@b3dotfun/sdk 0.0.8 → 0.0.9-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/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 +2 -7
- package/dist/cjs/anyspend/index.js +2 -8
- package/dist/cjs/anyspend/index.native.d.ts +2 -3
- package/dist/cjs/anyspend/index.native.js +2 -4
- 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 +2 -7
- package/dist/esm/anyspend/index.js +2 -8
- package/dist/esm/anyspend/index.native.d.ts +2 -3
- package/dist/esm/anyspend/index.native.js +2 -4
- 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 +2 -7
- package/dist/types/anyspend/index.native.d.ts +2 -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 +2 -5
- package/src/anyspend/index.ts +2 -9
- 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
package/README.md
CHANGED
|
@@ -412,7 +412,6 @@ The SDK components support custom styling through CSS classes and CSS-in-JS solu
|
|
|
412
412
|
All modules provide full TypeScript support with comprehensive type definitions:
|
|
413
413
|
|
|
414
414
|
```typescript
|
|
415
|
-
import type { Token } from "@b3dotfun/sdk/anyspend/types";
|
|
416
415
|
import type { GlobalAccount } from "@b3dotfun/sdk/global-account/types";
|
|
417
416
|
```
|
|
418
417
|
|
|
@@ -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,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ABI_bondKit = void 0;
|
|
4
|
+
exports.ABI_bondKit = [
|
|
5
|
+
{
|
|
6
|
+
inputs: [
|
|
7
|
+
{ internalType: "address", name: "_recipient", type: "address" },
|
|
8
|
+
{ internalType: "uint256", name: "_minTokensOut", type: "uint256" },
|
|
9
|
+
],
|
|
10
|
+
name: "buyFor",
|
|
11
|
+
outputs: [],
|
|
12
|
+
stateMutability: "payable",
|
|
13
|
+
type: "function",
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
inputs: [],
|
|
17
|
+
name: "name",
|
|
18
|
+
outputs: [{ internalType: "string", name: "", type: "string" }],
|
|
19
|
+
stateMutability: "view",
|
|
20
|
+
type: "function",
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
inputs: [],
|
|
24
|
+
name: "symbol",
|
|
25
|
+
outputs: [{ internalType: "string", name: "", type: "string" }],
|
|
26
|
+
stateMutability: "view",
|
|
27
|
+
type: "function",
|
|
28
|
+
},
|
|
29
|
+
];
|
|
@@ -1,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,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VENDOR_DISPLAY_NAMES = exports.PAYMENT_METHOD_ICONS = exports.STRIPE_CONFIG = exports.DEFAULT_NFT_CONTRACT = exports.NFT_CONTRACTS = exports.USDC_BASE = exports.B3_TOKEN = exports.SOLANA_TOKEN_2022_PROGRAM_ID = exports.SOLANA_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID = exports.RELAY_SOLANA_MAINNET_CHAIN_ID = exports.RELAY_SOL_ADDRESS = exports.RELAY_ETH_ADDRESS = exports.ANYSPEND_TESTNET_BASE_URL = exports.ANYSPEND_MAINNET_BASE_URL = void 0;
|
|
4
|
-
const types_1 = require("../../anyspend/types");
|
|
5
4
|
const chains_1 = require("viem/chains");
|
|
6
5
|
exports.ANYSPEND_MAINNET_BASE_URL = process.env.NEXT_PUBLIC_ANYSPEND_BASE_URL || "https://mainnet.anyspend.com";
|
|
7
6
|
exports.ANYSPEND_TESTNET_BASE_URL = process.env.NEXT_PUBLIC_ANYSPEND_BASE_URL || "https://testnet.anyspend.com";
|
|
@@ -40,8 +39,8 @@ exports.NFT_CONTRACTS = [
|
|
|
40
39
|
imageUrl: "https://storage.googleapis.com/nftimagebucket/base/tokens/0x80f0e6644723abb03aa8867d21e32bd854b2a2d9/preview/TVRjME1EUTRORFl4T0E9PV8zNjcy.jpg",
|
|
41
40
|
name: "Downhill Ski",
|
|
42
41
|
description: "Downhill Ski",
|
|
43
|
-
tokenId:
|
|
44
|
-
type:
|
|
42
|
+
tokenId: 0,
|
|
43
|
+
type: "erc721",
|
|
45
44
|
},
|
|
46
45
|
{
|
|
47
46
|
chainId: chains_1.base.id,
|
|
@@ -53,7 +52,7 @@ exports.NFT_CONTRACTS = [
|
|
|
53
52
|
name: "Eclipse Venom",
|
|
54
53
|
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.",
|
|
55
54
|
tokenId: null,
|
|
56
|
-
type:
|
|
55
|
+
type: "erc721",
|
|
57
56
|
},
|
|
58
57
|
];
|
|
59
58
|
exports.DEFAULT_NFT_CONTRACT = exports.NFT_CONTRACTS[1];
|
|
@@ -1,8 +1,3 @@
|
|
|
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";
|
|
6
1
|
export * from "./utils/address";
|
|
7
2
|
export * from "./utils/chain";
|
|
8
3
|
export * from "./utils/format";
|
|
@@ -11,5 +6,5 @@ export * from "./utils/number";
|
|
|
11
6
|
export * from "./utils/string";
|
|
12
7
|
export * from "./utils/token";
|
|
13
8
|
export * from "./constants";
|
|
14
|
-
export * from "./abis/
|
|
15
|
-
export * from "./abis/
|
|
9
|
+
export * from "./abis/abiUsdcBase";
|
|
10
|
+
export * from "./abis/erc20Staking";
|
|
@@ -14,12 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
// Types
|
|
18
|
-
__exportStar(require("./types"), exports);
|
|
19
|
-
__exportStar(require("./types/metadata"), exports);
|
|
20
|
-
__exportStar(require("./types/relay"), exports);
|
|
21
|
-
__exportStar(require("./types/signature-mint"), exports);
|
|
22
|
-
__exportStar(require("./types/token"), exports);
|
|
23
17
|
// Utils
|
|
24
18
|
__exportStar(require("./utils/address"), exports);
|
|
25
19
|
__exportStar(require("./utils/chain"), exports);
|
|
@@ -31,5 +25,5 @@ __exportStar(require("./utils/token"), exports);
|
|
|
31
25
|
// Constants
|
|
32
26
|
__exportStar(require("./constants"), exports);
|
|
33
27
|
// Abis
|
|
34
|
-
__exportStar(require("./abis/
|
|
35
|
-
__exportStar(require("./abis/
|
|
28
|
+
__exportStar(require("./abis/abiUsdcBase"), exports);
|
|
29
|
+
__exportStar(require("./abis/erc20Staking"), exports);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export * from "./react/hooks";
|
|
2
2
|
export * from "./react/providers/AnyspendProvider";
|
|
3
|
-
export * from "./types";
|
|
4
3
|
export * from "./utils/address";
|
|
5
4
|
export * from "./utils/chain";
|
|
6
5
|
export * from "./utils/format";
|
|
@@ -9,5 +8,5 @@ export * from "./utils/number";
|
|
|
9
8
|
export * from "./utils/string";
|
|
10
9
|
export * from "./utils/token";
|
|
11
10
|
export * from "./constants";
|
|
12
|
-
export * from "./abis/
|
|
13
|
-
export * from "./abis/
|
|
11
|
+
export * from "./abis/abiUsdcBase";
|
|
12
|
+
export * from "./abis/erc20Staking";
|
|
@@ -18,8 +18,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
18
|
__exportStar(require("./react/hooks"), exports);
|
|
19
19
|
// Providers
|
|
20
20
|
__exportStar(require("./react/providers/AnyspendProvider"), exports);
|
|
21
|
-
// Types
|
|
22
|
-
__exportStar(require("./types"), exports);
|
|
23
21
|
// Utils
|
|
24
22
|
__exportStar(require("./utils/address"), exports);
|
|
25
23
|
__exportStar(require("./utils/chain"), exports);
|
|
@@ -31,5 +29,5 @@ __exportStar(require("./utils/token"), exports);
|
|
|
31
29
|
// Constants
|
|
32
30
|
__exportStar(require("./constants"), exports);
|
|
33
31
|
// Abis
|
|
34
|
-
__exportStar(require("./abis/
|
|
35
|
-
__exportStar(require("./abis/
|
|
32
|
+
__exportStar(require("./abis/abiUsdcBase"), exports);
|
|
33
|
+
__exportStar(require("./abis/erc20Staking"), exports);
|
|
@@ -284,17 +284,17 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
|
|
|
284
284
|
}, [recipientAddressFromProps, globalAddress]);
|
|
285
285
|
// Get anyspend price
|
|
286
286
|
const activeInputAmountInWei = isSrcInputDirty
|
|
287
|
-
? (0, viem_1.parseUnits)(srcAmount.
|
|
288
|
-
: (0, viem_1.parseUnits)(dstAmount.
|
|
289
|
-
const srcAmountOnrampInWei = (0, viem_1.parseUnits)(srcAmountOnRamp.
|
|
287
|
+
? (0, viem_1.parseUnits)(srcAmount.replace(/,/g, ""), selectedSrcToken.decimals).toString()
|
|
288
|
+
: (0, viem_1.parseUnits)(dstAmount.replace(/,/g, ""), selectedDstToken.decimals).toString();
|
|
289
|
+
const srcAmountOnrampInWei = (0, viem_1.parseUnits)(srcAmountOnRamp.replace(/,/g, ""), anyspend_1.USDC_BASE.decimals).toString();
|
|
290
290
|
const { anyspendQuote, isLoadingAnyspendQuote, getAnyspendQuoteError } = (0, react_1.useAnyspendQuote)(isMainnet, activeTab === "crypto"
|
|
291
291
|
? {
|
|
292
292
|
srcChain: selectedSrcChainId,
|
|
293
293
|
dstChain: isBuyMode ? destinationTokenChainId : selectedDstChainId,
|
|
294
294
|
srcTokenAddress: selectedSrcToken.address,
|
|
295
295
|
dstTokenAddress: isBuyMode ? destinationTokenAddress : selectedDstToken.address,
|
|
296
|
-
type:
|
|
297
|
-
tradeType: isSrcInputDirty ?
|
|
296
|
+
type: "swap",
|
|
297
|
+
tradeType: isSrcInputDirty ? "EXACT_INPUT" : "EXPECTED_OUTPUT",
|
|
298
298
|
amount: activeInputAmountInWei,
|
|
299
299
|
}
|
|
300
300
|
: {
|
|
@@ -302,8 +302,8 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
|
|
|
302
302
|
dstChain: isBuyMode ? destinationTokenChainId : selectedDstChainId,
|
|
303
303
|
srcTokenAddress: anyspend_1.USDC_BASE.address,
|
|
304
304
|
dstTokenAddress: isBuyMode ? destinationTokenAddress : selectedDstToken.address,
|
|
305
|
-
type:
|
|
306
|
-
tradeType:
|
|
305
|
+
type: "swap",
|
|
306
|
+
tradeType: "EXACT_INPUT",
|
|
307
307
|
amount: srcAmountOnrampInWei,
|
|
308
308
|
});
|
|
309
309
|
// Replace the old ENS lookup with our new hooks
|
|
@@ -369,11 +369,11 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
|
|
|
369
369
|
// const handleCreateOrder = async (recipientAddress: string) => {
|
|
370
370
|
// try {
|
|
371
371
|
// invariant(anyspendPrice, "Relay price is not found");
|
|
372
|
-
// const srcAmountBigInt = parseUnits(srcAmount.
|
|
372
|
+
// const srcAmountBigInt = parseUnits(srcAmount.replace(/,/g, ""), selectedSrcToken.decimals);
|
|
373
373
|
// createOrder({
|
|
374
374
|
// isMainnet,
|
|
375
375
|
// recipientAddress,
|
|
376
|
-
// orderType:
|
|
376
|
+
// orderType: "swap",
|
|
377
377
|
// srcChain: selectedSrcChainId,
|
|
378
378
|
// dstChain: selectedDstChainId,
|
|
379
379
|
// srcToken: selectedSrcToken,
|
|
@@ -525,11 +525,11 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
|
|
|
525
525
|
setActivePanel(PanelView.FIAT_PAYMENT);
|
|
526
526
|
return;
|
|
527
527
|
}
|
|
528
|
-
const srcAmountBigInt = (0, viem_1.parseUnits)(srcAmount.
|
|
528
|
+
const srcAmountBigInt = (0, viem_1.parseUnits)(srcAmount.replace(/,/g, ""), selectedSrcToken.decimals);
|
|
529
529
|
createOrder({
|
|
530
530
|
isMainnet,
|
|
531
531
|
recipientAddress,
|
|
532
|
-
orderType:
|
|
532
|
+
orderType: "swap",
|
|
533
533
|
srcChain: selectedSrcChainId,
|
|
534
534
|
dstChain: isBuyMode ? destinationTokenChainId : selectedDstChainId,
|
|
535
535
|
srcToken: selectedSrcToken,
|
|
@@ -661,7 +661,7 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
|
|
|
661
661
|
// Using inline style to ensure color displays
|
|
662
662
|
return ((0, jsx_runtime_1.jsxs)("span", { className: "ml-2", style: { color: percentageNum >= 10 ? "red" : "#FFD700" }, children: ["(", isNegative ? "-" : "", percentage, "%)"] }));
|
|
663
663
|
})()] })] })] }), getAnyspendQuoteError && ((0, jsx_runtime_1.jsxs)("div", { className: "bg-as-on-surface-1 flex w-full max-w-[460px] items-center gap-2 rounded-2xl p-4", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.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" }), (0, jsx_runtime_1.jsx)("div", { className: "text-as-red text-sm", children: getAnyspendQuoteError.message })] })), (0, jsx_runtime_1.jsxs)(framer_motion_1.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: [(0, jsx_runtime_1.jsxs)(react_2.ShinyButton, { accentColor: "hsl(var(--as-brand))", disabled: btnInfo.disable, onClick: onMainButtonClick, className: (0, cn_1.cn)("relative w-full", btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand"), textClassName: (0, cn_1.cn)(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white"), children: [btnInfo.text, !btnInfo.disable && !btnInfo.error && ((0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRightCircle, { className: "absolute right-0 top-1/2 h-6 w-6 -translate-y-1/2 opacity-70" }))] }), !hideTransactionHistoryButton && (globalAddress || recipientAddress) ? ((0, jsx_runtime_1.jsxs)(react_2.Button, { variant: "link", onClick: onClickHistory, className: "text-as-primary/50 hover:text-as-primary flex items-center gap-1 transition-colors", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.HistoryIcon, { className: "h-4 w-4" }), " ", (0, jsx_runtime_1.jsx)("span", { className: "pr-4", children: "Transaction History" })] })) : ((0, jsx_runtime_1.jsx)("div", { className: "h-2 w-full" }))] })] }));
|
|
664
|
-
const onrampPaymentView = ((0, jsx_runtime_1.jsx)(PanelOnrampPayment_1.PanelOnrampPayment, { srcAmountOnRamp: srcAmountOnRamp, recipientName: recipientName, recipientAddress: recipientAddress, isMainnet: isMainnet, isBuyMode: isBuyMode, destinationTokenChainId: destinationTokenChainId, destinationTokenAddress: destinationTokenAddress, selectedDstChainId: selectedDstChainId, selectedDstToken: selectedDstToken, orderType:
|
|
664
|
+
const onrampPaymentView = ((0, jsx_runtime_1.jsx)(PanelOnrampPayment_1.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 => {
|
|
665
665
|
setOrderId(orderId);
|
|
666
666
|
setActivePanel(PanelView.ORDER_DETAILS);
|
|
667
667
|
// 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,209 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AnySpendBondKit = AnySpendBondKit;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const bondkit_1 = require("@b3dotfun/bondkit");
|
|
6
|
+
const react_1 = require("../../../global-account/react");
|
|
7
|
+
const supported_1 = require("../../../shared/constants/chains/supported");
|
|
8
|
+
const framer_motion_1 = require("framer-motion");
|
|
9
|
+
const react_2 = require("react");
|
|
10
|
+
const viem_1 = require("viem");
|
|
11
|
+
const bondKit_1 = require("../../abis/bondKit");
|
|
12
|
+
const AnySpendCustom_1 = require("./AnySpendCustom");
|
|
13
|
+
// Debounce utility function
|
|
14
|
+
function debounce(func, wait) {
|
|
15
|
+
let timeout;
|
|
16
|
+
return (...args) => {
|
|
17
|
+
clearTimeout(timeout);
|
|
18
|
+
timeout = setTimeout(() => func(...args), wait);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
// Format number with commas
|
|
22
|
+
function formatNumberWithCommas(x) {
|
|
23
|
+
const parts = x.split(".");
|
|
24
|
+
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
25
|
+
return parts.join(".");
|
|
26
|
+
}
|
|
27
|
+
function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, minTokensOut = "0", imageUrl, ethAmount: initialEthAmount, onSuccess, }) {
|
|
28
|
+
const hasMounted = (0, react_1.useHasMounted)();
|
|
29
|
+
const [showAmountPrompt, setShowAmountPrompt] = (0, react_2.useState)(!initialEthAmount);
|
|
30
|
+
const [ethAmount, setEthAmount] = (0, react_2.useState)(initialEthAmount || "");
|
|
31
|
+
const [isAmountValid, setIsAmountValid] = (0, react_2.useState)(!!initialEthAmount);
|
|
32
|
+
const [validationError, setValidationError] = (0, react_2.useState)("");
|
|
33
|
+
const [tokenName, setTokenName] = (0, react_2.useState)("");
|
|
34
|
+
const [tokenSymbol, setTokenSymbol] = (0, react_2.useState)("");
|
|
35
|
+
const [quote, setQuote] = (0, react_2.useState)(null);
|
|
36
|
+
const [isLoadingQuote, setIsLoadingQuote] = (0, react_2.useState)(false);
|
|
37
|
+
// Create BondKit client
|
|
38
|
+
const bondkitTokenClient = (0, react_2.useMemo)(() => {
|
|
39
|
+
if (!contractAddress)
|
|
40
|
+
return null;
|
|
41
|
+
try {
|
|
42
|
+
const client = new bondkit_1.BondkitToken(contractAddress);
|
|
43
|
+
client.connect();
|
|
44
|
+
return client;
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
console.error("Error creating bondkit client", error);
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}, [contractAddress]);
|
|
51
|
+
// Create a public client for reading contract data
|
|
52
|
+
const basePublicClient = (0, viem_1.createPublicClient)({
|
|
53
|
+
chain: supported_1.baseMainnet,
|
|
54
|
+
transport: (0, viem_1.http)(),
|
|
55
|
+
});
|
|
56
|
+
// Fetch token name from contract
|
|
57
|
+
(0, react_2.useEffect)(() => {
|
|
58
|
+
async function fetchTokenName() {
|
|
59
|
+
try {
|
|
60
|
+
const [name, symbol] = await Promise.all([
|
|
61
|
+
basePublicClient.readContract({
|
|
62
|
+
address: contractAddress,
|
|
63
|
+
abi: bondKit_1.ABI_bondKit,
|
|
64
|
+
functionName: "name",
|
|
65
|
+
}),
|
|
66
|
+
basePublicClient.readContract({
|
|
67
|
+
address: contractAddress,
|
|
68
|
+
abi: bondKit_1.ABI_bondKit,
|
|
69
|
+
functionName: "symbol",
|
|
70
|
+
}),
|
|
71
|
+
]);
|
|
72
|
+
setTokenName(name);
|
|
73
|
+
setTokenSymbol(symbol);
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
console.error("Error fetching token name:", error);
|
|
77
|
+
setTokenName("BondKit Token");
|
|
78
|
+
setTokenSymbol("BOND");
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (contractAddress) {
|
|
82
|
+
fetchTokenName();
|
|
83
|
+
}
|
|
84
|
+
}, [contractAddress, basePublicClient]);
|
|
85
|
+
// Get native token data for the chain
|
|
86
|
+
const { data: tokenData, isError: isTokenError, isLoading, } = (0, react_1.useTokenData)(supported_1.baseMainnet.id, "0x0000000000000000000000000000000000000000");
|
|
87
|
+
// Convert token data to AnySpend Token type
|
|
88
|
+
const dstToken = (0, react_2.useMemo)(() => {
|
|
89
|
+
if (!tokenData)
|
|
90
|
+
return null;
|
|
91
|
+
return {
|
|
92
|
+
address: tokenData.address,
|
|
93
|
+
chainId: supported_1.baseMainnet.id,
|
|
94
|
+
name: tokenData.name,
|
|
95
|
+
symbol: tokenData.symbol,
|
|
96
|
+
decimals: tokenData.decimals,
|
|
97
|
+
metadata: {
|
|
98
|
+
logoURI: tokenData.logoURI,
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
}, [tokenData]);
|
|
102
|
+
// Debounced quote fetching
|
|
103
|
+
const debouncedGetQuote = (0, react_2.useMemo)(() => debounce(async (val) => {
|
|
104
|
+
if (!val || Number(val) <= 0 || !bondkitTokenClient) {
|
|
105
|
+
setQuote(null);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
try {
|
|
109
|
+
setIsLoadingQuote(true);
|
|
110
|
+
const parsedAmount = (0, viem_1.parseEther)(val);
|
|
111
|
+
const buyQuote = await bondkitTokenClient.getAmountOfTokensToBuy(parsedAmount);
|
|
112
|
+
setQuote(buyQuote ? (0, viem_1.formatEther)(buyQuote) : null);
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
console.error("Error getting buy quote:", error);
|
|
116
|
+
setQuote(null);
|
|
117
|
+
}
|
|
118
|
+
finally {
|
|
119
|
+
setIsLoadingQuote(false);
|
|
120
|
+
}
|
|
121
|
+
}, 500), [bondkitTokenClient]);
|
|
122
|
+
// Fetch initial quote if ethAmount is provided
|
|
123
|
+
(0, react_2.useEffect)(() => {
|
|
124
|
+
if (initialEthAmount && bondkitTokenClient) {
|
|
125
|
+
debouncedGetQuote(initialEthAmount);
|
|
126
|
+
}
|
|
127
|
+
}, [initialEthAmount, bondkitTokenClient, debouncedGetQuote]);
|
|
128
|
+
const validateAndSetAmount = (value) => {
|
|
129
|
+
// Allow empty input
|
|
130
|
+
if (value === "") {
|
|
131
|
+
setEthAmount("");
|
|
132
|
+
setIsAmountValid(false);
|
|
133
|
+
setValidationError("");
|
|
134
|
+
setQuote(null);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
// Only allow valid number format (no leading zeros unless decimal)
|
|
138
|
+
if (!/^(0|[1-9]\d*)?\.?\d*$/.test(value)) {
|
|
139
|
+
setIsAmountValid(false);
|
|
140
|
+
setValidationError("Please enter a valid number");
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
// Prevent multiple decimal points
|
|
144
|
+
if ((value.match(/\./g) || []).length > 1) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
// Prevent more than 18 decimal places (ETH precision)
|
|
148
|
+
const parts = value.split(".");
|
|
149
|
+
if (parts[1] && parts[1].length > 18) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
// Clean the input - remove leading zeros if not decimal
|
|
153
|
+
const cleanedValue = value.startsWith("0") && !value.startsWith("0.") ? value.replace(/^0+/, "0") : value;
|
|
154
|
+
setEthAmount(cleanedValue);
|
|
155
|
+
try {
|
|
156
|
+
const parsedAmount = (0, viem_1.parseEther)(cleanedValue);
|
|
157
|
+
if (parsedAmount <= BigInt(0)) {
|
|
158
|
+
setIsAmountValid(false);
|
|
159
|
+
setValidationError("Amount must be greater than 0");
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
setIsAmountValid(true);
|
|
163
|
+
setValidationError("");
|
|
164
|
+
debouncedGetQuote(cleanedValue);
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
console.error("Error validating amount:", error);
|
|
168
|
+
setIsAmountValid(false);
|
|
169
|
+
setValidationError("Please enter a valid amount");
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
const header = () => ((0, jsx_runtime_1.jsx)("div", { className: "w-full px-6 py-4", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full flex-col items-center space-y-6", children: [(0, jsx_runtime_1.jsxs)("h2", { className: "text-[28px] font-bold", children: ["Buy ", tokenName, " (", tokenSymbol, ")"] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full flex-col items-center space-y-2", children: [(0, jsx_runtime_1.jsxs)("span", { className: "text-[28px] font-bold", children: [ethAmount, " ETH"] }), quote && ((0, jsx_runtime_1.jsxs)("span", { className: "text-lg", children: ["\u2248 ", formatNumberWithCommas(parseFloat(quote).toFixed(4)), " ", tokenSymbol] }))] })] }) }));
|
|
173
|
+
// Show loading state while fetching token data
|
|
174
|
+
if (isLoading) {
|
|
175
|
+
return ((0, jsx_runtime_1.jsx)(react_1.StyleRoot, { children: (0, jsx_runtime_1.jsx)("div", { className: "b3-root b3-modal bg-b3-react-background flex w-full flex-col items-center p-8", children: (0, jsx_runtime_1.jsx)("p", { className: "text-as-primary/70 text-center text-sm", children: "Loading payment information..." }) }) }));
|
|
176
|
+
}
|
|
177
|
+
// If we don't have token data after loading, show error state
|
|
178
|
+
if (!dstToken || isTokenError) {
|
|
179
|
+
return ((0, jsx_runtime_1.jsx)(react_1.StyleRoot, { children: (0, jsx_runtime_1.jsx)("div", { className: "b3-root b3-modal bg-b3-react-background flex w-full flex-col items-center p-8", children: (0, jsx_runtime_1.jsxs)("p", { className: "text-as-red text-center text-sm", children: ["Failed to fetch native token information for chain ", supported_1.baseMainnet.id, ". Please try again."] }) }) }));
|
|
180
|
+
}
|
|
181
|
+
if (showAmountPrompt) {
|
|
182
|
+
return ((0, jsx_runtime_1.jsx)(react_1.StyleRoot, { children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-background flex w-full flex-col items-center", children: [(0, jsx_runtime_1.jsxs)("div", { className: "w-full px-4 pb-2 pt-4", children: [(0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, { initial: false, animate: {
|
|
183
|
+
opacity: hasMounted ? 1 : 0,
|
|
184
|
+
y: hasMounted ? 0 : 20,
|
|
185
|
+
filter: hasMounted ? "blur(0px)" : "blur(10px)",
|
|
186
|
+
}, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, className: "mb-4 flex justify-center", children: imageUrl && ((0, jsx_runtime_1.jsxs)("div", { className: "relative size-16", children: [(0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 scale-95 rounded-[50%] bg-gradient-to-br from-blue-500/20 to-purple-600/20 blur-xl" }), (0, jsx_runtime_1.jsxs)(react_1.GlareCardRounded, { className: "overflow-hidden rounded-full border-none bg-gradient-to-br from-blue-500/10 to-purple-600/10 backdrop-blur-sm", children: [(0, jsx_runtime_1.jsx)("img", { alt: "token preview", className: "size-full rounded-lg object-cover", src: imageUrl }), (0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 rounded-[50%] border border-white/20" })] })] })) }), (0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, { initial: false, animate: {
|
|
187
|
+
opacity: hasMounted ? 1 : 0,
|
|
188
|
+
y: hasMounted ? 0 : 20,
|
|
189
|
+
filter: hasMounted ? "blur(0px)" : "blur(10px)",
|
|
190
|
+
}, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "text-center", children: (0, jsx_runtime_1.jsxs)("h2", { className: "font-sf-rounded text-as-primary mb-4 text-2xl font-bold", children: ["Buy ", tokenName] }) })] }), (0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, { initial: false, animate: {
|
|
191
|
+
opacity: hasMounted ? 1 : 0,
|
|
192
|
+
y: hasMounted ? 0 : 20,
|
|
193
|
+
filter: hasMounted ? "blur(0px)" : "blur(10px)",
|
|
194
|
+
}, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: "bg-b3-react-background w-full p-6", children: (0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-between", children: (0, jsx_runtime_1.jsx)("p", { className: "text-as-primary/70 text-sm font-medium", children: "ETH Amount" }) }), (0, jsx_runtime_1.jsx)("div", { className: "relative", children: (0, jsx_runtime_1.jsx)(react_1.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 && (0, jsx_runtime_1.jsx)("p", { className: "text-as-red text-sm", children: validationError }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-as-on-surface-2/30 rounded-lg border border-white/10 p-4 backdrop-blur-sm", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/70 text-sm font-medium", children: "Total Cost:" }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2", children: (0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary text-lg font-bold", children: [ethAmount || "0", " ETH"] }) })] }), isLoadingQuote ? ((0, jsx_runtime_1.jsx)("div", { className: "mt-2 text-center", children: (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/70 text-sm", children: "Calculating tokens..." }) })) : quote ? ((0, jsx_runtime_1.jsxs)("div", { className: "mt-2 flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/70 text-sm font-medium", children: "You'll receive:" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary text-sm font-medium", children: ["\u2248 ", formatNumberWithCommas(parseFloat(quote).toFixed(4)), " ", tokenSymbol] })] })) : null] }), (0, jsx_runtime_1.jsx)(react_1.Button, { onClick: () => {
|
|
195
|
+
if (isAmountValid && ethAmount) {
|
|
196
|
+
setShowAmountPrompt(false);
|
|
197
|
+
}
|
|
198
|
+
}, 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" })] }) })] }) }));
|
|
199
|
+
}
|
|
200
|
+
const encodedData = (0, viem_1.encodeFunctionData)({
|
|
201
|
+
abi: bondKit_1.ABI_bondKit,
|
|
202
|
+
functionName: "buyFor",
|
|
203
|
+
args: [recipientAddress, BigInt(minTokensOut)],
|
|
204
|
+
});
|
|
205
|
+
return ((0, jsx_runtime_1.jsx)(AnySpendCustom_1.AnySpendCustom, { isMainnet: true, mode: mode, recipientAddress: recipientAddress, orderType: "custom", dstChainId: supported_1.baseMainnet.id, dstToken: dstToken, dstAmount: (0, viem_1.parseEther)(ethAmount).toString(), contractAddress: contractAddress, encodedData: encodedData, metadata: {
|
|
206
|
+
type: "custom",
|
|
207
|
+
action: "BondKit Buy",
|
|
208
|
+
}, header: header, onSuccess: onSuccess, showRecipient: true }));
|
|
209
|
+
}
|
|
@@ -66,8 +66,6 @@ const SPIN_WHEEL_ABI = [
|
|
|
66
66
|
];
|
|
67
67
|
function getWheelStatus(wheelInfo) {
|
|
68
68
|
const now = BigInt(Math.floor(Date.now() / 1000));
|
|
69
|
-
console.log("@@anyspend-buy-spin:now:", now);
|
|
70
|
-
console.log("@@anyspend-buy-spin:wheelInfo:", wheelInfo);
|
|
71
69
|
if (now < wheelInfo.startTime_) {
|
|
72
70
|
return "not_started";
|
|
73
71
|
}
|
|
@@ -81,7 +79,6 @@ function getWheelStatus(wheelInfo) {
|
|
|
81
79
|
}
|
|
82
80
|
function generateEncodedDataForBuyEntriesAndSpin(user, quantity) {
|
|
83
81
|
(0, invariant_1.default)(BigInt(quantity) > 0, "Quantity must be greater than zero");
|
|
84
|
-
console.log("@@anyspend-buy-spin:encoded-data:", { user, quantity });
|
|
85
82
|
const encodedData = (0, viem_1.encodeFunctionData)({
|
|
86
83
|
abi: SPIN_WHEEL_ABI,
|
|
87
84
|
functionName: "buyEntriesAndSpin",
|
|
@@ -142,7 +139,6 @@ function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", spinwhee
|
|
|
142
139
|
const [validationError, setValidationError] = (0, react_2.useState)("");
|
|
143
140
|
const [displayQuantity, setDisplayQuantity] = (0, react_2.useState)("");
|
|
144
141
|
const [debouncedQuantity, setDebouncedQuantity] = (0, react_2.useState)("");
|
|
145
|
-
const [debouncedUserSpinQuantity, setDebouncedUserSpinQuantity] = (0, react_2.useState)("");
|
|
146
142
|
(0, react_2.useEffect)(() => {
|
|
147
143
|
if (prefillQuantity && wheelInfo) {
|
|
148
144
|
const remainingSpins = wheelInfo.totalPrizesAvailable_ - wheelInfo.prizesRequestedCount_;
|
|
@@ -159,7 +155,6 @@ function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", spinwhee
|
|
|
159
155
|
try {
|
|
160
156
|
setIsLoadingConfig(true);
|
|
161
157
|
setConfigError("");
|
|
162
|
-
console.log("@@anyspend-buy-spin:fetch-config:", { spinwheelContractAddress, chainId });
|
|
163
158
|
const [config, entryModuleAddress, wheelInfo] = await Promise.all([
|
|
164
159
|
basePublicClient.readContract({
|
|
165
160
|
address: spinwheelContractAddress,
|
|
@@ -202,7 +197,7 @@ function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", spinwhee
|
|
|
202
197
|
finally {
|
|
203
198
|
setIsLoadingConfig(false);
|
|
204
199
|
}
|
|
205
|
-
}, [spinwheelContractAddress
|
|
200
|
+
}, [spinwheelContractAddress]);
|
|
206
201
|
// Fetch config on mount and when dependencies change
|
|
207
202
|
(0, react_2.useEffect)(() => {
|
|
208
203
|
fetchPaymentConfig();
|
|
@@ -211,7 +206,6 @@ function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", spinwhee
|
|
|
211
206
|
(0, react_2.useEffect)(() => {
|
|
212
207
|
const timer = setTimeout(() => {
|
|
213
208
|
setDebouncedQuantity(displayQuantity);
|
|
214
|
-
setDebouncedUserSpinQuantity(userSpinQuantity);
|
|
215
209
|
}, 500);
|
|
216
210
|
return () => clearTimeout(timer);
|
|
217
211
|
}, [displayQuantity, userSpinQuantity]);
|
|
@@ -341,7 +335,6 @@ function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", spinwhee
|
|
|
341
335
|
const pricePerEntry = (0, viem_1.formatUnits)(paymentConfig.pricePerEntry, 18);
|
|
342
336
|
const remainingEntries = wheelInfo ? wheelInfo.totalPrizesAvailable_ - wheelInfo.prizesRequestedCount_ : BigInt(0);
|
|
343
337
|
const wheelStatus = wheelInfo ? getWheelStatus(wheelInfo) : null;
|
|
344
|
-
const isSoldOut = wheelStatus === "sold_out";
|
|
345
338
|
const isActive = wheelStatus === "active";
|
|
346
339
|
const getStatusMessage = () => {
|
|
347
340
|
if (!wheelInfo)
|
|
@@ -394,8 +387,8 @@ function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", spinwhee
|
|
|
394
387
|
}
|
|
395
388
|
// AnySpend flow for when user needs to swap to B3
|
|
396
389
|
const encodedData = generateEncodedDataForBuyEntriesAndSpin(address || "", userSpinQuantity);
|
|
397
|
-
return ((0, jsx_runtime_1.jsx)(AnySpendCustom_1.AnySpendCustom, { isMainnet: isMainnet, loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, orderType:
|
|
398
|
-
type:
|
|
390
|
+
return ((0, jsx_runtime_1.jsx)(AnySpendCustom_1.AnySpendCustom, { isMainnet: isMainnet, loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, orderType: "custom", dstChainId: chainId, dstToken: anyspend_1.B3_TOKEN, dstAmount: totalCost.toString(), contractAddress: spinwheelContractAddress, spenderAddress: paymentConfig.entryModule, encodedData: encodedData, metadata: {
|
|
391
|
+
type: "custom",
|
|
399
392
|
action: `buy ${userSpinQuantity} spin${userSpinQuantity !== "1" ? "s" : ""}`,
|
|
400
393
|
}, header: header, onSuccess: txHash => onSuccess?.(txHash), showRecipient: false }));
|
|
401
394
|
}
|
|
@@ -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;
|