/
model.go
52 lines (45 loc) · 1.47 KB
/
model.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
package account
import (
"time"
"github.com/ethereum/go-ethereum/accounts"
"github.com/iden3/go-iden3-crypto/babyjub"
)
type AccountAPIResponse struct {
Accounts []Account `json:"accounts"`
PendingItems int `json:"pendingItems"`
}
type Account struct {
AccountIndex string `json:"accountIndex"`
Balance string `json:"balance"`
BJJAddress string `json:"bjj"`
HezEthereumAddress string `json:"hezEthereumAddress"`
ItemID int `json:"itemId"`
Nonce int `json:"nonce"`
Token Token `json:"token"`
}
type Token struct {
USD float64 `json:"USD"`
Decimals int `json:"decimals"`
EthereumAddress string `json:"ethereumAddress"`
EthereumBlockNum int `json:"ethereumBlockNum"`
FiatUpdate time.Time `json:"fiatUpdate"`
ID int `json:"id"`
ItemID int `json:"itemId"`
Name string `json:"name"`
Symbol string `json:"symbol"`
}
// BJJWallet BJJ Wallet
type BJJWallet struct {
PrivateKey babyjub.PrivateKey
PublicKey babyjub.PublicKeyComp
HezBjjAddress string
EthAccount accounts.Account
HezEthAddress string
AccountCreationAuthSignature string
}
// AccountCreation is used to submit new account creation to a Hermez Node
type AccountCreation struct {
EthereumAddress string `json:"hezEthereumAddress"`
HezBjjAddress string `json:"bjj"`
Signature string `json:"signature"`
}