@b3dotfun/sdk 0.0.62-alpha.4 → 0.0.62-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.
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +1 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +4 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.js +3 -3
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +4 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.js +2 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +1 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +1 -1
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -1
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +1 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +4 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.js +3 -3
- package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +4 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.js +2 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +1 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +1 -1
- package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -1
- package/dist/types/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +4 -2
- package/dist/types/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +4 -2
- package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +1 -1
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +3 -4
- package/src/anyspend/react/components/AnySpendStakeB3ExactIn.tsx +8 -2
- package/src/anyspend/react/components/AnySpendStakeUpsideExactIn.tsx +7 -1
- package/src/anyspend/react/hooks/useAnyspendFlow.ts +2 -2
|
@@ -17,7 +17,7 @@ export interface AnySpendCustomExactInProps {
|
|
|
17
17
|
sourceTokenChainId?: number;
|
|
18
18
|
destinationToken: components["schemas"]["Token"];
|
|
19
19
|
destinationChainId: number;
|
|
20
|
-
onSuccess?: () => void;
|
|
20
|
+
onSuccess?: (amount: string) => void;
|
|
21
21
|
mainFooter?: React.ReactNode;
|
|
22
22
|
onTokenSelect?: (token: components["schemas"]["Token"], event: {
|
|
23
23
|
preventDefault: () => void;
|
|
@@ -250,8 +250,7 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
|
|
|
250
250
|
: anyspendQuote.data.currencyIn?.amountUsd
|
|
251
251
|
? Number(anyspendQuote.data.currencyIn.amountUsd)
|
|
252
252
|
: undefined, onBack: () => setActivePanel(useAnyspendFlow_1.PanelView.MAIN) })) : null;
|
|
253
|
-
return ((0, jsx_runtime_1.jsx)(react_1.StyleRoot, { children: (0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("anyspend-container font-inter mx-auto w-full max-w-[460px]
|
|
254
|
-
"bg-as-surface-primary border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl"), children: (0, jsx_runtime_1.jsx)(react_1.TransitionPanel, { activeIndex: orderId
|
|
253
|
+
return ((0, jsx_runtime_1.jsx)(react_1.StyleRoot, { children: (0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("anyspend-container font-inter bg-as-surface-primary mx-auto w-full max-w-[460px] p-6", mode === "page" && "border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl"), children: (0, jsx_runtime_1.jsx)(react_1.TransitionPanel, { activeIndex: orderId
|
|
255
254
|
? oat
|
|
256
255
|
? useAnyspendFlow_1.PanelView.ORDER_DETAILS
|
|
257
256
|
: useAnyspendFlow_1.PanelView.LOADING
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
export declare function AnySpendStakeB3ExactIn({ loadOrder, mode, recipientAddress, stakeAmount, onSuccess, }: {
|
|
1
|
+
export declare function AnySpendStakeB3ExactIn({ loadOrder, mode, sourceTokenAddress, sourceTokenChainId, recipientAddress, stakeAmount, onSuccess, }: {
|
|
2
2
|
loadOrder?: string;
|
|
3
3
|
mode?: "modal" | "page";
|
|
4
|
+
sourceTokenAddress?: string;
|
|
5
|
+
sourceTokenChainId?: number;
|
|
4
6
|
recipientAddress: string;
|
|
5
7
|
stakeAmount?: string;
|
|
6
|
-
onSuccess?: () => void;
|
|
8
|
+
onSuccess?: (amount: string) => void;
|
|
7
9
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -35,7 +35,7 @@ const STAKE_FUNCTION_ABI = JSON.stringify([
|
|
|
35
35
|
outputs: [],
|
|
36
36
|
},
|
|
37
37
|
]);
|
|
38
|
-
function AnySpendStakeB3ExactIn({ loadOrder, mode = "modal", recipientAddress, stakeAmount, onSuccess, }) {
|
|
38
|
+
function AnySpendStakeB3ExactIn({ loadOrder, mode = "modal", sourceTokenAddress, sourceTokenChainId, recipientAddress, stakeAmount, onSuccess, }) {
|
|
39
39
|
const hasMounted = (0, react_1.useHasMounted)();
|
|
40
40
|
const { setB3ModalOpen } = (0, react_1.useModalStore)();
|
|
41
41
|
// Wagmi hooks for direct staking
|
|
@@ -281,8 +281,8 @@ function AnySpendStakeB3ExactIn({ loadOrder, mode = "modal", recipientAddress, s
|
|
|
281
281
|
filter: hasMounted ? "blur(0px)" : "blur(10px)",
|
|
282
282
|
}, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: "bg-b3-react-background w-full p-6", children: [(0, jsx_runtime_1.jsx)("div", { className: "mb-6", children: (0, jsx_runtime_1.jsx)("a", { href: `https://basescan.org/tx/${stakingTxHash}`, target: "_blank", rel: "noopener noreferrer", className: "text-as-primary/70 hover:text-as-primary block break-all text-center font-mono text-sm underline transition-colors", children: "View transaction" }) }), (0, jsx_runtime_1.jsx)(react_1.Button, { onClick: () => {
|
|
283
283
|
setB3ModalOpen(false);
|
|
284
|
-
onSuccess?.();
|
|
284
|
+
onSuccess?.((0, number_1.formatTokenAmount)(BigInt(userStakeAmount), 18) ?? "");
|
|
285
285
|
}, className: "bg-as-brand hover:bg-as-brand/90 text-as-primary h-14 w-full rounded-xl text-lg font-medium", children: "Done" })] })] }) }));
|
|
286
286
|
}
|
|
287
|
-
return ((0, jsx_runtime_1.jsx)(AnySpendCustomExactIn_1.AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, destinationToken: anyspend_1.B3_TOKEN, destinationChainId: chains_1.base.id, customExactInConfig: customExactInConfig, header: header, onSuccess: onSuccess }));
|
|
287
|
+
return ((0, jsx_runtime_1.jsx)(AnySpendCustomExactIn_1.AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, sourceTokenAddress: sourceTokenAddress, sourceTokenChainId: sourceTokenChainId, destinationToken: anyspend_1.B3_TOKEN, destinationChainId: chains_1.base.id, customExactInConfig: customExactInConfig, header: header, onSuccess: onSuccess }));
|
|
288
288
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { components } from "../../../anyspend/types/api";
|
|
2
|
-
export declare function AnySpendStakeUpsideExactIn({ loadOrder, mode, recipientAddress, stakingContractAddress, token, onSuccess, }: {
|
|
2
|
+
export declare function AnySpendStakeUpsideExactIn({ loadOrder, mode, recipientAddress, sourceTokenAddress, sourceTokenChainId, stakingContractAddress, token, onSuccess, }: {
|
|
3
3
|
loadOrder?: string;
|
|
4
4
|
mode?: "modal" | "page";
|
|
5
5
|
recipientAddress: string;
|
|
6
|
+
sourceTokenAddress?: string;
|
|
7
|
+
sourceTokenChainId?: number;
|
|
6
8
|
stakingContractAddress: string;
|
|
7
9
|
token: components["schemas"]["Token"];
|
|
8
|
-
onSuccess?: () => void;
|
|
10
|
+
onSuccess?: (amount: string) => void;
|
|
9
11
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -17,7 +17,7 @@ const STAKE_FOR_FUNCTION_ABI = JSON.stringify([
|
|
|
17
17
|
outputs: [],
|
|
18
18
|
},
|
|
19
19
|
]);
|
|
20
|
-
function AnySpendStakeUpsideExactIn({ loadOrder, mode = "modal", recipientAddress, stakingContractAddress, token, onSuccess, }) {
|
|
20
|
+
function AnySpendStakeUpsideExactIn({ loadOrder, mode = "modal", recipientAddress, sourceTokenAddress, sourceTokenChainId, stakingContractAddress, token, onSuccess, }) {
|
|
21
21
|
if (!recipientAddress)
|
|
22
22
|
return null;
|
|
23
23
|
const header = () => ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)("div", { className: "from-b3-react-background to-as-on-surface-1 w-full rounded-t-lg bg-gradient-to-t", children: (0, jsx_runtime_1.jsx)("div", { className: "mb-1 flex w-full flex-col items-center gap-2", children: (0, jsx_runtime_1.jsxs)("span", { className: "font-sf-rounded text-2xl font-semibold", children: ["Swap & Stake ", token.symbol, " (Exact In)"] }) }) }) }));
|
|
@@ -29,5 +29,5 @@ function AnySpendStakeUpsideExactIn({ loadOrder, mode = "modal", recipientAddres
|
|
|
29
29
|
spenderAddress: stakingContractAddress,
|
|
30
30
|
action: `stake ${token.symbol}`,
|
|
31
31
|
};
|
|
32
|
-
return ((0, jsx_runtime_1.jsx)(AnySpendCustomExactIn_1.AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, destinationToken: token, destinationChainId: chains_1.base.id, customExactInConfig: customExactInConfig, header: header, onSuccess: onSuccess }));
|
|
32
|
+
return ((0, jsx_runtime_1.jsx)(AnySpendCustomExactIn_1.AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, sourceTokenAddress: sourceTokenAddress, sourceTokenChainId: sourceTokenChainId, destinationToken: token, destinationChainId: chains_1.base.id, customExactInConfig: customExactInConfig, header: header, onSuccess: onSuccess }));
|
|
33
33
|
}
|
|
@@ -17,7 +17,7 @@ interface UseAnyspendFlowProps {
|
|
|
17
17
|
loadOrder?: string;
|
|
18
18
|
isDepositMode?: boolean;
|
|
19
19
|
onOrderSuccess?: (orderId: string) => void;
|
|
20
|
-
onTransactionSuccess?: (amount
|
|
20
|
+
onTransactionSuccess?: (amount: string) => void;
|
|
21
21
|
sourceTokenAddress?: string;
|
|
22
22
|
sourceTokenChainId?: number;
|
|
23
23
|
destinationTokenAddress?: string;
|
|
@@ -220,7 +220,7 @@ function useAnyspendFlow({ paymentType = "crypto", recipientAddress, loadOrder,
|
|
|
220
220
|
const formattedActualDstAmount = amount
|
|
221
221
|
? (0, number_1.formatTokenAmount)(BigInt(amount), oat.data.order.metadata.dstToken.decimals)
|
|
222
222
|
: undefined;
|
|
223
|
-
onTransactionSuccess?.(formattedActualDstAmount);
|
|
223
|
+
onTransactionSuccess?.(formattedActualDstAmount ?? "");
|
|
224
224
|
}
|
|
225
225
|
}, [
|
|
226
226
|
oat?.data?.order.status,
|
|
@@ -17,7 +17,7 @@ export interface AnySpendCustomExactInProps {
|
|
|
17
17
|
sourceTokenChainId?: number;
|
|
18
18
|
destinationToken: components["schemas"]["Token"];
|
|
19
19
|
destinationChainId: number;
|
|
20
|
-
onSuccess?: () => void;
|
|
20
|
+
onSuccess?: (amount: string) => void;
|
|
21
21
|
mainFooter?: React.ReactNode;
|
|
22
22
|
onTokenSelect?: (token: components["schemas"]["Token"], event: {
|
|
23
23
|
preventDefault: () => void;
|
|
@@ -244,8 +244,7 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
|
|
|
244
244
|
: anyspendQuote.data.currencyIn?.amountUsd
|
|
245
245
|
? Number(anyspendQuote.data.currencyIn.amountUsd)
|
|
246
246
|
: undefined, onBack: () => setActivePanel(PanelView.MAIN) })) : null;
|
|
247
|
-
return (_jsx(StyleRoot, { children: _jsx("div", { className: cn("anyspend-container font-inter mx-auto w-full max-w-[460px]
|
|
248
|
-
"bg-as-surface-primary border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl"), children: _jsx(TransitionPanel, { activeIndex: orderId
|
|
247
|
+
return (_jsx(StyleRoot, { children: _jsx("div", { className: cn("anyspend-container font-inter bg-as-surface-primary mx-auto w-full max-w-[460px] p-6", mode === "page" && "border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl"), children: _jsx(TransitionPanel, { activeIndex: orderId
|
|
249
248
|
? oat
|
|
250
249
|
? PanelView.ORDER_DETAILS
|
|
251
250
|
: PanelView.LOADING
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
export declare function AnySpendStakeB3ExactIn({ loadOrder, mode, recipientAddress, stakeAmount, onSuccess, }: {
|
|
1
|
+
export declare function AnySpendStakeB3ExactIn({ loadOrder, mode, sourceTokenAddress, sourceTokenChainId, recipientAddress, stakeAmount, onSuccess, }: {
|
|
2
2
|
loadOrder?: string;
|
|
3
3
|
mode?: "modal" | "page";
|
|
4
|
+
sourceTokenAddress?: string;
|
|
5
|
+
sourceTokenChainId?: number;
|
|
4
6
|
recipientAddress: string;
|
|
5
7
|
stakeAmount?: string;
|
|
6
|
-
onSuccess?: () => void;
|
|
8
|
+
onSuccess?: (amount: string) => void;
|
|
7
9
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -32,7 +32,7 @@ const STAKE_FUNCTION_ABI = JSON.stringify([
|
|
|
32
32
|
outputs: [],
|
|
33
33
|
},
|
|
34
34
|
]);
|
|
35
|
-
export function AnySpendStakeB3ExactIn({ loadOrder, mode = "modal", recipientAddress, stakeAmount, onSuccess, }) {
|
|
35
|
+
export function AnySpendStakeB3ExactIn({ loadOrder, mode = "modal", sourceTokenAddress, sourceTokenChainId, recipientAddress, stakeAmount, onSuccess, }) {
|
|
36
36
|
const hasMounted = useHasMounted();
|
|
37
37
|
const { setB3ModalOpen } = useModalStore();
|
|
38
38
|
// Wagmi hooks for direct staking
|
|
@@ -278,8 +278,8 @@ export function AnySpendStakeB3ExactIn({ loadOrder, mode = "modal", recipientAdd
|
|
|
278
278
|
filter: hasMounted ? "blur(0px)" : "blur(10px)",
|
|
279
279
|
}, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: "bg-b3-react-background w-full p-6", children: [_jsx("div", { className: "mb-6", children: _jsx("a", { href: `https://basescan.org/tx/${stakingTxHash}`, target: "_blank", rel: "noopener noreferrer", className: "text-as-primary/70 hover:text-as-primary block break-all text-center font-mono text-sm underline transition-colors", children: "View transaction" }) }), _jsx(Button, { onClick: () => {
|
|
280
280
|
setB3ModalOpen(false);
|
|
281
|
-
onSuccess?.();
|
|
281
|
+
onSuccess?.(formatTokenAmount(BigInt(userStakeAmount), 18) ?? "");
|
|
282
282
|
}, className: "bg-as-brand hover:bg-as-brand/90 text-as-primary h-14 w-full rounded-xl text-lg font-medium", children: "Done" })] })] }) }));
|
|
283
283
|
}
|
|
284
|
-
return (_jsx(AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, destinationToken: B3_TOKEN, destinationChainId: base.id, customExactInConfig: customExactInConfig, header: header, onSuccess: onSuccess }));
|
|
284
|
+
return (_jsx(AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, sourceTokenAddress: sourceTokenAddress, sourceTokenChainId: sourceTokenChainId, destinationToken: B3_TOKEN, destinationChainId: base.id, customExactInConfig: customExactInConfig, header: header, onSuccess: onSuccess }));
|
|
285
285
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { components } from "../../../anyspend/types/api";
|
|
2
|
-
export declare function AnySpendStakeUpsideExactIn({ loadOrder, mode, recipientAddress, stakingContractAddress, token, onSuccess, }: {
|
|
2
|
+
export declare function AnySpendStakeUpsideExactIn({ loadOrder, mode, recipientAddress, sourceTokenAddress, sourceTokenChainId, stakingContractAddress, token, onSuccess, }: {
|
|
3
3
|
loadOrder?: string;
|
|
4
4
|
mode?: "modal" | "page";
|
|
5
5
|
recipientAddress: string;
|
|
6
|
+
sourceTokenAddress?: string;
|
|
7
|
+
sourceTokenChainId?: number;
|
|
6
8
|
stakingContractAddress: string;
|
|
7
9
|
token: components["schemas"]["Token"];
|
|
8
|
-
onSuccess?: () => void;
|
|
10
|
+
onSuccess?: (amount: string) => void;
|
|
9
11
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -14,7 +14,7 @@ const STAKE_FOR_FUNCTION_ABI = JSON.stringify([
|
|
|
14
14
|
outputs: [],
|
|
15
15
|
},
|
|
16
16
|
]);
|
|
17
|
-
export function AnySpendStakeUpsideExactIn({ loadOrder, mode = "modal", recipientAddress, stakingContractAddress, token, onSuccess, }) {
|
|
17
|
+
export function AnySpendStakeUpsideExactIn({ loadOrder, mode = "modal", recipientAddress, sourceTokenAddress, sourceTokenChainId, stakingContractAddress, token, onSuccess, }) {
|
|
18
18
|
if (!recipientAddress)
|
|
19
19
|
return null;
|
|
20
20
|
const header = () => (_jsx(_Fragment, { children: _jsx("div", { className: "from-b3-react-background to-as-on-surface-1 w-full rounded-t-lg bg-gradient-to-t", children: _jsx("div", { className: "mb-1 flex w-full flex-col items-center gap-2", children: _jsxs("span", { className: "font-sf-rounded text-2xl font-semibold", children: ["Swap & Stake ", token.symbol, " (Exact In)"] }) }) }) }));
|
|
@@ -26,5 +26,5 @@ export function AnySpendStakeUpsideExactIn({ loadOrder, mode = "modal", recipien
|
|
|
26
26
|
spenderAddress: stakingContractAddress,
|
|
27
27
|
action: `stake ${token.symbol}`,
|
|
28
28
|
};
|
|
29
|
-
return (_jsx(AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, destinationToken: token, destinationChainId: base.id, customExactInConfig: customExactInConfig, header: header, onSuccess: onSuccess }));
|
|
29
|
+
return (_jsx(AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, sourceTokenAddress: sourceTokenAddress, sourceTokenChainId: sourceTokenChainId, destinationToken: token, destinationChainId: base.id, customExactInConfig: customExactInConfig, header: header, onSuccess: onSuccess }));
|
|
30
30
|
}
|
|
@@ -17,7 +17,7 @@ interface UseAnyspendFlowProps {
|
|
|
17
17
|
loadOrder?: string;
|
|
18
18
|
isDepositMode?: boolean;
|
|
19
19
|
onOrderSuccess?: (orderId: string) => void;
|
|
20
|
-
onTransactionSuccess?: (amount
|
|
20
|
+
onTransactionSuccess?: (amount: string) => void;
|
|
21
21
|
sourceTokenAddress?: string;
|
|
22
22
|
sourceTokenChainId?: number;
|
|
23
23
|
destinationTokenAddress?: string;
|
|
@@ -216,7 +216,7 @@ export function useAnyspendFlow({ paymentType = "crypto", recipientAddress, load
|
|
|
216
216
|
const formattedActualDstAmount = amount
|
|
217
217
|
? formatTokenAmount(BigInt(amount), oat.data.order.metadata.dstToken.decimals)
|
|
218
218
|
: undefined;
|
|
219
|
-
onTransactionSuccess?.(formattedActualDstAmount);
|
|
219
|
+
onTransactionSuccess?.(formattedActualDstAmount ?? "");
|
|
220
220
|
}
|
|
221
221
|
}, [
|
|
222
222
|
oat?.data?.order.status,
|
|
@@ -17,7 +17,7 @@ export interface AnySpendCustomExactInProps {
|
|
|
17
17
|
sourceTokenChainId?: number;
|
|
18
18
|
destinationToken: components["schemas"]["Token"];
|
|
19
19
|
destinationChainId: number;
|
|
20
|
-
onSuccess?: () => void;
|
|
20
|
+
onSuccess?: (amount: string) => void;
|
|
21
21
|
mainFooter?: React.ReactNode;
|
|
22
22
|
onTokenSelect?: (token: components["schemas"]["Token"], event: {
|
|
23
23
|
preventDefault: () => void;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
export declare function AnySpendStakeB3ExactIn({ loadOrder, mode, recipientAddress, stakeAmount, onSuccess, }: {
|
|
1
|
+
export declare function AnySpendStakeB3ExactIn({ loadOrder, mode, sourceTokenAddress, sourceTokenChainId, recipientAddress, stakeAmount, onSuccess, }: {
|
|
2
2
|
loadOrder?: string;
|
|
3
3
|
mode?: "modal" | "page";
|
|
4
|
+
sourceTokenAddress?: string;
|
|
5
|
+
sourceTokenChainId?: number;
|
|
4
6
|
recipientAddress: string;
|
|
5
7
|
stakeAmount?: string;
|
|
6
|
-
onSuccess?: () => void;
|
|
8
|
+
onSuccess?: (amount: string) => void;
|
|
7
9
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
2
|
-
export declare function AnySpendStakeUpsideExactIn({ loadOrder, mode, recipientAddress, stakingContractAddress, token, onSuccess, }: {
|
|
2
|
+
export declare function AnySpendStakeUpsideExactIn({ loadOrder, mode, recipientAddress, sourceTokenAddress, sourceTokenChainId, stakingContractAddress, token, onSuccess, }: {
|
|
3
3
|
loadOrder?: string;
|
|
4
4
|
mode?: "modal" | "page";
|
|
5
5
|
recipientAddress: string;
|
|
6
|
+
sourceTokenAddress?: string;
|
|
7
|
+
sourceTokenChainId?: number;
|
|
6
8
|
stakingContractAddress: string;
|
|
7
9
|
token: components["schemas"]["Token"];
|
|
8
|
-
onSuccess?: () => void;
|
|
10
|
+
onSuccess?: (amount: string) => void;
|
|
9
11
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -17,7 +17,7 @@ interface UseAnyspendFlowProps {
|
|
|
17
17
|
loadOrder?: string;
|
|
18
18
|
isDepositMode?: boolean;
|
|
19
19
|
onOrderSuccess?: (orderId: string) => void;
|
|
20
|
-
onTransactionSuccess?: (amount
|
|
20
|
+
onTransactionSuccess?: (amount: string) => void;
|
|
21
21
|
sourceTokenAddress?: string;
|
|
22
22
|
sourceTokenChainId?: number;
|
|
23
23
|
destinationTokenAddress?: string;
|
package/package.json
CHANGED
|
@@ -42,7 +42,7 @@ export interface AnySpendCustomExactInProps {
|
|
|
42
42
|
sourceTokenChainId?: number;
|
|
43
43
|
destinationToken: components["schemas"]["Token"];
|
|
44
44
|
destinationChainId: number;
|
|
45
|
-
onSuccess?: () => void;
|
|
45
|
+
onSuccess?: (amount: string) => void;
|
|
46
46
|
mainFooter?: React.ReactNode;
|
|
47
47
|
onTokenSelect?: (token: components["schemas"]["Token"], event: { preventDefault: () => void }) => void;
|
|
48
48
|
customUsdInputValues?: string[];
|
|
@@ -554,9 +554,8 @@ function AnySpendCustomExactInInner({
|
|
|
554
554
|
<StyleRoot>
|
|
555
555
|
<div
|
|
556
556
|
className={cn(
|
|
557
|
-
"anyspend-container font-inter mx-auto w-full max-w-[460px]
|
|
558
|
-
mode === "page" &&
|
|
559
|
-
"bg-as-surface-primary border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl",
|
|
557
|
+
"anyspend-container font-inter bg-as-surface-primary mx-auto w-full max-w-[460px] p-6",
|
|
558
|
+
mode === "page" && "border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl",
|
|
560
559
|
)}
|
|
561
560
|
>
|
|
562
561
|
<TransitionPanel
|
|
@@ -48,15 +48,19 @@ const STAKE_FUNCTION_ABI = JSON.stringify([
|
|
|
48
48
|
export function AnySpendStakeB3ExactIn({
|
|
49
49
|
loadOrder,
|
|
50
50
|
mode = "modal",
|
|
51
|
+
sourceTokenAddress,
|
|
52
|
+
sourceTokenChainId,
|
|
51
53
|
recipientAddress,
|
|
52
54
|
stakeAmount,
|
|
53
55
|
onSuccess,
|
|
54
56
|
}: {
|
|
55
57
|
loadOrder?: string;
|
|
56
58
|
mode?: "modal" | "page";
|
|
59
|
+
sourceTokenAddress?: string;
|
|
60
|
+
sourceTokenChainId?: number;
|
|
57
61
|
recipientAddress: string;
|
|
58
62
|
stakeAmount?: string;
|
|
59
|
-
onSuccess?: () => void;
|
|
63
|
+
onSuccess?: (amount: string) => void;
|
|
60
64
|
}) {
|
|
61
65
|
const hasMounted = useHasMounted();
|
|
62
66
|
const { setB3ModalOpen } = useModalStore();
|
|
@@ -489,7 +493,7 @@ export function AnySpendStakeB3ExactIn({
|
|
|
489
493
|
<Button
|
|
490
494
|
onClick={() => {
|
|
491
495
|
setB3ModalOpen(false);
|
|
492
|
-
onSuccess?.();
|
|
496
|
+
onSuccess?.(formatTokenAmount(BigInt(userStakeAmount), 18) ?? "");
|
|
493
497
|
}}
|
|
494
498
|
className="bg-as-brand hover:bg-as-brand/90 text-as-primary h-14 w-full rounded-xl text-lg font-medium"
|
|
495
499
|
>
|
|
@@ -506,6 +510,8 @@ export function AnySpendStakeB3ExactIn({
|
|
|
506
510
|
loadOrder={loadOrder}
|
|
507
511
|
mode={mode}
|
|
508
512
|
recipientAddress={recipientAddress}
|
|
513
|
+
sourceTokenAddress={sourceTokenAddress}
|
|
514
|
+
sourceTokenChainId={sourceTokenChainId}
|
|
509
515
|
destinationToken={B3_TOKEN}
|
|
510
516
|
destinationChainId={base.id}
|
|
511
517
|
customExactInConfig={customExactInConfig}
|
|
@@ -20,6 +20,8 @@ export function AnySpendStakeUpsideExactIn({
|
|
|
20
20
|
loadOrder,
|
|
21
21
|
mode = "modal",
|
|
22
22
|
recipientAddress,
|
|
23
|
+
sourceTokenAddress,
|
|
24
|
+
sourceTokenChainId,
|
|
23
25
|
stakingContractAddress,
|
|
24
26
|
token,
|
|
25
27
|
onSuccess,
|
|
@@ -27,9 +29,11 @@ export function AnySpendStakeUpsideExactIn({
|
|
|
27
29
|
loadOrder?: string;
|
|
28
30
|
mode?: "modal" | "page";
|
|
29
31
|
recipientAddress: string;
|
|
32
|
+
sourceTokenAddress?: string;
|
|
33
|
+
sourceTokenChainId?: number;
|
|
30
34
|
stakingContractAddress: string;
|
|
31
35
|
token: components["schemas"]["Token"];
|
|
32
|
-
onSuccess?: () => void;
|
|
36
|
+
onSuccess?: (amount: string) => void;
|
|
33
37
|
}) {
|
|
34
38
|
if (!recipientAddress) return null;
|
|
35
39
|
|
|
@@ -57,6 +61,8 @@ export function AnySpendStakeUpsideExactIn({
|
|
|
57
61
|
loadOrder={loadOrder}
|
|
58
62
|
mode={mode}
|
|
59
63
|
recipientAddress={recipientAddress}
|
|
64
|
+
sourceTokenAddress={sourceTokenAddress}
|
|
65
|
+
sourceTokenChainId={sourceTokenChainId}
|
|
60
66
|
destinationToken={token}
|
|
61
67
|
destinationChainId={base.id}
|
|
62
68
|
customExactInConfig={customExactInConfig}
|
|
@@ -43,7 +43,7 @@ interface UseAnyspendFlowProps {
|
|
|
43
43
|
loadOrder?: string;
|
|
44
44
|
isDepositMode?: boolean;
|
|
45
45
|
onOrderSuccess?: (orderId: string) => void;
|
|
46
|
-
onTransactionSuccess?: (amount
|
|
46
|
+
onTransactionSuccess?: (amount: string) => void;
|
|
47
47
|
sourceTokenAddress?: string;
|
|
48
48
|
sourceTokenChainId?: number;
|
|
49
49
|
destinationTokenAddress?: string;
|
|
@@ -285,7 +285,7 @@ export function useAnyspendFlow({
|
|
|
285
285
|
const formattedActualDstAmount = amount
|
|
286
286
|
? formatTokenAmount(BigInt(amount), oat.data.order.metadata.dstToken.decimals)
|
|
287
287
|
: undefined;
|
|
288
|
-
onTransactionSuccess?.(formattedActualDstAmount);
|
|
288
|
+
onTransactionSuccess?.(formattedActualDstAmount ?? "");
|
|
289
289
|
}
|
|
290
290
|
}, [
|
|
291
291
|
oat?.data?.order.status,
|