@imtbl/sdk 1.20.2 → 1.20.4
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.js +2 -2
- package/dist/browser/checkout/{BridgeWidget-312cb2c2.js → BridgeWidget-764186df.js} +1 -1
- package/dist/browser/checkout/{HorizontalMenu-actual-4dbb5c81.js → HorizontalMenu-actual-f804d6c1.js} +1 -1
- package/dist/browser/checkout/{OnRampWidget-1340f0cc.js → OnRampWidget-d202910b.js} +1 -1
- package/dist/browser/checkout/{SaleWidget-be034e41.js → SaleWidget-21a0da95.js} +2 -2
- package/dist/browser/checkout/{SpendingCapHero-39ee51d6.js → SpendingCapHero-4cf86bc9.js} +1 -1
- package/dist/browser/checkout/{SwapWidget-e092d01c.js → SwapWidget-fa573621.js} +1 -1
- package/dist/browser/checkout/{TopUpView-6e32a129.js → TopUpView-20c59619.js} +1 -1
- package/dist/browser/checkout/{WalletWidget-abb75fc8.js → WalletWidget-a7dae882.js} +1 -1
- package/dist/browser/checkout/{auto-track-0ac33efe.js → auto-track-47f8ae7b.js} +1 -1
- package/dist/browser/checkout/{balance-713e469c.js → balance-13198af0.js} +1 -1
- package/dist/browser/checkout/{index-a8a9e072.js → index-394d516d.js} +2 -2
- package/dist/browser/checkout/{index-ceb8406f.js → index-6707b5f0.js} +1 -1
- package/dist/browser/checkout/{index-4f810b18.js → index-760c2a62.js} +1 -1
- package/dist/browser/checkout/{index-d2f39097.js → index-761d51ab.js} +1 -1
- package/dist/browser/checkout/{index-2d9d6340.js → index-800f3b79.js} +1 -1
- package/dist/browser/checkout/{index-63dc0a81.js → index-8b5981fa.js} +1 -1
- package/dist/browser/checkout/{index-ad4dc41d.js → index-9daeacd3.js} +1 -1
- package/dist/browser/checkout/index-c8504cfe.js +1 -0
- package/dist/browser/checkout/{index.umd-74591847.js → index.umd-cbd7b2eb.js} +1 -1
- package/dist/browser/checkout/{retry-5e0ff99b.js → retry-ce6e6559.js} +1 -1
- package/dist/browser/checkout/sdk.js +4 -4
- package/dist/browser/checkout/widgets-esm.js +1 -1
- package/dist/browser/checkout/widgets.js +2 -2
- package/dist/checkout.d.ts +8 -2
- package/dist/checkout.js +4 -4
- package/dist/config.js +1 -1
- package/dist/index.browser.js +5 -5
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +41 -32
- package/dist/index.d.ts +8 -2
- package/dist/index.js +42 -33
- package/dist/orderbook.js +1 -1
- package/dist/passport.js +40 -31
- package/dist/x.js +3 -3
- package/package.json +1 -1
- package/dist/browser/checkout/index-e0acfcc2.js +0 -1
package/dist/index.cjs
CHANGED
|
@@ -181,7 +181,7 @@ const flattenProperties$1 = (properties) => {
|
|
|
181
181
|
};
|
|
182
182
|
|
|
183
183
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
184
|
-
const SDK_VERSION$1 = '1.20.
|
|
184
|
+
const SDK_VERSION$1 = '1.20.4';
|
|
185
185
|
const getReferrer$1 = () => {
|
|
186
186
|
if (isNode$1()) {
|
|
187
187
|
return '';
|
|
@@ -13557,7 +13557,7 @@ class MultiRollupApiClients {
|
|
|
13557
13557
|
}
|
|
13558
13558
|
|
|
13559
13559
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
13560
|
-
const defaultHeaders$2 = { 'x-sdk-version': 'ts-immutable-sdk-1.20.
|
|
13560
|
+
const defaultHeaders$2 = { 'x-sdk-version': 'ts-immutable-sdk-1.20.4' };
|
|
13561
13561
|
const createConfig$1 = ({ basePath, headers, }) => {
|
|
13562
13562
|
if (!basePath.trim()) {
|
|
13563
13563
|
throw Error('basePath can not be empty');
|
|
@@ -13629,7 +13629,7 @@ class APIError extends Error {
|
|
|
13629
13629
|
|
|
13630
13630
|
/* eslint-disable implicit-arrow-linebreak */
|
|
13631
13631
|
const defaultHeaders$1 = {
|
|
13632
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.20.
|
|
13632
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.20.4',
|
|
13633
13633
|
};
|
|
13634
13634
|
/**
|
|
13635
13635
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -14103,7 +14103,7 @@ var blockchain_data = /*#__PURE__*/Object.freeze({
|
|
|
14103
14103
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
14104
14104
|
class ApiConfiguration extends index$2.Configuration {
|
|
14105
14105
|
}
|
|
14106
|
-
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.20.
|
|
14106
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.20.4' };
|
|
14107
14107
|
/**
|
|
14108
14108
|
* @dev use createImmutableXConfiguration instead
|
|
14109
14109
|
*/
|
|
@@ -14142,7 +14142,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
14142
14142
|
chainID,
|
|
14143
14143
|
coreContractAddress,
|
|
14144
14144
|
registrationContractAddress,
|
|
14145
|
-
sdkVersion: 'ts-immutable-sdk-1.20.
|
|
14145
|
+
sdkVersion: 'ts-immutable-sdk-1.20.4',
|
|
14146
14146
|
baseConfig,
|
|
14147
14147
|
});
|
|
14148
14148
|
const production = ({ baseConfig }) => createImmutableXConfiguration({
|
|
@@ -25637,9 +25637,9 @@ function digestOfTransactionsAndNonce(nonce, normalisedTransactions) {
|
|
|
25637
25637
|
const packMetaTransactionsNonceData = ethers.utils.defaultAbiCoder.encode(['uint256', META_TRANSACTIONS_TYPE], [nonce, normalisedTransactions]);
|
|
25638
25638
|
return ethers.utils.keccak256(packMetaTransactionsNonceData);
|
|
25639
25639
|
}
|
|
25640
|
-
const getNonce = async (
|
|
25640
|
+
const getNonce = async (rpcProvider, smartContractWalletAddress) => {
|
|
25641
25641
|
try {
|
|
25642
|
-
const contract = new ethers.Contract(smartContractWalletAddress, abi.walletContracts.mainModule.abi,
|
|
25642
|
+
const contract = new ethers.Contract(smartContractWalletAddress, abi.walletContracts.mainModule.abi, rpcProvider);
|
|
25643
25643
|
const result = await contract.nonce();
|
|
25644
25644
|
if (result instanceof ethers.BigNumber) {
|
|
25645
25645
|
return result;
|
|
@@ -25741,11 +25741,11 @@ const getEip155ChainId = (chainId) => `eip155:${chainId}`;
|
|
|
25741
25741
|
|
|
25742
25742
|
class RelayerClient {
|
|
25743
25743
|
config;
|
|
25744
|
-
|
|
25744
|
+
rpcProvider;
|
|
25745
25745
|
authManager;
|
|
25746
|
-
constructor({ config,
|
|
25746
|
+
constructor({ config, rpcProvider, authManager }) {
|
|
25747
25747
|
this.config = config;
|
|
25748
|
-
this.
|
|
25748
|
+
this.rpcProvider = rpcProvider;
|
|
25749
25749
|
this.authManager = authManager;
|
|
25750
25750
|
}
|
|
25751
25751
|
async postToRelayer(request) {
|
|
@@ -25770,7 +25770,7 @@ class RelayerClient {
|
|
|
25770
25770
|
return jsonResponse;
|
|
25771
25771
|
}
|
|
25772
25772
|
async ethSendTransaction(to, data) {
|
|
25773
|
-
const { chainId } = await this.
|
|
25773
|
+
const { chainId } = await this.rpcProvider.detectNetwork();
|
|
25774
25774
|
const payload = {
|
|
25775
25775
|
method: 'eth_sendTransaction',
|
|
25776
25776
|
params: [{
|
|
@@ -25791,7 +25791,7 @@ class RelayerClient {
|
|
|
25791
25791
|
return result;
|
|
25792
25792
|
}
|
|
25793
25793
|
async imGetFeeOptions(userAddress, data) {
|
|
25794
|
-
const { chainId } = await this.
|
|
25794
|
+
const { chainId } = await this.rpcProvider.detectNetwork();
|
|
25795
25795
|
const payload = {
|
|
25796
25796
|
method: 'im_getFeeOptions',
|
|
25797
25797
|
params: [{
|
|
@@ -25804,7 +25804,7 @@ class RelayerClient {
|
|
|
25804
25804
|
return result;
|
|
25805
25805
|
}
|
|
25806
25806
|
async imSignTypedData(address, eip712Payload) {
|
|
25807
|
-
const { chainId } = await this.
|
|
25807
|
+
const { chainId } = await this.rpcProvider.detectNetwork();
|
|
25808
25808
|
const payload = {
|
|
25809
25809
|
method: 'im_signTypedData',
|
|
25810
25810
|
params: [{
|
|
@@ -25851,11 +25851,11 @@ class JsonRpcError extends Error {
|
|
|
25851
25851
|
}
|
|
25852
25852
|
|
|
25853
25853
|
const MESSAGE_TO_SIGN = 'Only sign this message from Immutable Passport';
|
|
25854
|
-
async function registerZkEvmUser({ authManager, ethSigner, multiRollupApiClients, accessToken,
|
|
25854
|
+
async function registerZkEvmUser({ authManager, ethSigner, multiRollupApiClients, accessToken, rpcProvider, }) {
|
|
25855
25855
|
const [ethereumAddress, ethereumSignature, network, chainListResponse] = await Promise.all([
|
|
25856
25856
|
ethSigner.getAddress(),
|
|
25857
25857
|
signRaw(MESSAGE_TO_SIGN, ethSigner),
|
|
25858
|
-
|
|
25858
|
+
rpcProvider.detectNetwork(),
|
|
25859
25859
|
multiRollupApiClients.chainsApi.listChains(),
|
|
25860
25860
|
]);
|
|
25861
25861
|
const eipChainId = getEip155ChainId(network.chainId);
|
|
@@ -26076,15 +26076,15 @@ const getMetaTransactions = async (metaTransaction, nonce, chainId, walletAddres
|
|
|
26076
26076
|
}
|
|
26077
26077
|
return [metaTransaction, feeMetaTransaction];
|
|
26078
26078
|
};
|
|
26079
|
-
const sendTransaction$1 = ({ params, ethSigner,
|
|
26079
|
+
const sendTransaction$1 = ({ params, ethSigner, rpcProvider, relayerClient, guardianClient, zkevmAddress, }) => guardianClient
|
|
26080
26080
|
.withConfirmationScreen({ width: 480, height: 720 })(async () => {
|
|
26081
26081
|
const transactionRequest = params[0];
|
|
26082
26082
|
if (!transactionRequest.to) {
|
|
26083
26083
|
throw new JsonRpcError(RpcErrorCode.INVALID_PARAMS, 'eth_sendTransaction requires a "to" field');
|
|
26084
26084
|
}
|
|
26085
|
-
const { chainId } = await
|
|
26085
|
+
const { chainId } = await rpcProvider.detectNetwork();
|
|
26086
26086
|
const chainIdBigNumber = ethers.BigNumber.from(chainId);
|
|
26087
|
-
const nonce = await getNonce(
|
|
26087
|
+
const nonce = await getNonce(rpcProvider, zkevmAddress);
|
|
26088
26088
|
const metaTransaction = {
|
|
26089
26089
|
to: transactionRequest.to,
|
|
26090
26090
|
data: transactionRequest.data,
|
|
@@ -26172,14 +26172,14 @@ const transformTypedData = (typedData, chainId) => {
|
|
|
26172
26172
|
}
|
|
26173
26173
|
return transformedTypedData;
|
|
26174
26174
|
};
|
|
26175
|
-
const signTypedDataV4 = async ({ params, method, ethSigner,
|
|
26175
|
+
const signTypedDataV4 = async ({ params, method, ethSigner, rpcProvider, relayerClient, guardianClient, }) => guardianClient
|
|
26176
26176
|
.withConfirmationScreen({ width: 480, height: 720 })(async () => {
|
|
26177
26177
|
const fromAddress = params[0];
|
|
26178
26178
|
const typedDataParam = params[1];
|
|
26179
26179
|
if (!fromAddress || !typedDataParam) {
|
|
26180
26180
|
throw new JsonRpcError(RpcErrorCode.INVALID_PARAMS, `${method} requires an address and a typed data JSON`);
|
|
26181
26181
|
}
|
|
26182
|
-
const { chainId } = await
|
|
26182
|
+
const { chainId } = await rpcProvider.detectNetwork();
|
|
26183
26183
|
const typedData = transformTypedData(typedDataParam, chainId);
|
|
26184
26184
|
await guardianClient.validateMessage({ chainID: String(chainId), payload: typedData });
|
|
26185
26185
|
const relayerSignature = await relayerClient.imSignTypedData(fromAddress, typedData);
|
|
@@ -26192,7 +26192,7 @@ class ZkEvmProvider {
|
|
|
26192
26192
|
#config;
|
|
26193
26193
|
#eventEmitter;
|
|
26194
26194
|
#guardianClient;
|
|
26195
|
-
#
|
|
26195
|
+
#rpcProvider; // Used for read
|
|
26196
26196
|
#magicAdapter;
|
|
26197
26197
|
#multiRollupApiClients;
|
|
26198
26198
|
#relayerClient;
|
|
@@ -26212,19 +26212,19 @@ class ZkEvmProvider {
|
|
|
26212
26212
|
this.#config = config;
|
|
26213
26213
|
this.#guardianClient = guardianClient;
|
|
26214
26214
|
if (config.crossSdkBridgeEnabled) {
|
|
26215
|
-
//
|
|
26215
|
+
// StaticJsonRpcProvider by default sets the referrer as "client".
|
|
26216
26216
|
// On Unreal 4 this errors as the browser used is expecting a valid URL.
|
|
26217
|
-
this.#
|
|
26217
|
+
this.#rpcProvider = new providers.StaticJsonRpcProvider({
|
|
26218
26218
|
url: this.#config.zkEvmRpcUrl,
|
|
26219
26219
|
fetchOptions: { referrer: 'http://imtblgamesdk.local' },
|
|
26220
26220
|
});
|
|
26221
26221
|
}
|
|
26222
26222
|
else {
|
|
26223
|
-
this.#
|
|
26223
|
+
this.#rpcProvider = new providers.StaticJsonRpcProvider(this.#config.zkEvmRpcUrl);
|
|
26224
26224
|
}
|
|
26225
26225
|
this.#relayerClient = new RelayerClient({
|
|
26226
26226
|
config: this.#config,
|
|
26227
|
-
|
|
26227
|
+
rpcProvider: this.#rpcProvider,
|
|
26228
26228
|
authManager: this.#authManager,
|
|
26229
26229
|
});
|
|
26230
26230
|
this.#multiRollupApiClients = multiRollupApiClients;
|
|
@@ -26295,7 +26295,7 @@ class ZkEvmProvider {
|
|
|
26295
26295
|
authManager: this.#authManager,
|
|
26296
26296
|
multiRollupApiClients: this.#multiRollupApiClients,
|
|
26297
26297
|
accessToken: user.accessToken,
|
|
26298
|
-
|
|
26298
|
+
rpcProvider: this.#rpcProvider,
|
|
26299
26299
|
});
|
|
26300
26300
|
}
|
|
26301
26301
|
else {
|
|
@@ -26313,7 +26313,7 @@ class ZkEvmProvider {
|
|
|
26313
26313
|
params: request.params || [],
|
|
26314
26314
|
ethSigner,
|
|
26315
26315
|
guardianClient: this.#guardianClient,
|
|
26316
|
-
|
|
26316
|
+
rpcProvider: this.#rpcProvider,
|
|
26317
26317
|
relayerClient: this.#relayerClient,
|
|
26318
26318
|
zkevmAddress: this.#zkEvmAddress,
|
|
26319
26319
|
});
|
|
@@ -26331,11 +26331,21 @@ class ZkEvmProvider {
|
|
|
26331
26331
|
method: request.method,
|
|
26332
26332
|
params: request.params || [],
|
|
26333
26333
|
ethSigner,
|
|
26334
|
-
|
|
26334
|
+
rpcProvider: this.#rpcProvider,
|
|
26335
26335
|
relayerClient: this.#relayerClient,
|
|
26336
26336
|
guardianClient: this.#guardianClient,
|
|
26337
26337
|
});
|
|
26338
26338
|
}
|
|
26339
|
+
case 'eth_chainId': {
|
|
26340
|
+
// Call detect network to fetch the chainId so to take advantage of
|
|
26341
|
+
// the caching layer provided by StaticJsonRpcProvider.
|
|
26342
|
+
// In case Passport is changed from StaticJsonRpcProvider to a
|
|
26343
|
+
// JsonRpcProvider, this function will still work as expected given
|
|
26344
|
+
// that detectNetwork call _uncachedDetectNetwork which will force
|
|
26345
|
+
// the provider to re-fetch the chainId from remote.
|
|
26346
|
+
const { chainId } = await this.#rpcProvider.detectNetwork();
|
|
26347
|
+
return ethers.utils.hexlify(chainId);
|
|
26348
|
+
}
|
|
26339
26349
|
// Pass through methods
|
|
26340
26350
|
case 'eth_gasPrice':
|
|
26341
26351
|
case 'eth_getBalance':
|
|
@@ -26344,13 +26354,12 @@ class ZkEvmProvider {
|
|
|
26344
26354
|
case 'eth_estimateGas':
|
|
26345
26355
|
case 'eth_call':
|
|
26346
26356
|
case 'eth_blockNumber':
|
|
26347
|
-
case 'eth_chainId':
|
|
26348
26357
|
case 'eth_getBlockByHash':
|
|
26349
26358
|
case 'eth_getBlockByNumber':
|
|
26350
26359
|
case 'eth_getTransactionByHash':
|
|
26351
26360
|
case 'eth_getTransactionReceipt':
|
|
26352
26361
|
case 'eth_getTransactionCount': {
|
|
26353
|
-
return this.#
|
|
26362
|
+
return this.#rpcProvider.send(request.method, request.params || []);
|
|
26354
26363
|
}
|
|
26355
26364
|
default: {
|
|
26356
26365
|
throw new JsonRpcError(ProviderErrorCode.UNSUPPORTED_METHOD, 'Method not supported');
|
|
@@ -45437,7 +45446,7 @@ const flattenProperties = (properties) => {
|
|
|
45437
45446
|
};
|
|
45438
45447
|
|
|
45439
45448
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
45440
|
-
const SDK_VERSION = '1.20.
|
|
45449
|
+
const SDK_VERSION = '1.20.4';
|
|
45441
45450
|
const getReferrer = () => {
|
|
45442
45451
|
if (isNode()) {
|
|
45443
45452
|
return '';
|
|
@@ -50632,7 +50641,7 @@ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
|
|
|
50632
50641
|
maxPriorityFeePerGas: ethers.BigNumber.from(10e9),
|
|
50633
50642
|
};
|
|
50634
50643
|
|
|
50635
|
-
const SDK_VERSION_MARKER = '1.20.
|
|
50644
|
+
const SDK_VERSION_MARKER = '1.20.4';
|
|
50636
50645
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
50637
50646
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
50638
50647
|
|
package/dist/index.d.ts
CHANGED
|
@@ -27060,11 +27060,13 @@ type BridgeWidgetConfiguration = {} & WidgetConfiguration;
|
|
|
27060
27060
|
|
|
27061
27061
|
/**
|
|
27062
27062
|
* Wallet Widget Configuration represents the configuration options for the Wallet Widget.
|
|
27063
|
-
* @property {boolean | undefined} showDisconnectButton
|
|
27064
|
-
* @property {boolean | undefined} showNetworkMenu
|
|
27063
|
+
* @property {boolean | undefined} showDisconnectButton
|
|
27064
|
+
* @property {boolean | undefined} showNetworkMenu
|
|
27065
27065
|
*/
|
|
27066
27066
|
type WalletWidgetConfiguration = {
|
|
27067
|
+
/** Show/hide the disconnect button in the Wallet Widget (defaults to true) */
|
|
27067
27068
|
showDisconnectButton?: boolean;
|
|
27069
|
+
/** Show/hide the network menu in the Wallet Widget (defaults to true) */
|
|
27068
27070
|
showNetworkMenu?: boolean;
|
|
27069
27071
|
} & WidgetConfiguration;
|
|
27070
27072
|
|
|
@@ -27241,6 +27243,8 @@ type SaleSuccess = {
|
|
|
27241
27243
|
method: string;
|
|
27242
27244
|
hash: string | undefined;
|
|
27243
27245
|
}[];
|
|
27246
|
+
/** The order reference id, use it to trace order throughout flow */
|
|
27247
|
+
transactionId: string;
|
|
27244
27248
|
[key: string]: unknown;
|
|
27245
27249
|
};
|
|
27246
27250
|
/**
|
|
@@ -27263,6 +27267,8 @@ type SaleFailed = {
|
|
|
27263
27267
|
method: string;
|
|
27264
27268
|
hash: string | undefined;
|
|
27265
27269
|
}[];
|
|
27270
|
+
/** The order reference id, use it to trace order throughout flow */
|
|
27271
|
+
transactionId: string;
|
|
27266
27272
|
};
|
|
27267
27273
|
/**
|
|
27268
27274
|
* Type representing a Sale Widget with type TRANSACTION_SUCCESS.
|
package/dist/index.js
CHANGED
|
@@ -18,7 +18,7 @@ import * as crypto from 'crypto';
|
|
|
18
18
|
import { Magic } from 'magic-sdk';
|
|
19
19
|
import { OpenIdExtension } from '@magic-ext/oidc';
|
|
20
20
|
import { generateLegacyStarkPrivateKey as generateLegacyStarkPrivateKey$1, createStarkSigner as createStarkSigner$1 } from '@imtbl/core-sdk';
|
|
21
|
-
import {
|
|
21
|
+
import { StaticJsonRpcProvider, Web3Provider, JsonRpcProvider } from '@ethersproject/providers';
|
|
22
22
|
import { EventEmitter } from 'events';
|
|
23
23
|
import { walletContracts } from '@0xsequence/abi';
|
|
24
24
|
import { v1 } from '@0xsequence/core';
|
|
@@ -159,7 +159,7 @@ const flattenProperties$1 = (properties) => {
|
|
|
159
159
|
};
|
|
160
160
|
|
|
161
161
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
162
|
-
const SDK_VERSION$1 = '1.20.
|
|
162
|
+
const SDK_VERSION$1 = '1.20.4';
|
|
163
163
|
const getReferrer$1 = () => {
|
|
164
164
|
if (isNode$1()) {
|
|
165
165
|
return '';
|
|
@@ -13535,7 +13535,7 @@ class MultiRollupApiClients {
|
|
|
13535
13535
|
}
|
|
13536
13536
|
|
|
13537
13537
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
13538
|
-
const defaultHeaders$2 = { 'x-sdk-version': 'ts-immutable-sdk-1.20.
|
|
13538
|
+
const defaultHeaders$2 = { 'x-sdk-version': 'ts-immutable-sdk-1.20.4' };
|
|
13539
13539
|
const createConfig$1 = ({ basePath, headers, }) => {
|
|
13540
13540
|
if (!basePath.trim()) {
|
|
13541
13541
|
throw Error('basePath can not be empty');
|
|
@@ -13607,7 +13607,7 @@ class APIError extends Error {
|
|
|
13607
13607
|
|
|
13608
13608
|
/* eslint-disable implicit-arrow-linebreak */
|
|
13609
13609
|
const defaultHeaders$1 = {
|
|
13610
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.20.
|
|
13610
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.20.4',
|
|
13611
13611
|
};
|
|
13612
13612
|
/**
|
|
13613
13613
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -14081,7 +14081,7 @@ var blockchain_data = /*#__PURE__*/Object.freeze({
|
|
|
14081
14081
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
14082
14082
|
class ApiConfiguration extends index$2.Configuration {
|
|
14083
14083
|
}
|
|
14084
|
-
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.20.
|
|
14084
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.20.4' };
|
|
14085
14085
|
/**
|
|
14086
14086
|
* @dev use createImmutableXConfiguration instead
|
|
14087
14087
|
*/
|
|
@@ -14120,7 +14120,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
14120
14120
|
chainID,
|
|
14121
14121
|
coreContractAddress,
|
|
14122
14122
|
registrationContractAddress,
|
|
14123
|
-
sdkVersion: 'ts-immutable-sdk-1.20.
|
|
14123
|
+
sdkVersion: 'ts-immutable-sdk-1.20.4',
|
|
14124
14124
|
baseConfig,
|
|
14125
14125
|
});
|
|
14126
14126
|
const production = ({ baseConfig }) => createImmutableXConfiguration({
|
|
@@ -25615,9 +25615,9 @@ function digestOfTransactionsAndNonce(nonce, normalisedTransactions) {
|
|
|
25615
25615
|
const packMetaTransactionsNonceData = utils$3.defaultAbiCoder.encode(['uint256', META_TRANSACTIONS_TYPE], [nonce, normalisedTransactions]);
|
|
25616
25616
|
return utils$3.keccak256(packMetaTransactionsNonceData);
|
|
25617
25617
|
}
|
|
25618
|
-
const getNonce = async (
|
|
25618
|
+
const getNonce = async (rpcProvider, smartContractWalletAddress) => {
|
|
25619
25619
|
try {
|
|
25620
|
-
const contract = new Contract$1(smartContractWalletAddress, walletContracts.mainModule.abi,
|
|
25620
|
+
const contract = new Contract$1(smartContractWalletAddress, walletContracts.mainModule.abi, rpcProvider);
|
|
25621
25621
|
const result = await contract.nonce();
|
|
25622
25622
|
if (result instanceof BigNumber$1) {
|
|
25623
25623
|
return result;
|
|
@@ -25719,11 +25719,11 @@ const getEip155ChainId = (chainId) => `eip155:${chainId}`;
|
|
|
25719
25719
|
|
|
25720
25720
|
class RelayerClient {
|
|
25721
25721
|
config;
|
|
25722
|
-
|
|
25722
|
+
rpcProvider;
|
|
25723
25723
|
authManager;
|
|
25724
|
-
constructor({ config,
|
|
25724
|
+
constructor({ config, rpcProvider, authManager }) {
|
|
25725
25725
|
this.config = config;
|
|
25726
|
-
this.
|
|
25726
|
+
this.rpcProvider = rpcProvider;
|
|
25727
25727
|
this.authManager = authManager;
|
|
25728
25728
|
}
|
|
25729
25729
|
async postToRelayer(request) {
|
|
@@ -25748,7 +25748,7 @@ class RelayerClient {
|
|
|
25748
25748
|
return jsonResponse;
|
|
25749
25749
|
}
|
|
25750
25750
|
async ethSendTransaction(to, data) {
|
|
25751
|
-
const { chainId } = await this.
|
|
25751
|
+
const { chainId } = await this.rpcProvider.detectNetwork();
|
|
25752
25752
|
const payload = {
|
|
25753
25753
|
method: 'eth_sendTransaction',
|
|
25754
25754
|
params: [{
|
|
@@ -25769,7 +25769,7 @@ class RelayerClient {
|
|
|
25769
25769
|
return result;
|
|
25770
25770
|
}
|
|
25771
25771
|
async imGetFeeOptions(userAddress, data) {
|
|
25772
|
-
const { chainId } = await this.
|
|
25772
|
+
const { chainId } = await this.rpcProvider.detectNetwork();
|
|
25773
25773
|
const payload = {
|
|
25774
25774
|
method: 'im_getFeeOptions',
|
|
25775
25775
|
params: [{
|
|
@@ -25782,7 +25782,7 @@ class RelayerClient {
|
|
|
25782
25782
|
return result;
|
|
25783
25783
|
}
|
|
25784
25784
|
async imSignTypedData(address, eip712Payload) {
|
|
25785
|
-
const { chainId } = await this.
|
|
25785
|
+
const { chainId } = await this.rpcProvider.detectNetwork();
|
|
25786
25786
|
const payload = {
|
|
25787
25787
|
method: 'im_signTypedData',
|
|
25788
25788
|
params: [{
|
|
@@ -25829,11 +25829,11 @@ class JsonRpcError extends Error {
|
|
|
25829
25829
|
}
|
|
25830
25830
|
|
|
25831
25831
|
const MESSAGE_TO_SIGN = 'Only sign this message from Immutable Passport';
|
|
25832
|
-
async function registerZkEvmUser({ authManager, ethSigner, multiRollupApiClients, accessToken,
|
|
25832
|
+
async function registerZkEvmUser({ authManager, ethSigner, multiRollupApiClients, accessToken, rpcProvider, }) {
|
|
25833
25833
|
const [ethereumAddress, ethereumSignature, network, chainListResponse] = await Promise.all([
|
|
25834
25834
|
ethSigner.getAddress(),
|
|
25835
25835
|
signRaw(MESSAGE_TO_SIGN, ethSigner),
|
|
25836
|
-
|
|
25836
|
+
rpcProvider.detectNetwork(),
|
|
25837
25837
|
multiRollupApiClients.chainsApi.listChains(),
|
|
25838
25838
|
]);
|
|
25839
25839
|
const eipChainId = getEip155ChainId(network.chainId);
|
|
@@ -26054,15 +26054,15 @@ const getMetaTransactions = async (metaTransaction, nonce, chainId, walletAddres
|
|
|
26054
26054
|
}
|
|
26055
26055
|
return [metaTransaction, feeMetaTransaction];
|
|
26056
26056
|
};
|
|
26057
|
-
const sendTransaction$1 = ({ params, ethSigner,
|
|
26057
|
+
const sendTransaction$1 = ({ params, ethSigner, rpcProvider, relayerClient, guardianClient, zkevmAddress, }) => guardianClient
|
|
26058
26058
|
.withConfirmationScreen({ width: 480, height: 720 })(async () => {
|
|
26059
26059
|
const transactionRequest = params[0];
|
|
26060
26060
|
if (!transactionRequest.to) {
|
|
26061
26061
|
throw new JsonRpcError(RpcErrorCode.INVALID_PARAMS, 'eth_sendTransaction requires a "to" field');
|
|
26062
26062
|
}
|
|
26063
|
-
const { chainId } = await
|
|
26063
|
+
const { chainId } = await rpcProvider.detectNetwork();
|
|
26064
26064
|
const chainIdBigNumber = BigNumber$1.from(chainId);
|
|
26065
|
-
const nonce = await getNonce(
|
|
26065
|
+
const nonce = await getNonce(rpcProvider, zkevmAddress);
|
|
26066
26066
|
const metaTransaction = {
|
|
26067
26067
|
to: transactionRequest.to,
|
|
26068
26068
|
data: transactionRequest.data,
|
|
@@ -26150,14 +26150,14 @@ const transformTypedData = (typedData, chainId) => {
|
|
|
26150
26150
|
}
|
|
26151
26151
|
return transformedTypedData;
|
|
26152
26152
|
};
|
|
26153
|
-
const signTypedDataV4 = async ({ params, method, ethSigner,
|
|
26153
|
+
const signTypedDataV4 = async ({ params, method, ethSigner, rpcProvider, relayerClient, guardianClient, }) => guardianClient
|
|
26154
26154
|
.withConfirmationScreen({ width: 480, height: 720 })(async () => {
|
|
26155
26155
|
const fromAddress = params[0];
|
|
26156
26156
|
const typedDataParam = params[1];
|
|
26157
26157
|
if (!fromAddress || !typedDataParam) {
|
|
26158
26158
|
throw new JsonRpcError(RpcErrorCode.INVALID_PARAMS, `${method} requires an address and a typed data JSON`);
|
|
26159
26159
|
}
|
|
26160
|
-
const { chainId } = await
|
|
26160
|
+
const { chainId } = await rpcProvider.detectNetwork();
|
|
26161
26161
|
const typedData = transformTypedData(typedDataParam, chainId);
|
|
26162
26162
|
await guardianClient.validateMessage({ chainID: String(chainId), payload: typedData });
|
|
26163
26163
|
const relayerSignature = await relayerClient.imSignTypedData(fromAddress, typedData);
|
|
@@ -26170,7 +26170,7 @@ class ZkEvmProvider {
|
|
|
26170
26170
|
#config;
|
|
26171
26171
|
#eventEmitter;
|
|
26172
26172
|
#guardianClient;
|
|
26173
|
-
#
|
|
26173
|
+
#rpcProvider; // Used for read
|
|
26174
26174
|
#magicAdapter;
|
|
26175
26175
|
#multiRollupApiClients;
|
|
26176
26176
|
#relayerClient;
|
|
@@ -26190,19 +26190,19 @@ class ZkEvmProvider {
|
|
|
26190
26190
|
this.#config = config;
|
|
26191
26191
|
this.#guardianClient = guardianClient;
|
|
26192
26192
|
if (config.crossSdkBridgeEnabled) {
|
|
26193
|
-
//
|
|
26193
|
+
// StaticJsonRpcProvider by default sets the referrer as "client".
|
|
26194
26194
|
// On Unreal 4 this errors as the browser used is expecting a valid URL.
|
|
26195
|
-
this.#
|
|
26195
|
+
this.#rpcProvider = new StaticJsonRpcProvider({
|
|
26196
26196
|
url: this.#config.zkEvmRpcUrl,
|
|
26197
26197
|
fetchOptions: { referrer: 'http://imtblgamesdk.local' },
|
|
26198
26198
|
});
|
|
26199
26199
|
}
|
|
26200
26200
|
else {
|
|
26201
|
-
this.#
|
|
26201
|
+
this.#rpcProvider = new StaticJsonRpcProvider(this.#config.zkEvmRpcUrl);
|
|
26202
26202
|
}
|
|
26203
26203
|
this.#relayerClient = new RelayerClient({
|
|
26204
26204
|
config: this.#config,
|
|
26205
|
-
|
|
26205
|
+
rpcProvider: this.#rpcProvider,
|
|
26206
26206
|
authManager: this.#authManager,
|
|
26207
26207
|
});
|
|
26208
26208
|
this.#multiRollupApiClients = multiRollupApiClients;
|
|
@@ -26273,7 +26273,7 @@ class ZkEvmProvider {
|
|
|
26273
26273
|
authManager: this.#authManager,
|
|
26274
26274
|
multiRollupApiClients: this.#multiRollupApiClients,
|
|
26275
26275
|
accessToken: user.accessToken,
|
|
26276
|
-
|
|
26276
|
+
rpcProvider: this.#rpcProvider,
|
|
26277
26277
|
});
|
|
26278
26278
|
}
|
|
26279
26279
|
else {
|
|
@@ -26291,7 +26291,7 @@ class ZkEvmProvider {
|
|
|
26291
26291
|
params: request.params || [],
|
|
26292
26292
|
ethSigner,
|
|
26293
26293
|
guardianClient: this.#guardianClient,
|
|
26294
|
-
|
|
26294
|
+
rpcProvider: this.#rpcProvider,
|
|
26295
26295
|
relayerClient: this.#relayerClient,
|
|
26296
26296
|
zkevmAddress: this.#zkEvmAddress,
|
|
26297
26297
|
});
|
|
@@ -26309,11 +26309,21 @@ class ZkEvmProvider {
|
|
|
26309
26309
|
method: request.method,
|
|
26310
26310
|
params: request.params || [],
|
|
26311
26311
|
ethSigner,
|
|
26312
|
-
|
|
26312
|
+
rpcProvider: this.#rpcProvider,
|
|
26313
26313
|
relayerClient: this.#relayerClient,
|
|
26314
26314
|
guardianClient: this.#guardianClient,
|
|
26315
26315
|
});
|
|
26316
26316
|
}
|
|
26317
|
+
case 'eth_chainId': {
|
|
26318
|
+
// Call detect network to fetch the chainId so to take advantage of
|
|
26319
|
+
// the caching layer provided by StaticJsonRpcProvider.
|
|
26320
|
+
// In case Passport is changed from StaticJsonRpcProvider to a
|
|
26321
|
+
// JsonRpcProvider, this function will still work as expected given
|
|
26322
|
+
// that detectNetwork call _uncachedDetectNetwork which will force
|
|
26323
|
+
// the provider to re-fetch the chainId from remote.
|
|
26324
|
+
const { chainId } = await this.#rpcProvider.detectNetwork();
|
|
26325
|
+
return utils$3.hexlify(chainId);
|
|
26326
|
+
}
|
|
26317
26327
|
// Pass through methods
|
|
26318
26328
|
case 'eth_gasPrice':
|
|
26319
26329
|
case 'eth_getBalance':
|
|
@@ -26322,13 +26332,12 @@ class ZkEvmProvider {
|
|
|
26322
26332
|
case 'eth_estimateGas':
|
|
26323
26333
|
case 'eth_call':
|
|
26324
26334
|
case 'eth_blockNumber':
|
|
26325
|
-
case 'eth_chainId':
|
|
26326
26335
|
case 'eth_getBlockByHash':
|
|
26327
26336
|
case 'eth_getBlockByNumber':
|
|
26328
26337
|
case 'eth_getTransactionByHash':
|
|
26329
26338
|
case 'eth_getTransactionReceipt':
|
|
26330
26339
|
case 'eth_getTransactionCount': {
|
|
26331
|
-
return this.#
|
|
26340
|
+
return this.#rpcProvider.send(request.method, request.params || []);
|
|
26332
26341
|
}
|
|
26333
26342
|
default: {
|
|
26334
26343
|
throw new JsonRpcError(ProviderErrorCode.UNSUPPORTED_METHOD, 'Method not supported');
|
|
@@ -45415,7 +45424,7 @@ const flattenProperties = (properties) => {
|
|
|
45415
45424
|
};
|
|
45416
45425
|
|
|
45417
45426
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
45418
|
-
const SDK_VERSION = '1.20.
|
|
45427
|
+
const SDK_VERSION = '1.20.4';
|
|
45419
45428
|
const getReferrer = () => {
|
|
45420
45429
|
if (isNode()) {
|
|
45421
45430
|
return '';
|
|
@@ -50610,7 +50619,7 @@ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
|
|
|
50610
50619
|
maxPriorityFeePerGas: BigNumber$1.from(10e9),
|
|
50611
50620
|
};
|
|
50612
50621
|
|
|
50613
|
-
const SDK_VERSION_MARKER = '1.20.
|
|
50622
|
+
const SDK_VERSION_MARKER = '1.20.4';
|
|
50614
50623
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
50615
50624
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
50616
50625
|
|
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.20.
|
|
134
|
+
const SDK_VERSION = '1.20.4';
|
|
135
135
|
const getReferrer = () => {
|
|
136
136
|
if (isNode()) {
|
|
137
137
|
return '';
|