@le-space/chains 0.2.0 → 0.4.0

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/src/index.js CHANGED
@@ -10,7 +10,10 @@
10
10
  // Console indexer, deployments)
11
11
  // evm Ethereum, Base, Polygon, … (Blockscout, Alchemy)
12
12
  // bitcoin Esplora, addresses from a zpub/xpub
13
- // filecoin Filfox
13
+ // filecoin Filfox; `readFilecoin`/`statementFilecoin` give
14
+ // LedgerEntry for the documents
15
+ // akash Akash as LedgerEntry (`akash` here, or `/akash`);
16
+ // `evmReader(chain)` the same for Ethereum and Base
14
17
  // near NearBlocks + an archival RPC (from Eigenbeleg);
15
18
  // `near` here, or `@le-space/chains/near`
16
19
  // aleph Aleph Cloud credits (no chain: Aleph's API, by the
@@ -35,8 +38,15 @@ export { bech32Decode, bech32Encode, isCosmosAddress, moduleAddress } from './be
35
38
  export { decodeTx, encodeTx } from './protobuf.js';
36
39
  export { createAkashConsoleClient, normalizeConsoleTx } from './akash-console.js';
37
40
  export { createAkashDeploymentsClient, decUnits } from './akash-deployments.js';
41
+ export * as akash from './akash.js';
38
42
 
39
- export { createEvmClient, isEvmAddress, normalizeEvm, toChecksumAddress } from './evm.js';
43
+ export {
44
+ createEvmClient,
45
+ evmReader,
46
+ isEvmAddress,
47
+ normalizeEvm,
48
+ toChecksumAddress
49
+ } from './evm.js';
40
50
  export { alchemyBaseUrl, computeUnitsOf, createAlchemyReader, isAlchemyKey } from './alchemy.js';
41
51
 
42
52
  export {
@@ -55,6 +65,8 @@ export {
55
65
  isFilecoinAddress,
56
66
  normalizeFilecoin,
57
67
  normalizeFilecoinTokens,
68
+ readFilecoin,
69
+ statementFilecoin,
58
70
  toFilecoinAddress
59
71
  } from './filecoin.js';
60
72
 
package/src/registry.js CHANGED
@@ -24,6 +24,7 @@
24
24
  import { addressUrl, txUrl } from './explorer.js';
25
25
  import { AKASH_CHAIN, NYX_CHAIN } from './cosmos-chains.js';
26
26
  import { FILECOIN } from './filecoin-chain.js';
27
+ import { KNOWN_EVM_CONTRACTS } from './evm-contracts.js';
27
28
 
28
29
  /**
29
30
  * @typedef {object} ChainAsset
@@ -108,30 +109,6 @@ const etherscanLike = (/** @type {string} */ name, /** @type {string} */ base) =
108
109
  address: `${base}/address/{address}`
109
110
  });
110
111
 
111
- /**
112
- * Contracts a wallet meets when it swaps (issue #115), by their lower-case
113
- * address, and what they are called. Routers of the big aggregators and DEXes
114
- * sit at the same address on most EVM chains; WETH is Ethereum's. Checked
115
- * against the projects' own documentation; an address not here stays
116
- * "Vertrag".
117
- */
118
- export const KNOWN_EVM_CONTRACTS = /** @type {Readonly<Record<string, string>>} */ (
119
- Object.freeze({
120
- '0x881d40237659c251811cec9c364ef91dc08d300c': 'MetaMask Swap (Router)',
121
- '0x74de5d4fcbf63e00296fd95d33236b9794016631': 'MetaMask Swap (Spender)',
122
- '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad': 'Uniswap (Universal Router)',
123
- '0x66a9893cc07d91d95644aedd05d03f95e1dba8af': 'Uniswap (Universal Router v4)',
124
- '0x7a250d5630b4cf539739df2c5dacb4c659f2488d': 'Uniswap V2 (Router)',
125
- '0xe592427a0aece92de3edee1f18e0157c05861564': 'Uniswap V3 (Router)',
126
- '0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45': 'Uniswap V3 (Router 2)',
127
- '0x1111111254eeb25477b68fb85ed929f73a960582': '1inch (Router v5)',
128
- '0x111111125421ca6dc452d289314280a0f8842a65': '1inch (Router v6)',
129
- '0xdef1c0ded9bec7f1a1670819833240f027b25eff': '0x (Exchange Proxy)',
130
- '0x9008d19f58aabd9ed0d60971565aa8510560ab41': 'CoW Protocol (Settlement)',
131
- '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2': 'WETH'
132
- })
133
- );
134
-
135
112
  /** @type {Readonly<Record<string, Chain>>} */
136
113
  export const CHAINS = Object.freeze({
137
114
  nyx: NYX_CHAIN,
@@ -255,7 +232,7 @@ export function chainOf(id) {
255
232
  return typeof id === 'string' && Object.hasOwn(CHAINS, id) ? CHAINS[id] : null;
256
233
  }
257
234
 
258
- export { txUrl, addressUrl };
235
+ export { txUrl, addressUrl, KNOWN_EVM_CONTRACTS };
259
236
 
260
237
  /**
261
238
  * What the app is told about the chains: everything but code.
@@ -0,0 +1,6 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // @le-space/chains/testing/aleph: a fake Aleph API as a `fetch` function
3
+ // (Node and browser) and a made-up account and month to feed it. Every
4
+ // address, hash and amount is made up.
5
+ export * from './aleph-fetch.js';
6
+ export * from './aleph-sample.js';