UNPKG

ribbit-wallet-connect

Version:

Next-generation multi-chain wallet and payments app that makes crypto simple, secure, and usable in daily life.

26 lines (25 loc) 1.11 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BCS = void 0; const ts_sdk_1 = require("@aptos-labs/ts-sdk"); /** * BCS serialization and parsing utilities for dapps. * These helpers allow dapps to build arguments and type tags * without importing Aptos SDK types directly. */ exports.BCS = { bcsSerializeU8: (value) => new ts_sdk_1.U8(value), bcsSerializeU16: (value) => new ts_sdk_1.U16(value), bcsSerializeU32: (value) => new ts_sdk_1.U32(value), bcsSerializeU64: (value) => new ts_sdk_1.U64(BigInt(value)), bcsSerializeU128: (value) => new ts_sdk_1.U128(BigInt(value)), bcsSerializeU256: (value) => new ts_sdk_1.U256(BigInt(value)), bcsSerializeAddress: (address) => ts_sdk_1.AccountAddress.fromString(address), parseTypeTag: (ty) => (0, ts_sdk_1.parseTypeTag)(ty), typeTagStruct: (ty) => (0, ts_sdk_1.parseTypeTag)(ty), // structTag: (ty: string) => { // const tag = parseTypeTag(ty); // if (tag instanceof TypeTagStruct) return tag.value as StructTag; // throw new Error('Not a StructTag'); // }, };