@lendasat/lendaswap-sdk-pure 0.2.21-preview.0 → 0.2.21
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/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +4 -1
- package/dist/api/client.js.map +1 -1
- package/dist/version.d.ts +4 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +6 -0
- package/dist/version.js.map +1 -0
- package/package.json +4 -1
- package/dist/price-feed.d.ts +0 -124
- package/dist/price-feed.d.ts.map +0 -1
- package/dist/price-feed.js +0 -178
- package/dist/price-feed.js.map +0 -1
- package/dist/src/api/client.d.ts +0 -31
- package/dist/src/api/client.d.ts.map +0 -1
- package/dist/src/api/client.js +0 -12
- package/dist/src/api/client.js.map +0 -1
- package/dist/src/arkade.d.ts +0 -36
- package/dist/src/arkade.d.ts.map +0 -1
- package/dist/src/arkade.js +0 -68
- package/dist/src/arkade.js.map +0 -1
- package/dist/src/client.d.ts +0 -760
- package/dist/src/client.d.ts.map +0 -1
- package/dist/src/client.js +0 -2169
- package/dist/src/client.js.map +0 -1
- package/dist/src/create/arkade.d.ts +0 -34
- package/dist/src/create/arkade.d.ts.map +0 -1
- package/dist/src/create/arkade.js +0 -76
- package/dist/src/create/arkade.js.map +0 -1
- package/dist/src/create/bitcoin-to-arkade.d.ts +0 -36
- package/dist/src/create/bitcoin-to-arkade.d.ts.map +0 -1
- package/dist/src/create/bitcoin-to-arkade.js +0 -69
- package/dist/src/create/bitcoin-to-arkade.js.map +0 -1
- package/dist/src/create/bitcoin.d.ts +0 -31
- package/dist/src/create/bitcoin.d.ts.map +0 -1
- package/dist/src/create/bitcoin.js +0 -67
- package/dist/src/create/bitcoin.js.map +0 -1
- package/dist/src/create/evm-to-arkade.d.ts +0 -34
- package/dist/src/create/evm-to-arkade.d.ts.map +0 -1
- package/dist/src/create/evm-to-arkade.js +0 -69
- package/dist/src/create/evm-to-arkade.js.map +0 -1
- package/dist/src/create/evm-to-bitcoin.d.ts +0 -35
- package/dist/src/create/evm-to-bitcoin.d.ts.map +0 -1
- package/dist/src/create/evm-to-bitcoin.js +0 -71
- package/dist/src/create/evm-to-bitcoin.js.map +0 -1
- package/dist/src/create/evm-to-lightning.d.ts +0 -34
- package/dist/src/create/evm-to-lightning.d.ts.map +0 -1
- package/dist/src/create/evm-to-lightning.js +0 -66
- package/dist/src/create/evm-to-lightning.js.map +0 -1
- package/dist/src/create/index.d.ts +0 -19
- package/dist/src/create/index.d.ts.map +0 -1
- package/dist/src/create/index.js +0 -18
- package/dist/src/create/index.js.map +0 -1
- package/dist/src/create/lightning.d.ts +0 -31
- package/dist/src/create/lightning.d.ts.map +0 -1
- package/dist/src/create/lightning.js +0 -72
- package/dist/src/create/lightning.js.map +0 -1
- package/dist/src/create/types.d.ts +0 -247
- package/dist/src/create/types.d.ts.map +0 -1
- package/dist/src/create/types.js +0 -5
- package/dist/src/create/types.js.map +0 -1
- package/dist/src/delegate.d.ts +0 -62
- package/dist/src/delegate.d.ts.map +0 -1
- package/dist/src/delegate.js +0 -284
- package/dist/src/delegate.js.map +0 -1
- package/dist/src/esplora.d.ts +0 -41
- package/dist/src/esplora.d.ts.map +0 -1
- package/dist/src/esplora.js +0 -47
- package/dist/src/esplora.js.map +0 -1
- package/dist/src/evm/coordinator.d.ts +0 -247
- package/dist/src/evm/coordinator.d.ts.map +0 -1
- package/dist/src/evm/coordinator.js +0 -414
- package/dist/src/evm/coordinator.js.map +0 -1
- package/dist/src/evm/htlc.d.ts +0 -238
- package/dist/src/evm/htlc.d.ts.map +0 -1
- package/dist/src/evm/htlc.js +0 -278
- package/dist/src/evm/htlc.js.map +0 -1
- package/dist/src/evm/index.d.ts +0 -9
- package/dist/src/evm/index.d.ts.map +0 -1
- package/dist/src/evm/index.js +0 -9
- package/dist/src/evm/index.js.map +0 -1
- package/dist/src/evm/signing.d.ts +0 -30
- package/dist/src/evm/signing.d.ts.map +0 -1
- package/dist/src/evm/signing.js +0 -91
- package/dist/src/evm/signing.js.map +0 -1
- package/dist/src/generated/api.d.ts +0 -2736
- package/dist/src/generated/api.d.ts.map +0 -1
- package/dist/src/generated/api.js +0 -6
- package/dist/src/generated/api.js.map +0 -1
- package/dist/src/index.d.ts +0 -18
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -24
- package/dist/src/index.js.map +0 -1
- package/dist/src/node.d.ts +0 -19
- package/dist/src/node.d.ts.map +0 -1
- package/dist/src/node.js +0 -19
- package/dist/src/node.js.map +0 -1
- package/dist/src/price-calculations.d.ts +0 -109
- package/dist/src/price-calculations.d.ts.map +0 -1
- package/dist/src/price-calculations.js +0 -135
- package/dist/src/price-calculations.js.map +0 -1
- package/dist/src/redeem/arkade.d.ts +0 -65
- package/dist/src/redeem/arkade.d.ts.map +0 -1
- package/dist/src/redeem/arkade.js +0 -217
- package/dist/src/redeem/arkade.js.map +0 -1
- package/dist/src/redeem/ethereum.d.ts +0 -52
- package/dist/src/redeem/ethereum.d.ts.map +0 -1
- package/dist/src/redeem/ethereum.js +0 -206
- package/dist/src/redeem/ethereum.js.map +0 -1
- package/dist/src/redeem/gasless.d.ts +0 -41
- package/dist/src/redeem/gasless.d.ts.map +0 -1
- package/dist/src/redeem/gasless.js +0 -71
- package/dist/src/redeem/gasless.js.map +0 -1
- package/dist/src/redeem/index.d.ts +0 -49
- package/dist/src/redeem/index.d.ts.map +0 -1
- package/dist/src/redeem/index.js +0 -189
- package/dist/src/redeem/index.js.map +0 -1
- package/dist/src/redeem/types.d.ts +0 -126
- package/dist/src/redeem/types.d.ts.map +0 -1
- package/dist/src/redeem/types.js +0 -36
- package/dist/src/redeem/types.js.map +0 -1
- package/dist/src/refund/arkade.d.ts +0 -62
- package/dist/src/refund/arkade.d.ts.map +0 -1
- package/dist/src/refund/arkade.js +0 -212
- package/dist/src/refund/arkade.js.map +0 -1
- package/dist/src/refund/index.d.ts +0 -10
- package/dist/src/refund/index.d.ts.map +0 -1
- package/dist/src/refund/index.js +0 -10
- package/dist/src/refund/index.js.map +0 -1
- package/dist/src/refund/onchain.d.ts +0 -137
- package/dist/src/refund/onchain.d.ts.map +0 -1
- package/dist/src/refund/onchain.js +0 -366
- package/dist/src/refund/onchain.js.map +0 -1
- package/dist/src/signer/index.d.ts +0 -106
- package/dist/src/signer/index.d.ts.map +0 -1
- package/dist/src/signer/index.js +0 -179
- package/dist/src/signer/index.js.map +0 -1
- package/dist/src/storage/idb.d.ts +0 -70
- package/dist/src/storage/idb.d.ts.map +0 -1
- package/dist/src/storage/idb.js +0 -236
- package/dist/src/storage/idb.js.map +0 -1
- package/dist/src/storage/index.d.ts +0 -152
- package/dist/src/storage/index.d.ts.map +0 -1
- package/dist/src/storage/index.js +0 -98
- package/dist/src/storage/index.js.map +0 -1
- package/dist/src/storage/sqlite.d.ts +0 -95
- package/dist/src/storage/sqlite.d.ts.map +0 -1
- package/dist/src/storage/sqlite.js +0 -206
- package/dist/src/storage/sqlite.js.map +0 -1
- package/dist/src/storage/types.d.ts +0 -57
- package/dist/src/storage/types.d.ts.map +0 -1
- package/dist/src/storage/types.js +0 -9
- package/dist/src/storage/types.js.map +0 -1
- package/dist/src/tokens.d.ts +0 -29
- package/dist/src/tokens.d.ts.map +0 -1
- package/dist/src/tokens.js +0 -89
- package/dist/src/tokens.js.map +0 -1
- package/dist/src/usd-price.d.ts +0 -34
- package/dist/src/usd-price.d.ts.map +0 -1
- package/dist/src/usd-price.js +0 -83
- package/dist/src/usd-price.js.map +0 -1
- package/dist/tests/api-client.test.d.ts +0 -2
- package/dist/tests/api-client.test.d.ts.map +0 -1
- package/dist/tests/api-client.test.js +0 -86
- package/dist/tests/api-client.test.js.map +0 -1
- package/dist/tests/client.test.d.ts +0 -2
- package/dist/tests/client.test.d.ts.map +0 -1
- package/dist/tests/client.test.js +0 -150
- package/dist/tests/client.test.js.map +0 -1
- package/dist/tests/index.test.d.ts +0 -2
- package/dist/tests/index.test.d.ts.map +0 -1
- package/dist/tests/index.test.js +0 -8
- package/dist/tests/index.test.js.map +0 -1
- package/dist/tests/onchain-refund.test.d.ts +0 -2
- package/dist/tests/onchain-refund.test.d.ts.map +0 -1
- package/dist/tests/onchain-refund.test.js +0 -279
- package/dist/tests/onchain-refund.test.js.map +0 -1
- package/dist/tests/signer.test.d.ts +0 -2
- package/dist/tests/signer.test.d.ts.map +0 -1
- package/dist/tests/signer.test.js +0 -92
- package/dist/tests/signer.test.js.map +0 -1
- package/dist/tests/sqlite-storage.test.d.ts +0 -2
- package/dist/tests/sqlite-storage.test.d.ts.map +0 -1
- package/dist/tests/sqlite-storage.test.js +0 -160
- package/dist/tests/sqlite-storage.test.js.map +0 -1
- package/dist/tests/storage.test.d.ts +0 -2
- package/dist/tests/storage.test.d.ts.map +0 -1
- package/dist/tests/storage.test.js +0 -184
- package/dist/tests/storage.test.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/usdt0-bridge/bridge.d.ts +0 -82
- package/dist/usdt0-bridge/bridge.d.ts.map +0 -1
- package/dist/usdt0-bridge/bridge.js +0 -56
- package/dist/usdt0-bridge/bridge.js.map +0 -1
- package/dist/usdt0-bridge/chains.d.ts +0 -41
- package/dist/usdt0-bridge/chains.d.ts.map +0 -1
- package/dist/usdt0-bridge/chains.js +0 -117
- package/dist/usdt0-bridge/chains.js.map +0 -1
- package/dist/usdt0-bridge/layerzero-tracker.d.ts +0 -34
- package/dist/usdt0-bridge/layerzero-tracker.d.ts.map +0 -1
- package/dist/usdt0-bridge/layerzero-tracker.js +0 -86
- package/dist/usdt0-bridge/layerzero-tracker.js.map +0 -1
- package/dist/usdt0-bridge/oft-abi.d.ts +0 -145
- package/dist/usdt0-bridge/oft-abi.d.ts.map +0 -1
- package/dist/usdt0-bridge/oft-abi.js +0 -117
- package/dist/usdt0-bridge/oft-abi.js.map +0 -1
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* USDT0 OFT chain configuration.
|
|
3
|
-
*
|
|
4
|
-
* Adding a new USDT0-supported chain requires only a new entry here.
|
|
5
|
-
* Contract addresses sourced from https://docs.usdt0.to/technical-documentation/deployments
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* All supported USDT0 source chains, keyed by EVM chain ID.
|
|
9
|
-
*
|
|
10
|
-
* The destination chain (Arbitrum, chain ID 42161) is where LendaSwap's
|
|
11
|
-
* existing swap flow takes over — it is included here for reference
|
|
12
|
-
* but is not a valid source chain for `prepareSourceChainSwap()`.
|
|
13
|
-
*/
|
|
14
|
-
export const USDT0_CHAINS = {
|
|
15
|
-
10: {
|
|
16
|
-
oftAddress: "0xF03b4d9AC1D5d1E7c4cEf54C2A313b9fe051A0aD",
|
|
17
|
-
tokenAddress: "0x01bFF41798a0BcF287b996046Ca68b395DbC1071",
|
|
18
|
-
lzEid: 30111,
|
|
19
|
-
name: "Optimism",
|
|
20
|
-
decimals: 6,
|
|
21
|
-
},
|
|
22
|
-
137: {
|
|
23
|
-
oftAddress: "0x6BA10300f0DC58B7a1e4c0e41f5daBb7D7829e13",
|
|
24
|
-
tokenAddress: "0xc2132D05D31c914a87C6611C10748AEb04B58e8F",
|
|
25
|
-
lzEid: 30109,
|
|
26
|
-
name: "Polygon",
|
|
27
|
-
decimals: 6,
|
|
28
|
-
},
|
|
29
|
-
1: {
|
|
30
|
-
oftAddress: "0x6C96dE32CEa08842dcc4058c14d3aaAD7Fa41dee",
|
|
31
|
-
// Ethereum uses an OFT Adapter — users hold regular USDT, not a separate USDT0 token
|
|
32
|
-
tokenAddress: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
|
|
33
|
-
lzEid: 30101,
|
|
34
|
-
name: "Ethereum",
|
|
35
|
-
decimals: 6,
|
|
36
|
-
},
|
|
37
|
-
80094: {
|
|
38
|
-
oftAddress: "0x3Dc96399109df5ceb2C226664A086140bD0379cB",
|
|
39
|
-
tokenAddress: "0x779Ded0c9e1022225f8E0630b35a9b54bE713736",
|
|
40
|
-
lzEid: 30362,
|
|
41
|
-
name: "Berachain",
|
|
42
|
-
decimals: 6,
|
|
43
|
-
},
|
|
44
|
-
5000: {
|
|
45
|
-
oftAddress: "0xcb768e263FB1C62214E7cab4AA8d036D76dc59CC",
|
|
46
|
-
tokenAddress: "0x779Ded0c9e1022225f8E0630b35a9b54bE713736",
|
|
47
|
-
lzEid: 30181,
|
|
48
|
-
name: "Mantle",
|
|
49
|
-
decimals: 6,
|
|
50
|
-
},
|
|
51
|
-
1329: {
|
|
52
|
-
oftAddress: "0x56Fe74A2e3b484b921c447357203431a3485CC60",
|
|
53
|
-
tokenAddress: "0x9151434b16b9763660705744891fA906F660EcC5",
|
|
54
|
-
lzEid: 30280,
|
|
55
|
-
name: "Sei",
|
|
56
|
-
decimals: 6,
|
|
57
|
-
},
|
|
58
|
-
130: {
|
|
59
|
-
oftAddress: "0xc07bE8994D035631c36fb4a89C918CeFB2f03EC3",
|
|
60
|
-
tokenAddress: "0x9151434b16b9763660705744891fA906F660EcC5",
|
|
61
|
-
lzEid: 30320,
|
|
62
|
-
name: "Unichain",
|
|
63
|
-
decimals: 6,
|
|
64
|
-
},
|
|
65
|
-
57073: {
|
|
66
|
-
oftAddress: "0x1cB6De532588fCA4a21B7209DE7C456AF8434A65",
|
|
67
|
-
tokenAddress: "0x0200C29006150606B650577BBE7B6248F58470c1",
|
|
68
|
-
lzEid: 30339,
|
|
69
|
-
name: "Ink",
|
|
70
|
-
decimals: 6,
|
|
71
|
-
},
|
|
72
|
-
14: {
|
|
73
|
-
oftAddress: "0x567287d2A9829215a37e3B88843d32f9221E7588",
|
|
74
|
-
tokenAddress: "0xe7cd86e13AC4309349F30B3435a9d337750fC82D",
|
|
75
|
-
lzEid: 30295,
|
|
76
|
-
name: "Flare",
|
|
77
|
-
decimals: 6,
|
|
78
|
-
},
|
|
79
|
-
2818: {
|
|
80
|
-
oftAddress: "0xcb768e263FB1C62214E7cab4AA8d036D76dc59CC",
|
|
81
|
-
tokenAddress: "0xe7cd86e13AC4309349F30B3435a9d337750fC82D",
|
|
82
|
-
lzEid: 30322,
|
|
83
|
-
name: "Morph",
|
|
84
|
-
decimals: 6,
|
|
85
|
-
},
|
|
86
|
-
196: {
|
|
87
|
-
oftAddress: "0x94bcca6bdfd6a61817ab0e960bfede4984505554",
|
|
88
|
-
tokenAddress: "0x779Ded0c9e1022225f8E0630b35a9b54bE713736",
|
|
89
|
-
lzEid: 30274,
|
|
90
|
-
name: "X Layer",
|
|
91
|
-
decimals: 6,
|
|
92
|
-
},
|
|
93
|
-
30: {
|
|
94
|
-
oftAddress: "0x1a594d5d5d1c426281C1064B07f23F57B2716B61",
|
|
95
|
-
tokenAddress: "0x779dED0C9e1022225F8e0630b35A9B54Be713736",
|
|
96
|
-
lzEid: 30333,
|
|
97
|
-
name: "Rootstock",
|
|
98
|
-
decimals: 6,
|
|
99
|
-
},
|
|
100
|
-
};
|
|
101
|
-
/** Arbitrum is always the destination chain for the USDT0 bridge. */
|
|
102
|
-
export const ARBITRUM_CHAIN_ID = 42161;
|
|
103
|
-
export const ARBITRUM_LZ_EID = 30110;
|
|
104
|
-
/** USDT0 OFT contract on Arbitrum (used for bridging). */
|
|
105
|
-
export const ARBITRUM_USDT0_ADDRESS = "0x14E4A1B13bf7F943c8ff7C51fb60FA964A298D92";
|
|
106
|
-
/** USDT0 ERC-20 token address on Arbitrum (used for balanceOf, approvals). */
|
|
107
|
-
export const ARBITRUM_USDT0_TOKEN_ADDRESS = "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9";
|
|
108
|
-
/**
|
|
109
|
-
* Returns source chains available for USDT0 bridging (excludes Arbitrum).
|
|
110
|
-
*/
|
|
111
|
-
export function getUsdt0SourceChains() {
|
|
112
|
-
return Object.entries(USDT0_CHAINS).map(([chainId, config]) => ({
|
|
113
|
-
chainId: Number(chainId),
|
|
114
|
-
config,
|
|
115
|
-
}));
|
|
116
|
-
}
|
|
117
|
-
//# sourceMappingURL=chains.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3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
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LayerZero message delivery tracker.
|
|
3
|
-
*
|
|
4
|
-
* Queries the LayerZero Scan API to track the status of cross-chain
|
|
5
|
-
* OFT (Omnichain Fungible Token) transfers — e.g. USDT0 bridging
|
|
6
|
-
* from Optimism/Polygon → Arbitrum.
|
|
7
|
-
*/
|
|
8
|
-
export type LzDeliveryStatus = "INFLIGHT" | "DELIVERING" | "DELIVERED" | "FAILED" | "UNKNOWN";
|
|
9
|
-
export interface LzMessageStatus {
|
|
10
|
-
status: LzDeliveryStatus;
|
|
11
|
-
srcTxHash: string;
|
|
12
|
-
dstTxHash?: string;
|
|
13
|
-
srcChain: number;
|
|
14
|
-
dstChain: number;
|
|
15
|
-
statusMessage?: string;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Query the LayerZero Scan API for the status of a cross-chain message
|
|
19
|
-
* initiated by a given source transaction hash.
|
|
20
|
-
*/
|
|
21
|
-
export declare function getMessageStatus(srcTxHash: string): Promise<LzMessageStatus>;
|
|
22
|
-
export interface WaitForDeliveryOptions {
|
|
23
|
-
/** Polling interval in milliseconds (default: 5000). */
|
|
24
|
-
intervalMs?: number;
|
|
25
|
-
/** Maximum time to wait in milliseconds (default: 600000 = 10 minutes). */
|
|
26
|
-
timeoutMs?: number;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Poll the LayerZero Scan API until the message is DELIVERED or FAILED.
|
|
30
|
-
*
|
|
31
|
-
* Yields intermediate statuses so the caller can update the UI.
|
|
32
|
-
*/
|
|
33
|
-
export declare function waitForDelivery(srcTxHash: string, options?: WaitForDeliveryOptions): AsyncGenerator<LzMessageStatus>;
|
|
34
|
-
//# sourceMappingURL=layerzero-tracker.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"layerzero-tracker.d.ts","sourceRoot":"","sources":["../../src/usdt0-bridge/layerzero-tracker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,MAAM,gBAAgB,GACxB,UAAU,GACV,YAAY,GACZ,WAAW,GACX,QAAQ,GACR,SAAS,CAAC;AAEd,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,gBAAgB,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAyBD;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,eAAe,CAAC,CAqC1B;AAYD,MAAM,WAAW,sBAAsB;IACrC,wDAAwD;IACxD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2EAA2E;IAC3E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAuB,eAAe,CACpC,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,cAAc,CAAC,eAAe,CAAC,CAuBjC"}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LayerZero message delivery tracker.
|
|
3
|
-
*
|
|
4
|
-
* Queries the LayerZero Scan API to track the status of cross-chain
|
|
5
|
-
* OFT (Omnichain Fungible Token) transfers — e.g. USDT0 bridging
|
|
6
|
-
* from Optimism/Polygon → Arbitrum.
|
|
7
|
-
*/
|
|
8
|
-
const LZ_SCAN_API = "https://scan.layerzero-api.com/v1/messages/tx";
|
|
9
|
-
/**
|
|
10
|
-
* Query the LayerZero Scan API for the status of a cross-chain message
|
|
11
|
-
* initiated by a given source transaction hash.
|
|
12
|
-
*/
|
|
13
|
-
export async function getMessageStatus(srcTxHash) {
|
|
14
|
-
const url = `${LZ_SCAN_API}/${srcTxHash}`;
|
|
15
|
-
const res = await fetch(url);
|
|
16
|
-
if (!res.ok) {
|
|
17
|
-
return {
|
|
18
|
-
status: "UNKNOWN",
|
|
19
|
-
srcTxHash,
|
|
20
|
-
srcChain: 0,
|
|
21
|
-
dstChain: 0,
|
|
22
|
-
statusMessage: `LayerZero API returned ${res.status}`,
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
const json = await res.json();
|
|
26
|
-
const messages = json?.messages ?? json?.data ?? [];
|
|
27
|
-
if (messages.length === 0) {
|
|
28
|
-
return {
|
|
29
|
-
status: "UNKNOWN",
|
|
30
|
-
srcTxHash,
|
|
31
|
-
srcChain: 0,
|
|
32
|
-
dstChain: 0,
|
|
33
|
-
statusMessage: "No messages found for this transaction",
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
const msg = messages[0];
|
|
37
|
-
const status = mapStatus(msg.status?.name);
|
|
38
|
-
return {
|
|
39
|
-
status,
|
|
40
|
-
srcTxHash,
|
|
41
|
-
dstTxHash: msg.destination?.tx?.txHash,
|
|
42
|
-
srcChain: msg.pathway?.srcEid ?? 0,
|
|
43
|
-
dstChain: msg.pathway?.dstEid ?? 0,
|
|
44
|
-
statusMessage: msg.status?.message,
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
function mapStatus(raw) {
|
|
48
|
-
if (!raw)
|
|
49
|
-
return "UNKNOWN";
|
|
50
|
-
const upper = raw.toUpperCase();
|
|
51
|
-
if (upper === "INFLIGHT" || upper === "PENDING")
|
|
52
|
-
return "INFLIGHT";
|
|
53
|
-
if (upper === "DELIVERING")
|
|
54
|
-
return "DELIVERING";
|
|
55
|
-
if (upper === "DELIVERED")
|
|
56
|
-
return "DELIVERED";
|
|
57
|
-
if (upper === "FAILED")
|
|
58
|
-
return "FAILED";
|
|
59
|
-
return "UNKNOWN";
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Poll the LayerZero Scan API until the message is DELIVERED or FAILED.
|
|
63
|
-
*
|
|
64
|
-
* Yields intermediate statuses so the caller can update the UI.
|
|
65
|
-
*/
|
|
66
|
-
export async function* waitForDelivery(srcTxHash, options) {
|
|
67
|
-
const interval = options?.intervalMs ?? 5000;
|
|
68
|
-
const timeout = options?.timeoutMs ?? 1800_000;
|
|
69
|
-
const start = Date.now();
|
|
70
|
-
while (Date.now() - start < timeout) {
|
|
71
|
-
const status = await getMessageStatus(srcTxHash);
|
|
72
|
-
yield status;
|
|
73
|
-
if (status.status === "DELIVERED" || status.status === "FAILED") {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
await new Promise((r) => setTimeout(r, interval));
|
|
77
|
-
}
|
|
78
|
-
yield {
|
|
79
|
-
status: "FAILED",
|
|
80
|
-
srcTxHash,
|
|
81
|
-
srcChain: 0,
|
|
82
|
-
dstChain: 0,
|
|
83
|
-
statusMessage: "Timed out waiting for delivery",
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
//# sourceMappingURL=layerzero-tracker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"layerzero-tracker.js","sourceRoot":"","sources":["../../src/usdt0-bridge/layerzero-tracker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,GAAG,+CAA+C,CAAC;AAyCpE;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,SAAiB;IAEjB,MAAM,GAAG,GAAG,GAAG,WAAW,IAAI,SAAS,EAAE,CAAC;IAC1C,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;IAE7B,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,SAAS;YACT,QAAQ,EAAE,CAAC;YACX,QAAQ,EAAE,CAAC;YACX,aAAa,EAAE,0BAA0B,GAAG,CAAC,MAAM,EAAE;SACtD,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,GAAmB,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;IAC9C,MAAM,QAAQ,GAAG,IAAI,E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I,CAAC;IAC7C,MAAM,OAAO,GAAG,OAAO,EAAE,SAAS,IAAI,QAAQ,CAAC;IAC/C,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAEzB,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,OAAO,EAAE,CAAC;QACpC,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,SAAS,CAAC,CAAC;QACjD,MAAM,MAAM,CAAC;QAEb,IAAI,MAAM,CAAC,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;YAChE,OAAO;QACT,CAAC;QAED,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC;IACpD,CAAC;IAED,MAAM;QACJ,MAAM,EAAE,QAAQ;QAChB,SAAS;QACT,QAAQ,EAAE,CAAC;QACX,QAAQ,EAAE,CAAC;QACX,aAAa,EAAE,gCAAgC;KAChD,CAAC;AACJ,CAAC"}
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Minimal ABI for USDT0 OFT (Omnichain Fungible Token) contracts.
|
|
3
|
-
*
|
|
4
|
-
* Only includes the functions needed for bridging:
|
|
5
|
-
* - `quoteSend`: estimate native fee for a cross-chain transfer
|
|
6
|
-
* - `send`: initiate a cross-chain transfer via LayerZero
|
|
7
|
-
*/
|
|
8
|
-
export declare const OFT_ABI: readonly [{
|
|
9
|
-
readonly type: "function";
|
|
10
|
-
readonly name: "quoteSend";
|
|
11
|
-
readonly inputs: readonly [{
|
|
12
|
-
readonly name: "_sendParam";
|
|
13
|
-
readonly type: "tuple";
|
|
14
|
-
readonly components: readonly [{
|
|
15
|
-
readonly name: "dstEid";
|
|
16
|
-
readonly type: "uint32";
|
|
17
|
-
}, {
|
|
18
|
-
readonly name: "to";
|
|
19
|
-
readonly type: "bytes32";
|
|
20
|
-
}, {
|
|
21
|
-
readonly name: "amountLD";
|
|
22
|
-
readonly type: "uint256";
|
|
23
|
-
}, {
|
|
24
|
-
readonly name: "minAmountLD";
|
|
25
|
-
readonly type: "uint256";
|
|
26
|
-
}, {
|
|
27
|
-
readonly name: "extraOptions";
|
|
28
|
-
readonly type: "bytes";
|
|
29
|
-
}, {
|
|
30
|
-
readonly name: "composeMsg";
|
|
31
|
-
readonly type: "bytes";
|
|
32
|
-
}, {
|
|
33
|
-
readonly name: "oftCmd";
|
|
34
|
-
readonly type: "bytes";
|
|
35
|
-
}];
|
|
36
|
-
}, {
|
|
37
|
-
readonly name: "_payInLzToken";
|
|
38
|
-
readonly type: "bool";
|
|
39
|
-
}];
|
|
40
|
-
readonly outputs: readonly [{
|
|
41
|
-
readonly name: "";
|
|
42
|
-
readonly type: "tuple";
|
|
43
|
-
readonly components: readonly [{
|
|
44
|
-
readonly name: "nativeFee";
|
|
45
|
-
readonly type: "uint256";
|
|
46
|
-
}, {
|
|
47
|
-
readonly name: "lzTokenFee";
|
|
48
|
-
readonly type: "uint256";
|
|
49
|
-
}];
|
|
50
|
-
}];
|
|
51
|
-
readonly stateMutability: "view";
|
|
52
|
-
}, {
|
|
53
|
-
readonly type: "function";
|
|
54
|
-
readonly name: "send";
|
|
55
|
-
readonly inputs: readonly [{
|
|
56
|
-
readonly name: "_sendParam";
|
|
57
|
-
readonly type: "tuple";
|
|
58
|
-
readonly components: readonly [{
|
|
59
|
-
readonly name: "dstEid";
|
|
60
|
-
readonly type: "uint32";
|
|
61
|
-
}, {
|
|
62
|
-
readonly name: "to";
|
|
63
|
-
readonly type: "bytes32";
|
|
64
|
-
}, {
|
|
65
|
-
readonly name: "amountLD";
|
|
66
|
-
readonly type: "uint256";
|
|
67
|
-
}, {
|
|
68
|
-
readonly name: "minAmountLD";
|
|
69
|
-
readonly type: "uint256";
|
|
70
|
-
}, {
|
|
71
|
-
readonly name: "extraOptions";
|
|
72
|
-
readonly type: "bytes";
|
|
73
|
-
}, {
|
|
74
|
-
readonly name: "composeMsg";
|
|
75
|
-
readonly type: "bytes";
|
|
76
|
-
}, {
|
|
77
|
-
readonly name: "oftCmd";
|
|
78
|
-
readonly type: "bytes";
|
|
79
|
-
}];
|
|
80
|
-
}, {
|
|
81
|
-
readonly name: "_fee";
|
|
82
|
-
readonly type: "tuple";
|
|
83
|
-
readonly components: readonly [{
|
|
84
|
-
readonly name: "nativeFee";
|
|
85
|
-
readonly type: "uint256";
|
|
86
|
-
}, {
|
|
87
|
-
readonly name: "lzTokenFee";
|
|
88
|
-
readonly type: "uint256";
|
|
89
|
-
}];
|
|
90
|
-
}, {
|
|
91
|
-
readonly name: "_refundAddress";
|
|
92
|
-
readonly type: "address";
|
|
93
|
-
}];
|
|
94
|
-
readonly outputs: readonly [{
|
|
95
|
-
readonly name: "";
|
|
96
|
-
readonly type: "tuple";
|
|
97
|
-
readonly components: readonly [{
|
|
98
|
-
readonly name: "guid";
|
|
99
|
-
readonly type: "bytes32";
|
|
100
|
-
}, {
|
|
101
|
-
readonly name: "nonce";
|
|
102
|
-
readonly type: "uint64";
|
|
103
|
-
}, {
|
|
104
|
-
readonly name: "fee";
|
|
105
|
-
readonly type: "tuple";
|
|
106
|
-
readonly components: readonly [{
|
|
107
|
-
readonly name: "nativeFee";
|
|
108
|
-
readonly type: "uint256";
|
|
109
|
-
}, {
|
|
110
|
-
readonly name: "lzTokenFee";
|
|
111
|
-
readonly type: "uint256";
|
|
112
|
-
}];
|
|
113
|
-
}];
|
|
114
|
-
}, {
|
|
115
|
-
readonly name: "";
|
|
116
|
-
readonly type: "tuple";
|
|
117
|
-
readonly components: readonly [{
|
|
118
|
-
readonly name: "amountSentLD";
|
|
119
|
-
readonly type: "uint256";
|
|
120
|
-
}, {
|
|
121
|
-
readonly name: "amountReceivedLD";
|
|
122
|
-
readonly type: "uint256";
|
|
123
|
-
}];
|
|
124
|
-
}];
|
|
125
|
-
readonly stateMutability: "payable";
|
|
126
|
-
}];
|
|
127
|
-
/** LayerZero Endpoint ID for Arbitrum. */
|
|
128
|
-
export declare const ARBITRUM_LZ_EID = 30110;
|
|
129
|
-
/**
|
|
130
|
-
* Build LayerZero v2 executor options for a simple OFT transfer.
|
|
131
|
-
*
|
|
132
|
-
* Encodes a TYPE_3 options blob with an `addExecutorLzReceiveOption(gasLimit)`.
|
|
133
|
-
* This tells the destination-chain executor how much gas to allocate for `lzReceive`.
|
|
134
|
-
*
|
|
135
|
-
* Encoding:
|
|
136
|
-
* 0x0003 — TYPE_3 header (2 bytes)
|
|
137
|
-
* 01 — WORKER_ID_EXECUTOR (1 byte)
|
|
138
|
-
* 0011 — option payload size = 17 (2 bytes)
|
|
139
|
-
* 01 — OPTION_TYPE_LZRECEIVE (1 byte)
|
|
140
|
-
* <16 bytes gas limit> — uint128 gas
|
|
141
|
-
*
|
|
142
|
-
* @param gasLimit - Gas for lzReceive on the destination chain (default 200_000).
|
|
143
|
-
*/
|
|
144
|
-
export declare function buildLzReceiveOptions(gasLimit?: bigint): `0x${string}`;
|
|
145
|
-
//# sourceMappingURL=oft-abi.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"oft-abi.d.ts","sourceRoot":"","sources":["../../src/usdt0-bridge/oft-abi.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuFV,CAAC;AAEX,0CAA0C;AAC1C,eAAO,MAAM,eAAe,QAAQ,CAAC;AAErC;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,SAAW,GAAG,KAAK,MAAM,EAAE,CAGxE"}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Minimal ABI for USDT0 OFT (Omnichain Fungible Token) contracts.
|
|
3
|
-
*
|
|
4
|
-
* Only includes the functions needed for bridging:
|
|
5
|
-
* - `quoteSend`: estimate native fee for a cross-chain transfer
|
|
6
|
-
* - `send`: initiate a cross-chain transfer via LayerZero
|
|
7
|
-
*/
|
|
8
|
-
export const OFT_ABI = [
|
|
9
|
-
{
|
|
10
|
-
type: "function",
|
|
11
|
-
name: "quoteSend",
|
|
12
|
-
inputs: [
|
|
13
|
-
{
|
|
14
|
-
name: "_sendParam",
|
|
15
|
-
type: "tuple",
|
|
16
|
-
components: [
|
|
17
|
-
{ name: "dstEid", type: "uint32" },
|
|
18
|
-
{ name: "to", type: "bytes32" },
|
|
19
|
-
{ name: "amountLD", type: "uint256" },
|
|
20
|
-
{ name: "minAmountLD", type: "uint256" },
|
|
21
|
-
{ name: "extraOptions", type: "bytes" },
|
|
22
|
-
{ name: "composeMsg", type: "bytes" },
|
|
23
|
-
{ name: "oftCmd", type: "bytes" },
|
|
24
|
-
],
|
|
25
|
-
},
|
|
26
|
-
{ name: "_payInLzToken", type: "bool" },
|
|
27
|
-
],
|
|
28
|
-
outputs: [
|
|
29
|
-
{
|
|
30
|
-
name: "",
|
|
31
|
-
type: "tuple",
|
|
32
|
-
components: [
|
|
33
|
-
{ name: "nativeFee", type: "uint256" },
|
|
34
|
-
{ name: "lzTokenFee", type: "uint256" },
|
|
35
|
-
],
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
stateMutability: "view",
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
type: "function",
|
|
42
|
-
name: "send",
|
|
43
|
-
inputs: [
|
|
44
|
-
{
|
|
45
|
-
name: "_sendParam",
|
|
46
|
-
type: "tuple",
|
|
47
|
-
components: [
|
|
48
|
-
{ name: "dstEid", type: "uint32" },
|
|
49
|
-
{ name: "to", type: "bytes32" },
|
|
50
|
-
{ name: "amountLD", type: "uint256" },
|
|
51
|
-
{ name: "minAmountLD", type: "uint256" },
|
|
52
|
-
{ name: "extraOptions", type: "bytes" },
|
|
53
|
-
{ name: "composeMsg", type: "bytes" },
|
|
54
|
-
{ name: "oftCmd", type: "bytes" },
|
|
55
|
-
],
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
name: "_fee",
|
|
59
|
-
type: "tuple",
|
|
60
|
-
components: [
|
|
61
|
-
{ name: "nativeFee", type: "uint256" },
|
|
62
|
-
{ name: "lzTokenFee", type: "uint256" },
|
|
63
|
-
],
|
|
64
|
-
},
|
|
65
|
-
{ name: "_refundAddress", type: "address" },
|
|
66
|
-
],
|
|
67
|
-
outputs: [
|
|
68
|
-
{
|
|
69
|
-
name: "",
|
|
70
|
-
type: "tuple",
|
|
71
|
-
components: [
|
|
72
|
-
{ name: "guid", type: "bytes32" },
|
|
73
|
-
{ name: "nonce", type: "uint64" },
|
|
74
|
-
{
|
|
75
|
-
name: "fee",
|
|
76
|
-
type: "tuple",
|
|
77
|
-
components: [
|
|
78
|
-
{ name: "nativeFee", type: "uint256" },
|
|
79
|
-
{ name: "lzTokenFee", type: "uint256" },
|
|
80
|
-
],
|
|
81
|
-
},
|
|
82
|
-
],
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
name: "",
|
|
86
|
-
type: "tuple",
|
|
87
|
-
components: [
|
|
88
|
-
{ name: "amountSentLD", type: "uint256" },
|
|
89
|
-
{ name: "amountReceivedLD", type: "uint256" },
|
|
90
|
-
],
|
|
91
|
-
},
|
|
92
|
-
],
|
|
93
|
-
stateMutability: "payable",
|
|
94
|
-
},
|
|
95
|
-
];
|
|
96
|
-
/** LayerZero Endpoint ID for Arbitrum. */
|
|
97
|
-
export const ARBITRUM_LZ_EID = 30110;
|
|
98
|
-
/**
|
|
99
|
-
* Build LayerZero v2 executor options for a simple OFT transfer.
|
|
100
|
-
*
|
|
101
|
-
* Encodes a TYPE_3 options blob with an `addExecutorLzReceiveOption(gasLimit)`.
|
|
102
|
-
* This tells the destination-chain executor how much gas to allocate for `lzReceive`.
|
|
103
|
-
*
|
|
104
|
-
* Encoding:
|
|
105
|
-
* 0x0003 — TYPE_3 header (2 bytes)
|
|
106
|
-
* 01 — WORKER_ID_EXECUTOR (1 byte)
|
|
107
|
-
* 0011 — option payload size = 17 (2 bytes)
|
|
108
|
-
* 01 — OPTION_TYPE_LZRECEIVE (1 byte)
|
|
109
|
-
* <16 bytes gas limit> — uint128 gas
|
|
110
|
-
*
|
|
111
|
-
* @param gasLimit - Gas for lzReceive on the destination chain (default 200_000).
|
|
112
|
-
*/
|
|
113
|
-
export function buildLzReceiveOptions(gasLimit = 200000n) {
|
|
114
|
-
const gas = gasLimit.toString(16).padStart(32, "0"); // uint128 = 32 hex chars
|
|
115
|
-
return `0x000301001101${gas}`;
|
|
116
|
-
}
|
|
117
|
-
//# sourceMappingURL=oft-abi.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"oft-abi.js","sourceRoot":"","sources":["../../src/usdt0-bridge/oft-abi.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,WAAW;QACjB,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,YAAY;gBAClB,IAAI,EAAE,OAAO;gBACb,UAAU,EAAE;oBACV,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE;oBAClC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE;oBAC/B,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE;oBACrC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE;oBACxC,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,OAAO,EAAE;oBACvC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE;oBACrC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE;iBAClC;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