@b3dotfun/sdk 0.0.1-alpha.2 → 0.0.1-alpha.21

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 (115) hide show
  1. package/README.md +328 -230
  2. package/dist/cjs/anyspend/index.native.d.ts +13 -0
  3. package/dist/cjs/anyspend/index.native.js +35 -0
  4. package/dist/cjs/anyspend/react/components/AnySpend.d.ts +2 -1
  5. package/dist/cjs/anyspend/react/components/AnySpend.js +4 -4
  6. package/dist/cjs/anyspend/react/components/AnySpendBuySpin.d.ts +2 -1
  7. package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +123 -50
  8. package/dist/cjs/anyspend/react/components/common/OrderHistoryItem.js +5 -1
  9. package/dist/cjs/anyspend/react/components/common/TokenBalance.js +1 -1
  10. package/dist/cjs/anyspend/utils/chain.js +3 -0
  11. package/dist/cjs/global-account/react/components/B3DynamicModal.js +2 -2
  12. package/dist/cjs/global-account/react/components/{B3Provider.d.ts → B3Provider/B3Provider.d.ts} +3 -29
  13. package/dist/cjs/global-account/react/components/{B3Provider.js → B3Provider/B3Provider.js} +6 -34
  14. package/dist/cjs/global-account/react/components/{B3Provider.native.d.ts → B3Provider/B3Provider.native.d.ts} +2 -25
  15. package/dist/cjs/global-account/react/components/{B3Provider.native.js → B3Provider/B3Provider.native.js} +5 -28
  16. package/dist/cjs/global-account/react/components/B3Provider/types.d.ts +25 -0
  17. package/dist/cjs/global-account/react/components/B3Provider/types.js +20 -0
  18. package/dist/cjs/global-account/react/components/B3Provider/useB3.d.ts +5 -0
  19. package/dist/cjs/global-account/react/components/B3Provider/useB3.js +17 -0
  20. package/dist/cjs/global-account/react/components/StyleRoot.js +2 -2
  21. package/dist/cjs/global-account/react/components/index.d.ts +8 -6
  22. package/dist/cjs/global-account/react/components/index.js +18 -16
  23. package/dist/cjs/global-account/react/hooks/index.d.ts +1 -1
  24. package/dist/cjs/global-account/react/hooks/index.js +2 -1
  25. package/dist/cjs/global-account/react/hooks/useBestTransactionPath.js +3 -3
  26. package/dist/cjs/global-account/react/hooks/useTokenBalance.js +1 -1
  27. package/dist/cjs/global-account/react/index.native.d.ts +7 -0
  28. package/dist/cjs/global-account/react/index.native.js +21 -0
  29. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +2 -0
  30. package/dist/cjs/global-account/types/chain-networks.d.ts +34 -34
  31. package/dist/cjs/global-account/types/feature-flags.d.ts +5 -5
  32. package/dist/cjs/shared/constants/chains/b3Chain.d.ts +1 -1
  33. package/dist/cjs/shared/constants/chains/supported.d.ts +8 -7
  34. package/dist/cjs/shared/constants/chains/supported.js +8 -1
  35. package/dist/cjs/shared/utils/chains.js +4 -0
  36. package/dist/cjs/shared/utils/number.js +1 -1
  37. package/dist/esm/anyspend/index.native.d.ts +13 -0
  38. package/dist/esm/anyspend/index.native.js +19 -0
  39. package/dist/esm/anyspend/react/components/AnySpend.d.ts +2 -1
  40. package/dist/esm/anyspend/react/components/AnySpend.js +4 -4
  41. package/dist/esm/anyspend/react/components/AnySpendBuySpin.d.ts +2 -1
  42. package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +123 -50
  43. package/dist/esm/anyspend/react/components/common/OrderHistoryItem.js +5 -1
  44. package/dist/esm/anyspend/react/components/common/TokenBalance.js +1 -1
  45. package/dist/esm/anyspend/utils/chain.js +3 -0
  46. package/dist/esm/global-account/react/components/B3DynamicModal.js +1 -1
  47. package/dist/esm/global-account/react/components/{B3Provider.d.ts → B3Provider/B3Provider.d.ts} +3 -29
  48. package/dist/esm/global-account/react/components/{B3Provider.js → B3Provider/B3Provider.js} +5 -32
  49. package/dist/esm/global-account/react/components/{B3Provider.native.d.ts → B3Provider/B3Provider.native.d.ts} +2 -25
  50. package/dist/esm/global-account/react/components/{B3Provider.native.js → B3Provider/B3Provider.native.js} +5 -26
  51. package/dist/esm/global-account/react/components/B3Provider/types.d.ts +25 -0
  52. package/dist/esm/global-account/react/components/B3Provider/types.js +17 -0
  53. package/dist/esm/global-account/react/components/B3Provider/useB3.d.ts +5 -0
  54. package/dist/esm/global-account/react/components/B3Provider/useB3.js +14 -0
  55. package/dist/esm/global-account/react/components/StyleRoot.js +1 -1
  56. package/dist/esm/global-account/react/components/index.d.ts +8 -6
  57. package/dist/esm/global-account/react/components/index.js +7 -5
  58. package/dist/esm/global-account/react/hooks/index.d.ts +1 -1
  59. package/dist/esm/global-account/react/hooks/index.js +1 -1
  60. package/dist/esm/global-account/react/hooks/useBestTransactionPath.js +3 -3
  61. package/dist/esm/global-account/react/hooks/useTokenBalance.js +1 -1
  62. package/dist/esm/global-account/react/index.native.d.ts +7 -0
  63. package/dist/esm/global-account/react/index.native.js +11 -0
  64. package/dist/esm/global-account/react/stores/useModalStore.d.ts +2 -0
  65. package/dist/esm/global-account/types/chain-networks.d.ts +34 -34
  66. package/dist/esm/global-account/types/feature-flags.d.ts +5 -5
  67. package/dist/esm/shared/constants/chains/b3Chain.d.ts +1 -1
  68. package/dist/esm/shared/constants/chains/supported.d.ts +8 -7
  69. package/dist/esm/shared/constants/chains/supported.js +7 -0
  70. package/dist/esm/shared/utils/chains.js +4 -0
  71. package/dist/esm/shared/utils/number.js +1 -1
  72. package/dist/styles/index.css +1 -1
  73. package/dist/types/anyspend/index.native.d.ts +13 -0
  74. package/dist/types/anyspend/react/components/AnySpend.d.ts +2 -1
  75. package/dist/types/anyspend/react/components/AnySpendBuySpin.d.ts +2 -1
  76. package/dist/types/global-account/react/components/{B3Provider.d.ts → B3Provider/B3Provider.d.ts} +2 -28
  77. package/dist/types/global-account/react/components/{B3Provider.native.d.ts → B3Provider/B3Provider.native.d.ts} +1 -24
  78. package/dist/types/global-account/react/components/B3Provider/types.d.ts +25 -0
  79. package/dist/types/global-account/react/components/B3Provider/useB3.d.ts +5 -0
  80. package/dist/types/global-account/react/components/index.d.ts +8 -6
  81. package/dist/types/global-account/react/hooks/index.d.ts +1 -1
  82. package/dist/types/global-account/react/index.native.d.ts +7 -0
  83. package/dist/types/global-account/react/stores/useModalStore.d.ts +2 -0
  84. package/dist/types/global-account/types/chain-networks.d.ts +34 -34
  85. package/dist/types/global-account/types/feature-flags.d.ts +5 -5
  86. package/dist/types/shared/constants/chains/b3Chain.d.ts +1 -1
  87. package/dist/types/shared/constants/chains/supported.d.ts +8 -7
  88. package/package.json +26 -24
  89. package/src/anyspend/index.native.ts +24 -0
  90. package/src/anyspend/react/components/AnySpend.tsx +6 -5
  91. package/src/anyspend/react/components/AnySpendBuySpin.tsx +232 -179
  92. package/src/anyspend/react/components/common/OrderHistoryItem.tsx +5 -1
  93. package/src/anyspend/react/components/common/TokenBalance.tsx +1 -1
  94. package/src/anyspend/utils/chain.ts +3 -0
  95. package/src/global-account/react/components/B3DynamicModal.tsx +1 -1
  96. package/src/global-account/react/components/{B3Provider.native.tsx → B3Provider/B3Provider.native.tsx} +4 -45
  97. package/src/global-account/react/components/{B3Provider.tsx → B3Provider/B3Provider.tsx} +4 -53
  98. package/src/global-account/react/components/B3Provider/types.ts +40 -0
  99. package/src/global-account/react/components/B3Provider/useB3.ts +17 -0
  100. package/src/global-account/react/components/StyleRoot.tsx +1 -1
  101. package/src/global-account/react/components/index.ts +8 -6
  102. package/src/global-account/react/hooks/index.ts +1 -1
  103. package/src/global-account/react/hooks/useBestTransactionPath.tsx +3 -3
  104. package/src/global-account/react/hooks/useTokenBalance.tsx +1 -1
  105. package/src/global-account/react/index.native.ts +14 -0
  106. package/src/global-account/react/stores/useModalStore.ts +2 -0
  107. package/src/shared/constants/chains/supported.ts +12 -4
  108. package/src/shared/utils/chains.ts +4 -1
  109. package/src/shared/utils/number.ts +1 -1
  110. package/dist/cjs/styles/index.d.ts +0 -20
  111. package/dist/cjs/styles/index.js +0 -22
  112. package/dist/esm/styles/index.d.ts +0 -20
  113. package/dist/esm/styles/index.js +0 -20
  114. package/dist/types/styles/index.d.ts +0 -20
  115. package/src/styles/index.ts +0 -24
@@ -10,9 +10,9 @@ export declare const supportedChainNetworks: {
10
10
  testnet?: boolean | undefined;
11
11
  fees?: Record<string, any> | undefined;
12
12
  formatters?: Record<string, any> | undefined;
13
+ color?: string | undefined;
13
14
  testnetConfigID?: number | undefined;
14
15
  badge?: string | undefined;
15
- color?: string | undefined;
16
16
  enabledFeatures?: string[] | undefined;
17
17
  name: string;
18
18
  id: number;
@@ -35,19 +35,20 @@ export declare const supportedChainNetworks: {
35
35
  uri: string;
36
36
  }[];
37
37
  };
38
- _id: string | {};
39
38
  icon: {
40
39
  format: string;
41
40
  url: string;
42
- width: number;
43
41
  height: number;
42
+ width: number;
44
43
  };
44
+ _id: string | {};
45
45
  }[];
46
- export declare const b3Mainnet: import("viem").Chain | undefined;
47
- export declare const b3Testnet: import("viem").Chain | undefined;
46
+ export declare const b3Mainnet: import("viem").Chain;
47
+ export declare const b3Testnet: import("viem").Chain;
48
+ export declare const baseMainnet: import("viem").Chain | undefined;
48
49
  export declare const b3MainnetThirdWeb: Readonly<import("thirdweb/dist/types/chains/types").ChainOptions & {
49
50
  rpc: string;
50
- }> | undefined;
51
+ }>;
51
52
  export declare const b3TestnetThirdWeb: Readonly<import("thirdweb/dist/types/chains/types").ChainOptions & {
52
53
  rpc: string;
53
- }> | undefined;
54
+ }>;
package/package.json CHANGED
@@ -1,34 +1,29 @@
1
1
  {
2
2
  "name": "@b3dotfun/sdk",
3
- "version": "0.0.1-alpha.2",
3
+ "version": "0.0.1-alpha.21",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
7
7
  "module": "./dist/esm/index.js",
8
8
  "types": "./dist/types/index.d.ts",
9
9
  "exports": {
10
- "./styles": "./dist/types/styles/index.d.ts",
11
- ".": {
12
- "react-native": {
13
- "types": "./dist/types/global-account/index.native.d.ts",
14
- "import": "./dist/esm/global-account/index.native.js",
15
- "require": "./dist/cjs/global-account/index.native.js"
16
- },
17
- "default": {
18
- "types": "./dist/types/global-account/index.d.ts",
19
- "import": "./dist/esm/global-account/index.js",
20
- "require": "./dist/cjs/global-account/index.js"
21
- }
22
- },
10
+ "./index.css": "./dist/styles/index.css",
23
11
  "./anyspend": {
24
12
  "types": "./dist/types/anyspend/index.d.ts",
25
13
  "import": "./dist/esm/anyspend/index.js",
26
14
  "require": "./dist/cjs/anyspend/index.js"
27
15
  },
28
16
  "./anyspend/react": {
29
- "types": "./dist/types/anyspend/react/index.d.ts",
30
- "import": "./dist/esm/anyspend/react/index.js",
31
- "require": "./dist/cjs/anyspend/react/index.js"
17
+ "react-native": {
18
+ "types": "./dist/types/anyspend/react/index.native.d.ts",
19
+ "import": "./dist/esm/anyspend/react/index.native.js",
20
+ "require": "./dist/cjs/anyspend/react/index.native.js"
21
+ },
22
+ "default": {
23
+ "types": "./dist/types/anyspend/react/index.d.ts",
24
+ "import": "./dist/esm/anyspend/react/index.js",
25
+ "require": "./dist/cjs/anyspend/react/index.js"
26
+ }
32
27
  },
33
28
  "./anyspend/types": {
34
29
  "types": "./dist/types/anyspend/types/index.d.ts",
@@ -73,9 +68,16 @@
73
68
  }
74
69
  },
75
70
  "./global-account/react": {
76
- "types": "./dist/types/global-account/react/index.d.ts",
77
- "import": "./dist/esm/global-account/react/index.js",
78
- "require": "./dist/cjs/global-account/react/index.js"
71
+ "react-native": {
72
+ "types": "./dist/types/global-account/react/index.native.d.ts",
73
+ "import": "./dist/esm/global-account/react/index.native.js",
74
+ "require": "./dist/cjs/global-account/react/index.native.js"
75
+ },
76
+ "default": {
77
+ "types": "./dist/types/global-account/react/index.d.ts",
78
+ "import": "./dist/esm/global-account/react/index.js",
79
+ "require": "./dist/cjs/global-account/react/index.js"
80
+ }
79
81
  },
80
82
  "./global-account/types": {
81
83
  "types": "./dist/types/global-account/types.d.ts",
@@ -168,7 +170,7 @@
168
170
  "dependencies": {
169
171
  "@amplitude/analytics-browser": "2.14.0",
170
172
  "@b3dotfun/b3-api": "0.0.21",
171
- "@b3dotfun/basement-api": "0.0.10",
173
+ "@b3dotfun/basement-api": "0.0.11",
172
174
  "@chakra-ui/react": "2.10.7",
173
175
  "@feathersjs/authentication-client": "5.0.33",
174
176
  "@feathersjs/feathers": "5.0.33",
@@ -213,14 +215,14 @@
213
215
  "vaul": "^1.1.2",
214
216
  "viem": "2.27.2",
215
217
  "wagmi": "2.14.15",
216
- "zustand": "4.5.6"
218
+ "zustand": "4.5.6",
219
+ "zod": "3.25.51"
217
220
  },
218
221
  "devDependencies": {
219
222
  "@feathersjs/authentication-client": "5.0.33",
220
223
  "@feathersjs/feathers": "5.0.33",
221
224
  "@feathersjs/socketio-client": "5.0.33",
222
225
  "@feathersjs/typebox": "5.0.33",
223
- "@privy-io/react-auth": "2.8.0",
224
226
  "@types/big.js": "^6.2.2",
225
227
  "@types/invariant": "2.2.37",
226
228
  "@types/js-cookie": "3.0.6",
@@ -253,7 +255,7 @@
253
255
  }
254
256
  },
255
257
  "peerDependencies": {
256
- "@privy-io/react-auth": "*",
258
+ "@privy-io/react-auth": "^2.8.0",
257
259
  "@react-three/postprocessing": "2.16.6",
258
260
  "@readyplayerme/visage": "6.10.0",
259
261
  "@tanstack/react-query": "5.55.0",
@@ -0,0 +1,24 @@
1
+ // Export all hooks
2
+ export * from "./react/hooks";
3
+
4
+ // Providers
5
+ export * from "./react/providers/AnyspendProvider";
6
+
7
+ // Types
8
+ export * from "./types";
9
+
10
+ // Utils
11
+ export * from "./utils/address";
12
+ export * from "./utils/chain";
13
+ export * from "./utils/format";
14
+ export * from "./utils/json";
15
+ export * from "./utils/number";
16
+ export * from "./utils/string";
17
+ export * from "./utils/token";
18
+
19
+ // Constants
20
+ export * from "./constants";
21
+
22
+ // Abis
23
+ export * from "./abis/abi-usdc-base";
24
+ export * from "./abis/erc20-staking";
@@ -15,7 +15,6 @@ import {
15
15
  ShinyButton,
16
16
  StyleRoot,
17
17
  TransitionPanel,
18
- useAccountAssets,
19
18
  useAccountWallet,
20
19
  useOnchainName,
21
20
  useRouter,
@@ -23,8 +22,8 @@ import {
23
22
  useTokenData,
24
23
  useTokenFromUrl
25
24
  } from "@b3dotfun/sdk/global-account/react";
26
- import { shortenAddress } from "@b3dotfun/sdk/shared/utils/formatAddress";
27
25
  import { cn } from "@b3dotfun/sdk/shared/utils/cn";
26
+ import { shortenAddress } from "@b3dotfun/sdk/shared/utils/formatAddress";
28
27
  import { formatDisplayNumber, formatTokenAmount } from "@b3dotfun/sdk/shared/utils/number";
29
28
  import { motion } from "framer-motion";
30
29
  import invariant from "invariant";
@@ -66,7 +65,8 @@ export function AnySpend({
66
65
  mode = "modal",
67
66
  defaultActiveTab = "crypto",
68
67
  loadOrder,
69
- hideTransactionHistoryButton
68
+ hideTransactionHistoryButton,
69
+ recipientAddress: recipientAddressFromProps
70
70
  }: {
71
71
  destinationTokenAddress?: string;
72
72
  destinationTokenChainId?: number;
@@ -75,6 +75,7 @@ export function AnySpend({
75
75
  defaultActiveTab?: "crypto" | "fiat";
76
76
  loadOrder?: string;
77
77
  hideTransactionHistoryButton?: boolean;
78
+ recipientAddress?: string;
78
79
  }) {
79
80
  const searchParams = useSearchParamsSSR();
80
81
  const router = useRouter();
@@ -374,8 +375,8 @@ export function AnySpend({
374
375
 
375
376
  // Set default recipient address when wallet changes
376
377
  useEffect(() => {
377
- setRecipientAddress(globalAddress);
378
- }, [globalAddress]);
378
+ setRecipientAddress(recipientAddressFromProps || globalAddress);
379
+ }, [recipientAddressFromProps, globalAddress]);
379
380
 
380
381
  // Get anyspend price
381
382
  const activeInputAmountInWei = isSrcInputDirty