repo_name string | dataset string | owner string | lang string | func_name string | code string | docstring string | url string | sha string |
|---|---|---|---|---|---|---|---|---|
js-wallet-sdk | github_2023 | okx | typescript | HexString.toShortString | toShortString(): string {
const trimmed = this.hexString.replace(/^0x0*/, "");
return `0x${trimmed}`;
} | /**
* Trimmes extra zeroes in the begining of a string
* @returns Inner hexString without leading zeroes
* @example
* ```
* new HexString("0x000000string").toShortString(); // result = "0xstring"
* ```
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/hex_string.ts#L107-L110 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | HexString.toUint8Array | toUint8Array(): Uint8Array {
return Uint8Array.from(hexToBytes(this.noPrefix()));
} | /**
* Converts hex string to a Uint8Array
* @returns Uint8Array from inner hexString without prefix
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/hex_string.ts#L116-L118 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | TransactionBuilder.build | build(func: string, ty_tags: string[], args: any[]): RawTransaction {
if (!this.rawTxnBuilder) {
throw new Error("this.rawTxnBuilder doesn't exist.");
}
return this.rawTxnBuilder.build(func, ty_tags, args);
} | /**
* Builds a RawTransaction. Relays the call to TransactionBuilderABI.build
* @param func
* @param ty_tags
* @param args
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/builder.ts#L64-L70 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | TransactionBuilder.getSigningMessage | static getSigningMessage(rawTxn: AnyRawTransaction): SigningMessage {
const hash = sha3Hash.create();
if (rawTxn instanceof RawTransaction) {
hash.update(RAW_TRANSACTION_SALT);
} else if (rawTxn instanceof MultiAgentRawTransaction) {
hash.update(RAW_TRANSACTION_WITH_DATA_... | /** Generates a Signing Message out of a raw transaction. */ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/builder.ts#L73-L92 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | TransactionBuilderMultiEd25519.sign | sign(rawTxn: RawTransaction): Bytes {
return bcsToBytes(this.rawToSigned(rawTxn));
} | /** Signs a raw transaction and returns a bcs serialized transaction. */ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/builder.ts#L119-L121 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | TransactionBuilderABI.constructor | constructor(abis: Bytes[], builderConfig?: ABIBuilderConfig) {
this.abiMap = new Map<string, ScriptABI>();
abis.forEach((abi) => {
const deserializer = new Deserializer(abi);
const scriptABI = ScriptABI.deserialize(deserializer);
let k: string;
if (script... | /**
* Constructs a TransactionBuilderABI instance
* @param abis List of binary ABIs.
* @param builderConfig Configs for creating a raw transaction.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/builder.ts#L175-L202 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | TransactionBuilderABI.buildTransactionPayload | buildTransactionPayload(func: string, ty_tags: string[], args: any[]): TransactionPayload {
const typeTags = ty_tags.map((ty_arg) => new TypeTagParser(ty_arg).parseTypeTag());
let payload: TransactionPayload;
if (!this.abiMap.has(func)) {
throw new Error(`Cannot find function: ${fu... | /**
* Builds a TransactionPayload. For dApps, chain ID and account sequence numbers are only known to the wallet.
* Instead of building a RawTransaction (requires chainID and sequenceNumber), dApps can build a TransactionPayload
* and pass the payload to the wallet for signing and sending.
* @param ... | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/builder.ts#L237-L265 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | TransactionBuilderABI.build | build(func: string, ty_tags: string[], args: any[]): RawTransaction {
const {sender, sequenceNumber, gasUnitPrice, maxGasAmount, expSecFromNow, chainId} = this.builderConfig;
if (!gasUnitPrice) {
throw new Error("No gasUnitPrice provided.");
}
const senderAccount = sender i... | /**
* Builds a RawTransaction
* @param func Fully qualified func names, e.g. 0x1::aptos_account::transfer
* @param ty_tags TypeTag strings.
* @example Below are valid value examples
* ```
* // Structs are in format `AccountAddress::ModuleName::StructName`
* 0x1::aptos_coin::AptosCoin
... | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/builder.ts#L289-L313 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | normlize | const normlize = (s: string) => s.replace(/^0[xX]0*/g, "0x"); | /* eslint no-param-reassign: ["off"] */ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/builder.ts#L369-L369 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | TypeArgumentABI.constructor | constructor(public readonly name: string) {} | /**
* Constructs a TypeArgumentABI instance.
* @param name
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/aptos_types/abi.ts#L19-L19 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | ArgumentABI.constructor | constructor(public readonly name: string, public readonly type_tag: TypeTag) {} | /**
* Constructs an ArgumentABI instance.
* @param name
* @param type_tag
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/aptos_types/abi.ts#L37-L37 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | TransactionScriptABI.constructor | constructor(
public readonly name: string,
public readonly doc: string,
public readonly code: Bytes,
public readonly ty_args: Seq<TypeArgumentABI>,
public readonly args: Seq<ArgumentABI>,
) {
super();
} | /**
* Constructs a TransactionScriptABI instance.
* @param name Entry function name
* @param doc
* @param code
* @param ty_args
* @param args
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/aptos_types/abi.ts#L76-L84 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | EntryFunctionABI.constructor | constructor(
public readonly name: string,
public readonly module_name: ModuleId,
public readonly doc: string,
public readonly ty_args: Seq<TypeArgumentABI>,
public readonly args: Seq<ArgumentABI>,
) {
super();
} | /**
* Constructs a EntryFunctionABI instance
* @param name
* @param module_name Fully qualified module id
* @param doc
* @param ty_args
* @param args
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/aptos_types/abi.ts#L114-L122 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | AccountAddress.fromHex | static fromHex(addr: MaybeHexString): AccountAddress {
let address = HexString.ensure(addr);
// If an address hex has odd number of digits, padd the hex string with 0
// e.g. '1aa' would become '01aa'.
if (address.noPrefix().length % 2 !== 0) {
address = new HexString(`0${address.noPrefix()}`);
... | /**
* Creates AccountAddress from a hex string.
* @param addr Hex string can be with a prefix or without a prefix,
* e.g. '0x1aa' or '1aa'. Hex string will be left padded with 0s if too short.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/aptos_types/account_address.ts#L34-L56 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | AccountAddress.isValid | static isValid(addr: MaybeHexString): boolean {
// At least one zero is required
if (addr === "") {
return false;
}
let address = HexString.ensure(addr);
// If an address hex has odd number of digits, padd the hex string with 0
// e.g. '1aa' would become '01aa'.
if (address.noPrefix(... | /**
* Checks if the string is a valid AccountAddress
* @param addr Hex string can be with a prefix or without a prefix,
* e.g. '0x1aa' or '1aa'. Hex string will be left padded with 0s if too short.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/aptos_types/account_address.ts#L63-L80 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | AccountAddress.toHexString | toHexString(): MaybeHexString {
return HexString.fromUint8Array(this.address).hex();
} | /**
* Return a hex string from account Address.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/aptos_types/account_address.ts#L85-L87 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | AccountAddress.standardizeAddress | static standardizeAddress(address: string): string {
// Convert the address to lowercase
const lowercaseAddress = address.toLowerCase();
// Remove the "0x" prefix if present
const addressWithoutPrefix = lowercaseAddress.startsWith("0x") ? lowercaseAddress.slice(2) : lowercaseAddress;
// Pad the addr... | /**
* Standardizes an address to the format "0x" followed by 64 lowercase hexadecimal digits.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/aptos_types/account_address.ts#L100-L110 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | AuthenticationKey.fromMultiEd25519PublicKey | static fromMultiEd25519PublicKey(publicKey: MultiEd25519PublicKey): AuthenticationKey {
const pubKeyBytes = publicKey.toBytes();
const bytes = new Uint8Array(pubKeyBytes.length + 1);
bytes.set(pubKeyBytes);
bytes.set([AuthenticationKey.MULTI_ED25519_SCHEME], pubKeyBytes.length);
const hash = sha3H... | /**
* Converts a K-of-N MultiEd25519PublicKey to AuthenticationKey with:
* `auth_key = sha3-256(p_1 | … | p_n | K | 0x01)`. `K` represents the K-of-N required for
* authenticating the transaction. `0x01` is the 1-byte scheme for multisig.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/aptos_types/authentication_key.ts#L45-L56 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | AuthenticationKey.derivedAddress | derivedAddress(): HexString {
return HexString.fromUint8Array(this.bytes);
} | /**
* Derives an account address from AuthenticationKey. Since current AccountAddress is 32 bytes,
* AuthenticationKey bytes are directly translated to AccountAddress.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/aptos_types/authentication_key.ts#L75-L77 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | TransactionAuthenticatorEd25519.constructor | constructor(public readonly public_key: Ed25519PublicKey, public readonly signature: Ed25519Signature) {
super();
} | /**
* An authenticator for single signature.
*
* @param public_key Client's public key.
* @param signature Signature of a raw transaction.
* @see {@link https://aptos.dev/guides/creating-a-signed-transaction/ | Creating a Signed Transaction}
* for details about generating a signature.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/aptos_types/authenticator.ts#L43-L45 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | TransactionAuthenticatorMultiEd25519.constructor | constructor(public readonly public_key: MultiEd25519PublicKey, public readonly signature: MultiEd25519Signature) {
super();
} | /**
* An authenticator for multiple signatures.
*
* @param public_key
* @param signature
*
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/aptos_types/authenticator.ts#L68-L70 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | MultiEd25519PublicKey.constructor | constructor(public readonly public_keys: Seq<Ed25519PublicKey>, public readonly threshold: Uint8) {
if (threshold > MAX_SIGNATURES_SUPPORTED) {
throw new Error(`"threshold" cannot be larger than ${MAX_SIGNATURES_SUPPORTED}`);
}
} | /**
* Public key for a K-of-N multisig transaction. A K-of-N multisig transaction means that for such a
* transaction to be executed, at least K out of the N authorized signers have signed the transaction
* and passed the check conducted by the chain.
*
* @see {@link
* https://aptos.dev/guides/creatin... | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/aptos_types/multi_ed25519.ts#L30-L34 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | MultiEd25519PublicKey.toBytes | toBytes(): Bytes {
const bytes = new Uint8Array(this.public_keys.length * Ed25519PublicKey.LENGTH + 1);
this.public_keys.forEach((k: Ed25519PublicKey, i: number) => {
bytes.set(k.value, i * Ed25519PublicKey.LENGTH);
});
bytes[this.public_keys.length * Ed25519PublicKey.LENGTH] = this.threshold;
... | /**
* Converts a MultiEd25519PublicKey into bytes with: bytes = p1_bytes | ... | pn_bytes | threshold
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/aptos_types/multi_ed25519.ts#L39-L48 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | MultiEd25519Signature.constructor | constructor(public readonly signatures: Seq<Ed25519Signature>, public readonly bitmap: Uint8Array) {
if (bitmap.length !== MultiEd25519Signature.BITMAP_LEN) {
throw new Error(`"bitmap" length should be ${MultiEd25519Signature.BITMAP_LEN}`);
}
} | /**
* Signature for a K-of-N multisig transaction.
*
* @see {@link
* https://aptos.dev/guides/creating-a-signed-transaction#multisignature-transactions | Creating a Signed Transaction}
*
* @param signatures A list of ed25519 signatures
* @param bitmap 4 bytes, at most 32 signatures are supported. I... | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/aptos_types/multi_ed25519.ts#L81-L85 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | MultiEd25519Signature.toBytes | toBytes(): Bytes {
const bytes = new Uint8Array(this.signatures.length * Ed25519Signature.LENGTH + MultiEd25519Signature.BITMAP_LEN);
this.signatures.forEach((k: Ed25519Signature, i: number) => {
bytes.set(k.value, i * Ed25519Signature.LENGTH);
});
bytes.set(this.bitmap, this.signatures.length * ... | /**
* Converts a MultiEd25519Signature into bytes with `bytes = s1_bytes | ... | sn_bytes | bitmap`
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/aptos_types/multi_ed25519.ts#L90-L99 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | MultiEd25519Signature.createBitmap | static createBitmap(bits: Seq<Uint8>): Uint8Array {
// Bits are read from left to right. e.g. 0b10000000 represents the first bit is set in one byte.
// The decimal value of 0b10000000 is 128.
const firstBitInByte = 128;
const bitmap = new Uint8Array([0, 0, 0, 0]);
// Check if duplicates exist in b... | /**
* Helper method to create a bitmap out of the specified bit positions
* @param bits The bitmap positions that should be set. A position starts at index 0.
* Valid position should range between 0 and 31.
* @example
* Here's an example of valid `bits`
* ```
* [0, 2, 31]
* ```
* `[0, 2, 31]`... | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/aptos_types/multi_ed25519.ts#L115-L145 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | RawTransaction.constructor | constructor(
public readonly sender: AccountAddress,
public readonly sequence_number: Uint64,
public readonly payload: TransactionPayload,
public readonly max_gas_amount: Uint64,
public readonly gas_unit_price: Uint64,
public readonly expiration_timestamp_secs: Uint64,
public r... | /**
* RawTransactions contain the metadata and payloads that can be submitted to Aptos chain for execution.
* RawTransactions must be signed before Aptos chain can execute them.
*
* @param sender Account address of the sender.
* @param sequence_number Sequence number of this transaction. This must match ... | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/aptos_types/transaction.ts#L47-L55 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Script.constructor | constructor(
public readonly code: Bytes,
public readonly ty_args: Seq<TypeTag>,
public readonly args: Seq<TransactionArgument>,
) {} | /**
* Scripts contain the Move bytecodes payload that can be submitted to Aptos chain for execution.
* @param code Move bytecode
* @param ty_args Type arguments that bytecode requires.
*
* @example
* A coin transfer function has one type argument "CoinType".
* ```
* public(script) fun transfer<C... | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/aptos_types/transaction.ts#L106-L110 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | EntryFunction.constructor | constructor(
public readonly module_name: ModuleId,
public readonly function_name: Identifier,
public readonly ty_args: Seq<TypeTag>,
public readonly args: Seq<Bytes>,
) {} | /**
* Contains the payload to run a function within a module.
* @param module_name Fully qualified module name. ModuleId consists of account address and module name.
* @param function_name The function to run.
* @param ty_args Type arguments that move function requires.
*
* @example
* A coin transf... | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/aptos_types/transaction.ts#L146-L151 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | EntryFunction.natural | static natural(module: string, func: string, ty_args: Seq<TypeTag>, args: Seq<Bytes>): EntryFunction {
return new EntryFunction(ModuleId.fromStr(module), new Identifier(func), ty_args, args);
} | /**
*
* @param module Fully qualified module name in format "AccountAddress::module_name" e.g. "0x1::coin"
* @param func Function name
* @param ty_args Type arguments that move function requires.
*
* @example
* A coin transfer function has one type argument "CoinType".
* ```
* public(script) ... | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/aptos_types/transaction.ts#L173-L175 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | EntryFunction.natual | static natual(module: string, func: string, ty_args: Seq<TypeTag>, args: Seq<Bytes>): EntryFunction {
return EntryFunction.natural(module, func, ty_args, args);
} | /**
* `natual` is deprecated, please use `natural`
*
* @deprecated.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/aptos_types/transaction.ts#L182-L184 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | MultiSigTransactionPayload.constructor | constructor(public readonly transaction_payload: EntryFunction) {} | /**
* Contains the payload to run a multisig account transaction.
* @param transaction_payload The payload of the multisig transaction. This can only be EntryFunction for now but
* Script might be supported in the future.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/aptos_types/transaction.ts#L219-L219 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | MultiSig.constructor | constructor(
public readonly multisig_address: AccountAddress,
public readonly transaction_payload?: MultiSigTransactionPayload,
) {} | /**
* Contains the payload to run a multisig account transaction.
* @param multisig_address The multisig account address the transaction will be executed as.
* @param transaction_payload The payload of the multisig transaction. This is optional when executing a multisig
* transaction whose payload is alrea... | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/aptos_types/transaction.ts#L244-L247 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Module.constructor | constructor(public readonly code: Bytes) {} | /**
* Contains the bytecode of a Move module that can be published to the Aptos chain.
* @param code Move bytecode of a module.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/aptos_types/transaction.ts#L277-L277 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | ModuleId.constructor | constructor(public readonly address: AccountAddress, public readonly name: Identifier) {} | /**
* Full name of a module.
* @param address The account address.
* @param name The name of the module under the account at "address".
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/aptos_types/transaction.ts#L295-L295 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | ModuleId.fromStr | static fromStr(moduleId: string): ModuleId {
const parts = moduleId.split("::");
if (parts.length !== 2) {
throw new Error("Invalid module id.");
}
return new ModuleId(AccountAddress.fromHex(new HexString(parts[0])), new Identifier(parts[1]));
} | /**
* Converts a string literal to a ModuleId
* @param moduleId String literal in format "AccountAddress::module_name", e.g. "0x1::coin"
* @returns
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/aptos_types/transaction.ts#L302-L308 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | SignedTransaction.constructor | constructor(public readonly raw_txn: RawTransaction, public readonly authenticator: TransactionAuthenticator) {} | /**
* A SignedTransaction consists of a raw transaction and an authenticator. The authenticator
* contains a client's public key and the signature of the raw transaction.
*
* @see {@link https://aptos.dev/guides/creating-a-signed-transaction/ | Creating a Signed Transaction}
*
* @param raw_txn
* @p... | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/aptos_types/transaction.ts#L354-L354 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | StructTag.fromString | static fromString(structTag: string): StructTag {
// Use the TypeTagParser to parse the string literal into a TypeTagStruct
const typeTagStruct = new TypeTagParser(structTag).parseTypeTag() as TypeTagStruct;
// Convert and return as a StructTag
return new StructTag(
typeTagStruct.value.address,... | /**
* Converts a string literal to a StructTag
* @param structTag String literal in format "AcountAddress::module_name::ResourceName",
* e.g. "0x1::aptos_coin::AptosCoin"
* @returns
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/aptos_types/type_tag.ts#L192-L203 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | isGeneric | function isGeneric(c: string): boolean {
if (c.match(/T\d+/g)) {
return true;
}
return false;
} | // Generic format is T<digits> - for example T1, T2, T10 | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/aptos_types/type_tag.ts#L255-L260 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | nextToken | function nextToken(tagStr: string, pos: number): [Token, number] {
const c = tagStr[pos];
if (c === ":") {
if (tagStr.slice(pos, pos + 2) === "::") {
return [["COLON", "::"], 2];
}
bail("Unrecognized token.");
} else if (c === "<") {
return [["LT", "<"], 1];
} else if (c === ">") {
ret... | // Returns Token and Token byte size | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/aptos_types/type_tag.ts#L267-L307 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | TypeTagParser.consumeWholeGeneric | private consumeWholeGeneric() {
this.consume("<");
while (this.tokens[0][1] !== ">") {
// If it is nested, we have to consume another nested generic
if (this.tokens[0][1] === "<") {
this.consumeWholeGeneric();
} else {
this.tokens.shift();
}
}
this.consume(">");
... | /**
* Consumes all of an unused generic field, mostly applicable to object
*
* Note: This is recursive. it can be problematic if there's bad input
* @private
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/aptos_types/type_tag.ts#L348-L359 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Deserializer.deserializeStr | deserializeStr(): string {
const value = this.deserializeBytes();
const textDecoder = new TextDecoder();
return textDecoder.decode(value);
} | /**
* Deserializes a string. UTF8 string is supported. Reads the string's bytes length "l" first,
* and then reads "l" bytes of content. Decodes the byte array into a string.
*
* BCS layout for "string": string_length | string_content. string_length is the bytes length of
* the string that is uleb128 enc... | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/bcs/deserializer.ts#L50-L54 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Deserializer.deserializeBytes | deserializeBytes(): Bytes {
const len = this.deserializeUleb128AsU32();
return new Uint8Array(this.read(len));
} | /**
* Deserializes an array of bytes.
*
* BCS layout for "bytes": bytes_length | bytes. bytes_length is the length of the bytes array that is
* uleb128 encoded. bytes_length is a u32 integer.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/bcs/deserializer.ts#L62-L65 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Deserializer.deserializeFixedBytes | deserializeFixedBytes(len: number): Bytes {
return new Uint8Array(this.read(len));
} | /**
* Deserializes an array of bytes. The number of bytes to read is already known.
*
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/bcs/deserializer.ts#L71-L73 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Deserializer.deserializeBool | deserializeBool(): boolean {
const bool = new Uint8Array(this.read(1))[0];
if (bool !== 1 && bool !== 0) {
throw new Error("Invalid boolean value");
}
return bool === 1;
} | /**
* Deserializes a boolean value.
*
* BCS layout for "boolean": One byte. "0x01" for True and "0x00" for False.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/bcs/deserializer.ts#L80-L86 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Deserializer.deserializeU8 | deserializeU8(): Uint8 {
return new DataView(this.read(1)).getUint8(0);
} | /**
* Deserializes a uint8 number.
*
* BCS layout for "uint8": One byte. Binary format in little-endian representation.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/bcs/deserializer.ts#L93-L95 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Deserializer.deserializeU16 | deserializeU16(): Uint16 {
return new DataView(this.read(2)).getUint16(0, true);
} | /**
* Deserializes a uint16 number.
*
* BCS layout for "uint16": Two bytes. Binary format in little-endian representation.
* @example
* ```ts
* const deserializer = new Deserializer(new Uint8Array([0x34, 0x12]));
* assert(deserializer.deserializeU16() === 4660);
* ```
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/bcs/deserializer.ts#L107-L109 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Deserializer.deserializeU32 | deserializeU32(): Uint32 {
return new DataView(this.read(4)).getUint32(0, true);
} | /**
* Deserializes a uint32 number.
*
* BCS layout for "uint32": Four bytes. Binary format in little-endian representation.
* @example
* ```ts
* const deserializer = new Deserializer(new Uint8Array([0x78, 0x56, 0x34, 0x12]));
* assert(deserializer.deserializeU32() === 305419896);
* ```
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/bcs/deserializer.ts#L121-L123 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Deserializer.deserializeU64 | deserializeU64(): Uint64 {
const low = this.deserializeU32();
const high = this.deserializeU32();
// combine the two 32-bit values and return (little endian)
return BigInt((BigInt(high) << BigInt(32)) | BigInt(low));
} | /**
* Deserializes a uint64 number.
*
* BCS layout for "uint64": Eight bytes. Binary format in little-endian representation.
* @example
* ```ts
* const deserializer = new Deserializer(new Uint8Array([0x00, 0xEF, 0xCD, 0xAB, 0x78, 0x56, 0x34, 0x12]));
* assert(deserializer.deserializeU64() === 13117... | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/bcs/deserializer.ts#L135-L141 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Deserializer.deserializeU128 | deserializeU128(): Uint128 {
const low = this.deserializeU64();
const high = this.deserializeU64();
// combine the two 64-bit values and return (little endian)
return BigInt((high << BigInt(64)) | low);
} | /**
* Deserializes a uint128 number.
*
* BCS layout for "uint128": Sixteen bytes. Binary format in little-endian representation.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/bcs/deserializer.ts#L148-L154 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Deserializer.deserializeU256 | deserializeU256(): Uint256 {
const low = this.deserializeU128();
const high = this.deserializeU128();
// combine the two 128-bit values and return (little endian)
return BigInt((high << BigInt(128)) | low);
} | /**
* Deserializes a uint256 number.
*
* BCS layout for "uint256": Thirty-two bytes. Binary format in little-endian representation.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/bcs/deserializer.ts#L161-L167 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Deserializer.deserializeUleb128AsU32 | deserializeUleb128AsU32(): Uint32 {
let value: bigint = BigInt(0);
let shift = 0;
while (value < MAX_U32_NUMBER) {
const byte = this.deserializeU8();
value |= BigInt(byte & 0x7f) << BigInt(shift);
if ((byte & 0x80) === 0) {
break;
}
shift += 7;
}
if (value > ... | /**
* Deserializes a uleb128 encoded uint32 number.
*
* BCS use uleb128 encoding in two cases: (1) lengths of variable-length sequences and (2) tags of enum values
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/bcs/deserializer.ts#L174-L192 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Serializer.serializeStr | serializeStr(value: string): void {
const textEncoder = new TextEncoder();
this.serializeBytes(textEncoder.encode(value));
} | /**
* Serializes a string. UTF8 string is supported. Serializes the string's bytes length "l" first,
* and then serializes "l" bytes of the string content.
*
* BCS layout for "string": string_length | string_content. string_length is the bytes length of
* the string that is uleb128 encoded. string_length... | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/bcs/serializer.ts#L71-L74 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Serializer.serializeBytes | serializeBytes(value: Bytes): void {
this.serializeU32AsUleb128(value.length);
this.serialize(value);
} | /**
* Serializes an array of bytes.
*
* BCS layout for "bytes": bytes_length | bytes. bytes_length is the length of the bytes array that is
* uleb128 encoded. bytes_length is a u32 integer.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/bcs/serializer.ts#L82-L85 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Serializer.serializeFixedBytes | serializeFixedBytes(value: Bytes): void {
this.serialize(value);
} | /**
* Serializes an array of bytes with known length. Therefore length doesn't need to be
* serialized to help deserialization. When deserializing, the number of
* bytes to deserialize needs to be passed in.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/bcs/serializer.ts#L92-L94 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Serializer.serializeBool | serializeBool(value: boolean): void {
if (typeof value !== "boolean") {
throw new Error("Value needs to be a boolean");
}
const byteValue = value ? 1 : 0;
this.serialize(new Uint8Array([byteValue]));
} | /**
* Serializes a boolean value.
*
* BCS layout for "boolean": One byte. "0x01" for True and "0x00" for False.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/bcs/serializer.ts#L101-L107 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Serializer.getBytes | getBytes(): Bytes {
return new Uint8Array(this.buffer).slice(0, this.offset);
} | /**
* Returns the buffered bytes
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/bcs/serializer.ts#L222-L224 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | checkNumberRange | function checkNumberRange<T extends AnyNumber>(minValue: T, maxValue: T, message?: string) {
return (target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => {
const childFunction = descriptor.value;
// eslint-disable-next-line no-param-reassign
descriptor.value = function deco(value: AnyN... | /**
* Creates a decorator to make sure the arg value of the decorated function is within a range.
* @param minValue The arg value of decorated function must >= minValue
* @param maxValue The arg value of decorated function must <= maxValue
* @param message Error message
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/transaction_builder/bcs/serializer.ts#L233-L246 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Ed25519Account.constructor | constructor(args: Ed25519SignerConstructorArgs) {
const { privateKey, address } = args;
this.privateKey = privateKey;
this.publicKey = privateKey.publicKey();
this.accountAddress = address ? AccountAddress.from(address) : this.publicKey.authKey().derivedAddress();
} | // region Constructors | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/account/Ed25519Account.ts#L44-L49 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Ed25519Account.generate | static generate() {
const privateKey = Ed25519PrivateKey.generate();
return new Ed25519Account({ privateKey });
} | /**
* Derives a signer from a randomly generated private key
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/account/Ed25519Account.ts#L54-L57 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Ed25519Account.fromDerivationPath | static fromDerivationPath(args: Ed25519SignerFromDerivationPathArgs) {
const { path, mnemonic } = args;
const privateKey = Ed25519PrivateKey.fromDerivationPath(path, mnemonic);
return new Ed25519Account({ privateKey });
} | /**
* Derives an account with bip44 path and mnemonics
*
* @param args.path the BIP44 derive hardened path e.g. m/44'/637'/0'/0'/0'
* Detailed description: {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki}
* @param args.mnemonic the mnemonic seed phrase of the account
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/account/Ed25519Account.ts#L66-L70 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Ed25519Account.verifySignature | verifySignature(args: VerifyEd25519SignatureArgs): boolean {
return this.publicKey.verifySignature(args);
} | /**
* Verify the given message and signature with the public key.
*
* @param args.message raw message data in HexInput format
* @param args.signature signed message Signature
* @returns
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/account/Ed25519Account.ts#L83-L85 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Ed25519Account.signWithAuthenticator | signWithAuthenticator(message: HexInput): AccountAuthenticatorEd25519 {
return new AccountAuthenticatorEd25519(this.publicKey, this.privateKey.sign(message));
} | /**
* Sign a message using the account's Ed25519 private key.
* @param message the signing message, as binary input
* @return the AccountAuthenticator containing the signature, together with the account's public key
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/account/Ed25519Account.ts#L92-L94 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Ed25519Account.signTransactionWithAuthenticator | signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorEd25519 {
return new AccountAuthenticatorEd25519(this.publicKey, this.signTransaction(transaction));
} | /**
* Sign a transaction using the account's Ed25519 private key.
* @param transaction the raw transaction
* @return the AccountAuthenticator containing the signature of the transaction, together with the account's public key
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/account/Ed25519Account.ts#L101-L103 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Ed25519Account.sign | sign(message: HexInput): Ed25519Signature {
return this.privateKey.sign(message);
} | /**
* Sign the given message using the account's Ed25519 private key.
* @param message in HexInput format
* @returns Signature
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/account/Ed25519Account.ts#L110-L112 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Ed25519Account.signTransaction | signTransaction(transaction: AnyRawTransaction): Ed25519Signature {
return this.sign(generateSigningMessageForTransaction(transaction));
} | /**
* Sign the given transaction using the available signing capabilities.
* @param transaction the transaction to be signed
* @returns Signature
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/account/Ed25519Account.ts#L119-L121 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | MultiKeyAccount.constructor | constructor(args: { multiKey: MultiKey; signers: Account[] }) {
const { multiKey, signers } = args;
this.publicKey = multiKey;
this.signingScheme = SigningScheme.MultiKey;
this.accountAddress = this.publicKey.authKey().derivedAddress();
// Get the index of each respective signer in the bitmap
... | /**
* constructor for MultiKeyAccount
*
* @param args.multiKey the multikey of the account which consists of N public keys and a number M which is
* the number of required signatures.
* @param args.signers an array of M signers that will be used to sign the transaction
* @returns MultiKeyAccount
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/account/MultiKeyAccount.ts#L63-L84 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | MultiKeyAccount.fromPublicKeysAndSigners | static fromPublicKeysAndSigners(args: {
publicKeys: PublicKey[];
signaturesRequired: number;
signers: Account[];
}): MultiKeyAccount {
const { publicKeys, signaturesRequired, signers } = args;
const multiKey = new MultiKey({ publicKeys, signaturesRequired });
return new MultiKeyAccount({ multi... | /**
* Static constructor for MultiKeyAccount
*
* @param args.publicKeys the N public keys of the MultiKeyAccount
* @param args.signaturesRequired the number of signatures required
* @param args.signers an array of M signers that will be used to sign the transaction
* @returns MultiKeyAccount
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/account/MultiKeyAccount.ts#L94-L102 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | MultiKeyAccount.signWithAuthenticator | signWithAuthenticator(message: HexInput): AccountAuthenticatorMultiKey {
return new AccountAuthenticatorMultiKey(this.publicKey, this.sign(message));
} | /**
* Sign a message using the account's signers.
* @param message the signing message, as binary input
* @return the AccountAuthenticator containing the signature, together with the account's public key
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/account/MultiKeyAccount.ts#L113-L115 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | MultiKeyAccount.signTransactionWithAuthenticator | signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorMultiKey {
return new AccountAuthenticatorMultiKey(this.publicKey, this.signTransaction(transaction));
} | /**
* Sign a transaction using the account's signers.
* @param transaction the raw transaction
* @return the AccountAuthenticator containing the signature of the transaction, together with the account's public key
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/account/MultiKeyAccount.ts#L122-L124 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | MultiKeyAccount.sign | sign(data: HexInput): MultiKeySignature {
const signatures = [];
for (const signer of this.signers) {
signatures.push(signer.sign(data));
}
return new MultiKeySignature({ signatures, bitmap: this.signaturesBitmap });
} | /**
* Sign the given message using the MultiKeyAccount's signers
* @param message in HexInput format
* @returns MultiKeySignature
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/account/MultiKeyAccount.ts#L131-L137 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | MultiKeyAccount.signTransaction | signTransaction(transaction: AnyRawTransaction): MultiKeySignature {
const signatures = [];
for (const signer of this.signers) {
signatures.push(signer.signTransaction(transaction));
}
return new MultiKeySignature({ signatures, bitmap: this.signaturesBitmap });
} | /**
* Sign the given transaction using the MultiKeyAccount's signers
* @param transaction the transaction to be signed
* @returns MultiKeySignature
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/account/MultiKeyAccount.ts#L144-L150 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | MultiKeyAccount.verifySignature | verifySignature(args: VerifyMultiKeySignatureArgs): boolean {
const { message, signature } = args;
const isSignerIndiciesSorted = this.signerIndicies.every(
(value, i) => i === 0 || value >= this.signerIndicies[i - 1],
);
if (!isSignerIndiciesSorted) {
return false;
}
for (let i = 0;... | /**
* Verify the given message and signature with the public key.
*
* @param args.message raw message data in HexInput format
* @param args.signatures signed message MultiKeySignature
* @returns boolean
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/account/MultiKeyAccount.ts#L159-L175 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | SingleKeyAccount.constructor | constructor(args: SingleKeySignerConstructorArgs) {
const { privateKey, address } = args;
this.privateKey = privateKey;
this.publicKey = new AnyPublicKey(privateKey.publicKey());
this.accountAddress = address ? AccountAddress.from(address) : this.publicKey.authKey().derivedAddress();
} | // region Constructors | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/account/SingleKeyAccount.ts#L49-L54 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | SingleKeyAccount.generate | static generate(args: SingleKeySignerGenerateArgs = {}) {
const { scheme = SigningSchemeInput.Ed25519 } = args;
let privateKey: PrivateKey;
switch (scheme) {
case SigningSchemeInput.Ed25519:
privateKey = Ed25519PrivateKey.generate();
break;
case SigningSchemeInput.Secp256k1Ecdsa:... | /**
* Derives an account from a randomly generated private key.
* Default generation is using an Ed25519 key
* @returns Account with the given signature scheme
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/account/SingleKeyAccount.ts#L61-L75 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | SingleKeyAccount.fromDerivationPath | static fromDerivationPath(args: SingleKeySignerFromDerivationPathArgs) {
const { scheme = SigningSchemeInput.Ed25519, path, mnemonic } = args;
let privateKey: PrivateKey;
switch (scheme) {
case SigningSchemeInput.Ed25519:
privateKey = Ed25519PrivateKey.fromDerivationPath(path, mnemonic);
... | /**
* Derives an account with bip44 path and mnemonics,
* Default to using an Ed25519 signature scheme.
*
* @param args.scheme The signature scheme to derive the private key with
* @param args.path the BIP44 derive hardened path (e.g. m/44'/637'/0'/0'/0') for Ed25519,
* or non-hardened path (e.g. m/44... | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/account/SingleKeyAccount.ts#L87-L101 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | SingleKeyAccount.verifySignature | verifySignature(args: VerifySingleKeySignatureArgs): boolean {
return this.publicKey.verifySignature(args);
} | /**
* Verify the given message and signature with the public key.
*
* @param args.message raw message data in HexInput format
* @param args.signature signed message Signature
* @returns
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/account/SingleKeyAccount.ts#L114-L116 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | SingleKeyAccount.signWithAuthenticator | signWithAuthenticator(message: HexInput): AccountAuthenticatorSingleKey {
return new AccountAuthenticatorSingleKey(this.publicKey, this.sign(message));
} | /**
* Sign a message using the account's private key.
* @param message the signing message, as binary input
* @return the AccountAuthenticator containing the signature, together with the account's public key
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/account/SingleKeyAccount.ts#L123-L125 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | SingleKeyAccount.signTransactionWithAuthenticator | signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorSingleKey {
return new AccountAuthenticatorSingleKey(this.publicKey, this.signTransaction(transaction));
} | /**
* Sign a transaction using the account's private key.
* @param transaction the raw transaction
* @return the AccountAuthenticator containing the signature of the transaction, together with the account's public key
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/account/SingleKeyAccount.ts#L132-L134 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | SingleKeyAccount.sign | sign(message: HexInput): AnySignature {
return new AnySignature(this.privateKey.sign(message));
} | /**
* Sign the given message using the account's private key.
* @param message in HexInput format
* @returns Signature
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/account/SingleKeyAccount.ts#L141-L143 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | SingleKeyAccount.signTransaction | signTransaction(transaction: AnyRawTransaction): AnySignature {
return this.sign(generateSigningMessageForTransaction(transaction));
} | /**
* Sign the given transaction using the account's private key.
* @param transaction the transaction to be signed
* @returns Signature
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/account/SingleKeyAccount.ts#L150-L152 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | FungibleAsset.transferFungibleAsset | async transferFungibleAsset(args: {
senderAddress: AccountAddress;
fungibleAssetMetadataAddress: AccountAddressInput;
recipient: AccountAddressInput;
amount: AnyNumber;
options?: InputGenerateTransactionOptions;
}): Promise<SimpleTransaction> {
return transferFungibleAsset({ aptosConfig: this.... | /**
* Transfer `amount` of fungible asset from sender's primary store to recipient's primary store.
*
* Use this method to transfer any fungible asset including fungible token.
*
* @example
* const transaction = await aptos.transferFungibleAsset({
* sender: alice,
* fungibleAssetMetadataAddres... | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/api/fungibleAsset.ts#L164-L172 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Transaction.constructor | constructor(config: AptosConfig) {
this.config = config;
this.build = new Build(this.config);
this.simulate = new Simulate(this.config);
this.submit = new Submit(this.config);
// this.batch = new TransactionManagement(this.config);
} | // readonly batch: TransactionManagement; | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/api/transaction.ts#L55-L61 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Transaction.getSigningMessage | getSigningMessage(args: { transaction: AnyRawTransaction }): Uint8Array {
return getSigningMessage(args);
} | // eslint-disable-next-line class-methods-use-this | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/api/transaction.ts#L201-L203 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Transaction.publishPackageTransaction | async publishPackageTransaction(args: {
account: AccountAddressInput;
metadataBytes: HexInput;
moduleBytecode: Array<HexInput>;
options?: InputGenerateTransactionOptions;
}): Promise<SimpleTransaction> {
return publicPackageTransaction({aptosConfig: this.config, ...args});
... | /**
* Generates a transaction to publish a move package to chain.
*
* To get the `metadataBytes` and `byteCode`, can compile using Aptos CLI with command
* `aptos move compile --save-metadata ...`,
* For more info {@link https://aptos.dev/tutorials/your-first-dapp/#step-4-publish-a-move-module}... | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/api/transaction.ts#L225-L232 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Transaction.rotateAuthKey | async rotateAuthKey(args: { fromAccount: Account; toNewPrivateKey: PrivateKey }): Promise<TransactionResponse> {
return rotateAuthKey({aptosConfig: this.config, ...args});
} | /**
* Rotate an account's auth key. After rotation, only the new private key can be used to sign txns for
* the account.
* Note: Only legacy Ed25519 scheme is supported for now.
* More info: {@link https://aptos.dev/guides/account-management/key-rotation/}
*
* @example
* const respons... | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/api/transaction.ts#L251-L253 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Transaction.sign | sign(args: { signer: Account; transaction: AnyRawTransaction }): AccountAuthenticator {
return signTransaction({
...args,
});
} | // eslint-disable-next-line class-methods-use-this | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/api/transaction.ts#L271-L275 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Transaction.signAsFeePayer | signAsFeePayer(args: { signer: Account; transaction: AnyRawTransaction }): AccountAuthenticator {
const {signer, transaction} = args;
// if transaction doesnt hold a "feePayerAddress" prop it means
// this is not a fee payer transaction
if (!transaction.feePayerAddress) {
th... | // eslint-disable-next-line class-methods-use-this | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/api/transaction.ts#L293-L309 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Transaction.signAndSubmitTransaction | async signAndSubmitTransaction(args: {
signer: Account;
transaction: AnyRawTransaction;
}): Promise<PendingTransactionResponse> {
const {signer, transaction} = args;
return signAndSubmitTransaction({
aptosConfig: this.config,
signer,
transaction,
... | /**
* Sign and submit a single signer transaction to chain
*
* @param args.signer The signer account to sign the transaction
* @param args.transaction An instance of a RawTransaction, plus optional secondary/fee payer addresses
*
* @example
* const transaction = await aptos.transactio... | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/api/transaction.ts#L360-L370 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Build.simple | async simple(args: {
sender: AccountAddressInput;
data: InputGenerateTransactionPayloadData;
options?: InputGenerateTransactionOptions;
withFeePayer?: boolean;
}): Promise<SimpleTransaction> {
return generateTransaction({ aptosConfig: this.config, ...args });
} | /**
* Build a simple transaction
*
* @param args.sender The sender account address
* @param args.data The transaction data
* @param args.options optional. Optional transaction configurations
* @param args.withFeePayer optional. Whether there is a fee payer for the transaction
*
* @returns Simple... | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/api/transactionSubmission/build.ts#L31-L38 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Build.multiAgent | async multiAgent(args: {
sender: AccountAddressInput;
data: InputGenerateTransactionPayloadData;
secondarySignerAddresses: AccountAddressInput[];
options?: InputGenerateTransactionOptions;
withFeePayer?: boolean;
}): Promise<MultiAgentTransaction> {
return generateTransaction({ aptosConfig: th... | /**
* Build a multi agent transaction
*
* @param args.sender The sender account address
* @param args.data The transaction data
* @param args.secondarySignerAddresses An array of the secondary signers account addresses
* @param args.options optional. Optional transaction configurations
* @param arg... | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/api/transactionSubmission/build.ts#L51-L59 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Sign.transaction | transaction(args: { signer: Account; transaction: AnyRawTransaction }): AccountAuthenticator {
return signTransaction({
...args,
});
} | // eslint-disable-next-line class-methods-use-this | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/api/transactionSubmission/sign.ts#L20-L24 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Sign.transactionAsFeePayer | transactionAsFeePayer(args: { signer: Account; transaction: AnyRawTransaction }): AccountAuthenticator {
const { signer, transaction } = args;
// if transaction doesnt hold a "feePayerAddress" prop it means
// this is not a fee payer transaction
if (!transaction.feePayerAddress) {
throw new Error... | // eslint-disable-next-line class-methods-use-this | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/api/transactionSubmission/sign.ts#L27-L43 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Deserializer.deserializeStr | deserializeStr(): string {
const value = this.deserializeBytes();
const textDecoder = new TextDecoder();
return textDecoder.decode(value);
} | /**
* Deserializes a string. UTF8 string is supported. Reads the string's bytes length "l" first,
* and then reads "l" bytes of content. Decodes the byte array into a string.
*
* BCS layout for "string": string_length | string_content
* where string_length is a u32 integer encoded as a uleb128 ... | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/bcs/deserializer.ts#L54-L58 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Deserializer.deserializeBytes | deserializeBytes(): Uint8Array {
const len = this.deserializeUleb128AsU32();
return new Uint8Array(this.read(len));
} | /**
* Deserializes an array of bytes.
*
* BCS layout for "bytes": bytes_length | bytes
* where bytes_length is a u32 integer encoded as a uleb128 integer, equal to the length of the bytes array.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/bcs/deserializer.ts#L66-L69 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Deserializer.deserializeFixedBytes | deserializeFixedBytes(len: number): Uint8Array {
return new Uint8Array(this.read(len));
} | /**
* Deserializes an array of bytes. The number of bytes to read is already known.
*
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/bcs/deserializer.ts#L75-L77 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Deserializer.deserializeBool | deserializeBool(): boolean {
const bool = new Uint8Array(this.read(1))[0];
if (bool !== 1 && bool !== 0) {
throw new Error("Invalid boolean value");
}
return bool === 1;
} | /**
* Deserializes a boolean value.
*
* BCS layout for "boolean": One byte. "0x01" for true and "0x00" for false.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/bcs/deserializer.ts#L84-L90 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Deserializer.deserializeU8 | deserializeU8(): Uint8 {
return new DataView(this.read(1)).getUint8(0);
} | /**
* Deserializes a uint8 number.
*
* BCS layout for "uint8": One byte. Binary format in little-endian representation.
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/bcs/deserializer.ts#L97-L99 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Deserializer.deserializeU16 | deserializeU16(): Uint16 {
return new DataView(this.read(2)).getUint16(0, true);
} | /**
* Deserializes a uint16 number.
*
* BCS layout for "uint16": Two bytes. Binary format in little-endian representation.
* @example
* ```ts
* const deserializer = new Deserializer(new Uint8Array([0x34, 0x12]));
* assert(deserializer.deserializeU16() === 4660);
* ```
*/ | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/bcs/deserializer.ts#L111-L113 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
js-wallet-sdk | github_2023 | okx | typescript | Deserializer.deserializeU32 | deserializeU32(): Uint32 {
return new DataView(this.read(4)).getUint32(0, true);
} | /**
* Deserializes a uint32 number.
*
* BCS layout for "uint32": Four bytes. Binary format in little-endian representation.
* @example
* ```ts
* const deserializer = new Deserializer(new Uint8Array([0x78, 0x56, 0x34, 0x12]));
* assert(deserializer.deserializeU32() === 305419896);
... | https://github.com/okx/js-wallet-sdk/blob/dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89/packages/coin-aptos/src/v2/bcs/deserializer.ts#L125-L127 | dcb1ce39ebfdf747ec71ee657f11d5b2df0bba89 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.