Documentation ¶
Index ¶
- Constants
- Variables
- func MustMarshalJson(params interface{}) []byte
- func SignAndSerializeTransaction(keyPair KeyPair, txn Transaction) (blob string, err error)
- func YoctoToNEAR(yocto Balance) uint64
- type AccessKey
- type AccessKeyFunctionCallPermission
- type AccessKeyList
- type AccessKeyPermission
- type AccessKeyView
- type AccessKeyViewInfo
- type AccountID
- type AccountView
- type Action
- func NewAddKey(publicKey PublicKey, nonce Nonce, permission AccessKeyPermission) Action
- func NewCreateAccount() Action
- func NewDeleteAccount(beneficiaryID AccountID) Action
- func NewDeleteKey(publicKey PublicKey) Action
- func NewDeployContract(code []byte) Action
- func NewFeeChargeNativeCall(params FeerDepositArgs, amount Balance, gas Gas) Action
- func NewFeeTokenAddCall(params FeeManageOperationArgs, gas Gas) Action
- func NewFeeTokenRemoveCall(params FeeManageOperationArgs, gas Gas) Action
- func NewFeeTokenUpdateCall(params FeeManageOperationArgs, gas Gas) Action
- func NewFeeTokenWithdrawCall(params FeeManageOperationArgs, receiver AccountID, amount Balance, gas Gas) Action
- func NewFtTransferCall(params FtTransferArgs, gas Gas) Action
- func NewFtWithdrawCall(params FtWithdrawArgs, gas Gas, deposit Balance) Action
- func NewFunctionCall(methodName string, args []byte, gas Gas, deposit Balance) Action
- func NewNativeDepositCall(params NativeDepositArgs, gas Gas, deposit Balance) Action
- func NewNativeWithdrawCall(params NativeWithdrawArgs, gas Gas, deposit Balance) Action
- func NewNftTransferCall(params NftTransferArgs, gas Gas) Action
- func NewNftWithdrawCall(params NftWithdrawArgs, gas Gas, deposit Balance) Action
- func NewStake(stake Balance, publicKey PublicKey) Action
- func NewTransfer(deposit Balance) Action
- type ActionAccessKeyPermission
- type ActionAddKey
- type ActionAddKeyAccessKey
- type ActionCreateAccount
- type ActionDeleteAccount
- type ActionDeleteKey
- type ActionDeployContract
- type ActionFunctionCall
- type ActionStake
- type ActionTransfer
- type Balance
- func (bal Balance) Big() *big.Int
- func (bal Balance) Div64(div uint64) Balance
- func (bal Balance) Empty() bool
- func (bal Balance) Equals(other Balance) bool
- func (bal Balance) MarshalJSON() ([]byte, error)
- func (bal Balance) String() string
- func (bal Balance) Uint64() uint64
- func (bal *Balance) UnmarshalJSON(b []byte) error
- type Base58PublicKey
- type Base58Signature
- type BlockHeaderView
- type BlockHeight
- type BlockView
- type BridgeBaseEventData
- type BridgeDepositedEvent
- type BridgeDepositedEventData
- type BridgeEvent
- type BridgeEventType
- type BridgeWithdrawnEvent
- type BridgeWithdrawnEventData
- type CallResult
- type ChallengesResult
- type ChunkHeaderView
- type ChunkView
- type CurrentEpochValidatorInfo
- type EdgeInfo
- type EndpointSetup
- type ExecutionOutcomeView
- type ExecutionOutcomeWithIdView
- type ExecutionOutcomeWithReceipt
- type FeeManageOperation
- type FeeManageOperationArgs
- type FeeManageOperationArgsWithBorsh
- type FeeManageOperationType
- type FeeManageOperationWithBorsh
- type FeeToken
- type FeeTokenWithBorsh
- type FeerDepositArgs
- type FeerTransferType
- type FinalExecutionOutcomeView
- type FinalExecutionOutcomeWithReceiptView
- type FtTransferArgs
- type FtWithdrawArgs
- type FullAccessPermissionWrapper
- type FullPeerInfo
- type FunctionCallPermission
- type Gas
- type GasPrice
- type GenesisID
- type Hash
- type JsonActionAddKey
- type JsonActionDeleteKey
- type JsonRpcError
- type JsonRpcErrorCause
- type JsonRpcErrorCauseMessage
- type KeyPair
- type KnownProducer
- type LogEvent
- type LogEventDepositedData
- type LogEventType
- type MerklePath
- type MerklePathItem
- type MetricRecorder
- type NativeDepositArgs
- type NativeWithdrawArgs
- type NetworkID
- type NetworkInfo
- type NftContractMetadataView
- type NftMetadataView
- type NftTransferArgs
- type NftView
- type NftWithdrawArgs
- type NodeVersion
- type Nonce
- type NumBlocks
- type PeerChainInfo
- type PeerID
- type PeerInfo
- type PublicKey
- func (p PublicKey) Hash() string
- func (p PublicKey) MarshalJSON() ([]byte, error)
- func (p PublicKey) String() string
- func (p *PublicKey) ToBase58PublicKey() Base58PublicKey
- func (p PublicKey) TypeByte() byte
- func (p *PublicKey) UnmarshalJSON(b []byte) error
- func (p PublicKey) Value() []byte
- func (p *PublicKey) Verify(data []byte, signature Signature) (ok bool, err error)
- type PublicKeyType
- type QueryResponse
- type ReceiptView
- type Request
- type Response
- type ShardChunkTransactionView
- type ShardChunkView
- type ShardID
- type ShardStateChangeCauseView
- type ShardStateChangeChangeView
- type ShardStateChangeView
- type ShardView
- type SignArgs
- type Signature
- type SignatureType
- type SignedTransaction
- type SignedTransactionView
- type SlashedValidator
- type StateItem
- type StatusResponse
- type StatusSyncInfo
- type StorageUsage
- type TimeNanos
- type TokenType
- type Transaction
- type TransactionStatus
- type TransferArgs
- type TrieProofPath
- type ValidatorInfo
- type ValidatorStakeView
- type ValidatorsResponse
- type ViewStateResult
- type WithdrawArgs
Constants ¶
const ( OrdCreateAccount uint8 = iota OrdDeployContract OrdFunctionCall OrdTransfer OrdStake OrdAddKey OrdDeleteKey OrdDeleteAccount )
const ( TokenType_Native TokenType = "Native" TokenType_NFT = "NFT" TokenType_FT = "FT" )
const ( ContractNew = "new" ContractNftTransfer = "nft_transfer_call" ContractNftWithdraw = "nft_withdraw" ContractNftTokensForOwner = "nft_tokens_for_owner" ContractNftMetadata = "nft_metadata" ContractNftGet = "nft_token" ContractFtTransfer = "ft_transfer_call" ContractFtWithdraw = "ft_withdraw" ContractFtBalanceOf = "ft_balance_of" ContractFtMint = "ft_mint" ContractStorageDeposit = "storage_deposit" ContractBridgeNativeDeposit = "native_deposit" ContractBridgeNativeWithdraw = "native_withdraw" ContractFeerRegister = "register" ContractFeerUnregister = "unregister" ContractFeerChargeNative = "charge_native" ContractFeerAddFeeToken = "add_fee_token" ContractFeerUpdateFeeToken = "update_fee_token" ContractFeerRemoveFeeToken = "remove_fee_token" ContractFeerWithdraw = "withdraw" ContractFeerGetFeeToken = "get_fee_token" ContractFeerGetFeeTokens = "get_fee_tokens" )
const ( RawKeyTypeED25519 byte = iota RawKeyTypeSECP256K1 )
const ( RawSignatureTypeED25519 byte = iota RawSignatureTypeSECP256K1 )
const ( SignatureTypeED25519 = SignatureType("ed25519") SignatureTypeSECP256K1 = SignatureType("secp256k1") )
Variables ¶
var ( OrdMappings = map[string]uint8{ "CreateAccount": OrdCreateAccount, "DeployContract": OrdDeployContract, "FunctionCall": OrdFunctionCall, "Transfer": OrdTransfer, "Stake": OrdStake, "AddKey": OrdAddKey, "DeleteKey": OrdDeleteKey, "DeleteAccount": OrdDeleteAccount, } SimpleActions = map[string]bool{ "CreateAccount": true, } )
var ( TenPower24 = uint128.From64(uint64(math.Pow10(12))).Mul64(uint64(math.Pow10(12))) ZeroNEAR = Balance(uint128.From64(0)) OneYocto = Balance(uint128.From64(1)) One = big.NewInt(0).Exp(big.NewInt(10), big.NewInt(24), nil) )
var ( NftMintStorageDeposit = MustBalanceFromString("0.2") FtMintStorageDeposit = MustBalanceFromString("0.00125") )
var KeyTypes = map[byte]PublicKeyType{ RawKeyTypeED25519: KeyTypeED25519, RawKeyTypeSECP256K1: KeyTypeSECP256K1, }
var ReverseKeyTypeMapping = map[string]byte{ string(KeyTypeED25519): RawKeyTypeED25519, string(KeyTypeSECP256K1): RawKeyTypeSECP256K1, }
var ReverseSignatureMapping = map[string]byte{ string(SignatureTypeED25519): RawSignatureTypeED25519, string(SignatureTypeSECP256K1): RawSignatureTypeSECP256K1, }
var SignatureTypes = map[byte]SignatureType{ RawSignatureTypeED25519: SignatureTypeED25519, RawSignatureTypeSECP256K1: SignatureTypeSECP256K1, }
Functions ¶
func MustMarshalJson ¶
func MustMarshalJson(params interface{}) []byte
func SignAndSerializeTransaction ¶
func SignAndSerializeTransaction(keyPair KeyPair, txn Transaction) (blob string, err error)
func YoctoToNEAR ¶
Types ¶
type AccessKey ¶
type AccessKey struct { Nonce Nonce `json:"nonce"` // Permission holds parsed access key permission info Permission AccessKeyPermission `json:"-"` }
func (*AccessKey) UnmarshalJSON ¶
type AccessKeyFunctionCallPermission ¶
type AccessKeyFunctionCallPermission struct { Allowance *Balance `json:"allowance"` ReceiverID AccountID `json:"receiver_id"` MethodNames []string `json:"method_names"` }
func (AccessKeyFunctionCallPermission) String ¶
func (a AccessKeyFunctionCallPermission) String() string
type AccessKeyList ¶
type AccessKeyList struct {
Keys []AccessKeyViewInfo `json:"keys"`
}
type AccessKeyPermission ¶
type AccessKeyPermission struct { FullAccess bool `json:"-"` FunctionCall FunctionCallPermission `json:"-"` }
AccessKeyPermission holds info whether access key is a FullAccess, or FunctionCall key
func (*AccessKeyPermission) UnmarshalJSON ¶
func (akp *AccessKeyPermission) UnmarshalJSON(b []byte) (err error)
type AccessKeyView ¶
type AccessKeyView struct { AccessKey QueryResponse }
func (*AccessKeyView) UnmarshalJSON ¶
func (a *AccessKeyView) UnmarshalJSON(data []byte) (err error)
type AccessKeyViewInfo ¶
type AccessKeyViewInfo struct { PublicKey Base58PublicKey `json:"public_key"` AccessKey AccessKey `json:"access_key"` }
type AccountView ¶
type AccountView struct { Amount Balance `json:"amount"` Locked Balance `json:"locked"` CodeHash Hash `json:"code_hash"` StorageUsage StorageUsage `json:"storage_usage"` StoragePaidAt BlockHeight `json:"storage_paid_at"` QueryResponse }
type Action ¶
type Action struct { Enum borsh.Enum `borsh_enum:"true"` CreateAccount ActionCreateAccount DeployContract ActionDeployContract FunctionCall ActionFunctionCall Transfer ActionTransfer Stake ActionStake AddKey ActionAddKey DeleteKey ActionDeleteKey DeleteAccount ActionDeleteAccount }
func NewAddKey ¶
func NewAddKey(publicKey PublicKey, nonce Nonce, permission AccessKeyPermission) Action
func NewCreateAccount ¶
func NewCreateAccount() Action
NewCreateAccount Create an (sub)account using a transaction `receiver_id` as an ID for a new account
func NewDeleteAccount ¶
func NewDeleteKey ¶
func NewDeployContract ¶
func NewFeeChargeNativeCall ¶
func NewFeeChargeNativeCall(params FeerDepositArgs, amount Balance, gas Gas) Action
func NewFeeTokenAddCall ¶
func NewFeeTokenAddCall(params FeeManageOperationArgs, gas Gas) Action
func NewFeeTokenRemoveCall ¶
func NewFeeTokenRemoveCall(params FeeManageOperationArgs, gas Gas) Action
func NewFeeTokenUpdateCall ¶
func NewFeeTokenUpdateCall(params FeeManageOperationArgs, gas Gas) Action
func NewFeeTokenWithdrawCall ¶
func NewFeeTokenWithdrawCall(params FeeManageOperationArgs, receiver AccountID, amount Balance, gas Gas) Action
func NewFtTransferCall ¶
func NewFtTransferCall(params FtTransferArgs, gas Gas) Action
func NewFtWithdrawCall ¶
func NewFtWithdrawCall(params FtWithdrawArgs, gas Gas, deposit Balance) Action
func NewFunctionCall ¶
func NewNativeDepositCall ¶
func NewNativeDepositCall(params NativeDepositArgs, gas Gas, deposit Balance) Action
func NewNativeWithdrawCall ¶
func NewNativeWithdrawCall(params NativeWithdrawArgs, gas Gas, deposit Balance) Action
func NewNftTransferCall ¶
func NewNftTransferCall(params NftTransferArgs, gas Gas) Action
func NewNftWithdrawCall ¶
func NewNftWithdrawCall(params NftWithdrawArgs, gas Gas, deposit Balance) Action
func NewTransfer ¶
func (*Action) DepositBalance ¶
func (*Action) PrepaidGas ¶
func (*Action) UnderlyingValue ¶
func (a *Action) UnderlyingValue() interface{}
func (*Action) UnmarshalJSON ¶
type ActionAccessKeyPermission ¶
type ActionAccessKeyPermission struct { Enum borsh.Enum `borsh_enum:"true"` FunctionCallPermission AccessKeyFunctionCallPermission FullAccessPermission struct{} }
func NewFullAccessPermission ¶
func NewFullAccessPermission() ActionAccessKeyPermission
func NewFunctionCallPermission ¶
func NewFunctionCallPermission(allowance Balance, receiverID AccountID, methodNames []string) ActionAccessKeyPermission
func NewFunctionCallUnlimitedAllowancePermission ¶
func NewFunctionCallUnlimitedAllowancePermission(receiverID AccountID, methodNames []string) ActionAccessKeyPermission
func (*ActionAccessKeyPermission) IsFullAccess ¶
func (a *ActionAccessKeyPermission) IsFullAccess() bool
func (*ActionAccessKeyPermission) IsFunctionCall ¶
func (a *ActionAccessKeyPermission) IsFunctionCall() bool
func (ActionAccessKeyPermission) MarshalJSON ¶
func (a ActionAccessKeyPermission) MarshalJSON() ([]byte, error)
func (ActionAccessKeyPermission) String ¶
func (a ActionAccessKeyPermission) String() string
func (*ActionAccessKeyPermission) UnmarshalJSON ¶
func (a *ActionAccessKeyPermission) UnmarshalJSON(b []byte) error
type ActionAddKey ¶
type ActionAddKey struct { PublicKey PublicKey `json:"public_key"` AccessKey ActionAddKeyAccessKey `json:"access_key"` }
func (ActionAddKey) MarshalJSON ¶
func (a ActionAddKey) MarshalJSON() (b []byte, err error)
func (*ActionAddKey) UnmarshalJSON ¶
func (a *ActionAddKey) UnmarshalJSON(b []byte) (err error)
type ActionAddKeyAccessKey ¶
type ActionAddKeyAccessKey struct { Nonce Nonce `json:"nonce"` Permission AccessKeyPermission `json:"permission"` }
type ActionCreateAccount ¶
type ActionCreateAccount struct { }
type ActionDeleteAccount ¶
type ActionDeleteAccount struct {
BeneficiaryID AccountID `json:"beneficiary_id"`
}
type ActionDeleteKey ¶
type ActionDeleteKey struct {
PublicKey PublicKey `json:"public_key"`
}
func (ActionDeleteKey) MarshalJSON ¶
func (a ActionDeleteKey) MarshalJSON() (b []byte, err error)
func (*ActionDeleteKey) UnmarshalJSON ¶
func (a *ActionDeleteKey) UnmarshalJSON(b []byte) (err error)
type ActionDeployContract ¶
type ActionDeployContract struct {
Code []byte `json:"code"`
}
type ActionFunctionCall ¶
type ActionFunctionCall struct { MethodName string `json:"method_name"` Args []byte `json:"args"` Gas Gas `json:"gas"` Deposit Balance `json:"deposit"` }
func (ActionFunctionCall) String ¶
func (f ActionFunctionCall) String() string
type ActionStake ¶
type ActionTransfer ¶
type ActionTransfer struct {
Deposit Balance `json:"deposit"`
}
func (ActionTransfer) String ¶
func (t ActionTransfer) String() string
type Balance ¶
Balance holds amount of yoctoNEAR
func BalanceFromString ¶
func MustBalanceFromString ¶
func NEARToYocto ¶
func (Balance) MarshalJSON ¶
func (*Balance) UnmarshalJSON ¶
type Base58PublicKey ¶
type Base58PublicKey struct { Type PublicKeyType Value string Key PublicKey }
func NewBase58PublicKey ¶
func NewBase58PublicKey(raw string) (pk Base58PublicKey, err error)
func (Base58PublicKey) MarshalJSON ¶
func (pk Base58PublicKey) MarshalJSON() ([]byte, error)
func (Base58PublicKey) String ¶
func (pk Base58PublicKey) String() string
func (*Base58PublicKey) ToPublicKey ¶
func (pk *Base58PublicKey) ToPublicKey() PublicKey
Copies Base58PublicKey to PublicKey
func (*Base58PublicKey) UnmarshalJSON ¶
func (pk *Base58PublicKey) UnmarshalJSON(b []byte) (err error)
type Base58Signature ¶
type Base58Signature struct { Type SignatureType Value string }
func NewBase58Signature ¶
func NewBase58Signature(raw string) (pk Base58Signature, err error)
func (Base58Signature) MarshalJSON ¶
func (sig Base58Signature) MarshalJSON() ([]byte, error)
func (Base58Signature) String ¶
func (sig Base58Signature) String() string
func (*Base58Signature) UnmarshalJSON ¶
func (sig *Base58Signature) UnmarshalJSON(b []byte) (err error)
type BlockHeaderView ¶
type BlockHeaderView struct { Height BlockHeight `json:"height"` EpochID Hash `json:"epoch_id"` NextEpochID Hash `json:"next_epoch_id"` Hash Hash `json:"hash"` PrevHash Hash `json:"prev_hash"` PrevStateRoot Hash `json:"prev_state_root"` ChunkReceiptsRoot Hash `json:"chunk_receipts_root"` ChunkHeadersRoot Hash `json:"chunk_headers_root"` ChunkTxRoot Hash `json:"chunk_tx_root"` OutcomeRoot Hash `json:"outcome_root"` ChunksIncluded uint64 `json:"chunks_included"` ChallengesRoot Hash `json:"challenges_root"` Timestamp uint64 `json:"timestamp"` // milliseconds TimestampNanosec TimeNanos `json:"timestamp_nanosec"` // nanoseconds, uint128 RandomValue Hash `json:"random_value"` ValidatorProposals []ValidatorStakeView `json:"validator_proposals"` ChunkMask []bool `json:"chunk_mask"` GasPrice Balance `json:"gas_price"` RentPaid Balance `json:"rent_paid"` // NOTE: deprecated - 2021-05-14 ValidatorReward Balance `json:"validator_reward"` // NOTE: deprecated - 2021-05-14 TotalSupply Balance `json:"total_supply"` ChallengesResult ChallengesResult `json:"challenges_result"` LastFinalBlock Hash `json:"last_final_block"` LastDSFinalBlock Hash `json:"last_ds_final_block"` NextBPHash Hash `json:"next_bp_hash"` BlockMerkleRoot Hash `json:"block_merkle_root"` Approvals []*Base58Signature `json:"approvals"` Signature Base58Signature `json:"signature"` LatestProtocolVersion uint64 `json:"latest_protocol_version"` }
type BlockView ¶
type BlockView struct { Author AccountID `json:"author"` Header BlockHeaderView `json:"header"` Chunks []ChunkHeaderView `json:"chunks"` }
type BridgeBaseEventData ¶
type BridgeDepositedEvent ¶
type BridgeDepositedEvent struct { BridgeEvent Data []BridgeDepositedEventData `json:"data"` }
type BridgeDepositedEventData ¶
type BridgeDepositedEventData struct { BridgeBaseEventData ChainTo string `json:"chain_to"` BundleData *string `json:"bundle_data,omitempty"` BundleSalt *string `json:"bundle_salt,omitempty"` }
type BridgeEvent ¶
type BridgeEventType ¶
type BridgeEventType string
const ( EventTypeFTDeposited BridgeEventType = "ft_deposited" EventTypeFTWithdrawn BridgeEventType = "ft_withdrawn" EventTypeNFTDeposited BridgeEventType = "nft_deposited" EventTypeNFTWithdrawn BridgeEventType = "nft_withdrawn" EventTypeNativeDeposited BridgeEventType = "native_deposited" EventTypeNativeWithdrawn BridgeEventType = "native_withdrawn" )
type BridgeWithdrawnEvent ¶
type BridgeWithdrawnEvent struct { BridgeEvent Data []BridgeWithdrawnEventData `json:"data"` }
type BridgeWithdrawnEventData ¶
type BridgeWithdrawnEventData struct { BridgeBaseEventData Origin string `json:"origin"` Signature string `json:"signature"` Path []string `json:"path"` RecoveryID uint8 `json:"recovery_id"` }
type CallResult ¶
type CallResult struct { Result []byte `json:"result"` Logs []string `json:"logs"` QueryResponse }
type ChallengesResult ¶
type ChallengesResult = []SlashedValidator
type ChunkHeaderView ¶
type ChunkHeaderView struct { ChunkHash Hash `json:"chunk_hash"` PrevBlockHash Hash `json:"prev_block_hash"` OutcomeRoot Hash `json:"outcome_root"` PrevStateRoot json.RawMessage `json:"prev_state_root"` // TODO: needs a type! EncodedMerkleRoot Hash `json:"encoded_merkle_root"` EncodedLength uint64 `json:"encoded_length"` HeightCreated BlockHeight `json:"height_created"` HeightIncluded BlockHeight `json:"height_included"` ShardID ShardID `json:"shard_id"` GasUsed Gas `json:"gas_used"` GasLimit Gas `json:"gas_limit"` RentPaid Balance `json:"rent_paid"` // TODO: deprecated ValidatorReward Balance `json:"validator_reward"` // TODO: deprecated BalanceBurnt Balance `json:"balance_burnt"` OutgoingReceiptsRoot Hash `json:"outgoing_receipts_root"` TxRoot Hash `json:"tx_root"` ValidatorProposals []ValidatorStakeView `json:"validator_proposals"` Signature Base58Signature `json:"signature"` }
type ChunkView ¶
type ChunkView struct { Author AccountID `json:"author"` Header ChunkHeaderView `json:"header"` Transactions []SignedTransactionView `json:"transactions"` Receipts []ReceiptView `json:"receipts"` }
type CurrentEpochValidatorInfo ¶
type CurrentEpochValidatorInfo struct { ValidatorInfo PublicKey Base58PublicKey `json:"public_key"` Stake Balance `json:"stake"` Shards []ShardID `json:"shards"` NumProducedBlocks NumBlocks `json:"num_produced_blocks"` NumExpectedBlocks NumBlocks `json:"num_expected_blocks"` }
type EdgeInfo ¶
EdgeInfo contains information that will be ultimately used to create a new edge. It contains nonce proposed for the edge with signature from peer.
type EndpointSetup ¶
type ExecutionOutcomeView ¶
type ExecutionOutcomeWithIdView ¶
type ExecutionOutcomeWithIdView struct { Proof MerklePath `json:"proof"` BlockHash Hash `json:"block_hash"` ID Hash `json:"id"` Outcome ExecutionOutcomeView `json:"outcome"` }
type ExecutionOutcomeWithReceipt ¶
type ExecutionOutcomeWithReceipt struct { ExecutionOutcome ExecutionOutcomeWithIdView `json:"execution_outcome"` Receipt *ReceiptView `json:"receipt"` }
type FeeManageOperation ¶
type FeeManageOperationArgs ¶
type FeeManageOperationArgs struct {
Operation FeeManageOperation `json:"op,required"`
}
type FeeManageOperationArgsWithBorsh ¶
type FeeManageOperationArgsWithBorsh struct {
Operation FeeManageOperationWithBorsh `json:"op,required"`
}
type FeeManageOperationType ¶
type FeeManageOperationType int
const ( FeeAddFeeToken FeeManageOperationType = iota + 1 FeeRemoveFeeToken FeeUpdateFeeToken FeeWithdraw )
type FeeManageOperationWithBorsh ¶
type FeeManageOperationWithBorsh struct { SignArgs Token FeeTokenWithBorsh `json:"token,required"` }
type FeeTokenWithBorsh ¶
type FeerDepositArgs ¶
type FeerDepositArgs struct { FeeTokenAddr *AccountID `json:"fee_token_addr"` TokenAddr *AccountID `json:"token_addr,omitempty"` TokenType TokenType `json:"token_type,omitempty"` TransferType FeerTransferType `json:"transfer_type"` Receiver string `json:"receiver"` ChainTo string `json:"chain_to"` IsWrapped bool `json:"is_wrapped"` BundleData *string `json:"bundle_data,omitempty"` BundleSalt *string `json:"bundle_salt,omitempty"` }
func (FeerDepositArgs) String ¶
func (f FeerDepositArgs) String() (string, error)
func (FeerDepositArgs) WithTransferType ¶
func (f FeerDepositArgs) WithTransferType(transferType FeerTransferType) FeerDepositArgs
type FeerTransferType ¶
type FeerTransferType string
const ( FeerTransferType_Fee FeerTransferType = "Fee" FeerTransferType_Deposit FeerTransferType = "Deposit" )
type FinalExecutionOutcomeView ¶
type FinalExecutionOutcomeView struct { Status TransactionStatus `json:"status"` Transaction SignedTransactionView `json:"transaction"` TransactionOutcome ExecutionOutcomeWithIdView `json:"transaction_outcome"` ReceiptsOutcome []ExecutionOutcomeWithIdView `json:"receipts_outcome"` }
type FinalExecutionOutcomeWithReceiptView ¶
type FinalExecutionOutcomeWithReceiptView struct { FinalExecutionOutcomeView Receipts []ReceiptView `json:"receipts"` }
type FtTransferArgs ¶
type FtWithdrawArgs ¶
type FtWithdrawArgs struct { WithdrawArgs Token AccountID `json:"token"` Amount Balance `json:"amount"` IsWrapped bool `json:"is_wrapped"` }
type FullAccessPermissionWrapper ¶
type FullAccessPermissionWrapper struct {
FunctionCall AccessKeyFunctionCallPermission `json:"FunctionCall"`
}
type FullPeerInfo ¶
type FullPeerInfo struct { PeerInfo PeerInfo `json:"peer_info"` ChainInfo PeerChainInfo `json:"chain_info"` EdgeInfo EdgeInfo `json:"edge_info"` }
type FunctionCallPermission ¶
type FunctionCallPermission struct { // Allowance for this function call (default 0.25 NEAR). Can be absent. Allowance *Balance `json:"allowance"` // ReceiverID holds the contract the key is allowed to call methods on ReceiverID AccountID `json:"receiver_id"` // MethodNames hold which functions are allowed to call. Can be empty (all methods are allowed) MethodNames []string `json:"method_names"` }
FunctionCallPermission represents a function call permission
type Gas ¶
type Gas = uint64
Gas is a type for storing amounts of gas.
var ( // 30 TGas DefaultFunctionCallGas Gas = 30 * 1000000000000 )
type Hash ¶
Hash is a wrapper for SHA-256 digest byte array. Note that nearcore also defines MerkleHash as an alias, but it's omitted from this project.
func NewCryptoHash ¶
func NewCryptoHashFromBase58 ¶
func (Hash) MarshalJSON ¶
func (*Hash) UnmarshalJSON ¶
type JsonActionAddKey ¶
type JsonActionAddKey struct { PublicKey Base58PublicKey `json:"public_key"` AccessKey ActionAddKeyAccessKey `json:"access_key"` }
type JsonActionDeleteKey ¶
type JsonActionDeleteKey struct {
PublicKey Base58PublicKey `json:"public_key"`
}
type JsonRpcError ¶
type JsonRpcError struct { Name string `json:"name"` Cause JsonRpcErrorCause `json:"cause"` // Legacy - do not rely on them Code int `json:"code"` Message string `json:"message"` Data json.RawMessage `json:"data"` }
func (*JsonRpcError) Error ¶
func (err *JsonRpcError) Error() string
type JsonRpcErrorCause ¶
type JsonRpcErrorCause struct { Name string `json:"name"` Info json.RawMessage `json:"info"` // contains filtered or unexported fields }
func (JsonRpcErrorCause) String ¶
func (cause JsonRpcErrorCause) String() string
func (*JsonRpcErrorCause) UnmarshalJSON ¶
func (cause *JsonRpcErrorCause) UnmarshalJSON(b []byte) (err error)
type JsonRpcErrorCauseMessage ¶
type JsonRpcErrorCauseMessage struct {
ErrorMessage string `json:"error_message"`
}
type KeyPair ¶
type KeyPair struct { Type PublicKeyType PublicKey Base58PublicKey PrivateKey ed25519.PrivateKey }
func GenerateKeyPair ¶
func GenerateKeyPair(keyType PublicKeyType, rand io.Reader) (kp KeyPair, err error)
func NewBase58KeyPair ¶
func NewKeyPair ¶
func NewKeyPair(keyType PublicKeyType, pub Base58PublicKey, priv ed25519.PrivateKey) KeyPair
func (*KeyPair) PrivateEncoded ¶
func (*KeyPair) UnmarshalJSON ¶
type KnownProducer ¶
type KnownProducer struct { AccountID AccountID `json:"account_id"` Addr *string `json:"addr"` PeerID PeerID `json:"peer_id"` }
KnownProducer is basically PeerInfo, but AccountID is known
type LogEvent ¶
type LogEvent struct { Standard string `json:"standard,required"` Version string `json:"version,required"` Event LogEventType `json:"event,required"` Data []LogEventDepositedData `json:"data,required"` }
type LogEventDepositedData ¶
type LogEventDepositedData struct { Token *AccountID `json:"token,required"` // Empty if fungible token TokenID *string `json:"token_id,omitempty"` // Empty if non fungible token Amount *Balance `json:"amount,omitempty"` Chain string `json:"chain,required"` IsWrapped bool `json:"is_wrapped,required"` }
type LogEventType ¶
type LogEventType = string
const ( LogEventTypeNftDeposited LogEventType = "nft_deposited" LogEventTypeFtDeposited LogEventType = "ft_deposited" LogEventTypeNativeDeposited LogEventType = "native_deposited" )
type MerklePath ¶
type MerklePath = []MerklePathItem
type MerklePathItem ¶
type NativeDepositArgs ¶
type NativeWithdrawArgs ¶
type NativeWithdrawArgs struct { WithdrawArgs Amount Balance `json:"amount"` }
type NetworkInfo ¶
type NetworkInfo struct { ActivePeers []FullPeerInfo `json:"active_peers"` NumActivePeers uint `json:"num_active_peers"` PeerMaxCount uint32 `json:"peer_max_count"` HighestHeightPeers []FullPeerInfo `json:"highest_height_peers"` SentBytesPerSec uint64 `json:"sent_bytes_per_sec"` ReceivedBytesPerSec uint64 `json:"received_bytes_per_sec"` KnownProducers []KnownProducer `json:"known_producers"` MetricRecorder MetricRecorder `json:"metric_recorder"` PeerCounter uint `json:"peer_counter"` }
NetworkInfo holds network information
type NftContractMetadataView ¶
type NftContractMetadataView struct { // required, essentially a version like "nft-1.0.0" Spec string `json:"spec"` // required, ex. "Mosaics" Name string `json:"name"` // required, ex. "MOSIAC" Symbol string `json:"symbol"` // Data URL Icon *string `json:"icon"` // Centralized gateway known to have reliable access to decentralized storage assets referenced by `reference` or `media` URLs BaseURI *string `json:"base_uri,omitempty"` // URL to an off-chain JSON file with more info. Reference *string `json:"reference,omitempty"` // Base64-encoded sha256 hash of JSON from reference field. Required if `reference` is included. ReferenceHash []byte `json:"reference_hash,omitempty"` }
type NftMetadataView ¶
type NftMetadataView struct { // ex. "Arch Nemesis: Mail Carrier" or "Parcel #5055" Title string `json:"title,omitempty"` // free-form description Description string `json:"description,omitempty"` // URL to associated media, preferably to decentralized, content-addressed storage Media string `json:"media,omitempty"` // Base64-encoded sha256 hash of content referenced by the `media` field. Required if `media` is included. MediaHash []byte `json:"media_hash,omitempty"` // number of copies of this set of metadata in existence when token was minted. Copies uint64 `json:"copies,omitempty"` // ISO 8601 datetime when token was issued or minted IssuedAt time.Time `json:"issued_at,omitempty"` // ISO 8601 datetime when token expires ExpiresAt time.Time `json:"expires_at,omitempty"` // ISO 8601 datetime when token starts being valid StartsAt time.Time `json:"starts_at,omitempty"` // ISO 8601 datetime when token was last updated UpdatedAt time.Time `json:"updated_at,omitempty"` // anything extra the NFT wants to store on-chain. Can be stringified JSON. Extra string `json:"extra,omitempty"` // URL to an off-chain JSON file with more info. Reference string `json:"reference,omitempty"` // Base64-encoded sha256 hash of JSON from reference field. Required if `reference` is included. ReferenceHash []byte `json:"reference_hash,omitempty"` }
type NftTransferArgs ¶
type NftView ¶
type NftView struct { TokenID string `json:"token_id"` OwnerID string `json:"owner_id"` Metadata *NftMetadataView `json:"metadata"` ApprovedAccountIds *map[AccountID]int64 `json:"approved_account_ids"` }
type NftWithdrawArgs ¶
type NftWithdrawArgs struct { WithdrawArgs Token AccountID `json:"token"` TokenID string `json:"token_id"` TokenMetadata *NftMetadataView `json:"token_metadata,omitempty"` IsWrapped bool `json:"is_wrapped"` }
type NodeVersion ¶
type PeerChainInfo ¶
type PeerChainInfo struct { // ChainTo Id and hash of genesis block. GenesisID GenesisID `json:"genesis_id"` // Last known chain height of the peer. Height BlockHeight `json:"height"` // Shards that the peer is tracking. TrackedShards []ShardID `json:"tracked_shards"` // Denote if a node is running in archival mode or not. Archival bool `json:"archival"` }
PeerChainInfo contains peer chain information. This is derived from PeerCHainInfoV2 in nearcore
type PeerInfo ¶
type PeerInfo struct { ID PeerID `json:"id"` Addr *string `json:"addr"` AccountID *AccountID `json:"account_id"` }
PeerInfo holds peer information
type PublicKey ¶
type PublicKey [33]byte
TODO: SECP256K1
func PublicKeyFromBytes ¶
func WrapED25519 ¶
func WrapRawKey ¶
func WrapRawKey(keyType PublicKeyType, key []byte) (pk PublicKey, err error)
func (PublicKey) MarshalJSON ¶
func (*PublicKey) ToBase58PublicKey ¶
func (p *PublicKey) ToBase58PublicKey() Base58PublicKey
func (*PublicKey) UnmarshalJSON ¶
type PublicKeyType ¶
type PublicKeyType string
const ( KeyTypeED25519 PublicKeyType = "ed25519" KeyTypeSECP256K1 PublicKeyType = "secp256k1" )
type QueryResponse ¶
type QueryResponse struct { BlockHeight BlockHeight `json:"block_height"` BlockHash Hash `json:"block_hash"` Error *string `json:"error"` Logs []interface{} `json:"logs"` // TODO: use correct type }
type ReceiptView ¶
type ReceiptView struct { PredecessorID AccountID `json:"predecessor_id"` ReceiverID AccountID `json:"receiver_id"` ReceiptID Hash `json:"receipt_id"` Receipt json.RawMessage `json:"receipt"` // TODO: needs a type! }
type Request ¶
type Request struct { EndpointSetup Params interface{} `json:"params,omitempty"` }
type Response ¶
type Response struct { EndpointSetup Error *JsonRpcError `json:"error"` Result json.RawMessage `json:"result"` }
type ShardChunkTransactionView ¶
type ShardChunkTransactionView struct { Outcome ExecutionOutcomeWithReceipt `json:"outcome"` Transaction SignedTransactionView `json:"transaction"` }
type ShardChunkView ¶
type ShardChunkView struct { Author AccountID `json:"author"` Header ChunkHeaderView `json:"header"` Receipts []ReceiptView `json:"receipts"` Transactions []ShardChunkTransactionView `json:"transactions"` }
type ShardStateChangeChangeView ¶
type ShardStateChangeChangeView struct { AccountID AccountID `json:"account_id"` AccessKey *AccessKeyView `json:"access_key,omitempty"` PublicKey *Base58PublicKey `json:"public_key,omitempty"` Amount *Balance `json:"amount,omitempty"` Locked *Balance `json:"locked,omitempty"` CodeHash *Hash `json:"code_hash,omitempty"` StorageUsage *StorageUsage `json:"storage_usage,omitempty"` StoragePaidAt *BlockHeight `json:"storage_paid_at,omitempty"` }
type ShardStateChangeView ¶
type ShardStateChangeView struct { Type string `json:"type"` Cause ShardStateChangeCauseView `json:"cause"` Change ShardStateChangeChangeView `json:"change"` }
type ShardView ¶
type ShardView struct { ShardID ShardID `json:"shard_id"` Chunk *ShardChunkView `json:"chunk"` ReceiptExecutionOutcomes []ExecutionOutcomeWithReceipt `json:"receipt_execution_outcomes"` StateChanges []ShardStateChangeView `json:"state_changes"` }
type Signature ¶
type Signature [1 + ed25519.SignatureSize]byte
TODO: SECP256K1 support
func NewSignatureED25519 ¶
type SignatureType ¶
type SignatureType string
type SignedTransaction ¶
type SignedTransaction struct { Transaction Transaction Signature Signature SerializedTransaction []byte `borsh_skip:"true"` // contains filtered or unexported fields }
func NewSignedTransaction ¶
func NewSignedTransaction(keyPair KeyPair, transaction Transaction) (stxn SignedTransaction, err error)
func (*SignedTransaction) Hash ¶
func (st *SignedTransaction) Hash() Hash
func (SignedTransaction) Serialize ¶
func (st SignedTransaction) Serialize() (serialized string, err error)
func (*SignedTransaction) Size ¶
func (st *SignedTransaction) Size() int
type SignedTransactionView ¶
type SignedTransactionView struct { SignerID AccountID `json:"signer_id"` PublicKey Base58PublicKey `json:"public_key"` Nonce Nonce `json:"nonce"` ReceiverID AccountID `json:"receiver_id"` Actions []Action `json:"actions"` Signature Base58Signature `json:"signature"` Hash Hash `json:"hash"` }
type SlashedValidator ¶
type StateItem ¶
type StateItem struct { Key string `json:"key"` Value string `json:"value"` Proof TrieProofPath `json:"proof"` }
type StatusResponse ¶
type StatusResponse struct { // Binary version Version NodeVersion `json:"version"` // Unique chain id. ChainID string `json:"chain_id"` // Currently active protocol version. ProtocolVersion uint32 `json:"protocol_version"` // Latest protocol version that this client supports. LatestProtocolVersion uint32 `json:"latest_protocol_version"` // Address for RPC server. RPCAddr string `json:"rpc_addr"` // Current epoch validators. Validators []ValidatorInfo `json:"validators"` // Sync status of the node. SyncInfo StatusSyncInfo `json:"sync_info"` // Validator id of the node ValidatorAccountID *AccountID `json:"validator_account_id"` }
type StatusSyncInfo ¶
type StatusSyncInfo struct { LatestBlockHash Hash `json:"latest_block_hash"` LatestBlockHeight BlockHeight `json:"latest_block_height"` LatestBlockTime time.Time `json:"latest_block_time"` Syncing bool `json:"syncing"` }
type StorageUsage ¶
type StorageUsage = uint64
StorageUsage is used to count the amount of storage used by a contract.
type TimeNanos ¶
type TimeNanos = Balance
Time nanoseconds fit into uint128. Using existing Balance type which implements JSON marshal/unmarshal
type Transaction ¶
type Transaction struct { SignerID AccountID PublicKey PublicKey Nonce Nonce ReceiverID AccountID BlockHash Hash Actions []Action }
func (Transaction) HashAndSign ¶
type TransactionStatus ¶
type TransactionStatus struct { SuccessValue string `json:"SuccessValue"` SuccessReceiptID string `json:"SuccessReceiptId"` Failure json.RawMessage `json:"Failure"` // TODO }
type TransferArgs ¶
type TransferArgs struct { Token AccountID `json:"token"` Sender AccountID `json:"sender"` Receiver AccountID `json:"receiver"` ChainTo string `json:"chain_to"` IsWrapped bool `json:"is_wrapped"` BundleData string `json:"bundle_data,omitempty"` BundleSalt string `json:"bundle_salt,omitempty"` }
func NewTransferArgs ¶
func NewTransferArgs(token string, sender, receiver AccountID, chainTo string, isWrapped bool) *TransferArgs
func (*TransferArgs) String ¶
func (t *TransferArgs) String() (string, error)
type TrieProofPath ¶
type TrieProofPath = []string
TrieProofPath is a set of serialized TrieNodes that are encoded in base64. Represent proof of inclusion of some TrieNode in the MerkleTrie.
type ValidatorInfo ¶
type ValidatorStakeView ¶
type ValidatorStakeView struct { AccountID AccountID `json:"account_id"` PublicKey Base58PublicKey `json:"public_key"` Stake Balance `json:"stake"` }
ValidatorStakeView is based on ValidatorStakeV1 struct in nearcore
type ValidatorsResponse ¶
type ValidatorsResponse struct {
CurrentValidators []CurrentEpochValidatorInfo `json:"current_validator"`
}
type ViewStateResult ¶
type ViewStateResult struct { Values []StateItem `json:"values"` Proof TrieProofPath `json:"proof"` QueryResponse }
type WithdrawArgs ¶
Source Files ¶
- access_key.go
- account.go
- actions.go
- actions_access_key.go
- actions_bridge.go
- actions_feer.go
- args.go
- balance.go
- base58_public_key.go
- base58_signature.go
- basic.go
- block.go
- bridge_event.go
- chunk.go
- contract.go
- contracts.go
- gas.go
- hash.go
- jsonrpc.go
- jsonrpc_error.go
- key.go
- key_pair.go
- network.go
- nft.go
- public_key.go
- query.go
- shard.go
- signature.go
- signed_transaction.go
- transaction.go