@allbridge/bridge-core-sdk 3.35.1 → 3.36.0-beta.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/browser/index.js +2 -2
- package/dist/browser/index.js.map +4 -4
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/index.js.map +4 -4
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +4 -4
- package/dist/src/client/core-api/api-client-caching.d.ts +6 -1
- package/dist/src/client/core-api/api-client-caching.js +11 -0
- package/dist/src/client/core-api/api-client-caching.js.map +1 -1
- package/dist/src/client/core-api/api-client.d.ts +38 -4
- package/dist/src/client/core-api/api-client.js +83 -16
- package/dist/src/client/core-api/api-client.js.map +1 -1
- package/dist/src/client/core-api/core-api-mapper.d.ts +4 -1
- package/dist/src/client/core-api/core-api-mapper.js +25 -10
- package/dist/src/client/core-api/core-api-mapper.js.map +1 -1
- package/dist/src/client/core-api/core-api.model.d.ts +124 -21
- package/dist/src/client/core-api/core-api.model.js +9 -0
- package/dist/src/client/core-api/core-api.model.js.map +1 -1
- package/dist/src/client/core-api/core-client-base.d.ts +7 -1
- package/dist/src/client/core-api/core-client-base.js +9 -0
- package/dist/src/client/core-api/core-client-base.js.map +1 -1
- package/dist/src/client/core-api/core-client-filtered.d.ts +4 -1
- package/dist/src/client/core-api/core-client-filtered.js +9 -0
- package/dist/src/client/core-api/core-client-filtered.js.map +1 -1
- package/dist/src/client/core-api/core-client-pool-info-caching.d.ts +4 -1
- package/dist/src/client/core-api/core-client-pool-info-caching.js +9 -0
- package/dist/src/client/core-api/core-client-pool-info-caching.js.map +1 -1
- package/dist/src/exceptions/exceptions.d.ts +41 -0
- package/dist/src/exceptions/exceptions.js +52 -0
- package/dist/src/exceptions/exceptions.js.map +1 -1
- package/dist/src/index.d.ts +19 -6
- package/dist/src/index.js +6 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/models/index.d.ts +4 -2
- package/dist/src/models/index.js.map +1 -1
- package/dist/src/services/bridge/alg/index.d.ts +5 -1
- package/dist/src/services/bridge/alg/index.js +7 -0
- package/dist/src/services/bridge/alg/index.js.map +1 -1
- package/dist/src/services/bridge/evm/index.d.ts +12 -2
- package/dist/src/services/bridge/evm/index.js +32 -0
- package/dist/src/services/bridge/evm/index.js.map +1 -1
- package/dist/src/services/bridge/index.d.ts +10 -3
- package/dist/src/services/bridge/index.js +27 -3
- package/dist/src/services/bridge/index.js.map +1 -1
- package/dist/src/services/bridge/models/bridge.d.ts +17 -1
- package/dist/src/services/bridge/models/bridge.js +6 -0
- package/dist/src/services/bridge/models/bridge.js.map +1 -1
- package/dist/src/services/bridge/models/bridge.model.d.ts +25 -0
- package/dist/src/services/bridge/models/bridge.model.js.map +1 -1
- package/dist/src/services/bridge/raw-bridge-transaction-builder.d.ts +8 -1
- package/dist/src/services/bridge/raw-bridge-transaction-builder.js +11 -1
- package/dist/src/services/bridge/raw-bridge-transaction-builder.js.map +1 -1
- package/dist/src/services/bridge/sol/bridge-tx-service.js +3 -0
- package/dist/src/services/bridge/sol/bridge-tx-service.js.map +1 -1
- package/dist/src/services/bridge/sol/index.d.ts +14 -1
- package/dist/src/services/bridge/sol/index.js +47 -2
- package/dist/src/services/bridge/sol/index.js.map +1 -1
- package/dist/src/services/bridge/sol/payer-with-token-service.js +3 -0
- package/dist/src/services/bridge/sol/payer-with-token-service.js.map +1 -1
- package/dist/src/services/bridge/spender.js +4 -0
- package/dist/src/services/bridge/spender.js.map +1 -1
- package/dist/src/services/bridge/srb/index.d.ts +9 -1
- package/dist/src/services/bridge/srb/index.js +45 -3
- package/dist/src/services/bridge/srb/index.js.map +1 -1
- package/dist/src/services/bridge/stx/index.d.ts +6 -2
- package/dist/src/services/bridge/stx/index.js +7 -0
- package/dist/src/services/bridge/stx/index.js.map +1 -1
- package/dist/src/services/bridge/sui/index.d.ts +8 -1
- package/dist/src/services/bridge/sui/index.js +24 -0
- package/dist/src/services/bridge/sui/index.js.map +1 -1
- package/dist/src/services/bridge/trx/index.d.ts +11 -1
- package/dist/src/services/bridge/trx/index.js +25 -0
- package/dist/src/services/bridge/trx/index.js.map +1 -1
- package/dist/src/services/bridge/utils.js +4 -1
- package/dist/src/services/bridge/utils.js.map +1 -1
- package/dist/src/services/index.d.ts +10 -0
- package/dist/src/services/index.js +36 -1
- package/dist/src/services/index.js.map +1 -1
- package/dist/src/services/near-intents/index.d.ts +62 -0
- package/dist/src/services/near-intents/index.js +115 -0
- package/dist/src/services/near-intents/index.js.map +1 -0
- package/dist/src/services/near-intents/models.d.ts +169 -0
- package/dist/src/services/near-intents/models.js +2 -0
- package/dist/src/services/near-intents/models.js.map +1 -0
- package/dist/src/services/near-intents/utils.d.ts +34 -0
- package/dist/src/services/near-intents/utils.js +53 -0
- package/dist/src/services/near-intents/utils.js.map +1 -0
- package/dist/src/services/token/evm/index.js +3 -0
- package/dist/src/services/token/evm/index.js.map +1 -1
- package/dist/src/services/token/sol/index.js +3 -0
- package/dist/src/services/token/sol/index.js.map +1 -1
- package/dist/src/services/token/srb/index.js +11 -0
- package/dist/src/services/token/srb/index.js.map +1 -1
- package/dist/src/services/token/sui/index.js +5 -0
- package/dist/src/services/token/sui/index.js.map +1 -1
- package/dist/src/services/token/trx/index.js +3 -0
- package/dist/src/services/token/trx/index.js.map +1 -1
- package/dist/src/tokens-info/tokens-info.model.d.ts +23 -1
- package/dist/src/tokens-info/tokens-info.model.js.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/package.json +1 -1
|
@@ -12,11 +12,12 @@ export interface ChainDetailsDTO {
|
|
|
12
12
|
chainId: number;
|
|
13
13
|
bridgeId?: string;
|
|
14
14
|
paddingUtilId?: string;
|
|
15
|
-
/** @deprecated Do not use. */
|
|
16
|
-
bridgeAddress
|
|
15
|
+
/** @deprecated Do not use. Not served by the current Core API. */
|
|
16
|
+
bridgeAddress?: string;
|
|
17
17
|
oftBridgeAddress?: string;
|
|
18
18
|
abrPayer?: AbrPayerChainInfoDTO;
|
|
19
|
-
|
|
19
|
+
/** @deprecated Do not use. Not served by the current Core API. */
|
|
20
|
+
swapAddress?: string;
|
|
20
21
|
/**
|
|
21
22
|
* @deprecated Do not use.
|
|
22
23
|
*/
|
|
@@ -38,22 +39,23 @@ export interface TokenDTO {
|
|
|
38
39
|
symbol: string;
|
|
39
40
|
name: string;
|
|
40
41
|
decimals: number;
|
|
41
|
-
/** @deprecated Do not use. */
|
|
42
|
-
poolAddress
|
|
42
|
+
/** @deprecated Do not use. Not served by the current Core API. */
|
|
43
|
+
poolAddress?: string;
|
|
43
44
|
tokenAddress: string;
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
originTokenAddress?: string;
|
|
46
|
+
/** @deprecated Do not use. Not served by the current Core API. */
|
|
47
|
+
poolInfo?: PoolInfoDTO;
|
|
46
48
|
oftId?: string;
|
|
47
|
-
/** @deprecated Do not use. */
|
|
48
|
-
feeShare
|
|
49
|
-
/** @deprecated Do not use. */
|
|
50
|
-
apr
|
|
51
|
-
/** @deprecated Do not use. */
|
|
52
|
-
apr7d
|
|
53
|
-
/** @deprecated Do not use. */
|
|
54
|
-
apr30d
|
|
55
|
-
/** @deprecated Do not use. */
|
|
56
|
-
lpRate
|
|
49
|
+
/** @deprecated Do not use. Not served by the current Core API. */
|
|
50
|
+
feeShare?: string;
|
|
51
|
+
/** @deprecated Do not use. Not served by the current Core API. */
|
|
52
|
+
apr?: string;
|
|
53
|
+
/** @deprecated Do not use. Not served by the current Core API. */
|
|
54
|
+
apr7d?: string;
|
|
55
|
+
/** @deprecated Do not use. Not served by the current Core API. */
|
|
56
|
+
apr30d?: string;
|
|
57
|
+
/** @deprecated Do not use. Not served by the current Core API. */
|
|
58
|
+
lpRate?: string;
|
|
57
59
|
cctpAddress?: string;
|
|
58
60
|
cctpV2Address?: string;
|
|
59
61
|
cctpFeeShare?: string;
|
|
@@ -63,7 +65,19 @@ export interface TokenDTO {
|
|
|
63
65
|
*/
|
|
64
66
|
yieldId?: number;
|
|
65
67
|
xReserve?: XReserveDTO;
|
|
66
|
-
|
|
68
|
+
/**
|
|
69
|
+
* NEAR Intents (1Click) asset of the token. Defined when the token is listed by NEAR Intents.
|
|
70
|
+
*/
|
|
71
|
+
nearIntents?: NearIntentsDTO;
|
|
72
|
+
/**
|
|
73
|
+
* True when the token is the native gas token of the chain (listed under a sentinel address).
|
|
74
|
+
*/
|
|
75
|
+
isNative?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Optional: the current Core API always returns all tokens and omits the flags,
|
|
78
|
+
* in which case every token is treated as `swap: true, pool: false`.
|
|
79
|
+
*/
|
|
80
|
+
flags?: {
|
|
67
81
|
swap: boolean;
|
|
68
82
|
/** @deprecated Do not use. */
|
|
69
83
|
pool: boolean;
|
|
@@ -75,6 +89,9 @@ export interface XReserveDTO {
|
|
|
75
89
|
feeShare: string;
|
|
76
90
|
protocolAddress?: string;
|
|
77
91
|
}
|
|
92
|
+
export interface NearIntentsDTO {
|
|
93
|
+
assetId: string;
|
|
94
|
+
}
|
|
78
95
|
/**
|
|
79
96
|
* @deprecated Do not use.
|
|
80
97
|
*/
|
|
@@ -95,7 +112,8 @@ export declare enum MessengerKeyDTO {
|
|
|
95
112
|
CCTP = "cctp",
|
|
96
113
|
CCTP_V2 = "cctpV2",
|
|
97
114
|
OFT = "oft",
|
|
98
|
-
X_RESERVE = "xReserve"
|
|
115
|
+
X_RESERVE = "xReserve",
|
|
116
|
+
NEAR_INTENTS = "nearIntents"
|
|
99
117
|
}
|
|
100
118
|
export type AbrPayerAvailabilityKeyDTO = (typeof MessengerKeyDTO)[keyof typeof MessengerKeyDTO];
|
|
101
119
|
export type AbrPayerAvailabilityTypeDTO = Partial<Record<AbrPayerAvailabilityKeyDTO, boolean>>;
|
|
@@ -137,14 +155,22 @@ export declare enum Messenger {
|
|
|
137
155
|
* xReserve.
|
|
138
156
|
* Route is supported when `xReserve` is defined on both source and destination tokens.
|
|
139
157
|
*/
|
|
140
|
-
X_RESERVE = 6
|
|
158
|
+
X_RESERVE = 6,
|
|
159
|
+
/**
|
|
160
|
+
* NEAR Intents (1Click).
|
|
161
|
+
* Route is supported when `nearIntents` is defined on both source and destination tokens.
|
|
162
|
+
* The transfer is a plain token (or native currency) transfer to a one-shot deposit address,
|
|
163
|
+
* so no approval is needed. Amounts are market-priced quotes from the Core API, not a deterministic fee:
|
|
164
|
+
* see `AllbridgeCoreSdk.nearIntents`.
|
|
165
|
+
*/
|
|
166
|
+
NEAR_INTENTS = 7
|
|
141
167
|
}
|
|
142
168
|
/**
|
|
143
169
|
* @deprecated Do not use.
|
|
144
170
|
*/
|
|
145
171
|
export type LegacyMessenger = Messenger.ALLBRIDGE | Messenger.WORMHOLE;
|
|
146
172
|
/**
|
|
147
|
-
* Messengers supported for transfers: {@link Messenger.CCTP}, {@link Messenger.CCTP_V2}, {@link Messenger.OFT}, {@link Messenger.X_RESERVE}
|
|
173
|
+
* Messengers supported for transfers: {@link Messenger.CCTP}, {@link Messenger.CCTP_V2}, {@link Messenger.OFT}, {@link Messenger.X_RESERVE}, {@link Messenger.NEAR_INTENTS}
|
|
148
174
|
*/
|
|
149
175
|
export type ActiveMessenger = Exclude<Messenger, LegacyMessenger>;
|
|
150
176
|
export interface ReceiveTransactionCostRequest {
|
|
@@ -160,6 +186,77 @@ export interface ReceiveTransactionCostResponse {
|
|
|
160
186
|
abrExchangeRate?: string;
|
|
161
187
|
adminFeeShareWithExtras?: string;
|
|
162
188
|
}
|
|
189
|
+
/**
|
|
190
|
+
* NEAR Intents quote direction.
|
|
191
|
+
* - `EXACT_INPUT`: `amount` is what the user sends.
|
|
192
|
+
* - `EXACT_OUTPUT`: `amount` is what the user wants to receive.
|
|
193
|
+
*/
|
|
194
|
+
export type NearIntentsSwapType = "EXACT_INPUT" | "EXACT_OUTPUT";
|
|
195
|
+
export interface NearIntentsQuoteRequest {
|
|
196
|
+
sourceChainId: number;
|
|
197
|
+
sourceToken: string;
|
|
198
|
+
destinationChainId: number;
|
|
199
|
+
destinationToken: string;
|
|
200
|
+
/**
|
|
201
|
+
* Integer amount: in source token units for `EXACT_INPUT`, in destination token units for `EXACT_OUTPUT`.
|
|
202
|
+
*/
|
|
203
|
+
amount: string;
|
|
204
|
+
swapType: NearIntentsSwapType;
|
|
205
|
+
}
|
|
206
|
+
export interface NearIntentsQuoteResponse {
|
|
207
|
+
/** Integer amount in source token units */
|
|
208
|
+
amountIn: string;
|
|
209
|
+
/** Integer amount in destination token units */
|
|
210
|
+
amountOut: string;
|
|
211
|
+
/** Integer amount in destination token units, the slippage floor */
|
|
212
|
+
minAmountOut: string;
|
|
213
|
+
/** Estimated transfer time, seconds */
|
|
214
|
+
timeEstimate: number;
|
|
215
|
+
/**
|
|
216
|
+
* True when the server answered from its per-route quote model instead of a live 1Click quote.
|
|
217
|
+
* Deposits are never estimated. Older servers omit it.
|
|
218
|
+
*/
|
|
219
|
+
estimated: boolean;
|
|
220
|
+
/** Absent on an estimated answer for a token without a catalog price */
|
|
221
|
+
amountInUsd?: string;
|
|
222
|
+
/** Absent on an estimated answer for a token without a catalog price */
|
|
223
|
+
amountOutUsd?: string;
|
|
224
|
+
}
|
|
225
|
+
export interface NearIntentsDepositRequest extends NearIntentsQuoteRequest {
|
|
226
|
+
recipient: string;
|
|
227
|
+
refundTo: string;
|
|
228
|
+
}
|
|
229
|
+
export interface NearIntentsDepositResponse {
|
|
230
|
+
depositAddress: string;
|
|
231
|
+
depositMemo?: string;
|
|
232
|
+
/** Integer amount in source token units */
|
|
233
|
+
amountIn: string;
|
|
234
|
+
/** Integer amount in destination token units */
|
|
235
|
+
amountOut: string;
|
|
236
|
+
/** Integer amount in destination token units, the slippage floor */
|
|
237
|
+
minAmountOut: string;
|
|
238
|
+
/** ISO 8601 */
|
|
239
|
+
deadline: string;
|
|
240
|
+
/** ISO 8601 */
|
|
241
|
+
timeWhenInactive?: string;
|
|
242
|
+
/** Estimated transfer time, seconds */
|
|
243
|
+
timeEstimate: number;
|
|
244
|
+
}
|
|
245
|
+
export interface NearIntentsSubmitDepositRequest {
|
|
246
|
+
depositAddress: string;
|
|
247
|
+
depositMemo?: string;
|
|
248
|
+
txId: string;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Error codes of the Core API NEAR Intents endpoints (HTTP 400 and 502 bodies).
|
|
252
|
+
*/
|
|
253
|
+
export type NearIntentsErrorCode = "AMOUNT_TOO_LOW" | "NO_LIQUIDITY" | "FAILED_TO_GET_QUOTE" | "UPSTREAM_ERROR";
|
|
254
|
+
export interface NearIntentsErrorResponse {
|
|
255
|
+
code: NearIntentsErrorCode;
|
|
256
|
+
message: string;
|
|
257
|
+
minAmount?: string;
|
|
258
|
+
minAmountUsd?: string;
|
|
259
|
+
}
|
|
163
260
|
export interface GasBalanceResponse {
|
|
164
261
|
gasBalance: string | null;
|
|
165
262
|
status: AddressStatus;
|
|
@@ -186,6 +283,12 @@ export interface TransferStatusResponse {
|
|
|
186
283
|
signaturesNeeded: number;
|
|
187
284
|
send: BridgeTransaction;
|
|
188
285
|
receive?: BridgeTransaction;
|
|
286
|
+
/**
|
|
287
|
+
* True when the transfer was refunded to the sender on the source chain instead of being delivered
|
|
288
|
+
* (e.g. a {@link Messenger.NEAR_INTENTS} deposit refunded by NEAR Intents); `receive` stays absent.
|
|
289
|
+
* Optional: older Core API versions may omit it.
|
|
290
|
+
*/
|
|
291
|
+
refunded?: boolean;
|
|
189
292
|
responseTime?: number;
|
|
190
293
|
}
|
|
191
294
|
export interface BridgeTransaction {
|
|
@@ -17,6 +17,7 @@ export var MessengerKeyDTO;
|
|
|
17
17
|
MessengerKeyDTO["CCTP_V2"] = "cctpV2";
|
|
18
18
|
MessengerKeyDTO["OFT"] = "oft";
|
|
19
19
|
MessengerKeyDTO["X_RESERVE"] = "xReserve";
|
|
20
|
+
MessengerKeyDTO["NEAR_INTENTS"] = "nearIntents";
|
|
20
21
|
})(MessengerKeyDTO || (MessengerKeyDTO = {}));
|
|
21
22
|
/**
|
|
22
23
|
* Bridging protocol used for a transfer.
|
|
@@ -49,5 +50,13 @@ export var Messenger;
|
|
|
49
50
|
* Route is supported when `xReserve` is defined on both source and destination tokens.
|
|
50
51
|
*/
|
|
51
52
|
Messenger[Messenger["X_RESERVE"] = 6] = "X_RESERVE";
|
|
53
|
+
/**
|
|
54
|
+
* NEAR Intents (1Click).
|
|
55
|
+
* Route is supported when `nearIntents` is defined on both source and destination tokens.
|
|
56
|
+
* The transfer is a plain token (or native currency) transfer to a one-shot deposit address,
|
|
57
|
+
* so no approval is needed. Amounts are market-priced quotes from the Core API, not a deterministic fee:
|
|
58
|
+
* see `AllbridgeCoreSdk.nearIntents`.
|
|
59
|
+
*/
|
|
60
|
+
Messenger[Messenger["NEAR_INTENTS"] = 7] = "NEAR_INTENTS";
|
|
52
61
|
})(Messenger || (Messenger = {}));
|
|
53
62
|
//# sourceMappingURL=core-api.model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-api.model.js","sourceRoot":"","sources":["../../../../src/client/core-api/core-api.model.ts"],"names":[],"mappings":"AAgCA,MAAM,CAAN,IAAY,aAOX;AAPD,WAAY,aAAa;IACvB,0BAAS,CAAA;IACT,oCAAmB,CAAA;IACnB,wCAAuB,CAAA;IACvB,gDAA+B,CAAA;IAC/B,sDAAqC,CAAA;IACrC,kFAAiE,CAAA;AACnE,CAAC,EAPW,aAAa,KAAb,aAAa,QAOxB;AA0DD,MAAM,CAAN,IAAY,eASX;AATD,WAAY,eAAe;IACzB,8BAA8B;IAC9B,0CAAuB,CAAA;IACvB,8BAA8B;IAC9B,wCAAqB,CAAA;IACrB,gCAAa,CAAA;IACb,qCAAkB,CAAA;IAClB,8BAAW,CAAA;IACX,yCAAsB,CAAA;AACxB,CAAC,EATW,eAAe,KAAf,eAAe,QAS1B;AAkBD;;;GAGG;AACH,MAAM,CAAN,IAAY,SA0BX;AA1BD,WAAY,SAAS;IACnB,8BAA8B;IAC9B,mDAAa,CAAA;IACb,8BAA8B;IAC9B,iDAAY,CAAA;IACZ;;;OAGG;IACH,yCAAQ,CAAA;IACR;;;OAGG;IACH,+CAAW,CAAA;IACX;;;;OAIG;IACH,uCAAO,CAAA;IACP;;;OAGG;IACH,mDAAa,CAAA;AACf,CAAC,EA1BW,SAAS,KAAT,SAAS,QA0BpB","sourcesContent":["import { ChainSymbol } from \"../../chains/chain.enums\";\nimport { PoolInfo, SuiAddresses } from \"../../tokens-info\";\n\nexport type ChainDetailsResponse = Record<string, ChainDetailsDTO>;\n\nexport interface AbrPayerChainInfoDTO {\n payerAddress: string;\n tokenAddress: string;\n tokenDecimals: number;\n payerAvailability: AbrPayerAvailabilityTypeDTO;\n}\n\nexport interface ChainDetailsDTO {\n tokens: TokenDTO[];\n chainId: number;\n bridgeId?: string;\n paddingUtilId?: string;\n /** @deprecated Do not use. */\n bridgeAddress: string;\n oftBridgeAddress?: string;\n abrPayer?: AbrPayerChainInfoDTO;\n swapAddress: string;\n /**\n * @deprecated Do not use.\n */\n yieldAddress?: string;\n transferTime: TransferTimeDTO;\n txCostAmount: TxCostAmountDTO;\n confirmations: number;\n suiAddresses?: SuiAddresses;\n}\n\nexport enum AddressStatus {\n OK = \"OK\",\n INVALID = \"INVALID\",\n FORBIDDEN = \"FORBIDDEN\",\n UNINITIALIZED = \"UNINITIALIZED\",\n CONTRACT_ADDRESS = \"CONTRACT_ADDRESS\",\n WRONG_ASSOCIATED_ACCOUNT_OWNER = \"WRONG_ASSOCIATED_ACCOUNT_OWNER\",\n}\n\nexport interface TokenDTO {\n symbol: string;\n name: string;\n decimals: number;\n /** @deprecated Do not use. */\n poolAddress: string;\n tokenAddress: string;\n /** @deprecated Do not use. */\n poolInfo: PoolInfoDTO;\n oftId?: string;\n /** @deprecated Do not use. */\n feeShare: string;\n /** @deprecated Do not use. */\n apr: string;\n /** @deprecated Do not use. */\n apr7d: string;\n /** @deprecated Do not use. */\n apr30d: string;\n /** @deprecated Do not use. */\n lpRate: string;\n cctpAddress?: string;\n cctpV2Address?: string;\n cctpFeeShare?: string;\n cctpV2FeeShare?: string;\n /**\n * @deprecated Do not use.\n */\n yieldId?: number;\n xReserve?: XReserveDTO;\n flags: {\n swap: boolean;\n /** @deprecated Do not use. */\n pool: boolean;\n };\n}\n\nexport interface XReserveDTO {\n bridgeAddress: string;\n feeConst: string;\n feeShare: string;\n protocolAddress?: string;\n}\n\n/**\n * @deprecated Do not use.\n */\nexport interface PoolInfoDTO {\n aValue: string;\n dValue: string;\n tokenBalance: string;\n vUsdBalance: string;\n totalLpAmount: string;\n accRewardPerShareP: string;\n p: number;\n}\n\nexport enum MessengerKeyDTO {\n /** @deprecated Do not use. */\n ALLBRIDGE = \"allbridge\",\n /** @deprecated Do not use. */\n WORMHOLE = \"wormhole\",\n CCTP = \"cctp\",\n CCTP_V2 = \"cctpV2\",\n OFT = \"oft\",\n X_RESERVE = \"xReserve\",\n}\n\nexport type AbrPayerAvailabilityKeyDTO = (typeof MessengerKeyDTO)[keyof typeof MessengerKeyDTO];\n\nexport type AbrPayerAvailabilityTypeDTO = Partial<Record<AbrPayerAvailabilityKeyDTO, boolean>>;\n\nexport type TransferTimeDTO = Record<string, MessengerTransferTimeDTO>;\n\nexport interface TxCostAmountDTO {\n maxAmount: string;\n swap: string;\n transfer: string;\n}\n\nexport type MessengerTransferTimeDTO = {\n [messenger in MessengerKeyDTO]: number | null;\n};\n\n/**\n * Bridging protocol used for a transfer.\n * Only {@link ActiveMessenger} values are supported.\n */\nexport enum Messenger {\n /** @deprecated Do not use. */\n ALLBRIDGE = 1,\n /** @deprecated Do not use. */\n WORMHOLE = 2,\n /**\n * Circle CCTP.\n * Route is supported when `cctpAddress` is defined on both source and destination tokens.\n */\n CCTP = 3,\n /**\n * Circle CCTP V2.\n * Route is supported when `cctpV2Address` is defined on both source and destination tokens.\n */\n CCTP_V2 = 4,\n /**\n * LayerZero OFT.\n * Route is supported when source and destination tokens have the same `oftId`\n * and `oftBridgeAddress` is defined on both chains.\n */\n OFT = 5,\n /**\n * xReserve.\n * Route is supported when `xReserve` is defined on both source and destination tokens.\n */\n X_RESERVE = 6,\n}\n\n/**\n * @deprecated Do not use.\n */\nexport type LegacyMessenger = Messenger.ALLBRIDGE | Messenger.WORMHOLE;\n/**\n * Messengers supported for transfers: {@link Messenger.CCTP}, {@link Messenger.CCTP_V2}, {@link Messenger.OFT}, {@link Messenger.X_RESERVE}\n */\nexport type ActiveMessenger = Exclude<Messenger, LegacyMessenger>;\n\nexport interface ReceiveTransactionCostRequest {\n sourceChainId: number;\n destinationChainId: number;\n messenger: Messenger;\n sourceToken?: string;\n}\n\nexport interface ReceiveTransactionCostResponse {\n exchangeRate: string;\n fee: string;\n sourceNativeTokenPrice: string;\n abrExchangeRate?: string;\n adminFeeShareWithExtras?: string;\n}\n\nexport interface GasBalanceResponse {\n gasBalance: string | null;\n status: AddressStatus;\n}\n\nexport interface CheckAddressResponse {\n gasBalance: string | null;\n status: AddressStatus;\n}\n\nexport interface TransferStatusResponse {\n txId: string;\n\n sourceChainSymbol: ChainSymbol;\n destinationChainSymbol: ChainSymbol;\n\n sendAmount: string;\n sendAmountFormatted: number;\n\n stableFee: string;\n stableFeeFormatted: number;\n\n sourceTokenAddress: string;\n destinationTokenAddress: string;\n\n originSourceTokenAddress?: string;\n originDestinationTokenAddress?: string;\n\n senderAddress: string;\n recipientAddress: string;\n\n signaturesCount: number;\n signaturesNeeded: number;\n\n send: BridgeTransaction;\n receive?: BridgeTransaction;\n\n responseTime?: number;\n}\n\nexport interface BridgeTransaction {\n txId: string;\n\n sourceChainId: number;\n destinationChainId: number;\n\n fee: string;\n feeFormatted: number;\n\n stableFee: string;\n stableFeeFormatted: number;\n\n amount: string;\n amountFormatted: number;\n virtualAmount: string;\n\n bridgeContract: string;\n sender: string;\n recipient: string;\n\n sourceTokenAddress: string;\n destinationTokenAddress: string;\n\n originSourceTokenAddress?: string;\n originDestinationTokenAddress?: string;\n\n hash: string;\n\n messenger: Messenger;\n\n blockTime: number;\n blockId: string;\n\n confirmations: number;\n confirmationsNeeded: number;\n\n isClaimable?: boolean;\n}\n\n/**\n * @deprecated Do not use.\n */\nexport type PoolInfoResponse = Record<string, PoolInfo>;\n/**\n * @deprecated Do not use.\n */\nexport type PendingInfoResponse = Partial<Record<string, TokenPendingInfoDTO>>;\n/**\n * @deprecated Do not use.\n */\nexport type TokenPendingInfoDTO = Record<string, PendingInfoDTO>;\n\n/**\n * @deprecated Do not use.\n */\nexport interface PendingInfoDTO {\n pendingTxs: number;\n totalSentAmount: string;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"core-api.model.js","sourceRoot":"","sources":["../../../../src/client/core-api/core-api.model.ts"],"names":[],"mappings":"AAiCA,MAAM,CAAN,IAAY,aAOX;AAPD,WAAY,aAAa;IACvB,0BAAS,CAAA;IACT,oCAAmB,CAAA;IACnB,wCAAuB,CAAA;IACvB,gDAA+B,CAAA;IAC/B,sDAAqC,CAAA;IACrC,kFAAiE,CAAA;AACnE,CAAC,EAPW,aAAa,KAAb,aAAa,QAOxB;AA2ED,MAAM,CAAN,IAAY,eAUX;AAVD,WAAY,eAAe;IACzB,8BAA8B;IAC9B,0CAAuB,CAAA;IACvB,8BAA8B;IAC9B,wCAAqB,CAAA;IACrB,gCAAa,CAAA;IACb,qCAAkB,CAAA;IAClB,8BAAW,CAAA;IACX,yCAAsB,CAAA;IACtB,+CAA4B,CAAA;AAC9B,CAAC,EAVW,eAAe,KAAf,eAAe,QAU1B;AAkBD;;;GAGG;AACH,MAAM,CAAN,IAAY,SAkCX;AAlCD,WAAY,SAAS;IACnB,8BAA8B;IAC9B,mDAAa,CAAA;IACb,8BAA8B;IAC9B,iDAAY,CAAA;IACZ;;;OAGG;IACH,yCAAQ,CAAA;IACR;;;OAGG;IACH,+CAAW,CAAA;IACX;;;;OAIG;IACH,uCAAO,CAAA;IACP;;;OAGG;IACH,mDAAa,CAAA;IACb;;;;;;OAMG;IACH,yDAAgB,CAAA;AAClB,CAAC,EAlCW,SAAS,KAAT,SAAS,QAkCpB","sourcesContent":["import { ChainSymbol } from \"../../chains/chain.enums\";\nimport { PoolInfo, SuiAddresses } from \"../../tokens-info\";\n\nexport type ChainDetailsResponse = Record<string, ChainDetailsDTO>;\n\nexport interface AbrPayerChainInfoDTO {\n payerAddress: string;\n tokenAddress: string;\n tokenDecimals: number;\n payerAvailability: AbrPayerAvailabilityTypeDTO;\n}\n\nexport interface ChainDetailsDTO {\n tokens: TokenDTO[];\n chainId: number;\n bridgeId?: string;\n paddingUtilId?: string;\n /** @deprecated Do not use. Not served by the current Core API. */\n bridgeAddress?: string;\n oftBridgeAddress?: string;\n abrPayer?: AbrPayerChainInfoDTO;\n /** @deprecated Do not use. Not served by the current Core API. */\n swapAddress?: string;\n /**\n * @deprecated Do not use.\n */\n yieldAddress?: string;\n transferTime: TransferTimeDTO;\n txCostAmount: TxCostAmountDTO;\n confirmations: number;\n suiAddresses?: SuiAddresses;\n}\n\nexport enum AddressStatus {\n OK = \"OK\",\n INVALID = \"INVALID\",\n FORBIDDEN = \"FORBIDDEN\",\n UNINITIALIZED = \"UNINITIALIZED\",\n CONTRACT_ADDRESS = \"CONTRACT_ADDRESS\",\n WRONG_ASSOCIATED_ACCOUNT_OWNER = \"WRONG_ASSOCIATED_ACCOUNT_OWNER\",\n}\n\nexport interface TokenDTO {\n symbol: string;\n name: string;\n decimals: number;\n /** @deprecated Do not use. Not served by the current Core API. */\n poolAddress?: string;\n tokenAddress: string;\n originTokenAddress?: string;\n /** @deprecated Do not use. Not served by the current Core API. */\n poolInfo?: PoolInfoDTO;\n oftId?: string;\n /** @deprecated Do not use. Not served by the current Core API. */\n feeShare?: string;\n /** @deprecated Do not use. Not served by the current Core API. */\n apr?: string;\n /** @deprecated Do not use. Not served by the current Core API. */\n apr7d?: string;\n /** @deprecated Do not use. Not served by the current Core API. */\n apr30d?: string;\n /** @deprecated Do not use. Not served by the current Core API. */\n lpRate?: string;\n cctpAddress?: string;\n cctpV2Address?: string;\n cctpFeeShare?: string;\n cctpV2FeeShare?: string;\n /**\n * @deprecated Do not use.\n */\n yieldId?: number;\n xReserve?: XReserveDTO;\n /**\n * NEAR Intents (1Click) asset of the token. Defined when the token is listed by NEAR Intents.\n */\n nearIntents?: NearIntentsDTO;\n /**\n * True when the token is the native gas token of the chain (listed under a sentinel address).\n */\n isNative?: boolean;\n /**\n * Optional: the current Core API always returns all tokens and omits the flags,\n * in which case every token is treated as `swap: true, pool: false`.\n */\n flags?: {\n swap: boolean;\n /** @deprecated Do not use. */\n pool: boolean;\n };\n}\n\nexport interface XReserveDTO {\n bridgeAddress: string;\n feeConst: string;\n feeShare: string;\n protocolAddress?: string;\n}\n\nexport interface NearIntentsDTO {\n assetId: string;\n}\n\n/**\n * @deprecated Do not use.\n */\nexport interface PoolInfoDTO {\n aValue: string;\n dValue: string;\n tokenBalance: string;\n vUsdBalance: string;\n totalLpAmount: string;\n accRewardPerShareP: string;\n p: number;\n}\n\nexport enum MessengerKeyDTO {\n /** @deprecated Do not use. */\n ALLBRIDGE = \"allbridge\",\n /** @deprecated Do not use. */\n WORMHOLE = \"wormhole\",\n CCTP = \"cctp\",\n CCTP_V2 = \"cctpV2\",\n OFT = \"oft\",\n X_RESERVE = \"xReserve\",\n NEAR_INTENTS = \"nearIntents\",\n}\n\nexport type AbrPayerAvailabilityKeyDTO = (typeof MessengerKeyDTO)[keyof typeof MessengerKeyDTO];\n\nexport type AbrPayerAvailabilityTypeDTO = Partial<Record<AbrPayerAvailabilityKeyDTO, boolean>>;\n\nexport type TransferTimeDTO = Record<string, MessengerTransferTimeDTO>;\n\nexport interface TxCostAmountDTO {\n maxAmount: string;\n swap: string;\n transfer: string;\n}\n\nexport type MessengerTransferTimeDTO = {\n [messenger in MessengerKeyDTO]: number | null;\n};\n\n/**\n * Bridging protocol used for a transfer.\n * Only {@link ActiveMessenger} values are supported.\n */\nexport enum Messenger {\n /** @deprecated Do not use. */\n ALLBRIDGE = 1,\n /** @deprecated Do not use. */\n WORMHOLE = 2,\n /**\n * Circle CCTP.\n * Route is supported when `cctpAddress` is defined on both source and destination tokens.\n */\n CCTP = 3,\n /**\n * Circle CCTP V2.\n * Route is supported when `cctpV2Address` is defined on both source and destination tokens.\n */\n CCTP_V2 = 4,\n /**\n * LayerZero OFT.\n * Route is supported when source and destination tokens have the same `oftId`\n * and `oftBridgeAddress` is defined on both chains.\n */\n OFT = 5,\n /**\n * xReserve.\n * Route is supported when `xReserve` is defined on both source and destination tokens.\n */\n X_RESERVE = 6,\n /**\n * NEAR Intents (1Click).\n * Route is supported when `nearIntents` is defined on both source and destination tokens.\n * The transfer is a plain token (or native currency) transfer to a one-shot deposit address,\n * so no approval is needed. Amounts are market-priced quotes from the Core API, not a deterministic fee:\n * see `AllbridgeCoreSdk.nearIntents`.\n */\n NEAR_INTENTS = 7,\n}\n\n/**\n * @deprecated Do not use.\n */\nexport type LegacyMessenger = Messenger.ALLBRIDGE | Messenger.WORMHOLE;\n/**\n * Messengers supported for transfers: {@link Messenger.CCTP}, {@link Messenger.CCTP_V2}, {@link Messenger.OFT}, {@link Messenger.X_RESERVE}, {@link Messenger.NEAR_INTENTS}\n */\nexport type ActiveMessenger = Exclude<Messenger, LegacyMessenger>;\n\nexport interface ReceiveTransactionCostRequest {\n sourceChainId: number;\n destinationChainId: number;\n messenger: Messenger;\n sourceToken?: string;\n}\n\nexport interface ReceiveTransactionCostResponse {\n exchangeRate: string;\n fee: string;\n sourceNativeTokenPrice: string;\n abrExchangeRate?: string;\n adminFeeShareWithExtras?: string;\n}\n\n/**\n * NEAR Intents quote direction.\n * - `EXACT_INPUT`: `amount` is what the user sends.\n * - `EXACT_OUTPUT`: `amount` is what the user wants to receive.\n */\nexport type NearIntentsSwapType = \"EXACT_INPUT\" | \"EXACT_OUTPUT\";\n\nexport interface NearIntentsQuoteRequest {\n sourceChainId: number;\n sourceToken: string;\n destinationChainId: number;\n destinationToken: string;\n /**\n * Integer amount: in source token units for `EXACT_INPUT`, in destination token units for `EXACT_OUTPUT`.\n */\n amount: string;\n swapType: NearIntentsSwapType;\n}\n\nexport interface NearIntentsQuoteResponse {\n /** Integer amount in source token units */\n amountIn: string;\n /** Integer amount in destination token units */\n amountOut: string;\n /** Integer amount in destination token units, the slippage floor */\n minAmountOut: string;\n /** Estimated transfer time, seconds */\n timeEstimate: number;\n /**\n * True when the server answered from its per-route quote model instead of a live 1Click quote.\n * Deposits are never estimated. Older servers omit it.\n */\n estimated: boolean;\n /** Absent on an estimated answer for a token without a catalog price */\n amountInUsd?: string;\n /** Absent on an estimated answer for a token without a catalog price */\n amountOutUsd?: string;\n}\n\nexport interface NearIntentsDepositRequest extends NearIntentsQuoteRequest {\n recipient: string;\n refundTo: string;\n}\n\nexport interface NearIntentsDepositResponse {\n depositAddress: string;\n depositMemo?: string;\n /** Integer amount in source token units */\n amountIn: string;\n /** Integer amount in destination token units */\n amountOut: string;\n /** Integer amount in destination token units, the slippage floor */\n minAmountOut: string;\n /** ISO 8601 */\n deadline: string;\n /** ISO 8601 */\n timeWhenInactive?: string;\n /** Estimated transfer time, seconds */\n timeEstimate: number;\n}\n\nexport interface NearIntentsSubmitDepositRequest {\n depositAddress: string;\n depositMemo?: string;\n txId: string;\n}\n\n/**\n * Error codes of the Core API NEAR Intents endpoints (HTTP 400 and 502 bodies).\n */\nexport type NearIntentsErrorCode = \"AMOUNT_TOO_LOW\" | \"NO_LIQUIDITY\" | \"FAILED_TO_GET_QUOTE\" | \"UPSTREAM_ERROR\";\n\nexport interface NearIntentsErrorResponse {\n code: NearIntentsErrorCode;\n message: string;\n minAmount?: string;\n minAmountUsd?: string;\n}\n\nexport interface GasBalanceResponse {\n gasBalance: string | null;\n status: AddressStatus;\n}\n\nexport interface CheckAddressResponse {\n gasBalance: string | null;\n status: AddressStatus;\n}\n\nexport interface TransferStatusResponse {\n txId: string;\n\n sourceChainSymbol: ChainSymbol;\n destinationChainSymbol: ChainSymbol;\n\n sendAmount: string;\n sendAmountFormatted: number;\n\n stableFee: string;\n stableFeeFormatted: number;\n\n sourceTokenAddress: string;\n destinationTokenAddress: string;\n\n originSourceTokenAddress?: string;\n originDestinationTokenAddress?: string;\n\n senderAddress: string;\n recipientAddress: string;\n\n signaturesCount: number;\n signaturesNeeded: number;\n\n send: BridgeTransaction;\n receive?: BridgeTransaction;\n\n /**\n * True when the transfer was refunded to the sender on the source chain instead of being delivered\n * (e.g. a {@link Messenger.NEAR_INTENTS} deposit refunded by NEAR Intents); `receive` stays absent.\n * Optional: older Core API versions may omit it.\n */\n refunded?: boolean;\n\n responseTime?: number;\n}\n\nexport interface BridgeTransaction {\n txId: string;\n\n sourceChainId: number;\n destinationChainId: number;\n\n fee: string;\n feeFormatted: number;\n\n stableFee: string;\n stableFeeFormatted: number;\n\n amount: string;\n amountFormatted: number;\n virtualAmount: string;\n\n bridgeContract: string;\n sender: string;\n recipient: string;\n\n sourceTokenAddress: string;\n destinationTokenAddress: string;\n\n originSourceTokenAddress?: string;\n originDestinationTokenAddress?: string;\n\n hash: string;\n\n messenger: Messenger;\n\n blockTime: number;\n blockId: string;\n\n confirmations: number;\n confirmationsNeeded: number;\n\n isClaimable?: boolean;\n}\n\n/**\n * @deprecated Do not use.\n */\nexport type PoolInfoResponse = Record<string, PoolInfo>;\n/**\n * @deprecated Do not use.\n */\nexport type PendingInfoResponse = Partial<Record<string, TokenPendingInfoDTO>>;\n/**\n * @deprecated Do not use.\n */\nexport type TokenPendingInfoDTO = Record<string, PendingInfoDTO>;\n\n/**\n * @deprecated Do not use.\n */\nexport interface PendingInfoDTO {\n pendingTxs: number;\n totalSentAmount: string;\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChainDetailsMapWithFlags, PoolInfoMap, PoolKeyObject, TokenWithChainDetailsWithFlags } from "../../tokens-info";
|
|
2
2
|
import { ApiClient } from "./api-client";
|
|
3
|
-
import { GasBalanceResponse, PendingInfoResponse, ReceiveTransactionCostRequest, ReceiveTransactionCostResponse, TransferStatusResponse } from "./core-api.model";
|
|
3
|
+
import { GasBalanceResponse, NearIntentsDepositRequest, NearIntentsDepositResponse, NearIntentsQuoteRequest, NearIntentsQuoteResponse, NearIntentsSubmitDepositRequest, PendingInfoResponse, ReceiveTransactionCostRequest, ReceiveTransactionCostResponse, TransferStatusResponse } from "./core-api.model";
|
|
4
4
|
export interface AllbridgeCoreClientParams {
|
|
5
5
|
coreApiUrl: string;
|
|
6
6
|
coreApiHeaders?: Record<string, string>;
|
|
@@ -13,6 +13,9 @@ export interface AllbridgeCoreClient {
|
|
|
13
13
|
getTransferStatus(chainSymbol: string, txId: string): Promise<TransferStatusResponse>;
|
|
14
14
|
getReceiveTransactionCost(args: ReceiveTransactionCostRequest): Promise<ReceiveTransactionCostResponse>;
|
|
15
15
|
getGasBalance(chainSymbol: string, address: string): Promise<GasBalanceResponse>;
|
|
16
|
+
getNearIntentsQuote(args: NearIntentsQuoteRequest): Promise<NearIntentsQuoteResponse>;
|
|
17
|
+
createNearIntentsDeposit(args: NearIntentsDepositRequest): Promise<NearIntentsDepositResponse>;
|
|
18
|
+
submitNearIntentsDeposit(args: NearIntentsSubmitDepositRequest): Promise<void>;
|
|
16
19
|
}
|
|
17
20
|
export interface AllbridgeCoreClientWithTokens extends AllbridgeCoreClient {
|
|
18
21
|
getChainDetailsMap(): Promise<ChainDetailsMapWithFlags>;
|
|
@@ -47,4 +50,7 @@ export declare class AllbridgeCoreClientImpl implements AllbridgeCoreClientWithP
|
|
|
47
50
|
getReceiveTransactionCost(args: ReceiveTransactionCostRequest): Promise<ReceiveTransactionCostResponse>;
|
|
48
51
|
/** @deprecated Do not use. */
|
|
49
52
|
getPoolInfoMap(pools: PoolKeyObject[] | PoolKeyObject): Promise<PoolInfoMap>;
|
|
53
|
+
getNearIntentsQuote(args: NearIntentsQuoteRequest): Promise<NearIntentsQuoteResponse>;
|
|
54
|
+
createNearIntentsDeposit(args: NearIntentsDepositRequest): Promise<NearIntentsDepositResponse>;
|
|
55
|
+
submitNearIntentsDeposit(args: NearIntentsSubmitDepositRequest): Promise<void>;
|
|
50
56
|
}
|
|
@@ -31,5 +31,14 @@ export class AllbridgeCoreClientImpl {
|
|
|
31
31
|
async getPoolInfoMap(pools) {
|
|
32
32
|
return await this.apiClient.getPoolInfoMap(pools);
|
|
33
33
|
}
|
|
34
|
+
async getNearIntentsQuote(args) {
|
|
35
|
+
return await this.apiClient.getNearIntentsQuote(args);
|
|
36
|
+
}
|
|
37
|
+
async createNearIntentsDeposit(args) {
|
|
38
|
+
return await this.apiClient.createNearIntentsDeposit(args);
|
|
39
|
+
}
|
|
40
|
+
async submitNearIntentsDeposit(args) {
|
|
41
|
+
return await this.apiClient.submitNearIntentsDeposit(args);
|
|
42
|
+
}
|
|
34
43
|
}
|
|
35
44
|
//# sourceMappingURL=core-client-base.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-client-base.js","sourceRoot":"","sources":["../../../../src/client/core-api/core-client-base.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"core-client-base.js","sourceRoot":"","sources":["../../../../src/client/core-api/core-client-base.ts"],"names":[],"mappings":"AAgEA,MAAM,OAAO,uBAAuB;IACd;IAApB,YAAoB,SAAoB;QAApB,cAAS,GAAT,SAAS,CAAW;IAAG,CAAC;IAE5C,KAAK,CAAC,kBAAkB;QACtB,OAAO,CAAC,MAAM,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,CAAC,CAAC,eAAe,CAAC;IAC/D,CAAC;IAED,KAAK,CAAC,MAAM;QACV,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC5C,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAC3E,CAAC;IAED,8BAA8B;IAC9B,KAAK,CAAC,cAAc;QAClB,OAAO,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,CAAC;IACzC,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,WAAmB,EAAE,OAAe;QACtD,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;IAED,8BAA8B;IAC9B,KAAK,CAAC,gCAAgC;QAIpC,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,WAAmB,EAAE,IAAY;QACvD,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;IACnE,CAAC;IAED,KAAK,CAAC,yBAAyB,CAAC,IAAmC;QACjE,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC;IAC9D,CAAC;IAED,8BAA8B;IAC9B,KAAK,CAAC,cAAc,CAAC,KAAsC;QACzD,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,mBAAmB,CAAC,IAA6B;QACrD,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACxD,CAAC;IAED,KAAK,CAAC,wBAAwB,CAAC,IAA+B;QAC5D,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;IAC7D,CAAC;IAED,KAAK,CAAC,wBAAwB,CAAC,IAAqC;QAClE,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;IAC7D,CAAC;CACF","sourcesContent":["import {\n ChainDetailsMapWithFlags,\n PoolInfoMap,\n PoolKeyObject,\n TokenWithChainDetailsWithFlags,\n} from \"../../tokens-info\";\nimport { ApiClient } from \"./api-client\";\nimport {\n GasBalanceResponse,\n NearIntentsDepositRequest,\n NearIntentsDepositResponse,\n NearIntentsQuoteRequest,\n NearIntentsQuoteResponse,\n NearIntentsSubmitDepositRequest,\n PendingInfoResponse,\n ReceiveTransactionCostRequest,\n ReceiveTransactionCostResponse,\n TransferStatusResponse,\n} from \"./core-api.model\";\n\nexport interface AllbridgeCoreClientParams {\n coreApiUrl: string;\n coreApiHeaders?: Record<string, string>;\n coreApiHeadersProvider?: () => Promise<Record<string, string> | undefined>;\n coreApiQueryParams?: Record<string, string>;\n}\n\nexport interface AllbridgeCoreClient {\n /** @deprecated Do not use. */\n getPendingInfo(): Promise<PendingInfoResponse>;\n\n getTransferStatus(chainSymbol: string, txId: string): Promise<TransferStatusResponse>;\n\n getReceiveTransactionCost(args: ReceiveTransactionCostRequest): Promise<ReceiveTransactionCostResponse>;\n\n getGasBalance(chainSymbol: string, address: string): Promise<GasBalanceResponse>;\n\n getNearIntentsQuote(args: NearIntentsQuoteRequest): Promise<NearIntentsQuoteResponse>;\n\n createNearIntentsDeposit(args: NearIntentsDepositRequest): Promise<NearIntentsDepositResponse>;\n\n submitNearIntentsDeposit(args: NearIntentsSubmitDepositRequest): Promise<void>;\n}\n\nexport interface AllbridgeCoreClientWithTokens extends AllbridgeCoreClient {\n getChainDetailsMap(): Promise<ChainDetailsMapWithFlags>;\n\n tokens(): Promise<TokenWithChainDetailsWithFlags[]>;\n}\n\n/**\n * @deprecated Do not use.\n */\nexport interface AllbridgeCoreClientWithPoolInfo extends AllbridgeCoreClientWithTokens {\n /** @deprecated Do not use. */\n getChainDetailsMapAndPoolInfoMap(): Promise<{\n chainDetailsMap: ChainDetailsMapWithFlags;\n poolInfoMap: PoolInfoMap;\n }>;\n\n /** @deprecated Do not use. */\n getPoolInfoMap(pools: PoolKeyObject[] | PoolKeyObject): Promise<PoolInfoMap>;\n}\n\nexport class AllbridgeCoreClientImpl implements AllbridgeCoreClientWithPoolInfo {\n constructor(private apiClient: ApiClient) {}\n\n async getChainDetailsMap(): Promise<ChainDetailsMapWithFlags> {\n return (await this.apiClient.getTokenInfo()).chainDetailsMap;\n }\n\n async tokens(): Promise<TokenWithChainDetailsWithFlags[]> {\n const map = await this.getChainDetailsMap();\n return Object.values(map).flatMap((chainDetails) => chainDetails.tokens);\n }\n\n /** @deprecated Do not use. */\n async getPendingInfo(): Promise<PendingInfoResponse> {\n return this.apiClient.getPendingInfo();\n }\n\n async getGasBalance(chainSymbol: string, address: string): Promise<GasBalanceResponse> {\n return this.apiClient.getGasBalance(chainSymbol, address);\n }\n\n /** @deprecated Do not use. */\n async getChainDetailsMapAndPoolInfoMap(): Promise<{\n chainDetailsMap: ChainDetailsMapWithFlags;\n poolInfoMap: PoolInfoMap;\n }> {\n return await this.apiClient.getTokenInfo();\n }\n\n async getTransferStatus(chainSymbol: string, txId: string): Promise<TransferStatusResponse> {\n return await this.apiClient.getTransferStatus(chainSymbol, txId);\n }\n\n async getReceiveTransactionCost(args: ReceiveTransactionCostRequest): Promise<ReceiveTransactionCostResponse> {\n return await this.apiClient.getReceiveTransactionCost(args);\n }\n\n /** @deprecated Do not use. */\n async getPoolInfoMap(pools: PoolKeyObject[] | PoolKeyObject): Promise<PoolInfoMap> {\n return await this.apiClient.getPoolInfoMap(pools);\n }\n\n async getNearIntentsQuote(args: NearIntentsQuoteRequest): Promise<NearIntentsQuoteResponse> {\n return await this.apiClient.getNearIntentsQuote(args);\n }\n\n async createNearIntentsDeposit(args: NearIntentsDepositRequest): Promise<NearIntentsDepositResponse> {\n return await this.apiClient.createNearIntentsDeposit(args);\n }\n\n async submitNearIntentsDeposit(args: NearIntentsSubmitDepositRequest): Promise<void> {\n return await this.apiClient.submitNearIntentsDeposit(args);\n }\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AllbridgeCoreSdkOptions } from "../../index";
|
|
2
2
|
import { ChainDetailsMap, PoolInfo, PoolKeyObject, TokenWithChainDetails } from "../../tokens-info";
|
|
3
|
-
import { GasBalanceResponse, PendingInfoResponse, ReceiveTransactionCostRequest, ReceiveTransactionCostResponse, TransferStatusResponse } from "./core-api.model";
|
|
3
|
+
import { GasBalanceResponse, NearIntentsDepositRequest, NearIntentsDepositResponse, NearIntentsQuoteRequest, NearIntentsQuoteResponse, NearIntentsSubmitDepositRequest, PendingInfoResponse, ReceiveTransactionCostRequest, ReceiveTransactionCostResponse, TransferStatusResponse } from "./core-api.model";
|
|
4
4
|
import { AllbridgeCoreClient, AllbridgeCoreClientWithTokens } from "./core-client-base";
|
|
5
5
|
import { AllbridgeCoreClientPoolsExt } from "./core-client-pool-info-caching";
|
|
6
6
|
export interface AllbridgeCoreClientFiltered extends AllbridgeCoreClient, AllbridgeCoreClientPoolsExt {
|
|
@@ -30,6 +30,9 @@ export declare class AllbridgeCoreClientFilteredImpl implements AllbridgeCoreCli
|
|
|
30
30
|
getGasBalance(chainSymbol: string, address: string): Promise<GasBalanceResponse>;
|
|
31
31
|
getTransferStatus(chainSymbol: string, txId: string): Promise<TransferStatusResponse>;
|
|
32
32
|
getReceiveTransactionCost(args: ReceiveTransactionCostRequest): Promise<ReceiveTransactionCostResponse>;
|
|
33
|
+
getNearIntentsQuote(args: NearIntentsQuoteRequest): Promise<NearIntentsQuoteResponse>;
|
|
34
|
+
createNearIntentsDeposit(args: NearIntentsDepositRequest): Promise<NearIntentsDepositResponse>;
|
|
35
|
+
submitNearIntentsDeposit(args: NearIntentsSubmitDepositRequest): Promise<void>;
|
|
33
36
|
/** @deprecated Do not use. */
|
|
34
37
|
cachePut(poolKeyObject: PoolKeyObject, poolInfo: PoolInfo): void;
|
|
35
38
|
/** @deprecated Do not use. */
|
|
@@ -35,6 +35,15 @@ export class AllbridgeCoreClientFilteredImpl {
|
|
|
35
35
|
async getReceiveTransactionCost(args) {
|
|
36
36
|
return await this.client.getReceiveTransactionCost(args);
|
|
37
37
|
}
|
|
38
|
+
async getNearIntentsQuote(args) {
|
|
39
|
+
return await this.client.getNearIntentsQuote(args);
|
|
40
|
+
}
|
|
41
|
+
async createNearIntentsDeposit(args) {
|
|
42
|
+
return await this.client.createNearIntentsDeposit(args);
|
|
43
|
+
}
|
|
44
|
+
async submitNearIntentsDeposit(args) {
|
|
45
|
+
return await this.client.submitNearIntentsDeposit(args);
|
|
46
|
+
}
|
|
38
47
|
/** @deprecated Do not use. */
|
|
39
48
|
cachePut(poolKeyObject, poolInfo) {
|
|
40
49
|
return this.client.cachePut(poolKeyObject, poolInfo);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-client-filtered.js","sourceRoot":"","sources":["../../../../src/client/core-api/core-client-filtered.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"core-client-filtered.js","sourceRoot":"","sources":["../../../../src/client/core-api/core-client-filtered.ts"],"names":[],"mappings":"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","sourcesContent":["/* eslint-disable @typescript-eslint/unified-signatures -- overloads intentionally expose filter-specific deprecation metadata */\nimport { AllbridgeCoreSdkOptions } from \"../../index\";\nimport {\n ChainDetailsMap,\n PoolInfo,\n PoolKeyObject,\n TokenWithChainDetails,\n TokenWithChainDetailsWithFlags,\n} from \"../../tokens-info\";\nimport {\n GasBalanceResponse,\n NearIntentsDepositRequest,\n NearIntentsDepositResponse,\n NearIntentsQuoteRequest,\n NearIntentsQuoteResponse,\n NearIntentsSubmitDepositRequest,\n PendingInfoResponse,\n ReceiveTransactionCostRequest,\n ReceiveTransactionCostResponse,\n TransferStatusResponse,\n} from \"./core-api.model\";\nimport { AllbridgeCoreClient, AllbridgeCoreClientWithTokens } from \"./core-client-base\";\nimport { AllbridgeCoreClientPoolsExt } from \"./core-client-pool-info-caching\";\n\nexport interface AllbridgeCoreClientFiltered extends AllbridgeCoreClient, AllbridgeCoreClientPoolsExt {\n /** @deprecated Do not use. */\n getChainDetailsMap(type: \"pool\"): Promise<ChainDetailsMap>;\n getChainDetailsMap(type: \"swap\"): Promise<ChainDetailsMap>;\n getChainDetailsMap(type: \"swap\" | \"pool\"): Promise<ChainDetailsMap>;\n\n /** @deprecated Do not use. */\n tokens(type: \"pool\"): Promise<TokenWithChainDetails[]>;\n tokens(type: \"swap\"): Promise<TokenWithChainDetails[]>;\n tokens(type: \"swap\" | \"pool\"): Promise<TokenWithChainDetails[]>;\n}\n\nexport class AllbridgeCoreClientFilteredImpl implements AllbridgeCoreClientFiltered {\n private readonly isStaging: boolean;\n\n constructor(\n private client: AllbridgeCoreClientWithTokens & AllbridgeCoreClientPoolsExt,\n params: AllbridgeCoreSdkOptions\n ) {\n this.isStaging = params.coreApiQueryParams?.staging === \"true\";\n }\n\n /** @deprecated Do not use. */\n getChainDetailsMap(type: \"pool\"): Promise<ChainDetailsMap>;\n getChainDetailsMap(type: \"swap\"): Promise<ChainDetailsMap>;\n getChainDetailsMap(type: \"swap\" | \"pool\"): Promise<ChainDetailsMap>;\n async getChainDetailsMap(type: \"swap\" | \"pool\"): Promise<ChainDetailsMap> {\n const chainDetailsMapWithFlags = await this.client.getChainDetailsMap();\n const result: ChainDetailsMap = {};\n\n for (const key in chainDetailsMapWithFlags) {\n const chainDetailsWithTokensWithFlag = chainDetailsMapWithFlags[key];\n if (chainDetailsWithTokensWithFlag) {\n result[key] = {\n ...chainDetailsWithTokensWithFlag,\n tokens: filterAndConvertToTokenWithChainDetails(chainDetailsWithTokensWithFlag.tokens, type, this.isStaging),\n };\n }\n }\n return result;\n }\n\n /** @deprecated Do not use. */\n tokens(type: \"pool\"): Promise<TokenWithChainDetails[]>;\n tokens(type: \"swap\"): Promise<TokenWithChainDetails[]>;\n tokens(type: \"swap\" | \"pool\"): Promise<TokenWithChainDetails[]>;\n async tokens(type: \"swap\" | \"pool\"): Promise<TokenWithChainDetails[]> {\n return filterAndConvertToTokenWithChainDetails(await this.client.tokens(), type, this.isStaging);\n }\n\n /** @deprecated Do not use. */\n async getPendingInfo(): Promise<PendingInfoResponse> {\n return this.client.getPendingInfo();\n }\n\n async getGasBalance(chainSymbol: string, address: string): Promise<GasBalanceResponse> {\n return this.client.getGasBalance(chainSymbol, address);\n }\n\n async getTransferStatus(chainSymbol: string, txId: string): Promise<TransferStatusResponse> {\n return await this.client.getTransferStatus(chainSymbol, txId);\n }\n\n async getReceiveTransactionCost(args: ReceiveTransactionCostRequest): Promise<ReceiveTransactionCostResponse> {\n return await this.client.getReceiveTransactionCost(args);\n }\n\n async getNearIntentsQuote(args: NearIntentsQuoteRequest): Promise<NearIntentsQuoteResponse> {\n return await this.client.getNearIntentsQuote(args);\n }\n\n async createNearIntentsDeposit(args: NearIntentsDepositRequest): Promise<NearIntentsDepositResponse> {\n return await this.client.createNearIntentsDeposit(args);\n }\n\n async submitNearIntentsDeposit(args: NearIntentsSubmitDepositRequest): Promise<void> {\n return await this.client.submitNearIntentsDeposit(args);\n }\n\n /** @deprecated Do not use. */\n cachePut(poolKeyObject: PoolKeyObject, poolInfo: PoolInfo): void {\n return this.client.cachePut(poolKeyObject, poolInfo);\n }\n\n /** @deprecated Do not use. */\n getPoolInfoByKey(poolKeyObject: PoolKeyObject): Promise<PoolInfo> {\n return this.client.getPoolInfoByKey(poolKeyObject);\n }\n\n /** @deprecated Do not use. */\n refreshPoolInfo(poolKeyObjects?: PoolKeyObject | PoolKeyObject[]): Promise<void> {\n return this.client.refreshPoolInfo(poolKeyObjects);\n }\n}\n\nfunction filterAndConvertToTokenWithChainDetails(\n tokens: TokenWithChainDetailsWithFlags[],\n type: \"swap\" | \"pool\",\n isStaging: boolean\n): TokenWithChainDetails[] {\n return tokens.filter((token) => (isStaging ? true : token.flags[type])).map(convertToTokenWithChainDetails);\n}\n\nfunction convertToTokenWithChainDetails(token: TokenWithChainDetailsWithFlags): TokenWithChainDetails {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { flags, ...rest } = token;\n return rest;\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChainDetailsMapWithFlags, PoolInfo, PoolKeyObject, TokenWithChainDetailsWithFlags } from "../../tokens-info";
|
|
2
|
-
import { GasBalanceResponse, PendingInfoResponse, ReceiveTransactionCostRequest, ReceiveTransactionCostResponse, TransferStatusResponse } from "./core-api.model";
|
|
2
|
+
import { GasBalanceResponse, NearIntentsDepositRequest, NearIntentsDepositResponse, NearIntentsQuoteRequest, NearIntentsQuoteResponse, NearIntentsSubmitDepositRequest, PendingInfoResponse, ReceiveTransactionCostRequest, ReceiveTransactionCostResponse, TransferStatusResponse } from "./core-api.model";
|
|
3
3
|
import { AllbridgeCoreClientWithPoolInfo, AllbridgeCoreClientWithTokens } from "./core-client-base";
|
|
4
4
|
/**
|
|
5
5
|
* @deprecated Do not use.
|
|
@@ -26,6 +26,9 @@ export declare class AllbridgeCoreClientPoolInfoCaching implements AllbridgeCore
|
|
|
26
26
|
/** @deprecated Do not use. */
|
|
27
27
|
getPendingInfo(): Promise<PendingInfoResponse>;
|
|
28
28
|
getGasBalance(chainSymbol: string, address: string): Promise<GasBalanceResponse>;
|
|
29
|
+
getNearIntentsQuote(args: NearIntentsQuoteRequest): Promise<NearIntentsQuoteResponse>;
|
|
30
|
+
createNearIntentsDeposit(args: NearIntentsDepositRequest): Promise<NearIntentsDepositResponse>;
|
|
31
|
+
submitNearIntentsDeposit(args: NearIntentsSubmitDepositRequest): Promise<void>;
|
|
29
32
|
/** @deprecated Do not use. */
|
|
30
33
|
getPoolInfoByKey(poolKeyObject: PoolKeyObject): Promise<PoolInfo>;
|
|
31
34
|
/** @deprecated Do not use. */
|
|
@@ -32,6 +32,15 @@ export class AllbridgeCoreClientPoolInfoCaching {
|
|
|
32
32
|
getGasBalance(chainSymbol, address) {
|
|
33
33
|
return this.client.getGasBalance(chainSymbol, address);
|
|
34
34
|
}
|
|
35
|
+
getNearIntentsQuote(args) {
|
|
36
|
+
return this.client.getNearIntentsQuote(args);
|
|
37
|
+
}
|
|
38
|
+
createNearIntentsDeposit(args) {
|
|
39
|
+
return this.client.createNearIntentsDeposit(args);
|
|
40
|
+
}
|
|
41
|
+
submitNearIntentsDeposit(args) {
|
|
42
|
+
return this.client.submitNearIntentsDeposit(args);
|
|
43
|
+
}
|
|
35
44
|
/** @deprecated Do not use. */
|
|
36
45
|
async getPoolInfoByKey(poolKeyObject) {
|
|
37
46
|
this.poolInfoCache.putAllIfNotExists((await this.client.getChainDetailsMapAndPoolInfoMap()).poolInfoMap);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-client-pool-info-caching.js","sourceRoot":"","sources":["../../../../src/client/core-api/core-client-pool-info-caching.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,aAAa,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAQ5C,OAAO,EAAE,kCAAkC,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"core-client-pool-info-caching.js","sourceRoot":"","sources":["../../../../src/client/core-api/core-client-pool-info-caching.ts"],"names":[],"mappings":"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","sourcesContent":["import Cache from \"timed-cache\";\nimport { SdkError } from \"../../exceptions\";\nimport {\n ChainDetailsMapWithFlags,\n PoolInfo,\n PoolInfoMap,\n PoolKeyObject,\n TokenWithChainDetailsWithFlags,\n} from \"../../tokens-info\";\nimport { mapChainDetailsMapToPoolKeyObjects, mapPoolKeyObjectToPoolKey } from \"./core-api-mapper\";\nimport {\n GasBalanceResponse,\n NearIntentsDepositRequest,\n NearIntentsDepositResponse,\n NearIntentsQuoteRequest,\n NearIntentsQuoteResponse,\n NearIntentsSubmitDepositRequest,\n PendingInfoResponse,\n ReceiveTransactionCostRequest,\n ReceiveTransactionCostResponse,\n TransferStatusResponse,\n} from \"./core-api.model\";\nimport { AllbridgeCoreClientWithPoolInfo, AllbridgeCoreClientWithTokens } from \"./core-client-base\";\n\nconst _55_SECONDS_TTL = 55 * 1000;\n\n/**\n * @deprecated Do not use.\n */\nexport interface AllbridgeCoreClientPoolsExt {\n /** @deprecated Do not use. */\n getPoolInfoByKey(poolKeyObject: PoolKeyObject): Promise<PoolInfo>;\n /** @deprecated Do not use. */\n refreshPoolInfo(poolKeyObjects?: PoolKeyObject | PoolKeyObject[]): Promise<void>;\n /** @deprecated Do not use. */\n cachePut(poolKeyObject: PoolKeyObject, poolInfo: PoolInfo): void;\n}\n\n/**\n * @deprecated Do not use.\n */\nexport class AllbridgeCoreClientPoolInfoCaching implements AllbridgeCoreClientWithTokens, AllbridgeCoreClientPoolsExt {\n private readonly poolInfoCache;\n\n constructor(private readonly client: AllbridgeCoreClientWithPoolInfo) {\n this.poolInfoCache = new PoolInfoCache();\n }\n\n async getChainDetailsMap(): Promise<ChainDetailsMapWithFlags> {\n const result = await this.client.getChainDetailsMapAndPoolInfoMap();\n return result.chainDetailsMap;\n }\n\n async tokens(): Promise<TokenWithChainDetailsWithFlags[]> {\n return await this.client.tokens();\n }\n\n getTransferStatus(chainSymbol: string, txId: string): Promise<TransferStatusResponse> {\n return this.client.getTransferStatus(chainSymbol, txId);\n }\n\n getReceiveTransactionCost(args: ReceiveTransactionCostRequest): Promise<ReceiveTransactionCostResponse> {\n return this.client.getReceiveTransactionCost(args);\n }\n\n /** @deprecated Do not use. */\n getPendingInfo(): Promise<PendingInfoResponse> {\n return this.client.getPendingInfo();\n }\n\n getGasBalance(chainSymbol: string, address: string): Promise<GasBalanceResponse> {\n return this.client.getGasBalance(chainSymbol, address);\n }\n\n getNearIntentsQuote(args: NearIntentsQuoteRequest): Promise<NearIntentsQuoteResponse> {\n return this.client.getNearIntentsQuote(args);\n }\n\n createNearIntentsDeposit(args: NearIntentsDepositRequest): Promise<NearIntentsDepositResponse> {\n return this.client.createNearIntentsDeposit(args);\n }\n\n submitNearIntentsDeposit(args: NearIntentsSubmitDepositRequest): Promise<void> {\n return this.client.submitNearIntentsDeposit(args);\n }\n\n /** @deprecated Do not use. */\n async getPoolInfoByKey(poolKeyObject: PoolKeyObject): Promise<PoolInfo> {\n this.poolInfoCache.putAllIfNotExists((await this.client.getChainDetailsMapAndPoolInfoMap()).poolInfoMap);\n const poolInfo = this.poolInfoCache.get(poolKeyObject);\n\n if (poolInfo) {\n return poolInfo;\n } else {\n const poolInfoMap = await this.client.getPoolInfoMap(poolKeyObject);\n this.poolInfoCache.putAll(poolInfoMap);\n const result = poolInfoMap[mapPoolKeyObjectToPoolKey(poolKeyObject)];\n if (result) {\n return result;\n }\n throw new SdkError(\n \"Cannot find pool info for \" + poolKeyObject.poolAddress + \" on chain \" + poolKeyObject.chainSymbol\n );\n }\n }\n\n /** @deprecated Do not use. */\n async refreshPoolInfo(poolKeyObjects?: PoolKeyObject | PoolKeyObject[]): Promise<void> {\n let poolInfoMap;\n if (poolKeyObjects) {\n this.poolInfoCache.putAllIfNotExists((await this.client.getChainDetailsMapAndPoolInfoMap()).poolInfoMap);\n poolInfoMap = await this.client.getPoolInfoMap(poolKeyObjects);\n } else {\n const result = await this.client.getChainDetailsMapAndPoolInfoMap();\n poolInfoMap = await this.client.getPoolInfoMap(mapChainDetailsMapToPoolKeyObjects(result.chainDetailsMap));\n }\n this.poolInfoCache.putAll(poolInfoMap);\n }\n\n /** @deprecated Do not use. */\n cachePut(poolKeyObject: PoolKeyObject, poolInfo: PoolInfo): void {\n this.poolInfoCache.put(mapPoolKeyObjectToPoolKey(poolKeyObject), poolInfo);\n }\n}\n\nclass PoolInfoCache {\n private cache;\n\n constructor() {\n this.cache = new Cache<PoolInfo>({ defaultTtl: _55_SECONDS_TTL });\n }\n\n putAll(poolInfoMap: PoolInfoMap) {\n for (const [key, value] of Object.entries(poolInfoMap)) {\n this.cache.put(key, value);\n }\n }\n\n putAllIfNotExists(poolInfoMap: PoolInfoMap) {\n for (const [key, value] of Object.entries(poolInfoMap)) {\n if (!this.cache.get(key)) {\n this.cache.put(key, value);\n }\n }\n }\n\n put(key: string, poolInfo: PoolInfo) {\n this.cache.put(key, poolInfo);\n }\n\n get(poolKeyObject: PoolKeyObject): PoolInfo | undefined {\n const key = mapPoolKeyObjectToPoolKey(poolKeyObject);\n return this.cache.get(key);\n }\n}\n"]}
|
|
@@ -53,6 +53,43 @@ export declare class CCTPDoesNotSupportedError extends SdkRootError {
|
|
|
53
53
|
export declare class OFTDoesNotSupportedError extends SdkRootError {
|
|
54
54
|
constructor(message?: string);
|
|
55
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* The route is not supported by `Messenger.NEAR_INTENTS`: `nearIntents` is missing on the source or destination token,
|
|
58
|
+
* or the Core API does not know the route.
|
|
59
|
+
*/
|
|
60
|
+
export declare class NearIntentsDoesNotSupportedError extends SdkRootError {
|
|
61
|
+
constructor(message?: string);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The NEAR Intents amount is below the route minimum.
|
|
65
|
+
*/
|
|
66
|
+
export declare class NearIntentsAmountTooLowError extends SdkRootError {
|
|
67
|
+
/**
|
|
68
|
+
* Minimum amount, integer in the source token units. Optional.
|
|
69
|
+
*/
|
|
70
|
+
minAmount?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Minimum amount in USD. Optional.
|
|
73
|
+
*/
|
|
74
|
+
minAmountUsd?: string;
|
|
75
|
+
constructor(message?: string, minAmount?: string, minAmountUsd?: string);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* NEAR Intents has no liquidity for the route right now.
|
|
79
|
+
*/
|
|
80
|
+
export declare class NearIntentsNoLiquidityError extends SdkRootError {
|
|
81
|
+
constructor(message?: string);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* NEAR Intents failed to produce a quote or deposit (`FAILED_TO_GET_QUOTE`, or an upstream error).
|
|
85
|
+
*/
|
|
86
|
+
export declare class NearIntentsQuoteError extends SdkRootError {
|
|
87
|
+
/**
|
|
88
|
+
* Core API error code, e.g. `FAILED_TO_GET_QUOTE` or `UPSTREAM_ERROR`. Optional.
|
|
89
|
+
*/
|
|
90
|
+
code?: string;
|
|
91
|
+
constructor(message?: string, code?: string);
|
|
92
|
+
}
|
|
56
93
|
/**
|
|
57
94
|
* @deprecated Do not use.
|
|
58
95
|
*/
|
|
@@ -80,6 +117,10 @@ export declare enum ErrorCode {
|
|
|
80
117
|
NODE_RPC_URL_NOT_INITIALIZED_ERROR = "NodeRpcUrlNotInitializedError",
|
|
81
118
|
CCTP_DOES_NOT_SUPPORTED_ERROR = "CCTPDoesNotSupportedError",
|
|
82
119
|
OFT_DOES_NOT_SUPPORTED_ERROR = "OFTDoesNotSupportedError",
|
|
120
|
+
NEAR_INTENTS_DOES_NOT_SUPPORTED_ERROR = "NearIntentsDoesNotSupportedError",
|
|
121
|
+
NEAR_INTENTS_AMOUNT_TOO_LOW_ERROR = "NearIntentsAmountTooLowError",
|
|
122
|
+
NEAR_INTENTS_NO_LIQUIDITY_ERROR = "NearIntentsNoLiquidityError",
|
|
123
|
+
NEAR_INTENTS_QUOTE_ERROR = "NearIntentsQuoteError",
|
|
83
124
|
/**
|
|
84
125
|
* @deprecated Do not use.
|
|
85
126
|
*/
|
|
@@ -88,6 +88,54 @@ export class OFTDoesNotSupportedError extends SdkRootError {
|
|
|
88
88
|
super(ErrorCode.OFT_DOES_NOT_SUPPORTED_ERROR, message);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* The route is not supported by `Messenger.NEAR_INTENTS`: `nearIntents` is missing on the source or destination token,
|
|
93
|
+
* or the Core API does not know the route.
|
|
94
|
+
*/
|
|
95
|
+
export class NearIntentsDoesNotSupportedError extends SdkRootError {
|
|
96
|
+
constructor(message) {
|
|
97
|
+
super(ErrorCode.NEAR_INTENTS_DOES_NOT_SUPPORTED_ERROR, message);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* The NEAR Intents amount is below the route minimum.
|
|
102
|
+
*/
|
|
103
|
+
export class NearIntentsAmountTooLowError extends SdkRootError {
|
|
104
|
+
/**
|
|
105
|
+
* Minimum amount, integer in the source token units. Optional.
|
|
106
|
+
*/
|
|
107
|
+
minAmount;
|
|
108
|
+
/**
|
|
109
|
+
* Minimum amount in USD. Optional.
|
|
110
|
+
*/
|
|
111
|
+
minAmountUsd;
|
|
112
|
+
constructor(message, minAmount, minAmountUsd) {
|
|
113
|
+
super(ErrorCode.NEAR_INTENTS_AMOUNT_TOO_LOW_ERROR, message);
|
|
114
|
+
this.minAmount = minAmount;
|
|
115
|
+
this.minAmountUsd = minAmountUsd;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* NEAR Intents has no liquidity for the route right now.
|
|
120
|
+
*/
|
|
121
|
+
export class NearIntentsNoLiquidityError extends SdkRootError {
|
|
122
|
+
constructor(message) {
|
|
123
|
+
super(ErrorCode.NEAR_INTENTS_NO_LIQUIDITY_ERROR, message);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* NEAR Intents failed to produce a quote or deposit (`FAILED_TO_GET_QUOTE`, or an upstream error).
|
|
128
|
+
*/
|
|
129
|
+
export class NearIntentsQuoteError extends SdkRootError {
|
|
130
|
+
/**
|
|
131
|
+
* Core API error code, e.g. `FAILED_TO_GET_QUOTE` or `UPSTREAM_ERROR`. Optional.
|
|
132
|
+
*/
|
|
133
|
+
code;
|
|
134
|
+
constructor(message, code) {
|
|
135
|
+
super(ErrorCode.NEAR_INTENTS_QUOTE_ERROR, message);
|
|
136
|
+
this.code = code;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
91
139
|
/**
|
|
92
140
|
* @deprecated Do not use.
|
|
93
141
|
*/
|
|
@@ -120,6 +168,10 @@ export var ErrorCode;
|
|
|
120
168
|
ErrorCode["NODE_RPC_URL_NOT_INITIALIZED_ERROR"] = "NodeRpcUrlNotInitializedError";
|
|
121
169
|
ErrorCode["CCTP_DOES_NOT_SUPPORTED_ERROR"] = "CCTPDoesNotSupportedError";
|
|
122
170
|
ErrorCode["OFT_DOES_NOT_SUPPORTED_ERROR"] = "OFTDoesNotSupportedError";
|
|
171
|
+
ErrorCode["NEAR_INTENTS_DOES_NOT_SUPPORTED_ERROR"] = "NearIntentsDoesNotSupportedError";
|
|
172
|
+
ErrorCode["NEAR_INTENTS_AMOUNT_TOO_LOW_ERROR"] = "NearIntentsAmountTooLowError";
|
|
173
|
+
ErrorCode["NEAR_INTENTS_NO_LIQUIDITY_ERROR"] = "NearIntentsNoLiquidityError";
|
|
174
|
+
ErrorCode["NEAR_INTENTS_QUOTE_ERROR"] = "NearIntentsQuoteError";
|
|
123
175
|
/**
|
|
124
176
|
* @deprecated Do not use.
|
|
125
177
|
*/
|