Bucket SDK
SkillDev toolsUse when integrating Bucket Protocol on Sui with @bucket-protocol/sdk: CDP position updates, USDB mint and repay, PSM swaps, saving pools, flash mint, oracle prices, and protocol state queries.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the Bucket SDK skill
What this skill tells your AI
The instructions your AI receives, as published by bucket-protocol/bucket-protocol-sdk in skill/bucket-sdk/SKILL.md and read by ahel’s review.
Use this skill whenever the task touches @bucket-protocol/sdk.
Official docs:
Trigger Scope
Use for:
- Building PTBs with
buildManagePositionTransaction,buildPSMSwapInTransaction, saving pool builders, or flash mint. - Querying collateral, pool, oracle, position, account, or reward data.
- Debugging Bucket integration issues (
Unsupported collateral type, price feed issues, pool balance checks).
Do not use for:
- Generic Sui SDK tasks that do not involve Bucket Protocol.
Fast Workflow
- Initialize client:
import { BucketClient } from '@bucket-protocol/sdk';
const client = await BucketClient.initialize({ network: 'mainnet' });
- Resolve live types (never assume static lists):
const usdbType = await client.getUsdbCoinType();
const collateralTypes = await client.getAllCollateralTypes();
const oracleTypes = await client.getAllOracleCoinTypes();
const psmTypes = Object.keys(await client.getAllPsmPoolObjects());
const savingLpTypes = Object.keys(await client.getAllSavingPoolObjects());
- Build PTB commands on
Transaction, then sign and execute separately. - For unsupported user input, validate against live lists/maps first and return a clear error.
- If config may be stale (protocol upgrade), call
await client.refreshConfig().
Coin Type Policy
Keep context small. Do not paste long coin-type tables unless explicitly requested.
Rules:
- CDP
coinTypemust come fromgetAllCollateralTypes(). - PSM
coinTypemust come from keys ofgetAllPsmPoolObjects(). - Saving
lpTypemust come from keys ofgetAllSavingPoolObjects(). - Oracle price queries should use
getAllOracleCoinTypes()when possible. - Use
references/coin-types.mdonly when the user asks for static literals.
Core Behavior Notes
- All write methods are PTB builders (
build*): they append Move calls, not execute transactions. - Amounts are raw integers (smallest unit). No auto decimal scaling.
- Most config-dependent methods are async; always
await. buildManagePositionTransactionauto-aggregates prices when borrow or withdraw is requested.accountObjectOrIdswitches from EOA mode to Bucket Account mode.
Default Implementation Skeleton
Use this shape unless the user asks for another architecture:
import { BucketClient } from '@bucket-protocol/sdk';
import { Transaction } from '@mysten/sui/transactions';
const client = await BucketClient.initialize({ network: 'mainnet' });
const tx = new Transaction();
// validate types from live config here
// append build* commands here
tx.setSender(address);
await client.getSuiClient().signAndExecuteTransaction({ signer, transaction: tx });
If user asks for simulation only, use simulateTransaction after setting sender.
Method Map
Query methods:
getUsdbSupply,getAllVaultObjects,getAllPsmPoolObjects,getAllSavingPoolObjectsgetUserPositions,getUserSavings,getUserAccountsgetOraclePrices,getAllOraclePrices
Build methods:
- CDP:
buildManagePositionTransaction,buildClosePositionTransaction,buildClaimBorrowRewardsTransaction - PSM:
buildPSMSwapInTransaction,buildPSMSwapOutTransaction - Saving:
buildDepositToSavingPoolTransaction,buildWithdrawFromSavingPoolTransaction,buildClaimSavingRewardsTransaction - Flash:
flashMint,flashBurn
What To Open Next (Modular References)
Read only what you need:
references/api-workflows.md- End-to-end PTB examples for CDP, PSM, saving, flash, and composition.
references/query-cheatsheet.md- Query API quick reference, return-shape expectations, and troubleshooting checks.
references/protocol-concepts.md- CDP mechanics, CR/MCR, liquidation model, PSM peg behavior, and yield layers.
references/coin-types.md- Dynamic type resolution patterns and a small literal snapshot.
Runtime Diagnostics
Use the bundled script when you need a quick live state snapshot:
# Run in a project directory that has @bucket-protocol/sdk installed
# <skill-root> is wherever you store this skill, for example:
# .github/skills/bucket-sdk
# .agents/skills/bucket-sdk
# .claude/skills/bucket-sdk
node <skill-root>/scripts/query-state.mjs
It prints supply, prices, vault stats, PSM pools, saving pools, and supported collateral types.
Response Expectations
- Return code that is copy-paste runnable in TypeScript.
- Mention which live type source was used (
getAllCollateralTypes, PSM keys, or saving LP keys). - When rejecting input, include the checked list source and a short fix suggestion.
- Prefer small, composable PTBs over unrelated helper abstractions.
Quality Gates Before Finalizing
- Type validation done against live config (not hardcoded memory).
- Amount units are raw integer units.
- Transaction path is complete: build -> set sender -> sign+execute (or simulate).
- Failure handling includes useful checks:
- Unsupported collateral or PSM or lp type
- Missing price feed
- Insufficient pool balance
- Insufficient user balance
Signals
- GitHub stars
- 21
- Forks
- 8
- Last commit
- Aug 2026
Advanced
- Catalog kind
- skill
- Gateway key
bucket-sdk- Source
- github.com/bucket-protocol/bucket-protocol-sdk