Open
Conversation
…ns, savings, rewards Made-with: Cursor
Made-with: Cursor
Made-with: Cursor
- Add test/__mocks__/fetch.ts with mockFetchOk/mockFetchFail factories - Add test/fixtures/pyth-config.ts for shared Pyth config - Move pyth.test.ts to test/unit/utils/ (mirror src/utils/) - Add transaction.test.ts for getZeroCoin, destroyZeroCoin, coinWithBalance - Add test:unit, test:e2e, test:watch scripts - Set vitest testTimeout/hookTimeout to 10s Made-with: Cursor
- Replace single client.test.ts with domain-specific files (oracle, config, cdp, flash, psm, saving, savings-rewards, supply-pools, vaults, etc.) - Add shared setup helpers in test/e2e/helpers/setup.ts Made-with: Cursor
Made-with: Cursor
- Move buildClaimBorrowRewardsTransaction to rewards.test.ts for consistency
- Fix vaults assertions: use toBe('bigint') and toBeGreaterThanOrEqual
- Replace early returns with explicit expect in oracle tests
- Extract TEST_AMOUNT_USDB constant in saving.test.ts
Made-with: Cursor
- Add on-chain config: entry.ts, bucketConfig.ts, configAdapter.ts - Client: BucketClient.create(), refreshConfig(), require config in ctor - Remove static src/consts/config.ts; config now fetched from chain - E2E: inter-file delay (2s), per-test delay (600ms), setupE2E with retry - Vitest: retry once on RESOURCE_EXHAUSTED / Too Many Requests (3s delay) - Add onchain-config.test.ts and rateLimit.ts helpers Made-with: Cursor
…t-Protocol/bucket-protocol-sdk into merge/wl581-onchain-config
…or dynamic field parsing
…t-Protocol/bucket-protocol-sdk into merge/wl581-onchain-config
…ent typing; update test setup and formatting Made-with: Cursor
…ides, ensureConfig race, initialSharedVersion enrichment - queryAllConfig: fail-fast on sub-object fetch/parse errors instead of returning partial config - refreshConfig: preserve configOverrides when called without args - ensureConfig: use cached promise to prevent concurrent RPC calls - enrichSharedObjectRefs: fetch initialSharedVersion for refs with objectId-only (fixes PTB tx failure) - Add unit tests for all four fixes Made-with: Cursor
…onfig) before queryAllConfig return - Add required-section and key-field validation to fail-fast on incomplete RPC response - Throw when any required section is missing or key field is empty - Add unit tests for validation failure cases Made-with: Cursor
- bucketConfig: missing oracleConfig/objectConfig, empty pyth_state_id, empty treasury_obj - configAdapter: empty objectId skip, deduplication, non-Shared owner skip, no-refs case - client: explicit refreshConfig overrides, ensureConfig when config already loaded Made-with: Cursor
…edge tests
- client: clear _configInitPromise in ensureConfig catch so subsequent calls can retry
- client: fix mockImplementation type for queryAllConfig
- test: add reverse tests (enrichSharedObjectRefs immutability, refreshConfig({}), no retry on success)
- test: add expect.fail pattern for required section throw case
- prettier
Made-with: Cursor
- Add await to all async method calls (getAllCollateralTypes, build*, flashMint/flashBurn, getAggregatorObjectInfo, getVaultObjectInfo, etc.) - Update version 1.2.8 -> 2.0.1 - Fix Example Project link (client.test.ts -> test/e2e/ directory) - Constructor config is optional (lazy-load from chain) Made-with: Cursor
Made-with: Cursor
…API consistency with main Made-with: Cursor
Made-with: Cursor
Made-with: Cursor
… config+configOverrides Made-with: Cursor
Made-with: Cursor
- Replace private _config + getter with direct config field (match main style) - Fix flashBurn param: use flashMintReceipt in README Pattern 2 - Update example project path to actual e2e test files - Bump version in README to 2.0.1 Made-with: Cursor
…config - Replace _generated_onchain_config with _generated/bucket_onchain_config - Update BucketOnchainConfig to use raw on-chain JSON shape (Record<string, unknown>) - bucketConfig now defines local types; generated modules export BCS structs, not TS types - Add bucket_onchain_config bindings (copied from external source) - Remove codegen tooling (sui-codegen.config.ts, scripts, @mysten/codegen) - Add sui-codegen.config.ts to .gitignore, pnpm-lock.yaml to .prettierignore Made-with: Cursor
…jectRefs Silent failure left initialSharedVersion at 0 when object fetch failed, causing PTB to fail at execution with no clear indication of the cause. Now logs objectId and error message for easier debugging. Made-with: Cursor
…ated types
- Use SharedObjectRef, RewarderInfo, PsmPoolObjectInfo from generated $inferType
- Switch config parsing to snake_case and enum shapes ({ Pyth: {...} }, { SCOIN: {...} }, etc.)
- Keep manual types for AggregatorObjectInfo, PriceConfigInfo (MoveEnum requires $kind; we parse from JSON)
- Keep manual types for VaultObjectInfo, SavingPoolObjectInfo (optional rewarders/reward when empty)
- Change initialSharedVersion to string type to match BCS schema
- Update client.ts, configAdapter, and all related tests
Made-with: Cursor
On-chain derivative_kind can be 'Unihouse'; dk mapping already maps it to 'gCoin', but the switch lacked the case and threw Unsupported derivative kind. Made-with: Cursor
…rnType - Replace simulateTransaction + borrow_cap_mut with stateService.getCoinInfo - PTB cannot pass &mut references between commands; SDK v2 validates and rejects - Tighten test assertion: expect supply > 0 (was >= 0, masked failures) Made-with: Cursor
…ls until realtime_reward_amount_by_manager) Made-with: Cursor
…s, unit tests - Add all-query-outputs.test.ts with getAccountBorrowRewards using coinTypesWithRewarders - Add unit tests for client, bucketConfig, configAdapter, resolvers, transaction - Extend cdp.test, oracle.test Note: getAccountSavingPoolRewards / getUserSavings / getAccountSavings tests remain skipped — not yet fixed (awaiting contract upgrade for PTB reference limitation). Made-with: Cursor
- Replace get_rewarder + realtime_reward_amount with single get_realtime_reward_amount call to avoid PTB reference limitation (references cannot be passed between commands) - Simplify response parsing: one result per reward type instead of two - Re-enable savings-rewards e2e tests (getUserSavings, getAccountSavings, getAccountSavingPoolRewards) now that contract upgrade is deployed - Remove pool: 'forks' from vitest config Made-with: Cursor
Made-with: Cursor
…ls on Bucket Protocol features
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a Copilot Skill for the Bucket Protocol SDK (bucket-sdk). This gives GitHub Copilot deep, structured knowledge of the SDK so it can accurately assist with CDP transactions, PSM swaps, saving pool operations, oracle queries, flash mints, and leverage patterns — without hallucinating API signatures or misunderstanding protocol mechanics.
The skill is strictly additive (4 new files, 966 lines) and does not modify any source code.
Changes
SKILL.md (+421 lines)
Main integration guide consumed by Copilot. Covers:
BucketClient.initialize()andbuildManagePositionTransactioncoinWithBalancelazy resolver, decimal table, Account vs EOAVaultInfo,PositionInfo,SavingPoolInfo,PsmPoolInfo,SavingInfo,FlashMintInfo)coin-types.md (+100 lines)
Reference table of all mainnet coin type strings organized by category:
protocol-concepts.md (+342 lines)
Protocol-level decision guide covering:
query-state.ts (+103 lines)
Diagnostic script for querying live on-chain state. Prints USDB supply, oracle prices, vault stats, PSM pool balances, saving pool info, flash mint fees, and supported collateral types. Runnable via
npx tsx skills/bucket-sdk/scripts/query-state.ts.