Documentation
¶
Overview ¶
Package types 区块扫描相关数据类型
Package types 智能合约相关数据类型(与 decoder.SmartContractDecoder 配套)
Package types 多主链适配器核心数据类型(交易、账户、错误等)
Index ¶
- Constants
- type ABIInfo
- type AdapterError
- type Address
- type AssetsAccount
- type Balance
- type BalanceModelType
- type BlockHeader
- type BlockScanResult
- type BlockchainSyncStatus
- type Coin
- type ContractReceiptItem
- type ExtractDataItem
- type FeesSupportAccount
- type KeySignature
- type PendingSignTx
- type RawTransaction
- type RawTransactionWithError
- type Recharge
- type ScanTarget
- type ScanTargetParam
- type ScanTargetResult
- type SmartContract
- type SmartContractCallResult
- type SmartContractEvent
- type SmartContractRawTransaction
- type SmartContractReceipt
- type SummaryRawTransaction
- type SymbolInfo
- type SymbolInfoBase
- type TokenBalance
- type Transaction
- type TxExtractData
- type TxInput
- type TxOutPut
- type TxTransferExpected
- type TxVerifyExpected
- type TxVerifyMatchResult
- type TxVerifyResult
- type UnscanRecord
Constants ¶
const ( ScanTargetTypeAccountAddress = 0 // ScanTarget = 账户地址 ScanTargetTypeAccountAlias = 1 // ScanTarget = 账户别名 ScanTargetTypeContractAddress = 2 // ScanTarget = 合约地址 ScanTargetTypeContractAlias = 3 // ScanTarget = 合约别名 ScanTargetTypeAddressPubKey = 4 // ScanTarget = 地址公钥 ScanTargetTypeAddressMemo = 5 // ScanTarget = 地址备注 )
扫描目标类型:ScanTargetParam.ScanTargetType 决定 ScanTarget 字段的含义
const ( TxRawTypeHex = 0 // hex 字符串 TxRawTypeJSON = 1 // json 字符串 TxRawTypeBase64 = 2 // base64 字符串 )
TxRawType 智能合约原始交易 Raw 字段类型
const ( SmartContractCallResultStatusFail = 0 SmartContractCallResultStatusSuccess = 1 )
SmartContractCallResult 状态常量
const ( ErrInsufficientBalanceOfAccount = 2001 ErrInsufficientBalanceOfAddress = 2002 ErrInsufficientFees = 2003 ErrDustLimit = 2004 ErrCreateRawTransactionFailed = 2005 ErrSignRawTransactionFailed = 2006 ErrVerifyRawTransactionFailed = 2007 ErrSubmitRawTransactionFailed = 2008 ErrInsufficientTokenBalanceOfAddress = 2009 )
错误码分区:2xxx 交易、3xxx 账户/地址、4xxx 网络、9xxx 系统;AdapterError 为适配器统一错误类型。 交易相关错误码(2xxx)
const ( ErrAccountNotFound = 3001 ErrAddressNotFound = 3002 ErrContractNotFound = 3003 ErrAddressEncodeFailed = 3004 ErrAddressDecodeFailed = 3006 ErrNonceInvalid = 3007 )
账户/地址/合约等错误码(3xxx)
const ( ErrCallFullNodeAPIFailed = 4001 ErrNetworkRequestFailed = 4002 )
网络/节点错误码(4xxx)
const ( ErrUnknownException = 9001 ErrSystemException = 9002 )
系统/未知错误码(9xxx)
const ( TxStatusSuccess = "1" TxStatusFail = "0" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ABIInfo ¶
type ABIInfo struct {
Address string `json:"address"`
ABI interface{} `json:"abi"`
}
ABIInfo 合约 ABI 信息
func (ABIInfo) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (ABIInfo) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*ABIInfo) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*ABIInfo) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type AdapterError ¶
AdapterError 适配器统一错误类型,带 Code 与 Msg,可序列化为 JSON。
func ConvertError ¶
func ConvertError(err error) *AdapterError
func Errorf ¶
func Errorf(code uint64, format string, a ...interface{}) *AdapterError
func NewError ¶
func NewError(code uint64, text string) *AdapterError
func (*AdapterError) Error ¶
func (e *AdapterError) Error() string
func (*AdapterError) MarshalJSON ¶
func (e *AdapterError) MarshalJSON() ([]byte, error)
func (*AdapterError) UnmarshalJSON ¶
func (e *AdapterError) UnmarshalJSON(b []byte) error
type Address ¶
type Address struct {
ID int64 `json:"id"`
AccountID string `json:"accountID"`
Address string `json:"address"`
PublicKey string `json:"publicKey"`
Symbol string `json:"symbol"`
Balance string `json:"balance"`
Index uint64 `json:"index"`
HDPath string `json:"hdPath"`
ExtParam string `json:"extParam"`
}
Address 地址
func (Address) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Address) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Address) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Address) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type AssetsAccount ¶
type AssetsAccount struct {
ID int64 `json:"id"`
WalletID string `json:"walletID"`
Alias string `json:"alias"`
AccountID string `json:"accountID"`
Index uint64 `json:"index"`
HDPath string `json:"hdPath"`
PublicKey string `json:"publicKey"`
OwnerKeys []string `json:"ownerKeys"`
Required uint64 `json:"required"`
Symbol string `json:"symbol"`
Balance string `json:"balance"`
ExtParam string `json:"extParam"`
}
AssetsAccount 资产账户
func (AssetsAccount) MarshalEasyJSON ¶
func (v AssetsAccount) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (AssetsAccount) MarshalJSON ¶
func (v AssetsAccount) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*AssetsAccount) UnmarshalEasyJSON ¶
func (v *AssetsAccount) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*AssetsAccount) UnmarshalJSON ¶
func (v *AssetsAccount) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Balance ¶
type Balance struct {
Symbol string `json:"symbol"`
AccountID string `json:"accountID"`
Address string `json:"address"`
ConfirmBalance string `json:"confirmBalance"`
UnconfirmBalance string `json:"unconfirmBalance"`
Balance string `json:"balance"`
}
Balance 地址余额
func (Balance) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Balance) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Balance) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Balance) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type BalanceModelType ¶
type BalanceModelType uint32
BalanceModelType 余额模型(按地址或按账户)。
const ( BalanceModelTypeAddress BalanceModelType = 0 BalanceModelTypeAccount BalanceModelType = 1 )
type BlockHeader ¶
type BlockHeader struct {
Hash string `json:"hash"`
Confirmations uint64 `json:"confirmations"`
Merkleroot string `json:"merkleroot"`
Previousblockhash string `json:"previousblockhash"`
Height uint64 `json:"height"`
Version uint64 `json:"version"`
Time uint64 `json:"time"`
Fork bool `json:"fork"`
Symbol string `json:"symbol"`
}
BlockHeader 区块头
func (BlockHeader) MarshalEasyJSON ¶
func (v BlockHeader) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (BlockHeader) MarshalJSON ¶
func (v BlockHeader) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*BlockHeader) UnmarshalEasyJSON ¶
func (v *BlockHeader) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*BlockHeader) UnmarshalJSON ¶
func (v *BlockHeader) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type BlockScanResult ¶
type BlockScanResult struct {
Symbol string `json:"symbol"`
Height uint64 `json:"height"`
BlockHash string `json:"blockHash"`
// NetworkBlockHeight 为本次扫描时刻的链上最新高度(eth_blockNumber 等),便于业务侧观测进度与告警。
NetworkBlockHeight uint64 `json:"networkBlockHeight"`
Success bool `json:"success"`
ErrorReason string `json:"errorReason"`
TxTotal uint64 `json:"txTotal"`
TxFailed uint64 `json:"txFailed"`
ExtractedTxs uint64 `json:"extractedTxs"`
// FailedTxIDs 记录部分失败交易 ID(截断),用于快速定位问题;完整失败明细由外部系统自行落库。
FailedTxIDs []string `json:"failedTxIDs"`
// Header 为本次扫描对应的区块头(若能成功获取区块)。
Header *BlockHeader `json:"header"`
// ExtractData 为交易提取结果列表(按 SourceKey 聚合,仅当实现方开启交易提取时填充)。
ExtractData []*ExtractDataItem `json:"extractData"`
// ContractReceipts 为合约回执列表(key 字段可用于标识,如 contractAddr:logIndex)。
ContractReceipts []*ContractReceiptItem `json:"contractReceipts"`
// Once 标记本次扫描是否为“插队/一次性”扫描(由 ScanBlockPrioritize 触发)。
// 业务方可据此区分:true=插队扫描结果,false=主线 RunScanLoop 常规扫描结果。
Once bool `json:"once"`
}
BlockScanResult 单次按高度扫块的结果摘要(供外部系统维护游标、重试与告警)。 设计目标:扫块器不依赖内部存储(BlockchainDAI 可选),外部系统可依据该结果决定是否推进高度或重扫。 注意:不同链实现可按能力填充 TxTotal/TxFailed 等字段;最低要求是 Height + Success + ErrorReason。
func (BlockScanResult) MarshalEasyJSON ¶
func (v BlockScanResult) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (BlockScanResult) MarshalJSON ¶
func (v BlockScanResult) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*BlockScanResult) UnmarshalEasyJSON ¶
func (v *BlockScanResult) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*BlockScanResult) UnmarshalJSON ¶
func (v *BlockScanResult) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type BlockchainSyncStatus ¶
type BlockchainSyncStatus struct {
NetworkBlockHeight uint64
CurrentBlockHeight uint64
Syncing bool
}
BlockchainSyncStatus 链同步状态
func (BlockchainSyncStatus) MarshalEasyJSON ¶
func (v BlockchainSyncStatus) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (BlockchainSyncStatus) MarshalJSON ¶
func (v BlockchainSyncStatus) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*BlockchainSyncStatus) UnmarshalEasyJSON ¶
func (v *BlockchainSyncStatus) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*BlockchainSyncStatus) UnmarshalJSON ¶
func (v *BlockchainSyncStatus) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Coin ¶
type Coin struct {
Symbol string `json:"symbol"`
IsContract bool `json:"isContract"`
Contract SmartContract `json:"contract"`
}
Coin 币种/链标识
func (Coin) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Coin) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Coin) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Coin) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type ContractReceiptItem ¶
type ContractReceiptItem struct {
Key string `json:"key"`
Receipt *SmartContractReceipt `json:"receipt"`
}
ContractReceiptItem 合约回执项。
func (ContractReceiptItem) MarshalEasyJSON ¶
func (v ContractReceiptItem) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (ContractReceiptItem) MarshalJSON ¶
func (v ContractReceiptItem) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*ContractReceiptItem) UnmarshalEasyJSON ¶
func (v *ContractReceiptItem) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*ContractReceiptItem) UnmarshalJSON ¶
func (v *ContractReceiptItem) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type ExtractDataItem ¶
type ExtractDataItem struct {
SourceKey string `json:"sourceKey"`
Data []*TxExtractData `json:"data"`
}
ExtractDataItem 按 SourceKey 聚合的交易提取结果项。
func (ExtractDataItem) MarshalEasyJSON ¶
func (v ExtractDataItem) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (ExtractDataItem) MarshalJSON ¶
func (v ExtractDataItem) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*ExtractDataItem) UnmarshalEasyJSON ¶
func (v *ExtractDataItem) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*ExtractDataItem) UnmarshalJSON ¶
func (v *ExtractDataItem) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type FeesSupportAccount ¶
type FeesSupportAccount struct {
AccountID string `json:"accountID"`
FixSupportAmount string `json:"fixSupportAmount"`
FeesSupportScale string `json:"feesScale"`
}
FeesSupportAccount 手续费支持账户
func (FeesSupportAccount) MarshalEasyJSON ¶
func (v FeesSupportAccount) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (FeesSupportAccount) MarshalJSON ¶
func (v FeesSupportAccount) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*FeesSupportAccount) UnmarshalEasyJSON ¶
func (v *FeesSupportAccount) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*FeesSupportAccount) UnmarshalJSON ¶
func (v *FeesSupportAccount) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type KeySignature ¶
type KeySignature struct {
EccType uint32 `json:"eccType"` // 1.ecdsa 2.ed25519
Nonce string `json:"nonce"`
Address *Address `json:"address"`
Signature string `json:"signed"`
Message string `json:"msg"`
RSV bool `json:"rsv"`
}
KeySignature 单笔签名
func (KeySignature) MarshalEasyJSON ¶
func (v KeySignature) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (KeySignature) MarshalJSON ¶
func (v KeySignature) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*KeySignature) UnmarshalEasyJSON ¶
func (v *KeySignature) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*KeySignature) UnmarshalJSON ¶
func (v *KeySignature) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type PendingSignTx ¶
type PendingSignTx struct {
Sid string `json:"sid"`
Data string `json:"data"` // 原始交易单 JSON,全程不变
DataSign string `json:"dataSign"` // 构建时确定,保证 Data 不被篡改
TradeSign string `json:"tradeSign"` // 构建时确定,保证 Data 不被篡改
Code string `json:"code"`
Message string `json:"message"`
SignerList map[string]string `json:"signerList"` // MPC 签名后填充,再提交广播
}
PendingSignTx 待签名交易单:构建后产出,广播时入参。 构建成功即确定 Data(原始交易单 JSON,贯穿流程不变,仅反序列化读参)、DataSign、TradeSign(用于保证 Data 不被篡改); 随后由 MPC 签名填充 SignerList,再提交广播。
func (PendingSignTx) MarshalEasyJSON ¶
func (v PendingSignTx) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (PendingSignTx) MarshalJSON ¶
func (v PendingSignTx) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*PendingSignTx) UnmarshalEasyJSON ¶
func (v *PendingSignTx) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*PendingSignTx) UnmarshalJSON ¶
func (v *PendingSignTx) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type RawTransaction ¶
type RawTransaction struct {
Coin Coin `json:"coin"`
TxID string `json:"txID"`
RawHex string `json:"rawHex"`
FeeRate string `json:"feeRate"`
To map[string]string `json:"to"`
Account *AssetsAccount `json:"account"`
Signatures map[string][]*KeySignature `json:"sigParts"`
Required uint64 `json:"reqSigs"`
IsBuilt bool `json:"isBuilt"`
IsCompleted bool `json:"isComplete"`
IsSubmit bool `json:"isSubmit"`
Change *Address `json:"change"`
ExtParam map[string]string `json:"extParam"`
Sid string `json:"sid"`
CreateTime int64 `json:"createTime"`
CreateNonce string `json:"createNonce"`
TxType int64 `json:"txType"`
Fees string `json:"fees"`
TxAmount string `json:"txAmount"`
TxFrom []string `json:"txFrom"`
TxTo []string `json:"txTo"`
}
RawTransaction 原始交易单
func (RawTransaction) MarshalEasyJSON ¶
func (v RawTransaction) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (RawTransaction) MarshalJSON ¶
func (v RawTransaction) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*RawTransaction) UnmarshalEasyJSON ¶
func (v *RawTransaction) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*RawTransaction) UnmarshalJSON ¶
func (v *RawTransaction) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type RawTransactionWithError ¶
type RawTransactionWithError struct {
RawTx *RawTransaction `json:"rawTx"`
Error *AdapterError `json:"error"`
}
RawTransactionWithError 带错误的原始交易(汇总场景)
func (RawTransactionWithError) MarshalEasyJSON ¶
func (v RawTransactionWithError) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (RawTransactionWithError) MarshalJSON ¶
func (v RawTransactionWithError) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*RawTransactionWithError) UnmarshalEasyJSON ¶
func (v *RawTransactionWithError) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*RawTransactionWithError) UnmarshalJSON ¶
func (v *RawTransactionWithError) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Recharge ¶
type Recharge struct {
Sid string `json:"sid"`
TxID string `json:"txid"`
AccountID string `json:"accountID"`
Address string `json:"address"`
Symbol string `json:"symbol"`
Coin Coin `json:"coin"`
Amount string `json:"amount"`
Confirm int64 `json:"confirm"`
BlockHash string `json:"blockHash"`
BlockHeight uint64 `json:"blockHeight"`
Index uint64 `json:"index"`
CreateAt int64 `json:"createdAt"`
TxType uint64 `json:"txType"`
}
Recharge 充值/到账记录(用于 TxInput/TxOutPut)
func (Recharge) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Recharge) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Recharge) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Recharge) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type ScanTarget ¶
type ScanTarget struct {
Address string
PublicKey string
Alias string
Symbol string
BalanceModelType BalanceModelType
}
ScanTarget 扫描目标(V1,已废弃兼容用)
func (ScanTarget) MarshalEasyJSON ¶
func (v ScanTarget) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (ScanTarget) MarshalJSON ¶
func (v ScanTarget) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*ScanTarget) UnmarshalEasyJSON ¶
func (v *ScanTarget) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*ScanTarget) UnmarshalJSON ¶
func (v *ScanTarget) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type ScanTargetParam ¶
type ScanTargetParam struct {
ScanTarget string // 根据 ScanTargetType 填:地址、别名、公钥或备注
Symbol string
ScanTargetType uint64 // 见 ScanTargetType* 常量
}
ScanTargetParam 扫描目标参数:由 ScanTargetType 区分 ScanTarget 是 address / alias / 公钥 / 备注等
func NewScanTargetParamForAddress ¶
func NewScanTargetParamForAddress(symbol, address string) ScanTargetParam
NewScanTargetParamForAddress 用账户地址构造扫描目标参数
func NewScanTargetParamForAlias ¶
func NewScanTargetParamForAlias(symbol, alias string) ScanTargetParam
NewScanTargetParamForAlias 用账户别名构造扫描目标参数
func (ScanTargetParam) MarshalEasyJSON ¶
func (v ScanTargetParam) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (ScanTargetParam) MarshalJSON ¶
func (v ScanTargetParam) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*ScanTargetParam) UnmarshalEasyJSON ¶
func (v *ScanTargetParam) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*ScanTargetParam) UnmarshalJSON ¶
func (v *ScanTargetParam) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type ScanTargetResult ¶
ScanTargetResult 扫描目标结果
func (ScanTargetResult) MarshalEasyJSON ¶
func (v ScanTargetResult) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (ScanTargetResult) MarshalJSON ¶
func (v ScanTargetResult) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*ScanTargetResult) UnmarshalEasyJSON ¶
func (v *ScanTargetResult) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*ScanTargetResult) UnmarshalJSON ¶
func (v *ScanTargetResult) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type SmartContract ¶
type SmartContract struct {
Symbol string `json:"symbol"`
Address string `json:"address"`
Token string `json:"token"`
Protocol string `json:"protocol"`
Name string `json:"name"`
Decimals uint64 `json:"decimals"`
}
SmartContract 智能合约/代币信息
func (SmartContract) MarshalEasyJSON ¶
func (v SmartContract) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (SmartContract) MarshalJSON ¶
func (v SmartContract) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*SmartContract) UnmarshalEasyJSON ¶
func (v *SmartContract) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*SmartContract) UnmarshalJSON ¶
func (v *SmartContract) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type SmartContractCallResult ¶
type SmartContractCallResult struct {
Method string `json:"method"`
Value string `json:"value"`
RawHex string `json:"rawHex"`
Status uint64 `json:"status"`
Exception string `json:"exception"`
}
SmartContractCallResult 合约只读调用结果(不产生链上交易)
func (SmartContractCallResult) MarshalEasyJSON ¶
func (v SmartContractCallResult) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (SmartContractCallResult) MarshalJSON ¶
func (v SmartContractCallResult) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*SmartContractCallResult) UnmarshalEasyJSON ¶
func (v *SmartContractCallResult) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*SmartContractCallResult) UnmarshalJSON ¶
func (v *SmartContractCallResult) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type SmartContractEvent ¶
type SmartContractEvent struct {
Contract *SmartContract `json:"contract"`
Event string `json:"event"`
Value string `json:"value"`
}
SmartContractEvent 合约事件
func (SmartContractEvent) MarshalEasyJSON ¶
func (v SmartContractEvent) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (SmartContractEvent) MarshalJSON ¶
func (v SmartContractEvent) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*SmartContractEvent) UnmarshalEasyJSON ¶
func (v *SmartContractEvent) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*SmartContractEvent) UnmarshalJSON ¶
func (v *SmartContractEvent) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type SmartContractRawTransaction ¶
type SmartContractRawTransaction struct {
Coin Coin `json:"coin"`
TxID string `json:"txID"`
Sid string `json:"sid"`
Account *AssetsAccount `json:"account"`
Signatures map[string][]*KeySignature `json:"signatures"`
IsBuilt bool `json:"isBuilt"`
IsCompleted bool `json:"isComplete"`
IsSubmit bool `json:"isSubmit"`
Raw string `json:"raw"`
RawType uint64 `json:"rawType"`
ABIParam []string `json:"abiParam"`
Value string `json:"value"`
FeeRate string `json:"feeRate"`
Fees string `json:"fees"`
TxFrom string `json:"txFrom"`
TxTo string `json:"txTo"`
AwaitResult bool `json:"awaitResult"`
AwaitTimeout uint64 `json:"awaitTimeout"`
}
SmartContractRawTransaction 智能合约原始交易单
func (SmartContractRawTransaction) MarshalEasyJSON ¶
func (v SmartContractRawTransaction) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (SmartContractRawTransaction) MarshalJSON ¶
func (v SmartContractRawTransaction) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*SmartContractRawTransaction) UnmarshalEasyJSON ¶
func (v *SmartContractRawTransaction) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*SmartContractRawTransaction) UnmarshalJSON ¶
func (v *SmartContractRawTransaction) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type SmartContractReceipt ¶
type SmartContractReceipt struct {
Coin Coin `json:"coin"`
WxID string `json:"wxid"`
TxID string `json:"txid"`
From string `json:"from"`
To string `json:"to"`
Value string `json:"value"`
Fees string `json:"fees"`
RawReceipt string `json:"rawReceipt"`
Events []*SmartContractEvent `json:"events"`
BlockHash string `json:"blockHash"`
BlockHeight uint64 `json:"blockHeight"`
ConfirmTime int64 `json:"confirmTime"`
Status string `json:"status"`
Reason string `json:"reason"`
// OutputIndex 表示该回执对应的输出序号,语义随场景变化:
// - EVM 链:表示事件日志索引(logIndex)
// - UTXO 链:表示交易输出索引(vout)
// 用于精确定位同一 tx 内的多笔记录。
OutputIndex int64 `json:"outputIndex"`
// ExtParam 为键值对扩展字段,便于结构化存储额外信息(如 contract_creation 等)。
ExtParam map[string]string `json:"extParam"`
}
SmartContractReceipt 合约交易回执
func (SmartContractReceipt) MarshalEasyJSON ¶
func (v SmartContractReceipt) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (SmartContractReceipt) MarshalJSON ¶
func (v SmartContractReceipt) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*SmartContractReceipt) UnmarshalEasyJSON ¶
func (v *SmartContractReceipt) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*SmartContractReceipt) UnmarshalJSON ¶
func (v *SmartContractReceipt) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type SummaryRawTransaction ¶
type SummaryRawTransaction struct {
Sid string `json:"sid"`
Coin Coin `json:"coin"`
FeeRate string `json:"feeRate"`
SummaryAddress string `json:"summaryAddress"`
MinTransfer string `json:"minTransfer"`
RetainedBalance string `json:"retainedBalance"`
Account *AssetsAccount `json:"account"`
AddressStartIndex int64 `json:"addressStartIndex"`
AddressLimit int64 `json:"addressLimit"`
Confirms uint64 `json:"confirms"`
FeesSupportAccount *FeesSupportAccount `json:"feesSupportAccount"`
ExtParam string `json:"extParam"`
}
SummaryRawTransaction 汇总交易参数
func (SummaryRawTransaction) MarshalEasyJSON ¶
func (v SummaryRawTransaction) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (SummaryRawTransaction) MarshalJSON ¶
func (v SummaryRawTransaction) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*SummaryRawTransaction) UnmarshalEasyJSON ¶
func (v *SummaryRawTransaction) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*SummaryRawTransaction) UnmarshalJSON ¶
func (v *SummaryRawTransaction) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type SymbolInfo ¶
type SymbolInfo interface {
Symbol() string
Decimal() int32
CurveType() uint32
FullName() string
BalanceModelType() BalanceModelType
}
SymbolInfo 链/币种信息接口(Symbol、Decimal、CurveType、FullName、BalanceModelType)。
type SymbolInfoBase ¶
type SymbolInfoBase struct{}
SymbolInfoBase SymbolInfo 的默认空实现,供 ChainAdapterBase 嵌入。
func (SymbolInfoBase) BalanceModelType ¶
func (SymbolInfoBase) BalanceModelType() BalanceModelType
func (SymbolInfoBase) CurveType ¶
func (SymbolInfoBase) CurveType() uint32
func (SymbolInfoBase) Decimal ¶
func (SymbolInfoBase) Decimal() int32
func (SymbolInfoBase) FullName ¶
func (SymbolInfoBase) FullName() string
func (SymbolInfoBase) Symbol ¶
func (SymbolInfoBase) Symbol() string
type TokenBalance ¶
type TokenBalance struct {
Contract *SmartContract `json:"contract"`
Balance *Balance `json:"balance"`
}
TokenBalance 代币余额(合约 + 余额信息)
func (TokenBalance) MarshalEasyJSON ¶
func (v TokenBalance) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (TokenBalance) MarshalJSON ¶
func (v TokenBalance) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*TokenBalance) UnmarshalEasyJSON ¶
func (v *TokenBalance) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*TokenBalance) UnmarshalJSON ¶
func (v *TokenBalance) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Transaction ¶
type Transaction struct {
ID string `json:"id"`
WxID string `json:"wxid"`
TxID string `json:"txid"`
AccountID string `json:"accountID"`
Coin Coin `json:"coin"`
// FromAddr 发送方地址列表,与 FromAmt 一一对应
FromAddr []string `json:"fromAddr"`
// FromAmt 发送方金额列表,与 FromAddr 一一对应
FromAmt []string `json:"fromAmt"`
// ToAddr 接收方地址列表,与 ToAmt 一一对应
ToAddr []string `json:"toAddr"`
// ToAmt 接收方金额列表,与 ToAddr 一一对应
ToAmt []string `json:"toAmt"`
Amount string `json:"amount"`
Decimal int32 `json:"decimal"`
TxType uint64 `json:"txType"`
TxAction string `json:"txAction"`
Confirm int64 `json:"confirm"`
BlockHash string `json:"blockHash"`
BlockHeight uint64 `json:"blockHeight"`
Fees string `json:"fees"`
SubmitTime int64 `json:"submitTime"`
ConfirmTime int64 `json:"confirmTime"`
Status string `json:"status"`
Reason string `json:"reason"`
// OutputIndex 表示该 Transaction 对应的输出序号,语义随链类型变化:
// - EVM 链:表示事件日志索引(logIndex),>=0 为合约事件,-1 为主币转账,-2 为手续费记录
// - UTXO 链(BTC 等):表示交易输出索引(vout)
// 用于精确定位同一 tx 内的多笔记录,确保业务层唯一性。
OutputIndex int64 `json:"outputIndex"`
// FeeType 用于标识该记录是否为手续费类记录(如 "gas")。
// 空值表示该记录为普通转账类记录。
FeeType string `json:"feeType"`
// ExtParam 为键值对扩展字段,便于结构化存储额外信息(如 contract_creation 等)。
ExtParam map[string]string `json:"extParam"`
}
Transaction 广播后的交易结果
func (Transaction) MarshalEasyJSON ¶
func (v Transaction) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (Transaction) MarshalJSON ¶
func (v Transaction) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*Transaction) UnmarshalEasyJSON ¶
func (v *Transaction) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Transaction) UnmarshalJSON ¶
func (v *Transaction) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type TxExtractData ¶
type TxExtractData struct {
TxInputs []*TxInput `json:"txInputs"`
TxOutputs []*TxOutPut `json:"txOutputs"`
Transaction *Transaction `json:"transaction"`
}
TxExtractData 区块扫描后的交易提取结果
func (TxExtractData) MarshalEasyJSON ¶
func (v TxExtractData) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (TxExtractData) MarshalJSON ¶
func (v TxExtractData) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*TxExtractData) UnmarshalEasyJSON ¶
func (v *TxExtractData) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*TxExtractData) UnmarshalJSON ¶
func (v *TxExtractData) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type TxInput ¶
TxInput 交易输入(出账记录)
func (TxInput) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (TxInput) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*TxInput) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*TxInput) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type TxOutPut ¶
TxOutPut 交易输出(到账记录)
func (TxOutPut) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (TxOutPut) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*TxOutPut) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*TxOutPut) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type TxTransferExpected ¶
type TxTransferExpected struct {
// ContractAddr 为空表示主币转账;非空表示合约代币(ERC20)转账。
ContractAddr string `json:"contractAddr"`
From string `json:"from"`
To string `json:"to"`
// Amount 为十进制字符串(已按 decimals 格式化后的金额),例如 "1.23"。
Amount string `json:"amount"`
// Decimals 仅在 ContractAddr 非空时使用;若为 0 表示由实现方自行确定(不推荐,建议外部明确)。
Decimals uint32 `json:"decimals"`
// OutputIndex 可选:用于唯一定位同一 tx 内的多笔记录,语义随场景变化:
// - EVM 合约事件:表示事件日志索引(logIndex)
// - UTXO 链:表示交易输出索引(vout)
// <0 表示不使用该字段的场景。
OutputIndex int64 `json:"outputIndex"`
}
TxTransferExpected 主币/代币单条转账的期望值(用于入账前严格比对)。
func (TxTransferExpected) MarshalEasyJSON ¶
func (v TxTransferExpected) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (TxTransferExpected) MarshalJSON ¶
func (v TxTransferExpected) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*TxTransferExpected) UnmarshalEasyJSON ¶
func (v *TxTransferExpected) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*TxTransferExpected) UnmarshalJSON ¶
func (v *TxTransferExpected) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type TxVerifyExpected ¶
type TxVerifyExpected struct {
Symbol string `json:"symbol"`
TxID string `json:"txid"`
BlockHash string `json:"blockHash"`
Height uint64 `json:"height"`
// Transfers 为期望入账的转账列表(主币与代币均可)。
Transfers []*TxTransferExpected `json:"transfers"`
}
TxVerifyExpected 入账前复核所需的期望对象(外部系统准备入账的记录摘要)。
func (TxVerifyExpected) MarshalEasyJSON ¶
func (v TxVerifyExpected) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (TxVerifyExpected) MarshalJSON ¶
func (v TxVerifyExpected) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*TxVerifyExpected) UnmarshalEasyJSON ¶
func (v *TxVerifyExpected) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*TxVerifyExpected) UnmarshalJSON ¶
func (v *TxVerifyExpected) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type TxVerifyMatchResult ¶
type TxVerifyMatchResult struct {
TxID string `json:"txid"`
Verified bool `json:"verified"`
Reason string `json:"reason"`
// Mismatches 用于返回不一致的原因列表(可直接写日志/告警)。
Mismatches []string `json:"mismatches"`
// Chain 为链上复核与实际提取结果(便于外部定位差异)。
Chain *TxVerifyResult `json:"chain"`
}
TxVerifyMatchResult VerifyTransactionMatch 的返回值:链上复核 + 与期望值比对的结论。
func (TxVerifyMatchResult) MarshalEasyJSON ¶
func (v TxVerifyMatchResult) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (TxVerifyMatchResult) MarshalJSON ¶
func (v TxVerifyMatchResult) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*TxVerifyMatchResult) UnmarshalEasyJSON ¶
func (v *TxVerifyMatchResult) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*TxVerifyMatchResult) UnmarshalJSON ¶
func (v *TxVerifyMatchResult) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type TxVerifyResult ¶
type TxVerifyResult struct {
Symbol string `json:"symbol"`
TxID string `json:"txid"`
Verified bool `json:"verified"`
Reason string `json:"reason"`
BlockHeight uint64 `json:"blockHeight"`
BlockHash string `json:"blockHash"`
Confirmations uint64 `json:"confirmations"`
Status string `json:"status"`
// ExtractData 为交易提取结果列表(按 SourceKey 聚合)。
ExtractData []*ExtractDataItem `json:"extractData"`
// ContractReceipts 为合约回执列表(key 字段可用于标识,如 txid:contractAddr:logIndex)。
ContractReceipts []*ContractReceiptItem `json:"contractReceipts"`
}
TxVerifyResult 按 txid 复核链上交易并返回“可入账结果集”的输出。 设计目标:外部系统在入账前进行二次链上复核(上链归属、成功状态、确认数),并获取与扫块口径一致的提取结果集。
func (TxVerifyResult) MarshalEasyJSON ¶
func (v TxVerifyResult) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (TxVerifyResult) MarshalJSON ¶
func (v TxVerifyResult) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*TxVerifyResult) UnmarshalEasyJSON ¶
func (v *TxVerifyResult) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*TxVerifyResult) UnmarshalJSON ¶
func (v *TxVerifyResult) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type UnscanRecord ¶
type UnscanRecord struct {
ID string `json:"id"`
BlockHeight uint64 `json:"blockHeight"`
TxID string `json:"txid"`
Reason string `json:"reason"`
Symbol string `json:"symbol"`
}
UnscanRecord 扫描失败的区块/交易记录
func NewUnscanRecord ¶
func NewUnscanRecord(height uint64, txID, reason, symbol string) *UnscanRecord
NewUnscanRecord 构造未扫记录并生成 ID
func (UnscanRecord) MarshalEasyJSON ¶
func (v UnscanRecord) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (UnscanRecord) MarshalJSON ¶
func (v UnscanRecord) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*UnscanRecord) UnmarshalEasyJSON ¶
func (v *UnscanRecord) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*UnscanRecord) UnmarshalJSON ¶
func (v *UnscanRecord) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface