base_token

package
v0.0.0-...-e4bbcfe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 1, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseTokenAPI

type BaseTokenAPI struct {
	*ChaincodeAPI
	OwnerKeyPair *KeyPair
}

func NewBaseTokenAPI

func NewBaseTokenAPI(channelName string, chaincodeName string, hlfClient *service.HLFClient, ownerKeyPair *KeyPair) *BaseTokenAPI

func (*BaseTokenAPI) AllowedBalanceOf

func (b *BaseTokenAPI) AllowedBalanceOf(address string, token string) (*channel.Response, error)

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 - Signed by the issuer dealType - type of deal currency - currency type rate - value

func (*BaseTokenAPI) GetChaincodeName

func (b *BaseTokenAPI) GetChaincodeName() string

func (*BaseTokenAPI) GetChannelName

func (b *BaseTokenAPI) GetChannelName() string

func (*BaseTokenAPI) GetHlfClient

func (b *BaseTokenAPI) GetHlfClient() *service.HLFClient

func (*BaseTokenAPI) Metadata

func (b *BaseTokenAPI) Metadata() (*channel.Response, error)

Metadata - request the metadata of the token. 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 - Signed by the issuer dealType - type of deal 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 - swap reset. Method signature: TxSwapCancel(sender types.Sender, swapID string) error No additional conditions are required.

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(dealType dealType, currency string, rate uint64) (*channel.Response, error)
	DeleteRate(dealType dealType, currency string, rate uint64) (*channel.Response, error)
	Metadata() (*channel.Response, error)
	BalanceOf(address string) (*channel.Response, error)
	AllowedBalanceOf(address string, token string) (*channel.Response, error)
	Transfer(keyPair *KeyPair, toAddress string, amount *big.Int, ref string) (*channel.Response, error)
	SwapBegin(keyPair *KeyPair, token string, contractTo string, amount uint64, hash string) (*channel.Response, error)
	SwapCancel(keyPair *KeyPair, swapTransactionId string) (*channel.Response, error)
	SwapDone(swapTransactionId string, swapKey string) (*channel.Response, error)
	SwapGet(swapTransactionId string) (*channel.Response, error)
	GetChannelName() string
	GetChaincodeName() string
	GetHlfClient() *service.HLFClient
}

type ChaincodeAPI

type ChaincodeAPI struct {
	ChannelName   string
	ChaincodeName string
	// contains filtered or unexported fields
}

func NewChaincodeAPI

func NewChaincodeAPI(channelName string, chaincodeName string, hlfClient *service.HLFClient) *ChaincodeAPI

func (*ChaincodeAPI) GetChaincodeName

func (b *ChaincodeAPI) GetChaincodeName() string

func (*ChaincodeAPI) GetChannelName

func (b *ChaincodeAPI) GetChannelName() string

func (*ChaincodeAPI) GetHlfClient

func (b *ChaincodeAPI) GetHlfClient() *service.HLFClient

func (*ChaincodeAPI) Validate

func (b *ChaincodeAPI) Validate() error

type KeyPair

type KeyPair struct {
	UserID     string
	PrivateKey ed25519.PrivateKey
	PublicKey  ed25519.PublicKey
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL