@imtbl/sdk 0.28.3 → 0.28.4-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.
package/dist/index.cjs CHANGED
@@ -3651,7 +3651,7 @@ class MultiRollupApiClients {
3651
3651
  }
3652
3652
 
3653
3653
  // eslint-disable-next-line @typescript-eslint/naming-convention
3654
- const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.28.3' };
3654
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.28.4-alpha.2' };
3655
3655
  const createConfig = ({ basePath, headers, }) => {
3656
3656
  if (!basePath.trim()) {
3657
3657
  throw Error('basePath can not be empty');
@@ -3711,7 +3711,7 @@ class APIError extends Error {
3711
3711
 
3712
3712
  /* eslint-disable implicit-arrow-linebreak */
3713
3713
  const defaultHeaders = {
3714
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.28.3',
3714
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.28.4-alpha.2',
3715
3715
  };
3716
3716
  /**
3717
3717
  * createAPIConfiguration to create a custom Configuration
@@ -4122,7 +4122,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
4122
4122
  chainID,
4123
4123
  coreContractAddress,
4124
4124
  registrationContractAddress,
4125
- sdkVersion: 'ts-immutable-sdk-0.28.3',
4125
+ sdkVersion: 'ts-immutable-sdk-0.28.4-alpha.2',
4126
4126
  });
4127
4127
  /**
4128
4128
  * Sets `sdkVersion` at the time of build
@@ -30399,6 +30399,7 @@ async function $1564e43dde50bb61$export$60e0fe116a0e6ed0(web3Provider, walletAdd
30399
30399
  }
30400
30400
  // Blockscout client singleton per chain id
30401
30401
  const $1564e43dde50bb61$var$blockscoutClientMap = new Map();
30402
+ const $1564e43dde50bb61$export$be5483d07cfa803d = ()=>$1564e43dde50bb61$var$blockscoutClientMap.clear();
30402
30403
  const $1564e43dde50bb61$export$8c978679845804d4 = async (walletAddress, chainId, filterTokens)=>{
30403
30404
  // Shuffle the mapping of the tokens configuration so it is a hashmap
30404
30405
  // for faster access to tokens config objects.
@@ -30500,6 +30501,8 @@ const $1564e43dde50bb61$export$a3238cee431627c6 = async (config, web3Provider, w
30500
30501
  };
30501
30502
  };
30502
30503
  const $1564e43dde50bb61$export$fee49741664a4d7e = async (config, web3Provider, walletAddress, chainId)=>{
30504
+ // eslint-disable-next-line no-param-reassign
30505
+ chainId ||= await web3Provider.getSigner().getChainId();
30503
30506
  const { tokens: tokens } = await ($efe60cea83bfc4e8$export$473cec51305fdae8)(config, {
30504
30507
  type: ($08d5ddc39acd6833$export$fd9b17d87f4121d2).ALL,
30505
30508
  chainId: chainId
@@ -30521,7 +30524,7 @@ const $1564e43dde50bb61$export$fee49741664a4d7e = async (config, web3Provider, w
30521
30524
  // Please remove this hack once https://immutable.atlassian.net/browse/WT-1710
30522
30525
  // is done.
30523
30526
  const isL1Chain = ($4013c5c91bb535f6$export$9b794d067cdd1af6)(config) === chainId;
30524
- return ($458d407830d66110$export$5280dbcb91c8b391)(config, `Time to fetch balances using blockscout for ${chainId}`, $1564e43dde50bb61$export$8c978679845804d4(walletAddress, chainId, isL1Chain ? tokens : []));
30527
+ return await ($458d407830d66110$export$5280dbcb91c8b391)(config, `Time to fetch balances using blockscout for ${chainId}`, $1564e43dde50bb61$export$8c978679845804d4(walletAddress, chainId, isL1Chain ? tokens : []));
30525
30528
  }
30526
30529
  // This fallback to use ERC20s calls which is a best effort solution
30527
30530
  // Fails in fetching data from the RCP calls might result in some
@@ -30794,39 +30797,39 @@ function $06a6c5c23f7f2479$export$fbbc17f6e6e58544(address, contractInterface, s
30794
30797
 
30795
30798
  const $2e7bf45a7c9a9570$var$DUMMY_WALLET_ADDRESS = "0x0000000000000000000000000000000000000001";
30796
30799
  const $2e7bf45a7c9a9570$var$DEFAULT_TOKEN_DECIMALS = 18;
30797
- async function $2e7bf45a7c9a9570$var$getTokenInfoByAddress(config, tokenAddress, chainId, provider) {
30798
- if (tokenAddress === "NATIVE") return config.networkMap.get(chainId)?.nativeCurrency;
30799
- const contract = new (ethers.Contract)(tokenAddress, JSON.stringify(($d85ad1457a3f1a83$export$db5daa1b5156ccfe)), provider);
30800
- const name = await contract.name();
30801
- const symbol = await contract.symbol();
30802
- const decimals = await contract.decimals();
30803
- return {
30804
- name: name,
30805
- symbol: symbol,
30806
- decimals: decimals,
30807
- address: tokenAddress
30808
- };
30809
- }
30810
- async function $2e7bf45a7c9a9570$var$bridgeToL2GasEstimator(readOnlyProviders, config, isSpendingCapApprovalRequired, tokenAddress) {
30800
+ async function $2e7bf45a7c9a9570$var$bridgeToL2GasEstimator(readOnlyProviders, config, isSpendingCapApprovalRequired) {
30811
30801
  const fromChainId = ($4013c5c91bb535f6$export$9b794d067cdd1af6)(config);
30812
30802
  const toChainId = ($4013c5c91bb535f6$export$c9af4e4b001c6476)(config);
30813
30803
  const gasEstimateTokensConfig = await config.remote.getConfig("gasEstimateTokens");
30814
- const { gasTokenAddress: gasTokenAddress, fromAddress: fromAddress } = gasEstimateTokensConfig[fromChainId].bridgeToL2Addresses;
30804
+ const { fromAddress: fromAddress } = gasEstimateTokensConfig[fromChainId].bridgeToL2Addresses;
30815
30805
  const provider = readOnlyProviders.get(fromChainId);
30816
30806
  if (!provider) throw new Error(`Missing JsonRpcProvider for chain id: ${fromChainId}`);
30817
30807
  try {
30818
- const gasFee = await (0, $570856c68db0bd36$export$51010590edbe56a6)(provider, isSpendingCapApprovalRequired);
30819
- gasFee.token = await $2e7bf45a7c9a9570$var$getTokenInfoByAddress(config, tokenAddress ?? (gasTokenAddress || "NATIVE"), fromChainId, provider);
30820
- const tokenBridge = await $67fc622a2b913d5f$export$989eefe1274a439c(fromChainId, toChainId, readOnlyProviders, config);
30821
- const { bridgeFee: bridgeFee, bridgeable: bridgeable } = await (0, $570856c68db0bd36$export$9e73e22953cebcfc)(tokenBridge, fromAddress);
30808
+ let gasFees = {};
30809
+ const getGasFees = async ()=>{
30810
+ gasFees = await (0, $570856c68db0bd36$export$51010590edbe56a6)(provider, isSpendingCapApprovalRequired);
30811
+ gasFees.token = config.networkMap.get(fromChainId)?.nativeCurrency;
30812
+ };
30813
+ let bridgeFees = {
30814
+ bridgeFee: {},
30815
+ bridgeable: false
30816
+ };
30817
+ const getBridgeFees = async ()=>{
30818
+ const tokenBridge = await $67fc622a2b913d5f$export$989eefe1274a439c(fromChainId, toChainId, readOnlyProviders, config);
30819
+ bridgeFees = await (0, $570856c68db0bd36$export$9e73e22953cebcfc)(tokenBridge, fromAddress);
30820
+ };
30821
+ await Promise.all([
30822
+ getGasFees(),
30823
+ getBridgeFees()
30824
+ ]);
30822
30825
  return {
30823
30826
  gasEstimateType: (0, $de275b98d2b651c3$export$788b1fd17f3dad84).BRIDGE_TO_L2,
30824
- gasFee: gasFee,
30827
+ gasFee: gasFees,
30825
30828
  bridgeFee: {
30826
- estimatedAmount: bridgeFee?.estimatedAmount,
30827
- token: bridgeFee?.token
30829
+ estimatedAmount: bridgeFees.bridgeFee?.estimatedAmount,
30830
+ token: bridgeFees.bridgeFee?.token
30828
30831
  },
30829
- bridgeable: bridgeable
30832
+ bridgeable: bridgeFees.bridgeable
30830
30833
  };
30831
30834
  } catch {
30832
30835
  // In the case of an error, just return an empty gas & bridge fee estimate
@@ -30875,7 +30878,7 @@ async function $2e7bf45a7c9a9570$var$swapGasEstimator(config) {
30875
30878
  async function $2e7bf45a7c9a9570$export$942c8de7174809fc(params, readOnlyProviders, config) {
30876
30879
  switch(params.gasEstimateType){
30877
30880
  case ($de275b98d2b651c3$export$788b1fd17f3dad84).BRIDGE_TO_L2:
30878
- return await $2e7bf45a7c9a9570$var$bridgeToL2GasEstimator(readOnlyProviders, config, params.isSpendingCapApprovalRequired, params.tokenAddress);
30881
+ return await $2e7bf45a7c9a9570$var$bridgeToL2GasEstimator(readOnlyProviders, config, params.isSpendingCapApprovalRequired);
30879
30882
  case ($de275b98d2b651c3$export$788b1fd17f3dad84).SWAP:
30880
30883
  return await $2e7bf45a7c9a9570$var$swapGasEstimator(config);
30881
30884
  default:
@@ -30892,6 +30895,7 @@ async function $2e7bf45a7c9a9570$export$942c8de7174809fc(params, readOnlyProvide
30892
30895
 
30893
30896
 
30894
30897
 
30898
+
30895
30899
  const $ddc6bcd0896481e5$export$2fbfa41a4de56a89 = (erc20allowances, erc721allowances)=>{
30896
30900
  const aggregatedAllowances = [];
30897
30901
  if (!erc20allowances.sufficient) {
@@ -31198,7 +31202,7 @@ const $35c3fc7013888ba5$export$be546c525d418988 = async (provider, ownerAddress,
31198
31202
 
31199
31203
 
31200
31204
 
31201
- /* eslint-disable arrow-body-style */
31205
+
31202
31206
 
31203
31207
 
31204
31208
 
@@ -31391,17 +31395,14 @@ const $73d2282a108cc7e2$export$6ab9757fda54db7e = (itemRequirement, balances)=>{
31391
31395
  /**
31392
31396
  * Gets the balances for all NATIVE and ERC20 balance requirements.
31393
31397
  */ const $beb896e098e41faf$var$getTokenBalances = async (config, provider, ownerAddress, itemRequirements)=>{
31394
- let tokenBalances = [];
31395
31398
  try {
31396
- const tokenList = (0, $73d2282a108cc7e2$export$ed7929b58bab85da)(itemRequirements);
31397
- const { balances: balances } = await (0, $1564e43dde50bb61$export$a3238cee431627c6)(config, provider, ownerAddress, tokenList);
31398
- tokenBalances = [
31399
- ...balances.map((balance)=>balance)
31400
- ];
31399
+ const tokenMap = new Map();
31400
+ (0, $73d2282a108cc7e2$export$ed7929b58bab85da)(itemRequirements).forEach((item)=>tokenMap.set((item.address || "").toLocaleLowerCase(), item));
31401
+ const { balances: balances } = await (0, $1564e43dde50bb61$export$fee49741664a4d7e)(config, provider, ownerAddress);
31402
+ return balances.filter((balance)=>tokenMap.get((balance.token.address || "").toLocaleLowerCase()));
31401
31403
  } catch (error) {
31402
31404
  throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Failed to get balances", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).GET_BALANCE_ERROR);
31403
31405
  }
31404
- return tokenBalances;
31405
31406
  };
31406
31407
  /**
31407
31408
  * Gets the balances for all ERC721 balance requirements.
@@ -31439,42 +31440,46 @@ const $73d2282a108cc7e2$export$6ab9757fda54db7e = (itemRequirement, balances)=>{
31439
31440
  };
31440
31441
  const $beb896e098e41faf$export$ddfc885f43c3cb6e = async (config, provider, ownerAddress, itemRequirements)=>{
31441
31442
  const aggregatedItems = ($aa6caea9a60d18c7$export$f96d1c819a615a64)(itemRequirements);
31442
- if (aggregatedItems.filter((itemRequirement)=>{
31443
- return itemRequirement.type !== ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC721 && itemRequirement.type !== ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20 && itemRequirement.type !== ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE;
31444
- }).length > 0) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Unsupported item requirement balance check", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).UNSUPPORTED_BALANCE_REQUIREMENT_ERROR);
31443
+ const requiredToken = [];
31444
+ const requiredERC721 = [];
31445
+ aggregatedItems.forEach((item)=>{
31446
+ switch(item.type){
31447
+ case ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20:
31448
+ case ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE:
31449
+ requiredToken.push(item);
31450
+ break;
31451
+ case ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC721:
31452
+ requiredERC721.push(item);
31453
+ break;
31454
+ }
31455
+ });
31456
+ if (requiredERC721.length === 0 && requiredToken.length === 0) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Unsupported item requirement balance check", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).UNSUPPORTED_BALANCE_REQUIREMENT_ERROR);
31445
31457
  // Get all ERC20 and NATIVE balances
31446
- const currentBalances = [];
31447
- const tokenItemRequirements = aggregatedItems.filter((itemRequirement)=>itemRequirement.type === ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20 || itemRequirement.type === ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE);
31448
- if (tokenItemRequirements.length > 0) currentBalances.push($beb896e098e41faf$var$getTokenBalances(config, provider, ownerAddress, aggregatedItems));
31458
+ const balancePromises = [];
31459
+ if (requiredToken.length > 0) balancePromises.push($beb896e098e41faf$var$getTokenBalances(config, provider, ownerAddress, aggregatedItems));
31449
31460
  // Get all ERC721 balances
31450
- const erc721ItemRequirements = aggregatedItems.filter((itemRequirement)=>itemRequirement.type === ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC721);
31451
- if (erc721ItemRequirements.length > 0) currentBalances.push($beb896e098e41faf$var$getERC721Balances(provider, ownerAddress, aggregatedItems));
31461
+ if (requiredERC721.length > 0) balancePromises.push($beb896e098e41faf$var$getERC721Balances(provider, ownerAddress, aggregatedItems));
31452
31462
  // Wait for all balances and calculate the requirements
31453
- const balanceRequirements = await Promise.all(currentBalances).then((balances)=>{
31454
- const requirements = [];
31455
- if (balances.length > 1 || tokenItemRequirements.length > 0) {
31456
- const tokenBalances = balances[0];
31457
- tokenItemRequirements.forEach((tokenItemRequirement)=>{
31458
- requirements.push(($73d2282a108cc7e2$export$6ab9757fda54db7e)(tokenItemRequirement, tokenBalances));
31459
- });
31460
- if (erc721ItemRequirements.length > 0) {
31461
- const erc721Balances = balances[1];
31462
- erc721ItemRequirements.forEach((erc721ItemRequirement)=>{
31463
- requirements.push(($73d2282a108cc7e2$export$9b757e40b19984c3)(erc721ItemRequirement, erc721Balances));
31464
- });
31465
- }
31466
- } else if (erc721ItemRequirements.length > 0) {
31467
- // Only erc721
31468
- const erc721Balances = balances[0];
31469
- erc721ItemRequirements.forEach((erc721ItemRequirement)=>{
31470
- requirements.push(($73d2282a108cc7e2$export$9b757e40b19984c3)(erc721ItemRequirement, erc721Balances));
31471
- });
31472
- }
31473
- return requirements;
31474
- });
31475
- const sufficient = balanceRequirements.reduce((acc, balanceRequirement)=>{
31476
- return acc && balanceRequirement.sufficient;
31477
- }, true);
31463
+ const promisesResponses = await Promise.all(balancePromises);
31464
+ const balanceRequirements = [];
31465
+ // Get all ERC20 and NATIVE balances
31466
+ if (requiredToken.length > 0 && promisesResponses.length > 0) {
31467
+ const result = promisesResponses.shift();
31468
+ if (result) requiredToken.forEach((item)=>{
31469
+ balanceRequirements.push(($73d2282a108cc7e2$export$6ab9757fda54db7e)(item, result));
31470
+ });
31471
+ }
31472
+ // Get all ERC721 balances
31473
+ if (requiredERC721.length > 0 && promisesResponses.length > 0) {
31474
+ const result = promisesResponses.shift();
31475
+ if (result) requiredERC721.forEach((item)=>{
31476
+ balanceRequirements.push(($73d2282a108cc7e2$export$9b757e40b19984c3)(item, result));
31477
+ });
31478
+ }
31479
+ // Find if there are any requirements that aren't sufficient.
31480
+ // If there is not item with sufficient === false then the requirements
31481
+ // are satisfied.
31482
+ const sufficient = balanceRequirements.find((req)=>req.sufficient === false) === undefined;
31478
31483
  return {
31479
31484
  sufficient: sufficient,
31480
31485
  balanceRequirements: balanceRequirements
@@ -32058,7 +32063,9 @@ const $15fe1c77041bd4f4$export$9e73e22953cebcfc = async (config, readOnlyProvide
32058
32063
 
32059
32064
  const $887d24b47765b1c0$export$c37d8687c27b9660 = "0x0000000000000000000000000000000000000001";
32060
32065
  const $887d24b47765b1c0$export$1430626eec86fce9 = (chainId)=>{
32066
+ if (chainId === ($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_MAINNET) return "imtbl-zkevm-mainnet";
32061
32067
  if (chainId === ($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_TESTNET) return "imtbl-zkevm-testnet";
32068
+ if (chainId === ($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_DEVNET) return "imtbl-zkevm-devent";
32062
32069
  return "";
32063
32070
  };
32064
32071
  const $887d24b47765b1c0$export$53e663abd9b77fc1 = async (chainId, config)=>{
@@ -32879,7 +32886,6 @@ const $a7367d01c6e76b1c$export$d62081fac18000c2 = (orderHash, orderComponents, a
32879
32886
 
32880
32887
 
32881
32888
 
32882
-
32883
32889
  const $9051cee080948594$export$9ac1563efd38130 = 1; // 100%
32884
32890
  const $9051cee080948594$export$768e717351d4b176 = 6; // will allow 0.000001 (0.0001%) as the minimum value
32885
32891
  const $9051cee080948594$var$calculateFeesPercent = (orderFee, amountBn)=>{
@@ -32920,6 +32926,7 @@ const $9051cee080948594$export$1e69c9cfc42e28d8 = (orderFees, weiAmount, decimal
32920
32926
 
32921
32927
 
32922
32928
 
32929
+
32923
32930
  const $64863c39386de592$export$4249179755829904 = (type, contractAddress, amount, spenderAddress)=>{
32924
32931
  switch(type){
32925
32932
  case ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20:
@@ -32951,16 +32958,24 @@ const $64863c39386de592$export$8f2ff92ab8657f0b = (gasLimit, fulfillmentTransact
32951
32958
  };
32952
32959
  };
32953
32960
  const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, orders)=>{
32954
- let orderbook;
32961
+ if (orders.length === 0) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("No orders were provided to the orders array. Please provide at least one order.", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).FULFILL_ORDER_LISTING_ERROR);
32955
32962
  let order;
32956
32963
  let spenderAddress = "";
32964
+ let decimals = 18;
32957
32965
  const gasLimit = (constants).estimatedFulfillmentGasGwei;
32958
- if (orders.length === 0) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("No orders were provided to the orders array. Please provide at least one order.", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).FULFILL_ORDER_LISTING_ERROR);
32966
+ const orderbook = $67fc622a2b913d5f$export$c60ce6c6a92bc2ff(config);
32967
+ const blockchainClient = $67fc622a2b913d5f$export$436dd76f23f463ff(config);
32968
+ const fulfillerAddress = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Time to get the address from the provider", provider.getSigner().getAddress());
32969
+ // Prefetch balances and store them in memory
32970
+ ($1564e43dde50bb61$export$be5483d07cfa803d)();
32971
+ ($1564e43dde50bb61$export$fee49741664a4d7e)(config, provider, fulfillerAddress, ($4013c5c91bb535f6$export$9b794d067cdd1af6)(config));
32972
+ ($1564e43dde50bb61$export$fee49741664a4d7e)(config, provider, fulfillerAddress, ($4013c5c91bb535f6$export$c9af4e4b001c6476)(config));
32959
32973
  const { id: id, takerFees: takerFees } = orders[0];
32974
+ let orderChainName;
32960
32975
  try {
32961
- orderbook = $67fc622a2b913d5f$export$c60ce6c6a92bc2ff(config);
32962
32976
  order = await (0, $458d407830d66110$export$5280dbcb91c8b391)(config, "Time to fetch the listing from the orderbook", orderbook.getListing(id));
32963
- const { seaportContractAddress: seaportContractAddress } = orderbook.config();
32977
+ const { seaportContractAddress: seaportContractAddress, chainName: chainName } = orderbook.config();
32978
+ orderChainName = chainName;
32964
32979
  spenderAddress = seaportContractAddress;
32965
32980
  } catch (err) {
32966
32981
  throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("An error occurred while getting the order listing", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).GET_ORDER_LISTING_ERROR, {
@@ -32973,10 +32988,12 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
32973
32988
  message: "No buy side tokens found on order"
32974
32989
  });
32975
32990
  const buyToken = order.result.buy[0];
32976
- let decimals = 18;
32977
- if (order.result.buy[0].type === "ERC20") {
32978
- const tokenContract = $06a6c5c23f7f2479$export$fbbc17f6e6e58544(order.result.buy[0].contractAddress, ($d85ad1457a3f1a83$export$db5daa1b5156ccfe), provider);
32979
- decimals = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Time to get decimals of token contract for the buy token", tokenContract.decimals());
32991
+ if (buyToken.type === "ERC20") {
32992
+ const token = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Time to get decimals of token contract for the buy token", blockchainClient.getToken({
32993
+ contractAddress: buyToken.contractAddress,
32994
+ chainName: orderChainName
32995
+ }));
32996
+ if (token.result.decimals) decimals = token.result.decimals;
32980
32997
  }
32981
32998
  let fees = [];
32982
32999
  if (takerFees && takerFees.length > 0) fees = ($9051cee080948594$export$1e69c9cfc42e28d8)(takerFees, buyToken.amount, decimals);
@@ -32985,7 +33002,6 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
32985
33002
  let orderActions = [];
32986
33003
  const fulfillOrderStartTime = performance.now();
32987
33004
  try {
32988
- const fulfillerAddress = await (0, $458d407830d66110$export$5280dbcb91c8b391)(config, "Time to get the address from the provider", provider.getSigner().getAddress());
32989
33005
  const { actions: actions } = await (0, $458d407830d66110$export$5280dbcb91c8b391)(config, "Time to call fulfillOrder from the orderbook", orderbook.fulfillOrder(id, fulfillerAddress, fees));
32990
33006
  orderActions = actions;
32991
33007
  unsignedApprovalTransactions = await (0, $458d407830d66110$export$5280dbcb91c8b391)(config, "Time to construct the unsigned approval transactions", (0, $a7367d01c6e76b1c$export$f64a20a30eb98855)(actions));
@@ -33365,10 +33381,8 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
33365
33381
  allowUnsupportedProvider: true
33366
33382
  });
33367
33383
  await $c99672cf2294e839$export$43f7168eb392a88c(web3Provider);
33368
- const networkInfo = await $de192de6ef100f9f$export$79f13b4cfaaf0d09(this.config, web3Provider);
33369
33384
  return {
33370
- provider: web3Provider,
33371
- network: networkInfo
33385
+ provider: web3Provider
33372
33386
  };
33373
33387
  }
33374
33388
  /**
@@ -33587,7 +33601,7 @@ var $045213b18e9f1f94$export$75be0f6af9650f2c;
33587
33601
  })($045213b18e9f1f94$export$75be0f6af9650f2c || ($045213b18e9f1f94$export$75be0f6af9650f2c = {}));
33588
33602
 
33589
33603
 
33590
- const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.28.3";
33604
+ const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.28.4-alpha.2";
33591
33605
  const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
33592
33606
  const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
33593
33607
 
@@ -33772,6 +33786,7 @@ $parcel$export($9b3189b6b155842e$exports, "SaleEventType", () => $9b3189b6b15584
33772
33786
  SaleEventType["SUCCESS"] = "success";
33773
33787
  SaleEventType["FAILURE"] = "failure";
33774
33788
  SaleEventType["REJECTED"] = "rejected";
33789
+ SaleEventType["TRANSACTION_SUCCESS"] = "transaction-success";
33775
33790
  })($9b3189b6b155842e$export$881881ffb3bd733e || ($9b3189b6b155842e$export$881881ffb3bd733e = {}));
33776
33791
 
33777
33792
 
@@ -33881,7 +33896,7 @@ function $b222a8f062090058$export$fae4199086a966a3(tagName, passport) {
33881
33896
  if (attempts >= maxAttempts) {
33882
33897
  window.clearInterval(timer);
33883
33898
  // eslint-disable-next-line no-console
33884
- console.error("failed to set the provider");
33899
+ console.error("failed to set the provider", err);
33885
33900
  }
33886
33901
  }
33887
33902
  };
package/dist/index.d.ts CHANGED
@@ -15926,15 +15926,6 @@ type ExchangeOverrides = {
15926
15926
  wrappedNativeToken: ERC20;
15927
15927
  };
15928
15928
 
15929
- /**
15930
- * @typedef {string} Address - Represents an Ethereum address.
15931
- */
15932
- type Address = string;
15933
- /**
15934
- * @typedef {Address | 'NATIVE'} FungibleToken - Represents a fungible token, either an ERC20 token address or the native token.
15935
- */
15936
- type FungibleToken = Address | 'NATIVE';
15937
-
15938
15929
  /**
15939
15930
  * Enum representing different chain IDs.
15940
15931
  * @enum {number}
@@ -16713,20 +16704,6 @@ type ChainTokensConfig = {
16713
16704
  allowed?: TokenInfo[];
16714
16705
  blockscout?: boolean;
16715
16706
  };
16716
- /**
16717
- * Represents information about a network.
16718
- * @interface NetworkInfo
16719
- * @property {string} name - The name of the network.
16720
- * @property {number} chainId - The chain ID of the network.
16721
- * @property {TokenInfo} nativeCurrency - Information about the native currency of the network.
16722
- * @property {boolean} isSupported - Indicates whether the network is supported.
16723
- */
16724
- interface NetworkInfo {
16725
- name: string;
16726
- chainId: number;
16727
- nativeCurrency: TokenInfo;
16728
- isSupported: boolean;
16729
- }
16730
16707
  /**
16731
16708
  * Interface representing the params of {@link Checkout.connect}.
16732
16709
  * @property {Web3Provider} provider - The provider used to connect to the network.
@@ -16737,11 +16714,9 @@ interface ConnectParams {
16737
16714
  /**
16738
16715
  * Interface representing the result of {@link Checkout.connect}.
16739
16716
  * @property {Web3Provider} provider - The provider used to connect to the network.
16740
- * @property {NetworkInfo} network - Information about the connected network.
16741
16717
  */
16742
16718
  interface ConnectResult {
16743
16719
  provider: Web3Provider;
16744
- network: NetworkInfo;
16745
16720
  }
16746
16721
  /**
16747
16722
  * Interface representing the params of {@link Checkout.checkIsWalletConnected}.
@@ -16779,12 +16754,10 @@ type GasEstimateParams = GasEstimateBridgeToL2Params | GasEstimateSwapParams;
16779
16754
  * An interface representing the parameters for estimating gas for a bridge to L2 transaction {@link Checkout.gasEstimate}.
16780
16755
  * @param {GasEstimateType.BRIDGE_TO_L2} gasEstimateType - The type of gas estimate.
16781
16756
  * @param {boolean} isSpendingCapApprovalRequired - Whether or not spending cap approval is required.
16782
- * @param {FungibleToken | undefined} tokenAddress - The address of the fungible token to use in the transaction.
16783
16757
  */
16784
16758
  interface GasEstimateBridgeToL2Params {
16785
16759
  gasEstimateType: GasEstimateType.BRIDGE_TO_L2;
16786
16760
  isSpendingCapApprovalRequired: boolean;
16787
- tokenAddress?: FungibleToken;
16788
16761
  }
16789
16762
  /**
16790
16763
  * An interface representing the parameters for a gas estimate swap {@link Checkout.gasEstimate}.
@@ -16822,6 +16795,20 @@ interface TokenAmountEstimate {
16822
16795
  estimatedAmount?: BigNumber;
16823
16796
  token?: TokenInfo;
16824
16797
  }
16798
+ /**
16799
+ * Represents information about a network.
16800
+ * @interface NetworkInfo
16801
+ * @property {string} name - The name of the network.
16802
+ * @property {number} chainId - The chain ID of the network.
16803
+ * @property {TokenInfo} nativeCurrency - Information about the native currency of the network.
16804
+ * @property {boolean} isSupported - Indicates whether the network is supported.
16805
+ */
16806
+ interface NetworkInfo {
16807
+ name: string;
16808
+ chainId: number;
16809
+ nativeCurrency: TokenInfo;
16810
+ isSupported: boolean;
16811
+ }
16825
16812
  /**
16826
16813
  * Interface representing the parameters for {@link Checkout.switchNetwork}.
16827
16814
  * @property {Web3Provider} provider - The provider to connect to the network.
@@ -32175,11 +32162,12 @@ declare enum SaleEventType {
32175
32162
  CLOSE_WIDGET = "close-widget",
32176
32163
  SUCCESS = "success",
32177
32164
  FAILURE = "failure",
32178
- REJECTED = "rejected"
32165
+ REJECTED = "rejected",
32166
+ TRANSACTION_SUCCESS = "transaction-success"
32179
32167
  }
32180
32168
  /**
32181
32169
  * Represents a successful Sale transaction.
32182
- * @property {string} transactionHash - The hash of the successful transaction.
32170
+ * @property {Array} transactions - The executed transactions
32183
32171
  */
32184
32172
  type SaleSuccess = {
32185
32173
  transactions: {
@@ -32192,10 +32180,25 @@ type SaleSuccess = {
32192
32180
  * Type representing a Sale Widget with type FAILURE.
32193
32181
  * @property {string} reason - The reason why the swap failed.
32194
32182
  * @property {number} timestamp - The timestamp of the failed swap.
32183
+ * @property {Array} transactions - The executed transactions
32195
32184
  */
32196
32185
  type SaleFailed = {
32197
32186
  reason: string;
32198
32187
  timestamp: number;
32188
+ transactions: {
32189
+ method: string;
32190
+ hash: string | undefined;
32191
+ }[];
32192
+ };
32193
+ /**
32194
+ * Type representing a Sale Widget with type TRANSACTION_SUCCESS.
32195
+ * @property {Object} transactions - The executed transactions
32196
+ */
32197
+ type SaleTransactionSuccess = {
32198
+ transactions: {
32199
+ method: string;
32200
+ hash: string | undefined;
32201
+ }[];
32199
32202
  };
32200
32203
  /**
32201
32204
  * Enum representing the events emitted by the widgets.
@@ -32486,6 +32489,7 @@ type checkout_widgets_d_SaleEventType = SaleEventType;
32486
32489
  declare const checkout_widgets_d_SaleEventType: typeof SaleEventType;
32487
32490
  type checkout_widgets_d_SaleFailed = SaleFailed;
32488
32491
  type checkout_widgets_d_SaleSuccess = SaleSuccess;
32492
+ type checkout_widgets_d_SaleTransactionSuccess = SaleTransactionSuccess;
32489
32493
  type checkout_widgets_d_SemanticVersion = SemanticVersion;
32490
32494
  type checkout_widgets_d_SwapEventType = SwapEventType;
32491
32495
  declare const checkout_widgets_d_SwapEventType: typeof SwapEventType;
@@ -32540,6 +32544,7 @@ declare namespace checkout_widgets_d {
32540
32544
  checkout_widgets_d_SaleEventType as SaleEventType,
32541
32545
  checkout_widgets_d_SaleFailed as SaleFailed,
32542
32546
  checkout_widgets_d_SaleSuccess as SaleSuccess,
32547
+ checkout_widgets_d_SaleTransactionSuccess as SaleTransactionSuccess,
32543
32548
  checkout_widgets_d_SemanticVersion as SemanticVersion,
32544
32549
  checkout_widgets_d_SwapEventType as SwapEventType,
32545
32550
  checkout_widgets_d_SwapFailed as SwapFailed,