zerc20-client-sdk 0.2.1 → 0.2.2

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.
Files changed (34) hide show
  1. package/README.md +34 -0
  2. package/dist/assets/abi/Verifier.json +2093 -1
  3. package/dist/index.d.ts +1 -0
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +1 -0
  6. package/dist/index.js.map +1 -1
  7. package/dist/operations/receive/__tests__/redeemTransaction.test.js +38 -0
  8. package/dist/operations/receive/__tests__/redeemTransaction.test.js.map +1 -1
  9. package/dist/operations/receive/index.d.ts +1 -1
  10. package/dist/operations/receive/index.d.ts.map +1 -1
  11. package/dist/operations/receive/index.js.map +1 -1
  12. package/dist/operations/receive/redeemTransaction.d.ts +2 -1
  13. package/dist/operations/receive/redeemTransaction.d.ts.map +1 -1
  14. package/dist/operations/receive/redeemTransaction.js +11 -5
  15. package/dist/operations/receive/redeemTransaction.js.map +1 -1
  16. package/dist/operations/receive/types.d.ts +25 -2
  17. package/dist/operations/receive/types.d.ts.map +1 -1
  18. package/dist/operations/relay/__tests__/relay.test.d.ts +2 -0
  19. package/dist/operations/relay/__tests__/relay.test.d.ts.map +1 -0
  20. package/dist/operations/relay/__tests__/relay.test.js +270 -0
  21. package/dist/operations/relay/__tests__/relay.test.js.map +1 -0
  22. package/dist/operations/relay/index.d.ts +3 -0
  23. package/dist/operations/relay/index.d.ts.map +1 -0
  24. package/dist/operations/relay/index.js +2 -0
  25. package/dist/operations/relay/index.js.map +1 -0
  26. package/dist/operations/relay/relay.d.ts +18 -0
  27. package/dist/operations/relay/relay.d.ts.map +1 -0
  28. package/dist/operations/relay/relay.js +103 -0
  29. package/dist/operations/relay/relay.js.map +1 -0
  30. package/dist/operations/relay/types.d.ts +63 -0
  31. package/dist/operations/relay/types.d.ts.map +1 -0
  32. package/dist/operations/relay/types.js +2 -0
  33. package/dist/operations/relay/types.js.map +1 -0
  34. package/package.json +1 -1
package/README.md CHANGED
@@ -94,6 +94,7 @@ src/
94
94
  │ ├── invoice.ts # Invoice creation
95
95
  │ ├── teleport.ts # Single teleport proof
96
96
  │ ├── teleportProof.ts # Batch teleport proof (Nova + Decider)
97
+ │ ├── relay/ # Relay node HTTP client (redeem/swap)
97
98
  │ ├── liquidityManager/ # Wrap/unwrap with slippage protection
98
99
  │ └── layerzeroScan/ # LayerZero message tracking & decoding
99
100
  ├── wasm/ # WASM runtime & bindings
@@ -170,6 +171,39 @@ const quote = await buildCrossUnwrapQuote({
170
171
  });
171
172
  ```
172
173
 
174
+ ### Relay Operations
175
+
176
+ Interact with a relay node for relayer-based redeem and token-to-native swap flows:
177
+
178
+ ```typescript
179
+ import {
180
+ estimateRelayFee,
181
+ fetchSwapQuote,
182
+ submitRelaySwap,
183
+ submitRelayTeleport,
184
+ } from "zerc20-client-sdk";
185
+
186
+ const fee = await estimateRelayFee("https://relay.example", 1);
187
+
188
+ const quote = await fetchSwapQuote("https://relay.example", 1, 1_000_000n);
189
+ if (quote.priceFallback) {
190
+ console.warn("Relay is using fallback oracle prices");
191
+ }
192
+
193
+ await submitRelaySwap("https://relay.example", {
194
+ chainId: 1,
195
+ tokenAmount: 1_000_000n,
196
+ minNativeAmount: 900_000n,
197
+ maxNativeAmount: quote.nativeAmount,
198
+ recipient: "0x...",
199
+ owner: "0x...",
200
+ permitDeadline: 1_700_000_000n,
201
+ permitV: 27,
202
+ permitR: "0x...",
203
+ permitS: "0x...",
204
+ });
205
+ ```
206
+
173
207
  ### Adaptor Withdraw (Stuck Fund Recovery)
174
208
 
175
209
  When a cross-chain unwrap fails (e.g. due to Stargate liquidity shortage), user funds may remain in the destination chain's Adaptor contract. The SDK provides functions to detect and recover these stuck funds: