@b3dotfun/sdk 0.0.56-alpha.4 → 0.0.56-alpha.5
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.
|
@@ -9,13 +9,13 @@ const anyspend_1 = require("../../../../anyspend");
|
|
|
9
9
|
const ChainTokenIcon_1 = require("../../../../anyspend/react/components/common/ChainTokenIcon");
|
|
10
10
|
const react_1 = require("../../../../global-account/react");
|
|
11
11
|
const number_1 = require("../../../../shared/utils/number");
|
|
12
|
+
const invariant_1 = __importDefault(require("invariant"));
|
|
12
13
|
const lucide_react_1 = require("lucide-react");
|
|
13
14
|
const react_2 = require("react");
|
|
14
15
|
const react_number_format_1 = require("react-number-format");
|
|
15
16
|
const sonner_1 = require("sonner");
|
|
16
17
|
const react_3 = require("thirdweb/react");
|
|
17
18
|
const viem_1 = require("viem");
|
|
18
|
-
const invariant_1 = __importDefault(require("invariant"));
|
|
19
19
|
// Panel view enum for managing navigation between token list and send form
|
|
20
20
|
var TokenPanelView;
|
|
21
21
|
(function (TokenPanelView) {
|
|
@@ -134,11 +134,12 @@ function ContentTokens({ activeTab }) {
|
|
|
134
134
|
};
|
|
135
135
|
// Execute token transfer transaction
|
|
136
136
|
const handleSend = async () => {
|
|
137
|
-
|
|
137
|
+
const sendAmountWithoutCommas = sendAmount.replace(/,/g, "");
|
|
138
|
+
if (!displayToken || !recipientAddress || !sendAmount || parseFloat(sendAmountWithoutCommas) <= 0) {
|
|
138
139
|
return;
|
|
139
140
|
}
|
|
140
141
|
setIsSending(true);
|
|
141
|
-
const amountInWei = (0, viem_1.parseUnits)(
|
|
142
|
+
const amountInWei = (0, viem_1.parseUnits)(sendAmountWithoutCommas, displayToken.decimals);
|
|
142
143
|
// Prepare analytics event data
|
|
143
144
|
const analyticsData = {
|
|
144
145
|
amount: sendAmount,
|
|
@@ -3,13 +3,13 @@ import { ALL_CHAINS, getExplorerTxUrl } from "../../../../anyspend/index.js";
|
|
|
3
3
|
import { ChainTokenIcon } from "../../../../anyspend/react/components/common/ChainTokenIcon.js";
|
|
4
4
|
import { Button, TransitionPanel, useAnalytics, useSimBalance, useUnifiedChainSwitchAndExecute, } from "../../../../global-account/react/index.js";
|
|
5
5
|
import { formatDisplayNumber, formatTokenAmount } from "../../../../shared/utils/number.js";
|
|
6
|
+
import invariant from "invariant";
|
|
6
7
|
import { ArrowLeft, CircleHelp, Copy, Loader2, Send } from "lucide-react";
|
|
7
8
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
8
9
|
import { NumericFormat } from "react-number-format";
|
|
9
10
|
import { toast } from "sonner";
|
|
10
11
|
import { useActiveAccount } from "thirdweb/react";
|
|
11
12
|
import { encodeFunctionData, erc20Abi, isAddress, parseUnits } from "viem";
|
|
12
|
-
import invariant from "invariant";
|
|
13
13
|
// Panel view enum for managing navigation between token list and send form
|
|
14
14
|
var TokenPanelView;
|
|
15
15
|
(function (TokenPanelView) {
|
|
@@ -128,11 +128,12 @@ export function ContentTokens({ activeTab }) {
|
|
|
128
128
|
};
|
|
129
129
|
// Execute token transfer transaction
|
|
130
130
|
const handleSend = async () => {
|
|
131
|
-
|
|
131
|
+
const sendAmountWithoutCommas = sendAmount.replace(/,/g, "");
|
|
132
|
+
if (!displayToken || !recipientAddress || !sendAmount || parseFloat(sendAmountWithoutCommas) <= 0) {
|
|
132
133
|
return;
|
|
133
134
|
}
|
|
134
135
|
setIsSending(true);
|
|
135
|
-
const amountInWei = parseUnits(
|
|
136
|
+
const amountInWei = parseUnits(sendAmountWithoutCommas, displayToken.decimals);
|
|
136
137
|
// Prepare analytics event data
|
|
137
138
|
const analyticsData = {
|
|
138
139
|
amount: sendAmount,
|
package/package.json
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
useUnifiedChainSwitchAndExecute,
|
|
9
9
|
} from "@b3dotfun/sdk/global-account/react";
|
|
10
10
|
import { formatDisplayNumber, formatTokenAmount } from "@b3dotfun/sdk/shared/utils/number";
|
|
11
|
+
import invariant from "invariant";
|
|
11
12
|
import { ArrowLeft, CircleHelp, Copy, Loader2, Send } from "lucide-react";
|
|
12
13
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
13
14
|
import { NumericFormat } from "react-number-format";
|
|
@@ -15,7 +16,6 @@ import { toast } from "sonner";
|
|
|
15
16
|
import { useActiveAccount } from "thirdweb/react";
|
|
16
17
|
import { encodeFunctionData, erc20Abi, isAddress, parseUnits } from "viem";
|
|
17
18
|
import { SimBalanceItem } from "../../hooks/useSimBalance";
|
|
18
|
-
import invariant from "invariant";
|
|
19
19
|
|
|
20
20
|
// Panel view enum for managing navigation between token list and send form
|
|
21
21
|
enum TokenPanelView {
|
|
@@ -156,13 +156,15 @@ export function ContentTokens({ activeTab }: ContentTokensProps) {
|
|
|
156
156
|
|
|
157
157
|
// Execute token transfer transaction
|
|
158
158
|
const handleSend = async () => {
|
|
159
|
-
|
|
159
|
+
const sendAmountWithoutCommas = sendAmount.replace(/,/g, "");
|
|
160
|
+
|
|
161
|
+
if (!displayToken || !recipientAddress || !sendAmount || parseFloat(sendAmountWithoutCommas) <= 0) {
|
|
160
162
|
return;
|
|
161
163
|
}
|
|
162
164
|
|
|
163
165
|
setIsSending(true);
|
|
164
166
|
|
|
165
|
-
const amountInWei = parseUnits(
|
|
167
|
+
const amountInWei = parseUnits(sendAmountWithoutCommas, displayToken.decimals);
|
|
166
168
|
|
|
167
169
|
// Prepare analytics event data
|
|
168
170
|
const analyticsData = {
|