@b3dotfun/sdk 0.0.1-alpha.13 → 0.0.1-alpha.14
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/cjs/anyspend/react/components/AnySpend.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnySpend.js +4 -4
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnySpend.js +4 -4
- package/dist/types/anyspend/react/components/AnySpend.d.ts +2 -1
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +6 -5
|
@@ -11,7 +11,7 @@ export declare enum PanelView {
|
|
|
11
11
|
LOADING = 3,
|
|
12
12
|
FIAT_PAYMENT = 4
|
|
13
13
|
}
|
|
14
|
-
export declare function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet, mode, defaultActiveTab, loadOrder, hideTransactionHistoryButton }: {
|
|
14
|
+
export declare function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet, mode, defaultActiveTab, loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps }: {
|
|
15
15
|
destinationTokenAddress?: string;
|
|
16
16
|
destinationTokenChainId?: number;
|
|
17
17
|
isMainnet?: boolean;
|
|
@@ -19,4 +19,5 @@ export declare function AnySpend({ destinationTokenAddress, destinationTokenChai
|
|
|
19
19
|
defaultActiveTab?: "crypto" | "fiat";
|
|
20
20
|
loadOrder?: string;
|
|
21
21
|
hideTransactionHistoryButton?: boolean;
|
|
22
|
+
recipientAddress?: string;
|
|
22
23
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -9,8 +9,8 @@ exports.AnySpend = AnySpend;
|
|
|
9
9
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
10
10
|
const anyspend_1 = require("../../../anyspend");
|
|
11
11
|
const react_1 = require("../../../global-account/react");
|
|
12
|
-
const formatAddress_1 = require("../../../shared/utils/formatAddress");
|
|
13
12
|
const cn_1 = require("../../../shared/utils/cn");
|
|
13
|
+
const formatAddress_1 = require("../../../shared/utils/formatAddress");
|
|
14
14
|
const number_1 = require("../../../shared/utils/number");
|
|
15
15
|
const framer_motion_1 = require("framer-motion");
|
|
16
16
|
const invariant_1 = __importDefault(require("invariant"));
|
|
@@ -36,7 +36,7 @@ var PanelView;
|
|
|
36
36
|
PanelView[PanelView["FIAT_PAYMENT"] = 4] = "FIAT_PAYMENT";
|
|
37
37
|
})(PanelView || (exports.PanelView = PanelView = {}));
|
|
38
38
|
const ANYSPEND_RECIPIENTS_KEY = "anyspend_recipients";
|
|
39
|
-
function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet = true, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton }) {
|
|
39
|
+
function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet = true, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps }) {
|
|
40
40
|
const searchParams = (0, react_1.useSearchParamsSSR)();
|
|
41
41
|
const router = (0, react_1.useRouter)();
|
|
42
42
|
// Determine if we're in "buy mode" based on whether destination token props are provided
|
|
@@ -279,8 +279,8 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
|
|
|
279
279
|
const { address: globalAddress, wallet: globalWallet } = (0, react_1.useAccountWallet)();
|
|
280
280
|
// Set default recipient address when wallet changes
|
|
281
281
|
(0, react_2.useEffect)(() => {
|
|
282
|
-
setRecipientAddress(globalAddress);
|
|
283
|
-
}, [globalAddress]);
|
|
282
|
+
setRecipientAddress(recipientAddressFromProps || globalAddress);
|
|
283
|
+
}, [recipientAddressFromProps, globalAddress]);
|
|
284
284
|
// Get anyspend price
|
|
285
285
|
const activeInputAmountInWei = isSrcInputDirty
|
|
286
286
|
? (0, viem_1.parseUnits)(srcAmount.replaceAll(",", ""), selectedSrcToken.decimals).toString()
|
|
@@ -11,7 +11,7 @@ export declare enum PanelView {
|
|
|
11
11
|
LOADING = 3,
|
|
12
12
|
FIAT_PAYMENT = 4
|
|
13
13
|
}
|
|
14
|
-
export declare function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet, mode, defaultActiveTab, loadOrder, hideTransactionHistoryButton }: {
|
|
14
|
+
export declare function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet, mode, defaultActiveTab, loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps }: {
|
|
15
15
|
destinationTokenAddress?: string;
|
|
16
16
|
destinationTokenChainId?: number;
|
|
17
17
|
isMainnet?: boolean;
|
|
@@ -19,4 +19,5 @@ export declare function AnySpend({ destinationTokenAddress, destinationTokenChai
|
|
|
19
19
|
defaultActiveTab?: "crypto" | "fiat";
|
|
20
20
|
loadOrder?: string;
|
|
21
21
|
hideTransactionHistoryButton?: boolean;
|
|
22
|
+
recipientAddress?: string;
|
|
22
23
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { getDefaultToken, OrderType, TradeType, USDC_BASE, useAnyspendCreateOrder, useAnyspendOrderAndTransactions, useAnyspendQuote } from "../../../anyspend";
|
|
4
4
|
import { Button, ShinyButton, StyleRoot, TransitionPanel, useAccountWallet, useOnchainName, useRouter, useSearchParamsSSR, useTokenData, useTokenFromUrl } from "../../../global-account/react";
|
|
5
|
-
import { shortenAddress } from "../../../shared/utils/formatAddress";
|
|
6
5
|
import { cn } from "../../../shared/utils/cn";
|
|
6
|
+
import { shortenAddress } from "../../../shared/utils/formatAddress";
|
|
7
7
|
import { formatDisplayNumber, formatTokenAmount } from "../../../shared/utils/number";
|
|
8
8
|
import { motion } from "framer-motion";
|
|
9
9
|
import invariant from "invariant";
|
|
@@ -29,7 +29,7 @@ export var PanelView;
|
|
|
29
29
|
PanelView[PanelView["FIAT_PAYMENT"] = 4] = "FIAT_PAYMENT";
|
|
30
30
|
})(PanelView || (PanelView = {}));
|
|
31
31
|
const ANYSPEND_RECIPIENTS_KEY = "anyspend_recipients";
|
|
32
|
-
export function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet = true, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton }) {
|
|
32
|
+
export function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet = true, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps }) {
|
|
33
33
|
const searchParams = useSearchParamsSSR();
|
|
34
34
|
const router = useRouter();
|
|
35
35
|
// Determine if we're in "buy mode" based on whether destination token props are provided
|
|
@@ -272,8 +272,8 @@ export function AnySpend({ destinationTokenAddress, destinationTokenChainId, isM
|
|
|
272
272
|
const { address: globalAddress, wallet: globalWallet } = useAccountWallet();
|
|
273
273
|
// Set default recipient address when wallet changes
|
|
274
274
|
useEffect(() => {
|
|
275
|
-
setRecipientAddress(globalAddress);
|
|
276
|
-
}, [globalAddress]);
|
|
275
|
+
setRecipientAddress(recipientAddressFromProps || globalAddress);
|
|
276
|
+
}, [recipientAddressFromProps, globalAddress]);
|
|
277
277
|
// Get anyspend price
|
|
278
278
|
const activeInputAmountInWei = isSrcInputDirty
|
|
279
279
|
? parseUnits(srcAmount.replaceAll(",", ""), selectedSrcToken.decimals).toString()
|
|
@@ -11,7 +11,7 @@ export declare enum PanelView {
|
|
|
11
11
|
LOADING = 3,
|
|
12
12
|
FIAT_PAYMENT = 4
|
|
13
13
|
}
|
|
14
|
-
export declare function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet, mode, defaultActiveTab, loadOrder, hideTransactionHistoryButton }: {
|
|
14
|
+
export declare function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet, mode, defaultActiveTab, loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps }: {
|
|
15
15
|
destinationTokenAddress?: string;
|
|
16
16
|
destinationTokenChainId?: number;
|
|
17
17
|
isMainnet?: boolean;
|
|
@@ -19,4 +19,5 @@ export declare function AnySpend({ destinationTokenAddress, destinationTokenChai
|
|
|
19
19
|
defaultActiveTab?: "crypto" | "fiat";
|
|
20
20
|
loadOrder?: string;
|
|
21
21
|
hideTransactionHistoryButton?: boolean;
|
|
22
|
+
recipientAddress?: string;
|
|
22
23
|
}): import("react/jsx-runtime").JSX.Element;
|
package/package.json
CHANGED
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
ShinyButton,
|
|
16
16
|
StyleRoot,
|
|
17
17
|
TransitionPanel,
|
|
18
|
-
useAccountAssets,
|
|
19
18
|
useAccountWallet,
|
|
20
19
|
useOnchainName,
|
|
21
20
|
useRouter,
|
|
@@ -23,8 +22,8 @@ import {
|
|
|
23
22
|
useTokenData,
|
|
24
23
|
useTokenFromUrl
|
|
25
24
|
} from "@b3dotfun/sdk/global-account/react";
|
|
26
|
-
import { shortenAddress } from "@b3dotfun/sdk/shared/utils/formatAddress";
|
|
27
25
|
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
26
|
+
import { shortenAddress } from "@b3dotfun/sdk/shared/utils/formatAddress";
|
|
28
27
|
import { formatDisplayNumber, formatTokenAmount } from "@b3dotfun/sdk/shared/utils/number";
|
|
29
28
|
import { motion } from "framer-motion";
|
|
30
29
|
import invariant from "invariant";
|
|
@@ -66,7 +65,8 @@ export function AnySpend({
|
|
|
66
65
|
mode = "modal",
|
|
67
66
|
defaultActiveTab = "crypto",
|
|
68
67
|
loadOrder,
|
|
69
|
-
hideTransactionHistoryButton
|
|
68
|
+
hideTransactionHistoryButton,
|
|
69
|
+
recipientAddress: recipientAddressFromProps
|
|
70
70
|
}: {
|
|
71
71
|
destinationTokenAddress?: string;
|
|
72
72
|
destinationTokenChainId?: number;
|
|
@@ -75,6 +75,7 @@ export function AnySpend({
|
|
|
75
75
|
defaultActiveTab?: "crypto" | "fiat";
|
|
76
76
|
loadOrder?: string;
|
|
77
77
|
hideTransactionHistoryButton?: boolean;
|
|
78
|
+
recipientAddress?: string;
|
|
78
79
|
}) {
|
|
79
80
|
const searchParams = useSearchParamsSSR();
|
|
80
81
|
const router = useRouter();
|
|
@@ -374,8 +375,8 @@ export function AnySpend({
|
|
|
374
375
|
|
|
375
376
|
// Set default recipient address when wallet changes
|
|
376
377
|
useEffect(() => {
|
|
377
|
-
setRecipientAddress(globalAddress);
|
|
378
|
-
}, [globalAddress]);
|
|
378
|
+
setRecipientAddress(recipientAddressFromProps || globalAddress);
|
|
379
|
+
}, [recipientAddressFromProps, globalAddress]);
|
|
379
380
|
|
|
380
381
|
// Get anyspend price
|
|
381
382
|
const activeInputAmountInWei = isSrcInputDirty
|