TestNetDispenserApiClient
Defined in: src/dispenser-client.ts:73
TestNetDispenserApiClient is a class that provides methods to interact with the Algorand TestNet Dispenser API.
It allows you to fund an address with Algo, refund a transaction, and get the funding limit for the Algo asset.
The class requires an authentication token and a request timeout to be initialized. The authentication token can be provided
either directly as a parameter or through an ALGOKIT_DISPENSER_ACCESS_TOKEN environment variable. If neither is provided, an error is thrown.
The request timeout can be provided as a parameter. If not provided, a default value is used.
Example
Section titled “Example”const client = new TestNetDispenserApiClient({ authToken: 'your_auth_token', requestTimeout: 30 });const fundResponse = await client.fund('your_address', 100);const limitResponse = await client.getLimit();await client.refund('your_transaction_id');Throws
Section titled “Throws”If neither the environment variable ‘ALGOKIT_DISPENSER_ACCESS_TOKEN’ nor the authToken parameter were provided.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new TestNetDispenserApiClient(
params?):TestNetDispenserApiClient
Defined in: src/dispenser-client.ts:77
Parameters
Section titled “Parameters”params?
Section titled “params?”TestNetDispenserApiClientParams
Returns
Section titled “Returns”TestNetDispenserApiClient
Accessors
Section titled “Accessors”authToken
Section titled “authToken”Get Signature
Section titled “Get Signature”get authToken():
string
Defined in: src/dispenser-client.ts:93
Returns
Section titled “Returns”string
The authentication token used for API requests.
requestTimeout
Section titled “requestTimeout”Get Signature
Section titled “Get Signature”get requestTimeout():
number
Defined in: src/dispenser-client.ts:97
Returns
Section titled “Returns”number
The timeout for API requests, in seconds.
Methods:
fund- Sends a funding request to the dispenser API to fund the specified address with the given amount of Algo.refund- Sends a refund request to the dispenser API for the specified refundTxnId.limit- Sends a request to the dispenser API to get the funding limit for the Algo asset.
Methods
Section titled “Methods”fund()
Section titled “fund()”fund(
address,amount):Promise<DispenserFundResponse>
Defined in: src/dispenser-client.ts:159
Sends a funding request to the dispenser API to fund the specified address with the given amount of Algo.
Parameters
Section titled “Parameters”address
Section titled “address”The address to fund.
string | Address
amount
Section titled “amount”The amount of µAlgo to fund.
number | bigint
Returns
Section titled “Returns”Promise<DispenserFundResponse>
DispenserFundResponse: An object containing the transaction ID and funded amount.
getLimit()
Section titled “getLimit()”getLimit():
Promise<DispenserLimitResponse>
Defined in: src/dispenser-client.ts:189
Sends a request to the dispenser API to get the funding limit for the Algo asset.
Returns
Section titled “Returns”Promise<DispenserLimitResponse>
DispenserLimitResponse: An object containing the funding limit amount.
refund()
Section titled “refund()”refund(
refundTxnId):Promise<void>
Defined in: src/dispenser-client.ts:180
Sends a refund request to the dispenser API for the specified refundTxnId.
Parameters
Section titled “Parameters”refundTxnId
Section titled “refundTxnId”string
The transaction ID to refund.
Returns
Section titled “Returns”Promise<void>