swapTester.ts 941 B

123456789101112131415161718192021222324252627282930313233343536
  1. import { LCDClient, MnemonicKey, MsgExecute, Wallet } from '@initia/initia.js'
  2. import { InitiaClient } from './initiaClient'
  3. const key = new MnemonicKey({
  4. mnemonic:
  5. 'deal earth suggest craft impact vocal outdoor perfect winter nice unhappy lizard',
  6. })
  7. console.log('mnemonic:', key.mnemonic)
  8. // mnemonic: beauty sniff protect...
  9. console.log('account address:', key.accAddress)
  10. // account address: init10m5nnevplkzvv5svqf0xjx6dc4705u5dxfn2st
  11. const lcd = new LCDClient('https://api-initia-testnet.whispernode.com/', {
  12. chainId: 'initiation-1',
  13. })
  14. const wallet = new Wallet(lcd, key)
  15. const msg = new MsgExecute(
  16. key.accAddress,
  17. '0x1',
  18. 'dex',
  19. 'swap_script',
  20. [],
  21. [
  22. 'sTSuZ4bxDvdClOYn0lGbY7fHQqZzX5hoKSn+qahHRNI=',
  23. 'jkczvavPfUr8PRTw3UbJv1L7D86eS5lsk54ZW4vIkdk=',
  24. 'QEIPAAAAAAA=',
  25. 'AdWGAQAAAAAA',
  26. ],
  27. )
  28. async function main() {
  29. const client = new InitiaClient(key.mnemonic)
  30. await client.stakeInit()
  31. }
  32. main()