@imtbl/sdk 0.4.0-alpha → 0.4.0-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.
@@ -565,16 +565,6 @@ interface ModuleConfiguration<T> {
565
565
  overrides?: T;
566
566
  }
567
567
 
568
- /**
569
- * Interface representing the secondary fees for a swap
570
- * @property {string} feeRecipient - The fee recipient address
571
- * @property {number} feeBasisPoints - The fee percentage in basis points
572
- * @example 100 basis points = 1%
573
- */
574
- type SecondaryFee = {
575
- feeRecipient: string;
576
- feeBasisPoints: number;
577
- };
578
568
  /**
579
569
  * Interface representing a token
580
570
  * @property {number} chainId - The chain ID
@@ -595,7 +585,6 @@ interface ExchangeOverrides {
595
585
  exchangeContracts: ExchangeContracts;
596
586
  commonRoutingTokens: TokenInfo$1[];
597
587
  nativeToken: TokenInfo$1;
598
- secondaryFees?: SecondaryFee[];
599
588
  }
600
589
 
601
590
  /**
@@ -618,8 +607,8 @@ type FungibleToken = Address | 'NATIVE';
618
607
  */
619
608
  declare enum ChainId {
620
609
  IMTBL_ZKEVM_MAINNET = 13371,
621
- IMTBL_ZKEVM_TESTNET = 13372,
622
- IMTBL_ZKEVM_DEVNET = 13423,
610
+ IMTBL_ZKEVM_TESTNET = 13392,
611
+ IMTBL_ZKEVM_DEVNET = 13403,
623
612
  ETHEREUM = 1,
624
613
  SEPOLIA = 11155111
625
614
  }
@@ -989,11 +978,9 @@ interface CreateProviderParams {
989
978
  /**
990
979
  * Represents the result of creating a Web3 provider {@link Checkout.createProvider}.
991
980
  * @property {Web3Provider} provider - The created Web3 provider.
992
- * @property {WalletProviderName} providerName - The name of the wallet provider.
993
981
  */
994
982
  type CreateProviderResult = {
995
983
  provider: Web3Provider;
996
- walletProviderName: WalletProviderName;
997
984
  };
998
985
  /**
999
986
  * Interface representing a wallet filter to be used in {@link GetWalletAllowListParams}.
@@ -1101,7 +1088,6 @@ declare class RemoteConfigFetcher {
1101
1088
  }
1102
1089
  declare class CheckoutConfiguration {
1103
1090
  readonly isDevelopment: boolean;
1104
- readonly isLocal: boolean;
1105
1091
  readonly isProduction: boolean;
1106
1092
  readonly remote: RemoteConfigFetcher;
1107
1093
  readonly environment: Environment;
@@ -10216,7 +10216,7 @@ const ETH_MAINNET_CHAIN_ID = 'eip155:1';
10216
10216
  /**
10217
10217
  * @constant {string} ZKEVM_DEVNET_CHAIN_ID - The chain ID for the zkEVM devnet (EIP-155 compatible format).
10218
10218
  */
10219
- const ZKEVM_DEVNET_CHAIN_ID = 'eip155:13423';
10219
+ const ZKEVM_DEVNET_CHAIN_ID = 'eip155:13403';
10220
10220
  /**
10221
10221
  /**
10222
10222
  * @constant {string} ZKEVM_TESTNET_CHAIN_ID - The chain ID for the zkEVM testnet (EIP-155 compatible format).
@@ -10274,8 +10274,8 @@ const SUPPORTED_BRIDGES_FOR_ENVIRONMENT = {
10274
10274
  */
10275
10275
  const CONTRACTS_FOR_BRIDGE = new Map()
10276
10276
  .set(ETH_SEPOLIA_TO_ZKEVM_DEVNET, {
10277
- rootChainERC20Predicate: '0xf0b3435411A74F1aeCBD0fd6D53a90D5227fEeba',
10278
- rootChainStateSender: '0x868097dbAcfD431F441d09D0e4D3B5eD3182E597',
10277
+ rootChainERC20Predicate: '0x15Dd735de418B6d290727aed82cC25F8966dE4A5',
10278
+ rootChainStateSender: '0xb3Bac13799dAca9D9eC9307303a65fA1218b4724',
10279
10279
  childChainERC20Predicate: '0x0000000000000000000000000000000000001004',
10280
10280
  childChainStateReceiver: '0x0000000000000000000000000000000000001001',
10281
10281
  })
@@ -12512,28 +12512,16 @@ const SUPPORTED_CHAIN_IDS_FOR_ENVIRONMENT = {
12512
12512
  [Environment$1.PRODUCTION]: SUPPORTED_PRODUCTION_CHAINS,
12513
12513
  };
12514
12514
  function validateOverrides(overrides) {
12515
- const keysToCheck = ['rpcURL', 'exchangeContracts', 'commonRoutingTokens', 'nativeToken'];
12516
- for (const key of keysToCheck) {
12517
- if (!overrides[key]) {
12515
+ Object.entries(overrides).forEach(([key, value]) => {
12516
+ if (!value) {
12518
12517
  throw new InvalidConfigurationError(`Missing override: ${key}`);
12519
12518
  }
12520
- }
12519
+ });
12521
12520
  Object.entries(overrides.exchangeContracts).forEach(([key, contract]) => {
12522
12521
  if (!isValidNonZeroAddress(contract)) {
12523
12522
  throw new InvalidConfigurationError(`Invalid exchange contract address for ${key}`);
12524
12523
  }
12525
12524
  });
12526
- if (!overrides.secondaryFees) {
12527
- return;
12528
- }
12529
- for (const secondaryFee of overrides.secondaryFees) {
12530
- if (!isValidNonZeroAddress(secondaryFee.feeRecipient)) {
12531
- throw new InvalidConfigurationError(`Invalid secondary fee recipient address: ${secondaryFee.feeRecipient}`);
12532
- }
12533
- if (secondaryFee.feeBasisPoints < 0 || secondaryFee.feeBasisPoints > 10000) {
12534
- throw new InvalidConfigurationError(`Invalid secondary fee percentage: ${secondaryFee.feeBasisPoints}`);
12535
- }
12536
- }
12537
12525
  }
12538
12526
  /**
12539
12527
  * {@link ExchangeConfiguration} is used to configure the {@link Exchange} class.
@@ -12543,7 +12531,6 @@ function validateOverrides(overrides) {
12543
12531
  class ExchangeConfiguration {
12544
12532
  baseConfig;
12545
12533
  chain;
12546
- secondaryFees;
12547
12534
  constructor({ chainId, baseConfig, overrides }) {
12548
12535
  this.baseConfig = baseConfig;
12549
12536
  if (overrides) {
@@ -12555,10 +12542,8 @@ class ExchangeConfiguration {
12555
12542
  commonRoutingTokens: overrides.commonRoutingTokens,
12556
12543
  nativeToken: overrides.nativeToken,
12557
12544
  };
12558
- this.secondaryFees = overrides.secondaryFees ? overrides.secondaryFees : [];
12559
12545
  return;
12560
12546
  }
12561
- this.secondaryFees = [];
12562
12547
  const chain = SUPPORTED_CHAIN_IDS_FOR_ENVIRONMENT[baseConfig.environment][chainId];
12563
12548
  if (!chain) {
12564
12549
  throw new ChainNotSupportedError(chainId, baseConfig.environment);
@@ -12572,13 +12557,11 @@ class Exchange {
12572
12557
  router;
12573
12558
  chainId;
12574
12559
  nativeToken;
12575
- secondaryFees;
12576
12560
  constructor(configuration) {
12577
12561
  const config = new ExchangeConfiguration(configuration);
12578
12562
  this.chainId = config.chain.chainId;
12579
12563
  this.nativeToken = config.chain.nativeToken;
12580
12564
  this.provider = new ethers.providers.JsonRpcProvider(config.chain.rpcUrl);
12581
- this.secondaryFees = config.secondaryFees;
12582
12565
  this.router = new Router(this.provider, config.chain.commonRoutingTokens, {
12583
12566
  multicallAddress: config.chain.contracts.multicall,
12584
12567
  factoryAddress: config.chain.contracts.coreFactory,
@@ -12661,9 +12644,6 @@ class Exchange {
12661
12644
  async getUnsignedSwapTxFromAmountOut(fromAddress, tokenInAddress, tokenOutAddress, amountOut, slippagePercent = DEFAULT_SLIPPAGE, maxHops = DEFAULT_MAX_HOPS, deadline = DEFAULT_DEADLINE) {
12662
12645
  return await this.getUnsignedSwapTx(fromAddress, tokenInAddress, tokenOutAddress, amountOut, slippagePercent, maxHops, deadline, TradeType.EXACT_OUTPUT);
12663
12646
  }
12664
- thereAreSecondaryFees() {
12665
- return this.secondaryFees.length > 0;
12666
- }
12667
12647
  }
12668
12648
 
12669
12649
  /* eslint-disable class-methods-use-this */
@@ -12740,8 +12720,8 @@ const $762782b6c862d954$export$db5daa1b5156ccfe = [
12740
12720
  */ var $0472f23319457bfb$export$c06e1e7429de6283;
12741
12721
  (function(ChainId) {
12742
12722
  ChainId[ChainId["IMTBL_ZKEVM_MAINNET"] = 13371] = "IMTBL_ZKEVM_MAINNET";
12743
- ChainId[ChainId["IMTBL_ZKEVM_TESTNET"] = 13372] = "IMTBL_ZKEVM_TESTNET";
12744
- ChainId[ChainId["IMTBL_ZKEVM_DEVNET"] = 13423] = "IMTBL_ZKEVM_DEVNET";
12723
+ ChainId[ChainId["IMTBL_ZKEVM_TESTNET"] = 13392] = "IMTBL_ZKEVM_TESTNET";
12724
+ ChainId[ChainId["IMTBL_ZKEVM_DEVNET"] = 13403] = "IMTBL_ZKEVM_DEVNET";
12745
12725
  ChainId[ChainId["ETHEREUM"] = 1] = "ETHEREUM";
12746
12726
  ChainId[ChainId["SEPOLIA"] = 11155111] = "SEPOLIA";
12747
12727
  })($0472f23319457bfb$export$c06e1e7429de6283 || ($0472f23319457bfb$export$c06e1e7429de6283 = {}));
@@ -12826,10 +12806,6 @@ const $d85ad1457a3f1a83$export$161d4a74df65fc08 = {
12826
12806
  [(Environment$1).SANDBOX]: "https://checkout-api.sandbox.immutable.com",
12827
12807
  [(Environment$1).PRODUCTION]: "https://checkout-api.immutable.com"
12828
12808
  };
12829
- const $d85ad1457a3f1a83$export$7b057be2a3f512cc = {
12830
- [(Environment$1).SANDBOX]: "https://zkevm-rpc.sandbox.x.immutable.com",
12831
- [(Environment$1).PRODUCTION]: "https://zkevm-rpc.x.immutable.com"
12832
- };
12833
12809
  const $d85ad1457a3f1a83$export$6f24f3cef7d501c4 = new Map([
12834
12810
  [
12835
12811
  ($0472f23319457bfb$export$c06e1e7429de6283).ETHEREUM,
@@ -12855,7 +12831,7 @@ const $d85ad1457a3f1a83$export$6f24f3cef7d501c4 = new Map([
12855
12831
  chainIdHex: `0x${($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_MAINNET.toString(16)}`,
12856
12832
  chainName: ($0472f23319457bfb$export$b874c6b1dfe85e02).IMTBL_ZKEVM_MAINNET,
12857
12833
  rpcUrls: [
12858
- "https://rpc.immutable.com"
12834
+ "https://zkevm-rpc.x.immutable.com"
12859
12835
  ],
12860
12836
  nativeCurrency: {
12861
12837
  name: "IMX",
@@ -12890,7 +12866,7 @@ const $d85ad1457a3f1a83$export$3e81fc0987227f10 = new Map([
12890
12866
  chainIdHex: `0x${($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_TESTNET.toString(16)}`,
12891
12867
  chainName: ($0472f23319457bfb$export$b874c6b1dfe85e02).IMTBL_ZKEVM_TESTNET,
12892
12868
  rpcUrls: [
12893
- "https://rpc.testnet.immutable.com"
12869
+ "https://zkevm-rpc.sandbox.x.immutable.com"
12894
12870
  ],
12895
12871
  nativeCurrency: {
12896
12872
  name: "IMX",
@@ -13266,19 +13242,16 @@ async function $5c763be0b0b81038$var$getMetaMaskProvider() {
13266
13242
  if (!provider || !provider.request) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("No MetaMask provider installed.", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).METAMASK_PROVIDER_ERROR);
13267
13243
  return new (Web3Provider)(provider);
13268
13244
  }
13269
- async function $5c763be0b0b81038$export$500fbc0cd14cdbaa(walletProviderName) {
13270
- let provider = null;
13271
- switch(walletProviderName){
13245
+ async function $5c763be0b0b81038$export$500fbc0cd14cdbaa(defaultProvider) {
13246
+ let web3Provider = null;
13247
+ switch(defaultProvider){
13272
13248
  case ($e768639828688ca3$export$2d7a51a18d87e21d).METAMASK:
13273
- provider = await $5c763be0b0b81038$var$getMetaMaskProvider();
13249
+ web3Provider = await $5c763be0b0b81038$var$getMetaMaskProvider();
13274
13250
  break;
13275
13251
  default:
13276
13252
  throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Provider not supported", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).DEFAULT_PROVIDER_ERROR);
13277
13253
  }
13278
- return {
13279
- provider: provider,
13280
- walletProviderName: walletProviderName
13281
- };
13254
+ return web3Provider;
13282
13255
  }
13283
13256
 
13284
13257
 
@@ -13287,8 +13260,9 @@ async function $5c763be0b0b81038$export$500fbc0cd14cdbaa(walletProviderName) {
13287
13260
 
13288
13261
 
13289
13262
 
13263
+
13290
13264
  function $bb88265fe45a0393$export$ebe4804963e71f98(web3Provider) {
13291
- if (web3Provider && web3Provider.provider?.request && typeof web3Provider.provider.request === "function") return true;
13265
+ if (web3Provider && web3Provider instanceof (Web3Provider) && web3Provider.provider?.request) return true;
13292
13266
  return false;
13293
13267
  }
13294
13268
  async function $bb88265fe45a0393$export$9e1fd9cc88c637a0(config, web3Provider, validateProviderOptions) {
@@ -13498,23 +13472,10 @@ class $4013c5c91bb535f6$export$6ad73ea7e1b6f37f extends Error {
13498
13472
  this.message = message;
13499
13473
  }
13500
13474
  }
13501
- const $4013c5c91bb535f6$var$networkMap = (prod, dev, local)=>{
13502
- let networks;
13503
- if (dev) networks = ($d85ad1457a3f1a83$export$3a9ebede6a150274);
13504
- else if (prod) {
13505
- networks = ($d85ad1457a3f1a83$export$6f24f3cef7d501c4);
13506
- if (local) {
13507
- const rpcUrls = networks.get(($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_MAINNET)?.rpcUrls;
13508
- rpcUrls?.splice(0, 1, ($d85ad1457a3f1a83$export$7b057be2a3f512cc)[(Environment$1).PRODUCTION]);
13509
- }
13510
- } else {
13511
- networks = ($d85ad1457a3f1a83$export$3e81fc0987227f10);
13512
- if (local) {
13513
- const rpcUrls = networks.get(($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_TESTNET)?.rpcUrls;
13514
- rpcUrls?.splice(0, 1, ($d85ad1457a3f1a83$export$7b057be2a3f512cc)[(Environment$1).SANDBOX]);
13515
- }
13516
- }
13517
- return networks;
13475
+ const $4013c5c91bb535f6$var$networkMap = (prod, dev)=>{
13476
+ if (dev) return $d85ad1457a3f1a83$export$3a9ebede6a150274;
13477
+ if (prod) return $d85ad1457a3f1a83$export$6f24f3cef7d501c4;
13478
+ return $d85ad1457a3f1a83$export$3e81fc0987227f10;
13518
13479
  };
13519
13480
  const $4013c5c91bb535f6$export$9b794d067cdd1af6 = (config)=>{
13520
13481
  // DevMode and Sandbox will both use Sepolia.
@@ -13532,11 +13493,6 @@ class $4013c5c91bb535f6$export$4823433c4a67bbc6 {
13532
13493
  // This will be used to get around the lack of
13533
13494
  // Environment.DEVELOPMENT
13534
13495
  isDevelopment = false;
13535
- // This is a hidden feature that is only available
13536
- // when building the project from source code.
13537
- // This will be used to get around the lack of
13538
- // Environment.LOCAL_DEVELOPMENT
13539
- isLocal = false;
13540
13496
  isProduction;
13541
13497
  remote;
13542
13498
  environment;
@@ -13546,7 +13502,7 @@ class $4013c5c91bb535f6$export$4823433c4a67bbc6 {
13546
13502
  this.environment = config.baseConfig.environment;
13547
13503
  // Developer mode will super set any environment configuration
13548
13504
  this.isProduction = !this.isDevelopment && this.environment === (Environment$1).PRODUCTION;
13549
- this.networkMap = $4013c5c91bb535f6$var$networkMap(this.isProduction, this.isDevelopment, this.isLocal);
13505
+ this.networkMap = $4013c5c91bb535f6$var$networkMap(this.isProduction, this.isDevelopment);
13550
13506
  this.remote = new ($a492ee374ae7b613$export$d902b56530cd5f87)({
13551
13507
  isDevelopment: this.isDevelopment,
13552
13508
  isProduction: this.isProduction
@@ -13692,7 +13648,10 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
13692
13648
  * @param {CreateProviderParams} params - The parameters for creating the provider.
13693
13649
  * @returns {Promise<CreateProviderResult>} A promise that resolves to the created provider.
13694
13650
  */ async createProvider(params) {
13695
- return await $5c763be0b0b81038$export$500fbc0cd14cdbaa(params.walletProvider);
13651
+ const web3Provider = await $5c763be0b0b81038$export$500fbc0cd14cdbaa(params.walletProvider);
13652
+ return {
13653
+ provider: web3Provider
13654
+ };
13696
13655
  }
13697
13656
  /**
13698
13657
  * Checks if a wallet is connected to the specified provider.
@@ -14135,9 +14135,6 @@ declare namespace React {
14135
14135
  // - "string"
14136
14136
  // - union of string literals
14137
14137
  interface SVGAttributes<T> extends AriaAttributes, DOMAttributes<T> {
14138
- // React-specific Attributes
14139
- suppressHydrationWarning?: boolean | undefined;
14140
-
14141
14138
  // Attributes which also defined in HTMLAttributes
14142
14139
  // See comment in SVGDOMPropertyConfig.js
14143
14140
  className?: string | undefined;
@@ -15027,6 +15024,7 @@ type SemanticVersion = {
15027
15024
  * @property {WidgetTheme | undefined} theme - The theme of the Checkout Widget (default: "DARK")
15028
15025
  * @property {Environment | undefined} environment - The environment configuration (default: "SANDBOX")
15029
15026
  * @property {SemanticVersion | undefined} version - The version of the checkout widgets js file to use (default: "0.1.0")
15027
+ * @property {boolean | undefined} isOnRampEnabled - Enable on-ramp top-up method (default: "true")
15030
15028
  * @property {boolean | undefined} isSwapEnabled - Enable swap top-up method (default: "true")
15031
15029
  * @property {boolean | undefined} isBridgeEnabled - Enable bridge top-up method (default: "true")
15032
15030
  */
@@ -15034,6 +15032,7 @@ type CheckoutWidgetsConfig = {
15034
15032
  theme?: WidgetTheme;
15035
15033
  environment?: Environment;
15036
15034
  version?: SemanticVersion;
15035
+ isOnRampEnabled?: boolean;
15037
15036
  isSwapEnabled?: boolean;
15038
15037
  isBridgeEnabled?: boolean;
15039
15038
  };
@@ -4,7 +4,7 @@ import { useEffect } from 'react';
4
4
  function $parcel$export(e, n, v, s) {
5
5
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
6
6
  }
7
- const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.4.0-alpha";
7
+ const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.4.0-alpha.1";
8
8
  const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
9
9
  const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
10
10
 
@@ -10194,14 +10194,14 @@ declare class ImmutableXClient {
10194
10194
  * @returns a promise that resolves with the requested Order
10195
10195
  * @throws {@link index.IMXError}
10196
10196
  */
10197
- getOrder(request: OrdersApiGetOrderRequest): Promise<OrderV3>;
10197
+ getOrder(request: OrdersApiGetOrderRequest): Promise<Order>;
10198
10198
  /**
10199
10199
  * Get a list of Orders
10200
10200
  * @param request - optional object containing the parameters to be provided in the API request
10201
10201
  * @returns a promise that resolves with the requested list of Orders
10202
10202
  * @throws {@link index.IMXError}
10203
10203
  */
10204
- listOrders(request?: OrdersApiListOrdersRequest): Promise<ListOrdersResponseV3>;
10204
+ listOrders(request?: OrdersApiListOrdersRequest): Promise<ListOrdersResponse>;
10205
10205
  /**
10206
10206
  * Get details of a Trade with the given ID
10207
10207
  * @param request - the request object containing the parameters to be provided in the API request
@@ -16,7 +16,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
16
16
  chainID,
17
17
  coreContractAddress,
18
18
  registrationContractAddress,
19
- sdkVersion: 'ts-immutable-sdk-0.4.0-alpha',
19
+ sdkVersion: 'ts-immutable-sdk-0.4.0-alpha.1',
20
20
  });
21
21
  /**
22
22
  * Sets `sdkVersion` at the time of build