diff --git a/chain/filecoin/filecoin_test.go b/chain/filecoin/filecoin_test.go index 180428ca..a4010ce4 100644 --- a/chain/filecoin/filecoin_test.go +++ b/chain/filecoin/filecoin_test.go @@ -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()) @@ -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 @@ -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())