Skip to content

Commit

Permalink
v10.19.2: fix rpc timeouts and polygon rpc
Browse files Browse the repository at this point in the history
  • Loading branch information
0xNe0x1 committed Oct 16, 2024
1 parent dbf4821 commit d90a737
Show file tree
Hide file tree
Showing 15 changed files with 48 additions and 28 deletions.
2 changes: 1 addition & 1 deletion dev.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/ethers/5.7.1/ethers.umd.min.js" type="application/javascript"></script>
<script crossorigin src="https://unpkg.com/@depay/solana-web3.js@1"></script>
<script crossorigin src="https://unpkg.com/@depay/[email protected].0"></script>
<script crossorigin src="https://unpkg.com/@depay/[email protected].9"></script>
<script src="tmp/index.dev.js"></script>
</head>
<body>
Expand Down
4 changes: 3 additions & 1 deletion dist/esm/index.evm.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ class StaticJsonRpcBatchProvider extends ethers.providers.JsonRpcProvider {
method: 'POST',
body: JSON.stringify(batch),
headers: { 'Content-Type': 'application/json' },
signal: AbortSignal.timeout(10000) // 10-second timeout
}
).then((response)=>{
if(response.ok) {
Expand Down Expand Up @@ -281,7 +282,8 @@ const setProviderEndpoints$1 = async (blockchain, endpoints, detectFastest = tru
},
referrer: "",
referrerPolicy: "no-referrer",
body: JSON.stringify({ method: 'net_version', id: 1, jsonrpc: '2.0' })
body: JSON.stringify({ method: 'net_version', id: 1, jsonrpc: '2.0' }),
signal: AbortSignal.timeout(10000) // 10-second timeout
});
} catch (e) {}
if(!_optionalChain$1([response, 'optionalAccess', _ => _.ok])) { return resolve(999) }
Expand Down
8 changes: 6 additions & 2 deletions dist/esm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class StaticJsonRpcBatchProvider extends ethers.providers.JsonRpcProvider {
method: 'POST',
body: JSON.stringify(batch),
headers: { 'Content-Type': 'application/json' },
signal: AbortSignal.timeout(10000) // 10-second timeout
}
).then((response)=>{
if(response.ok) {
Expand Down Expand Up @@ -224,7 +225,8 @@ const setProviderEndpoints$2 = async (blockchain, endpoints, detectFastest = tru
},
referrer: "",
referrerPolicy: "no-referrer",
body: JSON.stringify({ method: 'net_version', id: 1, jsonrpc: '2.0' })
body: JSON.stringify({ method: 'net_version', id: 1, jsonrpc: '2.0' }),
signal: AbortSignal.timeout(10000) // 10-second timeout
});
} catch (e) {}
if(!_optionalChain$4([response, 'optionalAccess', _ => _.ok])) { return resolve(999) }
Expand Down Expand Up @@ -327,6 +329,7 @@ class StaticJsonRpcSequentialProvider extends Connection {
method: 'POST',
body: JSON.stringify(batch),
headers: { 'Content-Type': 'application/json' },
signal: AbortSignal.timeout(10000) // 10-second timeout
}
).then((response)=>{
if(response.ok) {
Expand Down Expand Up @@ -471,7 +474,8 @@ const setProviderEndpoints$1 = async (blockchain, endpoints, detectFastest = tru
},
referrer: "",
referrerPolicy: "no-referrer",
body: JSON.stringify({ method: 'getIdentity', id: 1, jsonrpc: '2.0' })
body: JSON.stringify({ method: 'getIdentity', id: 1, jsonrpc: '2.0' }),
signal: AbortSignal.timeout(10000) // 10-second timeout
});
} catch (e) {}
if(!_optionalChain$2([response, 'optionalAccess', _ => _.ok])) { return resolve(999) }
Expand Down
4 changes: 3 additions & 1 deletion dist/esm/index.solana.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class StaticJsonRpcSequentialProvider extends Connection {
method: 'POST',
body: JSON.stringify(batch),
headers: { 'Content-Type': 'application/json' },
signal: AbortSignal.timeout(10000) // 10-second timeout
}
).then((response)=>{
if(response.ok) {
Expand Down Expand Up @@ -215,7 +216,8 @@ const setProviderEndpoints$1 = async (blockchain, endpoints, detectFastest = tru
},
referrer: "",
referrerPolicy: "no-referrer",
body: JSON.stringify({ method: 'getIdentity', id: 1, jsonrpc: '2.0' })
body: JSON.stringify({ method: 'getIdentity', id: 1, jsonrpc: '2.0' }),
signal: AbortSignal.timeout(10000) // 10-second timeout
});
} catch (e) {}
if(!_optionalChain$2([response, 'optionalAccess', _ => _.ok])) { return resolve(999) }
Expand Down
4 changes: 3 additions & 1 deletion dist/umd/index.evm.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
method: 'POST',
body: JSON.stringify(batch),
headers: { 'Content-Type': 'application/json' },
signal: AbortSignal.timeout(10000) // 10-second timeout
}
).then((response)=>{
if(response.ok) {
Expand Down Expand Up @@ -288,7 +289,8 @@
},
referrer: "",
referrerPolicy: "no-referrer",
body: JSON.stringify({ method: 'net_version', id: 1, jsonrpc: '2.0' })
body: JSON.stringify({ method: 'net_version', id: 1, jsonrpc: '2.0' }),
signal: AbortSignal.timeout(10000) // 10-second timeout
});
} catch (e) {}
if(!_optionalChain$1([response, 'optionalAccess', _ => _.ok])) { return resolve(999) }
Expand Down
8 changes: 6 additions & 2 deletions dist/umd/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
method: 'POST',
body: JSON.stringify(batch),
headers: { 'Content-Type': 'application/json' },
signal: AbortSignal.timeout(10000) // 10-second timeout
}
).then((response)=>{
if(response.ok) {
Expand Down Expand Up @@ -230,7 +231,8 @@
},
referrer: "",
referrerPolicy: "no-referrer",
body: JSON.stringify({ method: 'net_version', id: 1, jsonrpc: '2.0' })
body: JSON.stringify({ method: 'net_version', id: 1, jsonrpc: '2.0' }),
signal: AbortSignal.timeout(10000) // 10-second timeout
});
} catch (e) {}
if(!_optionalChain$4([response, 'optionalAccess', _ => _.ok])) { return resolve(999) }
Expand Down Expand Up @@ -333,6 +335,7 @@
method: 'POST',
body: JSON.stringify(batch),
headers: { 'Content-Type': 'application/json' },
signal: AbortSignal.timeout(10000) // 10-second timeout
}
).then((response)=>{
if(response.ok) {
Expand Down Expand Up @@ -477,7 +480,8 @@
},
referrer: "",
referrerPolicy: "no-referrer",
body: JSON.stringify({ method: 'getIdentity', id: 1, jsonrpc: '2.0' })
body: JSON.stringify({ method: 'getIdentity', id: 1, jsonrpc: '2.0' }),
signal: AbortSignal.timeout(10000) // 10-second timeout
});
} catch (e) {}
if(!_optionalChain$2([response, 'optionalAccess', _ => _.ok])) { return resolve(999) }
Expand Down
4 changes: 3 additions & 1 deletion dist/umd/index.solana.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
method: 'POST',
body: JSON.stringify(batch),
headers: { 'Content-Type': 'application/json' },
signal: AbortSignal.timeout(10000) // 10-second timeout
}
).then((response)=>{
if(response.ok) {
Expand Down Expand Up @@ -221,7 +222,8 @@
},
referrer: "",
referrerPolicy: "no-referrer",
body: JSON.stringify({ method: 'getIdentity', id: 1, jsonrpc: '2.0' })
body: JSON.stringify({ method: 'getIdentity', id: 1, jsonrpc: '2.0' }),
signal: AbortSignal.timeout(10000) // 10-second timeout
});
} catch (e) {}
if(!_optionalChain$2([response, 'optionalAccess', _ => _.ok])) { return resolve(999) }
Expand Down
4 changes: 2 additions & 2 deletions package.evm.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@depay/web3-client-evm",
"moduleName": "Web3Client",
"version": "10.19.1",
"version": "10.19.2",
"description": "A web3 client to fetch blockchain data just like you are used to with HTTP clients.",
"main": "dist/umd/index.evm.js",
"module": "dist/esm/index.evm.js",
Expand All @@ -23,7 +23,7 @@
"homepage": "https://depay.com",
"private": false,
"peerDependencies": {
"@depay/web3-blockchains": "^9.6.0",
"@depay/web3-blockchains": "^9.6.9",
"ethers": "^5.7.1"
},
"engines": {
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@depay/web3-client",
"moduleName": "Web3Client",
"version": "10.19.1",
"version": "10.19.2",
"description": "A web3 client to fetch blockchain data just like you are used to with HTTP clients.",
"main": "dist/umd/index.js",
"module": "dist/esm/index.js",
Expand Down Expand Up @@ -34,7 +34,7 @@
"private": false,
"peerDependencies": {
"@depay/solana-web3.js": "^1.26.0",
"@depay/web3-blockchains": "^9.6.0",
"@depay/web3-blockchains": "^9.6.9",
"ethers": "^5.7.1"
},
"engines": {
Expand All @@ -44,8 +44,8 @@
"@babel/core": "^7.12.9",
"@babel/preset-env": "^7.12.7",
"@depay/solana-web3.js": "^1.26.0",
"@depay/web3-blockchains": "^9.6.0",
"@depay/web3-mock": "^14.19.0",
"@depay/web3-blockchains": "^9.6.9",
"@depay/web3-mock": "^14.19.1",
"@rollup/plugin-commonjs": "^22.0.1",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.3.0",
Expand Down
4 changes: 2 additions & 2 deletions package.solana.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@depay/web3-client-solana",
"moduleName": "Web3Client",
"version": "10.19.1",
"version": "10.19.2",
"description": "A web3 client to fetch blockchain data just like you are used to with HTTP clients.",
"main": "dist/umd/index.solana.js",
"module": "dist/esm/index.solana.js",
Expand All @@ -23,7 +23,7 @@
"homepage": "https://depay.com",
"private": false,
"peerDependencies": {
"@depay/web3-blockchains": "^9.6.0",
"@depay/web3-blockchains": "^9.6.9",
"@depay/solana-web3.js": "^1.26.0",
"ethers": "^5.7.1"
},
Expand Down
1 change: 1 addition & 0 deletions src/clients/ethers/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class StaticJsonRpcBatchProvider extends ethers.providers.JsonRpcProvider {
method: 'POST',
body: JSON.stringify(batch),
headers: { 'Content-Type': 'application/json' },
signal: AbortSignal.timeout(10000) // 10-second timeout
}
).then((response)=>{
if(response.ok) {
Expand Down
1 change: 1 addition & 0 deletions src/clients/solana/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class StaticJsonRpcSequentialProvider extends Connection {
method: 'POST',
body: JSON.stringify(batch),
headers: { 'Content-Type': 'application/json' },
signal: AbortSignal.timeout(10000) // 10-second timeout
}
).then((response)=>{
if(response.ok) {
Expand Down
3 changes: 2 additions & 1 deletion src/platforms/evm/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ const setProviderEndpoints = async (blockchain, endpoints, detectFastest = true)
},
referrer: "",
referrerPolicy: "no-referrer",
body: JSON.stringify({ method: 'net_version', id: 1, jsonrpc: '2.0' })
body: JSON.stringify({ method: 'net_version', id: 1, jsonrpc: '2.0' }),
signal: AbortSignal.timeout(10000) // 10-second timeout
})
} catch {}
if(!response?.ok) { return resolve(999) }
Expand Down
3 changes: 2 additions & 1 deletion src/platforms/solana/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ const setProviderEndpoints = async (blockchain, endpoints, detectFastest = true)
},
referrer: "",
referrerPolicy: "no-referrer",
body: JSON.stringify({ method: 'getIdentity', id: 1, jsonrpc: '2.0' })
body: JSON.stringify({ method: 'getIdentity', id: 1, jsonrpc: '2.0' }),
signal: AbortSignal.timeout(10000) // 10-second timeout
})
} catch {}
if(!response?.ok) { return resolve(999) }
Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -903,18 +903,18 @@
dependencies:
bs58 "^5.0.0"

"@depay/web3-blockchains@^9.6.0":
version "9.6.0"
resolved "https://registry.yarnpkg.com/@depay/web3-blockchains/-/web3-blockchains-9.6.0.tgz#51bcd4cd6bcc9542b61f7792eabdccbe6385b476"
integrity sha512-+REyl5vva1e6t4yvSJKJE2IgidTNDPB7imn4xxAqqeVOFJryLBwaPddyh5C9pnX9GMpLhR6s6Su4AgrdLSZ/JQ==
"@depay/web3-blockchains@^9.6.1", "@depay/web3-blockchains@^9.6.9":
version "9.6.9"
resolved "https://registry.yarnpkg.com/@depay/web3-blockchains/-/web3-blockchains-9.6.9.tgz#ea451a5aca840809a131e01232ff84e9463a2fbe"
integrity sha512-iAkWT+x6KlH7WsIprsruqVovCaR9R3yxKOp2AwsCsSwXDFsANP0BARnslFxwvGondeu0Hgt1D/zWIvOGm8+fBQ==

"@depay/web3-mock@^14.19.0":
version "14.19.0"
resolved "https://registry.yarnpkg.com/@depay/web3-mock/-/web3-mock-14.19.0.tgz#2e5430cc8240dea8a5f477d31f7861dc4e9666d7"
integrity sha512-/uTeJdxQTYEA4RFAZd8mAoMn1B+33UZ9s98cPKXQlksoRXstJiBUbPO+O7IOyZ4QUDsmcKTw1sjLH2+eIi4XTg==
"@depay/web3-mock@^14.19.1":
version "14.19.1"
resolved "https://registry.yarnpkg.com/@depay/web3-mock/-/web3-mock-14.19.1.tgz#3666a3fa0f2ae4e65f5cb90d88f59ba213414943"
integrity sha512-bBM1J0EWDWXJKVPtzo8YrX7fbGwUATYWN8kaJniQU2z5V+UK3kVhjQi+en0JMF9cCjinkERK7MqoZLaYR+cb+Q==
dependencies:
"@depay/solana-web3.js" "^1.26.0"
"@depay/web3-blockchains" "^9.6.0"
"@depay/web3-blockchains" "^9.6.1"
ethers "^5.7.1"

"@eslint/eslintrc@^0.4.3":
Expand Down

0 comments on commit d90a737

Please sign in to comment.