@agglayer/sdk 1.0.0-beta.24 → 1.0.0-beta.25
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/index.d.mts +110 -17
- package/dist/index.d.ts +110 -17
- package/dist/index.js +64 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +64 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1404,6 +1404,8 @@ import { createPublicClient as createPublicClient3, http as http3 } from "viem";
|
|
|
1404
1404
|
// src/constants.ts
|
|
1405
1405
|
var ARC_API_BASE_URL = "https://arc-api.polygon.technology";
|
|
1406
1406
|
var ARC_API_DEFAULT_TIMEOUT = 3e4;
|
|
1407
|
+
var LIFI_API_BASE_URL = "https://li.quest";
|
|
1408
|
+
var LIFI_API_DEFAULT_TIMEOUT = 5e3;
|
|
1407
1409
|
var DEFAULT_CHAINS_PER_PAGE = 100;
|
|
1408
1410
|
var DEFAULT_CHAINS_WITH_TOKENS_PER_PAGE = 1;
|
|
1409
1411
|
var MAX_TRANSACTIONS_PER_PAGE = 100;
|
|
@@ -1724,6 +1726,39 @@ var ArcApiService = class {
|
|
|
1724
1726
|
}
|
|
1725
1727
|
};
|
|
1726
1728
|
|
|
1729
|
+
// src/core/services/lifiApi.ts
|
|
1730
|
+
var LiFiApiService = class {
|
|
1731
|
+
constructor({ baseUrl, timeout }) {
|
|
1732
|
+
this.httpClient = new HttpClient({ baseUrl, timeout });
|
|
1733
|
+
}
|
|
1734
|
+
/**
|
|
1735
|
+
* Check the status of a cross-chain transfer
|
|
1736
|
+
*
|
|
1737
|
+
* @param params - Status request parameters
|
|
1738
|
+
* @param params.txHash - The transaction hash on the sending chain, destination chain or lifi step id
|
|
1739
|
+
* @param params.bridge - Optional: The bridging tool used for the transfer
|
|
1740
|
+
* @param params.fromChain - Optional: The sending chain (chain id or chain key)
|
|
1741
|
+
* @param params.toChain - Optional: The receiving chain (chain id or chain key)
|
|
1742
|
+
* @returns Promise containing the transfer status response
|
|
1743
|
+
*/
|
|
1744
|
+
async getStatus(params) {
|
|
1745
|
+
const { txHash, bridge, fromChain, toChain } = params;
|
|
1746
|
+
const queryParams = {
|
|
1747
|
+
txHash
|
|
1748
|
+
};
|
|
1749
|
+
if (bridge) {
|
|
1750
|
+
queryParams["bridge"] = bridge;
|
|
1751
|
+
}
|
|
1752
|
+
if (fromChain) {
|
|
1753
|
+
queryParams["fromChain"] = fromChain;
|
|
1754
|
+
}
|
|
1755
|
+
if (toChain) {
|
|
1756
|
+
queryParams["toChain"] = toChain;
|
|
1757
|
+
}
|
|
1758
|
+
return this.httpClient.get("/v1/status", queryParams);
|
|
1759
|
+
}
|
|
1760
|
+
};
|
|
1761
|
+
|
|
1727
1762
|
// src/core/utils/apiError.ts
|
|
1728
1763
|
var ApiError = class _ApiError extends Error {
|
|
1729
1764
|
constructor(errorResponse) {
|
|
@@ -1782,6 +1817,10 @@ var CoreClient = class {
|
|
|
1782
1817
|
baseUrl: apiBaseUrl || ARC_API_BASE_URL,
|
|
1783
1818
|
timeout: apiTimeout || ARC_API_DEFAULT_TIMEOUT
|
|
1784
1819
|
});
|
|
1820
|
+
this.lifiApiService = new LiFiApiService({
|
|
1821
|
+
baseUrl: LIFI_API_BASE_URL,
|
|
1822
|
+
timeout: LIFI_API_DEFAULT_TIMEOUT
|
|
1823
|
+
});
|
|
1785
1824
|
}
|
|
1786
1825
|
/**
|
|
1787
1826
|
* Generic pagination helper for chains API calls (limit and offset based pagination)
|
|
@@ -2042,6 +2081,31 @@ var CoreClient = class {
|
|
|
2042
2081
|
);
|
|
2043
2082
|
}
|
|
2044
2083
|
}
|
|
2084
|
+
/**
|
|
2085
|
+
* Check the status of a LiFi cross-chain transfer
|
|
2086
|
+
*
|
|
2087
|
+
* @param lifiStatusRequestParams - Status request parameters
|
|
2088
|
+
* @param lifiStatusRequestParams.txHash - The transaction hash on the sending chain, destination chain or lifi step id
|
|
2089
|
+
* @param lifiStatusRequestParams.bridge - Optional: The bridging tool used for the transfer
|
|
2090
|
+
* @param lifiStatusRequestParams.fromChain - Optional: The sending chain (chain id or chain key)
|
|
2091
|
+
* @param lifiStatusRequestParams.toChain - Optional: The receiving chain (chain id or chain key)
|
|
2092
|
+
*/
|
|
2093
|
+
async getLiFiTransferStatus(lifiStatusRequestParams) {
|
|
2094
|
+
try {
|
|
2095
|
+
const response = await this.lifiApiService.getStatus(
|
|
2096
|
+
lifiStatusRequestParams
|
|
2097
|
+
);
|
|
2098
|
+
return response.data;
|
|
2099
|
+
} catch (error) {
|
|
2100
|
+
if (error instanceof ApiError) {
|
|
2101
|
+
throw error;
|
|
2102
|
+
}
|
|
2103
|
+
throw ApiError.createFallbackError(
|
|
2104
|
+
error,
|
|
2105
|
+
"Get LiFi transfer status"
|
|
2106
|
+
);
|
|
2107
|
+
}
|
|
2108
|
+
}
|
|
2045
2109
|
};
|
|
2046
2110
|
|
|
2047
2111
|
// src/index.ts
|