@b3dotfun/sdk 0.0.8 → 0.0.9-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -1
- package/dist/cjs/anyspend/abis/bondKit.d.ts +35 -0
- package/dist/cjs/anyspend/abis/bondKit.js +29 -0
- package/dist/cjs/anyspend/constants/index.d.ts +16 -5
- package/dist/cjs/anyspend/constants/index.js +3 -4
- package/dist/cjs/anyspend/index.d.ts +3 -7
- package/dist/cjs/anyspend/index.js +3 -7
- package/dist/cjs/anyspend/index.native.d.ts +3 -3
- package/dist/cjs/anyspend/index.native.js +3 -3
- package/dist/cjs/anyspend/react/components/AnySpend.js +12 -12
- package/dist/cjs/anyspend/react/components/AnySpendBondKit.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/AnySpendBondKit.js +209 -0
- package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +3 -10
- package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +5 -4
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +49 -49
- package/dist/cjs/anyspend/react/components/AnySpendNFT.d.ts +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendNFT.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendTournament.d.ts +5 -5
- package/dist/cjs/anyspend/react/components/AnySpendTournament.js +2 -3
- package/dist/cjs/anyspend/react/components/AnyspendSignatureMint.d.ts +1 -1
- package/dist/cjs/anyspend/react/components/AnyspendSignatureMint.js +10 -8
- package/dist/cjs/anyspend/react/components/{AnySpendNFTButton.d.ts → common/AnySpendNFTButton.d.ts} +2 -2
- package/dist/cjs/anyspend/react/components/{AnySpendNFTButton.js → common/AnySpendNFTButton.js} +2 -2
- package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +6 -6
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +45 -47
- package/dist/cjs/anyspend/react/components/common/OrderHistoryItem.d.ts +2 -2
- package/dist/cjs/anyspend/react/components/common/OrderHistoryItem.js +10 -12
- package/dist/cjs/anyspend/react/components/common/OrderStatus.d.ts +2 -2
- package/dist/cjs/anyspend/react/components/common/OrderStatus.js +1 -1
- package/dist/cjs/anyspend/react/components/common/OrderToken.d.ts +3 -3
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.d.ts +3 -3
- package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.d.ts +6 -5
- package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.js +8 -9
- package/dist/cjs/anyspend/react/components/common/PaymentOneClick.d.ts +2 -2
- package/dist/cjs/anyspend/react/components/common/PaymentStripeWeb2.d.ts +2 -2
- package/dist/cjs/anyspend/react/components/common/PaymentVendorUI.d.ts +2 -2
- package/dist/cjs/anyspend/react/components/common/PaymentVendorUI.js +1 -2
- package/dist/cjs/anyspend/react/components/common/TokenBalance.d.ts +2 -2
- package/dist/cjs/anyspend/react/components/index.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/index.js +5 -3
- package/dist/cjs/anyspend/react/components/webview/WebviewOnrampOrderStatus.d.ts +2 -2
- package/dist/cjs/anyspend/react/components/webview/WebviewOnrampOrderStatus.js +9 -9
- package/dist/cjs/anyspend/react/components/webview/WebviewOnrampPayment.d.ts +3 -2
- package/dist/cjs/anyspend/react/components/webview/WebviewOnrampPayment.js +3 -4
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +2 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOrder.d.ts +6 -6
- package/dist/cjs/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +12 -644
- package/dist/cjs/anyspend/react/hooks/useAnyspendOrderAndTransactions.js +21 -6
- package/dist/cjs/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +72 -434
- package/dist/cjs/anyspend/react/hooks/useAnyspendOrderHistory.js +3 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendQuote.d.ts +7 -15
- package/dist/cjs/anyspend/react/hooks/useAnyspendQuote.js +4 -21
- package/dist/cjs/anyspend/react/hooks/useAnyspendTokens.d.ts +4 -4
- package/dist/cjs/anyspend/react/hooks/useCoinbaseOnrampOptions.d.ts +38 -27
- package/dist/cjs/anyspend/react/hooks/useCoinbaseOnrampOptions.js +1 -1
- package/dist/cjs/anyspend/react/hooks/useGeoOnrampOptions.d.ts +16 -13
- package/dist/cjs/anyspend/react/hooks/useSigMint.d.ts +7 -7
- package/dist/cjs/anyspend/services/anyspend.d.ts +10 -321
- package/dist/cjs/anyspend/services/anyspend.js +7 -11
- package/dist/cjs/anyspend/types/api.d.ts +1731 -0
- package/dist/cjs/anyspend/types/api.js +6 -0
- package/dist/cjs/anyspend/types/api_req_res.d.ts +10 -0
- package/dist/cjs/anyspend/types/chain.d.ts +3 -3
- package/dist/cjs/anyspend/types/signatureMint.js +2 -0
- package/dist/cjs/anyspend/utils/chain.d.ts +4 -3
- package/dist/cjs/anyspend/utils/chain.js +14 -14
- package/dist/cjs/anyspend/utils/format.d.ts +2 -2
- package/dist/cjs/anyspend/utils/format.js +13 -14
- package/dist/cjs/anyspend/utils/orderPayload.d.ts +29 -29
- package/dist/cjs/anyspend/utils/orderPayload.js +12 -13
- package/dist/cjs/anyspend/utils/token.d.ts +6 -6
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +4 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +1 -1
- package/dist/cjs/global-account/react/components/ui/TabSystem.d.ts +2 -2
- package/dist/cjs/global-account/react/components/ui/TabSystem.js +5 -5
- package/dist/cjs/global-account/react/components/ui/command.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/useAccountWallet.js +1 -1
- package/dist/cjs/global-account/react/hooks/useBestTransactionPath.d.ts +2 -2
- package/dist/cjs/global-account/react/hooks/useOnchainName.js +2 -2
- package/dist/cjs/global-account/react/hooks/useTokenBalance.d.ts +2 -2
- package/dist/cjs/global-account/react/hooks/useTokenFromUrl.d.ts +5 -5
- package/dist/cjs/global-account/react/hooks/useTokenFromUrl.js +1 -1
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +32 -9
- package/dist/cjs/shared/constants/chains/supported.d.ts +2 -2
- package/dist/cjs/shared/thirdweb/generated/@tanstack/react-query.gen.d.ts +249 -249
- package/dist/cjs/shared/utils/payment.utils.d.ts +3 -3
- package/dist/cjs/shared/utils/payment.utils.js +6 -7
- package/dist/esm/anyspend/abis/bondKit.d.ts +35 -0
- package/dist/esm/anyspend/abis/bondKit.js +26 -0
- package/dist/esm/anyspend/constants/index.d.ts +16 -5
- package/dist/esm/anyspend/constants/index.js +3 -4
- package/dist/esm/anyspend/index.d.ts +3 -7
- package/dist/esm/anyspend/index.js +3 -7
- package/dist/esm/anyspend/index.native.d.ts +3 -3
- package/dist/esm/anyspend/index.native.js +3 -3
- package/dist/esm/anyspend/react/components/AnySpend.js +13 -13
- package/dist/esm/anyspend/react/components/AnySpendBondKit.d.ts +2 -0
- package/dist/esm/anyspend/react/components/AnySpendBondKit.js +206 -0
- package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +4 -11
- package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +5 -4
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +49 -49
- package/dist/esm/anyspend/react/components/AnySpendNFT.d.ts +2 -2
- package/dist/esm/anyspend/react/components/AnySpendNFT.js +3 -3
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +3 -3
- package/dist/esm/anyspend/react/components/AnySpendTournament.d.ts +5 -5
- package/dist/esm/anyspend/react/components/AnySpendTournament.js +2 -3
- package/dist/esm/anyspend/react/components/AnyspendSignatureMint.d.ts +1 -1
- package/dist/esm/anyspend/react/components/AnyspendSignatureMint.js +10 -8
- package/dist/esm/anyspend/react/components/{AnySpendNFTButton.d.ts → common/AnySpendNFTButton.d.ts} +2 -2
- package/dist/esm/anyspend/react/components/{AnySpendNFTButton.js → common/AnySpendNFTButton.js} +2 -2
- package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +6 -6
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +46 -48
- package/dist/esm/anyspend/react/components/common/OrderHistoryItem.d.ts +2 -2
- package/dist/esm/anyspend/react/components/common/OrderHistoryItem.js +11 -13
- package/dist/esm/anyspend/react/components/common/OrderStatus.d.ts +2 -2
- package/dist/esm/anyspend/react/components/common/OrderStatus.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderToken.d.ts +3 -3
- package/dist/esm/anyspend/react/components/common/OrderTokenAmount.d.ts +3 -3
- package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.d.ts +6 -5
- package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.js +8 -9
- package/dist/esm/anyspend/react/components/common/PaymentOneClick.d.ts +2 -2
- package/dist/esm/anyspend/react/components/common/PaymentStripeWeb2.d.ts +2 -2
- package/dist/esm/anyspend/react/components/common/PaymentVendorUI.d.ts +2 -2
- package/dist/esm/anyspend/react/components/common/PaymentVendorUI.js +1 -2
- package/dist/esm/anyspend/react/components/common/TokenBalance.d.ts +2 -2
- package/dist/esm/anyspend/react/components/index.d.ts +2 -1
- package/dist/esm/anyspend/react/components/index.js +2 -1
- package/dist/esm/anyspend/react/components/webview/WebviewOnrampOrderStatus.d.ts +2 -2
- package/dist/esm/anyspend/react/components/webview/WebviewOnrampOrderStatus.js +10 -10
- package/dist/esm/anyspend/react/components/webview/WebviewOnrampPayment.d.ts +3 -2
- package/dist/esm/anyspend/react/components/webview/WebviewOnrampPayment.js +4 -5
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +2 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.d.ts +6 -6
- package/dist/esm/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +12 -644
- package/dist/esm/anyspend/react/hooks/useAnyspendOrderAndTransactions.js +21 -3
- package/dist/esm/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +72 -434
- package/dist/esm/anyspend/react/hooks/useAnyspendOrderHistory.js +3 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendQuote.d.ts +7 -15
- package/dist/esm/anyspend/react/hooks/useAnyspendQuote.js +4 -21
- package/dist/esm/anyspend/react/hooks/useAnyspendTokens.d.ts +4 -4
- package/dist/esm/anyspend/react/hooks/useCoinbaseOnrampOptions.d.ts +38 -27
- package/dist/esm/anyspend/react/hooks/useCoinbaseOnrampOptions.js +1 -1
- package/dist/esm/anyspend/react/hooks/useGeoOnrampOptions.d.ts +16 -13
- package/dist/esm/anyspend/react/hooks/useSigMint.d.ts +7 -7
- package/dist/esm/anyspend/services/anyspend.d.ts +10 -321
- package/dist/esm/anyspend/services/anyspend.js +7 -11
- package/dist/esm/anyspend/types/api.d.ts +1731 -0
- package/dist/esm/anyspend/types/api.js +5 -0
- package/dist/esm/anyspend/types/api_req_res.d.ts +10 -0
- package/dist/esm/anyspend/types/chain.d.ts +3 -3
- package/dist/esm/anyspend/types/signatureMint.js +1 -0
- package/dist/esm/anyspend/utils/chain.d.ts +4 -3
- package/dist/esm/anyspend/utils/chain.js +1 -1
- package/dist/esm/anyspend/utils/format.d.ts +2 -2
- package/dist/esm/anyspend/utils/format.js +13 -14
- package/dist/esm/anyspend/utils/orderPayload.d.ts +29 -29
- package/dist/esm/anyspend/utils/orderPayload.js +12 -13
- package/dist/esm/anyspend/utils/token.d.ts +6 -6
- package/dist/esm/global-account/react/components/B3DynamicModal.js +5 -1
- package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +1 -1
- package/dist/esm/global-account/react/components/ui/TabSystem.d.ts +2 -2
- package/dist/esm/global-account/react/components/ui/TabSystem.js +4 -4
- package/dist/esm/global-account/react/components/ui/command.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/useAccountWallet.js +1 -1
- package/dist/esm/global-account/react/hooks/useBestTransactionPath.d.ts +2 -2
- package/dist/esm/global-account/react/hooks/useOnchainName.js +2 -2
- package/dist/esm/global-account/react/hooks/useTokenBalance.d.ts +2 -2
- package/dist/esm/global-account/react/hooks/useTokenFromUrl.d.ts +5 -5
- package/dist/esm/global-account/react/hooks/useTokenFromUrl.js +1 -1
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +32 -9
- package/dist/esm/shared/constants/chains/supported.d.ts +2 -2
- package/dist/esm/shared/thirdweb/generated/@tanstack/react-query.gen.d.ts +249 -249
- package/dist/esm/shared/utils/payment.utils.d.ts +3 -3
- package/dist/esm/shared/utils/payment.utils.js +6 -7
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/abis/bondKit.d.ts +35 -0
- package/dist/types/anyspend/constants/index.d.ts +16 -5
- package/dist/types/anyspend/index.d.ts +3 -7
- package/dist/types/anyspend/index.native.d.ts +3 -3
- package/dist/types/anyspend/react/components/AnySpendBondKit.d.ts +2 -0
- package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +5 -4
- package/dist/types/anyspend/react/components/AnySpendNFT.d.ts +2 -2
- package/dist/types/anyspend/react/components/AnySpendTournament.d.ts +5 -5
- package/dist/types/anyspend/react/components/AnyspendSignatureMint.d.ts +1 -1
- package/dist/types/anyspend/react/components/{AnySpendNFTButton.d.ts → common/AnySpendNFTButton.d.ts} +2 -2
- package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +6 -6
- package/dist/types/anyspend/react/components/common/OrderHistoryItem.d.ts +2 -2
- package/dist/types/anyspend/react/components/common/OrderStatus.d.ts +2 -2
- package/dist/types/anyspend/react/components/common/OrderToken.d.ts +3 -3
- package/dist/types/anyspend/react/components/common/OrderTokenAmount.d.ts +3 -3
- package/dist/types/anyspend/react/components/common/PanelOnrampPayment.d.ts +6 -5
- package/dist/types/anyspend/react/components/common/PaymentOneClick.d.ts +2 -2
- package/dist/types/anyspend/react/components/common/PaymentStripeWeb2.d.ts +2 -2
- package/dist/types/anyspend/react/components/common/PaymentVendorUI.d.ts +2 -2
- package/dist/types/anyspend/react/components/common/TokenBalance.d.ts +2 -2
- package/dist/types/anyspend/react/components/index.d.ts +2 -1
- package/dist/types/anyspend/react/components/webview/WebviewOnrampOrderStatus.d.ts +2 -2
- package/dist/types/anyspend/react/components/webview/WebviewOnrampPayment.d.ts +3 -2
- package/dist/types/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +2 -2
- package/dist/types/anyspend/react/hooks/useAnyspendCreateOrder.d.ts +6 -6
- package/dist/types/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +12 -644
- package/dist/types/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +72 -434
- package/dist/types/anyspend/react/hooks/useAnyspendQuote.d.ts +7 -15
- package/dist/types/anyspend/react/hooks/useAnyspendTokens.d.ts +4 -4
- package/dist/types/anyspend/react/hooks/useCoinbaseOnrampOptions.d.ts +38 -27
- package/dist/types/anyspend/react/hooks/useGeoOnrampOptions.d.ts +16 -13
- package/dist/types/anyspend/react/hooks/useSigMint.d.ts +7 -7
- package/dist/types/anyspend/services/anyspend.d.ts +10 -321
- package/dist/types/anyspend/types/api.d.ts +1731 -0
- package/dist/types/anyspend/types/api_req_res.d.ts +10 -0
- package/dist/types/anyspend/types/chain.d.ts +3 -3
- package/dist/types/anyspend/utils/chain.d.ts +4 -3
- package/dist/types/anyspend/utils/format.d.ts +2 -2
- package/dist/types/anyspend/utils/orderPayload.d.ts +29 -29
- package/dist/types/anyspend/utils/token.d.ts +6 -6
- package/dist/types/global-account/react/components/ui/TabSystem.d.ts +2 -2
- package/dist/types/global-account/react/components/ui/command.d.ts +1 -1
- package/dist/types/global-account/react/hooks/useBestTransactionPath.d.ts +2 -2
- package/dist/types/global-account/react/hooks/useTokenBalance.d.ts +2 -2
- package/dist/types/global-account/react/hooks/useTokenFromUrl.d.ts +5 -5
- package/dist/types/global-account/react/stores/useModalStore.d.ts +32 -9
- package/dist/types/shared/constants/chains/supported.d.ts +2 -2
- package/dist/types/shared/thirdweb/generated/@tanstack/react-query.gen.d.ts +249 -249
- package/dist/types/shared/utils/payment.utils.d.ts +3 -3
- package/package.json +3 -1
- package/src/anyspend/README.md +33 -32
- package/src/anyspend/abis/bondKit.ts +26 -0
- package/src/anyspend/constants/index.ts +7 -7
- package/src/anyspend/index.native.ts +3 -3
- package/src/anyspend/index.ts +3 -7
- package/src/anyspend/react/components/AnySpend.tsx +19 -17
- package/src/anyspend/react/components/AnySpendBondKit.tsx +378 -0
- package/src/anyspend/react/components/AnySpendBuySpin.tsx +4 -12
- package/src/anyspend/react/components/AnySpendCustom.tsx +100 -112
- package/src/anyspend/react/components/AnySpendNFT.tsx +7 -6
- package/src/anyspend/react/components/AnySpendStakeB3.tsx +3 -3
- package/src/anyspend/react/components/AnySpendTournament.tsx +8 -7
- package/src/anyspend/react/components/AnyspendSignatureMint.tsx +22 -13
- package/src/anyspend/react/components/{AnySpendNFTButton.tsx → common/AnySpendNFTButton.tsx} +2 -2
- package/src/anyspend/react/components/common/OrderDetails.tsx +58 -70
- package/src/anyspend/react/components/common/OrderHistoryItem.tsx +13 -14
- package/src/anyspend/react/components/common/OrderStatus.tsx +4 -3
- package/src/anyspend/react/components/common/OrderToken.tsx +4 -3
- package/src/anyspend/react/components/common/OrderTokenAmount.tsx +4 -3
- package/src/anyspend/react/components/common/PanelOnrampPayment.tsx +19 -15
- package/src/anyspend/react/components/common/PaymentOneClick.tsx +2 -2
- package/src/anyspend/react/components/common/PaymentStripeWeb2.tsx +4 -3
- package/src/anyspend/react/components/common/PaymentVendorUI.tsx +3 -3
- package/src/anyspend/react/components/common/TokenBalance.tsx +2 -2
- package/src/anyspend/react/components/index.ts +2 -1
- package/src/anyspend/react/components/webview/WebviewOnrampOrderStatus.tsx +12 -11
- package/src/anyspend/react/components/webview/WebviewOnrampPayment.tsx +15 -16
- package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +2 -2
- package/src/anyspend/react/hooks/useAnyspendCreateOrder.ts +6 -6
- package/src/anyspend/react/hooks/useAnyspendOrderAndTransactions.ts +27 -5
- package/src/anyspend/react/hooks/useAnyspendOrderHistory.ts +10 -6
- package/src/anyspend/react/hooks/useAnyspendQuote.ts +15 -18
- package/src/anyspend/react/hooks/useCoinbaseOnrampOptions.ts +1 -1
- package/src/anyspend/react/hooks/useSigMint.tsx +1 -1
- package/src/anyspend/services/anyspend.ts +38 -30
- package/src/anyspend/types/api.ts +1756 -0
- package/src/anyspend/types/api_req_res.ts +16 -0
- package/src/anyspend/types/chain.ts +3 -3
- package/src/anyspend/utils/chain.ts +4 -3
- package/src/anyspend/utils/format.ts +17 -15
- package/src/anyspend/utils/orderPayload.ts +20 -20
- package/src/anyspend/utils/token.ts +6 -6
- package/src/global-account/react/components/B3DynamicModal.tsx +6 -1
- package/src/global-account/react/components/SignInWithB3/SignIn.tsx +1 -1
- package/src/global-account/react/components/StyleRoot.tsx +1 -0
- package/src/global-account/react/components/ui/TabSystem.tsx +36 -33
- package/src/global-account/react/hooks/useAccountWallet.tsx +1 -1
- package/src/global-account/react/hooks/useBestTransactionPath.tsx +3 -2
- package/src/global-account/react/hooks/useOnchainName.tsx +2 -2
- package/src/global-account/react/hooks/useTokenBalance.tsx +3 -2
- package/src/global-account/react/hooks/useTokenFromUrl.tsx +10 -4
- package/src/global-account/react/stores/useModalStore.ts +34 -9
- package/src/shared/utils/payment.utils.ts +9 -9
- package/dist/cjs/anyspend/types/custom.d.ts +0 -130
- package/dist/cjs/anyspend/types/custom.js +0 -19
- package/dist/cjs/anyspend/types/globalWallet.d.ts +0 -18
- package/dist/cjs/anyspend/types/globalWallet.js +0 -10
- package/dist/cjs/anyspend/types/index.d.ts +0 -13
- package/dist/cjs/anyspend/types/index.js +0 -29
- package/dist/cjs/anyspend/types/metadata.d.ts +0 -26
- package/dist/cjs/anyspend/types/metadata.js +0 -16
- package/dist/cjs/anyspend/types/nft.d.ts +0 -274
- package/dist/cjs/anyspend/types/nft.js +0 -38
- package/dist/cjs/anyspend/types/onramp.d.ts +0 -28
- package/dist/cjs/anyspend/types/onramp.js +0 -18
- package/dist/cjs/anyspend/types/order.d.ts +0 -1629
- package/dist/cjs/anyspend/types/order.js +0 -81
- package/dist/cjs/anyspend/types/relay.d.ts +0 -10
- package/dist/cjs/anyspend/types/relay.js +0 -12
- package/dist/cjs/anyspend/types/req-res/createOrder.d.ts +0 -4026
- package/dist/cjs/anyspend/types/req-res/createOrder.js +0 -61
- package/dist/cjs/anyspend/types/req-res/getCoinbaseOnrampOptions.d.ts +0 -120
- package/dist/cjs/anyspend/types/req-res/getCoinbaseOnrampOptions.js +0 -31
- package/dist/cjs/anyspend/types/req-res/getOrderAndTransactions.d.ts +0 -2922
- package/dist/cjs/anyspend/types/req-res/getOrderAndTransactions.js +0 -23
- package/dist/cjs/anyspend/types/req-res/getOrderByCreator.d.ts +0 -28
- package/dist/cjs/anyspend/types/req-res/getOrderByCreator.js +0 -11
- package/dist/cjs/anyspend/types/req-res/getOrderHistory.d.ts +0 -2117
- package/dist/cjs/anyspend/types/req-res/getOrderHistory.js +0 -11
- package/dist/cjs/anyspend/types/req-res/getQuote.d.ts +0 -290
- package/dist/cjs/anyspend/types/req-res/getQuote.js +0 -51
- package/dist/cjs/anyspend/types/req-res/getTokenList.d.ts +0 -63
- package/dist/cjs/anyspend/types/req-res/getTokenList.js +0 -18
- package/dist/cjs/anyspend/types/req-res/index.d.ts +0 -7
- package/dist/cjs/anyspend/types/req-res/index.js +0 -23
- package/dist/cjs/anyspend/types/req-res/stripe.d.ts +0 -0
- package/dist/cjs/anyspend/types/req-res/stripe.js +0 -1
- package/dist/cjs/anyspend/types/swap.d.ts +0 -119
- package/dist/cjs/anyspend/types/swap.js +0 -13
- package/dist/cjs/anyspend/types/token.d.ts +0 -34
- package/dist/cjs/anyspend/types/token.js +0 -14
- package/dist/cjs/anyspend/types/tournament.d.ts +0 -174
- package/dist/cjs/anyspend/types/tournament.js +0 -24
- package/dist/cjs/anyspend/types/transaction.d.ts +0 -84
- package/dist/cjs/anyspend/types/transaction.js +0 -34
- package/dist/esm/anyspend/types/custom.d.ts +0 -130
- package/dist/esm/anyspend/types/custom.js +0 -13
- package/dist/esm/anyspend/types/globalWallet.d.ts +0 -18
- package/dist/esm/anyspend/types/globalWallet.js +0 -7
- package/dist/esm/anyspend/types/index.d.ts +0 -13
- package/dist/esm/anyspend/types/index.js +0 -13
- package/dist/esm/anyspend/types/metadata.d.ts +0 -26
- package/dist/esm/anyspend/types/metadata.js +0 -11
- package/dist/esm/anyspend/types/nft.d.ts +0 -274
- package/dist/esm/anyspend/types/nft.js +0 -35
- package/dist/esm/anyspend/types/onramp.d.ts +0 -28
- package/dist/esm/anyspend/types/onramp.js +0 -15
- package/dist/esm/anyspend/types/order.d.ts +0 -1629
- package/dist/esm/anyspend/types/order.js +0 -78
- package/dist/esm/anyspend/types/relay.d.ts +0 -10
- package/dist/esm/anyspend/types/relay.js +0 -9
- package/dist/esm/anyspend/types/req-res/createOrder.d.ts +0 -4026
- package/dist/esm/anyspend/types/req-res/createOrder.js +0 -58
- package/dist/esm/anyspend/types/req-res/getCoinbaseOnrampOptions.d.ts +0 -120
- package/dist/esm/anyspend/types/req-res/getCoinbaseOnrampOptions.js +0 -28
- package/dist/esm/anyspend/types/req-res/getOrderAndTransactions.d.ts +0 -2922
- package/dist/esm/anyspend/types/req-res/getOrderAndTransactions.js +0 -20
- package/dist/esm/anyspend/types/req-res/getOrderByCreator.d.ts +0 -28
- package/dist/esm/anyspend/types/req-res/getOrderByCreator.js +0 -8
- package/dist/esm/anyspend/types/req-res/getOrderHistory.d.ts +0 -2117
- package/dist/esm/anyspend/types/req-res/getOrderHistory.js +0 -8
- package/dist/esm/anyspend/types/req-res/getQuote.d.ts +0 -290
- package/dist/esm/anyspend/types/req-res/getQuote.js +0 -48
- package/dist/esm/anyspend/types/req-res/getTokenList.d.ts +0 -63
- package/dist/esm/anyspend/types/req-res/getTokenList.js +0 -15
- package/dist/esm/anyspend/types/req-res/index.d.ts +0 -7
- package/dist/esm/anyspend/types/req-res/index.js +0 -7
- package/dist/esm/anyspend/types/req-res/stripe.d.ts +0 -0
- package/dist/esm/anyspend/types/req-res/stripe.js +0 -1
- package/dist/esm/anyspend/types/swap.d.ts +0 -119
- package/dist/esm/anyspend/types/swap.js +0 -10
- package/dist/esm/anyspend/types/token.d.ts +0 -34
- package/dist/esm/anyspend/types/token.js +0 -11
- package/dist/esm/anyspend/types/tournament.d.ts +0 -174
- package/dist/esm/anyspend/types/tournament.js +0 -21
- package/dist/esm/anyspend/types/transaction.d.ts +0 -84
- package/dist/esm/anyspend/types/transaction.js +0 -31
- package/dist/types/anyspend/types/custom.d.ts +0 -130
- package/dist/types/anyspend/types/globalWallet.d.ts +0 -18
- package/dist/types/anyspend/types/index.d.ts +0 -13
- package/dist/types/anyspend/types/metadata.d.ts +0 -26
- package/dist/types/anyspend/types/nft.d.ts +0 -274
- package/dist/types/anyspend/types/onramp.d.ts +0 -28
- package/dist/types/anyspend/types/order.d.ts +0 -1629
- package/dist/types/anyspend/types/relay.d.ts +0 -10
- package/dist/types/anyspend/types/req-res/createOrder.d.ts +0 -4026
- package/dist/types/anyspend/types/req-res/getCoinbaseOnrampOptions.d.ts +0 -120
- package/dist/types/anyspend/types/req-res/getOrderAndTransactions.d.ts +0 -2922
- package/dist/types/anyspend/types/req-res/getOrderByCreator.d.ts +0 -28
- package/dist/types/anyspend/types/req-res/getOrderHistory.d.ts +0 -2117
- package/dist/types/anyspend/types/req-res/getQuote.d.ts +0 -290
- package/dist/types/anyspend/types/req-res/getTokenList.d.ts +0 -63
- package/dist/types/anyspend/types/req-res/index.d.ts +0 -7
- package/dist/types/anyspend/types/req-res/stripe.d.ts +0 -0
- package/dist/types/anyspend/types/swap.d.ts +0 -119
- package/dist/types/anyspend/types/token.d.ts +0 -34
- package/dist/types/anyspend/types/tournament.d.ts +0 -174
- package/dist/types/anyspend/types/transaction.d.ts +0 -84
- package/src/anyspend/types/custom.ts +0 -17
- package/src/anyspend/types/globalWallet.ts +0 -9
- package/src/anyspend/types/index.ts +0 -14
- package/src/anyspend/types/metadata.ts +0 -41
- package/src/anyspend/types/nft.ts +0 -53
- package/src/anyspend/types/onramp.ts +0 -16
- package/src/anyspend/types/order.ts +0 -88
- package/src/anyspend/types/relay.ts +0 -13
- package/src/anyspend/types/req-res/createOrder.ts +0 -67
- package/src/anyspend/types/req-res/getCoinbaseOnrampOptions.ts +0 -34
- package/src/anyspend/types/req-res/getOrderAndTransactions.ts +0 -23
- package/src/anyspend/types/req-res/getOrderByCreator.ts +0 -9
- package/src/anyspend/types/req-res/getOrderHistory.ts +0 -9
- package/src/anyspend/types/req-res/getQuote.ts +0 -65
- package/src/anyspend/types/req-res/getTokenList.ts +0 -18
- package/src/anyspend/types/req-res/index.ts +0 -7
- package/src/anyspend/types/req-res/stripe.ts +0 -0
- package/src/anyspend/types/swap.ts +0 -12
- package/src/anyspend/types/token.ts +0 -13
- package/src/anyspend/types/tournament.ts +0 -26
- package/src/anyspend/types/transaction.ts +0 -39
- /package/dist/cjs/anyspend/abis/{abi-usdc-base.d.ts → abiUsdcBase.d.ts} +0 -0
- /package/dist/cjs/anyspend/abis/{abi-usdc-base.js → abiUsdcBase.js} +0 -0
- /package/dist/cjs/anyspend/abis/{erc20-staking.d.ts → erc20Staking.d.ts} +0 -0
- /package/dist/cjs/anyspend/abis/{erc20-staking.js → erc20Staking.js} +0 -0
- /package/dist/cjs/anyspend/abis/{signature-minting.d.ts → signatureMinting.d.ts} +0 -0
- /package/dist/cjs/anyspend/abis/{signature-minting.js → signatureMinting.js} +0 -0
- /package/dist/cjs/anyspend/types/{signature-mint.js → api_req_res.js} +0 -0
- /package/dist/cjs/anyspend/types/{signature-mint.d.ts → signatureMint.d.ts} +0 -0
- /package/dist/esm/anyspend/abis/{abi-usdc-base.d.ts → abiUsdcBase.d.ts} +0 -0
- /package/dist/esm/anyspend/abis/{abi-usdc-base.js → abiUsdcBase.js} +0 -0
- /package/dist/esm/anyspend/abis/{erc20-staking.d.ts → erc20Staking.d.ts} +0 -0
- /package/dist/esm/anyspend/abis/{erc20-staking.js → erc20Staking.js} +0 -0
- /package/dist/esm/anyspend/abis/{signature-minting.d.ts → signatureMinting.d.ts} +0 -0
- /package/dist/esm/anyspend/abis/{signature-minting.js → signatureMinting.js} +0 -0
- /package/dist/esm/anyspend/types/{signature-mint.js → api_req_res.js} +0 -0
- /package/dist/esm/anyspend/types/{signature-mint.d.ts → signatureMint.d.ts} +0 -0
- /package/dist/types/anyspend/abis/{abi-usdc-base.d.ts → abiUsdcBase.d.ts} +0 -0
- /package/dist/types/anyspend/abis/{erc20-staking.d.ts → erc20Staking.d.ts} +0 -0
- /package/dist/types/anyspend/abis/{signature-minting.d.ts → signatureMinting.d.ts} +0 -0
- /package/dist/types/anyspend/types/{signature-mint.d.ts → signatureMint.d.ts} +0 -0
- /package/src/anyspend/abis/{abi-usdc-base.ts → abiUsdcBase.ts} +0 -0
- /package/src/anyspend/abis/{erc20-staking.ts → erc20Staking.ts} +0 -0
- /package/src/anyspend/abis/{signature-minting.ts → signatureMinting.ts} +0 -0
- /package/src/anyspend/types/{signature-mint.ts → signatureMint.ts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function getVendorDisplayName(vendor?:
|
|
3
|
-
export declare function getPaymentMethodDescription(vendor?:
|
|
1
|
+
import { components } from "../../anyspend/types/api";
|
|
2
|
+
export declare function getVendorDisplayName(vendor?: components["schemas"]["OnrampMetadata"]["vendor"]): string;
|
|
3
|
+
export declare function getPaymentMethodDescription(vendor?: components["schemas"]["OnrampMetadata"]["vendor"]): string;
|
|
4
4
|
export declare function formatStripeAmount(amount: number): string;
|
|
5
5
|
export declare function generateReturnUrl(orderId: string): string;
|
|
@@ -4,14 +4,13 @@ exports.getVendorDisplayName = getVendorDisplayName;
|
|
|
4
4
|
exports.getPaymentMethodDescription = getPaymentMethodDescription;
|
|
5
5
|
exports.formatStripeAmount = formatStripeAmount;
|
|
6
6
|
exports.generateReturnUrl = generateReturnUrl;
|
|
7
|
-
const anyspend_1 = require("../../anyspend");
|
|
8
7
|
const constants_1 = require("../../anyspend/constants");
|
|
9
8
|
function getVendorDisplayName(vendor) {
|
|
10
9
|
switch (vendor) {
|
|
11
|
-
case
|
|
10
|
+
case "coinbase":
|
|
12
11
|
return constants_1.VENDOR_DISPLAY_NAMES.coinbase;
|
|
13
|
-
case
|
|
14
|
-
case
|
|
12
|
+
case "stripe":
|
|
13
|
+
case "stripe-web2":
|
|
15
14
|
return constants_1.VENDOR_DISPLAY_NAMES.stripe;
|
|
16
15
|
default:
|
|
17
16
|
return constants_1.VENDOR_DISPLAY_NAMES.unknown;
|
|
@@ -19,10 +18,10 @@ function getVendorDisplayName(vendor) {
|
|
|
19
18
|
}
|
|
20
19
|
function getPaymentMethodDescription(vendor) {
|
|
21
20
|
switch (vendor) {
|
|
22
|
-
case
|
|
23
|
-
case
|
|
21
|
+
case "stripe":
|
|
22
|
+
case "stripe-web2":
|
|
24
23
|
return "card, Apple Pay, Google Pay, and more";
|
|
25
|
-
case
|
|
24
|
+
case "coinbase":
|
|
26
25
|
return "debit card, or using your Coinbase account";
|
|
27
26
|
default:
|
|
28
27
|
return "supported payment method";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export declare const ABI_bondKit: readonly [{
|
|
2
|
+
readonly inputs: readonly [{
|
|
3
|
+
readonly internalType: "address";
|
|
4
|
+
readonly name: "_recipient";
|
|
5
|
+
readonly type: "address";
|
|
6
|
+
}, {
|
|
7
|
+
readonly internalType: "uint256";
|
|
8
|
+
readonly name: "_minTokensOut";
|
|
9
|
+
readonly type: "uint256";
|
|
10
|
+
}];
|
|
11
|
+
readonly name: "buyFor";
|
|
12
|
+
readonly outputs: readonly [];
|
|
13
|
+
readonly stateMutability: "payable";
|
|
14
|
+
readonly type: "function";
|
|
15
|
+
}, {
|
|
16
|
+
readonly inputs: readonly [];
|
|
17
|
+
readonly name: "name";
|
|
18
|
+
readonly outputs: readonly [{
|
|
19
|
+
readonly internalType: "string";
|
|
20
|
+
readonly name: "";
|
|
21
|
+
readonly type: "string";
|
|
22
|
+
}];
|
|
23
|
+
readonly stateMutability: "view";
|
|
24
|
+
readonly type: "function";
|
|
25
|
+
}, {
|
|
26
|
+
readonly inputs: readonly [];
|
|
27
|
+
readonly name: "symbol";
|
|
28
|
+
readonly outputs: readonly [{
|
|
29
|
+
readonly internalType: "string";
|
|
30
|
+
readonly name: "";
|
|
31
|
+
readonly type: "string";
|
|
32
|
+
}];
|
|
33
|
+
readonly stateMutability: "view";
|
|
34
|
+
readonly type: "function";
|
|
35
|
+
}];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const ABI_bondKit = [
|
|
2
|
+
{
|
|
3
|
+
inputs: [
|
|
4
|
+
{ internalType: "address", name: "_recipient", type: "address" },
|
|
5
|
+
{ internalType: "uint256", name: "_minTokensOut", type: "uint256" },
|
|
6
|
+
],
|
|
7
|
+
name: "buyFor",
|
|
8
|
+
outputs: [],
|
|
9
|
+
stateMutability: "payable",
|
|
10
|
+
type: "function",
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
inputs: [],
|
|
14
|
+
name: "name",
|
|
15
|
+
outputs: [{ internalType: "string", name: "", type: "string" }],
|
|
16
|
+
stateMutability: "view",
|
|
17
|
+
type: "function",
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
inputs: [],
|
|
21
|
+
name: "symbol",
|
|
22
|
+
outputs: [{ internalType: "string", name: "", type: "string" }],
|
|
23
|
+
stateMutability: "view",
|
|
24
|
+
type: "function",
|
|
25
|
+
},
|
|
26
|
+
];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { components } from "../types/api";
|
|
2
2
|
export declare const ANYSPEND_MAINNET_BASE_URL: string;
|
|
3
3
|
export declare const ANYSPEND_TESTNET_BASE_URL: string;
|
|
4
4
|
export declare const RELAY_ETH_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
@@ -6,10 +6,21 @@ export declare const RELAY_SOL_ADDRESS = "11111111111111111111111111111111";
|
|
|
6
6
|
export declare const RELAY_SOLANA_MAINNET_CHAIN_ID = 792703809;
|
|
7
7
|
export declare const SOLANA_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
8
8
|
export declare const SOLANA_TOKEN_2022_PROGRAM_ID = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
|
|
9
|
-
export declare const B3_TOKEN: Token;
|
|
10
|
-
export declare const USDC_BASE: Token;
|
|
11
|
-
export declare const NFT_CONTRACTS: NftContract[];
|
|
12
|
-
export declare const DEFAULT_NFT_CONTRACT:
|
|
9
|
+
export declare const B3_TOKEN: components["schemas"]["Token"];
|
|
10
|
+
export declare const USDC_BASE: components["schemas"]["Token"];
|
|
11
|
+
export declare const NFT_CONTRACTS: components["schemas"]["NftContract"][];
|
|
12
|
+
export declare const DEFAULT_NFT_CONTRACT: {
|
|
13
|
+
chainId: number;
|
|
14
|
+
contractAddress: string;
|
|
15
|
+
price: string;
|
|
16
|
+
priceFormatted: string;
|
|
17
|
+
currency: components["schemas"]["Token"];
|
|
18
|
+
imageUrl: string;
|
|
19
|
+
name: string;
|
|
20
|
+
description: string;
|
|
21
|
+
tokenId: number | null;
|
|
22
|
+
type: "erc721" | "erc1155";
|
|
23
|
+
};
|
|
13
24
|
export declare const STRIPE_CONFIG: {
|
|
14
25
|
readonly publishableKey: "pk_live_51QkrBwJnoDg53PsPq7QYOxSLfnXvtCVeD9UuyZ6c136i42XtYC2Z2bl1W5xbDg6AaoGyq63ErCc0yv3C2KBX29CG002AE862CP";
|
|
15
26
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { NftType } from "../../anyspend/types/index.js";
|
|
2
1
|
import { base } from "viem/chains";
|
|
3
2
|
export const ANYSPEND_MAINNET_BASE_URL = process.env.NEXT_PUBLIC_ANYSPEND_BASE_URL || "https://mainnet.anyspend.com";
|
|
4
3
|
export const ANYSPEND_TESTNET_BASE_URL = process.env.NEXT_PUBLIC_ANYSPEND_BASE_URL || "https://testnet.anyspend.com";
|
|
@@ -37,8 +36,8 @@ export const NFT_CONTRACTS = [
|
|
|
37
36
|
imageUrl: "https://storage.googleapis.com/nftimagebucket/base/tokens/0x80f0e6644723abb03aa8867d21e32bd854b2a2d9/preview/TVRjME1EUTRORFl4T0E9PV8zNjcy.jpg",
|
|
38
37
|
name: "Downhill Ski",
|
|
39
38
|
description: "Downhill Ski",
|
|
40
|
-
tokenId:
|
|
41
|
-
type:
|
|
39
|
+
tokenId: 0,
|
|
40
|
+
type: "erc721",
|
|
42
41
|
},
|
|
43
42
|
{
|
|
44
43
|
chainId: base.id,
|
|
@@ -50,7 +49,7 @@ export const NFT_CONTRACTS = [
|
|
|
50
49
|
name: "Eclipse Venom",
|
|
51
50
|
description: "The Eclipse Venom's crystalline blade channels imprisoned astral toxins through swirling currents of violet and teal light, synchronizing with its wielder's heartbeat for strikes that bypass conventional armor. Wounds from this otherworldly weapon resist healing as victims describe being consumed from within by liquid darkness, their final moments filled with visions of infinite cosmic depths.",
|
|
52
51
|
tokenId: null,
|
|
53
|
-
type:
|
|
52
|
+
type: "erc721",
|
|
54
53
|
},
|
|
55
54
|
];
|
|
56
55
|
export const DEFAULT_NFT_CONTRACT = NFT_CONTRACTS[1];
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
export * from "./types";
|
|
2
|
-
export * from "./types/metadata";
|
|
3
|
-
export * from "./types/relay";
|
|
4
|
-
export * from "./types/signature-mint";
|
|
5
|
-
export * from "./types/token";
|
|
1
|
+
export * from "./types/api";
|
|
6
2
|
export * from "./utils/address";
|
|
7
3
|
export * from "./utils/chain";
|
|
8
4
|
export * from "./utils/format";
|
|
@@ -11,5 +7,5 @@ export * from "./utils/number";
|
|
|
11
7
|
export * from "./utils/string";
|
|
12
8
|
export * from "./utils/token";
|
|
13
9
|
export * from "./constants";
|
|
14
|
-
export * from "./abis/
|
|
15
|
-
export * from "./abis/
|
|
10
|
+
export * from "./abis/abiUsdcBase";
|
|
11
|
+
export * from "./abis/erc20Staking";
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
// Types
|
|
2
|
-
export * from "./types/
|
|
3
|
-
export * from "./types/metadata.js";
|
|
4
|
-
export * from "./types/relay.js";
|
|
5
|
-
export * from "./types/signature-mint.js";
|
|
6
|
-
export * from "./types/token.js";
|
|
2
|
+
export * from "./types/api.js";
|
|
7
3
|
// Utils
|
|
8
4
|
export * from "./utils/address.js";
|
|
9
5
|
export * from "./utils/chain.js";
|
|
@@ -15,5 +11,5 @@ export * from "./utils/token.js";
|
|
|
15
11
|
// Constants
|
|
16
12
|
export * from "./constants/index.js";
|
|
17
13
|
// Abis
|
|
18
|
-
export * from "./abis/
|
|
19
|
-
export * from "./abis/
|
|
14
|
+
export * from "./abis/abiUsdcBase.js";
|
|
15
|
+
export * from "./abis/erc20Staking.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from "./react/hooks";
|
|
2
2
|
export * from "./react/providers/AnyspendProvider";
|
|
3
|
-
export * from "./types";
|
|
3
|
+
export * from "./types/api";
|
|
4
4
|
export * from "./utils/address";
|
|
5
5
|
export * from "./utils/chain";
|
|
6
6
|
export * from "./utils/format";
|
|
@@ -9,5 +9,5 @@ export * from "./utils/number";
|
|
|
9
9
|
export * from "./utils/string";
|
|
10
10
|
export * from "./utils/token";
|
|
11
11
|
export * from "./constants";
|
|
12
|
-
export * from "./abis/
|
|
13
|
-
export * from "./abis/
|
|
12
|
+
export * from "./abis/abiUsdcBase";
|
|
13
|
+
export * from "./abis/erc20Staking";
|
|
@@ -3,7 +3,7 @@ export * from "./react/hooks/index.js";
|
|
|
3
3
|
// Providers
|
|
4
4
|
export * from "./react/providers/AnyspendProvider.js";
|
|
5
5
|
// Types
|
|
6
|
-
export * from "./types/
|
|
6
|
+
export * from "./types/api.js";
|
|
7
7
|
// Utils
|
|
8
8
|
export * from "./utils/address.js";
|
|
9
9
|
export * from "./utils/chain.js";
|
|
@@ -15,5 +15,5 @@ export * from "./utils/token.js";
|
|
|
15
15
|
// Constants
|
|
16
16
|
export * from "./constants/index.js";
|
|
17
17
|
// Abis
|
|
18
|
-
export * from "./abis/
|
|
19
|
-
export * from "./abis/
|
|
18
|
+
export * from "./abis/abiUsdcBase.js";
|
|
19
|
+
export * from "./abis/erc20Staking.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { getDefaultToken,
|
|
3
|
+
import { getDefaultToken, USDC_BASE } from "../../../anyspend/index.js";
|
|
4
4
|
import { useAnyspendCreateOrder, useAnyspendOrderAndTransactions, useAnyspendQuote, } from "../../../anyspend/react/index.js";
|
|
5
5
|
import { Button, ShinyButton, StyleRoot, TransitionPanel, useAccountWallet, useOnchainName, useRouter, useSearchParamsSSR, useTokenData, useTokenFromUrl, } from "../../../global-account/react/index.js";
|
|
6
6
|
import { cn } from "../../../shared/utils/cn.js";
|
|
@@ -277,17 +277,17 @@ export function AnySpend({ destinationTokenAddress, destinationTokenChainId, isM
|
|
|
277
277
|
}, [recipientAddressFromProps, globalAddress]);
|
|
278
278
|
// Get anyspend price
|
|
279
279
|
const activeInputAmountInWei = isSrcInputDirty
|
|
280
|
-
? parseUnits(srcAmount.
|
|
281
|
-
: parseUnits(dstAmount.
|
|
282
|
-
const srcAmountOnrampInWei = parseUnits(srcAmountOnRamp.
|
|
280
|
+
? parseUnits(srcAmount.replace(/,/g, ""), selectedSrcToken.decimals).toString()
|
|
281
|
+
: parseUnits(dstAmount.replace(/,/g, ""), selectedDstToken.decimals).toString();
|
|
282
|
+
const srcAmountOnrampInWei = parseUnits(srcAmountOnRamp.replace(/,/g, ""), USDC_BASE.decimals).toString();
|
|
283
283
|
const { anyspendQuote, isLoadingAnyspendQuote, getAnyspendQuoteError } = useAnyspendQuote(isMainnet, activeTab === "crypto"
|
|
284
284
|
? {
|
|
285
285
|
srcChain: selectedSrcChainId,
|
|
286
286
|
dstChain: isBuyMode ? destinationTokenChainId : selectedDstChainId,
|
|
287
287
|
srcTokenAddress: selectedSrcToken.address,
|
|
288
288
|
dstTokenAddress: isBuyMode ? destinationTokenAddress : selectedDstToken.address,
|
|
289
|
-
type:
|
|
290
|
-
tradeType: isSrcInputDirty ?
|
|
289
|
+
type: "swap",
|
|
290
|
+
tradeType: isSrcInputDirty ? "EXACT_INPUT" : "EXPECTED_OUTPUT",
|
|
291
291
|
amount: activeInputAmountInWei,
|
|
292
292
|
}
|
|
293
293
|
: {
|
|
@@ -295,8 +295,8 @@ export function AnySpend({ destinationTokenAddress, destinationTokenChainId, isM
|
|
|
295
295
|
dstChain: isBuyMode ? destinationTokenChainId : selectedDstChainId,
|
|
296
296
|
srcTokenAddress: USDC_BASE.address,
|
|
297
297
|
dstTokenAddress: isBuyMode ? destinationTokenAddress : selectedDstToken.address,
|
|
298
|
-
type:
|
|
299
|
-
tradeType:
|
|
298
|
+
type: "swap",
|
|
299
|
+
tradeType: "EXACT_INPUT",
|
|
300
300
|
amount: srcAmountOnrampInWei,
|
|
301
301
|
});
|
|
302
302
|
// Replace the old ENS lookup with our new hooks
|
|
@@ -362,11 +362,11 @@ export function AnySpend({ destinationTokenAddress, destinationTokenChainId, isM
|
|
|
362
362
|
// const handleCreateOrder = async (recipientAddress: string) => {
|
|
363
363
|
// try {
|
|
364
364
|
// invariant(anyspendPrice, "Relay price is not found");
|
|
365
|
-
// const srcAmountBigInt = parseUnits(srcAmount.
|
|
365
|
+
// const srcAmountBigInt = parseUnits(srcAmount.replace(/,/g, ""), selectedSrcToken.decimals);
|
|
366
366
|
// createOrder({
|
|
367
367
|
// isMainnet,
|
|
368
368
|
// recipientAddress,
|
|
369
|
-
// orderType:
|
|
369
|
+
// orderType: "swap",
|
|
370
370
|
// srcChain: selectedSrcChainId,
|
|
371
371
|
// dstChain: selectedDstChainId,
|
|
372
372
|
// srcToken: selectedSrcToken,
|
|
@@ -518,11 +518,11 @@ export function AnySpend({ destinationTokenAddress, destinationTokenChainId, isM
|
|
|
518
518
|
setActivePanel(PanelView.FIAT_PAYMENT);
|
|
519
519
|
return;
|
|
520
520
|
}
|
|
521
|
-
const srcAmountBigInt = parseUnits(srcAmount.
|
|
521
|
+
const srcAmountBigInt = parseUnits(srcAmount.replace(/,/g, ""), selectedSrcToken.decimals);
|
|
522
522
|
createOrder({
|
|
523
523
|
isMainnet,
|
|
524
524
|
recipientAddress,
|
|
525
|
-
orderType:
|
|
525
|
+
orderType: "swap",
|
|
526
526
|
srcChain: selectedSrcChainId,
|
|
527
527
|
dstChain: isBuyMode ? destinationTokenChainId : selectedDstChainId,
|
|
528
528
|
srcToken: selectedSrcToken,
|
|
@@ -654,7 +654,7 @@ export function AnySpend({ destinationTokenAddress, destinationTokenChainId, isM
|
|
|
654
654
|
// Using inline style to ensure color displays
|
|
655
655
|
return (_jsxs("span", { className: "ml-2", style: { color: percentageNum >= 10 ? "red" : "#FFD700" }, children: ["(", isNegative ? "-" : "", percentage, "%)"] }));
|
|
656
656
|
})()] })] })] }), getAnyspendQuoteError && (_jsxs("div", { className: "bg-as-on-surface-1 flex w-full max-w-[460px] items-center gap-2 rounded-2xl p-4", children: [_jsx(CircleAlert, { className: "bg-as-red h-4 min-h-4 w-4 min-w-4 rounded-full p-0 text-sm font-medium text-white" }), _jsx("div", { className: "text-as-red text-sm", children: getAnyspendQuoteError.message })] })), _jsxs(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: "flex w-full max-w-[460px] flex-col gap-2", children: [_jsxs(ShinyButton, { accentColor: "hsl(var(--as-brand))", disabled: btnInfo.disable, onClick: onMainButtonClick, className: cn("relative w-full", btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand"), textClassName: cn(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white"), children: [btnInfo.text, !btnInfo.disable && !btnInfo.error && (_jsx(ChevronRightCircle, { className: "absolute right-0 top-1/2 h-6 w-6 -translate-y-1/2 opacity-70" }))] }), !hideTransactionHistoryButton && (globalAddress || recipientAddress) ? (_jsxs(Button, { variant: "link", onClick: onClickHistory, className: "text-as-primary/50 hover:text-as-primary flex items-center gap-1 transition-colors", children: [_jsx(HistoryIcon, { className: "h-4 w-4" }), " ", _jsx("span", { className: "pr-4", children: "Transaction History" })] })) : (_jsx("div", { className: "h-2 w-full" }))] })] }));
|
|
657
|
-
const onrampPaymentView = (_jsx(PanelOnrampPayment, { srcAmountOnRamp: srcAmountOnRamp, recipientName: recipientName, recipientAddress: recipientAddress, isMainnet: isMainnet, isBuyMode: isBuyMode, destinationTokenChainId: destinationTokenChainId, destinationTokenAddress: destinationTokenAddress, selectedDstChainId: selectedDstChainId, selectedDstToken: selectedDstToken, orderType:
|
|
657
|
+
const onrampPaymentView = (_jsx(PanelOnrampPayment, { srcAmountOnRamp: srcAmountOnRamp, recipientName: recipientName, recipientAddress: recipientAddress, isMainnet: isMainnet, isBuyMode: isBuyMode, destinationTokenChainId: destinationTokenChainId, destinationTokenAddress: destinationTokenAddress, selectedDstChainId: selectedDstChainId, selectedDstToken: selectedDstToken, orderType: "swap", anyspendQuote: anyspendQuote, globalAddress: globalAddress, onOrderCreated: orderId => {
|
|
658
658
|
setOrderId(orderId);
|
|
659
659
|
setActivePanel(PanelView.ORDER_DETAILS);
|
|
660
660
|
// Add orderId to URL for persistence
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { AnySpendBondKitProps } from "../../../global-account/react/stores/useModalStore";
|
|
2
|
+
export declare function AnySpendBondKit({ mode, recipientAddress, contractAddress, minTokensOut, imageUrl, ethAmount: initialEthAmount, onSuccess, }: AnySpendBondKitProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { BondkitToken } from "@b3dotfun/bondkit";
|
|
3
|
+
import { Button, GlareCardRounded, Input, StyleRoot, useHasMounted, useTokenData, } from "../../../global-account/react/index.js";
|
|
4
|
+
import { baseMainnet } from "../../../shared/constants/chains/supported.js";
|
|
5
|
+
import { motion } from "framer-motion";
|
|
6
|
+
import { useEffect, useMemo, useState } from "react";
|
|
7
|
+
import { createPublicClient, encodeFunctionData, formatEther, http, parseEther } from "viem";
|
|
8
|
+
import { ABI_bondKit } from "../../abis/bondKit.js";
|
|
9
|
+
import { AnySpendCustom } from "./AnySpendCustom.js";
|
|
10
|
+
// Debounce utility function
|
|
11
|
+
function debounce(func, wait) {
|
|
12
|
+
let timeout;
|
|
13
|
+
return (...args) => {
|
|
14
|
+
clearTimeout(timeout);
|
|
15
|
+
timeout = setTimeout(() => func(...args), wait);
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
// Format number with commas
|
|
19
|
+
function formatNumberWithCommas(x) {
|
|
20
|
+
const parts = x.split(".");
|
|
21
|
+
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
22
|
+
return parts.join(".");
|
|
23
|
+
}
|
|
24
|
+
export function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, minTokensOut = "0", imageUrl, ethAmount: initialEthAmount, onSuccess, }) {
|
|
25
|
+
const hasMounted = useHasMounted();
|
|
26
|
+
const [showAmountPrompt, setShowAmountPrompt] = useState(!initialEthAmount);
|
|
27
|
+
const [ethAmount, setEthAmount] = useState(initialEthAmount || "");
|
|
28
|
+
const [isAmountValid, setIsAmountValid] = useState(!!initialEthAmount);
|
|
29
|
+
const [validationError, setValidationError] = useState("");
|
|
30
|
+
const [tokenName, setTokenName] = useState("");
|
|
31
|
+
const [tokenSymbol, setTokenSymbol] = useState("");
|
|
32
|
+
const [quote, setQuote] = useState(null);
|
|
33
|
+
const [isLoadingQuote, setIsLoadingQuote] = useState(false);
|
|
34
|
+
// Create BondKit client
|
|
35
|
+
const bondkitTokenClient = useMemo(() => {
|
|
36
|
+
if (!contractAddress)
|
|
37
|
+
return null;
|
|
38
|
+
try {
|
|
39
|
+
const client = new BondkitToken(contractAddress);
|
|
40
|
+
client.connect();
|
|
41
|
+
return client;
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
console.error("Error creating bondkit client", error);
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
}, [contractAddress]);
|
|
48
|
+
// Create a public client for reading contract data
|
|
49
|
+
const basePublicClient = createPublicClient({
|
|
50
|
+
chain: baseMainnet,
|
|
51
|
+
transport: http(),
|
|
52
|
+
});
|
|
53
|
+
// Fetch token name from contract
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
async function fetchTokenName() {
|
|
56
|
+
try {
|
|
57
|
+
const [name, symbol] = await Promise.all([
|
|
58
|
+
basePublicClient.readContract({
|
|
59
|
+
address: contractAddress,
|
|
60
|
+
abi: ABI_bondKit,
|
|
61
|
+
functionName: "name",
|
|
62
|
+
}),
|
|
63
|
+
basePublicClient.readContract({
|
|
64
|
+
address: contractAddress,
|
|
65
|
+
abi: ABI_bondKit,
|
|
66
|
+
functionName: "symbol",
|
|
67
|
+
}),
|
|
68
|
+
]);
|
|
69
|
+
setTokenName(name);
|
|
70
|
+
setTokenSymbol(symbol);
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
console.error("Error fetching token name:", error);
|
|
74
|
+
setTokenName("BondKit Token");
|
|
75
|
+
setTokenSymbol("BOND");
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (contractAddress) {
|
|
79
|
+
fetchTokenName();
|
|
80
|
+
}
|
|
81
|
+
}, [contractAddress, basePublicClient]);
|
|
82
|
+
// Get native token data for the chain
|
|
83
|
+
const { data: tokenData, isError: isTokenError, isLoading, } = useTokenData(baseMainnet.id, "0x0000000000000000000000000000000000000000");
|
|
84
|
+
// Convert token data to AnySpend Token type
|
|
85
|
+
const dstToken = useMemo(() => {
|
|
86
|
+
if (!tokenData)
|
|
87
|
+
return null;
|
|
88
|
+
return {
|
|
89
|
+
address: tokenData.address,
|
|
90
|
+
chainId: baseMainnet.id,
|
|
91
|
+
name: tokenData.name,
|
|
92
|
+
symbol: tokenData.symbol,
|
|
93
|
+
decimals: tokenData.decimals,
|
|
94
|
+
metadata: {
|
|
95
|
+
logoURI: tokenData.logoURI,
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
}, [tokenData]);
|
|
99
|
+
// Debounced quote fetching
|
|
100
|
+
const debouncedGetQuote = useMemo(() => debounce(async (val) => {
|
|
101
|
+
if (!val || Number(val) <= 0 || !bondkitTokenClient) {
|
|
102
|
+
setQuote(null);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
try {
|
|
106
|
+
setIsLoadingQuote(true);
|
|
107
|
+
const parsedAmount = parseEther(val);
|
|
108
|
+
const buyQuote = await bondkitTokenClient.getAmountOfTokensToBuy(parsedAmount);
|
|
109
|
+
setQuote(buyQuote ? formatEther(buyQuote) : null);
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
console.error("Error getting buy quote:", error);
|
|
113
|
+
setQuote(null);
|
|
114
|
+
}
|
|
115
|
+
finally {
|
|
116
|
+
setIsLoadingQuote(false);
|
|
117
|
+
}
|
|
118
|
+
}, 500), [bondkitTokenClient]);
|
|
119
|
+
// Fetch initial quote if ethAmount is provided
|
|
120
|
+
useEffect(() => {
|
|
121
|
+
if (initialEthAmount && bondkitTokenClient) {
|
|
122
|
+
debouncedGetQuote(initialEthAmount);
|
|
123
|
+
}
|
|
124
|
+
}, [initialEthAmount, bondkitTokenClient, debouncedGetQuote]);
|
|
125
|
+
const validateAndSetAmount = (value) => {
|
|
126
|
+
// Allow empty input
|
|
127
|
+
if (value === "") {
|
|
128
|
+
setEthAmount("");
|
|
129
|
+
setIsAmountValid(false);
|
|
130
|
+
setValidationError("");
|
|
131
|
+
setQuote(null);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
// Only allow valid number format (no leading zeros unless decimal)
|
|
135
|
+
if (!/^(0|[1-9]\d*)?\.?\d*$/.test(value)) {
|
|
136
|
+
setIsAmountValid(false);
|
|
137
|
+
setValidationError("Please enter a valid number");
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
// Prevent multiple decimal points
|
|
141
|
+
if ((value.match(/\./g) || []).length > 1) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
// Prevent more than 18 decimal places (ETH precision)
|
|
145
|
+
const parts = value.split(".");
|
|
146
|
+
if (parts[1] && parts[1].length > 18) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
// Clean the input - remove leading zeros if not decimal
|
|
150
|
+
const cleanedValue = value.startsWith("0") && !value.startsWith("0.") ? value.replace(/^0+/, "0") : value;
|
|
151
|
+
setEthAmount(cleanedValue);
|
|
152
|
+
try {
|
|
153
|
+
const parsedAmount = parseEther(cleanedValue);
|
|
154
|
+
if (parsedAmount <= BigInt(0)) {
|
|
155
|
+
setIsAmountValid(false);
|
|
156
|
+
setValidationError("Amount must be greater than 0");
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
setIsAmountValid(true);
|
|
160
|
+
setValidationError("");
|
|
161
|
+
debouncedGetQuote(cleanedValue);
|
|
162
|
+
}
|
|
163
|
+
catch (error) {
|
|
164
|
+
console.error("Error validating amount:", error);
|
|
165
|
+
setIsAmountValid(false);
|
|
166
|
+
setValidationError("Please enter a valid amount");
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
const header = () => (_jsx("div", { className: "w-full px-6 py-4", children: _jsxs("div", { className: "flex w-full flex-col items-center space-y-6", children: [_jsxs("h2", { className: "text-[28px] font-bold", children: ["Buy ", tokenName, " (", tokenSymbol, ")"] }), _jsxs("div", { className: "flex w-full flex-col items-center space-y-2", children: [_jsxs("span", { className: "text-[28px] font-bold", children: [ethAmount, " ETH"] }), quote && (_jsxs("span", { className: "text-lg", children: ["\u2248 ", formatNumberWithCommas(parseFloat(quote).toFixed(4)), " ", tokenSymbol] }))] })] }) }));
|
|
170
|
+
// Show loading state while fetching token data
|
|
171
|
+
if (isLoading) {
|
|
172
|
+
return (_jsx(StyleRoot, { children: _jsx("div", { className: "b3-root b3-modal bg-b3-react-background flex w-full flex-col items-center p-8", children: _jsx("p", { className: "text-as-primary/70 text-center text-sm", children: "Loading payment information..." }) }) }));
|
|
173
|
+
}
|
|
174
|
+
// If we don't have token data after loading, show error state
|
|
175
|
+
if (!dstToken || isTokenError) {
|
|
176
|
+
return (_jsx(StyleRoot, { children: _jsx("div", { className: "b3-root b3-modal bg-b3-react-background flex w-full flex-col items-center p-8", children: _jsxs("p", { className: "text-as-red text-center text-sm", children: ["Failed to fetch native token information for chain ", baseMainnet.id, ". Please try again."] }) }) }));
|
|
177
|
+
}
|
|
178
|
+
if (showAmountPrompt) {
|
|
179
|
+
return (_jsx(StyleRoot, { children: _jsxs("div", { className: "bg-b3-react-background flex w-full flex-col items-center", children: [_jsxs("div", { className: "w-full px-4 pb-2 pt-4", children: [_jsx(motion.div, { initial: false, animate: {
|
|
180
|
+
opacity: hasMounted ? 1 : 0,
|
|
181
|
+
y: hasMounted ? 0 : 20,
|
|
182
|
+
filter: hasMounted ? "blur(0px)" : "blur(10px)",
|
|
183
|
+
}, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, className: "mb-4 flex justify-center", children: imageUrl && (_jsxs("div", { className: "relative size-16", children: [_jsx("div", { className: "absolute inset-0 scale-95 rounded-[50%] bg-gradient-to-br from-blue-500/20 to-purple-600/20 blur-xl" }), _jsxs(GlareCardRounded, { className: "overflow-hidden rounded-full border-none bg-gradient-to-br from-blue-500/10 to-purple-600/10 backdrop-blur-sm", children: [_jsx("img", { alt: "token preview", className: "size-full rounded-lg object-cover", src: imageUrl }), _jsx("div", { className: "absolute inset-0 rounded-[50%] border border-white/20" })] })] })) }), _jsx(motion.div, { initial: false, animate: {
|
|
184
|
+
opacity: hasMounted ? 1 : 0,
|
|
185
|
+
y: hasMounted ? 0 : 20,
|
|
186
|
+
filter: hasMounted ? "blur(0px)" : "blur(10px)",
|
|
187
|
+
}, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "text-center", children: _jsxs("h2", { className: "font-sf-rounded text-as-primary mb-4 text-2xl font-bold", children: ["Buy ", tokenName] }) })] }), _jsx(motion.div, { initial: false, animate: {
|
|
188
|
+
opacity: hasMounted ? 1 : 0,
|
|
189
|
+
y: hasMounted ? 0 : 20,
|
|
190
|
+
filter: hasMounted ? "blur(0px)" : "blur(10px)",
|
|
191
|
+
}, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: "bg-b3-react-background w-full p-6", children: _jsxs("div", { className: "space-y-4", children: [_jsx("div", { className: "flex items-center justify-between", children: _jsx("p", { className: "text-as-primary/70 text-sm font-medium", children: "ETH Amount" }) }), _jsx("div", { className: "relative", children: _jsx(Input, { type: "text", inputMode: "decimal", placeholder: "0.1", value: ethAmount, onChange: e => validateAndSetAmount(e.target.value), className: `h-14 px-4 text-lg ${!isAmountValid && ethAmount ? "border-as-red" : "border-b3-react-border"}` }) }), !isAmountValid && ethAmount && _jsx("p", { className: "text-as-red text-sm", children: validationError }), _jsxs("div", { className: "bg-as-on-surface-2/30 rounded-lg border border-white/10 p-4 backdrop-blur-sm", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "text-as-primary/70 text-sm font-medium", children: "Total Cost:" }), _jsx("div", { className: "flex items-center gap-2", children: _jsxs("span", { className: "text-as-primary text-lg font-bold", children: [ethAmount || "0", " ETH"] }) })] }), isLoadingQuote ? (_jsx("div", { className: "mt-2 text-center", children: _jsx("span", { className: "text-as-primary/70 text-sm", children: "Calculating tokens..." }) })) : quote ? (_jsxs("div", { className: "mt-2 flex items-center justify-between", children: [_jsx("span", { className: "text-as-primary/70 text-sm font-medium", children: "You'll receive:" }), _jsxs("span", { className: "text-as-primary text-sm font-medium", children: ["\u2248 ", formatNumberWithCommas(parseFloat(quote).toFixed(4)), " ", tokenSymbol] })] })) : null] }), _jsx(Button, { onClick: () => {
|
|
192
|
+
if (isAmountValid && ethAmount) {
|
|
193
|
+
setShowAmountPrompt(false);
|
|
194
|
+
}
|
|
195
|
+
}, disabled: !isAmountValid || !ethAmount || isLoadingQuote, className: "bg-as-brand hover:bg-as-brand/90 text-as-primary mt-4 h-14 w-full rounded-xl text-lg font-medium", children: "Continue" })] }) })] }) }));
|
|
196
|
+
}
|
|
197
|
+
const encodedData = encodeFunctionData({
|
|
198
|
+
abi: ABI_bondKit,
|
|
199
|
+
functionName: "buyFor",
|
|
200
|
+
args: [recipientAddress, BigInt(minTokensOut)],
|
|
201
|
+
});
|
|
202
|
+
return (_jsx(AnySpendCustom, { isMainnet: true, mode: mode, recipientAddress: recipientAddress, orderType: "custom", dstChainId: baseMainnet.id, dstToken: dstToken, dstAmount: parseEther(ethAmount).toString(), contractAddress: contractAddress, encodedData: encodedData, metadata: {
|
|
203
|
+
type: "custom",
|
|
204
|
+
action: "BondKit Buy",
|
|
205
|
+
}, header: header, onSuccess: onSuccess, showRecipient: true }));
|
|
206
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { B3_TOKEN
|
|
2
|
+
import { B3_TOKEN } from "../../../anyspend/index.js";
|
|
3
3
|
import { Button, GlareCardRounded, Input, StyleRoot, TextLoop, useChainSwitchWithAction, useHasMounted, useModalStore, useTokenBalance, } from "../../../global-account/react/index.js";
|
|
4
4
|
import { baseMainnet } from "../../../shared/constants/chains/supported.js";
|
|
5
5
|
import { motion } from "framer-motion";
|
|
@@ -60,8 +60,6 @@ const SPIN_WHEEL_ABI = [
|
|
|
60
60
|
];
|
|
61
61
|
function getWheelStatus(wheelInfo) {
|
|
62
62
|
const now = BigInt(Math.floor(Date.now() / 1000));
|
|
63
|
-
console.log("@@anyspend-buy-spin:now:", now);
|
|
64
|
-
console.log("@@anyspend-buy-spin:wheelInfo:", wheelInfo);
|
|
65
63
|
if (now < wheelInfo.startTime_) {
|
|
66
64
|
return "not_started";
|
|
67
65
|
}
|
|
@@ -75,7 +73,6 @@ function getWheelStatus(wheelInfo) {
|
|
|
75
73
|
}
|
|
76
74
|
function generateEncodedDataForBuyEntriesAndSpin(user, quantity) {
|
|
77
75
|
invariant(BigInt(quantity) > 0, "Quantity must be greater than zero");
|
|
78
|
-
console.log("@@anyspend-buy-spin:encoded-data:", { user, quantity });
|
|
79
76
|
const encodedData = encodeFunctionData({
|
|
80
77
|
abi: SPIN_WHEEL_ABI,
|
|
81
78
|
functionName: "buyEntriesAndSpin",
|
|
@@ -136,7 +133,6 @@ export function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", s
|
|
|
136
133
|
const [validationError, setValidationError] = useState("");
|
|
137
134
|
const [displayQuantity, setDisplayQuantity] = useState("");
|
|
138
135
|
const [debouncedQuantity, setDebouncedQuantity] = useState("");
|
|
139
|
-
const [debouncedUserSpinQuantity, setDebouncedUserSpinQuantity] = useState("");
|
|
140
136
|
useEffect(() => {
|
|
141
137
|
if (prefillQuantity && wheelInfo) {
|
|
142
138
|
const remainingSpins = wheelInfo.totalPrizesAvailable_ - wheelInfo.prizesRequestedCount_;
|
|
@@ -153,7 +149,6 @@ export function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", s
|
|
|
153
149
|
try {
|
|
154
150
|
setIsLoadingConfig(true);
|
|
155
151
|
setConfigError("");
|
|
156
|
-
console.log("@@anyspend-buy-spin:fetch-config:", { spinwheelContractAddress, chainId });
|
|
157
152
|
const [config, entryModuleAddress, wheelInfo] = await Promise.all([
|
|
158
153
|
basePublicClient.readContract({
|
|
159
154
|
address: spinwheelContractAddress,
|
|
@@ -196,7 +191,7 @@ export function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", s
|
|
|
196
191
|
finally {
|
|
197
192
|
setIsLoadingConfig(false);
|
|
198
193
|
}
|
|
199
|
-
}, [spinwheelContractAddress
|
|
194
|
+
}, [spinwheelContractAddress]);
|
|
200
195
|
// Fetch config on mount and when dependencies change
|
|
201
196
|
useEffect(() => {
|
|
202
197
|
fetchPaymentConfig();
|
|
@@ -205,7 +200,6 @@ export function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", s
|
|
|
205
200
|
useEffect(() => {
|
|
206
201
|
const timer = setTimeout(() => {
|
|
207
202
|
setDebouncedQuantity(displayQuantity);
|
|
208
|
-
setDebouncedUserSpinQuantity(userSpinQuantity);
|
|
209
203
|
}, 500);
|
|
210
204
|
return () => clearTimeout(timer);
|
|
211
205
|
}, [displayQuantity, userSpinQuantity]);
|
|
@@ -335,7 +329,6 @@ export function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", s
|
|
|
335
329
|
const pricePerEntry = formatUnits(paymentConfig.pricePerEntry, 18);
|
|
336
330
|
const remainingEntries = wheelInfo ? wheelInfo.totalPrizesAvailable_ - wheelInfo.prizesRequestedCount_ : BigInt(0);
|
|
337
331
|
const wheelStatus = wheelInfo ? getWheelStatus(wheelInfo) : null;
|
|
338
|
-
const isSoldOut = wheelStatus === "sold_out";
|
|
339
332
|
const isActive = wheelStatus === "active";
|
|
340
333
|
const getStatusMessage = () => {
|
|
341
334
|
if (!wheelInfo)
|
|
@@ -388,8 +381,8 @@ export function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", s
|
|
|
388
381
|
}
|
|
389
382
|
// AnySpend flow for when user needs to swap to B3
|
|
390
383
|
const encodedData = generateEncodedDataForBuyEntriesAndSpin(address || "", userSpinQuantity);
|
|
391
|
-
return (_jsx(AnySpendCustom, { isMainnet: isMainnet, loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, orderType:
|
|
392
|
-
type:
|
|
384
|
+
return (_jsx(AnySpendCustom, { isMainnet: isMainnet, loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, orderType: "custom", dstChainId: chainId, dstToken: B3_TOKEN, dstAmount: totalCost.toString(), contractAddress: spinwheelContractAddress, spenderAddress: paymentConfig.entryModule, encodedData: encodedData, metadata: {
|
|
385
|
+
type: "custom",
|
|
393
386
|
action: `buy ${userSpinQuantity} spin${userSpinQuantity !== "1" ? "s" : ""}`,
|
|
394
387
|
}, header: header, onSuccess: txHash => onSuccess?.(txHash), showRecipient: false }));
|
|
395
388
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { components } from "../../../anyspend/types/api";
|
|
2
|
+
import { GetQuoteResponse } from "../../../anyspend/types/api_req_res";
|
|
2
3
|
import React from "react";
|
|
3
4
|
export declare function AnySpendCustom({ isMainnet, loadOrder, mode, recipientAddress: recipientAddressProps, spenderAddress, orderType, dstChainId, dstToken, dstAmount, contractAddress, encodedData, metadata, header, onSuccess, showRecipient, }: {
|
|
4
5
|
isMainnet?: boolean;
|
|
@@ -6,13 +7,13 @@ export declare function AnySpendCustom({ isMainnet, loadOrder, mode, recipientAd
|
|
|
6
7
|
mode?: "modal" | "page";
|
|
7
8
|
recipientAddress?: string;
|
|
8
9
|
spenderAddress?: string;
|
|
9
|
-
orderType:
|
|
10
|
+
orderType: components["schemas"]["Order"]["type"];
|
|
10
11
|
dstChainId: number;
|
|
11
|
-
dstToken: Token;
|
|
12
|
+
dstToken: components["schemas"]["Token"];
|
|
12
13
|
dstAmount: string;
|
|
13
14
|
contractAddress: string;
|
|
14
15
|
encodedData: string;
|
|
15
|
-
metadata:
|
|
16
|
+
metadata: any;
|
|
16
17
|
header: ({ anyspendPrice, isLoadingAnyspendPrice, }: {
|
|
17
18
|
anyspendPrice: GetQuoteResponse | undefined;
|
|
18
19
|
isLoadingAnyspendPrice: boolean;
|