avalanche

v0.3.0
dev.avakit/avalanche Checked 5 hours ago Published 8 days ago

Scaffold a dapp, deploy contracts and send contract calls (for example mint) on the Fuji testnet.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

list_templates List templates

List the Avalanche dapp templates available to scaffold_app.

scaffold_app Scaffold an Avalanche dapp

Create a new Avalanche dapp from a template (minimal, nft-mint, token-gated-app, erc20-token, icm-messenger, eerc-token, l1-launch, token-bridge). Wraps create-avalanche-app. Returns the created files, next steps, and `artifacts`: the paths of the project's compiled contracts, which deploy_contract and write_contract take as artifactPath — nothing has to be read or copied to deploy and call them. Each template supports only the chains list_templates shows for it — most are Fuji-only — and any other chain is refused. The project is created inside the server's working directory (or AVAKIT_…

ParameterTypeDescription
name *stringProject directory name, e.g. my-avax-app
chainstringMust be one of the template's chains (see list_templates). c-chain is mainnet.
directorystringParent directory for the project. Must be inside the server's working directory, which is also the default.
localbooleanOnly for developing AvaKit itself: links @avakit/* with workspace:*, so the app installs only inside the AvaKit monorepo. Leave unset.
templatestring

read_chain Read Avalanche chain data

Read a native AVAX balance, a transaction receipt, or a contract view/pure function over RPC. No key needed. For contractRead pass the contract's ABI the same way write_contract takes it: as artifactPath (one of the `artifacts` scaffold_app returned) or as abi (the JSON ABI, or just the function's signature). To change state (for example to mint) use write_contract.

ParameterTypeDescription
action *string
abiarrayFor contractRead, instead of artifactPath: the JSON ABI, or signatures such as ["function ownerOf(uint256 tokenId) view returns (address)"].
addressstringAddress for balance / contractRead
argsarrayThe function's arguments, in order. Pass large integers as decimal strings.
artifactPathstringPath to the contract's artifact file, relative to the server's working directory: one of the `artifacts` scaffold_app returned (e.g. my-app/lib/nft-artifact.ts), or a Foundry/Hardhat JSON artifact wit…
chainstring
functionNamestringFor contractRead: the view or pure function to read, e.g. "ownerOf". To pick between overloads, the full signature, e.g. "balanceOf(address,uint256)".
hashstringTx hash for txReceipt

estimate_gas Estimate gas

Estimate the gas a transaction (to / data / value) would use and report the current gas price and rough AVAX cost, over RPC. No key needed.

ParameterTypeDescription
to *stringRecipient / contract address (0x…)
chainstring
datastringCalldata (0x…)
fromstringSender address (0x…)
valuestringNative value in wei (decimal string)

deploy_contract Deploy a contract

Deploy a compiled contract to Avalanche and return its address, once the transaction has succeeded and there is code at that address. Pass the contract either as artifactPath (a file: one of the `artifacts` scaffold_app returned, or a Foundry/Hardhat JSON artifact) or as abi + bytecode — exactly one of the two; artifactPath means no bytecode has to be copied into the call. On the Fuji testnet (the default) no key is needed: when AVAKIT_DEPLOYER_KEY is not set, the server signs with a temporary session test wallet that exists only in its memory, works on Fuji only, and is funded from the AvaK…

ParameterTypeDescription
abiarrayWith bytecode, instead of artifactPath: the JSON ABI, or signatures such as ["constructor(address owner)"].
argsarrayConstructor arguments, in order. Pass large integers as decimal strings.
artifactPathstringPath to the contract's artifact file, relative to the server's working directory: one of the `artifacts` scaffold_app returned (e.g. my-app/lib/nft-artifact.ts), or a Foundry/Hardhat JSON artifact wit…
bytecodestringWith abi, instead of artifactPath: the creation bytecode (0x-prefixed).
chainstring
confirmbooleanRequired on mainnet (c-chain), together with AVAKIT_ALLOW_MAINNET=1 in the server environment. Not needed on Fuji.

write_contract Call a contract (state-changing)

Send a state-changing contract call — for example mint — and return once it has succeeded on chain. The call is simulated first: if it would revert, the revert reason is returned and nothing is sent. Give the ABI as artifactPath (the file deploy_contract took) or as abi, which can be just the function's signature, e.g. ["function mint() returns (uint256)"] — exactly one of the two. It calls only a contract this server deployed in this session (with deploy_contract, on the same chain) or one whose address AVAKIT_WRITE_ALLOWLIST lists in the server's environment (AVAKIT_WRITE_ALLOWLIST=* a…

ParameterTypeDescription
address *stringThe contract's address, e.g. the one deploy_contract returned: a contract this server deployed in this session, or one AVAKIT_WRITE_ALLOWLIST lists.
functionName *stringThe function to call, e.g. "mint". To pick between overloads, the full signature, e.g. "safeTransferFrom(address,address,uint256)".
abiarrayInstead of artifactPath: the JSON ABI, or signatures such as ["function mint() returns (uint256)"].
argsarrayThe function's arguments, in order. Pass large integers as decimal strings.
artifactPathstringPath to the contract's artifact file, relative to the server's working directory: one of the `artifacts` scaffold_app returned (e.g. my-app/lib/nft-artifact.ts), or a Foundry/Hardhat JSON artifact wit…
chainstring
confirmbooleanRequired on mainnet (c-chain), together with AVAKIT_ALLOW_MAINNET=1 in the server environment. Not needed on Fuji.
valuestringWei to send with a payable call (decimal string). Only with your own key (AVAKIT_DEPLOYER_KEY) on Fuji, and at most AVAKIT_MAX_VALUE AVAX (0.1 unless the server sets it): the session test wallet never…

wallet_status Wallet status

Show the wallet deploy_contract and write_contract would sign with on a chain, where it comes from ("session": the temporary Fuji test wallet; "env": your key in AVAKIT_DEPLOYER_KEY; "none": nothing to sign with), and its balance. Read-only: it sends nothing and never asks the faucet for funds. A session wallet with a zero balance is normal before its first transaction — the signing tools fund it when it cannot pay. On mainnet (c-chain) there is a wallet only when AVAKIT_DEPLOYER_KEY is set.

ParameterTypeDescription
chainstring

get_context Get AvaKit context

Return AvaKit + Avalanche context for coding: the API surface, conventions, doc links, and how deploying and minting work from this server (no key needed on Fuji; what mainnet needs).

ParameterTypeDescription
topicstringOptional focus topic