-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for new vara-testnet (#99)
Co-authored-by: Dmitry Osipov <[email protected]>
- Loading branch information
1 parent
052a2fa
commit 1ffb83e
Showing
24 changed files
with
453 additions
and
411 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
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
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -8,10 +8,10 @@ | |
"start:dev": "yarn workspace rosetta-api run start:dev", | ||
"start:offline": "yarn workspace rosetta-api run start:offline", | ||
"start:vara": "yarn workspace rosetta-api run start:vara", | ||
"start:vara-test": "yarn workspace rosetta-api run start:vara-test", | ||
"start:vara-testnet": "yarn workspace rosetta-api run start:vara-testnet", | ||
"watch:dev": "yarn workspace rosetta-api run watch:dev", | ||
"watch:vara": "yarn workspace rosetta-api run watch:vara", | ||
"watch:vara-test": "yarn workspace rosetta-api run watch:vara-test", | ||
"watch:vara-testnet": "yarn workspace rosetta-api run watch:vara-testnet", | ||
"watch:offline": "yarn workspace rosetta-api run watch:offline" | ||
}, | ||
"packageManager": "[email protected]", | ||
|
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
This file was deleted.
Oops, something went wrong.
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,2 @@ | ||
0x525639f713f397dcf839bd022cd821f367ebcf179de7b9253531f8adbe5436d6 | ||
1000 |
This file was deleted.
Oops, something went wrong.
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 @@ | ||
[supervisord] | ||
nodaemon=true | ||
|
||
[program:gear-testnet] | ||
directory=/opt/rosetta-api | ||
command=/usr/local/bin/gear --base-path /data/ --chain /opt/vara-testnet.json --unsafe-ws-external --unsafe-rpc-external --rpc-methods Unsafe --rpc-cors all --pruning archive --name=gear-vara | ||
|
||
[program:rosetta] | ||
directory=/opt/rosetta-api | ||
command=yarn start:vara-testnet --update-config --ws ws://localhost:9944 --http http://localhost:9933 |
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
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 |
---|---|---|
@@ -1,21 +1,42 @@ | ||
const { ApiPromise } = require('@polkadot/api'); | ||
const { Keyring } = require('@polkadot/keyring'); | ||
|
||
|
||
const main = async () => { | ||
const api = await ApiPromise.create(); | ||
const keyring = new Keyring(); | ||
const alice = keyring.addFromUri('//Alice', {}, 'sr25519'); | ||
const bob = keyring.addFromUri('//Bob', {}, 'sr25519'); | ||
|
||
await api.tx.balances.transferKeepAlive('5HChDnRNd2xn7rGsbJNqJrV5NmpALVKTY9YC2Zzeyu5rjzqC', 100000).signAndSend(alice) | ||
await api.tx.balances.transferKeepAlive('5GDCKqWHVg6NG9RQeKQjAQ7t9Pc94UZ3FsxRDCNyesUudi8Y', 100000).signAndSend(bob) | ||
} | ||
const tx = api.tx.utility.batchAll([ | ||
api.tx.balances.transferKeepAlive('kGkfymFqB4aBVunXCW69EzQRDtkZkUQB44GB4XJnwNwqmWyRN', 1000 * 10 ** 12), | ||
api.tx.balances.transferKeepAlive('kGjgUsJv5wDK645fjZ7B8qx42fNMjCPQdmzbHhwBG3vEpQhij', 100 * 10 ** 12), | ||
]); | ||
|
||
await new Promise((resolve, reject) => | ||
tx.signAndSend(alice, ({ events, status }) => { | ||
if (status.isInBlock) { | ||
const transferEvents = events.filter( | ||
({ event: { method, section } }) => section === 'balances' && method === 'Transfer', | ||
); | ||
|
||
if (transferEvents.length > 0) { | ||
transferEvents.forEach((transferEvent) => { | ||
const [from, to, amount] = transferEvent.event.data; | ||
console.log(`${from} transfered ${amount} to ${to}`); | ||
}); | ||
} else { | ||
console.log('No transfer event found'); | ||
} | ||
} else if (status.isFinalized) { | ||
resolve('Finalized'); | ||
} | ||
}), | ||
); | ||
}; | ||
|
||
main() | ||
.then(() => process.exit(0)) | ||
.catch((error) => { | ||
console.log(error); | ||
console.log(error); | ||
process.exit(1); | ||
}); | ||
|
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
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