@b3dotfun/sdk 0.0.40-alpha.23 → 0.0.40-alpha.25

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.
@@ -111,14 +111,15 @@ function useAnyspendFlow({ paymentType = "crypto", recipientAddress, loadOrder,
111
111
  }
112
112
  };
113
113
  // Get quote
114
- const activeInputAmountInWei = (0, viem_1.parseUnits)(srcAmount.replace(/,/g, ""), selectedSrcToken.decimals).toString();
114
+ // For fiat payments, always use USDC decimals (6) regardless of selectedSrcToken
115
+ const effectiveDecimals = paymentType === "fiat" ? anyspend_1.USDC_BASE.decimals : selectedSrcToken.decimals;
116
+ const activeInputAmountInWei = (0, viem_1.parseUnits)(srcAmount.replace(/,/g, ""), effectiveDecimals).toString();
115
117
  const { anyspendQuote, isLoadingAnyspendQuote, getAnyspendQuoteError } = (0, react_1.useAnyspendQuote)({
116
118
  srcChain: paymentType === "fiat" ? chains_1.base.id : selectedSrcChainId,
117
119
  dstChain: isDepositMode ? chains_1.base.id : selectedDstChainId, // For deposits, always Base; for swaps, use selected destination
118
120
  srcTokenAddress: paymentType === "fiat" ? anyspend_1.USDC_BASE.address : selectedSrcToken.address,
119
121
  dstTokenAddress: isDepositMode ? anyspend_1.B3_TOKEN.address : selectedSrcToken.address, // For deposits, always B3
120
- type: "swap",
121
- tradeType: "EXACT_INPUT",
122
+ type: "hype_duel",
122
123
  amount: activeInputAmountInWei,
123
124
  recipientAddress: selectedRecipientAddress,
124
125
  onrampVendor: paymentType === "fiat" ? getOnrampVendor(selectedFiatPaymentMethod) : undefined,
@@ -107,14 +107,15 @@ export function useAnyspendFlow({ paymentType = "crypto", recipientAddress, load
107
107
  }
108
108
  };
109
109
  // Get quote
110
- const activeInputAmountInWei = parseUnits(srcAmount.replace(/,/g, ""), selectedSrcToken.decimals).toString();
110
+ // For fiat payments, always use USDC decimals (6) regardless of selectedSrcToken
111
+ const effectiveDecimals = paymentType === "fiat" ? USDC_BASE.decimals : selectedSrcToken.decimals;
112
+ const activeInputAmountInWei = parseUnits(srcAmount.replace(/,/g, ""), effectiveDecimals).toString();
111
113
  const { anyspendQuote, isLoadingAnyspendQuote, getAnyspendQuoteError } = useAnyspendQuote({
112
114
  srcChain: paymentType === "fiat" ? base.id : selectedSrcChainId,
113
115
  dstChain: isDepositMode ? base.id : selectedDstChainId, // For deposits, always Base; for swaps, use selected destination
114
116
  srcTokenAddress: paymentType === "fiat" ? USDC_BASE.address : selectedSrcToken.address,
115
117
  dstTokenAddress: isDepositMode ? B3_TOKEN.address : selectedSrcToken.address, // For deposits, always B3
116
- type: "swap",
117
- tradeType: "EXACT_INPUT",
118
+ type: "hype_duel",
118
119
  amount: activeInputAmountInWei,
119
120
  recipientAddress: selectedRecipientAddress,
120
121
  onrampVendor: paymentType === "fiat" ? getOnrampVendor(selectedFiatPaymentMethod) : undefined,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b3dotfun/sdk",
3
- "version": "0.0.40-alpha.23",
3
+ "version": "0.0.40-alpha.25",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
@@ -157,14 +157,15 @@ export function useAnyspendFlow({
157
157
  };
158
158
 
159
159
  // Get quote
160
- const activeInputAmountInWei = parseUnits(srcAmount.replace(/,/g, ""), selectedSrcToken.decimals).toString();
160
+ // For fiat payments, always use USDC decimals (6) regardless of selectedSrcToken
161
+ const effectiveDecimals = paymentType === "fiat" ? USDC_BASE.decimals : selectedSrcToken.decimals;
162
+ const activeInputAmountInWei = parseUnits(srcAmount.replace(/,/g, ""), effectiveDecimals).toString();
161
163
  const { anyspendQuote, isLoadingAnyspendQuote, getAnyspendQuoteError } = useAnyspendQuote({
162
164
  srcChain: paymentType === "fiat" ? base.id : selectedSrcChainId,
163
165
  dstChain: isDepositMode ? base.id : selectedDstChainId, // For deposits, always Base; for swaps, use selected destination
164
166
  srcTokenAddress: paymentType === "fiat" ? USDC_BASE.address : selectedSrcToken.address,
165
167
  dstTokenAddress: isDepositMode ? B3_TOKEN.address : selectedSrcToken.address, // For deposits, always B3
166
- type: "swap",
167
- tradeType: "EXACT_INPUT",
168
+ type: "hype_duel",
168
169
  amount: activeInputAmountInWei,
169
170
  recipientAddress: selectedRecipientAddress,
170
171
  onrampVendor: paymentType === "fiat" ? getOnrampVendor(selectedFiatPaymentMethod) : undefined,