@elsoul/erpc-sdk 0.6.0 → 0.7.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/README.md +112 -0
- package/dist/index.cjs +3236 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +361 -1
- package/dist/index.d.ts +361 -1
- package/dist/index.js +3200 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,6 +36,117 @@ erpc.close()
|
|
|
36
36
|
JSON-RPC method calls return pending requests. Call `.send()` to perform the
|
|
37
37
|
network request.
|
|
38
38
|
|
|
39
|
+
## Offline token catalog
|
|
40
|
+
|
|
41
|
+
The token catalog is bundled with the package, so lookups do not need an
|
|
42
|
+
`ErpcClient`, API key, or network request. Deployment IDs are opaque and the
|
|
43
|
+
chain aliases expose those IDs directly:
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
import {
|
|
47
|
+
TOKEN_CHAIN_IDS,
|
|
48
|
+
findTokenDeploymentsBySymbol,
|
|
49
|
+
listTokenDeployments,
|
|
50
|
+
tokens,
|
|
51
|
+
} from '@elsoul/erpc-sdk'
|
|
52
|
+
|
|
53
|
+
const usdcByChain = {
|
|
54
|
+
ethereum: findTokenDeploymentsBySymbol(
|
|
55
|
+
TOKEN_CHAIN_IDS.ethereumMainnet,
|
|
56
|
+
'USDC',
|
|
57
|
+
),
|
|
58
|
+
solana: findTokenDeploymentsBySymbol(TOKEN_CHAIN_IDS.solanaMainnet, 'USDC'),
|
|
59
|
+
avalancheC: findTokenDeploymentsBySymbol(
|
|
60
|
+
TOKEN_CHAIN_IDS.avalancheCMainnet,
|
|
61
|
+
'USDC',
|
|
62
|
+
),
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const canonicalEthereumUsdcId = tokens.ethereum.USDC
|
|
66
|
+
const usdDeployments = listTokenDeployments({ stableCurrency: 'USD' })
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The result includes every matching deployment and its status, decimals,
|
|
70
|
+
standard, address, and flattened asset metadata. See the
|
|
71
|
+
[canonical registry guide](https://github.com/elsoul/erpc-sdk/blob/main/registry/README.md)
|
|
72
|
+
for the source data and ID policy.
|
|
73
|
+
|
|
74
|
+
## Offline token rankings
|
|
75
|
+
|
|
76
|
+
Ranking data is bundled as an immutable snapshot and is available without an
|
|
77
|
+
API key or network request:
|
|
78
|
+
|
|
79
|
+
```ts
|
|
80
|
+
import {
|
|
81
|
+
TOKEN_CHAIN_IDS,
|
|
82
|
+
TOKEN_RANKINGS_METADATA,
|
|
83
|
+
listTokenRankings,
|
|
84
|
+
} from '@elsoul/erpc-sdk'
|
|
85
|
+
|
|
86
|
+
const ethereumRankings = listTokenRankings(TOKEN_CHAIN_IDS.ethereumMainnet)
|
|
87
|
+
console.log({ status: TOKEN_RANKINGS_METADATA.status, ethereumRankings })
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Rows use the reviewed ranking metric recorded in
|
|
91
|
+
`TOKEN_RANKINGS_METADATA`. For the native total-supply-value metric, values are
|
|
92
|
+
exact rational values in atomic native units. The snapshot can be unconfigured
|
|
93
|
+
or partial, has no current-time filtering, and does not fetch live prices or
|
|
94
|
+
supply data; check its metadata before presenting a ranking as current.
|
|
95
|
+
|
|
96
|
+
## Offline DEX and pool catalog
|
|
97
|
+
|
|
98
|
+
DEX deployments, pool addresses, native/wrapped relationships, and
|
|
99
|
+
chain-qualified aliases are bundled as generated data. These lookups are
|
|
100
|
+
offline and use opaque IDs, so an Ethereum USDC address cannot be confused
|
|
101
|
+
with an Avalanche or Solana deployment:
|
|
102
|
+
|
|
103
|
+
The published package baseline is currently `0.6.0`. The DEX catalog and swap
|
|
104
|
+
exports described below are in the source tree for the unreleased `0.7.0`
|
|
105
|
+
line and are not part of published `0.6.0` packages yet.
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
import {
|
|
109
|
+
DEX_CHAIN_IDS,
|
|
110
|
+
dexes,
|
|
111
|
+
findPoolDefinitionsByPair,
|
|
112
|
+
getNativeWrapDefinition,
|
|
113
|
+
pools,
|
|
114
|
+
tokens,
|
|
115
|
+
} from '@elsoul/erpc-sdk'
|
|
116
|
+
|
|
117
|
+
const ethereumPools = findPoolDefinitionsByPair(
|
|
118
|
+
DEX_CHAIN_IDS.ethereum,
|
|
119
|
+
tokens.ethereum.WETH,
|
|
120
|
+
tokens.ethereum.USDC,
|
|
121
|
+
)
|
|
122
|
+
const uniswap = dexes.ethereum.UNISWAP_V2
|
|
123
|
+
const weth = getNativeWrapDefinition(tokens.ethereum.ETH)
|
|
124
|
+
const pool = pools.ethereum.UNISWAP_V2_USDC_WETH
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
The reviewed Ethereum Uniswap V2 and Avalanche LFJ legacy constant-product
|
|
128
|
+
pools support RPC-only exact-input quotes. Solana Orca and Raydium records are
|
|
129
|
+
available for lookup while their CLMM quote adapters are being added. Catalog
|
|
130
|
+
growth adds lookup and monitoring data; it does not implicitly add swap
|
|
131
|
+
eligibility:
|
|
132
|
+
|
|
133
|
+
```ts
|
|
134
|
+
const quote = await erpc.swap.quoteExactInput({
|
|
135
|
+
chainId: DEX_CHAIN_IDS.ethereum,
|
|
136
|
+
poolDefinitionId: pool,
|
|
137
|
+
inputTokenDeploymentId: tokens.ethereum.WETH,
|
|
138
|
+
outputTokenDeploymentId: tokens.ethereum.USDC,
|
|
139
|
+
amountIn: '1000000000000000000',
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
console.log(quote.amountOut)
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Quotes read the configured EVM RPC at one EIP-1898 block snapshot and apply
|
|
146
|
+
the constant-product formula locally. The request does not build, sign,
|
|
147
|
+
simulate, or broadcast a transaction; route selection, slippage, bridging,
|
|
148
|
+
and Solana CLMM execution are separate capabilities.
|
|
149
|
+
|
|
39
150
|
## Namespaces
|
|
40
151
|
|
|
41
152
|
| Namespace | Purpose |
|
|
@@ -141,6 +252,7 @@ const result = await erpc.solana.rpc
|
|
|
141
252
|
## Documentation
|
|
142
253
|
|
|
143
254
|
- [Complete guide](https://github.com/elsoul/erpc-sdk#readme)
|
|
255
|
+
- [Solana transaction v1 guide](https://github.com/elsoul/erpc-sdk/blob/main/packages/typescript/docs/solana-v1.md)
|
|
144
256
|
- [Method availability](https://github.com/elsoul/erpc-sdk/blob/main/docs/METHODS.md)
|
|
145
257
|
- [Roadmap](https://github.com/elsoul/erpc-sdk/blob/main/ROADMAP.md)
|
|
146
258
|
- [Security policy](https://github.com/elsoul/erpc-sdk/blob/main/SECURITY.md)
|