github.com/lmittmann/w3@v0.20.0/module/txpool/content_test.go (about) 1 package txpool_test 2 3 import ( 4 "math/big" 5 "testing" 6 7 "github.com/ethereum/go-ethereum/common" 8 "github.com/ethereum/go-ethereum/core/types" 9 "github.com/lmittmann/w3" 10 "github.com/lmittmann/w3/module/txpool" 11 "github.com/lmittmann/w3/rpctest" 12 ) 13 14 func TestContent(t *testing.T) { 15 rpctest.RunTestCases(t, []rpctest.TestCase[*txpool.ContentResponse]{ 16 { 17 Golden: "content", 18 Call: txpool.Content(), 19 WantRet: &txpool.ContentResponse{ 20 Pending: map[common.Address][]*types.Transaction{ 21 w3.A("0x000454307bB96E303044046a6eB2736D2aD560B6"): { 22 types.NewTx(&types.DynamicFeeTx{ 23 ChainID: big.NewInt(1), 24 Nonce: 4652, 25 GasTipCap: big.NewInt(31407912032), 26 GasFeeCap: big.NewInt(202871575924), 27 Gas: 1100000, 28 To: w3.APtr("0xEf1c6E67703c7BD7107eed8303Fbe6EC2554BF6B"), 29 Value: big.NewInt(81000000000000000), 30 Data: w3.B("0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000001896e196d5300000000000000000000000000000000000000000000000000000000000000030b090c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000011fc51222ce800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000004657febe8d8000000000000000000000000000000000000000000000000000011fc51222ce800000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000008d538a82c84d7003aa0e7f1098bd9dc5ea1777be000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000"), 31 R: new(big.Int).SetBytes(w3.B("0xf91729846ac8bb780a7239b7f0157d53330bba310a0811f4eec2eae25172c252")), 32 S: new(big.Int).SetBytes(w3.B("0x1bb9a1b9aea8b128e0e8dc42b17664be50c7b4073973c730b6c4cf2a3b3503cb")), 33 }), 34 }, 35 }, 36 Queued: map[common.Address][]*types.Transaction{ 37 w3.A("0x1BA4Ca9ac6ff4CF192C11E8C1624563f302cAA87"): { 38 types.NewTx(&types.DynamicFeeTx{ 39 ChainID: big.NewInt(1), 40 Nonce: 183, 41 GasTipCap: big.NewInt(110000000), 42 GasFeeCap: big.NewInt(20027736270), 43 Gas: 99226, 44 To: w3.APtr("0x1BA4Ca9ac6ff4CF192C11E8C1624563f302cAA87"), 45 Value: big.NewInt(0), 46 Data: []byte{}, 47 R: new(big.Int).SetBytes(w3.B("0xea35c7c0643b79664b0bbb7f42d64edd371508ae4c33c1f817a80a2655465935")), 48 S: new(big.Int).SetBytes(w3.B("0x76d39f794e9e1ee359d66b7d3b19b90aaf2051b2159c68f3bb8c954558989da8")), 49 }), 50 }, 51 }, 52 }, 53 }, 54 }) 55 } 56 57 func TestContentFrom(t *testing.T) { 58 rpctest.RunTestCases(t, []rpctest.TestCase[*txpool.ContentFromResponse]{ 59 { 60 Golden: "contentFrom", 61 Call: txpool.ContentFrom(w3.A("0x1BA4Ca9ac6ff4CF192C11E8C1624563f302cAA87")), 62 WantRet: &txpool.ContentFromResponse{ 63 Queued: []*types.Transaction{ 64 types.NewTx(&types.DynamicFeeTx{ 65 ChainID: big.NewInt(1), 66 Nonce: 183, 67 GasTipCap: big.NewInt(110000000), 68 GasFeeCap: big.NewInt(20027736270), 69 Gas: 99226, 70 To: w3.APtr("0x1BA4Ca9ac6ff4CF192C11E8C1624563f302cAA87"), 71 Value: big.NewInt(0), 72 Data: []byte{}, 73 R: new(big.Int).SetBytes(w3.B("0xea35c7c0643b79664b0bbb7f42d64edd371508ae4c33c1f817a80a2655465935")), 74 S: new(big.Int).SetBytes(w3.B("0x76d39f794e9e1ee359d66b7d3b19b90aaf2051b2159c68f3bb8c954558989da8")), 75 }), 76 }, 77 }, 78 }, 79 }) 80 }