/
assets.go
129 lines (105 loc) · 3.36 KB
/
assets.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*
* Copyright 2018 The openwallet Authors
* This file is part of the openwallet library.
*
* The openwallet library is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The openwallet library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
package openwallet
import (
"github.com/blocktree/openwallet/v2/log"
)
//Coin 币种信息
type Coin struct {
Symbol string `json:"symbol"`
IsContract bool `json:"isContract"`
ContractID string `json:"contractID"`
Contract SmartContract `json:"contract"`
}
// AssetsAdapter 资产适配器接口
// 适配OpenWallet钱包体系的抽象接口
type AssetsAdapter interface {
//币种信息
//@required
SymbolInfo
//配置
//@required
AssetsConfig
//GetAddressDecodeV2 地址解析器V2
//如果实现了AddressDecoderV2,就无需实现AddressDecoder
//@required
GetAddressDecoderV2() AddressDecoderV2
//GetAddressDecode 地址解析器
//如果实现了AddressDecoderV2,就无需实现AddressDecoder
//@required
GetAddressDecode() AddressDecoder
//GetTransactionDecoder 交易单解析器
//@required
GetTransactionDecoder() TransactionDecoder
//GetBlockScanner 获取区块链扫描器
//@required
GetBlockScanner() BlockScanner
//GetSmartContractDecoder 获取智能合约解析器
//@optional
GetSmartContractDecoder() SmartContractDecoder
//GetAssetsLogger 获取资产日志工具
//@optional
GetAssetsLogger() *log.OWLogger
//GetJsonRPCEndpoint 获取全节点服务的JSON-RPC客户端
//@optional
GetJsonRPCEndpoint() JsonRPCEndpoint
//GetNFTContractDecoder 获取NFT智能合约解析器
//@optional
GetNFTContractDecoder() NFTContractDecoder
}
type AssetsAdapterBase struct {
SymbolInfoBase
AssetsConfigBase
}
//GetAddressDecode 地址解析器
func (a *AssetsAdapterBase) InitAssetsAdapter() error {
return nil
}
//GetAddressDecode 地址解析器
//如果实现了AddressDecoderV2,就无需实现AddressDecoder
func (a *AssetsAdapterBase) GetAddressDecode() AddressDecoder {
return nil
}
//GetAddressDecode 地址解析器
//如果实现了AddressDecoderV2,就无需实现AddressDecoder
func (a *AssetsAdapterBase) GetAddressDecoderV2() AddressDecoderV2 {
return nil
}
//GetTransactionDecoder 交易单解析器
func (a *AssetsAdapterBase) GetTransactionDecoder() TransactionDecoder {
return nil
}
//GetBlockScanner 获取区块链扫描器
func (a *AssetsAdapterBase) GetBlockScanner() BlockScanner {
return nil
}
//GetBlockScanner 获取智能合约解析器
func (a *AssetsAdapterBase) GetSmartContractDecoder() SmartContractDecoder {
return nil
}
//GetAssetsLogger 获取资产账户日志工具
func (a *AssetsAdapterBase) GetAssetsLogger() *log.OWLogger {
return nil
}
//GetJsonRPCEndpoint 获取全节点服务的JSON-RPC客户端
//@optional
func (a *AssetsAdapterBase) GetJsonRPCEndpoint() JsonRPCEndpoint {
return nil
}
//GetNFTContractDecoder 获取NFT智能合约解析器
//@optional
func (a *AssetsAdapterBase) GetNFTContractDecoder() NFTContractDecoder {
return nil
}