@b3dotfun/sdk 0.0.47-alpha.0 → 0.0.47-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.
@@ -273,11 +273,13 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
273
273
  (0, react_4.useEffect)(() => {
274
274
  if (oat?.data?.order.status === "executed" && !onSuccessCalled.current) {
275
275
  console.log("Calling onSuccess");
276
- const txHash = oat?.data?.executeTx?.txHash;
276
+ const relayTxs = oat?.data?.relayTxs;
277
+ const lastRelayTxHash = relayTxs?.[relayTxs.length - 1]?.txHash;
278
+ const txHash = oat?.data?.executeTx?.txHash || lastRelayTxHash;
277
279
  onSuccess?.(txHash);
278
280
  onSuccessCalled.current = true;
279
281
  }
280
- }, [oat?.data?.order.status, oat?.data?.executeTx?.txHash, onSuccess]);
282
+ }, [oat?.data?.order.status, oat?.data?.executeTx?.txHash, oat?.data?.relayTxs, onSuccess]);
281
283
  // Reset flag when orderId changes
282
284
  (0, react_4.useEffect)(() => {
283
285
  onSuccessCalled.current = false;
@@ -467,7 +469,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
467
469
  const historyView = ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("mx-auto flex w-full max-w-2xl flex-col items-center p-5", mode === "modal" && "bg-b3-react-background"), children: (0, jsx_runtime_1.jsx)(OrderHistory_1.OrderHistory, { mode: mode, onBack: () => {
468
470
  setActivePanel(PanelView.HISTORY);
469
471
  }, onSelectOrder: onSelectOrder }) }));
470
- const orderDetailsView = ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("mx-auto flex w-full flex-col items-center gap-4", mode === "modal" && "bg-b3-react-background rounded-xl"), children: [oat && ((0, jsx_runtime_1.jsx)(OrderDetails_1.OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTxs: oat.data.relayTxs, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, cryptoPaymentMethod: activeTab === "fiat" ? CryptoPaymentMethod_1.CryptoPaymentMethodType.NONE : selectedCryptoPaymentMethod, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onPaymentMethodChange: setSelectedCryptoPaymentMethod, onBack: () => {
472
+ const orderDetailsView = ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("mx-auto flex w-full flex-col items-center gap-4 p-5", mode === "modal" && "bg-b3-react-background rounded-xl"), children: [oat && ((0, jsx_runtime_1.jsx)(OrderDetails_1.OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTxs: oat.data.relayTxs, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, cryptoPaymentMethod: activeTab === "fiat" ? CryptoPaymentMethod_1.CryptoPaymentMethodType.NONE : selectedCryptoPaymentMethod, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onPaymentMethodChange: setSelectedCryptoPaymentMethod, onBack: () => {
471
473
  setOrderId(undefined);
472
474
  setActivePanel(PanelView.CONFIRM_ORDER);
473
475
  // Remove orderId from URL when canceling
@@ -234,11 +234,13 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
234
234
  useEffect(() => {
235
235
  if (oat?.data?.order.status === "executed" && !onSuccessCalled.current) {
236
236
  console.log("Calling onSuccess");
237
- const txHash = oat?.data?.executeTx?.txHash;
237
+ const relayTxs = oat?.data?.relayTxs;
238
+ const lastRelayTxHash = relayTxs?.[relayTxs.length - 1]?.txHash;
239
+ const txHash = oat?.data?.executeTx?.txHash || lastRelayTxHash;
238
240
  onSuccess?.(txHash);
239
241
  onSuccessCalled.current = true;
240
242
  }
241
- }, [oat?.data?.order.status, oat?.data?.executeTx?.txHash, onSuccess]);
243
+ }, [oat?.data?.order.status, oat?.data?.executeTx?.txHash, oat?.data?.relayTxs, onSuccess]);
242
244
  // Reset flag when orderId changes
243
245
  useEffect(() => {
244
246
  onSuccessCalled.current = false;
@@ -428,7 +430,7 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
428
430
  const historyView = (_jsx("div", { className: cn("mx-auto flex w-full max-w-2xl flex-col items-center p-5", mode === "modal" && "bg-b3-react-background"), children: _jsx(OrderHistory, { mode: mode, onBack: () => {
429
431
  setActivePanel(PanelView.HISTORY);
430
432
  }, onSelectOrder: onSelectOrder }) }));
431
- const orderDetailsView = (_jsxs("div", { className: cn("mx-auto flex w-full flex-col items-center gap-4", mode === "modal" && "bg-b3-react-background rounded-xl"), children: [oat && (_jsx(OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTxs: oat.data.relayTxs, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, cryptoPaymentMethod: activeTab === "fiat" ? CryptoPaymentMethodType.NONE : selectedCryptoPaymentMethod, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onPaymentMethodChange: setSelectedCryptoPaymentMethod, onBack: () => {
433
+ const orderDetailsView = (_jsxs("div", { className: cn("mx-auto flex w-full flex-col items-center gap-4 p-5", mode === "modal" && "bg-b3-react-background rounded-xl"), children: [oat && (_jsx(OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTxs: oat.data.relayTxs, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, cryptoPaymentMethod: activeTab === "fiat" ? CryptoPaymentMethodType.NONE : selectedCryptoPaymentMethod, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onPaymentMethodChange: setSelectedCryptoPaymentMethod, onBack: () => {
432
434
  setOrderId(undefined);
433
435
  setActivePanel(PanelView.CONFIRM_ORDER);
434
436
  // Remove orderId from URL when canceling
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b3dotfun/sdk",
3
- "version": "0.0.47-alpha.0",
3
+ "version": "0.0.47-alpha.1",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
@@ -395,11 +395,13 @@ function AnySpendCustomInner({
395
395
  useEffect(() => {
396
396
  if (oat?.data?.order.status === "executed" && !onSuccessCalled.current) {
397
397
  console.log("Calling onSuccess");
398
- const txHash = oat?.data?.executeTx?.txHash;
398
+ const relayTxs = oat?.data?.relayTxs;
399
+ const lastRelayTxHash = relayTxs?.[relayTxs.length - 1]?.txHash;
400
+ const txHash = oat?.data?.executeTx?.txHash || lastRelayTxHash;
399
401
  onSuccess?.(txHash);
400
402
  onSuccessCalled.current = true;
401
403
  }
402
- }, [oat?.data?.order.status, oat?.data?.executeTx?.txHash, onSuccess]);
404
+ }, [oat?.data?.order.status, oat?.data?.executeTx?.txHash, oat?.data?.relayTxs, onSuccess]);
403
405
 
404
406
  // Reset flag when orderId changes
405
407
  useEffect(() => {
@@ -665,7 +667,7 @@ function AnySpendCustomInner({
665
667
  const orderDetailsView = (
666
668
  <div
667
669
  className={cn(
668
- "mx-auto flex w-full flex-col items-center gap-4",
670
+ "mx-auto flex w-full flex-col items-center gap-4 p-5",
669
671
  mode === "modal" && "bg-b3-react-background rounded-xl",
670
672
  )}
671
673
  >