PHP WebShell

Текущая директория: /opt/BitGoJS/node_modules/@aptos-labs/ts-sdk/dist/esm

Просмотр файла: chunk-VIZHWYI5.mjs.map

{"version":3,"sources":["../../src/internal/faucet.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This file contains the underlying implementations for exposed API surface in\n * the {@link api/faucet}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * faucet namespace and without having a dependency cycle error.\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { postAptosFaucet } from \"../client\";\nimport { AccountAddress, AccountAddressInput } from \"../core\";\nimport { TransactionResponseType, UserTransactionResponse, WaitForTransactionOptions } from \"../types\";\nimport { DEFAULT_TXN_TIMEOUT_SEC } from \"../utils/const\";\nimport { waitForTransaction } from \"./transaction\";\n\n/**\n * Funds an account with a specified amount of tokens from the Aptos faucet.\n * This function is useful for quickly providing a new or existing account with tokens to facilitate transactions.\n *\n * @param args - The arguments for funding the account.\n * @param args.aptosConfig - The configuration settings for connecting to the Aptos network.\n * @param args.accountAddress - The address of the account to be funded.\n * @param args.amount - The amount of tokens to fund the account with.\n * @param args.options - Optional parameters for the transaction.\n * @param args.options.timeoutSecs - The maximum time to wait for the transaction to complete, in seconds.\n * @param args.options.checkSuccess - A flag indicating whether to check if the transaction was successful.\n *\n * @throws Error if the transaction does not return a user transaction type.\n */\nexport async function fundAccount(args: {\n  aptosConfig: AptosConfig;\n  accountAddress: AccountAddressInput;\n  amount: number;\n  options?: WaitForTransactionOptions;\n}): Promise<UserTransactionResponse> {\n  const { aptosConfig, accountAddress, amount, options } = args;\n  const timeout = options?.timeoutSecs || DEFAULT_TXN_TIMEOUT_SEC;\n  const { data } = await postAptosFaucet<any, { txn_hashes: Array<string> }>({\n    aptosConfig,\n    path: \"fund\",\n    body: {\n      address: AccountAddress.from(accountAddress).toString(),\n      amount,\n    },\n    originMethod: \"fundAccount\",\n  });\n\n  const txnHash = data.txn_hashes[0];\n\n  const res = await waitForTransaction({\n    aptosConfig,\n    transactionHash: txnHash,\n    options: {\n      timeoutSecs: timeout,\n      checkSuccess: options?.checkSuccess,\n    },\n  });\n\n  // Response is always User transaction for a user submitted transaction\n  if (res.type === TransactionResponseType.User) {\n    return res;\n  }\n\n  throw new Error(`Unexpected transaction received for fund account: ${res.type}`);\n}\n"],"mappings":"oKA+BA,eAAsBA,EAAYC,EAKG,CACnC,GAAM,CAAE,YAAAC,EAAa,eAAAC,EAAgB,OAAAC,EAAQ,QAAAC,CAAQ,EAAIJ,EACnDK,EAAUD,GAAS,aAAe,GAClC,CAAE,KAAAE,CAAK,EAAI,MAAMC,EAAoD,CACzE,YAAAN,EACA,KAAM,OACN,KAAM,CACJ,QAASO,EAAe,KAAKN,CAAc,EAAE,SAAS,EACtD,OAAAC,CACF,EACA,aAAc,aAChB,CAAC,EAEKM,EAAUH,EAAK,WAAW,CAAC,EAE3BI,EAAM,MAAMC,EAAmB,CACnC,YAAAV,EACA,gBAAiBQ,EACjB,QAAS,CACP,YAAaJ,EACb,aAAcD,GAAS,YACzB,CACF,CAAC,EAGD,GAAIM,EAAI,OAAS,mBACf,OAAOA,EAGT,MAAM,IAAI,MAAM,qDAAqDA,EAAI,IAAI,EAAE,CACjF","names":["fundAccount","args","aptosConfig","accountAddress","amount","options","timeout","data","postAptosFaucet","AccountAddress","txnHash","res","waitForTransaction"]}

Выполнить команду


Для локальной разработки. Не используйте в интернете!