{"version":3,"sources":["../../src/api/faucet.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { fundAccount } from \"../internal/faucet\";\nimport { UserTransactionResponse, WaitForTransactionOptions } from \"../types\";\nimport { AccountAddressInput } from \"../core\";\nimport { AptosConfig } from \"./aptosConfig\";\nimport { waitForIndexer } from \"../internal/transaction\";\n\n/**\n * A class to query all `Faucet` related queries on Aptos.\n */\nexport class Faucet {\n  constructor(readonly config: AptosConfig) {}\n\n  /**\n   * This creates an account if it does not exist and mints the specified amount of\n   * coins into that account\n   *\n   * @example\n   * const transaction = await aptos.fundAccount({accountAddress:\"0x123\", amount: 100})\n   *\n   * @param args.accountAddress Address of the account to fund\n   * @param args.amount Amount of tokens to fund the account with\n   * @param args.options Configuration options for waitForTransaction\n   * @returns Transaction hash of the transaction that funded the account\n   */\n  async fundAccount(args: {\n    accountAddress: AccountAddressInput;\n    amount: number;\n    options?: WaitForTransactionOptions;\n  }): Promise<UserTransactionResponse> {\n    const fundTxn = await fundAccount({ aptosConfig: this.config, ...args });\n\n    if (args.options?.waitForIndexer !== false) {\n      await waitForIndexer({ aptosConfig: this.config, minimumLedgerVersion: BigInt(fundTxn.version) });\n    }\n\n    return fundTxn;\n  }\n}\n"],"mappings":"kFAYO,IAAMA,EAAN,KAAa,CAClB,YAAqBC,EAAqB,CAArB,YAAAA,CAAsB,CAc3C,MAAM,YAAYC,EAImB,CACnC,IAAMC,EAAU,MAAMC,EAAY,CAAE,YAAa,KAAK,OAAQ,GAAGF,CAAK,CAAC,EAEvE,OAAIA,EAAK,SAAS,iBAAmB,IACnC,MAAMG,EAAe,CAAE,YAAa,KAAK,OAAQ,qBAAsB,OAAOF,EAAQ,OAAO,CAAE,CAAC,EAG3FA,CACT,CACF","names":["Faucet","config","args","fundTxn","fundAccount","waitForIndexer"]}