@imtbl/sdk 1.19.2-alpha → 1.19.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.js +2 -2
- package/dist/browser/checkout/{BridgeWidget-24521d11.js → BridgeWidget-a1459601.js} +1 -1
- package/dist/browser/checkout/{HorizontalMenu-actual-6612c0c3.js → HorizontalMenu-actual-08754aa6.js} +1 -1
- package/dist/browser/checkout/{OnRampWidget-d264f707.js → OnRampWidget-52218bd1.js} +1 -1
- package/dist/browser/checkout/SaleWidget-22fef0b5.js +2 -0
- package/dist/browser/checkout/{SpendingCapHero-0db6d7ed.js → SpendingCapHero-90db2206.js} +1 -1
- package/dist/browser/checkout/{SwapWidget-2c06420c.js → SwapWidget-3635434d.js} +1 -1
- package/dist/browser/checkout/{TopUpView-d9658bbd.js → TopUpView-67c26c0e.js} +1 -1
- package/dist/browser/checkout/{WalletWidget-43fb112d.js → WalletWidget-2ed51013.js} +1 -1
- package/dist/browser/checkout/{auto-track-a398bcd2.js → auto-track-05a079ed.js} +1 -1
- package/dist/browser/checkout/{balance-124a9c3c.js → balance-0ee1be7d.js} +1 -1
- package/dist/browser/checkout/{index-80d8482d.js → index-3f3f2ae3.js} +2 -2
- package/dist/browser/checkout/{index-bc84abbd.js → index-43d8cc45.js} +1 -1
- package/dist/browser/checkout/{index-384fe7dd.js → index-56a0f324.js} +1 -1
- package/dist/browser/checkout/{index-e22be227.js → index-5adbc757.js} +1 -1
- package/dist/browser/checkout/{index-5327f330.js → index-6c4db150.js} +1 -1
- package/dist/browser/checkout/{index-6e2b798d.js → index-b7601a04.js} +1 -1
- package/dist/browser/checkout/index-c652c950.js +1 -0
- package/dist/browser/checkout/{index-dcf79a29.js → index-db394721.js} +1 -1
- package/dist/browser/checkout/{index.umd-4fe7c784.js → index.umd-6ee30c1b.js} +1 -1
- package/dist/browser/checkout/{retry-21d3107e.js → retry-27ee3083.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 +5 -5
- package/dist/checkout.d.ts +6 -2
- package/dist/checkout.js +7 -7
- 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 +33 -33
- package/dist/index.d.ts +6 -2
- package/dist/index.js +34 -34
- package/dist/orderbook.js +1 -1
- package/dist/passport.js +29 -29
- package/dist/x.js +3 -3
- package/package.json +1 -1
- package/dist/browser/checkout/SaleWidget-82dbc082.js +0 -2
- package/dist/browser/checkout/index-9ed7d230.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.19.2-alpha';
|
|
184
|
+
const SDK_VERSION$1 = '1.19.2-alpha.1';
|
|
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.19.2-alpha' };
|
|
13560
|
+
const defaultHeaders$2 = { 'x-sdk-version': 'ts-immutable-sdk-1.19.2-alpha.1' };
|
|
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.19.2-alpha',
|
|
13632
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.19.2-alpha.1',
|
|
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.19.2-alpha' };
|
|
14106
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.19.2-alpha.1' };
|
|
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.19.2-alpha',
|
|
14145
|
+
sdkVersion: 'ts-immutable-sdk-1.19.2-alpha.1',
|
|
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 (staticJsonRpcProvider, 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, staticJsonRpcProvider);
|
|
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
|
+
staticJsonRpcProvider;
|
|
25745
25745
|
authManager;
|
|
25746
|
-
constructor({ config,
|
|
25746
|
+
constructor({ config, staticJsonRpcProvider, authManager }) {
|
|
25747
25747
|
this.config = config;
|
|
25748
|
-
this.
|
|
25748
|
+
this.staticJsonRpcProvider = staticJsonRpcProvider;
|
|
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.staticJsonRpcProvider.ready;
|
|
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.staticJsonRpcProvider.ready;
|
|
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.staticJsonRpcProvider.ready;
|
|
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, staticJsonRpcProvider, }) {
|
|
25855
25855
|
const [ethereumAddress, ethereumSignature, network, chainListResponse] = await Promise.all([
|
|
25856
25856
|
ethSigner.getAddress(),
|
|
25857
25857
|
signRaw(MESSAGE_TO_SIGN, ethSigner),
|
|
25858
|
-
|
|
25858
|
+
staticJsonRpcProvider.ready,
|
|
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, staticJsonRpcProvider, 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 staticJsonRpcProvider.ready;
|
|
26086
26086
|
const chainIdBigNumber = ethers.BigNumber.from(chainId);
|
|
26087
|
-
const nonce = await getNonce(
|
|
26087
|
+
const nonce = await getNonce(staticJsonRpcProvider, 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, staticJsonRpcProvider, 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 staticJsonRpcProvider.ready;
|
|
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
|
+
#staticJsonRpcProvider; // 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.#staticJsonRpcProvider = 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.#staticJsonRpcProvider = new providers.StaticJsonRpcProvider(this.#config.zkEvmRpcUrl);
|
|
26224
26224
|
}
|
|
26225
26225
|
this.#relayerClient = new RelayerClient({
|
|
26226
26226
|
config: this.#config,
|
|
26227
|
-
|
|
26227
|
+
staticJsonRpcProvider: this.#staticJsonRpcProvider,
|
|
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
|
+
staticJsonRpcProvider: this.#staticJsonRpcProvider,
|
|
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
|
+
staticJsonRpcProvider: this.#staticJsonRpcProvider,
|
|
26317
26317
|
relayerClient: this.#relayerClient,
|
|
26318
26318
|
zkevmAddress: this.#zkEvmAddress,
|
|
26319
26319
|
});
|
|
@@ -26331,7 +26331,7 @@ class ZkEvmProvider {
|
|
|
26331
26331
|
method: request.method,
|
|
26332
26332
|
params: request.params || [],
|
|
26333
26333
|
ethSigner,
|
|
26334
|
-
|
|
26334
|
+
staticJsonRpcProvider: this.#staticJsonRpcProvider,
|
|
26335
26335
|
relayerClient: this.#relayerClient,
|
|
26336
26336
|
guardianClient: this.#guardianClient,
|
|
26337
26337
|
});
|
|
@@ -26350,7 +26350,7 @@ class ZkEvmProvider {
|
|
|
26350
26350
|
case 'eth_getTransactionByHash':
|
|
26351
26351
|
case 'eth_getTransactionReceipt':
|
|
26352
26352
|
case 'eth_getTransactionCount': {
|
|
26353
|
-
return this.#
|
|
26353
|
+
return this.#staticJsonRpcProvider.send(request.method, request.params || []);
|
|
26354
26354
|
}
|
|
26355
26355
|
default: {
|
|
26356
26356
|
throw new JsonRpcError(ProviderErrorCode.UNSUPPORTED_METHOD, 'Method not supported');
|
|
@@ -45437,7 +45437,7 @@ const flattenProperties = (properties) => {
|
|
|
45437
45437
|
};
|
|
45438
45438
|
|
|
45439
45439
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
45440
|
-
const SDK_VERSION = '1.19.2-alpha';
|
|
45440
|
+
const SDK_VERSION = '1.19.2-alpha.1';
|
|
45441
45441
|
const getReferrer = () => {
|
|
45442
45442
|
if (isNode()) {
|
|
45443
45443
|
return '';
|
|
@@ -50632,7 +50632,7 @@ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
|
|
|
50632
50632
|
maxPriorityFeePerGas: ethers.BigNumber.from(10e9),
|
|
50633
50633
|
};
|
|
50634
50634
|
|
|
50635
|
-
const SDK_VERSION_MARKER = '1.19.2-alpha';
|
|
50635
|
+
const SDK_VERSION_MARKER = '1.19.2-alpha.1';
|
|
50636
50636
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
50637
50637
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
50638
50638
|
|
|
@@ -51441,7 +51441,7 @@ async function bridgeToL2GasEstimator(readOnlyProviders, config) {
|
|
|
51441
51441
|
const toChainId = getL2ChainId(config);
|
|
51442
51442
|
const provider = readOnlyProviders.get(fromChainId);
|
|
51443
51443
|
if (!provider)
|
|
51444
|
-
throw new Error(`Missing
|
|
51444
|
+
throw new Error(`Missing StaticJsonRpcProvider for chain id: ${fromChainId}`);
|
|
51445
51445
|
try {
|
|
51446
51446
|
const tokenBridge = createBridgeInstance(fromChainId, toChainId, readOnlyProviders, config);
|
|
51447
51447
|
// This gas estimate does not include an ERC20 approval
|
|
@@ -52368,7 +52368,7 @@ async function createReadOnlyProviders(config, existingReadOnlyProviders) {
|
|
|
52368
52368
|
});
|
|
52369
52369
|
allowedNetworks.networks.forEach((networkInfo) => {
|
|
52370
52370
|
const rpcUrl = config.networkMap.get(networkInfo.chainId)?.rpcUrls[0];
|
|
52371
|
-
const provider = new providers.
|
|
52371
|
+
const provider = new providers.StaticJsonRpcProvider(rpcUrl);
|
|
52372
52372
|
readOnlyProviders.set(networkInfo.chainId, provider);
|
|
52373
52373
|
});
|
|
52374
52374
|
return readOnlyProviders;
|
package/dist/index.d.ts
CHANGED
|
@@ -21147,6 +21147,10 @@ declare class JsonRpcProvider extends BaseProvider {
|
|
|
21147
21147
|
};
|
|
21148
21148
|
}
|
|
21149
21149
|
|
|
21150
|
+
declare class StaticJsonRpcProvider extends JsonRpcProvider {
|
|
21151
|
+
detectNetwork(): Promise<Network>;
|
|
21152
|
+
}
|
|
21153
|
+
|
|
21150
21154
|
declare type ExternalProvider = {
|
|
21151
21155
|
isMetaMask?: boolean;
|
|
21152
21156
|
isStatus?: boolean;
|
|
@@ -26002,11 +26006,11 @@ interface TokenInfo {
|
|
|
26002
26006
|
}
|
|
26003
26007
|
/**
|
|
26004
26008
|
* Interface representing the parameters for {@link Checkout.getTokenInfo}.
|
|
26005
|
-
* @property {Web3Provider |
|
|
26009
|
+
* @property {Web3Provider | StaticJsonRpcProvider} provider - The provider used to get the balance.
|
|
26006
26010
|
* @property {string} tokenAddress - The contract address of the token.
|
|
26007
26011
|
*/
|
|
26008
26012
|
interface GetTokenInfoParams {
|
|
26009
|
-
provider: Web3Provider |
|
|
26013
|
+
provider: Web3Provider | StaticJsonRpcProvider;
|
|
26010
26014
|
tokenAddress: string;
|
|
26011
26015
|
}
|
|
26012
26016
|
|
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, Config, TransfersApi as TransfersApi$2, OrdersApi as OrdersApi$3, UsersApi as UsersApi$2, Contracts, TradesApi as TradesApi$2, ExchangesApi as ExchangesApi$2, WithdrawalsApi as WithdrawalsApi$2, MintsApi as MintsApi$2, DepositsApi as DepositsApi$2, EncodingApi as EncodingApi$2, TokensApi as TokensApi$3 } from '@imtbl/core-sdk';
|
|
21
|
-
import {
|
|
21
|
+
import { StaticJsonRpcProvider, Web3Provider } 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.19.2-alpha';
|
|
162
|
+
const SDK_VERSION$1 = '1.19.2-alpha.1';
|
|
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.19.2-alpha' };
|
|
13538
|
+
const defaultHeaders$2 = { 'x-sdk-version': 'ts-immutable-sdk-1.19.2-alpha.1' };
|
|
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.19.2-alpha',
|
|
13610
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.19.2-alpha.1',
|
|
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.19.2-alpha' };
|
|
14084
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.19.2-alpha.1' };
|
|
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.19.2-alpha',
|
|
14123
|
+
sdkVersion: 'ts-immutable-sdk-1.19.2-alpha.1',
|
|
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 (staticJsonRpcProvider, smartContractWalletAddress) => {
|
|
25619
25619
|
try {
|
|
25620
|
-
const contract = new Contract$1(smartContractWalletAddress, walletContracts.mainModule.abi,
|
|
25620
|
+
const contract = new Contract$1(smartContractWalletAddress, walletContracts.mainModule.abi, staticJsonRpcProvider);
|
|
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
|
+
staticJsonRpcProvider;
|
|
25723
25723
|
authManager;
|
|
25724
|
-
constructor({ config,
|
|
25724
|
+
constructor({ config, staticJsonRpcProvider, authManager }) {
|
|
25725
25725
|
this.config = config;
|
|
25726
|
-
this.
|
|
25726
|
+
this.staticJsonRpcProvider = staticJsonRpcProvider;
|
|
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.staticJsonRpcProvider.ready;
|
|
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.staticJsonRpcProvider.ready;
|
|
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.staticJsonRpcProvider.ready;
|
|
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, staticJsonRpcProvider, }) {
|
|
25833
25833
|
const [ethereumAddress, ethereumSignature, network, chainListResponse] = await Promise.all([
|
|
25834
25834
|
ethSigner.getAddress(),
|
|
25835
25835
|
signRaw(MESSAGE_TO_SIGN, ethSigner),
|
|
25836
|
-
|
|
25836
|
+
staticJsonRpcProvider.ready,
|
|
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, staticJsonRpcProvider, 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 staticJsonRpcProvider.ready;
|
|
26064
26064
|
const chainIdBigNumber = BigNumber$1.from(chainId);
|
|
26065
|
-
const nonce = await getNonce(
|
|
26065
|
+
const nonce = await getNonce(staticJsonRpcProvider, 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, staticJsonRpcProvider, 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 staticJsonRpcProvider.ready;
|
|
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
|
+
#staticJsonRpcProvider; // 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.#staticJsonRpcProvider = 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.#staticJsonRpcProvider = new StaticJsonRpcProvider(this.#config.zkEvmRpcUrl);
|
|
26202
26202
|
}
|
|
26203
26203
|
this.#relayerClient = new RelayerClient({
|
|
26204
26204
|
config: this.#config,
|
|
26205
|
-
|
|
26205
|
+
staticJsonRpcProvider: this.#staticJsonRpcProvider,
|
|
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
|
+
staticJsonRpcProvider: this.#staticJsonRpcProvider,
|
|
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
|
+
staticJsonRpcProvider: this.#staticJsonRpcProvider,
|
|
26295
26295
|
relayerClient: this.#relayerClient,
|
|
26296
26296
|
zkevmAddress: this.#zkEvmAddress,
|
|
26297
26297
|
});
|
|
@@ -26309,7 +26309,7 @@ class ZkEvmProvider {
|
|
|
26309
26309
|
method: request.method,
|
|
26310
26310
|
params: request.params || [],
|
|
26311
26311
|
ethSigner,
|
|
26312
|
-
|
|
26312
|
+
staticJsonRpcProvider: this.#staticJsonRpcProvider,
|
|
26313
26313
|
relayerClient: this.#relayerClient,
|
|
26314
26314
|
guardianClient: this.#guardianClient,
|
|
26315
26315
|
});
|
|
@@ -26328,7 +26328,7 @@ class ZkEvmProvider {
|
|
|
26328
26328
|
case 'eth_getTransactionByHash':
|
|
26329
26329
|
case 'eth_getTransactionReceipt':
|
|
26330
26330
|
case 'eth_getTransactionCount': {
|
|
26331
|
-
return this.#
|
|
26331
|
+
return this.#staticJsonRpcProvider.send(request.method, request.params || []);
|
|
26332
26332
|
}
|
|
26333
26333
|
default: {
|
|
26334
26334
|
throw new JsonRpcError(ProviderErrorCode.UNSUPPORTED_METHOD, 'Method not supported');
|
|
@@ -45415,7 +45415,7 @@ const flattenProperties = (properties) => {
|
|
|
45415
45415
|
};
|
|
45416
45416
|
|
|
45417
45417
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
45418
|
-
const SDK_VERSION = '1.19.2-alpha';
|
|
45418
|
+
const SDK_VERSION = '1.19.2-alpha.1';
|
|
45419
45419
|
const getReferrer = () => {
|
|
45420
45420
|
if (isNode()) {
|
|
45421
45421
|
return '';
|
|
@@ -50610,7 +50610,7 @@ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
|
|
|
50610
50610
|
maxPriorityFeePerGas: BigNumber$1.from(10e9),
|
|
50611
50611
|
};
|
|
50612
50612
|
|
|
50613
|
-
const SDK_VERSION_MARKER = '1.19.2-alpha';
|
|
50613
|
+
const SDK_VERSION_MARKER = '1.19.2-alpha.1';
|
|
50614
50614
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
50615
50615
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
50616
50616
|
|
|
@@ -51419,7 +51419,7 @@ async function bridgeToL2GasEstimator(readOnlyProviders, config) {
|
|
|
51419
51419
|
const toChainId = getL2ChainId(config);
|
|
51420
51420
|
const provider = readOnlyProviders.get(fromChainId);
|
|
51421
51421
|
if (!provider)
|
|
51422
|
-
throw new Error(`Missing
|
|
51422
|
+
throw new Error(`Missing StaticJsonRpcProvider for chain id: ${fromChainId}`);
|
|
51423
51423
|
try {
|
|
51424
51424
|
const tokenBridge = createBridgeInstance(fromChainId, toChainId, readOnlyProviders, config);
|
|
51425
51425
|
// This gas estimate does not include an ERC20 approval
|
|
@@ -52346,7 +52346,7 @@ async function createReadOnlyProviders(config, existingReadOnlyProviders) {
|
|
|
52346
52346
|
});
|
|
52347
52347
|
allowedNetworks.networks.forEach((networkInfo) => {
|
|
52348
52348
|
const rpcUrl = config.networkMap.get(networkInfo.chainId)?.rpcUrls[0];
|
|
52349
|
-
const provider = new
|
|
52349
|
+
const provider = new StaticJsonRpcProvider(rpcUrl);
|
|
52350
52350
|
readOnlyProviders.set(networkInfo.chainId, provider);
|
|
52351
52351
|
});
|
|
52352
52352
|
return readOnlyProviders;
|
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.19.2-alpha';
|
|
134
|
+
const SDK_VERSION = '1.19.2-alpha.1';
|
|
135
135
|
const getReferrer = () => {
|
|
136
136
|
if (isNode()) {
|
|
137
137
|
return '';
|