-
Notifications
You must be signed in to change notification settings - Fork 5
/
types.go
134 lines (119 loc) · 4.92 KB
/
types.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
130
131
132
133
134
package ethNotification
type EngineConfig struct {
WSURL string
FCM_PUSH_KEY string
FCM_PUSH_TITLE string
ENABLE_PUSH_PENDING_TX bool
CHAIN_NAME string
}
type TokenContract struct {
Name string `json:"name" bson:"name"`
Symbol string `json:"symbol" bson:"symbol"`
TotalSupply string `json:"total_supply" bson:"total_supply"`
Decimals int8 `json:"decimals" bson:"decimals"`
ContractAddress string `json:"contract_address" bson:"contract_address"`
ContractCreator string `json:"contract_creator" bson:"contract_creator"`
}
type InputData struct {
MethodID string `json:"method_id" bson:"method_id"`
ToAddress string `json:"to_address" bson:"to_address"`
Value string `json:"value" bson:"value"`
ValueWithDecimals string `json:"value_with_dcms" bson:"value_with_dcms"`
}
type PushMessage struct {
Title string `json:"title" bson:"title"`
Sound string `json:"sound" bson:"sound"`
Content string `json:"content" bson:"content"`
Badge string `json:"badge" bson:"badge"`
DeviceTokens []string `json:"device_tokens" bson:"device_tokens"`
Payload map[string]interface{} `json:"payload" bson:"payload"`
Responses []PushResult `json:"results,omitempty" bson:"results,omitempty"`
}
type PushResult struct {
DeviceToken string `json:"device_token" bson:"device_token"`
Result map[string]string `json:"result,omitempty" bson:"result,omitempty"`
}
type Block struct {
Hash string `json:"hash"`
Number string `json:"number"`
Transactions []Transaction `json:"transactions"`
}
type Transaction struct {
BlockHash string `json:"blockHash" bson:"block_hash"`
BlockNumber string `json:"blockNumber" bson:"block_number"`
From string `json:"from" bson:"from"`
To string `json:"to" bson:"to"`
Value string `json:"value" bson:"value"`
Gas string `json:"gas" bson:"gas"`
GasPrice string `json:"gasPrice" bson:"gas_price"`
Hash string `json:"hash" bson:"hash"`
Input string `json:"input" bson:"input"`
TransactionIndex string `json:"transactionIndex" bson:"tx_index"`
TimeStamp string `json:"timeStamp" bson:"time_stamp"`
ContractAddress string `json:"contractAddress" bson:"contract_address"`
TokenName string `json:"tokenName" bson:"token_name"`
TokenSymbol string `json:"tokenSymbol" bson:"token_symbol"`
TokenDecimal int `json:"tokenDecimal" bson:"token_decimal"`
Status TxStatus `json:"-" bson:"status"`
IsSeft bool `json:"isSeft"`
ChainName string `json:"chainName"`
Receipt TransactionReceipt
// Nonce string `json:"nonce" bson:"nonce"`
// GasUsed string `json:"gasUsed" bson:"gas_used"`
// V string `json:"v" bson:"v"`
// R string `json:"r" bson:"r"`
// S string `json:"s" bson:"s"`
}
type TransactionReceipt struct {
ContractAddress string `json:"contractAddress" bson:"contract_address"`
CumulativeGasUsed string `json:"cumulativeGasUsed" bson:"cumulativeGasUsed"`
From string `json:"from" bson:"from"`
To string `json:"to" bson:"to"`
GasUsed string `json:"gasUsed" bson:"gasUsed"`
Logs []Log `json:"logs" bson:"logs"`
LogsBloom string `json:"logsBloom" bson:"logsBloom"`
Status string `json:"status" bson:"status"`
}
type Log struct {
Address string `json:"address" bson:"address"`
Topics []string `json:"topics" bson:"topics"`
Data string `json:"data" bson:"data"`
BlockNumber string `json:"blockNumber" bson:"blockNumber"`
TransactionHash string `json:"transactionHash" bson:"transactionHash"`
TransactionIndex string `json:"transactionIndex" bson:"transactionIndex"`
BlockHash string `json:"blockHash" bson:"blockHash"`
LogIndex string `json:"logIndex" bson:"logIndex"`
Removed bool `json:"removed" bson:"removed"`
}
func (t *Transaction) IsNormalTx() bool {
switch {
case t.Value == "0x0":
return false
default:
return true
}
}
type Wallet struct {
ID string `json:"id" bson:"id,omitempty"`
Name string `json:"name" bson:"name"`
Address string `json:"address" bson:"address"`
Type string `json:"type" bson:"type"`
}
type WalletPush struct {
Wallet
DeviceUDID string `json:"device_udid" bson:"_id"`
DeviceToken string `json:"device_token" bson:"device_token"`
}
type WalletSubscriber struct {
WalletName string
WalletAddress string
DeviceToken string
}
type WalletSubscriberResult struct {
Transaction *Transaction
Subscribers []WalletSubscriber
}
type CacheData struct {
Transaction Transaction
WalletSubscribers []WalletSubscriber
}