@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.
- package/README.md +328 -230
- package/dist/cjs/anyspend/index.native.d.ts +13 -0
- package/dist/cjs/anyspend/index.native.js +35 -0
- package/dist/cjs/anyspend/react/components/AnySpend.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnySpend.js +4 -4
- package/dist/cjs/anyspend/react/components/AnySpendBuySpin.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +123 -50
- package/dist/cjs/anyspend/react/components/common/OrderHistoryItem.js +5 -1
- package/dist/cjs/anyspend/react/components/common/TokenBalance.js +1 -1
- package/dist/cjs/anyspend/utils/chain.js +3 -0
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +2 -2
- package/dist/cjs/global-account/react/components/{B3Provider.d.ts → B3Provider/B3Provider.d.ts} +3 -29
- package/dist/cjs/global-account/react/components/{B3Provider.js → B3Provider/B3Provider.js} +6 -34
- package/dist/cjs/global-account/react/components/{B3Provider.native.d.ts → B3Provider/B3Provider.native.d.ts} +2 -25
- package/dist/cjs/global-account/react/components/{B3Provider.native.js → B3Provider/B3Provider.native.js} +5 -28
- package/dist/cjs/global-account/react/components/B3Provider/types.d.ts +25 -0
- package/dist/cjs/global-account/react/components/B3Provider/types.js +20 -0
- package/dist/cjs/global-account/react/components/B3Provider/useB3.d.ts +5 -0
- package/dist/cjs/global-account/react/components/B3Provider/useB3.js +17 -0
- package/dist/cjs/global-account/react/components/StyleRoot.js +2 -2
- package/dist/cjs/global-account/react/components/index.d.ts +8 -6
- package/dist/cjs/global-account/react/components/index.js +18 -16
- package/dist/cjs/global-account/react/hooks/index.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/index.js +2 -1
- package/dist/cjs/global-account/react/hooks/useBestTransactionPath.js +3 -3
- package/dist/cjs/global-account/react/hooks/useTokenBalance.js +1 -1
- package/dist/cjs/global-account/react/index.native.d.ts +7 -0
- package/dist/cjs/global-account/react/index.native.js +21 -0
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +2 -0
- package/dist/cjs/global-account/types/chain-networks.d.ts +34 -34
- package/dist/cjs/global-account/types/feature-flags.d.ts +5 -5
- package/dist/cjs/shared/constants/chains/b3Chain.d.ts +1 -1
- package/dist/cjs/shared/constants/chains/supported.d.ts +8 -7
- package/dist/cjs/shared/constants/chains/supported.js +8 -1
- package/dist/cjs/shared/utils/chains.js +4 -0
- package/dist/cjs/shared/utils/number.js +1 -1
- package/dist/esm/anyspend/index.native.d.ts +13 -0
- package/dist/esm/anyspend/index.native.js +19 -0
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnySpend.js +4 -4
- package/dist/esm/anyspend/react/components/AnySpendBuySpin.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +123 -50
- package/dist/esm/anyspend/react/components/common/OrderHistoryItem.js +5 -1
- package/dist/esm/anyspend/react/components/common/TokenBalance.js +1 -1
- package/dist/esm/anyspend/utils/chain.js +3 -0
- package/dist/esm/global-account/react/components/B3DynamicModal.js +1 -1
- package/dist/esm/global-account/react/components/{B3Provider.d.ts → B3Provider/B3Provider.d.ts} +3 -29
- package/dist/esm/global-account/react/components/{B3Provider.js → B3Provider/B3Provider.js} +5 -32
- package/dist/esm/global-account/react/components/{B3Provider.native.d.ts → B3Provider/B3Provider.native.d.ts} +2 -25
- package/dist/esm/global-account/react/components/{B3Provider.native.js → B3Provider/B3Provider.native.js} +5 -26
- package/dist/esm/global-account/react/components/B3Provider/types.d.ts +25 -0
- package/dist/esm/global-account/react/components/B3Provider/types.js +17 -0
- package/dist/esm/global-account/react/components/B3Provider/useB3.d.ts +5 -0
- package/dist/esm/global-account/react/components/B3Provider/useB3.js +14 -0
- package/dist/esm/global-account/react/components/StyleRoot.js +1 -1
- package/dist/esm/global-account/react/components/index.d.ts +8 -6
- package/dist/esm/global-account/react/components/index.js +7 -5
- package/dist/esm/global-account/react/hooks/index.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/index.js +1 -1
- package/dist/esm/global-account/react/hooks/useBestTransactionPath.js +3 -3
- package/dist/esm/global-account/react/hooks/useTokenBalance.js +1 -1
- package/dist/esm/global-account/react/index.native.d.ts +7 -0
- package/dist/esm/global-account/react/index.native.js +11 -0
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +2 -0
- package/dist/esm/global-account/types/chain-networks.d.ts +34 -34
- package/dist/esm/global-account/types/feature-flags.d.ts +5 -5
- package/dist/esm/shared/constants/chains/b3Chain.d.ts +1 -1
- package/dist/esm/shared/constants/chains/supported.d.ts +8 -7
- package/dist/esm/shared/constants/chains/supported.js +7 -0
- package/dist/esm/shared/utils/chains.js +4 -0
- package/dist/esm/shared/utils/number.js +1 -1
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/index.native.d.ts +13 -0
- package/dist/types/anyspend/react/components/AnySpend.d.ts +2 -1
- package/dist/types/anyspend/react/components/AnySpendBuySpin.d.ts +2 -1
- package/dist/types/global-account/react/components/{B3Provider.d.ts → B3Provider/B3Provider.d.ts} +2 -28
- package/dist/types/global-account/react/components/{B3Provider.native.d.ts → B3Provider/B3Provider.native.d.ts} +1 -24
- package/dist/types/global-account/react/components/B3Provider/types.d.ts +25 -0
- package/dist/types/global-account/react/components/B3Provider/useB3.d.ts +5 -0
- package/dist/types/global-account/react/components/index.d.ts +8 -6
- package/dist/types/global-account/react/hooks/index.d.ts +1 -1
- package/dist/types/global-account/react/index.native.d.ts +7 -0
- package/dist/types/global-account/react/stores/useModalStore.d.ts +2 -0
- package/dist/types/global-account/types/chain-networks.d.ts +34 -34
- package/dist/types/global-account/types/feature-flags.d.ts +5 -5
- package/dist/types/shared/constants/chains/b3Chain.d.ts +1 -1
- package/dist/types/shared/constants/chains/supported.d.ts +8 -7
- package/package.json +26 -24
- package/src/anyspend/index.native.ts +24 -0
- package/src/anyspend/react/components/AnySpend.tsx +6 -5
- package/src/anyspend/react/components/AnySpendBuySpin.tsx +232 -179
- package/src/anyspend/react/components/common/OrderHistoryItem.tsx +5 -1
- package/src/anyspend/react/components/common/TokenBalance.tsx +1 -1
- package/src/anyspend/utils/chain.ts +3 -0
- package/src/global-account/react/components/B3DynamicModal.tsx +1 -1
- package/src/global-account/react/components/{B3Provider.native.tsx → B3Provider/B3Provider.native.tsx} +4 -45
- package/src/global-account/react/components/{B3Provider.tsx → B3Provider/B3Provider.tsx} +4 -53
- package/src/global-account/react/components/B3Provider/types.ts +40 -0
- package/src/global-account/react/components/B3Provider/useB3.ts +17 -0
- package/src/global-account/react/components/StyleRoot.tsx +1 -1
- package/src/global-account/react/components/index.ts +8 -6
- package/src/global-account/react/hooks/index.ts +1 -1
- package/src/global-account/react/hooks/useBestTransactionPath.tsx +3 -3
- package/src/global-account/react/hooks/useTokenBalance.tsx +1 -1
- package/src/global-account/react/index.native.ts +14 -0
- package/src/global-account/react/stores/useModalStore.ts +2 -0
- package/src/shared/constants/chains/supported.ts +12 -4
- package/src/shared/utils/chains.ts +4 -1
- package/src/shared/utils/number.ts +1 -1
- package/dist/cjs/styles/index.d.ts +0 -20
- package/dist/cjs/styles/index.js +0 -22
- package/dist/esm/styles/index.d.ts +0 -20
- package/dist/esm/styles/index.js +0 -20
- package/dist/types/styles/index.d.ts +0 -20
- 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
|
|
47
|
-
export declare const b3Testnet: import("viem").Chain
|
|
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
|
-
}
|
|
51
|
+
}>;
|
|
51
52
|
export declare const b3TestnetThirdWeb: Readonly<import("thirdweb/dist/types/chains/types").ChainOptions & {
|
|
52
53
|
rpc: string;
|
|
53
|
-
}
|
|
54
|
+
}>;
|
package/package.json
CHANGED
|
@@ -1,34 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@b3dotfun/sdk",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
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
|
-
"./
|
|
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
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
"
|
|
77
|
-
|
|
78
|
-
|
|
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.
|
|
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
|