Documentation ¶
Index ¶
- func CreateBridge(token string, params map[string]interface{}) (int, interface{}, error)
- func DeleteConnector(token, connectorID string) error
- func GetAccountBalance(token, accountID, tokenID string, params map[string]interface{}) (int, interface{}, error)
- func GetBridgeDetails(token, bridgeID string, params map[string]interface{}) (int, interface{}, error)
- func ListBridges(token string, params map[string]interface{}) (int, interface{}, error)
- func ListNetworkBlocks(token, networkID string, params map[string]interface{}) (int, interface{}, error)
- func ListNetworkBridges(token, networkID string, params map[string]interface{}) (int, interface{}, error)
- func UpdateNetwork(token, networkID string, params map[string]interface{}) error
- type Account
- func CreateAccount(token string, params map[string]interface{}) (*Account, error)
- func GetAccountDetails(token, accountID string, params map[string]interface{}) (*Account, error)
- func ListAccounts(token string, params map[string]interface{}) ([]*Account, error)
- func ListNetworkAccounts(token, networkID string, params map[string]interface{}) ([]*Account, error)
- func ListWalletAccounts(token, walletID string, params map[string]interface{}) ([]*Account, error)
- type CompiledArtifact
- type Connector
- func CreateConnector(token string, params map[string]interface{}) (*Connector, error)
- func GetConnectorDetails(token, connectorID string, params map[string]interface{}) (*Connector, error)
- func ListConnectors(token string, params map[string]interface{}) ([]*Connector, error)
- func ListNetworkConnectors(token, networkID string, params map[string]interface{}) ([]*Connector, error)
- type ConnectorDetails
- type Contract
- func CreateContract(token string, params map[string]interface{}) (*Contract, error)
- func CreatePublicContract(token string, params map[string]interface{}) (*Contract, error)
- func GetContractDetails(token, contractID string, params map[string]interface{}) (*Contract, error)
- func GetNetworkContractDetails(token, networkID, contractID string, params map[string]interface{}) (*Contract, error)
- func ListContracts(token string, params map[string]interface{}) ([]*Contract, error)
- func ListNetworkContracts(token, networkID string, params map[string]interface{}) ([]*Contract, error)
- type ContractExecutionResponse
- type EthereumJsonRpcResponse
- type EthereumJsonRpcResponseError
- type EthereumTxTraceResponse
- type EthereumWebsocketSubscriptionResponse
- type Network
- type NetworkStatus
- type Oracle
- func CreateOracle(token string, params map[string]interface{}) (*Oracle, error)
- func GetOracleDetails(token, oracleID string, params map[string]interface{}) (*Oracle, error)
- func ListNetworkOracles(token, networkID string, params map[string]interface{}) ([]*Oracle, error)
- func ListOracles(token string, params map[string]interface{}) ([]*Oracle, error)
- type Service
- type Token
- func CreateTokenContract(token string, params map[string]interface{}) (*Token, error)
- func GetTokenContractDetails(token, tokenID string, params map[string]interface{}) (*Token, error)
- func ListNetworkTokens(token, networkID string, params map[string]interface{}) ([]*Token, error)
- func ListTokenContracts(token string, params map[string]interface{}) ([]*Token, error)
- type Transaction
- func CreateTransaction(token string, params map[string]interface{}) (*Transaction, error)
- func GetNetworkTransactionDetails(token, networkID, txID string, params map[string]interface{}) (*Transaction, error)
- func GetTransactionDetails(token, txID string, params map[string]interface{}) (*Transaction, error)
- func ListNetworkTransactions(token, networkID string, params map[string]interface{}) ([]*Transaction, error)
- func ListTransactions(token string, params map[string]interface{}) ([]*Transaction, error)
- type TxReceipt
- type TxTrace
- type TxValue
- type Wallet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateBridge ¶
CreateBridge
func GetAccountBalance ¶
func GetAccountBalance(token, accountID, tokenID string, params map[string]interface{}) (int, interface{}, error)
GetAccountBalance
func GetBridgeDetails ¶
func GetBridgeDetails(token, bridgeID string, params map[string]interface{}) (int, interface{}, error)
GetBridgeDetails
func ListBridges ¶
ListBridges
func ListNetworkBlocks ¶
func ListNetworkBlocks(token, networkID string, params map[string]interface{}) (int, interface{}, error)
ListNetworkBlocks
func ListNetworkBridges ¶
func ListNetworkBridges(token, networkID string, params map[string]interface{}) (int, interface{}, error)
ListNetworkBridges
func UpdateNetwork ¶
UpdateNetwork updates an existing network
Types ¶
type Account ¶
type Account struct { api.Model NetworkID *uuid.UUID `json:"network_id,omitempty"` WalletID *uuid.UUID `json:"wallet_id,omitempty"` ApplicationID *uuid.UUID `json:"application_id,omitempty"` UserID *uuid.UUID `json:"user_id,omitempty"` OrganizationID *uuid.UUID `json:"organization_id,omitempty"` VaultID *uuid.UUID `json:"vault_id,omitempty"` KeyID *uuid.UUID `json:"key_id,omitempty"` Type *string `json:"type,omitempty"` HDDerivationPath *string `json:"hd_derivation_path,omitempty"` // i.e. m/44'/60'/0'/0 PublicKey *string `json:"public_key,omitempty"` PrivateKey *string `json:"private_key,omitempty"` Address string `json:"address"` Balance *big.Int `json:"balance,omitempty"` AccessedAt *time.Time `json:"accessed_at,omitempty"` }
Account contains the specific account user details
func CreateAccount ¶
CreateAccount creates a new account
func GetAccountDetails ¶
GetAccountDetails
func ListAccounts ¶
ListAccounts
type CompiledArtifact ¶
type CompiledArtifact struct { Name string `json:"name"` ABI []interface{} `json:"abi"` Assembly interface{} `json:"assembly,omitempty"` Bytecode string `json:"bytecode"` Deps []interface{} `json:"deps,omitempty"` Opcodes string `json:"opcodes,omitempty"` Raw json.RawMessage `json:"raw"` Source *string `json:"source"` Fingerprint *string `json:"fingerprint"` }
CompiledArtifact represents compiled sourcecode
type Connector ¶
type Connector struct { api.Model ApplicationID *uuid.UUID `json:"application_id"` NetworkID uuid.UUID `json:"network_id"` OrganizationID *uuid.UUID `json:"organization_id"` Name *string `json:"name"` Type *string `json:"type"` Status *string `json:"status"` Description *string `json:"description"` Config *json.RawMessage `json:"config,omitempty"` IsVirtual bool `json:"is_virtual,omitempty"` AccessedAt *time.Time `json:"accessed_at,omitempty"` Details *ConnectorDetails `json:"details,omitempty"` }
Connector instances represent a logical connection to IPFS or other decentralized filesystem; in the future it may represent a logical connection to services of other types
func CreateConnector ¶
CreateConnector
func GetConnectorDetails ¶
func GetConnectorDetails(token, connectorID string, params map[string]interface{}) (*Connector, error)
GetConnectorDetails
func ListConnectors ¶
ListConnectors
type ConnectorDetails ¶
type ConnectorDetails struct { Page *int64 `json:"page,omitempty"` RPP *int64 `json:"rpp,omitempty"` Data interface{} `json:"data,omitempty"` }
ConnectorDetails is a generic representation for a type-specific enrichment of a described connector; the details object may have complexity of its own, such as paginated subresults
type Contract ¶
type Contract struct { api.Model ApplicationID *uuid.UUID `json:"application_id"` NetworkID uuid.UUID `json:"network_id"` ContractID *uuid.UUID `json:"contract_id"` // id of the contract which created the contract (or null) TransactionID *uuid.UUID `json:"transaction_id"` // id of the transaction which deployed the contract (or null) Name *string `json:"name"` Address *string `json:"address"` Type *string `json:"type"` Params *json.RawMessage `json:"params,omitempty"` AccessedAt *time.Time `json:"accessed_at"` PubsubPrefix *string `json:"pubsub_prefix,omitempty"` }
Contract instances must be associated with an application identifier.
func CreateContract ¶
CreateContract
func CreatePublicContract ¶
CreatePublicContract loads an already deployed contract into nchain for arbitrary transaction execution this can be used for org registries, erc20 etc.
func GetContractDetails ¶
GetContractDetails
func GetNetworkContractDetails ¶
func GetNetworkContractDetails(token, networkID, contractID string, params map[string]interface{}) (*Contract, error)
GetNetworkContractDetails
func ListContracts ¶
ListContracts
type ContractExecutionResponse ¶
type ContractExecutionResponse struct { Confidence float64 `json:"confidence"` Reference *string `json:"ref"` Response interface{} `json:"response,omitempty"` }
ContractExecutionResponse is a response from the contract execution call
func ExecuteContract ¶
func ExecuteContract(token, contractID string, params map[string]interface{}) (*ContractExecutionResponse, error)
ExecuteContract
type EthereumJsonRpcResponse ¶
type EthereumJsonRpcResponse struct { ID interface{} `json:"id"` Result interface{} `json:"result"` Error *EthereumJsonRpcResponseError `json:"error,omitempty"` }
EthereumJsonRpcResponse is a generic handler for ethereum JSON-RPC responses
type EthereumJsonRpcResponseError ¶
type EthereumJsonRpcResponseError struct { Code int `json:"code"` Message string `json:"message"` Data interface{} `json:"data,omitempty"` }
EthereumJsonRpcResponseError is a generic error representation for ethereum JSON-RPC responses
type EthereumTxTraceResponse ¶
type EthereumTxTraceResponse struct { Result []struct { Action struct { CallType *string `json:"callType"` From *string `json:"from"` Gas *string `json:"gas"` Init *string `json:"init"` Input *string `json:"input"` To *string `json:"to"` Value *string `json:"value"` } `json:"action"` BlockHash *string `json:"blockHash"` BlockNumber int `json:"blockNumber"` Result struct { Address *string `json:"address"` Code *string `json:"code"` GasUsed *string `json:"gasUsed"` Output *string `json:"output"` } `json:"result"` Error *string `json:"error"` Subtraces int `json:"subtraces"` TraceAddress []interface{} `json:"traceAddress"` TransactionHash *string `json:"transactionHash"` TransactionPosition int `json:"transactionPosition"` Type *string `json:"type"` } `json:"result"` }
EthereumTxTraceResponse is returned upon successful contract execution
type EthereumWebsocketSubscriptionResponse ¶
type EthereumWebsocketSubscriptionResponse struct { ID interface{} `json:"id"` Params map[string]interface{} `json:"params"` }
EthereumWebsocketSubscriptionResponse is a generic handler for ethereum websocket subscription responses
type Network ¶
type Network struct { api.Model ApplicationID *uuid.UUID `json:"application_id,omitempty"` UserID *uuid.UUID `json:"user_id,omitempty"` Name *string `json:"name"` Description *string `json:"description"` Enabled *bool `json:"enabled"` ChainID *string `json:"chain_id"` // protocol-specific chain id NetworkID *uuid.UUID `json:"network_id,omitempty"` // network id used as the parent Config *json.RawMessage `json:"config,omitempty"` }
Network contains the specific Ethereum network details (mainnet, etc.)
func CreateNetwork ¶
CreateNetwork creates a new network
func GetNetworkDetails ¶
GetNetworkDetails returns the details for the specified network id
type NetworkStatus ¶
type NetworkStatus struct { Block uint64 `json:"block,omitempty"` // current block ChainID *string `json:"chain_id,omitempty"` // the chain id Height *uint64 `json:"height,omitempty"` // total height of the blockchain; null after syncing completed LastBlockAt *uint64 `json:"last_block_at,omitempty"` // unix timestamp of the last block; i.e., when the last block was collated PeerCount uint64 `json:"peer_count,omitempty"` // number of peers connected to the JSON-RPC client ProtocolVersion *string `json:"protocol_version,omitempty"` // protocol version State *string `json:"state,omitempty"` // i.e., syncing, synced, etc Syncing bool `json:"syncing,omitempty"` // when true, the network is in the process of syncing the ledger; available functionaltiy will be network-specific Meta map[string]interface{} `json:"meta,omitempty"` // network-specific metadata }
NetworkStatus provides network-agnostic status
func GetNetworkStatusMeta ¶
func GetNetworkStatusMeta(token, networkID string, params map[string]interface{}) (*NetworkStatus, error)
GetNetworkStatusMeta returns the status details for the specified network
type Oracle ¶
type Oracle struct { api.Model ApplicationID *uuid.UUID `json:"application_id"` NetworkID uuid.UUID `json:"network_id"` ContractID uuid.UUID `json:"contract_id"` Name *string `json:"name"` FeedURL *url.URL `json:"feed_url"` Params *json.RawMessage `json:"params"` AttachmentIds []*uuid.UUID `json:"attachment_ids"` }
Oracle instances are smart contracts whose terms are fulfilled writing data from a configured feed onto the blockchain
func CreateOracle ¶
CreateOracle
func GetOracleDetails ¶
GetOracleDetails
func ListNetworkOracles ¶
ListNetworkOracles
type Service ¶
Service for the nchain api
func InitNChainService ¶
InitNChainService convenience method to initialize an `nchain.Service` instance
type Token ¶
type Token struct { api.Model ApplicationID *uuid.UUID `json:"application_id"` NetworkID uuid.UUID `json:"network_id"` ContractID *uuid.UUID `json:"contract_id"` SaleContractID *uuid.UUID `json:"sale_contract_id"` Name *string `json:"name"` Symbol *string `json:"symbol"` Decimals uint64 `json:"decimals"` Address *string `json:"address"` // network-specific token contract address SaleAddress *string `json:"sale_address"` // non-null if token sale contract is specified AccessedAt *time.Time `json:"accessed_at"` }
Token contract
func CreateTokenContract ¶
CreateTokenContract
func GetTokenContractDetails ¶
GetTokenContractDetails
func ListNetworkTokens ¶
ListNetworkTokens
type Transaction ¶
type Transaction struct { api.Model NetworkID uuid.UUID `json:"network_id,omitempty"` // Application or user id, if populated, is the entity for which the transaction was custodially signed and broadcast ApplicationID *uuid.UUID `json:"application_id,omitempty"` UserID *uuid.UUID `json:"user_id,omitempty"` // Account or HD wallet which custodially signed the transaction; when an HD wallet is used, if no HD derivation path is provided, // the most recently derived non-zero account is used to sign AccountID *uuid.UUID `json:"account_id,omitempty"` WalletID *uuid.UUID `json:"wallet_id,omitempty"` Path *string `json:"hd_derivation_path,omitempty"` // Network-agnostic tx fields Signer *string `json:"signer,omitempty"` To *string `json:"to"` Value *TxValue `json:"value"` Data *string `json:"data"` Hash *string `json:"hash"` Status *string `json:"status"` Params *json.RawMessage `json:"params,omitempty"` Ref *string `json:"ref"` Description *string `json:"description"` // Ephemeral fields for managing the tx/rx and tracing lifecycles Traces interface{} `json:"traces,omitempty"` // Transaction metadata/instrumentation Block *uint64 `json:"block"` BlockTimestamp *time.Time `json:"block_timestamp,omitempty"` // timestamp when the tx was finalized on-chain, according to its tx receipt BroadcastAt *time.Time `json:"broadcast_at,omitempty"` // timestamp when the tx was broadcast to the network FinalizedAt *time.Time `json:"finalized_at,omitempty"` // timestamp when the tx was finalized on-platform PublishedAt *time.Time `json:"published_at,omitempty"` // timestamp when the tx was published to NATS cluster QueueLatency *uint64 `json:"queue_latency,omitempty"` // broadcast_at - published_at (in millis) -- the amount of time between when a message is enqueued to the NATS broker and when it is broadcast to the network NetworkLatency *uint64 `json:"network_latency,omitempty"` // finalized_at - broadcast_at (in millis) -- the amount of time between when a message is broadcast to the network and when it is finalized on-chain E2ELatency *uint64 `json:"e2e_latency,omitempty"` // finalized_at - published_at (in millis) -- the amount of time between when a message is published to the NATS broker and when it is finalized on-chain }
Transaction instances are associated with a signing wallet and exactly one matching instance of either an a) application identifier or b) user identifier.
func CreateTransaction ¶
func CreateTransaction(token string, params map[string]interface{}) (*Transaction, error)
CreateTransaction
func GetNetworkTransactionDetails ¶
func GetNetworkTransactionDetails(token, networkID, txID string, params map[string]interface{}) (*Transaction, error)
GetNetworkTransactionDetails
func GetTransactionDetails ¶
func GetTransactionDetails(token, txID string, params map[string]interface{}) (*Transaction, error)
GetTransactionDetails
func ListNetworkTransactions ¶
func ListNetworkTransactions(token, networkID string, params map[string]interface{}) ([]*Transaction, error)
ListNetworkTransactions
func ListTransactions ¶
func ListTransactions(token string, params map[string]interface{}) ([]*Transaction, error)
ListTransactions
type TxReceipt ¶
type TxReceipt struct { TxHash common.Hash `json:"hash"` ContractAddress common.Address `json:"contract_address"` GasUsed uint64 `json:"gas_used"` BlockHash common.Hash `json:"block_hash,omitempty"` BlockNumber *big.Int `json:"block,omitempty"` TransactionIndex uint `json:"transaction_index"` PostState []byte `json:"root"` Status uint64 `json:"status"` CumulativeGasUsed uint64 `json:"cumulative_gas_used"` Bloom interface{} `json:"logs_bloom"` Logs []interface{} `json:"logs"` }
TxReceipt is generalized transaction receipt model
type TxTrace ¶
type TxTrace struct { Result []struct { Action struct { CallType *string `json:"callType"` From *string `json:"from"` Gas *string `json:"gas"` Init *string `json:"init"` Input *string `json:"input"` To *string `json:"to"` Value *string `json:"value"` } `json:"action"` BlockHash *string `json:"blockHash"` BlockNumber int `json:"blockNumber"` Result struct { Address *string `json:"address"` Code *string `json:"code"` GasUsed *string `json:"gasUsed"` Output *string `json:"output"` } `json:"result"` Error *string `json:"error"` Subtraces int `json:"subtraces"` TraceAddress []interface{} `json:"traceAddress"` TransactionHash *string `json:"transactionHash"` TransactionPosition int `json:"transactionPosition"` Type *string `json:"type"` } `json:"result"` }
TxTrace is generalized transaction trace model
type TxValue ¶
type TxValue struct {
// contains filtered or unexported fields
}
TxValue provides JSON marshaling and gorm driver support for wrapping/unwrapping big.Int
func NewTxValue ¶
NewTxValue is a convenience method to return a TxValue
func (*TxValue) MarshalJSON ¶
MarshalJSON marshals the tx value to bytes
func (*TxValue) Scan ¶
Scan reads the persisted value using the gorm driver and marshals it into a TxValue
func (*TxValue) UnmarshalJSON ¶
UnmarshalJSON sets the tx value big.Int from its string representation
type Wallet ¶
type Wallet struct { api.Model WalletID *uuid.UUID `json:"wallet_id,omitempty"` ApplicationID *uuid.UUID `json:"application_id,omitempty"` UserID *uuid.UUID `json:"user_id,omitempty"` OrganizationID *uuid.UUID `json:"organization_id,omitempty"` VaultID *uuid.UUID `json:"vault_id,omitempty"` KeyID *uuid.UUID `json:"key_id,omitempty"` Path *string `json:"path,omitempty"` Purpose *int `json:"purpose,omitempty"` Mnemonic *string `json:"mnemonic,omitempty"` PublicKey *string `json:"public_key,omitempty"` PrivateKey *string `json:"private_key,omitempty"` }
Wallet contains the specific wallet details
func CreateWallet ¶
CreateWallet
func GetWalletDetails ¶
GetWalletDetails