-
Notifications
You must be signed in to change notification settings - Fork 15
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
8 changed files
with
175 additions
and
131 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,89 +1,125 @@ | ||
import { MnemonicKey, MsgSend, Wallet } from "@initia/initia.js"; | ||
import { getConfig } from "config"; | ||
import { sendTx } from "lib/tx"; | ||
import { Coin, MnemonicKey, MsgSend, Wallet } from '@initia/initia.js'; | ||
import { delay } from 'bluebird'; | ||
import { getConfig } from 'config'; | ||
import { sendTx } from 'lib/tx'; | ||
import { TxBot } from 'test/utils/TxBot'; | ||
|
||
const config = getConfig(); | ||
const L1_FUNDER = new Wallet( | ||
config.l1lcd, | ||
new MnemonicKey({ | ||
mnemonic: '' | ||
}) | ||
) | ||
config.l1lcd, | ||
new MnemonicKey({ | ||
mnemonic: | ||
'recycle sight world spoon leopard shine dizzy before public use jungle either arctic detail hawk output option august hedgehog menu keen night work become' | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
}) | ||
); | ||
const L2_FUNDER = new Wallet( | ||
config.l2lcd, | ||
config.l2lcd, | ||
new MnemonicKey({ | ||
mnemonic: '' | ||
}) | ||
); | ||
|
||
async function fundL1() { | ||
const executor = new Wallet( | ||
config.l1lcd, | ||
new MnemonicKey({ mnemonic: config.EXECUTOR_MNEMONIC }) | ||
); | ||
const output = new Wallet( | ||
config.l1lcd, | ||
new MnemonicKey({ mnemonic: config.OUTPUT_SUBMITTER_MNEMONIC }) | ||
); | ||
const batch = new Wallet( | ||
config.l1lcd, | ||
new MnemonicKey({ mnemonic: config.BATCH_SUBMITTER_MNEMONIC }) | ||
); | ||
const challenger = new Wallet( | ||
config.l1lcd, | ||
new MnemonicKey({ mnemonic: config.CHALLENGER_MNEMONIC }) | ||
); | ||
const receiver = new Wallet( | ||
config.l1lcd, | ||
new MnemonicKey({ | ||
mnemonic: '' | ||
}) | ||
) | ||
|
||
async function fundL1(){ | ||
const executor = new Wallet(config.l1lcd, new MnemonicKey({mnemonic: config.EXECUTOR_MNEMONIC})) | ||
const output = new Wallet(config.l1lcd, new MnemonicKey({mnemonic: config.OUTPUT_SUBMITTER_MNEMONIC})) | ||
const batch = new Wallet(config.l1lcd, new MnemonicKey({mnemonic: config.BATCH_SUBMITTER_MNEMONIC})) | ||
const challenger = new Wallet(config.l1lcd, new MnemonicKey({mnemonic: config.CHALLENGER_MNEMONIC})) | ||
); | ||
|
||
const sendMsg = [ | ||
new MsgSend( | ||
L1_FUNDER.key.accAddress, | ||
executor.key.accAddress, | ||
"50000000000uinit" | ||
), | ||
new MsgSend( | ||
L1_FUNDER.key.accAddress, | ||
output.key.accAddress, | ||
"50000000000uinit" | ||
), | ||
new MsgSend( | ||
L1_FUNDER.key.accAddress, | ||
batch.key.accAddress, | ||
"50000000000uinit" | ||
), | ||
new MsgSend( | ||
L1_FUNDER.key.accAddress, | ||
challenger.key.accAddress, | ||
"50000000000uinit" | ||
) | ||
] | ||
await sendTx(L1_FUNDER, sendMsg); | ||
const sendMsg = [ | ||
new MsgSend( | ||
L1_FUNDER.key.accAddress, | ||
executor.key.accAddress, | ||
'50000000000uinit' | ||
), | ||
new MsgSend( | ||
L1_FUNDER.key.accAddress, | ||
output.key.accAddress, | ||
'50000000000uinit' | ||
), | ||
new MsgSend( | ||
L1_FUNDER.key.accAddress, | ||
batch.key.accAddress, | ||
'50000000000uinit' | ||
), | ||
new MsgSend( | ||
L1_FUNDER.key.accAddress, | ||
challenger.key.accAddress, | ||
'50000000000uinit' | ||
), | ||
new MsgSend( | ||
L1_FUNDER.key.accAddress, | ||
receiver.key.accAddress, | ||
'100000000000uinit' | ||
) | ||
]; | ||
await sendTx(L1_FUNDER, sendMsg); | ||
} | ||
|
||
async function fundL2(){ | ||
const executor = new Wallet(config.l2lcd, new MnemonicKey({mnemonic: config.EXECUTOR_MNEMONIC})) | ||
const output = new Wallet(config.l2lcd, new MnemonicKey({mnemonic: config.OUTPUT_SUBMITTER_MNEMONIC})) | ||
const batch = new Wallet(config.l2lcd, new MnemonicKey({mnemonic: config.BATCH_SUBMITTER_MNEMONIC})) | ||
const challenger = new Wallet(config.l2lcd, new MnemonicKey({mnemonic: config.CHALLENGER_MNEMONIC})) | ||
async function fundL2() { | ||
const executor = new Wallet( | ||
config.l2lcd, | ||
new MnemonicKey({ mnemonic: config.EXECUTOR_MNEMONIC }) | ||
); | ||
const output = new Wallet( | ||
config.l2lcd, | ||
new MnemonicKey({ mnemonic: config.OUTPUT_SUBMITTER_MNEMONIC }) | ||
); | ||
const batch = new Wallet( | ||
config.l2lcd, | ||
new MnemonicKey({ mnemonic: config.BATCH_SUBMITTER_MNEMONIC }) | ||
); | ||
const challenger = new Wallet( | ||
config.l2lcd, | ||
new MnemonicKey({ mnemonic: config.CHALLENGER_MNEMONIC }) | ||
); | ||
|
||
const sendMsg = [ | ||
new MsgSend(L2_FUNDER.key.accAddress, executor.key.accAddress, '1umin'), | ||
new MsgSend(L2_FUNDER.key.accAddress, output.key.accAddress, '1umin'), | ||
new MsgSend(L2_FUNDER.key.accAddress, batch.key.accAddress, '1umin'), | ||
new MsgSend(L2_FUNDER.key.accAddress, challenger.key.accAddress, '1umin') | ||
]; | ||
await sendTx(L2_FUNDER, sendMsg); | ||
} | ||
|
||
const sendMsg = [ | ||
new MsgSend( | ||
L2_FUNDER.key.accAddress, | ||
executor.key.accAddress, | ||
"1umin" | ||
), | ||
new MsgSend( | ||
L2_FUNDER.key.accAddress, | ||
output.key.accAddress, | ||
"1umin" | ||
), | ||
new MsgSend( | ||
L2_FUNDER.key.accAddress, | ||
batch.key.accAddress, | ||
"1umin" | ||
), | ||
new MsgSend( | ||
L2_FUNDER.key.accAddress, | ||
challenger.key.accAddress, | ||
"1umin" | ||
) | ||
] | ||
await sendTx(L2_FUNDER, sendMsg); | ||
async function startDepositTxBot() { | ||
const txBot = new TxBot(config.BRIDGE_ID); | ||
for (;;) { | ||
const res = await txBot.deposit( | ||
txBot.l1sender, | ||
txBot.l2sender, | ||
new Coin('uinit', 1_000_000) | ||
); | ||
console.log(`Deposited height ${res.height} ${res.txhash}`); | ||
await delay(10_000); | ||
} | ||
} | ||
|
||
async function main(){ | ||
// await fundL1(); | ||
// await fundL2(); | ||
console.log('Funded accounts'); | ||
async function main() { | ||
await startDepositTxBot(); | ||
// await fundL1(); | ||
// await fundL2(); | ||
console.log('Funded accounts'); | ||
} | ||
|
||
if (require.main === module) { | ||
main(); | ||
} | ||
main(); | ||
} |
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 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
Oops, something went wrong.
???