@forevermoney/sdk 0.1.0 → 0.2.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/CHANGELOG.md +21 -0
- package/README.md +27 -5
- package/dist/index.cjs +350 -223
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +49 -27
- package/dist/index.d.ts +49 -27
- package/dist/index.js +356 -206
- package/dist/index.js.map +1 -1
- package/examples/viem.ts +64 -0
- package/package.json +5 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.0 — 2026-09-10
|
|
4
|
+
|
|
5
|
+
- Replaced ethers with viem 2.56.3 for RPC clients, ABI encoding, gas estimation,
|
|
6
|
+
event decoding, and transaction tracking.
|
|
7
|
+
- Replaced `@polkadot/util` and `@polkadot/util-crypto` with PAPI's
|
|
8
|
+
`@polkadot-api/substrate-bindings` 0.21.1 for SS58 validation and mirror addresses.
|
|
9
|
+
- Added `toViemTransaction()` and a typed example that reuses existing viem clients.
|
|
10
|
+
Retained the dependency-free `toEthersTransaction()` compatibility adapter.
|
|
11
|
+
- Lower-level tracking functions accept viem public clients and retain support
|
|
12
|
+
for ethers-style JSON-RPC providers through a dependency-free adapter. The
|
|
13
|
+
high-level transport interface, human-readable ABIs, and plan format are unchanged.
|
|
14
|
+
- Enforced the plan's canonical chain in `toViemTransaction()` and rejected
|
|
15
|
+
unsupported chain IDs before signing.
|
|
16
|
+
- Preserved uppercase EVM address normalization and mixed-case checksum validation.
|
|
17
|
+
- Added regression tests for wrong-chain signing, legacy provider tracking, and
|
|
18
|
+
address normalization.
|
|
19
|
+
- Added original-implementation plan and address regression fixtures; migrated
|
|
20
|
+
offline tests, fork tests, and the guarded live canary to the new libraries.
|
|
21
|
+
- Fixed the Base canary to request staked delivery: its 0.001 TAO maximum is below
|
|
22
|
+
the 0.01 TAO liquid-delivery minimum. Broadcast guards and funding caps remain.
|
|
23
|
+
|
|
3
24
|
## 0.1.0
|
|
4
25
|
|
|
5
26
|
- Added canonical Base and Subtensor production deployment metadata.
|
package/README.md
CHANGED
|
@@ -19,6 +19,12 @@ npm install @forevermoney/sdk
|
|
|
19
19
|
|
|
20
20
|
Node.js 22 or newer is required. Both ESM and CommonJS builds are published.
|
|
21
21
|
|
|
22
|
+
The SDK uses viem for EVM reads, ABI encoding, and receipt decoding, and
|
|
23
|
+
PAPI's `@polkadot-api/substrate-bindings` for SS58 and EVM mirror addresses.
|
|
24
|
+
It does not require ethers or the legacy `@polkadot/*` packages. The full PAPI
|
|
25
|
+
RPC client is unnecessary because the bridge executes on Subtensor EVM;
|
|
26
|
+
this SDK does not sign native Substrate extrinsics.
|
|
27
|
+
|
|
22
28
|
## Create a client
|
|
23
29
|
|
|
24
30
|
```ts
|
|
@@ -54,8 +60,10 @@ const foreverMoney = createForeverMoneyClient({
|
|
|
54
60
|
})
|
|
55
61
|
```
|
|
56
62
|
|
|
57
|
-
|
|
58
|
-
|
|
63
|
+
Existing viem public clients can supply their `.transport` directly. See
|
|
64
|
+
[`examples/viem.ts`](./examples/viem.ts) for transport reuse and execution with a
|
|
65
|
+
viem wallet client, or [`examples/talisman.ts`](./examples/talisman.ts) for
|
|
66
|
+
raw EIP-1193 account and transaction handling.
|
|
59
67
|
|
|
60
68
|
## Prepare a bridge
|
|
61
69
|
|
|
@@ -163,9 +171,23 @@ for (const step of prepared.plan.steps) {
|
|
|
163
171
|
}
|
|
164
172
|
```
|
|
165
173
|
|
|
166
|
-
|
|
167
|
-
`
|
|
168
|
-
|
|
174
|
+
Viem consumers can pass `toViemTransaction(step.transaction)` to
|
|
175
|
+
`walletClient.sendTransaction()`. The adapter supplies the canonical `chain`
|
|
176
|
+
for the plan, so viem rejects a wallet connected to another network. Do not
|
|
177
|
+
override that chain or disable viem's chain assertion. The adapter maps
|
|
178
|
+
`from` to `account`, `gasLimit` to `gas`, and decimal quantities to `bigint`.
|
|
179
|
+
Confirm the signing account and chain before every signature. Local-account
|
|
180
|
+
signers must pass their account object explicitly, after checking that its
|
|
181
|
+
address matches the plan's sender.
|
|
182
|
+
|
|
183
|
+
`toEthersTransaction()` remains as a dependency-free compatibility adapter for
|
|
184
|
+
existing consumers. All adapters validate decimal quantities before conversion.
|
|
185
|
+
The exported lower-level tracking functions accept either a viem `PublicClient`
|
|
186
|
+
or an existing ethers-style provider with `send(method, params)`. Legacy
|
|
187
|
+
providers are adapted through their own transport without an ethers dependency.
|
|
188
|
+
The `createForeverMoneyClient()` transport interface is unchanged. Exported
|
|
189
|
+
`foreverMoneyAbis` remain human-readable; use viem's `parseAbi()` when calling
|
|
190
|
+
contracts directly.
|
|
169
191
|
|
|
170
192
|
If a plan contains an approval, its later transaction intentionally has no gas
|
|
171
193
|
limit: that transaction cannot be simulated against pre-approval state. The
|