-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
73 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
[settings] | ||
timeout = 1000 | ||
|
||
[relaychain] | ||
chain = "rococo-local" | ||
command = "polkadot" | ||
|
||
[[relaychain.nodes]] | ||
name = "alice" | ||
validator = true | ||
|
||
[[relaychain.nodes]] | ||
name = "bob" | ||
validator = true | ||
|
||
[[parachains]] | ||
id = 2000 | ||
addToGenesis = false | ||
|
||
[parachains.collator] | ||
name = "regionx-collator01" | ||
command = "regionx-node" | ||
args = [ "-lruntime=debug,parachain=trace" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Description: Native currency fee payment | ||
Network: ./0002-native-fee-payment-test.toml | ||
Creds: config | ||
|
||
alice: is up | ||
bob: is up | ||
|
||
alice: parachain 2000 is registered within 225 seconds | ||
|
||
regionx-collator01: js-script ./0002-native-transfer.js return is 0 within 200 seconds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
const BOB = "5HpG9w8EBLe5XCrbczpwq5TSXvedjrBGCwqxK1iQ7qUsSWFc"; | ||
|
||
async function run(nodeName, networkInfo, _jsArgs) { | ||
const { wsUri, userDefinedTypes } = networkInfo.nodesByName[nodeName]; | ||
const api = await zombie.connect(wsUri, userDefinedTypes); | ||
|
||
await zombie.util.cryptoWaitReady(); | ||
|
||
// account to submit tx | ||
const keyring = new zombie.Keyring({ type: "sr25519" }); | ||
const alice = keyring.addFromUri("//Alice"); | ||
|
||
const call = api.tx.balances.transferKeepAlive(BOB, 10n**6n); | ||
const sudo = api.tx.sudo.sudo(call); | ||
|
||
await new Promise(async (resolve, reject) => { | ||
const unsub = await sudo.signAndSend(alice, (result) => { | ||
console.log(`Current status is ${result.status}`); | ||
if (result.status.isInBlock) { | ||
console.log( | ||
`Transaction included at blockHash ${result.status.asInBlock}` | ||
); | ||
} else if (result.status.isFinalized) { | ||
console.log( | ||
`Transaction finalized at blockHash ${result.status.asFinalized}` | ||
); | ||
unsub(); | ||
return resolve(); | ||
} else if (result.isError) { | ||
console.log(`Transaction error`); | ||
unsub(); | ||
return resolve(); | ||
} | ||
}); | ||
}); | ||
|
||
return 0; | ||
} | ||
|
||
module.exports = { run }; |