zerc20-client-sdk 0.1.15 → 0.2.1
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 +275 -25
- package/dist/chain/__tests__/metadata.test.d.ts +2 -0
- package/dist/chain/__tests__/metadata.test.d.ts.map +1 -0
- package/dist/chain/__tests__/metadata.test.js +162 -0
- package/dist/chain/__tests__/metadata.test.js.map +1 -0
- package/dist/chain/index.d.ts +3 -0
- package/dist/chain/index.d.ts.map +1 -0
- package/dist/chain/index.js +2 -0
- package/dist/chain/index.js.map +1 -0
- package/dist/chain/metadata.d.ts +38 -0
- package/dist/chain/metadata.d.ts.map +1 -0
- package/dist/chain/metadata.js +158 -0
- package/dist/chain/metadata.js.map +1 -0
- package/dist/chain/types.d.ts +18 -0
- package/dist/chain/types.d.ts.map +1 -0
- package/dist/chain/types.js +2 -0
- package/dist/chain/types.js.map +1 -0
- package/dist/constants.d.ts +3 -3
- package/dist/constants.js +3 -3
- package/dist/ic/__tests__/connections.test.js +16 -152
- package/dist/ic/__tests__/connections.test.js.map +1 -1
- package/dist/ic/__tests__/recipient.test.d.ts +2 -0
- package/dist/ic/__tests__/recipient.test.d.ts.map +1 -0
- package/dist/ic/__tests__/recipient.test.js +47 -0
- package/dist/ic/__tests__/recipient.test.js.map +1 -0
- package/dist/ic/authorization.js +2 -2
- package/dist/ic/authorization.js.map +1 -1
- package/dist/ic/connections.d.ts +0 -50
- package/dist/ic/connections.d.ts.map +1 -1
- package/dist/ic/connections.js +0 -127
- package/dist/ic/connections.js.map +1 -1
- package/dist/ic/index.d.ts +4 -8
- package/dist/ic/index.d.ts.map +1 -1
- package/dist/ic/index.js +3 -8
- package/dist/ic/index.js.map +1 -1
- package/dist/ic/recipient.d.ts +10 -0
- package/dist/ic/recipient.d.ts.map +1 -1
- package/dist/ic/recipient.js +21 -1
- package/dist/ic/recipient.js.map +1 -1
- package/dist/index.d.ts +14 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/dist/onchain/__tests__/contracts.test.js +2 -32
- package/dist/onchain/__tests__/contracts.test.js.map +1 -1
- package/dist/onchain/__tests__/decode.test.d.ts +2 -0
- package/dist/onchain/__tests__/decode.test.d.ts.map +1 -0
- package/dist/onchain/__tests__/decode.test.js +155 -0
- package/dist/onchain/__tests__/decode.test.js.map +1 -0
- package/dist/onchain/__tests__/tokenReads.test.d.ts +2 -0
- package/dist/onchain/__tests__/tokenReads.test.d.ts.map +1 -0
- package/dist/onchain/__tests__/tokenReads.test.js +60 -0
- package/dist/onchain/__tests__/tokenReads.test.js.map +1 -0
- package/dist/onchain/contracts.d.ts +3 -29734
- package/dist/onchain/contracts.d.ts.map +1 -1
- package/dist/onchain/contracts.js +3 -59
- package/dist/onchain/contracts.js.map +1 -1
- package/dist/onchain/decode.d.ts +39 -0
- package/dist/onchain/decode.d.ts.map +1 -0
- package/dist/onchain/decode.js +100 -0
- package/dist/onchain/decode.js.map +1 -0
- package/dist/onchain/tokenReads.d.ts +30 -0
- package/dist/onchain/tokenReads.d.ts.map +1 -0
- package/dist/onchain/tokenReads.js +51 -0
- package/dist/onchain/tokenReads.js.map +1 -0
- package/dist/operations/__tests__/invoice.test.js +52 -1
- package/dist/operations/__tests__/invoice.test.js.map +1 -1
- package/dist/operations/__tests__/privateSendTransfer.test.d.ts +2 -0
- package/dist/operations/__tests__/privateSendTransfer.test.d.ts.map +1 -0
- package/dist/operations/__tests__/privateSendTransfer.test.js +60 -0
- package/dist/operations/__tests__/privateSendTransfer.test.js.map +1 -0
- package/dist/operations/__tests__/reexports.test.js +1 -1
- package/dist/operations/__tests__/reexports.test.js.map +1 -1
- package/dist/operations/__tests__/teleportProof.test.js +35 -75
- package/dist/operations/__tests__/teleportProof.test.js.map +1 -1
- package/dist/operations/invoice.d.ts +14 -0
- package/dist/operations/invoice.d.ts.map +1 -1
- package/dist/operations/invoice.js +22 -0
- package/dist/operations/invoice.js.map +1 -1
- package/dist/operations/layerzeroScan/__tests__/codec.decode.test.d.ts +2 -0
- package/dist/operations/layerzeroScan/__tests__/codec.decode.test.d.ts.map +1 -0
- package/dist/operations/layerzeroScan/__tests__/codec.decode.test.js +57 -0
- package/dist/operations/layerzeroScan/__tests__/codec.decode.test.js.map +1 -0
- package/dist/operations/layerzeroScan/__tests__/codec.test.d.ts +2 -0
- package/dist/operations/layerzeroScan/__tests__/codec.test.d.ts.map +1 -0
- package/dist/operations/layerzeroScan/__tests__/codec.test.js +120 -0
- package/dist/operations/layerzeroScan/__tests__/codec.test.js.map +1 -0
- package/dist/operations/layerzeroScan/__tests__/formatters.test.d.ts +2 -0
- package/dist/operations/layerzeroScan/__tests__/formatters.test.d.ts.map +1 -0
- package/dist/operations/layerzeroScan/__tests__/formatters.test.js +164 -0
- package/dist/operations/layerzeroScan/__tests__/formatters.test.js.map +1 -0
- package/dist/operations/layerzeroScan/__tests__/integration.test.d.ts +2 -0
- package/dist/operations/layerzeroScan/__tests__/integration.test.d.ts.map +1 -0
- package/dist/operations/layerzeroScan/__tests__/integration.test.js +164 -0
- package/dist/operations/layerzeroScan/__tests__/integration.test.js.map +1 -0
- package/dist/operations/layerzeroScan/__tests__/scan.test.d.ts +2 -0
- package/dist/operations/layerzeroScan/__tests__/scan.test.d.ts.map +1 -0
- package/dist/operations/layerzeroScan/__tests__/scan.test.js +103 -0
- package/dist/operations/layerzeroScan/__tests__/scan.test.js.map +1 -0
- package/dist/operations/layerzeroScan/__tests__/status.test.d.ts +2 -0
- package/dist/operations/layerzeroScan/__tests__/status.test.d.ts.map +1 -0
- package/dist/operations/layerzeroScan/__tests__/status.test.js +153 -0
- package/dist/operations/layerzeroScan/__tests__/status.test.js.map +1 -0
- package/dist/operations/layerzeroScan/codec.d.ts +34 -0
- package/dist/operations/layerzeroScan/codec.d.ts.map +1 -0
- package/dist/operations/layerzeroScan/codec.js +79 -0
- package/dist/operations/layerzeroScan/codec.js.map +1 -0
- package/dist/operations/layerzeroScan/formatters.d.ts +26 -0
- package/dist/operations/layerzeroScan/formatters.d.ts.map +1 -0
- package/dist/operations/layerzeroScan/formatters.js +75 -0
- package/dist/operations/layerzeroScan/formatters.js.map +1 -0
- package/dist/operations/layerzeroScan/index.d.ts +9 -0
- package/dist/operations/layerzeroScan/index.d.ts.map +1 -0
- package/dist/operations/layerzeroScan/index.js +12 -0
- package/dist/operations/layerzeroScan/index.js.map +1 -0
- package/dist/operations/layerzeroScan/scan.d.ts +21 -0
- package/dist/operations/layerzeroScan/scan.d.ts.map +1 -0
- package/dist/operations/layerzeroScan/scan.js +70 -0
- package/dist/operations/layerzeroScan/scan.js.map +1 -0
- package/dist/operations/layerzeroScan/status.d.ts +17 -0
- package/dist/operations/layerzeroScan/status.d.ts.map +1 -0
- package/dist/operations/layerzeroScan/status.js +178 -0
- package/dist/operations/layerzeroScan/status.js.map +1 -0
- package/dist/operations/layerzeroScan/types.d.ts +181 -0
- package/dist/operations/layerzeroScan/types.d.ts.map +1 -0
- package/dist/operations/layerzeroScan/types.js +5 -0
- package/dist/operations/layerzeroScan/types.js.map +1 -0
- package/dist/operations/layerzeroScan.d.ts +5 -0
- package/dist/operations/layerzeroScan.d.ts.map +1 -0
- package/dist/operations/layerzeroScan.js +5 -0
- package/dist/operations/layerzeroScan.js.map +1 -0
- package/dist/operations/liquidityManager/__tests__/adaptorWithdraw.test.d.ts +2 -0
- package/dist/operations/liquidityManager/__tests__/adaptorWithdraw.test.d.ts.map +1 -0
- package/dist/operations/liquidityManager/__tests__/adaptorWithdraw.test.js +157 -0
- package/dist/operations/liquidityManager/__tests__/adaptorWithdraw.test.js.map +1 -0
- package/dist/operations/liquidityManager/__tests__/balance.test.js +24 -37
- package/dist/operations/liquidityManager/__tests__/balance.test.js.map +1 -1
- package/dist/operations/liquidityManager/__tests__/crossUnwrap.test.js +51 -31
- package/dist/operations/liquidityManager/__tests__/crossUnwrap.test.js.map +1 -1
- package/dist/operations/liquidityManager/__tests__/helpers.test.js +11 -8
- package/dist/operations/liquidityManager/__tests__/helpers.test.js.map +1 -1
- package/dist/operations/liquidityManager/__tests__/unwrap.test.js +68 -82
- package/dist/operations/liquidityManager/__tests__/unwrap.test.js.map +1 -1
- package/dist/operations/liquidityManager/__tests__/wrap.test.js +55 -64
- package/dist/operations/liquidityManager/__tests__/wrap.test.js.map +1 -1
- package/dist/operations/liquidityManager/abi.d.ts +57 -0
- package/dist/operations/liquidityManager/abi.d.ts.map +1 -0
- package/dist/operations/liquidityManager/abi.js +41 -0
- package/dist/operations/liquidityManager/abi.js.map +1 -0
- package/dist/operations/liquidityManager/adaptorWithdraw.d.ts +82 -0
- package/dist/operations/liquidityManager/adaptorWithdraw.d.ts.map +1 -0
- package/dist/operations/liquidityManager/adaptorWithdraw.js +107 -0
- package/dist/operations/liquidityManager/adaptorWithdraw.js.map +1 -0
- package/dist/operations/liquidityManager/balance.d.ts +3 -3
- package/dist/operations/liquidityManager/balance.d.ts.map +1 -1
- package/dist/operations/liquidityManager/balance.js +22 -15
- package/dist/operations/liquidityManager/balance.js.map +1 -1
- package/dist/operations/liquidityManager/crossUnwrap.d.ts +13 -11
- package/dist/operations/liquidityManager/crossUnwrap.d.ts.map +1 -1
- package/dist/operations/liquidityManager/crossUnwrap.js +44 -20
- package/dist/operations/liquidityManager/crossUnwrap.js.map +1 -1
- package/dist/operations/liquidityManager/helpers.d.ts +10 -15474
- package/dist/operations/liquidityManager/helpers.d.ts.map +1 -1
- package/dist/operations/liquidityManager/helpers.js +28 -18
- package/dist/operations/liquidityManager/helpers.js.map +1 -1
- package/dist/operations/liquidityManager/index.d.ts +3 -0
- package/dist/operations/liquidityManager/index.d.ts.map +1 -1
- package/dist/operations/liquidityManager/index.js +3 -0
- package/dist/operations/liquidityManager/index.js.map +1 -1
- package/dist/operations/liquidityManager/types.d.ts +1 -1
- package/dist/operations/liquidityManager/types.d.ts.map +1 -1
- package/dist/operations/liquidityManager/unwrap.d.ts +9 -9
- package/dist/operations/liquidityManager/unwrap.d.ts.map +1 -1
- package/dist/operations/liquidityManager/unwrap.js +48 -24
- package/dist/operations/liquidityManager/unwrap.js.map +1 -1
- package/dist/operations/liquidityManager/wrap.d.ts +7 -7
- package/dist/operations/liquidityManager/wrap.d.ts.map +1 -1
- package/dist/operations/liquidityManager/wrap.js +35 -16
- package/dist/operations/liquidityManager/wrap.js.map +1 -1
- package/dist/operations/privateSend.d.ts +33 -0
- package/dist/operations/privateSend.d.ts.map +1 -1
- package/dist/operations/privateSend.js +26 -0
- package/dist/operations/privateSend.js.map +1 -1
- package/dist/operations/receive/__tests__/announcementStatus.test.js +34 -11
- package/dist/operations/receive/__tests__/announcementStatus.test.js.map +1 -1
- package/dist/operations/receive/__tests__/cache.test.js +55 -161
- package/dist/operations/receive/__tests__/cache.test.js.map +1 -1
- package/dist/operations/receive/__tests__/createVerifierReader.test.d.ts +2 -0
- package/dist/operations/receive/__tests__/createVerifierReader.test.d.ts.map +1 -0
- package/dist/operations/receive/__tests__/createVerifierReader.test.js +28 -0
- package/dist/operations/receive/__tests__/createVerifierReader.test.js.map +1 -0
- package/dist/operations/receive/__tests__/helpers.test.js +9 -9
- package/dist/operations/receive/__tests__/helpers.test.js.map +1 -1
- package/dist/operations/receive/__tests__/redeemTransaction.test.d.ts +2 -0
- package/dist/operations/receive/__tests__/redeemTransaction.test.d.ts.map +1 -0
- package/dist/operations/receive/__tests__/redeemTransaction.test.js +258 -0
- package/dist/operations/receive/__tests__/redeemTransaction.test.js.map +1 -0
- package/dist/operations/receive/__tests__/submitRedeem.test.d.ts +2 -0
- package/dist/operations/receive/__tests__/submitRedeem.test.d.ts.map +1 -0
- package/dist/operations/receive/__tests__/submitRedeem.test.js +58 -0
- package/dist/operations/receive/__tests__/submitRedeem.test.js.map +1 -0
- package/dist/operations/receive/announcementStatus.d.ts +1 -1
- package/dist/operations/receive/announcementStatus.d.ts.map +1 -1
- package/dist/operations/receive/announcementStatus.js +7 -5
- package/dist/operations/receive/announcementStatus.js.map +1 -1
- package/dist/operations/receive/cache.d.ts +1 -19
- package/dist/operations/receive/cache.d.ts.map +1 -1
- package/dist/operations/receive/cache.js +6 -35
- package/dist/operations/receive/cache.js.map +1 -1
- package/dist/operations/receive/helpers.d.ts +14 -3
- package/dist/operations/receive/helpers.d.ts.map +1 -1
- package/dist/operations/receive/helpers.js +33 -3
- package/dist/operations/receive/helpers.js.map +1 -1
- package/dist/operations/receive/index.d.ts +6 -2
- package/dist/operations/receive/index.d.ts.map +1 -1
- package/dist/operations/receive/index.js +6 -1
- package/dist/operations/receive/index.js.map +1 -1
- package/dist/operations/receive/redeemTransaction.d.ts +30 -0
- package/dist/operations/receive/redeemTransaction.d.ts.map +1 -0
- package/dist/operations/receive/redeemTransaction.js +104 -0
- package/dist/operations/receive/redeemTransaction.js.map +1 -0
- package/dist/operations/receive/submitRedeem.d.ts +32 -0
- package/dist/operations/receive/submitRedeem.d.ts.map +1 -0
- package/dist/operations/receive/submitRedeem.js +27 -0
- package/dist/operations/receive/submitRedeem.js.map +1 -0
- package/dist/operations/receive/types.d.ts +53 -5
- package/dist/operations/receive/types.d.ts.map +1 -1
- package/dist/operations/teleportProof.d.ts +10 -31
- package/dist/operations/teleportProof.d.ts.map +1 -1
- package/dist/operations/teleportProof.js +14 -26
- package/dist/operations/teleportProof.js.map +1 -1
- package/dist/registry/__tests__/helpers.test.js +2 -44
- package/dist/registry/__tests__/helpers.test.js.map +1 -1
- package/dist/registry/__tests__/loader.test.js +17 -191
- package/dist/registry/__tests__/loader.test.js.map +1 -1
- package/dist/registry/__tests__/normalize.test.js +109 -1
- package/dist/registry/__tests__/normalize.test.js.map +1 -1
- package/dist/registry/helpers.d.ts +0 -7
- package/dist/registry/helpers.d.ts.map +1 -1
- package/dist/registry/helpers.js +0 -14
- package/dist/registry/helpers.js.map +1 -1
- package/dist/registry/index.d.ts +5 -5
- package/dist/registry/index.d.ts.map +1 -1
- package/dist/registry/index.js +4 -4
- package/dist/registry/index.js.map +1 -1
- package/dist/registry/loader.d.ts +0 -25
- package/dist/registry/loader.d.ts.map +1 -1
- package/dist/registry/loader.js +0 -68
- package/dist/registry/loader.js.map +1 -1
- package/dist/registry/normalize.d.ts +13 -1
- package/dist/registry/normalize.d.ts.map +1 -1
- package/dist/registry/normalize.js +43 -0
- package/dist/registry/normalize.js.map +1 -1
- package/dist/registry/types.d.ts +13 -2
- package/dist/registry/types.d.ts.map +1 -1
- package/dist/types/__tests__/evm.test.d.ts +2 -0
- package/dist/types/__tests__/evm.test.d.ts.map +1 -0
- package/dist/types/__tests__/evm.test.js +15 -0
- package/dist/types/__tests__/evm.test.js.map +1 -0
- package/dist/types/evm.d.ts +95 -0
- package/dist/types/evm.d.ts.map +1 -0
- package/dist/types/evm.js +11 -0
- package/dist/types/evm.js.map +1 -0
- package/dist/types.d.ts +15 -13
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/__tests__/fees.test.js +66 -29
- package/dist/utils/__tests__/fees.test.js.map +1 -1
- package/dist/utils/__tests__/hex.test.js +64 -1
- package/dist/utils/__tests__/hex.test.js.map +1 -1
- package/dist/utils/__tests__/http.test.js +2 -64
- package/dist/utils/__tests__/http.test.js.map +1 -1
- package/dist/utils/fees.d.ts +7 -2
- package/dist/utils/fees.d.ts.map +1 -1
- package/dist/utils/fees.js +32 -16
- package/dist/utils/fees.js.map +1 -1
- package/dist/utils/hex.d.ts +11 -0
- package/dist/utils/hex.d.ts.map +1 -1
- package/dist/utils/hex.js +16 -1
- package/dist/utils/hex.js.map +1 -1
- package/dist/utils/http.d.ts +0 -27
- package/dist/utils/http.d.ts.map +1 -1
- package/dist/utils/http.js +0 -36
- package/dist/utils/http.js.map +1 -1
- package/dist/wasm/__tests__/functions.test.js +56 -1
- package/dist/wasm/__tests__/functions.test.js.map +1 -1
- package/dist/wasm/functions.d.ts +6 -0
- package/dist/wasm/functions.d.ts.map +1 -1
- package/dist/wasm/functions.js +17 -0
- package/dist/wasm/functions.js.map +1 -1
- package/dist/wasm/index.d.ts +1 -1
- package/dist/wasm/index.d.ts.map +1 -1
- package/dist/wasm/index.js +1 -1
- package/dist/wasm/index.js.map +1 -1
- package/dist/zkp/__tests__/proofService.test.js +34 -52
- package/dist/zkp/__tests__/proofService.test.js.map +1 -1
- package/dist/zkp/__tests__/workerClient.test.js +1 -40
- package/dist/zkp/__tests__/workerClient.test.js.map +1 -1
- package/dist/zkp/index.d.ts +1 -1
- package/dist/zkp/index.d.ts.map +1 -1
- package/dist/zkp/index.js +1 -1
- package/dist/zkp/index.js.map +1 -1
- package/dist/zkp/proofService.d.ts +6 -2
- package/dist/zkp/proofService.d.ts.map +1 -1
- package/dist/zkp/proofService.js +12 -15
- package/dist/zkp/proofService.js.map +1 -1
- package/dist/zkp/worker.js +13 -137
- package/dist/zkp/worker.js.map +1 -1
- package/dist/zkp/workerClient.d.ts +0 -24
- package/dist/zkp/workerClient.d.ts.map +1 -1
- package/dist/zkp/workerClient.js +0 -36
- package/dist/zkp/workerClient.js.map +1 -1
- package/package.json +3 -4
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal ERC-20 ABI subset used by liquidity manager operations.
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export const ERC20_ABI = [
|
|
6
|
+
{
|
|
7
|
+
name: "balanceOf",
|
|
8
|
+
type: "function",
|
|
9
|
+
stateMutability: "view",
|
|
10
|
+
inputs: [{ name: "account", type: "address" }],
|
|
11
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: "decimals",
|
|
15
|
+
type: "function",
|
|
16
|
+
stateMutability: "view",
|
|
17
|
+
inputs: [],
|
|
18
|
+
outputs: [{ name: "", type: "uint8" }],
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: "allowance",
|
|
22
|
+
type: "function",
|
|
23
|
+
stateMutability: "view",
|
|
24
|
+
inputs: [
|
|
25
|
+
{ name: "owner", type: "address" },
|
|
26
|
+
{ name: "spender", type: "address" },
|
|
27
|
+
],
|
|
28
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: "approve",
|
|
32
|
+
type: "function",
|
|
33
|
+
stateMutability: "nonpayable",
|
|
34
|
+
inputs: [
|
|
35
|
+
{ name: "spender", type: "address" },
|
|
36
|
+
{ name: "amount", type: "uint256" },
|
|
37
|
+
],
|
|
38
|
+
outputs: [{ name: "", type: "bool" }],
|
|
39
|
+
},
|
|
40
|
+
];
|
|
41
|
+
//# sourceMappingURL=abi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abi.js","sourceRoot":"","sources":["../../../src/operations/liquidityManager/abi.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB;QACE,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE,MAAM;QACvB,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QAC9C,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;KACzC;IACD;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE,MAAM;QACvB,MAAM,EAAE,EAAE;QACV,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;KACvC;IACD;QACE,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE,MAAM;QACvB,MAAM,EAAE;YACN,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;YAClC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;SACrC;QACD,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;KACzC;IACD;QACE,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE,YAAY;QAC7B,MAAM,EAAE;YACN,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;YACpC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE;SACpC;QACD,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;KACtC;CACO,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adaptor withdraw operations for rescuing stuck funds from failed cross-chain unwraps.
|
|
3
|
+
*/
|
|
4
|
+
import type { EvmReadProvider, EvmWriteProvider } from "../../types/evm.js";
|
|
5
|
+
import { type FeeOverrides } from "../../utils/fees.js";
|
|
6
|
+
/**
|
|
7
|
+
* Balances stuck in an adaptor contract for a given user.
|
|
8
|
+
*/
|
|
9
|
+
export interface AdaptorBalances {
|
|
10
|
+
/** Underlying token balance stuck in the adaptor. */
|
|
11
|
+
underlyingTokenBalance: bigint;
|
|
12
|
+
/** zERC20 token balance stuck in the adaptor. */
|
|
13
|
+
zerc20Balance: bigint;
|
|
14
|
+
/** Native token balance stuck in the adaptor. */
|
|
15
|
+
nativeBalance: bigint;
|
|
16
|
+
/** Underlying token address as configured in the adaptor. */
|
|
17
|
+
underlyingTokenAddress: `0x${string}`;
|
|
18
|
+
/** zERC20 token address as configured in the adaptor. */
|
|
19
|
+
zerc20TokenAddress: `0x${string}`;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Parameters for `withdrawFromAdaptor`.
|
|
23
|
+
*/
|
|
24
|
+
export interface AdaptorWithdrawParams {
|
|
25
|
+
/** Write provider used to sign and submit transactions. */
|
|
26
|
+
writeProvider: EvmWriteProvider;
|
|
27
|
+
/** Optional read provider for receipt polling. */
|
|
28
|
+
readProvider?: EvmReadProvider;
|
|
29
|
+
/** Adaptor contract address. */
|
|
30
|
+
adaptorAddress: string;
|
|
31
|
+
/** Token address to withdraw (underlying, zERC20, or native sentinel). */
|
|
32
|
+
token: string;
|
|
33
|
+
/** Amount to withdraw (bigint-like). */
|
|
34
|
+
amount: bigint | number | string;
|
|
35
|
+
/** Optional fee overrides (e.g., gas, maxFeePerGas). */
|
|
36
|
+
feeOverrides?: FeeOverrides;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Fetch balances stuck in an adaptor contract for a given user.
|
|
40
|
+
*
|
|
41
|
+
* @remarks
|
|
42
|
+
* When a cross-chain unwrap fails (e.g. due to Stargate liquidity shortage),
|
|
43
|
+
* user funds remain in the adaptor contract. This function reads those balances
|
|
44
|
+
* so the UI can prompt the user to withdraw.
|
|
45
|
+
*
|
|
46
|
+
* @param params.provider - Provider to use for contract reads.
|
|
47
|
+
* @param params.account - User address to check balances for.
|
|
48
|
+
* @param params.adaptorAddress - Adaptor contract address.
|
|
49
|
+
*/
|
|
50
|
+
export declare function fetchAdaptorBalances(params: {
|
|
51
|
+
provider: EvmReadProvider;
|
|
52
|
+
account: string;
|
|
53
|
+
adaptorAddress: string;
|
|
54
|
+
}): Promise<AdaptorBalances>;
|
|
55
|
+
/**
|
|
56
|
+
* Check whether any funds are stuck in the adaptor for a given user.
|
|
57
|
+
*
|
|
58
|
+
* @remarks Convenience wrapper around `fetchAdaptorBalances` that returns `true`
|
|
59
|
+
* if any balance (underlying, zERC20, or native) is greater than zero.
|
|
60
|
+
*/
|
|
61
|
+
export declare function hasStuckFunds(params: {
|
|
62
|
+
provider: EvmReadProvider;
|
|
63
|
+
account: string;
|
|
64
|
+
adaptorAddress: string;
|
|
65
|
+
}): Promise<boolean>;
|
|
66
|
+
/**
|
|
67
|
+
* Withdraw stuck funds from an adaptor contract.
|
|
68
|
+
*
|
|
69
|
+
* @remarks
|
|
70
|
+
* Calls the adaptor's `withdraw(token, amount)` function. The token parameter
|
|
71
|
+
* should be one of:
|
|
72
|
+
* - The underlying token address (for funds that were unwrapped but failed to bridge)
|
|
73
|
+
* - The zERC20 token address (for funds that failed before unwrap)
|
|
74
|
+
* - The native token sentinel `0xEeee...` (for stuck native token)
|
|
75
|
+
*
|
|
76
|
+
* @throws If `amount` is not positive.
|
|
77
|
+
* @returns Transaction hash for the withdraw.
|
|
78
|
+
*/
|
|
79
|
+
export declare function withdrawFromAdaptor(params: AdaptorWithdrawParams): Promise<{
|
|
80
|
+
transactionHash: string;
|
|
81
|
+
}>;
|
|
82
|
+
//# sourceMappingURL=adaptorWithdraw.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adaptorWithdraw.d.ts","sourceRoot":"","sources":["../../../src/operations/liquidityManager/adaptorWithdraw.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAO,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAE,KAAK,YAAY,EAAsB,MAAM,qBAAqB,CAAC;AAW5E;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,qDAAqD;IACrD,sBAAsB,EAAE,MAAM,CAAC;IAC/B,iDAAiD;IACjD,aAAa,EAAE,MAAM,CAAC;IACtB,iDAAiD;IACjD,aAAa,EAAE,MAAM,CAAC;IACtB,6DAA6D;IAC7D,sBAAsB,EAAE,KAAK,MAAM,EAAE,CAAC;IACtC,yDAAyD;IACzD,kBAAkB,EAAE,KAAK,MAAM,EAAE,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,2DAA2D;IAC3D,aAAa,EAAE,gBAAgB,CAAC;IAChC,kDAAkD;IAClD,YAAY,CAAC,EAAE,eAAe,CAAC;IAC/B,gCAAgC;IAChC,cAAc,EAAE,MAAM,CAAC;IACvB,0EAA0E;IAC1E,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IACjC,wDAAwD;IACxD,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,oBAAoB,CAAC,MAAM,EAAE;IACjD,QAAQ,EAAE,eAAe,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;CACxB,GAAG,OAAO,CAAC,eAAe,CAAC,CAiD3B;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE;IAC1C,QAAQ,EAAE,eAAe,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;CACxB,GAAG,OAAO,CAAC,OAAO,CAAC,CAOnB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE,CAAC,CAyBtC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adaptor withdraw operations for rescuing stuck funds from failed cross-chain unwraps.
|
|
3
|
+
*/
|
|
4
|
+
import AdaptorArtifact from "../../assets/abi/Adaptor.json" with { type: "json" };
|
|
5
|
+
import { spreadFeeOverrides } from "../../utils/fees.js";
|
|
6
|
+
import { ensureAccount, ensureBigintLike, normalizeAddress, receiptProvider, } from "./helpers.js";
|
|
7
|
+
/**
|
|
8
|
+
* Fetch balances stuck in an adaptor contract for a given user.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* When a cross-chain unwrap fails (e.g. due to Stargate liquidity shortage),
|
|
12
|
+
* user funds remain in the adaptor contract. This function reads those balances
|
|
13
|
+
* so the UI can prompt the user to withdraw.
|
|
14
|
+
*
|
|
15
|
+
* @param params.provider - Provider to use for contract reads.
|
|
16
|
+
* @param params.account - User address to check balances for.
|
|
17
|
+
* @param params.adaptorAddress - Adaptor contract address.
|
|
18
|
+
*/
|
|
19
|
+
export async function fetchAdaptorBalances(params) {
|
|
20
|
+
const { provider, account, adaptorAddress } = params;
|
|
21
|
+
const normalizedAccount = normalizeAddress(account);
|
|
22
|
+
const normalizedAdaptor = normalizeAddress(adaptorAddress);
|
|
23
|
+
const [underlyingTokenBalance, zerc20Balance, nativeBalance, underlyingTokenAddress, zerc20TokenAddress,] = await Promise.all([
|
|
24
|
+
provider.readContract({
|
|
25
|
+
address: normalizedAdaptor,
|
|
26
|
+
abi: AdaptorArtifact.abi,
|
|
27
|
+
functionName: "underlyingTokenBalances",
|
|
28
|
+
args: [normalizedAccount],
|
|
29
|
+
}),
|
|
30
|
+
provider.readContract({
|
|
31
|
+
address: normalizedAdaptor,
|
|
32
|
+
abi: AdaptorArtifact.abi,
|
|
33
|
+
functionName: "zerc20Balances",
|
|
34
|
+
args: [normalizedAccount],
|
|
35
|
+
}),
|
|
36
|
+
provider.readContract({
|
|
37
|
+
address: normalizedAdaptor,
|
|
38
|
+
abi: AdaptorArtifact.abi,
|
|
39
|
+
functionName: "nativeBalances",
|
|
40
|
+
args: [normalizedAccount],
|
|
41
|
+
}),
|
|
42
|
+
provider.readContract({
|
|
43
|
+
address: normalizedAdaptor,
|
|
44
|
+
abi: AdaptorArtifact.abi,
|
|
45
|
+
functionName: "UNDERLYING_TOKEN",
|
|
46
|
+
}),
|
|
47
|
+
provider.readContract({
|
|
48
|
+
address: normalizedAdaptor,
|
|
49
|
+
abi: AdaptorArtifact.abi,
|
|
50
|
+
functionName: "ZERC20_TOKEN",
|
|
51
|
+
}),
|
|
52
|
+
]);
|
|
53
|
+
return {
|
|
54
|
+
underlyingTokenBalance: ensureBigintLike(underlyingTokenBalance, "underlyingTokenBalance"),
|
|
55
|
+
zerc20Balance: ensureBigintLike(zerc20Balance, "zerc20Balance"),
|
|
56
|
+
nativeBalance: ensureBigintLike(nativeBalance, "nativeBalance"),
|
|
57
|
+
underlyingTokenAddress: normalizeAddress(underlyingTokenAddress),
|
|
58
|
+
zerc20TokenAddress: normalizeAddress(zerc20TokenAddress),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Check whether any funds are stuck in the adaptor for a given user.
|
|
63
|
+
*
|
|
64
|
+
* @remarks Convenience wrapper around `fetchAdaptorBalances` that returns `true`
|
|
65
|
+
* if any balance (underlying, zERC20, or native) is greater than zero.
|
|
66
|
+
*/
|
|
67
|
+
export async function hasStuckFunds(params) {
|
|
68
|
+
const balances = await fetchAdaptorBalances(params);
|
|
69
|
+
return (balances.underlyingTokenBalance > 0n ||
|
|
70
|
+
balances.zerc20Balance > 0n ||
|
|
71
|
+
balances.nativeBalance > 0n);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Withdraw stuck funds from an adaptor contract.
|
|
75
|
+
*
|
|
76
|
+
* @remarks
|
|
77
|
+
* Calls the adaptor's `withdraw(token, amount)` function. The token parameter
|
|
78
|
+
* should be one of:
|
|
79
|
+
* - The underlying token address (for funds that were unwrapped but failed to bridge)
|
|
80
|
+
* - The zERC20 token address (for funds that failed before unwrap)
|
|
81
|
+
* - The native token sentinel `0xEeee...` (for stuck native token)
|
|
82
|
+
*
|
|
83
|
+
* @throws If `amount` is not positive.
|
|
84
|
+
* @returns Transaction hash for the withdraw.
|
|
85
|
+
*/
|
|
86
|
+
export async function withdrawFromAdaptor(params) {
|
|
87
|
+
const { writeProvider, readProvider, adaptorAddress, token, amount, feeOverrides } = params;
|
|
88
|
+
const normalizedAmount = ensureBigintLike(amount, "amount");
|
|
89
|
+
if (normalizedAmount <= 0n) {
|
|
90
|
+
throw new Error("amount must be greater than zero");
|
|
91
|
+
}
|
|
92
|
+
const account = ensureAccount(writeProvider);
|
|
93
|
+
const normalizedAdaptor = normalizeAddress(adaptorAddress);
|
|
94
|
+
const normalizedToken = normalizeAddress(token);
|
|
95
|
+
const receipt = receiptProvider(writeProvider, readProvider);
|
|
96
|
+
const txOverrides = { account, chain: writeProvider.chain, ...spreadFeeOverrides(feeOverrides) };
|
|
97
|
+
const withdrawHash = await writeProvider.writeContract({
|
|
98
|
+
address: normalizedAdaptor,
|
|
99
|
+
abi: AdaptorArtifact.abi,
|
|
100
|
+
functionName: "withdraw",
|
|
101
|
+
args: [normalizedToken, normalizedAmount],
|
|
102
|
+
...txOverrides,
|
|
103
|
+
});
|
|
104
|
+
const withdrawReceipt = await receipt.waitForTransactionReceipt({ hash: withdrawHash });
|
|
105
|
+
return { transactionHash: withdrawReceipt.transactionHash };
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=adaptorWithdraw.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adaptorWithdraw.js","sourceRoot":"","sources":["../../../src/operations/liquidityManager/adaptorWithdraw.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,eAAe,MAAM,+BAA+B,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAElF,OAAO,EAAqB,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE5E,OAAO,EACL,aAAa,EACb,gBAAgB,EAEhB,gBAAgB,EAChB,eAAe,GAEhB,MAAM,cAAc,CAAC;AAoCtB;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,MAI1C;IACC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC;IACrD,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACpD,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,cAAc,CAAC,CAAC;IAE3D,MAAM,CACJ,sBAAsB,EACtB,aAAa,EACb,aAAa,EACb,sBAAsB,EACtB,kBAAkB,EACnB,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACpB,QAAQ,CAAC,YAAY,CAAC;YACpB,OAAO,EAAE,iBAAiB;YAC1B,GAAG,EAAE,eAAe,CAAC,GAAG;YACxB,YAAY,EAAE,yBAAyB;YACvC,IAAI,EA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operations for liquidity manager.
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
4
|
+
import type { EvmReadProvider } from "../../types/evm.js";
|
|
5
5
|
import type { LiquidityBalances } from "./types.js";
|
|
6
6
|
/**
|
|
7
7
|
* Fetch balances/decimals for the underlying token and its corresponding zERC20 for an account.
|
|
8
8
|
* @remarks
|
|
9
9
|
* - If the liquidity manager's `underlyingToken` is the native-token sentinel address,
|
|
10
|
-
* balance is fetched via `
|
|
10
|
+
* balance is fetched via `provider.getBalance(...)` and decimals are assumed to be 18.
|
|
11
11
|
* - Otherwise ERC-20 `balanceOf` and `decimals` are read for the underlying token.
|
|
12
12
|
*/
|
|
13
13
|
export declare function fetchLiquidityManagerBalances(params: {
|
|
14
|
-
|
|
14
|
+
provider: EvmReadProvider;
|
|
15
15
|
account: string;
|
|
16
16
|
liquidityManagerAddress: string;
|
|
17
17
|
zerc20TokenAddress: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"balance.d.ts","sourceRoot":"","sources":["../../../src/operations/liquidityManager/balance.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"balance.d.ts","sourceRoot":"","sources":["../../../src/operations/liquidityManager/balance.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAGpD;;;;;;GAMG;AACH,wBAAsB,6BAA6B,CAAC,MAAM,EAAE;IAC1D,QAAQ,EAAE,eAAe,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,uBAAuB,EAAE,MAAM,CAAC;IAChC,kBAAkB,EAAE,MAAM,CAAC;CAC5B,GAAG,OAAO,CAAC,iBAAiB,CAAC,CA+D7B"}
|
|
@@ -1,47 +1,54 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Balance fetching operations for liquidity manager.
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import LiquidityManagerArtifact from "../../assets/abi/LiquidityManager.json" with { type: "json" };
|
|
5
|
+
import Zerc20Artifact from "../../assets/abi/zERC20.json" with { type: "json" };
|
|
6
|
+
import { ERC20_ABI } from "./abi.js";
|
|
6
7
|
import { isNativeToken, NATIVE_DECIMALS, normalizeAddress } from "./helpers.js";
|
|
7
8
|
/**
|
|
8
9
|
* Fetch balances/decimals for the underlying token and its corresponding zERC20 for an account.
|
|
9
10
|
* @remarks
|
|
10
11
|
* - If the liquidity manager's `underlyingToken` is the native-token sentinel address,
|
|
11
|
-
* balance is fetched via `
|
|
12
|
+
* balance is fetched via `provider.getBalance(...)` and decimals are assumed to be 18.
|
|
12
13
|
* - Otherwise ERC-20 `balanceOf` and `decimals` are read for the underlying token.
|
|
13
14
|
*/
|
|
14
15
|
export async function fetchLiquidityManagerBalances(params) {
|
|
15
|
-
const {
|
|
16
|
+
const { provider, account, liquidityManagerAddress, zerc20TokenAddress } = params;
|
|
16
17
|
const normalizedAccount = normalizeAddress(account);
|
|
17
18
|
const managerAddress = normalizeAddress(liquidityManagerAddress);
|
|
18
19
|
const tokenAddress = normalizeAddress(zerc20TokenAddress);
|
|
19
|
-
const
|
|
20
|
-
|
|
20
|
+
const underlyingAddress = normalizeAddress((await provider.readContract({
|
|
21
|
+
address: managerAddress,
|
|
22
|
+
abi: LiquidityManagerArtifact.abi,
|
|
23
|
+
functionName: "underlyingToken",
|
|
24
|
+
})));
|
|
21
25
|
const nativeUnderlying = isNativeToken(underlyingAddress);
|
|
22
|
-
const zerc20DecimalsPromise =
|
|
26
|
+
const zerc20DecimalsPromise = provider.readContract({
|
|
23
27
|
address: tokenAddress,
|
|
24
|
-
abi:
|
|
28
|
+
abi: Zerc20Artifact.abi,
|
|
25
29
|
functionName: "decimals",
|
|
26
30
|
});
|
|
27
31
|
const underlyingDecimalsPromise = nativeUnderlying
|
|
28
32
|
? Promise.resolve(NATIVE_DECIMALS)
|
|
29
|
-
:
|
|
33
|
+
: provider.readContract({
|
|
30
34
|
address: underlyingAddress,
|
|
31
|
-
abi:
|
|
35
|
+
abi: ERC20_ABI,
|
|
32
36
|
functionName: "decimals",
|
|
33
37
|
});
|
|
34
|
-
const zerc20BalancePromise =
|
|
38
|
+
const zerc20BalancePromise = provider.readContract({
|
|
35
39
|
address: tokenAddress,
|
|
36
|
-
abi:
|
|
40
|
+
abi: Zerc20Artifact.abi,
|
|
37
41
|
functionName: "balanceOf",
|
|
38
42
|
args: [normalizedAccount],
|
|
39
43
|
});
|
|
44
|
+
if (nativeUnderlying && !provider.getBalance) {
|
|
45
|
+
throw new Error("provider.getBalance is required for native token balance queries");
|
|
46
|
+
}
|
|
40
47
|
const underlyingBalancePromise = nativeUnderlying
|
|
41
|
-
?
|
|
42
|
-
:
|
|
48
|
+
? provider.getBalance({ address: normalizedAccount })
|
|
49
|
+
: provider.readContract({
|
|
43
50
|
address: underlyingAddress,
|
|
44
|
-
abi:
|
|
51
|
+
abi: ERC20_ABI,
|
|
45
52
|
functionName: "balanceOf",
|
|
46
53
|
args: [normalizedAccount],
|
|
47
54
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"balance.js","sourceRoot":"","sources":["../../../src/operations/liquidityManager/balance.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"balance.js","sourceRoot":"","sources":["../../../src/operations/liquidityManager/balance.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,wBAAwB,MAAM,wCAAwC,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACpG,OAAO,cAAc,MAAM,8BAA8B,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAGhF,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhF;;;;;;GAMG;AACH,M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,KAAK,CAAC,kEAAkE,CAAC,CAAC;IACtF,CAAC;IAED,MAAM,wBAAwB,GAAG,gBAAgB;QAC/C,CAAC,CAAC,QAAQ,CAAC,UAAW,CAAC,EAAE,OAAO,EAAE,iBAAiB,EAAE,CAAC;QACtD,CAAC,CAAE,QAAQ,CAAC,YAAY,CAAC;YACrB,OAAO,EAAE,iBAAiB;YAC1B,GAAG,EAAE,SAAS;YACd,YAAY,EAAE,WAAW;YACzB,IAAI,EAAE,CAAC,iBAAiB,CAAC;SAC1B,CAAqB,CAAC;IAE3B,MAAM,CAAC,cAAc,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,aAAa,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC/F,qBAAqB;QACrB,yBAAyB;QACzB,wBAAwB;QACxB,oBAAoB;KACrB,CAAC,CAAC;IAEH,OAAO;QACL,iBAAiB;QACjB,iBAAiB;QACjB,kBAAkB,EAAE,MAAM,CAAC,kBAAkB,CAAC;QAC9C,aAAa;QACb,cAAc,EAAE,MAAM,CAAC,cAAc,CAAC;KACvC,CAAC;AACJ,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Cross-chain unwrap operations using LayerZero.
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
4
|
+
import type { EvmReadProvider, EvmWriteProvider } from "../../types/evm.js";
|
|
5
5
|
import type { TokenEntry } from "../../registry/tokens.js";
|
|
6
|
-
import type
|
|
6
|
+
import { type FeeOverrides } from "../../utils/fees.js";
|
|
7
7
|
import type { CrossUnwrapQuote, LiquidityActionResult } from "./types.js";
|
|
8
8
|
/**
|
|
9
9
|
* Parameters for `buildCrossUnwrapQuote`.
|
|
@@ -17,10 +17,10 @@ export interface CrossUnwrapQuoteParams {
|
|
|
17
17
|
amount: bigint | number | string;
|
|
18
18
|
/** EVM account address initiating the flow (source chain). */
|
|
19
19
|
account: string;
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
|
|
20
|
+
/** Read provider for source chain reads. */
|
|
21
|
+
readProviderSource: EvmReadProvider;
|
|
22
|
+
/** Read provider for destination chain reads (adaptor quote). */
|
|
23
|
+
readProviderDestination: EvmReadProvider;
|
|
24
24
|
/**
|
|
25
25
|
* Slippage tolerance in basis points (e.g. 50 = 0.5%, 300 = 3%).
|
|
26
26
|
* @remarks Applied to both `SendParam.minAmountLD` and `BridgeRequest.minAmountOut`.
|
|
@@ -49,10 +49,12 @@ export declare function applySlippage(amount: bigint, slippageBps: number): bigi
|
|
|
49
49
|
* Parameters for `sendCrossUnwrap`.
|
|
50
50
|
*/
|
|
51
51
|
export interface CrossUnwrapSendParams {
|
|
52
|
-
/**
|
|
53
|
-
|
|
54
|
-
/** Optional
|
|
55
|
-
|
|
52
|
+
/** Write provider used to sign and submit transactions on the source chain. */
|
|
53
|
+
writeProvider: EvmWriteProvider;
|
|
54
|
+
/** Optional read provider for reads and receipt polling. */
|
|
55
|
+
readProvider?: EvmReadProvider;
|
|
56
|
+
/** Read provider for destination chain reads (required when no pre-built quote is provided). */
|
|
57
|
+
readProviderDestination?: EvmReadProvider;
|
|
56
58
|
/** Source token (zERC20) config on the source chain. */
|
|
57
59
|
sourceToken: TokenEntry;
|
|
58
60
|
/** Destination token config on the destination chain. */
|
|
@@ -61,7 +63,7 @@ export interface CrossUnwrapSendParams {
|
|
|
61
63
|
amount: bigint | number | string;
|
|
62
64
|
/** Optional pre-built quote from `buildCrossUnwrapQuote`. If omitted, the quote is built internally. */
|
|
63
65
|
quote?: CrossUnwrapQuote;
|
|
64
|
-
/** Optional
|
|
66
|
+
/** Optional fee overrides (e.g., gas, maxFeePerGas). */
|
|
65
67
|
feeOverrides?: FeeOverrides;
|
|
66
68
|
}
|
|
67
69
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crossUnwrap.d.ts","sourceRoot":"","sources":["../../../src/operations/liquidityManager/crossUnwrap.ts"],"names":[],"mappings":"AA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C;IACxB,yDAAyD;IACzD,gBAAgB,EAAE,UAAU,CAAC;IAC7B,2EAA2E;IAC3E,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IACjC,wGAAwG;IACxG,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,wDAAwD;IACxD,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC,CAwChC"}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* Cross-chain unwrap operations using LayerZero.
|
|
3
3
|
*/
|
|
4
4
|
import { encodeAbiParameters, hexToBytes, padHex, toHex } from "viem";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import { ensureAccount, ensureBigintLike, normalizeAddress,
|
|
5
|
+
import AdaptorArtifact from "../../assets/abi/Adaptor.json" with { type: "json" };
|
|
6
|
+
import Zerc20Artifact from "../../assets/abi/zERC20.json" with { type: "json" };
|
|
7
|
+
import { spreadFeeOverrides } from "../../utils/fees.js";
|
|
8
|
+
import { ensureAccount, ensureBigintLike, normalizeAddress, receiptProvider, removeDust, } from "./helpers.js";
|
|
9
9
|
// ============================================================================
|
|
10
10
|
// LayerZero Options Constants
|
|
11
11
|
// ============================================================================
|
|
@@ -87,8 +87,9 @@ export async function buildCrossUnwrapQuote(params) {
|
|
|
87
87
|
throw new Error("destination token is missing adaptor configuration for cross-chain unwrap");
|
|
88
88
|
}
|
|
89
89
|
const adaptorAddress = normalizeAddress(destinationToken.adaptorAddress);
|
|
90
|
-
const
|
|
91
|
-
const
|
|
90
|
+
const dstProvider = params.readProviderDestination;
|
|
91
|
+
const srcProvider = params.readProviderSource;
|
|
92
|
+
const zerc20Address = normalizeAddress(sourceToken.tokenAddress);
|
|
92
93
|
const effectiveSlippageBps = BigInt(slippageBps ?? 0);
|
|
93
94
|
const bridgeRequest = {
|
|
94
95
|
dstEid: Number(sourceToken.eid),
|
|
@@ -98,11 +99,18 @@ export async function buildCrossUnwrapQuote(params) {
|
|
|
98
99
|
composeMsg: "0x",
|
|
99
100
|
oftCmd: "0x",
|
|
100
101
|
};
|
|
101
|
-
const zerc20 = getZerc20Contract(normalizeAddress(sourceToken.tokenAddress), srcClient);
|
|
102
|
-
const adaptor = getAdaptorContract(adaptorAddress, dstClient);
|
|
103
102
|
const [feeQuote, decimalConversionRate] = await Promise.all([
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
dstProvider.readContract({
|
|
104
|
+
address: adaptorAddress,
|
|
105
|
+
abi: AdaptorArtifact.abi,
|
|
106
|
+
functionName: "quoteFee",
|
|
107
|
+
args: [normalizedAmount, bridgeRequest],
|
|
108
|
+
}),
|
|
109
|
+
srcProvider.readContract({
|
|
110
|
+
address: zerc20Address,
|
|
111
|
+
abi: Zerc20Artifact.abi,
|
|
112
|
+
functionName: "decimalConversionRate",
|
|
113
|
+
}),
|
|
106
114
|
]);
|
|
107
115
|
const nativeBridgeBuffer = (feeQuote.nativeBridgeFee * 3n) / 2n;
|
|
108
116
|
const composeOptions = [[COMPOSE_GAS, nativeBridgeBuffer]];
|
|
@@ -131,7 +139,12 @@ export async function buildCrossUnwrapQuote(params) {
|
|
|
131
139
|
composeMsg: composePayload,
|
|
132
140
|
oftCmd: "0x",
|
|
133
141
|
};
|
|
134
|
-
const sendFee = (await
|
|
142
|
+
const sendFee = (await srcProvider.readContract({
|
|
143
|
+
address: zerc20Address,
|
|
144
|
+
abi: Zerc20Artifact.abi,
|
|
145
|
+
functionName: "quoteSend",
|
|
146
|
+
args: [sendParam, false],
|
|
147
|
+
}));
|
|
135
148
|
if (sendFee.lzTokenFee > 0n) {
|
|
136
149
|
throw new Error("lzTokenFee payments are not supported for this flow");
|
|
137
150
|
}
|
|
@@ -163,9 +176,15 @@ export function applySlippage(amount, slippageBps) {
|
|
|
163
176
|
* The required native fee is taken from the quote and sent as `value` with the transaction.
|
|
164
177
|
*/
|
|
165
178
|
export async function sendCrossUnwrap(params) {
|
|
166
|
-
const {
|
|
167
|
-
|
|
168
|
-
|
|
179
|
+
const { writeProvider, readProvider, sourceToken, destinationToken } = params;
|
|
180
|
+
if (!params.quote && !params.readProvider) {
|
|
181
|
+
throw new Error("readProvider is required when no pre-built quote is provided");
|
|
182
|
+
}
|
|
183
|
+
if (!params.quote && !params.readProviderDestination) {
|
|
184
|
+
throw new Error("readProviderDestination is required when no pre-built quote is provided");
|
|
185
|
+
}
|
|
186
|
+
const account = ensureAccount(writeProvider);
|
|
187
|
+
const receipt = receiptProvider(writeProvider, readProvider);
|
|
169
188
|
const feeOverrides = params.feeOverrides;
|
|
170
189
|
const quote = params.quote ??
|
|
171
190
|
(await buildCrossUnwrapQuote({
|
|
@@ -173,17 +192,22 @@ export async function sendCrossUnwrap(params) {
|
|
|
173
192
|
destinationToken,
|
|
174
193
|
amount: params.amount,
|
|
175
194
|
account,
|
|
176
|
-
|
|
195
|
+
readProviderSource: readProvider,
|
|
196
|
+
readProviderDestination: params.readProviderDestination,
|
|
177
197
|
}));
|
|
178
|
-
const
|
|
179
|
-
const sendHash = await
|
|
198
|
+
const zerc20Address = normalizeAddress(sourceToken.tokenAddress);
|
|
199
|
+
const sendHash = await writeProvider.writeContract({
|
|
200
|
+
address: zerc20Address,
|
|
201
|
+
abi: Zerc20Artifact.abi,
|
|
202
|
+
functionName: "send",
|
|
203
|
+
args: [quote.sendParam, { nativeFee: quote.sendNativeFee, lzTokenFee: 0n }, account],
|
|
180
204
|
account,
|
|
181
205
|
value: quote.sendNativeFee,
|
|
182
|
-
...(feeOverrides
|
|
206
|
+
...spreadFeeOverrides(feeOverrides),
|
|
183
207
|
});
|
|
184
|
-
const
|
|
208
|
+
const sendReceipt = await receipt.waitForTransactionReceipt({ hash: sendHash });
|
|
185
209
|
return {
|
|
186
|
-
transactionHash:
|
|
210
|
+
transactionHash: sendReceipt.transactionHash,
|
|
187
211
|
};
|
|
188
212
|
}
|
|
189
213
|
//# sourceMappingURL=crossUnwrap.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crossUnwrap.js","sourceRoot":"","sources":["../../../src/operations/liquidityManager/crossUnwrap.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"crossUnwrap.js","sourceRoot":"","sources":["../../../src/operations/liquidityManager/crossUnwrap.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAEtE,OAAO,eAAe,MAAM,+BAA+B,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAClF,OAAO,cAAc,MAAM,8BAA8B,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAGhF,OAAO,EAAqB,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAG5E,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,UAAU,GACX,MAAM,cAAc,CAAC;AAEtB,+EAA+E;AAC/E,8BAA8B;AAC9B,+EAA+E;AAE/E,MAAM,WAAW,GAAG,OAAQ,CAAC;AAC7B,MAAM,WAAW,GAAG,OAAQ,CAAC;AAC7B,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACjC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACjC,MAAM,cAAc,GAAG,CAAC,CAAC;AAEzB,MAAM,kBAAkB,GAAG;IACzB,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE;IAClC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE;IAC/B,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,SAAS,EAAE;IACzC,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,OAAO,EAAE;IAC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