swapTester.ts 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. 'language tooth rug border arm essence badge rough ahead unaware bag night stay auto spawn february odor equip hub demand three setup used sentence',
  15. // 'camp rural essay together right oblige shine visa sketch garage legal crush argue calm soup egg forum luxury action cupboard fade myth gospel confirm',
  16. // 'neutral flight plug goddess marble champion message bottom gentle guilt ketchup way guide obey nominee panda sleep meadow scene sea fine cause upgrade only',
  17. })
  18. console.log('mnemonic:', key.mnemonic)
  19. // mnemonic: beauty sniff protect...
  20. console.log('account address:', key.accAddress)
  21. // account address: init10m5nnevplkzvv5svqf0xjx6dc4705u5dxfn2st
  22. const lcd = new LCDClient('https://api-initia-testnet.whispernode.com/', {
  23. chainId: 'initiation-1',
  24. })
  25. // const wallet = new Wallet(lcd, key)
  26. // const msg = new MsgExecute(
  27. // key.accAddress,
  28. // '0x1',
  29. // 'dex',
  30. // 'swap_script',
  31. // [],
  32. // [
  33. // 'sTSuZ4bxDvdClOYn0lGbY7fHQqZzX5hoKSn+qahHRNI=',
  34. // 'jkczvavPfUr8PRTw3UbJv1L7D86eS5lsk54ZW4vIkdk=',
  35. // 'QEIPAAAAAAA=',
  36. // 'AdWGAQAAAAAA',
  37. // ],
  38. // )
  39. async function main() {
  40. const client = new InitiaClient(key.mnemonic, false)
  41. // await client.nameRegister()
  42. // await client.drawFood()
  43. // const a = await client.newBridge2Miniwasm()
  44. // console.log(a)
  45. // await client.transferGas('init1yq7erc0hmemy7exhycdqx8j05jj46g0hgycw5g', 0.2)
  46. // await client.mintPart()
  47. const res = await client.week6task1()
  48. // const res = ((new Date().valueOf() + 1500000) * 1000000).toString()
  49. console.log(res)
  50. // console.log(`1718639224520000000`)
  51. // 1718638714100000000
  52. }
  53. const target = '0x76622C9877947A6EEBaBba6898FAf6C57Ea2dfC8'
  54. async function hex() {
  55. console.log(toHex(key.accAddress))
  56. }
  57. // hex()
  58. main()