modus

package
v0.0.0-...-d56c475 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authentication

type Authentication interface {
	// GetUid
	// @method get
	// @return uid string "signature line"
	// @return token string "temporary token to pass in login. Currently, the lifetime of a temporary token is 5 seconds"
	// Get the temporary token for login and save prepare config
	GetUid() error
	// Login
	// @method post
	// Log in to the specified role and save the token
	Login(roleId int64) (err error)
	// AutoLogin
	// no role auto login
	AutoLogin() error
	GetAuthStatus() (*response.AuthStatusResponse, error)
}

type Base

type Base interface {
	Init() (err error)
	GetConfig() config.Config
	SetConfig(config.Config)
	Version() string
	AmountValidator(amount string) error
	ExpediteValidator(expedite string) error

	// RESTful API
	SendGet(url string, form *url.Values, result any) error
	SendPost(url string, form *url.Values, result any) error
	//SendPostByFile(url string, form *url.Values, fileName string) error
	SendMultipart(url string, files map[string][]byte, result any) error

	// JSON-RPC Request
	NewMessage(params request.RequestParams) (request.Request, error)
	NewBatchMessage(requestPrams []request.BatchRequestParams) ([]request.BatchRequest, error)
	GET(form any, result any) error
	POST(form any, result any) error
}

type Client

type Contract

type Contract interface {
	// GetContracts
	// @method get
	// get contracts
	GetContracts(limit, offset int64) (*response.ListResult, error)
	// GetContract
	// @method get
	// get contract information by contract name
	GetContract(contractName string) (*response.GetContractResult, error)
	// PrepareContractTx
	// @method get
	// contain Prepare Contract transaction function
	// @return params map[string]any "contract params"
	// @return contractId int "contract id"
	PrepareContractTx(contractName string, form Getter) (params map[string]any, contractId int, err error)
	// NewContractTransaction
	// Build a contract transaction
	// @return data []byte "contract transaction data"
	// @return hash []byte "transaction data hash"
	// expedite: ibax fee
	NewContractTransaction(contractId int, params map[string]any, expedite string) (data, hash []byte, err error)
	// AutoCallContract
	// call Contract and return transaction result
	AutoCallContract(contractName string, form Getter, expedite string) (*response.TxStatusResult, error)
}

Contract Functions for Work with Contracts

type Getter

type Getter interface {
	Get(string) string
}

type Query

type Query interface {
	// GetKeyInfo
	// @method get
	// get key info
	GetKeyInfo(account string) (*response.KeyInfoResult, error)
	// Balance
	// @method get
	Balance(wallet string, ecosystem int64) (*response.TokenBalanceResult, error)
	GetBalance(wallet string) (*response.TokenBalanceResult, error)

	GetVersion() (*string, error)
	GetIBAXConfig(option string) (*string, error)

	//metrics
	EcosystemCount() (int64, error)
	GetMaxBlockID() (int64, error)
	TransactionsCount() (int64, error)
	KeysCount() (int64, error)
	HonorNodesCount() (int64, error)
	BlocksCount() (int64, error)

	//DataVerify Save the response result to filename,if filename is null, then return result
	DataVerify(tableName string, id int64, column, hash, fileName string) (result request.FileType, err error)
	//BinaryVerify Save the response result to filename,if filename is null, then return result
	BinaryVerify(id int64, hash, fileName string) (result request.FileType, err error)
	GetAvatar(account string, ecosystem int64, fileName string) (result request.FileType, err error)

	//block
	DetailedBlocks(block, count int64) (*map[int64]response.BlockDetailedInfo, error)
	GetBlockInfo(id int64) (*response.BlockInfoResult, error)
	BlocksTxInfo(block, count int64) (*map[int64][]response.BlockTxInfo, error)

	//ecosystem
	GetTableCount(offset, limit int) (*response.TablesResult, error)
	GetTable(tableName string) (*response.TableResult, error)
	GetSections(language string, offset, limit int) (*response.ListResult, error)
	GetPageRow(name string) (*response.PageResult, error)
	GetMenuRow(name string) (*response.MenuResult, error)
	GetSnippetRow(name string) (*response.SnippetResult, error)
	GetAppContent(appId int64) (*response.AppContentResult, error)

	//ecosystem
	EcosystemName(ecosystem int64) (*response.EcosystemNameResult, error)
	AppParams(appid int64, names string, ecosystem int64, params ...int) (*response.AppParamsResult, error)
	AppParam(appid int64, name string, ecosystem int64) (*response.ParamResult, error)
	EcosystemParam(ecosystem int64, name string) (*response.ParamResult, error)
	EcosystemParams(ecosystem int64, names string, params ...int) (*response.ParamsResult, error)
	SystemParams(names string, params ...int) (*response.ParamsResult, error)
	GetRow(tableName string, id int64, columns string, whereColumn string) (*response.RowResult, error)
	GetRowExtend(tableName, columns string, value string, rowsName string) (*response.RowResult, error)
	GetHistory(table string, id uint64) (*response.HistoryResult, error)
	GetList(params request.GetList) (*response.ListResult, error)
	GetListWhere(params request.GetList) (*response.ListResult, error)
	GetNodeListWhere(params request.GetList) (*response.ListResult, error)

	BlockTxCount(blockIdOrBlockHash any) (int64, error)
	DetailedBlock(blockIdOrBlockHash any) (*response.BlockDetailedInfo, error)
	EcosystemInfo(ecosystem int64) (*response.EcosystemInfo, error)
	GetMemberInfo(account string, ecosystem int64) (*response.MemberInfo, error)
}

type Transaction

type Transaction interface {
	// SendTx
	// send transaction
	// return hashMap *map[string]string "transaction hash map"
	SendTx(arrData map[string][]byte) (hashMap *map[string]string, err error)
	// TxStatus
	// Query the transaction result of the specified hash
	TxStatus(hash string, frequency int, interval time.Duration) (response.TxStatusResult, error)
	// TxsStatus
	// Query the transaction result of the multiple hash
	TxsStatus(hashList []string, interval time.Duration) (map[string]response.TxStatusResult, error)

	GetTxInfo(hash string, getContractInfo bool) (*response.TxInfoResult, error)
	GetTxInfoMulti(hashList []string, getContractInfo bool) (*response.MultiTxInfoResult, error)
}

Transaction transaction

type Utxo

type Utxo interface {
	NewUtxoSmartTransaction(txType request.UtxoType, form Getter, expedite string) (*types.SmartTransaction, error)
	NewUtxoTransaction(smartTransaction types.SmartTransaction) (data, hash []byte, err error)
	AutoCallUtxo(txType request.UtxoType, form Getter, expedite string) (*response.TxStatusResult, error)
}

Utxo Functions for Work with UTXO

type Wallet

type Wallet interface {
	NewMnemonic(length request.WordsLenType) (mnemonic string, err error)
	NewWallet(length request.WordsLenType) (*hd.Wallet, error)
	NewWalletFromMnemonic(mnemonic string) (*hd.Wallet, error)
	NewAccountFromPath(wallet *hd.Wallet, path string, pin bool) (as.Account, error)
	GetPrivateKey(wallet *hd.Wallet, account as.Account) ([]byte, error)
	GetPublicKey(wallet *hd.Wallet, account as.Account) ([]byte, error)
	FormatAddress(account as.Account) string
	GetAddress(publicKey []byte) string
	GetKeyId(publicKey []byte) int64
	GetETHAddress(publicKey []byte) string
}

Jump to

Keyboard shortcuts

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