Documentation ¶
Overview ¶
Package subi for substrate client
Package subi for substrate client
Index ¶
- type Contract
- type Manager
- type ManagerInterface
- type SubstrateExt
- type SubstrateImpl
- func (s *SubstrateImpl) BatchAllCreateContract(identity substrate.Identity, contractsData []substrate.BatchCreateContractData) ([]uint64, error)
- func (s *SubstrateImpl) BatchCancelContract(identity substrate.Identity, contracts []uint64) error
- func (s *SubstrateImpl) BatchCreateContract(identity substrate.Identity, contractsData []substrate.BatchCreateContractData) ([]uint64, *int, error)
- func (s *SubstrateImpl) CancelContract(identity substrate.Identity, contractID uint64) error
- func (s *SubstrateImpl) Close()
- func (s *SubstrateImpl) CreateNameContract(identity substrate.Identity, name string) (uint64, error)
- func (s *SubstrateImpl) CreateNodeContract(identity substrate.Identity, node uint32, body string, hash string, ...) (uint64, error)
- func (s *SubstrateImpl) DeleteInvalidContracts(contracts map[uint32]uint64) error
- func (s *SubstrateImpl) EnsureContractCanceled(identity substrate.Identity, contractID uint64) error
- func (s *SubstrateImpl) GetAccount(identity substrate.Identity) (substrate.AccountInfo, error)
- func (s *SubstrateImpl) GetBalance(identity substrate.Identity) (balance substrate.Balance, err error)
- func (s *SubstrateImpl) GetContract(contractID uint64) (Contract, error)
- func (s *SubstrateImpl) GetContractIDByNameRegistration(name string) (uint64, error)
- func (s *SubstrateImpl) GetNodeTwin(nodeID uint32) (uint32, error)
- func (s *SubstrateImpl) GetPricingPolicy(policyID uint32) (pricingPolicy substrate.PricingPolicy, err error)
- func (s *SubstrateImpl) GetTFTPrice() (balance types.U32, err error)
- func (s *SubstrateImpl) GetTwinPK(id uint32) ([]byte, error)
- func (s *SubstrateImpl) InvalidateNameContract(ctx context.Context, identity substrate.Identity, contractID uint64, ...) (uint64, error)
- func (s *SubstrateImpl) IsValidContract(contractID uint64) (bool, error)
- func (s *SubstrateImpl) UpdateNodeContract(identity substrate.Identity, contract uint64, body string, hash string) (uint64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Contract ¶
Contract is for contract implementation
func (*Contract) PublicIPCount ¶
PublicIPCount returns contract's public IPs count
type Manager ¶
Manager is substrate manager struct
func (*Manager) SubstrateExt ¶
func (m *Manager) SubstrateExt() (*SubstrateImpl, error)
SubstrateExt returns a substrate implementation to be used
type ManagerInterface ¶
type ManagerInterface interface { substrate.Manager SubstrateExt() (SubstrateImpl, error) }
ManagerInterface for substrate manager
type SubstrateExt ¶
type SubstrateExt interface { CancelContract(identity substrate.Identity, contractID uint64) error CreateNodeContract(identity substrate.Identity, node uint32, body string, hash string, publicIPs uint32, solutionProviderID *uint64) (uint64, error) UpdateNodeContract(identity substrate.Identity, contract uint64, body string, hash string) (uint64, error) Close() GetTwinByPubKey(pk []byte) (uint32, error) EnsureContractCanceled(identity substrate.Identity, contractID uint64) error DeleteInvalidContracts(contracts map[uint32]uint64) error IsValidContract(contractID uint64) (bool, error) InvalidateNameContract( ctx context.Context, identity substrate.Identity, contractID uint64, name string, ) (uint64, error) GetContract(id uint64) (Contract, error) GetNodeTwin(id uint32) (uint32, error) CreateNameContract(identity substrate.Identity, name string) (uint64, error) GetAccount(identity substrate.Identity) (substrate.AccountInfo, error) GetBalance(identity substrate.Identity) (balance substrate.Balance, err error) GetTFTPrice() (balance types.U32, err error) GetPricingPolicy(policyID uint32) (pricingPolicy substrate.PricingPolicy, err error) GetTwinPK(twinID uint32) ([]byte, error) GetContractIDByNameRegistration(name string) (uint64, error) BatchCreateContract(identity substrate.Identity, contractsData []substrate.BatchCreateContractData) ([]uint64, *int, error) BatchAllCreateContract(identity substrate.Identity, contractsData []substrate.BatchCreateContractData) ([]uint64, error) BatchCancelContract(identity substrate.Identity, contracts []uint64) error }
SubstrateExt interface for substrate client
type SubstrateImpl ¶
SubstrateImpl struct to use dev substrate
func (*SubstrateImpl) BatchAllCreateContract ¶
func (s *SubstrateImpl) BatchAllCreateContract(identity substrate.Identity, contractsData []substrate.BatchCreateContractData) ([]uint64, error)
BatchAllCreateContract creates a batch of contracts atomically
func (*SubstrateImpl) BatchCancelContract ¶
func (s *SubstrateImpl) BatchCancelContract(identity substrate.Identity, contracts []uint64) error
BatchCancelContract cancels a batch of contracts
func (*SubstrateImpl) BatchCreateContract ¶
func (s *SubstrateImpl) BatchCreateContract(identity substrate.Identity, contractsData []substrate.BatchCreateContractData) ([]uint64, *int, error)
BatchCreateContract creates a batch of contracts non-atomically
func (*SubstrateImpl) CancelContract ¶
func (s *SubstrateImpl) CancelContract(identity substrate.Identity, contractID uint64) error
CancelContract cancels a contract
func (*SubstrateImpl) CreateNameContract ¶
func (s *SubstrateImpl) CreateNameContract(identity substrate.Identity, name string) (uint64, error)
CreateNameContract creates a new name contract
func (*SubstrateImpl) CreateNodeContract ¶
func (s *SubstrateImpl) CreateNodeContract(identity substrate.Identity, node uint32, body string, hash string, publicIPs uint32, solutionProviderID *uint64) (uint64, error)
CreateNodeContract creates a new node contract
func (*SubstrateImpl) DeleteInvalidContracts ¶
func (s *SubstrateImpl) DeleteInvalidContracts(contracts map[uint32]uint64) error
DeleteInvalidContracts deletes invalid contracts
func (*SubstrateImpl) EnsureContractCanceled ¶
func (s *SubstrateImpl) EnsureContractCanceled(identity substrate.Identity, contractID uint64) error
EnsureContractCanceled ensures a canceled contract
func (*SubstrateImpl) GetAccount ¶
func (s *SubstrateImpl) GetAccount(identity substrate.Identity) (substrate.AccountInfo, error)
GetAccount returns the user's account
func (*SubstrateImpl) GetBalance ¶
func (s *SubstrateImpl) GetBalance(identity substrate.Identity) (balance substrate.Balance, err error)
GetBalance returns the user's balance
func (*SubstrateImpl) GetContract ¶
func (s *SubstrateImpl) GetContract(contractID uint64) (Contract, error)
GetContract returns a contract given its ID
func (*SubstrateImpl) GetContractIDByNameRegistration ¶
func (s *SubstrateImpl) GetContractIDByNameRegistration(name string) (uint64, error)
GetContractIDByNameRegistration returns contract ID using its name
func (*SubstrateImpl) GetNodeTwin ¶
func (s *SubstrateImpl) GetNodeTwin(nodeID uint32) (uint32, error)
GetNodeTwin returns the twin ID for a node ID
func (*SubstrateImpl) GetPricingPolicy ¶
func (s *SubstrateImpl) GetPricingPolicy(policyID uint32) (pricingPolicy substrate.PricingPolicy, err error)
GetPricingPolicy returns a pricing policy
func (*SubstrateImpl) GetTFTPrice ¶
func (s *SubstrateImpl) GetTFTPrice() (balance types.U32, err error)
GetTFTPrice returns the TFT's price
func (*SubstrateImpl) GetTwinPK ¶
func (s *SubstrateImpl) GetTwinPK(id uint32) ([]byte, error)
GetTwinPK returns twin's public key
func (*SubstrateImpl) InvalidateNameContract ¶
func (s *SubstrateImpl) InvalidateNameContract( ctx context.Context, identity substrate.Identity, contractID uint64, name string, ) (uint64, error)
InvalidateNameContract invalidate a name contract
func (*SubstrateImpl) IsValidContract ¶
func (s *SubstrateImpl) IsValidContract(contractID uint64) (bool, error)
IsValidContract checks if a contract is invalid
func (*SubstrateImpl) UpdateNodeContract ¶
func (s *SubstrateImpl) UpdateNodeContract(identity substrate.Identity, contract uint64, body string, hash string) (uint64, error)
UpdateNodeContract updates a new name contract