swapTester.ts 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import {
  2. AccAddress,
  3. LCDClient,
  4. MnemonicKey,
  5. MsgExecute,
  6. Wallet,
  7. } from '@initia/initia.js'
  8. import { InitiaClient } from './InitiaClient'
  9. import toHex = AccAddress.toHex
  10. const key = new MnemonicKey({
  11. mnemonic:
  12. // 'visual giant rely tooth recall explain vital tunnel snow road airport cake',
  13. // 'deal earth suggest craft impact vocal outdoor perfect winter nice unhappy lizard',
  14. // 'pumpkin frog pond gauge cat essay key employ shoulder keen stomach breeze history urge duty drink leisure crash genuine acid describe erosion ugly raise',
  15. 'neutral flight plug goddess marble champion message bottom gentle guilt ketchup way guide obey nominee panda sleep meadow scene sea fine cause upgrade only',
  16. })
  17. console.log('mnemonic:', key.mnemonic)
  18. // mnemonic: beauty sniff protect...
  19. console.log('account address:', key.accAddress)
  20. // account address: init10m5nnevplkzvv5svqf0xjx6dc4705u5dxfn2st
  21. const lcd = new LCDClient('https://api-initia-testnet.whispernode.com/', {
  22. chainId: 'initiation-1',
  23. })
  24. // const wallet = new Wallet(lcd, key)
  25. // const msg = new MsgExecute(
  26. // key.accAddress,
  27. // '0x1',
  28. // 'dex',
  29. // 'swap_script',
  30. // [],
  31. // [
  32. // 'sTSuZ4bxDvdClOYn0lGbY7fHQqZzX5hoKSn+qahHRNI=',
  33. // 'jkczvavPfUr8PRTw3UbJv1L7D86eS5lsk54ZW4vIkdk=',
  34. // 'QEIPAAAAAAA=',
  35. // 'AdWGAQAAAAAA',
  36. // ],
  37. // )
  38. async function main() {
  39. const client = new InitiaClient(key.mnemonic, false)
  40. // await client.nameRegister()
  41. // await client.drawFood()
  42. // const a = await client.newBridge2Miniwasm()
  43. // console.log(a)
  44. // await client.transferGas('init1yq7erc0hmemy7exhycdqx8j05jj46g0hgycw5g', 0.2)
  45. // await client.mintPart()
  46. const res = await client.week5Task1()
  47. // const res = ((new Date().valueOf() + 1500000) * 1000000).toString()
  48. console.log(res)
  49. // console.log(`1718639224520000000`)
  50. // 1718638714100000000
  51. }
  52. const target = '0x76622C9877947A6EEBaBba6898FAf6C57Ea2dfC8'
  53. async function hex() {
  54. console.log(toHex(key.accAddress))
  55. }
  56. // hex()
  57. main()