epistery 1.3.7 → 1.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/README.md +65 -5
- package/artifacts/build-info/60715e1c329fcc4dc4bf715978075cf3.json +1 -0
- package/dist/chains/Chain.d.ts +117 -0
- package/dist/chains/Chain.d.ts.map +1 -0
- package/dist/chains/Chain.js +175 -0
- package/dist/chains/Chain.js.map +1 -0
- package/dist/chains/EthereumChain.d.ts +18 -0
- package/dist/chains/EthereumChain.d.ts.map +1 -0
- package/dist/chains/EthereumChain.js +26 -0
- package/dist/chains/EthereumChain.js.map +1 -0
- package/dist/chains/JapanOpenChain.d.ts +21 -0
- package/dist/chains/JapanOpenChain.d.ts.map +1 -0
- package/dist/chains/JapanOpenChain.js +36 -0
- package/dist/chains/JapanOpenChain.js.map +1 -0
- package/dist/chains/PolygonChain.d.ts +31 -0
- package/dist/chains/PolygonChain.d.ts.map +1 -0
- package/dist/chains/PolygonChain.js +50 -0
- package/dist/chains/PolygonChain.js.map +1 -0
- package/dist/chains/index.d.ts +22 -0
- package/dist/chains/index.d.ts.map +1 -0
- package/dist/chains/index.js +39 -0
- package/dist/chains/index.js.map +1 -0
- package/dist/chains/registry.d.ts +21 -0
- package/dist/chains/registry.d.ts.map +1 -0
- package/dist/chains/registry.js +53 -0
- package/dist/chains/registry.js.map +1 -0
- package/dist/utils/Utils.d.ts.map +1 -1
- package/dist/utils/Utils.js +3 -2
- package/dist/utils/Utils.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/index.mjs +6 -4
- package/package.json +1 -1
- package/src/chains/Chain.ts +221 -0
- package/src/chains/EthereumChain.ts +23 -0
- package/src/chains/JapanOpenChain.ts +37 -0
- package/src/chains/PolygonChain.ts +53 -0
- package/src/chains/README.md +109 -0
- package/src/chains/index.ts +27 -0
- package/src/chains/registry.ts +53 -0
- package/src/utils/Utils.ts +3 -2
- package/src/utils/index.ts +2 -1
package/README.md
CHANGED
|
@@ -198,13 +198,41 @@ email=you@example.com
|
|
|
198
198
|
[ipfs]
|
|
199
199
|
url=https://rootz.digital/api/v0
|
|
200
200
|
|
|
201
|
-
[default.provider]
|
|
202
|
-
chainId=420420422
|
|
203
|
-
name=polkadot-hub-testnet
|
|
204
|
-
rpc=https://testnet-passet-hub-eth-rpc.polkadot.io
|
|
205
|
-
|
|
206
201
|
[cli]
|
|
207
202
|
default_domain=localhost
|
|
203
|
+
|
|
204
|
+
# Legacy single provider (still supported):
|
|
205
|
+
[default.provider]
|
|
206
|
+
chainId=137
|
|
207
|
+
name=Polygon Mainnet
|
|
208
|
+
rpc=https://polygon-rpc.com
|
|
209
|
+
|
|
210
|
+
# Preferred: array of providers with public/private RPC separation.
|
|
211
|
+
# epistery-host uses this to populate the network selection dropdown
|
|
212
|
+
# and to inject private (API-key) RPCs for server-side calls.
|
|
213
|
+
|
|
214
|
+
[[default.providers]]
|
|
215
|
+
chainId=137
|
|
216
|
+
name=Polygon Mainnet
|
|
217
|
+
publicRpc=https://polygon-rpc.com
|
|
218
|
+
privateRpc=https://polygon-mainnet.g.alchemy.com/v2/YOUR_KEY
|
|
219
|
+
nativeCurrencyName=POL
|
|
220
|
+
nativeCurrencySymbol=POL
|
|
221
|
+
nativeCurrencyDecimals=18
|
|
222
|
+
|
|
223
|
+
[[default.providers]]
|
|
224
|
+
chainId=81
|
|
225
|
+
name=Japan Open Chain
|
|
226
|
+
publicRpc=https://rpc-2.japanopenchain.org:8545
|
|
227
|
+
nativeCurrencyName=JOC
|
|
228
|
+
nativeCurrencySymbol=JOC
|
|
229
|
+
nativeCurrencyDecimals=18
|
|
230
|
+
|
|
231
|
+
# Optional per-chain policy overrides (defaults are in code):
|
|
232
|
+
[default.providers.policy]
|
|
233
|
+
minPriorityFeeGwei=25
|
|
234
|
+
maxFeeMultiplier=2
|
|
235
|
+
gasLimitMultiplier=1.3
|
|
208
236
|
```
|
|
209
237
|
|
|
210
238
|
### Domain Config (`~/.epistery/mydomain.com/config.ini`)
|
|
@@ -298,11 +326,43 @@ Epistery follows a plugin architecture that integrates seamlessly with Express.j
|
|
|
298
326
|
- **Client Libraries** (`/client/*.js`): Browser-side authentication and data wallet tools
|
|
299
327
|
- **CLI** (`/cli/epistery.mjs`): Command-line interface for authenticated requests
|
|
300
328
|
- **Utils** (`/src/utils/`): Configuration, crypto operations, and Aqua protocol implementation
|
|
329
|
+
- **Chains** (`/src/chains/`): Per-chain provider, fee policy, and gas estimation
|
|
301
330
|
|
|
302
331
|
All endpoints follow RFC 8615 well-known URIs standard for service discovery.
|
|
303
332
|
|
|
304
333
|
See [Architecture.md](Architecture.md) for detailed architecture documentation.
|
|
305
334
|
|
|
335
|
+
### Chain Support
|
|
336
|
+
|
|
337
|
+
Each EVM chain epistery talks to is represented by a `Chain` object that owns the JSON-RPC provider, fee policy, and gas estimation strategy. Built-in chains:
|
|
338
|
+
|
|
339
|
+
| Chain | ID | Fee Model |
|
|
340
|
+
|-------|----|-----------|
|
|
341
|
+
| Polygon Mainnet | 137 | EIP-1559 with 25 gwei priority floor |
|
|
342
|
+
| Polygon Amoy | 80002 | EIP-1559 with 25 gwei priority floor |
|
|
343
|
+
| Ethereum Mainnet | 1 | Standard EIP-1559 |
|
|
344
|
+
| Sepolia Testnet | 11155111 | Standard EIP-1559 |
|
|
345
|
+
| Japan Open Chain | 81 | Legacy gasPrice with 30 gwei floor |
|
|
346
|
+
|
|
347
|
+
Use `chainFor()` to get a chain instance from a provider config:
|
|
348
|
+
|
|
349
|
+
```javascript
|
|
350
|
+
import { chainFor } from 'epistery';
|
|
351
|
+
|
|
352
|
+
const chain = chainFor(domainConfig.provider);
|
|
353
|
+
|
|
354
|
+
// Provider with explicit network info (no "could not detect network" errors)
|
|
355
|
+
const wallet = ethers.Wallet.fromMnemonic(mnemonic).connect(chain.provider);
|
|
356
|
+
|
|
357
|
+
// Per-chain fee data for transaction overrides
|
|
358
|
+
const feeData = await chain.getFeeData();
|
|
359
|
+
// → Polygon: { maxPriorityFeePerGas: 25 gwei, maxFeePerGas: 50 gwei }
|
|
360
|
+
// → JOC: { gasPrice: 30 gwei }
|
|
361
|
+
// → Ethereum: { maxPriorityFeePerGas: <network>, maxFeePerGas: <network> }
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
Adding a new chain is a single file — extend `Chain`, override the fee hooks that differ, and call `registerChain()`. No edits to existing code. See [src/chains/README.md](src/chains/README.md) for details.
|
|
365
|
+
|
|
306
366
|
## Use Cases
|
|
307
367
|
|
|
308
368
|
- **Decentralized Wikis**: User authentication and content ownership without central accounts
|