sui library

Classes

AddressOwner
AddStakeTransaction
AuthorityQuorumSignInfo
BalanceChange
BatchFaucetResponse
BatchSendStatusType
BatchStatusFaucetResponse
BuildOptions
CertifiedTransaction
Claim
Coin
CoinBalance
CoinDenominationInfoResponse
CoinMetadataStruct
CoinStruct
CoinSupply
Commands
DisplayFieldsResponse
DryRunTransactionBlockResponse
Ed25519Keypair
Ed25519PublicKey
EffectsCert
EventFilter
ExecutionStatus
FaucetClient
FaucetCoinInfo
FaucetResponse
FaucetResponseV2
Response from /v2/gas. status is 'Success' or a {Failure: {internal}} map.
GasConfig
GasCostSummary
Id
Inputs
JsonRpcClient
JsonRpcResolutionClient
TxResolutionClient backed by the JSON-RPC SuiClient.
MoveCall
MoveCallTransaction
MoveEventField
MoveEventModule
MoveModule
MultiSig
MultiSigPublicKey
MultiSigPublicKeyStruct
MultiSigSigner
A Signer combining member keypairs of a MultiSigPublicKey. sign throws; use signTransaction / signPersonalMessage to collect and combine member signatures.
MultiSigStruct
ObjectOwner
OwnedObjectRef
PaginatedCoins
PaginatedObjectsResponse
PaginatedTransactionResponse
ParsedPartialMultiSigSignature
ParsedPasskeySignature
PasskeyAuthentication
The result of a WebAuthn assertion (navigator.credentials.get and friends).
PasskeyKeypair
A passkey signer (SIP-9). The private key never leaves the authenticator; signing is delegated to a PasskeyProvider, so every signing method is async.
PasskeyProvider
Bridges to a platform WebAuthn/credentials API. The actual key lives in the authenticator, so this is implemented by the host app (browser via JS interop, iOS/Android via platform channels) and supplied to PasskeyKeypair.
PasskeyPublicKey
A passkey (WebAuthn) public key. The underlying key is a 33-byte compressed secp256r1 point; signatures are produced by an authenticator over the WebAuthn signing payload rather than over the message directly.
PasskeyRegistration
The public key and credential id returned when registering a new passkey.
Pay
PayAllSui
PayAllSuiTransaction
Send all SUI coins to one recipient. This is for SUI coin only and does not require a separate gas coin object. Specifically, what pay_all_sui does are:
PaySui
PaySuiTransaction
Send SUI coins to a list of addresses, following a list of amounts. This is for SUI coin only and does not require a separate gas coin object. Specifically, what pay_sui does are:
PayTransaction
Send Coin<T> to a list of addresses, where T can be any coin type, following a list of amounts, The object specified in the gas field will be used to pay the gas fee for the transaction. The gas object can not appear in input_coins. If the gas object is not specified, the RPC server will auto-select one.
ProofPoints
PubkeyEnumWeightPair
PubkeyWeightPair
PublicKeyWeight
PublishTransaction
RequestOptions
Secp256
Secp256k1Keypair
An Secp256k1 Keypair used for signing transactions.
Secp256KeypairData
Secp256PublicKey
Secp256r1Keypair
An Secp256r1 Keypair used for signing transactions.
SerializeTransactionOptions
SerialQueue
Runs async tasks one at a time, in submission order. A failing task does not break the chain — its error is delivered to that task's caller only.
SerialTransactionExecutor
Signs and executes transactions one at a time for a single account, reusing the gas coin from each transaction's effects so the next transaction does not have to wait for the previous one to be indexed.
Shared
SignableTransaction
SIGNATURE_SCHEME_TO_FLAG
SignatureData
SignatureWithBytes
Signer
A transport-agnostic signer. Keypairs sign directly; composite signers (e.g. MultiSigSigner, ZkLoginSigner) override signWithIntent, through which every signing method funnels.
SignOptions
SplitCoinEqualTransaction
SplitCoinTransaction
SuiAccount
SuiBcs
SuiChangeEpoch
SuiClient
SuiData
SuiEffects
SuiExecuteTransactionResponse
SuiGasData
SuiMoveObject
SuiMovePackage
SuiObject
SuiObjectData
SuiObjectDataFields
SuiObjectDataOptions
SuiObjectError
SuiObjectRef
SuiObjectResponse
SuiPackage
SuiParsedMergeCoinResponse
SuiParsedPublishResponse
SuiParsedSplitCoinResponse
SuiParsedTransactionResponse
SuiPure
SuiRawMoveObject
SuiTransactionBlock
SuiTransactionBlockData
SuiTransactionBlockResponseOptions
SuiTransactionData
SuiTransactionKind
SuiTransactionResponse
SuiTransferSui
SuiUrls
TimeRange
Transaction
TransactionBlockDataBuilder
TransactionData
TransactionEffects
TransactionExpiration
TransactionResult
Transactions
Simple helpers used to construct transactions:
TransferObject
TransferObjectTransaction
TransferSuiTransaction
TxResolutionClient
Transport-agnostic view of the chain reads the transaction builder needs at build time (coin selection, object resolution, gas price, dry run, move function signatures, protocol limits).
WebsocketClient
WithdrawStakeTransaction
ZkLoginDeserializedSignature
ZkLoginPublicIdentifier
ZkLoginSignature
ZkLoginSignatureInputs
ZkLoginSigner
A transport- and provider-agnostic zkLogin signer.

Mixins

Keypair
A keypair used for signing transactions.
PublicKey
TxnDataSerializer

Properties

COIN_TYPE_ARG_REGEX RegExp
final
curve256k1Params → ECCurve_secp256k1
final
curve256r1Params → ECCurve_secp256r1
final
GAS_SAFE_OVERHEAD BigInt
final
MOVE_IDENTIFIER_REGEX RegExp
final
NORMALIZE_SUI_TYPE_ARG String
final
SUI_CLOCK_OBJECT_ID String
final
SUI_COIN_REGISTRY_OBJECT_ID String
final
SUI_DENY_LIST_OBJECT_ID String
final
SUI_RANDOM_OBJECT_ID String
final
SUI_SYSTEM_STATE_OBJECT_ID String
final
SUI_TYPE String
final
VECTOR_TYPE_REGEX RegExp
final
zkLoginSignature → BcsType<Map<String, dynamic>, dynamic>
final

Functions

argumentToGrpcArgument(Map<String, dynamic> arg) Argument
asIndices(int bitmap) Uint8List
base64UrlCharTo6Bits(String base64UrlChar) List<int>
base64UrlStringToBitVector(String base64UrlString) List<int>
bytesEqual(Uint8List a, Uint8List b) bool
callArgToGrpcInput(Map<String, dynamic> arg) Input
chunk<T>(List<T> arr, int size) List<List<T>>
coinWithBalance({required dynamic balance, String? type, bool useGasCoin = true}) CoinWithBalanceBuilder
Returns a coin of type holding exactly balance, selecting and merging the sender's coins at build time. For SUI, the gas coin is used unless useGasCoin is false. Requires a client and a sender on the transaction.
commandToGrpcCommand(Map cmd) Command
computeZkLoginAddressFromSeed(BigInt addressSeed, String iss, {bool legacyAddress = false}) String
createBalance({required dynamic balance, String? type, bool useGasCoin = true}) CoinWithBalanceBuilder
Like coinWithBalance but yields a Balance<T> instead of a Coin<T>.
decodeBase64URL(String s, int i) String
decodeBigIntToUnsigned(List<int> magnitude) BigInt
decodeSuiPrivateKey(String value) → (SignatureScheme, Uint8List)
This returns an ParsedKeypair object based by validating the 33-byte Bech32 encoded string starting with suiprivkey, and parse out the signature scheme and the private key in bytes.
deriveDynamicFieldId({required String parentObjectId, required String keyTypeTag, required Uint8List keyBcs}) String
Deterministic UID of a dynamic field, for direct getObject(uid). BLAKE2b-256 of 0xf0 || parent (32) || keyLen (u64 LE) || keyBcs || typeTagBcs (order is wire-significant).
deriveObjectId({required String parentObjectId, required String typeTag, required Uint8List key}) String
Derive the ID of a derived_object. key is BCS-encoded key bytes; typeTag is its Move type.
encodeBigInt(BigInt? number) Uint8List
encodeBigIntAsUnsigned(BigInt number) Uint8List
encodeSuiPrivateKey(Uint8List bytes, SignatureScheme scheme) String
This returns a Bech32 encoded string starting with suiprivkey, encoding 33-byte flag || bytes for the given the 32-byte private key and its signature scheme.
expectClient(BuildOptions options) TxResolutionClient
extractClaimValue<R>(Claim claim, String claimName) → R
findCommonPublicKey(List<PasskeyPublicKey> a, List<PasskeyPublicKey> b) PasskeyPublicKey
Returns the single public key present in both lists, throwing if there is not exactly one. Used with two PasskeyKeypair.signAndRecover results.
findFirstNonZeroIndex(Uint8List bytes) int
formatAddress(String address) String
Shorten an address to 0xXXXX…XXXX for display.
formatDigest(String digest) String
Shorten a digest to its first 10 characters followed by an ellipsis.
gasCoinFromEffects(SuiTransactionBlockResponse response) SuiObjectRef?
The gas coin reference from a transaction's effects (the mutated gas object), or null if effects were not returned.
generateMnemonic({int strength = 128}) String
getExtendedEphemeralPublicKey(PublicKey publicKey) String
Flag-prefixed base64 ephemeral public key expected by the proving service.
getHexByteLength(String value) int
getIdFromCallArg(dynamic arg) → dynamic
getMoveObject(dynamic data) SuiMoveObject?
getMoveObjectType(SuiObjectResponse resp) String?
getMovePackageContent(dynamic data) MovePackageContent
getObjectDeletedResponse(SuiObjectResponse resp) SuiObjectRef?
getObjectFields(dynamic resp) MovePackageContent
getObjectOwner(SuiObjectResponse resp) ObjectOwner?
getObjectPreviousTransactionDigest(SuiObjectResponse resp) String?
getObjectReference(SuiObjectResponse resp) SuiObjectRef?
getObjectType(SuiObjectResponse resp) String?
getObjectVersion(dynamic data) int?
getRandom() → FortunaRandom
getSharedObjectInitialVersion(SuiObjectResponse resp) int?
getSharedObjectInput(dynamic arg) → dynamic
getSuiObjectData(SuiObjectResponse resp) SuiObject?
getTransactionKind(SuiTransactionBlockResponse data) → dynamic
getZkLoginSignature(ZkLoginSignature signature) String
getZkLoginSignatureBytes(ZkLoginSignature signature) Uint8List
hasPublicTransfer(dynamic data) bool
isHex(String value) bool
isImmutableObject(SuiObjectResponse resp) bool
isMutableSharedObjectInput(dynamic arg) bool
isSharedObject(SuiObjectResponse resp) bool
isSharedObjectInput(dynamic arg) bool
isSuiObjectResponse(SuiObjectResponse resp) bool
isValidBIP32Path(String path) bool
Parse and validate a path that is compliant to BIP-32 in form m/54'/784'/{account_index}'/{change_index}/{address_index} for Secp256k1 and m/74'/784'/{account_index}'/{change_index}/{address_index} for Secp256r1.
isValidHardenedPath(String path) bool
Parse and validate a path that is compliant to SLIP-0010 in form m/44'/784'/{account_index}'/{change_index}'/{address_index}'.
isValidMnemonics(String mnemonics) bool
isValidMoveIdentifier(String name) bool
isValidNamedPackage(String name) bool
Whether name is a valid Move Registry (MVR) package name, e.g. @org/app or @org/app/1.
isValidNamedType(String type) bool
Whether type contains valid named packages and is a valid Move struct tag.
isValidParsedStructTag(StructTag tag) bool
isValidPersonalMessageSignature(Uint8List message, String signature, {String? address}) bool
Like isValidSignature, for a personal message.
isValidSignature(Uint8List bytes, String signature, {String? address}) bool
Whether signature is valid over bytes (and matches address if given). Returns false instead of throwing on malformed/invalid signatures.
isValidStructTag(String type) bool
isValidSuiAddress(String value) bool
isValidSuiNSName(String name) bool
isValidSuiObjectId(String value) bool
isValidTransactionDigest(String value) bool
True if value is a valid tx digest (Base58-encoded 32 bytes).
isValidTransactionSignature(Uint8List transaction, String signature, {String? address}) bool
Like isValidSignature, for transaction bytes.
isValidTypeTag(String type) bool
jwtDecode(String token, {bool header = false}) Map<String, dynamic>
Decode a JWT without verifying its signature. Returns the payload, or the header when header is true.
mnemonicToSeed(String mnemonics) Uint8List
Uses KDF to derive 64 bytes of key data from mnemonic with empty password.
mnemonicToSeedHex(String mnemonics) String
Derive the seed in hex format from mnemonic with empty password.
normalizeStructTag(StructTag type) String
normalizeStructTagString(String type) String
normalizeSuiAddress(String value, [bool forceAdd0x = false]) String
Lowercases, prepends 0x, and left-pads to SUI_ADDRESS_LENGTH.
normalizeSuiNSName(String name, [SuiNSType format = SuiNSType.at]) String
normalizeSuiObjectId(String value, [bool forceAdd0x = false]) String
normalizeZkLoginIssuer(String iss) String
Normalize a zkLogin issuer: accounts.google.com -> https://accounts.google.com.
padLeftUint8List(Uint8List data, [int len = 32]) Uint8List
parseDerSPKI(Uint8List der) Uint8List
Parses a DER SubjectPublicKeyInfo into the uncompressed point (0x04 || x || y), verifying the curve is secp256r1 (P-256).
parsePartialSignatures(MultiSigStruct multisig) List<ParsedPartialMultiSigSignature>
Parses a multisig into its individual signatures (scheme, signature, public key, weight).
parseSerializedPasskeySignature(dynamic signature) ParsedPasskeySignature
Parses a serialized passkey signature (flag 0x06 || BCS(PasskeyAuthenticator)), from raw bytes or a base64 string, into its component fields.
parseSerializedSignature(String serializedSignature) SignaturePubkeyPair
parseStructTag(String type) StructTag
parseToMist(String amount) BigInt
Parse a SUI decimal string into MIST.
parseToUnits(String amount, int decimals) BigInt
Parse a decimal string to smallest-unit BigInt (pure BigInt, no float).
parseTypeTag(String type) → dynamic
parseZkLoginSignature(Uint8List signature) ZkLoginDeserializedSignature
prepareSuiAddress(String address) String
publicKeyFromRawBytes(String signatureScheme, Uint8List bytes, {String? address}) PublicKey
publicKeyFromSuiBytes(dynamic publicKey, {String? address}) PublicKey
Decode a flag-prefixed public key (base64 or raw bytes); inverse of PublicKey.toSuiPublicKey.
resolveCoinBalance(TransactionBlockDataBuilder transactionData, BuildOptions options, Future<void> next()) Future<void>
Resolves all COIN_WITH_BALANCE intents in transactionData into concrete merge/split commands.
splitGenericParameters(String str, [(String, String) genericSeparators = ('<', '>')]) List<String>
toBigEndianBytes(BigInt num, int width) Uint8List
Big-endian bytes of num with leading zeros stripped.
toIterableGrpcArguments(List? args) List<Argument>
toPaddedBigEndianBytes(BigInt num, int width) Uint8List
Big-endian bytes of num, left-padded with zeros to width.
toSerializedSignature(SignatureScheme signatureScheme, Uint8List signature, PublicKey pubKey) String
toZkLoginPublicIdentifier(BigInt addressSeed, String iss, {bool legacyAddress = false}) ZkLoginPublicIdentifier
transactionDataToGrpcTransaction(TransactionData data) Transaction
verifyExtendedClaim(String claim) → (dynamic, dynamic)
verifyPersonalMessageSignature(Uint8List message, String signature, {String? address}) PublicKey
Like verifySignature, for a personal message.
verifySignature(Uint8List bytes, String signature, {String? address}) PublicKey
Verify signature over bytes, returning the recovered PublicKey. Throws if invalid or mismatched with address.
verifyTransactionSignature(Uint8List transaction, String signature, {String? address}) PublicKey
Like verifySignature, for transaction bytes.

Typedefs

CoinWithBalanceBuilder = TransactionResult Function(Transaction tx)
A function added to a transaction with tx.add(...). Invoked with the transaction, it registers the resolver, appends the intent command, and returns the resulting coin argument.
GetOwnedObjectsResponse = List<SuiObject>
IntentResolver = Future<void> Function(TransactionBlockDataBuilder transactionData, BuildOptions options, Future<void> next())
An async resolver for a named $Intent command. It may inspect and mutate transactionData (e.g. via replaceCommand) and must call next to run the rest of the resolver chain.
Limits = dynamic
MovePackageContent = dynamic
ObjectContentFields = dynamic
ObjectData = dynamic
ObjectDigest = String
ObjectId = String
SequenceNumber = int
SuiAddress = String
SuiJsonValue = dynamic
SuiTransactionBlockResponse = SuiExecuteTransactionResponse
TransactionDigest = String
Base58 string representing the object digest
TransactionEvents = List<SuiEvent>

Exceptions / Errors

InvalidTokenError
Thrown when a JWT cannot be decoded.