StaticblendedMixed number and bigint multiplication helpers.
The suffix describes the argument and return types: N is number and
B is bigint. Helpers that return bigint apply Math.floor before the
conversion. Converting a bigint product to number can lose precision.
Multiplies two bigints and returns the exact bigint product.
Multiplies two bigints and converts the product to a number.
Multiplies a number by a bigint after converting the bigint to a number, floors the product, and returns a bigint.
Multiplies a number by a bigint after converting the bigint to a number.
Multiplies two numbers, floors the product, and returns a bigint.
Multiplies two numbers and returns a number.
Static ReadonlydynamicStatic reference to the DynamicFieldsApiHelpers, providing utility methods
for working with dynamic fields in Sui objects.
Static ReadonlyeventsStatic reference to the EventsApiHelpers, providing methods for
querying and filtering Sui events.
Static ReadonlyinspectionsStatic reference to the InspectionsApiHelpers, used for reading
Summaries or inspection data from objects.
Static ReadonlyobjectsStatic reference to the ObjectsApiHelpers, providing direct
retrieval or manipulation of on-chain Sui objects.
Static ReadonlytransactionsStatic reference to the TransactionsApiHelpers, enabling easier
queries for transaction data by digest or other criteria.
StaticabsReturns the non-negative absolute value of a bigint.
The input bigint.
num when it is non-negative, or -num otherwise.
StaticaddLeft-pads the first type segment to 64 characters after 0x.
When type contains ::, the text after the first separator is appended
unchanged apart from the helper's existing removal of the next 0x while
it splits the suffix. The method does not validate hexadecimal characters.
The address or extended Move type string.
A string whose first segment has 64 characters after 0x.
StaticaddConverts an object ID into a transaction object argument when needed.
A string calls tx.object(object), which adds an input to the transaction.
An existing TransactionObjectArgument is returned by identity and does
not call the transaction.
The transaction to update when object is a string.
An object ID or an existing transaction object argument.
A transaction object argument for object.
StaticapplyApplies a percent reduction to a JavaScript number.
The method returns amount - (slippage / 100) * amount without clamping or
validating the input.
The original numeric amount.
The percent value, where 1 means 1%.
The reduced amount as a number.
StaticapplyApplies a percent reduction to a bigint amount.
The method computes amount - floor((slippage / 100) * Number(amount)).
Converting the amount to number can lose precision before the reduction is
converted back to bigint. It does not clamp the result or validate the
percent input.
The original amount.
The percent value, where 1 means 1%.
The reduced amount as a bigint.
StaticbifilterSplits an array according to a synchronous predicate.
Truthy predicate results go to the first array and falsy results go to the second. The method preserves input order and passes the item, index, and original array to the predicate.
A tuple of [truthyItems, falsyItems].
StaticbifilterSplits an array according to asynchronous predicate results.
The method invokes the predicate for every item before awaiting
Promise.all, so the checks run in parallel. It preserves input order and
rejects if any predicate promise rejects.
A promise for [truthyItems, falsyItems].
StaticcapitalizeUppercases the first character and lowercases the remaining characters.
For example, "HELLO" becomes "Hello". An empty string remains empty.
The input string to transform.
The transformed string.
StaticcloseChecks whether two numbers differ by at most a relative tolerance.
The exact comparison is Math.abs(a - b) <= tolerance * Math.max(a, b).
The method does not clamp tolerance or use absolute values for the
operands in the right-hand side.
The first number.
The second number.
The multiplier applied to Math.max(a, b).
true when the comparison passes.
StaticcloseChecks bigint closeness after converting both operands to numbers.
The comparison is therefore subject to JavaScript number precision and uses
the same formula as closeEnough.
First bigint.
Second bigint.
The multiplier passed to closeEnough.
true when the numeric comparison passes.
StaticcreateCreates a timestamp-and-random base36 identifier string.
The value combines Date.now().toString(36) with the random suffix from
Math.random().toString(36). It is not guaranteed to be globally unique.
The generated base36 string.
StaticdeepRecursively copies arrays, enumerable object properties, and Date values.
Dates are cloned from their timestamp. Other objects become plain objects containing their enumerable string-keyed properties. Primitive values are returned unchanged, and cyclic input is not supported.
The data to clone deeply.
A copied structure with the same generic type.
StaticfilterReturns an object containing only entries accepted by a predicate.
The method examines the object's enumerable own string-keyed entries and
returns a new object. It does not mutate obj.
A new object with the accepted entries.
StaticgetReturns display metadata from a gRPC object view in JSON-RPC shape.
Reshaped onto JSON-RPC's DisplayFieldsResponse so the display casters are
unaffected by the transport change; see
GrpcCasting.displayFieldsResponseFromGrpcDisplay for the two
semantic differences that reshape absorbs.
display is undefined when it was not requested and null when the
object's type has no Display template. A non-null value is reshaped by
GrpcCasting.displayFieldsResponseFromGrpcDisplay.
The object view containing display data.
The JSON-RPC-shaped display response.
StaticgetReturns the Move fields from a gRPC object view.
The value is the gRPC json view, not JSON-RPC content.fields. Nested
structs can be bare, vector<u8> fields can be base64 strings, and UID
fields can be bare object IDs. Use the corresponding GrpcCasting helpers
before reading those shapes. The returned record is dynamic and is not
statically checked field by field.
json is undefined unless include: { json: true } was passed at the
fetch site.
The object view containing the requested json fields.
The dynamic Move field record.
StaticgetReturns the object ID after applying addLeadingZeroesToType.
The gRPC object view.
A zero-padded ObjectId string.
StaticgetReturns the object type after applying addLeadingZeroesToType.
The helper pads the outer address segment. Generic arguments keep their source padding and spacing, so equivalent gRPC and JSON-RPC generic type strings can remain textually different.
The gRPC object view.
The normalized fully qualified object type.
StaticindexFinds the first index containing the maximum comparable value.
The input array.
The first maximum index, or -1 when the array is empty.
StaticisChecks whether an unknown value is an array whose items are all strings.
The value to check.
true for an empty or string-only array, otherwise false.
StaticisChecks whether a string matches the helper's unsigned decimal pattern.
The pattern accepts digits with at most one decimal point, including an
empty string, a leading point such as .5, and a trailing point such as
5.. It rejects signs, exponents, and other characters.
The string to test.
true when str matches that pattern.
StaticisChecks whether a string contains one or more hexadecimal digits.
The string may begin with 0x or 0X. Whitespace, signs, and an empty
0x prefix are rejected.
The string to check.
true when the string matches the hexadecimal pattern.
StaticisChecks whether a string is a valid Sui address.
Lowercase-0x addresses of up to 64 hexadecimal characters are padded to
64 characters before validation. Invalid prefixes, lengths, characters, and
address strings longer than 64 characters return false; normalization
errors are caught rather than thrown.
The address string to validate.
true when the normalized value passes Sui address validation.
StaticisApplies the helper's minimum-shape check for a Sui Move type.
After trimming whitespace, the string must start with lowercase 0x, have
length at least 9, contain :: at index 3 or later and again at index
6 or later, and not end with :. The method does not validate the full
address, module, or type grammar.
The string to validate.
true when the minimum shape passes.
StatickeypairConstructs a Sui keypair from an encoded private key.
decodeSuiPrivateKey selects the scheme from the encoded key. This method
supports ED25519, Secp256k1, and Secp256r1 and returns the matching
keypair implementation. It performs no network I/O.
The encoded private key accepted by
decodeSuiPrivateKey.
A new keypair for signing.
StaticmaxStaticminStaticparseParses JSON while applying the SDK's bigint and null conversions.
Every string containing an optional minus sign, decimal digits, and a trailing
n becomes a bigint after that suffix is removed. Every JSON null becomes
undefined, including nested values.
With unsafeStringNumberConversion: true, strings accepted by isNumber
are also passed to BigInt; this can convert decimal-looking strings only
when BigInt accepts them and can throw for strings that match the loose
pattern but are not valid bigint input.
A valid JSON string.
Whether to convert strings accepted by
isNumber to bigint as well.
The parsed value after recursive reviver conversion. Top-level
null becomes undefined.
StaticparseExtracts a Move abort code, package ID, and module from a Sui error message.
The message must contain MoveAbort and the parser must find an integer
after the last comma, an address: ... , name: package segment, and an
Identifier("...") module segment. The package ID is normalized to 64
hexadecimal characters. An empty address segment is accepted by the current
padding logic and becomes the zero address. If any other required part is
missing or invalid, the method returns undefined.
The raw Sui error message.
The error text to parse.
The parsed error details, or undefined when the message does not
match the supported shape.
StaticremoveCopies an object or array while replacing repeated references with undefined.
The seen set tracks every object visited during this call. A cycle and a
later occurrence of an already visited shared object both become
undefined. The method returns new arrays and plain objects without
mutating the input, but it mutates the supplied seen set.
The object or array to remove circular references from.
The reference set used to track visited objects.
A copied structure, or undefined for a repeated object reference.
StaticsleepReturns a promise that resolves after a timer delay.
The delay passed to setTimeout, in milliseconds.
A promise that resolves with undefined after the timer fires.
StaticsplitSplits a coin string at colons for external coin-price lookups.
When both the first and second segments are non-empty, the method returns
those two segments and discards later segments. When either segment is
empty or absent, it returns the original string with chain: "sui".
The chain value is not validated against the CoinGeckoChain union at
runtime.
The coin string, which may look like "bsc:0x<...>" or just "0x<...>".
An object with the chain (e.g. "bsc") and the coinType.
The prefix before the first colon, or "sui" for an unsplit value.
The text between the first and second colon when a prefix exists.
StaticstripRemoves zeroes from every x0... sequence in a type string.
For example, "0x0000123" becomes "0x123". The replacement also
affects addresses inside generic type arguments, and it does not validate
the rest of the string.
The address or Move type string to process.
A new string with those zero runs removed.
StaticsumAdds the numbers in an array from left to right.
The array of numbers to sum.
The numeric total, or 0 for an empty array.
StaticsumAdds the bigints in an array from left to right.
The array of bigints to sum.
The bigint total, or 0n for an empty array.
StatictranslateMaps a parsed Move abort to a message in a package error table.
The method first requires a package entry. It then prefers an exact module
and error-code entry, and falls back to the package's ANY table. It returns
undefined when parsing fails, the package is absent, or neither table has
the error code.
The error text and lookup table.
The raw Sui Move abort message.
The package, module, and error-code message table.
The parsed details with the translated message, or undefined.
StaticuniqueReturns a new array with duplicate elements removed.
If the first element is an object, the method compares every element by its
JSON.stringify result. Otherwise it uses Set equality. Both paths keep
the first occurrence's order, and the input array is not mutated.
The original array.
An array of unique items.
StaticveryCompares the floored scale buckets of two numbers.
The method computes Math.floor(a / fixedOne) and
Math.floor(b / fixedOne), then checks whether their absolute difference
is at most 1.
First number (scaled).
Second number (scaled).
The scale divisor shared by a and b.
true when the bucket difference is at most 1.
Staticzip
A utility class containing various helper functions for general use across the Aftermath TS ecosystem. This includes numeric operations, object field extraction, array transformations, slippage adjustments, and Move error parsing.