sdk

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: MIT Imports: 23 Imported by: 2

Documentation

Index

Constants

View Source
const (
	RSASignerType = "RSASigner"
	EccSignerType = "EccSigner"
)

Variables

View Source
var (
	ErrTokenNotExist   = errors.New("err_not_exist_token")
	ErrBurnFeeNotExist = errors.New("err_not_exist_burn_fee")
	ErrNotBundleTx     = errors.New("err_not_bundle_tx")

	ErrNotJsonData = errors.New("err_not_json_data")
)

Functions

func GenBundle

func GenBundle(items []paySchema.BundleItem, expiration int64) paySchema.Bundle

GenBundle expiration: bundle tx expiration time(s)

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(payURL string) *Client

func (*Client) Balance

func (c *Client) Balance(tokenTag, accid string) (balance serverSchema.AccBalance, err error)

func (*Client) Balances

func (c *Client) Balances(accid string) (balances serverSchema.AccBalances, err error)

func (*Client) BundleByHash

func (c *Client) BundleByHash(everHash string) (
	tx cacheSchema.TxResponse,
	bundle paySchema.BundleWithSigs,
	internalStatus cacheSchema.InternalStatus,
	err error)

func (*Client) CursorTxs

func (c *Client) CursorTxs(startCursor uint64, tokenSymbol, action, withoutAction string) (txs serverSchema.Txs, err error)

func (*Client) CursorTxsByAcc

func (c *Client) CursorTxsByAcc(accid string, startCursor uint64, tokenSymbol, action, withoutAction string) (txs serverSchema.Txs, err error)

func (*Client) Fee

func (c *Client) Fee(tokenTag string) (fee serverSchema.Fee, err error)

func (*Client) Fees

func (c *Client) Fees() (fees serverSchema.Fees, err error)

func (*Client) GetInfo

func (c *Client) GetInfo() (info serverSchema.Info, err error)

func (*Client) LimitIp

func (c *Client) LimitIp() (isLimit bool, err error)

func (*Client) MintTx

func (c *Client) MintTx(chainHash string) (tx serverSchema.Tx, err error)

MintTx get minted everTx by onChain mint txHash

func (*Client) PendingTxs

func (c *Client) PendingTxs(everHash string) (txs serverSchema.PendingTxs, err error)

PendingTxs get pending Txs everHash: means get from the everTx

func (*Client) SetHeader

func (c *Client) SetHeader(key, val string)

func (*Client) SubmitTx

func (c *Client) SubmitTx(tx paySchema.Transaction) (err error)

func (*Client) SubscribeTxs

func (c *Client) SubscribeTxs(fq schema.FilterQuery) *SubscribeTx

SubscribeTxs fq.StartCursor: option fq.Address: option fq.TokenSymbol: option fq.Action: option fq.WithoutAction: option

func (*Client) TxByHash

func (c *Client) TxByHash(everHash string) (tx serverSchema.Tx, err error)

func (*Client) Txs

func (c *Client) Txs(page int, orderBy, tokenSymbol string, action, withoutAction string) (txs serverSchema.Txs, err error)

Txs option args: tokenId, action, withoutAction default value: page(1), orderBy(desc)

func (*Client) TxsByAcc

func (c *Client) TxsByAcc(accid string, page int, orderBy string, tokenSymbol, action, withoutAction string) (txs serverSchema.AccTxs, err error)

TxsByAcc option args: tokenId, action, withoutAction default value: page(1), orderBy(desc)

type SDK

type SDK struct {
	AccId string
	Cli   *Client
	// contains filtered or unexported fields
}

func New

func New(signer interface{}, payUrl string) (*SDK, error)

func (*SDK) Bundle

func (s *SDK) Bundle(symbol string, to string, amount *big.Int, bundleWithSigs paySchema.BundleWithSigs) (*paySchema.Transaction, error)

func (*SDK) GetSymbolToTag

func (s *SDK) GetSymbolToTag() map[string]string

func (*SDK) GetTokens

func (s *SDK) GetTokens() map[string]serverSchema.TokenInfo

func (*SDK) Sign

func (s *SDK) Sign(msg string) (string, error)

func (*SDK) SignBundleData

func (s *SDK) SignBundleData(bundleTx paySchema.Bundle) (paySchema.BundleWithSigs, error)

func (*SDK) Transfer

func (s *SDK) Transfer(symbol string, amount *big.Int, to, data string) (*paySchema.Transaction, error)

func (*SDK) Withdraw

func (s *SDK) Withdraw(symbol string, amount *big.Int, chainType, to string) (*paySchema.Transaction, error)

type SubscribeTx

type SubscribeTx struct {
	// contains filtered or unexported fields
}

func (*SubscribeTx) Subscribe

func (s *SubscribeTx) Subscribe() <-chan cacheSchema.TxResponse

func (*SubscribeTx) Unsubscribe

func (s *SubscribeTx) Unsubscribe()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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