@imtbl/sdk 1.13.0 → 1.13.2-alpha.1
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.d.ts +1 -13
- package/dist/blockchain_data.js +4 -3
- package/dist/browser/checkout/{BridgeWidget-a0216abf.js → BridgeWidget-feb6e244.js} +1 -1
- package/dist/browser/checkout/{OnRampWidget-0141412f.js → OnRampWidget-bf7b0285.js} +1 -1
- package/dist/browser/checkout/SaleWidget-8bbac84d.js +2 -0
- package/dist/browser/checkout/{SpendingCapHero-f00c162d.js → SpendingCapHero-cc97026e.js} +1 -1
- package/dist/browser/checkout/{SwapWidget-7dd7ae0d.js → SwapWidget-411d726b.js} +1 -1
- package/dist/browser/checkout/{TopUpView-83b01082.js → TopUpView-62c3bb1c.js} +1 -1
- package/dist/browser/checkout/{WalletWidget-a7294770.js → WalletWidget-da4cd5a6.js} +1 -1
- package/dist/browser/checkout/{auto-track-a6ee7728.js → auto-track-42ec91ae.js} +1 -1
- package/dist/browser/checkout/{balance-cab05497.js → balance-0e3acb15.js} +1 -1
- package/dist/browser/checkout/{index-e06cc1d2.js → index-0face9fc.js} +1 -1
- package/dist/browser/checkout/{index-57f03d43.js → index-1383cc81.js} +2 -2
- package/dist/browser/checkout/{index-fb6525df.js → index-2a04a2f2.js} +1 -1
- package/dist/browser/checkout/{index-a53ae4b9.js → index-4ceb8896.js} +1 -1
- package/dist/browser/checkout/index-4eeff6a1.js +1 -0
- package/dist/browser/checkout/{index-f13a14b5.js → index-6b30a04c.js} +1 -1
- package/dist/browser/checkout/{index-51cb702e.js → index-912bd43f.js} +1 -1
- package/dist/browser/checkout/{index-b10fea31.js → index-a4e5665c.js} +1 -1
- package/dist/browser/checkout/{index.umd-ebf23be8.js → index.umd-22e11686.js} +1 -1
- package/dist/browser/checkout/{retry-242a2c60.js → retry-4271fac2.js} +1 -1
- package/dist/browser/checkout/sdk.js +7 -7
- package/dist/browser/checkout/{useTransakEvents-4a36b909.js → useTransakEvents-4f11a227.js} +1 -1
- package/dist/browser/checkout/widgets-esm.js +1 -1
- package/dist/browser/checkout/widgets.js +60 -60
- package/dist/checkout.d.ts +1 -13
- package/dist/checkout.js +6 -5
- package/dist/config.d.ts +2 -17
- package/dist/config.js +3 -21
- package/dist/index.browser.js +13 -13
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +89 -79
- package/dist/index.d.ts +1 -22
- package/dist/index.js +90 -80
- package/dist/orderbook.d.ts +1 -13
- package/dist/orderbook.js +1 -1
- package/dist/passport.d.ts +1 -13
- package/dist/passport.js +85 -54
- package/dist/x.d.ts +1 -13
- package/dist/x.js +2 -2
- package/package.json +1 -1
- package/dist/browser/checkout/SaleWidget-dfb3ec06.js +0 -2
- package/dist/browser/checkout/index-1c0cb426.js +0 -1
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import { JsonRpcProvider, Web3Provider } from '@ethersproject/providers';
|
|
|
11
11
|
import BN$2 from 'bn.js';
|
|
12
12
|
import * as encUtils from 'enc-utils';
|
|
13
13
|
import { EventEmitter } from 'events';
|
|
14
|
-
import { BigNumber as BigNumber$1,
|
|
14
|
+
import { BigNumber as BigNumber$1, Contract as Contract$1, errors, utils as utils$3, ethers, constants as constants$1, providers, ContractFactory } from 'ethers';
|
|
15
15
|
import { walletContracts } from '@0xsequence/abi';
|
|
16
16
|
import { v1 } from '@0xsequence/core';
|
|
17
17
|
import FormData$2 from 'form-data';
|
|
@@ -152,7 +152,7 @@ const flattenProperties$1 = (properties) => {
|
|
|
152
152
|
};
|
|
153
153
|
|
|
154
154
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
155
|
-
const SDK_VERSION$1 = '1.13.
|
|
155
|
+
const SDK_VERSION$1 = '1.13.2-alpha.1';
|
|
156
156
|
const getReferrer$1 = () => {
|
|
157
157
|
if (isNode$1()) {
|
|
158
158
|
return '';
|
|
@@ -388,6 +388,7 @@ const addKeysToHeadersOverride = (baseConfig, overrides) => {
|
|
|
388
388
|
}
|
|
389
389
|
if (baseConfig.publishableKey) {
|
|
390
390
|
newHeaders[KeyHeaders$1.PUBLISHABLE_KEY] = baseConfig.publishableKey;
|
|
391
|
+
setPublishableApiKey(baseConfig.publishableKey);
|
|
391
392
|
}
|
|
392
393
|
if (baseConfig.rateLimitingKey) {
|
|
393
394
|
newHeaders[KeyHeaders$1.RATE_LIMITING_KEY] = baseConfig.rateLimitingKey;
|
|
@@ -407,35 +408,13 @@ const addKeysToHeadersOverride = (baseConfig, overrides) => {
|
|
|
407
408
|
headers: newHeaders,
|
|
408
409
|
};
|
|
409
410
|
};
|
|
410
|
-
const API_KEY_PREFIX = 'sk_imapik-';
|
|
411
|
-
const PUBLISHABLE_KEY_PREFIX$1 = 'pk_imapik-';
|
|
412
|
-
const addApiKeyToAxiosHeader = (apiKey) => {
|
|
413
|
-
if (!apiKey.startsWith(API_KEY_PREFIX)) {
|
|
414
|
-
throw new Error('Invalid API key. Create your api key in Immutable developer hub. https://hub.immutable.com');
|
|
415
|
-
}
|
|
416
|
-
globalAxios$1.defaults.headers.common[KeyHeaders$1.API_KEY] = apiKey;
|
|
417
|
-
};
|
|
418
|
-
const addPublishableKeyToAxiosHeader = (publishableKey) => {
|
|
419
|
-
if (!publishableKey.startsWith(PUBLISHABLE_KEY_PREFIX$1)) {
|
|
420
|
-
throw new Error('Invalid Publishable key. Create your Publishable key in Immutable developer hub.'
|
|
421
|
-
+ ' https://hub.immutable.com');
|
|
422
|
-
}
|
|
423
|
-
setPublishableApiKey(publishableKey);
|
|
424
|
-
globalAxios$1.defaults.headers.common[KeyHeaders$1.PUBLISHABLE_KEY] = publishableKey;
|
|
425
|
-
};
|
|
426
|
-
const addRateLimitingKeyToAxiosHeader = (rateLimitingKey) => {
|
|
427
|
-
globalAxios$1.defaults.headers.common[KeyHeaders$1.RATE_LIMITING_KEY] = rateLimitingKey;
|
|
428
|
-
};
|
|
429
411
|
|
|
430
412
|
var config = /*#__PURE__*/Object.freeze({
|
|
431
413
|
__proto__: null,
|
|
432
414
|
get Environment () { return Environment$1; },
|
|
433
415
|
ImmutableConfiguration: ImmutableConfiguration,
|
|
434
416
|
get KeyHeaders () { return KeyHeaders$1; },
|
|
435
|
-
|
|
436
|
-
addKeysToHeadersOverride: addKeysToHeadersOverride,
|
|
437
|
-
addPublishableKeyToAxiosHeader: addPublishableKeyToAxiosHeader,
|
|
438
|
-
addRateLimitingKeyToAxiosHeader: addRateLimitingKeyToAxiosHeader
|
|
417
|
+
addKeysToHeadersOverride: addKeysToHeadersOverride
|
|
439
418
|
});
|
|
440
419
|
|
|
441
420
|
/* tslint:disable */
|
|
@@ -11549,7 +11528,7 @@ class MultiRollupApiClients {
|
|
|
11549
11528
|
}
|
|
11550
11529
|
|
|
11551
11530
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
11552
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-1.13.
|
|
11531
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-1.13.2-alpha.1' };
|
|
11553
11532
|
const createConfig = ({ basePath, headers, }) => {
|
|
11554
11533
|
if (!basePath.trim()) {
|
|
11555
11534
|
throw Error('basePath can not be empty');
|
|
@@ -11621,7 +11600,7 @@ class APIError extends Error {
|
|
|
11621
11600
|
|
|
11622
11601
|
/* eslint-disable implicit-arrow-linebreak */
|
|
11623
11602
|
const defaultHeaders = {
|
|
11624
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.13.
|
|
11603
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.13.2-alpha.1',
|
|
11625
11604
|
};
|
|
11626
11605
|
/**
|
|
11627
11606
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -12104,7 +12083,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
12104
12083
|
chainID,
|
|
12105
12084
|
coreContractAddress,
|
|
12106
12085
|
registrationContractAddress,
|
|
12107
|
-
sdkVersion: 'ts-immutable-sdk-1.13.
|
|
12086
|
+
sdkVersion: 'ts-immutable-sdk-1.13.2-alpha.1',
|
|
12108
12087
|
});
|
|
12109
12088
|
/**
|
|
12110
12089
|
* Sets `sdkVersion` at the time of build
|
|
@@ -16710,6 +16689,17 @@ class DeviceCredentialsManager {
|
|
|
16710
16689
|
}
|
|
16711
16690
|
}
|
|
16712
16691
|
|
|
16692
|
+
const shouldLog = process?.env?.JEST_WORKER_ID === undefined;
|
|
16693
|
+
const warn = (...args) => {
|
|
16694
|
+
if (shouldLog) {
|
|
16695
|
+
// eslint-disable-next-line no-console
|
|
16696
|
+
console.warn(...args);
|
|
16697
|
+
}
|
|
16698
|
+
};
|
|
16699
|
+
var logger$f = {
|
|
16700
|
+
warn,
|
|
16701
|
+
};
|
|
16702
|
+
|
|
16713
16703
|
function isIdTokenExpired(idToken) {
|
|
16714
16704
|
if (!idToken) {
|
|
16715
16705
|
return false;
|
|
@@ -16872,8 +16862,7 @@ class AuthManager {
|
|
|
16872
16862
|
user = await this.getUser();
|
|
16873
16863
|
}
|
|
16874
16864
|
catch (err) {
|
|
16875
|
-
|
|
16876
|
-
console.warn('failed to retrieve a cached user session:', err);
|
|
16865
|
+
logger$f.warn('Failed to retrieve a cached user session', err);
|
|
16877
16866
|
}
|
|
16878
16867
|
return user || this.login();
|
|
16879
16868
|
}
|
|
@@ -17017,8 +17006,7 @@ class AuthManager {
|
|
|
17017
17006
|
}
|
|
17018
17007
|
forceUserRefreshInBackground() {
|
|
17019
17008
|
this.refreshTokenAndUpdatePromise().catch((error) => {
|
|
17020
|
-
|
|
17021
|
-
console.warn('Failed to refresh user token', error);
|
|
17009
|
+
logger$f.warn('Failed to refresh user token', error);
|
|
17022
17010
|
});
|
|
17023
17011
|
}
|
|
17024
17012
|
async forceUserRefresh() {
|
|
@@ -17519,7 +17507,7 @@ async function registerOffchain$1(userAdminKeySigner, starkSigner, unregisteredU
|
|
|
17519
17507
|
return response;
|
|
17520
17508
|
}
|
|
17521
17509
|
catch (err) {
|
|
17522
|
-
if (globalAxios$1.isAxiosError(err) && err.status === 409) {
|
|
17510
|
+
if (globalAxios$1.isAxiosError(err) && err.response?.status === 409) {
|
|
17523
17511
|
// The user already registered, but the user token is not updated yet.
|
|
17524
17512
|
await forceUserRefresh(authManager);
|
|
17525
17513
|
return { tx_hash: '' };
|
|
@@ -17538,8 +17526,8 @@ class PassportImxProvider {
|
|
|
17538
17526
|
/**
|
|
17539
17527
|
* This property is set during initialisation and stores the signers in a promise.
|
|
17540
17528
|
* This property is not meant to be accessed directly, but through the
|
|
17541
|
-
* `
|
|
17542
|
-
* @see
|
|
17529
|
+
* `#getSigners` method.
|
|
17530
|
+
* @see #getSigners
|
|
17543
17531
|
*/
|
|
17544
17532
|
signers;
|
|
17545
17533
|
signerInitialisationError;
|
|
@@ -17549,7 +17537,7 @@ class PassportImxProvider {
|
|
|
17549
17537
|
this.magicAdapter = magicAdapter;
|
|
17550
17538
|
this.imxApiClients = imxApiClients;
|
|
17551
17539
|
this.guardianClient = guardianClient;
|
|
17552
|
-
this
|
|
17540
|
+
this.#initialiseSigners();
|
|
17553
17541
|
passportEventEmitter.on(PassportEvents.LOGGED_OUT, this.handleLogout);
|
|
17554
17542
|
}
|
|
17555
17543
|
handleLogout = () => {
|
|
@@ -17564,10 +17552,10 @@ class PassportImxProvider {
|
|
|
17564
17552
|
* so that it doesn't result in an unhandled promise rejection.
|
|
17565
17553
|
*
|
|
17566
17554
|
* This error is thrown when the signers are requested through:
|
|
17567
|
-
* @see
|
|
17555
|
+
* @see #getSigners
|
|
17568
17556
|
*
|
|
17569
17557
|
*/
|
|
17570
|
-
initialiseSigners() {
|
|
17558
|
+
#initialiseSigners() {
|
|
17571
17559
|
const generateSigners = async () => {
|
|
17572
17560
|
const user = await this.authManager.getUser();
|
|
17573
17561
|
// The user will be present because the factory validates it
|
|
@@ -17589,11 +17577,14 @@ class PassportImxProvider {
|
|
|
17589
17577
|
}
|
|
17590
17578
|
});
|
|
17591
17579
|
}
|
|
17592
|
-
async
|
|
17580
|
+
async #getAuthenticatedUser() {
|
|
17593
17581
|
const user = await this.authManager.getUser();
|
|
17594
17582
|
if (!user || !this.signers) {
|
|
17595
17583
|
throw new PassportError('User has been logged out', PassportErrorType.NOT_LOGGED_IN_ERROR);
|
|
17596
17584
|
}
|
|
17585
|
+
return user;
|
|
17586
|
+
}
|
|
17587
|
+
async #getSigners() {
|
|
17597
17588
|
const signers = await this.signers;
|
|
17598
17589
|
// Throw the stored error if the signers failed to initialise
|
|
17599
17590
|
if (typeof signers === 'undefined') {
|
|
@@ -17602,17 +17593,24 @@ class PassportImxProvider {
|
|
|
17602
17593
|
}
|
|
17603
17594
|
throw new Error('Signers failed to initialise');
|
|
17604
17595
|
}
|
|
17605
|
-
return
|
|
17596
|
+
return signers;
|
|
17606
17597
|
}
|
|
17607
|
-
async getRegisteredImxUserAndSigners() {
|
|
17608
|
-
const
|
|
17598
|
+
async #getRegisteredImxUserAndSigners() {
|
|
17599
|
+
const [user, signers] = await Promise.all([
|
|
17600
|
+
this.#getAuthenticatedUser(),
|
|
17601
|
+
this.#getSigners(),
|
|
17602
|
+
]);
|
|
17609
17603
|
if (!isUserImx(user)) {
|
|
17610
17604
|
throw new PassportError('User has not been registered with StarkEx', PassportErrorType.USER_NOT_REGISTERED_ERROR);
|
|
17611
17605
|
}
|
|
17612
|
-
return {
|
|
17606
|
+
return {
|
|
17607
|
+
user,
|
|
17608
|
+
starkSigner: signers.starkSigner,
|
|
17609
|
+
ethSigner: signers.ethSigner,
|
|
17610
|
+
};
|
|
17613
17611
|
}
|
|
17614
17612
|
async transfer(request) {
|
|
17615
|
-
const { user, starkSigner } = await this
|
|
17613
|
+
const { user, starkSigner } = await this.#getRegisteredImxUserAndSigners();
|
|
17616
17614
|
return transfer$1({
|
|
17617
17615
|
request,
|
|
17618
17616
|
user,
|
|
@@ -17622,20 +17620,22 @@ class PassportImxProvider {
|
|
|
17622
17620
|
});
|
|
17623
17621
|
}
|
|
17624
17622
|
async registerOffchain() {
|
|
17625
|
-
const
|
|
17626
|
-
|
|
17623
|
+
const [user, signers] = await Promise.all([
|
|
17624
|
+
this.#getAuthenticatedUser(),
|
|
17625
|
+
this.#getSigners(),
|
|
17626
|
+
]);
|
|
17627
|
+
return await registerOffchain$1(signers.ethSigner, signers.starkSigner, user, this.authManager, this.imxApiClients);
|
|
17627
17628
|
}
|
|
17628
17629
|
async isRegisteredOffchain() {
|
|
17629
|
-
const
|
|
17630
|
+
const user = await this.#getAuthenticatedUser();
|
|
17630
17631
|
return !!user.imx;
|
|
17631
17632
|
}
|
|
17632
|
-
// TODO: Remove once implemented
|
|
17633
17633
|
// eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars
|
|
17634
17634
|
isRegisteredOnchain() {
|
|
17635
17635
|
throw new PassportError('Operation not supported', PassportErrorType.OPERATION_NOT_SUPPORTED_ERROR);
|
|
17636
17636
|
}
|
|
17637
17637
|
async createOrder(request) {
|
|
17638
|
-
const { user, starkSigner } = await this
|
|
17638
|
+
const { user, starkSigner } = await this.#getRegisteredImxUserAndSigners();
|
|
17639
17639
|
return createOrder$1({
|
|
17640
17640
|
request,
|
|
17641
17641
|
user,
|
|
@@ -17645,7 +17645,7 @@ class PassportImxProvider {
|
|
|
17645
17645
|
});
|
|
17646
17646
|
}
|
|
17647
17647
|
async cancelOrder(request) {
|
|
17648
|
-
const { user, starkSigner } = await this
|
|
17648
|
+
const { user, starkSigner } = await this.#getRegisteredImxUserAndSigners();
|
|
17649
17649
|
return cancelOrder$1({
|
|
17650
17650
|
request,
|
|
17651
17651
|
user,
|
|
@@ -17655,7 +17655,7 @@ class PassportImxProvider {
|
|
|
17655
17655
|
});
|
|
17656
17656
|
}
|
|
17657
17657
|
async createTrade(request) {
|
|
17658
|
-
const { user, starkSigner } = await this
|
|
17658
|
+
const { user, starkSigner } = await this.#getRegisteredImxUserAndSigners();
|
|
17659
17659
|
return createTrade$1({
|
|
17660
17660
|
request,
|
|
17661
17661
|
user,
|
|
@@ -17665,7 +17665,7 @@ class PassportImxProvider {
|
|
|
17665
17665
|
});
|
|
17666
17666
|
}
|
|
17667
17667
|
async batchNftTransfer(request) {
|
|
17668
|
-
const { user, starkSigner } = await this
|
|
17668
|
+
const { user, starkSigner } = await this.#getRegisteredImxUserAndSigners();
|
|
17669
17669
|
return batchNftTransfer({
|
|
17670
17670
|
request,
|
|
17671
17671
|
user,
|
|
@@ -17675,7 +17675,7 @@ class PassportImxProvider {
|
|
|
17675
17675
|
});
|
|
17676
17676
|
}
|
|
17677
17677
|
async exchangeTransfer(request) {
|
|
17678
|
-
const { user, starkSigner } = await this
|
|
17678
|
+
const { user, starkSigner } = await this.#getRegisteredImxUserAndSigners();
|
|
17679
17679
|
return exchangeTransfer$1({
|
|
17680
17680
|
request,
|
|
17681
17681
|
user,
|
|
@@ -17683,17 +17683,14 @@ class PassportImxProvider {
|
|
|
17683
17683
|
exchangesApi: this.immutableXClient.exchangeApi,
|
|
17684
17684
|
});
|
|
17685
17685
|
}
|
|
17686
|
-
// TODO: Remove once implemented
|
|
17687
17686
|
// eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars
|
|
17688
17687
|
deposit(deposit) {
|
|
17689
17688
|
throw new PassportError('Operation not supported', PassportErrorType.OPERATION_NOT_SUPPORTED_ERROR);
|
|
17690
17689
|
}
|
|
17691
|
-
// TODO: Remove once implemented
|
|
17692
17690
|
// eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars
|
|
17693
17691
|
prepareWithdrawal(request) {
|
|
17694
17692
|
throw new PassportError('Operation not supported', PassportErrorType.OPERATION_NOT_SUPPORTED_ERROR);
|
|
17695
17693
|
}
|
|
17696
|
-
// TODO: Remove once implemented
|
|
17697
17694
|
// eslint-disable-next-line class-methods-use-this
|
|
17698
17695
|
completeWithdrawal(
|
|
17699
17696
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -17703,7 +17700,10 @@ class PassportImxProvider {
|
|
|
17703
17700
|
throw new PassportError('Operation not supported', PassportErrorType.OPERATION_NOT_SUPPORTED_ERROR);
|
|
17704
17701
|
}
|
|
17705
17702
|
async getAddress() {
|
|
17706
|
-
const
|
|
17703
|
+
const user = await this.#getAuthenticatedUser();
|
|
17704
|
+
if (!isUserImx(user)) {
|
|
17705
|
+
throw new PassportError('User has not been registered with StarkEx', PassportErrorType.USER_NOT_REGISTERED_ERROR);
|
|
17706
|
+
}
|
|
17707
17707
|
return Promise.resolve(user.imx.ethAddress);
|
|
17708
17708
|
}
|
|
17709
17709
|
}
|
|
@@ -18060,33 +18060,45 @@ function getNormalisedTransactions(txs) {
|
|
|
18060
18060
|
return txs.map((t) => ({
|
|
18061
18061
|
delegateCall: t.delegateCall === true,
|
|
18062
18062
|
revertOnError: t.revertOnError === true,
|
|
18063
|
-
gasLimit: t.gasLimit ??
|
|
18064
|
-
target: t.to ??
|
|
18065
|
-
value: t.value ??
|
|
18063
|
+
gasLimit: t.gasLimit ?? constants$1.Zero,
|
|
18064
|
+
target: t.to ?? constants$1.AddressZero,
|
|
18065
|
+
value: t.value ?? constants$1.Zero,
|
|
18066
18066
|
data: t.data ?? [],
|
|
18067
18067
|
}));
|
|
18068
18068
|
}
|
|
18069
18069
|
function digestOfTransactionsAndNonce(nonce, normalisedTransactions) {
|
|
18070
|
-
const packMetaTransactionsNonceData =
|
|
18071
|
-
return
|
|
18070
|
+
const packMetaTransactionsNonceData = utils$3.defaultAbiCoder.encode(['uint256', META_TRANSACTIONS_TYPE], [nonce, normalisedTransactions]);
|
|
18071
|
+
return utils$3.keccak256(packMetaTransactionsNonceData);
|
|
18072
18072
|
}
|
|
18073
18073
|
const getNonce = async (jsonRpcProvider, smartContractWalletAddress) => {
|
|
18074
|
-
|
|
18075
|
-
|
|
18076
|
-
const
|
|
18077
|
-
|
|
18074
|
+
try {
|
|
18075
|
+
const contract = new Contract$1(smartContractWalletAddress, walletContracts.mainModule.abi, jsonRpcProvider);
|
|
18076
|
+
const result = await contract.nonce();
|
|
18077
|
+
if (result instanceof BigNumber$1) {
|
|
18078
|
+
return result;
|
|
18079
|
+
}
|
|
18078
18080
|
}
|
|
18079
|
-
|
|
18081
|
+
catch (error) {
|
|
18082
|
+
if (error instanceof Error
|
|
18083
|
+
&& 'code' in error
|
|
18084
|
+
&& error.code === errors.CALL_EXCEPTION) {
|
|
18085
|
+
// The most likely reason for a CALL_EXCEPTION is that the smart contract wallet
|
|
18086
|
+
// has not been deployed yet, so we should default to a nonce of 0.
|
|
18087
|
+
return BigNumber$1.from(0);
|
|
18088
|
+
}
|
|
18089
|
+
throw error;
|
|
18090
|
+
}
|
|
18091
|
+
throw new Error('Unexpected result from contract.nonce() call.');
|
|
18080
18092
|
};
|
|
18081
|
-
const encodeMessageSubDigest = (chainId, walletAddress, digest) => (
|
|
18093
|
+
const encodeMessageSubDigest = (chainId, walletAddress, digest) => (utils$3.solidityPack(['string', 'uint256', 'address', 'bytes32'], [ETH_SIGN_PREFIX, chainId, walletAddress, digest]));
|
|
18082
18094
|
const getSignedMetaTransactions = async (metaTransactions, nonce, chainId, walletAddress, signer) => {
|
|
18083
18095
|
const normalisedMetaTransactions = getNormalisedTransactions(metaTransactions);
|
|
18084
18096
|
// Get the hash
|
|
18085
18097
|
const digest = digestOfTransactionsAndNonce(nonce, normalisedMetaTransactions);
|
|
18086
18098
|
const completePayload = encodeMessageSubDigest(chainId, walletAddress, digest);
|
|
18087
|
-
const hash =
|
|
18099
|
+
const hash = utils$3.keccak256(completePayload);
|
|
18088
18100
|
// Sign the digest
|
|
18089
|
-
const hashArray =
|
|
18101
|
+
const hashArray = utils$3.arrayify(hash);
|
|
18090
18102
|
const ethsigNoType = await signer.signMessage(hashArray);
|
|
18091
18103
|
const signedDigest = `${ethsigNoType}${ETH_SIGN_FLAG}`;
|
|
18092
18104
|
// Add metadata
|
|
@@ -18103,7 +18115,7 @@ const getSignedMetaTransactions = async (metaTransactions, nonce, chainId, walle
|
|
|
18103
18115
|
],
|
|
18104
18116
|
});
|
|
18105
18117
|
// Encode the transaction;
|
|
18106
|
-
const walletInterface = new
|
|
18118
|
+
const walletInterface = new utils$3.Interface(walletContracts.mainModule.abi);
|
|
18107
18119
|
return walletInterface.encodeFunctionData(walletInterface.getFunction('execute'), [
|
|
18108
18120
|
normalisedMetaTransactions,
|
|
18109
18121
|
nonce,
|
|
@@ -18120,13 +18132,13 @@ const getSignedTypedData = async (typedData, relayerSignature, chainId, walletAd
|
|
|
18120
18132
|
// @ts-ignore
|
|
18121
18133
|
delete types.EIP712Domain;
|
|
18122
18134
|
// Hash the EIP712 payload and generate the complete payload
|
|
18123
|
-
const { _TypedDataEncoder: typedDataEncoder } =
|
|
18135
|
+
const { _TypedDataEncoder: typedDataEncoder } = utils$3;
|
|
18124
18136
|
const typedDataHash = typedDataEncoder.hash(typedData.domain, types, typedData.message);
|
|
18125
18137
|
const messageSubDigest = encodeMessageSubDigest(chainId, walletAddress, typedDataHash);
|
|
18126
|
-
const hash =
|
|
18138
|
+
const hash = utils$3.keccak256(messageSubDigest);
|
|
18127
18139
|
// Sign the sub digest
|
|
18128
18140
|
// https://github.com/immutable/wallet-contracts/blob/7824b5f24b2e0eb2dc465ecb5cd71f3984556b73/src/contracts/modules/commons/ModuleAuth.sol#L155
|
|
18129
|
-
const hashArray =
|
|
18141
|
+
const hashArray = utils$3.arrayify(hash);
|
|
18130
18142
|
const ethsigNoType = await signer.signMessage(hashArray);
|
|
18131
18143
|
const signedDigest = `${ethsigNoType}${ETH_SIGN_FLAG}`;
|
|
18132
18144
|
// Combine the relayer and user signatures; sort by address to match the imageHash order
|
|
@@ -18990,8 +19002,7 @@ class Passport {
|
|
|
18990
19002
|
if (useCachedSession) {
|
|
18991
19003
|
throw error;
|
|
18992
19004
|
}
|
|
18993
|
-
|
|
18994
|
-
console.warn('login failed to retrieve a cached user session', error);
|
|
19005
|
+
logger$f.warn('Failed to retrieve a cached user session', error);
|
|
18995
19006
|
}
|
|
18996
19007
|
if (!user && !useCachedSession) {
|
|
18997
19008
|
user = await this.authManager.login(options?.anonymousId);
|
|
@@ -19025,8 +19036,7 @@ class Passport {
|
|
|
19025
19036
|
await this.confirmationScreen.logout();
|
|
19026
19037
|
}
|
|
19027
19038
|
catch (err) {
|
|
19028
|
-
|
|
19029
|
-
console.warn('Failed to logout from confirmation screen', err);
|
|
19039
|
+
logger$f.warn('Failed to logout from confirmation screen', err);
|
|
19030
19040
|
}
|
|
19031
19041
|
await Promise.allSettled([
|
|
19032
19042
|
this.authManager.logout(),
|
|
@@ -37835,7 +37845,7 @@ const flattenProperties = (properties) => {
|
|
|
37835
37845
|
};
|
|
37836
37846
|
|
|
37837
37847
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
37838
|
-
const SDK_VERSION = '1.13.
|
|
37848
|
+
const SDK_VERSION = '1.13.2-alpha.1';
|
|
37839
37849
|
const getReferrer = () => {
|
|
37840
37850
|
if (isNode()) {
|
|
37841
37851
|
return '';
|
|
@@ -43011,7 +43021,7 @@ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
|
|
|
43011
43021
|
maxPriorityFeePerGas: BigNumber$1.from(10e9),
|
|
43012
43022
|
};
|
|
43013
43023
|
|
|
43014
|
-
const SDK_VERSION_MARKER = '1.13.
|
|
43024
|
+
const SDK_VERSION_MARKER = '1.13.2-alpha.1';
|
|
43015
43025
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
43016
43026
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
43017
43027
|
|
package/dist/orderbook.d.ts
CHANGED
|
@@ -15,20 +15,8 @@ declare class ImmutableConfiguration {
|
|
|
15
15
|
publishableKey?: string;
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
|
-
type ImmutableConfigurationWithRequireableFields<T> = ImmutableConfiguration & (T extends {
|
|
19
|
-
apiKey: 'required';
|
|
20
|
-
} ? Required<{
|
|
21
|
-
apiKey: string;
|
|
22
|
-
}> : {}) & (T extends {
|
|
23
|
-
publishableKey: 'required';
|
|
24
|
-
} ? Required<{
|
|
25
|
-
publishableKey: string;
|
|
26
|
-
}> : {});
|
|
27
|
-
type ImmutableConfigurationWithOmitableFields<T> = T extends {
|
|
28
|
-
apiKey: 'omit';
|
|
29
|
-
} ? Omit<ImmutableConfigurationWithRequireableFields<T>, 'apiKey'> : ImmutableConfigurationWithRequireableFields<T>;
|
|
30
18
|
interface ModuleConfiguration<T> {
|
|
31
|
-
baseConfig:
|
|
19
|
+
baseConfig: ImmutableConfiguration;
|
|
32
20
|
overrides?: T;
|
|
33
21
|
}
|
|
34
22
|
|
package/dist/orderbook.js
CHANGED
|
@@ -131,7 +131,7 @@ const flattenProperties = (properties) => {
|
|
|
131
131
|
};
|
|
132
132
|
|
|
133
133
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
134
|
-
const SDK_VERSION = '1.13.
|
|
134
|
+
const SDK_VERSION = '1.13.2-alpha.1';
|
|
135
135
|
const getReferrer = () => {
|
|
136
136
|
if (isNode()) {
|
|
137
137
|
return '';
|
package/dist/passport.d.ts
CHANGED
|
@@ -9826,20 +9826,8 @@ declare class ImmutableConfiguration {
|
|
|
9826
9826
|
publishableKey?: string;
|
|
9827
9827
|
});
|
|
9828
9828
|
}
|
|
9829
|
-
type ImmutableConfigurationWithRequireableFields<T> = ImmutableConfiguration & (T extends {
|
|
9830
|
-
apiKey: 'required';
|
|
9831
|
-
} ? Required<{
|
|
9832
|
-
apiKey: string;
|
|
9833
|
-
}> : {}) & (T extends {
|
|
9834
|
-
publishableKey: 'required';
|
|
9835
|
-
} ? Required<{
|
|
9836
|
-
publishableKey: string;
|
|
9837
|
-
}> : {});
|
|
9838
|
-
type ImmutableConfigurationWithOmitableFields<T> = T extends {
|
|
9839
|
-
apiKey: 'omit';
|
|
9840
|
-
} ? Omit<ImmutableConfigurationWithRequireableFields<T>, 'apiKey'> : ImmutableConfigurationWithRequireableFields<T>;
|
|
9841
9829
|
interface ModuleConfiguration<T> {
|
|
9842
|
-
baseConfig:
|
|
9830
|
+
baseConfig: ImmutableConfiguration;
|
|
9843
9831
|
overrides?: T;
|
|
9844
9832
|
}
|
|
9845
9833
|
|