decred.org/dcrdex@v1.0.3/client/asset/polygon/multirpc_live_test.go (about) 1 //go:build rpclive 2 3 package polygon 4 5 import ( 6 "context" 7 "os" 8 "testing" 9 10 "decred.org/dcrdex/client/asset/eth" 11 "decred.org/dcrdex/dex" 12 ) 13 14 const ( 15 alphaHTTPPort = "48296" 16 alphaWSPort = "34983" 17 ) 18 19 var mt *eth.MRPCTest 20 21 func TestMain(m *testing.M) { 22 ctx, shutdown := context.WithCancel(context.Background()) 23 mt = eth.NewMRPCTest(ctx, ChainConfig, NetworkCompatibilityData, "polygon") 24 doIt := func() int { 25 defer shutdown() 26 return m.Run() 27 } 28 os.Exit(doIt()) 29 } 30 31 func TestHTTP(t *testing.T) { 32 mt.TestHTTP(t, alphaHTTPPort) 33 } 34 35 func TestWS(t *testing.T) { 36 mt.TestWS(t, alphaWSPort) 37 } 38 39 func TestWSTxLogs(t *testing.T) { 40 mt.TestWSTxLogs(t, alphaWSPort) 41 } 42 43 func TestSimnetMultiRPCClient(t *testing.T) { 44 mt.TestSimnetMultiRPCClient(t, alphaWSPort, alphaHTTPPort) 45 } 46 47 func TestMonitorTestnet(t *testing.T) { 48 mt.TestMonitorNet(t, dex.Testnet) 49 } 50 51 func TestMonitorMainnet(t *testing.T) { 52 mt.TestMonitorNet(t, dex.Mainnet) 53 } 54 55 func TestRPCMainnet(t *testing.T) { 56 mt.TestRPC(t, dex.Mainnet) 57 } 58 59 func TestRPCTestnet(t *testing.T) { 60 mt.TestRPC(t, dex.Testnet) 61 } 62 63 func TestFreeServers(t *testing.T) { 64 // https://www.alchemy.com/chain-connect/chain/polygon-pos 65 // https://chainlist.org/?search=Polygon+Mainnet 66 freeServers := []string{ 67 // Passing 68 "https://1rpc.io/matic", 69 "https://rpc.ankr.com/polygon", 70 "https://polygon-mainnet.public.blastapi.io", 71 "https://polygon.blockpi.network/v1/rpc/public", 72 "https://polygon.llamarpc.com", 73 "https://endpoints.omniatech.io/v1/matic/mainnet/public", 74 "https://rpc-mainnet.matic.quiknode.pro", 75 "https://gateway.tenderly.co/public/polygon", 76 // Failing 77 "https://matic-mainnet-full-rpc.bwarelabs.com", // connect error: failed to connect to even a single provider among: bwarelabs.com 78 "https://polygon.api.onfinality.io/public", // "BalanceAt" error: Too Many Requests, Please apply an OnFinality API key or contact us to receive a higher rate limit 79 "https://poly-rpc.gateway.pokt.network", // connect error: failed to connect to even a single provider among: pokt.network 80 "https://polygon-rpc.com", // "TransactionReceipt" error: not found 81 "https://polygon.meowrpc.com", // "TransactionReceipt" error: not found 82 "wss://polygon.drpc.org", // "TransactionReceipt" error: Unable to perform request 83 "https://polygon.rpc.blxrbdn.com", // "TransactionReceipt" error: not found 84 "https://g.w.lavanet.xyz:443/gateway/polygon1/rpc-http/f7ee0000000000000000000000000000", // "TransactionReceipt" error: not found 85 "https://rpc-mainnet.matic.network", // connect error: failed to connect to even a single provider among: matic.network 86 "wss://polygon-bor-rpc.publicnode.com", // "TransactionReceipt" error: not found 87 "https://public.stackup.sh/api/v1/node/polygon-mainnet", // "TransactionReceipt" error: not found 88 "https://matic-mainnet.chainstacklabs.com", // connect error: failed to connect to even a single provider among: chainstacklabs.com 89 90 } 91 mt.TestFreeServers(t, freeServers, dex.Mainnet) 92 } 93 94 func TestFreeTestnetServers(t *testing.T) { 95 // https://chainlist.org/chain/80002 96 // PASSING 24 April 2024 97 freeServers := []string{ 98 "https://rpc-amoy.polygon.technology", 99 "wss://polygon-amoy-bor-rpc.publicnode.com", 100 "https://polygon-amoy.blockpi.network/v1/rpc/public", 101 } 102 mt.TestFreeServers(t, freeServers, dex.Testnet) 103 } 104 105 func TestMainnetCompliance(t *testing.T) { 106 mt.TestMainnetCompliance(t) 107 } 108 109 func TestTestnetFees(t *testing.T) { 110 mt.FeeHistory(t, dex.Testnet, 3, 90) 111 } 112 113 func TestTestnetTipCaps(t *testing.T) { 114 mt.TipCaps(t, dex.Testnet) 115 } 116 117 func TestFees(t *testing.T) { 118 mt.FeeHistory(t, dex.Mainnet, 3, 365) 119 } 120 121 func TestTipCaps(t *testing.T) { 122 mt.TipCaps(t, dex.Mainnet) 123 } 124 125 func TestReceiptsHaveEffectiveGasPrice(t *testing.T) { 126 mt.TestReceiptsHaveEffectiveGasPrice(t) 127 }