amogus-sdk-internal-utils 0.35.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.
- package/dist/_virtual/rolldown_runtime.cjs +43 -0
- package/dist/_virtual/rolldown_runtime.js +18 -0
- package/dist/bridgeIndexer/bridgeIndexerHttpClient/apis.cjs +10 -0
- package/dist/bridgeIndexer/bridgeIndexerHttpClient/apis.d.cts +6 -0
- package/dist/bridgeIndexer/bridgeIndexerHttpClient/apis.d.ts +6 -0
- package/dist/bridgeIndexer/bridgeIndexerHttpClient/apis.js +10 -0
- package/dist/bridgeIndexer/bridgeIndexerHttpClient/index.cjs +17 -0
- package/dist/bridgeIndexer/bridgeIndexerHttpClient/index.d.cts +9 -0
- package/dist/bridgeIndexer/bridgeIndexerHttpClient/index.d.ts +9 -0
- package/dist/bridgeIndexer/bridgeIndexerHttpClient/index.js +12 -0
- package/dist/bridgeIndexer/bridgeIndexerHttpClient/runtime.cjs +20 -0
- package/dist/bridgeIndexer/bridgeIndexerHttpClient/runtime.js +20 -0
- package/dist/bridgeIndexer/bridgeIndexerHttpClient/types.cjs +25 -0
- package/dist/bridgeIndexer/bridgeIndexerHttpClient/types.d.cts +31 -0
- package/dist/bridgeIndexer/bridgeIndexerHttpClient/types.d.ts +31 -0
- package/dist/bridgeIndexer/bridgeIndexerHttpClient/types.js +23 -0
- package/dist/bridgeIndexer/index.cjs +13 -0
- package/dist/bridgeIndexer/index.d.cts +8 -0
- package/dist/bridgeIndexer/index.d.ts +8 -0
- package/dist/bridgeIndexer/index.js +8 -0
- package/dist/config.cjs +86 -0
- package/dist/config.d.cts +50 -0
- package/dist/config.d.ts +50 -0
- package/dist/config.js +76 -0
- package/dist/errors/assert.cjs +11 -0
- package/dist/errors/assert.d.cts +11 -0
- package/dist/errors/assert.d.ts +11 -0
- package/dist/errors/assert.js +11 -0
- package/dist/errors/base.cjs +34 -0
- package/dist/errors/base.d.cts +21 -0
- package/dist/errors/base.d.ts +21 -0
- package/dist/errors/base.js +33 -0
- package/dist/errors/index.cjs +23 -0
- package/dist/errors/index.d.cts +11 -0
- package/dist/errors/index.d.ts +11 -0
- package/dist/errors/index.js +18 -0
- package/dist/errors/request.cjs +48 -0
- package/dist/errors/request.d.cts +61 -0
- package/dist/errors/request.d.ts +61 -0
- package/dist/errors/request.js +46 -0
- package/dist/errors/utils/isNetworkError.cjs +23 -0
- package/dist/errors/utils/isNetworkError.js +22 -0
- package/dist/errors/utils/toError.cjs +8 -0
- package/dist/errors/utils/toError.d.cts +4 -0
- package/dist/errors/utils/toError.d.ts +4 -0
- package/dist/errors/utils/toError.js +7 -0
- package/dist/index.cjs +144 -0
- package/dist/index.d.cts +33 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +33 -0
- package/dist/logger.d.cts +11 -0
- package/dist/logger.d.ts +11 -0
- package/dist/nearClient.cjs +18 -0
- package/dist/nearClient.d.cts +8 -0
- package/dist/nearClient.d.ts +8 -0
- package/dist/nearClient.js +18 -0
- package/dist/poaBridge/constants/blockchains.cjs +62 -0
- package/dist/poaBridge/constants/blockchains.d.cts +95 -0
- package/dist/poaBridge/constants/blockchains.d.ts +95 -0
- package/dist/poaBridge/constants/blockchains.js +59 -0
- package/dist/poaBridge/errors/withdrawal.cjs +52 -0
- package/dist/poaBridge/errors/withdrawal.d.cts +34 -0
- package/dist/poaBridge/errors/withdrawal.d.ts +34 -0
- package/dist/poaBridge/errors/withdrawal.js +50 -0
- package/dist/poaBridge/getPendingDeposits.cjs +31 -0
- package/dist/poaBridge/getPendingDeposits.d.cts +14 -0
- package/dist/poaBridge/getPendingDeposits.d.ts +15 -0
- package/dist/poaBridge/getPendingDeposits.js +31 -0
- package/dist/poaBridge/index.cjs +23 -0
- package/dist/poaBridge/index.d.cts +11 -0
- package/dist/poaBridge/index.d.ts +11 -0
- package/dist/poaBridge/index.js +18 -0
- package/dist/poaBridge/poaBridgeHttpClient/apis.cjs +38 -0
- package/dist/poaBridge/poaBridgeHttpClient/apis.d.cts +12 -0
- package/dist/poaBridge/poaBridgeHttpClient/apis.d.ts +12 -0
- package/dist/poaBridge/poaBridgeHttpClient/apis.js +32 -0
- package/dist/poaBridge/poaBridgeHttpClient/index.cjs +21 -0
- package/dist/poaBridge/poaBridgeHttpClient/index.d.cts +9 -0
- package/dist/poaBridge/poaBridgeHttpClient/index.d.ts +9 -0
- package/dist/poaBridge/poaBridgeHttpClient/index.js +16 -0
- package/dist/poaBridge/poaBridgeHttpClient/runtime.cjs +49 -0
- package/dist/poaBridge/poaBridgeHttpClient/runtime.js +47 -0
- package/dist/poaBridge/poaBridgeHttpClient/types.d.cts +172 -0
- package/dist/poaBridge/poaBridgeHttpClient/types.d.ts +172 -0
- package/dist/poaBridge/waitForWithdrawalCompletion.cjs +57 -0
- package/dist/poaBridge/waitForWithdrawalCompletion.d.cts +31 -0
- package/dist/poaBridge/waitForWithdrawalCompletion.d.ts +31 -0
- package/dist/poaBridge/waitForWithdrawalCompletion.js +56 -0
- package/dist/services/blockchainBalanceService.cjs +40 -0
- package/dist/services/blockchainBalanceService.d.cts +21 -0
- package/dist/services/blockchainBalanceService.d.ts +21 -0
- package/dist/services/blockchainBalanceService.js +37 -0
- package/dist/solverRelay/errors/intentSettlement.cjs +20 -0
- package/dist/solverRelay/errors/intentSettlement.d.cts +13 -0
- package/dist/solverRelay/errors/intentSettlement.d.ts +13 -0
- package/dist/solverRelay/errors/intentSettlement.js +20 -0
- package/dist/solverRelay/errors/quote.cjs +18 -0
- package/dist/solverRelay/errors/quote.d.cts +21 -0
- package/dist/solverRelay/errors/quote.d.ts +22 -0
- package/dist/solverRelay/errors/quote.js +18 -0
- package/dist/solverRelay/getQuote.cjs +70 -0
- package/dist/solverRelay/getQuote.d.cts +14 -0
- package/dist/solverRelay/getQuote.d.ts +14 -0
- package/dist/solverRelay/getQuote.js +70 -0
- package/dist/solverRelay/getStatus.cjs +26 -0
- package/dist/solverRelay/getStatus.d.cts +17 -0
- package/dist/solverRelay/getStatus.d.ts +18 -0
- package/dist/solverRelay/getStatus.js +26 -0
- package/dist/solverRelay/index.cjs +27 -0
- package/dist/solverRelay/index.d.cts +16 -0
- package/dist/solverRelay/index.d.ts +16 -0
- package/dist/solverRelay/index.js +22 -0
- package/dist/solverRelay/publishIntent.cjs +20 -0
- package/dist/solverRelay/publishIntent.d.cts +15 -0
- package/dist/solverRelay/publishIntent.d.ts +16 -0
- package/dist/solverRelay/publishIntent.js +20 -0
- package/dist/solverRelay/publishIntents.cjs +42 -0
- package/dist/solverRelay/publishIntents.d.cts +10 -0
- package/dist/solverRelay/publishIntents.d.ts +11 -0
- package/dist/solverRelay/publishIntents.js +41 -0
- package/dist/solverRelay/solverRelayHttpClient/apis.cjs +21 -0
- package/dist/solverRelay/solverRelayHttpClient/apis.d.cts +9 -0
- package/dist/solverRelay/solverRelayHttpClient/apis.d.ts +9 -0
- package/dist/solverRelay/solverRelayHttpClient/apis.js +18 -0
- package/dist/solverRelay/solverRelayHttpClient/index.cjs +18 -0
- package/dist/solverRelay/solverRelayHttpClient/index.d.cts +9 -0
- package/dist/solverRelay/solverRelayHttpClient/index.d.ts +9 -0
- package/dist/solverRelay/solverRelayHttpClient/index.js +13 -0
- package/dist/solverRelay/solverRelayHttpClient/runtime.cjs +60 -0
- package/dist/solverRelay/solverRelayHttpClient/runtime.js +58 -0
- package/dist/solverRelay/solverRelayHttpClient/types.d.cts +117 -0
- package/dist/solverRelay/solverRelayHttpClient/types.d.ts +117 -0
- package/dist/solverRelay/utils/parseFailedPublishError.cjs +64 -0
- package/dist/solverRelay/utils/parseFailedPublishError.d.cts +56 -0
- package/dist/solverRelay/utils/parseFailedPublishError.d.ts +57 -0
- package/dist/solverRelay/utils/parseFailedPublishError.js +61 -0
- package/dist/solverRelay/utils/quoteWithLog.cjs +21 -0
- package/dist/solverRelay/utils/quoteWithLog.d.cts +12 -0
- package/dist/solverRelay/utils/quoteWithLog.d.ts +14 -0
- package/dist/solverRelay/utils/quoteWithLog.js +21 -0
- package/dist/solverRelay/waitForIntentSettlement.cjs +52 -0
- package/dist/solverRelay/waitForIntentSettlement.d.cts +30 -0
- package/dist/solverRelay/waitForIntentSettlement.d.ts +30 -0
- package/dist/solverRelay/waitForIntentSettlement.js +52 -0
- package/dist/types/authHandle.cjs +22 -0
- package/dist/types/authHandle.d.cts +25 -0
- package/dist/types/authHandle.d.ts +25 -0
- package/dist/types/authHandle.js +16 -0
- package/dist/types/base.d.cts +45 -0
- package/dist/types/base.d.ts +45 -0
- package/dist/types/intentsUserId.d.cts +10 -0
- package/dist/types/intentsUserId.d.ts +10 -0
- package/dist/types/walletMessage.cjs +11 -0
- package/dist/types/walletMessage.d.cts +106 -0
- package/dist/types/walletMessage.d.ts +106 -0
- package/dist/types/walletMessage.js +5 -0
- package/dist/utils/abortSignal.cjs +19 -0
- package/dist/utils/abortSignal.js +18 -0
- package/dist/utils/appFee.cjs +20 -0
- package/dist/utils/appFee.d.cts +9 -0
- package/dist/utils/appFee.d.ts +9 -0
- package/dist/utils/appFee.js +15 -0
- package/dist/utils/assert.cjs +9 -0
- package/dist/utils/assert.d.cts +7 -0
- package/dist/utils/assert.d.ts +7 -0
- package/dist/utils/assert.js +9 -0
- package/dist/utils/authIdentity.cjs +56 -0
- package/dist/utils/authIdentity.d.cts +34 -0
- package/dist/utils/authIdentity.d.ts +34 -0
- package/dist/utils/authIdentity.js +50 -0
- package/dist/utils/failover.cjs +36 -0
- package/dist/utils/failover.d.cts +24 -0
- package/dist/utils/failover.d.ts +24 -0
- package/dist/utils/failover.js +34 -0
- package/dist/utils/handleRPCResponse.cjs +30 -0
- package/dist/utils/handleRPCResponse.js +28 -0
- package/dist/utils/handleResponse.cjs +31 -0
- package/dist/utils/handleResponse.js +29 -0
- package/dist/utils/index.cjs +55 -0
- package/dist/utils/index.d.cts +13 -0
- package/dist/utils/index.d.ts +13 -0
- package/dist/utils/index.js +50 -0
- package/dist/utils/messageFactory.cjs +137 -0
- package/dist/utils/messageFactory.d.cts +70 -0
- package/dist/utils/messageFactory.d.ts +70 -0
- package/dist/utils/messageFactory.js +132 -0
- package/dist/utils/multiPayload/webauthn.cjs +27 -0
- package/dist/utils/multiPayload/webauthn.js +26 -0
- package/dist/utils/near.cjs +58 -0
- package/dist/utils/near.d.cts +35 -0
- package/dist/utils/near.d.ts +35 -0
- package/dist/utils/near.js +53 -0
- package/dist/utils/poll.cjs +87 -0
- package/dist/utils/poll.d.cts +54 -0
- package/dist/utils/poll.d.ts +54 -0
- package/dist/utils/poll.js +85 -0
- package/dist/utils/prepareBroadcastRequest.cjs +98 -0
- package/dist/utils/prepareBroadcastRequest.d.cts +16 -0
- package/dist/utils/prepareBroadcastRequest.d.ts +16 -0
- package/dist/utils/prepareBroadcastRequest.js +90 -0
- package/dist/utils/promise/withTimeout.cjs +34 -0
- package/dist/utils/promise/withTimeout.d.cts +16 -0
- package/dist/utils/promise/withTimeout.d.ts +16 -0
- package/dist/utils/promise/withTimeout.js +34 -0
- package/dist/utils/request.cjs +100 -0
- package/dist/utils/request.d.cts +27 -0
- package/dist/utils/request.d.ts +27 -0
- package/dist/utils/request.js +99 -0
- package/dist/utils/requestShouldRetry.cjs +20 -0
- package/dist/utils/requestShouldRetry.js +20 -0
- package/dist/utils/retry.cjs +66 -0
- package/dist/utils/retry.d.cts +56 -0
- package/dist/utils/retry.d.ts +56 -0
- package/dist/utils/retry.js +64 -0
- package/dist/utils/rpc-endpoint.cjs +56 -0
- package/dist/utils/rpc-endpoint.d.cts +20 -0
- package/dist/utils/rpc-endpoint.d.ts +20 -0
- package/dist/utils/rpc-endpoint.js +54 -0
- package/dist/utils/serialize.cjs +82 -0
- package/dist/utils/serialize.d.cts +17 -0
- package/dist/utils/serialize.d.ts +17 -0
- package/dist/utils/serialize.js +81 -0
- package/dist/utils/stellarAddressToBytes.cjs +295 -0
- package/dist/utils/stellarAddressToBytes.js +294 -0
- package/dist/utils/token.cjs +8 -0
- package/dist/utils/token.js +7 -0
- package/dist/utils/tokenUtils.cjs +263 -0
- package/dist/utils/tokenUtils.d.cts +88 -0
- package/dist/utils/tokenUtils.d.ts +88 -0
- package/dist/utils/tokenUtils.js +238 -0
- package/dist/utils/tronAddressToHex.cjs +18 -0
- package/dist/utils/tronAddressToHex.js +17 -0
- package/dist/utils/uint8Array.cjs +15 -0
- package/dist/utils/uint8Array.d.cts +4 -0
- package/dist/utils/uint8Array.d.ts +4 -0
- package/dist/utils/uint8Array.js +14 -0
- package/dist/utils/webAuthn.cjs +58 -0
- package/dist/utils/webAuthn.js +56 -0
- package/dist/xrpl/index.cjs +13 -0
- package/dist/xrpl/index.d.cts +8 -0
- package/dist/xrpl/index.d.ts +8 -0
- package/dist/xrpl/index.js +8 -0
- package/dist/xrpl/xrplHttpClient/apis.cjs +28 -0
- package/dist/xrpl/xrplHttpClient/apis.d.cts +7 -0
- package/dist/xrpl/xrplHttpClient/apis.d.ts +7 -0
- package/dist/xrpl/xrplHttpClient/apis.js +27 -0
- package/dist/xrpl/xrplHttpClient/errors.cjs +27 -0
- package/dist/xrpl/xrplHttpClient/errors.d.cts +24 -0
- package/dist/xrpl/xrplHttpClient/errors.d.ts +24 -0
- package/dist/xrpl/xrplHttpClient/errors.js +26 -0
- package/dist/xrpl/xrplHttpClient/index.cjs +19 -0
- package/dist/xrpl/xrplHttpClient/index.d.cts +10 -0
- package/dist/xrpl/xrplHttpClient/index.d.ts +10 -0
- package/dist/xrpl/xrplHttpClient/index.js +14 -0
- package/dist/xrpl/xrplHttpClient/runtime.cjs +57 -0
- package/dist/xrpl/xrplHttpClient/runtime.js +55 -0
- package/dist/xrpl/xrplHttpClient/types.cjs +39 -0
- package/dist/xrpl/xrplHttpClient/types.d.cts +64 -0
- package/dist/xrpl/xrplHttpClient/types.d.ts +64 -0
- package/dist/xrpl/xrplHttpClient/types.js +35 -0
- package/package.json +59 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const require_apis = require('./poaBridgeHttpClient/apis.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/poaBridge/getPendingDeposits.ts
|
|
4
|
+
const MAX_PAGES = 50;
|
|
5
|
+
/**
|
|
6
|
+
* @description Fetches all pending deposits for the given account, paginating through results (20 per page). Capped at 50 as a safeguard against infinite loops from a misbehaving API.
|
|
7
|
+
* @param accountId
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
async function getPendingDeposits(accountId) {
|
|
11
|
+
const pendingDeposits = [];
|
|
12
|
+
const limit = 20;
|
|
13
|
+
let offset = 0;
|
|
14
|
+
let page = 0;
|
|
15
|
+
while (page < MAX_PAGES) {
|
|
16
|
+
const result = await require_apis.getDepositStatus({
|
|
17
|
+
account_id: accountId,
|
|
18
|
+
limit,
|
|
19
|
+
offset,
|
|
20
|
+
status: "PENDING"
|
|
21
|
+
});
|
|
22
|
+
for (const deposit of result.deposits) pendingDeposits.push(deposit);
|
|
23
|
+
offset += result.deposits.length;
|
|
24
|
+
page++;
|
|
25
|
+
if (offset >= result.total || result.deposits.length < limit) break;
|
|
26
|
+
}
|
|
27
|
+
return pendingDeposits;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
exports.getPendingDeposits = getPendingDeposits;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { GetDepositStatusResponse, JSONRPCErrorType } from "./poaBridgeHttpClient/types.cjs";
|
|
2
|
+
import { IntentsUserId } from "../types/intentsUserId.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/poaBridge/getPendingDeposits.d.ts
|
|
5
|
+
type PendingDeposit = GetDepositStatusResponse<"PENDING">["result"]["deposits"][number];
|
|
6
|
+
type GetPendingDepositsErrorType = JSONRPCErrorType;
|
|
7
|
+
/**
|
|
8
|
+
* @description Fetches all pending deposits for the given account, paginating through results (20 per page). Capped at 50 as a safeguard against infinite loops from a misbehaving API.
|
|
9
|
+
* @param accountId
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
declare function getPendingDeposits(accountId: IntentsUserId): Promise<PendingDeposit[]>;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { GetPendingDepositsErrorType, PendingDeposit, getPendingDeposits };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { GetDepositStatusResponse, JSONRPCErrorType } from "./poaBridgeHttpClient/types.js";
|
|
2
|
+
import "./poaBridgeHttpClient/index.js";
|
|
3
|
+
import { IntentsUserId } from "../types/intentsUserId.js";
|
|
4
|
+
|
|
5
|
+
//#region src/poaBridge/getPendingDeposits.d.ts
|
|
6
|
+
type PendingDeposit = GetDepositStatusResponse<"PENDING">["result"]["deposits"][number];
|
|
7
|
+
type GetPendingDepositsErrorType = JSONRPCErrorType;
|
|
8
|
+
/**
|
|
9
|
+
* @description Fetches all pending deposits for the given account, paginating through results (20 per page). Capped at 50 as a safeguard against infinite loops from a misbehaving API.
|
|
10
|
+
* @param accountId
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
declare function getPendingDeposits(accountId: IntentsUserId): Promise<PendingDeposit[]>;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { GetPendingDepositsErrorType, PendingDeposit, getPendingDeposits };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { getDepositStatus } from "./poaBridgeHttpClient/apis.js";
|
|
2
|
+
|
|
3
|
+
//#region src/poaBridge/getPendingDeposits.ts
|
|
4
|
+
const MAX_PAGES = 50;
|
|
5
|
+
/**
|
|
6
|
+
* @description Fetches all pending deposits for the given account, paginating through results (20 per page). Capped at 50 as a safeguard against infinite loops from a misbehaving API.
|
|
7
|
+
* @param accountId
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
async function getPendingDeposits(accountId) {
|
|
11
|
+
const pendingDeposits = [];
|
|
12
|
+
const limit = 20;
|
|
13
|
+
let offset = 0;
|
|
14
|
+
let page = 0;
|
|
15
|
+
while (page < MAX_PAGES) {
|
|
16
|
+
const result = await getDepositStatus({
|
|
17
|
+
account_id: accountId,
|
|
18
|
+
limit,
|
|
19
|
+
offset,
|
|
20
|
+
status: "PENDING"
|
|
21
|
+
});
|
|
22
|
+
for (const deposit of result.deposits) pendingDeposits.push(deposit);
|
|
23
|
+
offset += result.deposits.length;
|
|
24
|
+
page++;
|
|
25
|
+
if (offset >= result.total || result.deposits.length < limit) break;
|
|
26
|
+
}
|
|
27
|
+
return pendingDeposits;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
export { getPendingDeposits };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_index = require('./poaBridgeHttpClient/index.cjs');
|
|
3
|
+
const require_waitForWithdrawalCompletion = require('./waitForWithdrawalCompletion.cjs');
|
|
4
|
+
const require_blockchains = require('./constants/blockchains.cjs');
|
|
5
|
+
const require_getPendingDeposits = require('./getPendingDeposits.cjs');
|
|
6
|
+
|
|
7
|
+
//#region src/poaBridge/index.ts
|
|
8
|
+
var poaBridge_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
|
|
9
|
+
BlockchainEnum: () => require_blockchains.BlockchainEnum,
|
|
10
|
+
PoaBridgeNetworkReference: () => require_blockchains.PoaBridgeNetworkReference,
|
|
11
|
+
VirtualNetworkReference: () => require_blockchains.VirtualNetworkReference,
|
|
12
|
+
getPendingDeposits: () => require_getPendingDeposits.getPendingDeposits,
|
|
13
|
+
httpClient: () => require_index.poaBridgeHttpClient_exports,
|
|
14
|
+
waitForWithdrawalCompletion: () => require_waitForWithdrawalCompletion.waitForWithdrawalCompletion
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
Object.defineProperty(exports, 'poaBridge_exports', {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return poaBridge_exports;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BlockchainEnum, PoaBridgeNetworkReference, VirtualNetworkReference } from "./constants/blockchains.cjs";
|
|
2
|
+
import { index_d_exports as index_d_exports$1 } from "./poaBridgeHttpClient/index.cjs";
|
|
3
|
+
import { WaitForWithdrawalCompletionErrorType, WaitForWithdrawalCompletionOkType, WithdrawalCriteria, waitForWithdrawalCompletion } from "./waitForWithdrawalCompletion.cjs";
|
|
4
|
+
import { GetPendingDepositsErrorType, PendingDeposit, getPendingDeposits } from "./getPendingDeposits.cjs";
|
|
5
|
+
|
|
6
|
+
//#region src/poaBridge/index.d.ts
|
|
7
|
+
declare namespace index_d_exports {
|
|
8
|
+
export { BlockchainEnum, GetPendingDepositsErrorType, PendingDeposit, PoaBridgeNetworkReference, VirtualNetworkReference, WaitForWithdrawalCompletionErrorType, WaitForWithdrawalCompletionOkType, WithdrawalCriteria, getPendingDeposits, index_d_exports$1 as httpClient, waitForWithdrawalCompletion };
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { index_d_exports };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BlockchainEnum, PoaBridgeNetworkReference, VirtualNetworkReference } from "./constants/blockchains.js";
|
|
2
|
+
import { index_d_exports as index_d_exports$1 } from "./poaBridgeHttpClient/index.js";
|
|
3
|
+
import { WaitForWithdrawalCompletionErrorType, WaitForWithdrawalCompletionOkType, WithdrawalCriteria, waitForWithdrawalCompletion } from "./waitForWithdrawalCompletion.js";
|
|
4
|
+
import { GetPendingDepositsErrorType, PendingDeposit, getPendingDeposits } from "./getPendingDeposits.js";
|
|
5
|
+
|
|
6
|
+
//#region src/poaBridge/index.d.ts
|
|
7
|
+
declare namespace index_d_exports {
|
|
8
|
+
export { BlockchainEnum, GetPendingDepositsErrorType, PendingDeposit, PoaBridgeNetworkReference, VirtualNetworkReference, WaitForWithdrawalCompletionErrorType, WaitForWithdrawalCompletionOkType, WithdrawalCriteria, getPendingDeposits, index_d_exports$1 as httpClient, waitForWithdrawalCompletion };
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { index_d_exports };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { __exportAll } from "../_virtual/rolldown_runtime.js";
|
|
2
|
+
import { poaBridgeHttpClient_exports } from "./poaBridgeHttpClient/index.js";
|
|
3
|
+
import { waitForWithdrawalCompletion } from "./waitForWithdrawalCompletion.js";
|
|
4
|
+
import { BlockchainEnum, PoaBridgeNetworkReference, VirtualNetworkReference } from "./constants/blockchains.js";
|
|
5
|
+
import { getPendingDeposits } from "./getPendingDeposits.js";
|
|
6
|
+
|
|
7
|
+
//#region src/poaBridge/index.ts
|
|
8
|
+
var poaBridge_exports = /* @__PURE__ */ __exportAll({
|
|
9
|
+
BlockchainEnum: () => BlockchainEnum,
|
|
10
|
+
PoaBridgeNetworkReference: () => PoaBridgeNetworkReference,
|
|
11
|
+
VirtualNetworkReference: () => VirtualNetworkReference,
|
|
12
|
+
getPendingDeposits: () => getPendingDeposits,
|
|
13
|
+
httpClient: () => poaBridgeHttpClient_exports,
|
|
14
|
+
waitForWithdrawalCompletion: () => waitForWithdrawalCompletion
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { poaBridge_exports };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const require_config = require('../../config.cjs');
|
|
2
|
+
const require_request = require('../../utils/request.cjs');
|
|
3
|
+
const require_runtime = require('./runtime.cjs');
|
|
4
|
+
|
|
5
|
+
//#region src/poaBridge/poaBridgeHttpClient/apis.ts
|
|
6
|
+
async function getSupportedTokens(params, config$1 = {}) {
|
|
7
|
+
return await require_runtime.jsonRPCRequest("supported_tokens", params, config$1);
|
|
8
|
+
}
|
|
9
|
+
async function getDepositAddress(params, config$1 = {}) {
|
|
10
|
+
return await require_runtime.jsonRPCRequest("deposit_address", params, config$1);
|
|
11
|
+
}
|
|
12
|
+
async function getDepositStatus(params, config$1 = {}) {
|
|
13
|
+
return await require_runtime.jsonRPCRequest("recent_deposits", params, config$1);
|
|
14
|
+
}
|
|
15
|
+
async function getWithdrawalStatus(params, config$1 = {}) {
|
|
16
|
+
return await require_runtime.jsonRPCRequest("withdrawal_status", params, config$1);
|
|
17
|
+
}
|
|
18
|
+
async function hotOmniWithdraw(params, config$1 = {}) {
|
|
19
|
+
return await require_runtime.jsonRPCRequest("hot_omni_withdraw", params, config$1);
|
|
20
|
+
}
|
|
21
|
+
async function getTokenBalancesRequest(addresses, config$1 = {}) {
|
|
22
|
+
return (await require_request.request({
|
|
23
|
+
url: `${config$1.baseURL ?? require_config.config.env.poaBridgeBaseURL}/console/tokenBalances?${addresses.map((address) => `addresses[]=${address}`).join("&")}`,
|
|
24
|
+
fetchOptions: { method: "GET" }
|
|
25
|
+
})).json();
|
|
26
|
+
}
|
|
27
|
+
async function getWithdrawalEstimate(params, config$1 = {}) {
|
|
28
|
+
return await require_runtime.jsonRPCRequest("withdrawal_estimate", params, config$1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
exports.getDepositAddress = getDepositAddress;
|
|
33
|
+
exports.getDepositStatus = getDepositStatus;
|
|
34
|
+
exports.getSupportedTokens = getSupportedTokens;
|
|
35
|
+
exports.getTokenBalancesRequest = getTokenBalancesRequest;
|
|
36
|
+
exports.getWithdrawalEstimate = getWithdrawalEstimate;
|
|
37
|
+
exports.getWithdrawalStatus = getWithdrawalStatus;
|
|
38
|
+
exports.hotOmniWithdraw = hotOmniWithdraw;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BridgeBalanceResponse, DepositStatus, GetDepositAddressRequest, GetDepositAddressResponse, GetDepositStatusParams, GetDepositStatusResponse, GetSupportedTokensRequest, GetSupportedTokensResponse, GetWithdrawalEstimateRequest, HotOmniWithdrawRequest, HotOmniWithdrawResponse, RequestConfig, WithdrawalEstimateResponse, WithdrawalStatusRequest, WithdrawalStatusResponseOk } from "./types.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/poaBridge/poaBridgeHttpClient/apis.d.ts
|
|
4
|
+
declare function getSupportedTokens(params: GetSupportedTokensRequest["params"][0], config?: RequestConfig): Promise<GetSupportedTokensResponse["result"]>;
|
|
5
|
+
declare function getDepositAddress(params: GetDepositAddressRequest["params"][0], config?: RequestConfig): Promise<GetDepositAddressResponse["result"]>;
|
|
6
|
+
declare function getDepositStatus<S extends DepositStatus["status"]>(params: GetDepositStatusParams<S>, config?: RequestConfig): Promise<GetDepositStatusResponse<S>["result"]>;
|
|
7
|
+
declare function getWithdrawalStatus(params: WithdrawalStatusRequest["params"][0], config?: RequestConfig): Promise<WithdrawalStatusResponseOk["result"]>;
|
|
8
|
+
declare function hotOmniWithdraw(params: HotOmniWithdrawRequest["params"][0], config?: RequestConfig): Promise<HotOmniWithdrawResponse["result"]>;
|
|
9
|
+
declare function getTokenBalancesRequest(addresses: string[], config?: RequestConfig): Promise<BridgeBalanceResponse>;
|
|
10
|
+
declare function getWithdrawalEstimate(params: GetWithdrawalEstimateRequest["params"][0], config?: RequestConfig): Promise<WithdrawalEstimateResponse>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { getDepositAddress, getDepositStatus, getSupportedTokens, getTokenBalancesRequest, getWithdrawalEstimate, getWithdrawalStatus, hotOmniWithdraw };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BridgeBalanceResponse, DepositStatus, GetDepositAddressRequest, GetDepositAddressResponse, GetDepositStatusParams, GetDepositStatusResponse, GetSupportedTokensRequest, GetSupportedTokensResponse, GetWithdrawalEstimateRequest, HotOmniWithdrawRequest, HotOmniWithdrawResponse, RequestConfig, WithdrawalEstimateResponse, WithdrawalStatusRequest, WithdrawalStatusResponseOk } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/poaBridge/poaBridgeHttpClient/apis.d.ts
|
|
4
|
+
declare function getSupportedTokens(params: GetSupportedTokensRequest["params"][0], config?: RequestConfig): Promise<GetSupportedTokensResponse["result"]>;
|
|
5
|
+
declare function getDepositAddress(params: GetDepositAddressRequest["params"][0], config?: RequestConfig): Promise<GetDepositAddressResponse["result"]>;
|
|
6
|
+
declare function getDepositStatus<S extends DepositStatus["status"]>(params: GetDepositStatusParams<S>, config?: RequestConfig): Promise<GetDepositStatusResponse<S>["result"]>;
|
|
7
|
+
declare function getWithdrawalStatus(params: WithdrawalStatusRequest["params"][0], config?: RequestConfig): Promise<WithdrawalStatusResponseOk["result"]>;
|
|
8
|
+
declare function hotOmniWithdraw(params: HotOmniWithdrawRequest["params"][0], config?: RequestConfig): Promise<HotOmniWithdrawResponse["result"]>;
|
|
9
|
+
declare function getTokenBalancesRequest(addresses: string[], config?: RequestConfig): Promise<BridgeBalanceResponse>;
|
|
10
|
+
declare function getWithdrawalEstimate(params: GetWithdrawalEstimateRequest["params"][0], config?: RequestConfig): Promise<WithdrawalEstimateResponse>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { getDepositAddress, getDepositStatus, getSupportedTokens, getTokenBalancesRequest, getWithdrawalEstimate, getWithdrawalStatus, hotOmniWithdraw };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { config } from "../../config.js";
|
|
2
|
+
import { request } from "../../utils/request.js";
|
|
3
|
+
import { jsonRPCRequest } from "./runtime.js";
|
|
4
|
+
|
|
5
|
+
//#region src/poaBridge/poaBridgeHttpClient/apis.ts
|
|
6
|
+
async function getSupportedTokens(params, config$1 = {}) {
|
|
7
|
+
return await jsonRPCRequest("supported_tokens", params, config$1);
|
|
8
|
+
}
|
|
9
|
+
async function getDepositAddress(params, config$1 = {}) {
|
|
10
|
+
return await jsonRPCRequest("deposit_address", params, config$1);
|
|
11
|
+
}
|
|
12
|
+
async function getDepositStatus(params, config$1 = {}) {
|
|
13
|
+
return await jsonRPCRequest("recent_deposits", params, config$1);
|
|
14
|
+
}
|
|
15
|
+
async function getWithdrawalStatus(params, config$1 = {}) {
|
|
16
|
+
return await jsonRPCRequest("withdrawal_status", params, config$1);
|
|
17
|
+
}
|
|
18
|
+
async function hotOmniWithdraw(params, config$1 = {}) {
|
|
19
|
+
return await jsonRPCRequest("hot_omni_withdraw", params, config$1);
|
|
20
|
+
}
|
|
21
|
+
async function getTokenBalancesRequest(addresses, config$1 = {}) {
|
|
22
|
+
return (await request({
|
|
23
|
+
url: `${config$1.baseURL ?? config.env.poaBridgeBaseURL}/console/tokenBalances?${addresses.map((address) => `addresses[]=${address}`).join("&")}`,
|
|
24
|
+
fetchOptions: { method: "GET" }
|
|
25
|
+
})).json();
|
|
26
|
+
}
|
|
27
|
+
async function getWithdrawalEstimate(params, config$1 = {}) {
|
|
28
|
+
return await jsonRPCRequest("withdrawal_estimate", params, config$1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { getDepositAddress, getDepositStatus, getSupportedTokens, getTokenBalancesRequest, getWithdrawalEstimate, getWithdrawalStatus, hotOmniWithdraw };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_apis = require('./apis.cjs');
|
|
3
|
+
|
|
4
|
+
//#region src/poaBridge/poaBridgeHttpClient/index.ts
|
|
5
|
+
var poaBridgeHttpClient_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
|
|
6
|
+
getDepositAddress: () => require_apis.getDepositAddress,
|
|
7
|
+
getDepositStatus: () => require_apis.getDepositStatus,
|
|
8
|
+
getSupportedTokens: () => require_apis.getSupportedTokens,
|
|
9
|
+
getTokenBalancesRequest: () => require_apis.getTokenBalancesRequest,
|
|
10
|
+
getWithdrawalEstimate: () => require_apis.getWithdrawalEstimate,
|
|
11
|
+
getWithdrawalStatus: () => require_apis.getWithdrawalStatus,
|
|
12
|
+
hotOmniWithdraw: () => require_apis.hotOmniWithdraw
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
Object.defineProperty(exports, 'poaBridgeHttpClient_exports', {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () {
|
|
19
|
+
return poaBridgeHttpClient_exports;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BridgeBalanceResponse, DepositNetworkMemo, DepositStatus, GetDepositAddressRequest, GetDepositAddressResponse, GetDepositStatusParams, GetDepositStatusRequest, GetDepositStatusResponse, GetSupportedTokensRequest, GetSupportedTokensResponse, GetWithdrawalEstimateRequest, HotOmniWithdrawRequest, HotOmniWithdrawResponse, JSONRPCErrorType, JSONRPCRequest, JSONRPCResponse, RequestConfig, TokenBalances, WithdrawalEstimateResponse, WithdrawalStatusRequest, WithdrawalStatusResponseOk } from "./types.cjs";
|
|
2
|
+
import { getDepositAddress, getDepositStatus, getSupportedTokens, getTokenBalancesRequest, getWithdrawalEstimate, getWithdrawalStatus, hotOmniWithdraw } from "./apis.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/poaBridge/poaBridgeHttpClient/index.d.ts
|
|
5
|
+
declare namespace index_d_exports {
|
|
6
|
+
export { BridgeBalanceResponse, DepositNetworkMemo, DepositStatus, GetDepositAddressRequest, GetDepositAddressResponse, GetDepositStatusParams, GetDepositStatusRequest, GetDepositStatusResponse, GetSupportedTokensRequest, GetSupportedTokensResponse, GetWithdrawalEstimateRequest, HotOmniWithdrawRequest, HotOmniWithdrawResponse, JSONRPCErrorType, JSONRPCRequest, JSONRPCResponse, RequestConfig, TokenBalances, WithdrawalEstimateResponse, WithdrawalStatusRequest, WithdrawalStatusResponseOk, getDepositAddress, getDepositStatus, getSupportedTokens, getTokenBalancesRequest, getWithdrawalEstimate, getWithdrawalStatus, hotOmniWithdraw };
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { index_d_exports };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BridgeBalanceResponse, DepositNetworkMemo, DepositStatus, GetDepositAddressRequest, GetDepositAddressResponse, GetDepositStatusParams, GetDepositStatusRequest, GetDepositStatusResponse, GetSupportedTokensRequest, GetSupportedTokensResponse, GetWithdrawalEstimateRequest, HotOmniWithdrawRequest, HotOmniWithdrawResponse, JSONRPCErrorType, JSONRPCRequest, JSONRPCResponse, RequestConfig, TokenBalances, WithdrawalEstimateResponse, WithdrawalStatusRequest, WithdrawalStatusResponseOk } from "./types.js";
|
|
2
|
+
import { getDepositAddress, getDepositStatus, getSupportedTokens, getTokenBalancesRequest, getWithdrawalEstimate, getWithdrawalStatus, hotOmniWithdraw } from "./apis.js";
|
|
3
|
+
|
|
4
|
+
//#region src/poaBridge/poaBridgeHttpClient/index.d.ts
|
|
5
|
+
declare namespace index_d_exports {
|
|
6
|
+
export { BridgeBalanceResponse, DepositNetworkMemo, DepositStatus, GetDepositAddressRequest, GetDepositAddressResponse, GetDepositStatusParams, GetDepositStatusRequest, GetDepositStatusResponse, GetSupportedTokensRequest, GetSupportedTokensResponse, GetWithdrawalEstimateRequest, HotOmniWithdrawRequest, HotOmniWithdrawResponse, JSONRPCErrorType, JSONRPCRequest, JSONRPCResponse, RequestConfig, TokenBalances, WithdrawalEstimateResponse, WithdrawalStatusRequest, WithdrawalStatusResponseOk, getDepositAddress, getDepositStatus, getSupportedTokens, getTokenBalancesRequest, getWithdrawalEstimate, getWithdrawalStatus, hotOmniWithdraw };
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { index_d_exports };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { __exportAll } from "../../_virtual/rolldown_runtime.js";
|
|
2
|
+
import { getDepositAddress, getDepositStatus, getSupportedTokens, getTokenBalancesRequest, getWithdrawalEstimate, getWithdrawalStatus, hotOmniWithdraw } from "./apis.js";
|
|
3
|
+
|
|
4
|
+
//#region src/poaBridge/poaBridgeHttpClient/index.ts
|
|
5
|
+
var poaBridgeHttpClient_exports = /* @__PURE__ */ __exportAll({
|
|
6
|
+
getDepositAddress: () => getDepositAddress,
|
|
7
|
+
getDepositStatus: () => getDepositStatus,
|
|
8
|
+
getSupportedTokens: () => getSupportedTokens,
|
|
9
|
+
getTokenBalancesRequest: () => getTokenBalancesRequest,
|
|
10
|
+
getWithdrawalEstimate: () => getWithdrawalEstimate,
|
|
11
|
+
getWithdrawalStatus: () => getWithdrawalStatus,
|
|
12
|
+
hotOmniWithdraw: () => hotOmniWithdraw
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { poaBridgeHttpClient_exports };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_config = require('../../config.cjs');
|
|
3
|
+
const require_request = require('../../utils/request.cjs');
|
|
4
|
+
const require_handleRPCResponse = require('../../utils/handleRPCResponse.cjs');
|
|
5
|
+
const require_retry = require('../../utils/retry.cjs');
|
|
6
|
+
let valibot = require("valibot");
|
|
7
|
+
valibot = require_rolldown_runtime.__toESM(valibot);
|
|
8
|
+
|
|
9
|
+
//#region src/poaBridge/poaBridgeHttpClient/runtime.ts
|
|
10
|
+
const rpcResponseSchema = valibot.union([valibot.object({
|
|
11
|
+
jsonrpc: valibot.literal("2.0"),
|
|
12
|
+
id: valibot.string(),
|
|
13
|
+
result: valibot.unknown()
|
|
14
|
+
}), valibot.object({
|
|
15
|
+
jsonrpc: valibot.literal("2.0"),
|
|
16
|
+
id: valibot.string(),
|
|
17
|
+
error: valibot.pipe(valibot.string(), valibot.transform((v) => {
|
|
18
|
+
return {
|
|
19
|
+
code: -1,
|
|
20
|
+
data: null,
|
|
21
|
+
message: v
|
|
22
|
+
};
|
|
23
|
+
}))
|
|
24
|
+
})]);
|
|
25
|
+
async function jsonRPCRequest(method, params, config$1) {
|
|
26
|
+
const baseURL = config$1?.baseURL ?? require_config.config.env.poaBridgeBaseURL;
|
|
27
|
+
const url = new URL("rpc", baseURL);
|
|
28
|
+
url.searchParams.set("method", String(method));
|
|
29
|
+
const body = {
|
|
30
|
+
id: config$1?.requestId ?? "dontcare",
|
|
31
|
+
jsonrpc: "2.0",
|
|
32
|
+
method,
|
|
33
|
+
params: params !== void 0 ? [params] : void 0
|
|
34
|
+
};
|
|
35
|
+
return require_handleRPCResponse.handleRPCResponse(await require_request.request({
|
|
36
|
+
url,
|
|
37
|
+
body,
|
|
38
|
+
...config$1,
|
|
39
|
+
fetchOptions: {
|
|
40
|
+
...config$1?.fetchOptions,
|
|
41
|
+
method: "POST"
|
|
42
|
+
},
|
|
43
|
+
retryOptions: config$1?.retryOptions ?? require_retry.RETRY_CONFIGS.THIRTY_SECS_AGGRESSIVE,
|
|
44
|
+
logger: config$1?.logger
|
|
45
|
+
}), body, rpcResponseSchema);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
exports.jsonRPCRequest = jsonRPCRequest;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { config } from "../../config.js";
|
|
2
|
+
import { request } from "../../utils/request.js";
|
|
3
|
+
import { handleRPCResponse } from "../../utils/handleRPCResponse.js";
|
|
4
|
+
import { RETRY_CONFIGS } from "../../utils/retry.js";
|
|
5
|
+
import * as v from "valibot";
|
|
6
|
+
|
|
7
|
+
//#region src/poaBridge/poaBridgeHttpClient/runtime.ts
|
|
8
|
+
const rpcResponseSchema = v.union([v.object({
|
|
9
|
+
jsonrpc: v.literal("2.0"),
|
|
10
|
+
id: v.string(),
|
|
11
|
+
result: v.unknown()
|
|
12
|
+
}), v.object({
|
|
13
|
+
jsonrpc: v.literal("2.0"),
|
|
14
|
+
id: v.string(),
|
|
15
|
+
error: v.pipe(v.string(), v.transform((v$1) => {
|
|
16
|
+
return {
|
|
17
|
+
code: -1,
|
|
18
|
+
data: null,
|
|
19
|
+
message: v$1
|
|
20
|
+
};
|
|
21
|
+
}))
|
|
22
|
+
})]);
|
|
23
|
+
async function jsonRPCRequest(method, params, config$1) {
|
|
24
|
+
const baseURL = config$1?.baseURL ?? config.env.poaBridgeBaseURL;
|
|
25
|
+
const url = new URL("rpc", baseURL);
|
|
26
|
+
url.searchParams.set("method", String(method));
|
|
27
|
+
const body = {
|
|
28
|
+
id: config$1?.requestId ?? "dontcare",
|
|
29
|
+
jsonrpc: "2.0",
|
|
30
|
+
method,
|
|
31
|
+
params: params !== void 0 ? [params] : void 0
|
|
32
|
+
};
|
|
33
|
+
return handleRPCResponse(await request({
|
|
34
|
+
url,
|
|
35
|
+
body,
|
|
36
|
+
...config$1,
|
|
37
|
+
fetchOptions: {
|
|
38
|
+
...config$1?.fetchOptions,
|
|
39
|
+
method: "POST"
|
|
40
|
+
},
|
|
41
|
+
retryOptions: config$1?.retryOptions ?? RETRY_CONFIGS.THIRTY_SECS_AGGRESSIVE,
|
|
42
|
+
logger: config$1?.logger
|
|
43
|
+
}), body, rpcResponseSchema);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
export { jsonRPCRequest };
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { RpcRequestError } from "../../errors/request.cjs";
|
|
2
|
+
import { ILogger } from "../../logger.cjs";
|
|
3
|
+
import { BaseTokenInfo } from "../../types/base.cjs";
|
|
4
|
+
import { RetryOptions } from "../../utils/retry.cjs";
|
|
5
|
+
import { RequestErrorType } from "../../utils/request.cjs";
|
|
6
|
+
import { BlockchainEnum } from "../constants/blockchains.cjs";
|
|
7
|
+
|
|
8
|
+
//#region src/poaBridge/poaBridgeHttpClient/types.d.ts
|
|
9
|
+
type RequestConfig = {
|
|
10
|
+
requestId?: string | undefined;
|
|
11
|
+
timeout?: number | undefined;
|
|
12
|
+
fetchOptions?: Omit<RequestInit, "body"> | undefined;
|
|
13
|
+
baseURL?: string | undefined;
|
|
14
|
+
retryOptions?: RetryOptions;
|
|
15
|
+
logger?: ILogger;
|
|
16
|
+
};
|
|
17
|
+
type JSONRPCRequest<Method, Params> = {
|
|
18
|
+
id: string;
|
|
19
|
+
jsonrpc: "2.0";
|
|
20
|
+
method: Method;
|
|
21
|
+
params: Params[];
|
|
22
|
+
};
|
|
23
|
+
type JSONRPCResponse<Result> = {
|
|
24
|
+
id: string;
|
|
25
|
+
jsonrpc: "2.0";
|
|
26
|
+
result: Result;
|
|
27
|
+
};
|
|
28
|
+
type JSONRPCErrorType = RequestErrorType | RpcRequestError;
|
|
29
|
+
type GetSupportedTokensRequest = JSONRPCRequest<"supported_tokens", {
|
|
30
|
+
chains?: string[];
|
|
31
|
+
}>;
|
|
32
|
+
type GetSupportedTokensResponse = JSONRPCResponse<{
|
|
33
|
+
tokens: {
|
|
34
|
+
/**
|
|
35
|
+
* Raw asset id.
|
|
36
|
+
* Example: "nep245:v2_1.omni.hot.tg:1117_3tsdfyziyc7EJbP2aULWSKU4toBaAcN4FdTgfm5W1mC4ouR"
|
|
37
|
+
*/
|
|
38
|
+
intents_token_id: string;
|
|
39
|
+
/**
|
|
40
|
+
* Token standard extracted from intents_token_id (the part before the first colon).
|
|
41
|
+
* In most cases it is either "nep245" or "nep141"
|
|
42
|
+
*/
|
|
43
|
+
standard: string;
|
|
44
|
+
/**
|
|
45
|
+
* Contract ID extracted from intents_token_id (the part between the first and second colon).
|
|
46
|
+
* Example: "v2_1.omni.hot.tg"
|
|
47
|
+
*/
|
|
48
|
+
near_token_id: string;
|
|
49
|
+
/**
|
|
50
|
+
* Token ID extracted from intents_token_id (the part after the second colon).
|
|
51
|
+
* Only present for "nep245" standard tokens.
|
|
52
|
+
* Example: "1117_3tsdfyziyc7EJbP2aULWSKU4toBaAcN4FdTgfm5W1mC4ouR"
|
|
53
|
+
*/
|
|
54
|
+
multi_token_id?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Symbol
|
|
57
|
+
*/
|
|
58
|
+
asset_name: string;
|
|
59
|
+
decimals: number;
|
|
60
|
+
min_deposit_amount: string;
|
|
61
|
+
min_withdrawal_amount: string;
|
|
62
|
+
withdrawal_fee: string;
|
|
63
|
+
/**
|
|
64
|
+
* Internal POA Bridge identifier.
|
|
65
|
+
* @deprecated This identifier is for internal use only and should not be used in client code.
|
|
66
|
+
* @internal
|
|
67
|
+
*/
|
|
68
|
+
defuse_asset_identifier: string;
|
|
69
|
+
}[];
|
|
70
|
+
}>;
|
|
71
|
+
type DepositNetworkMemo = {
|
|
72
|
+
deposit_mode: "MEMO";
|
|
73
|
+
} | null;
|
|
74
|
+
type GetDepositAddressRequest = JSONRPCRequest<"deposit_address", {
|
|
75
|
+
account_id: string;
|
|
76
|
+
/** Chain is joined blockchain and network (e.g. eth:8453) */
|
|
77
|
+
chain: string;
|
|
78
|
+
/** Stellar blockchain specific */
|
|
79
|
+
deposit_mode?: "MEMO" | "SIMPLE";
|
|
80
|
+
}>;
|
|
81
|
+
type GetDepositAddressResponse = JSONRPCResponse<{
|
|
82
|
+
address: string;
|
|
83
|
+
chain: string;
|
|
84
|
+
/** Stellar blockchain specific */
|
|
85
|
+
memo?: string;
|
|
86
|
+
}>;
|
|
87
|
+
type DepositStatus = {
|
|
88
|
+
tx_hash: string;
|
|
89
|
+
chain: string;
|
|
90
|
+
defuse_asset_identifier: string;
|
|
91
|
+
near_token_id: string;
|
|
92
|
+
decimals: number;
|
|
93
|
+
amount: number;
|
|
94
|
+
account_id: string;
|
|
95
|
+
address: string;
|
|
96
|
+
status: "COMPLETED" | "PENDING" | "FAILED" | "CREDITED";
|
|
97
|
+
};
|
|
98
|
+
type GetDepositStatusRequest = JSONRPCRequest<"recent_deposits", {
|
|
99
|
+
account_id: string;
|
|
100
|
+
chain?: string;
|
|
101
|
+
status?: DepositStatus["status"];
|
|
102
|
+
limit?: number;
|
|
103
|
+
offset?: number;
|
|
104
|
+
}>;
|
|
105
|
+
type GetDepositStatusParams<S extends DepositStatus["status"]> = Omit<GetDepositStatusRequest["params"][0], "status"> & {
|
|
106
|
+
status?: S;
|
|
107
|
+
};
|
|
108
|
+
type GetDepositStatusResponse<S extends DepositStatus["status"]> = JSONRPCResponse<{
|
|
109
|
+
deposits: (Omit<DepositStatus, "status"> & {
|
|
110
|
+
status: S;
|
|
111
|
+
})[];
|
|
112
|
+
total: number;
|
|
113
|
+
limit: number;
|
|
114
|
+
offset: number;
|
|
115
|
+
}>;
|
|
116
|
+
type WithdrawalStatusRequest = JSONRPCRequest<"withdrawal_status", {
|
|
117
|
+
withdrawal_hash: string;
|
|
118
|
+
}>;
|
|
119
|
+
type WithdrawalStatusResponseOk = JSONRPCResponse<{
|
|
120
|
+
withdrawals: {
|
|
121
|
+
status: "COMPLETED" | "PENDING";
|
|
122
|
+
data: {
|
|
123
|
+
tx_hash: string;
|
|
124
|
+
transfer_tx_hash: string | null;
|
|
125
|
+
chain: string;
|
|
126
|
+
defuse_asset_identifier: string;
|
|
127
|
+
near_token_id: string;
|
|
128
|
+
decimals: number;
|
|
129
|
+
amount: number;
|
|
130
|
+
account_id: string;
|
|
131
|
+
address: string;
|
|
132
|
+
created: string;
|
|
133
|
+
};
|
|
134
|
+
}[];
|
|
135
|
+
}>;
|
|
136
|
+
type HotOmniWithdrawRequest = JSONRPCRequest<"hot_omni_withdraw", {
|
|
137
|
+
account_id: string;
|
|
138
|
+
tx_hash: string;
|
|
139
|
+
receiver: string;
|
|
140
|
+
chain_id: string;
|
|
141
|
+
}>;
|
|
142
|
+
type HotOmniWithdrawResponse = JSONRPCResponse<{
|
|
143
|
+
status: "COMPLETED" | "PENDING";
|
|
144
|
+
data: {
|
|
145
|
+
transfer_tx_hash: string | null;
|
|
146
|
+
};
|
|
147
|
+
}[]>;
|
|
148
|
+
type TokenBalances = {
|
|
149
|
+
symbol: string;
|
|
150
|
+
address: string;
|
|
151
|
+
nearAddress: string;
|
|
152
|
+
decimals: number;
|
|
153
|
+
totalSupply: string;
|
|
154
|
+
vaultBalance: string;
|
|
155
|
+
coldWalletBalance: string;
|
|
156
|
+
balanceOnDefuse: string;
|
|
157
|
+
};
|
|
158
|
+
type BridgeBalanceResponse = TokenBalances[];
|
|
159
|
+
type GetWithdrawalEstimateRequest = JSONRPCRequest<"withdrawal_estimate", {
|
|
160
|
+
token: string;
|
|
161
|
+
address: string;
|
|
162
|
+
chain: BlockchainEnum;
|
|
163
|
+
}>;
|
|
164
|
+
type WithdrawalEstimateResponse = {
|
|
165
|
+
token: BaseTokenInfo;
|
|
166
|
+
tokenAddress: string;
|
|
167
|
+
userAddress: string;
|
|
168
|
+
withdrawalFee: string;
|
|
169
|
+
withdrawalFeeDecimals: number;
|
|
170
|
+
};
|
|
171
|
+
//#endregion
|
|
172
|
+
export { BridgeBalanceResponse, DepositNetworkMemo, DepositStatus, GetDepositAddressRequest, GetDepositAddressResponse, GetDepositStatusParams, GetDepositStatusRequest, GetDepositStatusResponse, GetSupportedTokensRequest, GetSupportedTokensResponse, GetWithdrawalEstimateRequest, HotOmniWithdrawRequest, HotOmniWithdrawResponse, JSONRPCErrorType, JSONRPCRequest, JSONRPCResponse, RequestConfig, TokenBalances, WithdrawalEstimateResponse, WithdrawalStatusRequest, WithdrawalStatusResponseOk };
|