Documentation ¶
Index ¶
- func ContextWithKeyPair(ctx context.Context, keyPair key.KeyPair) context.Context
- type AccessKey
- type AccessKeyList
- type AccessKeyPermission
- type AccessKeyView
- type AccessKeyViewInfo
- type BlockHeaderView
- type BlockView
- type ChallengesResult
- type ChunkHeaderView
- type Client
- func (c *Client) AccessKeyView(ctx context.Context, accountID types.AccountID, publicKey key.Base58PublicKey, ...) (resp AccessKeyView, err error)
- func (c *Client) AccessKeyViewChanges(ctx context.Context, accountID types.AccountID, publicKey key.Base58PublicKey, ...) (res jsonrpc.Response, err error)
- func (c *Client) AccessKeyViewChangesAll(ctx context.Context, accountIDs []types.AccountID, ...) (res jsonrpc.Response, err error)
- func (c *Client) AccessKeyViewList(ctx context.Context, accountID types.AccountID, ...) (resp AccessKeyList, err error)
- func (c *Client) AccountView(ctx context.Context, accountID types.AccountID, ...) (res jsonrpc.Response, err error)
- func (c *Client) AccountViewChanges(ctx context.Context, accountIDs []types.AccountID, ...) (res jsonrpc.Response, err error)
- func (c *Client) BlockChanges(ctx context.Context, block block.BlockCharacteristic) (res jsonrpc.Response, err error)
- func (c *Client) BlockDetails(ctx context.Context, block block.BlockCharacteristic) (resp BlockView, err error)
- func (c *Client) ChunkDetails(ctx context.Context, chunkHash hash.CryptoHash) (res jsonrpc.Response, err error)
- func (c *Client) ContractViewCallFunction(ctx context.Context, accountID, methodName, argsBase64 string, ...) (res jsonrpc.Response, err error)
- func (c *Client) ContractViewCodeChanges(ctx context.Context, accountIDs []types.AccountID, ...) (res jsonrpc.Response, err error)
- func (c *Client) ContractViewState(ctx context.Context, accountID types.AccountID, prefixBase64 string, ...) (res jsonrpc.Response, err error)
- func (c *Client) ContractViewStateChanges(ctx context.Context, accountIDs []types.AccountID, keyPrefixBase64 string, ...) (res jsonrpc.Response, err error)
- func (c *Client) GasPriceView(ctx context.Context, block block.BlockCharacteristic) (res jsonrpc.Response, err error)
- func (c *Client) GenesisConfig(ctx context.Context) (res jsonrpc.Response, err error)
- func (c *Client) NetworkAddr() string
- func (c *Client) NetworkInfo(ctx context.Context) (res jsonrpc.Response, err error)
- func (c *Client) NetworkStatusValidators(ctx context.Context) (res jsonrpc.Response, err error)
- func (c *Client) NetworkStatusValidatorsDetailed(ctx context.Context, block block.BlockCharacteristic) (res jsonrpc.Response, err error)
- func (c *Client) RPCTransactionSend(ctx context.Context, signedTxnBase64 string) (resp hash.CryptoHash, err error)
- func (c *Client) RPCTransactionSendAwait(ctx context.Context, signedTxnBase64 string) (resp FinalExecutionOutcomeView, err error)
- func (c *Client) TransactionSend(ctx context.Context, from, to types.AccountID, actions []action.Action, ...) (res hash.CryptoHash, err error)
- func (c *Client) TransactionSendAwait(ctx context.Context, from, to types.AccountID, actions []action.Action, ...) (res FinalExecutionOutcomeView, err error)
- func (c *Client) TransactionStatus(ctx context.Context, tx hash.CryptoHash, sender types.AccountID) (resp FinalExecutionOutcomeView, err error)
- func (c *Client) TransactionStatusWithReceipts(ctx context.Context, tx hash.CryptoHash, sender types.AccountID) (resp FinalExecutionOutcomeWithReceiptView, err error)
- type ExecutionOutcomeView
- type ExecutionOutcomeWithIdView
- type FinalExecutionOutcomeView
- type FinalExecutionOutcomeWithReceiptView
- type FunctionCallPermission
- type MerklePath
- type MerklePathItem
- type ReceiptView
- type SignedTransactionView
- type SlashedValidator
- type TransactionOpt
- type TransactionStatus
- type ValidatorStakeView
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AccessKey ¶
type AccessKey struct { Nonce types.Nonce `json:"nonce"` // Permission holds parsed access key permission info Permission AccessKeyPermission `json:"-"` }
func (*AccessKey) UnmarshalJSON ¶
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 BlockHeight uint64 `json:"block_height"` BlockHash hash.CryptoHash `json:"block_hash"` }
type AccessKeyViewInfo ¶
type AccessKeyViewInfo struct { PublicKey key.Base58PublicKey `json:"public_key"` AccessKey AccessKey `json:"access_key"` }
type BlockHeaderView ¶
type BlockHeaderView struct { Height types.BlockHeight `json:"height"` EpochID hash.CryptoHash `json:"epoch_id"` NextEpochID hash.CryptoHash `json:"next_epoch_id"` Hash hash.CryptoHash `json:"hash"` PrevHash hash.CryptoHash `json:"prev_hash"` PrevStateRoot hash.CryptoHash `json:"prev_state_root"` ChunkReceiptsRoot hash.CryptoHash `json:"chunk_receipts_root"` ChunkHeadersRoot hash.CryptoHash `json:"chunk_headers_root"` ChunkTxRoot hash.CryptoHash `json:"chunk_tx_root"` OutcomeRoot hash.CryptoHash `json:"outcome_root"` ChunksIncluded uint64 `json:"chunks_included"` ChallengesRoot hash.CryptoHash `json:"challenges_root"` Timestamp uint64 `json:"timestamp"` // milliseconds TimestampNanosec types.TimeNanos `json:"timestamp_nanosec"` // nanoseconds, uint128 RandomValue hash.CryptoHash `json:"random_value"` ValidatorProposals []ValidatorStakeView `json:"validator_proposals"` ChunkMask []bool `json:"chunk_mask"` GasPrice types.Balance `json:"gas_price"` RentPaid types.Balance `json:"rent_paid"` // NOTE: deprecated - 2021-05-14 ValidatorReward types.Balance `json:"validator_reward"` // NOTE: deprecated - 2021-05-14 TotalSupply types.Balance `json:"total_supply"` ChallengesResult ChallengesResult `json:"challenges_result"` LastFinalBlock hash.CryptoHash `json:"last_final_block"` LastDSFinalBlock hash.CryptoHash `json:"last_ds_final_block"` NextBPHash hash.CryptoHash `json:"next_bp_hash"` BlockMerkleRoot hash.CryptoHash `json:"block_merkle_root"` Approvals []*signature.Base58Signature `json:"approvals"` Signature signature.Base58Signature `json:"signature"` LatestProtocolVersion uint64 `json:"latest_protocol_version"` }
type BlockView ¶
type BlockView struct { Author types.AccountID `json:"author"` Header BlockHeaderView `json:"header"` Chunks []ChunkHeaderView `json:"chunks"` }
type ChallengesResult ¶
type ChallengesResult = []SlashedValidator
type ChunkHeaderView ¶
type ChunkHeaderView struct { ChunkHash hash.CryptoHash `json:"chunk_hash"` PrevBlockHash hash.CryptoHash `json:"prev_block_hash"` OutcomeRoot hash.CryptoHash `json:"outcome_root"` PrevStateRoot json.RawMessage `json:"prev_state_root"` // TODO: needs a type! EncodedMerkleRoot hash.CryptoHash `json:"encoded_merkle_root"` EncodedLength uint64 `json:"encoded_length"` HeightCreated types.BlockHeight `json:"height_created"` HeightIncluded types.BlockHeight `json:"height_included"` ShardID types.ShardID `json:"shard_id"` GasUsed types.Gas `json:"gas_used"` GasLimit types.Gas `json:"gas_limit"` RentPaid types.Balance `json:"rent_paid"` // TODO: deprecated ValidatorReward types.Balance `json:"validator_reward"` // TODO: deprecated BalanceBurnt types.Balance `json:"balance_burnt"` OutgoingReceiptsRoot hash.CryptoHash `json:"outgoing_receipts_root"` TxRoot hash.CryptoHash `json:"tx_root"` ValidatorProposals []ValidatorStakeView `json:"validator_proposals"` Signature signature.Base58Signature `json:"signature"` }
type Client ¶
func (*Client) AccessKeyView ¶
func (c *Client) AccessKeyView(ctx context.Context, accountID types.AccountID, publicKey key.Base58PublicKey, block block.BlockCharacteristic) (resp AccessKeyView, err error)
https://docs.near.org/docs/develop/front-end/rpc#view-access-key
func (*Client) AccessKeyViewChanges ¶
func (c *Client) AccessKeyViewChanges(ctx context.Context, accountID types.AccountID, publicKey key.Base58PublicKey, block block.BlockCharacteristic) (res jsonrpc.Response, err error)
TODO: decode response https://docs.near.org/docs/develop/front-end/rpc#view-access-key-changes-single
func (*Client) AccessKeyViewChangesAll ¶
func (c *Client) AccessKeyViewChangesAll(ctx context.Context, accountIDs []types.AccountID, block block.BlockCharacteristic) (res jsonrpc.Response, err error)
TODO: decode response https://docs.near.org/docs/develop/front-end/rpc#view-access-key-changes-all
func (*Client) AccessKeyViewList ¶
func (c *Client) AccessKeyViewList(ctx context.Context, accountID types.AccountID, block block.BlockCharacteristic) (resp AccessKeyList, err error)
https://docs.near.org/docs/develop/front-end/rpc#view-access-key-list
func (*Client) AccountView ¶
func (c *Client) AccountView(ctx context.Context, accountID types.AccountID, block block.BlockCharacteristic) (res jsonrpc.Response, err error)
TODO: decode response https://docs.near.org/docs/develop/front-end/rpc#view-account
func (*Client) AccountViewChanges ¶
func (c *Client) AccountViewChanges(ctx context.Context, accountIDs []types.AccountID, block block.BlockCharacteristic) (res jsonrpc.Response, err error)
TODO: decode response https://docs.near.org/docs/develop/front-end/rpc#view-account-changes
func (*Client) BlockChanges ¶
func (c *Client) BlockChanges(ctx context.Context, block block.BlockCharacteristic) (res jsonrpc.Response, err error)
TODO: decode resposne https://docs.near.org/docs/develop/front-end/rpc#changes-in-block
func (*Client) BlockDetails ¶
func (c *Client) BlockDetails(ctx context.Context, block block.BlockCharacteristic) (resp BlockView, err error)
https://docs.near.org/docs/develop/front-end/rpc#block-details
func (*Client) ChunkDetails ¶
func (c *Client) ChunkDetails(ctx context.Context, chunkHash hash.CryptoHash) (res jsonrpc.Response, err error)
TODO: decode response https://docs.near.org/docs/develop/front-end/rpc#chunk-details
func (*Client) ContractViewCallFunction ¶
func (c *Client) ContractViewCallFunction(ctx context.Context, accountID, methodName, argsBase64 string, block block.BlockCharacteristic) (res jsonrpc.Response, err error)
TODO: decode response https://docs.near.org/docs/develop/front-end/rpc#call-a-contract-function
func (*Client) ContractViewCodeChanges ¶
func (c *Client) ContractViewCodeChanges(ctx context.Context, accountIDs []types.AccountID, block block.BlockCharacteristic) (res jsonrpc.Response, err error)
TODO: decode response https://docs.near.org/docs/develop/front-end/rpc#view-contract-code-changes
func (*Client) ContractViewState ¶
func (c *Client) ContractViewState(ctx context.Context, accountID types.AccountID, prefixBase64 string, block block.BlockCharacteristic) (res jsonrpc.Response, err error)
TODO: decode response https://docs.near.org/docs/develop/front-end/rpc#view-contract-state
func (*Client) ContractViewStateChanges ¶
func (c *Client) ContractViewStateChanges(ctx context.Context, accountIDs []types.AccountID, keyPrefixBase64 string, block block.BlockCharacteristic) (res jsonrpc.Response, err error)
TODO: decode response https://docs.near.org/docs/develop/front-end/rpc#view-contract-state-changes
func (*Client) GasPriceView ¶
func (c *Client) GasPriceView(ctx context.Context, block block.BlockCharacteristic) (res jsonrpc.Response, err error)
TODO: decode response https://docs.near.org/docs/develop/front-end/rpc#gas-price
func (*Client) GenesisConfig ¶
TODO: decode response https://docs.near.org/docs/develop/front-end/rpc#genesis-config
func (*Client) NetworkAddr ¶
func (*Client) NetworkInfo ¶
TODO: decode response https://docs.near.org/docs/develop/front-end/rpc#network-info
func (*Client) NetworkStatusValidators ¶
TODO: decode response https://docs.near.org/docs/develop/front-end/rpc#general-validator-status
func (*Client) NetworkStatusValidatorsDetailed ¶
func (c *Client) NetworkStatusValidatorsDetailed(ctx context.Context, block block.BlockCharacteristic) (res jsonrpc.Response, err error)
TODO: decode response https://docs.near.org/docs/develop/front-end/rpc#detailed-validator-status
func (*Client) RPCTransactionSend ¶
func (c *Client) RPCTransactionSend(ctx context.Context, signedTxnBase64 string) (resp hash.CryptoHash, err error)
https://docs.near.org/docs/develop/front-end/rpc#send-transaction-async
func (*Client) RPCTransactionSendAwait ¶
func (c *Client) RPCTransactionSendAwait(ctx context.Context, signedTxnBase64 string) (resp FinalExecutionOutcomeView, err error)
https://docs.near.org/docs/develop/front-end/rpc#send-transaction-await
func (*Client) TransactionSend ¶
func (c *Client) TransactionSend(ctx context.Context, from, to types.AccountID, actions []action.Action, txnOpts ...TransactionOpt) (res hash.CryptoHash, err error)
https://docs.near.org/docs/develop/front-end/rpc#send-transaction-async
func (*Client) TransactionSendAwait ¶
func (c *Client) TransactionSendAwait(ctx context.Context, from, to types.AccountID, actions []action.Action, txnOpts ...TransactionOpt) (res FinalExecutionOutcomeView, err error)
https://docs.near.org/docs/develop/front-end/rpc#send-transaction-await
func (*Client) TransactionStatus ¶
func (c *Client) TransactionStatus(ctx context.Context, tx hash.CryptoHash, sender types.AccountID) (resp FinalExecutionOutcomeView, err error)
https://docs.near.org/docs/develop/front-end/rpc#transaction-status
func (*Client) TransactionStatusWithReceipts ¶
func (c *Client) TransactionStatusWithReceipts(ctx context.Context, tx hash.CryptoHash, sender types.AccountID) (resp FinalExecutionOutcomeWithReceiptView, err error)
https://docs.near.org/docs/develop/front-end/rpc#transaction-status-with-receipts
type ExecutionOutcomeView ¶
type ExecutionOutcomeView struct { Logs []string `json:"logs"` ReceiptIDs []hash.CryptoHash `json:"receipt_ids"` GasBurnt types.Gas `json:"gas_burnt"` TokensBurnt types.Balance `json:"tokens_burnt"` ExecutorID types.AccountID `json:"executor_id"` Status TransactionStatus `json:"status"` }
type ExecutionOutcomeWithIdView ¶
type ExecutionOutcomeWithIdView struct { Proof MerklePath `json:"proof"` BlockHash hash.CryptoHash `json:"block_hash"` ID hash.CryptoHash `json:"id"` Outcome ExecutionOutcomeView `json:"outcome"` }
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 FunctionCallPermission ¶
type FunctionCallPermission struct { // Allowance for this function call (default 0.25 NEAR). Can be absent. Allowance *types.Balance `json:"allowance"` // ReceiverID holds the contract the key is allowed to call methods on ReceiverID types.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 MerklePath ¶
type MerklePath = []MerklePathItem
type MerklePathItem ¶
type MerklePathItem struct { Hash hash.CryptoHash `json:"hash"` Direction string `json:"direction"` // TODO: enum type, either 'Left' or 'Right' }
type ReceiptView ¶
type ReceiptView struct { PredecessorId types.AccountID `json:"predecessor_id"` ReceiverID types.AccountID `json:"receiver_id"` ReceiptID hash.CryptoHash `jsom:"receipt_id"` Receipt json.RawMessage `json:"receipt"` // TODO: needs a type! }
type SignedTransactionView ¶
type SignedTransactionView struct { SignerID types.AccountID `json:"signer_id"` PublicKey key.Base58PublicKey `json:"public_key"` Nonce types.Nonce `json:"nonce"` ReceiverID types.AccountID `json:"receiver_id"` Actions []action.Action `json:"actions"` Signature signature.Base58Signature `json:"signature"` Hash hash.CryptoHash `json:"hash"` }
type SlashedValidator ¶
type TransactionOpt ¶
func WithBlockCharacteristic ¶
func WithBlockCharacteristic(block block.BlockCharacteristic) TransactionOpt
func WithBlockHash ¶
func WithBlockHash(hash hash.CryptoHash) TransactionOpt
WithBlockHash sets block hash to attach this transaction to
func WithKeyNonce ¶
func WithKeyNonce(nonce types.Nonce) TransactionOpt
WithKeyNonce sets key nonce to use with this transaction. If not set via this function, a RPC query will be done to query current nonce and (nonce+1) will be used
func WithKeyPair ¶
func WithKeyPair(keyPair key.KeyPair) TransactionOpt
WithKeyPair sets key pair to use sign this transaction with
func WithLatestBlock ¶
func WithLatestBlock() TransactionOpt
WithLatestBlock is alias to `WithBlockCharacteristic(block.FinalityFinal())`
type TransactionStatus ¶
type TransactionStatus struct { SuccessValue string `json:"SuccessValue"` SuccessReceiptID string `json:"SuccessReceiptId"` Failure json.RawMessage `json:"Failure"` // TODO }