@b3dotfun/sdk 0.0.40-alpha.27 → 0.0.40-alpha.28

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.
@@ -31,4 +31,5 @@ export declare function AnySpend(props: {
31
31
  onTokenSelect?: (token: components["schemas"]["Token"], event: {
32
32
  preventDefault: () => void;
33
33
  }) => void;
34
+ onSuccess?: (txHash?: string) => void;
34
35
  }): import("react/jsx-runtime").JSX.Element;
@@ -49,7 +49,7 @@ function AnySpend(props) {
49
49
  const fingerprintConfig = (0, AnySpendFingerprintWrapper_1.getFingerprintConfig)();
50
50
  return ((0, jsx_runtime_1.jsx)(AnySpendFingerprintWrapper_1.AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: (0, jsx_runtime_1.jsx)(AnySpendInner, { ...props }) }));
51
51
  }
52
- function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, }) {
52
+ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, }) {
53
53
  const searchParams = (0, react_2.useSearchParamsSSR)();
54
54
  const router = (0, react_2.useRouter)();
55
55
  // Determine if we're in "buy mode" based on whether destination token props are provided
@@ -393,6 +393,13 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
393
393
  }
394
394
  }
395
395
  }, [anyspendQuote, isSrcInputDirty]);
396
+ (0, react_4.useEffect)(() => {
397
+ if (oat?.data?.order.status === "executed") {
398
+ console.log("Calling onSuccess");
399
+ const txHash = oat?.data?.executeTx?.txHash;
400
+ onSuccess?.(txHash);
401
+ }
402
+ }, [oat?.data?.executeTx?.txHash, oat?.data?.order.status, onSuccess]);
396
403
  const { createOrder, isCreatingOrder } = (0, react_1.useAnyspendCreateOrder)({
397
404
  onSuccess: data => {
398
405
  const orderId = data.data.id;
@@ -31,4 +31,5 @@ export declare function AnySpend(props: {
31
31
  onTokenSelect?: (token: components["schemas"]["Token"], event: {
32
32
  preventDefault: () => void;
33
33
  }) => void;
34
+ onSuccess?: (txHash?: string) => void;
34
35
  }): import("react/jsx-runtime").JSX.Element;
@@ -42,7 +42,7 @@ export function AnySpend(props) {
42
42
  const fingerprintConfig = getFingerprintConfig();
43
43
  return (_jsx(AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: _jsx(AnySpendInner, { ...props }) }));
44
44
  }
45
- function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, }) {
45
+ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, }) {
46
46
  const searchParams = useSearchParamsSSR();
47
47
  const router = useRouter();
48
48
  // Determine if we're in "buy mode" based on whether destination token props are provided
@@ -386,6 +386,13 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
386
386
  }
387
387
  }
388
388
  }, [anyspendQuote, isSrcInputDirty]);
389
+ useEffect(() => {
390
+ if (oat?.data?.order.status === "executed") {
391
+ console.log("Calling onSuccess");
392
+ const txHash = oat?.data?.executeTx?.txHash;
393
+ onSuccess?.(txHash);
394
+ }
395
+ }, [oat?.data?.executeTx?.txHash, oat?.data?.order.status, onSuccess]);
389
396
  const { createOrder, isCreatingOrder } = useAnyspendCreateOrder({
390
397
  onSuccess: data => {
391
398
  const orderId = data.data.id;
@@ -31,4 +31,5 @@ export declare function AnySpend(props: {
31
31
  onTokenSelect?: (token: components["schemas"]["Token"], event: {
32
32
  preventDefault: () => void;
33
33
  }) => void;
34
+ onSuccess?: (txHash?: string) => void;
34
35
  }): import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b3dotfun/sdk",
3
- "version": "0.0.40-alpha.27",
3
+ "version": "0.0.40-alpha.28",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
@@ -78,6 +78,7 @@ export function AnySpend(props: {
78
78
  * Useful for handling special cases like B3 token selection.
79
79
  */
80
80
  onTokenSelect?: (token: components["schemas"]["Token"], event: { preventDefault: () => void }) => void;
81
+ onSuccess?: (txHash?: string) => void;
81
82
  }) {
82
83
  const fingerprintConfig = getFingerprintConfig();
83
84
 
@@ -97,6 +98,7 @@ function AnySpendInner({
97
98
  hideTransactionHistoryButton,
98
99
  recipientAddress: recipientAddressFromProps,
99
100
  onTokenSelect,
101
+ onSuccess,
100
102
  }: {
101
103
  destinationTokenAddress?: string;
102
104
  destinationTokenChainId?: number;
@@ -106,6 +108,7 @@ function AnySpendInner({
106
108
  hideTransactionHistoryButton?: boolean;
107
109
  recipientAddress?: string;
108
110
  onTokenSelect?: (token: components["schemas"]["Token"], event: { preventDefault: () => void }) => void;
111
+ onSuccess?: (txHash?: string) => void;
109
112
  }) {
110
113
  const searchParams = useSearchParamsSSR();
111
114
  const router = useRouter();
@@ -516,6 +519,14 @@ function AnySpendInner({
516
519
  }
517
520
  }, [anyspendQuote, isSrcInputDirty]);
518
521
 
522
+ useEffect(() => {
523
+ if (oat?.data?.order.status === "executed") {
524
+ console.log("Calling onSuccess");
525
+ const txHash = oat?.data?.executeTx?.txHash;
526
+ onSuccess?.(txHash);
527
+ }
528
+ }, [oat?.data?.executeTx?.txHash, oat?.data?.order.status, onSuccess]);
529
+
519
530
  const { createOrder, isCreatingOrder } = useAnyspendCreateOrder({
520
531
  onSuccess: data => {
521
532
  const orderId = data.data.id;