@@ -32,7 +32,7 @@ var _ = Describe("Filecoin", func() {
3232 client , err := filecoin .NewClient (
3333 filecoin .DefaultClientOptions ().
3434 WithRPCURL ("ws://127.0.0.1:1234/rpc/v0" ).
35- WithAuthToken ("Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBbGxvdyI6WyJyZWFkIiwid3JpdGUiLCJzaWduIiwiYWRtaW4iXX0.673MLa4AmbhNeC1Hj2Bn6c4t_ci68I0amkqAEHea8ik" ),
35+ WithAuthToken (fetchAuthToken () ),
3636 )
3737 Expect (err ).ToNot (HaveOccurred ())
3838
@@ -66,8 +66,13 @@ var _ = Describe("Filecoin", func() {
6666 recipientFilAddr , err := filaddress .NewSecp256k1Address (recipientPubKeyCompressed )
6767 Expect (err ).NotTo (HaveOccurred ())
6868
69+ // get good gas estimates
70+ gasLimit := uint64 (495335 )
71+ gasEstimator := filecoin .NewGasEstimator (client , int64 (gasLimit ))
72+ gasFeeCap , gasPremium , err := gasEstimator .EstimateGasPrice (ctx )
73+ Expect (err ).ToNot (HaveOccurred ())
74+
6975 // construct the transaction builder
70- gasPremium := pack .NewU256FromU64 (pack .NewU64 (149514 ))
7176 filTxBuilder := filecoin .NewTxBuilder (gasPremium )
7277
7378 // build the transaction
@@ -77,9 +82,9 @@ var _ = Describe("Filecoin", func() {
7782 multichain .Address (pack .String (recipientFilAddr .String ())),
7883 pack .NewU256FromU64 (pack .NewU64 (100000000 )), // amount
7984 pack .NewU256FromU64 (pack .NewU64 (0 )), // nonce
80- pack .NewU256FromU64 (pack .NewU64 (495335 )), // gasFeeCap
81- pack . NewU256FromU64 ( pack . NewU64 ( 149838 )) , // gasPrice
82- pack .Bytes (nil ), // payload
85+ pack .NewU256FromU64 (pack .NewU64 (gasLimit )), // gasLimit
86+ gasFeeCap , // gasFeeCap
87+ pack .Bytes (nil ), // payload
8388 )
8489 Expect (err ).ToNot (HaveOccurred ())
8590
0 commit comments