@0xsquid/react-hooks 8.12.0 → 8.12.1-beta-arc.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.
Files changed (32) hide show
  1. package/dist/core/constants.d.ts +1 -0
  2. package/dist/hooks/transaction/useArcFeeCheck.d.ts +5 -0
  3. package/dist/{index-CJVX-7hj.js → index-8RIq6GyB.js} +60 -6
  4. package/dist/index-8RIq6GyB.js.map +1 -0
  5. package/dist/{index-C3owE9lb.js → index-BVneqIL5.js} +60 -6
  6. package/dist/index-BVneqIL5.js.map +1 -0
  7. package/dist/{index.es-09IsADsA.js → index.es-Bm5GQH70.js} +2 -2
  8. package/dist/{index.es-09IsADsA.js.map → index.es-Bm5GQH70.js.map} +1 -1
  9. package/dist/{index.es-CTKuR0LC.js → index.es-CnV3EYrQ.js} +2 -2
  10. package/dist/{index.es-CTKuR0LC.js.map → index.es-CnV3EYrQ.js.map} +1 -1
  11. package/dist/index.esm.js +1 -1
  12. package/dist/index.js +1 -1
  13. package/dist/{secretService-GHdReJBs.js → secretService-C6GiPeC8.js} +2 -2
  14. package/dist/{secretService-GHdReJBs.js.map → secretService-C6GiPeC8.js.map} +1 -1
  15. package/dist/{secretService--tJFCkzT.js → secretService-D8ySaXvX.js} +2 -2
  16. package/dist/{secretService--tJFCkzT.js.map → secretService-D8ySaXvX.js.map} +1 -1
  17. package/dist/server.esm.js +1 -0
  18. package/dist/server.esm.js.map +1 -1
  19. package/dist/server.js +1 -0
  20. package/dist/server.js.map +1 -1
  21. package/dist/services/internal/arcService.d.ts +9 -0
  22. package/dist/{stellarService.client-DvA-2pXq.js → stellarService.client-DkBWS3eX.js} +2 -2
  23. package/dist/{stellarService.client-DvA-2pXq.js.map → stellarService.client-DkBWS3eX.js.map} +1 -1
  24. package/dist/{stellarService.client-DAxgO3m3.js → stellarService.client-IiUZ6NO6.js} +2 -2
  25. package/dist/{stellarService.client-DAxgO3m3.js.map → stellarService.client-IiUZ6NO6.js.map} +1 -1
  26. package/dist/tests/arcAssetsService.test.d.ts +1 -0
  27. package/dist/tests/arcGasAccounting.test.d.ts +1 -0
  28. package/dist/tests/fixtures/arc.d.ts +8 -0
  29. package/dist/tests/sourceChainGas.test.d.ts +1 -0
  30. package/package.json +1 -1
  31. package/dist/index-C3owE9lb.js.map +0 -1
  32. package/dist/index-CJVX-7hj.js.map +0 -1
@@ -74,6 +74,7 @@ export declare const CHAIN_IDS: {
74
74
  readonly MANTRA: "5888";
75
75
  readonly CITREA: "4114";
76
76
  readonly TEMPO: "4217";
77
+ readonly ARC: "5042";
77
78
  readonly BITCOIN: "bitcoin";
78
79
  readonly SOLANA: "solana-mainnet-beta";
79
80
  readonly SUI: "sui-mainnet";
@@ -0,0 +1,5 @@
1
+ import { ChainData } from "@0xsquid/squid-types";
2
+ import { ArcFeeData } from "../../services/internal/arcService";
3
+ export declare const useArcFeeCheck: ({ fromChain, }: {
4
+ fromChain: ChainData | undefined;
5
+ }) => ArcFeeData | null;
@@ -153,6 +153,7 @@ const CHAIN_IDS = {
153
153
  MANTRA: "5888",
154
154
  CITREA: "4114",
155
155
  TEMPO: "4217",
156
+ ARC: "5042",
156
157
  // others
157
158
  BITCOIN: "bitcoin",
158
159
  SOLANA: "solana-mainnet-beta",
@@ -23658,9 +23659,9 @@ const groupTokensByChainId = (tokens, chains) => {
23658
23659
  */
23659
23660
  const filterViewableTokens = (tokens, config, direction) => {
23660
23661
  const disabledTokens = [
23661
- // On Celo, native token & custom address tokens are returned
23662
- // so we should hide the native one but keep receiving it to use gas balance
23662
+ // Both interfaces share one balance; show only the ERC20 token.
23663
23663
  { chainId: CHAIN_IDS.CELO, address: nativeEvmTokenAddress },
23664
+ { chainId: CHAIN_IDS.ARC, address: nativeEvmTokenAddress },
23664
23665
  // SagaEVM is gasless, so the native token is not used
23665
23666
  { chainId: CHAIN_IDS.SAGA_EVM, address: nativeEvmTokenAddress },
23666
23667
  { chainId: CHAIN_IDS.DCHAIN, address: nativeEvmTokenAddress },
@@ -23681,7 +23682,7 @@ const filterViewableTokens = (tokens, config, direction) => {
23681
23682
  };
23682
23683
  const getSecretNetworkBalances = async (chainData, cosmosAddress, squidTokens, keplrTypeWallet) => {
23683
23684
  const squidSecretTokens = squidTokens.filter((t) => t.chainId === CHAIN_IDS.SECRET);
23684
- const { fetchAllSecretBalances } = await Promise.resolve().then(function () { return require('./secretService-GHdReJBs.js'); });
23685
+ const { fetchAllSecretBalances } = await Promise.resolve().then(function () { return require('./secretService-C6GiPeC8.js'); });
23685
23686
  return fetchAllSecretBalances(chainData, cosmosAddress, squidSecretTokens, keplrTypeWallet);
23686
23687
  };
23687
23688
  function getTokenAssetsKey(token) {
@@ -28108,7 +28109,7 @@ function useStellarWallets() {
28108
28109
  try {
28109
28110
  const { allowAllModules: initializeAllModules } = await import('@creit.tech/stellar-wallets-kit');
28110
28111
  const { LedgerModule } = await import('@creit.tech/stellar-wallets-kit/modules/ledger.module.mjs');
28111
- const { formatStellarWallet } = await Promise.resolve().then(function () { return require('./stellarService.client-DvA-2pXq.js'); });
28112
+ const { formatStellarWallet } = await Promise.resolve().then(function () { return require('./stellarService.client-DkBWS3eX.js'); });
28112
28113
  const modules = [...initializeAllModules(), new LedgerModule()];
28113
28114
  const promises = modules.map(async (module) => {
28114
28115
  const isAvailable = await module.isAvailable();
@@ -31555,7 +31556,7 @@ function hederaWalletConnect(parameters) {
31555
31556
  const optionalChains = config.chains.map((x) => x.id);
31556
31557
  if (!optionalChains.length)
31557
31558
  return;
31558
- const { EthereumProvider } = await Promise.resolve().then(function () { return require('./index.es-CTKuR0LC.js'); });
31559
+ const { EthereumProvider } = await Promise.resolve().then(function () { return require('./index.es-CnV3EYrQ.js'); });
31559
31560
  const rawProvider = await EthereumProvider.init({
31560
31561
  ...restParameters,
31561
31562
  disableProviderPing: true,
@@ -32779,6 +32780,12 @@ const isTempoChain = (chainId) => chainId === CHAIN_IDS.TEMPO;
32779
32780
  */
32780
32781
  const convertTempoFeeToStablecoinUnits = (feeIn18Dec) => feeIn18Dec / BigInt(10 ** 12);
32781
32782
 
32783
+ const arcUsdcTokenAddress = "0x3600000000000000000000000000000000000000";
32784
+ const isArcChain = (chainId) => chainId === CHAIN_IDS.ARC;
32785
+ const isArcUsdcToken = (token) => isArcChain(token?.chainId) &&
32786
+ token?.address.toLowerCase() === arcUsdcTokenAddress;
32787
+ const convertArcGasToUsdcUnits = (fee) => (fee + 10n ** 12n - 1n) / 10n ** 12n;
32788
+
32782
32789
  const DEFAULT_REFRESH_INTERVAL_MS = 15000;
32783
32790
  /**
32784
32791
  * Returns raw on-chain gas token data for Tempo chains, or null when the source
@@ -32845,6 +32852,30 @@ const useTempoFeeCheck = ({ fromChain, fromToken, }) => {
32845
32852
  };
32846
32853
  };
32847
32854
 
32855
+ const useArcFeeCheck = ({ fromChain, }) => {
32856
+ const { connectedAddresses } = useWallet();
32857
+ const { evmTokens } = useSquidTokens();
32858
+ const isArc = isArcChain(fromChain?.chainId);
32859
+ const gasToken = React.useMemo(() => {
32860
+ if (!isArc)
32861
+ return undefined;
32862
+ return evmTokens.find(isArcUsdcToken);
32863
+ }, [isArc, evmTokens]);
32864
+ const userAddress = connectedAddresses[squidTypes.ChainType.EVM];
32865
+ const { balance, isLoading } = useEvmBalance({
32866
+ chain: fromChain,
32867
+ token: gasToken,
32868
+ userAddress,
32869
+ enabled: isArc && !!gasToken,
32870
+ });
32871
+ if (!isArc || !gasToken || !userAddress || isLoading)
32872
+ return null;
32873
+ return {
32874
+ gasTokenAddress: gasToken.address,
32875
+ gasBalance: parseToBigInt(balance, gasToken.decimals),
32876
+ };
32877
+ };
32878
+
32848
32879
  /**
32849
32880
  * Hook that returns the gas token and chain fee params for a given source chain and token.
32850
32881
  */
@@ -32853,6 +32884,7 @@ function useSourceChainGasToken({ fromChain, fromToken, }) {
32853
32884
  const { evmTokens } = useSquidTokens();
32854
32885
  const { nativeBalance } = useNativeBalance(fromChain);
32855
32886
  const tempoFeeData = useTempoFeeCheck({ fromChain, fromToken });
32887
+ const arcFeeData = useArcFeeCheck({ fromChain });
32856
32888
  const chainFeeParams = React.useMemo(() => {
32857
32889
  if (fromToken?.address == null ||
32858
32890
  fromChain?.chainId == null ||
@@ -32870,6 +32902,17 @@ function useSourceChainGasToken({ fromChain, fromToken, }) {
32870
32902
  normalizeFee: convertTempoFeeToStablecoinUnits,
32871
32903
  };
32872
32904
  }
32905
+ if (isArcChain(fromChain.chainId)) {
32906
+ if (!arcFeeData)
32907
+ return null;
32908
+ const fromTokenPaysGasFees = arcFeeData.gasTokenAddress.toLowerCase() ===
32909
+ fromToken.address.toLowerCase();
32910
+ return {
32911
+ fromTokenPaysGasFees,
32912
+ gasTokenBalanceWei: arcFeeData.gasBalance,
32913
+ normalizeFee: (fee) => fee,
32914
+ };
32915
+ }
32873
32916
  return {
32874
32917
  fromTokenPaysGasFees: fromToken.address.toLowerCase() ===
32875
32918
  chainTypeToNativeTokenAddressMap[fromToken.type].toLowerCase(),
@@ -32882,6 +32925,7 @@ function useSourceChainGasToken({ fromChain, fromToken, }) {
32882
32925
  fromChain?.chainId,
32883
32926
  nativeBalance?.value,
32884
32927
  tempoFeeData,
32928
+ arcFeeData,
32885
32929
  ]);
32886
32930
  /**
32887
32931
  * The token to pay for gas on the source chain.
@@ -32895,12 +32939,19 @@ function useSourceChainGasToken({ fromChain, fromToken, }) {
32895
32939
  return evmTokens.find((t) => t.chainId === fromChain.chainId &&
32896
32940
  t.address.toLowerCase() === tempoFeeData.gasTokenAddress.toLowerCase());
32897
32941
  }
32942
+ if (isArcChain(fromChain.chainId)) {
32943
+ if (!arcFeeData)
32944
+ return undefined;
32945
+ return evmTokens.find((t) => t.chainId === fromChain.chainId &&
32946
+ t.address.toLowerCase() === arcFeeData.gasTokenAddress.toLowerCase());
32947
+ }
32898
32948
  return nativeToken;
32899
32949
  }, [
32900
32950
  fromChain?.chainId,
32901
32951
  fromToken?.address,
32902
32952
  nativeToken,
32903
32953
  tempoFeeData,
32954
+ arcFeeData,
32904
32955
  evmTokens,
32905
32956
  ]);
32906
32957
  return { gasToken, chainFeeParams };
@@ -33257,6 +33308,9 @@ function useSendTransactionGas({ chain, token, from, }) {
33257
33308
  if (chain.chainId === CHAIN_IDS.TEMPO) {
33258
33309
  return convertTempoFeeToStablecoinUnits(feeWei);
33259
33310
  }
33311
+ if (isArcChain(chain.chainId)) {
33312
+ return convertArcGasToUsdcUnits(feeWei);
33313
+ }
33260
33314
  return feeWei;
33261
33315
  }
33262
33316
  case squidTypes.ChainType.COSMOS: {
@@ -39462,4 +39516,4 @@ exports.useXrplTrustLine = useXrplTrustLine;
39462
39516
  exports.waitForReceiptWithRetry = waitForReceiptWithRetry;
39463
39517
  exports.walletIconBaseUrl = walletIconBaseUrl;
39464
39518
  exports.walletSupportsChainType = walletSupportsChainType;
39465
- //# sourceMappingURL=index-CJVX-7hj.js.map
39519
+ //# sourceMappingURL=index-8RIq6GyB.js.map