test.ts 903 B

1234567891011121314151617181920212223242526272829303132333435
  1. import { getCaptcha } from './faucet/recaptcha'
  2. import { faucetAccount } from './faucet/faucet'
  3. import { MnemonicKey } from '@initia/initia.js'
  4. import { InitiaClient } from './InitiaClient'
  5. import polly from 'polly-js'
  6. import { DBClient } from './singletons'
  7. // await polly()
  8. // .waitAndRetry(4)
  9. // .executeForPromise(async () => {
  10. // const key = new MnemonicKey()
  11. // console.log(key.accAddress)
  12. // console.log(key.mnemonic)
  13. // await faucetAccount(key.accAddress)
  14. // })
  15. async function createAccounts(count: number) {
  16. const accounts = []
  17. for (let i = 0; i < count; i++) {
  18. console.log(`creating account ${i}/${count}`)
  19. const key = new MnemonicKey()
  20. const account = {
  21. mnemonic: key.mnemonic,
  22. address: key.accAddress,
  23. }
  24. accounts.push(account)
  25. }
  26. await DBClient.instance.account.createMany({ data: accounts })
  27. }
  28. await createAccounts(20000)