@spicenet-io/spiceflow-ui 1.9.8 → 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$
|
|
19
|
+
const chains$2 = require('wagmi/chains');
|
|
19
20
|
const connectors = require('wagmi/connectors');
|
|
20
21
|
|
|
21
22
|
const CHAIN_CONFIGS = {
|
|
@@ -3080,7 +3081,7 @@ const useWallet = () => {
|
|
|
3080
3081
|
};
|
|
3081
3082
|
};
|
|
3082
3083
|
|
|
3083
|
-
const RELAYER_API_URL = process.env.NEXT_PUBLIC_RELAYER_API_URL || "https://tx-
|
|
3084
|
+
const RELAYER_API_URL = process.env.NEXT_PUBLIC_RELAYER_API_URL || "https://tx-api.spicenet.io/";
|
|
3084
3085
|
class RelayerService {
|
|
3085
3086
|
constructor() {
|
|
3086
3087
|
this.baseUrl = RELAYER_API_URL;
|
|
@@ -5607,6 +5608,7 @@ const CrossChainDepositModal = ({
|
|
|
5607
5608
|
title = "Deposit to Spicenet",
|
|
5608
5609
|
description = "Select tokens and enter amounts to deposit to your Spicenet Account",
|
|
5609
5610
|
chainId,
|
|
5611
|
+
embeddedWalletAddress,
|
|
5610
5612
|
externalWalletAddress,
|
|
5611
5613
|
escrowAddress = "0xeee2b52e7CFe6e2168341a34cEB783b68FEdf1A2",
|
|
5612
5614
|
getChainConfig,
|
|
@@ -5756,15 +5758,40 @@ const CrossChainDepositModal = ({
|
|
|
5756
5758
|
data
|
|
5757
5759
|
});
|
|
5758
5760
|
}
|
|
5759
|
-
|
|
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({
|
|
5760
5786
|
txHash: hash,
|
|
5761
|
-
sender:
|
|
5787
|
+
sender: embeddedWalletAddress,
|
|
5762
5788
|
tokenAddress: asset.address,
|
|
5763
5789
|
chainId,
|
|
5764
|
-
amount: amount.toString(),
|
|
5765
|
-
user:
|
|
5790
|
+
amount: viem.parseUnits(amount, asset.decimals).toString(),
|
|
5791
|
+
user: embeddedWalletAddress,
|
|
5766
5792
|
isDeposit: true
|
|
5767
5793
|
});
|
|
5794
|
+
console.log("Deposit result:", depositResult);
|
|
5768
5795
|
results.push({ asset, txHash: hash, success: true });
|
|
5769
5796
|
} catch (err) {
|
|
5770
5797
|
console.error(`Deposit error for ${asset.symbol}:`, err);
|
|
@@ -11721,7 +11748,7 @@ const SpiceWithdraw = (props) => {
|
|
|
11721
11748
|
}
|
|
11722
11749
|
});
|
|
11723
11750
|
if (chains.length === 0) {
|
|
11724
|
-
chains.push(chains$
|
|
11751
|
+
chains.push(chains$2.sepolia, chains$2.arbitrumSepolia);
|
|
11725
11752
|
}
|
|
11726
11753
|
const transports = {};
|
|
11727
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';
|
|
@@ -3078,7 +3079,7 @@ const useWallet = () => {
|
|
|
3078
3079
|
};
|
|
3079
3080
|
};
|
|
3080
3081
|
|
|
3081
|
-
const RELAYER_API_URL = process.env.NEXT_PUBLIC_RELAYER_API_URL || "https://tx-
|
|
3082
|
+
const RELAYER_API_URL = process.env.NEXT_PUBLIC_RELAYER_API_URL || "https://tx-api.spicenet.io/";
|
|
3082
3083
|
class RelayerService {
|
|
3083
3084
|
constructor() {
|
|
3084
3085
|
this.baseUrl = RELAYER_API_URL;
|
|
@@ -5605,6 +5606,7 @@ const CrossChainDepositModal = ({
|
|
|
5605
5606
|
title = "Deposit to Spicenet",
|
|
5606
5607
|
description = "Select tokens and enter amounts to deposit to your Spicenet Account",
|
|
5607
5608
|
chainId,
|
|
5609
|
+
embeddedWalletAddress,
|
|
5608
5610
|
externalWalletAddress,
|
|
5609
5611
|
escrowAddress = "0xeee2b52e7CFe6e2168341a34cEB783b68FEdf1A2",
|
|
5610
5612
|
getChainConfig,
|
|
@@ -5754,15 +5756,40 @@ const CrossChainDepositModal = ({
|
|
|
5754
5756
|
data
|
|
5755
5757
|
});
|
|
5756
5758
|
}
|
|
5757
|
-
|
|
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({
|
|
5758
5784
|
txHash: hash,
|
|
5759
|
-
sender:
|
|
5785
|
+
sender: embeddedWalletAddress,
|
|
5760
5786
|
tokenAddress: asset.address,
|
|
5761
5787
|
chainId,
|
|
5762
|
-
amount: amount.toString(),
|
|
5763
|
-
user:
|
|
5788
|
+
amount: parseUnits(amount, asset.decimals).toString(),
|
|
5789
|
+
user: embeddedWalletAddress,
|
|
5764
5790
|
isDeposit: true
|
|
5765
5791
|
});
|
|
5792
|
+
console.log("Deposit result:", depositResult);
|
|
5766
5793
|
results.push({ asset, txHash: hash, success: true });
|
|
5767
5794
|
} catch (err) {
|
|
5768
5795
|
console.error(`Deposit error for ${asset.symbol}:`, err);
|