Skip to content

Commit

Permalink
Merge pull request OpenEmojiBattler#3 from tash-2s/set-endpoint
Browse files Browse the repository at this point in the history
Set endpoint and add message
  • Loading branch information
tash-2s committed Mar 24, 2021
2 parents 1be5dc1 + dada2e6 commit 71b053d
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 13 deletions.
4 changes: 2 additions & 2 deletions chain/scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"license": "Apache-2.0",
"scripts": {
"set-code:dev": "ts-node setCode.ts local",
"set-code:staging": "ts-node setCode.ts staging \"$OEB_STAGING_ADMIN_MNEMONIC\"",
"set-code:production": "ts-node setCode.ts production \"$OEB_PRODUCTION_ADMIN_MNEMONIC\"",
"set-code:staging": "ts-node setCode.ts staging \"$OEB_STAGING_ADMIN\"",
"set-code:production": "ts-node setCode.ts production \"$OEB_PRODUCTION_ADMIN\"",
"check-ts": "tsc -p . --noEmit"
},
"dependencies": {
Expand Down
10 changes: 6 additions & 4 deletions chain/scripts/setCode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@ import { tx, query, connected, getEnv } from "common"

const main = async () => {
const envName = process.argv[2]
const adminMnemonic = process.argv[3]
const admin = process.argv[3]

await cryptoWaitReady()

const keyring = new Keyring({ ss58Format: 42, type: "sr25519" })

const adminPair = adminMnemonic
? keyring.addFromMnemonic(adminMnemonic)
: keyring.addFromUri("//Alice")
if (!admin) {
console.log("Use Alice")
}

const adminPair = admin ? keyring.addFromMnemonic(admin) : keyring.addFromUri("//Alice")

const code = fs
.readFileSync(
Expand Down
2 changes: 1 addition & 1 deletion common/js/src/envs.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"endpoint": "wss://node-6769173380176625664.jm.onfinality.io/ws"
},
"production": {
"endpoint": "wss://node-6769103523900899328.jm.onfinality.io/ws"
"endpoint": "wss://node-6780467208130813952.jm.onfinality.io/ws"
}
}
4 changes: 2 additions & 2 deletions data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"license": "Apache-2.0",
"scripts": {
"seed:dev": "ts-node ./seed.ts local",
"seed:staging": "ts-node ./seed.ts staging \"$OEB_STAGING_ADMIN_MNEMONIC\"",
"seed:production": "ts-node ./seed.ts production \"$OEB_PRODUCTION_ADMIN_MNEMONIC\"",
"seed:staging": "ts-node ./seed.ts staging \"$OEB_STAGING_ADMIN\"",
"seed:production": "ts-node ./seed.ts production \"$OEB_PRODUCTION_ADMIN\"",
"lint": "prettier --write '*.{ts,json}'",
"check-ts": "tsc -p . --noEmit"
},
Expand Down
10 changes: 6 additions & 4 deletions data/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import availableEmoBaseIds from "./availableEmoBaseIds.json"

const main = async () => {
const envName = process.argv[2]
const adminMnemonic = process.argv[3]
const admin = process.argv[3]

await connected(getEnv(envName).endpoint, async () => {
const basesMap = new Map()
Expand All @@ -23,9 +23,11 @@ const main = async () => {
await cryptoWaitReady()
const keyring = new Keyring({ ss58Format: 42, type: "sr25519" })

const adminPair = adminMnemonic
? keyring.addFromMnemonic(adminMnemonic)
: keyring.addFromUri("//Alice")
if (!admin) {
console.log("Use Alice")
}

const adminPair = admin ? keyring.addFromMnemonic(admin) : keyring.addFromUri("//Alice")

const h = await sudo(
(t) => t.game.updateEmoBases(bases, fixedBaseIds, builtBaseIds, true),
Expand Down

0 comments on commit 71b053d

Please sign in to comment.