github ava-labs/avalanchejs v3.2.0

latest releases: v5.1.0-alpha.4, v5.1.0-canary.5, v5.1.0-canary.4...
5 years ago

Apricot Release πŸŽ‰

CodecID 1 πŸ“’

AvalancheJS now supports codecID 00 00 and 00 01. By default it will encode all serializable classes to codecID 00 00 in order to remain backward-compatible w/ the pre-apricot build of AvalancheGo. All serializable objects have a 4 byte typeID when encoded to codecID 00 00. CodecID 00 01 instead has a 2 byte groupID and a 2 byte typeID.

For exampleβ€”a SECPTransferOutput, when encoded to codecID 00 00, has a 4 byte typeID of 00 00 00 07. When encoded to codecID 00 01 it has a 2 byte groupID of 00 01 and a 2 byte typeID of 00 02. Internally AvalancheJS handles the 2 byte groupID and 2 byte typeID as a single 4 byte value. So groupID 00 01 and typeID 00 02 becomes 00 01 00 02 or 65538 in decimal, which is how it's stored as a constant.

GroupID 0

  • avm.BaseTx --> typeID 0
  • avm.CreateAssetTx --> type ID 1
  • avm.OperationTx --> typeID 2
  • avm.ImportTx --> type ID 3
  • avm.ImportTx --> type ID 4

GroupdID 1

  • secp2561fx.TransferInput --> typeID 0
  • secp2561fx.MintOutput --> typeID 1
  • secp2561fx.TransferOutput --> typeID 2
  • secp2561fx.MintOperation --> typeID 3
  • secp2561fx.Credential --> typeID 4

GroupID 2

  • nftfx.MintOutput --> typeID 0
  • nftfx.TransferOutput --> typeID 1
  • nftfx.MintOperation --> typeID 2
  • nftfx.TransferOperation --> typeID 3
  • nftfx.Credential --> typeID 4

Example Scripts πŸ’»

The examples/ directory

Don't miss a new avalanchejs release

NewReleases is sending notifications on new releases.