@imtbl/sdk 1.72.1 → 1.72.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/{blockchain_data-BaFWWmmp.js → blockchain_data-BmbQdP_C.js} +2 -2
- package/dist/blockchain_data.js +3 -3
- package/dist/browser/checkout/sdk.js +4 -4
- package/dist/browser/checkout/widgets.js +850 -795
- package/dist/{checkout-CKRqIULK.js → checkout-B6gBhJWx.js} +5 -5
- package/dist/checkout.js +5 -5
- package/dist/{config-B_ISTQZV.js → config-QbGV-jxY.js} +1 -1
- package/dist/config.js +1 -1
- package/dist/{index-D9dR5BcM.js → index-08gcLjI3.js} +3 -3
- package/dist/{index-CNjk-TuX.js → index-BqES76q8.js} +1 -1
- package/dist/{index-DAmmcRLN.js → index-DK_xTGSI.js} +1 -1
- package/dist/{index-D2PZ-39Q.js → index-DLu9g736.js} +1 -1
- package/dist/{index-Bgkp5myq.js → index-DTd9zrBY.js} +4 -4
- package/dist/{index-DZSpHBQx.js → index-kFE9jNzl.js} +1 -1
- package/dist/index.browser.js +5 -5
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +60 -33
- package/dist/index.d.ts +2 -1
- package/dist/index.js +14 -14
- package/dist/{minting_backend-LhHkpcJK.js → minting_backend-Drblkmez.js} +3 -3
- package/dist/minting_backend.js +5 -5
- package/dist/{orderbook-Cs4et1cF.js → orderbook-CzoIIUYR.js} +1 -1
- package/dist/orderbook.js +2 -2
- package/dist/{passport-Bl5sHQzU.js → passport-DueWl0WJ.js} +56 -29
- package/dist/passport.d.ts +2 -1
- package/dist/passport.js +4 -4
- package/dist/{webhook-B1vSuX3x.js → webhook-BOOTRK5K.js} +1 -1
- package/dist/webhook.js +2 -2
- package/dist/{x-DDsEH-41.js → x-6mmW-KST.js} +3 -3
- package/dist/x.js +4 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -218,7 +218,7 @@ const flattenProperties$1 = (properties) => {
|
|
|
218
218
|
};
|
|
219
219
|
|
|
220
220
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
221
|
-
const SDK_VERSION$1 = '1.72.
|
|
221
|
+
const SDK_VERSION$1 = '1.72.2';
|
|
222
222
|
const getFrameParentDomain$1 = () => {
|
|
223
223
|
if (isNode$1()) {
|
|
224
224
|
return '';
|
|
@@ -15001,7 +15001,7 @@ class MultiRollupApiClients {
|
|
|
15001
15001
|
}
|
|
15002
15002
|
|
|
15003
15003
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
15004
|
-
const defaultHeaders$2 = { 'x-sdk-version': 'ts-immutable-sdk-1.72.
|
|
15004
|
+
const defaultHeaders$2 = { 'x-sdk-version': 'ts-immutable-sdk-1.72.2' };
|
|
15005
15005
|
const createConfig$1 = ({ basePath, headers, }) => {
|
|
15006
15006
|
if (!basePath.trim()) {
|
|
15007
15007
|
throw Error('basePath can not be empty');
|
|
@@ -15073,7 +15073,7 @@ class APIError extends Error {
|
|
|
15073
15073
|
|
|
15074
15074
|
/* eslint-disable implicit-arrow-linebreak */
|
|
15075
15075
|
const defaultHeaders$1 = {
|
|
15076
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.72.
|
|
15076
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.72.2',
|
|
15077
15077
|
};
|
|
15078
15078
|
/**
|
|
15079
15079
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -15663,7 +15663,7 @@ var blockchain_data = /*#__PURE__*/Object.freeze({
|
|
|
15663
15663
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
15664
15664
|
class ApiConfiguration extends index$2.Configuration {
|
|
15665
15665
|
}
|
|
15666
|
-
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.72.
|
|
15666
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.72.2' };
|
|
15667
15667
|
/**
|
|
15668
15668
|
* @dev use createImmutableXConfiguration instead
|
|
15669
15669
|
*/
|
|
@@ -15704,7 +15704,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
15704
15704
|
coreContractAddress,
|
|
15705
15705
|
registrationContractAddress,
|
|
15706
15706
|
registrationV4ContractAddress,
|
|
15707
|
-
sdkVersion: 'ts-immutable-sdk-1.72.
|
|
15707
|
+
sdkVersion: 'ts-immutable-sdk-1.72.2',
|
|
15708
15708
|
baseConfig,
|
|
15709
15709
|
});
|
|
15710
15710
|
const production = ({ baseConfig }) => createImmutableXConfiguration({
|
|
@@ -24346,6 +24346,7 @@ var PassportErrorType;
|
|
|
24346
24346
|
PassportErrorType["LINK_WALLET_VALIDATION_ERROR"] = "LINK_WALLET_VALIDATION_ERROR";
|
|
24347
24347
|
PassportErrorType["LINK_WALLET_DUPLICATE_NONCE_ERROR"] = "LINK_WALLET_DUPLICATE_NONCE_ERROR";
|
|
24348
24348
|
PassportErrorType["LINK_WALLET_GENERIC_ERROR"] = "LINK_WALLET_GENERIC_ERROR";
|
|
24349
|
+
PassportErrorType["SERVICE_UNAVAILABLE_ERROR"] = "SERVICE_UNAVAILABLE_ERROR";
|
|
24349
24350
|
})(PassportErrorType || (PassportErrorType = {}));
|
|
24350
24351
|
function isAPIError(error) {
|
|
24351
24352
|
return 'code' in error && 'message' in error;
|
|
@@ -24363,6 +24364,9 @@ const withPassportError = async (fn, customErrorType) => {
|
|
|
24363
24364
|
}
|
|
24364
24365
|
catch (error) {
|
|
24365
24366
|
let errorMessage;
|
|
24367
|
+
if (error instanceof PassportError && error.type === PassportErrorType.SERVICE_UNAVAILABLE_ERROR) {
|
|
24368
|
+
throw new PassportError(error.message, error.type);
|
|
24369
|
+
}
|
|
24366
24370
|
if (globalAxios.isAxiosError(error) && error.response?.data && isAPIError(error.response.data)) {
|
|
24367
24371
|
errorMessage = error.response.data.message;
|
|
24368
24372
|
}
|
|
@@ -26293,6 +26297,14 @@ class ConfirmationScreen {
|
|
|
26293
26297
|
this.showConfirmationScreen(href, messageHandler, resolve);
|
|
26294
26298
|
});
|
|
26295
26299
|
}
|
|
26300
|
+
showServiceUnavailable() {
|
|
26301
|
+
return new Promise((_, reject) => {
|
|
26302
|
+
this.showConfirmationScreen(this.getHref('unavailable'), () => { }, () => {
|
|
26303
|
+
this.closeWindow();
|
|
26304
|
+
reject(new Error('Service unavailable'));
|
|
26305
|
+
});
|
|
26306
|
+
});
|
|
26307
|
+
}
|
|
26296
26308
|
loading(popupOptions) {
|
|
26297
26309
|
if (this.config.crossSdkBridgeEnabled) {
|
|
26298
26310
|
// There is no need to open a confirmation window if cross-sdk bridge is enabled
|
|
@@ -26760,6 +26772,10 @@ class GuardianClient {
|
|
|
26760
26772
|
return await task();
|
|
26761
26773
|
}
|
|
26762
26774
|
catch (err) {
|
|
26775
|
+
if (err instanceof PassportError && err.type === PassportErrorType.SERVICE_UNAVAILABLE_ERROR) {
|
|
26776
|
+
await this.confirmationScreen.showServiceUnavailable();
|
|
26777
|
+
throw err;
|
|
26778
|
+
}
|
|
26763
26779
|
this.confirmationScreen.closeWindow();
|
|
26764
26780
|
throw err;
|
|
26765
26781
|
}
|
|
@@ -26769,36 +26785,44 @@ class GuardianClient {
|
|
|
26769
26785
|
return this.withConfirmationScreenTask()(task);
|
|
26770
26786
|
}
|
|
26771
26787
|
async evaluateImxTransaction({ payloadHash }) {
|
|
26772
|
-
|
|
26773
|
-
|
|
26774
|
-
|
|
26775
|
-
|
|
26776
|
-
|
|
26777
|
-
|
|
26778
|
-
|
|
26779
|
-
|
|
26780
|
-
}, { headers }), { finallyFn });
|
|
26781
|
-
if (!transactionRes.data.id) {
|
|
26782
|
-
throw new Error("Transaction doesn't exists");
|
|
26783
|
-
}
|
|
26784
|
-
const evaluateImxRes = await this.guardianApi.evaluateTransaction({
|
|
26785
|
-
id: payloadHash,
|
|
26786
|
-
transactionEvaluationRequest: {
|
|
26788
|
+
try {
|
|
26789
|
+
const finallyFn = () => {
|
|
26790
|
+
this.confirmationScreen.closeWindow();
|
|
26791
|
+
};
|
|
26792
|
+
const user = await this.authManager.getUserImx();
|
|
26793
|
+
const headers = { Authorization: `Bearer ${user.accessToken}` };
|
|
26794
|
+
const transactionRes = await retryWithDelay(async () => this.guardianApi.getTransactionByID({
|
|
26795
|
+
transactionID: payloadHash,
|
|
26787
26796
|
chainType: 'starkex',
|
|
26788
|
-
},
|
|
26789
|
-
|
|
26790
|
-
|
|
26791
|
-
if (confirmationRequired) {
|
|
26792
|
-
if (this.crossSdkBridgeEnabled) {
|
|
26793
|
-
throw new Error(transactionRejectedCrossSdkBridgeError);
|
|
26797
|
+
}, { headers }), { finallyFn });
|
|
26798
|
+
if (!transactionRes.data.id) {
|
|
26799
|
+
throw new Error("Transaction doesn't exists");
|
|
26794
26800
|
}
|
|
26795
|
-
const
|
|
26796
|
-
|
|
26797
|
-
|
|
26801
|
+
const evaluateImxRes = await this.guardianApi.evaluateTransaction({
|
|
26802
|
+
id: payloadHash,
|
|
26803
|
+
transactionEvaluationRequest: {
|
|
26804
|
+
chainType: 'starkex',
|
|
26805
|
+
},
|
|
26806
|
+
}, { headers });
|
|
26807
|
+
const { confirmationRequired } = evaluateImxRes.data;
|
|
26808
|
+
if (confirmationRequired) {
|
|
26809
|
+
if (this.crossSdkBridgeEnabled) {
|
|
26810
|
+
throw new Error(transactionRejectedCrossSdkBridgeError);
|
|
26811
|
+
}
|
|
26812
|
+
const confirmationResult = await this.confirmationScreen.requestConfirmation(payloadHash, user.imx.ethAddress, index$1.TransactionApprovalRequestChainTypeEnum.Starkex);
|
|
26813
|
+
if (!confirmationResult.confirmed) {
|
|
26814
|
+
throw new Error('Transaction rejected by user');
|
|
26815
|
+
}
|
|
26816
|
+
}
|
|
26817
|
+
else {
|
|
26818
|
+
this.confirmationScreen.closeWindow();
|
|
26798
26819
|
}
|
|
26799
26820
|
}
|
|
26800
|
-
|
|
26801
|
-
|
|
26821
|
+
catch (error) {
|
|
26822
|
+
if (globalAxios.isAxiosError(error) && error.response?.status === 403) {
|
|
26823
|
+
throw new PassportError('Service unavailable', PassportErrorType.SERVICE_UNAVAILABLE_ERROR);
|
|
26824
|
+
}
|
|
26825
|
+
throw error;
|
|
26802
26826
|
}
|
|
26803
26827
|
}
|
|
26804
26828
|
async evaluateEVMTransaction({ chainId, nonce, metaTransactions, }) {
|
|
@@ -26821,6 +26845,9 @@ class GuardianClient {
|
|
|
26821
26845
|
return response.data;
|
|
26822
26846
|
}
|
|
26823
26847
|
catch (error) {
|
|
26848
|
+
if (globalAxios.isAxiosError(error) && error.response?.status === 403) {
|
|
26849
|
+
throw new PassportError('Service unavailable', PassportErrorType.SERVICE_UNAVAILABLE_ERROR);
|
|
26850
|
+
}
|
|
26824
26851
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
26825
26852
|
throw new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, `Transaction failed to validate with error: ${errorMessage}`);
|
|
26826
26853
|
}
|
|
@@ -50434,7 +50461,7 @@ const flattenProperties = (properties) => {
|
|
|
50434
50461
|
};
|
|
50435
50462
|
|
|
50436
50463
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
50437
|
-
const SDK_VERSION = '1.72.
|
|
50464
|
+
const SDK_VERSION = '1.72.2';
|
|
50438
50465
|
const getFrameParentDomain = () => {
|
|
50439
50466
|
if (isNode()) {
|
|
50440
50467
|
return '';
|
|
@@ -55543,7 +55570,7 @@ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
|
|
|
55543
55570
|
maxPriorityFeePerGas: ethers.BigNumber.from(10e9),
|
|
55544
55571
|
};
|
|
55545
55572
|
|
|
55546
|
-
const SDK_VERSION_MARKER = '1.72.
|
|
55573
|
+
const SDK_VERSION_MARKER = '1.72.2';
|
|
55547
55574
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
55548
55575
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
55549
55576
|
|
package/dist/index.d.ts
CHANGED
|
@@ -16369,7 +16369,8 @@ declare enum PassportErrorType {
|
|
|
16369
16369
|
LINK_WALLET_MAX_WALLETS_LINKED_ERROR = "LINK_WALLET_MAX_WALLETS_LINKED_ERROR",
|
|
16370
16370
|
LINK_WALLET_VALIDATION_ERROR = "LINK_WALLET_VALIDATION_ERROR",
|
|
16371
16371
|
LINK_WALLET_DUPLICATE_NONCE_ERROR = "LINK_WALLET_DUPLICATE_NONCE_ERROR",
|
|
16372
|
-
LINK_WALLET_GENERIC_ERROR = "LINK_WALLET_GENERIC_ERROR"
|
|
16372
|
+
LINK_WALLET_GENERIC_ERROR = "LINK_WALLET_GENERIC_ERROR",
|
|
16373
|
+
SERVICE_UNAVAILABLE_ERROR = "SERVICE_UNAVAILABLE_ERROR"
|
|
16373
16374
|
}
|
|
16374
16375
|
declare class PassportError extends Error {
|
|
16375
16376
|
type: PassportErrorType;
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
export { c as config } from './config-
|
|
2
|
-
export { b as blockchainData } from './blockchain_data-
|
|
3
|
-
export { p as passport } from './passport-
|
|
4
|
-
export { o as orderbook } from './orderbook-
|
|
5
|
-
export { c as checkout } from './checkout-
|
|
6
|
-
export { x } from './x-
|
|
7
|
-
export { w as webhook } from './webhook-
|
|
8
|
-
export { m as mintingBackend } from './minting_backend-
|
|
9
|
-
import './index-
|
|
1
|
+
export { c as config } from './config-QbGV-jxY.js';
|
|
2
|
+
export { b as blockchainData } from './blockchain_data-BmbQdP_C.js';
|
|
3
|
+
export { p as passport } from './passport-DueWl0WJ.js';
|
|
4
|
+
export { o as orderbook } from './orderbook-CzoIIUYR.js';
|
|
5
|
+
export { c as checkout } from './checkout-B6gBhJWx.js';
|
|
6
|
+
export { x } from './x-6mmW-KST.js';
|
|
7
|
+
export { w as webhook } from './webhook-BOOTRK5K.js';
|
|
8
|
+
export { m as mintingBackend } from './minting_backend-Drblkmez.js';
|
|
9
|
+
import './index-DLu9g736.js';
|
|
10
10
|
import 'axios';
|
|
11
11
|
import 'lru-memorise';
|
|
12
12
|
import 'global-const';
|
|
13
|
-
import './index-
|
|
14
|
-
import './index-
|
|
15
|
-
import './index-
|
|
13
|
+
import './index-08gcLjI3.js';
|
|
14
|
+
import './index-BqES76q8.js';
|
|
15
|
+
import './index-DTd9zrBY.js';
|
|
16
16
|
import '@ethersproject/keccak256';
|
|
17
17
|
import '@ethersproject/strings';
|
|
18
18
|
import 'bn.js';
|
|
@@ -35,7 +35,7 @@ import 'events';
|
|
|
35
35
|
import '@0xsequence/abi';
|
|
36
36
|
import '@0xsequence/core';
|
|
37
37
|
import 'uuid';
|
|
38
|
-
import './index-
|
|
38
|
+
import './index-DK_xTGSI.js';
|
|
39
39
|
import 'form-data';
|
|
40
40
|
import '@opensea/seaport-js/lib/constants';
|
|
41
41
|
import 'ethers-v6';
|
|
@@ -49,5 +49,5 @@ import '@metamask/detect-provider';
|
|
|
49
49
|
import 'semver';
|
|
50
50
|
import '@ethersproject/units';
|
|
51
51
|
import '@ethersproject/bignumber';
|
|
52
|
-
import './index-
|
|
52
|
+
import './index-kFE9jNzl.js';
|
|
53
53
|
import 'sns-validator';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { B as BlockchainData } from './index-
|
|
2
|
-
import { h as handle } from './index-
|
|
3
|
-
import { t as track, e as setEnvironment, f as setPublishableApiKey } from './index-
|
|
1
|
+
import { B as BlockchainData } from './index-08gcLjI3.js';
|
|
2
|
+
import { h as handle } from './index-kFE9jNzl.js';
|
|
3
|
+
import { t as track, e as setEnvironment, f as setPublishableApiKey } from './index-DLu9g736.js';
|
|
4
4
|
|
|
5
5
|
const moduleName = 'minting_backend_sdk';
|
|
6
6
|
const trackInitializePersistencePG = () => {
|
package/dist/minting_backend.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { M as MintingBackendModule, a as mintingPersistencePg, b as mintingPersistencePrismaSqlite, p as processMint, r as recordMint, s as submitMintingRequests } from './minting_backend-
|
|
2
|
-
import './index-
|
|
3
|
-
import './index-
|
|
1
|
+
export { M as MintingBackendModule, a as mintingPersistencePg, b as mintingPersistencePrismaSqlite, p as processMint, r as recordMint, s as submitMintingRequests } from './minting_backend-Drblkmez.js';
|
|
2
|
+
import './index-08gcLjI3.js';
|
|
3
|
+
import './index-BqES76q8.js';
|
|
4
4
|
import 'axios';
|
|
5
|
-
import './index-
|
|
5
|
+
import './index-DLu9g736.js';
|
|
6
6
|
import 'lru-memorise';
|
|
7
7
|
import 'global-const';
|
|
8
|
-
import './index-
|
|
8
|
+
import './index-kFE9jNzl.js';
|
|
9
9
|
import 'sns-validator';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as ActionType, F as FeeType, O as OrderStatusName, a as Orderbook, S as SignablePurpose, T as TransactionPurpose, c as constants } from './index-
|
|
1
|
+
import { A as ActionType, F as FeeType, O as OrderStatusName, a as Orderbook, S as SignablePurpose, T as TransactionPurpose, c as constants } from './index-DK_xTGSI.js';
|
|
2
2
|
|
|
3
3
|
var orderbook = /*#__PURE__*/Object.freeze({
|
|
4
4
|
__proto__: null,
|
package/dist/orderbook.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { A as ActionType, F as FeeType, O as OrderStatusName, a as Orderbook, S as SignablePurpose, T as TransactionPurpose, c as constants } from './index-
|
|
2
|
-
import './index-
|
|
1
|
+
export { A as ActionType, F as FeeType, O as OrderStatusName, a as Orderbook, S as SignablePurpose, T as TransactionPurpose, c as constants } from './index-DK_xTGSI.js';
|
|
2
|
+
import './index-DLu9g736.js';
|
|
3
3
|
import 'axios';
|
|
4
4
|
import 'lru-memorise';
|
|
5
5
|
import 'global-const';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import globalAxios, { isAxiosError } from 'axios';
|
|
2
|
-
import { M as MultiRollupApiClients, c as createConfig, m as multiRollupConfig, a as index$1, I as ImxApiClients, b as imxApiConfig } from './index-
|
|
3
|
-
import { I as IMXClient, s as signRaw, c as convertToSignableToken, g as generateLegacyStarkPrivateKey, a as createStarkSigner } from './index-
|
|
4
|
-
import { s as setPassportClientId, t as track, b as trackFlow, c as trackError, u as utils, i as identify, g as getDetail, D as Detail, d as trackDuration, E as Environment } from './index-
|
|
2
|
+
import { M as MultiRollupApiClients, c as createConfig, m as multiRollupConfig, a as index$1, I as ImxApiClients, b as imxApiConfig } from './index-BqES76q8.js';
|
|
3
|
+
import { I as IMXClient, s as signRaw, c as convertToSignableToken, g as generateLegacyStarkPrivateKey, a as createStarkSigner } from './index-DTd9zrBY.js';
|
|
4
|
+
import { s as setPassportClientId, t as track, b as trackFlow, c as trackError, u as utils, i as identify, g as getDetail, D as Detail, d as trackDuration, E as Environment } from './index-DLu9g736.js';
|
|
5
5
|
import { UserManager, User, ErrorTimeout, ErrorResponse, InMemoryWebStorage, WebStorageStateStore } from 'oidc-client-ts';
|
|
6
6
|
import * as crypto from 'crypto';
|
|
7
7
|
import jwt_decode from 'jwt-decode';
|
|
@@ -37,6 +37,7 @@ var PassportErrorType;
|
|
|
37
37
|
PassportErrorType["LINK_WALLET_VALIDATION_ERROR"] = "LINK_WALLET_VALIDATION_ERROR";
|
|
38
38
|
PassportErrorType["LINK_WALLET_DUPLICATE_NONCE_ERROR"] = "LINK_WALLET_DUPLICATE_NONCE_ERROR";
|
|
39
39
|
PassportErrorType["LINK_WALLET_GENERIC_ERROR"] = "LINK_WALLET_GENERIC_ERROR";
|
|
40
|
+
PassportErrorType["SERVICE_UNAVAILABLE_ERROR"] = "SERVICE_UNAVAILABLE_ERROR";
|
|
40
41
|
})(PassportErrorType || (PassportErrorType = {}));
|
|
41
42
|
function isAPIError(error) {
|
|
42
43
|
return 'code' in error && 'message' in error;
|
|
@@ -54,6 +55,9 @@ const withPassportError = async (fn, customErrorType) => {
|
|
|
54
55
|
}
|
|
55
56
|
catch (error) {
|
|
56
57
|
let errorMessage;
|
|
58
|
+
if (error instanceof PassportError && error.type === PassportErrorType.SERVICE_UNAVAILABLE_ERROR) {
|
|
59
|
+
throw new PassportError(error.message, error.type);
|
|
60
|
+
}
|
|
57
61
|
if (isAxiosError(error) && error.response?.data && isAPIError(error.response.data)) {
|
|
58
62
|
errorMessage = error.response.data.message;
|
|
59
63
|
}
|
|
@@ -1984,6 +1988,14 @@ class ConfirmationScreen {
|
|
|
1984
1988
|
this.showConfirmationScreen(href, messageHandler, resolve);
|
|
1985
1989
|
});
|
|
1986
1990
|
}
|
|
1991
|
+
showServiceUnavailable() {
|
|
1992
|
+
return new Promise((_, reject) => {
|
|
1993
|
+
this.showConfirmationScreen(this.getHref('unavailable'), () => { }, () => {
|
|
1994
|
+
this.closeWindow();
|
|
1995
|
+
reject(new Error('Service unavailable'));
|
|
1996
|
+
});
|
|
1997
|
+
});
|
|
1998
|
+
}
|
|
1987
1999
|
loading(popupOptions) {
|
|
1988
2000
|
if (this.config.crossSdkBridgeEnabled) {
|
|
1989
2001
|
// There is no need to open a confirmation window if cross-sdk bridge is enabled
|
|
@@ -2451,6 +2463,10 @@ class GuardianClient {
|
|
|
2451
2463
|
return await task();
|
|
2452
2464
|
}
|
|
2453
2465
|
catch (err) {
|
|
2466
|
+
if (err instanceof PassportError && err.type === PassportErrorType.SERVICE_UNAVAILABLE_ERROR) {
|
|
2467
|
+
await this.confirmationScreen.showServiceUnavailable();
|
|
2468
|
+
throw err;
|
|
2469
|
+
}
|
|
2454
2470
|
this.confirmationScreen.closeWindow();
|
|
2455
2471
|
throw err;
|
|
2456
2472
|
}
|
|
@@ -2460,36 +2476,44 @@ class GuardianClient {
|
|
|
2460
2476
|
return this.withConfirmationScreenTask()(task);
|
|
2461
2477
|
}
|
|
2462
2478
|
async evaluateImxTransaction({ payloadHash }) {
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
}, { headers }), { finallyFn });
|
|
2472
|
-
if (!transactionRes.data.id) {
|
|
2473
|
-
throw new Error("Transaction doesn't exists");
|
|
2474
|
-
}
|
|
2475
|
-
const evaluateImxRes = await this.guardianApi.evaluateTransaction({
|
|
2476
|
-
id: payloadHash,
|
|
2477
|
-
transactionEvaluationRequest: {
|
|
2479
|
+
try {
|
|
2480
|
+
const finallyFn = () => {
|
|
2481
|
+
this.confirmationScreen.closeWindow();
|
|
2482
|
+
};
|
|
2483
|
+
const user = await this.authManager.getUserImx();
|
|
2484
|
+
const headers = { Authorization: `Bearer ${user.accessToken}` };
|
|
2485
|
+
const transactionRes = await retryWithDelay(async () => this.guardianApi.getTransactionByID({
|
|
2486
|
+
transactionID: payloadHash,
|
|
2478
2487
|
chainType: 'starkex',
|
|
2479
|
-
},
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
if (confirmationRequired) {
|
|
2483
|
-
if (this.crossSdkBridgeEnabled) {
|
|
2484
|
-
throw new Error(transactionRejectedCrossSdkBridgeError);
|
|
2488
|
+
}, { headers }), { finallyFn });
|
|
2489
|
+
if (!transactionRes.data.id) {
|
|
2490
|
+
throw new Error("Transaction doesn't exists");
|
|
2485
2491
|
}
|
|
2486
|
-
const
|
|
2487
|
-
|
|
2488
|
-
|
|
2492
|
+
const evaluateImxRes = await this.guardianApi.evaluateTransaction({
|
|
2493
|
+
id: payloadHash,
|
|
2494
|
+
transactionEvaluationRequest: {
|
|
2495
|
+
chainType: 'starkex',
|
|
2496
|
+
},
|
|
2497
|
+
}, { headers });
|
|
2498
|
+
const { confirmationRequired } = evaluateImxRes.data;
|
|
2499
|
+
if (confirmationRequired) {
|
|
2500
|
+
if (this.crossSdkBridgeEnabled) {
|
|
2501
|
+
throw new Error(transactionRejectedCrossSdkBridgeError);
|
|
2502
|
+
}
|
|
2503
|
+
const confirmationResult = await this.confirmationScreen.requestConfirmation(payloadHash, user.imx.ethAddress, index$1.TransactionApprovalRequestChainTypeEnum.Starkex);
|
|
2504
|
+
if (!confirmationResult.confirmed) {
|
|
2505
|
+
throw new Error('Transaction rejected by user');
|
|
2506
|
+
}
|
|
2507
|
+
}
|
|
2508
|
+
else {
|
|
2509
|
+
this.confirmationScreen.closeWindow();
|
|
2489
2510
|
}
|
|
2490
2511
|
}
|
|
2491
|
-
|
|
2492
|
-
|
|
2512
|
+
catch (error) {
|
|
2513
|
+
if (globalAxios.isAxiosError(error) && error.response?.status === 403) {
|
|
2514
|
+
throw new PassportError('Service unavailable', PassportErrorType.SERVICE_UNAVAILABLE_ERROR);
|
|
2515
|
+
}
|
|
2516
|
+
throw error;
|
|
2493
2517
|
}
|
|
2494
2518
|
}
|
|
2495
2519
|
async evaluateEVMTransaction({ chainId, nonce, metaTransactions, }) {
|
|
@@ -2512,6 +2536,9 @@ class GuardianClient {
|
|
|
2512
2536
|
return response.data;
|
|
2513
2537
|
}
|
|
2514
2538
|
catch (error) {
|
|
2539
|
+
if (globalAxios.isAxiosError(error) && error.response?.status === 403) {
|
|
2540
|
+
throw new PassportError('Service unavailable', PassportErrorType.SERVICE_UNAVAILABLE_ERROR);
|
|
2541
|
+
}
|
|
2515
2542
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
2516
2543
|
throw new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, `Transaction failed to validate with error: ${errorMessage}`);
|
|
2517
2544
|
}
|
package/dist/passport.d.ts
CHANGED
|
@@ -9982,7 +9982,8 @@ declare enum PassportErrorType {
|
|
|
9982
9982
|
LINK_WALLET_MAX_WALLETS_LINKED_ERROR = "LINK_WALLET_MAX_WALLETS_LINKED_ERROR",
|
|
9983
9983
|
LINK_WALLET_VALIDATION_ERROR = "LINK_WALLET_VALIDATION_ERROR",
|
|
9984
9984
|
LINK_WALLET_DUPLICATE_NONCE_ERROR = "LINK_WALLET_DUPLICATE_NONCE_ERROR",
|
|
9985
|
-
LINK_WALLET_GENERIC_ERROR = "LINK_WALLET_GENERIC_ERROR"
|
|
9985
|
+
LINK_WALLET_GENERIC_ERROR = "LINK_WALLET_GENERIC_ERROR",
|
|
9986
|
+
SERVICE_UNAVAILABLE_ERROR = "SERVICE_UNAVAILABLE_ERROR"
|
|
9986
9987
|
}
|
|
9987
9988
|
declare class PassportError extends Error {
|
|
9988
9989
|
type: PassportErrorType;
|
package/dist/passport.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { J as JsonRpcError, P as Passport, a as PassportError, b as ProviderErrorCode, c as ProviderEvent, R as RpcErrorCode } from './passport-
|
|
1
|
+
export { J as JsonRpcError, P as Passport, a as PassportError, b as ProviderErrorCode, c as ProviderEvent, R as RpcErrorCode } from './passport-DueWl0WJ.js';
|
|
2
2
|
import 'axios';
|
|
3
|
-
import './index-
|
|
4
|
-
import './index-
|
|
5
|
-
import './index-
|
|
3
|
+
import './index-BqES76q8.js';
|
|
4
|
+
import './index-DTd9zrBY.js';
|
|
5
|
+
import './index-DLu9g736.js';
|
|
6
6
|
import 'lru-memorise';
|
|
7
7
|
import 'global-const';
|
|
8
8
|
import '@ethersproject/keccak256';
|
package/dist/webhook.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { b as ImxConfiguration, c as convertToSignableToken, s as signRaw, e as exportContracts, d as signMessage, E as EncodingApi, M as MintsApi, f as signRegisterEthAddress, A as ApiConfiguration, h as AssetsApi, B as BalancesApi, C as CollectionsApi, D as DepositsApi, i as ExchangesApi, I as IMXClient, j as IMXError, k as ImmutableX, l as MetadataApi, m as MetadataRefreshesApi, n as MetadataSchemaRequestTypeEnum, N as NftCheckoutPrimaryApi, O as OrdersApi, P as ProjectsApi, T as TokensApi, o as TradesApi, p as TransfersApi, U as UsersApi, W as WithdrawalsApi, q as createConfig, r as createImmutableXConfiguration, a as createStarkSigner, g as generateLegacyStarkPrivateKey, t as generateStarkPrivateKey, u as imxClientConfig, v as production, w as sandbox, x as serializePackedSignature, y as starkEcOrder } from './index-
|
|
2
|
-
import { d as index$2 } from './index-
|
|
1
|
+
import { b as ImxConfiguration, c as convertToSignableToken, s as signRaw, e as exportContracts, d as signMessage, E as EncodingApi, M as MintsApi, f as signRegisterEthAddress, A as ApiConfiguration, h as AssetsApi, B as BalancesApi, C as CollectionsApi, D as DepositsApi, i as ExchangesApi, I as IMXClient, j as IMXError, k as ImmutableX, l as MetadataApi, m as MetadataRefreshesApi, n as MetadataSchemaRequestTypeEnum, N as NftCheckoutPrimaryApi, O as OrdersApi, P as ProjectsApi, T as TokensApi, o as TradesApi, p as TransfersApi, U as UsersApi, W as WithdrawalsApi, q as createConfig, r as createImmutableXConfiguration, a as createStarkSigner, g as generateLegacyStarkPrivateKey, t as generateStarkPrivateKey, u as imxClientConfig, v as production, w as sandbox, x as serializePackedSignature, y as starkEcOrder } from './index-DTd9zrBY.js';
|
|
2
|
+
import { d as index$2 } from './index-BqES76q8.js';
|
|
3
3
|
import { isAxiosError } from 'axios';
|
|
4
4
|
import * as encUtils from 'enc-utils';
|
|
5
5
|
import { parseUnits } from '@ethersproject/units';
|
|
6
6
|
import { BigNumber } from '@ethersproject/bignumber';
|
|
7
7
|
import { ethers } from 'ethers';
|
|
8
8
|
import detectEthereumProvider from '@metamask/detect-provider';
|
|
9
|
-
import { E as Environment, I as ImmutableConfiguration } from './index-
|
|
9
|
+
import { E as Environment, I as ImmutableConfiguration } from './index-DLu9g736.js';
|
|
10
10
|
import { Signer } from '@ethersproject/abstract-signer';
|
|
11
11
|
|
|
12
12
|
function isChainValid(chainID, config) {
|
package/dist/x.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { A as ApiConfiguration, h as AssetsApi, B as BalancesApi, C as CollectionsApi, e as Contracts, D as DepositsApi, E as EncodingApi, i as ExchangesApi, I as IMXClient, j as IMXError, k as ImmutableX, b as ImxConfiguration, l as MetadataApi, m as MetadataRefreshesApi, n as MetadataSchemaRequestTypeEnum, M as MintsApi, N as NftCheckoutPrimaryApi, O as OrdersApi, P as ProjectsApi, T as TokensApi, o as TradesApi, p as TransfersApi, U as UsersApi, W as WithdrawalsApi, q as createConfig, r as createImmutableXConfiguration, a as createStarkSigner, g as generateLegacyStarkPrivateKey, t as generateStarkPrivateKey, u as imxClientConfig, a as imxClientCreateStarkSigner, g as imxClientGenerateLegacyStarkPrivateKey, v as production, w as sandbox, x as serializePackedSignature, f as signRegisterEthAddress, y as starkEcOrder } from './index-
|
|
2
|
-
export { G as GenericIMXProvider, M as MetaMaskIMXProvider, P as ProviderConfiguration } from './x-
|
|
3
|
-
export { E as Environment, I as ImmutableConfiguration } from './index-
|
|
1
|
+
export { A as ApiConfiguration, h as AssetsApi, B as BalancesApi, C as CollectionsApi, e as Contracts, D as DepositsApi, E as EncodingApi, i as ExchangesApi, I as IMXClient, j as IMXError, k as ImmutableX, b as ImxConfiguration, l as MetadataApi, m as MetadataRefreshesApi, n as MetadataSchemaRequestTypeEnum, M as MintsApi, N as NftCheckoutPrimaryApi, O as OrdersApi, P as ProjectsApi, T as TokensApi, o as TradesApi, p as TransfersApi, U as UsersApi, W as WithdrawalsApi, q as createConfig, r as createImmutableXConfiguration, a as createStarkSigner, g as generateLegacyStarkPrivateKey, t as generateStarkPrivateKey, u as imxClientConfig, a as imxClientCreateStarkSigner, g as imxClientGenerateLegacyStarkPrivateKey, v as production, w as sandbox, x as serializePackedSignature, f as signRegisterEthAddress, y as starkEcOrder } from './index-DTd9zrBY.js';
|
|
2
|
+
export { G as GenericIMXProvider, M as MetaMaskIMXProvider, P as ProviderConfiguration } from './x-6mmW-KST.js';
|
|
3
|
+
export { E as Environment, I as ImmutableConfiguration } from './index-DLu9g736.js';
|
|
4
4
|
export { Signer as EthSigner } from '@ethersproject/abstract-signer';
|
|
5
|
-
import './index-
|
|
5
|
+
import './index-BqES76q8.js';
|
|
6
6
|
import 'axios';
|
|
7
7
|
import '@ethersproject/keccak256';
|
|
8
8
|
import '@ethersproject/strings';
|
package/package.json
CHANGED