@b3dotfun/sdk 0.0.40-test.6 → 0.0.41-test.0
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 +0 -1
- package/dist/cjs/anyspend/constants/index.js +1 -2
- package/dist/cjs/anyspend/react/components/AnySpend.d.ts +10 -1
- package/dist/cjs/anyspend/react/components/AnySpend.js +12 -9
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +8 -9
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +8 -0
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +10 -8
- package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.js +7 -4
- package/dist/cjs/anyspend/react/components/common/CryptoPaySection.d.ts +4 -1
- package/dist/cjs/anyspend/react/components/common/CryptoPaySection.js +9 -9
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +80 -10
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +39 -37
- package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +24 -23
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +9 -8
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.d.ts +4 -1
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.js +23 -9
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +7 -6
- package/dist/cjs/anyspend/react/components/common/PaymentMethodSwitch.d.ts +7 -0
- package/dist/cjs/anyspend/react/components/common/PaymentMethodSwitch.js +24 -0
- package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.d.ts +6 -0
- package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.js +14 -0
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.js +6 -4
- package/dist/cjs/anyspend/react/contexts/FeatureFlagsContext.d.ts +11 -0
- package/dist/cjs/anyspend/react/contexts/FeatureFlagsContext.js +21 -0
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +13 -5
- package/dist/cjs/anyspend/react/providers/AnyspendProvider.d.ts +5 -2
- package/dist/cjs/anyspend/react/providers/AnyspendProvider.js +5 -3
- package/dist/cjs/anyspend/react/providers/index.d.ts +1 -0
- package/dist/cjs/anyspend/react/providers/index.js +3 -0
- package/dist/cjs/anyspend/types/api.d.ts +10 -0
- package/dist/cjs/anyspend/utils/chain.js +1 -1
- package/dist/cjs/bondkit/bondkitToken.d.ts +37 -2
- package/dist/cjs/bondkit/bondkitToken.js +268 -2
- package/dist/cjs/bondkit/bondkitTokenFactory.d.ts +1 -1
- package/dist/cjs/bondkit/bondkitTokenFactory.js +2 -2
- package/dist/cjs/bondkit/config.d.ts +1 -1
- package/dist/cjs/bondkit/config.js +5 -2
- package/dist/cjs/bondkit/constants.d.ts +4 -0
- package/dist/cjs/bondkit/constants.js +6 -1
- package/dist/cjs/bondkit/index.d.ts +1 -0
- package/dist/cjs/bondkit/index.js +4 -1
- package/dist/cjs/bondkit/swapService.d.ts +43 -0
- package/dist/cjs/bondkit/swapService.js +373 -0
- package/dist/cjs/bondkit/types.d.ts +10 -4
- package/dist/cjs/bondkit/types.js +4 -5
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +2 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +14 -19
- package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.js +63 -3
- package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +35 -2
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +4 -3
- package/dist/cjs/global-account/react/hooks/useAccountWallet.js +0 -12
- package/dist/cjs/global-account/react/hooks/useAuthentication.js +1 -2
- package/dist/cjs/global-account/react/hooks/useSimBalance.js +2 -2
- package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +27 -22
- package/dist/esm/anyspend/constants/index.d.ts +0 -1
- package/dist/esm/anyspend/constants/index.js +0 -1
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +10 -1
- package/dist/esm/anyspend/react/components/AnySpend.js +13 -10
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +8 -9
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +8 -0
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +11 -9
- package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.d.ts +2 -1
- package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.js +8 -5
- package/dist/esm/anyspend/react/components/common/CryptoPaySection.d.ts +4 -1
- package/dist/esm/anyspend/react/components/common/CryptoPaySection.js +9 -9
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +80 -10
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +2 -1
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +39 -37
- package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +25 -24
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +10 -9
- package/dist/esm/anyspend/react/components/common/OrderTokenAmount.d.ts +4 -1
- package/dist/esm/anyspend/react/components/common/OrderTokenAmount.js +23 -9
- package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
- package/dist/esm/anyspend/react/components/common/PanelOnramp.js +7 -6
- package/dist/esm/anyspend/react/components/common/PaymentMethodSwitch.d.ts +7 -0
- package/dist/esm/anyspend/react/components/common/PaymentMethodSwitch.js +21 -0
- package/dist/esm/anyspend/react/components/common/PointsDetailPanel.d.ts +6 -0
- package/dist/esm/anyspend/react/components/common/PointsDetailPanel.js +8 -0
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.js +6 -4
- package/dist/esm/anyspend/react/contexts/FeatureFlagsContext.d.ts +11 -0
- package/dist/esm/anyspend/react/contexts/FeatureFlagsContext.js +17 -0
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +13 -5
- package/dist/esm/anyspend/react/providers/AnyspendProvider.d.ts +5 -2
- package/dist/esm/anyspend/react/providers/AnyspendProvider.js +5 -3
- package/dist/esm/anyspend/react/providers/index.d.ts +1 -0
- package/dist/esm/anyspend/react/providers/index.js +1 -0
- package/dist/esm/anyspend/types/api.d.ts +10 -0
- package/dist/esm/anyspend/utils/chain.js +1 -1
- package/dist/esm/bondkit/bondkitToken.d.ts +37 -2
- package/dist/esm/bondkit/bondkitToken.js +268 -2
- package/dist/esm/bondkit/bondkitTokenFactory.d.ts +1 -1
- package/dist/esm/bondkit/bondkitTokenFactory.js +2 -2
- package/dist/esm/bondkit/config.d.ts +1 -1
- package/dist/esm/bondkit/config.js +5 -2
- package/dist/esm/bondkit/constants.d.ts +4 -0
- package/dist/esm/bondkit/constants.js +5 -0
- package/dist/esm/bondkit/index.d.ts +1 -0
- package/dist/esm/bondkit/index.js +2 -0
- package/dist/esm/bondkit/swapService.d.ts +43 -0
- package/dist/esm/bondkit/swapService.js +369 -0
- package/dist/esm/bondkit/types.d.ts +10 -4
- package/dist/esm/bondkit/types.js +4 -5
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +2 -1
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +14 -19
- package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +65 -5
- package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +35 -2
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +3 -2
- package/dist/esm/global-account/react/hooks/useAccountWallet.js +0 -12
- package/dist/esm/global-account/react/hooks/useAuthentication.js +1 -2
- package/dist/esm/global-account/react/hooks/useSimBalance.js +2 -2
- package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +27 -22
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/constants/index.d.ts +0 -1
- package/dist/types/anyspend/react/components/AnySpend.d.ts +10 -1
- package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +8 -0
- package/dist/types/anyspend/react/components/common/ConnectWalletPayment.d.ts +2 -1
- package/dist/types/anyspend/react/components/common/CryptoPaySection.d.ts +4 -1
- package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +2 -1
- package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +2 -0
- package/dist/types/anyspend/react/components/common/OrderTokenAmount.d.ts +4 -1
- package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
- package/dist/types/anyspend/react/components/common/PaymentMethodSwitch.d.ts +7 -0
- package/dist/types/anyspend/react/components/common/PointsDetailPanel.d.ts +6 -0
- package/dist/types/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
- package/dist/types/anyspend/react/contexts/FeatureFlagsContext.d.ts +11 -0
- package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -1
- package/dist/types/anyspend/react/providers/AnyspendProvider.d.ts +5 -2
- package/dist/types/anyspend/react/providers/index.d.ts +1 -0
- package/dist/types/anyspend/types/api.d.ts +10 -0
- package/dist/types/bondkit/bondkitToken.d.ts +37 -2
- package/dist/types/bondkit/bondkitTokenFactory.d.ts +1 -1
- package/dist/types/bondkit/config.d.ts +1 -1
- package/dist/types/bondkit/constants.d.ts +4 -0
- package/dist/types/bondkit/index.d.ts +1 -0
- package/dist/types/bondkit/swapService.d.ts +43 -0
- package/dist/types/bondkit/types.d.ts +10 -4
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +2 -1
- package/package.json +2 -1
- package/src/anyspend/constants/index.ts +0 -2
- package/src/anyspend/react/components/AnySpend.tsx +38 -17
- package/src/anyspend/react/components/AnySpendCustom.tsx +19 -21
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +38 -18
- package/src/anyspend/react/components/common/ConnectWalletPayment.tsx +12 -4
- package/src/anyspend/react/components/common/CryptoPaySection.tsx +13 -8
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +170 -44
- package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +63 -45
- package/src/anyspend/react/components/common/OrderDetails.tsx +60 -47
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +62 -41
- package/src/anyspend/react/components/common/OrderTokenAmount.tsx +28 -8
- package/src/anyspend/react/components/common/PanelOnramp.tsx +28 -15
- package/src/anyspend/react/components/common/PaymentMethodSwitch.tsx +38 -0
- package/src/anyspend/react/components/common/PointsDetailPanel.tsx +55 -0
- package/src/anyspend/react/components/common/TransferCryptoDetails.tsx +65 -43
- package/src/anyspend/react/contexts/FeatureFlagsContext.tsx +34 -0
- package/src/anyspend/react/hooks/useAnyspendFlow.ts +13 -5
- package/src/anyspend/react/providers/AnyspendProvider.tsx +11 -6
- package/src/anyspend/react/providers/index.ts +1 -0
- package/src/anyspend/types/api.ts +10 -0
- package/src/anyspend/types/api_req_res.ts +6 -10
- package/src/anyspend/utils/chain.ts +1 -1
- package/src/bondkit/bondkitToken.ts +323 -3
- package/src/bondkit/bondkitTokenFactory.ts +2 -2
- package/src/bondkit/config.ts +5 -2
- package/src/bondkit/constants.ts +7 -0
- package/src/bondkit/index.ts +3 -0
- package/src/bondkit/swapService.ts +461 -0
- package/src/bondkit/types.ts +12 -5
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +17 -19
- package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +106 -32
- package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +60 -5
- package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +4 -2
- package/src/global-account/react/hooks/useAccountWallet.tsx +0 -13
- package/src/global-account/react/hooks/useAuthentication.ts +1 -2
- package/src/global-account/react/hooks/useSimBalance.ts +2 -2
- package/src/global-account/react/hooks/useUnifiedChainSwitchAndExecute.ts +28 -23
- package/dist/cjs/global-account/examples/client-selection-example.d.ts +0 -5
- package/dist/cjs/global-account/examples/client-selection-example.js +0 -96
- package/dist/esm/global-account/examples/client-selection-example.d.ts +0 -5
- package/dist/esm/global-account/examples/client-selection-example.js +0 -93
- package/dist/types/global-account/examples/client-selection-example.d.ts +0 -5
- package/src/global-account/docs/client-selection.md +0 -292
- package/src/global-account/examples/client-selection-example.tsx +0 -197
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
|
|
4
|
+
|
|
5
|
+
interface PaymentMethodSwitchProps {
|
|
6
|
+
currentMethod: CryptoPaymentMethodType;
|
|
7
|
+
onMethodChange?: (method: CryptoPaymentMethodType) => void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function PaymentMethodSwitch({ currentMethod, onMethodChange }: PaymentMethodSwitchProps) {
|
|
11
|
+
if (!onMethodChange) return null;
|
|
12
|
+
|
|
13
|
+
const isTransferCrypto = currentMethod === CryptoPaymentMethodType.TRANSFER_CRYPTO;
|
|
14
|
+
const isConnectWallet =
|
|
15
|
+
currentMethod === CryptoPaymentMethodType.CONNECT_WALLET || currentMethod === CryptoPaymentMethodType.GLOBAL_WALLET;
|
|
16
|
+
|
|
17
|
+
// Only show switch if we're in one of the payment states
|
|
18
|
+
if (!isTransferCrypto && !isConnectWallet) return null;
|
|
19
|
+
|
|
20
|
+
const handleSwitch = () => {
|
|
21
|
+
if (isTransferCrypto) {
|
|
22
|
+
onMethodChange(CryptoPaymentMethodType.CONNECT_WALLET);
|
|
23
|
+
} else {
|
|
24
|
+
onMethodChange(CryptoPaymentMethodType.TRANSFER_CRYPTO);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<div className="order-details-payment-switch-container flex items-center justify-center">
|
|
30
|
+
<button
|
|
31
|
+
onClick={handleSwitch}
|
|
32
|
+
className="order-details-payment-switch-btn text-as-primary/60 hover:text-as-primary text-sm underline transition-colors"
|
|
33
|
+
>
|
|
34
|
+
{isTransferCrypto ? "Switch to Connect Wallet" : "Switch to scan / manually send crypto"}
|
|
35
|
+
</button>
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Button, ShinyButton } from "@b3dotfun/sdk/global-account/react";
|
|
2
|
+
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
3
|
+
import { ArrowDown } from "lucide-react";
|
|
4
|
+
import Link from "next/link";
|
|
5
|
+
|
|
6
|
+
interface PointsDetailPanelProps {
|
|
7
|
+
pointsAmount?: number;
|
|
8
|
+
onBack: () => void;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function PointsDetailPanel({ pointsAmount = 0, onBack }: PointsDetailPanelProps) {
|
|
12
|
+
return (
|
|
13
|
+
<div className="mx-auto flex w-[460px] max-w-full flex-col items-center gap-4">
|
|
14
|
+
<div className="flex w-full items-center justify-between">
|
|
15
|
+
<Button
|
|
16
|
+
variant="ghost"
|
|
17
|
+
onClick={onBack}
|
|
18
|
+
className="text-as-primary/70 hover:text-as-primary flex items-center gap-2"
|
|
19
|
+
>
|
|
20
|
+
<ArrowDown className="h-4 w-4 rotate-90" />
|
|
21
|
+
Back
|
|
22
|
+
</Button>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<div className="flex flex-col items-center gap-4 text-center">
|
|
26
|
+
<h3 className="text-as-primary text-xl font-bold">Earn Points with Every Swap</h3>
|
|
27
|
+
<p className="text-as-primary/70 text-balance text-sm leading-relaxed">
|
|
28
|
+
You'll earn <span className="text-as-brand font-semibold">+{pointsAmount.toLocaleString()} points</span>{" "}
|
|
29
|
+
towards the{" "}
|
|
30
|
+
<Link href="https://anyspend.com/points" target="_blank" className="text-as-brand underline">
|
|
31
|
+
next AnySpend airdrop
|
|
32
|
+
</Link>{" "}
|
|
33
|
+
when you complete this transaction.
|
|
34
|
+
</p>
|
|
35
|
+
<div className="bg-as-surface-primary border-as-border-secondary mt-2 w-full rounded-lg border p-4 text-left">
|
|
36
|
+
<h4 className="text-as-primary mb-2 font-semibold">How it works:</h4>
|
|
37
|
+
<ul className="text-as-primary/70 space-y-1 text-sm">
|
|
38
|
+
<li>• Points are earned based on transaction volume</li>
|
|
39
|
+
<li>• Higher volume = more points</li>
|
|
40
|
+
<li>• Points contribute to future airdrops</li>
|
|
41
|
+
<li>• Keep swapping to maximize your rewards</li>
|
|
42
|
+
</ul>
|
|
43
|
+
</div>
|
|
44
|
+
<ShinyButton
|
|
45
|
+
accentColor={"hsl(var(--as-brand))"}
|
|
46
|
+
onClick={onBack}
|
|
47
|
+
className={cn("as-main-button !bg-as-brand relative w-full")}
|
|
48
|
+
textClassName={cn("text-white")}
|
|
49
|
+
>
|
|
50
|
+
Back to Swap
|
|
51
|
+
</ShinyButton>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
@@ -11,7 +11,9 @@ import { QRCodeSVG } from "qrcode.react";
|
|
|
11
11
|
import { memo, useEffect, useMemo, useState } from "react";
|
|
12
12
|
import { toast } from "sonner";
|
|
13
13
|
import { b3 } from "viem/chains";
|
|
14
|
+
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
|
|
14
15
|
import { OrderDetailsCollapsible } from "./OrderDetailsCollapsible";
|
|
16
|
+
import { PaymentMethodSwitch } from "./PaymentMethodSwitch";
|
|
15
17
|
|
|
16
18
|
type Order = components["schemas"]["Order"];
|
|
17
19
|
type Token = components["schemas"]["Token"];
|
|
@@ -26,6 +28,7 @@ interface TransferCryptoDetailsProps {
|
|
|
26
28
|
nft?: NFT;
|
|
27
29
|
onBack: () => void;
|
|
28
30
|
recipientName?: string;
|
|
31
|
+
onPaymentMethodChange?: (method: CryptoPaymentMethodType) => void;
|
|
29
32
|
}
|
|
30
33
|
|
|
31
34
|
export const TransferCryptoDetails = memo(function TransferCryptoDetails({
|
|
@@ -36,6 +39,7 @@ export const TransferCryptoDetails = memo(function TransferCryptoDetails({
|
|
|
36
39
|
nft,
|
|
37
40
|
onBack,
|
|
38
41
|
recipientName,
|
|
42
|
+
onPaymentMethodChange,
|
|
39
43
|
}: TransferCryptoDetailsProps) {
|
|
40
44
|
const [timeLeft, setTimeLeft] = useState(0);
|
|
41
45
|
|
|
@@ -98,21 +102,21 @@ export const TransferCryptoDetails = memo(function TransferCryptoDetails({
|
|
|
98
102
|
};
|
|
99
103
|
|
|
100
104
|
return (
|
|
101
|
-
<div className="flex w-full flex-col gap-6">
|
|
105
|
+
<div className="order-transfer-crypto flex w-full flex-col gap-6">
|
|
102
106
|
{/* Header */}
|
|
103
|
-
<div className="flex items-center justify-between">
|
|
107
|
+
<div className="order-transfer-crypto-header flex items-center justify-between">
|
|
104
108
|
<button
|
|
105
109
|
onClick={onBack}
|
|
106
|
-
className="text-as-primary/60 hover:text-as-primary flex h-10 w-10 items-center justify-center rounded-full transition-colors"
|
|
110
|
+
className="order-transfer-crypto-back-btn text-as-primary/60 hover:text-as-primary flex h-10 w-10 items-center justify-center rounded-full transition-colors"
|
|
107
111
|
>
|
|
108
112
|
<ChevronLeft size={24} className="text-as-quaternary" />
|
|
109
113
|
</button>
|
|
110
114
|
|
|
111
|
-
<h2 className="text-as-primary text-lg font-semibold">Transfer crypto</h2>
|
|
115
|
+
<h2 className="order-transfer-crypto-title text-as-primary text-lg font-semibold">Transfer crypto</h2>
|
|
112
116
|
|
|
113
117
|
{/* Countdown Timer */}
|
|
114
|
-
<div className="relative flex h-11 w-11 items-center justify-center">
|
|
115
|
-
<svg className="h-11 w-11 -rotate-90" viewBox="0 0 44 44">
|
|
118
|
+
<div className="order-transfer-crypto-timer relative flex h-11 w-11 items-center justify-center">
|
|
119
|
+
<svg className="order-transfer-crypto-timer-svg h-11 w-11 -rotate-90" viewBox="0 0 44 44">
|
|
116
120
|
<circle
|
|
117
121
|
cx="22"
|
|
118
122
|
cy="22"
|
|
@@ -120,7 +124,7 @@ export const TransferCryptoDetails = memo(function TransferCryptoDetails({
|
|
|
120
124
|
stroke="currentColor"
|
|
121
125
|
strokeWidth="3"
|
|
122
126
|
fill="none"
|
|
123
|
-
className="text-gray-200"
|
|
127
|
+
className="order-transfer-crypto-timer-bg text-gray-200"
|
|
124
128
|
/>
|
|
125
129
|
<circle
|
|
126
130
|
cx="22"
|
|
@@ -130,7 +134,7 @@ export const TransferCryptoDetails = memo(function TransferCryptoDetails({
|
|
|
130
134
|
strokeWidth="3"
|
|
131
135
|
fill="none"
|
|
132
136
|
strokeLinecap="round"
|
|
133
|
-
className="text-blue-500"
|
|
137
|
+
className="order-transfer-crypto-timer-progress text-blue-500"
|
|
134
138
|
strokeDasharray={`${2 * Math.PI * 18}`}
|
|
135
139
|
strokeDashoffset={`${2 * Math.PI * 18 * (1 - timeLeft / totalTime)}`}
|
|
136
140
|
style={{
|
|
@@ -138,57 +142,66 @@ export const TransferCryptoDetails = memo(function TransferCryptoDetails({
|
|
|
138
142
|
}}
|
|
139
143
|
/>
|
|
140
144
|
</svg>
|
|
141
|
-
<div className="absolute inset-0 flex items-center justify-center">
|
|
145
|
+
<div className="order-transfer-crypto-timer-text absolute inset-0 flex items-center justify-center">
|
|
142
146
|
<span className="text-as-primary text-[10px] font-semibold">{formatTime(timeLeft)}</span>
|
|
143
147
|
</div>
|
|
144
148
|
</div>
|
|
145
149
|
</div>
|
|
146
150
|
|
|
147
151
|
{/* Main Content Cards */}
|
|
148
|
-
<div className="flex w-full flex-col gap-4">
|
|
152
|
+
<div className="order-transfer-crypto-content flex w-full flex-col gap-4">
|
|
149
153
|
{/* Amount Card */}
|
|
150
|
-
<div className="flex items-center gap-4">
|
|
151
|
-
<div className="w-full">
|
|
152
|
-
<span className="text-as-content-secondary text-sm font-medium">
|
|
153
|
-
|
|
154
|
+
<div className="order-transfer-crypto-cards flex items-center gap-4">
|
|
155
|
+
<div className="order-transfer-crypto-amount-card w-full">
|
|
156
|
+
<span className="order-transfer-crypto-amount-label text-as-content-secondary text-sm font-medium">
|
|
157
|
+
Amount
|
|
158
|
+
</span>
|
|
159
|
+
<div className="order-transfer-crypto-amount-container border-as-border-primary rounded-lg border p-2 shadow-sm">
|
|
154
160
|
<CopyToClipboard
|
|
155
161
|
text={roundedUpSrcAmount || ""}
|
|
156
162
|
onCopy={() => {
|
|
157
163
|
toast.success("Amount copied to clipboard");
|
|
158
164
|
}}
|
|
159
165
|
>
|
|
160
|
-
<div className="flex cursor-pointer items-center justify-between gap-2">
|
|
161
|
-
<strong className="text-as-primary font-semibold">
|
|
166
|
+
<div className="order-transfer-crypto-amount-copy flex cursor-pointer items-center justify-between gap-2">
|
|
167
|
+
<strong className="order-transfer-crypto-amount-text text-as-primary font-semibold">
|
|
162
168
|
{roundedUpSrcAmount} {srcToken.symbol}
|
|
163
169
|
</strong>
|
|
164
|
-
<Copy className="text-as-primary/50 hover:text-as-primary h-4 w-4 transition-all duration-200" />
|
|
170
|
+
<Copy className="order-transfer-crypto-amount-copy-icon text-as-primary/50 hover:text-as-primary h-4 w-4 transition-all duration-200" />
|
|
165
171
|
</div>
|
|
166
172
|
</CopyToClipboard>
|
|
167
173
|
</div>
|
|
168
174
|
</div>
|
|
169
175
|
|
|
170
176
|
{/* Chain Card */}
|
|
171
|
-
<div className="w-full">
|
|
172
|
-
<span className="text-as-content-secondary text-sm font-medium">
|
|
173
|
-
|
|
174
|
-
|
|
177
|
+
<div className="order-transfer-crypto-chain-card w-full">
|
|
178
|
+
<span className="order-transfer-crypto-chain-label text-as-content-secondary text-sm font-medium">
|
|
179
|
+
Chain
|
|
180
|
+
</span>
|
|
181
|
+
<div className="order-transfer-crypto-chain-container border-as-border-primary rounded-lg border p-2 shadow-sm">
|
|
182
|
+
<div className="order-transfer-crypto-chain-info flex items-center gap-2">
|
|
175
183
|
<img
|
|
176
184
|
src={ALL_CHAINS[order.srcChain].logoUrl}
|
|
177
185
|
alt={getChainName(order.srcChain)}
|
|
178
|
-
className={cn(
|
|
186
|
+
className={cn(
|
|
187
|
+
"order-transfer-crypto-chain-logo h-6 rounded-full",
|
|
188
|
+
order.srcChain === b3.id && "h-5 rounded-none",
|
|
189
|
+
)}
|
|
179
190
|
/>
|
|
180
|
-
<span className="text-as-primary text-sm font-semibold">
|
|
191
|
+
<span className="order-transfer-crypto-chain-name text-as-primary text-sm font-semibold">
|
|
192
|
+
{getChainName(order.srcChain)}
|
|
193
|
+
</span>
|
|
181
194
|
</div>
|
|
182
195
|
</div>
|
|
183
196
|
</div>
|
|
184
197
|
</div>
|
|
185
198
|
|
|
186
199
|
{/* QR Code and Deposit Address Card */}
|
|
187
|
-
<div className="border-b3-react-border bg-as-surface-secondary grid h-[220px] grid-cols-2 overflow-hidden rounded-xl border">
|
|
200
|
+
<div className="order-transfer-crypto-qr-deposit-card border-b3-react-border bg-as-surface-secondary grid h-[220px] grid-cols-2 overflow-hidden rounded-xl border">
|
|
188
201
|
{/* QR Code Section */}
|
|
189
|
-
<div className="border-as-border-primary h-full w-full border-r">
|
|
190
|
-
<div className="flex justify-center">
|
|
191
|
-
<div className="bg-as-surface-secondary flex flex-col items-center rounded-lg p-6">
|
|
202
|
+
<div className="order-transfer-crypto-qr-section border-as-border-primary h-full w-full border-r">
|
|
203
|
+
<div className="order-transfer-crypto-qr-wrapper flex justify-center">
|
|
204
|
+
<div className="order-transfer-crypto-qr-container bg-as-surface-secondary flex flex-col items-center rounded-lg p-6">
|
|
192
205
|
<QRCodeSVG
|
|
193
206
|
value={getPaymentUrl(
|
|
194
207
|
order.globalAddress,
|
|
@@ -197,15 +210,17 @@ export const TransferCryptoDetails = memo(function TransferCryptoDetails({
|
|
|
197
210
|
order.srcChain,
|
|
198
211
|
srcToken?.decimals,
|
|
199
212
|
)}
|
|
200
|
-
className="bg-as-surface-secondary max-h-48 max-w-48"
|
|
213
|
+
className="order-transfer-crypto-qr-code bg-as-surface-secondary max-h-48 max-w-48"
|
|
201
214
|
/>
|
|
202
|
-
<div className="mt-3 flex items-center justify-center gap-2 text-sm">
|
|
203
|
-
<span className="text-as-brand/70 text-sm font-medium">
|
|
215
|
+
<div className="order-transfer-crypto-wallet-hint mt-3 flex items-center justify-center gap-2 text-sm">
|
|
216
|
+
<span className="order-transfer-crypto-wallet-text text-as-brand/70 text-sm font-medium">
|
|
217
|
+
SCAN WITH
|
|
218
|
+
</span>
|
|
204
219
|
<TextLoop interval={3}>
|
|
205
|
-
<WalletMetamask className="h-5 w-5" variant="branded" />
|
|
206
|
-
<WalletCoinbase className="h-5 w-5" variant="branded" />
|
|
207
|
-
<WalletPhantom className="h-5 w-5" variant="branded" />
|
|
208
|
-
<WalletTrust className="h-5 w-5" variant="branded" />
|
|
220
|
+
<WalletMetamask className="order-transfer-crypto-wallet-icon h-5 w-5" variant="branded" />
|
|
221
|
+
<WalletCoinbase className="order-transfer-crypto-wallet-icon h-5 w-5" variant="branded" />
|
|
222
|
+
<WalletPhantom className="order-transfer-crypto-wallet-icon h-5 w-5" variant="branded" />
|
|
223
|
+
<WalletTrust className="order-transfer-crypto-wallet-icon h-5 w-5" variant="branded" />
|
|
209
224
|
</TextLoop>
|
|
210
225
|
</div>
|
|
211
226
|
</div>
|
|
@@ -213,17 +228,19 @@ export const TransferCryptoDetails = memo(function TransferCryptoDetails({
|
|
|
213
228
|
</div>
|
|
214
229
|
|
|
215
230
|
{/* Deposit Address Section */}
|
|
216
|
-
<div className="flex h-full w-full flex-col gap-2 p-6">
|
|
217
|
-
<span className="text-as-content-secondary text-sm font-medium">
|
|
231
|
+
<div className="order-transfer-crypto-address-section flex h-full w-full flex-col gap-2 p-6">
|
|
232
|
+
<span className="order-transfer-crypto-address-label text-as-content-secondary text-sm font-medium">
|
|
233
|
+
Deposit address:
|
|
234
|
+
</span>
|
|
218
235
|
<div
|
|
219
|
-
className="flex h-full cursor-pointer flex-col items-stretch justify-between gap-4"
|
|
236
|
+
className="order-transfer-crypto-address-copy flex h-full cursor-pointer flex-col items-stretch justify-between gap-4"
|
|
220
237
|
onClick={handleCopyAddress}
|
|
221
238
|
>
|
|
222
|
-
<div className="text-as-primary break-all font-mono text-sm font-semibold leading-relaxed">
|
|
239
|
+
<div className="order-transfer-crypto-address-text text-as-primary break-all font-mono text-sm font-semibold leading-relaxed">
|
|
223
240
|
{order.globalAddress}
|
|
224
241
|
</div>
|
|
225
|
-
<div className="place-self-end">
|
|
226
|
-
<Copy className="group-hover:text-as-brand text-as-tertiarry h-4 w-4 cursor-pointer transition-all duration-200" />
|
|
242
|
+
<div className="order-transfer-crypto-address-copy-icon-wrapper place-self-end">
|
|
243
|
+
<Copy className="order-transfer-crypto-address-copy-icon group-hover:text-as-brand text-as-tertiarry h-4 w-4 cursor-pointer transition-all duration-200" />
|
|
227
244
|
</div>
|
|
228
245
|
</div>
|
|
229
246
|
</div>
|
|
@@ -240,23 +257,28 @@ export const TransferCryptoDetails = memo(function TransferCryptoDetails({
|
|
|
240
257
|
</div>
|
|
241
258
|
|
|
242
259
|
{/* Action Buttons */}
|
|
243
|
-
<div className="flex flex-col gap-3">
|
|
260
|
+
<div className="order-transfer-crypto-actions flex flex-col gap-3">
|
|
244
261
|
<ShinyButton
|
|
245
262
|
accentColor="hsl(var(--as-brand))"
|
|
246
263
|
textColor="text-white"
|
|
247
|
-
className="w-full py-3"
|
|
264
|
+
className="order-transfer-crypto-copy-btn w-full py-3"
|
|
248
265
|
onClick={handleCopyAddress}
|
|
249
266
|
>
|
|
250
267
|
Copy deposit address
|
|
251
268
|
</ShinyButton>
|
|
252
269
|
|
|
253
270
|
{/* <button
|
|
254
|
-
className="text-as-primary/60 hover:text-as-primary flex w-full items-center justify-center gap-2 py-2 transition-colors"
|
|
271
|
+
className="order-transfer-crypto-cancel-btn text-as-primary/60 hover:text-as-primary flex w-full items-center justify-center gap-2 py-2 transition-colors"
|
|
255
272
|
onClick={onBack}
|
|
256
273
|
>
|
|
257
274
|
<RefreshCcw className="h-4 w-4" />
|
|
258
275
|
Cancel and start over
|
|
259
276
|
</button> */}
|
|
277
|
+
|
|
278
|
+
<PaymentMethodSwitch
|
|
279
|
+
currentMethod={CryptoPaymentMethodType.TRANSFER_CRYPTO}
|
|
280
|
+
onMethodChange={onPaymentMethodChange}
|
|
281
|
+
/>
|
|
260
282
|
</div>
|
|
261
283
|
</div>
|
|
262
284
|
);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { createContext, useContext, ReactNode } from "react";
|
|
4
|
+
|
|
5
|
+
export interface FeatureFlags {
|
|
6
|
+
showPoints?: boolean;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface FeatureFlagsContextType {
|
|
10
|
+
featureFlags: FeatureFlags;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const FeatureFlagsContext = createContext<FeatureFlagsContextType | undefined>(undefined);
|
|
14
|
+
|
|
15
|
+
interface FeatureFlagsProviderProps {
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
featureFlags?: FeatureFlags;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const defaultFeatureFlags: FeatureFlags = {
|
|
21
|
+
showPoints: false,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export function FeatureFlagsProvider({ children, featureFlags = defaultFeatureFlags }: FeatureFlagsProviderProps) {
|
|
25
|
+
return <FeatureFlagsContext.Provider value={{ featureFlags }}>{children}</FeatureFlagsContext.Provider>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function useFeatureFlags(): FeatureFlags {
|
|
29
|
+
const context = useContext(FeatureFlagsContext);
|
|
30
|
+
if (!context) {
|
|
31
|
+
return defaultFeatureFlags;
|
|
32
|
+
}
|
|
33
|
+
return context.featureFlags;
|
|
34
|
+
}
|
|
@@ -31,6 +31,7 @@ export enum PanelView {
|
|
|
31
31
|
RECIPIENT_SELECTION,
|
|
32
32
|
ORDER_DETAILS,
|
|
33
33
|
LOADING,
|
|
34
|
+
POINTS_DETAIL,
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
interface UseAnyspendFlowProps {
|
|
@@ -244,12 +245,19 @@ export function useAnyspendFlow({
|
|
|
244
245
|
// Handle order completion
|
|
245
246
|
useEffect(() => {
|
|
246
247
|
if (oat?.data?.order.status === "executed") {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
const
|
|
250
|
-
|
|
248
|
+
// get the actualDstAmount if available from custompayload
|
|
249
|
+
const amount = (oat.data.order.payload as { actualDstAmount?: string })?.actualDstAmount;
|
|
250
|
+
const formattedActualDstAmount = amount
|
|
251
|
+
? formatTokenAmount(BigInt(amount), oat.data.order.metadata.dstToken.decimals)
|
|
252
|
+
: undefined;
|
|
253
|
+
onTransactionSuccess?.(formattedActualDstAmount);
|
|
251
254
|
}
|
|
252
|
-
}, [
|
|
255
|
+
}, [
|
|
256
|
+
oat?.data?.order.status,
|
|
257
|
+
oat?.data?.order.payload,
|
|
258
|
+
onTransactionSuccess,
|
|
259
|
+
oat?.data?.order.metadata.dstToken.decimals,
|
|
260
|
+
]);
|
|
253
261
|
|
|
254
262
|
return {
|
|
255
263
|
// State
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
import { TooltipProvider } from "@b3dotfun/sdk/global-account/react";
|
|
4
4
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
5
5
|
import { ReactNode, useState } from "react";
|
|
6
|
+
import { FeatureFlags, FeatureFlagsProvider } from "../contexts/FeatureFlagsContext";
|
|
6
7
|
import { StripeRedirectHandler } from "./StripeRedirectHandler";
|
|
7
8
|
|
|
8
9
|
interface AnyspendProviderProps {
|
|
9
10
|
children: ReactNode;
|
|
11
|
+
featureFlags?: FeatureFlags;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
const defaultQueryClientConfig = {
|
|
@@ -29,27 +31,30 @@ const defaultQueryClientConfig = {
|
|
|
29
31
|
* - Safe to use at the application root
|
|
30
32
|
* - Configures sensible defaults for query caching
|
|
31
33
|
* - Handles Stripe payment redirects and modal state
|
|
34
|
+
* - Provides feature flags configuration
|
|
32
35
|
*
|
|
33
36
|
* @example
|
|
34
37
|
* ```tsx
|
|
35
38
|
* function App() {
|
|
36
39
|
* return (
|
|
37
|
-
* <AnyspendProvider>
|
|
40
|
+
* <AnyspendProvider featureFlags={{ showPoints: true }}>
|
|
38
41
|
* <YourApp />
|
|
39
42
|
* </AnyspendProvider>
|
|
40
43
|
* );
|
|
41
44
|
* }
|
|
42
45
|
* ```
|
|
43
46
|
*/
|
|
44
|
-
export const AnyspendProvider = function AnyspendProvider({ children }: AnyspendProviderProps) {
|
|
47
|
+
export const AnyspendProvider = function AnyspendProvider({ children, featureFlags }: AnyspendProviderProps) {
|
|
45
48
|
const [queryClient] = useState(() => new QueryClient(defaultQueryClientConfig));
|
|
46
49
|
|
|
47
50
|
return (
|
|
48
51
|
<QueryClientProvider client={queryClient}>
|
|
49
|
-
<
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
<FeatureFlagsProvider featureFlags={featureFlags}>
|
|
53
|
+
<TooltipProvider>
|
|
54
|
+
<StripeRedirectHandler />
|
|
55
|
+
{children}
|
|
56
|
+
</TooltipProvider>
|
|
57
|
+
</FeatureFlagsProvider>
|
|
53
58
|
</QueryClientProvider>
|
|
54
59
|
);
|
|
55
60
|
};
|
|
@@ -805,6 +805,16 @@ export interface paths {
|
|
|
805
805
|
* @example 0
|
|
806
806
|
*/
|
|
807
807
|
userBalance?: string;
|
|
808
|
+
/**
|
|
809
|
+
* @description Anyspend points that will be awarded for the order
|
|
810
|
+
* @example 100
|
|
811
|
+
*/
|
|
812
|
+
pointsAmount?: number;
|
|
813
|
+
/**
|
|
814
|
+
* @description Multiplier applied to points that will be awarded for the order
|
|
815
|
+
* @example 1.5
|
|
816
|
+
*/
|
|
817
|
+
pointsMultiplier?: number;
|
|
808
818
|
};
|
|
809
819
|
/** @example 200 */
|
|
810
820
|
statusCode: number;
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import { paths } from "./api";
|
|
2
2
|
|
|
3
|
-
export type GetOrderAndTxsResponse =
|
|
4
|
-
paths["/orders/{orderId}"]["get"]["responses"]["200"]["content"]["application/json"];
|
|
3
|
+
export type GetOrderAndTxsResponse = paths["/orders/{orderId}"]["get"]["responses"]["200"]["content"]["application/json"];
|
|
5
4
|
export type GetQuoteRequest = paths["/orders/quote"]["post"]["requestBody"]["content"]["application/json"];
|
|
6
5
|
export type GetQuoteResponse = paths["/orders/quote"]["post"]["responses"]["200"]["content"]["application/json"];
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
|
|
7
|
+
export type GetCoinbaseOnrampOptionsResponse = paths["/onramp/coinbase/options"]["get"]["responses"]["200"]["content"]["application/json"];
|
|
9
8
|
export type GetOrderHistoryResponse = paths["/orders"]["get"]["responses"]["200"]["content"]["application/json"];
|
|
10
|
-
export type GetTokenListResponse =
|
|
11
|
-
paths["/chains/{chainId}/tokens"]["get"]["responses"]["200"]["content"]["application/json"];
|
|
9
|
+
export type GetTokenListResponse = paths["/chains/{chainId}/tokens"]["get"]["responses"]["200"]["content"]["application/json"];
|
|
12
10
|
export type CreateOrderResponse = paths["/orders"]["post"]["responses"]["200"]["content"]["application/json"];
|
|
13
|
-
export type GetStripeSupportedResponse =
|
|
14
|
-
|
|
15
|
-
export type GetStripeClientSecret =
|
|
16
|
-
paths["/stripe/clientSecret"]["get"]["responses"]["200"]["content"]["application/json"];
|
|
11
|
+
export type GetStripeSupportedResponse = paths["/onramp/stripe/supported"]["get"]["responses"]["200"]["content"]["application/json"];
|
|
12
|
+
export type GetStripeClientSecret = paths["/stripe/clientSecret"]["get"]["responses"]["200"]["content"]["application/json"];
|
|
@@ -149,7 +149,7 @@ export const EVM_MAINNET: Record<number, IEVMChain> = {
|
|
|
149
149
|
name: bsc.name,
|
|
150
150
|
logoUrl: "https://avatars.githubusercontent.com/u/45615063?s=280&v=4",
|
|
151
151
|
type: ChainType.EVM,
|
|
152
|
-
nativeRequired: parseEther("0.
|
|
152
|
+
nativeRequired: parseEther("0.0001"),
|
|
153
153
|
canDepositNative: true,
|
|
154
154
|
defaultToken: getBnbToken(),
|
|
155
155
|
nativeToken: getBnbToken(),
|