Documentation
¶
Index ¶
- func ValidateBtpAddress(ba BTPAddress) error
- type AddToBlacklistRequestEvent
- type AssetTransferDetails
- type BTPAddress
- func (a BTPAddress) BlockChain() string
- func (a BTPAddress) ContractAddress() string
- func (a BTPAddress) NetworkAddress() string
- func (a BTPAddress) NetworkID() string
- func (a BTPAddress) Protocol() string
- func (a *BTPAddress) Set(v string) error
- func (a BTPAddress) String() string
- func (a BTPAddress) Type() string
- type BlacklistResponseEvent
- type ChainAPI
- type ChainType
- type CoinBalance
- type Config
- type ContractName
- type DstAPI
- type EventLogInfo
- type EventLogType
- type FeeGatheringRequestEvent
- type FullConfigAPI
- type GasLimitType
- type RemoveFromBlacklistRequestEvent
- type SrcAPI
- type StandardConfigAPI
- type TokenLimitRequestEvent
- type TokenLimitResponseEvent
- type TransferEndEvent
- type TransferReceivedEvent
- type TransferStartEvent
- type TxnResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateBtpAddress ¶
func ValidateBtpAddress(ba BTPAddress) error
Types ¶
type AssetTransferDetails ¶
type BTPAddress ¶
type BTPAddress string
func (BTPAddress) BlockChain ¶
func (a BTPAddress) BlockChain() string
func (BTPAddress) ContractAddress ¶
func (a BTPAddress) ContractAddress() string
func (BTPAddress) NetworkAddress ¶
func (a BTPAddress) NetworkAddress() string
func (BTPAddress) NetworkID ¶
func (a BTPAddress) NetworkID() string
func (BTPAddress) Protocol ¶
func (a BTPAddress) Protocol() string
func (*BTPAddress) Set ¶
func (a *BTPAddress) Set(v string) error
func (BTPAddress) String ¶
func (a BTPAddress) String() string
func (BTPAddress) Type ¶
func (a BTPAddress) Type() string
type BlacklistResponseEvent ¶
type ChainAPI ¶
type ChainAPI interface { // Subscription Subscribe(ctx context.Context) (sinkChan chan *EventLogInfo, errChan chan error, err error) // Account GetKeyPairs(num int) ([][2]string, error) GetKeyPairFromKeystore(keystoreFile, secretFile string) (string, string, error) // Transfer TransferBatch(coinNames []string, senderKey, recepientAddress string, amounts []*big.Int) (txnHash string, err error) Transfer(coinName, senderKey, recepientAddress string, amount *big.Int) (txnHash string, err error) WaitForTxnResult(ctx context.Context, hash string) (txnr *TxnResult, err error) WatchForTransferStart(ID uint64, seq int64) error WatchForTransferReceived(ID uint64, seq int64) error WatchForTransferEnd(ID uint64, seq int64) error Approve(coinName string, ownerKey string, amount *big.Int) (txnHash string, err error) GetCoinBalance(coinName string, addr string) (*CoinBalance, error) Reclaim(coinName string, ownerKey string, amount *big.Int) (txnHash string, err error) // Query NativeCoin() string NativeTokens() []string GetBTPAddress(addr string) string ChargedGasFee(txnHash string) (*big.Int, error) SuggestGasPrice() *big.Int // Configure SetTokenLimit(ownerKey string, coinNames []string, tokenLimits []*big.Int) (txnHash string, err error) AddBlackListAddress(ownerKey string, net string, addrs []string) (txnHash string, err error) RemoveBlackListAddress(ownerKey string, net string, addrs []string) (txnHash string, err error) ChangeRestriction(ownerKey string, enable bool) (txnHash string, err error) GetTokenLimitStatus(net, coinName string) (response bool, err error) GetBlackListedUsers(net string, startCursor, endCursor int) (addrs []string, err error) SetFeeGatheringTerm(ownerKey string, interval uint64) (hash string, err error) GetFeeGatheringTerm() (interval uint64, err error) WatchForAddToBlacklistRequest(ID uint64, seq int64) error WatchForRemoveFromBlacklistRequest(ID uint64, seq int64) error WatchForBlacklistResponse(ID uint64, seq int64) error WatchForSetTokenLmitRequest(ID uint64, seq int64) error WatchForSetTokenLmitResponse(ID uint64, seq int64) error GetConfigRequestEvent(evtType EventLogType, hash string) (*EventLogInfo, error) WatchForFeeGatheringRequest(ID uint64, addr string) error WatchForFeeGatheringTransferStart(ID uint64, addr string) error IsUserBlackListed(net, addr string) (response bool, err error) GetTokenLimit(coinName string) (tokenLimit *big.Int, err error) IsBTSOwner(addr string) (response bool, err error) SetFeeRatio(ownerKey string, coinName string, feeNumerator, fixedFee *big.Int) (string, error) GetFeeRatio(coinName string) (feeNumerator *big.Int, fixedFee *big.Int, err error) GetAccumulatedFees() (map[string]*big.Int, error) }
type CoinBalance ¶
type CoinBalance struct { UsableBalance *big.Int LockedBalance *big.Int RefundableBalance *big.Int UserBalance *big.Int TotalBalance *big.Int // held by BTS + by itself }
func (*CoinBalance) String ¶
func (cb *CoinBalance) String() string
type Config ¶
type Config struct { Name ChainType `json:"name"` URL string `json:"url"` ContractAddresses map[ContractName]string `json:"contract_addresses"` NativeCoin string `json:"native_coin"` NativeTokens []string `json:"native_tokens"` WrappedCoins []string `json:"wrapped_coins"` GodWalletKeystorePath string `json:"god_wallet_keystore_path"` GodWalletSecretPath string `json:"god_wallet_secret_path"` BTSOwnerKeystorePath string `json:"bts_owner_keystore_path"` BTSOwnerSecretPath string `json:"bts_owner_secret_path"` NetworkID string `json:"network_id"` GasLimit map[GasLimitType]uint64 `json:"gas_limit"` }
type ContractName ¶
type ContractName string
const ( BMC ContractName = "BMC" BMCPeriphery ContractName = "BMCPeriphery" BTS ContractName = "BTS" BTSPeriphery ContractName = "BTSPeriphery" )
type EventLogInfo ¶
type EventLogInfo struct { PID uint64 ContractAddress string EventType EventLogType EventLog interface{} }
type EventLogType ¶
type EventLogType string
const ( TransferStart EventLogType = "TransferStart" TransferReceived EventLogType = "TransferReceived" TransferEnd EventLogType = "TransferEnd" AddToBlacklistRequest EventLogType = "AddToBlacklistRequest" RemoveFromBlacklistRequest EventLogType = "RemoveFromBlacklistRequest" BlacklistResponse EventLogType = "BlacklistResponse" TokenLimitRequest EventLogType = "TokenLimitRequest" TokenLimitResponse EventLogType = "TokenLimitResponse" FeeGatheringRequest EventLogType = "FeeGatheringRequest" Message EventLogType = "Message" )
type FullConfigAPI ¶
type FullConfigAPI interface { SetTokenLimit(ownerKey string, coinNames []string, tokenLimits []*big.Int) (txnHash string, err error) AddBlackListAddress(ownerKey string, net string, addrs []string) (txnHash string, err error) RemoveBlackListAddress(ownerKey string, net string, addrs []string) (txnHash string, err error) ChangeRestriction(ownerKey string, enable bool) (txnHash string, err error) GetTokenLimitStatus(net, coinName string) (response bool, err error) GetBlackListedUsers(net string, startCursor, endCursor int) (addrs []string, err error) SetFeeGatheringTerm(ownerKey string, interval uint64) (hash string, err error) GetFeeGatheringTerm() (interval uint64, err error) WatchForAddToBlacklistRequest(ID uint64, seq int64) error WatchForRemoveFromBlacklistRequest(ID uint64, seq int64) error WatchForSetTokenLmitRequest(ID uint64, seq int64) error GetConfigRequestEvent(evtType EventLogType, hash string) (*EventLogInfo, error) WatchForFeeGatheringRequest(ID uint64, addr string) error IsUserBlackListed(net, addr string) (response bool, err error) GetTokenLimit(coinName string) (tokenLimit *big.Int, err error) IsBTSOwner(addr string) (response bool, err error) }
type GasLimitType ¶
type GasLimitType string
const ( TransferNativeCoinIntraChainGasLimit GasLimitType = "TransferNativeCoinIntraChainGasLimit" TransferTokenIntraChainGasLimit GasLimitType = "TransferTokenIntraChainGasLimit" ApproveTokenInterChainGasLimit GasLimitType = "ApproveTokenInterChainGasLimit" TransferCoinInterChainGasLimit GasLimitType = "TransferCoinInterChainGasLimit" TransferBatchCoinInterChainGasLimit GasLimitType = "TransferBatchCoinInterChainGasLimit" DefaultGasLimit GasLimitType = "DefaultGasLimit" )
type SrcAPI ¶
type SrcAPI interface { Transfer(coinName, senderKey, recepientAddress string, amount *big.Int) (txnHash string, err error) TransferBatch(coinNames []string, senderKey, recepientAddress string, amounts []*big.Int) (txnHash string, err error) WaitForTxnResult(ctx context.Context, hash string) (txnr *TxnResult, err error) WatchForTransferStart(requestID uint64, seq int64) error WatchForTransferEnd(ID uint64, seq int64) error WatchForFeeGatheringTransferStart(ID uint64, addr string) error Approve(coinName string, ownerKey string, amount *big.Int) (txnHash string, err error) GetCoinBalance(coinName string, addr string) (*CoinBalance, error) Reclaim(coinName string, ownerKey string, amount *big.Int) (txnHash string, err error) NativeCoin() string NativeTokens() []string GetBTPAddress(addr string) string ChargedGasFee(txnHash string) (*big.Int, error) SuggestGasPrice() *big.Int }
type StandardConfigAPI ¶
type StandardConfigAPI interface { IsUserBlackListed(net, addr string) (response bool, err error) GetTokenLimit(coinName string) (tokenLimit *big.Int, err error) IsBTSOwner(addr string) (response bool, err error) SetFeeRatio(ownerKey string, coinName string, feeNumerator, fixedFee *big.Int) (string, error) GetFeeRatio(coinName string) (feeNumerator *big.Int, fixedFee *big.Int, err error) GetAccumulatedFees() (map[string]*big.Int, error) WatchForBlacklistResponse(ID uint64, seq int64) error WatchForSetTokenLmitResponse(ID uint64, seq int64) error }
type TokenLimitRequestEvent ¶
type TokenLimitResponseEvent ¶
type TransferEndEvent ¶
type TransferReceivedEvent ¶
type TransferReceivedEvent struct { From string To string Sn *big.Int Assets []AssetTransferDetails }
type TransferStartEvent ¶
type TransferStartEvent struct { From string To string Sn *big.Int Assets []AssetTransferDetails }
type TxnResult ¶
type TxnResult struct { StatusCode int ElInfo []*EventLogInfo Raw interface{} }
Click to show internal directories.
Click to hide internal directories.