Install
openclaw skills install @api3dao/api3-data-feed-purchasePurchases Api3 data feed subscriptions from market.api3.org.
openclaw skills install @api3dao/api3-data-feed-purchase| Variable | Description |
|---|---|
DAPI_NAME | Exact feed name from the dAPI list (e.g. ETH/USD) |
CHAIN_ALIAS | Chain alias from the chain list (e.g. ethereum) |
CHAIN_NAME | Human-readable chain name (e.g. Ethereum Mainnet) |
CHAIN_ID | Numeric chain ID (e.g. 1) |
DEVIATION | Deviation threshold — must be exactly one of: 0.25, 0.5, 1, 2.5, 5 |
PROXY_ADDRESS | Reader proxy contract address — starts with 0x, exactly 42 characters |
node_modules/, pnpm-lock.yaml, or pnpm-workspace.yaml,they are not needed for this skill nor relevant to the user.exec tool to run commands. Never use Bash or shell directly.{baseDir} (the directory named by the name field at the top of this file). Prefix every command with cd {baseDir} && to ensure it runs from the correct directory.exec command before running it.<CHAIN_ALIAS> and the feed/token symbol (e.g. the base of <DAPI_NAME>) when substituting them into market.api3.org URL paths (e.g. https://market.api3.org/ethereum/eth-usd/integrate), even if the confirmed values are stored/displayed with different casing.@api3/dapi-management@openzeppelin/merkle-treedotenvetherspnpm install. Wait for an affirmative response. Once approved, run the command regardless of whether packages may already be installed:exec command="cd {baseDir} && pnpm install"
ETH/USD). Direct them to https://market.api3.org to browse available feeds.ethereum).0.25, 0.5, 1, 2.5, 5 (percent).get-dapis.ts and get-chains.ts to fetch the list of available feeds and supported chains:exec command="cd {baseDir} && ts-node scripts/get-dapis.ts"
exec command="cd {baseDir} && ts-node scripts/get-chains.ts"
Validate DAPI_NAME:
get-dapis.ts for an entry matching the user's feed name exactly (case-insensitive).DAPI_NAME to the exact string from the list (preserve its casing) and confirm the matched value to the user.Validate CHAIN_ALIAS:
get-chains.ts — first by alias field (case-insensitive), then by name field.CHAIN_ALIAS, CHAIN_NAME, CHAIN_ID from that entry. Confirm the match with the user and ask if it is correct. If not, ask them to re-enter and repeat this step.Validate DEVIATION:
0.25, 0.5, 1, 2.5, 5.DEVIATION.<DAPI_NAME><CHAIN_NAME><DEVIATION>%explore-data-feeds.ts, which fetches each provider's Signed API data and decodes the live value for this feed directly:exec command="cd {baseDir} && ts-node scripts/explore-data-feeds.ts <DAPI_NAME>"
quote.ts to fetch the live subscription price for the selected feed, chain, and deviation:exec command="cd {baseDir} && ts-node scripts/quote.ts <CHAIN_ID> <DAPI_NAME> <DEVIATION>"
Extract and show these fields from the output:
| Field | Label to show |
|---|---|
| dAPI | Feed |
| Chain | Chain |
| Deviation | Deviation Threshold |
| Duration | Subscription Duration (seconds) |
| Price | Subscription Price (ETH) |
| Amount to send | Amount to Send (ETH) |
| Sponsor wallet | Sponsor Wallet |
If the amount to send is lower than the subscription price, explain that the sponsor wallet already holds funds, so only the difference needs to be sent.
Ask the user to confirm that they want to proceed with these options. If yes, proceed to Phase 5. If no, ask the user what they want to do.
buy.ts, which will execute a blockchain transaction to purchase the subscription.WALLET_MNEMONIC environment variable to sign the transaction. Make sure the user has WALLET_MNEMONIC set in .env file in the root of this skill..env file is ready with the correct mnemonic and if they want you to run the purchase script. Wait for an affirmative response before proceeding. Then run the following command if answer is affirmative:(substitute actual variable values when running):
exec command="cd {baseDir} && ts-node scripts/buy.ts <CHAIN_ID> <DAPI_NAME> <DEVIATION>"
Invalid root error, this means either Api3 Market (https://market.api3.org/) is closed due to ongoing integrations or skill is out of date and user should download the latest version of this skill.Confirmed: line of the output and show the purchase summary: feed, chain, deviation, subscription duration, and transaction hash./ replaced by ->/integrate0x.PROXY_ADDRESS to the valid value.read-data-feed.ts to fetch the latest value and timestamp from the proxy contract:exec command="cd {baseDir} && ts-node scripts/read-data-feed.ts <PROXY_ADDRESS> <CHAIN_ALIAS>"