feat(deepbook-predict): add DeepBook Predict TypeScript SDK#1126
Draft
tonylee08 wants to merge 1 commit into
Draft
feat(deepbook-predict): add DeepBook Predict TypeScript SDK#1126tonylee08 wants to merge 1 commit into
tonylee08 wants to merge 1 commit into
Conversation
New standalone `@mysten/deepbook-predict` package wrapping the Predict protocol (European cash-settled range digitals): codegen bindings, the packed-u256 order-id codec, trader + LP + keeper transaction builders, on-chain + indexer queries, and the `PredictClient` facade. Pre-launch (0.0.0): Predict is not yet deployed, so `PredictConfig` takes explicit `ids`; oracle is read-only and there is no off-chain quote previewer in this first cut. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
@mysten/deepbook-predictpackage wrapping the Predict protocol (on-chain European cash-settled range digitals). Mirrors the@mysten/deepbook-v3two-layer anatomy (generated bindings + hand-written builders/queries/client).@mysten/codegen): bindings fordeepbook_predict+account+propbookinsrc/contracts/**, used as the BCS-schema source. Regenerate withpnpm codegen.types/orderId.ts): TS mirror ofdeepbook_predict::order(packedu256, 196 bits) — the Move module exposes no public accessors, so the SDK replicates the packing.accountcustody,loadLivePricer, mint/redeem,predict_accountbuilder codes), LP (plpsupply/withdraw requests + cancel, DEEP stake, loss-rebate, sponsor), and the keeperfullFlush(single-PTB hot-potato sequence).MarketQueries/VaultQueries(viaclient.core.simulateTransaction) + propbook feed resolution, and a typedIndexerClientforpredict-server.PredictClientfacade +predict()$extendregistration.Key decisions
deepbook-v3): Predict has no Move dependency ondeepbookand a separate, pre-launch release cadence.tx.add) instead of hand-writtentx.moveCall({target}). This diverges from deepbook-v3's tx idiom by design: the thunks auto-injectClock, normalize args in the exact Move param order, and resolve the (unpublished) package id via apackageoverride fromPredictConfig.ids.PredictConfigrequires explicitids. Testnet is the initial target; real ids get filled at deploy.account::balanceand thepredict_accountgetters take&Account, a borrow that can't cross PTB commands from a sharedAccountWrapper. Market/vault getters take their object directly, so those reads are on-chain.0.0.0package, not being published in this PR).Test plan
pnpm codegenregeneratessrc/contracts/**(sui move summary+ codegen) cleanlytsc --noEmitpassesvitest run— 33 tests: order-id codec (reference-packing, round-trip, rejections), tx arg-shaping (incl. the full-flush hot-potato sequence), query decode via a stub client, indexer URL buildingoxlintclean (0 warnings / 0 errors)tsdownbundle builds (esm +.d.mts)🤖 Generated with Claude Code