@b3dotfun/sdk 0.0.51-alpha.0 → 0.0.51-alpha.2

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/types/chain.d.ts +1 -0
  2. package/dist/cjs/anyspend/utils/chain.js +56 -47
  3. package/dist/cjs/bondkit/bondkitToken.js +40 -6
  4. package/dist/cjs/bondkit/bondkitTokenFactory.js +16 -5
  5. package/dist/cjs/global-account/react/hooks/useAuthentication.js +6 -5
  6. package/dist/cjs/global-account/react/hooks/useFirstEOA.d.ts +1 -7670
  7. package/dist/cjs/global-account/react/hooks/useFirstEOA.js +1 -21
  8. package/dist/cjs/global-account/react/hooks/useSiwe.js +1 -0
  9. package/dist/cjs/global-account/react/hooks/useTWAuth.d.ts +4 -0
  10. package/dist/cjs/global-account/react/hooks/useTWAuth.js +33 -0
  11. package/dist/cjs/shared/constants/chains/b3Chain.d.ts +3 -9
  12. package/dist/cjs/shared/utils/simplehash.d.ts +1 -1
  13. package/dist/esm/anyspend/types/chain.d.ts +1 -0
  14. package/dist/esm/anyspend/utils/chain.js +57 -48
  15. package/dist/esm/bondkit/bondkitToken.js +40 -6
  16. package/dist/esm/bondkit/bondkitTokenFactory.js +16 -5
  17. package/dist/esm/global-account/react/hooks/useAuthentication.js +7 -6
  18. package/dist/esm/global-account/react/hooks/useFirstEOA.d.ts +1 -7670
  19. package/dist/esm/global-account/react/hooks/useFirstEOA.js +2 -22
  20. package/dist/esm/global-account/react/hooks/useSiwe.js +1 -0
  21. package/dist/esm/global-account/react/hooks/useTWAuth.d.ts +4 -0
  22. package/dist/esm/global-account/react/hooks/useTWAuth.js +27 -0
  23. package/dist/esm/shared/constants/chains/b3Chain.d.ts +3 -9
  24. package/dist/esm/shared/utils/simplehash.d.ts +1 -1
  25. package/dist/types/anyspend/types/chain.d.ts +1 -0
  26. package/dist/types/global-account/react/hooks/useFirstEOA.d.ts +1 -7670
  27. package/dist/types/global-account/react/hooks/useTWAuth.d.ts +4 -0
  28. package/dist/types/shared/constants/chains/b3Chain.d.ts +3 -9
  29. package/dist/types/shared/utils/simplehash.d.ts +1 -1
  30. package/package.json +5 -6
  31. package/src/anyspend/types/chain.ts +1 -0
  32. package/src/anyspend/utils/chain.ts +49 -53
  33. package/src/bondkit/bondkitToken.ts +42 -8
  34. package/src/bondkit/bondkitTokenFactory.ts +16 -5
  35. package/src/global-account/react/hooks/useAuthentication.ts +8 -6
  36. package/src/global-account/react/hooks/useFirstEOA.tsx +2 -20
  37. package/src/global-account/react/hooks/useSiwe.tsx +1 -0
  38. package/src/global-account/react/hooks/useTWAuth.tsx +36 -0
@@ -1,11 +1,9 @@
1
1
  import { useAuthStore } from "../../../global-account/react/index.js";
2
2
  import { debugB3React } from "../../../shared/utils/debug.js";
3
- import { client } from "../../../shared/utils/thirdweb.js";
4
- import { useEffect, useMemo, useState } from "react";
5
- import { viemAdapter } from "thirdweb/adapters/viem";
3
+ import { useEffect, useState } from "react";
6
4
  import { useConnectedWallets, useWalletInfo } from "thirdweb/react";
7
5
  const debug = debugB3React("useFirstEOA");
8
- export function useFirstEOA(chain) {
6
+ export function useFirstEOA() {
9
7
  const wallets = useConnectedWallets();
10
8
  const isConnected = useAuthStore(state => state.isConnected);
11
9
  const [firstEOA, setFirstEOA] = useState(undefined);
@@ -32,27 +30,9 @@ export function useFirstEOA(chain) {
32
30
  };
33
31
  autoSelectFirstEOAWallet();
34
32
  }, [isConnected, wallets]);
35
- const walletClient = useMemo(() => {
36
- if (!firstEOA)
37
- return undefined;
38
- if (!chain)
39
- return undefined;
40
- try {
41
- const viemClientWallet = viemAdapter.wallet.toViem({
42
- client,
43
- chain,
44
- wallet: firstEOA,
45
- });
46
- return viemClientWallet;
47
- }
48
- catch (err) {
49
- console.error("Error setting wallet client", err);
50
- }
51
- }, [firstEOA, chain]);
52
33
  return {
53
34
  account: firstEOA,
54
35
  address,
55
36
  info: walletInfo,
56
- walletClient,
57
37
  };
58
38
  }
@@ -5,6 +5,7 @@ import { useSearchParam } from "./useSearchParamsSSR.js";
5
5
  export function useSiwe() {
6
6
  const referralCode = useSearchParam("referralCode");
7
7
  const authenticate = useCallback(async (account, partnerId) => {
8
+ console.warn("@@useSiwe is deprecated, use useTWAuth instead");
8
9
  if (!account || !account.signMessage)
9
10
  throw new Error("Account not found");
10
11
  console.log("@@useAuthenticate:referralCode", referralCode);
@@ -0,0 +1,4 @@
1
+ import { Wallet } from "thirdweb/wallets";
2
+ export declare function useTWAuth(): {
3
+ authenticate: (wallet: Wallet, partnerId: string) => Promise<import("@feathersjs/authentication").AuthenticationResult>;
4
+ };
@@ -0,0 +1,27 @@
1
+ import app from "../../../global-account/app.js";
2
+ import debug from "../../../shared/utils/debug.js";
3
+ import { useCallback } from "react";
4
+ import { useSearchParam } from "./useSearchParamsSSR.js";
5
+ export function useTWAuth() {
6
+ const referralCode = useSearchParam("referralCode");
7
+ const authenticate = useCallback(async (wallet, partnerId) => {
8
+ if (!wallet || !wallet?.getAuthToken?.())
9
+ throw new Error("Wallet not found");
10
+ const authToken = wallet.getAuthToken();
11
+ debug("@@useTWSignIn:authToken", authToken);
12
+ debug("@@useTWSignIn:referralCode", referralCode);
13
+ // authenticate
14
+ const response = await app.authenticate({
15
+ strategy: "thirdweb-jwt",
16
+ accessToken: authToken,
17
+ // http://localhost:5173/?referralCode=GIO2
18
+ referralCode,
19
+ partnerId: partnerId,
20
+ });
21
+ debug("@@useTWSignIn:response", response);
22
+ return response;
23
+ }, [referralCode]);
24
+ return {
25
+ authenticate,
26
+ };
27
+ }
@@ -12,7 +12,6 @@ export declare const b3Mainnet: {
12
12
  readonly url: "https://explorer.b3.fun";
13
13
  };
14
14
  };
15
- blockTime?: number | undefined | undefined;
16
15
  contracts?: {
17
16
  [x: string]: import("viem").ChainContract | {
18
17
  [sourceId: number]: import("viem").ChainContract | undefined;
@@ -20,7 +19,7 @@ export declare const b3Mainnet: {
20
19
  ensRegistry?: import("viem").ChainContract | undefined;
21
20
  ensUniversalResolver?: import("viem").ChainContract | undefined;
22
21
  multicall3?: import("viem").ChainContract | undefined;
23
- erc6492Verifier?: import("viem").ChainContract | undefined;
22
+ universalSignatureVerifier?: import("viem").ChainContract | undefined;
24
23
  } | undefined;
25
24
  ensTlds?: readonly string[] | undefined;
26
25
  id: 8333;
@@ -30,7 +29,6 @@ export declare const b3Mainnet: {
30
29
  readonly symbol: "ETH";
31
30
  readonly decimals: 18;
32
31
  };
33
- experimental_preconfirmationTime?: number | undefined | undefined;
34
32
  rpcUrls: {
35
33
  readonly default: {
36
34
  readonly http: readonly ["https://mainnet-rpc.b3.fun"];
@@ -58,7 +56,6 @@ export declare const getViemChainConfig: (config: ChainNetworks) => {
58
56
  readonly url: string;
59
57
  };
60
58
  };
61
- blockTime?: number | undefined | undefined;
62
59
  contracts?: {
63
60
  [x: string]: import("viem").ChainContract | {
64
61
  [sourceId: number]: import("viem").ChainContract | undefined;
@@ -66,7 +63,7 @@ export declare const getViemChainConfig: (config: ChainNetworks) => {
66
63
  ensRegistry?: import("viem").ChainContract | undefined;
67
64
  ensUniversalResolver?: import("viem").ChainContract | undefined;
68
65
  multicall3?: import("viem").ChainContract | undefined;
69
- erc6492Verifier?: import("viem").ChainContract | undefined;
66
+ universalSignatureVerifier?: import("viem").ChainContract | undefined;
70
67
  } | undefined;
71
68
  ensTlds?: readonly string[] | undefined;
72
69
  id: number;
@@ -76,7 +73,6 @@ export declare const getViemChainConfig: (config: ChainNetworks) => {
76
73
  name: string;
77
74
  decimals: number;
78
75
  };
79
- experimental_preconfirmationTime?: number | undefined | undefined;
80
76
  rpcUrls: {
81
77
  readonly default: {
82
78
  readonly http: readonly [string];
@@ -107,7 +103,6 @@ export declare const b3Chain: Chain | {
107
103
  readonly url: "https://explorer.b3.fun";
108
104
  };
109
105
  };
110
- blockTime?: number | undefined | undefined;
111
106
  contracts?: {
112
107
  [x: string]: import("viem").ChainContract | {
113
108
  [sourceId: number]: import("viem").ChainContract | undefined;
@@ -115,7 +110,7 @@ export declare const b3Chain: Chain | {
115
110
  ensRegistry?: import("viem").ChainContract | undefined;
116
111
  ensUniversalResolver?: import("viem").ChainContract | undefined;
117
112
  multicall3?: import("viem").ChainContract | undefined;
118
- erc6492Verifier?: import("viem").ChainContract | undefined;
113
+ universalSignatureVerifier?: import("viem").ChainContract | undefined;
119
114
  } | undefined;
120
115
  ensTlds?: readonly string[] | undefined;
121
116
  id: 8333;
@@ -125,7 +120,6 @@ export declare const b3Chain: Chain | {
125
120
  readonly symbol: "ETH";
126
121
  readonly decimals: 18;
127
122
  };
128
- experimental_preconfirmationTime?: number | undefined | undefined;
129
123
  rpcUrls: {
130
124
  readonly default: {
131
125
  readonly http: readonly ["https://mainnet-rpc.b3.fun"];
@@ -1,6 +1,6 @@
1
1
  import * as SimpleHashTypes from "../../global-account/types/simplehash.types";
2
2
  export * from "../../global-account/types/simplehash.types";
3
- export declare const simpleHashChainToChainId: (chain: string) => 8453 | 8333 | 84532 | 1993 | null;
3
+ export declare const simpleHashChainToChainId: (chain: string) => 8453 | 8333 | 1993 | 84532 | null;
4
4
  export declare const simpleHashChainToChainName: (chain: number) => "base" | "b3" | "b3-sepolia" | "base-sepolia" | null;
5
5
  type SimpleHashRoute = `/v0/nfts/${string}/${string}/${string}` | `/v0/nfts/${string}` | `/v0/nfts/collections/${string}/${string}` | `/v0/nfts/transfers/${string}/${string}` | `/v0/fungibles/assets` | `/v0/native_tokens/balances` | string;
6
6
  type RouteReturnType<T extends SimpleHashRoute> = T extends `/v0/nfts/collections/${string}/${string}` ? SimpleHashTypes.SimpleHashNFTResponse : T extends `/v0/nfts/transfers/${string}/${string}` ? {
@@ -19,6 +19,7 @@ export interface IEVMChain extends IBaseChain {
19
19
  type: ChainType.EVM;
20
20
  viem: Chain;
21
21
  pollingInterval: number;
22
+ wethAddress: string;
22
23
  zapperEnum?: string;
23
24
  }
24
25
  export interface ISolanaChain extends IBaseChain {