scallop_deepbook_kit 5.0.0
scallop_deepbook_kit: ^5.0.0 copied to clipboard
A Dart/Flutter toolkit for interacting with DeepBook V3 Margin Pools on the Sui blockchain.
Changelog #
4.0.0 #
Breaking #
- Require
sui_dart^0.10.0.simulateTransactionno longer selects gas by default,SuiCoreClientimplementations must add four new methods, andgetTransactionthrowsTransactionErroron an unknown digest, so consumers onsui_dart0.9.x must migrate. This package's own API is unchanged.
3.0.0 #
Breaking #
- Require
sui_dart^0.9.0. Its transport refactor removed the JSON-RPC surface and renamed client reads (listCoins→getCoins, etc.), so consumers onsui_dart0.8.x must migrate. This package's own API is unchanged.
2.0.0 #
1.1.1 #
- Upgraded the
sui_dartdependency to^0.5.0(from^0.4.1). The public API is unchanged; this is a maintenance release that tracks the latestsui_dart. - Dropped the now-removed
Constants.enableDebugLogtoggle from the internaltool/check scripts (it no longer exists insui_dart0.5.0).
1.1.0 #
- Switched the Sui transport from JSON-RPC to gRPC (
sui_dart'sSuiGrpcClient).- All reads, simulate/devInspect, and execute now go over gRPC
(
fullnode.<net>.sui.io:443). No JSON-RPC client is used. - Writes are built server-side:
simulateTransaction(doGasSelection: true)returns the canonical signable bytes (.bcs); those are signed locally and submitted viaexecuteTransaction. Removed the JSON-RPC build dependency (ToolkitConfig.fullnodeUrl). - Added
src/utils/grpc_exec.dart: rawsimulate/executecalls with a correctFieldMaskto work aroundsui_dart0.4.1's wrapper readMask, which omitscommand_outputs/effects. - Added explicit in-band status checks (gRPC dry-run/execute report Move aborts via
effects.status.success == false, not by throwing). - Added a defensive Move-field unwrap for
ObjectData.json(flat gRPC shape + nested fallback). - Added
ToolkitConfig.grpcHostoverride anddispose()onDeepBookMarginToolkit/DeepBookMarginPoolto close the gRPC channel.
- All reads, simulate/devInspect, and execute now go over gRPC
(
- Live-verified read paths (mainnet + testnet pool params/APR, balances, pool discovery).
- Added
test/live_grpc_test.dart— live gRPC read integration tests (pool params + APR decode,getOnChainMarginPools); gated behindRUN_LIVE_TESTS=1, all passing against real fullnodes. - Hardened after a full adversarial audit: fixed the
executeTransactionreadMask (it omittedeffects, so writes would always report failure), guardedgetBalanceU64 decode against short buffers, madeDeepBookMarginPool.dispose()not close a caller-owned client, and made created-object detection fall back to a direct object-type read. - Note: gRPC uses native HTTP/2 — Flutter mobile & desktop only (Web needs a grpc-web proxy).
- Wallet usage support (build a tx and sign with your own wallet — no private-key toolkit required):
DeepBookMarginPool.build*helpers (buildMintSupplierCap,buildSupply— resolves the coin from a plain amount,buildWithdraw,buildMintSupplyReferral,buildWithdrawReferralFees) that add Move calls to an unsignedTransaction.- Public
coinWithBalance(client, tx, owner:, coinType:, amount:)resolver andsignAndExecuteTransaction(client, account, tx)so any wallet/account can sign + execute a built tx. DeepBookMarginPool.getSupplierCapIds([owner])for supplier-cap discovery.
- Fix: supplier-cap discovery. A SupplierCap's type keeps the ORIGINAL margin package id,
which differs from
marginPackageIdafter a package upgrade — the old owned-objects filter bymarginPackageIdfound nothing, soinitialize()minted a new cap on every call. Now matches by the::margin_pool::SupplierCaptype suffix (upgrade-safe). Verified on testnet. - Verified the full wallet flow on testnet:
getSupplierCapIds→buildSupply→signAndExecuteTransaction→buildWithdrawround-trip.
1.0.2 #
- Initial release — a Dart/Flutter toolkit for DeepBook V3 margin pools, built on
sui_dart. DeepBookMarginToolkit:initialize,createSupplierCap,createSupplyReferral,supplyToMarginPool,withdrawFromMarginPool,withdrawReferralFees,getBalance,getSupplierCapId,getAddress.DeepBookMarginPool:getPoolParameters/getPoolsParameterswith borrow/supply APR, utilization, and kink computation.MarginPoolContract: DeepBook V3 margin-pool Move-call builders.DeepBookConfig+ constants (package ids, coins, pools, margin pools) for testnet and mainnet.getOnChainMarginPools()query.- Utilities:
accountFromPrivateKey(hex / 0x-hex / base64 /suiprivkey),mul,normalize,getRpcUrl,convertQuantity. - Offline unit tests; clean
dart analyze.