@b3dotfun/sdk 0.0.40-test.6 → 0.0.41-alpha.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 +11 -1
- package/dist/cjs/anyspend/react/components/AnySpend.js +22 -10
- package/dist/cjs/anyspend/react/components/AnySpendBondKit.js +0 -1
- package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +0 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +1 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +41 -20
- package/dist/cjs/anyspend/react/components/AnySpendNFT.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnySpendNFT.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +0 -1
- 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/AnyspendSignatureMint.js +1 -2
- 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 +40 -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 +10 -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/PointsBadge.d.ts +7 -0
- package/dist/cjs/anyspend/react/components/common/PointsBadge.js +7 -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 +18 -8
- 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/services/anyspend.d.ts +1 -1
- package/dist/cjs/anyspend/services/anyspend.js +2 -0
- package/dist/cjs/anyspend/types/api.d.ts +51 -1
- package/dist/cjs/anyspend/utils/chain.js +1 -1
- package/dist/cjs/anyspend/utils/orderPayload.js +3 -0
- 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/components/TradingView.js +3 -4
- 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 +376 -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 +27 -28
- 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/index.d.ts +1 -0
- package/dist/cjs/global-account/react/hooks/index.js +3 -1
- package/dist/cjs/global-account/react/hooks/useAccountAssets.js +5 -2
- package/dist/cjs/global-account/react/hooks/useAccountWallet.js +0 -12
- package/dist/cjs/global-account/react/hooks/useAuthentication.js +2 -3
- package/dist/cjs/global-account/react/hooks/useGlobalAccount.d.ts +6 -0
- package/dist/cjs/global-account/react/hooks/useGlobalAccount.js +32 -0
- package/dist/cjs/global-account/react/hooks/useQueryB3.js +5 -2
- package/dist/cjs/global-account/react/hooks/useQueryBSMNT.js +5 -2
- package/dist/cjs/global-account/react/hooks/useSimBalance.js +2 -2
- package/dist/cjs/global-account/react/hooks/useTokenBalancesByChain.js +7 -1
- package/dist/cjs/global-account/react/hooks/useTokenFromUrl.js +2 -2
- package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +28 -24
- package/dist/cjs/shared/utils/fetchBalances.d.ts +1 -1
- 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 +11 -1
- package/dist/esm/anyspend/react/components/AnySpend.js +23 -11
- package/dist/esm/anyspend/react/components/AnySpendBondKit.js +0 -1
- package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +0 -1
- package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +1 -0
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +41 -20
- package/dist/esm/anyspend/react/components/AnySpendNFT.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnySpendNFT.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +0 -1
- 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/AnyspendSignatureMint.js +1 -2
- 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 +40 -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 +10 -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/PointsBadge.d.ts +7 -0
- package/dist/esm/anyspend/react/components/common/PointsBadge.js +4 -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 +18 -8
- 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/services/anyspend.d.ts +1 -1
- package/dist/esm/anyspend/services/anyspend.js +2 -0
- package/dist/esm/anyspend/types/api.d.ts +51 -1
- package/dist/esm/anyspend/utils/chain.js +1 -1
- package/dist/esm/anyspend/utils/orderPayload.js +3 -0
- 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/components/TradingView.js +3 -4
- 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 +372 -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 +27 -28
- 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/index.d.ts +1 -0
- package/dist/esm/global-account/react/hooks/index.js +1 -0
- package/dist/esm/global-account/react/hooks/useAccountAssets.js +2 -2
- package/dist/esm/global-account/react/hooks/useAccountWallet.js +0 -12
- package/dist/esm/global-account/react/hooks/useAuthentication.js +2 -3
- package/dist/esm/global-account/react/hooks/useGlobalAccount.d.ts +6 -0
- package/dist/esm/global-account/react/hooks/useGlobalAccount.js +29 -0
- package/dist/esm/global-account/react/hooks/useQueryB3.js +5 -2
- package/dist/esm/global-account/react/hooks/useQueryBSMNT.js +5 -2
- package/dist/esm/global-account/react/hooks/useSimBalance.js +2 -2
- package/dist/esm/global-account/react/hooks/useTokenBalancesByChain.js +4 -1
- package/dist/esm/global-account/react/hooks/useTokenFromUrl.js +2 -2
- package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +29 -25
- package/dist/esm/shared/utils/fetchBalances.d.ts +1 -1
- 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 +11 -1
- package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +1 -0
- package/dist/types/anyspend/react/components/AnySpendNFT.d.ts +2 -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/PointsBadge.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/services/anyspend.d.ts +1 -1
- package/dist/types/anyspend/types/api.d.ts +51 -1
- 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/dist/types/global-account/react/hooks/index.d.ts +1 -0
- package/dist/types/global-account/react/hooks/useGlobalAccount.d.ts +6 -0
- package/dist/types/shared/utils/fetchBalances.d.ts +1 -1
- package/package.json +1 -1
- package/src/anyspend/constants/index.ts +0 -2
- package/src/anyspend/react/components/AnySpend.tsx +52 -18
- package/src/anyspend/react/components/AnySpendBondKit.tsx +0 -1
- package/src/anyspend/react/components/AnySpendBuySpin.tsx +0 -1
- package/src/anyspend/react/components/AnySpendCustom.tsx +82 -34
- package/src/anyspend/react/components/AnySpendNFT.tsx +3 -0
- package/src/anyspend/react/components/AnySpendStakeB3.tsx +0 -1
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +38 -18
- package/src/anyspend/react/components/AnyspendSignatureMint.tsx +1 -2
- 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 +61 -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/PointsBadge.tsx +20 -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 +18 -8
- package/src/anyspend/react/hooks/useAnyspendOrderAndTransactions.ts +1 -1
- package/src/anyspend/react/hooks/useCoinbaseOnrampOptions.ts +1 -1
- package/src/anyspend/react/providers/AnyspendProvider.tsx +11 -6
- package/src/anyspend/react/providers/index.ts +1 -0
- package/src/anyspend/services/anyspend.ts +3 -1
- package/src/anyspend/types/api.ts +51 -1
- package/src/anyspend/types/api_req_res.ts +6 -10
- package/src/anyspend/utils/chain.ts +1 -1
- package/src/anyspend/utils/orderPayload.ts +3 -0
- package/src/bondkit/bondkitToken.ts +323 -3
- package/src/bondkit/bondkitTokenFactory.ts +2 -2
- package/src/bondkit/components/TradingView.tsx +3 -5
- 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 +464 -0
- package/src/bondkit/types.ts +12 -5
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +31 -32
- 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/index.ts +1 -0
- package/src/global-account/react/hooks/useAccountAssets.ts +4 -3
- package/src/global-account/react/hooks/useAccountWallet.tsx +0 -13
- package/src/global-account/react/hooks/useAuthentication.ts +2 -3
- package/src/global-account/react/hooks/useGlobalAccount.tsx +36 -0
- package/src/global-account/react/hooks/useOneBalance.tsx +1 -1
- package/src/global-account/react/hooks/useQueryB3.ts +22 -15
- package/src/global-account/react/hooks/useQueryBSMNT.ts +22 -15
- package/src/global-account/react/hooks/useSimBalance.ts +2 -2
- package/src/global-account/react/hooks/useTokenBalancesByChain.tsx +4 -1
- package/src/global-account/react/hooks/useTokenFromUrl.tsx +2 -2
- package/src/global-account/react/hooks/useUnifiedChainSwitchAndExecute.ts +30 -26
- package/src/shared/utils/fetchBalances.ts +1 -1
- 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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { components } from "../../../../anyspend/types/api";
|
|
2
|
-
export declare function OrderTokenAmount({ disabled, inputValue, onChangeInput, context, address, chainId, setChainId, token, setToken, hideTokenSelect, canEditAmount, className, innerClassName, amountClassName, tokenSelectClassName, }: {
|
|
2
|
+
export declare function OrderTokenAmount({ disabled, inputValue, onChangeInput, context, address, chainId, setChainId, token, setToken, hideTokenSelect, canEditAmount, className, innerClassName, amountClassName, tokenSelectClassName, onTokenSelect, }: {
|
|
3
3
|
disabled?: boolean;
|
|
4
4
|
inputValue: string;
|
|
5
5
|
onChangeInput: (value: string) => void;
|
|
@@ -15,4 +15,7 @@ export declare function OrderTokenAmount({ disabled, inputValue, onChangeInput,
|
|
|
15
15
|
innerClassName?: string;
|
|
16
16
|
amountClassName?: string;
|
|
17
17
|
tokenSelectClassName?: string;
|
|
18
|
+
onTokenSelect?: (token: components["schemas"]["Token"], event: {
|
|
19
|
+
preventDefault: () => void;
|
|
20
|
+
}) => void;
|
|
18
21
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -8,7 +8,7 @@ import { Button } from "../../../../global-account/react/index.js";
|
|
|
8
8
|
import { cn } from "../../../../shared/utils/index.js";
|
|
9
9
|
import { TokenSelector } from "@reservoir0x/relay-kit-ui";
|
|
10
10
|
import { ChainTokenIcon } from "./ChainTokenIcon.js";
|
|
11
|
-
export function OrderTokenAmount({ disabled, inputValue, onChangeInput, context, address, chainId, setChainId, token, setToken, hideTokenSelect = false, canEditAmount = true, className, innerClassName, amountClassName, tokenSelectClassName, }) {
|
|
11
|
+
export function OrderTokenAmount({ disabled, inputValue, onChangeInput, context, address, chainId, setChainId, token, setToken, hideTokenSelect = false, canEditAmount = true, className, innerClassName, amountClassName, tokenSelectClassName, onTokenSelect, }) {
|
|
12
12
|
// Track previous token to detect changes
|
|
13
13
|
const prevTokenRef = useRef(token.address);
|
|
14
14
|
useEffect(() => {
|
|
@@ -25,19 +25,33 @@ export function OrderTokenAmount({ disabled, inputValue, onChangeInput, context,
|
|
|
25
25
|
}
|
|
26
26
|
}, [token.address, chainId, context, onChangeInput]);
|
|
27
27
|
const handleTokenSelect = (newToken) => {
|
|
28
|
-
|
|
29
|
-
prevTokenRef.current = "changing"; // Temporary value to force effect
|
|
30
|
-
// Set the chain ID first
|
|
31
|
-
setChainId(newToken.chainId);
|
|
32
|
-
// Then set the new token
|
|
33
|
-
setToken({
|
|
28
|
+
const token = {
|
|
34
29
|
address: newToken.address,
|
|
35
|
-
chainId: newToken.chainId,
|
|
30
|
+
chainId: newToken.chainId,
|
|
36
31
|
decimals: newToken.decimals,
|
|
37
32
|
metadata: { logoURI: newToken.logoURI },
|
|
38
33
|
name: newToken.name,
|
|
39
34
|
symbol: newToken.symbol,
|
|
40
|
-
}
|
|
35
|
+
};
|
|
36
|
+
// Call the onTokenSelect callback if provided
|
|
37
|
+
if (onTokenSelect) {
|
|
38
|
+
let isDefaultPrevented = false;
|
|
39
|
+
const event = {
|
|
40
|
+
preventDefault: () => {
|
|
41
|
+
isDefaultPrevented = true;
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
onTokenSelect(token, event);
|
|
45
|
+
if (isDefaultPrevented) {
|
|
46
|
+
return; // Early return if callback prevented default behavior
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
// Mark that we're about to change tokens
|
|
50
|
+
prevTokenRef.current = "changing"; // Temporary value to force effect
|
|
51
|
+
// Set the chain ID first
|
|
52
|
+
setChainId(newToken.chainId);
|
|
53
|
+
// Then set the new token
|
|
54
|
+
setToken(token);
|
|
41
55
|
// If this is the source token, reset the amount immediately
|
|
42
56
|
if (context === "from") {
|
|
43
57
|
onChangeInput("0.01");
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { components } from "../../../../anyspend/types/api";
|
|
2
|
+
import { GetQuoteResponse } from "../../../../anyspend/types/api_req_res";
|
|
2
3
|
import { FiatPaymentMethod } from "./FiatPaymentMethod";
|
|
3
|
-
export declare function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selectedPaymentMethod, setActivePanel, _recipientAddress, destinationToken, destinationChainId, destinationAmount, onDestinationTokenChange, onDestinationChainChange, fiatPaymentMethodIndex, recipientSelectionPanelIndex, dstTokenSymbol, hideDstToken, }: {
|
|
4
|
+
export declare function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selectedPaymentMethod, setActivePanel, _recipientAddress, destinationToken, destinationChainId, destinationAmount, onDestinationTokenChange, onDestinationChainChange, fiatPaymentMethodIndex, recipientSelectionPanelIndex, dstTokenSymbol, hideDstToken, anyspendQuote, onShowPointsDetail, }: {
|
|
4
5
|
srcAmountOnRamp: string;
|
|
5
6
|
setSrcAmountOnRamp: (amount: string) => void;
|
|
6
7
|
selectedPaymentMethod?: FiatPaymentMethod;
|
|
@@ -15,4 +16,6 @@ export declare function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selec
|
|
|
15
16
|
recipientSelectionPanelIndex: number;
|
|
16
17
|
dstTokenSymbol?: string;
|
|
17
18
|
hideDstToken?: boolean;
|
|
19
|
+
anyspendQuote?: GetQuoteResponse;
|
|
20
|
+
onShowPointsDetail?: () => void;
|
|
18
21
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,9 +7,12 @@ import { formatAddress } from "../../../../shared/utils/formatAddress.js";
|
|
|
7
7
|
import { ChevronRight, Wallet } from "lucide-react";
|
|
8
8
|
import { useRef } from "react";
|
|
9
9
|
import { toast } from "sonner";
|
|
10
|
+
import { useFeatureFlags } from "../../contexts/FeatureFlagsContext.js";
|
|
10
11
|
import { FiatPaymentMethod } from "./FiatPaymentMethod.js";
|
|
11
12
|
import { OrderTokenAmountFiat } from "./OrderTokenAmountFiat.js";
|
|
12
|
-
|
|
13
|
+
import { PointsBadge } from "./PointsBadge.js";
|
|
14
|
+
export function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selectedPaymentMethod, setActivePanel, _recipientAddress, destinationToken, destinationChainId, destinationAmount, onDestinationTokenChange, onDestinationChainChange, fiatPaymentMethodIndex, recipientSelectionPanelIndex, dstTokenSymbol, hideDstToken = false, anyspendQuote, onShowPointsDetail, }) {
|
|
15
|
+
const featureFlags = useFeatureFlags();
|
|
13
16
|
// Get geo-based onramp options to access fee information
|
|
14
17
|
const { stripeWeb2Support } = useGeoOnrampOptions(srcAmountOnRamp);
|
|
15
18
|
// Helper function to get fees from API data
|
|
@@ -70,9 +73,10 @@ export function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selectedPayme
|
|
|
70
73
|
width: `${Math.max(50, srcAmountOnRamp.length * 34)}px`,
|
|
71
74
|
} })] }) }), _jsx("div", { className: cn("mx-auto mb-6 inline-grid grid-cols-4 gap-2", hideDstToken && "mb-0"), children: ["5", "10", "20", "25"].map(value => (_jsxs("button", { onClick: () => handleQuickAmount(value), className: `bg-as-surface-secondary border-as-border-secondary hover:border-as-border-secondary h-7 w-14 rounded-lg border text-sm font-medium transition-all duration-200 ${srcAmountOnRamp === value
|
|
72
75
|
? "border-as-border-secondary bg-as-surface-secondary"
|
|
73
|
-
: "bg-as-surface-secondary hover:bg-as-surface-secondary"}`, children: ["$", value] }, value))) }), destinationToken && destinationChainId && !hideDstToken && (_jsx(OrderTokenAmountFiat, { address: _recipientAddress, context: "to", inputValue: destinationAmount || "0", onChangeInput: () => { }, chainId: destinationChainId, setChainId: onDestinationChainChange || (() => { }), token: destinationToken, setToken: onDestinationTokenChange || (() => { }) }))] }), _jsxs("div", { className: "border-as-border-secondary bg-as-surface-secondary mt-4 flex w-full flex-col gap-3 rounded-xl border p-4", children: [_jsxs("div", { className: "flex w-full items-center justify-between gap-2", children: [_jsx("span", { className: "text-as-tertiarry flex items-center text-sm", children: "Recipient" }), _recipientAddress ? (_jsxs("button", { className: "text-as-tertiarry flex h-7 items-center gap-1 text-sm transition-colors hover:text-blue-700", onClick: () => setActivePanel(recipientSelectionPanelIndex), children: [_jsx("span", { className: "text-sm", children: recipientName ? formatUsername(recipientName) : formatAddress(_recipientAddress) }), _jsx(ChevronRight, { size: 16 })] })) : (_jsxs("button", { className: "text-as-tertiarry flex h-7 items-center gap-1 text-sm transition-colors hover:text-blue-700", onClick: () => setActivePanel(5), children: [_jsx(Wallet, { className: "text-as-brand", size: 16 }), "Select recipient", _jsx(ChevronRight, { size: 16 })] }))] }), _jsx("div", { className: "divider w-full" }), _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "text-as-tertiarry text-sm", children: "Expected to receive" }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsxs("span", { className: "text-as-primary font-semibold", children: [destinationAmount || "0", " ", dstTokenSymbol || destinationToken?.symbol || ""] }), _jsxs("span", { className: "text-as-tertiarry text-sm", children: ["on ", destinationChainId ? ALL_CHAINS[destinationChainId]?.name : ""] }), destinationToken && destinationChainId && destinationToken.metadata?.logoURI && (_jsx("img", { src: ALL_CHAINS[destinationChainId]?.logoUrl, alt: "Chain", className: "h-4 w-4 rounded-full" }))] })] }), _jsx("div", { className: "divider w-full" }), _jsx("div", { className: "", children:
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
: "bg-as-surface-secondary hover:bg-as-surface-secondary"}`, children: ["$", value] }, value))) }), destinationToken && destinationChainId && !hideDstToken && (_jsx(OrderTokenAmountFiat, { address: _recipientAddress, context: "to", inputValue: destinationAmount || "0", onChangeInput: () => { }, chainId: destinationChainId, setChainId: onDestinationChainChange || (() => { }), token: destinationToken, setToken: onDestinationTokenChange || (() => { }) }))] }), _jsxs("div", { className: "border-as-border-secondary bg-as-surface-secondary mt-4 flex w-full flex-col gap-3 rounded-xl border p-4", children: [_jsxs("div", { className: "flex w-full items-center justify-between gap-2", children: [_jsx("span", { className: "text-as-tertiarry flex items-center text-sm", children: "Recipient" }), _recipientAddress ? (_jsxs("button", { className: "text-as-tertiarry flex h-7 items-center gap-1 text-sm transition-colors hover:text-blue-700", onClick: () => setActivePanel(recipientSelectionPanelIndex), children: [_jsx("span", { className: "text-sm", children: recipientName ? formatUsername(recipientName) : formatAddress(_recipientAddress) }), _jsx(ChevronRight, { size: 16 })] })) : (_jsxs("button", { className: "text-as-tertiarry flex h-7 items-center gap-1 text-sm transition-colors hover:text-blue-700", onClick: () => setActivePanel(5), children: [_jsx(Wallet, { className: "text-as-brand", size: 16 }), "Select recipient", _jsx(ChevronRight, { size: 16 })] }))] }), _jsx("div", { className: "divider w-full" }), _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "text-as-tertiarry text-sm", children: "Expected to receive" }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsxs("span", { className: "text-as-primary font-semibold", children: [destinationAmount || "0", " ", dstTokenSymbol || destinationToken?.symbol || ""] }), _jsxs("span", { className: "text-as-tertiarry text-sm", children: ["on ", destinationChainId ? ALL_CHAINS[destinationChainId]?.name : ""] }), destinationToken && destinationChainId && destinationToken.metadata?.logoURI && (_jsx("img", { src: ALL_CHAINS[destinationChainId]?.logoUrl, alt: "Chain", className: "h-4 w-4 rounded-full" }))] })] }), _jsx("div", { className: "divider w-full" }), _jsx("div", { className: "", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-as-tertiarry text-sm", children: (() => {
|
|
77
|
+
const fee = getFeeFromApi(selectedPaymentMethod || FiatPaymentMethod.NONE);
|
|
78
|
+
return fee !== null ? `Total (included $${fee.toFixed(2)} fee)` : "Total";
|
|
79
|
+
})() }), featureFlags.showPoints &&
|
|
80
|
+
anyspendQuote?.data?.pointsAmount &&
|
|
81
|
+
anyspendQuote?.data?.pointsAmount > 0 && (_jsx(PointsBadge, { pointsAmount: anyspendQuote.data.pointsAmount, pointsMultiplier: anyspendQuote.data.pointsMultiplier, onClick: () => onShowPointsDetail?.() }))] }), _jsxs("span", { className: "text-as-primary font-semibold", children: ["$", getTotalAmount(selectedPaymentMethod || FiatPaymentMethod.NONE).toFixed(2)] })] }) })] })] }));
|
|
78
82
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
|
|
2
|
+
interface PaymentMethodSwitchProps {
|
|
3
|
+
currentMethod: CryptoPaymentMethodType;
|
|
4
|
+
onMethodChange?: (method: CryptoPaymentMethodType) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function PaymentMethodSwitch({ currentMethod, onMethodChange }: PaymentMethodSwitchProps): import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod.js";
|
|
4
|
+
export function PaymentMethodSwitch({ currentMethod, onMethodChange }) {
|
|
5
|
+
if (!onMethodChange)
|
|
6
|
+
return null;
|
|
7
|
+
const isTransferCrypto = currentMethod === CryptoPaymentMethodType.TRANSFER_CRYPTO;
|
|
8
|
+
const isConnectWallet = currentMethod === CryptoPaymentMethodType.CONNECT_WALLET || currentMethod === CryptoPaymentMethodType.GLOBAL_WALLET;
|
|
9
|
+
// Only show switch if we're in one of the payment states
|
|
10
|
+
if (!isTransferCrypto && !isConnectWallet)
|
|
11
|
+
return null;
|
|
12
|
+
const handleSwitch = () => {
|
|
13
|
+
if (isTransferCrypto) {
|
|
14
|
+
onMethodChange(CryptoPaymentMethodType.CONNECT_WALLET);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
onMethodChange(CryptoPaymentMethodType.TRANSFER_CRYPTO);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
return (_jsx("div", { className: "order-details-payment-switch-container flex items-center justify-center", children: _jsx("button", { onClick: handleSwitch, className: "order-details-payment-switch-btn text-as-primary/60 hover:text-as-primary text-sm underline transition-colors", children: isTransferCrypto ? "Switch to Connect Wallet" : "Switch to scan / manually send crypto" }) }));
|
|
21
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export function PointsBadge({ pointsAmount, pointsMultiplier, onClick }) {
|
|
3
|
+
return (_jsxs("button", { className: "bg-as-brand hover:scale-102 active:scale-98 relative flex cursor-pointer items-center gap-1 rounded-lg px-2 py-1 transition-all", onClick: onClick, children: [_jsx("div", { className: "pointer-events-none absolute inset-0 h-full w-full rounded-lg border border-white/10 border-t-white/20 bg-gradient-to-b from-white/10 to-white/0" }), _jsxs("span", { className: "relative text-xs text-white", children: ["+", pointsAmount.toLocaleString(), " pts", pointsMultiplier && pointsMultiplier > 1 && _jsxs("span", { className: "ml-1 opacity-80", children: ["(", pointsMultiplier, "x)"] })] })] }));
|
|
4
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button, ShinyButton } from "../../../../global-account/react/index.js";
|
|
3
|
+
import { cn } from "../../../../shared/utils/cn.js";
|
|
4
|
+
import { ArrowDown } from "lucide-react";
|
|
5
|
+
import Link from "next/link";
|
|
6
|
+
export function PointsDetailPanel({ pointsAmount = 0, onBack }) {
|
|
7
|
+
return (_jsxs("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-4", children: [_jsx("div", { className: "flex w-full items-center justify-between", children: _jsxs(Button, { variant: "ghost", onClick: onBack, className: "text-as-primary/70 hover:text-as-primary flex items-center gap-2", children: [_jsx(ArrowDown, { className: "h-4 w-4 rotate-90" }), "Back"] }) }), _jsxs("div", { className: "flex flex-col items-center gap-4 text-center", children: [_jsx("h3", { className: "text-as-primary text-xl font-bold", children: "Earn Points with Every Swap" }), _jsxs("p", { className: "text-as-primary/70 text-balance text-sm leading-relaxed", children: ["You'll earn ", _jsxs("span", { className: "text-as-brand font-semibold", children: ["+", pointsAmount.toLocaleString(), " points"] }), " ", "towards the", " ", _jsx(Link, { href: "https://anyspend.com/points", target: "_blank", className: "text-as-brand underline", children: "next AnySpend airdrop" }), " ", "when you complete this transaction."] }), _jsxs("div", { className: "bg-as-surface-primary border-as-border-secondary mt-2 w-full rounded-lg border p-4 text-left", children: [_jsx("h4", { className: "text-as-primary mb-2 font-semibold", children: "How it works:" }), _jsxs("ul", { className: "text-as-primary/70 space-y-1 text-sm", children: [_jsx("li", { children: "\u2022 Points are earned based on transaction volume" }), _jsx("li", { children: "\u2022 Higher volume = more points" }), _jsx("li", { children: "\u2022 Points contribute to future airdrops" }), _jsx("li", { children: "\u2022 Keep swapping to maximize your rewards" })] })] }), _jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", onClick: onBack, className: cn("as-main-button !bg-as-brand relative w-full"), textClassName: cn("text-white"), children: "Back to Swap" })] })] }));
|
|
8
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { components } from "../../../../anyspend/types/api";
|
|
2
|
+
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
|
|
2
3
|
type Order = components["schemas"]["Order"];
|
|
3
4
|
type Token = components["schemas"]["Token"];
|
|
4
5
|
type Tournament = components["schemas"]["Tournament"];
|
|
@@ -11,6 +12,7 @@ interface TransferCryptoDetailsProps {
|
|
|
11
12
|
nft?: NFT;
|
|
12
13
|
onBack: () => void;
|
|
13
14
|
recipientName?: string;
|
|
15
|
+
onPaymentMethodChange?: (method: CryptoPaymentMethodType) => void;
|
|
14
16
|
}
|
|
15
17
|
export declare const TransferCryptoDetails: import("react").NamedExoticComponent<TransferCryptoDetailsProps>;
|
|
16
18
|
export {};
|
|
@@ -10,8 +10,10 @@ import { QRCodeSVG } from "qrcode.react";
|
|
|
10
10
|
import { memo, useEffect, useMemo, useState } from "react";
|
|
11
11
|
import { toast } from "sonner";
|
|
12
12
|
import { b3 } from "viem/chains";
|
|
13
|
+
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod.js";
|
|
13
14
|
import { OrderDetailsCollapsible } from "./OrderDetailsCollapsible.js";
|
|
14
|
-
|
|
15
|
+
import { PaymentMethodSwitch } from "./PaymentMethodSwitch.js";
|
|
16
|
+
export const TransferCryptoDetails = memo(function TransferCryptoDetails({ order, srcToken, dstToken, tournament, nft, onBack, recipientName, onPaymentMethodChange, }) {
|
|
15
17
|
const [timeLeft, setTimeLeft] = useState(0);
|
|
16
18
|
useEffect(() => {
|
|
17
19
|
const calculateTimeLeft = () => {
|
|
@@ -62,9 +64,9 @@ export const TransferCryptoDetails = memo(function TransferCryptoDetails({ order
|
|
|
62
64
|
navigator.clipboard.writeText(order.globalAddress);
|
|
63
65
|
toast.success("Deposit address copied to clipboard");
|
|
64
66
|
};
|
|
65
|
-
return (_jsxs("div", { className: "flex w-full flex-col gap-6", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("button", { onClick: onBack, className: "text-as-primary/60 hover:text-as-primary flex h-10 w-10 items-center justify-center rounded-full transition-colors", children: _jsx(ChevronLeft, { size: 24, className: "text-as-quaternary" }) }), _jsx("h2", { className: "text-as-primary text-lg font-semibold", children: "Transfer crypto" }), _jsxs("div", { className: "relative flex h-11 w-11 items-center justify-center", children: [_jsxs("svg", { className: "h-11 w-11 -rotate-90", viewBox: "0 0 44 44", children: [_jsx("circle", { cx: "22", cy: "22", r: "18", stroke: "currentColor", strokeWidth: "3", fill: "none", className: "text-gray-200" }), _jsx("circle", { cx: "22", cy: "22", r: "18", stroke: "currentColor", strokeWidth: "3", fill: "none", strokeLinecap: "round", className: "text-blue-500", strokeDasharray: `${2 * Math.PI * 18}`, strokeDashoffset: `${2 * Math.PI * 18 * (1 - timeLeft / totalTime)}`, style: {
|
|
67
|
+
return (_jsxs("div", { className: "order-transfer-crypto flex w-full flex-col gap-6", children: [_jsxs("div", { className: "order-transfer-crypto-header flex items-center justify-between", children: [_jsx("button", { onClick: onBack, 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", children: _jsx(ChevronLeft, { size: 24, className: "text-as-quaternary" }) }), _jsx("h2", { className: "order-transfer-crypto-title text-as-primary text-lg font-semibold", children: "Transfer crypto" }), _jsxs("div", { className: "order-transfer-crypto-timer relative flex h-11 w-11 items-center justify-center", children: [_jsxs("svg", { className: "order-transfer-crypto-timer-svg h-11 w-11 -rotate-90", viewBox: "0 0 44 44", children: [_jsx("circle", { cx: "22", cy: "22", r: "18", stroke: "currentColor", strokeWidth: "3", fill: "none", className: "order-transfer-crypto-timer-bg text-gray-200" }), _jsx("circle", { cx: "22", cy: "22", r: "18", stroke: "currentColor", strokeWidth: "3", fill: "none", strokeLinecap: "round", className: "order-transfer-crypto-timer-progress text-blue-500", strokeDasharray: `${2 * Math.PI * 18}`, strokeDashoffset: `${2 * Math.PI * 18 * (1 - timeLeft / totalTime)}`, style: {
|
|
66
68
|
transition: "stroke-dashoffset 1s linear",
|
|
67
|
-
} })] }), _jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: _jsx("span", { className: "text-as-primary text-[10px] font-semibold", children: formatTime(timeLeft) }) })] })] }), _jsxs("div", { className: "flex w-full flex-col gap-4", children: [_jsxs("div", { className: "flex items-center gap-4", children: [_jsxs("div", { className: "w-full", children: [_jsx("span", { className: "text-as-content-secondary text-sm font-medium", children: "Amount" }), _jsx("div", { className: "border-as-border-primary rounded-lg border p-2 shadow-sm", children: _jsx(CopyToClipboard, { text: roundedUpSrcAmount || "", onCopy: () => {
|
|
69
|
+
} })] }), _jsx("div", { className: "order-transfer-crypto-timer-text absolute inset-0 flex items-center justify-center", children: _jsx("span", { className: "text-as-primary text-[10px] font-semibold", children: formatTime(timeLeft) }) })] })] }), _jsxs("div", { className: "order-transfer-crypto-content flex w-full flex-col gap-4", children: [_jsxs("div", { className: "order-transfer-crypto-cards flex items-center gap-4", children: [_jsxs("div", { className: "order-transfer-crypto-amount-card w-full", children: [_jsx("span", { className: "order-transfer-crypto-amount-label text-as-content-secondary text-sm font-medium", children: "Amount" }), _jsx("div", { className: "order-transfer-crypto-amount-container border-as-border-primary rounded-lg border p-2 shadow-sm", children: _jsx(CopyToClipboard, { text: roundedUpSrcAmount || "", onCopy: () => {
|
|
68
70
|
toast.success("Amount copied to clipboard");
|
|
69
|
-
}, children: _jsxs("div", { className: "flex cursor-pointer items-center justify-between gap-2", children: [_jsxs("strong", { className: "text-as-primary font-semibold", children: [roundedUpSrcAmount, " ", srcToken.symbol] }), _jsx(Copy, { className: "text-as-primary/50 hover:text-as-primary h-4 w-4 transition-all duration-200" })] }) }) })] }), _jsxs("div", { className: "w-full", children: [_jsx("span", { className: "text-as-content-secondary text-sm font-medium", children: "Chain" }), _jsx("div", { className: "border-as-border-primary rounded-lg border p-2 shadow-sm", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("img", { src: ALL_CHAINS[order.srcChain].logoUrl, alt: getChainName(order.srcChain), className: cn("h-6 rounded-full", order.srcChain === b3.id && "h-5 rounded-none") }), _jsx("span", { className: "text-as-primary text-sm font-semibold", children: getChainName(order.srcChain) })] }) })] })] }), _jsxs("div", { className: "border-b3-react-border bg-as-surface-secondary grid h-[220px] grid-cols-2 overflow-hidden rounded-xl border", children: [_jsx("div", { className: "border-as-border-primary h-full w-full border-r", children: _jsx("div", { className: "flex justify-center", children: _jsxs("div", { className: "bg-as-surface-secondary flex flex-col items-center rounded-lg p-6", children: [_jsx(QRCodeSVG, { value: getPaymentUrl(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress === RELAY_ETH_ADDRESS ? "ETH" : order.srcTokenAddress, order.srcChain, srcToken?.decimals), className: "bg-as-surface-secondary max-h-48 max-w-48" }), _jsxs("div", { className: "mt-3 flex items-center justify-center gap-2 text-sm", children: [_jsx("span", { className: "text-as-brand/70 text-sm font-medium", children: "SCAN WITH" }), _jsxs(TextLoop, { interval: 3, children: [_jsx(WalletMetamask, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletPhantom, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletTrust, { className: "h-5 w-5", variant: "branded" })] })] })] }) }) }), _jsxs("div", { className: "flex h-full w-full flex-col gap-2 p-6", children: [_jsx("span", { className: "text-as-content-secondary text-sm font-medium", children: "Deposit address:" }), _jsxs("div", { className: "flex h-full cursor-pointer flex-col items-stretch justify-between gap-4", onClick: handleCopyAddress, children: [_jsx("div", { className: "text-as-primary break-all font-mono text-sm font-semibold leading-relaxed", children: order.globalAddress }), _jsx("div", { className: "place-self-end", children: _jsx(Copy, { className: "group-hover:text-as-brand text-as-tertiarry h-4 w-4 cursor-pointer transition-all duration-200" }) })] })] })] }), _jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount })] }),
|
|
71
|
+
}, children: _jsxs("div", { className: "order-transfer-crypto-amount-copy flex cursor-pointer items-center justify-between gap-2", children: [_jsxs("strong", { className: "order-transfer-crypto-amount-text text-as-primary font-semibold", children: [roundedUpSrcAmount, " ", srcToken.symbol] }), _jsx(Copy, { className: "order-transfer-crypto-amount-copy-icon text-as-primary/50 hover:text-as-primary h-4 w-4 transition-all duration-200" })] }) }) })] }), _jsxs("div", { className: "order-transfer-crypto-chain-card w-full", children: [_jsx("span", { className: "order-transfer-crypto-chain-label text-as-content-secondary text-sm font-medium", children: "Chain" }), _jsx("div", { className: "order-transfer-crypto-chain-container border-as-border-primary rounded-lg border p-2 shadow-sm", children: _jsxs("div", { className: "order-transfer-crypto-chain-info flex items-center gap-2", children: [_jsx("img", { src: ALL_CHAINS[order.srcChain].logoUrl, alt: getChainName(order.srcChain), className: cn("order-transfer-crypto-chain-logo h-6 rounded-full", order.srcChain === b3.id && "h-5 rounded-none") }), _jsx("span", { className: "order-transfer-crypto-chain-name text-as-primary text-sm font-semibold", children: getChainName(order.srcChain) })] }) })] })] }), _jsxs("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", children: [_jsx("div", { className: "order-transfer-crypto-qr-section border-as-border-primary h-full w-full border-r", children: _jsx("div", { className: "order-transfer-crypto-qr-wrapper flex justify-center", children: _jsxs("div", { className: "order-transfer-crypto-qr-container bg-as-surface-secondary flex flex-col items-center rounded-lg p-6", children: [_jsx(QRCodeSVG, { value: getPaymentUrl(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress === RELAY_ETH_ADDRESS ? "ETH" : order.srcTokenAddress, order.srcChain, srcToken?.decimals), className: "order-transfer-crypto-qr-code bg-as-surface-secondary max-h-48 max-w-48" }), _jsxs("div", { className: "order-transfer-crypto-wallet-hint mt-3 flex items-center justify-center gap-2 text-sm", children: [_jsx("span", { className: "order-transfer-crypto-wallet-text text-as-brand/70 text-sm font-medium", children: "SCAN WITH" }), _jsxs(TextLoop, { interval: 3, children: [_jsx(WalletMetamask, { className: "order-transfer-crypto-wallet-icon h-5 w-5", variant: "branded" }), _jsx(WalletCoinbase, { className: "order-transfer-crypto-wallet-icon h-5 w-5", variant: "branded" }), _jsx(WalletPhantom, { className: "order-transfer-crypto-wallet-icon h-5 w-5", variant: "branded" }), _jsx(WalletTrust, { className: "order-transfer-crypto-wallet-icon h-5 w-5", variant: "branded" })] })] })] }) }) }), _jsxs("div", { className: "order-transfer-crypto-address-section flex h-full w-full flex-col gap-2 p-6", children: [_jsx("span", { className: "order-transfer-crypto-address-label text-as-content-secondary text-sm font-medium", children: "Deposit address:" }), _jsxs("div", { className: "order-transfer-crypto-address-copy flex h-full cursor-pointer flex-col items-stretch justify-between gap-4", onClick: handleCopyAddress, children: [_jsx("div", { className: "order-transfer-crypto-address-text text-as-primary break-all font-mono text-sm font-semibold leading-relaxed", children: order.globalAddress }), _jsx("div", { className: "order-transfer-crypto-address-copy-icon-wrapper place-self-end", children: _jsx(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" }) })] })] })] }), _jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount })] }), _jsxs("div", { className: "order-transfer-crypto-actions flex flex-col gap-3", children: [_jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", className: "order-transfer-crypto-copy-btn w-full py-3", onClick: handleCopyAddress, children: "Copy deposit address" }), _jsx(PaymentMethodSwitch, { currentMethod: CryptoPaymentMethodType.TRANSFER_CRYPTO, onMethodChange: onPaymentMethodChange })] })] }));
|
|
70
72
|
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
export interface FeatureFlags {
|
|
3
|
+
showPoints?: boolean;
|
|
4
|
+
}
|
|
5
|
+
interface FeatureFlagsProviderProps {
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
featureFlags?: FeatureFlags;
|
|
8
|
+
}
|
|
9
|
+
export declare function FeatureFlagsProvider({ children, featureFlags }: FeatureFlagsProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function useFeatureFlags(): FeatureFlags;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext } from "react";
|
|
4
|
+
const FeatureFlagsContext = createContext(undefined);
|
|
5
|
+
const defaultFeatureFlags = {
|
|
6
|
+
showPoints: false,
|
|
7
|
+
};
|
|
8
|
+
export function FeatureFlagsProvider({ children, featureFlags = defaultFeatureFlags }) {
|
|
9
|
+
return _jsx(FeatureFlagsContext.Provider, { value: { featureFlags }, children: children });
|
|
10
|
+
}
|
|
11
|
+
export function useFeatureFlags() {
|
|
12
|
+
const context = useContext(FeatureFlagsContext);
|
|
13
|
+
if (!context) {
|
|
14
|
+
return defaultFeatureFlags;
|
|
15
|
+
}
|
|
16
|
+
return context.featureFlags;
|
|
17
|
+
}
|
|
@@ -7,7 +7,8 @@ export declare enum PanelView {
|
|
|
7
7
|
FIAT_PAYMENT_METHOD = 2,
|
|
8
8
|
RECIPIENT_SELECTION = 3,
|
|
9
9
|
ORDER_DETAILS = 4,
|
|
10
|
-
LOADING = 5
|
|
10
|
+
LOADING = 5,
|
|
11
|
+
POINTS_DETAIL = 6
|
|
11
12
|
}
|
|
12
13
|
interface UseAnyspendFlowProps {
|
|
13
14
|
paymentType?: "crypto" | "fiat";
|
|
@@ -140,6 +141,8 @@ export declare function useAnyspendFlow({ paymentType, recipientAddress, loadOrd
|
|
|
140
141
|
};
|
|
141
142
|
timeEstimate?: number;
|
|
142
143
|
userBalance?: string;
|
|
144
|
+
pointsAmount?: number;
|
|
145
|
+
pointsMultiplier?: number;
|
|
143
146
|
};
|
|
144
147
|
statusCode: number;
|
|
145
148
|
} | undefined;
|
|
@@ -18,6 +18,7 @@ export var PanelView;
|
|
|
18
18
|
PanelView[PanelView["RECIPIENT_SELECTION"] = 3] = "RECIPIENT_SELECTION";
|
|
19
19
|
PanelView[PanelView["ORDER_DETAILS"] = 4] = "ORDER_DETAILS";
|
|
20
20
|
PanelView[PanelView["LOADING"] = 5] = "LOADING";
|
|
21
|
+
PanelView[PanelView["POINTS_DETAIL"] = 6] = "POINTS_DETAIL";
|
|
21
22
|
})(PanelView || (PanelView = {}));
|
|
22
23
|
export function useAnyspendFlow({ paymentType = "crypto", recipientAddress, loadOrder, isDepositMode = false, onOrderSuccess, onTransactionSuccess, sourceTokenAddress, sourceTokenChainId, slippage = 0, disableUrlParamManagement = false, }) {
|
|
23
24
|
const searchParams = useSearchParamsSSR();
|
|
@@ -106,15 +107,17 @@ export function useAnyspendFlow({ paymentType = "crypto", recipientAddress, load
|
|
|
106
107
|
}
|
|
107
108
|
};
|
|
108
109
|
// Get quote
|
|
109
|
-
|
|
110
|
+
// For fiat payments, always use USDC decimals (6) regardless of selectedSrcToken
|
|
111
|
+
const effectiveDecimals = paymentType === "fiat" ? USDC_BASE.decimals : selectedSrcToken.decimals;
|
|
112
|
+
const activeInputAmountInWei = parseUnits(srcAmount.replace(/,/g, ""), effectiveDecimals).toString();
|
|
110
113
|
const { anyspendQuote, isLoadingAnyspendQuote, getAnyspendQuoteError } = useAnyspendQuote({
|
|
111
114
|
srcChain: paymentType === "fiat" ? base.id : selectedSrcChainId,
|
|
112
115
|
dstChain: isDepositMode ? base.id : selectedDstChainId, // For deposits, always Base; for swaps, use selected destination
|
|
113
116
|
srcTokenAddress: paymentType === "fiat" ? USDC_BASE.address : selectedSrcToken.address,
|
|
114
117
|
dstTokenAddress: isDepositMode ? B3_TOKEN.address : selectedSrcToken.address, // For deposits, always B3
|
|
115
|
-
type: "
|
|
116
|
-
tradeType: "EXACT_INPUT",
|
|
118
|
+
type: "hype_duel",
|
|
117
119
|
amount: activeInputAmountInWei,
|
|
120
|
+
recipientAddress: selectedRecipientAddress,
|
|
118
121
|
onrampVendor: paymentType === "fiat" ? getOnrampVendor(selectedFiatPaymentMethod) : undefined,
|
|
119
122
|
});
|
|
120
123
|
// Get geo options for fiat
|
|
@@ -185,12 +188,19 @@ export function useAnyspendFlow({ paymentType = "crypto", recipientAddress, load
|
|
|
185
188
|
// Handle order completion
|
|
186
189
|
useEffect(() => {
|
|
187
190
|
if (oat?.data?.order.status === "executed") {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
const
|
|
191
|
-
|
|
191
|
+
// get the actualDstAmount if available from custompayload
|
|
192
|
+
const amount = oat.data.order.payload?.actualDstAmount;
|
|
193
|
+
const formattedActualDstAmount = amount
|
|
194
|
+
? formatTokenAmount(BigInt(amount), oat.data.order.metadata.dstToken.decimals)
|
|
195
|
+
: undefined;
|
|
196
|
+
onTransactionSuccess?.(formattedActualDstAmount);
|
|
192
197
|
}
|
|
193
|
-
}, [
|
|
198
|
+
}, [
|
|
199
|
+
oat?.data?.order.status,
|
|
200
|
+
oat?.data?.order.payload,
|
|
201
|
+
onTransactionSuccess,
|
|
202
|
+
oat?.data?.order.metadata.dstToken.decimals,
|
|
203
|
+
]);
|
|
194
204
|
return {
|
|
195
205
|
// State
|
|
196
206
|
activePanel,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
+
import { FeatureFlags } from "../contexts/FeatureFlagsContext";
|
|
2
3
|
interface AnyspendProviderProps {
|
|
3
4
|
children: ReactNode;
|
|
5
|
+
featureFlags?: FeatureFlags;
|
|
4
6
|
}
|
|
5
7
|
/**
|
|
6
8
|
* AnyspendProvider is a top-level provider that wraps your application to provide
|
|
@@ -12,17 +14,18 @@ interface AnyspendProviderProps {
|
|
|
12
14
|
* - Safe to use at the application root
|
|
13
15
|
* - Configures sensible defaults for query caching
|
|
14
16
|
* - Handles Stripe payment redirects and modal state
|
|
17
|
+
* - Provides feature flags configuration
|
|
15
18
|
*
|
|
16
19
|
* @example
|
|
17
20
|
* ```tsx
|
|
18
21
|
* function App() {
|
|
19
22
|
* return (
|
|
20
|
-
* <AnyspendProvider>
|
|
23
|
+
* <AnyspendProvider featureFlags={{ showPoints: true }}>
|
|
21
24
|
* <YourApp />
|
|
22
25
|
* </AnyspendProvider>
|
|
23
26
|
* );
|
|
24
27
|
* }
|
|
25
28
|
* ```
|
|
26
29
|
*/
|
|
27
|
-
export declare const AnyspendProvider: ({ children }: AnyspendProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export declare const AnyspendProvider: ({ children, featureFlags }: AnyspendProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
31
|
export {};
|
|
@@ -3,6 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { TooltipProvider } from "../../../global-account/react/index.js";
|
|
4
4
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
5
5
|
import { useState } from "react";
|
|
6
|
+
import { FeatureFlagsProvider } from "../contexts/FeatureFlagsContext.js";
|
|
6
7
|
import { StripeRedirectHandler } from "./StripeRedirectHandler.js";
|
|
7
8
|
const defaultQueryClientConfig = {
|
|
8
9
|
defaultOptions: {
|
|
@@ -23,19 +24,20 @@ const defaultQueryClientConfig = {
|
|
|
23
24
|
* - Safe to use at the application root
|
|
24
25
|
* - Configures sensible defaults for query caching
|
|
25
26
|
* - Handles Stripe payment redirects and modal state
|
|
27
|
+
* - Provides feature flags configuration
|
|
26
28
|
*
|
|
27
29
|
* @example
|
|
28
30
|
* ```tsx
|
|
29
31
|
* function App() {
|
|
30
32
|
* return (
|
|
31
|
-
* <AnyspendProvider>
|
|
33
|
+
* <AnyspendProvider featureFlags={{ showPoints: true }}>
|
|
32
34
|
* <YourApp />
|
|
33
35
|
* </AnyspendProvider>
|
|
34
36
|
* );
|
|
35
37
|
* }
|
|
36
38
|
* ```
|
|
37
39
|
*/
|
|
38
|
-
export const AnyspendProvider = function AnyspendProvider({ children }) {
|
|
40
|
+
export const AnyspendProvider = function AnyspendProvider({ children, featureFlags }) {
|
|
39
41
|
const [queryClient] = useState(() => new QueryClient(defaultQueryClientConfig));
|
|
40
|
-
return (_jsx(QueryClientProvider, { client: queryClient, children: _jsxs(TooltipProvider, { children: [_jsx(StripeRedirectHandler, {}), children] }) }));
|
|
42
|
+
return (_jsx(QueryClientProvider, { client: queryClient, children: _jsx(FeatureFlagsProvider, { featureFlags: featureFlags, children: _jsxs(TooltipProvider, { children: [_jsx(StripeRedirectHandler, {}), children] }) }) }));
|
|
41
43
|
};
|
|
@@ -28,7 +28,7 @@ export declare const anyspendService: {
|
|
|
28
28
|
}>;
|
|
29
29
|
getOrderAndTransactions: (orderId: string | undefined) => Promise<GetOrderAndTxsResponse>;
|
|
30
30
|
getOrderHistory: (creatorAddress: string | undefined, limit?: number, offset?: number) => Promise<GetOrderHistoryResponse>;
|
|
31
|
-
getCoinbaseOnrampOptions: (country: string, visitorData?: VisitorData) => Promise<GetCoinbaseOnrampOptionsResponse>;
|
|
31
|
+
getCoinbaseOnrampOptions: (country: string | undefined, visitorData?: VisitorData) => Promise<GetCoinbaseOnrampOptionsResponse>;
|
|
32
32
|
checkStripeSupport: (usdAmount?: string, visitorData?: VisitorData) => Promise<{
|
|
33
33
|
stripeOnramp: boolean;
|
|
34
34
|
stripeWeb2: components["schemas"]["StripeWeb2Support"];
|
|
@@ -63,6 +63,7 @@ export const anyspendService = {
|
|
|
63
63
|
return data;
|
|
64
64
|
},
|
|
65
65
|
getOrderAndTransactions: async (orderId) => {
|
|
66
|
+
invariant(orderId, "orderId is required");
|
|
66
67
|
const response = await fetch(`${ANYSPEND_MAINNET_BASE_URL}/orders/${orderId}`);
|
|
67
68
|
const data = await response.json();
|
|
68
69
|
return data;
|
|
@@ -80,6 +81,7 @@ export const anyspendService = {
|
|
|
80
81
|
return data;
|
|
81
82
|
},
|
|
82
83
|
getCoinbaseOnrampOptions: async (country, visitorData) => {
|
|
84
|
+
invariant(country, "country is required");
|
|
83
85
|
const params = new URLSearchParams({
|
|
84
86
|
country,
|
|
85
87
|
// include fingerprintId and requestId in the query params
|
|
@@ -503,11 +503,16 @@ export interface paths {
|
|
|
503
503
|
* @example 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
|
|
504
504
|
*/
|
|
505
505
|
dstTokenAddress: string;
|
|
506
|
+
/**
|
|
507
|
+
* @description Recipient address
|
|
508
|
+
* @example 0x55c71fca5e01cf246718748ae540473e608d0282
|
|
509
|
+
*/
|
|
510
|
+
recipientAddress?: string;
|
|
506
511
|
/**
|
|
507
512
|
* @description Type of trade execution
|
|
508
513
|
* @enum {string}
|
|
509
514
|
*/
|
|
510
|
-
tradeType: "EXACT_INPUT" | "
|
|
515
|
+
tradeType: "EXACT_INPUT" | "EXACT_OUTPUT";
|
|
511
516
|
/**
|
|
512
517
|
* @description Amount to quote
|
|
513
518
|
* @example 1000000000000000000
|
|
@@ -544,6 +549,11 @@ export interface paths {
|
|
|
544
549
|
* @example 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
|
|
545
550
|
*/
|
|
546
551
|
dstTokenAddress: string;
|
|
552
|
+
/**
|
|
553
|
+
* @description Recipient address
|
|
554
|
+
* @example 0x55c71fca5e01cf246718748ae540473e608d0282
|
|
555
|
+
*/
|
|
556
|
+
recipientAddress?: string;
|
|
547
557
|
/** @description Custom payload for execution */
|
|
548
558
|
payload: {
|
|
549
559
|
/** @description Encoded transaction data */
|
|
@@ -567,6 +577,11 @@ export interface paths {
|
|
|
567
577
|
dstChain: number;
|
|
568
578
|
srcTokenAddress: string;
|
|
569
579
|
dstTokenAddress: string;
|
|
580
|
+
/**
|
|
581
|
+
* @description Recipient address
|
|
582
|
+
* @example 0x55c71fca5e01cf246718748ae540473e608d0282
|
|
583
|
+
*/
|
|
584
|
+
recipientAddress?: string;
|
|
570
585
|
/** @enum {string} */
|
|
571
586
|
onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
|
|
572
587
|
contractAddress: string;
|
|
@@ -581,6 +596,11 @@ export interface paths {
|
|
|
581
596
|
dstChain: number;
|
|
582
597
|
srcTokenAddress: string;
|
|
583
598
|
dstTokenAddress: string;
|
|
599
|
+
/**
|
|
600
|
+
* @description Recipient address
|
|
601
|
+
* @example 0x55c71fca5e01cf246718748ae540473e608d0282
|
|
602
|
+
*/
|
|
603
|
+
recipientAddress?: string;
|
|
584
604
|
/** @enum {string} */
|
|
585
605
|
onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
|
|
586
606
|
contractAddress: string;
|
|
@@ -592,6 +612,11 @@ export interface paths {
|
|
|
592
612
|
dstChain: number;
|
|
593
613
|
srcTokenAddress: string;
|
|
594
614
|
dstTokenAddress: string;
|
|
615
|
+
/**
|
|
616
|
+
* @description Recipient address
|
|
617
|
+
* @example 0x55c71fca5e01cf246718748ae540473e608d0282
|
|
618
|
+
*/
|
|
619
|
+
recipientAddress?: string;
|
|
595
620
|
/** @enum {string} */
|
|
596
621
|
onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
|
|
597
622
|
contractAddress: string;
|
|
@@ -622,6 +647,11 @@ export interface paths {
|
|
|
622
647
|
* @example 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
|
|
623
648
|
*/
|
|
624
649
|
dstTokenAddress: string;
|
|
650
|
+
/**
|
|
651
|
+
* @description Recipient address
|
|
652
|
+
* @example 0x55c71fca5e01cf246718748ae540473e608d0282
|
|
653
|
+
*/
|
|
654
|
+
recipientAddress?: string;
|
|
625
655
|
/**
|
|
626
656
|
* @description Amount to quote
|
|
627
657
|
* @example 1000000000000000000
|
|
@@ -798,6 +828,16 @@ export interface paths {
|
|
|
798
828
|
* @example 0
|
|
799
829
|
*/
|
|
800
830
|
userBalance?: string;
|
|
831
|
+
/**
|
|
832
|
+
* @description Anyspend points that will be awarded for the order
|
|
833
|
+
* @example 100
|
|
834
|
+
*/
|
|
835
|
+
pointsAmount?: number;
|
|
836
|
+
/**
|
|
837
|
+
* @description Multiplier applied to points that will be awarded for the order
|
|
838
|
+
* @example 1.5
|
|
839
|
+
*/
|
|
840
|
+
pointsMultiplier?: number;
|
|
801
841
|
};
|
|
802
842
|
/** @example 200 */
|
|
803
843
|
statusCode: number;
|
|
@@ -1077,6 +1117,11 @@ export interface components {
|
|
|
1077
1117
|
* @example 990000
|
|
1078
1118
|
*/
|
|
1079
1119
|
actualDstAmount: string | null;
|
|
1120
|
+
/**
|
|
1121
|
+
* @description Amount in after fee
|
|
1122
|
+
* @example 990000
|
|
1123
|
+
*/
|
|
1124
|
+
amountInAfterFee: string | null;
|
|
1080
1125
|
};
|
|
1081
1126
|
/** @description HypeDuel-specific payload */
|
|
1082
1127
|
HypeDuelPayload: {
|
|
@@ -1090,6 +1135,11 @@ export interface components {
|
|
|
1090
1135
|
* @example 990000
|
|
1091
1136
|
*/
|
|
1092
1137
|
actualDstAmount: string | null;
|
|
1138
|
+
/**
|
|
1139
|
+
* @description Amount in after fee
|
|
1140
|
+
* @example 990000
|
|
1141
|
+
*/
|
|
1142
|
+
amountInAfterFee: string | null;
|
|
1093
1143
|
};
|
|
1094
1144
|
/** @description Custom execution payload */
|
|
1095
1145
|
CustomPayload: {
|
|
@@ -104,7 +104,7 @@ export const EVM_MAINNET = {
|
|
|
104
104
|
name: bsc.name,
|
|
105
105
|
logoUrl: "https://avatars.githubusercontent.com/u/45615063?s=280&v=4",
|
|
106
106
|
type: ChainType.EVM,
|
|
107
|
-
nativeRequired: parseEther("0.
|
|
107
|
+
nativeRequired: parseEther("0.0001"),
|
|
108
108
|
canDepositNative: true,
|
|
109
109
|
defaultToken: getBnbToken(),
|
|
110
110
|
nativeToken: getBnbToken(),
|
|
@@ -6,6 +6,7 @@ export const buildPayload = (orderType, params) => {
|
|
|
6
6
|
return {
|
|
7
7
|
expectedDstAmount,
|
|
8
8
|
actualDstAmount: null,
|
|
9
|
+
amountInAfterFee: null,
|
|
9
10
|
};
|
|
10
11
|
case "mint_nft":
|
|
11
12
|
if (nft?.type === "erc1155") {
|
|
@@ -20,6 +21,7 @@ export const buildPayload = (orderType, params) => {
|
|
|
20
21
|
return {
|
|
21
22
|
contractAddress: normalizeAddress(nft.contractAddress),
|
|
22
23
|
nftPrice: nft?.price || "",
|
|
24
|
+
tokenId: null,
|
|
23
25
|
contractType: nft?.type,
|
|
24
26
|
};
|
|
25
27
|
}
|
|
@@ -42,6 +44,7 @@ export const buildPayload = (orderType, params) => {
|
|
|
42
44
|
return {
|
|
43
45
|
expectedDstAmount,
|
|
44
46
|
actualDstAmount: null,
|
|
47
|
+
amountInAfterFee: null,
|
|
45
48
|
};
|
|
46
49
|
default:
|
|
47
50
|
throw new Error(`Invalid order type: ${orderType}`);
|