Skip to content

Commit 4758c99

Browse files
committed
improving web3 limit order structure
1 parent 74a6827 commit 4758c99

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

orderbook/examples/create_order/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func main() {
5151
publicKey := ecdsaPrivateKey.Public()
5252
publicAddress := crypto.PubkeyToAddress(*publicKey.(*ecdsa.PublicKey))
5353

54-
seriesNonce, err := orderbook.GetSeriesNonce(ctx, client.Wallet, publicAddress)
54+
seriesNonce, err := client.GetSeriesNonce(ctx, publicAddress)
5555
if err != nil {
5656
log.Fatal(fmt.Errorf("failed to get series nonce: %v", err))
5757
}
@@ -60,7 +60,7 @@ func main() {
6060
ChainId: chainId,
6161
SeriesNonce: seriesNonce,
6262
PrivateKey: privateKey,
63-
ExpireAfter: time.Now().Add(time.Minute * 10).Unix(), // TODO update the field name to have "unix" suffix
63+
ExpireAfter: time.Now().Add(time.Hour * 10).Unix(), // TODO update the field name to have "unix" suffix
6464
Maker: publicAddress.Hex(),
6565
MakerAsset: wmatic,
6666
TakerAsset: usdc,

orderbook/web3data.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@ import (
1010
"github.com/ethereum/go-ethereum/accounts/abi"
1111
gethCommon "github.com/ethereum/go-ethereum/common"
1212

13-
"github.com/1inch/1inch-sdk-go/common"
1413
"github.com/1inch/1inch-sdk-go/constants"
1514
)
1615

17-
func GetSeriesNonce(ctx context.Context, wallet common.Wallet, publicAddress gethCommon.Address) (*big.Int, error) {
16+
func (c *Client) GetSeriesNonce(ctx context.Context, publicAddress gethCommon.Address) (*big.Int, error) {
1817

19-
seriesNonceManager, err := constants.GetSeriesNonceManagerFromChainId(int(wallet.ChainId()))
18+
seriesNonceManager, err := constants.GetSeriesNonceManagerFromChainId(int(c.Wallet.ChainId()))
2019
if err != nil {
2120
log.Fatal(fmt.Errorf("failed to get series nonce manager address: %v", err))
2221
}
@@ -33,7 +32,7 @@ func GetSeriesNonce(ctx context.Context, wallet common.Wallet, publicAddress get
3332
return nil, err
3433
}
3534

36-
result, err := wallet.Call(ctx, gethCommon.HexToAddress(seriesNonceManager), seriesNonceData)
35+
result, err := c.Wallet.Call(ctx, gethCommon.HexToAddress(seriesNonceManager), seriesNonceData)
3736
if err != nil {
3837
return nil, err
3938
}

0 commit comments

Comments
 (0)