chainlist-rpcs 0.4.205 → 0.5.205
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/modules/rpcs.js +3 -0
- package/package.json +2 -2
- package/tests/filter.test.js +18 -1
package/README.md
CHANGED
|
@@ -76,7 +76,7 @@ const multiple_chains_by_name = get_rpcs_for_chains( { chain_names: ["ethereum",
|
|
|
76
76
|
## Example usage with viem
|
|
77
77
|
|
|
78
78
|
```js
|
|
79
|
-
import { get_rpcs_for_chains
|
|
79
|
+
import { get_rpcs_for_chains } from 'chainlist-rpcs'
|
|
80
80
|
import { arbitrum } from 'viem/chains'
|
|
81
81
|
import { createPublicClient, fallback, http, formatEther } from 'viem'
|
|
82
82
|
|
package/modules/rpcs.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chainlist-rpcs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.205",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Wrapper around the rpcs as published by DefiLlama/chainlist.",
|
|
6
6
|
"main": "app.js",
|
|
@@ -30,4 +30,4 @@
|
|
|
30
30
|
"vitest": "^2.1.5"
|
|
31
31
|
},
|
|
32
32
|
"types": "types.d.ts"
|
|
33
|
-
}
|
|
33
|
+
}
|
package/tests/filter.test.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, it, expect } from 'vitest'
|
|
2
2
|
|
|
3
|
-
import { get_rpcs_for_chains, get_rpcs_for_chain, chains_by_name } from '../app'
|
|
3
|
+
import { get_rpcs_for_chains, get_rpcs_for_chain, chains_by_name, rpcs } from '../app'
|
|
4
4
|
import { chains_by_id } from '../app'
|
|
5
5
|
|
|
6
6
|
describe( 'get_rpcs_for_chain', () => {
|
|
@@ -120,4 +120,21 @@ describe( 'Chain constant should have coherent values', () => {
|
|
|
120
120
|
}
|
|
121
121
|
} )
|
|
122
122
|
|
|
123
|
+
} )
|
|
124
|
+
|
|
125
|
+
describe( 'RPCs constant should be coherent', () => {
|
|
126
|
+
it( 'Should be a mapping of ids to arrays of rpc objects', () => {
|
|
127
|
+
expect( rpcs ).toBeDefined()
|
|
128
|
+
expect( typeof rpcs ).toBe( 'object' )
|
|
129
|
+
for( const chain_id in rpcs ) {
|
|
130
|
+
expect( rpcs[chain_id] ).toBeDefined()
|
|
131
|
+
expect( Array.isArray( rpcs[chain_id] ) ).toBe( true )
|
|
132
|
+
for( const rpc of rpcs[chain_id] ) {
|
|
133
|
+
expect( typeof rpc ).toBe( 'object' )
|
|
134
|
+
expect( rpc.url ).toBeDefined()
|
|
135
|
+
expect( typeof rpc.url ).toBe( 'string' )
|
|
136
|
+
expect( [ 'none', 'limited', 'yes', 'unknown', 'unspecified' ].includes( rpc.tracking ) ).toBe( true )
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
} )
|
|
123
140
|
} )
|