Skip to content

Commit

Permalink
checkpoint #4
Browse files Browse the repository at this point in the history
  • Loading branch information
roynalnaruto committed Oct 8, 2020
1 parent 978e6ab commit 84dbcbb
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions chain/filecoin/filecoin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var _ = Describe("Filecoin", func() {
client, err := filecoin.NewClient(
filecoin.DefaultClientOptions().
WithRPCURL("ws://127.0.0.1:1234/rpc/v0").
WithAuthToken("Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBbGxvdyI6WyJyZWFkIiwid3JpdGUiLCJzaWduIiwiYWRtaW4iXX0.673MLa4AmbhNeC1Hj2Bn6c4t_ci68I0amkqAEHea8ik"),
WithAuthToken(fetchAuthToken()),
)
Expect(err).ToNot(HaveOccurred())

Expand Down Expand Up @@ -66,8 +66,13 @@ var _ = Describe("Filecoin", func() {
recipientFilAddr, err := filaddress.NewSecp256k1Address(recipientPubKeyCompressed)
Expect(err).NotTo(HaveOccurred())

// get good gas estimates
gasLimit := uint64(495335)
gasEstimator := filecoin.NewGasEstimator(client, int64(gasLimit))
gasFeeCap, gasPremium, err := gasEstimator.EstimateGasPrice(ctx)
Expect(err).ToNot(HaveOccurred())

// construct the transaction builder
gasPremium := pack.NewU256FromU64(pack.NewU64(149514))
filTxBuilder := filecoin.NewTxBuilder(gasPremium)

// build the transaction
Expand All @@ -77,9 +82,9 @@ var _ = Describe("Filecoin", func() {
multichain.Address(pack.String(recipientFilAddr.String())),
pack.NewU256FromU64(pack.NewU64(100000000)), // amount
pack.NewU256FromU64(pack.NewU64(0)), // nonce
pack.NewU256FromU64(pack.NewU64(495335)), // gasFeeCap
pack.NewU256FromU64(pack.NewU64(149838)), // gasPrice
pack.Bytes(nil), // payload
pack.NewU256FromU64(pack.NewU64(gasLimit)), // gasLimit
gasFeeCap, // gasFeeCap
pack.Bytes(nil), // payload
)
Expect(err).ToNot(HaveOccurred())

Expand Down

0 comments on commit 84dbcbb

Please sign in to comment.