service

package
v0.0.0-...-73ba865 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthorityService

type AuthorityService struct {
	Base
}

func NewAuthorityService

func NewAuthorityService() *AuthorityService

func (*AuthorityService) GetAccount

func (a *AuthorityService) GetAccount(account string) (*dto.AccountInfo, error)

GetAccount @Description: 运营方、平台方以及终端用户可以通过调用该方法进行DDC账户信息的查询 @receiver a @param account DDC用户的账户地址 @return *dto.AccountInfo DDC账户信息实体 @return error

func (*AuthorityService) HasFunctionPermission

func (a *AuthorityService) HasFunctionPermission(accAddr, ctrAddr string, sig [4]byte) (bool, error)

HasFunctionPermission @Description: 运营方调用该方法查询平台方和终端用户是否有调用对应方法的权限 @receiver a @param accAddr 账户地址 @param ctrAddr 合约地址 @param sig 目标方法对应的sig编码 @return bool 是否已被授权 @return error

func (*AuthorityService) UpdateAccState

func (a *AuthorityService) UpdateAccState(opts *bind.TransactOpts, account string, state uint8, changePlatformState bool) (signedTx *types.Transaction, err error)

UpdateAccState @Description: 运营方或平台方可以通过调用该方法对终端用户进行DDC账户信息状态的更改 @receiver a @param opts opts.Price和opts.Signer为空时,默认使用初始化client时set的price和signer @param account 要更新的账户地址 @param state 状态 :Frozen 0 - 冻结状态 ; Active 1 - 活跃状态 @param changePlatformState 修改平台方状态标识 @return signedTx 签名好的交易 @return error

type Base

type Base struct {
	TxService
	BlockService
}

func (Base) Bech32ToHex

func (b Base) Bech32ToHex(addr string) (string, error)

Bech32ToHex @Description: irita链账户转以太坊账户格式 @receiver b @param addr irita链账户 @return string 以太坊账户 @return error

func (Base) CreateAccount

func (b Base) CreateAccount() (*dto.Account, error)

CreateAccount @Description:平台方或终端用户可以通过此方法生成离线账户 @receiver b @return *dto.Account 返回的账户信息 @return error

func (Base) DDCIdByHash

func (b Base) DDCIdByHash(hash string) (res []uint64)

DDCIdByHash @Description: 通过交易hash查询相关ddc的ddcId @receiver b @param hash 交易哈希 @return []uint64 对应的ddcId的集合

func (Base) EstimateGas

func (b Base) EstimateGas(opts *bind.TransactOpts, contract *common.Address, input []byte) (uint64, error)

EstimateGas 预估gas

func (Base) EstimateGasLimit

func (b Base) EstimateGasLimit(opts *bind.TransactOpts, contrName, funcName string, params ...interface{}) (gasLimit uint64, err error)

EstimateGasLimit @Description: 根据合约名、方法名以及入参预估gasLimit @receiver b @param opts @param contrName 合约名(见constant/contr_name.go) @param funcName 方法名(见constant/func_name.go) @param params 方法入参 @return gasLimit @return err

func (Base) GetNonce

func (b Base) GetNonce(addr common.Address) (uint64, error)

GetNonce @Description:查询对应账户下的最新nonce @receiver b @param addr 账户地址 @return uint64 最新nonce @return error

func (Base) HexToBech32

func (b Base) HexToBech32(addr string) (string, error)

HexToBech32 @Description: 以太坊账户格式转irita链账户 @receiver b @param addr 0x开头的以太坊账户 @return string irita链账户 @return error

func (Base) NewRawTx

func (b Base) NewRawTx(opts *bind.TransactOpts, contract common.Address, input []byte) (*types.Transaction, error)

NewRawTx @Description: 组装待签名的交易 @receiver b @param opts @param contract 目标合约地址 @param input 目标方法的字节码 @return *types.Transaction 待签名的交易 @return error

func (Base) StringToPrivateKey

func (b Base) StringToPrivateKey(privateKeyStr string) (*ecdsa.PrivateKey, error)

StringToPrivateKey @Description: 从明文的私钥字符串转换成该类型 @receiver b @param privateKeyStr 字符串形式的私钥 @return *ecdsa.PrivateKey ECDSA格式的私钥 @return error

type BlockService

type BlockService struct {
}

func (*BlockService) GetBlockByNumber

func (b *BlockService) GetBlockByNumber(blockNumber int64) (*types.Block, error)

GetBlockByNumber @Description: 运营方或平台方根据区块高度对区块信息进行查询,并解析区块数据返回给运营方或平台方 @receiver b @param blockNumber: 区块高度 @return *types2.Block: 区块信息 @return error

func (*BlockService) GetBlockEvents

func (b *BlockService) GetBlockEvents(blockNumber int64) (*dto.BlockEventBean, error)

GetBlockEvents @Description: 获取指定区块内的所有events @receiver b @param blockNumber 块高 @return *dto.BlockEventBean 事件和时间戳的实体 @return error

func (*BlockService) GetTxEvents

func (b *BlockService) GetTxEvents(txHash common.Hash) (events []interface{}, err error)

GetTxEvents @Description: 获取指定交易中的所有events @receiver b @param txHash 交易哈希 @return events 查询出的事件 @return err

type ChargeService

type ChargeService struct {
	Base
}

func NewChargeService

func NewChargeService() *ChargeService

func (*ChargeService) BalanceOf

func (c *ChargeService) BalanceOf(accAddr string) (uint64, error)

BalanceOf @Description: 查询指定账户的余额 @receiver c @param accAddr 要查询的账户地址 @return uint64 账户所对应的业务费余额 @return error

func (*ChargeService) QueryFee

func (c *ChargeService) QueryFee(contrAddr string, sig [4]byte) (uint32, error)

QueryFee @Description: 查询指定的DDC业务方法所对应的业务费用 @receiver c @param contrAddr DDC业务合约地址 @param sig DDC业务方法对应的sig编码 @return uint32 业务费用 @return error

func (*ChargeService) Recharge

func (c *ChargeService) Recharge(opts *bind.TransactOpts, to string, amount int64) (signedTx *types.Transaction, err error)

Recharge @Description:运营方、平台方调用该接口为所属同一方的同一级别账户或者下级账户充值 @receiver c @param opts opts.Price和opts.Signer为空时,默认使用初始化client时set的price和signer @param to 接收者账户 @param amount 充值金额 @return signedTx 签名好的交易 @return error

type DDC1155Service

type DDC1155Service struct {
	Base
}

func NewDDC1155Service

func NewDDC1155Service() *DDC1155Service

func (*DDC1155Service) BalanceOf

func (d *DDC1155Service) BalanceOf(owner string, ddcID int64) (uint64, error)

BalanceOf @Description: 运营方、平台方以及终端用户可以通过调用该方法进行查询当前账户拥有的对应ddcId的数量 @receiver d @param owner 拥有者账户 @param ddcID DDC唯一标识 @return uint64 ddcId对应的数量 @return error

func (*DDC1155Service) BalanceOfBatch

func (d *DDC1155Service) BalanceOfBatch(owners []common.Address, ddcIds []*big.Int) ([]*big.Int, error)

BalanceOfBatch @Description: 运营方、平台方以及终端用户可以通过调用该方法进行批量查询账户拥有的DDC的数量 @receiver d @param owners 要查询的账户地址 @param ddcIds 要查询的ddcId @return []*big.Int ddc数量的集合 @return error

func (*DDC1155Service) Burn

func (d *DDC1155Service) Burn(opts *bind.TransactOpts, owner string, ddcID int64) (signedTx *types.Transaction, err error)

Burn @Description: DDC拥有者或DDC授权者可以通过调用该方法进行DDC的销毁 @receiver d @param opts opts.Price和opts.Signer为空时,默认使用初始化client时set的price和signer @param ddcID DDC唯一标识 @return signedTx 签名好的交易 @return error

func (*DDC1155Service) BurnBatch

func (d *DDC1155Service) BurnBatch(opts *bind.TransactOpts, owner string, ddcIds []int64) (signedTx *types.Transaction, err error)

BurnBatch @Description: DDC拥用者可以通过调用该方法进行DDC的批量销毁 @receiver d @param opts opts.Price和opts.Signer为空时,默认使用初始化client时set的price和signer @param owner 拥有者账户 @param ddcIds 要销毁的DDC的唯一标识的集合 @return signedTx 签名好的交易 @return error

func (*DDC1155Service) DdcURI

func (d *DDC1155Service) DdcURI(ddcID int64) (ddcURI string, err error)

DdcURI @Description: 运营方、平台方以及终端用户可以通过调用该方法查询当前DDC的资源标识符 @receiver d @param ddcID DDC唯一标识符 @return string DDC资源标识符 @return error

func (*DDC1155Service) IsApprovedForAll

func (d *DDC1155Service) IsApprovedForAll(owner, operator string) (bool, error)

IsApprovedForAll @Description: 运营方、平台方或终端用户可以通过调用该方法进行账户授权查询 @receiver d @param owner 拥有者账户 @param operator 授权者账户 @return bool 授权标识 @return error

func (*DDC1155Service) SafeBatchTransferFrom

func (d *DDC1155Service) SafeBatchTransferFrom(opts *bind.TransactOpts, from, to string, ddcInfo map[int64]int64, data []byte) (signedTx *types.Transaction, err error)

SafeBatchTransferFrom @Description: DDC拥有者或DDC授权者可以通过调用该方法进行DDC的批量转移 @receiver d @param opts opts.Price和opts.Signer为空时,默认使用初始化client时set的price和signer @param from 拥有者账户 @param to 接收者账户 @param ddcInfo 要转移的ddc集合(ddcID->amount) @param data 附加数据 @return signedTx 签名好的交易 @return error

func (*DDC1155Service) SafeMint

func (d *DDC1155Service) SafeMint(opts *bind.TransactOpts, to string, amount int64, ddcURI string, data []byte) (signedTx *types.Transaction, err error)

SafeMint @Description: 平台方或终端用户可以通过调用该方法进行DDC的安全生成 @receiver d @param opts opts.Price和opts.Signer为空时,默认使用初始化client时set的price和signer @param to 接收者账户 @param amount DDC数量 @param ddcURI DDC资源 @param data 附加数据 @return signedTx 签名好的交易 @return error

func (*DDC1155Service) SafeMintBatch

func (d *DDC1155Service) SafeMintBatch(opts *bind.TransactOpts, to string, amounts []*big.Int, ddcURIs []string, data []byte) (signedTx *types.Transaction, err error)

SafeMintBatch @Description: 平台方或终端用户可以通过调用该方法进行DDC的批量安全生成 @receiver d @param opts opts.Price和opts.Signer为空时,默认使用初始化client时set的price和signer @param to 接收者账户 @param amounts DDC数量集合 @param ddcURIs 对应的DDC资源链接集合 @param data 附加数据 @return signedTx 交易结果 @return err

func (*DDC1155Service) SafeTransferFrom

func (d *DDC1155Service) SafeTransferFrom(opts *bind.TransactOpts, from, to string, ddcID, amount int64, data []byte) (signedTx *types.Transaction, err error)

SafeTransferFrom @Description: DDC拥有者或DDC授权者可以通过调用该方法进行DDC的转移 @receiver d @param opts opts.Price和opts.Signer为空时,默认使用初始化client时set的price和signer @param from 拥有者账户 @param to 接收者账户 @param ddcID DDC唯一标识 @param amount 需要转移的DDC数量 @param data 附加数据 @return signedTx 签名好的交易 @return error

func (*DDC1155Service) SetApprovalForAll

func (d *DDC1155Service) SetApprovalForAll(opts *bind.TransactOpts, operator string, approved bool) (signedTx *types.Transaction, err error)

SetApprovalForAll @Description: DDC拥有者可以通过调用该方法进行账户授权,发起者需要是DDC的拥有者 @receiver d @param opts opts.Price和opts.Signer为空时,默认使用初始化client时set的price和signer @param operator 授权者账户 @param approved 授权标识 @return signedTx 签名好的交易 @return error

func (*DDC1155Service) SetURI

func (d *DDC1155Service) SetURI(opts *bind.TransactOpts, owner string, ddcID int64, ddcURI string) (signedTx *types.Transaction, err error)

SetURI @Description: DDC拥有者或DDC授权者通过调用该方法对DDC的资源标识符进行设置 @receiver d @param opts opts.Price和opts.Signer为空时,默认使用初始化client时set的price和signer @param owner DDC拥有者 @param ddcID DDC唯一标识 @param ddcURI DDC资源标识符 @return signedTx 签名好的交易 @return error

type DDC721Service

type DDC721Service struct {
	Base
}

func NewDDC721Service

func NewDDC721Service() *DDC721Service

func (*DDC721Service) Approve

func (d *DDC721Service) Approve(opts *bind.TransactOpts, to string, ddcID int64) (signedTx *types.Transaction, err error)

Approve @Description: DDC拥有者可以通过调用该方法进行DDC的授权,发起者需要是DDC的拥有者 @receiver d @param opts opts.Price和opts.Signer为空时,默认使用初始化client时set的price和signer @param to 授权者账户 @param ddcID DDC唯一标识 @return signedTx 签名好的交易 @return error

func (*DDC721Service) BalanceOf

func (d *DDC721Service) BalanceOf(owner string) (uint64, error)

BalanceOf @Description: 运营方、平台方以及终端用户可以通过调用该方法进行查询当前账户拥有的DDC的数量 @receiver d @param owner 拥有者账户 @return uint64 ddc的数量 @return error

func (*DDC721Service) Burn

func (d *DDC721Service) Burn(opts *bind.TransactOpts, ddcID int64) (signedTx *types.Transaction, err error)

Burn @Description: DDC拥有者或DDC授权者可以通过调用该方法进行DDC的销毁 @receiver d @param opts opts.Price和opts.Signer为空时,默认使用初始化client时set的price和signer @param ddcID DDC唯一标识 @return signedTx 签名好的交易 @return error

func (*DDC721Service) DdcURI

func (d *DDC721Service) DdcURI(ddcID int64) (string, error)

DdcURI @Description: 运营方、平台方以及终端用户可以通过调用该方法查询当前DDC的资源标识符 @receiver d @param ddcID DDC唯一标识符 @return string DDC资源标识符 @return error

func (*DDC721Service) GetApprove

func (d *DDC721Service) GetApprove(ddcID int64) (string, error)

GetApprove @Description: 运营方、平台方或终端用户都可以通过调用该方法查询DDC的授权情况 @receiver d @param ddcID DDC唯一标识 @return string 授权的账户 @return error

func (*DDC721Service) IsApprovedForAll

func (d *DDC721Service) IsApprovedForAll(owner, operator string) (bool, error)

IsApprovedForAll @Description: 运营方、平台方或终端用户可以通过调用该方法进行账户授权查询 @receiver d @param owner 拥有者账户 @param operator 授权者账户 @return bool 授权标识 @return error

func (*DDC721Service) Mint

func (d *DDC721Service) Mint(opts *bind.TransactOpts, to, ddcURI string) (signedTx *types.Transaction, err error)

Mint @Description: 平台方或终端用户可以通过调用该方法进行DDC的生成 @receiver d @param opts opts.Price和opts.Signer为空时,默认使用初始化client时set的price和signer @param to 接收者账户 @param ddcURI DDC资源标识符 @return signedTx 签名好的交易 @return error

func (*DDC721Service) Name

func (d *DDC721Service) Name() (string, error)

Name @Description: 营方、平台方以及终端用户可以通过调用该方法查询当前DDC的名称 @receiver d @return string DDC运营方名称 @return error

func (*DDC721Service) OwnerOf

func (d *DDC721Service) OwnerOf(ddcID int64) (string, error)

OwnerOf @Description: 运营方、平台方以及终端用户可以通过调用该方法查询当前DDC的拥有者 @receiver d @param ddcID ddc唯一标识 @return string 拥有者账户 @return error

func (*DDC721Service) SafeMint

func (d *DDC721Service) SafeMint(opts *bind.TransactOpts, to, ddcURI string, data []byte) (signedTx *types.Transaction, err error)

SafeMint @Description: 平台方或终端用户可以通过调用该方法进行DDC的安全生成 @receiver d @param opts opts.Price和opts.Signer为空时,默认使用初始化client时set的price和signer @param to 接收者账户 @param ddcURI DDC资源标识符 @param data 附加数据 @return signedTx 签名好的交易 @return error

func (*DDC721Service) SafeTransferFrom

func (d *DDC721Service) SafeTransferFrom(opts *bind.TransactOpts, from, to string, ddcID int64, data []byte) (signedTx *types.Transaction, err error)

SafeTransferFrom @Description: DDC的拥有者或授权者可以通过调用该方法进行DDC的转移 @receiver d @param opts opts.Price和opts.Signer为空时,默认使用初始化client时set的price和signer @param from 拥有者账户 @param to 接收者账户 @param ddcID DDC唯一标识 @param data 附加数据 @return signedTx 签名好的交易 @return error

func (*DDC721Service) SetApprovalForAll

func (d *DDC721Service) SetApprovalForAll(opts *bind.TransactOpts, operator string, approved bool) (signedTx *types.Transaction, err error)

SetApprovalForAll @Description: DDC拥有者可以通过调用该方法进行账户授权,发起者需要是DDC的拥有者 @receiver d @param opts opts.Price和opts.Signer为空时,默认使用初始化client时set的price和signer @param operator 授权者账户 @param approved 授权标识 @return signedTx 签名好的交易 @return error

func (*DDC721Service) SetURI

func (d *DDC721Service) SetURI(opts *bind.TransactOpts, ddcID int64, ddcURI string) (signedTx *types.Transaction, err error)

SetURI @Description: DDC拥有者或DDC授权者通过调用该方法对DDC的资源标识符进行设置 @receiver d @param opts opts.Price和opts.Signer为空时,默认使用初始化client时set的price和signer @param ddcID DDC唯一标识 @param ddcURI DDC资源标识符 @return signedTx 签名好的交易 @return err

func (*DDC721Service) Symbol

func (d *DDC721Service) Symbol() (string, error)

Symbol @Description: 运营方、平台方以及终端用户可以通过调用该方法查询当前DDC的符号标识 @receiver d @return string DDC运营方符号 @return error

func (*DDC721Service) TransferFrom

func (d *DDC721Service) TransferFrom(opts *bind.TransactOpts, from, to string, ddcID int64) (signedTx *types.Transaction, err error)

TransferFrom @Description: DDC拥有者或授权者可以通过调用该方法进行DDC的转移 @receiver d @param opts opts.Price和opts.Signer为空时,默认使用初始化client时set的price和signer @param from 拥有者账户 @param to 接收者账户 @param ddcID ddc唯一标识 @return signedTx 签名好的交易 @return error

type TxService

type TxService struct {
}

func (TxService) GetTimeByTxHash

func (t TxService) GetTimeByTxHash(txHash string) (uint64, error)

GetTimeByTxHash @Description: 通过txHash查询所在块的时间 @receiver t @param txHash 交易哈希 @return uint64 所在块的时间 @return error

func (TxService) GetTxByHash

func (t TxService) GetTxByHash(txHash string) (*types.Transaction, bool, error)

GetTxByHash @Description: 运营方或平台方根据交易哈希对交易信息进行查询 @receiver t @param txHash: 交易哈希 @return *types.Transaction: 交易信息 @return bool: pending状态 @return error

func (TxService) GetTxReceipt

func (t TxService) GetTxReceipt(txHash string) (*types.Receipt, error)

GetTxReceipt @Description: 运营方或平台方根据交易哈希对交易回执信息进行查询。 @receiver t @param txHash: 交易哈希 @return string: 交易回执 @return error

func (TxService) GetTxStatus

func (t TxService) GetTxStatus(txHash string) (bool, error)

GetTxStatus @Description: 运营方或平台方根据交易哈希查询交易状态是否成功 @receiver t @param txHash: 交易哈希 @return bool:交易是否成功 @return error

Jump to

Keyboard shortcuts

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