Documentation
¶
Index ¶
- type BaseTokenAPI
- func (b *BaseTokenAPI) AllowedBalanceOf(address string, token string) (*channel.Response, error)
- func (b *BaseTokenAPI) BalanceOf(address string) (*channel.Response, error)
- func (b *BaseTokenAPI) DeleteRate(dealType dealType, currency string, rate uint64) (*channel.Response, error)
- func (b *BaseTokenAPI) GetChaincodeName() string
- func (b *BaseTokenAPI) GetChannelName() string
- func (b *BaseTokenAPI) GetHlfClient() *service.HLFClient
- func (b *BaseTokenAPI) Metadata() (*channel.Response, error)
- func (b *BaseTokenAPI) SetRate(dealType dealType, currency string, rate uint64) (*channel.Response, error)
- func (b *BaseTokenAPI) SwapBegin(keyPair *KeyPair, token string, contractTo string, amount uint64, hash string) (*channel.Response, error)
- func (b *BaseTokenAPI) SwapCancel(keyPair *KeyPair, swapTransactionId string) (*channel.Response, error)
- func (b *BaseTokenAPI) SwapDone(swapTransactionId string, swapKey string) (*channel.Response, error)
- func (b *BaseTokenAPI) SwapGet(swapTransactionId string) (*channel.Response, error)
- func (b *BaseTokenAPI) Transfer(keyPair *KeyPair, toAddress string, amount *big.Int, ref string) (*channel.Response, error)
- type BaseTokenInterface
- type ChaincodeAPI
- type KeyPair
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseTokenAPI ¶
type BaseTokenAPI struct {
// ChaincodeAPI - chaincode api
*ChaincodeAPI
// OwnerKeyPair - key pair for owner
OwnerKeyPair *KeyPair
}
BaseTokenAPI - base token api struct
func NewBaseTokenAPI ¶
func NewBaseTokenAPI(channelName string, chaincodeName string, hlfClient *service.HLFClient, ownerKeyPair *KeyPair) *BaseTokenAPI
NewBaseTokenAPI - create new base token api
func (*BaseTokenAPI) AllowedBalanceOf ¶
AllowedBalanceOf - request for allowed balance. Method signature: QueryAllowedBalanceOf(address types.Address, token string) No additional conditions are required.
func (*BaseTokenAPI) BalanceOf ¶
func (b *BaseTokenAPI) BalanceOf(address string) (*channel.Response, error)
BalanceOf - balance query. Method signature: QueryBalanceOf(address types.Address) (*big.Int, error) No additional conditions are required.
func (*BaseTokenAPI) DeleteRate ¶
func (b *BaseTokenAPI) DeleteRate(dealType dealType, currency string, rate uint64) (*channel.Response, error)
DeleteRate - delete rate for deal type and currency Signed by the issuer dealType - type of transaction currency - currency type rate - value
func (*BaseTokenAPI) GetChaincodeName ¶
func (b *BaseTokenAPI) GetChaincodeName() string
GetChaincodeName - get chaincode name
func (*BaseTokenAPI) GetChannelName ¶
func (b *BaseTokenAPI) GetChannelName() string
GetChannelName - get channel name
func (*BaseTokenAPI) GetHlfClient ¶
func (b *BaseTokenAPI) GetHlfClient() *service.HLFClient
GetHlfClient - get hlf client
func (*BaseTokenAPI) Metadata ¶
func (b *BaseTokenAPI) Metadata() (*channel.Response, error)
Metadata - token metadata query Method signature: QueryMetadata() (metadata, error) No additional conditions are required.
func (*BaseTokenAPI) SetRate ¶
func (b *BaseTokenAPI) SetRate(dealType dealType, currency string, rate uint64) (*channel.Response, error)
SetRate - set rate for deal type and currency Subscribed by the issuer dealType - deal type currency - currency type rate - value
func (*BaseTokenAPI) SwapBegin ¶
func (b *BaseTokenAPI) SwapBegin(keyPair *KeyPair, token string, contractTo string, amount uint64, hash string) (*channel.Response, error)
SwapBegin - the beginning of the atomic swap process. Method signature: TxSwapBegin(sender types.Sender, token string, contractTo string, amount *big.Int, hash types.Hex) (string, error) No additional conditions are required.
func (*BaseTokenAPI) SwapCancel ¶
func (b *BaseTokenAPI) SwapCancel(keyPair *KeyPair, swapTransactionId string) (*channel.Response, error)
SwapCancel - cancel the atomic swap process.
func (*BaseTokenAPI) SwapDone ¶
func (b *BaseTokenAPI) SwapDone(swapTransactionId string, swapKey string) (*channel.Response, error)
SwapDone - start of the atomic swap process. No additional conditions are required.
func (*BaseTokenAPI) SwapGet ¶
func (b *BaseTokenAPI) SwapGet(swapTransactionId string) (*channel.Response, error)
SwapGet - swap information. Method signature: QuerySwapGet(swapID string) (*proto.Swap, error) No additional conditions are required.
func (*BaseTokenAPI) Transfer ¶
func (b *BaseTokenAPI) Transfer(keyPair *KeyPair, toAddress string, amount *big.Int, ref string) (*channel.Response, error)
Transfer - transfer tokens to the specified address. Method signature: TxTransfer(sender types.Sender, to types.Address, amount *big.Int, ref string) error The number of tokens to be transferred must not be zero, tokens cannot be transferred to oneself, if a commission is set and the commission currency is not empty, the sender will be charged a commission.
type BaseTokenInterface ¶
type BaseTokenInterface interface {
// SetRate - set rate for deal type and currency
SetRate(dealType dealType, currency string, rate uint64) (*channel.Response, error)
// DeleteRate - delete rate for deal type and currency
DeleteRate(dealType dealType, currency string, rate uint64) (*channel.Response, error)
// Metadata - get metadata for token
Metadata() (*channel.Response, error)
// BalanceOf - get balance for address
BalanceOf(address string) (*channel.Response, error)
// AllowedBalanceOf - get allowed balance for address
AllowedBalanceOf(address string, token string) (*channel.Response, error)
// Transfer - transfer token to address
Transfer(keyPair *KeyPair, toAddress string, amount *big.Int, ref string) (*channel.Response, error)
// SwapBegin - begin swap process
SwapBegin(keyPair *KeyPair, token string, contractTo string, amount uint64, hash string) (*channel.Response, error)
// SwapCancel - cancel swap process
SwapCancel(keyPair *KeyPair, swapTransactionId string) (*channel.Response, error)
// SwapDone - done swap process
SwapDone(swapTransactionId string, swapKey string) (*channel.Response, error)
// SwapGet - get swap info
SwapGet(swapTransactionId string) (*channel.Response, error)
// GetChannelName - get channel name
GetChannelName() string
// GetChaincodeName - get chaincode name
GetChaincodeName() string
// GetHlfClient - get hlf client
GetHlfClient() *service.HLFClient
}
BaseTokenInterface - interface for base token
type ChaincodeAPI ¶
type ChaincodeAPI struct {
// ChannelName - channel name for chaincode
ChannelName string
// ChaincodeName - chaincode name for base token
ChaincodeName string
// contains filtered or unexported fields
}
ChaincodeAPI - base token api struct
func NewChaincodeAPI ¶
func NewChaincodeAPI(channelName string, chaincodeName string, hlfClient *service.HLFClient) *ChaincodeAPI
NewChaincodeAPI - create new base token api
func (*ChaincodeAPI) GetChaincodeName ¶
func (b *ChaincodeAPI) GetChaincodeName() string
GetChaincodeName - get chaincode name
func (*ChaincodeAPI) GetChannelName ¶
func (b *ChaincodeAPI) GetChannelName() string
GetChannelName - get channel name
func (*ChaincodeAPI) GetHlfClient ¶
func (b *ChaincodeAPI) GetHlfClient() *service.HLFClient
GetHlfClient - get hlf client for chaincode
func (*ChaincodeAPI) Validate ¶
func (b *ChaincodeAPI) Validate() error
Validate - validate chaincode api