sui_dart 0.11.1
sui_dart: ^0.11.1 copied to clipboard
A cross-platform SDK for Sui blockchain, supporting Mobile, Web and Desktop.
0.11.1 #
Synced to 1056b78.
Fixed #
- GraphQL
getObjectssends ids 40 at a time. One request carrying every id can exceed the node's request size limit. - gRPC transaction timestamps keep their sub-second part.
- gRPC transaction effects carry the version the node reported.
- gRPC
getTransactionreports a failed transaction as failed.effects.statuswas only requested wheninclude.effectswas set, so a default call reported every transaction as successful. - GraphQL
getTransactionandlistTransactionsreturn the checkpoint sequence number, which was always null on that transport.
Changed #
- Vendored protos refreshed from
sui-apis201981c, adding theTransactionExpirationVALIDITYkind and itsAllowedProposersmessage. The copies underlib/grpc/proto/had drifted behind the generated code, andfilter.protoandquery_options.protowere missing entirely.
Removed #
- Unreachable JSON-RPC response models:
Checkpoint,DevInspectResults,SuiExecutionResult,DynamicFieldPage,DynamicFieldInfo,Paged,NextCursor,ValidatorsApys,ValidatorApy, and thelib/types/validator, version, and event models. None was exported frompackage:sui_dart. RPCError,RPCValidationError, andRPCErrorRequest, left from the removed JSON-RPC transport and never exported.
0.11.0 #
Synced to ad407b5.
Added #
Inputs.fundsWithdrawalbuilds aFUNDS_WITHDRAWALinput against the sender's or sponsor's address balance.coinWithBalanceandcreateBalancesource from the address balance when the owned coins fall short, returning the leftover there viacoin::send_funds. Funds held asBalance<T>were unspendable through this intent.
Changed #
- Gas payment falls back to the address balance when the sender owns no spare SUI
coin object, instead of throwing
No valid gas coins found for the transaction..
Fixed #
simulateTransactionresolves pending intents before converting to gRPC, which is synchronous. AcoinWithBalanceintent failed withUnknown Command kind.- Command clones and
addInputresults keepStringmap keys, which the cast toMap<String, dynamic>on the way to gRPC requires. - A
FUNDS_WITHDRAWALinput converts to gRPC after a BCS round trip. Its reservation reads back as aBigInt, failing every dry run of a parsed transaction withtype '_BigIntImpl' is not a subtype of type 'String'. - A
ValidDuringexpiration reaches gRPC asVALID_DURINGrather thanNONE, keeping the replay protection address-balance gas depends on.
0.10.1 #
Fixed #
simulateTransactionno longer disables transaction checks as a side effect ofdoGasSelection: false. Checks followchecksEnabledalone, and are disabled only when it is explicitlyfalse. A caller that relied on the old coupling for a gasless simulate should passchecksEnabled: false, or build the transaction first so it carries an expiration.- The gas budget dry-run simulates against a mocked gas coin instead of asking
the node to select one, and carries a
ValidDuringexpiration for replay protection. Gas paid from the sender's address balance can now be estimated without owning a gas coin. - gRPC conversion reads a tagged-union variant from its sole key when
$kindis absent, which a JSON round-trip omits.
0.10.0 #
Synced to f033be4.
Breaking #
SuiCoreClientgainedresolveNameServiceAddress,getProtocolConfig,listTransactions, andlistEvents; implementations of the interface must add all four.simulateTransactionno longer requests gas selection by default. It is requested only when the transaction's gas payment is an explicitly empty list, which means gas is paid from the sender's address balance; a transaction with no gas payment is simulated against a mocked gas coin. PassdoGasSelection: truefor the previous behavior.getTransactionthrowsTransactionErrorwhen the digest is unknown. GraphQL threw a bareException; gRPC returned an empty response.
Fixed #
coinWithBalance/createBalance: thecoin::destroy_zerocleanup for an exact-balance match is spliced in with the intent's own commands instead of appended to the block. Appended cleanup can land after a Move call that consumesRandom, which the chain rejects.- BCS
TransactionKinddecodes system transactions.ChangeEpoch,Genesis, andConsensusCommitProloguewere unparseable placeholders and now have typed payloads;AuthenticatorStateUpdate,EndOfEpochTransaction,RandomnessStateUpdate,ConsensusCommitPrologueV2–V4, andProgrammableSystemTransactionwere missing entirely. - A transaction that pays gas from the sender's address balance is built with a
ValidDuringexpiration covering the current and next epoch. With no gas coin version to bound it and no expiration set, such a transaction could be replayed.
Added #
listTransactionsandlistEventsread the indexed ledger on both transports, with sender/function and sender/module/type filters, cursor paging in either direction, and optional checkpoint bounds.PagegainedstartCursorfor reading back, andEventgainedcheckpoint,transactionDigest, andeventIndex.resolveNameServiceAddressresolves a SuiNS name to an address (nullwhen the name is unregistered or expired), on both transports.getProtocolConfigreturnsprotocolVersion,featureFlags, andattributes, on both transports.SuiGraphQLClientforwards the whole Core API as top-level methods, matchingSuiGrpcClient.executeTransactionandverifyZkLoginSignaturestill throwUnsupportedErrorthere.FaucetRateLimitErroris exported frompackage:sui_dart/sui.dart, so the throwrequestSuiFromFaucetV2documents can be caught by type.- README sections for the ledger queries, name-service resolution, and protocol config, and the transport table covers them.
ObjectErrorcarries a transport-neutralreason, the requestedobjectId, the transport'scode, and the underlyingcause. Missing objects reportreason: ObjectErrorReason.notFoundandcode: 'notExists'on both transports.
Changed #
- The faucet tests run offline against a stubbed HTTP adapter. They used to call
the live devnet faucet's retired
/gasand/v1/gasendpoints, so they failed on every run.
gRPC #
- Regenerated
lib/grpc/generated/from the current protobuf definitions.LedgerServicegained the streamingListTransactions/ListEvents/ListCheckpointsRPCs with thefilterandquery_optionsmessages;SubscriptionServicegainedSubscribeTransactions/SubscribeEvents;Eventcarries its checkpoint, transaction digest, and index;CommandArgumentErrorgainedINVALID_TX_CONTEXT.listCheckpointshas no core-client wrapper yet.
0.9.1 #
Fixed #
Transaction.toJson()encoded the raw block snapshot and threw "Converting object to an encodable object failed: Instance of 'TransactionData'".- Blocks whose commands reference an earlier command's result now serialize to
JSON.
TransactionResultwas not encodable, so bothtoJsonandtoJsonAsyncfailed on nearly every real transaction. Transaction.object()no longer resolves an argument onto an existing pure input. A value with no object id matched the first pure input, handing back a pure argument where an object was wanted and failing on chain withCommandArgumentError { kind: InvalidUsageOfPureArg }.
0.9.0 #
This release is breaking throughout: the JSON-RPC surface is gone and the
transport layer is unified behind SuiCoreClient.
Added #
SuiCoreClient, a transport-agnostic contract for reads, simulate, and execute, withGrpcCoreClientandGraphQLCoreClientimplementations reachable viaclient.coreonSuiGrpcClientandSuiGraphQLClient.- README "Choosing a Transport" comparison table.
Changed #
SuiGrpcClientread methods renamed to matchSuiCoreClient:listCoins/listOwnedObjects/listBalances/listDynamicFieldsare nowgetCoins/getOwnedObjects/getAllBalances/getDynamicFields.BuildOptions/SerializeTransactionOptions/SignOptionstakeclient: SuiCoreClient(passclient.core) instead ofresolutionClient. GraphQL building is read-only: move-call arguments aren't resolved.- Renamed
grpc/client.darttogrpc/sui_grpc_client.dartandgrpc/core.darttogrpc/grpc_core_client.dart.
Removed #
- JSON-RPC surface:
SuiClient,JsonRpcProvider,JsonRpcClient,WebsocketClient,RawSigner,SignerWithProvider,SerialTransactionExecutor,TxnDataSerializer. UseSuiGrpcClientorSuiGraphQLClient. TxResolutionClient/GrpcResolutionClientand the deprecatedlist*aliases onGrpcCoreClient.- Unused
MultiSig/PubkeyWeightPair(cryptography/multisig.dart) andSuiPure(bcs/sui_pure.dart). UseMultiSigPublicKeyandschemaFromName(builder/pure.dart).
0.0.1 #
- Initial version, created by Mofa Labs.
0.0.3 #
-
SuiNS
-
Websocket
-
Secp256r1
-
Programmable Transactions Block
0.0.4 #
- Add requestSuiFromFaucetV1
- Fix TransactionBlock decode json data
0.1.0 #
- Refactor JsonRpcProvider
- Add more rpc methods
- Update readme
0.1.1 #
- Add Events API
0.1.2 #
- Add Web Support
0.1.3 #
- Fix query gas object
- Fix setSigner
- Add Web Demo
0.1.4 #
- Fix TransactionBlock
- Rename ED25519 to Ed25519
0.1.5 #
- Fix TransactionBlock Input Type, Estimate Gas
0.1.6 #
- Add zkLogin
0.1.7 #
- Fix hex pad
0.2.0 #
- Add MultiSig
- Add zkLogin Test
0.2.1 #
- export bech32 private key
0.3.0 #
- Refactor Transaction & BCS
0.3.1 #
- Fix dio use default transformer
0.3.2 #
- Fix bugs
0.3.3 #
- Fix example
- Clean code
0.3.4 #
- Perf: resolve move modules
- Bump BCS
0.3.5 #
- Fix map equality in transaction arguments
0.3.6 #
- Fix parse subIndex failed
0.3.7 #
- Config request options
0.3.8 #
- Refactor: major
- Fix: Update GetDynamicFieldObjects param
- Fix: Remove Flutter dependency
0.3.9 #
- Feat: Handle devInspect both Transaction and build result
0.3.10 #
- Fix: Only set sender if transaction input is valid
0.4.0 #
- Feat: gRPC client integration (
SuiGrpcClient+GrpcCoreClient, transaction resolver, type converters, generated proto bindings) - Feat: Add
deriveDynamicFieldIdhelper for one-shot dynamic-field UID lookup - Feat: Add
toSuiObject()converter onGrpcObjectData - Feat: Support
FundsWithdrawalcase incallArgToGrpcInput - Feat: Protobuf value conversion functions for dynamic mapping in gRPC core
- Refactor: Align gRPC types with the canonical on-chain types
- Refactor: Replace untyped
Map<String, dynamic>/Map<String, bool>with typed classes in gRPC core - Refactor: Improved type safety in transaction handling across
GrpcCoreClientandSuiGrpcClient - Fix: Use
transaction.bcsinstead ofeffects.bcsinGrpcCoreClient - Fix: Cast
typeArgumentstoStringfor move calls incommandToGrpcCommand - Fix: Handle non-string version types in
callArgToGrpcInput - Chore: Update Sui URLs to include port 443; upgrade SDK to 3.11.0
- Chore: Upgrade
pointycastleto 4.0.0
0.4.1 #
- Chore: Swap
bip32/bip39forbip32_plus/bip39_plus(pointycastle ^4 compatible). Removes the need for apointycastledependency override in consumers.
0.5.0 #
- Chore: Update package metadata (
homepage,repository,issue_tracker). - Feat: Add an
example/demonstrating account creation, faucet funding, and balance lookup. - Chore: Tighten dependency lower bounds and widen
web_socket_channelto^3.0.3. - Refactor: Move platform-specific HTTP adapters under
lib/src/so the package reports correct platform support (Android, iOS, Windows, macOS, Linux). - Style: Resolve all
dart analyzewarnings — add public-API type annotations, remove dead code, and escape doc comments.
0.5.1 #
- Fix: Relax
metaconstraint to^1.18.0(was^1.18.3).^1.18.3cannot resolve on current Flutter stable, which pinsmeta 1.18.0; the package only uses@immutable.
0.6.0 #
Synced to f898c13.
Breaking #
computeZkLoginAddressFromSeedandtoZkLoginPublicIdentifiertake alegacyAddressnamed argument (defaults tofalse). Previously the two functions disagreed on seed encoding (unpadded vs padded), so the address derived from a seed did not match the address derived from the public identifier. PasslegacyAddress: truefor the deprecated legacy derivation.Ed25519Keypair.fromSecretKeynow validates the secret key by default (skipValidationdefaults tofalse).- BCS
ExecutionStatusvariantFailedrenamed toFailure; effects fieldcongestedObjectsrenamed tocongested_objects;UnchangedSharedKind(variantsMutateDeleted/ReadDeleted) renamed toUnchangedConsensusKind(MutateConsensusStreamEnded/ReadConsensusStreamEnded); effects fieldunchangedSharedObjectsrenamed tounchangedConsensusObjects.
Fixes #
- BCS:
Owner.ConsensusAddressOwnerfield order corrected to{startVersion, owner}(the previous order produced wrong bytes). - BCS:
TransactionEffectsis now an enum ({V1, V2}) instead of a struct; decoding effects as a struct read both versions back-to-back. - BCS: added the newer
ExecutionFailureStatusandCommandArgumentErrorvariants, plusObjectOut.AccumulatorWriteV1and the accumulator types, so current chain effects decode without out-of-range-tag errors. - Transaction builder:
isUsedAsMutableno longer marks nearly every shared-object input mutable (invertedMergeCoins/SplitCoinsconditions); shared-object mutability now also honors an explicitmutableflag. - Transaction builder:
splitCoins,mergeCoins,transferObjects, andmakeMoveVecnow accept string object IDs and route object-position arguments throughobject(). - Transaction builder:
Transaction.fromaccepts base64 BCS bytes in addition to JSON;getIdFromCallArgnormalizes unresolved object IDs. - Type parsing:
parseStructTagrejects malformed tags (empty components, trailing content);parseTypeTaghandlesvector<...>(includingvector<struct>);normalizeStructTagrejects top-level vector strings. isValidTransactionDigestnow validates Base58 (digests are Base58, not Base64).- zkLogin: the Google issuer is normalized consistently across address and public-identifier derivation;
ZkLoginPublicIdentifiergains legacy/non-legacy handling (legacyAddress,fromBytes({address, legacyAddress}),fromProof,verifyAddress). - Crypto: secp256k1/secp256r1 verification rejects non-canonical (high-S) signatures; point recovery uses the correct per-curve field prime (was hardcoded to secp256k1).
ed25519_hd_key.getPublicKey(withZeroByte: true)no longer crashes on the fixed-length buffer.
Added #
lib/cryptography/verify.dart:verifySignature/verifyPersonalMessageSignature/verifyTransactionSignature, their non-throwingisValid*variants, andpublicKeyFromSuiBytes.lib/utils/format.dart:parseToUnits,parseToMist,formatAddress,formatDigest.lib/utils/move_registry.dart:isValidNamedPackage,isValidNamedType.common.dart:isValidStructTag,isValidTypeTag,isValidMoveIdentifier.- BCS:
CallArg.FundsWithdrawal(withReservation/WithdrawalType/WithdrawFrom),TransactionExpiration.ValidDuring, and theObject/ObjectInner/MovePackageschema. FaucetClient.requestSuiFromFaucetV2(/v2/gas) withFaucetResponseV2;V0/V1/status methods are deprecated.PublicKey.verifyAddress;MultiSigPublicKey.getThreshold/getPublicKeys;Ed25519Keypair.deriveKeypairFromSeed;deriveObjectId; constantsSUI_RANDOM_OBJECT_ID,SUI_COIN_REGISTRY_OBJECT_ID,SUI_DENY_LIST_OBJECT_ID.
0.7.0 #
Synced to f898c13.
Fixed #
Transaction.serialize()no longer throwsConverting object to an encodable object failed.serializeV1TransactionDataleft the per-command argument/module lists as lazyIterables (.map(...)without.toList()), whichjsonEncodecannot encode; they are now materialized.
Added #
Signerbase class (lib/cryptography/signer.dart) — a transport-agnostic signing interface withsignTransaction/signPersonalMessagebuilt onsignWithIntent.ZkLoginSigner(lib/zklogin/signer.dart) — wraps an ephemeralKeypairand converts its signatures into zkLogin signatures using the proofinputs+maxEpoch. Optionaladdressvalidates the derived address against thelegacyAddressflag. Uses no Poseidon.MultiSigSigner(lib/multisig/multisig_signer.dart) — wraps aMultiSigPublicKeyand its member keypairs;signTransaction/signPersonalMessagecollect and combine the members' partial signatures. Validates membership, deduplication, and that the combined weight meets the threshold.jwtDecode(lib/zklogin/jwt_decode.dart) — decode a JWT's payload or header without signature verification (InvalidTokenErroron malformed input).getExtendedEphemeralPublicKey(lib/zklogin/utils.dart) — the flag-prefixed base64 ephemeral public key the zkLogin proving service expects.
gRPC #
- Regenerated
lib/grpc/generated/from the latest protobuf definitions.AccumulatorWritenow carries the authenticated-events shape (value_kind+integer_value/integer_tuple/event_digest_value, theEventDigestEntrymessage, and theAccumulatorValueenum);objectandtransaction_execution_servicemessages picked up their new fields. - Added the
ForkingService(sui/forking/v1alpha) client and exposed it asSuiGrpcClient.forkingService(admin-only; forsui-forkinstances).
0.8.0 #
Synced to f898c13.
Added #
- Passkey (WebAuthn) signature verification:
PasskeyPublicKeyandparseSerializedPasskeySignature(lib/cryptography/passkey_publickey.dart), withSignatureScheme.Passkey(flag0x06) wired intoparseSerializedSignature,publicKeyFromRawBytes, andpublicKeyFromSuiBytes. Verification reconstructs the WebAuthn signing payload and checks the inner secp256r1 signature against the embedded key. - Passkey signing (
lib/cryptography/passkey_keypair.dart):PasskeyKeypairplus aPasskeyProviderinterface the host app backs with a platform WebAuthn/credentials binding. Handles DER signature parsing, low-S normalization, deriving the secp256r1 key from the DERSubjectPublicKeyInfo, and assembling the serialized passkey signature;signAndRecover/findCommonPublicKeyidentify an existing passkey's key. Signing is async. coinWithBalance/createBalanceintents (lib/builder/intents/coin_with_balance.dart):tx.add(coinWithBalance({type, balance}))yields a coin (or balance) of an exact amount, with the sender's coins selected, merged, and split at build time. Backed by a new async intent-resolution pipeline (Transaction.addIntentResolver) andTransactionBlockDataBuilder.replaceCommand(which remaps argument indices after splicing). SUI uses the gas coin unlessuseGasCoin: false. Requires a client and sender. The address-balance withdrawal path is not used; surplus remains an owned coin.Transaction.toJsonAsync/prepareForSerialization/isPreparedForSerialization: async JSON serialization that resolves intents first (without requiring gas/sender), with asupportedIntentsoption to leave intents for the recipient to resolve. The synchronoustoJson()is unchanged.SerialTransactionExecutor(lib/builder/executor/serial_transaction_executor.dart): signs and executes transactions one at a time for a single account, reusing the gas coin from each transaction's effects so back-to-back transactions don't wait for indexing. Includes aSerialQueueutility. (Caches only the gas coin, not arbitrary owned-object versions; there is no parallel executor.)
0.8.1 #
Added #
- gRPC transaction building:
GrpcResolutionClient+BuildOptions.resolutionClientbuild transactions over gRPC (coin selection, object/gas/move resolution, dry-run viasimulateTransaction);TxResolutionClientabstracts the transport. Validated on mainnet. SuiGrpcClient:buildTransaction/signAndExecuteTransaction(end-to-end over gRPC) andgetDynamicFieldObject(thesuix_getDynamicFieldObjectequivalent).- gRPC
Eventexposesjsonalongsidebcs(u64 fields lose precision injson; decodebcs).
Fixed #
- gRPC
simulateTransaction(commandResults: true)/ devInspect now return Move call return values — the read mask omittedcommand_outputs, so the server returned none.
Deprecated #
- JSON-RPC layer (
SuiClient,JsonRpcClient,JsonRpcProvider,SignerWithProvider,RawSigner) in favor ofSuiGrpcClient; JSON-RPC sunsets ~July 2026. Still functional; removed in a future major.
0.8.2 #
Fixed #
- gRPC
simulateTransaction(events: true)/ devInspect now return emitted events — the read mask requestedeventsinstead oftransaction.events(events are nested undertransaction), so the server returned none.
0.8.3 #
Added #
ObjectIncludeOptions.display+ObjectData.display: gRPC object reads can fetch the rendered Sui Display (name,image_url, …) as aMap. Null when the type has no Display template.
0.8.4 #
Fixed #
- gRPC event reads: the events read mask used
transaction.events, which the node rejects as an invalid path (INVALID_ARGUMENT), sogetTransaction/executeTransaction/simulateTransaction(events: true)returned no events. Corrected to the top-leveleventsfield, verified against mainnet. Reverts the incorrect 0.8.2 change. - gRPC dry-run:
dryRunTransactionsimulated without requestingeffects, so auto gas-budget estimation had nogasUsedand a failed simulation reported success. It now requestseffects.
0.8.6 #
Added #
simulateTransactionacceptschecksEnabled. Passfalseto run the transaction checks as DISABLED (maps to the gRPCSimulateTransactionRequest.checksfield). When disabled, the node ignoresdoGasSelection, so an unfunded sender can simulate without gas.
0.8.7 #
Fixed #
- gRPC
simulateTransaction(events: true)returned no events, so event-driven read queries came back empty.SimulateTransactionResponsenests the executed transaction undertransaction, so simulate now builds its owntransaction.-prefixed read mask (_simulateReadMask), naming the derived per-event JSON explicitly, whilegetTransaction/executeTransactionkeep the top-leveleventsmask. This resolves the 0.8.2/0.8.4 flip-flop, where one shared mask could not satisfy both response shapes: 0.8.2 switched it totransaction.eventsand broke get/execute; 0.8.4 reverted toeventsand re-broke simulate.
Changed #
simulateTransactiondisables transaction checks by default whendoGasSelectionisfalse— a read-only simulate has no gas to satisfy gas checks. Gas-selecting simulations keep the node default so real gas/validity errors still surface; passchecksEnabledto override.
0.8.8 #
Added #
- Add
SuiGraphQLClientandGraphQLTransportwith custom queries, structured errors, partial data, cancellation, and cursor pagination. - Add generated typed operations for transaction and object history, gas summaries, events, epochs, validators, and stakes.
- Add a checked-in Sui GraphQL schema and schema-refresh tooling.