BCS
The @mysten/sui/bcs package extends @mysten/bcs with Sui specific scheme definitions.
To learn more about using BCS see the BCS documentation.
the bcs export of @mysten/sui/bcs contains all the same exports as bcs from @mysten/bcs plus
the following pre-defined schemes:
U8U16U32U64U128U256ULEB128BoolStringAddressArgumentCallArgCompressedSignatureGasDataMultiSigMultiSigPkMapMultiSigPublicKeyObjectArgObjectDigestProgrammableMoveCallProgrammableTransactionPublicKeySenderSignedDataSharedObjectRefStructTagSuiObjectRefTransactionTransactionDataTransactionDataV1TransactionExpirationTransactionKindTypeTag
All the upper-cased values are BcsType instances, and can be used directly to parse and serialize
data.
import { bcs } from '@mysten/sui/bcs';
bcs.U8.serialize(1);
bcs.Address.serialize('0x1');
bcs.TypeTag.serialize({
vector: {
u8: true,
},
});