@b3dotfun/sdk 0.0.49-alpha.9 → 0.0.50-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.
Files changed (38) hide show
  1. package/dist/cjs/anyspend/react/components/common/OrderToken.js +1 -1
  2. package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.js +1 -1
  3. package/dist/cjs/anyspend/react/components/common/OrderTokenAmountFiat.js +1 -1
  4. package/dist/cjs/anyspend/react/components/common/OrderTokenAmountNew.js +1 -1
  5. package/dist/cjs/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +24 -12
  6. package/dist/cjs/anyspend/types/api.d.ts +14 -2
  7. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +1 -1
  8. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +1 -1
  9. package/dist/cjs/global-account/react/components/B3Provider/RelayKitProviderWrapper.js +2 -2
  10. package/dist/cjs/global-account/react/hooks/useAuthentication.js +11 -0
  11. package/dist/cjs/global-account/react/hooks/useFirstEOA.d.ts +7663 -1
  12. package/dist/cjs/global-account/react/hooks/useFirstEOA.js +21 -1
  13. package/dist/esm/anyspend/react/components/common/OrderToken.js +1 -1
  14. package/dist/esm/anyspend/react/components/common/OrderTokenAmount.js +1 -1
  15. package/dist/esm/anyspend/react/components/common/OrderTokenAmountFiat.js +1 -1
  16. package/dist/esm/anyspend/react/components/common/OrderTokenAmountNew.js +1 -1
  17. package/dist/esm/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +24 -12
  18. package/dist/esm/anyspend/types/api.d.ts +14 -2
  19. package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +1 -1
  20. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +1 -1
  21. package/dist/esm/global-account/react/components/B3Provider/RelayKitProviderWrapper.js +2 -2
  22. package/dist/esm/global-account/react/hooks/useAuthentication.js +11 -0
  23. package/dist/esm/global-account/react/hooks/useFirstEOA.d.ts +7663 -1
  24. package/dist/esm/global-account/react/hooks/useFirstEOA.js +22 -2
  25. package/dist/types/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +24 -12
  26. package/dist/types/anyspend/types/api.d.ts +14 -2
  27. package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +1 -1
  28. package/dist/types/global-account/react/hooks/useFirstEOA.d.ts +7663 -1
  29. package/package.json +4 -4
  30. package/src/anyspend/react/components/common/OrderToken.tsx +1 -1
  31. package/src/anyspend/react/components/common/OrderTokenAmount.tsx +1 -1
  32. package/src/anyspend/react/components/common/OrderTokenAmountFiat.tsx +1 -1
  33. package/src/anyspend/react/components/common/OrderTokenAmountNew.tsx +1 -1
  34. package/src/anyspend/types/api.ts +14 -2
  35. package/src/global-account/react/components/B3Provider/B3Provider.tsx +1 -1
  36. package/src/global-account/react/components/B3Provider/RelayKitProviderWrapper.tsx +2 -2
  37. package/src/global-account/react/hooks/useAuthentication.ts +13 -1
  38. package/src/global-account/react/hooks/useFirstEOA.tsx +20 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b3dotfun/sdk",
3
- "version": "0.0.49-alpha.9",
3
+ "version": "0.0.50-alpha.0",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
@@ -295,8 +295,8 @@
295
295
  "@radix-ui/react-slot": "1.1.2",
296
296
  "@radix-ui/react-tabs": "1.1.3",
297
297
  "@radix-ui/react-tooltip": "1.1.8",
298
- "@reservoir0x/relay-kit-ui": "2.17.2",
299
- "@reservoir0x/relay-sdk": "2.4.0",
298
+ "@relayprotocol/relay-kit-ui": "5.0.3",
299
+ "@relayprotocol/relay-sdk": "3.0.0",
300
300
  "@solana/spl-token": "^0.4.13",
301
301
  "@solana/web3.js": "^1.98.2",
302
302
  "@stripe/react-stripe-js": "^3.7.0",
@@ -374,7 +374,7 @@
374
374
  "react": "^18.0.0 || ^19.0.0",
375
375
  "react-dom": "^18.0.0 || ^19.0.0",
376
376
  "react-native-mmkv": "^3.2.0",
377
- "thirdweb": "5.108.9",
377
+ "thirdweb": "5.108.14",
378
378
  "three": "^0.175.0",
379
379
  "viem": "^2.28.1",
380
380
  "wagmi": "^2.14.15"
@@ -5,7 +5,7 @@ import { Button, useAccountWallet, useTokenBalancesByChain } from "@b3dotfun/sdk
5
5
  import { cn } from "@b3dotfun/sdk/shared/utils";
6
6
  import { formatTokenAmount } from "@b3dotfun/sdk/shared/utils/number";
7
7
  import { simpleHashChainToChainName } from "@b3dotfun/sdk/shared/utils/simplehash";
8
- import { TokenSelector } from "@reservoir0x/relay-kit-ui";
8
+ import { TokenSelector } from "@relayprotocol/relay-kit-ui";
9
9
  import { CheckCircle2, ChevronsUpDown } from "lucide-react";
10
10
  import { useMemo } from "react";
11
11
  import { ChainTokenIcon } from "./ChainTokenIcon";
@@ -8,7 +8,7 @@ import { ALL_CHAINS, RELAY_SOLANA_MAINNET_CHAIN_ID } from "@b3dotfun/sdk/anyspen
8
8
  import { components } from "@b3dotfun/sdk/anyspend/types/api";
9
9
  import { Button } from "@b3dotfun/sdk/global-account/react";
10
10
  import { cn } from "@b3dotfun/sdk/shared/utils";
11
- import { TokenSelector } from "@reservoir0x/relay-kit-ui";
11
+ import { TokenSelector } from "@relayprotocol/relay-kit-ui";
12
12
  import { ChainTokenIcon } from "./ChainTokenIcon";
13
13
 
14
14
  export function OrderTokenAmount({
@@ -7,7 +7,7 @@ import { NumericFormat } from "react-number-format";
7
7
  import { ALL_CHAINS, RELAY_SOLANA_MAINNET_CHAIN_ID } from "@b3dotfun/sdk/anyspend";
8
8
  import { components } from "@b3dotfun/sdk/anyspend/types/api";
9
9
  import { cn } from "@b3dotfun/sdk/shared/utils";
10
- import { TokenSelector } from "@reservoir0x/relay-kit-ui";
10
+ import { TokenSelector } from "@relayprotocol/relay-kit-ui";
11
11
  import { ChainTokenIcon } from "./ChainTokenIcon";
12
12
 
13
13
  export function OrderTokenAmountFiat({
@@ -7,7 +7,7 @@ import { NumericFormat } from "react-number-format";
7
7
  import { ALL_CHAINS, RELAY_SOLANA_MAINNET_CHAIN_ID } from "@b3dotfun/sdk/anyspend";
8
8
  import { Button } from "@b3dotfun/sdk/global-account/react";
9
9
  import { cn } from "@b3dotfun/sdk/shared/utils";
10
- import { TokenSelector } from "@reservoir0x/relay-kit-ui";
10
+ import { TokenSelector } from "@relayprotocol/relay-kit-ui";
11
11
  import { ChainTokenIcon } from "./ChainTokenIcon";
12
12
  import { components } from "@b3dotfun/sdk/anyspend/types/api";
13
13
 
@@ -1334,10 +1334,22 @@ export interface components {
1334
1334
  /** @description Settlement information for executed orders */
1335
1335
  settlement: {
1336
1336
  /**
1337
- * @description Actual received amount after execution
1337
+ * @description Actual received amount after execution (only for swap/hypeduel orders). Optional - only present for swap/hypeduel orders.
1338
1338
  * @example 990000
1339
1339
  */
1340
- actualDstAmount: string | null;
1340
+ actualDstAmount?: string;
1341
+ /**
1342
+ * @description Complete relay API response data. Contains transaction details, state changes, fees, and execution status. Optional - can be backfilled by querying Relay API /requests/v2 endpoint.
1343
+ * @example {
1344
+ * "status": "success",
1345
+ * "metadata": {
1346
+ * "currencyOut": {
1347
+ * "amount": "990000"
1348
+ * }
1349
+ * }
1350
+ * }
1351
+ */
1352
+ relay?: Record<string, never>;
1341
1353
  } | null;
1342
1354
  /** @description Fee structure for the order including Stripe and AnySpend fees */
1343
1355
  fee?: Omit<components["schemas"]["Fee"], "type"> | null;
@@ -8,7 +8,7 @@ import { useWagmiConfig } from "@b3dotfun/sdk/global-account/react/hooks/useWagm
8
8
  import { PermissionsConfig } from "@b3dotfun/sdk/global-account/types/permissions";
9
9
  import { loadGA4Script } from "@b3dotfun/sdk/global-account/utils/analytics";
10
10
  import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
11
- import "@reservoir0x/relay-kit-ui/styles.css";
11
+ import "@relayprotocol/relay-kit-ui/styles.css";
12
12
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
13
13
  import { useCallback, useEffect, useState } from "react";
14
14
  import { Toaster } from "sonner";
@@ -1,5 +1,5 @@
1
- import { RelayKitProvider } from "@reservoir0x/relay-kit-ui";
2
- import { fetchChainConfigs, MAINNET_RELAY_API, RelayChain } from "@reservoir0x/relay-sdk";
1
+ import { RelayKitProvider } from "@relayprotocol/relay-kit-ui";
2
+ import { fetchChainConfigs, MAINNET_RELAY_API, RelayChain } from "@relayprotocol/relay-sdk";
3
3
  import { useEffect, useState } from "react";
4
4
 
5
5
  export function RelayKitProviderWrapper({
@@ -14,7 +14,7 @@ import {
14
14
  useDisconnect,
15
15
  useSetActiveWallet,
16
16
  } from "thirdweb/react";
17
- import { ecosystemWallet, Wallet } from "thirdweb/wallets";
17
+ import { Wallet, ecosystemWallet } from "thirdweb/wallets";
18
18
  import { preAuthenticate } from "thirdweb/wallets/in-app";
19
19
  import { useAccount, useConnect, useSwitchAccount } from "wagmi";
20
20
  import { useUserQuery } from "./useUserQuery";
@@ -45,6 +45,18 @@ export function useAuthentication(partnerId: string) {
45
45
  const { switchAccount } = useSwitchAccount();
46
46
  debug("@@activeWagmiAccount", activeWagmiAccount);
47
47
 
48
+ // Check localStorage version and clear if not found or mismatched
49
+ useEffect(() => {
50
+ if (typeof localStorage !== "undefined") {
51
+ const version = localStorage.getItem("version");
52
+ if (version !== "1") {
53
+ debug("@@localStorage:clearing due to version mismatch", { version });
54
+ localStorage.clear();
55
+ localStorage.setItem("version", "1");
56
+ }
57
+ }
58
+ }, []);
59
+
48
60
  const wallet = ecosystemWallet(ecosystemWalletId, {
49
61
  partnerId: partnerId,
50
62
  });
@@ -1,12 +1,14 @@
1
1
  import { useAuthStore } from "@b3dotfun/sdk/global-account/react";
2
2
  import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
3
- import { useEffect, useState } from "react";
3
+ import { client } from "@b3dotfun/sdk/shared/utils/thirdweb";
4
+ import { useEffect, useMemo, useState } from "react";
5
+ import { viemAdapter } from "thirdweb/adapters/viem";
4
6
  import { useConnectedWallets, useWalletInfo } from "thirdweb/react";
5
7
  import { Wallet } from "thirdweb/wallets";
6
8
 
7
9
  const debug = debugB3React("useFirstEOA");
8
10
 
9
- export function useFirstEOA() {
11
+ export function useFirstEOA(chain?: { id: number; name: string; rpc: string }) {
10
12
  const wallets = useConnectedWallets();
11
13
  const isConnected = useAuthStore(state => state.isConnected);
12
14
  const [firstEOA, setFirstEOA] = useState<Wallet | undefined>(undefined);
@@ -39,9 +41,25 @@ export function useFirstEOA() {
39
41
  autoSelectFirstEOAWallet();
40
42
  }, [isConnected, wallets]);
41
43
 
44
+ const walletClient = useMemo(() => {
45
+ if (!firstEOA) return undefined;
46
+ if (!chain) return undefined;
47
+ try {
48
+ const viemClientWallet = viemAdapter.wallet.toViem({
49
+ client,
50
+ chain,
51
+ wallet: firstEOA,
52
+ });
53
+ return viemClientWallet;
54
+ } catch (err) {
55
+ console.error("Error setting wallet client", err);
56
+ }
57
+ }, [firstEOA, chain]);
58
+
42
59
  return {
43
60
  account: firstEOA,
44
61
  address,
45
62
  info: walletInfo,
63
+ walletClient,
46
64
  };
47
65
  }