@b3dotfun/sdk 0.0.65-alpha.4 → 0.0.65-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/AnySpendDepositUpside.d.ts +11 -0
- package/dist/cjs/anyspend/react/components/AnySpendDepositUpside.js +41 -0
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +3 -0
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +21 -1
- package/dist/esm/anyspend/react/components/AnySpendDepositUpside.d.ts +11 -0
- package/dist/esm/anyspend/react/components/AnySpendDepositUpside.js +38 -0
- package/dist/esm/global-account/react/components/B3DynamicModal.js +3 -0
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +21 -1
- package/dist/types/anyspend/react/components/AnySpendDepositUpside.d.ts +11 -0
- package/dist/types/global-account/react/stores/useModalStore.d.ts +21 -1
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpendDepositUpside.tsx +81 -0
- package/src/global-account/react/components/B3DynamicModal.tsx +3 -0
- package/src/global-account/react/stores/useModalStore.ts +22 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { components } from "../../../anyspend/types/api";
|
|
2
|
+
export declare function AnySpendDepositUpside({ loadOrder, mode, recipientAddress, sourceTokenAddress, sourceTokenChainId, depositContractAddress, token, onSuccess, }: {
|
|
3
|
+
loadOrder?: string;
|
|
4
|
+
mode?: "modal" | "page";
|
|
5
|
+
recipientAddress: string;
|
|
6
|
+
sourceTokenAddress?: string;
|
|
7
|
+
sourceTokenChainId?: number;
|
|
8
|
+
depositContractAddress: string;
|
|
9
|
+
token: components["schemas"]["Token"];
|
|
10
|
+
onSuccess?: (amount: string) => void;
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AnySpendDepositUpside = AnySpendDepositUpside;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const utils_1 = require("../../../anyspend/utils");
|
|
6
|
+
const chains_1 = require("viem/chains");
|
|
7
|
+
const AnySpendCustomExactIn_1 = require("./AnySpendCustomExactIn");
|
|
8
|
+
const DEPOSIT_FOR_FUNCTION_ABI = JSON.stringify([
|
|
9
|
+
{
|
|
10
|
+
inputs: [
|
|
11
|
+
{
|
|
12
|
+
internalType: "address",
|
|
13
|
+
name: "user",
|
|
14
|
+
type: "address",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
internalType: "uint256",
|
|
18
|
+
name: "amount",
|
|
19
|
+
type: "uint256",
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
name: "depositFor",
|
|
23
|
+
outputs: [],
|
|
24
|
+
stateMutability: "nonpayable",
|
|
25
|
+
type: "function",
|
|
26
|
+
},
|
|
27
|
+
]);
|
|
28
|
+
function AnySpendDepositUpside({ loadOrder, mode = "modal", recipientAddress, sourceTokenAddress, sourceTokenChainId, depositContractAddress, token, onSuccess, }) {
|
|
29
|
+
if (!recipientAddress)
|
|
30
|
+
return null;
|
|
31
|
+
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 & Deposit ", token.symbol] }) }) }) }));
|
|
32
|
+
const customExactInConfig = {
|
|
33
|
+
functionAbi: DEPOSIT_FOR_FUNCTION_ABI,
|
|
34
|
+
functionName: "depositFor",
|
|
35
|
+
functionArgs: [(0, utils_1.normalizeAddress)(recipientAddress), "{{amount_out}}"],
|
|
36
|
+
to: depositContractAddress,
|
|
37
|
+
spenderAddress: depositContractAddress,
|
|
38
|
+
action: `deposit ${token.symbol}`,
|
|
39
|
+
};
|
|
40
|
+
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 }));
|
|
41
|
+
}
|
|
@@ -20,6 +20,7 @@ const RequestPermissions_1 = require("./RequestPermissions/RequestPermissions");
|
|
|
20
20
|
const SignInWithB3Flow_1 = require("./SignInWithB3/SignInWithB3Flow");
|
|
21
21
|
const dialog_1 = require("./ui/dialog");
|
|
22
22
|
const drawer_1 = require("./ui/drawer");
|
|
23
|
+
const AnySpendDepositUpside_1 = require("../../../anyspend/react/components/AnySpendDepositUpside");
|
|
23
24
|
const debug = (0, debug_1.debugB3React)("B3DynamicModal");
|
|
24
25
|
function B3DynamicModal() {
|
|
25
26
|
const { isOpen, setB3ModalOpen, contentType, history, navigateBack } = (0, react_2.useModalStore)();
|
|
@@ -105,6 +106,8 @@ function B3DynamicModal() {
|
|
|
105
106
|
return (0, jsx_runtime_1.jsx)(AnySpendStakeUpside_1.AnySpendStakeUpside, { ...contentType, mode: "modal" });
|
|
106
107
|
case "anySpendStakeUpsideExactIn":
|
|
107
108
|
return (0, jsx_runtime_1.jsx)(AnySpendStakeUpsideExactIn_1.AnySpendStakeUpsideExactIn, { ...contentType, mode: "modal" });
|
|
109
|
+
case "anySpendDepositUpside":
|
|
110
|
+
return (0, jsx_runtime_1.jsx)(AnySpendDepositUpside_1.AnySpendDepositUpside, { ...contentType, mode: "modal" });
|
|
108
111
|
case "anySpendBuySpin":
|
|
109
112
|
return (0, jsx_runtime_1.jsx)(react_1.AnySpendBuySpin, { ...contentType, mode: "modal" });
|
|
110
113
|
case "anySpendSignatureMint":
|
|
@@ -260,6 +260,26 @@ export interface AnySpendStakeUpsideExactInProps extends BaseModalProps {
|
|
|
260
260
|
/** Callback function called when the stake is successful */
|
|
261
261
|
onSuccess?: () => void;
|
|
262
262
|
}
|
|
263
|
+
/**
|
|
264
|
+
* Props for the AnySpend Deposit Upside (Exact In) modal
|
|
265
|
+
* Handles token deposit operations using the custom exact in flow
|
|
266
|
+
*/
|
|
267
|
+
export interface AnySpendDepositUpsideProps extends BaseModalProps {
|
|
268
|
+
/** Modal type identifier */
|
|
269
|
+
type: "anySpendDepositUpside";
|
|
270
|
+
/** Source token address */
|
|
271
|
+
sourceTokenAddress?: string;
|
|
272
|
+
/** Source token address */
|
|
273
|
+
sourceTokenChainId?: number;
|
|
274
|
+
/** Recipient address to deposit tokens for */
|
|
275
|
+
recipientAddress: string;
|
|
276
|
+
/** Deposit contract address */
|
|
277
|
+
depositContractAddress: string;
|
|
278
|
+
/** Token to deposit */
|
|
279
|
+
token: components["schemas"]["Token"];
|
|
280
|
+
/** Callback function called when the deposit is successful */
|
|
281
|
+
onSuccess?: () => void;
|
|
282
|
+
}
|
|
263
283
|
/**
|
|
264
284
|
* Props for the AnySpend Buy Spin modal
|
|
265
285
|
* Handles spin wheel entry purchases
|
|
@@ -360,7 +380,7 @@ export interface ProfileEditorModalProps extends BaseModalProps {
|
|
|
360
380
|
/**
|
|
361
381
|
* Union type of all possible modal content types
|
|
362
382
|
*/
|
|
363
|
-
export type ModalContentType = SignInWithB3ModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps | AnySpendOrderHistoryProps | AnySpendStakeB3Props | AnySpendStakeB3ExactInProps | AnySpendStakeUpsideProps | AnySpendStakeUpsideExactInProps | AnySpendBuySpinProps | AnySpendSignatureMintProps | AnySpendBondKitProps | LinkAccountModalProps | AnySpendDepositHypeProps | AvatarEditorModalProps | ProfileEditorModalProps;
|
|
383
|
+
export type ModalContentType = SignInWithB3ModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps | AnySpendOrderHistoryProps | AnySpendStakeB3Props | AnySpendStakeB3ExactInProps | AnySpendStakeUpsideProps | AnySpendStakeUpsideExactInProps | AnySpendDepositUpsideProps | AnySpendBuySpinProps | AnySpendSignatureMintProps | AnySpendBondKitProps | LinkAccountModalProps | AnySpendDepositHypeProps | AvatarEditorModalProps | ProfileEditorModalProps;
|
|
364
384
|
/**
|
|
365
385
|
* State interface for the modal store
|
|
366
386
|
*/
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { components } from "../../../anyspend/types/api";
|
|
2
|
+
export declare function AnySpendDepositUpside({ loadOrder, mode, recipientAddress, sourceTokenAddress, sourceTokenChainId, depositContractAddress, token, onSuccess, }: {
|
|
3
|
+
loadOrder?: string;
|
|
4
|
+
mode?: "modal" | "page";
|
|
5
|
+
recipientAddress: string;
|
|
6
|
+
sourceTokenAddress?: string;
|
|
7
|
+
sourceTokenChainId?: number;
|
|
8
|
+
depositContractAddress: string;
|
|
9
|
+
token: components["schemas"]["Token"];
|
|
10
|
+
onSuccess?: (amount: string) => void;
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { normalizeAddress } from "../../../anyspend/utils/index.js";
|
|
3
|
+
import { base } from "viem/chains";
|
|
4
|
+
import { AnySpendCustomExactIn } from "./AnySpendCustomExactIn.js";
|
|
5
|
+
const DEPOSIT_FOR_FUNCTION_ABI = JSON.stringify([
|
|
6
|
+
{
|
|
7
|
+
inputs: [
|
|
8
|
+
{
|
|
9
|
+
internalType: "address",
|
|
10
|
+
name: "user",
|
|
11
|
+
type: "address",
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
internalType: "uint256",
|
|
15
|
+
name: "amount",
|
|
16
|
+
type: "uint256",
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
name: "depositFor",
|
|
20
|
+
outputs: [],
|
|
21
|
+
stateMutability: "nonpayable",
|
|
22
|
+
type: "function",
|
|
23
|
+
},
|
|
24
|
+
]);
|
|
25
|
+
export function AnySpendDepositUpside({ loadOrder, mode = "modal", recipientAddress, sourceTokenAddress, sourceTokenChainId, depositContractAddress, token, onSuccess, }) {
|
|
26
|
+
if (!recipientAddress)
|
|
27
|
+
return null;
|
|
28
|
+
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 & Deposit ", token.symbol] }) }) }) }));
|
|
29
|
+
const customExactInConfig = {
|
|
30
|
+
functionAbi: DEPOSIT_FOR_FUNCTION_ABI,
|
|
31
|
+
functionName: "depositFor",
|
|
32
|
+
functionArgs: [normalizeAddress(recipientAddress), "{{amount_out}}"],
|
|
33
|
+
to: depositContractAddress,
|
|
34
|
+
spenderAddress: depositContractAddress,
|
|
35
|
+
action: `deposit ${token.symbol}`,
|
|
36
|
+
};
|
|
37
|
+
return (_jsx(AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, sourceTokenAddress: sourceTokenAddress, sourceTokenChainId: sourceTokenChainId, destinationToken: token, destinationChainId: base.id, customExactInConfig: customExactInConfig, header: header, onSuccess: onSuccess }));
|
|
38
|
+
}
|
|
@@ -17,6 +17,7 @@ import { RequestPermissions } from "./RequestPermissions/RequestPermissions.js";
|
|
|
17
17
|
import { SignInWithB3Flow } from "./SignInWithB3/SignInWithB3Flow.js";
|
|
18
18
|
import { Dialog, DialogContent, DialogDescription, DialogTitle } from "./ui/dialog.js";
|
|
19
19
|
import { Drawer, DrawerContent, DrawerDescription, DrawerTitle } from "./ui/drawer.js";
|
|
20
|
+
import { AnySpendDepositUpside } from "../../../anyspend/react/components/AnySpendDepositUpside.js";
|
|
20
21
|
const debug = debugB3React("B3DynamicModal");
|
|
21
22
|
export function B3DynamicModal() {
|
|
22
23
|
const { isOpen, setB3ModalOpen, contentType, history, navigateBack } = useModalStore();
|
|
@@ -102,6 +103,8 @@ export function B3DynamicModal() {
|
|
|
102
103
|
return _jsx(AnySpendStakeUpside, { ...contentType, mode: "modal" });
|
|
103
104
|
case "anySpendStakeUpsideExactIn":
|
|
104
105
|
return _jsx(AnySpendStakeUpsideExactIn, { ...contentType, mode: "modal" });
|
|
106
|
+
case "anySpendDepositUpside":
|
|
107
|
+
return _jsx(AnySpendDepositUpside, { ...contentType, mode: "modal" });
|
|
105
108
|
case "anySpendBuySpin":
|
|
106
109
|
return _jsx(AnySpendBuySpin, { ...contentType, mode: "modal" });
|
|
107
110
|
case "anySpendSignatureMint":
|
|
@@ -260,6 +260,26 @@ export interface AnySpendStakeUpsideExactInProps extends BaseModalProps {
|
|
|
260
260
|
/** Callback function called when the stake is successful */
|
|
261
261
|
onSuccess?: () => void;
|
|
262
262
|
}
|
|
263
|
+
/**
|
|
264
|
+
* Props for the AnySpend Deposit Upside (Exact In) modal
|
|
265
|
+
* Handles token deposit operations using the custom exact in flow
|
|
266
|
+
*/
|
|
267
|
+
export interface AnySpendDepositUpsideProps extends BaseModalProps {
|
|
268
|
+
/** Modal type identifier */
|
|
269
|
+
type: "anySpendDepositUpside";
|
|
270
|
+
/** Source token address */
|
|
271
|
+
sourceTokenAddress?: string;
|
|
272
|
+
/** Source token address */
|
|
273
|
+
sourceTokenChainId?: number;
|
|
274
|
+
/** Recipient address to deposit tokens for */
|
|
275
|
+
recipientAddress: string;
|
|
276
|
+
/** Deposit contract address */
|
|
277
|
+
depositContractAddress: string;
|
|
278
|
+
/** Token to deposit */
|
|
279
|
+
token: components["schemas"]["Token"];
|
|
280
|
+
/** Callback function called when the deposit is successful */
|
|
281
|
+
onSuccess?: () => void;
|
|
282
|
+
}
|
|
263
283
|
/**
|
|
264
284
|
* Props for the AnySpend Buy Spin modal
|
|
265
285
|
* Handles spin wheel entry purchases
|
|
@@ -360,7 +380,7 @@ export interface ProfileEditorModalProps extends BaseModalProps {
|
|
|
360
380
|
/**
|
|
361
381
|
* Union type of all possible modal content types
|
|
362
382
|
*/
|
|
363
|
-
export type ModalContentType = SignInWithB3ModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps | AnySpendOrderHistoryProps | AnySpendStakeB3Props | AnySpendStakeB3ExactInProps | AnySpendStakeUpsideProps | AnySpendStakeUpsideExactInProps | AnySpendBuySpinProps | AnySpendSignatureMintProps | AnySpendBondKitProps | LinkAccountModalProps | AnySpendDepositHypeProps | AvatarEditorModalProps | ProfileEditorModalProps;
|
|
383
|
+
export type ModalContentType = SignInWithB3ModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps | AnySpendOrderHistoryProps | AnySpendStakeB3Props | AnySpendStakeB3ExactInProps | AnySpendStakeUpsideProps | AnySpendStakeUpsideExactInProps | AnySpendDepositUpsideProps | AnySpendBuySpinProps | AnySpendSignatureMintProps | AnySpendBondKitProps | LinkAccountModalProps | AnySpendDepositHypeProps | AvatarEditorModalProps | ProfileEditorModalProps;
|
|
364
384
|
/**
|
|
365
385
|
* State interface for the modal store
|
|
366
386
|
*/
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
2
|
+
export declare function AnySpendDepositUpside({ loadOrder, mode, recipientAddress, sourceTokenAddress, sourceTokenChainId, depositContractAddress, token, onSuccess, }: {
|
|
3
|
+
loadOrder?: string;
|
|
4
|
+
mode?: "modal" | "page";
|
|
5
|
+
recipientAddress: string;
|
|
6
|
+
sourceTokenAddress?: string;
|
|
7
|
+
sourceTokenChainId?: number;
|
|
8
|
+
depositContractAddress: string;
|
|
9
|
+
token: components["schemas"]["Token"];
|
|
10
|
+
onSuccess?: (amount: string) => void;
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -260,6 +260,26 @@ export interface AnySpendStakeUpsideExactInProps extends BaseModalProps {
|
|
|
260
260
|
/** Callback function called when the stake is successful */
|
|
261
261
|
onSuccess?: () => void;
|
|
262
262
|
}
|
|
263
|
+
/**
|
|
264
|
+
* Props for the AnySpend Deposit Upside (Exact In) modal
|
|
265
|
+
* Handles token deposit operations using the custom exact in flow
|
|
266
|
+
*/
|
|
267
|
+
export interface AnySpendDepositUpsideProps extends BaseModalProps {
|
|
268
|
+
/** Modal type identifier */
|
|
269
|
+
type: "anySpendDepositUpside";
|
|
270
|
+
/** Source token address */
|
|
271
|
+
sourceTokenAddress?: string;
|
|
272
|
+
/** Source token address */
|
|
273
|
+
sourceTokenChainId?: number;
|
|
274
|
+
/** Recipient address to deposit tokens for */
|
|
275
|
+
recipientAddress: string;
|
|
276
|
+
/** Deposit contract address */
|
|
277
|
+
depositContractAddress: string;
|
|
278
|
+
/** Token to deposit */
|
|
279
|
+
token: components["schemas"]["Token"];
|
|
280
|
+
/** Callback function called when the deposit is successful */
|
|
281
|
+
onSuccess?: () => void;
|
|
282
|
+
}
|
|
263
283
|
/**
|
|
264
284
|
* Props for the AnySpend Buy Spin modal
|
|
265
285
|
* Handles spin wheel entry purchases
|
|
@@ -360,7 +380,7 @@ export interface ProfileEditorModalProps extends BaseModalProps {
|
|
|
360
380
|
/**
|
|
361
381
|
* Union type of all possible modal content types
|
|
362
382
|
*/
|
|
363
|
-
export type ModalContentType = SignInWithB3ModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps | AnySpendOrderHistoryProps | AnySpendStakeB3Props | AnySpendStakeB3ExactInProps | AnySpendStakeUpsideProps | AnySpendStakeUpsideExactInProps | AnySpendBuySpinProps | AnySpendSignatureMintProps | AnySpendBondKitProps | LinkAccountModalProps | AnySpendDepositHypeProps | AvatarEditorModalProps | ProfileEditorModalProps;
|
|
383
|
+
export type ModalContentType = SignInWithB3ModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps | AnySpendOrderHistoryProps | AnySpendStakeB3Props | AnySpendStakeB3ExactInProps | AnySpendStakeUpsideProps | AnySpendStakeUpsideExactInProps | AnySpendDepositUpsideProps | AnySpendBuySpinProps | AnySpendSignatureMintProps | AnySpendBondKitProps | LinkAccountModalProps | AnySpendDepositHypeProps | AvatarEditorModalProps | ProfileEditorModalProps;
|
|
364
384
|
/**
|
|
365
385
|
* State interface for the modal store
|
|
366
386
|
*/
|
package/package.json
CHANGED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
2
|
+
import { normalizeAddress } from "@b3dotfun/sdk/anyspend/utils";
|
|
3
|
+
import { base } from "viem/chains";
|
|
4
|
+
import { AnySpendCustomExactIn } from "./AnySpendCustomExactIn";
|
|
5
|
+
|
|
6
|
+
const DEPOSIT_FOR_FUNCTION_ABI = JSON.stringify([
|
|
7
|
+
{
|
|
8
|
+
inputs: [
|
|
9
|
+
{
|
|
10
|
+
internalType: "address",
|
|
11
|
+
name: "user",
|
|
12
|
+
type: "address",
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
internalType: "uint256",
|
|
16
|
+
name: "amount",
|
|
17
|
+
type: "uint256",
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
name: "depositFor",
|
|
21
|
+
outputs: [],
|
|
22
|
+
stateMutability: "nonpayable",
|
|
23
|
+
type: "function",
|
|
24
|
+
},
|
|
25
|
+
]);
|
|
26
|
+
|
|
27
|
+
export function AnySpendDepositUpside({
|
|
28
|
+
loadOrder,
|
|
29
|
+
mode = "modal",
|
|
30
|
+
recipientAddress,
|
|
31
|
+
sourceTokenAddress,
|
|
32
|
+
sourceTokenChainId,
|
|
33
|
+
depositContractAddress,
|
|
34
|
+
token,
|
|
35
|
+
onSuccess,
|
|
36
|
+
}: {
|
|
37
|
+
loadOrder?: string;
|
|
38
|
+
mode?: "modal" | "page";
|
|
39
|
+
recipientAddress: string;
|
|
40
|
+
sourceTokenAddress?: string;
|
|
41
|
+
sourceTokenChainId?: number;
|
|
42
|
+
depositContractAddress: string;
|
|
43
|
+
token: components["schemas"]["Token"];
|
|
44
|
+
onSuccess?: (amount: string) => void;
|
|
45
|
+
}) {
|
|
46
|
+
if (!recipientAddress) return null;
|
|
47
|
+
|
|
48
|
+
const header = () => (
|
|
49
|
+
<>
|
|
50
|
+
<div className="from-b3-react-background to-as-on-surface-1 w-full rounded-t-lg bg-gradient-to-t">
|
|
51
|
+
<div className="mb-1 flex w-full flex-col items-center gap-2">
|
|
52
|
+
<span className="font-sf-rounded text-2xl font-semibold">Swap & Deposit {token.symbol}</span>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
</>
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
const customExactInConfig = {
|
|
59
|
+
functionAbi: DEPOSIT_FOR_FUNCTION_ABI,
|
|
60
|
+
functionName: "depositFor",
|
|
61
|
+
functionArgs: [normalizeAddress(recipientAddress), "{{amount_out}}"],
|
|
62
|
+
to: depositContractAddress,
|
|
63
|
+
spenderAddress: depositContractAddress,
|
|
64
|
+
action: `deposit ${token.symbol}`,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<AnySpendCustomExactIn
|
|
69
|
+
loadOrder={loadOrder}
|
|
70
|
+
mode={mode}
|
|
71
|
+
recipientAddress={recipientAddress}
|
|
72
|
+
sourceTokenAddress={sourceTokenAddress}
|
|
73
|
+
sourceTokenChainId={sourceTokenChainId}
|
|
74
|
+
destinationToken={token}
|
|
75
|
+
destinationChainId={base.id}
|
|
76
|
+
customExactInConfig={customExactInConfig}
|
|
77
|
+
header={header}
|
|
78
|
+
onSuccess={onSuccess}
|
|
79
|
+
/>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
@@ -26,6 +26,7 @@ import { RequestPermissions } from "./RequestPermissions/RequestPermissions";
|
|
|
26
26
|
import { SignInWithB3Flow } from "./SignInWithB3/SignInWithB3Flow";
|
|
27
27
|
import { Dialog, DialogContent, DialogDescription, DialogTitle } from "./ui/dialog";
|
|
28
28
|
import { Drawer, DrawerContent, DrawerDescription, DrawerTitle } from "./ui/drawer";
|
|
29
|
+
import { AnySpendDepositUpside } from "@b3dotfun/sdk/anyspend/react/components/AnySpendDepositUpside";
|
|
29
30
|
|
|
30
31
|
const debug = debugB3React("B3DynamicModal");
|
|
31
32
|
|
|
@@ -130,6 +131,8 @@ export function B3DynamicModal() {
|
|
|
130
131
|
return <AnySpendStakeUpside {...contentType} mode="modal" />;
|
|
131
132
|
case "anySpendStakeUpsideExactIn":
|
|
132
133
|
return <AnySpendStakeUpsideExactIn {...contentType} mode="modal" />;
|
|
134
|
+
case "anySpendDepositUpside":
|
|
135
|
+
return <AnySpendDepositUpside {...contentType} mode="modal" />;
|
|
133
136
|
case "anySpendBuySpin":
|
|
134
137
|
return <AnySpendBuySpin {...contentType} mode="modal" />;
|
|
135
138
|
case "anySpendSignatureMint":
|
|
@@ -276,6 +276,27 @@ export interface AnySpendStakeUpsideExactInProps extends BaseModalProps {
|
|
|
276
276
|
onSuccess?: () => void;
|
|
277
277
|
}
|
|
278
278
|
|
|
279
|
+
/**
|
|
280
|
+
* Props for the AnySpend Deposit Upside (Exact In) modal
|
|
281
|
+
* Handles token deposit operations using the custom exact in flow
|
|
282
|
+
*/
|
|
283
|
+
export interface AnySpendDepositUpsideProps extends BaseModalProps {
|
|
284
|
+
/** Modal type identifier */
|
|
285
|
+
type: "anySpendDepositUpside";
|
|
286
|
+
/** Source token address */
|
|
287
|
+
sourceTokenAddress?: string;
|
|
288
|
+
/** Source token address */
|
|
289
|
+
sourceTokenChainId?: number;
|
|
290
|
+
/** Recipient address to deposit tokens for */
|
|
291
|
+
recipientAddress: string;
|
|
292
|
+
/** Deposit contract address */
|
|
293
|
+
depositContractAddress: string;
|
|
294
|
+
/** Token to deposit */
|
|
295
|
+
token: components["schemas"]["Token"];
|
|
296
|
+
/** Callback function called when the deposit is successful */
|
|
297
|
+
onSuccess?: () => void;
|
|
298
|
+
}
|
|
299
|
+
|
|
279
300
|
/**
|
|
280
301
|
* Props for the AnySpend Buy Spin modal
|
|
281
302
|
* Handles spin wheel entry purchases
|
|
@@ -397,6 +418,7 @@ export type ModalContentType =
|
|
|
397
418
|
| AnySpendStakeB3ExactInProps
|
|
398
419
|
| AnySpendStakeUpsideProps
|
|
399
420
|
| AnySpendStakeUpsideExactInProps
|
|
421
|
+
| AnySpendDepositUpsideProps
|
|
400
422
|
| AnySpendBuySpinProps
|
|
401
423
|
| AnySpendSignatureMintProps
|
|
402
424
|
| AnySpendBondKitProps
|