Documentation
¶
Index ¶
- type AccessKeyView
- type Account
- func (a *Account) DeployContract(ctx context.Context, code []byte) (*FinalExecutionOutcome, error)
- func (a *Account) FindAccessKey(ctx context.Context, receiverID string, actions []transaction.Action) (*keys.PublicKey, *AccessKeyView, error)
- func (a *Account) FunctionCall(ctx context.Context, contractID, methodName string, ...) (*FinalExecutionOutcome, error)
- func (a *Account) SignAndSendTransaction(ctx context.Context, receiverID string, actions ...transaction.Action) (*FinalExecutionOutcome, error)
- func (a *Account) SignTransaction(ctx context.Context, receiverID string, actions ...transaction.Action) ([]byte, *transaction.SignedTransaction, error)
- func (a *Account) State(ctx context.Context, opts ...StateOption) (*AccountView, error)
- func (a *Account) ViewAccessKey(ctx context.Context, pubKey *keys.PublicKey) (*AccessKeyView, error)
- func (a *Account) ViewState(ctx context.Context, opts ...ViewStateOption) (*AccountStateView, error)
- type AccountStateView
- type AccountView
- type ExecutionOutcome
- type ExecutionOutcomeWithID
- type ExecutionStatus
- type ExecutionStatusBasic
- type FinalExecutionOutcome
- type FinalExecutionStatus
- type FinalExecutionStatusBasic
- type FunctionCall
- type FunctionCallPermissionView
- type PermissionType
- type StateOption
- type Value
- type ViewStateOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessKeyView ¶
type AccessKeyView struct { types.QueryResponse Nonce uint64 PermissionType PermissionType FunctionCallPermissionView *FunctionCallPermissionView }
AccessKeyView contains information about an access key.
type Account ¶
type Account struct {
// contains filtered or unexported fields
}
Account provides functions for a single account.
func NewAccount ¶
NewAccount creates a new account.
func (*Account) DeployContract ¶
DeployContract deploys contract code to the account.
func (*Account) FindAccessKey ¶
func (a *Account) FindAccessKey( ctx context.Context, receiverID string, actions []transaction.Action, ) (*keys.PublicKey, *AccessKeyView, error)
FindAccessKey finds the AccessKeyView associated with the account's PublicKey stored in the KeyStore.
func (*Account) FunctionCall ¶
func (a *Account) FunctionCall( ctx context.Context, contractID, methodName string, opts ...transaction.FunctionCallOpton, ) (*FinalExecutionOutcome, error)
FunctionCall calls a smart contract function.
func (*Account) SignAndSendTransaction ¶
func (a *Account) SignAndSendTransaction( ctx context.Context, receiverID string, actions ...transaction.Action, ) (*FinalExecutionOutcome, error)
SignAndSendTransaction creates, signs and sends a tranaction for the supplied actions.
func (*Account) SignTransaction ¶
func (a *Account) SignTransaction( ctx context.Context, receiverID string, actions ...transaction.Action, ) ([]byte, *transaction.SignedTransaction, error)
SignTransaction creates and signs a transaction from the supplied actions.
func (*Account) State ¶
func (a *Account) State( ctx context.Context, opts ...StateOption, ) (*AccountView, error)
State queries information about the account state.
func (*Account) ViewAccessKey ¶
func (a *Account) ViewAccessKey(ctx context.Context, pubKey *keys.PublicKey) (*AccessKeyView, error)
ViewAccessKey gets the access key view for the provided public key associated with the account.
func (*Account) ViewState ¶
func (a *Account) ViewState(ctx context.Context, opts ...ViewStateOption) (*AccountStateView, error)
ViewState queries the contract state.
type AccountStateView ¶
type AccountStateView struct { types.QueryResponse Values []Value `json:"values"` }
AccountStateView holds information about contract state.
type AccountView ¶
type AccountView struct { types.QueryResponse Amount string `json:"amount"` Locked string `json:"locked"` CodeHash string `json:"code_hash"` StorageUsage int `json:"storage_usage"` StoragePaidAt int `json:"storage_paid_at"` }
AccountView holds information about an account.
type ExecutionOutcome ¶
type ExecutionOutcome struct { Logs []string `json:"logs"` ReceiptIDs []string `json:"receipt_ids"` GasBurnt int64 `json:"gas_burnt"` RawStatus json.RawMessage `json:"status"` }
ExecutionOutcome is the outcome of a transaction.
func (*ExecutionOutcome) GetStatus ¶
func (eo *ExecutionOutcome) GetStatus() (ExecutionStatus, bool)
GetStatus returns a bool indicating if the status is an ExecutionStatus, and if so, the ExecutionStatus.
func (*ExecutionOutcome) GetStatusBasic ¶
func (eo *ExecutionOutcome) GetStatusBasic() (ExecutionStatusBasic, bool)
GetStatusBasic returns a bool indicating if the status is an ExecutionStatusBasic, and if so, the ExecutionStatusBasic.
type ExecutionOutcomeWithID ¶
type ExecutionOutcomeWithID struct { ID string `json:"id"` Outcome ExecutionOutcome `json:"outcome"` }
ExecutionOutcomeWithID provides the transaction or receipt outcome with and id.
type ExecutionStatus ¶
type ExecutionStatus struct { SuccessValue string `json:"SuccessValue"` SuccessReceiptID string `json:"SuccessReceiptId"` Failure map[string]interface{} `json:"Failure,omitempty"` }
ExecutionStatus is the status of a transaction.
type ExecutionStatusBasic ¶
type ExecutionStatusBasic int
ExecutionStatusBasic is the status of a transaction.
const ( // ExecutionStatusBasicUnknown means the transaction status is unknown. ExecutionStatusBasicUnknown ExecutionStatusBasic = iota // ExecutionStatusBasicPending means the transaction is pending. ExecutionStatusBasicPending // ExecutionStatusBasicFailure means the transaction has failed. ExecutionStatusBasicFailure )
type FinalExecutionOutcome ¶
type FinalExecutionOutcome struct { RawStatus json.RawMessage `json:"status"` Transaction json.RawMessage `json:"transaction"` TransactionOutcome ExecutionOutcomeWithID `json:"transaction_outcome"` ReceiptsOutcome []ExecutionOutcomeWithID `json:"receipts_outcome"` }
FinalExecutionOutcome is the final outcome of a transaction.
func (*FinalExecutionOutcome) GetStatus ¶
func (feo *FinalExecutionOutcome) GetStatus() (FinalExecutionStatus, bool)
GetStatus returns a bool indicating if the status is an FinalExecutionStatus, and if so, the FinalExecutionStatus.
func (*FinalExecutionOutcome) GetStatusBasic ¶
func (feo *FinalExecutionOutcome) GetStatusBasic() (FinalExecutionStatusBasic, bool)
GetStatusBasic returns a bool indicating if the status is an FinalExecutionStatusBasic, and if so, the FinalExecutionStatusBasic.
type FinalExecutionStatus ¶
type FinalExecutionStatus struct { SuccessValue string `json:"SuccessValue"` Failure map[string]interface{} `json:"Failure,omitempty"` }
FinalExecutionStatus is the final status of a transaction.
type FinalExecutionStatusBasic ¶
type FinalExecutionStatusBasic int
FinalExecutionStatusBasic is the final status of a transaction.
const ( // FinalExecutionStatusBasicNotStarted means the transaction hasn't started. FinalExecutionStatusBasicNotStarted FinalExecutionStatusBasic = iota // FinalExecutionStatusBasicStarted means the transaction has started. FinalExecutionStatusBasicStarted // FinalExecutionStatusBasicFailure means the transaction has failed. FinalExecutionStatusBasicFailure )
type FunctionCall ¶
type FunctionCall struct { Allowance string `json:"allowance"` ReceiverID string `json:"receiver_id"` MethodNames []string `json:"method_names"` }
FunctionCall provides information about the allowed function call.
type FunctionCallPermissionView ¶
type FunctionCallPermissionView struct {
FunctionCall FunctionCall `json:"FunctionCall"`
}
FunctionCallPermissionView contains a FunctionCall.
type PermissionType ¶
type PermissionType int
PermissionType specifies the type of permission.
const ( // FullAccessPermissionType means the account has full access. FullAccessPermissionType PermissionType = iota // FunctionCallPermissionType means the account has permission to call some functions. FunctionCallPermissionType )
type StateOption ¶
type StateOption func(*itypes.QueryRequest)
StateOption controls the behavior when calling ViewAccount.
func StateWithBlockHash ¶
func StateWithBlockHash(blockHash string) StateOption
StateWithBlockHash specifies the block hash to query the account for.
func StateWithBlockHeight ¶
func StateWithBlockHeight(blockHeight int) StateOption
StateWithBlockHeight specifies the block height to query the account for.
func StateWithFinality ¶
func StateWithFinality(finalaity string) StateOption
StateWithFinality specifies the finality to be used when querying the account.
type ViewStateOption ¶
type ViewStateOption func(*itypes.QueryRequest)
ViewStateOption controls the behavior when calling ViewState.
func ViewStateWithBlockHash ¶
func ViewStateWithBlockHash(blockHash string) ViewStateOption
ViewStateWithBlockHash specifies the block hash to query the state for.
func ViewStateWithBlockHeight ¶
func ViewStateWithBlockHeight(blockHeight int) ViewStateOption
ViewStateWithBlockHeight specifies the block height to query the state for.
func ViewStateWithFinality ¶
func ViewStateWithFinality(finalaity string) ViewStateOption
ViewStateWithFinality specifies the finality to be used when querying the state.
func ViewStateWithPrefix ¶
func ViewStateWithPrefix(prefix string) ViewStateOption
ViewStateWithPrefix specifies the state key prefix to query for.