@b3dotfun/sdk 0.0.51 → 0.0.52-alpha.1
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/abis/upsideStaking.d.ts +2058 -0
- package/dist/cjs/anyspend/abis/upsideStaking.js +1139 -0
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpside.d.ts +11 -0
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpside.js +44 -0
- package/dist/cjs/anyspend/types/chain.d.ts +1 -0
- package/dist/cjs/anyspend/utils/chain.js +56 -47
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +5 -0
- package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.js +5 -3
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +21 -1
- package/dist/cjs/shared/utils/simplehash.d.ts +1 -1
- package/dist/esm/anyspend/abis/upsideStaking.d.ts +2058 -0
- package/dist/esm/anyspend/abis/upsideStaking.js +1136 -0
- package/dist/esm/anyspend/react/components/AnySpendStakeUpside.d.ts +11 -0
- package/dist/esm/anyspend/react/components/AnySpendStakeUpside.js +38 -0
- package/dist/esm/anyspend/types/chain.d.ts +1 -0
- package/dist/esm/anyspend/utils/chain.js +57 -48
- package/dist/esm/global-account/react/components/B3DynamicModal.js +5 -0
- package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.js +6 -4
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +21 -1
- package/dist/esm/shared/utils/simplehash.d.ts +1 -1
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/abis/upsideStaking.d.ts +2058 -0
- package/dist/types/anyspend/react/components/AnySpendStakeUpside.d.ts +11 -0
- package/dist/types/anyspend/types/chain.d.ts +1 -0
- package/dist/types/global-account/react/stores/useModalStore.d.ts +21 -1
- package/dist/types/shared/utils/simplehash.d.ts +1 -1
- package/package.json +1 -1
- package/src/anyspend/abis/upsideStaking.ts +1137 -0
- package/src/anyspend/react/components/AnySpendStakeUpside.tsx +96 -0
- package/src/anyspend/types/chain.ts +1 -0
- package/src/anyspend/utils/chain.ts +49 -53
- package/src/global-account/react/components/B3DynamicModal.tsx +5 -0
- package/src/global-account/react/components/ManageAccount/BalanceContent.tsx +7 -4
- 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 AnySpendStakeUpside({ loadOrder, mode, beneficiaryAddress, stakeAmount, stakingContractAddress, token, poolType, onSuccess, }: {
|
|
3
|
+
loadOrder?: string;
|
|
4
|
+
mode?: "modal" | "page";
|
|
5
|
+
beneficiaryAddress: string;
|
|
6
|
+
stakeAmount: string;
|
|
7
|
+
stakingContractAddress: string;
|
|
8
|
+
token: components["schemas"]["Token"];
|
|
9
|
+
poolType: "b3" | "weth";
|
|
10
|
+
onSuccess?: () => void;
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AnySpendStakeUpside = AnySpendStakeUpside;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = require("../../../global-account/react");
|
|
9
|
+
const number_1 = require("../../../shared/utils/number");
|
|
10
|
+
const invariant_1 = __importDefault(require("invariant"));
|
|
11
|
+
const viem_1 = require("viem");
|
|
12
|
+
const chains_1 = require("viem/chains");
|
|
13
|
+
const upsideStaking_1 = require("../../abis/upsideStaking");
|
|
14
|
+
const AnySpendCustom_1 = require("./AnySpendCustom");
|
|
15
|
+
function generateEncodedDataForStaking(amount, beneficiary, poolType) {
|
|
16
|
+
(0, invariant_1.default)(BigInt(amount) > 0, "Amount must be greater than zero");
|
|
17
|
+
if (poolType === "weth") {
|
|
18
|
+
return (0, viem_1.encodeFunctionData)({
|
|
19
|
+
abi: upsideStaking_1.WETH_STAKING_CONTRACT,
|
|
20
|
+
functionName: "stakeFor",
|
|
21
|
+
args: [beneficiary, BigInt(amount)],
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
else if (poolType === "b3") {
|
|
25
|
+
return (0, viem_1.encodeFunctionData)({
|
|
26
|
+
abi: upsideStaking_1.B3_STAKING_CONTRACT,
|
|
27
|
+
functionName: "stakeFor",
|
|
28
|
+
args: [beneficiary, BigInt(amount)],
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
throw new Error("Unsupported pool type");
|
|
32
|
+
}
|
|
33
|
+
function AnySpendStakeUpside({ loadOrder, mode = "modal", beneficiaryAddress, stakeAmount, stakingContractAddress, token, poolType, onSuccess, }) {
|
|
34
|
+
const header = () => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "relative mx-auto size-32", children: (0, jsx_runtime_1.jsx)("img", { alt: "token", className: "size-full", src: token.metadata.logoURI || "https://cdn.b3.fun/b3-coin-3d.png" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "from-b3-react-background to-as-on-surface-1 mt-[-60px] w-full rounded-t-lg bg-gradient-to-t", children: [(0, jsx_runtime_1.jsx)("div", { className: "h-[60px] w-full" }), (0, jsx_runtime_1.jsx)("div", { className: "mb-1 flex w-full flex-col items-center gap-2 p-5", children: (0, jsx_runtime_1.jsxs)("span", { className: "font-sf-rounded text-2xl font-semibold", children: ["Swap & Stake ", stakeAmount ? (0, number_1.formatTokenAmount)(BigInt(stakeAmount), token.decimals) : "", " ", token.symbol] }) })] })] }));
|
|
35
|
+
// Only generate encoded data if we have a valid beneficiary address
|
|
36
|
+
// This is used for the AnySpendCustom swap & stake flow
|
|
37
|
+
if (!beneficiaryAddress || beneficiaryAddress === "") {
|
|
38
|
+
return ((0, jsx_runtime_1.jsx)(react_1.StyleRoot, { children: (0, jsx_runtime_1.jsx)("div", { className: "bg-b3-react-background flex w-full flex-col items-center justify-center p-8", children: (0, jsx_runtime_1.jsx)("p", { className: "font-medium text-yellow-600 dark:text-yellow-400", children: "\u26A0\uFE0F Please connect your wallet to continue." }) }) }));
|
|
39
|
+
}
|
|
40
|
+
const encodedData = generateEncodedDataForStaking(stakeAmount, beneficiaryAddress, poolType);
|
|
41
|
+
return ((0, jsx_runtime_1.jsx)(AnySpendCustom_1.AnySpendCustom, { loadOrder: loadOrder, mode: mode, recipientAddress: beneficiaryAddress, orderType: "custom", dstChainId: chains_1.base.id, dstToken: token, dstAmount: stakeAmount, contractAddress: stakingContractAddress, encodedData: encodedData, metadata: {
|
|
42
|
+
action: `stake ${token.symbol}`,
|
|
43
|
+
}, header: header, onSuccess: onSuccess, showRecipient: true }));
|
|
44
|
+
}
|
|
@@ -52,6 +52,7 @@ exports.EVM_MAINNET = {
|
|
|
52
52
|
pollingInterval: 4000, // 4 seconds for Ethereum mainnet
|
|
53
53
|
zapperEnum: "ETHEREUM_MAINNET",
|
|
54
54
|
coingeckoName: "eth",
|
|
55
|
+
wethAddress: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
|
|
55
56
|
},
|
|
56
57
|
[chains_1.arbitrum.id]: {
|
|
57
58
|
id: chains_1.arbitrum.id,
|
|
@@ -66,6 +67,7 @@ exports.EVM_MAINNET = {
|
|
|
66
67
|
pollingInterval: 500, // 500ms for Arbitrum's fast blocks
|
|
67
68
|
zapperEnum: "ARBITRUM_MAINNET",
|
|
68
69
|
coingeckoName: "arbitrum",
|
|
70
|
+
wethAddress: "0x82af49447d8a07e3bd95bd0d56f35241523fbab1",
|
|
69
71
|
},
|
|
70
72
|
[chains_1.base.id]: {
|
|
71
73
|
id: chains_1.base.id,
|
|
@@ -80,6 +82,7 @@ exports.EVM_MAINNET = {
|
|
|
80
82
|
pollingInterval: 1000, // 1 second for Base
|
|
81
83
|
zapperEnum: "BASE_MAINNET",
|
|
82
84
|
coingeckoName: "base",
|
|
85
|
+
wethAddress: "0x4200000000000000000000000000000000000006",
|
|
83
86
|
},
|
|
84
87
|
[chains_1.optimism.id]: {
|
|
85
88
|
id: chains_1.optimism.id,
|
|
@@ -94,6 +97,7 @@ exports.EVM_MAINNET = {
|
|
|
94
97
|
pollingInterval: 1000, // 1 second for Optimism
|
|
95
98
|
zapperEnum: "OPTIMISM_MAINNET",
|
|
96
99
|
coingeckoName: "optimism",
|
|
100
|
+
wethAddress: "0x4200000000000000000000000000000000000006",
|
|
97
101
|
},
|
|
98
102
|
[chains_1.polygon.id]: {
|
|
99
103
|
id: chains_1.polygon.id,
|
|
@@ -108,6 +112,7 @@ exports.EVM_MAINNET = {
|
|
|
108
112
|
pollingInterval: 1000, // 1 second for Polygon
|
|
109
113
|
zapperEnum: "POLYGON_MAINNET",
|
|
110
114
|
coingeckoName: "polygon_pos",
|
|
115
|
+
wethAddress: "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270",
|
|
111
116
|
},
|
|
112
117
|
[chains_1.avalanche.id]: {
|
|
113
118
|
id: chains_1.avalanche.id,
|
|
@@ -122,6 +127,7 @@ exports.EVM_MAINNET = {
|
|
|
122
127
|
pollingInterval: 1000, // 1 second for Avalanche
|
|
123
128
|
zapperEnum: "AVALANCHE_MAINNET",
|
|
124
129
|
coingeckoName: "avax",
|
|
130
|
+
wethAddress: "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7",
|
|
125
131
|
},
|
|
126
132
|
[chains_1.bsc.id]: {
|
|
127
133
|
id: chains_1.bsc.id,
|
|
@@ -136,6 +142,7 @@ exports.EVM_MAINNET = {
|
|
|
136
142
|
pollingInterval: 1000, // 1 second for BSC
|
|
137
143
|
zapperEnum: "BSC_MAINNET",
|
|
138
144
|
coingeckoName: "bsc",
|
|
145
|
+
wethAddress: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",
|
|
139
146
|
},
|
|
140
147
|
[chains_1.b3.id]: {
|
|
141
148
|
id: chains_1.b3.id,
|
|
@@ -150,6 +157,7 @@ exports.EVM_MAINNET = {
|
|
|
150
157
|
pollingInterval: 1000, // 1 second for B3
|
|
151
158
|
zapperEnum: "B3_MAINNET",
|
|
152
159
|
coingeckoName: "b3",
|
|
160
|
+
wethAddress: "0x4200000000000000000000000000000000000006",
|
|
153
161
|
},
|
|
154
162
|
[chains_1.abstract.id]: {
|
|
155
163
|
id: chains_1.abstract.id,
|
|
@@ -164,56 +172,57 @@ exports.EVM_MAINNET = {
|
|
|
164
172
|
pollingInterval: 3000, // 3 seconds for Abstract
|
|
165
173
|
zapperEnum: "ABSTRACT_MAINNET",
|
|
166
174
|
coingeckoName: "abstract",
|
|
175
|
+
wethAddress: "0x3439153eb7af838ad19d56e1571fbd09333c2809",
|
|
167
176
|
},
|
|
168
177
|
};
|
|
169
178
|
exports.EVM_TESTNET = {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
179
|
+
// [sepolia.id]: {
|
|
180
|
+
// id: sepolia.id,
|
|
181
|
+
// name: sepolia.name,
|
|
182
|
+
// logoUrl: "https://assets.relay.link/icons/square/1/light.png",
|
|
183
|
+
// type: ChainType.EVM,
|
|
184
|
+
// nativeRequired: parseEther("0.00001"),
|
|
185
|
+
// canDepositNative: true,
|
|
186
|
+
// defaultToken: getEthToken(sepolia.id),
|
|
187
|
+
// nativeToken: getEthToken(sepolia.id),
|
|
188
|
+
// viem: sepolia,
|
|
189
|
+
// pollingInterval: 1000, // 1 second for Sepolia
|
|
190
|
+
// coingeckoName: "sepolia-testnet",
|
|
191
|
+
// },
|
|
192
|
+
// [baseSepolia.id]: {
|
|
193
|
+
// id: baseSepolia.id,
|
|
194
|
+
// name: baseSepolia.name,
|
|
195
|
+
// logoUrl: "https://assets.relay.link/icons/square/8453/light.png",
|
|
196
|
+
// type: ChainType.EVM,
|
|
197
|
+
// nativeRequired: parseEther("0.00001"),
|
|
198
|
+
// canDepositNative: true,
|
|
199
|
+
// defaultToken: getEthToken(baseSepolia.id),
|
|
200
|
+
// nativeToken: getEthToken(baseSepolia.id),
|
|
201
|
+
// viem: baseSepolia,
|
|
202
|
+
// pollingInterval: 1000, // 1 second for Base Sepolia
|
|
203
|
+
// coingeckoName: null,
|
|
204
|
+
// },
|
|
205
|
+
// [b3Sepolia.id]: {
|
|
206
|
+
// id: b3Sepolia.id,
|
|
207
|
+
// name: b3Sepolia.name,
|
|
208
|
+
// logoUrl: "https://assets.relay.link/icons/square/8333/light.png",
|
|
209
|
+
// type: ChainType.EVM,
|
|
210
|
+
// nativeRequired: parseEther("0.00001"),
|
|
211
|
+
// canDepositNative: true,
|
|
212
|
+
// defaultToken: getEthToken(b3Sepolia.id),
|
|
213
|
+
// nativeToken: getEthToken(b3Sepolia.id),
|
|
214
|
+
// viem: b3Sepolia,
|
|
215
|
+
// pollingInterval: 1000, // 1 second for B3 Sepolia
|
|
216
|
+
// coingeckoName: null,
|
|
217
|
+
// },
|
|
218
|
+
// [b4testnet.id]: {
|
|
219
|
+
// id: b4testnet.id,
|
|
220
|
+
// logoUrl: "https://cdn.b3.fun/b4-logo.png",
|
|
221
|
+
// type: ChainType.EVM,
|
|
222
|
+
// viem: b4testnet,
|
|
223
|
+
// requireNativeBalance: parseEther("0.00001"),
|
|
224
|
+
// supportDepositNative: true,
|
|
225
|
+
// },
|
|
217
226
|
};
|
|
218
227
|
exports.SOLANA_MAINNET = {
|
|
219
228
|
id: constants_1.RELAY_SOLANA_MAINNET_CHAIN_ID,
|
|
@@ -4,6 +4,7 @@ exports.B3DynamicModal = B3DynamicModal;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("../../../anyspend/react");
|
|
6
6
|
const AnyspendDepositHype_1 = require("../../../anyspend/react/components/AnyspendDepositHype");
|
|
7
|
+
const AnySpendStakeUpside_1 = require("../../../anyspend/react/components/AnySpendStakeUpside");
|
|
7
8
|
const react_2 = require("../../../global-account/react");
|
|
8
9
|
const cn_1 = require("../../../shared/utils/cn");
|
|
9
10
|
const debug_1 = require("../../../shared/utils/debug");
|
|
@@ -27,6 +28,7 @@ function B3DynamicModal() {
|
|
|
27
28
|
"anySpendJoinTournament",
|
|
28
29
|
"anySpendFundTournament",
|
|
29
30
|
"anySpendStakeB3",
|
|
31
|
+
"anySpendStakeUpside",
|
|
30
32
|
"anySpendBuySpin",
|
|
31
33
|
"anySpendOrderHistory",
|
|
32
34
|
"signInWithB3",
|
|
@@ -40,6 +42,7 @@ function B3DynamicModal() {
|
|
|
40
42
|
"anySpendJoinTournament",
|
|
41
43
|
"anySpendFundTournament",
|
|
42
44
|
"anySpendStakeB3",
|
|
45
|
+
"anySpendStakeUpside",
|
|
43
46
|
"anySpendBuySpin",
|
|
44
47
|
"anySpendSignatureMint",
|
|
45
48
|
"anySpendBondKit",
|
|
@@ -75,6 +78,8 @@ function B3DynamicModal() {
|
|
|
75
78
|
return (0, jsx_runtime_1.jsx)(react_1.OrderHistory, { onBack: () => { }, mode: "modal" });
|
|
76
79
|
case "anySpendStakeB3":
|
|
77
80
|
return (0, jsx_runtime_1.jsx)(react_1.AnySpendStakeB3, { ...contentType, mode: "modal" });
|
|
81
|
+
case "anySpendStakeUpside":
|
|
82
|
+
return (0, jsx_runtime_1.jsx)(AnySpendStakeUpside_1.AnySpendStakeUpside, { ...contentType, mode: "modal" });
|
|
78
83
|
case "anySpendBuySpin":
|
|
79
84
|
return (0, jsx_runtime_1.jsx)(react_1.AnySpendBuySpin, { ...contentType, mode: "modal" });
|
|
80
85
|
case "anySpendSignatureMint":
|
|
@@ -22,6 +22,7 @@ function centerTruncate(str, length = 4) {
|
|
|
22
22
|
}
|
|
23
23
|
function BalanceContent({ onLogout, showDeposit = true, showSwap = true }) {
|
|
24
24
|
const account = (0, react_3.useActiveAccount)();
|
|
25
|
+
const globalAccount = (0, react_1.useGlobalAccount)();
|
|
25
26
|
const { address: eoaAddress, info: eoaInfo } = (0, useFirstEOA_1.useFirstEOA)();
|
|
26
27
|
const { data: profile } = (0, react_1.useProfile)({
|
|
27
28
|
address: eoaAddress || account?.address,
|
|
@@ -47,11 +48,12 @@ function BalanceContent({ onLogout, showDeposit = true, showSwap = true }) {
|
|
|
47
48
|
};
|
|
48
49
|
console.log("eoaAddress", eoaAddress);
|
|
49
50
|
console.log("account?.address", account?.address);
|
|
51
|
+
console.log("globalAccount", globalAccount);
|
|
50
52
|
// Balance data fetching
|
|
51
53
|
const { data: eoaNativeBalance, isLoading: eoaNativeLoading } = (0, react_1.useNativeBalance)(eoaAddress);
|
|
52
54
|
const { data: eoaB3Balance, isLoading: eoaB3Loading } = (0, react_1.useB3BalanceFromAddresses)(eoaAddress);
|
|
53
|
-
const { data: b3Balance, isLoading: b3Loading } = (0, react_1.useB3BalanceFromAddresses)(
|
|
54
|
-
const { data: nativeBalance, isLoading: nativeLoading } = (0, react_1.useNativeBalance)(
|
|
55
|
+
const { data: b3Balance, isLoading: b3Loading } = (0, react_1.useB3BalanceFromAddresses)(globalAccount?.address);
|
|
56
|
+
const { data: nativeBalance, isLoading: nativeLoading } = (0, react_1.useNativeBalance)(globalAccount?.address);
|
|
55
57
|
// Calculate total USD values for comparison
|
|
56
58
|
const globalAccountTotalUsd = (b3Balance?.balanceUsd || 0) + (nativeBalance?.totalUsd || 0);
|
|
57
59
|
const eoaTotalUsd = (eoaB3Balance?.balanceUsd || 0) + (eoaNativeBalance?.totalUsd || 0);
|
|
@@ -101,5 +103,5 @@ function BalanceContent({ onLogout, showDeposit = true, showSwap = true }) {
|
|
|
101
103
|
type: "anySpend",
|
|
102
104
|
showBackButton: true,
|
|
103
105
|
});
|
|
104
|
-
}, children: [(0, jsx_runtime_1.jsx)(SwapIcon_1.SwapIcon, { size: 24, className: "text-b3-primary-blue" }), (0, jsx_runtime_1.jsx)("div", { className: "text-b3-grey font-neue-montreal-semibold", children: "Swap" })] }))] })), (0, jsx_runtime_1.jsxs)(accordion_1.Accordion, { type: "multiple", value: openAccordions, onValueChange: setOpenAccordions, className: "space-y-2", children: [(0, jsx_runtime_1.jsxs)(accordion_1.AccordionItem, { value: "global-account", className: "border-none", children: [(0, jsx_runtime_1.jsx)(accordion_1.AccordionTrigger, { className: "text-b3-grey font-neue-montreal-semibold py-2 hover:no-underline", children: (0, jsx_runtime_1.jsx)("span", { children: "Balance" }) }), (0, jsx_runtime_1.jsxs)(accordion_1.AccordionContent, { className: "space-y-4", children: [(0, jsx_runtime_1.jsx)(TokenBalanceRow_1.TokenBalanceRow, { icon: (0, jsx_runtime_1.jsx)(TokenIcon_1.B3TokenIcon, { className: "size-10" }), name: "B3", balance: `${b3Balance?.formattedTotal || "0.00"} B3`, usdValue: b3Balance?.balanceUsdFormatted || "0.00", priceChange: b3Balance?.priceChange24h }), (0, jsx_runtime_1.jsx)(TokenBalanceRow_1.TokenBalanceRow, { icon: (0, jsx_runtime_1.jsx)(TokenIcon_1.EthereumTokenIcon, { className: "size-10" }), name: "Ethereum", balance: `${nativeBalance?.formattedTotal || "0.00"} ETH`, usdValue: nativeBalance?.formattedTotalUsd || "0.00", priceChange: nativeBalance?.priceChange24h })] })] }), eoaAddress && ((0, jsx_runtime_1.jsxs)(accordion_1.AccordionItem, { value: "eoa-account", className: "border-none", children: [(0, jsx_runtime_1.jsx)(accordion_1.AccordionTrigger, { className: "text-b3-grey font-neue-montreal-semibold py-2 hover:no-underline", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.
|
|
106
|
+
}, children: [(0, jsx_runtime_1.jsx)(SwapIcon_1.SwapIcon, { size: 24, className: "text-b3-primary-blue" }), (0, jsx_runtime_1.jsx)("div", { className: "text-b3-grey font-neue-montreal-semibold", children: "Swap" })] }))] })), (0, jsx_runtime_1.jsxs)(accordion_1.Accordion, { type: "multiple", value: openAccordions, onValueChange: setOpenAccordions, className: "space-y-2", children: [(0, jsx_runtime_1.jsxs)(accordion_1.AccordionItem, { value: "global-account", className: "border-none", children: [(0, jsx_runtime_1.jsx)(accordion_1.AccordionTrigger, { className: "text-b3-grey font-neue-montreal-semibold py-2 hover:no-underline", children: (0, jsx_runtime_1.jsx)("span", { children: "Smart Account Balance" }) }), (0, jsx_runtime_1.jsxs)(accordion_1.AccordionContent, { className: "space-y-4", children: [(0, jsx_runtime_1.jsx)(TokenBalanceRow_1.TokenBalanceRow, { icon: (0, jsx_runtime_1.jsx)(TokenIcon_1.B3TokenIcon, { className: "size-10" }), name: "B3", balance: `${b3Balance?.formattedTotal || "0.00"} B3`, usdValue: b3Balance?.balanceUsdFormatted || "0.00", priceChange: b3Balance?.priceChange24h }), (0, jsx_runtime_1.jsx)(TokenBalanceRow_1.TokenBalanceRow, { icon: (0, jsx_runtime_1.jsx)(TokenIcon_1.EthereumTokenIcon, { className: "size-10" }), name: "Ethereum", balance: `${nativeBalance?.formattedTotal || "0.00"} ETH`, usdValue: nativeBalance?.formattedTotalUsd || "0.00", priceChange: nativeBalance?.priceChange24h })] })] }), eoaAddress && ((0, jsx_runtime_1.jsxs)(accordion_1.AccordionItem, { value: "eoa-account", className: "border-none", children: [(0, jsx_runtime_1.jsx)(accordion_1.AccordionTrigger, { className: "text-b3-grey font-neue-montreal-semibold py-2 hover:no-underline", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("span", { children: eoaInfo?.data?.name || "Wallet" }), (0, jsx_runtime_1.jsxs)("div", { className: "address-button border-b3-line bg-b3-line/20 hover:bg-b3-line/40 flex w-fit items-center gap-2 rounded-full border px-3 py-1 transition-colors", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-b3-foreground-muted font-mono text-xs", children: centerTruncate(eoaAddress, 6) }), (0, jsx_runtime_1.jsx)(react_1.CopyToClipboard, { text: eoaAddress })] })] }) }), (0, jsx_runtime_1.jsxs)(accordion_1.AccordionContent, { className: "space-y-4", children: [(0, jsx_runtime_1.jsx)(TokenBalanceRow_1.TokenBalanceRow, { icon: (0, jsx_runtime_1.jsx)(TokenIcon_1.B3TokenIcon, { className: "size-10" }), name: "B3", balance: `${eoaB3Balance?.formattedTotal || "0.00"} B3`, usdValue: eoaB3Balance?.balanceUsdFormatted || "0.00", priceChange: eoaB3Balance?.priceChange24h }), (0, jsx_runtime_1.jsx)(TokenBalanceRow_1.TokenBalanceRow, { icon: (0, jsx_runtime_1.jsx)(TokenIcon_1.EthereumTokenIcon, { className: "size-10" }), name: "Ethereum", balance: `${eoaNativeBalance?.formattedTotal || "0.00"} ETH`, usdValue: eoaNativeBalance?.formattedTotalUsd || "0.00", priceChange: eoaNativeBalance?.priceChange24h })] })] }))] }), (0, jsx_runtime_1.jsxs)("button", { className: "logout-button border-b3-line hover:bg-b3-line relative flex w-full items-center justify-center rounded-2xl border p-4 transition-colors", onClick: onLogoutEnhanced, children: [(0, jsx_runtime_1.jsx)("span", { className: "font-neue-montreal-semibold text-b3-grey", children: "Sign out" }), (0, jsx_runtime_1.jsx)("div", { className: "absolute right-4", children: logoutLoading ? ((0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "animate-spin", size: 16 })) : ((0, jsx_runtime_1.jsx)(SignOutIcon_1.SignOutIcon, { size: 16, className: "text-b3-grey" })) })] })] }));
|
|
105
107
|
}
|
|
@@ -210,6 +210,26 @@ export interface AnySpendStakeB3Props extends BaseModalProps {
|
|
|
210
210
|
/** Callback function called when the stake is successful */
|
|
211
211
|
onSuccess?: () => void;
|
|
212
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* Props for the AnySpend Stake Contract modal
|
|
215
|
+
* Handles token staking operations to a given contract
|
|
216
|
+
*/
|
|
217
|
+
export interface AnySpendStakeUpsideProps extends BaseModalProps {
|
|
218
|
+
/** Modal type identifier */
|
|
219
|
+
type: "anySpendStakeUpside";
|
|
220
|
+
/** Recipient address to stake B3 for */
|
|
221
|
+
beneficiaryAddress: string;
|
|
222
|
+
/** Stake amount */
|
|
223
|
+
stakeAmount: string;
|
|
224
|
+
/** Staking contract address */
|
|
225
|
+
stakingContractAddress: string;
|
|
226
|
+
/** Pool type for staking */
|
|
227
|
+
poolType: "b3" | "weth";
|
|
228
|
+
/** Token address to stake */
|
|
229
|
+
token: components["schemas"]["Token"];
|
|
230
|
+
/** Callback function called when the stake is successful */
|
|
231
|
+
onSuccess?: () => void;
|
|
232
|
+
}
|
|
213
233
|
/**
|
|
214
234
|
* Props for the AnySpend Buy Spin modal
|
|
215
235
|
* Handles spin wheel entry purchases
|
|
@@ -302,7 +322,7 @@ export interface AvatarEditorModalProps extends BaseModalProps {
|
|
|
302
322
|
/**
|
|
303
323
|
* Union type of all possible modal content types
|
|
304
324
|
*/
|
|
305
|
-
export type ModalContentType = SignInWithB3ModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps | AnySpendOrderHistoryProps | AnySpendStakeB3Props | AnySpendBuySpinProps | AnySpendSignatureMintProps | AnySpendBondKitProps | LinkAccountModalProps | AnySpendDepositHypeProps | AvatarEditorModalProps;
|
|
325
|
+
export type ModalContentType = SignInWithB3ModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps | AnySpendOrderHistoryProps | AnySpendStakeB3Props | AnySpendStakeUpsideProps | AnySpendBuySpinProps | AnySpendSignatureMintProps | AnySpendBondKitProps | LinkAccountModalProps | AnySpendDepositHypeProps | AvatarEditorModalProps;
|
|
306
326
|
/**
|
|
307
327
|
* State interface for the modal store
|
|
308
328
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as SimpleHashTypes from "../../global-account/types/simplehash.types";
|
|
2
2
|
export * from "../../global-account/types/simplehash.types";
|
|
3
|
-
export declare const simpleHashChainToChainId: (chain: string) => 8453 | 8333 |
|
|
3
|
+
export declare const simpleHashChainToChainId: (chain: string) => 8453 | 8333 | 1993 | 84532 | null;
|
|
4
4
|
export declare const simpleHashChainToChainName: (chain: number) => "base" | "b3" | "b3-sepolia" | "base-sepolia" | null;
|
|
5
5
|
type SimpleHashRoute = `/v0/nfts/${string}/${string}/${string}` | `/v0/nfts/${string}` | `/v0/nfts/collections/${string}/${string}` | `/v0/nfts/transfers/${string}/${string}` | `/v0/fungibles/assets` | `/v0/native_tokens/balances` | string;
|
|
6
6
|
type RouteReturnType<T extends SimpleHashRoute> = T extends `/v0/nfts/collections/${string}/${string}` ? SimpleHashTypes.SimpleHashNFTResponse : T extends `/v0/nfts/transfers/${string}/${string}` ? {
|