@b3dotfun/sdk 0.0.29 → 0.0.30-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/constants/index.d.ts +1 -0
- package/dist/cjs/anyspend/constants/index.js +2 -1
- package/dist/cjs/anyspend/react/components/AnySpend.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendBondKit.d.ts +1 -1
- package/dist/cjs/anyspend/react/components/AnySpendBondKit.js +23 -24
- package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +2 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +1 -1
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +2 -1
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +4 -2
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +17 -10
- package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.js +9 -1
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +124 -41
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +6 -3
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +6 -4
- package/dist/cjs/anyspend/react/components/common/OrderStatus.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/OrderStatus.js +2 -2
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.js +1 -1
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +2 -2
- package/dist/cjs/anyspend/react/components/common/PaySection.js +6 -4
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +34 -3
- package/dist/cjs/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/cjs/bondkit/abis/BondkitTokenABI.d.ts +62 -17
- package/dist/cjs/bondkit/abis/BondkitTokenABI.js +41 -9
- package/dist/cjs/bondkit/abis/BondkitTokenFactoryABI.d.ts +0 -25
- package/dist/cjs/bondkit/abis/BondkitTokenFactoryABI.js +0 -9
- package/dist/cjs/bondkit/constants.js +1 -1
- package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.js +28 -15
- package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +1 -1
- package/dist/cjs/global-account/react/hooks/useB3BalanceFromAddresses.js +2 -1
- package/dist/cjs/global-account/react/hooks/useNativeBalance.js +2 -1
- package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.d.ts +1 -0
- package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +1 -0
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +4 -2
- package/dist/cjs/shared/constants/chains/b3Chain.d.ts +2 -2
- package/dist/cjs/shared/constants/chains/supported.d.ts +4 -4
- package/dist/cjs/shared/constants/index.d.ts +1 -0
- package/dist/cjs/shared/constants/index.js +2 -1
- package/dist/esm/anyspend/constants/index.d.ts +1 -0
- package/dist/esm/anyspend/constants/index.js +1 -0
- package/dist/esm/anyspend/react/components/AnySpend.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendBondKit.d.ts +1 -1
- package/dist/esm/anyspend/react/components/AnySpendBondKit.js +23 -24
- package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +2 -1
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +1 -1
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +2 -1
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +4 -2
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +19 -12
- package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.js +6 -1
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +126 -43
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +7 -4
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +7 -5
- package/dist/esm/anyspend/react/components/common/OrderStatus.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/OrderStatus.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderTokenAmount.js +1 -1
- package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +2 -1
- package/dist/esm/anyspend/react/components/common/PanelOnramp.js +2 -2
- package/dist/esm/anyspend/react/components/common/PaySection.js +7 -5
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +35 -4
- package/dist/esm/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/esm/bondkit/abis/BondkitTokenABI.d.ts +62 -17
- package/dist/esm/bondkit/abis/BondkitTokenABI.js +41 -9
- package/dist/esm/bondkit/abis/BondkitTokenFactoryABI.d.ts +0 -25
- package/dist/esm/bondkit/abis/BondkitTokenFactoryABI.js +0 -9
- package/dist/esm/bondkit/constants.js +1 -1
- package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +28 -15
- package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +1 -1
- package/dist/esm/global-account/react/hooks/useB3BalanceFromAddresses.js +2 -1
- package/dist/esm/global-account/react/hooks/useNativeBalance.js +2 -1
- package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.d.ts +1 -0
- package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +1 -0
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +4 -2
- package/dist/esm/shared/constants/chains/b3Chain.d.ts +2 -2
- package/dist/esm/shared/constants/chains/supported.d.ts +4 -4
- package/dist/esm/shared/constants/index.d.ts +1 -0
- package/dist/esm/shared/constants/index.js +1 -0
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/constants/index.d.ts +1 -0
- package/dist/types/anyspend/react/components/AnySpendBondKit.d.ts +1 -1
- package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +4 -2
- package/dist/types/anyspend/react/components/common/OrderStatus.d.ts +2 -0
- package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +2 -1
- package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -1
- package/dist/types/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/types/bondkit/abis/BondkitTokenABI.d.ts +62 -17
- package/dist/types/bondkit/abis/BondkitTokenFactoryABI.d.ts +0 -25
- package/dist/types/global-account/react/hooks/useUnifiedChainSwitchAndExecute.d.ts +1 -0
- package/dist/types/global-account/react/stores/useModalStore.d.ts +4 -2
- package/dist/types/shared/constants/chains/b3Chain.d.ts +2 -2
- package/dist/types/shared/constants/chains/supported.d.ts +4 -4
- package/dist/types/shared/constants/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/anyspend/constants/index.ts +2 -0
- package/src/anyspend/react/components/AnySpend.tsx +2 -1
- package/src/anyspend/react/components/AnySpendBondKit.tsx +28 -28
- package/src/anyspend/react/components/AnySpendBuySpin.tsx +2 -1
- package/src/anyspend/react/components/AnySpendCustom.tsx +1 -1
- package/src/anyspend/react/components/AnySpendStakeB3.tsx +2 -1
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +143 -130
- package/src/anyspend/react/components/common/ConnectWalletPayment.tsx +9 -0
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +243 -104
- package/src/anyspend/react/components/common/OrderDetails.tsx +7 -3
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +10 -4
- package/src/anyspend/react/components/common/OrderStatus.tsx +9 -2
- package/src/anyspend/react/components/common/OrderTokenAmount.tsx +2 -2
- package/src/anyspend/react/components/common/PanelOnramp.tsx +3 -1
- package/src/anyspend/react/components/common/PaySection.tsx +10 -8
- package/src/anyspend/react/hooks/useAnyspendFlow.ts +41 -3
- package/src/bondkit/abis/BondkitTokenABI.ts +41 -9
- package/src/bondkit/abis/BondkitTokenFactoryABI.ts +0 -9
- package/src/bondkit/constants.ts +1 -1
- package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +26 -10
- package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +5 -1
- package/src/global-account/react/hooks/useB3BalanceFromAddresses.ts +2 -1
- package/src/global-account/react/hooks/useNativeBalance.tsx +2 -1
- package/src/global-account/react/hooks/useUnifiedChainSwitchAndExecute.ts +1 -0
- package/src/global-account/react/stores/useModalStore.ts +4 -2
- package/src/shared/constants/index.ts +2 -0
- package/dist/cjs/anyspend/abis/bondKit.d.ts +0 -35
- package/dist/cjs/anyspend/abis/bondKit.js +0 -29
- package/dist/esm/anyspend/abis/bondKit.d.ts +0 -35
- package/dist/esm/anyspend/abis/bondKit.js +0 -26
- package/dist/types/anyspend/abis/bondKit.d.ts +0 -35
- package/src/anyspend/abis/bondKit.ts +0 -26
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
useGeoOnrampOptions,
|
|
8
8
|
} from "@b3dotfun/sdk/anyspend/react";
|
|
9
9
|
import { anyspendService } from "@b3dotfun/sdk/anyspend/services/anyspend";
|
|
10
|
-
import { useAccountWallet, useProfile } from "@b3dotfun/sdk/global-account/react";
|
|
10
|
+
import { useAccountWallet, useProfile, useRouter, useSearchParamsSSR } from "@b3dotfun/sdk/global-account/react";
|
|
11
11
|
import { formatTokenAmount, formatUnits } from "@b3dotfun/sdk/shared/utils/number";
|
|
12
12
|
import { useEffect, useState } from "react";
|
|
13
13
|
import { toast } from "sonner";
|
|
@@ -35,6 +35,7 @@ interface UseAnyspendFlowProps {
|
|
|
35
35
|
onTransactionSuccess?: () => void;
|
|
36
36
|
sourceTokenAddress?: string;
|
|
37
37
|
sourceTokenChainId?: number;
|
|
38
|
+
slippage?: number;
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
export function useAnyspendFlow({
|
|
@@ -46,7 +47,11 @@ export function useAnyspendFlow({
|
|
|
46
47
|
onTransactionSuccess,
|
|
47
48
|
sourceTokenAddress,
|
|
48
49
|
sourceTokenChainId,
|
|
50
|
+
slippage = 0,
|
|
49
51
|
}: UseAnyspendFlowProps) {
|
|
52
|
+
const searchParams = useSearchParamsSSR();
|
|
53
|
+
const router = useRouter();
|
|
54
|
+
|
|
50
55
|
// Panel and order state
|
|
51
56
|
const [activePanel, setActivePanel] = useState<PanelView>(loadOrder ? PanelView.ORDER_DETAILS : PanelView.MAIN);
|
|
52
57
|
const [orderId, setOrderId] = useState<string | undefined>(loadOrder);
|
|
@@ -82,6 +87,12 @@ export function useAnyspendFlow({
|
|
|
82
87
|
}
|
|
83
88
|
}, [selectedRecipientAddress, globalAddress]);
|
|
84
89
|
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
if (paymentType === "crypto") {
|
|
92
|
+
setSelectedCryptoPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
|
|
93
|
+
}
|
|
94
|
+
}, [paymentType]);
|
|
95
|
+
|
|
85
96
|
// Fetch specific token when sourceTokenAddress and sourceTokenChainId are provided
|
|
86
97
|
useEffect(() => {
|
|
87
98
|
const fetchSourceToken = async () => {
|
|
@@ -135,12 +146,27 @@ export function useAnyspendFlow({
|
|
|
135
146
|
if (anyspendQuote?.data?.currencyOut?.amount && anyspendQuote.data.currencyOut.currency?.decimals) {
|
|
136
147
|
const amount = anyspendQuote.data.currencyOut.amount;
|
|
137
148
|
const decimals = anyspendQuote.data.currencyOut.currency.decimals;
|
|
138
|
-
|
|
149
|
+
|
|
150
|
+
// Apply slippage (0-100) - reduce amount by slippage percentageFixed slippage value
|
|
151
|
+
const amountWithSlippage = (BigInt(amount) * BigInt(100 - slippage)) / BigInt(100);
|
|
152
|
+
|
|
153
|
+
const formattedAmount = formatTokenAmount(amountWithSlippage, decimals, 6, false);
|
|
139
154
|
setDstAmount(formattedAmount);
|
|
140
155
|
} else {
|
|
141
156
|
setDstAmount("");
|
|
142
157
|
}
|
|
143
|
-
}, [anyspendQuote]);
|
|
158
|
+
}, [anyspendQuote, slippage]);
|
|
159
|
+
|
|
160
|
+
// Update useEffect for URL parameter to not override loadOrder
|
|
161
|
+
useEffect(() => {
|
|
162
|
+
if (loadOrder) return; // Skip if we have a loadOrder
|
|
163
|
+
|
|
164
|
+
const orderIdParam = searchParams.get("orderId");
|
|
165
|
+
if (orderIdParam) {
|
|
166
|
+
setOrderId(orderIdParam);
|
|
167
|
+
setActivePanel(PanelView.ORDER_DETAILS);
|
|
168
|
+
}
|
|
169
|
+
}, [searchParams, loadOrder]);
|
|
144
170
|
|
|
145
171
|
// Order creation hooks
|
|
146
172
|
const { createOrder, isCreatingOrder } = useAnyspendCreateOrder({
|
|
@@ -149,6 +175,18 @@ export function useAnyspendFlow({
|
|
|
149
175
|
setOrderId(newOrderId);
|
|
150
176
|
setActivePanel(PanelView.ORDER_DETAILS);
|
|
151
177
|
onOrderSuccess?.(newOrderId);
|
|
178
|
+
|
|
179
|
+
// Add orderId and payment method to URL for persistence
|
|
180
|
+
const params = new URLSearchParams(searchParams.toString()); // Preserve existing params
|
|
181
|
+
params.set("orderId", newOrderId);
|
|
182
|
+
if (selectedCryptoPaymentMethod !== CryptoPaymentMethodType.NONE) {
|
|
183
|
+
console.log("Setting cryptoPaymentMethod in URL:", selectedCryptoPaymentMethod);
|
|
184
|
+
params.set("cryptoPaymentMethod", selectedCryptoPaymentMethod);
|
|
185
|
+
} else {
|
|
186
|
+
console.log("Payment method is NONE, not setting in URL");
|
|
187
|
+
}
|
|
188
|
+
console.log("Final URL params:", params.toString());
|
|
189
|
+
router.push(`${window.location.pathname}?${params.toString()}`);
|
|
152
190
|
},
|
|
153
191
|
onError: error => {
|
|
154
192
|
console.error(error);
|
|
@@ -158,11 +158,6 @@ export const BondkitTokenABI = [
|
|
|
158
158
|
name: "ValidationInvalidLPSplitRatio",
|
|
159
159
|
type: "error",
|
|
160
160
|
},
|
|
161
|
-
{
|
|
162
|
-
inputs: [{ internalType: "address", name: "providedAddress", type: "address" }],
|
|
163
|
-
name: "ValidationInvalidMigrationAdminAddress",
|
|
164
|
-
type: "error",
|
|
165
|
-
},
|
|
166
161
|
{
|
|
167
162
|
inputs: [{ internalType: "uint24", name: "value", type: "uint24" }],
|
|
168
163
|
name: "ValidationInvalidV4PoolFee",
|
|
@@ -183,6 +178,15 @@ export const BondkitTokenABI = [
|
|
|
183
178
|
name: "Approval",
|
|
184
179
|
type: "event",
|
|
185
180
|
},
|
|
181
|
+
{
|
|
182
|
+
anonymous: false,
|
|
183
|
+
inputs: [
|
|
184
|
+
{ indexed: true, internalType: "address", name: "previousAdmin", type: "address" },
|
|
185
|
+
{ indexed: true, internalType: "address", name: "newAdmin", type: "address" },
|
|
186
|
+
],
|
|
187
|
+
name: "B3AdminUpdated",
|
|
188
|
+
type: "event",
|
|
189
|
+
},
|
|
186
190
|
{
|
|
187
191
|
anonymous: false,
|
|
188
192
|
inputs: [
|
|
@@ -234,6 +238,15 @@ export const BondkitTokenABI = [
|
|
|
234
238
|
name: "BondkitTokenMigrated",
|
|
235
239
|
type: "event",
|
|
236
240
|
},
|
|
241
|
+
{
|
|
242
|
+
anonymous: false,
|
|
243
|
+
inputs: [
|
|
244
|
+
{ indexed: false, internalType: "uint256", name: "totalRaisedBonding", type: "uint256" },
|
|
245
|
+
{ indexed: false, internalType: "uint256", name: "targetAmount", type: "uint256" },
|
|
246
|
+
],
|
|
247
|
+
name: "DexTriggerThresholdMet",
|
|
248
|
+
type: "event",
|
|
249
|
+
},
|
|
237
250
|
{
|
|
238
251
|
anonymous: false,
|
|
239
252
|
inputs: [
|
|
@@ -302,6 +315,13 @@ export const BondkitTokenABI = [
|
|
|
302
315
|
stateMutability: "nonpayable",
|
|
303
316
|
type: "function",
|
|
304
317
|
},
|
|
318
|
+
{
|
|
319
|
+
inputs: [],
|
|
320
|
+
name: "b3Admin",
|
|
321
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
322
|
+
stateMutability: "view",
|
|
323
|
+
type: "function",
|
|
324
|
+
},
|
|
305
325
|
{
|
|
306
326
|
inputs: [{ internalType: "address", name: "account", type: "address" }],
|
|
307
327
|
name: "balanceOf",
|
|
@@ -323,7 +343,7 @@ export const BondkitTokenABI = [
|
|
|
323
343
|
],
|
|
324
344
|
name: "buy",
|
|
325
345
|
outputs: [],
|
|
326
|
-
stateMutability: "
|
|
346
|
+
stateMutability: "nonpayable",
|
|
327
347
|
type: "function",
|
|
328
348
|
},
|
|
329
349
|
{
|
|
@@ -334,7 +354,7 @@ export const BondkitTokenABI = [
|
|
|
334
354
|
],
|
|
335
355
|
name: "buyFor",
|
|
336
356
|
outputs: [],
|
|
337
|
-
stateMutability: "
|
|
357
|
+
stateMutability: "nonpayable",
|
|
338
358
|
type: "function",
|
|
339
359
|
},
|
|
340
360
|
{
|
|
@@ -397,6 +417,13 @@ export const BondkitTokenABI = [
|
|
|
397
417
|
stateMutability: "view",
|
|
398
418
|
type: "function",
|
|
399
419
|
},
|
|
420
|
+
{
|
|
421
|
+
inputs: [],
|
|
422
|
+
name: "getB3Admin",
|
|
423
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
424
|
+
stateMutability: "view",
|
|
425
|
+
type: "function",
|
|
426
|
+
},
|
|
400
427
|
{
|
|
401
428
|
inputs: [],
|
|
402
429
|
name: "getBondingCurveConfig",
|
|
@@ -539,7 +566,6 @@ export const BondkitTokenABI = [
|
|
|
539
566
|
{ internalType: "uint256", name: "lpSplitRatioFeeRecipientBps", type: "uint256" },
|
|
540
567
|
{ internalType: "uint256", name: "targetAmount", type: "uint256" },
|
|
541
568
|
{ internalType: "address", name: "tradingToken", type: "address" },
|
|
542
|
-
{ internalType: "address", name: "migrationAdminAddress", type: "address" },
|
|
543
569
|
{ internalType: "address", name: "bondingPhaseSplitter", type: "address" },
|
|
544
570
|
{ internalType: "address", name: "v4PoolManager", type: "address" },
|
|
545
571
|
{ internalType: "address", name: "v4Hook", type: "address" },
|
|
@@ -659,6 +685,13 @@ export const BondkitTokenABI = [
|
|
|
659
685
|
stateMutability: "nonpayable",
|
|
660
686
|
type: "function",
|
|
661
687
|
},
|
|
688
|
+
{
|
|
689
|
+
inputs: [{ internalType: "address", name: "_newAdmin", type: "address" }],
|
|
690
|
+
name: "updateB3Admin",
|
|
691
|
+
outputs: [],
|
|
692
|
+
stateMutability: "nonpayable",
|
|
693
|
+
type: "function",
|
|
694
|
+
},
|
|
662
695
|
{
|
|
663
696
|
inputs: [{ internalType: "address", name: "_bondingPhaseSplitter", type: "address" }],
|
|
664
697
|
name: "updateSplitter",
|
|
@@ -701,5 +734,4 @@ export const BondkitTokenABI = [
|
|
|
701
734
|
stateMutability: "view",
|
|
702
735
|
type: "function",
|
|
703
736
|
},
|
|
704
|
-
{ stateMutability: "payable", type: "receive" },
|
|
705
737
|
] as const;
|
|
@@ -57,11 +57,6 @@ export const BondkitTokenFactoryABI = [
|
|
|
57
57
|
name: "ValidationInvalidLPSplitRatio",
|
|
58
58
|
type: "error",
|
|
59
59
|
},
|
|
60
|
-
{
|
|
61
|
-
inputs: [{ internalType: "address", name: "providedAddress", type: "address" }],
|
|
62
|
-
name: "ValidationInvalidMigrationAdminAddress",
|
|
63
|
-
type: "error",
|
|
64
|
-
},
|
|
65
60
|
{
|
|
66
61
|
inputs: [{ internalType: "uint24", name: "value", type: "uint24" }],
|
|
67
62
|
name: "ValidationInvalidV4PoolFee",
|
|
@@ -80,7 +75,6 @@ export const BondkitTokenFactoryABI = [
|
|
|
80
75
|
{ indexed: false, internalType: "string", name: "name", type: "string" },
|
|
81
76
|
{ indexed: false, internalType: "string", name: "symbol", type: "string" },
|
|
82
77
|
{ indexed: true, internalType: "address", name: "feeRecipient", type: "address" },
|
|
83
|
-
{ indexed: false, internalType: "address", name: "migrationAdmin", type: "address" },
|
|
84
78
|
],
|
|
85
79
|
name: "BondkitTokenCreated",
|
|
86
80
|
type: "event",
|
|
@@ -132,7 +126,6 @@ export const BondkitTokenFactoryABI = [
|
|
|
132
126
|
{ internalType: "uint256", name: "lpSplitRatioFeeRecipientBps", type: "uint256" },
|
|
133
127
|
{ internalType: "uint256", name: "targetAmount", type: "uint256" },
|
|
134
128
|
{ internalType: "address", name: "tradingToken", type: "address" },
|
|
135
|
-
{ internalType: "address", name: "migrationAdminAddress", type: "address" },
|
|
136
129
|
{ internalType: "address", name: "bondingPhaseSplitter", type: "address" },
|
|
137
130
|
{ internalType: "address", name: "v4PoolManager", type: "address" },
|
|
138
131
|
{ internalType: "address", name: "v4Hook", type: "address" },
|
|
@@ -175,7 +168,6 @@ export const BondkitTokenFactoryABI = [
|
|
|
175
168
|
{ internalType: "uint256", name: "lpSplitRatioFeeRecipientBps", type: "uint256" },
|
|
176
169
|
{ internalType: "uint256", name: "targetAmount", type: "uint256" },
|
|
177
170
|
{ internalType: "address", name: "tradingToken", type: "address" },
|
|
178
|
-
{ internalType: "address", name: "migrationAdminAddress", type: "address" },
|
|
179
171
|
{ internalType: "address", name: "bondingPhaseSplitter", type: "address" },
|
|
180
172
|
{ internalType: "address", name: "v4PoolManager", type: "address" },
|
|
181
173
|
{ internalType: "address", name: "v4Hook", type: "address" },
|
|
@@ -227,7 +219,6 @@ export const BondkitTokenFactoryABI = [
|
|
|
227
219
|
{ internalType: "uint256", name: "lpSplitRatioFeeRecipientBps", type: "uint256" },
|
|
228
220
|
{ internalType: "uint256", name: "targetAmount", type: "uint256" },
|
|
229
221
|
{ internalType: "address", name: "tradingToken", type: "address" },
|
|
230
|
-
{ internalType: "address", name: "migrationAdminAddress", type: "address" },
|
|
231
222
|
{ internalType: "address", name: "bondingPhaseSplitter", type: "address" },
|
|
232
223
|
{ internalType: "address", name: "v4PoolManager", type: "address" },
|
|
233
224
|
{ internalType: "address", name: "v4Hook", type: "address" },
|
package/src/bondkit/constants.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
2
|
|
|
3
|
-
export const BaseBondkitTokenFactoryContractAddress: Address = "
|
|
3
|
+
export const BaseBondkitTokenFactoryContractAddress: Address = "0x5d641bbB206d4B5585eCCd919F36270200A9A2Ad";
|
|
4
4
|
|
|
5
5
|
export const BaseMainnetRpcUrl = "https://base-rpc.publicnode.com";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ecosystemWalletId } from "@b3dotfun/sdk/shared/constants";
|
|
1
2
|
import { client } from "@b3dotfun/sdk/shared/utils/thirdweb";
|
|
2
3
|
import { Loader2 } from "lucide-react";
|
|
3
4
|
import { useCallback, useEffect, useState } from "react";
|
|
@@ -122,12 +123,20 @@ export function LinkAccount({
|
|
|
122
123
|
client,
|
|
123
124
|
strategy: "email",
|
|
124
125
|
email,
|
|
126
|
+
ecosystem: {
|
|
127
|
+
id: ecosystemWalletId,
|
|
128
|
+
partnerId: partnerId,
|
|
129
|
+
},
|
|
125
130
|
});
|
|
126
131
|
} else if (selectedMethod === "phone") {
|
|
127
132
|
await preAuthenticate({
|
|
128
133
|
client,
|
|
129
134
|
strategy: "phone",
|
|
130
135
|
phoneNumber: phone,
|
|
136
|
+
ecosystem: {
|
|
137
|
+
id: ecosystemWalletId,
|
|
138
|
+
partnerId: partnerId,
|
|
139
|
+
},
|
|
131
140
|
});
|
|
132
141
|
}
|
|
133
142
|
|
|
@@ -142,11 +151,13 @@ export function LinkAccount({
|
|
|
142
151
|
|
|
143
152
|
const handleLinkAccount = async () => {
|
|
144
153
|
if (!otp) {
|
|
154
|
+
console.error("No OTP entered");
|
|
145
155
|
setError("Please enter the verification code");
|
|
146
156
|
return;
|
|
147
157
|
}
|
|
148
158
|
|
|
149
159
|
try {
|
|
160
|
+
setOtpSent(false);
|
|
150
161
|
setLinkingState(true, selectedMethod);
|
|
151
162
|
setError(null);
|
|
152
163
|
|
|
@@ -171,15 +182,10 @@ export function LinkAccount({
|
|
|
171
182
|
mutationOptions,
|
|
172
183
|
);
|
|
173
184
|
}
|
|
174
|
-
|
|
175
|
-
onSuccess?.();
|
|
176
|
-
onClose?.();
|
|
177
185
|
} catch (error) {
|
|
178
186
|
console.error("Error linking account:", error);
|
|
179
187
|
setError(error instanceof Error ? error.message : "Failed to link account");
|
|
180
188
|
onError?.(error as Error);
|
|
181
|
-
} finally {
|
|
182
|
-
setLinkingState(false);
|
|
183
189
|
}
|
|
184
190
|
};
|
|
185
191
|
|
|
@@ -239,8 +245,13 @@ export function LinkAccount({
|
|
|
239
245
|
setLinkingState(false);
|
|
240
246
|
}, [isLinking, setSelectedMethod, setEmail, setPhone, setOtp, setOtpSent, setError, setLinkingState]);
|
|
241
247
|
|
|
242
|
-
|
|
243
|
-
|
|
248
|
+
const handleFinishedLinking = useCallback(
|
|
249
|
+
(success: boolean) => {
|
|
250
|
+
if (success) {
|
|
251
|
+
onSuccess?.();
|
|
252
|
+
onClose?.();
|
|
253
|
+
}
|
|
254
|
+
|
|
244
255
|
setLinkingState(false);
|
|
245
256
|
navigateBack();
|
|
246
257
|
setB3ModalContentType({
|
|
@@ -250,6 +261,13 @@ export function LinkAccount({
|
|
|
250
261
|
chain,
|
|
251
262
|
partnerId,
|
|
252
263
|
});
|
|
264
|
+
},
|
|
265
|
+
[chain, navigateBack, partnerId, setB3ModalContentType, setLinkingState, onSuccess, onClose],
|
|
266
|
+
);
|
|
267
|
+
|
|
268
|
+
useEffect(() => {
|
|
269
|
+
if (isLinking) {
|
|
270
|
+
handleFinishedLinking(true);
|
|
253
271
|
}
|
|
254
272
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
255
273
|
}, [profiles.length]);
|
|
@@ -338,15 +356,13 @@ export function LinkAccount({
|
|
|
338
356
|
className="bg-b3-line text-b3-grey font-neue-montreal-medium focus:ring-b3-primary-blue/20 w-full rounded-xl p-4 focus:outline-none focus:ring-2"
|
|
339
357
|
value={otp}
|
|
340
358
|
onChange={e => setOtp(e.target.value)}
|
|
341
|
-
disabled={isLinking && linkingMethod === selectedMethod}
|
|
342
359
|
/>
|
|
343
360
|
</div>
|
|
344
361
|
<Button
|
|
345
362
|
className="bg-b3-primary-blue hover:bg-b3-primary-blue/90 font-neue-montreal-semibold h-12 w-full text-white"
|
|
346
363
|
onClick={handleLinkAccount}
|
|
347
|
-
disabled={!otp || (isLinking && linkingMethod === selectedMethod)}
|
|
348
364
|
>
|
|
349
|
-
|
|
365
|
+
Link Account
|
|
350
366
|
</Button>
|
|
351
367
|
</div>
|
|
352
368
|
) : (
|
|
@@ -597,12 +597,16 @@ export function ManageAccount({
|
|
|
597
597
|
>
|
|
598
598
|
Mints
|
|
599
599
|
</TabTriggerPrimitive>
|
|
600
|
+
{/*
|
|
601
|
+
// TODO: Apps is a remnant of session key flow. Moving forward, we should find a way to properly associate apps from linked partners that a user has logged in with
|
|
602
|
+
https://linear.app/npclabs/issue/B3-2318/find-a-way-to-properly-display-which-partner-apps-a-user-has-logged-in
|
|
603
|
+
|
|
600
604
|
<TabTriggerPrimitive
|
|
601
605
|
value="apps"
|
|
602
606
|
className="data-[state=active]:text-b3-primary-blue data-[state=active]:border-b-b3-primary-blue flex-none rounded-none border-0 p-0 pb-1 text-xl leading-none tracking-wide transition-colors data-[state=active]:border-b data-[state=active]:bg-white md:pb-4"
|
|
603
607
|
>
|
|
604
608
|
Apps
|
|
605
|
-
</TabTriggerPrimitive>
|
|
609
|
+
</TabTriggerPrimitive> */}
|
|
606
610
|
<TabTriggerPrimitive
|
|
607
611
|
value="settings"
|
|
608
612
|
className="data-[state=active]:text-b3-primary-blue data-[state=active]:border-b-b3-primary-blue flex-none rounded-none border-0 p-0 pb-1 text-xl leading-none tracking-wide transition-colors data-[state=active]:border-b data-[state=active]:bg-white md:pb-4"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { B3_TOKEN } from "@b3dotfun/sdk/anyspend";
|
|
2
|
+
import { PUBLIC_BASE_RPC_URL } from "@b3dotfun/sdk/shared/constants";
|
|
2
3
|
import { formatNumber } from "@b3dotfun/sdk/shared/utils/formatNumber";
|
|
3
4
|
import { useQuery } from "@tanstack/react-query";
|
|
4
5
|
import { createPublicClient, formatUnits, http } from "viem";
|
|
@@ -19,7 +20,7 @@ const abi = [
|
|
|
19
20
|
// Create a public client for Base
|
|
20
21
|
const client = createPublicClient({
|
|
21
22
|
chain: base,
|
|
22
|
-
transport: http(),
|
|
23
|
+
transport: http(PUBLIC_BASE_RPC_URL),
|
|
23
24
|
});
|
|
24
25
|
|
|
25
26
|
async function fetchB3Balances(addresses: string[]): Promise<{
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PUBLIC_BASE_RPC_URL } from "@b3dotfun/sdk/shared/constants";
|
|
1
2
|
import { b3Mainnet, b3Testnet } from "@b3dotfun/sdk/shared/constants/chains/supported";
|
|
2
3
|
import { formatNumber } from "@b3dotfun/sdk/shared/utils/formatNumber";
|
|
3
4
|
import { useQuery } from "@tanstack/react-query";
|
|
@@ -114,7 +115,7 @@ export function useNativeBalanceFromRPC(address: string, chainId: number) {
|
|
|
114
115
|
try {
|
|
115
116
|
const publicClient = createPublicClient({
|
|
116
117
|
chain: chainId === 8333 ? b3Mainnet : b3Testnet,
|
|
117
|
-
transport: http(),
|
|
118
|
+
transport: http(chainId === 8333 ? PUBLIC_BASE_RPC_URL : undefined),
|
|
118
119
|
});
|
|
119
120
|
|
|
120
121
|
const balance = await publicClient.getBalance({
|
|
@@ -289,8 +289,8 @@ export interface AnySpendBondKitProps extends BaseModalProps {
|
|
|
289
289
|
imageUrl?: string;
|
|
290
290
|
/** Token name to display */
|
|
291
291
|
tokenName?: string;
|
|
292
|
-
/** Optional pre-filled
|
|
293
|
-
|
|
292
|
+
/** Optional pre-filled B3 amount */
|
|
293
|
+
b3Amount?: string;
|
|
294
294
|
/** Callback function called when purchase is successful */
|
|
295
295
|
onSuccess?: (txHash?: string) => void;
|
|
296
296
|
}
|
|
@@ -318,6 +318,8 @@ export interface AnySpendDepositHypeProps extends BaseModalProps {
|
|
|
318
318
|
paymentType?: "crypto" | "fiat";
|
|
319
319
|
/** Deposit contract address */
|
|
320
320
|
depositContractAddress: string;
|
|
321
|
+
/** Main footer */
|
|
322
|
+
mainFooter?: React.ReactNode;
|
|
321
323
|
/** Callback function called when the deposit is successful */
|
|
322
324
|
onSuccess?: () => void;
|
|
323
325
|
}
|
|
@@ -28,3 +28,5 @@ export const CLIENT_APP_BUNDLE_ID = process.env.EXPO_PUBLIC_B3_BUNDLE_ID || "";
|
|
|
28
28
|
export const B3_AUTH_COOKIE_NAME = "b3-auth";
|
|
29
29
|
|
|
30
30
|
export const ENS_GATEWAY_URL = "https://ens-gateway.b3.fun/";
|
|
31
|
+
|
|
32
|
+
export const PUBLIC_BASE_RPC_URL = "https://base-rpc.publicnode.com";
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export declare const ABI_bondKit: readonly [{
|
|
2
|
-
readonly inputs: readonly [{
|
|
3
|
-
readonly internalType: "address";
|
|
4
|
-
readonly name: "_recipient";
|
|
5
|
-
readonly type: "address";
|
|
6
|
-
}, {
|
|
7
|
-
readonly internalType: "uint256";
|
|
8
|
-
readonly name: "_minTokensOut";
|
|
9
|
-
readonly type: "uint256";
|
|
10
|
-
}];
|
|
11
|
-
readonly name: "buyFor";
|
|
12
|
-
readonly outputs: readonly [];
|
|
13
|
-
readonly stateMutability: "payable";
|
|
14
|
-
readonly type: "function";
|
|
15
|
-
}, {
|
|
16
|
-
readonly inputs: readonly [];
|
|
17
|
-
readonly name: "name";
|
|
18
|
-
readonly outputs: readonly [{
|
|
19
|
-
readonly internalType: "string";
|
|
20
|
-
readonly name: "";
|
|
21
|
-
readonly type: "string";
|
|
22
|
-
}];
|
|
23
|
-
readonly stateMutability: "view";
|
|
24
|
-
readonly type: "function";
|
|
25
|
-
}, {
|
|
26
|
-
readonly inputs: readonly [];
|
|
27
|
-
readonly name: "symbol";
|
|
28
|
-
readonly outputs: readonly [{
|
|
29
|
-
readonly internalType: "string";
|
|
30
|
-
readonly name: "";
|
|
31
|
-
readonly type: "string";
|
|
32
|
-
}];
|
|
33
|
-
readonly stateMutability: "view";
|
|
34
|
-
readonly type: "function";
|
|
35
|
-
}];
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ABI_bondKit = void 0;
|
|
4
|
-
exports.ABI_bondKit = [
|
|
5
|
-
{
|
|
6
|
-
inputs: [
|
|
7
|
-
{ internalType: "address", name: "_recipient", type: "address" },
|
|
8
|
-
{ internalType: "uint256", name: "_minTokensOut", type: "uint256" },
|
|
9
|
-
],
|
|
10
|
-
name: "buyFor",
|
|
11
|
-
outputs: [],
|
|
12
|
-
stateMutability: "payable",
|
|
13
|
-
type: "function",
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
inputs: [],
|
|
17
|
-
name: "name",
|
|
18
|
-
outputs: [{ internalType: "string", name: "", type: "string" }],
|
|
19
|
-
stateMutability: "view",
|
|
20
|
-
type: "function",
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
inputs: [],
|
|
24
|
-
name: "symbol",
|
|
25
|
-
outputs: [{ internalType: "string", name: "", type: "string" }],
|
|
26
|
-
stateMutability: "view",
|
|
27
|
-
type: "function",
|
|
28
|
-
},
|
|
29
|
-
];
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export declare const ABI_bondKit: readonly [{
|
|
2
|
-
readonly inputs: readonly [{
|
|
3
|
-
readonly internalType: "address";
|
|
4
|
-
readonly name: "_recipient";
|
|
5
|
-
readonly type: "address";
|
|
6
|
-
}, {
|
|
7
|
-
readonly internalType: "uint256";
|
|
8
|
-
readonly name: "_minTokensOut";
|
|
9
|
-
readonly type: "uint256";
|
|
10
|
-
}];
|
|
11
|
-
readonly name: "buyFor";
|
|
12
|
-
readonly outputs: readonly [];
|
|
13
|
-
readonly stateMutability: "payable";
|
|
14
|
-
readonly type: "function";
|
|
15
|
-
}, {
|
|
16
|
-
readonly inputs: readonly [];
|
|
17
|
-
readonly name: "name";
|
|
18
|
-
readonly outputs: readonly [{
|
|
19
|
-
readonly internalType: "string";
|
|
20
|
-
readonly name: "";
|
|
21
|
-
readonly type: "string";
|
|
22
|
-
}];
|
|
23
|
-
readonly stateMutability: "view";
|
|
24
|
-
readonly type: "function";
|
|
25
|
-
}, {
|
|
26
|
-
readonly inputs: readonly [];
|
|
27
|
-
readonly name: "symbol";
|
|
28
|
-
readonly outputs: readonly [{
|
|
29
|
-
readonly internalType: "string";
|
|
30
|
-
readonly name: "";
|
|
31
|
-
readonly type: "string";
|
|
32
|
-
}];
|
|
33
|
-
readonly stateMutability: "view";
|
|
34
|
-
readonly type: "function";
|
|
35
|
-
}];
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export const ABI_bondKit = [
|
|
2
|
-
{
|
|
3
|
-
inputs: [
|
|
4
|
-
{ internalType: "address", name: "_recipient", type: "address" },
|
|
5
|
-
{ internalType: "uint256", name: "_minTokensOut", type: "uint256" },
|
|
6
|
-
],
|
|
7
|
-
name: "buyFor",
|
|
8
|
-
outputs: [],
|
|
9
|
-
stateMutability: "payable",
|
|
10
|
-
type: "function",
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
inputs: [],
|
|
14
|
-
name: "name",
|
|
15
|
-
outputs: [{ internalType: "string", name: "", type: "string" }],
|
|
16
|
-
stateMutability: "view",
|
|
17
|
-
type: "function",
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
inputs: [],
|
|
21
|
-
name: "symbol",
|
|
22
|
-
outputs: [{ internalType: "string", name: "", type: "string" }],
|
|
23
|
-
stateMutability: "view",
|
|
24
|
-
type: "function",
|
|
25
|
-
},
|
|
26
|
-
];
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export declare const ABI_bondKit: readonly [{
|
|
2
|
-
readonly inputs: readonly [{
|
|
3
|
-
readonly internalType: "address";
|
|
4
|
-
readonly name: "_recipient";
|
|
5
|
-
readonly type: "address";
|
|
6
|
-
}, {
|
|
7
|
-
readonly internalType: "uint256";
|
|
8
|
-
readonly name: "_minTokensOut";
|
|
9
|
-
readonly type: "uint256";
|
|
10
|
-
}];
|
|
11
|
-
readonly name: "buyFor";
|
|
12
|
-
readonly outputs: readonly [];
|
|
13
|
-
readonly stateMutability: "payable";
|
|
14
|
-
readonly type: "function";
|
|
15
|
-
}, {
|
|
16
|
-
readonly inputs: readonly [];
|
|
17
|
-
readonly name: "name";
|
|
18
|
-
readonly outputs: readonly [{
|
|
19
|
-
readonly internalType: "string";
|
|
20
|
-
readonly name: "";
|
|
21
|
-
readonly type: "string";
|
|
22
|
-
}];
|
|
23
|
-
readonly stateMutability: "view";
|
|
24
|
-
readonly type: "function";
|
|
25
|
-
}, {
|
|
26
|
-
readonly inputs: readonly [];
|
|
27
|
-
readonly name: "symbol";
|
|
28
|
-
readonly outputs: readonly [{
|
|
29
|
-
readonly internalType: "string";
|
|
30
|
-
readonly name: "";
|
|
31
|
-
readonly type: "string";
|
|
32
|
-
}];
|
|
33
|
-
readonly stateMutability: "view";
|
|
34
|
-
readonly type: "function";
|
|
35
|
-
}];
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export const ABI_bondKit = [
|
|
2
|
-
{
|
|
3
|
-
inputs: [
|
|
4
|
-
{ internalType: "address", name: "_recipient", type: "address" },
|
|
5
|
-
{ internalType: "uint256", name: "_minTokensOut", type: "uint256" },
|
|
6
|
-
],
|
|
7
|
-
name: "buyFor",
|
|
8
|
-
outputs: [],
|
|
9
|
-
stateMutability: "payable",
|
|
10
|
-
type: "function",
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
inputs: [],
|
|
14
|
-
name: "name",
|
|
15
|
-
outputs: [{ internalType: "string", name: "", type: "string" }],
|
|
16
|
-
stateMutability: "view",
|
|
17
|
-
type: "function",
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
inputs: [],
|
|
21
|
-
name: "symbol",
|
|
22
|
-
outputs: [{ internalType: "string", name: "", type: "string" }],
|
|
23
|
-
stateMutability: "view",
|
|
24
|
-
type: "function",
|
|
25
|
-
},
|
|
26
|
-
] as const;
|