@b3dotfun/sdk 0.0.63-test.0 → 0.0.63

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.
Files changed (66) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +34 -0
  2. package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +275 -0
  3. package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +9 -0
  4. package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.js +288 -0
  5. package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +11 -0
  6. package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.js +33 -0
  7. package/dist/cjs/anyspend/react/components/common/OrderDetails.js +10 -2
  8. package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +2 -3
  9. package/dist/cjs/anyspend/react/components/index.d.ts +5 -1
  10. package/dist/cjs/anyspend/react/components/index.js +11 -3
  11. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +25 -3
  12. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +30 -8
  13. package/dist/cjs/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +116 -0
  14. package/dist/cjs/anyspend/react/hooks/useAnyspendQuote.js +1 -1
  15. package/dist/cjs/anyspend/types/api.d.ts +665 -3
  16. package/dist/cjs/anyspend/utils/orderPayload.js +4 -0
  17. package/dist/cjs/global-account/react/components/B3DynamicModal.js +10 -1
  18. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +2 -2
  19. package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +2 -2
  20. package/dist/cjs/global-account/react/hooks/useAuthentication.js +7 -2
  21. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +31 -1
  22. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +34 -0
  23. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +269 -0
  24. package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +9 -0
  25. package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.js +285 -0
  26. package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +11 -0
  27. package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.js +30 -0
  28. package/dist/esm/anyspend/react/components/common/OrderDetails.js +10 -2
  29. package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +2 -3
  30. package/dist/esm/anyspend/react/components/index.d.ts +5 -1
  31. package/dist/esm/anyspend/react/components/index.js +5 -1
  32. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +25 -3
  33. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +30 -8
  34. package/dist/esm/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +116 -0
  35. package/dist/esm/anyspend/react/hooks/useAnyspendQuote.js +1 -1
  36. package/dist/esm/anyspend/types/api.d.ts +665 -3
  37. package/dist/esm/anyspend/utils/orderPayload.js +4 -0
  38. package/dist/esm/global-account/react/components/B3DynamicModal.js +11 -2
  39. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +2 -2
  40. package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +2 -2
  41. package/dist/esm/global-account/react/hooks/useAuthentication.js +7 -2
  42. package/dist/esm/global-account/react/stores/useModalStore.d.ts +31 -1
  43. package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +34 -0
  44. package/dist/types/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +9 -0
  45. package/dist/types/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +11 -0
  46. package/dist/types/anyspend/react/components/index.d.ts +5 -1
  47. package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +25 -3
  48. package/dist/types/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +116 -0
  49. package/dist/types/anyspend/types/api.d.ts +665 -3
  50. package/dist/types/global-account/react/hooks/useAuthentication.d.ts +2 -2
  51. package/dist/types/global-account/react/stores/useModalStore.d.ts +31 -1
  52. package/package.json +3 -3
  53. package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +595 -0
  54. package/src/anyspend/react/components/AnySpendStakeB3ExactIn.tsx +522 -0
  55. package/src/anyspend/react/components/AnySpendStakeUpsideExactIn.tsx +73 -0
  56. package/src/anyspend/react/components/common/OrderDetails.tsx +10 -2
  57. package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +2 -3
  58. package/src/anyspend/react/components/index.ts +5 -1
  59. package/src/anyspend/react/hooks/useAnyspendFlow.ts +38 -8
  60. package/src/anyspend/react/hooks/useAnyspendQuote.ts +1 -1
  61. package/src/anyspend/types/api.ts +669 -1
  62. package/src/anyspend/utils/orderPayload.ts +5 -1
  63. package/src/global-account/react/components/B3DynamicModal.tsx +11 -1
  64. package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +2 -2
  65. package/src/global-account/react/hooks/useAuthentication.ts +10 -2
  66. package/src/global-account/react/stores/useModalStore.ts +34 -0
@@ -1,5 +1,5 @@
1
- import { normalizeAddress } from "@b3dotfun/sdk/anyspend/utils";
2
1
  import { components } from "@b3dotfun/sdk/anyspend/types/api";
2
+ import { normalizeAddress } from "@b3dotfun/sdk/anyspend/utils";
3
3
 
4
4
  export type OrderParams = {
5
5
  orderType: components["schemas"]["Order"]["type"];
@@ -48,6 +48,8 @@ export const buildPayload = (orderType: components["schemas"]["Order"]["type"],
48
48
  };
49
49
  case "custom":
50
50
  return { ...payload };
51
+ case "custom_exact_in":
52
+ return { ...payload, expectedDstAmount };
51
53
  case "hype_duel":
52
54
  return {
53
55
  expectedDstAmount,
@@ -73,6 +75,8 @@ export const buildMetadata = (orderType: components["schemas"]["Order"]["type"],
73
75
  return { ...baseMetadata, tournament };
74
76
  case "custom":
75
77
  return { ...baseMetadata, action: payload.action };
78
+ case "custom_exact_in":
79
+ return { ...baseMetadata, action: payload.action };
76
80
  case "hype_duel":
77
81
  return { ...baseMetadata };
78
82
  default:
@@ -5,16 +5,19 @@ import {
5
5
  AnySpendNFT,
6
6
  AnyspendSignatureMint,
7
7
  AnySpendStakeB3,
8
+ AnySpendStakeB3ExactIn,
8
9
  AnySpendTournament,
9
10
  OrderHistory,
10
11
  } from "@b3dotfun/sdk/anyspend/react";
11
12
  import { AnySpendDepositHype } from "@b3dotfun/sdk/anyspend/react/components/AnyspendDepositHype";
12
13
  import { AnySpendStakeUpside } from "@b3dotfun/sdk/anyspend/react/components/AnySpendStakeUpside";
14
+ import { AnySpendStakeUpsideExactIn } from "@b3dotfun/sdk/anyspend/react/components/AnySpendStakeUpsideExactIn";
13
15
  import { useGlobalWalletState } from "@b3dotfun/sdk/anyspend/utils";
14
16
  import { useIsMobile, useModalStore } from "@b3dotfun/sdk/global-account/react";
15
17
  import { cn } from "@b3dotfun/sdk/shared/utils/cn";
16
18
  import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
17
19
  import { useEffect, useRef } from "react";
20
+ import { useSetActiveWallet } from "thirdweb/react";
18
21
  import { AvatarEditor } from "./AvatarEditor/AvatarEditor";
19
22
  import { useB3 } from "./B3Provider/useB3";
20
23
  import { LinkAccount } from "./LinkAccount/LinkAccount";
@@ -23,7 +26,6 @@ import { RequestPermissions } from "./RequestPermissions/RequestPermissions";
23
26
  import { SignInWithB3Flow } from "./SignInWithB3/SignInWithB3Flow";
24
27
  import { Dialog, DialogContent, DialogDescription, DialogTitle } from "./ui/dialog";
25
28
  import { Drawer, DrawerContent, DrawerDescription, DrawerTitle } from "./ui/drawer";
26
- import { useSetActiveWallet } from "thirdweb/react";
27
29
 
28
30
  const debug = debugB3React("B3DynamicModal");
29
31
 
@@ -56,7 +58,9 @@ export function B3DynamicModal() {
56
58
  "anySpendJoinTournament",
57
59
  "anySpendFundTournament",
58
60
  "anySpendStakeB3",
61
+ "anySpendStakeB3ExactIn",
59
62
  "anySpendStakeUpside",
63
+ "anySpendStakeUpsideExactIn",
60
64
  "anySpendBuySpin",
61
65
  "anySpendOrderHistory",
62
66
  "signInWithB3",
@@ -71,7 +75,9 @@ export function B3DynamicModal() {
71
75
  "anySpendJoinTournament",
72
76
  "anySpendFundTournament",
73
77
  "anySpendStakeB3",
78
+ "anySpendStakeB3ExactIn",
74
79
  "anySpendStakeUpside",
80
+ "anySpendStakeUpsideExactIn",
75
81
  "anySpendBuySpin",
76
82
  "anySpendSignatureMint",
77
83
  "anySpendBondKit",
@@ -120,8 +126,12 @@ export function B3DynamicModal() {
120
126
  return <OrderHistory onBack={() => {}} mode="modal" />;
121
127
  case "anySpendStakeB3":
122
128
  return <AnySpendStakeB3 {...contentType} mode="modal" />;
129
+ case "anySpendStakeB3ExactIn":
130
+ return <AnySpendStakeB3ExactIn {...contentType} mode="modal" />;
123
131
  case "anySpendStakeUpside":
124
132
  return <AnySpendStakeUpside {...contentType} mode="modal" />;
133
+ case "anySpendStakeUpsideExactIn":
134
+ return <AnySpendStakeUpsideExactIn {...contentType} mode="modal" />;
125
135
  case "anySpendBuySpin":
126
136
  return <AnySpendBuySpin {...contentType} mode="modal" />;
127
137
  case "anySpendSignatureMint":
@@ -86,8 +86,8 @@ export function LoginStep({ onSuccess, chain }: LoginStepProps) {
86
86
  titleIcon: "https://cdn.b3.fun/b3_logo.svg",
87
87
  }}
88
88
  className="b3-login-step"
89
- onConnect={async wallet => {
90
- await onConnect(wallet);
89
+ onConnect={async (wallet, allConnectedWallets) => {
90
+ await onConnect(wallet, allConnectedWallets);
91
91
  const account = wallet.getAccount();
92
92
  if (!account) throw new Error("No account found");
93
93
  await onSuccess(account);
@@ -164,7 +164,15 @@ export function useAuthentication(partnerId: string) {
164
164
  );
165
165
 
166
166
  const onConnect = useCallback(
167
- async (wallet: Wallet) => {
167
+ async (_walleAutoConnectedWith: Wallet, allConnectedWallets: Wallet[]) => {
168
+ debug("@@useAuthentication:onConnect", { _walleAutoConnectedWith, allConnectedWallets });
169
+
170
+ const wallet = allConnectedWallets.find(wallet => wallet.id.startsWith("ecosystem."));
171
+
172
+ if (!wallet) {
173
+ throw new Error("No smart wallet found during auto-connect");
174
+ }
175
+
168
176
  debug("@@useAuthentication:onConnect", { wallet });
169
177
 
170
178
  try {
@@ -243,7 +251,7 @@ export function useAuthentication(partnerId: string) {
243
251
  const { isLoading: useAutoConnectLoading } = useAutoConnect({
244
252
  client,
245
253
  wallets: [wallet],
246
- onConnect: onConnect,
254
+ onConnect,
247
255
  });
248
256
 
249
257
  /**
@@ -223,6 +223,21 @@ export interface AnySpendStakeB3Props extends BaseModalProps {
223
223
  onSuccess?: () => void;
224
224
  }
225
225
 
226
+ /**
227
+ * Props for the AnySpend Stake B3 (Custom Exact In) modal
228
+ * Handles B3 token staking operations using the custom exact in flow
229
+ */
230
+ export interface AnySpendStakeB3ExactInProps extends BaseModalProps {
231
+ /** Modal type identifier */
232
+ type: "anySpendStakeB3ExactIn";
233
+ /** Recipient address to stake B3 for */
234
+ recipientAddress: string;
235
+ /** Stake amount */
236
+ stakeAmount?: string;
237
+ /** Callback function called when the stake is successful */
238
+ onSuccess?: () => void;
239
+ }
240
+
226
241
  /**
227
242
  * Props for the AnySpend Stake Contract modal
228
243
  * Handles token staking operations to a given contract
@@ -244,6 +259,23 @@ export interface AnySpendStakeUpsideProps extends BaseModalProps {
244
259
  onSuccess?: () => void;
245
260
  }
246
261
 
262
+ /**
263
+ * Props for the AnySpend Stake Upside (Exact In) modal
264
+ * Handles token staking operations using the custom exact in flow
265
+ */
266
+ export interface AnySpendStakeUpsideExactInProps extends BaseModalProps {
267
+ /** Modal type identifier */
268
+ type: "anySpendStakeUpsideExactIn";
269
+ /** Recipient address to stake tokens for */
270
+ recipientAddress: string;
271
+ /** Staking contract address */
272
+ stakingContractAddress: string;
273
+ /** Token to stake */
274
+ token: components["schemas"]["Token"];
275
+ /** Callback function called when the stake is successful */
276
+ onSuccess?: () => void;
277
+ }
278
+
247
279
  /**
248
280
  * Props for the AnySpend Buy Spin modal
249
281
  * Handles spin wheel entry purchases
@@ -355,7 +387,9 @@ export type ModalContentType =
355
387
  | AnySpendFundTournamentProps
356
388
  | AnySpendOrderHistoryProps
357
389
  | AnySpendStakeB3Props
390
+ | AnySpendStakeB3ExactInProps
358
391
  | AnySpendStakeUpsideProps
392
+ | AnySpendStakeUpsideExactInProps
359
393
  | AnySpendBuySpinProps
360
394
  | AnySpendSignatureMintProps
361
395
  | AnySpendBondKitProps