Documentation ¶
Overview ¶
Author: https://github.com/zksync-sdk/zksync-go *
Package common contains various helper functions.
Author: https://github.com/zksync-sdk/zksync-go *
Author: https://github.com/zksync-sdk/zksync-go *
Author: https://github.com/zksync-sdk/zksync-go *
Author: https://github.com/zksync-sdk/zksync-go *
Package hexutil implements hex encoding with 0x prefix. This encoding is used by the Ethereum RPC API to transport binary data in JSON payloads.
Encoding Rules ¶
All hex data must have prefix "0x".
For byte slices, the hex data must be of even length. An empty byte slice encodes as "0x".
Integers are encoded using the least amount of digits (no leading zero digits). Their encoding may be of uneven length. The number zero encodes as "0x0".
Author: https://github.com/zksync-sdk/zksync-go *
Author: https://github.com/zksync-sdk/zksync-go *
Author: https://github.com/zksync-sdk/zksync-go *
Author: https://github.com/zksync-sdk/zksync-go *
Author: https://github.com/zksync-sdk/zksync-go *
Author: https://github.com/zksync-sdk/zksync-go *
Author: https://github.com/zksync-sdk/zksync-go *
Author: https://github.com/zksync-sdk/zksync-go *
Author: https://github.com/zksync-sdk/zksync-go *
Author: https://github.com/zksync-sdk/zksync-go *
Index ¶
- Constants
- Variables
- func BigIntToBytesBE(v *big.Int, numBytes int) []byte
- func Bytes2Hex(d []byte) string
- func CopyBytes(b []byte) (copiedBytes []byte)
- func Decode(input string) ([]byte, error)
- func DecodeBig(input string) (*big.Int, error)
- func DecodeUint64(input string) (uint64, error)
- func Encode(b []byte) string
- func EncodeBig(bigint *big.Int) string
- func EncodeUint64(i uint64) string
- func FromHex(s string) []byte
- func Hex2Bytes(str string) []byte
- func Hex2BytesFixed(str string, flen int) []byte
- func IsHexAddress(s string) bool
- func LeftPadBytes(slice []byte, l int) []byte
- func MustDecode(input string) []byte
- func MustDecodeBig(input string) *big.Int
- func MustDecodeUint64(input string) uint64
- func PackAmount(fee *big.Int) ([]byte, error)
- func PackFee(fee *big.Int) ([]byte, error)
- func ParseAddress(address string) []byte
- func RightPadBytes(slice []byte, l int) []byte
- func TrimLeftZeroes(s []byte) []byte
- func TrimRightZeroes(s []byte) []byte
- func Uint16ToBytes(v uint16) []byte
- func Uint32ToBytes(v uint32) []byte
- func Uint64ToBytes(v uint64) []byte
- func UnmarshalFixedJSON(typ reflect.Type, input, out []byte) error
- func UnmarshalFixedText(typname string, input, out []byte) error
- func UnmarshalFixedUnprefixedText(typname string, input, out []byte) error
- type AccountState
- type Address
- func (a Address) Bytes() []byte
- func (a Address) Format(s fmt.State, c rune)
- func (a Address) Hash() Hash
- func (a Address) Hex() string
- func (a Address) ImplementsGraphQLType(name string) bool
- func (a Address) MarshalText() ([]byte, error)
- func (a *Address) Scan(src interface{}) error
- func (a *Address) SetBytes(b []byte)
- func (a Address) String() string
- func (a *Address) UnmarshalGraphQL(input interface{}) error
- func (a *Address) UnmarshalJSON(input []byte) error
- func (a *Address) UnmarshalText(input []byte) error
- func (a Address) Value() (driver.Value, error)
- type Big
- func (b Big) ImplementsGraphQLType(name string) bool
- func (b Big) MarshalText() ([]byte, error)
- func (b *Big) String() string
- func (b *Big) ToInt() *big.Int
- func (b *Big) UnmarshalGraphQL(input interface{}) error
- func (b *Big) UnmarshalJSON(input []byte) error
- func (b *Big) UnmarshalText(input []byte) error
- type Bits
- func (b *Bits) Append(a *Bits) *Bits
- func (b *Bits) Clone() *Bits
- func (b *Bits) FromBytesBE(bytes []byte) *Bits
- func (b *Bits) GetBit(i uint) bool
- func (b *Bits) Len() uint
- func (b *Bits) Reverse() *Bits
- func (b *Bits) SetBit(i uint, v bool)
- func (b *Bits) String() (s string)
- func (b *Bits) ToBytesBE() ([]byte, error)
- type BlockInfo
- type Bytes
- type ChainId
- type ChangePubKey
- type ChangePubKeyAuthType
- type ChangePubKeyCREATE2
- type ChangePubKeyECDSA
- type ChangePubKeyOnchain
- type ChangePubKeyVariant
- type DepositingBalance
- type DepositingState
- type EthOpInfo
- type EthSignature
- type EthSignatureType
- type EthSigner
- type ForcedExit
- type Hash
- func (h Hash) Big() *big.Int
- func (h Hash) Bytes() []byte
- func (h Hash) Format(s fmt.State, c rune)
- func (h Hash) Generate(rand *rand.Rand, size int) reflect.Value
- func (h Hash) Hex() string
- func (Hash) ImplementsGraphQLType(name string) bool
- func (h Hash) MarshalText() ([]byte, error)
- func (h *Hash) Scan(src interface{}) error
- func (h *Hash) SetBytes(b []byte)
- func (h Hash) String() string
- func (h Hash) TerminalString() string
- func (h *Hash) UnmarshalGraphQL(input interface{}) error
- func (h *Hash) UnmarshalJSON(input []byte) error
- func (h *Hash) UnmarshalText(input []byte) error
- func (h Hash) Value() (driver.Value, error)
- type MintNFT
- type MixedcaseAddress
- func (ma *MixedcaseAddress) Address() Address
- func (ma *MixedcaseAddress) MarshalJSON() ([]byte, error)
- func (ma *MixedcaseAddress) Original() string
- func (ma *MixedcaseAddress) String() string
- func (ma *MixedcaseAddress) UnmarshalJSON(input []byte) error
- func (ma *MixedcaseAddress) ValidChecksum() bool
- type NFT
- type OkEthSigner
- func (s *OkEthSigner) GetAddress() string
- func (s *OkEthSigner) SignAuth(txData *ChangePubKey) (*ChangePubKeyECDSA, error)
- func (s *OkEthSigner) SignBatch(txs []ZksTransaction, nonce uint32, token *Token, fee *big.Int) (*EthSignature, error)
- func (s *OkEthSigner) SignHash(msg []byte) ([]byte, error)
- func (s *OkEthSigner) SignMessage(msg []byte) ([]byte, error)
- func (s *OkEthSigner) SignOrder(order *Order, sell, buy *Token) (*EthSignature, error)
- func (s *OkEthSigner) SignTransaction(tx ZksTransaction, nonce uint32, token *Token, fee *big.Int) (*EthSignature, error)
- type Order
- type Signature
- type SignedTransaction
- type State
- type Swap
- type TimeRange
- type Token
- type Tokens
- type TransactionDetails
- type TransactionFee
- type TransactionFeeDetails
- type TransactionStatus
- type TransactionType
- type TransactionTypeChangePubKey
- type Transfer
- type Uint
- type Uint64
- type UnprefixedAddress
- type UnprefixedHash
- type Withdraw
- type WithdrawNFT
- type ZkSigner
- func (s *ZkSigner) GetPublicKey() string
- func (s *ZkSigner) GetPublicKeyHash() string
- func (s *ZkSigner) Sign(message []byte) (*zkscrypto.Signature, error)
- func (s *ZkSigner) SignChangePubKey(txData *ChangePubKey) (*Signature, error)
- func (s *ZkSigner) SignForcedExit(txData *ForcedExit) (*Signature, error)
- func (s *ZkSigner) SignMintNFT(txData *MintNFT) (*Signature, error)
- func (s *ZkSigner) SignTransfer(txData *Transfer) (*Signature, error)
- func (s *ZkSigner) SignWithdraw(txData *Withdraw) (*Signature, error)
- func (s *ZkSigner) SignWithdrawNFT(txData *WithdrawNFT) (*Signature, error)
- type ZksTransaction
Constants ¶
const ( TransactionTypeMintNFT = "MintNFT" TransactionTypeWithdrawNFT = "WithdrawNFT" )
const ( AmountExponentBitWidth int64 = 5 AmountMantissaBitWidth int64 = 35 FeeExponentBitWidth int64 = 5 FeeMantissaBitWidth int64 = 11 )
const ( // HashLength is the expected length of the hash HashLength = 32 // AddressLength is the expected length of the address AddressLength = 20 )
Lengths of hashes and addresses in bytes.
const ( TransactionTypeWithdraw = "Withdraw" TransactionTypeForcedExit = "ForcedExit" )
const ( Message = "Access zkSync account.\n\nOnly sign this message for a trusted client!" TransactionVersion byte = 0x01 PUBLICK_KEY_PREFIX = "sync:" HEX_PREFIX = "0x" )
const (
TransactionTypeSwap = "Swap"
)
const (
TransactionTypeTransfer = "Transfer"
)
Variables ¶
var ( ErrUnknownTxTYPE = errors.New("unknown tx type") ErrConvertBigInt = errors.New("failed to convert string fee to big.Int") )
var ( ErrEmptyString = &decError{"empty hex string"} ErrSyntax = &decError{"invalid hex string"} ErrMissingPrefix = &decError{"hex string without 0x prefix"} ErrOddLength = &decError{"hex string of odd length"} ErrEmptyNumber = &decError{"hex string \"0x\""} ErrLeadingZero = &decError{"hex number with leading zero digits"} ErrUint64Range = &decError{"hex number > 64 bits"} ErrUintRange = &decError{fmt.Sprintf("hex number > %d bits", uintBits)} ErrBig256Range = &decError{"hex number > 256 bits"} )
Errors
Functions ¶
func DecodeBig ¶
DecodeBig decodes a hex string with 0x prefix as a quantity. Numbers larger than 256 bits are not accepted.
func DecodeUint64 ¶
DecodeUint64 decodes a hex string with 0x prefix as a quantity.
func EncodeBig ¶
EncodeBig encodes bigint as a hex string with 0x prefix. The sign of the integer is ignored.
func EncodeUint64 ¶
EncodeUint64 encodes i as a hex string with 0x prefix.
func FromHex ¶
FromHex returns the bytes represented by the hexadecimal string s. s may be prefixed with "0x".
func Hex2BytesFixed ¶
Hex2BytesFixed returns bytes of a specified fixed length flen.
func IsHexAddress ¶
IsHexAddress verifies whether a string can represent a valid hex-encoded Ethereum address or not.
func LeftPadBytes ¶
LeftPadBytes zero-pads slice to the left up to length l.
func MustDecode ¶
MustDecode decodes a hex string with 0x prefix. It panics for invalid input.
func MustDecodeBig ¶
MustDecodeBig decodes a hex string with 0x prefix as a quantity. It panics for invalid input.
func MustDecodeUint64 ¶
MustDecodeUint64 decodes a hex string with 0x prefix as a quantity. It panics for invalid input.
func ParseAddress ¶
func RightPadBytes ¶
RightPadBytes zero-pads slice to the right up to length l.
func TrimLeftZeroes ¶
TrimLeftZeroes returns a subslice of s without leading zeroes
func TrimRightZeroes ¶
TrimRightZeroes returns a subslice of s without trailing zeroes
func Uint16ToBytes ¶
func Uint32ToBytes ¶
func Uint64ToBytes ¶
func UnmarshalFixedJSON ¶
UnmarshalFixedJSON decodes the input as a string with 0x prefix. The length of out determines the required input length. This function is commonly used to implement the UnmarshalJSON method for fixed-size types.
func UnmarshalFixedText ¶
UnmarshalFixedText decodes the input as a string with 0x prefix. The length of out determines the required input length. This function is commonly used to implement the UnmarshalText method for fixed-size types.
func UnmarshalFixedUnprefixedText ¶
UnmarshalFixedUnprefixedText decodes the input as a string with optional 0x prefix. The length of out determines the required input length. This function is commonly used to implement the UnmarshalText method for fixed-size types.
Types ¶
type AccountState ¶
type AccountState struct { Address string `json:"address"` Id uint32 `json:"id"` Depositing *DepositingState `json:"depositing"` Committed *State `json:"committed"` Verified *State `json:"verified"` }
type Address ¶
type Address [AddressLength]byte
Address represents the 20 byte address of an Ethereum account.
func BigToAddress ¶
BigToAddress returns Address with byte values of b. If b is larger than len(h), b will be cropped from the left.
func BytesToAddress ¶
BytesToAddress returns Address with value b. If b is larger than len(h), b will be cropped from the left.
func HexToAddress ¶
HexToAddress returns Address with byte values of s. If s is larger than len(h), s will be cropped from the left.
func (Address) Format ¶
Format implements fmt.Formatter. Address supports the %v, %s, %v, %x, %X and %d format verbs.
func (Address) ImplementsGraphQLType ¶
ImplementsGraphQLType returns true if Hash implements the specified GraphQL type.
func (Address) MarshalText ¶
MarshalText returns the hex representation of a.
func (*Address) SetBytes ¶
SetBytes sets the address to the value of b. If b is larger than len(a), b will be cropped from the left.
func (*Address) UnmarshalGraphQL ¶
UnmarshalGraphQL unmarshals the provided GraphQL query data.
func (*Address) UnmarshalJSON ¶
UnmarshalJSON parses a hash in hex syntax.
func (*Address) UnmarshalText ¶
UnmarshalText parses a hash in hex syntax.
type Big ¶
Big marshals/unmarshals as a JSON string with 0x prefix. The zero value marshals as "0x0".
Negative integers are not supported at this time. Attempting to marshal them will return an error. Values larger than 256bits are rejected by Unmarshal but will be marshaled without error.
func (Big) ImplementsGraphQLType ¶
ImplementsGraphQLType returns true if Big implements the provided GraphQL type.
func (Big) MarshalText ¶
MarshalText implements encoding.TextMarshaler
func (*Big) UnmarshalGraphQL ¶
UnmarshalGraphQL unmarshals the provided GraphQL query data.
func (*Big) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Big) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler
type Bits ¶
type Bits struct {
// contains filtered or unexported fields
}
func (*Bits) FromBytesBE ¶
type Bytes ¶
type Bytes []byte
Bytes marshals/unmarshals as a JSON string with 0x prefix. The empty slice marshals as "0x".
func (Bytes) ImplementsGraphQLType ¶
ImplementsGraphQLType returns true if Bytes implements the specified GraphQL type.
func (Bytes) MarshalText ¶
MarshalText implements encoding.TextMarshaler
func (*Bytes) UnmarshalGraphQL ¶
UnmarshalGraphQL unmarshals the provided GraphQL query data.
func (*Bytes) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Bytes) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type ChangePubKey ¶
type ChangePubKey struct { Type string `json:"type"` AccountId uint32 `json:"accountId"` Account string `json:"account"` NewPkHash string `json:"newPkHash"` FeeToken uint32 `json:"feeToken"` Fee string `json:"fee"` Nonce uint32 `json:"nonce"` Signature *Signature `json:"signature"` EthAuthData ChangePubKeyVariant `json:"ethAuthData"` *TimeRange }
func (*ChangePubKey) GetTxHash ¶
func (t *ChangePubKey) GetTxHash() (string, error)
type ChangePubKeyAuthType ¶
type ChangePubKeyAuthType string
const ( ChangePubKeyAuthTypeOnchain ChangePubKeyAuthType = `Onchain` ChangePubKeyAuthTypeECDSA ChangePubKeyAuthType = `ECDSA` ChangePubKeyAuthTypeCREATE2 ChangePubKeyAuthType = `CREATE2` )
type ChangePubKeyCREATE2 ¶
type ChangePubKeyCREATE2 struct { Type ChangePubKeyAuthType `json:"type"` CreatorAddress string `json:"creatorAddress"` SaltArg string `json:"saltArg"` CodeHash string `json:"codeHash"` }
type ChangePubKeyECDSA ¶
type ChangePubKeyECDSA struct { Type ChangePubKeyAuthType `json:"type"` EthSignature string `json:"ethSignature"` BatchHash string `json:"batchHash"` }
type ChangePubKeyOnchain ¶
type ChangePubKeyOnchain struct {
Type ChangePubKeyAuthType `json:"type"`
}
type ChangePubKeyVariant ¶
type ChangePubKeyVariant interface {
// contains filtered or unexported methods
}
type DepositingBalance ¶
type DepositingState ¶
type DepositingState struct {
Balances map[string]*DepositingBalance `json:"balances"`
}
type EthSignature ¶
type EthSignature struct { Type EthSignatureType `json:"type"` Signature string `json:"signature"` }
type EthSignatureType ¶
type EthSignatureType string
const ( EthSignatureTypeEth EthSignatureType = "EthereumSignature" EthSignatureTypeEIP1271 EthSignatureType = "EIP1271Signature" )
type EthSigner ¶
type EthSigner interface { GetAddress() string SignMessage([]byte) ([]byte, error) SignHash(msg []byte) ([]byte, error) SignAuth(txData *ChangePubKey) (*ChangePubKeyECDSA, error) SignTransaction(tx ZksTransaction, nonce uint32, token *Token, fee *big.Int) (*EthSignature, error) SignBatch(txs []ZksTransaction, nonce uint32, token *Token, fee *big.Int) (*EthSignature, error) SignOrder(order *Order, sell, buy *Token) (*EthSignature, error) }
type ForcedExit ¶
type Hash ¶
type Hash [HashLength]byte
Hash represents the 32 byte Keccak256 hash of arbitrary data.
func BigToHash ¶
BigToHash sets byte representation of b to hash. If b is larger than len(h), b will be cropped from the left.
func BytesToHash ¶
BytesToHash sets b to hash. If b is larger than len(h), b will be cropped from the left.
func HexToHash ¶
HexToHash sets byte representation of s to hash. If b is larger than len(h), b will be cropped from the left.
func (Hash) Format ¶
Format implements fmt.Formatter. Hash supports the %v, %s, %v, %x, %X and %d format verbs.
func (Hash) ImplementsGraphQLType ¶
ImplementsGraphQLType returns true if Hash implements the specified GraphQL type.
func (Hash) MarshalText ¶
MarshalText returns the hex representation of h.
func (*Hash) SetBytes ¶
SetBytes sets the hash to the value of b. If b is larger than len(h), b will be cropped from the left.
func (Hash) String ¶
String implements the stringer interface and is used also by the logger when doing full logging into a file.
func (Hash) TerminalString ¶
TerminalString implements log.TerminalStringer, formatting a string for console output during logging.
func (*Hash) UnmarshalGraphQL ¶
UnmarshalGraphQL unmarshals the provided GraphQL query data.
func (*Hash) UnmarshalJSON ¶
UnmarshalJSON parses a hash in hex syntax.
func (*Hash) UnmarshalText ¶
UnmarshalText parses a hash in hex syntax.
type MintNFT ¶
type MintNFT struct { Type string `json:"type"` CreatorId uint32 `json:"creatorId"` CreatorAddress string `json:"creatorAddress"` ContentHash Hash `json:"contentHash"` Recipient string `json:"recipient"` Fee string `json:"fee"` FeeToken uint32 `json:"feeToken"` Nonce uint32 `json:"nonce"` Signature *Signature `json:"signature"` }
type MixedcaseAddress ¶
type MixedcaseAddress struct {
// contains filtered or unexported fields
}
MixedcaseAddress retains the original string, which may or may not be correctly checksummed
func NewMixedcaseAddress ¶
func NewMixedcaseAddress(addr Address) MixedcaseAddress
NewMixedcaseAddress constructor (mainly for testing)
func NewMixedcaseAddressFromString ¶
func NewMixedcaseAddressFromString(hexaddr string) (*MixedcaseAddress, error)
NewMixedcaseAddressFromString is mainly meant for unit-testing
func (*MixedcaseAddress) Address ¶
func (ma *MixedcaseAddress) Address() Address
Address returns the address
func (*MixedcaseAddress) MarshalJSON ¶
func (ma *MixedcaseAddress) MarshalJSON() ([]byte, error)
MarshalJSON marshals the original value
func (*MixedcaseAddress) Original ¶
func (ma *MixedcaseAddress) Original() string
Original returns the mixed-case input string
func (*MixedcaseAddress) String ¶
func (ma *MixedcaseAddress) String() string
String implements fmt.Stringer
func (*MixedcaseAddress) UnmarshalJSON ¶
func (ma *MixedcaseAddress) UnmarshalJSON(input []byte) error
UnmarshalJSON parses MixedcaseAddress
func (*MixedcaseAddress) ValidChecksum ¶
func (ma *MixedcaseAddress) ValidChecksum() bool
ValidChecksum returns true if the address has valid checksum
type NFT ¶
type OkEthSigner ¶
type OkEthSigner struct {
// contains filtered or unexported fields
}
func NewOkEthSignerFromPrivBytes ¶
func NewOkEthSignerFromPrivBytes(privKeyBytes []byte) (*OkEthSigner, error)
func (*OkEthSigner) GetAddress ¶
func (s *OkEthSigner) GetAddress() string
func (*OkEthSigner) SignAuth ¶
func (s *OkEthSigner) SignAuth(txData *ChangePubKey) (*ChangePubKeyECDSA, error)
func (*OkEthSigner) SignBatch ¶
func (s *OkEthSigner) SignBatch(txs []ZksTransaction, nonce uint32, token *Token, fee *big.Int) (*EthSignature, error)
func (*OkEthSigner) SignMessage ¶
func (s *OkEthSigner) SignMessage(msg []byte) ([]byte, error)
func (*OkEthSigner) SignOrder ¶
func (s *OkEthSigner) SignOrder(order *Order, sell, buy *Token) (*EthSignature, error)
func (*OkEthSigner) SignTransaction ¶
func (s *OkEthSigner) SignTransaction(tx ZksTransaction, nonce uint32, token *Token, fee *big.Int) (*EthSignature, error)
type Order ¶
type Order struct { AccountId uint32 `json:"accountId"` RecipientAddress string `json:"recipient"` Nonce uint32 `json:"nonce"` TokenBuy uint32 `json:"tokenBuy"` TokenSell uint32 `json:"tokenSell"` Ratio []*big.Int `json:"ratio"` Amount *big.Int `json:"amount"` Signature *Signature `json:"signature"` EthereumSignature *EthSignature `json:"ethereumSignature"` *TimeRange }
type SignedTransaction ¶
type SignedTransaction struct { Transaction ZksTransaction `json:"tx"` EthereumSignature *EthSignature `json:"signature"` }
type State ¶
type Swap ¶
type Swap struct { Type string `json:"type"` SubmitterId uint32 `json:"submitterId"` SubmitterAddress string `json:"submitterAddress"` Nonce uint32 `json:"nonce"` Orders []*Order `json:"orders"` Amounts []*big.Int `json:"amounts"` Fee string `json:"fee"` FeeToken uint32 `json:"feeToken"` Signature *Signature `json:"signature"` *TimeRange }
type TimeRange ¶
func DefaultTimeRange ¶
func DefaultTimeRange() *TimeRange
type Token ¶
type Token struct { Id uint32 `json:"id"` Address string `json:"address"` Symbol string `json:"symbol"` Decimals uint `json:"decimals"` IsNft bool `json:"is_nft"` }
func (Token) GetAddress ¶
type TransactionDetails ¶
type TransactionFee ¶
type TransactionFeeDetails ¶
type TransactionFeeDetails struct { GasTxAmount string `json:"gasTxAmount"` GasPriceWei string `json:"gasPriceWei"` GasFee string `json:"gasFee"` ZkpFee string `json:"zkpFee"` TotalFee string `json:"totalFee"` }
func (*TransactionFeeDetails) GetTotalFee ¶
func (d *TransactionFeeDetails) GetTotalFee() *big.Int
func (*TransactionFeeDetails) GetTxFee ¶
func (d *TransactionFeeDetails) GetTxFee(feeToken *Token) *TransactionFee
type TransactionStatus ¶
type TransactionStatus int
const ( TransactionStatusSent TransactionStatus = iota TransactionStatusCommitted TransactionStatusVerified )
type TransactionType ¶
type TransactionType string
const ( TransactionTypeChangePubKey_ = "ChangePubKey" TransactionTypeChangePubKeyOnchain TransactionType = "Onchain" TransactionTypeChangePubKeyECDSA TransactionType = "ECDSA" TransactionTypeChangePubKeyCREATE2 TransactionType = "CREATE2" )
type TransactionTypeChangePubKey ¶
type TransactionTypeChangePubKey struct {
ChangePubKey string `json:"ChangePubKey"`
}
type Transfer ¶
type Transfer struct { Type string `json:"type"` AccountId uint32 `json:"accountId"` From string `json:"from"` To string `json:"to"` Token *Token `json:"-"` TokenId uint32 `json:"token"` Amount *big.Int `json:"amount"` Fee string `json:"fee"` Nonce uint32 `json:"nonce"` Signature *Signature `json:"signature"` *TimeRange }
type Uint ¶
type Uint uint
Uint marshals/unmarshals as a JSON string with 0x prefix. The zero value marshals as "0x0".
func (Uint) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (*Uint) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Uint) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type Uint64 ¶
type Uint64 uint64
Uint64 marshals/unmarshals as a JSON string with 0x prefix. The zero value marshals as "0x0".
func (Uint64) ImplementsGraphQLType ¶
ImplementsGraphQLType returns true if Uint64 implements the provided GraphQL type.
func (Uint64) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (*Uint64) UnmarshalGraphQL ¶
UnmarshalGraphQL unmarshals the provided GraphQL query data.
func (*Uint64) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Uint64) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler
type UnprefixedAddress ¶
type UnprefixedAddress Address
UnprefixedAddress allows marshaling an Address without 0x prefix.
func (UnprefixedAddress) MarshalText ¶
func (a UnprefixedAddress) MarshalText() ([]byte, error)
MarshalText encodes the address as hex.
func (*UnprefixedAddress) UnmarshalText ¶
func (a *UnprefixedAddress) UnmarshalText(input []byte) error
UnmarshalText decodes the address from hex. The 0x prefix is optional.
type UnprefixedHash ¶
type UnprefixedHash Hash
UnprefixedHash allows marshaling a Hash without 0x prefix.
func (UnprefixedHash) MarshalText ¶
func (h UnprefixedHash) MarshalText() ([]byte, error)
MarshalText encodes the hash as hex.
func (*UnprefixedHash) UnmarshalText ¶
func (h *UnprefixedHash) UnmarshalText(input []byte) error
UnmarshalText decodes the hash from hex. The 0x prefix is optional.
type WithdrawNFT ¶
type WithdrawNFT struct { Type string `json:"type"` AccountId uint32 `json:"accountId"` From string `json:"from"` To string `json:"to"` Token uint32 `json:"token"` FeeToken uint32 `json:"feeToken"` Fee string `json:"fee"` Nonce uint32 `json:"nonce"` Signature *Signature `json:"signature"` *TimeRange }
type ZkSigner ¶
type ZkSigner struct {
// contains filtered or unexported fields
}
func NewZkSignerFromSeed ¶
func (*ZkSigner) GetPublicKey ¶
func (*ZkSigner) GetPublicKeyHash ¶
func (*ZkSigner) SignChangePubKey ¶
func (s *ZkSigner) SignChangePubKey(txData *ChangePubKey) (*Signature, error)
func (*ZkSigner) SignForcedExit ¶
func (s *ZkSigner) SignForcedExit(txData *ForcedExit) (*Signature, error)
func (*ZkSigner) SignTransfer ¶
func (*ZkSigner) SignWithdraw ¶
func (*ZkSigner) SignWithdrawNFT ¶
func (s *ZkSigner) SignWithdrawNFT(txData *WithdrawNFT) (*Signature, error)
type ZksTransaction ¶
type ZksTransaction interface {
// contains filtered or unexported methods
}