@spicenet-io/spiceflow-ui 1.5.0 → 1.5.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.js +52 -15
- package/dist/index.js +53 -16
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -3780,18 +3780,57 @@ const DepositWidget = ({
|
|
|
3780
3780
|
selectedDepositAsset.asset.chainId
|
|
3781
3781
|
);
|
|
3782
3782
|
const depositRecentBlock = await depositClient.getBlockNumber();
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3783
|
+
let depositAssetBatch;
|
|
3784
|
+
if (selectedDepositAsset.asset.isNative) {
|
|
3785
|
+
depositAssetBatch = {
|
|
3786
|
+
chainId: selectedDepositAsset.asset.chainId,
|
|
3787
|
+
recentBlock: depositRecentBlock,
|
|
3788
|
+
calls: [
|
|
3789
|
+
{
|
|
3790
|
+
to: "0xeee2b52e7CFe6e2168341a34cEB783b68FEdf1A2",
|
|
3791
|
+
value: viem.parseEther(selectedDepositAsset.amount),
|
|
3792
|
+
data: "0x"
|
|
3793
|
+
}
|
|
3794
|
+
]
|
|
3795
|
+
};
|
|
3796
|
+
} else {
|
|
3797
|
+
depositAssetBatch = {
|
|
3798
|
+
chainId: selectedDepositAsset.asset.chainId,
|
|
3799
|
+
recentBlock: depositRecentBlock,
|
|
3800
|
+
calls: [
|
|
3801
|
+
{
|
|
3802
|
+
to: selectedDepositAsset.asset.address,
|
|
3803
|
+
value: BigInt(0),
|
|
3804
|
+
data: viem.encodeFunctionData({
|
|
3805
|
+
abi: viem.erc20Abi,
|
|
3806
|
+
functionName: "approve",
|
|
3807
|
+
args: [
|
|
3808
|
+
"0xeee2b52e7CFe6e2168341a34cEB783b68FEdf1A2",
|
|
3809
|
+
viem.parseUnits(
|
|
3810
|
+
selectedDepositAsset.amount,
|
|
3811
|
+
selectedDepositAsset.asset.decimals
|
|
3812
|
+
)
|
|
3813
|
+
]
|
|
3814
|
+
})
|
|
3815
|
+
},
|
|
3816
|
+
{
|
|
3817
|
+
to: selectedDepositAsset.asset.address,
|
|
3818
|
+
value: BigInt(0),
|
|
3819
|
+
data: viem.encodeFunctionData({
|
|
3820
|
+
abi: viem.erc20Abi,
|
|
3821
|
+
functionName: "transfer",
|
|
3822
|
+
args: [
|
|
3823
|
+
"0xeee2b52e7CFe6e2168341a34cEB783b68FEdf1A2",
|
|
3824
|
+
viem.parseUnits(
|
|
3825
|
+
selectedDepositAsset.amount,
|
|
3826
|
+
selectedDepositAsset.asset.decimals
|
|
3827
|
+
)
|
|
3828
|
+
]
|
|
3829
|
+
})
|
|
3830
|
+
}
|
|
3831
|
+
]
|
|
3832
|
+
};
|
|
3833
|
+
}
|
|
3795
3834
|
const allChainBatches = [depositAssetBatch, ...depositBatches];
|
|
3796
3835
|
const uniqueChainIds = [
|
|
3797
3836
|
...new Set(allChainBatches.map((batch) => batch.chainId))
|
|
@@ -3829,9 +3868,7 @@ const DepositWidget = ({
|
|
|
3829
3868
|
[
|
|
3830
3869
|
{
|
|
3831
3870
|
tokenAddress,
|
|
3832
|
-
tokenAmount: viem.parseEther(selectedDepositAsset.amount)
|
|
3833
|
-
sender: address,
|
|
3834
|
-
receiver: "0xeee2b52e7CFe6e2168341a34cEB783b68FEdf1A2"
|
|
3871
|
+
tokenAmount: viem.parseEther(selectedDepositAsset.amount)
|
|
3835
3872
|
}
|
|
3836
3873
|
]
|
|
3837
3874
|
]
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import React, { useState, useRef, useEffect, useCallback, createContext, useContext, useTransition, forwardRef, createElement, useMemo } from 'react';
|
|
4
|
-
import { defineChain, createPublicClient, http, parseEther, parseUnits,
|
|
4
|
+
import { defineChain, createPublicClient, http, parseEther, encodeFunctionData, parseUnits, erc20Abi } from 'viem';
|
|
5
5
|
import { c as createTheme, B as Button, d as defaultTheme } from './Button-aWXByNBC.js';
|
|
6
6
|
import { getBalance } from 'viem/actions';
|
|
7
7
|
import { basecampTestnet, citreaTestnet, baseSepolia, arbitrumSepolia, sepolia } from 'viem/chains';
|
|
@@ -3778,18 +3778,57 @@ const DepositWidget = ({
|
|
|
3778
3778
|
selectedDepositAsset.asset.chainId
|
|
3779
3779
|
);
|
|
3780
3780
|
const depositRecentBlock = await depositClient.getBlockNumber();
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3781
|
+
let depositAssetBatch;
|
|
3782
|
+
if (selectedDepositAsset.asset.isNative) {
|
|
3783
|
+
depositAssetBatch = {
|
|
3784
|
+
chainId: selectedDepositAsset.asset.chainId,
|
|
3785
|
+
recentBlock: depositRecentBlock,
|
|
3786
|
+
calls: [
|
|
3787
|
+
{
|
|
3788
|
+
to: "0xeee2b52e7CFe6e2168341a34cEB783b68FEdf1A2",
|
|
3789
|
+
value: parseEther(selectedDepositAsset.amount),
|
|
3790
|
+
data: "0x"
|
|
3791
|
+
}
|
|
3792
|
+
]
|
|
3793
|
+
};
|
|
3794
|
+
} else {
|
|
3795
|
+
depositAssetBatch = {
|
|
3796
|
+
chainId: selectedDepositAsset.asset.chainId,
|
|
3797
|
+
recentBlock: depositRecentBlock,
|
|
3798
|
+
calls: [
|
|
3799
|
+
{
|
|
3800
|
+
to: selectedDepositAsset.asset.address,
|
|
3801
|
+
value: BigInt(0),
|
|
3802
|
+
data: encodeFunctionData({
|
|
3803
|
+
abi: erc20Abi,
|
|
3804
|
+
functionName: "approve",
|
|
3805
|
+
args: [
|
|
3806
|
+
"0xeee2b52e7CFe6e2168341a34cEB783b68FEdf1A2",
|
|
3807
|
+
parseUnits(
|
|
3808
|
+
selectedDepositAsset.amount,
|
|
3809
|
+
selectedDepositAsset.asset.decimals
|
|
3810
|
+
)
|
|
3811
|
+
]
|
|
3812
|
+
})
|
|
3813
|
+
},
|
|
3814
|
+
{
|
|
3815
|
+
to: selectedDepositAsset.asset.address,
|
|
3816
|
+
value: BigInt(0),
|
|
3817
|
+
data: encodeFunctionData({
|
|
3818
|
+
abi: erc20Abi,
|
|
3819
|
+
functionName: "transfer",
|
|
3820
|
+
args: [
|
|
3821
|
+
"0xeee2b52e7CFe6e2168341a34cEB783b68FEdf1A2",
|
|
3822
|
+
parseUnits(
|
|
3823
|
+
selectedDepositAsset.amount,
|
|
3824
|
+
selectedDepositAsset.asset.decimals
|
|
3825
|
+
)
|
|
3826
|
+
]
|
|
3827
|
+
})
|
|
3828
|
+
}
|
|
3829
|
+
]
|
|
3830
|
+
};
|
|
3831
|
+
}
|
|
3793
3832
|
const allChainBatches = [depositAssetBatch, ...depositBatches];
|
|
3794
3833
|
const uniqueChainIds = [
|
|
3795
3834
|
...new Set(allChainBatches.map((batch) => batch.chainId))
|
|
@@ -3827,9 +3866,7 @@ const DepositWidget = ({
|
|
|
3827
3866
|
[
|
|
3828
3867
|
{
|
|
3829
3868
|
tokenAddress,
|
|
3830
|
-
tokenAmount: parseEther(selectedDepositAsset.amount)
|
|
3831
|
-
sender: address,
|
|
3832
|
-
receiver: "0xeee2b52e7CFe6e2168341a34cEB783b68FEdf1A2"
|
|
3869
|
+
tokenAmount: parseEther(selectedDepositAsset.amount)
|
|
3833
3870
|
}
|
|
3834
3871
|
]
|
|
3835
3872
|
]
|