forked from okx/go-wallet-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
swap.go
43 lines (38 loc) · 1.13 KB
/
swap.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
/*
Author: https://github.com/zksync-sdk/zksync-go
*
*/
package core
import (
"math/big"
)
const (
TransactionTypeSwap = "Swap"
)
type Order struct {
AccountId uint32 `json:"accountId"`
RecipientAddress string `json:"recipient"`
Nonce uint32 `json:"nonce"`
TokenBuy uint32 `json:"tokenBuy"`
TokenSell uint32 `json:"tokenSell"`
Ratio []*big.Int `json:"ratio"`
Amount *big.Int `json:"amount"`
Signature *Signature `json:"signature"`
EthereumSignature *EthSignature `json:"ethereumSignature"`
*TimeRange
}
type Swap struct {
Type string `json:"type"`
SubmitterId uint32 `json:"submitterId"`
SubmitterAddress string `json:"submitterAddress"`
Nonce uint32 `json:"nonce"`
Orders []*Order `json:"orders"`
Amounts []*big.Int `json:"amounts"`
Fee string `json:"fee"`
FeeToken uint32 `json:"feeToken"`
Signature *Signature `json:"signature"`
*TimeRange
}
func (t *Swap) getType() string {
return TransactionTypeSwap
}