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