Documentation
¶
Index ¶
- func SerializeBody(payment *ExecutableDeployItem, session *ExecutableDeployItem) []byte
- func SerializeHeader(deployHeader *DeployHeader) []byte
- type AccountDeploy
- type AccountDeploysResult
- type ActionThresholds
- type Approval
- type AssociatedKey
- type AuctionState
- type BlockBody
- type BlockHeader
- type BlockResponse
- type BlockResult
- type BlocksResult
- type BoundContract
- type Contract
- type Deploy
- type DeployHash
- type DeployHeader
- type DeployParams
- type DeployRes
- type DeployResult
- type Duration
- type EraValidators
- type EventService
- func (e EventService) GetAccountDeploy(accountHex string, page int, limit int) (AccountDeploysResult, error)
- func (e EventService) GetBlockByHash(blockHash string) (BlockResult, error)
- func (e EventService) GetBlocks(page int, count int) (BlocksResult, error)
- func (e EventService) GetDeployByHash(deployHash string) (DeployResult, error)
- func (e EventService) GetResponseData(endpoint string) ([]byte, error)
- func (e EventService) GetTransfersByAccountHash(accountHash string) ([]TransferResult, error)
- type ExecutableDeployItem
- func NewModuleBytes(moduleBytes []byte, args RuntimeArgs) *ExecutableDeployItem
- func NewStoredContractByHash(hash [32]byte, entryPoint string, args RuntimeArgs) *ExecutableDeployItem
- func NewStoredContractByName(name, entryPoint string, args RuntimeArgs) *ExecutableDeployItem
- func NewStoredVersionedContractByHash(hash [32]byte, version uint32, entryPoint string, args RuntimeArgs) *ExecutableDeployItem
- func NewStoredVersionedContractByHashWithoutVersion(hash [32]byte, entryPoint string, args RuntimeArgs) *ExecutableDeployItem
- func NewStoredVersionedContractByName(name string, version uint32, entryPoint string, args RuntimeArgs) *ExecutableDeployItem
- func NewStoredVersionedContractByNameWithoutVersion(name string, entryPoint string, args RuntimeArgs) *ExecutableDeployItem
- func NewTransfer(amount *big.Int, target *keypair.PublicKey, sourcePurse string, id uint64) *ExecutableDeployItem
- func NewTransferWithoutId(amount *big.Int, target *keypair.PublicKey, sourcePurse string) *ExecutableDeployItem
- func StandardPayment(amount *big.Int) *ExecutableDeployItem
- func (e ExecutableDeployItem) ArmForSwitch(sw byte) (string, bool)
- func (e *ExecutableDeployItem) IsModuleBytes() bool
- func (e *ExecutableDeployItem) IsStoredContractByHash() bool
- func (e *ExecutableDeployItem) IsStoredContractByName() bool
- func (e *ExecutableDeployItem) IsStoredVersionedContractByHash() bool
- func (e *ExecutableDeployItem) IsStoredVersionedContractByName() bool
- func (e *ExecutableDeployItem) IsTransfer() bool
- func (e ExecutableDeployItem) MarshalJSON() ([]byte, error)
- func (e *ExecutableDeployItem) SetArg(key string, value types.CLValue) error
- func (e ExecutableDeployItem) SwitchFieldName() string
- func (e *ExecutableDeployItem) ToBytes() []byte
- func (e *ExecutableDeployItem) UnmarshalJSON(data []byte) error
- type ExecutableDeployItemType
- type ExecutionResult
- type FaucetContract
- type Hash
- type JsonAccount
- type JsonApproval
- type JsonCLValue
- type JsonContractMetadata
- type JsonDeploy
- type JsonDeployHeader
- type JsonDeployInfo
- type JsonExecutionResult
- type JsonPutDeployRes
- type ModuleBytes
- type NamedKey
- type Page
- type Peer
- type PeerResult
- type Proof
- type RpcClient
- func (c *RpcClient) GetAccountBalance(stateRootHash, balanceUref string) (big.Int, error)
- func (c *RpcClient) GetAccountBalanceByKeypair(stateRootHash string, key keypair.KeyPair) (big.Int, error)
- func (c *RpcClient) GetAccountMainPurseURef(accountHash string) string
- func (c *RpcClient) GetBlockByHash(hash string) (BlockResponse, error)
- func (c *RpcClient) GetBlockByHeight(height uint64) (BlockResponse, error)
- func (c *RpcClient) GetBlockTransfersByHash(blockHash string) ([]TransferResponse, error)
- func (c *RpcClient) GetBlockTransfersByHeight(height uint64) ([]TransferResponse, error)
- func (c *RpcClient) GetDeploy(hash string) (DeployResult, error)
- func (c *RpcClient) GetLatestBlock() (BlockResponse, error)
- func (c *RpcClient) GetLatestBlockTransfers() ([]TransferResponse, error)
- func (c *RpcClient) GetPeers() (PeerResult, error)
- func (c *RpcClient) GetStateItem(stateRootHash, key string, path []string) (StoredValue, error)
- func (c *RpcClient) GetStateRootHash(stateRootHash string) (StateRootHashResult, error)
- func (c *RpcClient) GetStatus() (StatusResult, error)
- func (c *RpcClient) GetValidator() (ValidatorPesponse, error)
- func (c *RpcClient) PutDeploy(deploy Deploy) (JsonPutDeployRes, error)
- type RpcError
- type RpcRequest
- type RpcResponse
- type RuntimeArgs
- type StateRootHashResult
- type StatusResult
- type StoredContractByHash
- type StoredContractByName
- type StoredValue
- type StoredVersionedContractByHash
- type StoredVersionedContractByName
- type SuccessExecutionResult
- type Timestamp
- type Transfer
- type TransferContract
- type TransferResponse
- type TransferResult
- type UniqAddress
- type ValidatorPesponse
- type ValidatorWeight
- type Value
- type ValueMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SerializeBody ¶
func SerializeBody(payment *ExecutableDeployItem, session *ExecutableDeployItem) []byte
func SerializeHeader ¶
func SerializeHeader(deployHeader *DeployHeader) []byte
Types ¶
type AccountDeploy ¶
type AccountDeploysResult ¶
type AccountDeploysResult struct {
Data []AccountDeploy `json:"data"`
PageCount int `json:"page_count"`
ItemCount int `json:"item_count"`
Pages []Page `json:"pages"`
}
type ActionThresholds ¶
type AssociatedKey ¶
type AuctionState ¶
type AuctionState struct {
StateRootHash string `json:"state_root_hash"`
BlockHeight uint64 `json:"block_height"`
EraValidators []EraValidators `json:"era_validators"`
}
type BlockHeader ¶
type BlockHeader struct {
ParentHash string `json:"parent_hash"`
StateRootHash string `json:"state_root_hash"`
BodyHash string `json:"body_hash"`
RandomBit bool `json:"random_bit"`
AccumulatedSeed string `json:"accumulated_seed"`
Timestamp time.Time `json:"timestamp"`
EraID int `json:"era_id"`
Height int `json:"height"`
ProtocolVersion string `json:"protocol_version"`
}
type BlockResponse ¶
type BlockResponse struct {
Hash string `json:"hash"`
Header BlockHeader `json:"header"`
Body BlockBody `json:"body"`
Proofs []Proof `json:"proofs"`
}
type BlockResult ¶
type BlockResult struct {
BlockHash string `json:"block_hash"`
ParentHash string `json:"parent_hash"`
TimeStamp string `json:"time_stamp"`
Eraid int `json:"eraid"`
Proposer string `json:"proposer"`
State string `json:"state"`
DeployCount int `json:"deploy_count"`
Height uint64 `json:"height"`
Deploys []string `json:"deploys"`
}
type BlocksResult ¶
type BlocksResult struct {
Data []BlockResult `json:"data"`
PageCount int `json:"page_count"`
ItemCount int `json:"item_count"`
Pages []Page `json:"pages"`
}
type BoundContract ¶
func (BoundContract) Deploy ¶
func (b BoundContract) Deploy(args RuntimeArgs, paymentAmount big.Int, chainName string) *Deploy
type Contract ¶
func NewContract ¶
type Deploy ¶
type Deploy struct {
Hash Hash `json:"hash"`
Header *DeployHeader `json:"header"`
Payment *ExecutableDeployItem `json:"payment"`
Session *ExecutableDeployItem `json:"session"`
Approvals []Approval `json:"approvals"`
}
func MakeDeploy ¶
func MakeDeploy(deployParam *DeployParams, payment *ExecutableDeployItem, session *ExecutableDeployItem) *Deploy
func NewDeploy ¶
func NewDeploy(hash []byte, header *DeployHeader, payment *ExecutableDeployItem, sessions *ExecutableDeployItem, approvals []Approval) *Deploy
func (*Deploy) AddArgToDeploy ¶
func (*Deploy) IsStandardPayment ¶
func (*Deploy) IsTransfer ¶
func (*Deploy) SignDeploy ¶
func (*Deploy) ValidateDeploy ¶
type DeployHash ¶
type DeployHeader ¶
type DeployHeader struct {
Account keypair.PublicKey `json:"account"`
Timestamp Timestamp `json:"timestamp"`
TTL Duration `json:"ttl"`
GasPrice uint64 `json:"gas_price"`
BodyHash Hash `json:"body_hash"`
Dependencies [][]byte `json:"dependencies"`
ChainName string `json:"chain_name"`
}
func NewDeployHeader ¶
func (DeployHeader) ToBytes ¶
func (d DeployHeader) ToBytes() []uint8
type DeployParams ¶
type DeployParams struct {
AccountPublicKey keypair.PublicKey
ChainName string
GasPrice uint64
Ttl int64
Dependencies [][]uint8
Timestamp int64
}
func NewDeployParams ¶
type DeployResult ¶
type DeployResult struct {
Deploy JsonDeploy `json:"deploy"`
ExecutionResults []JsonExecutionResult `json:"execution_results"`
}
type EraValidators ¶
type EraValidators struct {
EraId int `json:"era_id"`
ValidatorWeights []ValidatorWeight `json:"validator_weights"`
}
type EventService ¶
type EventService struct {
Url string
}
func NewEventService ¶
func NewEventService(url string) *EventService
func (EventService) GetAccountDeploy ¶
func (e EventService) GetAccountDeploy(accountHex string, page int, limit int) (AccountDeploysResult, error)
func (EventService) GetBlockByHash ¶
func (e EventService) GetBlockByHash(blockHash string) (BlockResult, error)
func (EventService) GetBlocks ¶
func (e EventService) GetBlocks(page int, count int) (BlocksResult, error)
func (EventService) GetDeployByHash ¶
func (e EventService) GetDeployByHash(deployHash string) (DeployResult, error)
func (EventService) GetResponseData ¶
func (e EventService) GetResponseData(endpoint string) ([]byte, error)
func (EventService) GetTransfersByAccountHash ¶
func (e EventService) GetTransfersByAccountHash(accountHash string) ([]TransferResult, error)
type ExecutableDeployItem ¶
type ExecutableDeployItem struct {
Type ExecutableDeployItemType
ModuleBytes *ModuleBytes
StoredContractByHash *StoredContractByHash
StoredContractByName *StoredContractByName
StoredVersionedContractByHash *StoredVersionedContractByHash
StoredVersionedContractByName *StoredVersionedContractByName
Transfer *Transfer
}
func NewModuleBytes ¶
func NewModuleBytes(moduleBytes []byte, args RuntimeArgs) *ExecutableDeployItem
func NewStoredContractByHash ¶
func NewStoredContractByHash(hash [32]byte, entryPoint string, args RuntimeArgs) *ExecutableDeployItem
func NewStoredContractByName ¶
func NewStoredContractByName(name, entryPoint string, args RuntimeArgs) *ExecutableDeployItem
func NewStoredVersionedContractByHash ¶
func NewStoredVersionedContractByHash(hash [32]byte, version uint32, entryPoint string, args RuntimeArgs) *ExecutableDeployItem
func NewStoredVersionedContractByHashWithoutVersion ¶
func NewStoredVersionedContractByHashWithoutVersion(hash [32]byte, entryPoint string, args RuntimeArgs) *ExecutableDeployItem
func NewStoredVersionedContractByName ¶
func NewStoredVersionedContractByName(name string, version uint32, entryPoint string, args RuntimeArgs) *ExecutableDeployItem
func NewStoredVersionedContractByNameWithoutVersion ¶
func NewStoredVersionedContractByNameWithoutVersion(name string, entryPoint string, args RuntimeArgs) *ExecutableDeployItem
func NewTransfer ¶
func NewTransferWithoutId ¶
func StandardPayment ¶
func StandardPayment(amount *big.Int) *ExecutableDeployItem
func (ExecutableDeployItem) ArmForSwitch ¶
func (e ExecutableDeployItem) ArmForSwitch(sw byte) (string, bool)
func (*ExecutableDeployItem) IsModuleBytes ¶
func (e *ExecutableDeployItem) IsModuleBytes() bool
func (*ExecutableDeployItem) IsStoredContractByHash ¶
func (e *ExecutableDeployItem) IsStoredContractByHash() bool
func (*ExecutableDeployItem) IsStoredContractByName ¶
func (e *ExecutableDeployItem) IsStoredContractByName() bool
func (*ExecutableDeployItem) IsStoredVersionedContractByHash ¶
func (e *ExecutableDeployItem) IsStoredVersionedContractByHash() bool
func (*ExecutableDeployItem) IsStoredVersionedContractByName ¶
func (e *ExecutableDeployItem) IsStoredVersionedContractByName() bool
func (*ExecutableDeployItem) IsTransfer ¶
func (e *ExecutableDeployItem) IsTransfer() bool
func (ExecutableDeployItem) MarshalJSON ¶
func (e ExecutableDeployItem) MarshalJSON() ([]byte, error)
func (*ExecutableDeployItem) SetArg ¶
func (e *ExecutableDeployItem) SetArg(key string, value types.CLValue) error
func (ExecutableDeployItem) SwitchFieldName ¶
func (e ExecutableDeployItem) SwitchFieldName() string
func (*ExecutableDeployItem) ToBytes ¶
func (e *ExecutableDeployItem) ToBytes() []byte
func (*ExecutableDeployItem) UnmarshalJSON ¶
func (e *ExecutableDeployItem) UnmarshalJSON(data []byte) error
type ExecutableDeployItemType ¶
type ExecutableDeployItemType byte
const ( ExecutableDeployItemTypeModuleBytes ExecutableDeployItemType = iota ExecutableDeployItemTypeStoredContractByHash ExecutableDeployItemTypeStoredContractByName ExecutableDeployItemTypeStoredVersionedContractByHash ExecutableDeployItemTypeStoredVersionedContractByName ExecutableDeployItemTypeTransfer )
type ExecutionResult ¶
type ExecutionResult struct {
Success SuccessExecutionResult `json:"success"`
ErrorMessage *string `json:"error_message,omitempty"`
}
type FaucetContract ¶
type FaucetContract struct{}
func (FaucetContract) MakeArgs ¶
func (f FaucetContract) MakeArgs(accountHash string) RuntimeArgs
type JsonAccount ¶
type JsonAccount struct {
AccountHash string `json:"account_hash"`
NamedKeys []NamedKey `json:"named_keys"`
MainPurse string `json:"main_purse"`
AssociatedKeys []AssociatedKey `json:"associated_keys"`
ActionThresholds ActionThresholds `json:"action_thresholds"`
}
type JsonApproval ¶
type JsonCLValue ¶
type JsonContractMetadata ¶
type JsonDeploy ¶
type JsonDeploy struct {
Hash string `json:"hash"`
Header JsonDeployHeader `json:"header"`
Approvals []JsonApproval `json:"approvals"`
}
type JsonDeployHeader ¶
type JsonDeployInfo ¶
type JsonExecutionResult ¶
type JsonExecutionResult struct {
BlockHash string `json:"block_hash"`
Result ExecutionResult `json:"result"`
}
type JsonPutDeployRes ¶
type JsonPutDeployRes struct {
Hash string `json:"deploy_hash"`
}
type ModuleBytes ¶
type ModuleBytes struct {
Tag ExecutableDeployItemType
ModuleBytes []byte
Args RuntimeArgs
}
func (ModuleBytes) MarshalJSON ¶
func (m ModuleBytes) MarshalJSON() ([]byte, error)
func (ModuleBytes) ToBytes ¶
func (m ModuleBytes) ToBytes() []byte
func (*ModuleBytes) UnmarshalModuleBytes ¶
func (m *ModuleBytes) UnmarshalModuleBytes(tempMap map[string]interface{}) error
type PeerResult ¶
type PeerResult struct {
Peers []Peer `json:"peers"`
}
type RpcClient ¶
type RpcClient struct {
// contains filtered or unexported fields
}
func NewRpcClient ¶
func (*RpcClient) GetAccountBalance ¶
func (*RpcClient) GetAccountBalanceByKeypair ¶
func (*RpcClient) GetAccountMainPurseURef ¶
func (*RpcClient) GetBlockByHash ¶
func (c *RpcClient) GetBlockByHash(hash string) (BlockResponse, error)
func (*RpcClient) GetBlockByHeight ¶
func (c *RpcClient) GetBlockByHeight(height uint64) (BlockResponse, error)
func (*RpcClient) GetBlockTransfersByHash ¶
func (c *RpcClient) GetBlockTransfersByHash(blockHash string) ([]TransferResponse, error)
func (*RpcClient) GetBlockTransfersByHeight ¶
func (c *RpcClient) GetBlockTransfersByHeight(height uint64) ([]TransferResponse, error)
func (*RpcClient) GetLatestBlock ¶
func (c *RpcClient) GetLatestBlock() (BlockResponse, error)
func (*RpcClient) GetLatestBlockTransfers ¶
func (c *RpcClient) GetLatestBlockTransfers() ([]TransferResponse, error)
func (*RpcClient) GetPeers ¶
func (c *RpcClient) GetPeers() (PeerResult, error)
func (*RpcClient) GetStateItem ¶
func (c *RpcClient) GetStateItem(stateRootHash, key string, path []string) (StoredValue, error)
func (*RpcClient) GetStateRootHash ¶
func (c *RpcClient) GetStateRootHash(stateRootHash string) (StateRootHashResult, error)
func (*RpcClient) GetStatus ¶
func (c *RpcClient) GetStatus() (StatusResult, error)
func (*RpcClient) GetValidator ¶
func (c *RpcClient) GetValidator() (ValidatorPesponse, error)
type RpcRequest ¶
type RpcResponse ¶
type RpcResponse struct {
Version string `json:"jsonrpc"`
Id string `json:"id"`
Result json.RawMessage `json:"result"`
Error *RpcError `json:"error,omitempty"`
}
type RuntimeArgs ¶
func NewRunTimeArgs ¶
func NewRunTimeArgs(args map[string]Value, keyOrder []string) *RuntimeArgs
func ParseRuntimeArgs ¶
func ParseRuntimeArgs(args []interface{}) (RuntimeArgs, error)
func (RuntimeArgs) FromMap ¶
func (r RuntimeArgs) FromMap(args map[string]Value, keyOrder []string) *RuntimeArgs
func (RuntimeArgs) Insert ¶
func (r RuntimeArgs) Insert(key string, value Value)
func (RuntimeArgs) ToBytes ¶
func (r RuntimeArgs) ToBytes() []byte
func (RuntimeArgs) ToJSONInterface ¶
func (r RuntimeArgs) ToJSONInterface() []interface{}
runtime args in deploy are encoded as an array of pairs "key" : "value"
type StateRootHashResult ¶
type StateRootHashResult struct {
StateRootHash string `json:"state_root_hash"`
}
type StatusResult ¶
type StatusResult struct {
LastAddedBlock BlockResponse `json:"last_added_block"`
BuildVersion string `json:"build_version"`
}
type StoredContractByHash ¶
type StoredContractByHash struct {
Tag ExecutableDeployItemType
Hash [32]byte
Entrypoint string
Args RuntimeArgs
}
func (StoredContractByHash) MarshalJSON ¶
func (s StoredContractByHash) MarshalJSON() ([]byte, error)
func (StoredContractByHash) ToBytes ¶
func (s StoredContractByHash) ToBytes() []byte
func (*StoredContractByHash) UnmarshalStoredContractByHash ¶
func (s *StoredContractByHash) UnmarshalStoredContractByHash(tempMap map[string]interface{}) error
type StoredContractByName ¶
type StoredContractByName struct {
Tag ExecutableDeployItemType
Name string
Entrypoint string
Args RuntimeArgs
}
func (StoredContractByName) MarshalJSON ¶
func (s StoredContractByName) MarshalJSON() ([]byte, error)
func (StoredContractByName) ToBytes ¶
func (s StoredContractByName) ToBytes() []byte
func (*StoredContractByName) UnmarshalStoredContractByName ¶
func (s *StoredContractByName) UnmarshalStoredContractByName(tempMap map[string]interface{}) error
type StoredValue ¶
type StoredValue struct {
CLValue *JsonCLValue `json:"CLValue,omitempty"`
Account *JsonAccount `json:"Account,omitempty"`
Contract *JsonContractMetadata `json:"Contract,omitempty"`
ContractWASM *string `json:"ContractWASM,omitempty"`
ContractPackage *string `json:"ContractPackage,omitempty"`
Transfer *TransferResponse `json:"Transfer,omitempty"`
DeployInfo *JsonDeployInfo `json:"DeployInfo,omitempty"`
}
type StoredVersionedContractByHash ¶
type StoredVersionedContractByHash struct {
Tag ExecutableDeployItemType
Hash [32]byte
Version *types.CLValue
Entrypoint string
Args RuntimeArgs
}
func (StoredVersionedContractByHash) MarshalJSON ¶
func (s StoredVersionedContractByHash) MarshalJSON() ([]byte, error)
func (StoredVersionedContractByHash) ToBytes ¶
func (s StoredVersionedContractByHash) ToBytes() []byte
func (*StoredVersionedContractByHash) UnmarshalStoredVersionedContractByHash ¶
func (s *StoredVersionedContractByHash) UnmarshalStoredVersionedContractByHash(tempMap map[string]interface{}) error
type StoredVersionedContractByName ¶
type StoredVersionedContractByName struct {
Tag ExecutableDeployItemType
Name string
Version *types.CLValue
Entrypoint string
Args RuntimeArgs
}
func (StoredVersionedContractByName) MarshalJSON ¶
func (s StoredVersionedContractByName) MarshalJSON() ([]byte, error)
func (StoredVersionedContractByName) ToBytes ¶
func (s StoredVersionedContractByName) ToBytes() []byte
func (*StoredVersionedContractByName) UnmarshalStoredVersionedContractByName ¶
func (s *StoredVersionedContractByName) UnmarshalStoredVersionedContractByName(tempMap map[string]interface{}) error
type SuccessExecutionResult ¶
type Timestamp ¶
type Timestamp int64
func (Timestamp) MarshalJSON ¶
func (*Timestamp) UnmarshalJSON ¶
type Transfer ¶
type Transfer struct {
Tag ExecutableDeployItemType
Args RuntimeArgs
}
func (Transfer) MarshalJSON ¶
func (*Transfer) UnmarshalTransfer ¶
type TransferContract ¶
type TransferContract struct{}
func (TransferContract) MakeArgs ¶
func (t TransferContract) MakeArgs(accountHash string, amount big.Int) RuntimeArgs
type TransferResponse ¶
type TransferResult ¶
type UniqAddress ¶
type ValidatorPesponse ¶
type ValidatorPesponse struct {
Version string `json:"jsonrpc"`
AuctionState `json:"auction_state"`
}
type ValidatorWeight ¶
Click to show internal directories.
Click to hide internal directories.