Files
zeekay 7cf87b230b node-unified is the node
The module already called itself github.com/luxfi/node while containing no node
in Go: cmd/luxd was twenty-one lines that printed the size of a few types, and
the Go column of the matrix measured a VM plugin. A repo that fetches the thing
it claims to be has not replaced it, so the Go sources move in — 1515 files,
the daemon and everything under it — and the build reaches outside this module
for nothing.

Rust and C++ sit beside it unchanged and are still measured against it by the
differential. That is the point of one repo: the reference implementation and
the two ports are the same checkout, so parity is a thing you can run rather
than a thing you assert.

Verified: builds, and the closure carries no lux-private — checked at build time
rather than believed. The daemon starts twelve chains on a local network
(P X C Q Z A B G K M F, plus D through its plugin) and reports healthy.
2026-09-07 16:15:25 -07:00

2606 lines
69 KiB
Go

// Code generated by zip; DO NOT EDIT.
package platformvm
import (
"encoding/binary"
"fmt"
"strings"
formatting "github.com/luxfi/formatting"
ids "github.com/luxfi/ids"
json "github.com/luxfi/node/utils/json"
gas "github.com/luxfi/node/vms/components/gas"
api "github.com/luxfi/node/vms/platformvm/api"
status "github.com/luxfi/node/vms/platformvm/status"
utxo "github.com/luxfi/utxo"
validators "github.com/luxfi/validators"
types "github.com/luxfi/vm/types"
zap "github.com/zap-proto/go"
)
// ---- APIBlockchain -----------------------------------------------------
const (
aPIBlockchainIDAt = 0
aPIBlockchainNameAt = 32
aPIBlockchainChainIDAt = 40
aPIBlockchainVMIDAt = 72
aPIBlockchainSize = 104
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*APIBlockchain)(nil)
// MarshalZAP writes APIBlockchain from constant offsets.
func (x *APIBlockchain) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(aPIBlockchainSize + 256)
ob := b.StartObject(aPIBlockchainSize)
ob.SetBytesFixed(aPIBlockchainIDAt, x.ID[:])
ob.SetText(aPIBlockchainNameAt, string(x.Name))
ob.SetBytesFixed(aPIBlockchainChainIDAt, x.ChainID[:])
ob.SetBytesFixed(aPIBlockchainVMIDAt, x.VMID[:])
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads APIBlockchain out of the buffer that arrived.
func (x *APIBlockchain) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("APIBlockchain: %w", err)
}
o := m.Root()
copy(x.ID[:], o.BytesFixed(aPIBlockchainIDAt, 32))
x.Name = string(strings.Clone(o.Text(aPIBlockchainNameAt)))
copy(x.ChainID[:], o.BytesFixed(aPIBlockchainChainIDAt, 32))
copy(x.VMID[:], o.BytesFixed(aPIBlockchainVMIDAt, 32))
return nil
}
// ---- APIChain ----------------------------------------------------------
const (
aPIChainIDAt = 0
aPIChainControlKeysAt = 32
aPIChainThresholdAt = 40
aPIChainSize = 48
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*APIChain)(nil)
// MarshalZAP writes APIChain from constant offsets.
func (x *APIChain) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(aPIChainSize + 256)
controlKeysAt, controlKeysN := 0, len(x.ControlKeys)
if controlKeysN > 0 {
var blob []byte
for i := range x.ControlKeys {
enc := []byte(x.ControlKeys[i])
var n [4]byte
binary.LittleEndian.PutUint32(n[:], uint32(len(enc)))
blob = append(blob, n[:]...)
blob = append(blob, enc...)
}
controlKeysAt = b.WriteBytes(blob)
}
ob := b.StartObject(aPIChainSize)
ob.SetBytesFixed(aPIChainIDAt, x.ID[:])
ob.SetUint32(aPIChainThresholdAt, uint32(x.Threshold))
if controlKeysN > 0 {
ob.SetList(aPIChainControlKeysAt, controlKeysAt, controlKeysN)
}
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads APIChain out of the buffer that arrived.
func (x *APIChain) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("APIChain: %w", err)
}
o := m.Root()
copy(x.ID[:], o.BytesFixed(aPIChainIDAt, 32))
if l := o.List(aPIChainControlKeysAt); l.Len() > 0 {
rows := make([]string, l.Len())
for i := range rows {
rows[i] = string(l.BytesAt(i))
}
x.ControlKeys = rows
}
x.Threshold = json.Uint32(o.Uint32(aPIChainThresholdAt))
return nil
}
// ---- APINet ------------------------------------------------------------
const (
aPINetIDAt = 0
aPINetControlKeysAt = 32
aPINetThresholdAt = 40
aPINetSize = 48
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*APINet)(nil)
// MarshalZAP writes APINet from constant offsets.
func (x *APINet) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(aPINetSize + 256)
controlKeysAt, controlKeysN := 0, len(x.ControlKeys)
if controlKeysN > 0 {
var blob []byte
for i := range x.ControlKeys {
enc := []byte(x.ControlKeys[i])
var n [4]byte
binary.LittleEndian.PutUint32(n[:], uint32(len(enc)))
blob = append(blob, n[:]...)
blob = append(blob, enc...)
}
controlKeysAt = b.WriteBytes(blob)
}
ob := b.StartObject(aPINetSize)
ob.SetBytesFixed(aPINetIDAt, x.ID[:])
ob.SetUint32(aPINetThresholdAt, uint32(x.Threshold))
if controlKeysN > 0 {
ob.SetList(aPINetControlKeysAt, controlKeysAt, controlKeysN)
}
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads APINet out of the buffer that arrived.
func (x *APINet) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("APINet: %w", err)
}
o := m.Root()
copy(x.ID[:], o.BytesFixed(aPINetIDAt, 32))
if l := o.List(aPINetControlKeysAt); l.Len() > 0 {
rows := make([]string, l.Len())
for i := range rows {
rows[i] = string(l.BytesAt(i))
}
x.ControlKeys = rows
}
x.Threshold = json.Uint32(o.Uint32(aPINetThresholdAt))
return nil
}
// ---- Amount ------------------------------------------------------------
const (
amountAssetIDAt = 0
amountValueAt = 32
amountSize = 40
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*Amount)(nil)
// MarshalZAP writes Amount from constant offsets.
func (x *Amount) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(amountSize + 256)
ob := b.StartObject(amountSize)
ob.SetBytesFixed(amountAssetIDAt, x.AssetID[:])
ob.SetUint64(amountValueAt, uint64(x.Value))
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads Amount out of the buffer that arrived.
func (x *Amount) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("Amount: %w", err)
}
o := m.Root()
copy(x.AssetID[:], o.BytesFixed(amountAssetIDAt, 32))
x.Value = json.Uint64(o.Uint64(amountValueAt))
return nil
}
// ---- ChainValidatorSet -------------------------------------------------
const (
chainValidatorSetChainIDAt = 0
chainValidatorSetValidatorsAt = 32
chainValidatorSetSize = 40
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*ChainValidatorSet)(nil)
// MarshalZAP writes ChainValidatorSet from constant offsets.
func (x *ChainValidatorSet) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(chainValidatorSetSize + 256)
validatorsAt, validatorsN := 0, len(x.Validators)
if validatorsN > 0 {
var blob []byte
for i := range x.Validators {
elem := x.Validators[i]
if elem == nil {
elem = new(validators.GetValidatorOutput)
}
enc, err := elem.MarshalZAP()
if err != nil {
return nil, err
}
var n [4]byte
binary.LittleEndian.PutUint32(n[:], uint32(len(enc)))
blob = append(blob, n[:]...)
blob = append(blob, enc...)
}
validatorsAt = b.WriteBytes(blob)
}
ob := b.StartObject(chainValidatorSetSize)
ob.SetBytesFixed(chainValidatorSetChainIDAt, x.ChainID[:])
if validatorsN > 0 {
ob.SetList(chainValidatorSetValidatorsAt, validatorsAt, validatorsN)
}
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads ChainValidatorSet out of the buffer that arrived.
func (x *ChainValidatorSet) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("ChainValidatorSet: %w", err)
}
o := m.Root()
copy(x.ChainID[:], o.BytesFixed(chainValidatorSetChainIDAt, 32))
if l := o.List(chainValidatorSetValidatorsAt); l.Len() > 0 {
rows := make([]*validators.GetValidatorOutput, l.Len())
for i := range rows {
rows[i] = new(validators.GetValidatorOutput)
if err := rows[i].UnmarshalZAP(l.BytesAt(i)); err != nil {
return err
}
}
x.Validators = rows
}
return nil
}
// ---- CurrentValidator --------------------------------------------------
const (
currentValidatorPermissionlessAt = 0
currentValidatorPermissionedAt = 8
currentValidatorL1At = 16
currentValidatorSize = 24
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*CurrentValidator)(nil)
// MarshalZAP writes CurrentValidator from constant offsets.
func (x *CurrentValidator) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(currentValidatorSize + 256)
ob := b.StartObject(currentValidatorSize)
if x.Permissionless != nil {
innerPermissionless, err := x.Permissionless.MarshalZAP()
if err != nil {
return nil, err
}
ob.SetBytes(currentValidatorPermissionlessAt, innerPermissionless)
}
if x.Permissioned != nil {
innerPermissioned, err := x.Permissioned.MarshalZAP()
if err != nil {
return nil, err
}
ob.SetBytes(currentValidatorPermissionedAt, innerPermissioned)
}
if x.L1 != nil {
innerL1, err := x.L1.MarshalZAP()
if err != nil {
return nil, err
}
ob.SetBytes(currentValidatorL1At, innerL1)
}
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads CurrentValidator out of the buffer that arrived.
func (x *CurrentValidator) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("CurrentValidator: %w", err)
}
o := m.Root()
if raw := o.Bytes(currentValidatorPermissionlessAt); len(raw) > 0 {
var v api.PermissionlessValidator
if err := v.UnmarshalZAP(raw); err != nil {
return err
}
x.Permissionless = &v
}
if raw := o.Bytes(currentValidatorPermissionedAt); len(raw) > 0 {
var v api.Staker
if err := v.UnmarshalZAP(raw); err != nil {
return err
}
x.Permissioned = &v
}
if raw := o.Bytes(currentValidatorL1At); len(raw) > 0 {
var v api.APIL1Validator
if err := v.UnmarshalZAP(raw); err != nil {
return err
}
x.L1 = &v
}
return nil
}
// ---- GetAllValidatorsAtArgs --------------------------------------------
const (
getAllValidatorsAtArgsHeightAt = 0
getAllValidatorsAtArgsSize = 8
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetAllValidatorsAtArgs)(nil)
// MarshalZAP writes GetAllValidatorsAtArgs from constant offsets.
func (x *GetAllValidatorsAtArgs) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getAllValidatorsAtArgsSize + 256)
ob := b.StartObject(getAllValidatorsAtArgsSize)
ob.SetUint64(getAllValidatorsAtArgsHeightAt, uint64(x.Height))
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetAllValidatorsAtArgs out of the buffer that arrived.
func (x *GetAllValidatorsAtArgs) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetAllValidatorsAtArgs: %w", err)
}
o := m.Root()
x.Height = api.Height(o.Uint64(getAllValidatorsAtArgsHeightAt))
return nil
}
// ---- GetAllValidatorsAtReply -------------------------------------------
const (
getAllValidatorsAtReplyValidatorSetsAt = 0
getAllValidatorsAtReplySize = 8
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetAllValidatorsAtReply)(nil)
// MarshalZAP writes GetAllValidatorsAtReply from constant offsets.
func (x *GetAllValidatorsAtReply) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getAllValidatorsAtReplySize + 256)
validatorSetsAt, validatorSetsN := 0, len(x.ValidatorSets)
if validatorSetsN > 0 {
var blob []byte
for i := range x.ValidatorSets {
enc, err := x.ValidatorSets[i].MarshalZAP()
if err != nil {
return nil, err
}
var n [4]byte
binary.LittleEndian.PutUint32(n[:], uint32(len(enc)))
blob = append(blob, n[:]...)
blob = append(blob, enc...)
}
validatorSetsAt = b.WriteBytes(blob)
}
ob := b.StartObject(getAllValidatorsAtReplySize)
if validatorSetsN > 0 {
ob.SetList(getAllValidatorsAtReplyValidatorSetsAt, validatorSetsAt, validatorSetsN)
}
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetAllValidatorsAtReply out of the buffer that arrived.
func (x *GetAllValidatorsAtReply) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetAllValidatorsAtReply: %w", err)
}
o := m.Root()
if l := o.List(getAllValidatorsAtReplyValidatorSetsAt); l.Len() > 0 {
rows := make([]ChainValidatorSet, l.Len())
for i := range rows {
if err := rows[i].UnmarshalZAP(l.BytesAt(i)); err != nil {
return err
}
}
x.ValidatorSets = rows
}
return nil
}
// ---- GetBalanceRequest -------------------------------------------------
const (
getBalanceRequestAddressesAt = 0
getBalanceRequestSize = 8
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetBalanceRequest)(nil)
// MarshalZAP writes GetBalanceRequest from constant offsets.
func (x *GetBalanceRequest) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getBalanceRequestSize + 256)
addressesAt, addressesN := 0, len(x.Addresses)
if addressesN > 0 {
var blob []byte
for i := range x.Addresses {
enc := []byte(x.Addresses[i])
var n [4]byte
binary.LittleEndian.PutUint32(n[:], uint32(len(enc)))
blob = append(blob, n[:]...)
blob = append(blob, enc...)
}
addressesAt = b.WriteBytes(blob)
}
ob := b.StartObject(getBalanceRequestSize)
if addressesN > 0 {
ob.SetList(getBalanceRequestAddressesAt, addressesAt, addressesN)
}
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetBalanceRequest out of the buffer that arrived.
func (x *GetBalanceRequest) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetBalanceRequest: %w", err)
}
o := m.Root()
if l := o.List(getBalanceRequestAddressesAt); l.Len() > 0 {
rows := make([]string, l.Len())
for i := range rows {
rows[i] = string(l.BytesAt(i))
}
x.Addresses = rows
}
return nil
}
// ---- GetBalanceResponse ------------------------------------------------
const (
getBalanceResponseBalanceAt = 0
getBalanceResponseUnlockedAt = 8
getBalanceResponseLockedStakeableAt = 16
getBalanceResponseLockedNotStakeableAt = 24
getBalanceResponseBalancesAt = 32
getBalanceResponseUnlockedsAt = 40
getBalanceResponseLockedStakeablesAt = 48
getBalanceResponseLockedNotStakeablesAt = 56
getBalanceResponseUTXOIDsAt = 64
getBalanceResponseSize = 72
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetBalanceResponse)(nil)
// MarshalZAP writes GetBalanceResponse from constant offsets.
func (x *GetBalanceResponse) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getBalanceResponseSize + 256)
balancesAt, balancesN := 0, len(x.Balances)
if balancesN > 0 {
var blob []byte
for i := range x.Balances {
enc, err := x.Balances[i].MarshalZAP()
if err != nil {
return nil, err
}
var n [4]byte
binary.LittleEndian.PutUint32(n[:], uint32(len(enc)))
blob = append(blob, n[:]...)
blob = append(blob, enc...)
}
balancesAt = b.WriteBytes(blob)
}
unlockedsAt, unlockedsN := 0, len(x.Unlockeds)
if unlockedsN > 0 {
var blob []byte
for i := range x.Unlockeds {
enc, err := x.Unlockeds[i].MarshalZAP()
if err != nil {
return nil, err
}
var n [4]byte
binary.LittleEndian.PutUint32(n[:], uint32(len(enc)))
blob = append(blob, n[:]...)
blob = append(blob, enc...)
}
unlockedsAt = b.WriteBytes(blob)
}
lockedStakeablesAt, lockedStakeablesN := 0, len(x.LockedStakeables)
if lockedStakeablesN > 0 {
var blob []byte
for i := range x.LockedStakeables {
enc, err := x.LockedStakeables[i].MarshalZAP()
if err != nil {
return nil, err
}
var n [4]byte
binary.LittleEndian.PutUint32(n[:], uint32(len(enc)))
blob = append(blob, n[:]...)
blob = append(blob, enc...)
}
lockedStakeablesAt = b.WriteBytes(blob)
}
lockedNotStakeablesAt, lockedNotStakeablesN := 0, len(x.LockedNotStakeables)
if lockedNotStakeablesN > 0 {
var blob []byte
for i := range x.LockedNotStakeables {
enc, err := x.LockedNotStakeables[i].MarshalZAP()
if err != nil {
return nil, err
}
var n [4]byte
binary.LittleEndian.PutUint32(n[:], uint32(len(enc)))
blob = append(blob, n[:]...)
blob = append(blob, enc...)
}
lockedNotStakeablesAt = b.WriteBytes(blob)
}
uTXOIDsAt, uTXOIDsN := 0, len(x.UTXOIDs)
if uTXOIDsN > 0 {
var blob []byte
for i := range x.UTXOIDs {
elem := x.UTXOIDs[i]
if elem == nil {
elem = new(utxo.UTXOID)
}
enc, err := elem.MarshalZAP()
if err != nil {
return nil, err
}
var n [4]byte
binary.LittleEndian.PutUint32(n[:], uint32(len(enc)))
blob = append(blob, n[:]...)
blob = append(blob, enc...)
}
uTXOIDsAt = b.WriteBytes(blob)
}
ob := b.StartObject(getBalanceResponseSize)
ob.SetUint64(getBalanceResponseBalanceAt, uint64(x.Balance))
ob.SetUint64(getBalanceResponseUnlockedAt, uint64(x.Unlocked))
ob.SetUint64(getBalanceResponseLockedStakeableAt, uint64(x.LockedStakeable))
ob.SetUint64(getBalanceResponseLockedNotStakeableAt, uint64(x.LockedNotStakeable))
if balancesN > 0 {
ob.SetList(getBalanceResponseBalancesAt, balancesAt, balancesN)
}
if unlockedsN > 0 {
ob.SetList(getBalanceResponseUnlockedsAt, unlockedsAt, unlockedsN)
}
if lockedStakeablesN > 0 {
ob.SetList(getBalanceResponseLockedStakeablesAt, lockedStakeablesAt, lockedStakeablesN)
}
if lockedNotStakeablesN > 0 {
ob.SetList(getBalanceResponseLockedNotStakeablesAt, lockedNotStakeablesAt, lockedNotStakeablesN)
}
if uTXOIDsN > 0 {
ob.SetList(getBalanceResponseUTXOIDsAt, uTXOIDsAt, uTXOIDsN)
}
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetBalanceResponse out of the buffer that arrived.
func (x *GetBalanceResponse) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetBalanceResponse: %w", err)
}
o := m.Root()
x.Balance = json.Uint64(o.Uint64(getBalanceResponseBalanceAt))
x.Unlocked = json.Uint64(o.Uint64(getBalanceResponseUnlockedAt))
x.LockedStakeable = json.Uint64(o.Uint64(getBalanceResponseLockedStakeableAt))
x.LockedNotStakeable = json.Uint64(o.Uint64(getBalanceResponseLockedNotStakeableAt))
if l := o.List(getBalanceResponseBalancesAt); l.Len() > 0 {
rows := make(Amounts, l.Len())
for i := range rows {
if err := rows[i].UnmarshalZAP(l.BytesAt(i)); err != nil {
return err
}
}
x.Balances = rows
}
if l := o.List(getBalanceResponseUnlockedsAt); l.Len() > 0 {
rows := make(Amounts, l.Len())
for i := range rows {
if err := rows[i].UnmarshalZAP(l.BytesAt(i)); err != nil {
return err
}
}
x.Unlockeds = rows
}
if l := o.List(getBalanceResponseLockedStakeablesAt); l.Len() > 0 {
rows := make(Amounts, l.Len())
for i := range rows {
if err := rows[i].UnmarshalZAP(l.BytesAt(i)); err != nil {
return err
}
}
x.LockedStakeables = rows
}
if l := o.List(getBalanceResponseLockedNotStakeablesAt); l.Len() > 0 {
rows := make(Amounts, l.Len())
for i := range rows {
if err := rows[i].UnmarshalZAP(l.BytesAt(i)); err != nil {
return err
}
}
x.LockedNotStakeables = rows
}
if l := o.List(getBalanceResponseUTXOIDsAt); l.Len() > 0 {
rows := make([]*utxo.UTXOID, l.Len())
for i := range rows {
rows[i] = new(utxo.UTXOID)
if err := rows[i].UnmarshalZAP(l.BytesAt(i)); err != nil {
return err
}
}
x.UTXOIDs = rows
}
return nil
}
// ---- GetBlockchainStatusArgs -------------------------------------------
const (
getBlockchainStatusArgsBlockchainIDAt = 0
getBlockchainStatusArgsSize = 8
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetBlockchainStatusArgs)(nil)
// MarshalZAP writes GetBlockchainStatusArgs from constant offsets.
func (x *GetBlockchainStatusArgs) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getBlockchainStatusArgsSize + 256)
ob := b.StartObject(getBlockchainStatusArgsSize)
ob.SetText(getBlockchainStatusArgsBlockchainIDAt, string(x.BlockchainID))
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetBlockchainStatusArgs out of the buffer that arrived.
func (x *GetBlockchainStatusArgs) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetBlockchainStatusArgs: %w", err)
}
o := m.Root()
x.BlockchainID = string(strings.Clone(o.Text(getBlockchainStatusArgsBlockchainIDAt)))
return nil
}
// ---- GetBlockchainStatusReply ------------------------------------------
const (
getBlockchainStatusReplyStatusAt = 0
getBlockchainStatusReplySize = 8
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetBlockchainStatusReply)(nil)
// MarshalZAP writes GetBlockchainStatusReply from constant offsets.
func (x *GetBlockchainStatusReply) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getBlockchainStatusReplySize + 256)
ob := b.StartObject(getBlockchainStatusReplySize)
ob.SetUint32(getBlockchainStatusReplyStatusAt, uint32(x.Status))
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetBlockchainStatusReply out of the buffer that arrived.
func (x *GetBlockchainStatusReply) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetBlockchainStatusReply: %w", err)
}
o := m.Root()
x.Status = status.BlockchainStatus(o.Uint32(getBlockchainStatusReplyStatusAt))
return nil
}
// ---- GetBlockchainsResponse --------------------------------------------
const (
getBlockchainsResponseBlockchainsAt = 0
getBlockchainsResponseSize = 8
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetBlockchainsResponse)(nil)
// MarshalZAP writes GetBlockchainsResponse from constant offsets.
func (x *GetBlockchainsResponse) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getBlockchainsResponseSize + 256)
blockchainsAt, blockchainsN := 0, len(x.Blockchains)
if blockchainsN > 0 {
var blob []byte
for i := range x.Blockchains {
enc, err := x.Blockchains[i].MarshalZAP()
if err != nil {
return nil, err
}
var n [4]byte
binary.LittleEndian.PutUint32(n[:], uint32(len(enc)))
blob = append(blob, n[:]...)
blob = append(blob, enc...)
}
blockchainsAt = b.WriteBytes(blob)
}
ob := b.StartObject(getBlockchainsResponseSize)
if blockchainsN > 0 {
ob.SetList(getBlockchainsResponseBlockchainsAt, blockchainsAt, blockchainsN)
}
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetBlockchainsResponse out of the buffer that arrived.
func (x *GetBlockchainsResponse) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetBlockchainsResponse: %w", err)
}
o := m.Root()
if l := o.List(getBlockchainsResponseBlockchainsAt); l.Len() > 0 {
rows := make([]APIBlockchain, l.Len())
for i := range rows {
if err := rows[i].UnmarshalZAP(l.BytesAt(i)); err != nil {
return err
}
}
x.Blockchains = rows
}
return nil
}
// ---- GetChainsArgs -----------------------------------------------------
const (
getChainsArgsIDsAt = 0
getChainsArgsSize = 8
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetChainsArgs)(nil)
// MarshalZAP writes GetChainsArgs from constant offsets.
func (x *GetChainsArgs) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getChainsArgsSize + 256)
iDsAt, iDsN := 0, len(x.IDs)
if iDsN > 0 {
var blob []byte
for i := range x.IDs {
enc := x.IDs[i][:]
var n [4]byte
binary.LittleEndian.PutUint32(n[:], uint32(len(enc)))
blob = append(blob, n[:]...)
blob = append(blob, enc...)
}
iDsAt = b.WriteBytes(blob)
}
ob := b.StartObject(getChainsArgsSize)
if iDsN > 0 {
ob.SetList(getChainsArgsIDsAt, iDsAt, iDsN)
}
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetChainsArgs out of the buffer that arrived.
func (x *GetChainsArgs) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetChainsArgs: %w", err)
}
o := m.Root()
if l := o.List(getChainsArgsIDsAt); l.Len() > 0 {
rows := make([]ids.ID, l.Len())
for i := range rows {
copy(rows[i][:], l.BytesAt(i))
}
x.IDs = rows
}
return nil
}
// ---- GetChainsResponse -------------------------------------------------
const (
getChainsResponseChainsAt = 0
getChainsResponseSize = 8
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetChainsResponse)(nil)
// MarshalZAP writes GetChainsResponse from constant offsets.
func (x *GetChainsResponse) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getChainsResponseSize + 256)
chainsAt, chainsN := 0, len(x.Chains)
if chainsN > 0 {
var blob []byte
for i := range x.Chains {
enc, err := x.Chains[i].MarshalZAP()
if err != nil {
return nil, err
}
var n [4]byte
binary.LittleEndian.PutUint32(n[:], uint32(len(enc)))
blob = append(blob, n[:]...)
blob = append(blob, enc...)
}
chainsAt = b.WriteBytes(blob)
}
ob := b.StartObject(getChainsResponseSize)
if chainsN > 0 {
ob.SetList(getChainsResponseChainsAt, chainsAt, chainsN)
}
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetChainsResponse out of the buffer that arrived.
func (x *GetChainsResponse) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetChainsResponse: %w", err)
}
o := m.Root()
if l := o.List(getChainsResponseChainsAt); l.Len() > 0 {
rows := make([]APIChain, l.Len())
for i := range rows {
if err := rows[i].UnmarshalZAP(l.BytesAt(i)); err != nil {
return err
}
}
x.Chains = rows
}
return nil
}
// ---- GetCurrentSupplyArgs ----------------------------------------------
const (
getCurrentSupplyArgsChainIDAt = 0
getCurrentSupplyArgsSize = 32
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetCurrentSupplyArgs)(nil)
// MarshalZAP writes GetCurrentSupplyArgs from constant offsets.
func (x *GetCurrentSupplyArgs) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getCurrentSupplyArgsSize + 256)
ob := b.StartObject(getCurrentSupplyArgsSize)
ob.SetBytesFixed(getCurrentSupplyArgsChainIDAt, x.ChainID[:])
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetCurrentSupplyArgs out of the buffer that arrived.
func (x *GetCurrentSupplyArgs) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetCurrentSupplyArgs: %w", err)
}
o := m.Root()
copy(x.ChainID[:], o.BytesFixed(getCurrentSupplyArgsChainIDAt, 32))
return nil
}
// ---- GetCurrentSupplyReply ---------------------------------------------
const (
getCurrentSupplyReplySupplyAt = 0
getCurrentSupplyReplyHeightAt = 8
getCurrentSupplyReplySize = 16
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetCurrentSupplyReply)(nil)
// MarshalZAP writes GetCurrentSupplyReply from constant offsets.
func (x *GetCurrentSupplyReply) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getCurrentSupplyReplySize + 256)
ob := b.StartObject(getCurrentSupplyReplySize)
ob.SetUint64(getCurrentSupplyReplySupplyAt, uint64(x.Supply))
ob.SetUint64(getCurrentSupplyReplyHeightAt, uint64(x.Height))
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetCurrentSupplyReply out of the buffer that arrived.
func (x *GetCurrentSupplyReply) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetCurrentSupplyReply: %w", err)
}
o := m.Root()
x.Supply = json.Uint64(o.Uint64(getCurrentSupplyReplySupplyAt))
x.Height = json.Uint64(o.Uint64(getCurrentSupplyReplyHeightAt))
return nil
}
// ---- GetCurrentValidatorsArgs ------------------------------------------
const (
getCurrentValidatorsArgsChainIDAt = 0
getCurrentValidatorsArgsNodeIDsAt = 32
getCurrentValidatorsArgsSize = 40
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetCurrentValidatorsArgs)(nil)
// MarshalZAP writes GetCurrentValidatorsArgs from constant offsets.
func (x *GetCurrentValidatorsArgs) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getCurrentValidatorsArgsSize + 256)
nodeIDsAt, nodeIDsN := 0, len(x.NodeIDs)
if nodeIDsN > 0 {
var blob []byte
for i := range x.NodeIDs {
enc := x.NodeIDs[i][:]
var n [4]byte
binary.LittleEndian.PutUint32(n[:], uint32(len(enc)))
blob = append(blob, n[:]...)
blob = append(blob, enc...)
}
nodeIDsAt = b.WriteBytes(blob)
}
ob := b.StartObject(getCurrentValidatorsArgsSize)
ob.SetBytesFixed(getCurrentValidatorsArgsChainIDAt, x.ChainID[:])
if nodeIDsN > 0 {
ob.SetList(getCurrentValidatorsArgsNodeIDsAt, nodeIDsAt, nodeIDsN)
}
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetCurrentValidatorsArgs out of the buffer that arrived.
func (x *GetCurrentValidatorsArgs) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetCurrentValidatorsArgs: %w", err)
}
o := m.Root()
copy(x.ChainID[:], o.BytesFixed(getCurrentValidatorsArgsChainIDAt, 32))
if l := o.List(getCurrentValidatorsArgsNodeIDsAt); l.Len() > 0 {
rows := make([]ids.NodeID, l.Len())
for i := range rows {
copy(rows[i][:], l.BytesAt(i))
}
x.NodeIDs = rows
}
return nil
}
// ---- GetCurrentValidatorsReply -----------------------------------------
const (
getCurrentValidatorsReplyValidatorsAt = 0
getCurrentValidatorsReplySize = 8
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetCurrentValidatorsReply)(nil)
// MarshalZAP writes GetCurrentValidatorsReply from constant offsets.
func (x *GetCurrentValidatorsReply) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getCurrentValidatorsReplySize + 256)
validatorsAt, validatorsN := 0, len(x.Validators)
if validatorsN > 0 {
var blob []byte
for i := range x.Validators {
enc, err := x.Validators[i].MarshalZAP()
if err != nil {
return nil, err
}
var n [4]byte
binary.LittleEndian.PutUint32(n[:], uint32(len(enc)))
blob = append(blob, n[:]...)
blob = append(blob, enc...)
}
validatorsAt = b.WriteBytes(blob)
}
ob := b.StartObject(getCurrentValidatorsReplySize)
if validatorsN > 0 {
ob.SetList(getCurrentValidatorsReplyValidatorsAt, validatorsAt, validatorsN)
}
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetCurrentValidatorsReply out of the buffer that arrived.
func (x *GetCurrentValidatorsReply) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetCurrentValidatorsReply: %w", err)
}
o := m.Root()
if l := o.List(getCurrentValidatorsReplyValidatorsAt); l.Len() > 0 {
rows := make([]CurrentValidator, l.Len())
for i := range rows {
if err := rows[i].UnmarshalZAP(l.BytesAt(i)); err != nil {
return err
}
}
x.Validators = rows
}
return nil
}
// ---- GetFeeConfigReply -------------------------------------------------
const (
getFeeConfigReplyWeightsAt = 0
getFeeConfigReplyMaxCapacityAt = 8
getFeeConfigReplyMaxPerSecondAt = 16
getFeeConfigReplyTargetPerSecondAt = 24
getFeeConfigReplyMinPriceAt = 32
getFeeConfigReplyExcessConversionConstantAt = 40
getFeeConfigReplySize = 48
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetFeeConfigReply)(nil)
// MarshalZAP writes GetFeeConfigReply from constant offsets.
func (x *GetFeeConfigReply) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getFeeConfigReplySize + 256)
weightsAt, weightsN := 0, len(x.Weights)
if weightsN > 0 {
var blob []byte
for i := range x.Weights {
var full [8]byte
binary.LittleEndian.PutUint64(full[:], uint64(x.Weights[i]))
enc := full[:8]
var n [4]byte
binary.LittleEndian.PutUint32(n[:], uint32(len(enc)))
blob = append(blob, n[:]...)
blob = append(blob, enc...)
}
weightsAt = b.WriteBytes(blob)
}
ob := b.StartObject(getFeeConfigReplySize)
ob.SetUint64(getFeeConfigReplyMaxCapacityAt, uint64(x.MaxCapacity))
ob.SetUint64(getFeeConfigReplyMaxPerSecondAt, uint64(x.MaxPerSecond))
ob.SetUint64(getFeeConfigReplyTargetPerSecondAt, uint64(x.TargetPerSecond))
ob.SetUint64(getFeeConfigReplyMinPriceAt, uint64(x.MinPrice))
ob.SetUint64(getFeeConfigReplyExcessConversionConstantAt, uint64(x.ExcessConversionConstant))
if weightsN > 0 {
ob.SetList(getFeeConfigReplyWeightsAt, weightsAt, weightsN)
}
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetFeeConfigReply out of the buffer that arrived.
func (x *GetFeeConfigReply) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetFeeConfigReply: %w", err)
}
o := m.Root()
if l := o.List(getFeeConfigReplyWeightsAt); l.Len() > 0 {
rows := make([]uint64, l.Len())
for i := range rows {
var full [8]byte
copy(full[:], l.BytesAt(i))
rows[i] = uint64(binary.LittleEndian.Uint64(full[:]))
}
x.Weights = rows
}
x.MaxCapacity = gas.Gas(o.Uint64(getFeeConfigReplyMaxCapacityAt))
x.MaxPerSecond = gas.Gas(o.Uint64(getFeeConfigReplyMaxPerSecondAt))
x.TargetPerSecond = gas.Gas(o.Uint64(getFeeConfigReplyTargetPerSecondAt))
x.MinPrice = gas.Price(o.Uint64(getFeeConfigReplyMinPriceAt))
x.ExcessConversionConstant = gas.Gas(o.Uint64(getFeeConfigReplyExcessConversionConstantAt))
return nil
}
// ---- GetFeeStateReply --------------------------------------------------
const (
getFeeStateReplyStateAt = 0
getFeeStateReplyPriceAt = 8
getFeeStateReplyTimeAt = 16
getFeeStateReplySize = 24
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetFeeStateReply)(nil)
// MarshalZAP writes GetFeeStateReply from constant offsets.
func (x *GetFeeStateReply) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getFeeStateReplySize + 256)
ob := b.StartObject(getFeeStateReplySize)
innerState, err := x.State.MarshalZAP()
if err != nil {
return nil, err
}
ob.SetBytes(getFeeStateReplyStateAt, innerState)
ob.SetUint64(getFeeStateReplyPriceAt, uint64(x.Price))
innerTime, err := x.Time.MarshalZAP()
if err != nil {
return nil, err
}
ob.SetBytes(getFeeStateReplyTimeAt, innerTime)
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetFeeStateReply out of the buffer that arrived.
func (x *GetFeeStateReply) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetFeeStateReply: %w", err)
}
o := m.Root()
if raw := o.Bytes(getFeeStateReplyStateAt); len(raw) > 0 {
if err := x.State.UnmarshalZAP(raw); err != nil {
return err
}
}
x.Price = gas.Price(o.Uint64(getFeeStateReplyPriceAt))
if raw := o.Bytes(getFeeStateReplyTimeAt); len(raw) > 0 {
if err := x.Time.UnmarshalZAP(raw); err != nil {
return err
}
}
return nil
}
// ---- GetL1ValidatorArgs ------------------------------------------------
const (
getL1ValidatorArgsValidationIDAt = 0
getL1ValidatorArgsSize = 32
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetL1ValidatorArgs)(nil)
// MarshalZAP writes GetL1ValidatorArgs from constant offsets.
func (x *GetL1ValidatorArgs) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getL1ValidatorArgsSize + 256)
ob := b.StartObject(getL1ValidatorArgsSize)
ob.SetBytesFixed(getL1ValidatorArgsValidationIDAt, x.ValidationID[:])
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetL1ValidatorArgs out of the buffer that arrived.
func (x *GetL1ValidatorArgs) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetL1ValidatorArgs: %w", err)
}
o := m.Root()
copy(x.ValidationID[:], o.BytesFixed(getL1ValidatorArgsValidationIDAt, 32))
return nil
}
// ---- GetL1ValidatorReply -----------------------------------------------
const (
getL1ValidatorReplyAPIL1ValidatorAt = 0
getL1ValidatorReplyChainIDAt = 8
getL1ValidatorReplyHeightAt = 40
getL1ValidatorReplySize = 48
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetL1ValidatorReply)(nil)
// MarshalZAP writes GetL1ValidatorReply from constant offsets.
func (x *GetL1ValidatorReply) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getL1ValidatorReplySize + 256)
ob := b.StartObject(getL1ValidatorReplySize)
innerAPIL1Validator, err := x.APIL1Validator.MarshalZAP()
if err != nil {
return nil, err
}
ob.SetBytes(getL1ValidatorReplyAPIL1ValidatorAt, innerAPIL1Validator)
ob.SetBytesFixed(getL1ValidatorReplyChainIDAt, x.ChainID[:])
ob.SetUint64(getL1ValidatorReplyHeightAt, uint64(x.Height))
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetL1ValidatorReply out of the buffer that arrived.
func (x *GetL1ValidatorReply) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetL1ValidatorReply: %w", err)
}
o := m.Root()
if raw := o.Bytes(getL1ValidatorReplyAPIL1ValidatorAt); len(raw) > 0 {
if err := x.APIL1Validator.UnmarshalZAP(raw); err != nil {
return err
}
}
copy(x.ChainID[:], o.BytesFixed(getL1ValidatorReplyChainIDAt, 32))
x.Height = json.Uint64(o.Uint64(getL1ValidatorReplyHeightAt))
return nil
}
// ---- GetMinStakeArgs ---------------------------------------------------
const (
getMinStakeArgsChainIDAt = 0
getMinStakeArgsSize = 32
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetMinStakeArgs)(nil)
// MarshalZAP writes GetMinStakeArgs from constant offsets.
func (x *GetMinStakeArgs) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getMinStakeArgsSize + 256)
ob := b.StartObject(getMinStakeArgsSize)
ob.SetBytesFixed(getMinStakeArgsChainIDAt, x.ChainID[:])
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetMinStakeArgs out of the buffer that arrived.
func (x *GetMinStakeArgs) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetMinStakeArgs: %w", err)
}
o := m.Root()
copy(x.ChainID[:], o.BytesFixed(getMinStakeArgsChainIDAt, 32))
return nil
}
// ---- GetMinStakeReply --------------------------------------------------
const (
getMinStakeReplyMinValidatorStakeAt = 0
getMinStakeReplyMinDelegatorStakeAt = 8
getMinStakeReplySize = 16
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetMinStakeReply)(nil)
// MarshalZAP writes GetMinStakeReply from constant offsets.
func (x *GetMinStakeReply) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getMinStakeReplySize + 256)
ob := b.StartObject(getMinStakeReplySize)
ob.SetUint64(getMinStakeReplyMinValidatorStakeAt, uint64(x.MinValidatorStake))
ob.SetUint64(getMinStakeReplyMinDelegatorStakeAt, uint64(x.MinDelegatorStake))
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetMinStakeReply out of the buffer that arrived.
func (x *GetMinStakeReply) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetMinStakeReply: %w", err)
}
o := m.Root()
x.MinValidatorStake = json.Uint64(o.Uint64(getMinStakeReplyMinValidatorStakeAt))
x.MinDelegatorStake = json.Uint64(o.Uint64(getMinStakeReplyMinDelegatorStakeAt))
return nil
}
// ---- GetNetArgs --------------------------------------------------------
const (
getNetArgsChainIDAt = 0
getNetArgsSize = 32
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetNetArgs)(nil)
// MarshalZAP writes GetNetArgs from constant offsets.
func (x *GetNetArgs) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getNetArgsSize + 256)
ob := b.StartObject(getNetArgsSize)
ob.SetBytesFixed(getNetArgsChainIDAt, x.ChainID[:])
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetNetArgs out of the buffer that arrived.
func (x *GetNetArgs) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetNetArgs: %w", err)
}
o := m.Root()
copy(x.ChainID[:], o.BytesFixed(getNetArgsChainIDAt, 32))
return nil
}
// ---- GetNetResponse ----------------------------------------------------
const (
getNetResponseIsPermissionedAt = 0
getNetResponseControlKeysAt = 8
getNetResponseThresholdAt = 16
getNetResponseLocktimeAt = 24
getNetResponseNetTransformationTxIDAt = 32
getNetResponseConversionIDAt = 64
getNetResponseManagerChainIDAt = 96
getNetResponseManagerAddressAt = 128
getNetResponseSize = 136
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetNetResponse)(nil)
// MarshalZAP writes GetNetResponse from constant offsets.
func (x *GetNetResponse) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getNetResponseSize + 256)
controlKeysAt, controlKeysN := 0, len(x.ControlKeys)
if controlKeysN > 0 {
var blob []byte
for i := range x.ControlKeys {
enc := []byte(x.ControlKeys[i])
var n [4]byte
binary.LittleEndian.PutUint32(n[:], uint32(len(enc)))
blob = append(blob, n[:]...)
blob = append(blob, enc...)
}
controlKeysAt = b.WriteBytes(blob)
}
ob := b.StartObject(getNetResponseSize)
ob.SetBool(getNetResponseIsPermissionedAt, bool(x.IsPermissioned))
ob.SetUint32(getNetResponseThresholdAt, uint32(x.Threshold))
ob.SetUint64(getNetResponseLocktimeAt, uint64(x.Locktime))
ob.SetBytesFixed(getNetResponseNetTransformationTxIDAt, x.NetTransformationTxID[:])
ob.SetBytesFixed(getNetResponseConversionIDAt, x.ConversionID[:])
ob.SetBytesFixed(getNetResponseManagerChainIDAt, x.ManagerChainID[:])
ob.SetBytes(getNetResponseManagerAddressAt, []byte(x.ManagerAddress))
if controlKeysN > 0 {
ob.SetList(getNetResponseControlKeysAt, controlKeysAt, controlKeysN)
}
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetNetResponse out of the buffer that arrived.
func (x *GetNetResponse) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetNetResponse: %w", err)
}
o := m.Root()
x.IsPermissioned = bool(o.Bool(getNetResponseIsPermissionedAt))
if l := o.List(getNetResponseControlKeysAt); l.Len() > 0 {
rows := make([]string, l.Len())
for i := range rows {
rows[i] = string(l.BytesAt(i))
}
x.ControlKeys = rows
}
x.Threshold = json.Uint32(o.Uint32(getNetResponseThresholdAt))
x.Locktime = json.Uint64(o.Uint64(getNetResponseLocktimeAt))
copy(x.NetTransformationTxID[:], o.BytesFixed(getNetResponseNetTransformationTxIDAt, 32))
copy(x.ConversionID[:], o.BytesFixed(getNetResponseConversionIDAt, 32))
copy(x.ManagerChainID[:], o.BytesFixed(getNetResponseManagerChainIDAt, 32))
x.ManagerAddress = types.JSONByteSlice(append([]byte(nil), o.Bytes(getNetResponseManagerAddressAt)...))
return nil
}
// ---- GetNetsArgs -------------------------------------------------------
const (
getNetsArgsIDsAt = 0
getNetsArgsSize = 8
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetNetsArgs)(nil)
// MarshalZAP writes GetNetsArgs from constant offsets.
func (x *GetNetsArgs) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getNetsArgsSize + 256)
iDsAt, iDsN := 0, len(x.IDs)
if iDsN > 0 {
var blob []byte
for i := range x.IDs {
enc := x.IDs[i][:]
var n [4]byte
binary.LittleEndian.PutUint32(n[:], uint32(len(enc)))
blob = append(blob, n[:]...)
blob = append(blob, enc...)
}
iDsAt = b.WriteBytes(blob)
}
ob := b.StartObject(getNetsArgsSize)
if iDsN > 0 {
ob.SetList(getNetsArgsIDsAt, iDsAt, iDsN)
}
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetNetsArgs out of the buffer that arrived.
func (x *GetNetsArgs) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetNetsArgs: %w", err)
}
o := m.Root()
if l := o.List(getNetsArgsIDsAt); l.Len() > 0 {
rows := make([]ids.ID, l.Len())
for i := range rows {
copy(rows[i][:], l.BytesAt(i))
}
x.IDs = rows
}
return nil
}
// ---- GetNetsResponse ---------------------------------------------------
const (
getNetsResponseNetsAt = 0
getNetsResponseSize = 8
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetNetsResponse)(nil)
// MarshalZAP writes GetNetsResponse from constant offsets.
func (x *GetNetsResponse) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getNetsResponseSize + 256)
netsAt, netsN := 0, len(x.Nets)
if netsN > 0 {
var blob []byte
for i := range x.Nets {
enc, err := x.Nets[i].MarshalZAP()
if err != nil {
return nil, err
}
var n [4]byte
binary.LittleEndian.PutUint32(n[:], uint32(len(enc)))
blob = append(blob, n[:]...)
blob = append(blob, enc...)
}
netsAt = b.WriteBytes(blob)
}
ob := b.StartObject(getNetsResponseSize)
if netsN > 0 {
ob.SetList(getNetsResponseNetsAt, netsAt, netsN)
}
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetNetsResponse out of the buffer that arrived.
func (x *GetNetsResponse) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetNetsResponse: %w", err)
}
o := m.Root()
if l := o.List(getNetsResponseNetsAt); l.Len() > 0 {
rows := make([]APINet, l.Len())
for i := range rows {
if err := rows[i].UnmarshalZAP(l.BytesAt(i)); err != nil {
return err
}
}
x.Nets = rows
}
return nil
}
// ---- GetRewardUTXOsReply -----------------------------------------------
const (
getRewardUTXOsReplyNumFetchedAt = 0
getRewardUTXOsReplyUTXOsAt = 8
getRewardUTXOsReplyEncodingAt = 16
getRewardUTXOsReplySize = 24
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetRewardUTXOsReply)(nil)
// MarshalZAP writes GetRewardUTXOsReply from constant offsets.
func (x *GetRewardUTXOsReply) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getRewardUTXOsReplySize + 256)
uTXOsAt, uTXOsN := 0, len(x.UTXOs)
if uTXOsN > 0 {
var blob []byte
for i := range x.UTXOs {
enc := []byte(x.UTXOs[i])
var n [4]byte
binary.LittleEndian.PutUint32(n[:], uint32(len(enc)))
blob = append(blob, n[:]...)
blob = append(blob, enc...)
}
uTXOsAt = b.WriteBytes(blob)
}
ob := b.StartObject(getRewardUTXOsReplySize)
ob.SetUint64(getRewardUTXOsReplyNumFetchedAt, uint64(x.NumFetched))
ob.SetUint8(getRewardUTXOsReplyEncodingAt, uint8(x.Encoding))
if uTXOsN > 0 {
ob.SetList(getRewardUTXOsReplyUTXOsAt, uTXOsAt, uTXOsN)
}
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetRewardUTXOsReply out of the buffer that arrived.
func (x *GetRewardUTXOsReply) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetRewardUTXOsReply: %w", err)
}
o := m.Root()
x.NumFetched = json.Uint64(o.Uint64(getRewardUTXOsReplyNumFetchedAt))
if l := o.List(getRewardUTXOsReplyUTXOsAt); l.Len() > 0 {
rows := make([]string, l.Len())
for i := range rows {
rows[i] = string(l.BytesAt(i))
}
x.UTXOs = rows
}
x.Encoding = formatting.Encoding(o.Uint8(getRewardUTXOsReplyEncodingAt))
return nil
}
// ---- GetStakeArgs ------------------------------------------------------
const (
getStakeArgsJSONAddressesAt = 0
getStakeArgsValidatorsOnlyAt = 8
getStakeArgsEncodingAt = 9
getStakeArgsSize = 16
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetStakeArgs)(nil)
// MarshalZAP writes GetStakeArgs from constant offsets.
func (x *GetStakeArgs) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getStakeArgsSize + 256)
ob := b.StartObject(getStakeArgsSize)
innerJSONAddresses, err := x.JSONAddresses.MarshalZAP()
if err != nil {
return nil, err
}
ob.SetBytes(getStakeArgsJSONAddressesAt, innerJSONAddresses)
ob.SetBool(getStakeArgsValidatorsOnlyAt, bool(x.ValidatorsOnly))
ob.SetUint8(getStakeArgsEncodingAt, uint8(x.Encoding))
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetStakeArgs out of the buffer that arrived.
func (x *GetStakeArgs) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetStakeArgs: %w", err)
}
o := m.Root()
if raw := o.Bytes(getStakeArgsJSONAddressesAt); len(raw) > 0 {
if err := x.JSONAddresses.UnmarshalZAP(raw); err != nil {
return err
}
}
x.ValidatorsOnly = bool(o.Bool(getStakeArgsValidatorsOnlyAt))
x.Encoding = formatting.Encoding(o.Uint8(getStakeArgsEncodingAt))
return nil
}
// ---- GetStakeReply -----------------------------------------------------
const (
getStakeReplyStakedAt = 0
getStakeReplyStakedsAt = 8
getStakeReplyOutputsAt = 16
getStakeReplyEncodingAt = 24
getStakeReplySize = 32
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetStakeReply)(nil)
// MarshalZAP writes GetStakeReply from constant offsets.
func (x *GetStakeReply) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getStakeReplySize + 256)
stakedsAt, stakedsN := 0, len(x.Stakeds)
if stakedsN > 0 {
var blob []byte
for i := range x.Stakeds {
enc, err := x.Stakeds[i].MarshalZAP()
if err != nil {
return nil, err
}
var n [4]byte
binary.LittleEndian.PutUint32(n[:], uint32(len(enc)))
blob = append(blob, n[:]...)
blob = append(blob, enc...)
}
stakedsAt = b.WriteBytes(blob)
}
outputsAt, outputsN := 0, len(x.Outputs)
if outputsN > 0 {
var blob []byte
for i := range x.Outputs {
enc := []byte(x.Outputs[i])
var n [4]byte
binary.LittleEndian.PutUint32(n[:], uint32(len(enc)))
blob = append(blob, n[:]...)
blob = append(blob, enc...)
}
outputsAt = b.WriteBytes(blob)
}
ob := b.StartObject(getStakeReplySize)
ob.SetUint64(getStakeReplyStakedAt, uint64(x.Staked))
ob.SetUint8(getStakeReplyEncodingAt, uint8(x.Encoding))
if stakedsN > 0 {
ob.SetList(getStakeReplyStakedsAt, stakedsAt, stakedsN)
}
if outputsN > 0 {
ob.SetList(getStakeReplyOutputsAt, outputsAt, outputsN)
}
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetStakeReply out of the buffer that arrived.
func (x *GetStakeReply) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetStakeReply: %w", err)
}
o := m.Root()
x.Staked = json.Uint64(o.Uint64(getStakeReplyStakedAt))
if l := o.List(getStakeReplyStakedsAt); l.Len() > 0 {
rows := make(Amounts, l.Len())
for i := range rows {
if err := rows[i].UnmarshalZAP(l.BytesAt(i)); err != nil {
return err
}
}
x.Stakeds = rows
}
if l := o.List(getStakeReplyOutputsAt); l.Len() > 0 {
rows := make([]string, l.Len())
for i := range rows {
rows[i] = string(l.BytesAt(i))
}
x.Outputs = rows
}
x.Encoding = formatting.Encoding(o.Uint8(getStakeReplyEncodingAt))
return nil
}
// ---- GetStakingAssetIDArgs ---------------------------------------------
const (
getStakingAssetIDArgsChainIDAt = 0
getStakingAssetIDArgsSize = 32
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetStakingAssetIDArgs)(nil)
// MarshalZAP writes GetStakingAssetIDArgs from constant offsets.
func (x *GetStakingAssetIDArgs) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getStakingAssetIDArgsSize + 256)
ob := b.StartObject(getStakingAssetIDArgsSize)
ob.SetBytesFixed(getStakingAssetIDArgsChainIDAt, x.ChainID[:])
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetStakingAssetIDArgs out of the buffer that arrived.
func (x *GetStakingAssetIDArgs) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetStakingAssetIDArgs: %w", err)
}
o := m.Root()
copy(x.ChainID[:], o.BytesFixed(getStakingAssetIDArgsChainIDAt, 32))
return nil
}
// ---- GetStakingAssetIDResponse -----------------------------------------
const (
getStakingAssetIDResponseAssetIDAt = 0
getStakingAssetIDResponseSize = 32
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetStakingAssetIDResponse)(nil)
// MarshalZAP writes GetStakingAssetIDResponse from constant offsets.
func (x *GetStakingAssetIDResponse) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getStakingAssetIDResponseSize + 256)
ob := b.StartObject(getStakingAssetIDResponseSize)
ob.SetBytesFixed(getStakingAssetIDResponseAssetIDAt, x.AssetID[:])
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetStakingAssetIDResponse out of the buffer that arrived.
func (x *GetStakingAssetIDResponse) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetStakingAssetIDResponse: %w", err)
}
o := m.Root()
copy(x.AssetID[:], o.BytesFixed(getStakingAssetIDResponseAssetIDAt, 32))
return nil
}
// ---- GetTimestampReply -------------------------------------------------
const (
getTimestampReplyTimestampAt = 0
getTimestampReplySize = 8
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetTimestampReply)(nil)
// MarshalZAP writes GetTimestampReply from constant offsets.
func (x *GetTimestampReply) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getTimestampReplySize + 256)
ob := b.StartObject(getTimestampReplySize)
innerTimestamp, err := x.Timestamp.MarshalZAP()
if err != nil {
return nil, err
}
ob.SetBytes(getTimestampReplyTimestampAt, innerTimestamp)
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetTimestampReply out of the buffer that arrived.
func (x *GetTimestampReply) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetTimestampReply: %w", err)
}
o := m.Root()
if raw := o.Bytes(getTimestampReplyTimestampAt); len(raw) > 0 {
if err := x.Timestamp.UnmarshalZAP(raw); err != nil {
return err
}
}
return nil
}
// ---- GetTotalStakeArgs -------------------------------------------------
const (
getTotalStakeArgsChainIDAt = 0
getTotalStakeArgsSize = 32
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetTotalStakeArgs)(nil)
// MarshalZAP writes GetTotalStakeArgs from constant offsets.
func (x *GetTotalStakeArgs) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getTotalStakeArgsSize + 256)
ob := b.StartObject(getTotalStakeArgsSize)
ob.SetBytesFixed(getTotalStakeArgsChainIDAt, x.ChainID[:])
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetTotalStakeArgs out of the buffer that arrived.
func (x *GetTotalStakeArgs) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetTotalStakeArgs: %w", err)
}
o := m.Root()
copy(x.ChainID[:], o.BytesFixed(getTotalStakeArgsChainIDAt, 32))
return nil
}
// ---- GetTotalStakeReply ------------------------------------------------
const (
getTotalStakeReplyStakeAt = 0
getTotalStakeReplyWeightAt = 8
getTotalStakeReplySize = 16
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetTotalStakeReply)(nil)
// MarshalZAP writes GetTotalStakeReply from constant offsets.
func (x *GetTotalStakeReply) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getTotalStakeReplySize + 256)
ob := b.StartObject(getTotalStakeReplySize)
ob.SetUint64(getTotalStakeReplyStakeAt, uint64(x.Stake))
ob.SetUint64(getTotalStakeReplyWeightAt, uint64(x.Weight))
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetTotalStakeReply out of the buffer that arrived.
func (x *GetTotalStakeReply) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetTotalStakeReply: %w", err)
}
o := m.Root()
x.Stake = json.Uint64(o.Uint64(getTotalStakeReplyStakeAt))
x.Weight = json.Uint64(o.Uint64(getTotalStakeReplyWeightAt))
return nil
}
// ---- GetTxStatusArgs ---------------------------------------------------
const (
getTxStatusArgsTxIDAt = 0
getTxStatusArgsSize = 32
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetTxStatusArgs)(nil)
// MarshalZAP writes GetTxStatusArgs from constant offsets.
func (x *GetTxStatusArgs) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getTxStatusArgsSize + 256)
ob := b.StartObject(getTxStatusArgsSize)
ob.SetBytesFixed(getTxStatusArgsTxIDAt, x.TxID[:])
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetTxStatusArgs out of the buffer that arrived.
func (x *GetTxStatusArgs) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetTxStatusArgs: %w", err)
}
o := m.Root()
copy(x.TxID[:], o.BytesFixed(getTxStatusArgsTxIDAt, 32))
return nil
}
// ---- GetTxStatusResponse -----------------------------------------------
const (
getTxStatusResponseStatusAt = 0
getTxStatusResponseReasonAt = 8
getTxStatusResponseSize = 16
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetTxStatusResponse)(nil)
// MarshalZAP writes GetTxStatusResponse from constant offsets.
func (x *GetTxStatusResponse) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getTxStatusResponseSize + 256)
ob := b.StartObject(getTxStatusResponseSize)
ob.SetUint32(getTxStatusResponseStatusAt, uint32(x.Status))
ob.SetText(getTxStatusResponseReasonAt, string(x.Reason))
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetTxStatusResponse out of the buffer that arrived.
func (x *GetTxStatusResponse) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetTxStatusResponse: %w", err)
}
o := m.Root()
x.Status = status.Status(o.Uint32(getTxStatusResponseStatusAt))
x.Reason = string(strings.Clone(o.Text(getTxStatusResponseReasonAt)))
return nil
}
// ---- GetValidatorFeeStateReply -----------------------------------------
const (
getValidatorFeeStateReplyExcessAt = 0
getValidatorFeeStateReplyPriceAt = 8
getValidatorFeeStateReplyTimeAt = 16
getValidatorFeeStateReplySize = 24
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetValidatorFeeStateReply)(nil)
// MarshalZAP writes GetValidatorFeeStateReply from constant offsets.
func (x *GetValidatorFeeStateReply) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getValidatorFeeStateReplySize + 256)
ob := b.StartObject(getValidatorFeeStateReplySize)
ob.SetUint64(getValidatorFeeStateReplyExcessAt, uint64(x.Excess))
ob.SetUint64(getValidatorFeeStateReplyPriceAt, uint64(x.Price))
innerTime, err := x.Time.MarshalZAP()
if err != nil {
return nil, err
}
ob.SetBytes(getValidatorFeeStateReplyTimeAt, innerTime)
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetValidatorFeeStateReply out of the buffer that arrived.
func (x *GetValidatorFeeStateReply) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetValidatorFeeStateReply: %w", err)
}
o := m.Root()
x.Excess = gas.Gas(o.Uint64(getValidatorFeeStateReplyExcessAt))
x.Price = gas.Price(o.Uint64(getValidatorFeeStateReplyPriceAt))
if raw := o.Bytes(getValidatorFeeStateReplyTimeAt); len(raw) > 0 {
if err := x.Time.UnmarshalZAP(raw); err != nil {
return err
}
}
return nil
}
// ---- GetValidatorsAtArgs -----------------------------------------------
const (
getValidatorsAtArgsHeightAt = 0
getValidatorsAtArgsChainIDAt = 8
getValidatorsAtArgsSize = 40
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetValidatorsAtArgs)(nil)
// MarshalZAP writes GetValidatorsAtArgs from constant offsets.
func (x *GetValidatorsAtArgs) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getValidatorsAtArgsSize + 256)
ob := b.StartObject(getValidatorsAtArgsSize)
ob.SetUint64(getValidatorsAtArgsHeightAt, uint64(x.Height))
ob.SetBytesFixed(getValidatorsAtArgsChainIDAt, x.ChainID[:])
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetValidatorsAtArgs out of the buffer that arrived.
func (x *GetValidatorsAtArgs) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetValidatorsAtArgs: %w", err)
}
o := m.Root()
x.Height = api.Height(o.Uint64(getValidatorsAtArgsHeightAt))
copy(x.ChainID[:], o.BytesFixed(getValidatorsAtArgsChainIDAt, 32))
return nil
}
// ---- GetValidatorsAtReply ----------------------------------------------
const (
getValidatorsAtReplyValidatorsAt = 0
getValidatorsAtReplySize = 8
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetValidatorsAtReply)(nil)
// MarshalZAP writes GetValidatorsAtReply from constant offsets.
func (x *GetValidatorsAtReply) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getValidatorsAtReplySize + 256)
validatorsAt, validatorsN := 0, len(x.Validators)
if validatorsN > 0 {
var blob []byte
for i := range x.Validators {
enc, err := x.Validators[i].MarshalZAP()
if err != nil {
return nil, err
}
var n [4]byte
binary.LittleEndian.PutUint32(n[:], uint32(len(enc)))
blob = append(blob, n[:]...)
blob = append(blob, enc...)
}
validatorsAt = b.WriteBytes(blob)
}
ob := b.StartObject(getValidatorsAtReplySize)
if validatorsN > 0 {
ob.SetList(getValidatorsAtReplyValidatorsAt, validatorsAt, validatorsN)
}
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetValidatorsAtReply out of the buffer that arrived.
func (x *GetValidatorsAtReply) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetValidatorsAtReply: %w", err)
}
o := m.Root()
if l := o.List(getValidatorsAtReplyValidatorsAt); l.Len() > 0 {
rows := make(ValidatorSet, l.Len())
for i := range rows {
if err := rows[i].UnmarshalZAP(l.BytesAt(i)); err != nil {
return err
}
}
x.Validators = rows
}
return nil
}
// ---- ValidatedByArgs ---------------------------------------------------
const (
validatedByArgsBlockchainIDAt = 0
validatedByArgsSize = 32
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*ValidatedByArgs)(nil)
// MarshalZAP writes ValidatedByArgs from constant offsets.
func (x *ValidatedByArgs) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(validatedByArgsSize + 256)
ob := b.StartObject(validatedByArgsSize)
ob.SetBytesFixed(validatedByArgsBlockchainIDAt, x.BlockchainID[:])
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads ValidatedByArgs out of the buffer that arrived.
func (x *ValidatedByArgs) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("ValidatedByArgs: %w", err)
}
o := m.Root()
copy(x.BlockchainID[:], o.BytesFixed(validatedByArgsBlockchainIDAt, 32))
return nil
}
// ---- ValidatedByResponse -----------------------------------------------
const (
validatedByResponseChainIDAt = 0
validatedByResponseSize = 32
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*ValidatedByResponse)(nil)
// MarshalZAP writes ValidatedByResponse from constant offsets.
func (x *ValidatedByResponse) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(validatedByResponseSize + 256)
ob := b.StartObject(validatedByResponseSize)
ob.SetBytesFixed(validatedByResponseChainIDAt, x.ChainID[:])
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads ValidatedByResponse out of the buffer that arrived.
func (x *ValidatedByResponse) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("ValidatedByResponse: %w", err)
}
o := m.Root()
copy(x.ChainID[:], o.BytesFixed(validatedByResponseChainIDAt, 32))
return nil
}
// ---- ValidatesArgs -----------------------------------------------------
const (
validatesArgsChainIDAt = 0
validatesArgsSize = 32
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*ValidatesArgs)(nil)
// MarshalZAP writes ValidatesArgs from constant offsets.
func (x *ValidatesArgs) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(validatesArgsSize + 256)
ob := b.StartObject(validatesArgsSize)
ob.SetBytesFixed(validatesArgsChainIDAt, x.ChainID[:])
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads ValidatesArgs out of the buffer that arrived.
func (x *ValidatesArgs) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("ValidatesArgs: %w", err)
}
o := m.Root()
copy(x.ChainID[:], o.BytesFixed(validatesArgsChainIDAt, 32))
return nil
}
// ---- ValidatesResponse -------------------------------------------------
const (
validatesResponseBlockchainIDsAt = 0
validatesResponseSize = 8
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*ValidatesResponse)(nil)
// MarshalZAP writes ValidatesResponse from constant offsets.
func (x *ValidatesResponse) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(validatesResponseSize + 256)
blockchainIDsAt, blockchainIDsN := 0, len(x.BlockchainIDs)
if blockchainIDsN > 0 {
var blob []byte
for i := range x.BlockchainIDs {
enc := x.BlockchainIDs[i][:]
var n [4]byte
binary.LittleEndian.PutUint32(n[:], uint32(len(enc)))
blob = append(blob, n[:]...)
blob = append(blob, enc...)
}
blockchainIDsAt = b.WriteBytes(blob)
}
ob := b.StartObject(validatesResponseSize)
if blockchainIDsN > 0 {
ob.SetList(validatesResponseBlockchainIDsAt, blockchainIDsAt, blockchainIDsN)
}
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads ValidatesResponse out of the buffer that arrived.
func (x *ValidatesResponse) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("ValidatesResponse: %w", err)
}
o := m.Root()
if l := o.List(validatesResponseBlockchainIDsAt); l.Len() > 0 {
rows := make([]ids.ID, l.Len())
for i := range rows {
copy(rows[i][:], l.BytesAt(i))
}
x.BlockchainIDs = rows
}
return nil
}
// ---- Validator ---------------------------------------------------------
const (
validatorNodeIDAt = 0
validatorPublicKeyAt = 24
validatorWeightAt = 32
validatorSize = 40
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*Validator)(nil)
// MarshalZAP writes Validator from constant offsets.
func (x *Validator) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(validatorSize + 256)
ob := b.StartObject(validatorSize)
ob.SetBytesFixed(validatorNodeIDAt, x.NodeID[:])
ob.SetBytes(validatorPublicKeyAt, []byte(x.PublicKey))
ob.SetUint64(validatorWeightAt, uint64(x.Weight))
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads Validator out of the buffer that arrived.
func (x *Validator) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("Validator: %w", err)
}
o := m.Root()
copy(x.NodeID[:], o.BytesFixed(validatorNodeIDAt, 20))
x.PublicKey = []uint8(append([]byte(nil), o.Bytes(validatorPublicKeyAt)...))
x.Weight = json.Uint64(o.Uint64(validatorWeightAt))
return nil
}