-
Notifications
You must be signed in to change notification settings - Fork 7
/
NFT.go
63 lines (55 loc) · 1.68 KB
/
NFT.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
package zksync
import (
"github.com/ethereum/go-ethereum/common"
)
const (
TransactionTypeMintNFT TransactionType = "MintNFT"
TransactionTypeWithdrawNFT TransactionType = "WithdrawNFT"
)
type NFT struct {
Id uint32 `json:"id"`
Symbol string `json:"symbol"`
CreatorId uint32 `json:"creatorId"`
ContentHash common.Hash `json:"contentHash"`
CreatorAddress common.Address `json:"creatorAddress"`
SerialId uint32 `json:"serialId"`
Address string `json:"address"`
}
func (t *NFT) ToToken() *Token {
return &Token{
Id: t.Id,
Address: t.Address,
Symbol: t.Symbol,
Decimals: 0,
IsNft: true,
}
}
type MintNFT struct {
Type string `json:"type"`
CreatorId uint32 `json:"creatorId"`
CreatorAddress common.Address `json:"creatorAddress"`
ContentHash common.Hash `json:"contentHash"`
Recipient common.Address `json:"recipient"`
Fee string `json:"fee"`
FeeToken uint32 `json:"feeToken"`
Nonce uint32 `json:"nonce"`
Signature *Signature `json:"signature"`
}
func (t *MintNFT) getType() string {
return "MintNFT"
}
type WithdrawNFT struct {
Type string `json:"type"`
AccountId uint32 `json:"accountId"`
From common.Address `json:"from"`
To common.Address `json:"to"`
Token uint32 `json:"token"`
FeeToken uint32 `json:"feeToken"`
Fee string `json:"fee"`
Nonce uint32 `json:"nonce"`
Signature *Signature `json:"signature"`
*TimeRange
}
func (t *WithdrawNFT) getType() string {
return "WithdrawNFT"
}