@imtbl/sdk 1.19.2-alpha.1 → 1.19.2-alpha.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.
Files changed (40) hide show
  1. package/dist/blockchain_data.js +2 -2
  2. package/dist/browser/checkout/{BridgeWidget-a1459601.js → BridgeWidget-e20aae24.js} +1 -1
  3. package/dist/browser/checkout/{HorizontalMenu-actual-08754aa6.js → HorizontalMenu-actual-575774d2.js} +1 -1
  4. package/dist/browser/checkout/{OnRampWidget-52218bd1.js → OnRampWidget-66f6516f.js} +1 -1
  5. package/dist/browser/checkout/SaleWidget-661a9733.js +2 -0
  6. package/dist/browser/checkout/{SpendingCapHero-90db2206.js → SpendingCapHero-ef4695ef.js} +1 -1
  7. package/dist/browser/checkout/{SwapWidget-3635434d.js → SwapWidget-6f35a346.js} +1 -1
  8. package/dist/browser/checkout/{TopUpView-67c26c0e.js → TopUpView-4c41c2ba.js} +1 -1
  9. package/dist/browser/checkout/{WalletWidget-2ed51013.js → WalletWidget-a098915f.js} +1 -1
  10. package/dist/browser/checkout/{auto-track-05a079ed.js → auto-track-2347c952.js} +1 -1
  11. package/dist/browser/checkout/{balance-0ee1be7d.js → balance-8eece366.js} +1 -1
  12. package/dist/browser/checkout/{index-56a0f324.js → index-291e03a6.js} +1 -1
  13. package/dist/browser/checkout/{index-5adbc757.js → index-36e30a03.js} +1 -1
  14. package/dist/browser/checkout/index-454df514.js +1 -0
  15. package/dist/browser/checkout/{index-b7601a04.js → index-670cc439.js} +1 -1
  16. package/dist/browser/checkout/{index-db394721.js → index-68b39d4d.js} +1 -1
  17. package/dist/browser/checkout/{index-6c4db150.js → index-9a484e52.js} +1 -1
  18. package/dist/browser/checkout/{index-43d8cc45.js → index-a55bea1a.js} +1 -1
  19. package/dist/browser/checkout/{index-3f3f2ae3.js → index-c9bcb679.js} +2 -2
  20. package/dist/browser/checkout/{index.umd-6ee30c1b.js → index.umd-d7a104a3.js} +1 -1
  21. package/dist/browser/checkout/{retry-27ee3083.js → retry-90e79a4a.js} +1 -1
  22. package/dist/browser/checkout/sdk.js +4 -4
  23. package/dist/browser/checkout/widgets-esm.js +1 -1
  24. package/dist/browser/checkout/widgets.js +5 -5
  25. package/dist/checkout.d.ts +239 -603
  26. package/dist/checkout.js +7 -7
  27. package/dist/config.js +1 -1
  28. package/dist/index.browser.js +13 -13
  29. package/dist/index.browser.js.map +1 -1
  30. package/dist/index.cjs +77 -87
  31. package/dist/index.d.ts +1160 -1718
  32. package/dist/index.js +79 -89
  33. package/dist/orderbook.js +1 -1
  34. package/dist/passport.d.ts +478 -838
  35. package/dist/passport.js +29 -29
  36. package/dist/x.d.ts +103 -657
  37. package/dist/x.js +47 -58
  38. package/package.json +1 -1
  39. package/dist/browser/checkout/SaleWidget-22fef0b5.js +0 -2
  40. package/dist/browser/checkout/index-c652c950.js +0 -1
package/dist/index.js CHANGED
@@ -17,8 +17,8 @@ import jwt_decode from 'jwt-decode';
17
17
  import * as crypto from 'crypto';
18
18
  import { Magic } from 'magic-sdk';
19
19
  import { OpenIdExtension } from '@magic-ext/oidc';
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 { StaticJsonRpcProvider, Web3Provider } from '@ethersproject/providers';
20
+ import { generateLegacyStarkPrivateKey as generateLegacyStarkPrivateKey$1, createStarkSigner as createStarkSigner$1 } from '@imtbl/core-sdk';
21
+ import { JsonRpcProvider, 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.1';
162
+ const SDK_VERSION$1 = '1.19.2-alpha.2';
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.1' };
13538
+ const defaultHeaders$2 = { 'x-sdk-version': 'ts-immutable-sdk-1.19.2-alpha.2' };
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.1',
13610
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.19.2-alpha.2',
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.1' };
14084
+ const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.19.2-alpha.2' };
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.1',
14123
+ sdkVersion: 'ts-immutable-sdk-1.19.2-alpha.2',
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 (staticJsonRpcProvider, smartContractWalletAddress) => {
25618
+ const getNonce = async (jsonRpcProvider, smartContractWalletAddress) => {
25619
25619
  try {
25620
- const contract = new Contract$1(smartContractWalletAddress, walletContracts.mainModule.abi, staticJsonRpcProvider);
25620
+ const contract = new Contract$1(smartContractWalletAddress, walletContracts.mainModule.abi, jsonRpcProvider);
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
- staticJsonRpcProvider;
25722
+ jsonRpcProvider;
25723
25723
  authManager;
25724
- constructor({ config, staticJsonRpcProvider, authManager }) {
25724
+ constructor({ config, jsonRpcProvider, authManager }) {
25725
25725
  this.config = config;
25726
- this.staticJsonRpcProvider = staticJsonRpcProvider;
25726
+ this.jsonRpcProvider = jsonRpcProvider;
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.staticJsonRpcProvider.ready;
25751
+ const { chainId } = await this.jsonRpcProvider.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.staticJsonRpcProvider.ready;
25772
+ const { chainId } = await this.jsonRpcProvider.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.staticJsonRpcProvider.ready;
25785
+ const { chainId } = await this.jsonRpcProvider.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, staticJsonRpcProvider, }) {
25832
+ async function registerZkEvmUser({ authManager, ethSigner, multiRollupApiClients, accessToken, jsonRpcProvider, }) {
25833
25833
  const [ethereumAddress, ethereumSignature, network, chainListResponse] = await Promise.all([
25834
25834
  ethSigner.getAddress(),
25835
25835
  signRaw(MESSAGE_TO_SIGN, ethSigner),
25836
- staticJsonRpcProvider.ready,
25836
+ jsonRpcProvider.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, staticJsonRpcProvider, relayerClient, guardianClient, zkevmAddress, }) => guardianClient
26057
+ const sendTransaction$1 = ({ params, ethSigner, jsonRpcProvider, 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 staticJsonRpcProvider.ready;
26063
+ const { chainId } = await jsonRpcProvider.ready;
26064
26064
  const chainIdBigNumber = BigNumber$1.from(chainId);
26065
- const nonce = await getNonce(staticJsonRpcProvider, zkevmAddress);
26065
+ const nonce = await getNonce(jsonRpcProvider, 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, staticJsonRpcProvider, relayerClient, guardianClient, }) => guardianClient
26153
+ const signTypedDataV4 = async ({ params, method, ethSigner, jsonRpcProvider, 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 staticJsonRpcProvider.ready;
26160
+ const { chainId } = await jsonRpcProvider.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
- #staticJsonRpcProvider; // Used for read
26173
+ #jsonRpcProvider; // 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
- // StaticJsonRpcProvider by default sets the referrer as "client".
26193
+ // JsonRpcProvider 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.#staticJsonRpcProvider = new StaticJsonRpcProvider({
26195
+ this.#jsonRpcProvider = new JsonRpcProvider({
26196
26196
  url: this.#config.zkEvmRpcUrl,
26197
26197
  fetchOptions: { referrer: 'http://imtblgamesdk.local' },
26198
26198
  });
26199
26199
  }
26200
26200
  else {
26201
- this.#staticJsonRpcProvider = new StaticJsonRpcProvider(this.#config.zkEvmRpcUrl);
26201
+ this.#jsonRpcProvider = new JsonRpcProvider(this.#config.zkEvmRpcUrl);
26202
26202
  }
26203
26203
  this.#relayerClient = new RelayerClient({
26204
26204
  config: this.#config,
26205
- staticJsonRpcProvider: this.#staticJsonRpcProvider,
26205
+ jsonRpcProvider: this.#jsonRpcProvider,
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
- staticJsonRpcProvider: this.#staticJsonRpcProvider,
26276
+ jsonRpcProvider: this.#jsonRpcProvider,
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
- staticJsonRpcProvider: this.#staticJsonRpcProvider,
26294
+ jsonRpcProvider: this.#jsonRpcProvider,
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
- staticJsonRpcProvider: this.#staticJsonRpcProvider,
26312
+ jsonRpcProvider: this.#jsonRpcProvider,
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.#staticJsonRpcProvider.send(request.method, request.params || []);
26331
+ return this.#jsonRpcProvider.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.1';
45418
+ const SDK_VERSION = '1.19.2-alpha.2';
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.1';
50613
+ const SDK_VERSION_MARKER = '1.19.2-alpha.2';
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 StaticJsonRpcProvider for chain id: ${fromChainId}`);
51422
+ throw new Error(`Missing JsonRpcProvider 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 StaticJsonRpcProvider(rpcUrl);
52349
+ const provider = new JsonRpcProvider(rpcUrl);
52350
52350
  readOnlyProviders.set(networkInfo.chainId, provider);
52351
52351
  });
52352
52352
  return readOnlyProviders;
@@ -54745,7 +54745,7 @@ async function validateChain(signer, config) {
54745
54745
  async function transfer({ signers: { ethSigner, starkSigner }, request, config, }) {
54746
54746
  await validateChain(ethSigner, config.immutableXConfig);
54747
54747
  const ethAddress = await ethSigner.getAddress();
54748
- const transfersApi = new TransfersApi$2(config.immutableXConfig.apiConfiguration);
54748
+ const transfersApi = new index$2.TransfersApi(config.immutableXConfig.apiConfiguration);
54749
54749
  const transferAmount = request.type === 'ERC721' ? '1' : request.amount;
54750
54750
  const signableResult = await transfersApi.getSignableTransferV1({
54751
54751
  getSignableTransferRequest: {
@@ -54785,7 +54785,7 @@ async function transfer({ signers: { ethSigner, starkSigner }, request, config,
54785
54785
  async function batchTransfer({ signers: { ethSigner, starkSigner }, request, config, }) {
54786
54786
  await validateChain(ethSigner, config.immutableXConfig);
54787
54787
  const ethAddress = await ethSigner.getAddress();
54788
- const transfersApi = new TransfersApi$2(config.immutableXConfig.apiConfiguration);
54788
+ const transfersApi = new index$2.TransfersApi(config.immutableXConfig.apiConfiguration);
54789
54789
  const signableRequests = request.map((nftTransfer) => ({
54790
54790
  amount: '1',
54791
54791
  token: convertToSignableToken({
@@ -54841,7 +54841,7 @@ async function batchTransfer({ signers: { ethSigner, starkSigner }, request, con
54841
54841
  async function createOrder({ signers, request, config, }) {
54842
54842
  await validateChain(signers.ethSigner, config.immutableXConfig);
54843
54843
  const ethAddress = await signers.ethSigner.getAddress();
54844
- const ordersApi = new OrdersApi$3(config.immutableXConfig.apiConfiguration);
54844
+ const ordersApi = new index$2.OrdersApi(config.immutableXConfig.apiConfiguration);
54845
54845
  const amountSell = request.sell.type === 'ERC721' ? '1' : request.sell.amount;
54846
54846
  const amountBuy = request.buy.type === 'ERC721' ? '1' : request.buy.amount;
54847
54847
  const getSignableOrderRequest = {
@@ -54883,7 +54883,7 @@ async function createOrder({ signers, request, config, }) {
54883
54883
  };
54884
54884
  }
54885
54885
  async function cancelOrder({ signers, request, config, }) {
54886
- const ordersApi = new OrdersApi$3(config.immutableXConfig.apiConfiguration);
54886
+ const ordersApi = new index$2.OrdersApi(config.immutableXConfig.apiConfiguration);
54887
54887
  const getSignableCancelOrderResponse = await ordersApi.getSignableCancelOrderV3({
54888
54888
  getSignableCancelOrderRequest: {
54889
54889
  order_id: request.order_id,
@@ -54910,7 +54910,7 @@ async function cancelOrder({ signers, request, config, }) {
54910
54910
 
54911
54911
  async function registerOffchain(signers, config) {
54912
54912
  await validateChain(signers.ethSigner, config.immutableXConfig);
54913
- const usersApi = new UsersApi$2(config.immutableXConfig.apiConfiguration);
54913
+ const usersApi = new index$2.UsersApi(config.immutableXConfig.apiConfiguration);
54914
54914
  const userAddress = await signers.ethSigner.getAddress();
54915
54915
  const starkPublicKey = await signers.starkSigner.getAddress();
54916
54916
  const signableResult = await usersApi.getSignableRegistrationOffchain({
@@ -54934,7 +54934,7 @@ async function registerOffchain(signers, config) {
54934
54934
  }
54935
54935
  async function isRegisteredOffchain(ethAddress, config) {
54936
54936
  try {
54937
- const usersApi = new UsersApi$2(config.immutableXConfig.apiConfiguration);
54937
+ const usersApi = new index$2.UsersApi(config.immutableXConfig.apiConfiguration);
54938
54938
  const getUsersResult = await usersApi.getUsers({
54939
54939
  user: ethAddress,
54940
54940
  });
@@ -54950,7 +54950,7 @@ async function isRegisteredOffchain(ethAddress, config) {
54950
54950
  }
54951
54951
  async function isRegisteredOnChain(starkPublicKey, ethSigner, config) {
54952
54952
  await validateChain(ethSigner, config.immutableXConfig);
54953
- const registrationContract = Contracts.Registration.connect(config.immutableXConfig.ethConfiguration.registrationContractAddress, ethSigner);
54953
+ const registrationContract = exportContracts.Registration.connect(config.immutableXConfig.ethConfiguration.registrationContractAddress, ethSigner);
54954
54954
  try {
54955
54955
  return await registrationContract.isRegistered(starkPublicKey);
54956
54956
  }
@@ -54984,7 +54984,7 @@ const assertIsDefined = (value) => {
54984
54984
  async function prepareWithdrawalAction(params) {
54985
54985
  const { signers: { ethSigner, starkSigner }, type, config, } = params;
54986
54986
  await validateChain(ethSigner, params.config);
54987
- const withdrawalsApi = new WithdrawalsApi$2(config.apiConfiguration);
54987
+ const withdrawalsApi = new index$2.WithdrawalsApi(config.apiConfiguration);
54988
54988
  const withdrawalAmount = type === 'ERC721' ? '1' : params.amount;
54989
54989
  const signableWithdrawalResult = await withdrawalsApi.getSignableWithdrawal({
54990
54990
  getSignableWithdrawalRequest: {
@@ -55012,7 +55012,7 @@ async function prepareWithdrawalAction(params) {
55012
55012
  }
55013
55013
 
55014
55014
  async function getEncodeAssetInfo(assetType, tokenType, config, tokenData) {
55015
- const encodingApi = new EncodingApi$2(config.apiConfiguration);
55015
+ const encodingApi = new index$2.EncodingApi(config.apiConfiguration);
55016
55016
  const result = await encodingApi.encodeAsset({
55017
55017
  assetType,
55018
55018
  encodeAssetRequest: {
@@ -55028,14 +55028,14 @@ async function getEncodeAssetInfo(assetType, tokenType, config, tokenData) {
55028
55028
  async function executeRegisterAndWithdrawERC20({ ethSigner, assetType, starkPublicKey, config, }) {
55029
55029
  const etherKey = await ethSigner.getAddress();
55030
55030
  const imxConfig = config.immutableXConfig;
55031
- const usersApi = new UsersApi$2(imxConfig.apiConfiguration);
55031
+ const usersApi = new index$2.UsersApi(imxConfig.apiConfiguration);
55032
55032
  const signableResult = await getSignableRegistrationOnchain(etherKey, starkPublicKey, usersApi);
55033
- const contract = Contracts.Registration.connect(config.immutableXConfig.ethConfiguration.registrationContractAddress, ethSigner);
55033
+ const contract = exportContracts.Registration.connect(config.immutableXConfig.ethConfiguration.registrationContractAddress, ethSigner);
55034
55034
  const populatedTransaction = await contract.populateTransaction.registerAndWithdraw(etherKey, starkPublicKey, signableResult.operator_signature, assetType);
55035
55035
  return ethSigner.sendTransaction(populatedTransaction);
55036
55036
  }
55037
55037
  async function executeWithdrawERC20(ethSigner, assetType, starkPublicKey, config) {
55038
- const contract = Contracts.Core.connect(config.ethConfiguration.coreContractAddress, ethSigner);
55038
+ const contract = exportContracts.Core.connect(config.ethConfiguration.coreContractAddress, ethSigner);
55039
55039
  const populatedTransaction = await contract.populateTransaction.withdraw(starkPublicKey, assetType);
55040
55040
  return ethSigner.sendTransaction(populatedTransaction);
55041
55041
  }
@@ -55058,15 +55058,15 @@ async function completeERC20WithdrawalAction({ ethSigner, starkPublicKey, token,
55058
55058
  }
55059
55059
 
55060
55060
  async function executeWithdrawMintableERC721(ethSigner, assetType, starkPublicKey, mintingBlob, config) {
55061
- const contract = Contracts.Core.connect(config.ethConfiguration.coreContractAddress, ethSigner);
55061
+ const contract = exportContracts.Core.connect(config.ethConfiguration.coreContractAddress, ethSigner);
55062
55062
  const populatedTransaction = await contract.populateTransaction.withdrawAndMint(starkPublicKey, assetType, mintingBlob);
55063
55063
  return ethSigner.sendTransaction(populatedTransaction);
55064
55064
  }
55065
55065
  async function executeRegisterAndWithdrawMintableERC721(ethSigner, assetType, starkPublicKey, mintingBlob, config) {
55066
55066
  const etherKey = await ethSigner.getAddress();
55067
- const usersApi = new UsersApi$2(config.apiConfiguration);
55067
+ const usersApi = new index$2.UsersApi(config.apiConfiguration);
55068
55068
  const signableResult = await getSignableRegistrationOnchain(etherKey, starkPublicKey, usersApi);
55069
- const contract = Contracts.Registration.connect(config.ethConfiguration.registrationContractAddress, ethSigner);
55069
+ const contract = exportContracts.Registration.connect(config.ethConfiguration.registrationContractAddress, ethSigner);
55070
55070
  const populatedTransaction = await contract.populateTransaction.regsiterAndWithdrawAndMint(etherKey, starkPublicKey, signableResult.operator_signature, assetType, mintingBlob);
55071
55071
  return ethSigner.sendTransaction(populatedTransaction);
55072
55072
  }
@@ -55091,14 +55091,14 @@ async function completeMintableERC721Withdrawal(ethSigner, starkPublicKey, token
55091
55091
  }
55092
55092
  async function executeRegisterAndWithdrawERC721(ethSigner, assetType, starkPublicKey, tokenId, config) {
55093
55093
  const etherKey = await ethSigner.getAddress();
55094
- const usersApi = new UsersApi$2(config.apiConfiguration);
55094
+ const usersApi = new index$2.UsersApi(config.apiConfiguration);
55095
55095
  const signableResult = await getSignableRegistrationOnchain(etherKey, starkPublicKey, usersApi);
55096
- const contract = Contracts.Registration.connect(config.ethConfiguration.registrationContractAddress, ethSigner);
55096
+ const contract = exportContracts.Registration.connect(config.ethConfiguration.registrationContractAddress, ethSigner);
55097
55097
  const populatedTransaction = await contract.populateTransaction.registerAndWithdrawNft(etherKey, starkPublicKey, signableResult.operator_signature, assetType, tokenId);
55098
55098
  return ethSigner.sendTransaction(populatedTransaction);
55099
55099
  }
55100
55100
  async function executeWithdrawERC721(ethSigner, assetType, starkPublicKey, tokenId, config) {
55101
- const contract = Contracts.Core.connect(config.ethConfiguration.coreContractAddress, ethSigner);
55101
+ const contract = exportContracts.Core.connect(config.ethConfiguration.coreContractAddress, ethSigner);
55102
55102
  const populatedTransaction = await contract.populateTransaction.withdrawNft(starkPublicKey, assetType, tokenId);
55103
55103
  return ethSigner.sendTransaction(populatedTransaction);
55104
55104
  }
@@ -55119,7 +55119,7 @@ async function completeERC721WithdrawalAction({ ethSigner, starkPublicKey, token
55119
55119
  const { tokenAddress } = token;
55120
55120
  const { tokenId } = token;
55121
55121
  const imxConfig = config.immutableXConfig;
55122
- const mintsApi = new MintsApi$2(imxConfig.apiConfiguration);
55122
+ const mintsApi = new index$2.MintsApi(imxConfig.apiConfiguration);
55123
55123
  return await mintsApi
55124
55124
  .getMintableTokenDetailsByClientTokenId({
55125
55125
  tokenAddress,
@@ -55144,14 +55144,14 @@ async function completeERC721WithdrawalAction({ ethSigner, starkPublicKey, token
55144
55144
 
55145
55145
  async function executeRegisterAndWithdrawEth(ethSigner, assetType, starkPublicKey, config) {
55146
55146
  const etherKey = await ethSigner.getAddress();
55147
- const usersApi = new UsersApi$2(config.apiConfiguration);
55147
+ const usersApi = new index$2.UsersApi(config.apiConfiguration);
55148
55148
  const signableResult = await getSignableRegistrationOnchain(etherKey, starkPublicKey, usersApi);
55149
- const contract = Contracts.Registration.connect(config.ethConfiguration.registrationContractAddress, ethSigner);
55149
+ const contract = exportContracts.Registration.connect(config.ethConfiguration.registrationContractAddress, ethSigner);
55150
55150
  const populatedTransaction = await contract.populateTransaction.registerAndWithdraw(etherKey, starkPublicKey, signableResult.operator_signature, assetType);
55151
55151
  return ethSigner.sendTransaction(populatedTransaction);
55152
55152
  }
55153
55153
  async function executeWithdrawEth(ethSigner, assetType, starkPublicKey, config) {
55154
- const contract = Contracts.Core.connect(config.ethConfiguration.coreContractAddress, ethSigner);
55154
+ const contract = exportContracts.Core.connect(config.ethConfiguration.coreContractAddress, ethSigner);
55155
55155
  const populatedTransaction = await contract.populateTransaction.withdraw(starkPublicKey, assetType);
55156
55156
  return ethSigner.sendTransaction(populatedTransaction);
55157
55157
  }
@@ -55201,7 +55201,7 @@ async function completeWithdrawal({ signers: { ethSigner }, starkPublicKey, toke
55201
55201
  async function createTrade({ signers: { ethSigner, starkSigner }, request, config, }) {
55202
55202
  await validateChain(ethSigner, config.immutableXConfig);
55203
55203
  const ethAddress = await ethSigner.getAddress();
55204
- const tradesApi = new TradesApi$2(config.immutableXConfig.apiConfiguration);
55204
+ const tradesApi = new index$2.TradesApi(config.immutableXConfig.apiConfiguration);
55205
55205
  const signableResult = await tradesApi.getSignableTrade({
55206
55206
  getSignableTradeRequest: {
55207
55207
  user: ethAddress,
@@ -55237,13 +55237,13 @@ async function createTrade({ signers: { ethSigner, starkSigner }, request, confi
55237
55237
 
55238
55238
  async function executeRegisterAndDepositEth(ethSigner, amount, assetType, starkPublicKey, vaultId, config, usersApi) {
55239
55239
  const etherKey = await ethSigner.getAddress();
55240
- const coreContract = Contracts.Core.connect(config.ethConfiguration.coreContractAddress, ethSigner);
55240
+ const coreContract = exportContracts.Core.connect(config.ethConfiguration.coreContractAddress, ethSigner);
55241
55241
  const signableResult = await getSignableRegistrationOnchain(etherKey, starkPublicKey, usersApi);
55242
55242
  const populatedTransaction = await coreContract.populateTransaction.registerAndDepositEth(etherKey, starkPublicKey, signableResult.operator_signature, assetType, vaultId);
55243
55243
  return ethSigner.sendTransaction({ ...populatedTransaction, value: amount });
55244
55244
  }
55245
55245
  async function executeDepositEth(ethSigner, amount, assetType, starkPublicKey, vaultId, config) {
55246
- const coreContract = Contracts.Core.connect(config.ethConfiguration.coreContractAddress, ethSigner);
55246
+ const coreContract = exportContracts.Core.connect(config.ethConfiguration.coreContractAddress, ethSigner);
55247
55247
  const populatedTransaction = await coreContract.populateTransaction['deposit(uint256,uint256,uint256)'](starkPublicKey, assetType, vaultId);
55248
55248
  return ethSigner.sendTransaction({ ...populatedTransaction, value: amount });
55249
55249
  }
@@ -55255,9 +55255,9 @@ async function depositEth({ signers: { ethSigner }, deposit, config, }) {
55255
55255
  };
55256
55256
  const amount = parseUnits(deposit.amount, 'wei');
55257
55257
  const imxConfig = config.immutableXConfig;
55258
- const depositsApi = new DepositsApi$2(imxConfig.apiConfiguration);
55259
- const encodingApi = new EncodingApi$2(imxConfig.apiConfiguration);
55260
- const usersApi = new UsersApi$2(imxConfig.apiConfiguration);
55258
+ const depositsApi = new index$2.DepositsApi(imxConfig.apiConfiguration);
55259
+ const encodingApi = new index$2.EncodingApi(imxConfig.apiConfiguration);
55260
+ const usersApi = new index$2.UsersApi(imxConfig.apiConfiguration);
55261
55261
  const getSignableDepositRequest = {
55262
55262
  user,
55263
55263
  token: {
@@ -55289,13 +55289,13 @@ async function depositEth({ signers: { ethSigner }, deposit, config, }) {
55289
55289
 
55290
55290
  async function executeRegisterAndDepositERC20(ethSigner, quantizedAmount, assetType, starkPublicKey, vaultId, config, usersApi) {
55291
55291
  const etherKey = await ethSigner.getAddress();
55292
- const coreContract = Contracts.Core.connect(config.coreContractAddress, ethSigner);
55292
+ const coreContract = exportContracts.Core.connect(config.coreContractAddress, ethSigner);
55293
55293
  const signableResult = await getSignableRegistrationOnchain(etherKey, starkPublicKey, usersApi);
55294
55294
  const populatedTransaction = await coreContract.populateTransaction.registerAndDepositERC20(etherKey, starkPublicKey, signableResult.operator_signature, assetType, vaultId, quantizedAmount);
55295
55295
  return ethSigner.sendTransaction(populatedTransaction);
55296
55296
  }
55297
55297
  async function executeDepositERC20(ethSigner, quantizedAmount, assetType, starkPublicKey, vaultId, config) {
55298
- const coreContract = Contracts.Core.connect(config.coreContractAddress, ethSigner);
55298
+ const coreContract = exportContracts.Core.connect(config.coreContractAddress, ethSigner);
55299
55299
  const populatedTransaction = await coreContract.populateTransaction.depositERC20(starkPublicKey, assetType, vaultId, quantizedAmount);
55300
55300
  return ethSigner.sendTransaction(populatedTransaction);
55301
55301
  }
@@ -55303,10 +55303,10 @@ async function depositERC20({ signers: { ethSigner }, deposit, config, }) {
55303
55303
  await validateChain(ethSigner, config.immutableXConfig);
55304
55304
  const { apiConfiguration, ethConfiguration } = config.immutableXConfig;
55305
55305
  const user = await ethSigner.getAddress();
55306
- const tokensApi = new TokensApi$3(apiConfiguration);
55307
- const depositsApi = new DepositsApi$2(apiConfiguration);
55308
- const encodingApi = new EncodingApi$2(apiConfiguration);
55309
- const usersApi = new UsersApi$2(apiConfiguration);
55306
+ const tokensApi = new index$2.TokensApi(apiConfiguration);
55307
+ const depositsApi = new index$2.DepositsApi(apiConfiguration);
55308
+ const encodingApi = new index$2.EncodingApi(apiConfiguration);
55309
+ const usersApi = new index$2.UsersApi(apiConfiguration);
55310
55310
  // Get decimals for this specific ERC20
55311
55311
  const token = await tokensApi.getToken({ address: deposit.tokenAddress });
55312
55312
  // TODO: remove once fixed
@@ -55318,7 +55318,7 @@ async function depositERC20({ signers: { ethSigner }, deposit, config, }) {
55318
55318
  };
55319
55319
  const amount = parseUnits(deposit.amount, 0); // 0 to always use undecimalized value
55320
55320
  // Approve whether an amount of token from an account can be spent by a third-party account
55321
- const tokenContract = Contracts.IERC20.connect(deposit.tokenAddress, ethSigner);
55321
+ const tokenContract = exportContracts.IERC20.connect(deposit.tokenAddress, ethSigner);
55322
55322
  const approveTransaction = await tokenContract.populateTransaction.approve(ethConfiguration.coreContractAddress, amount);
55323
55323
  await ethSigner.sendTransaction(approveTransaction);
55324
55324
  const getSignableDepositRequest = {
@@ -55356,7 +55356,7 @@ async function depositERC20({ signers: { ethSigner }, deposit, config, }) {
55356
55356
  }
55357
55357
 
55358
55358
  async function executeDepositERC721(ethSigner, tokenId, assetType, starkPublicKey, vaultId, config) {
55359
- const coreContract = Contracts.Core.connect(config.ethConfiguration.coreContractAddress, ethSigner);
55359
+ const coreContract = exportContracts.Core.connect(config.ethConfiguration.coreContractAddress, ethSigner);
55360
55360
  const populatedTransaction = await coreContract.populateTransaction.depositNft(starkPublicKey, assetType, vaultId, tokenId);
55361
55361
  return ethSigner.sendTransaction(populatedTransaction);
55362
55362
  }
@@ -55364,9 +55364,9 @@ async function depositERC721({ signers: { ethSigner }, deposit, config, }) {
55364
55364
  await validateChain(ethSigner, config.immutableXConfig);
55365
55365
  const user = await ethSigner.getAddress();
55366
55366
  const { immutableXConfig } = config;
55367
- const depositsApi = new DepositsApi$2(immutableXConfig.apiConfiguration);
55368
- const encodingApi = new EncodingApi$2(immutableXConfig.apiConfiguration);
55369
- const usersApi = new UsersApi$2(immutableXConfig.apiConfiguration);
55367
+ const depositsApi = new index$2.DepositsApi(immutableXConfig.apiConfiguration);
55368
+ const encodingApi = new index$2.EncodingApi(immutableXConfig.apiConfiguration);
55369
+ const usersApi = new index$2.UsersApi(immutableXConfig.apiConfiguration);
55370
55370
  const data = {
55371
55371
  token_address: deposit.tokenAddress,
55372
55372
  token_id: deposit.tokenId,
@@ -55401,7 +55401,7 @@ async function depositERC721({ signers: { ethSigner }, deposit, config, }) {
55401
55401
  const vaultId = signableDepositResult.data.vault_id;
55402
55402
  const isRegistered = await isRegisteredOnChain(starkPublicKey, ethSigner, config);
55403
55403
  // Approve whether an amount of token from an account can be spent by a third-party account
55404
- const tokenContract = Contracts.IERC721.connect(deposit.tokenAddress, ethSigner);
55404
+ const tokenContract = exportContracts.IERC721.connect(deposit.tokenAddress, ethSigner);
55405
55405
  const operator = immutableXConfig.ethConfiguration.coreContractAddress;
55406
55406
  const isApprovedForAll = await tokenContract.isApprovedForAll(user, operator);
55407
55407
  if (!isApprovedForAll) {
@@ -55409,7 +55409,7 @@ async function depositERC721({ signers: { ethSigner }, deposit, config, }) {
55409
55409
  }
55410
55410
  if (!isRegistered) {
55411
55411
  const signableResult = await getSignableRegistrationOnchain(user, starkPublicKey, usersApi);
55412
- const coreContract = Contracts.Core.connect(immutableXConfig.ethConfiguration.coreContractAddress, ethSigner);
55412
+ const coreContract = exportContracts.Core.connect(immutableXConfig.ethConfiguration.coreContractAddress, ethSigner);
55413
55413
  // Note: proxy registration contract registerAndDepositNft method is not used as
55414
55414
  // it currently fails erc721 transfer ownership check
55415
55415
  await coreContract.registerUser(user, starkPublicKey, signableResult.operator_signature);
@@ -55434,7 +55434,7 @@ async function deposit({ signers, deposit, config }) {
55434
55434
 
55435
55435
  async function exchangeTransfer({ signers, request, config, }) {
55436
55436
  await validateChain(signers.ethSigner, config.immutableXConfig);
55437
- const exchangeApi = new ExchangesApi$2(config.immutableXConfig.apiConfiguration);
55437
+ const exchangeApi = new index$2.ExchangesApi(config.immutableXConfig.apiConfiguration);
55438
55438
  const ethAddress = await signers.ethSigner.getAddress();
55439
55439
  const transferAmount = request.amount;
55440
55440
  const signableResult = await exchangeApi.getExchangeSignableTransfer({
@@ -55793,18 +55793,8 @@ class ProviderConfiguration {
55793
55793
  this.immutableXConfig = overrides.immutableXConfig;
55794
55794
  }
55795
55795
  else {
55796
- // TODO: remove once a sensible default is chosen
55797
- // eslint-disable-next-line default-case
55798
- switch (baseConfig.environment) {
55799
- case Environment$1.SANDBOX: {
55800
- this.immutableXConfig = Config.SANDBOX;
55801
- break;
55802
- }
55803
- case Environment$1.PRODUCTION: {
55804
- this.immutableXConfig = Config.PRODUCTION;
55805
- break;
55806
- }
55807
- }
55796
+ const clientConfig = new ImxConfiguration({ baseConfig });
55797
+ this.immutableXConfig = clientConfig.immutableXConfig;
55808
55798
  }
55809
55799
  }
55810
55800
  }
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.1';
134
+ const SDK_VERSION = '1.19.2-alpha.2';
135
135
  const getReferrer = () => {
136
136
  if (isNode()) {
137
137
  return '';