clients.dispenser_api_client
Attributes
Section titled “Attributes”DISPENSER_ASSETS | |
|---|---|
DISPENSER_REQUEST_TIMEOUT | |
DISPENSER_ACCESS_TOKEN_KEY |
Classes
Section titled “Classes”DispenserApiConfig | |
|---|---|
DispenserAssetName | Enum where members are also (and must be) ints |
DispenserAsset | |
DispenserFundResponse | |
DispenserLimitResponse | |
TestNetDispenserApiClient | Client for interacting with the AlgoKit TestNet Dispenser API. |
Module Contents
Section titled “Module Contents”class algokit_utils.clients.dispenser_api_client.DispenserApiConfig
Section titled “class algokit_utils.clients.dispenser_api_client.DispenserApiConfig”BASE*URL *= ‘https://api.dispenser.algorandfoundation.tools’_
Section titled “BASE*URL *= ‘https://api.dispenser.algorandfoundation.tools’_”class algokit_utils.clients.dispenser_api_client.DispenserAssetName
Section titled “class algokit_utils.clients.dispenser_api_client.DispenserAssetName”Bases: enum.IntEnum
Enum where members are also (and must be) ints
ALGO = 0
Section titled “ALGO = 0”class algokit_utils.clients.dispenser_api_client.DispenserAsset
Section titled “class algokit_utils.clients.dispenser_api_client.DispenserAsset”asset*id *: int_
Section titled “asset*id *: int_”The ID of the asset
decimals : int
Section titled “decimals : int”The amount of decimal places the asset was created with
description : str
Section titled “description : str”The description of the asset
class algokit_utils.clients.dispenser_api_client.DispenserFundResponse
Section titled “class algokit_utils.clients.dispenser_api_client.DispenserFundResponse”tx*id *: str_
Section titled “tx*id *: str_”The transaction ID of the funded transaction
amount : int
Section titled “amount : int”The amount of Algos funded
class algokit_utils.clients.dispenser_api_client.DispenserLimitResponse
Section titled “class algokit_utils.clients.dispenser_api_client.DispenserLimitResponse”amount : int
Section titled “amount : int”The amount of Algos that can be funded
algokit_utils.clients.dispenser_api_client.DISPENSER_ASSETS
Section titled “algokit_utils.clients.dispenser_api_client.DISPENSER_ASSETS”algokit*utils.clients.dispenser_api_client.DISPENSER_REQUEST_TIMEOUT *= 15_
Section titled “algokit*utils.clients.dispenser_api_client.DISPENSER_REQUEST_TIMEOUT *= 15_”algokitutils.clients.dispenser_api_client.DISPENSER_ACCESS_TOKEN_KEY = ‘ALGOKITDISPENSER_ACCESS_TOKEN’
Section titled “algokitutils.clients.dispenser_api_client.DISPENSER_ACCESS_TOKEN_KEY = ‘ALGOKITDISPENSER_ACCESS_TOKEN’”class algokit_utils.clients.dispenser_api_client.TestNetDispenserApiClient(auth_token: str | None = None, request_timeout: int = DISPENSER_REQUEST_TIMEOUT)
Section titled “class algokit_utils.clients.dispenser_api_client.TestNetDispenserApiClient(auth_token: str | None = None, request_timeout: int = DISPENSER_REQUEST_TIMEOUT)”Client for interacting with the AlgoKit TestNet Dispenser API. To get started create a new access token via algokit dispenser login –ci and pass it to the client constructor as auth_token. Alternatively set the access token as environment variable ALGOKIT_DISPENSER_ACCESS_TOKEN, and it will be auto loaded. If both are set, the constructor argument takes precedence.
Default request timeout is 15 seconds. Modify by passing request_timeout to the constructor.
auth*token *: str_
Section titled “auth*token *: str_”request*timeout *= 15_
Section titled “request*timeout *= 15_”fund(address: str, amount: int) → DispenserFundResponse
Section titled “fund(address: str, amount: int) → DispenserFundResponse”fund(address: str, amount: int, asset_id: int | None = None) → DispenserFundResponse
Section titled “fund(address: str, amount: int, asset_id: int | None = None) → DispenserFundResponse”Fund an account with Algos from the dispenser API
- Parameters:
- address – The address to fund
- amount – The amount of Algos to fund
- asset_id – The asset ID to fund (deprecated)
- Returns: The transaction ID of the funded transaction
- Raises: Exception – If the dispenser API request fails
- Example:
dispenser_client = TestNetDispenserApiClient()dispenser_client.fund(address="SENDER_ADDRESS", amount=1000000)
refund(refund_txn_id: str) → None
Section titled “refund(refund_txn_id: str) → None”Register a refund for a transaction with the dispenser API
get_limit(address: str) → DispenserLimitResponse
Section titled “get_limit(address: str) → DispenserLimitResponse”Get current limit for an account with Algos from the dispenser API