@spicenet-io/spiceflow-ui 1.9.7 → 1.9.9

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.
@@ -26,6 +26,7 @@ export interface CrossChainDepositModalProps {
26
26
  title?: string;
27
27
  description?: string;
28
28
  chainId: 11155111 | 421614 | 84532 | undefined;
29
+ embeddedWalletAddress: string;
29
30
  externalWalletAddress: string;
30
31
  escrowAddress?: string;
31
32
  supportedChains: number[];
package/dist/index.cjs.js CHANGED
@@ -12,10 +12,11 @@ const reactAuth = require('@privy-io/react-auth');
12
12
  const sdkReactCore = require('@dynamic-labs/sdk-react-core');
13
13
  const spiceflowCoreTest = require('spiceflow-core-test');
14
14
  const wagmi = require('wagmi');
15
+ const chains$1 = require('@/utils/chains');
15
16
  const authDynamic = require('./auth-dynamic.cjs.js');
16
17
  const authPrivy = require('./auth-privy.cjs.js');
17
18
  const reactQuery = require('@tanstack/react-query');
18
- const chains$1 = require('wagmi/chains');
19
+ const chains$2 = require('wagmi/chains');
19
20
  const connectors = require('wagmi/connectors');
20
21
 
21
22
  const CHAIN_CONFIGS = {
@@ -2753,7 +2754,6 @@ const PrivyProviderWrapper = ({ children, appId, supportedViemChains }) => {
2753
2754
  theme: "#fafafa",
2754
2755
  showWalletLoginFirst: false,
2755
2756
  walletChainType: "ethereum-only",
2756
- logo: "https://spicenet.io/assets/Spicenet_Lockup_Secondary_FullColor.png",
2757
2757
  walletList: [
2758
2758
  "detected_ethereum_wallets",
2759
2759
  "metamask",
@@ -3081,7 +3081,7 @@ const useWallet = () => {
3081
3081
  };
3082
3082
  };
3083
3083
 
3084
- const RELAYER_API_URL = process.env.NEXT_PUBLIC_RELAYER_API_URL || "https://tx-submission-api-dev.spicenet.io";
3084
+ const RELAYER_API_URL = process.env.NEXT_PUBLIC_RELAYER_API_URL || "https://tx-api.spicenet.io/";
3085
3085
  class RelayerService {
3086
3086
  constructor() {
3087
3087
  this.baseUrl = RELAYER_API_URL;
@@ -5608,6 +5608,7 @@ const CrossChainDepositModal = ({
5608
5608
  title = "Deposit to Spicenet",
5609
5609
  description = "Select tokens and enter amounts to deposit to your Spicenet Account",
5610
5610
  chainId,
5611
+ embeddedWalletAddress,
5611
5612
  externalWalletAddress,
5612
5613
  escrowAddress = "0xeee2b52e7CFe6e2168341a34cEB783b68FEdf1A2",
5613
5614
  getChainConfig,
@@ -5757,15 +5758,40 @@ const CrossChainDepositModal = ({
5757
5758
  data
5758
5759
  });
5759
5760
  }
5760
- await relayerService.submitSpiceDeposit({
5761
+ const client = chains$1.getClientForChain(chainId);
5762
+ const receipt = await client.waitForTransactionReceipt({
5763
+ hash,
5764
+ timeout: 12e4,
5765
+ pollingInterval: 2e3,
5766
+ confirmations: 2
5767
+ });
5768
+ if (receipt.status !== "success") {
5769
+ throw new Error(`Transfer to escrow failed for ${asset.symbol}`);
5770
+ }
5771
+ const currentBlock = await client.getBlockNumber();
5772
+ const confirmations = currentBlock - receipt.blockNumber;
5773
+ if (confirmations < 2) {
5774
+ await new Promise((resolve) => setTimeout(resolve, 3e3));
5775
+ }
5776
+ console.log("submitting deposit to relayer with params:", {
5777
+ txHash: hash,
5778
+ sender: embeddedWalletAddress,
5779
+ tokenAddress: asset.address,
5780
+ chainId,
5781
+ amount: viem.parseUnits(amount, asset.decimals).toString(),
5782
+ user: embeddedWalletAddress,
5783
+ isDeposit: true
5784
+ });
5785
+ const depositResult = await relayerService.submitSpiceDeposit({
5761
5786
  txHash: hash,
5762
- sender: externalWalletAddress,
5787
+ sender: embeddedWalletAddress,
5763
5788
  tokenAddress: asset.address,
5764
5789
  chainId,
5765
- amount: amount.toString(),
5766
- user: escrowAddress,
5790
+ amount: viem.parseUnits(amount, asset.decimals).toString(),
5791
+ user: embeddedWalletAddress,
5767
5792
  isDeposit: true
5768
5793
  });
5794
+ console.log("Deposit result:", depositResult);
5769
5795
  results.push({ asset, txHash: hash, success: true });
5770
5796
  } catch (err) {
5771
5797
  console.error(`Deposit error for ${asset.symbol}:`, err);
@@ -11722,7 +11748,7 @@ const SpiceWithdraw = (props) => {
11722
11748
  }
11723
11749
  });
11724
11750
  if (chains.length === 0) {
11725
- chains.push(chains$1.sepolia, chains$1.arbitrumSepolia);
11751
+ chains.push(chains$2.sepolia, chains$2.arbitrumSepolia);
11726
11752
  }
11727
11753
  const transports = {};
11728
11754
  chains.forEach((chain) => {
package/dist/index.js CHANGED
@@ -10,6 +10,7 @@ import { useWallets, usePrivy, useSign7702Authorization, useSignMessage } from '
10
10
  import { useDynamicContext } from '@dynamic-labs/sdk-react-core';
11
11
  import { getAccountNonce, hashChainBatches, getAuthorizationHash } from 'spiceflow-core-test';
12
12
  import { useAccount, useWalletClient, useSwitchChain, useReadContracts, useConnect, useDisconnect, http as http$1, createConfig, WagmiProvider } from 'wagmi';
13
+ import { getClientForChain as getClientForChain$1 } from '@/utils/chains';
13
14
  import { DynamicLogin } from './auth-dynamic.js';
14
15
  import { PrivyLogin } from './auth-privy.js';
15
16
  import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
@@ -2751,7 +2752,6 @@ const PrivyProviderWrapper = ({ children, appId, supportedViemChains }) => {
2751
2752
  theme: "#fafafa",
2752
2753
  showWalletLoginFirst: false,
2753
2754
  walletChainType: "ethereum-only",
2754
- logo: "https://spicenet.io/assets/Spicenet_Lockup_Secondary_FullColor.png",
2755
2755
  walletList: [
2756
2756
  "detected_ethereum_wallets",
2757
2757
  "metamask",
@@ -3079,7 +3079,7 @@ const useWallet = () => {
3079
3079
  };
3080
3080
  };
3081
3081
 
3082
- const RELAYER_API_URL = process.env.NEXT_PUBLIC_RELAYER_API_URL || "https://tx-submission-api-dev.spicenet.io";
3082
+ const RELAYER_API_URL = process.env.NEXT_PUBLIC_RELAYER_API_URL || "https://tx-api.spicenet.io/";
3083
3083
  class RelayerService {
3084
3084
  constructor() {
3085
3085
  this.baseUrl = RELAYER_API_URL;
@@ -5606,6 +5606,7 @@ const CrossChainDepositModal = ({
5606
5606
  title = "Deposit to Spicenet",
5607
5607
  description = "Select tokens and enter amounts to deposit to your Spicenet Account",
5608
5608
  chainId,
5609
+ embeddedWalletAddress,
5609
5610
  externalWalletAddress,
5610
5611
  escrowAddress = "0xeee2b52e7CFe6e2168341a34cEB783b68FEdf1A2",
5611
5612
  getChainConfig,
@@ -5755,15 +5756,40 @@ const CrossChainDepositModal = ({
5755
5756
  data
5756
5757
  });
5757
5758
  }
5758
- await relayerService.submitSpiceDeposit({
5759
+ const client = getClientForChain$1(chainId);
5760
+ const receipt = await client.waitForTransactionReceipt({
5761
+ hash,
5762
+ timeout: 12e4,
5763
+ pollingInterval: 2e3,
5764
+ confirmations: 2
5765
+ });
5766
+ if (receipt.status !== "success") {
5767
+ throw new Error(`Transfer to escrow failed for ${asset.symbol}`);
5768
+ }
5769
+ const currentBlock = await client.getBlockNumber();
5770
+ const confirmations = currentBlock - receipt.blockNumber;
5771
+ if (confirmations < 2) {
5772
+ await new Promise((resolve) => setTimeout(resolve, 3e3));
5773
+ }
5774
+ console.log("submitting deposit to relayer with params:", {
5775
+ txHash: hash,
5776
+ sender: embeddedWalletAddress,
5777
+ tokenAddress: asset.address,
5778
+ chainId,
5779
+ amount: parseUnits(amount, asset.decimals).toString(),
5780
+ user: embeddedWalletAddress,
5781
+ isDeposit: true
5782
+ });
5783
+ const depositResult = await relayerService.submitSpiceDeposit({
5759
5784
  txHash: hash,
5760
- sender: externalWalletAddress,
5785
+ sender: embeddedWalletAddress,
5761
5786
  tokenAddress: asset.address,
5762
5787
  chainId,
5763
- amount: amount.toString(),
5764
- user: escrowAddress,
5788
+ amount: parseUnits(amount, asset.decimals).toString(),
5789
+ user: embeddedWalletAddress,
5765
5790
  isDeposit: true
5766
5791
  });
5792
+ console.log("Deposit result:", depositResult);
5767
5793
  results.push({ asset, txHash: hash, success: true });
5768
5794
  } catch (err) {
5769
5795
  console.error(`Deposit error for ${asset.symbol}:`, err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spicenet-io/spiceflow-ui",
3
- "version": "1.9.7",
3
+ "version": "1.9.9",
4
4
  "description": "Spiceflow UI SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs.js",