-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v9.7.3: fix more rpcs and add test:rpcs
- Loading branch information
Showing
13 changed files
with
153 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Test RPC Availability | ||
|
||
on: | ||
push: | ||
branches: | ||
- '*' # Matches all branches | ||
schedule: | ||
# Runs at 05:00 UTC every day | ||
- cron: '0 5 * * *' | ||
|
||
jobs: | ||
daily-job: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: '18.x' | ||
- name: Cache node modules | ||
uses: actions/cache@v2 | ||
env: | ||
cache-name: cache-node-modules | ||
with: | ||
# npm cache files are stored in `~/.npm` on Linux/macOS | ||
path: ~/.npm | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-name }}- | ||
${{ runner.os }}-build- | ||
${{ runner.os }}- | ||
- name: npm install | ||
run: | | ||
npm install | ||
- name: npm run build | ||
run: | | ||
npm run build | ||
- name: Run Tests | ||
run: | | ||
yarn test:rpcs | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "@depay/web3-blockchains", | ||
"moduleName": "Web3Blockchains", | ||
"version": "9.7.2", | ||
"version": "9.7.3", | ||
"description": "JavaScript library containing aggregated information and abstractions for web3 blockchains.", | ||
"main": "dist/umd/index.js", | ||
"module": "dist/esm/index.js", | ||
|
@@ -15,7 +15,8 @@ | |
"lint:fix": "eslint \"src/**/*.{js,jsx,ts,tsx}\" --fix", | ||
"dev": "rollup -c rollup.dev.config.js -w", | ||
"test:units": "yarn build && npx jest --no-cache", | ||
"test": "yarn test:units" | ||
"test": "yarn test:units", | ||
"test:rpcs": "npx jest --no-cache test.rpc.availability.spec.js" | ||
}, | ||
"repository": "[email protected]:DePayFi/web3-blockchains.git", | ||
"keywords": [ | ||
|
@@ -32,7 +33,7 @@ | |
"dependencies": {}, | ||
"peerDependencies": {}, | ||
"engines": { | ||
"node": ">=10" | ||
"node": ">=18" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.12.9", | ||
|
@@ -43,6 +44,7 @@ | |
"@rollup/plugin-sucrase": "^3.1.0", | ||
"babel-loader": "^8.2.2", | ||
"babel-preset-env": "^1.7.0", | ||
"cross-fetch": "^4.0.0", | ||
"eslint": "^7.15.0", | ||
"eslint-plugin-import": "^2.22.1", | ||
"eslint-webpack-plugin": "^3.0.1", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
import 'regenerator-runtime/runtime' | ||
|
||
global.fetch = require('cross-fetch') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import Blockchains from 'src'; | ||
|
||
describe('test RPC availability', () => { | ||
|
||
Blockchains.all.filter((blockchain)=>!['solana'].includes(blockchain.name)).forEach((blockchain)=>{ | ||
|
||
describe(blockchain.label, ()=>{ | ||
|
||
blockchain.endpoints.forEach((endpoint)=>{ | ||
|
||
it(`${endpoint} works with up to 50 subrequests`, async()=>{ | ||
|
||
let response = await fetch(endpoint, { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify( | ||
Array.from({ length: 50 }, (_, index)=> index+1).map((index)=> { | ||
return( | ||
{ | ||
"jsonrpc": "2.0", | ||
"id": index, | ||
"method": "eth_call", | ||
"params": [ | ||
{ | ||
"to":"0x1f98431c8ad98523631ae4a59f267346ea31f984", | ||
"data":"0x1698ee82000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000000000064" | ||
} ,"latest" | ||
] | ||
} | ||
) | ||
}) | ||
) | ||
}) | ||
|
||
if (!response.ok) { | ||
throw new Error('Network response was not ok') | ||
} | ||
|
||
let json = await response.json() | ||
await Promise.all(json.map((item)=>{ | ||
return new Promise((resolve, reject)=>{ | ||
if(item.result && !item.error){ | ||
resolve() | ||
} else { | ||
reject('ERROR FOUND') | ||
} | ||
}) | ||
})) | ||
}) | ||
}) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters