Documentation
¶
Index ¶
- Constants
- Variables
- func CloseLog()
- func ConvertToToken(value int64) float64
- func ConvertToValue(token float64) int64
- func CreateMSVote(proposal, grpClientID, signerWalletstr, toClientID string, token int64) (string, error)
- func CreateMSWallet(t, n int) (string, string, []string, error)
- func CreateWallet(statusCb WalletCallback) error
- func GetBalance(cb GetBalanceCallback) error
- func GetBalanceWallet(walletStr string, cb GetBalanceCallback) error
- func GetBlobbers(cb GetInfoCallback) error
- func GetChallengePoolStat(cb GetInfoCallback, allocID string) (err error)
- func GetClientID(pkey string) string
- func GetIdForUrl(url string) string
- func GetLockConfig(cb GetInfoCallback) error
- func GetLockedTokens(cb GetInfoCallback) error
- func GetMultisigPayload(mswstr string) (interface{}, error)
- func GetMultisigVotePayload(msvstr string) (interface{}, error)
- func GetReadPoolsStats(cb GetInfoCallback) (err error)
- func GetStakePoolStat(cb GetInfoCallback, blobberID string) (err error)
- func GetStorageSCConfig(cb GetInfoCallback) (err error)
- func GetUserPoolDetails(clientID, poolID string, cb GetInfoCallback) error
- func GetUserPools(cb GetInfoCallback) error
- func GetVersion() string
- func GetWallet(walletStr string) (*zcncrypto.Wallet, error)
- func GetWalletClientID(walletStr string) (string, error)
- func GetWritePoolStat(cb GetInfoCallback, allocID string) (err error)
- func GetZcnUSDInfo(cb GetUSDInfoCallback) error
- func Init(c string) error
- func InitZCNSDK(miners []string, sharders []string, signscheme string, ...) error
- func IsMnemonicValid(mnemonic string) bool
- func RecoverWallet(mnemonic string, statusCb WalletCallback) error
- func RegisterToMiners(wallet *zcncrypto.Wallet, statusCb WalletCallback) error
- func RegisterWallet(walletString string, cb WalletCallback)
- func SetAuthUrl(url string) error
- func SetLogFile(logFile string, verbose bool)
- func SetLogLevel(lvl int)
- func SetWalletInfo(w string, splitKeyWallet bool) error
- func SetupAuth(authHost, clientID, clientKey, publicKey, privateKey, localPublicKey string, ...) error
- func SplitKeys(privateKey string, numSplits int) (string, error)
- func VerifyContentHash(metaTxnDataJSON string) (bool, error)
- func WithChainID(id string) func(c *ChainConfig) error
- func WithConfirmationChainLength(m int) func(c *ChainConfig) error
- func WithMinConfirmation(m int) func(c *ChainConfig) error
- func WithMinSubmit(m int) func(c *ChainConfig) error
- type AuthCallback
- type ChainConfig
- type GetBalanceCallback
- type GetInfoCallback
- type GetUSDInfoCallback
- type MSTransfer
- type MSVote
- type MSVoteCallback
- type MSWallet
- type MultisigSCWallet
- type OnJSONInfoCb
- type Transaction
- func (t *Transaction) CreateReadPool() (err error)
- func (t *Transaction) DeleteStake(clientID, poolID string) error
- func (t *Transaction) ExecuteFaucetSCWallet(walletStr string, methodName string, input []byte) error
- func (t *Transaction) ExecuteSmartContract(address, methodName, jsoninput string, val int64) error
- func (t *Transaction) FinalizeAllocation(allocID string) (err error)
- func (t *Transaction) GetTransactionError() string
- func (t *Transaction) GetTransactionHash() string
- func (t *Transaction) GetVerifyError() string
- func (t *Transaction) GetVerifyOutput() string
- func (t *Transaction) LockTokens(val int64, durationHr int64, durationMin int) error
- func (t *Transaction) ReadPoolLock(val int64, dur time.Duration) (err error)
- func (t *Transaction) ReadPoolUnlock(poolID string) (err error)
- func (t *Transaction) RegisterMultiSig(walletstr string, mswallet string) error
- func (t *Transaction) RegisterVote(signerwalletstr string, msvstr string) error
- func (t *Transaction) Send(toClientID string, val int64, desc string) error
- func (t *Transaction) SendWithSignatureHash(toClientID string, val int64, desc string, sig string, CreationDate int64, ...) error
- func (t *Transaction) SetTransactionCallback(cb TransactionCallback) error
- func (t *Transaction) SetTransactionFee(txnFee int64) error
- func (t *Transaction) SetTransactionHash(hash string) error
- func (t *Transaction) Stake(clientID string, val int64) error
- func (t *Transaction) StakePoolUnlock() (err error)
- func (t *Transaction) StoreData(data string) error
- func (t *Transaction) UnlockTokens(poolID string) error
- func (t *Transaction) Verify() error
- func (t *Transaction) VestingAdd(ar *VestingAddRequest, value common.Balance) (err error)
- func (t *Transaction) VestingDelete(poolID common.Key) (err error)
- func (t *Transaction) VestingLock(poolID common.Key, value common.Balance) (err error)
- func (t *Transaction) VestingTrigger(poolID common.Key) (err error)
- func (t *Transaction) VestingUnlock(poolID common.Key) (err error)
- func (t *Transaction) VestingUpdateConfig(vscc *VestingSCConfig) (err error)
- func (t *Transaction) WritePoolLock(allocID string, val int64) (err error)
- type TransactionCallback
- type TransactionScheme
- type TransactionWithAuth
- func (ta *TransactionWithAuth) CreateReadPool() (err error)
- func (ta *TransactionWithAuth) DeleteStake(clientID, poolID string) error
- func (ta *TransactionWithAuth) ExecuteFaucetSCWallet(walletStr string, methodName string, input []byte) error
- func (ta *TransactionWithAuth) ExecuteSmartContract(address, methodName, jsoninput string, val int64) error
- func (ta *TransactionWithAuth) FinalizeAllocation(allocID string) (err error)
- func (ta *TransactionWithAuth) GetTransactionError() string
- func (ta *TransactionWithAuth) GetTransactionHash() string
- func (ta *TransactionWithAuth) GetVerifyError() string
- func (ta *TransactionWithAuth) GetVerifyOutput() string
- func (ta *TransactionWithAuth) LockTokens(val int64, durationHr int64, durationMin int) error
- func (ta *TransactionWithAuth) ReadPoolLock(val int64, dur time.Duration) (err error)
- func (ta *TransactionWithAuth) ReadPoolUnlock(poolID string) (err error)
- func (ta *TransactionWithAuth) RegisterMultiSig(walletstr string, mswallet string) error
- func (ta *TransactionWithAuth) Send(toClientID string, val int64, desc string) error
- func (ta *TransactionWithAuth) SetTransactionCallback(cb TransactionCallback) error
- func (ta *TransactionWithAuth) SetTransactionFee(txnFee int64) error
- func (ta *TransactionWithAuth) SetTransactionHash(hash string) error
- func (ta *TransactionWithAuth) Stake(clientID string, val int64) error
- func (ta *TransactionWithAuth) StakePoolUnlock() (err error)
- func (ta *TransactionWithAuth) StoreData(data string) error
- func (ta *TransactionWithAuth) UnlockTokens(poolID string) error
- func (ta *TransactionWithAuth) Verify() error
- func (ta *TransactionWithAuth) VestingAdd(ar *VestingAddRequest, value common.Balance) (err error)
- func (ta *TransactionWithAuth) VestingDelete(poolID common.Key) (err error)
- func (ta *TransactionWithAuth) VestingLock(poolID common.Key, value common.Balance) (err error)
- func (ta *TransactionWithAuth) VestingTrigger(poolID common.Key) (err error)
- func (ta *TransactionWithAuth) VestingUnlock(poolID common.Key) (err error)
- func (ta *TransactionWithAuth) VestingUpdateConfig(vscc *VestingSCConfig) (err error)
- func (ta *TransactionWithAuth) WritePoolLock(allocID string, val int64) (err error)
- type VestingAddRequest
- type VestingClientList
- type VestingPoolInfo
- type VestingSCConfig
- type WalletCallback
Constants ¶
const ( REGISTER_CLIENT = `/v1/client/put` PUT_TRANSACTION = `/v1/transaction/put` TXN_VERIFY_URL = `/v1/transaction/get/confirmation?hash=` GET_BALANCE = `/v1/client/get/balance?client_id=` GET_LOCK_CONFIG = `/v1/screst/` + InterestPoolSmartContractAddress + `/getLockConfig` GET_LOCKED_TOKENS = `/v1/screst/` + InterestPoolSmartContractAddress + `/getPoolsStats?client_id=` GET_BLOCK_INFO = `/v1/block/get?` GET_USER_POOLS = `/v1/screst/` + MinerSmartContractAddress + `/getUserPools?client_id=` GET_USER_POOL_DETAIL = `/v1/screst/` + MinerSmartContractAddress + `/getPoolsStats?` GET_VESTING_CONFIG = `/v1/screst/` + VestingSmartContractAddress + `/getConfig` GET_VESTING_POOL_INFO = `/v1/screst/` + VestingSmartContractAddress + `/getPoolInfo` GET_VESTING_CLIENT_POOLS = `/v1/screst/` + VestingSmartContractAddress + `/getClientPools` // TORM (sfxdx): remove from zwallet GET_BLOBBERS = `/v1/screst/` + StorageSmartContractAddress + `/getblobbers` GET_READ_POOL_STATS = `/v1/screst/` + StorageSmartContractAddress + `/getReadPoolsStats?client_id=` GET_WRITE_POOL_STAT = `/v1/screst/` + StorageSmartContractAddress + `/getWritePoolStat?allocation_id=` GET_STAKE_POOL_STAT = `/v1/screst/` + StorageSmartContractAddress + `/getStakePoolStat?blobber_id=` GET_CHALLENGE_POOL_STAT = `/v1/screst/` + StorageSmartContractAddress + `/getChallengePoolStat?allocation_id=` GET_STORAGE_SC_CONFIG = `/v1/screst/` + StorageSmartContractAddress + `/getConfig` )
const ( // TORM (sfxdx) remove from zwallet StorageSmartContractAddress = `6dba10422e368813802877a85039d3985d96760ed844092319743fb3a76712d7` VestingSmartContractAddress = `2bba5b05949ea59c80aed3ac3474d7379d3be737e8eb5a968c52295e48333ead` FaucetSmartContractAddress = `6dba10422e368813802877a85039d3985d96760ed844092319743fb3a76712d3` InterestPoolSmartContractAddress = `6dba10422e368813802877a85039d3985d96760ed844092319743fb3a76712d9` MultiSigSmartContractAddress = `27b5ef7120252b79f9dd9c05505dd28f328c80f6863ee446daede08a84d651a7` MinerSmartContractAddress = `6dba10422e368813802877a85039d3985d96760ed844092319743fb3a76712d1` MultiSigRegisterFuncName = "register" MultiSigVoteFuncName = "vote" )
const ( StatusSuccess int = 0 StatusNetworkError int = 1 // TODO: Change to specific error StatusError int = 2 StatusRejectedByUser int = 3 StatusInvalidSignature int = 4 StatusAuthError int = 5 StatusAuthVerifyFailed int = 6 StatusAuthTimeout int = 7 StatusUnknown int = -1 )
const ( OpGetTokenLockConfig int = iota OpGetLockedTokens OpGetUserPools OpGetUserPoolDetail OpGetBlobbers OpGetReadPoolsStats OpGetWritePoolStat OpGetStakePoolStat OpGetChallengePoolStat OpGetStorageSCConfig )
const TOKEN_UNIT = int64(10000000000)
Variables ¶
var Logger logger.Logger
Functions ¶
func ConvertToToken ¶
ConvertToToken converts the value to ZCN tokens
func ConvertToValue ¶
ConvertToValue converts ZCN tokens to value
func CreateMSVote ¶
func CreateMSVote(proposal, grpClientID, signerWalletstr, toClientID string, token int64) (string, error)
CreateMSVote create a vote for multisig
func CreateMSWallet ¶
CreateMSWallet returns multisig wallet information
func CreateWallet ¶
func CreateWallet(statusCb WalletCallback) error
CreateWallet creates the a wallet for the configure signature scheme. It also registers the wallet again to block chain.
func GetBalance ¶
func GetBalance(cb GetBalanceCallback) error
GetBalance retreives wallet balance from sharders
func GetBalanceWallet ¶
func GetBalanceWallet(walletStr string, cb GetBalanceCallback) error
GetBalance retreives wallet balance from sharders
func GetBlobbers ¶
func GetBlobbers(cb GetInfoCallback) error
func GetChallengePoolStat ¶ added in v1.0.38
func GetChallengePoolStat(cb GetInfoCallback, allocID string) (err error)
GetChallengePoolStat returns statistic of tokens in a challenge pool.
func GetClientID ¶
GetClientID -- computes Client ID from publickey
func GetIdForUrl ¶
func GetLockConfig ¶
func GetLockConfig(cb GetInfoCallback) error
GetLockConfig returns the lock token configuration information such as interest rate from blockchain
func GetLockedTokens ¶
func GetLockedTokens(cb GetInfoCallback) error
GetLockedTokens returns the ealier locked token pool stats
func GetMultisigPayload ¶
GetMultisigPayload given a multisig wallet as a string, makes a multisig wallet payload to register
func GetMultisigVotePayload ¶
GetMultisigVotePayload given a multisig vote as a string, makes a multisig vote payload to register
func GetReadPoolsStats ¶ added in v1.0.34
func GetReadPoolsStats(cb GetInfoCallback) (err error)
GetReadPoolsStats returns statistic of locked tokens in read pool.
func GetStakePoolStat ¶ added in v1.0.36
func GetStakePoolStat(cb GetInfoCallback, blobberID string) (err error)
GetStakePoolStat returns statistic of locked tokens in a stake pool.
func GetStorageSCConfig ¶
func GetStorageSCConfig(cb GetInfoCallback) (err error)
GetStorageSCConfig returns current configurations of storage SC.
func GetUserPoolDetails ¶ added in v1.0.11
func GetUserPoolDetails(clientID, poolID string, cb GetInfoCallback) error
func GetUserPools ¶ added in v1.0.11
func GetUserPools(cb GetInfoCallback) error
func GetWalletClientID ¶
GetWalletClientID -- given a walletstr return ClientID
func GetWritePoolStat ¶ added in v1.0.34
func GetWritePoolStat(cb GetInfoCallback, allocID string) (err error)
GetWritePoolStat returns statistic of locked tokens in a write pool.
func GetZcnUSDInfo ¶
func GetZcnUSDInfo(cb GetUSDInfoCallback) error
GetZcnUSDInfo returns USD value for ZCN token from coinmarketcap.com
func Init ¶
Init inializes the SDK with miner, sharder and signature scheme provided in configuration provided in JSON format
func InitZCNSDK ¶
func InitZCNSDK(miners []string, sharders []string, signscheme string, configs ...func(*ChainConfig) error) error
InitZCNSDK initializes the SDK with miner, sharder and signature scheme provided.
func IsMnemonicValid ¶
IsMnemonicValid is an utility function to check the mnemonic valid
func RecoverWallet ¶
func RecoverWallet(mnemonic string, statusCb WalletCallback) error
RecoverWallet recovers the previously generated wallet using the mnemonic. It also registers the wallet again to block chain.
func RegisterToMiners ¶
func RegisterToMiners(wallet *zcncrypto.Wallet, statusCb WalletCallback) error
RegisterToMiners can be used to register the wallet.
func RegisterWallet ¶
func RegisterWallet(walletString string, cb WalletCallback)
RegisterWallet registers multisig related wallets
func SetAuthUrl ¶
SetAuthUrl will be called by app to set zauth URL to SDK.
func SetLogFile ¶
SetLogFile - sets file path to write log verbose - true - console output; false - no console output
func SetLogLevel ¶
func SetLogLevel(lvl int)
SetLogLevel set the log level. lvl - 0 disabled; higher number (upto 4) more verbosity
func SetWalletInfo ¶
SetWalletInfo should be set before any transaction or client specific APIs splitKeyWallet parameter is valid only if SignatureScheme is "BLS0Chain"
func SetupAuth ¶
func SetupAuth(authHost, clientID, clientKey, publicKey, privateKey, localPublicKey string, cb AuthCallback) error
SetupAuth prepare auth app with clientid, key and a set of public, private key and local publickey which is running on PC/Mac.
func VerifyContentHash ¶
func WithChainID ¶
func WithChainID(id string) func(c *ChainConfig) error
func WithConfirmationChainLength ¶
func WithConfirmationChainLength(m int) func(c *ChainConfig) error
func WithMinConfirmation ¶
func WithMinConfirmation(m int) func(c *ChainConfig) error
func WithMinSubmit ¶
func WithMinSubmit(m int) func(c *ChainConfig) error
Types ¶
type AuthCallback ¶
type AuthCallback interface {
// This call back gives the status of the Two factor authenticator(zauth) setup.
OnSetupComplete(status int, err string)
}
AuthCallback needs to be implemented by the caller SetupAuth()
type ChainConfig ¶
type ChainConfig struct {
ChainID string `json:"chain_id,omitempty"`
Miners []string `json:"miners"`
Sharders []string `json:"sharders"`
SignatureScheme string `json:"signaturescheme"`
MinSubmit int `json:"min_submit"`
MinConfirmation int `json:"min_confirmation"`
ConfirmationChainLength int `json:"confirmation_chain_length"`
}
type GetBalanceCallback ¶
GetBalanceCallback needs to be implemented by the caller of GetBalance() to get the status
type GetInfoCallback ¶
type GetInfoCallback interface {
// OnInfoAvailable will be called when GetLockTokenConfig is complete
// if status == StatusSuccess then info is valid
// is status != StatusSuccess then err will give the reason
OnInfoAvailable(op int, status int, info string, err string)
}
GetInfoCallback needs to be implemented by the caller of GetLockTokenConfig() and GetLockedTokens()
type GetUSDInfoCallback ¶
type GetUSDInfoCallback interface {
// This will be called when GetZcnUSDInfo completes.
// if status == StatusSuccess then info is valid
// is status != StatusSuccess then err will give the reason
OnUSDInfoAvailable(status int, info string, err string)
}
GetUSDInfoCallback needs to be implemented by the caller of GetZcnUSDInfo()
type MSTransfer ¶
type MSTransfer struct {
ClientID string `json:"from"`
ToClientID string `json:"to"`
Amount int64 `json:"amount"`
}
MSTransfer - a data structure to hold state transfer from one client to another
type MSVote ¶
type MSVote struct {
ProposalID string `json:"proposal_id"`
// Client ID in transfer is that of the multi-sig wallet, not the signer.
Transfer MSTransfer `json:"transfer"`
Signature string `json:"signature"`
}
MSVote -- this should mimic the type Vote defined in MultiSig SC
type MSVoteCallback ¶
MSVoteCallback callback definition multisig Vote function
type MSWallet ¶
type MSWallet struct {
Id int `json:"id"`
SignatureScheme string `json:"signature_scheme"`
GroupClientID string `json:"group_client_id"`
GroupKey *zcncrypto.BLS0ChainScheme `json:"group_key"`
SignerClientIDs []string `json:"sig_client_ids"`
SignerKeys []zcncrypto.BLS0ChainThresholdScheme `json:"signer_keys"`
T int `json:"threshold"`
N int `json:"num_subkeys"`
}
MSWallet Client data necessary for a multi-sig wallet.
type MultisigSCWallet ¶
type MultisigSCWallet struct {
ClientID string `json:"client_id"`
SignatureScheme string `json:"signature_scheme"`
PublicKey string `json:"public_key"`
SignerThresholdIDs []string `json:"signer_threshold_ids"`
SignerPublicKeys []string `json:"signer_public_keys"`
NumRequired int `json:"num_required"`
}
MultisigSCWallet --this should mimic MultisigWallet definition in MultiSig SC
type OnJSONInfoCb ¶ added in v1.0.46
type OnJSONInfoCb struct {
// contains filtered or unexported fields
}
func NewJSONInfoCB ¶ added in v1.0.46
func NewJSONInfoCB(val interface{}) (cb *OnJSONInfoCb)
func (*OnJSONInfoCb) OnInfoAvailable ¶ added in v1.0.46
func (ojsonic *OnJSONInfoCb) OnInfoAvailable(op int, status int, info string, errMsg string)
func (*OnJSONInfoCb) Wait ¶ added in v1.0.46
func (ojsonic *OnJSONInfoCb) Wait() (err error)
Wait for info.
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
func NewMSTransaction ¶
func NewMSTransaction(walletstr string, cb TransactionCallback) (*Transaction, error)
NewMSTransaction new transaction object for multisig operation
func (*Transaction) CreateReadPool ¶
func (t *Transaction) CreateReadPool() (err error)
func (*Transaction) DeleteStake ¶ added in v1.0.11
func (t *Transaction) DeleteStake(clientID, poolID string) error
func (*Transaction) ExecuteFaucetSCWallet ¶
func (t *Transaction) ExecuteFaucetSCWallet(walletStr string, methodName string, input []byte) error
ExecuteFaucetSCWallet impements the Faucet Smart contract for a given wallet
func (*Transaction) ExecuteSmartContract ¶
func (t *Transaction) ExecuteSmartContract(address, methodName, jsoninput string, val int64) error
func (*Transaction) FinalizeAllocation ¶
func (t *Transaction) FinalizeAllocation(allocID string) (err error)
FinalizeAllocation performs all required to finalize an expired allocation.
func (*Transaction) GetTransactionError ¶
func (t *Transaction) GetTransactionError() string
func (*Transaction) GetTransactionHash ¶
func (t *Transaction) GetTransactionHash() string
func (*Transaction) GetVerifyError ¶
func (t *Transaction) GetVerifyError() string
func (*Transaction) GetVerifyOutput ¶
func (t *Transaction) GetVerifyOutput() string
func (*Transaction) LockTokens ¶
func (t *Transaction) LockTokens(val int64, durationHr int64, durationMin int) error
func (*Transaction) ReadPoolLock ¶
func (t *Transaction) ReadPoolLock(val int64, dur time.Duration) (err error)
func (*Transaction) ReadPoolUnlock ¶
func (t *Transaction) ReadPoolUnlock(poolID string) (err error)
func (*Transaction) RegisterMultiSig ¶
func (t *Transaction) RegisterMultiSig(walletstr string, mswallet string) error
RegisterMultiSig register a multisig wallet with the SC.
func (*Transaction) RegisterVote ¶
func (t *Transaction) RegisterVote(signerwalletstr string, msvstr string) error
RegisterVote register a multisig wallet with the SC.
func (*Transaction) Send ¶
func (t *Transaction) Send(toClientID string, val int64, desc string) error
func (*Transaction) SendWithSignatureHash ¶
func (*Transaction) SetTransactionCallback ¶
func (t *Transaction) SetTransactionCallback(cb TransactionCallback) error
func (*Transaction) SetTransactionFee ¶
func (t *Transaction) SetTransactionFee(txnFee int64) error
func (*Transaction) SetTransactionHash ¶
func (t *Transaction) SetTransactionHash(hash string) error
func (*Transaction) Stake ¶ added in v1.0.11
func (t *Transaction) Stake(clientID string, val int64) error
func (*Transaction) StakePoolUnlock ¶
func (t *Transaction) StakePoolUnlock() (err error)
StakePoolUnlock unlock expired tokens of the write pool.
func (*Transaction) StoreData ¶
func (t *Transaction) StoreData(data string) error
func (*Transaction) UnlockTokens ¶
func (t *Transaction) UnlockTokens(poolID string) error
func (*Transaction) Verify ¶
func (t *Transaction) Verify() error
func (*Transaction) VestingAdd ¶
func (t *Transaction) VestingAdd(ar *VestingAddRequest, value common.Balance) (err error)
func (*Transaction) VestingDelete ¶
func (t *Transaction) VestingDelete(poolID common.Key) (err error)
func (*Transaction) VestingLock ¶ added in v1.0.46
func (*Transaction) VestingTrigger ¶
func (t *Transaction) VestingTrigger(poolID common.Key) (err error)
func (*Transaction) VestingUnlock ¶
func (t *Transaction) VestingUnlock(poolID common.Key) (err error)
func (*Transaction) VestingUpdateConfig ¶
func (t *Transaction) VestingUpdateConfig(vscc *VestingSCConfig) (err error)
func (*Transaction) WritePoolLock ¶
func (t *Transaction) WritePoolLock(allocID string, val int64) (err error)
WritePoolLock lock token for the write pool.
type TransactionCallback ¶
type TransactionCallback interface {
OnTransactionComplete(t *Transaction, status int)
OnVerifyComplete(t *Transaction, status int)
OnAuthComplete(t *Transaction, status int)
}
TransactionCallback needs to be implemented by the caller for transaction related APIs
type TransactionScheme ¶
type TransactionScheme interface {
// SetTransactionCallback implements storing the callback
// used to call after the transaction or verification is completed
SetTransactionCallback(cb TransactionCallback) error
// Send implements sending token to a given clientid
Send(toClientID string, val int64, desc string) error
// StoreData implements store the data to blockchain
StoreData(data string) error
// ExecuteSmartContract impements the Faucet Smart contract
ExecuteSmartContract(address, methodName, jsoninput string, val int64) error
// ExecuteFaucetSCWallet impements the Faucet Smart contract for a given wallet
ExecuteFaucetSCWallet(walletStr string, methodName string, input []byte) error
// GetTransactionHash implements retrieval of hash of the submitted transaction
GetTransactionHash() string
// LockTokens implements the lock token.
LockTokens(val int64, durationHr int64, durationMin int) error
// UnlockTokens implements unlocking of earlier locked tokens.
UnlockTokens(poolID string) error
// Stake implementes token to be stake on clientID
Stake(clientID string, val int64) error
// DeleteStake implements deleteing staked tokens
DeleteStake(clientID, poolID string) error
//RegisterMultiSig registers a group wallet and subwallets with MultisigSC
RegisterMultiSig(walletstr, mswallet string) error
// SetTransactionHash implements verify a previous transation status
SetTransactionHash(hash string) error
// SetTransactionFee implements method to set the transaction fee
SetTransactionFee(txnFee int64) error
// Verify implements verify the transaction
Verify() error
// GetVerifyOutput implements the verifcation output from sharders
GetVerifyOutput() string
// GetTransactionError implements error string incase of transaction failure
GetTransactionError() string
// GetVerifyError implements error string incase of verify failure error
GetVerifyError() string
// vesting SC
VestingTrigger(poolID common.Key) error
VestingLock(poolID common.Key, value common.Balance) error
VestingUnlock(poolID common.Key) error
VestingAdd(ar *VestingAddRequest, value common.Balance) error
VestingDelete(poolID common.Key) error
VestingUpdateConfig(vscc *VestingSCConfig) error
// CreateReadPool if missing or when wallet created.
CreateReadPool() (err error)
// ReadPoolLock lock token for the read pool.
ReadPoolLock(val int64, dur time.Duration) (err error)
// ReadPoolUnlock unlock expired tokens of the read pool.
ReadPoolUnlock(poolID string) (err error)
// WritePoolLock lock token for the write pool.
WritePoolLock(allocID string, val int64) (err error)
// StakePoolUnlock unlock expired tokens of stake pool by owner.
StakePoolUnlock() (err error)
// FinalizeAllocation performs all required on allocation expires.
FinalizeAllocation(allocID string) (err error)
}
TransactionScheme implements few methods for block chain
func NewTransaction ¶
func NewTransaction(cb TransactionCallback, txnFee int64) (TransactionScheme, error)
NewTransaction allocation new generic transaction object for any operation
type TransactionWithAuth ¶
type TransactionWithAuth struct {
// contains filtered or unexported fields
}
func (*TransactionWithAuth) CreateReadPool ¶
func (ta *TransactionWithAuth) CreateReadPool() (err error)
func (*TransactionWithAuth) DeleteStake ¶ added in v1.0.11
func (ta *TransactionWithAuth) DeleteStake(clientID, poolID string) error
func (*TransactionWithAuth) ExecuteFaucetSCWallet ¶
func (ta *TransactionWithAuth) ExecuteFaucetSCWallet(walletStr string, methodName string, input []byte) error
ExecuteFaucetSCWallet impements the Faucet Smart contract for a given wallet
func (*TransactionWithAuth) ExecuteSmartContract ¶
func (ta *TransactionWithAuth) ExecuteSmartContract(address, methodName, jsoninput string, val int64) error
func (*TransactionWithAuth) FinalizeAllocation ¶
func (ta *TransactionWithAuth) FinalizeAllocation(allocID string) (err error)
FinalizeAllocation performs all required where allocation expired.
func (*TransactionWithAuth) GetTransactionError ¶
func (ta *TransactionWithAuth) GetTransactionError() string
func (*TransactionWithAuth) GetTransactionHash ¶
func (ta *TransactionWithAuth) GetTransactionHash() string
func (*TransactionWithAuth) GetVerifyError ¶
func (ta *TransactionWithAuth) GetVerifyError() string
func (*TransactionWithAuth) GetVerifyOutput ¶
func (ta *TransactionWithAuth) GetVerifyOutput() string
func (*TransactionWithAuth) LockTokens ¶
func (ta *TransactionWithAuth) LockTokens(val int64, durationHr int64, durationMin int) error
func (*TransactionWithAuth) ReadPoolLock ¶
func (ta *TransactionWithAuth) ReadPoolLock(val int64, dur time.Duration) ( err error)
func (*TransactionWithAuth) ReadPoolUnlock ¶
func (ta *TransactionWithAuth) ReadPoolUnlock(poolID string) (err error)
func (*TransactionWithAuth) RegisterMultiSig ¶
func (ta *TransactionWithAuth) RegisterMultiSig(walletstr string, mswallet string) error
RegisterMultiSig register a multisig wallet with the SC.
func (*TransactionWithAuth) Send ¶
func (ta *TransactionWithAuth) Send(toClientID string, val int64, desc string) error
func (*TransactionWithAuth) SetTransactionCallback ¶
func (ta *TransactionWithAuth) SetTransactionCallback(cb TransactionCallback) error
func (*TransactionWithAuth) SetTransactionFee ¶
func (ta *TransactionWithAuth) SetTransactionFee(txnFee int64) error
func (*TransactionWithAuth) SetTransactionHash ¶
func (ta *TransactionWithAuth) SetTransactionHash(hash string) error
func (*TransactionWithAuth) Stake ¶ added in v1.0.11
func (ta *TransactionWithAuth) Stake(clientID string, val int64) error
func (*TransactionWithAuth) StakePoolUnlock ¶
func (ta *TransactionWithAuth) StakePoolUnlock() (err error)
StakePoolUnlock unlock expired tokens of stake pool by owner.
func (*TransactionWithAuth) StoreData ¶
func (ta *TransactionWithAuth) StoreData(data string) error
func (*TransactionWithAuth) UnlockTokens ¶
func (ta *TransactionWithAuth) UnlockTokens(poolID string) error
func (*TransactionWithAuth) Verify ¶
func (ta *TransactionWithAuth) Verify() error
func (*TransactionWithAuth) VestingAdd ¶
func (ta *TransactionWithAuth) VestingAdd(ar *VestingAddRequest, value common.Balance) (err error)
func (*TransactionWithAuth) VestingDelete ¶
func (ta *TransactionWithAuth) VestingDelete(poolID common.Key) (err error)
func (*TransactionWithAuth) VestingLock ¶ added in v1.0.46
func (*TransactionWithAuth) VestingTrigger ¶
func (ta *TransactionWithAuth) VestingTrigger(poolID common.Key) (err error)
func (*TransactionWithAuth) VestingUnlock ¶
func (ta *TransactionWithAuth) VestingUnlock(poolID common.Key) (err error)
func (*TransactionWithAuth) VestingUpdateConfig ¶
func (ta *TransactionWithAuth) VestingUpdateConfig( vscc *VestingSCConfig) (err error)
func (*TransactionWithAuth) WritePoolLock ¶
func (ta *TransactionWithAuth) WritePoolLock(allocID string, val int64) ( err error)
WritePoolLock lock token for the write pool.
type VestingAddRequest ¶
type VestingAddRequest struct {
Description string `json:"description"` // allow empty
StartTime common.Timestamp `json:"start_time"` //
Duration time.Duration `json:"duration"` //
Friquency time.Duration `json:"friquency"` //
Destinations []common.Key `json:"destinations"` //
Amount common.Balance `json:"amount"` //
}
type VestingClientList ¶
func GetVestingClientList ¶
func GetVestingClientList(clientID common.Key) ( vcl *VestingClientList, err error)
type VestingPoolInfo ¶
type VestingPoolInfo struct {
ID common.Key `json:"pool_id"`
Balance common.Balance `json:"balance"`
Description string `json:"description"`
StartTime common.Timestamp `json:"start_time"`
ExpireAt common.Timestamp `json:"expire_at"`
Friquency time.Duration `json:"friquency"`
Destinations []common.Key `json:"destinations"`
Amount common.Balance `json:"amount"`
ClientID common.Key `json:"client_id"`
Last common.Timestamp `json:"last"`
}
func GetVestingPoolInfo ¶
func GetVestingPoolInfo(poolID common.Key) (vpi *VestingPoolInfo, err error)
type VestingSCConfig ¶
type VestingSCConfig struct {
Triggers []common.Key `json:"triggers"`
MinLock common.Balance `json:"min_lock"`
MinDuration time.Duration `json:"min_duration"`
MaxDuration time.Duration `json:"max_duration"`
MinFriquency time.Duration `json:"min_friquency"`
MaxFriquency time.Duration `json:"max_friquency"`
MaxDestinations int `json:"max_destinations"`
MaxDescriptionLength int `json:"max_description_length"`
}
func GetVestingSCConfig ¶
func GetVestingSCConfig() (vscc *VestingSCConfig, err error)
type WalletCallback ¶
WalletCallback needs to be implmented for wallet creation.