@ethernauta/chain 0.0.42 → 0.0.43
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 +27 -21
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[](https://deno.bundlejs.com/?q=@ethernauta/chain&treeshake=[*])
|
|
2
2
|
|
|
3
3
|
## Philosophy
|
|
4
4
|
|
|
@@ -7,33 +7,39 @@ This module aims to be an un-opinionated representation of the defined:
|
|
|
7
7
|
- [Ethereum chains](https://github.com/ethereum-lists/chains/tree/master/_data/chains)
|
|
8
8
|
- [chain schema](https://github.com/ethereum-lists/chains/blob/master/tools/schema/chainSchema.json)
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
- [abi](https://github.com/niconiahi/ethernauta/blob/main/packages/abi) [[NPM](https://www.npmjs.com/package/@ethernauta/abi)]
|
|
13
|
-
- [chain](https://github.com/niconiahi/ethernauta/blob/main/packages/chain) [[NPM](https://www.npmjs.com/package/@ethernauta/chain)]
|
|
14
|
-
- [cli](https://github.com/niconiahi/ethernauta/blob/main/packages/cli) [[NPM](https://www.npmjs.com/package/@ethernauta/cli)]
|
|
15
|
-
- [erc](https://github.com/niconiahi/ethernauta/blob/main/packages/erc) [[NPM](https://www.npmjs.com/package/@ethernauta/erc)]
|
|
16
|
-
- [eth](https://github.com/niconiahi/ethernauta/blob/main/packages/eth) [[NPM](https://www.npmjs.com/package/@ethernauta/eth)]
|
|
17
|
-
- [transaction](https://github.com/niconiahi/ethernauta/blob/main/packages/transaction) [[NPM](https://www.npmjs.com/package/@ethernauta/transaction)]
|
|
18
|
-
- [utils](https://github.com/niconiahi/ethernauta/blob/main/packages/utils) [[NPM](https://www.npmjs.com/package/@ethernauta/utils)]
|
|
19
|
-
- [wallet](https://github.com/niconiahi/ethernauta/blob/main/packages/wallet)
|
|
10
|
+
Each chain is exported as a const that you can pair with `encode_chain_id` (from `@ethernauta/transport`) to produce a [CAIP-2](https://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-2.md) identifier.
|
|
20
11
|
|
|
21
|
-
##
|
|
12
|
+
## Modules
|
|
22
13
|
|
|
23
|
-
|
|
14
|
+
- [abi](https://github.com/niconiahi/ethernauta/tree/main/packages/abi) [[NPM](https://www.npmjs.com/package/@ethernauta/abi)]
|
|
15
|
+
- [chain](https://github.com/niconiahi/ethernauta/tree/main/packages/chain) [[NPM](https://www.npmjs.com/package/@ethernauta/chain)]
|
|
16
|
+
- [cli](https://github.com/niconiahi/ethernauta/tree/main/packages/cli) [[NPM](https://www.npmjs.com/package/@ethernauta/cli)]
|
|
17
|
+
- [eip](https://github.com/niconiahi/ethernauta/tree/main/packages/eip) [[NPM](https://www.npmjs.com/package/@ethernauta/eip)]
|
|
18
|
+
- [erc](https://github.com/niconiahi/ethernauta/tree/main/packages/erc) [[NPM](https://www.npmjs.com/package/@ethernauta/erc)]
|
|
19
|
+
- [eth](https://github.com/niconiahi/ethernauta/tree/main/packages/eth) [[NPM](https://www.npmjs.com/package/@ethernauta/eth)]
|
|
20
|
+
- [transaction](https://github.com/niconiahi/ethernauta/tree/main/packages/transaction) [[NPM](https://www.npmjs.com/package/@ethernauta/transaction)]
|
|
21
|
+
- [transport](https://github.com/niconiahi/ethernauta/tree/main/packages/transport) [[NPM](https://www.npmjs.com/package/@ethernauta/transport)]
|
|
22
|
+
- [utils](https://github.com/niconiahi/ethernauta/tree/main/packages/utils) [[NPM](https://www.npmjs.com/package/@ethernauta/utils)]
|
|
23
|
+
- [wallet](https://github.com/niconiahi/ethernauta/tree/main/packages/wallet)
|
|
24
24
|
|
|
25
25
|
## API
|
|
26
26
|
|
|
27
|
-
```
|
|
28
|
-
import {
|
|
27
|
+
```ts
|
|
28
|
+
import { eip155_11155111 } from "@ethernauta/chain"
|
|
29
|
+
import {
|
|
30
|
+
decode_chain_id,
|
|
31
|
+
encode_chain_id,
|
|
32
|
+
} from "@ethernauta/transport"
|
|
33
|
+
|
|
29
34
|
const chain_id = encode_chain_id({
|
|
30
35
|
namespace: "eip155",
|
|
31
|
-
reference:
|
|
32
|
-
})
|
|
33
|
-
console.log(chain_id)// eip155:11155111
|
|
36
|
+
reference: eip155_11155111.chainId,
|
|
37
|
+
})
|
|
38
|
+
console.log(chain_id) // eip155:11155111
|
|
39
|
+
|
|
34
40
|
const { namespace, reference } = decode_chain_id(chain_id)
|
|
35
|
-
console.log(namespace)// eip155
|
|
36
|
-
console.log(reference)// 11155111
|
|
41
|
+
console.log(namespace) // eip155
|
|
42
|
+
console.log(reference) // 11155111
|
|
37
43
|
```
|
|
38
44
|
|
|
39
45
|
## Files to pay attention
|
|
@@ -43,4 +49,4 @@ console.log(reference)// 11155111
|
|
|
43
49
|
### chain
|
|
44
50
|
|
|
45
51
|
- [chain/shared.ts](https://github.com/niconiahi/ethernauta/blob/main/packages/chain/src/chain/shared.ts)
|
|
46
|
-
- [chain/eip155
|
|
52
|
+
- [chain/eip155](https://github.com/niconiahi/ethernauta/tree/main/packages/chain/src/chain/eip155) (500+ chain definitions)
|