@b3dotfun/sdk 0.1.69-alpha.16 → 0.1.69-alpha.18
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/dist/cjs/anyspend/constants/rpc.d.ts +1 -1
- package/dist/cjs/anyspend/constants/rpc.js +1 -1
- package/dist/cjs/anyspend/react/components/AnySpendNFT.js +2 -2
- package/dist/cjs/anyspend/react/components/checkout/CheckoutSuccess.js +3 -3
- package/dist/cjs/anyspend/react/components/common/InsufficientDepositPayment.js +2 -2
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +2 -2
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +2 -2
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.js +2 -2
- package/dist/cjs/anyspend/utils/chain.js +8 -7
- package/dist/cjs/global-account/better-auth-client.d.ts +1883 -0
- package/dist/cjs/global-account/better-auth-client.js +17 -0
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +4 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.js +2 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +4 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +3 -2
- package/dist/cjs/global-account/react/components/B3Provider/BetterAuthProvider.d.ts +16 -0
- package/dist/cjs/global-account/react/components/B3Provider/BetterAuthProvider.js +120 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthResetPassword.d.ts +21 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthResetPassword.js +67 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +34 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthSignIn.js +149 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +9 -3
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +6 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.js +123 -0
- package/dist/cjs/global-account/react/components/SignInWithB3/utils/signInUtils.js +5 -1
- package/dist/cjs/global-account/react/components/custom/Button.d.ts +1 -1
- package/dist/cjs/global-account/react/components/index.d.ts +3 -0
- package/dist/cjs/global-account/react/components/index.js +7 -3
- package/dist/cjs/global-account/react/components/ui/button.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/index.d.ts +1 -0
- package/dist/cjs/global-account/react/hooks/index.js +4 -2
- package/dist/cjs/global-account/react/hooks/useBetterAuth.d.ts +969 -0
- package/dist/cjs/global-account/react/hooks/useBetterAuth.js +142 -0
- package/dist/cjs/shared/constants/chains/b3Chain.d.ts +7 -7
- package/dist/cjs/shared/constants/chains/b3Chain.js +4 -4
- package/dist/cjs/shared/constants/chains/b3Viem.d.ts +6 -0
- package/dist/cjs/shared/constants/chains/b3Viem.js +19 -0
- package/dist/cjs/shared/constants/chains/supported.d.ts +1 -1
- package/dist/cjs/shared/generated/chain-networks.json +2 -2
- package/dist/cjs/shared/utils/chains.d.ts +1 -1
- package/dist/cjs/shared/utils/chains.js +2 -2
- package/dist/esm/anyspend/constants/rpc.d.ts +1 -1
- package/dist/esm/anyspend/constants/rpc.js +1 -1
- package/dist/esm/anyspend/react/components/AnySpendNFT.js +2 -2
- package/dist/esm/anyspend/react/components/checkout/CheckoutSuccess.js +3 -3
- package/dist/esm/anyspend/react/components/common/InsufficientDepositPayment.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +2 -2
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.js +2 -2
- package/dist/esm/anyspend/utils/chain.js +10 -9
- package/dist/esm/global-account/better-auth-client.d.ts +1883 -0
- package/dist/esm/global-account/better-auth-client.js +13 -0
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +4 -1
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.js +2 -1
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +4 -1
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +3 -2
- package/dist/esm/global-account/react/components/B3Provider/BetterAuthProvider.d.ts +16 -0
- package/dist/esm/global-account/react/components/B3Provider/BetterAuthProvider.js +115 -0
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthResetPassword.d.ts +21 -0
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthResetPassword.js +64 -0
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +34 -0
- package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthSignIn.js +146 -0
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +9 -3
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +6 -0
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.js +120 -0
- package/dist/esm/global-account/react/components/SignInWithB3/utils/signInUtils.js +5 -1
- package/dist/esm/global-account/react/components/custom/Button.d.ts +1 -1
- package/dist/esm/global-account/react/components/index.d.ts +3 -0
- package/dist/esm/global-account/react/components/index.js +2 -0
- package/dist/esm/global-account/react/components/ui/button.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/index.d.ts +1 -0
- package/dist/esm/global-account/react/hooks/index.js +1 -0
- package/dist/esm/global-account/react/hooks/useBetterAuth.d.ts +969 -0
- package/dist/esm/global-account/react/hooks/useBetterAuth.js +136 -0
- package/dist/esm/shared/constants/chains/b3Chain.d.ts +7 -7
- package/dist/esm/shared/constants/chains/b3Chain.js +4 -4
- package/dist/esm/shared/constants/chains/b3Viem.d.ts +6 -0
- package/dist/esm/shared/constants/chains/b3Viem.js +16 -0
- package/dist/esm/shared/constants/chains/supported.d.ts +1 -1
- package/dist/esm/shared/generated/chain-networks.json +2 -2
- package/dist/esm/shared/utils/chains.d.ts +1 -1
- package/dist/esm/shared/utils/chains.js +2 -2
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/constants/rpc.d.ts +1 -1
- package/dist/types/global-account/better-auth-client.d.ts +1883 -0
- package/dist/types/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +4 -1
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +4 -1
- package/dist/types/global-account/react/components/B3Provider/BetterAuthProvider.d.ts +16 -0
- package/dist/types/global-account/react/components/SignInWithB3/BetterAuthResetPassword.d.ts +21 -0
- package/dist/types/global-account/react/components/SignInWithB3/BetterAuthSignIn.d.ts +34 -0
- package/dist/types/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.d.ts +6 -0
- package/dist/types/global-account/react/components/custom/Button.d.ts +1 -1
- package/dist/types/global-account/react/components/index.d.ts +3 -0
- package/dist/types/global-account/react/components/ui/button.d.ts +1 -1
- package/dist/types/global-account/react/hooks/index.d.ts +1 -0
- package/dist/types/global-account/react/hooks/useBetterAuth.d.ts +969 -0
- package/dist/types/shared/constants/chains/b3Chain.d.ts +7 -7
- package/dist/types/shared/constants/chains/b3Viem.d.ts +6 -0
- package/dist/types/shared/constants/chains/supported.d.ts +1 -1
- package/dist/types/shared/utils/chains.d.ts +1 -1
- package/package.json +2 -1
- package/src/anyspend/constants/rpc.ts +2 -1
- package/src/anyspend/react/components/AnySpendNFT.tsx +2 -2
- package/src/anyspend/react/components/checkout/CheckoutSuccess.tsx +3 -3
- package/src/anyspend/react/components/common/InsufficientDepositPayment.tsx +2 -2
- package/src/anyspend/react/components/common/OrderDetails.tsx +2 -2
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +4 -4
- package/src/anyspend/react/components/common/TransferCryptoDetails.tsx +2 -2
- package/src/anyspend/utils/chain.ts +9 -9
- package/src/global-account/better-auth-client.ts +17 -0
- package/src/global-account/react/components/B3Provider/B3ConfigProvider.tsx +6 -0
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +15 -5
- package/src/global-account/react/components/B3Provider/BetterAuthProvider.tsx +127 -0
- package/src/global-account/react/components/SignInWithB3/BetterAuthResetPassword.tsx +146 -0
- package/src/global-account/react/components/SignInWithB3/BetterAuthSignIn.tsx +375 -0
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +9 -3
- package/src/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.tsx +263 -0
- package/src/global-account/react/components/SignInWithB3/utils/signInUtils.ts +5 -1
- package/src/global-account/react/components/index.ts +3 -0
- package/src/global-account/react/hooks/index.ts +1 -0
- package/src/global-account/react/hooks/useBetterAuth.ts +177 -0
- package/src/shared/constants/chains/b3Chain.ts +5 -5
- package/src/shared/constants/chains/b3Viem.ts +18 -0
- package/src/shared/generated/chain-networks.json +2 -2
- package/src/shared/utils/chains.ts +3 -2
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import app from "../../../global-account/app.js";
|
|
2
|
+
import { useAuthStore, useB3Config } from "../../../global-account/react/index.js";
|
|
3
|
+
import { debugB3React } from "../../../shared/utils/debug.js";
|
|
4
|
+
import { useCallback } from "react";
|
|
5
|
+
import { betterAuthClient } from "../../better-auth-client.js";
|
|
6
|
+
import { useUserQuery } from "./useUserQuery.js";
|
|
7
|
+
const debug = debugB3React("useBetterAuth");
|
|
8
|
+
/**
|
|
9
|
+
* Hook for authentication via Better Auth (email/password + social providers).
|
|
10
|
+
*
|
|
11
|
+
* Follows the same pattern as Thirdweb auth:
|
|
12
|
+
* 1. Better Auth sign-in returns a session token
|
|
13
|
+
* 2. Token is passed as accessToken to app.authenticate({ strategy: "better-auth" })
|
|
14
|
+
* 3. BetterAuthStrategy verifies the token and issues a Feathers JWT
|
|
15
|
+
*/
|
|
16
|
+
export function useBetterAuth() {
|
|
17
|
+
const { partnerId } = useB3Config();
|
|
18
|
+
const { setUser } = useUserQuery();
|
|
19
|
+
const setIsAuthenticated = useAuthStore(state => state.setIsAuthenticated);
|
|
20
|
+
const setIsAuthenticating = useAuthStore(state => state.setIsAuthenticating);
|
|
21
|
+
const setIsConnected = useAuthStore(state => state.setIsConnected);
|
|
22
|
+
const setHasStartedConnecting = useAuthStore(state => state.setHasStartedConnecting);
|
|
23
|
+
const exchangeForFeathersJWT = useCallback(async (sessionToken) => {
|
|
24
|
+
debug("Exchanging Better Auth token for Feathers JWT");
|
|
25
|
+
const response = await app.authenticate({
|
|
26
|
+
strategy: "better-auth",
|
|
27
|
+
accessToken: sessionToken,
|
|
28
|
+
partnerId,
|
|
29
|
+
});
|
|
30
|
+
if (!response.user) {
|
|
31
|
+
throw new Error("No user returned from authentication");
|
|
32
|
+
}
|
|
33
|
+
setUser(response.user);
|
|
34
|
+
setIsAuthenticated(true);
|
|
35
|
+
setIsConnected(true);
|
|
36
|
+
setIsAuthenticating(false);
|
|
37
|
+
debug("Feathers JWT exchange successful", { userId: response.user?.userId });
|
|
38
|
+
return response;
|
|
39
|
+
}, [partnerId, setUser, setIsAuthenticated, setIsConnected, setIsAuthenticating]);
|
|
40
|
+
const signInWithEmail = useCallback(async (email, password) => {
|
|
41
|
+
debug("Signing in with email", { email });
|
|
42
|
+
setHasStartedConnecting(true);
|
|
43
|
+
setIsAuthenticating(true);
|
|
44
|
+
try {
|
|
45
|
+
const result = await betterAuthClient.signIn.email({ email, password });
|
|
46
|
+
if (result.error) {
|
|
47
|
+
throw new Error(result.error.message || "Sign in failed");
|
|
48
|
+
}
|
|
49
|
+
const token = result.data?.token;
|
|
50
|
+
if (!token) {
|
|
51
|
+
throw new Error("No session token returned from sign in");
|
|
52
|
+
}
|
|
53
|
+
return await exchangeForFeathersJWT(token);
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
setIsAuthenticating(false);
|
|
57
|
+
debug("Sign in failed", error);
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
60
|
+
}, [exchangeForFeathersJWT, setIsAuthenticating, setHasStartedConnecting]);
|
|
61
|
+
const signUpWithEmail = useCallback(async (email, password, name) => {
|
|
62
|
+
debug("Signing up with email", { email, name });
|
|
63
|
+
setHasStartedConnecting(true);
|
|
64
|
+
setIsAuthenticating(true);
|
|
65
|
+
try {
|
|
66
|
+
const result = await betterAuthClient.signUp.email({ email, password, name });
|
|
67
|
+
if (result.error) {
|
|
68
|
+
throw new Error(result.error.message || "Sign up failed");
|
|
69
|
+
}
|
|
70
|
+
const token = result.data?.token;
|
|
71
|
+
if (!token) {
|
|
72
|
+
throw new Error("No session token returned from sign up");
|
|
73
|
+
}
|
|
74
|
+
return await exchangeForFeathersJWT(token);
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
setIsAuthenticating(false);
|
|
78
|
+
debug("Sign up failed", error);
|
|
79
|
+
throw error;
|
|
80
|
+
}
|
|
81
|
+
}, [exchangeForFeathersJWT, setIsAuthenticating, setHasStartedConnecting]);
|
|
82
|
+
const signInWithSocial = useCallback(async (provider) => {
|
|
83
|
+
debug("Signing in with social provider", { provider });
|
|
84
|
+
setHasStartedConnecting(true);
|
|
85
|
+
setIsAuthenticating(true);
|
|
86
|
+
try {
|
|
87
|
+
const result = await betterAuthClient.signIn.social({
|
|
88
|
+
provider,
|
|
89
|
+
callbackURL: window.location.href,
|
|
90
|
+
});
|
|
91
|
+
if (result.error) {
|
|
92
|
+
throw new Error(result.error.message || `${provider} sign in failed`);
|
|
93
|
+
}
|
|
94
|
+
// Social auth redirects to provider — JWT exchange happens on callback
|
|
95
|
+
// via BetterAuthProvider session restore
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
setIsAuthenticating(false);
|
|
99
|
+
debug("Social sign in failed", error);
|
|
100
|
+
throw error;
|
|
101
|
+
}
|
|
102
|
+
}, [setIsAuthenticating, setHasStartedConnecting]);
|
|
103
|
+
const requestPasswordReset = useCallback(async (email, redirectTo) => {
|
|
104
|
+
debug("Requesting password reset", { email });
|
|
105
|
+
const result = await betterAuthClient.requestPasswordReset({
|
|
106
|
+
email,
|
|
107
|
+
redirectTo,
|
|
108
|
+
});
|
|
109
|
+
if (result.error) {
|
|
110
|
+
throw new Error(result.error.message || "Password reset request failed");
|
|
111
|
+
}
|
|
112
|
+
debug("Password reset email sent");
|
|
113
|
+
return result;
|
|
114
|
+
}, []);
|
|
115
|
+
const resetPassword = useCallback(async (newPassword, token) => {
|
|
116
|
+
debug("Resetting password");
|
|
117
|
+
const result = await betterAuthClient.resetPassword({
|
|
118
|
+
newPassword,
|
|
119
|
+
token,
|
|
120
|
+
});
|
|
121
|
+
if (result.error) {
|
|
122
|
+
throw new Error(result.error.message || "Password reset failed");
|
|
123
|
+
}
|
|
124
|
+
debug("Password reset successful");
|
|
125
|
+
return result;
|
|
126
|
+
}, []);
|
|
127
|
+
return {
|
|
128
|
+
signInWithEmail,
|
|
129
|
+
signUpWithEmail,
|
|
130
|
+
signInWithSocial,
|
|
131
|
+
requestPasswordReset,
|
|
132
|
+
resetPassword,
|
|
133
|
+
exchangeForFeathersJWT,
|
|
134
|
+
betterAuthClient,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { ChainNetworks } from "../../../global-account/types/chain-networks";
|
|
1
2
|
import { Chain as ThirdwebChain } from "thirdweb";
|
|
2
3
|
import { Chain } from "viem";
|
|
3
|
-
import { ChainNetworks } from "../../../global-account/types/chain-networks";
|
|
4
4
|
export declare const nullAddress = "0x0000000000000000000000000000000000000000";
|
|
5
5
|
export declare const avatarsNFTCollectionAddress = "0x658E2F67D3121A0eA81e5854be0b7539be27Aeb0";
|
|
6
6
|
export declare const viemToThirdwebChain: (chain: Chain) => ThirdwebChain;
|
|
@@ -33,8 +33,8 @@ export declare const b3Mainnet: {
|
|
|
33
33
|
experimental_preconfirmationTime?: number | undefined | undefined;
|
|
34
34
|
rpcUrls: {
|
|
35
35
|
readonly default: {
|
|
36
|
-
readonly http: readonly ["https://
|
|
37
|
-
readonly ws: readonly ["wss://
|
|
36
|
+
readonly http: readonly ["https://late-dimensional-yard.b3-mainnet.quiknode.pro/461dbdbd44158cd7a7a764a58ffb01a67eef77f2"];
|
|
37
|
+
readonly ws: readonly ["wss://late-dimensional-yard.b3-mainnet.quiknode.pro/461dbdbd44158cd7a7a764a58ffb01a67eef77f2"];
|
|
38
38
|
};
|
|
39
39
|
};
|
|
40
40
|
sourceId?: number | undefined | undefined;
|
|
@@ -43,7 +43,7 @@ export declare const b3Mainnet: {
|
|
|
43
43
|
fees?: import("viem").ChainFees<undefined> | undefined;
|
|
44
44
|
formatters?: undefined;
|
|
45
45
|
serializers?: import("viem").ChainSerializers<undefined, import("viem").TransactionSerializable> | undefined;
|
|
46
|
-
readonly rpc: "https://
|
|
46
|
+
readonly rpc: "https://late-dimensional-yard.b3-mainnet.quiknode.pro/461dbdbd44158cd7a7a764a58ffb01a67eef77f2";
|
|
47
47
|
readonly icon: {
|
|
48
48
|
readonly url: "https://cdn.b3.fun/b3_logo.svg";
|
|
49
49
|
readonly width: 32;
|
|
@@ -128,8 +128,8 @@ export declare const b3Chain: Chain | {
|
|
|
128
128
|
experimental_preconfirmationTime?: number | undefined | undefined;
|
|
129
129
|
rpcUrls: {
|
|
130
130
|
readonly default: {
|
|
131
|
-
readonly http: readonly ["https://
|
|
132
|
-
readonly ws: readonly ["wss://
|
|
131
|
+
readonly http: readonly ["https://late-dimensional-yard.b3-mainnet.quiknode.pro/461dbdbd44158cd7a7a764a58ffb01a67eef77f2"];
|
|
132
|
+
readonly ws: readonly ["wss://late-dimensional-yard.b3-mainnet.quiknode.pro/461dbdbd44158cd7a7a764a58ffb01a67eef77f2"];
|
|
133
133
|
};
|
|
134
134
|
};
|
|
135
135
|
sourceId?: number | undefined | undefined;
|
|
@@ -138,7 +138,7 @@ export declare const b3Chain: Chain | {
|
|
|
138
138
|
fees?: import("viem").ChainFees<undefined> | undefined;
|
|
139
139
|
formatters?: undefined;
|
|
140
140
|
serializers?: import("viem").ChainSerializers<undefined, import("viem").TransactionSerializable> | undefined;
|
|
141
|
-
readonly rpc: "https://
|
|
141
|
+
readonly rpc: "https://late-dimensional-yard.b3-mainnet.quiknode.pro/461dbdbd44158cd7a7a764a58ffb01a67eef77f2";
|
|
142
142
|
readonly icon: {
|
|
143
143
|
readonly url: "https://cdn.b3.fun/b3_logo.svg";
|
|
144
144
|
readonly width: 32;
|
|
@@ -52,11 +52,11 @@ export const b3Testnet = defineChain({
|
|
|
52
52
|
export const b3Mainnet = defineChain({
|
|
53
53
|
id: 8333,
|
|
54
54
|
name: "B3",
|
|
55
|
-
rpc: "https://
|
|
55
|
+
rpc: "https://late-dimensional-yard.b3-mainnet.quiknode.pro/461dbdbd44158cd7a7a764a58ffb01a67eef77f2",
|
|
56
56
|
rpcUrls: {
|
|
57
57
|
default: {
|
|
58
|
-
http: ["https://
|
|
59
|
-
ws: ["wss://
|
|
58
|
+
http: ["https://late-dimensional-yard.b3-mainnet.quiknode.pro/461dbdbd44158cd7a7a764a58ffb01a67eef77f2"],
|
|
59
|
+
ws: ["wss://late-dimensional-yard.b3-mainnet.quiknode.pro/461dbdbd44158cd7a7a764a58ffb01a67eef77f2"],
|
|
60
60
|
},
|
|
61
61
|
},
|
|
62
62
|
icon: {
|
|
@@ -123,7 +123,7 @@ export const thirdwebB3Testnet = defineThirdwebChain({
|
|
|
123
123
|
export const thirdwebB3Mainnet = defineThirdwebChain({
|
|
124
124
|
id: 8333,
|
|
125
125
|
name: "B3",
|
|
126
|
-
rpc: "https://
|
|
126
|
+
rpc: "https://late-dimensional-yard.b3-mainnet.quiknode.pro/461dbdbd44158cd7a7a764a58ffb01a67eef77f2/",
|
|
127
127
|
icon: {
|
|
128
128
|
url: "https://cdn.b3.fun/b3_logo.svg",
|
|
129
129
|
width: 32,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { B3_PUBLIC_RPC } from "../../../anyspend/constants/rpc.js";
|
|
2
|
+
import { b3 as viemB3 } from "viem/chains";
|
|
3
|
+
/**
|
|
4
|
+
* Viem's built-in `b3` chain points at mainnet-rpc.b3.fun; we spread it and override
|
|
5
|
+
* RPC URLs so all SDK call sites stay aligned with {@link B3_PUBLIC_RPC}.
|
|
6
|
+
*/
|
|
7
|
+
export const b3Viem = {
|
|
8
|
+
...viemB3,
|
|
9
|
+
rpcUrls: {
|
|
10
|
+
...viemB3.rpcUrls,
|
|
11
|
+
default: {
|
|
12
|
+
...viemB3.rpcUrls.default,
|
|
13
|
+
http: [B3_PUBLIC_RPC],
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
};
|
|
@@ -2,6 +2,7 @@ import type { Chain as ThirdwebChain } from "thirdweb";
|
|
|
2
2
|
export declare const supportedChains: import("viem").Chain[];
|
|
3
3
|
export declare const supportedChainsTW: ThirdwebChain[];
|
|
4
4
|
export declare const supportedChainNetworks: {
|
|
5
|
+
formatters?: Record<string, any> | undefined;
|
|
5
6
|
contracts?: Record<string, {
|
|
6
7
|
blockCreated?: number | undefined;
|
|
7
8
|
address: string;
|
|
@@ -9,7 +10,6 @@ export declare const supportedChainNetworks: {
|
|
|
9
10
|
sourceId?: number | undefined;
|
|
10
11
|
testnet?: boolean | undefined;
|
|
11
12
|
fees?: Record<string, any> | undefined;
|
|
12
|
-
formatters?: Record<string, any> | undefined;
|
|
13
13
|
color?: string | undefined;
|
|
14
14
|
testnetConfigID?: number | undefined;
|
|
15
15
|
badge?: string | undefined;
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
"name": "B3",
|
|
6
6
|
"rpcUrls": {
|
|
7
7
|
"default": {
|
|
8
|
-
"http": "https://
|
|
9
|
-
"ws": "wss://
|
|
8
|
+
"http": "https://late-dimensional-yard.b3-mainnet.quiknode.pro/461dbdbd44158cd7a7a764a58ffb01a67eef77f2/",
|
|
9
|
+
"ws": "wss://late-dimensional-yard.b3-mainnet.quiknode.pro/461dbdbd44158cd7a7a764a58ffb01a67eef77f2/"
|
|
10
10
|
},
|
|
11
11
|
"backups": []
|
|
12
12
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Chain } from "viem
|
|
1
|
+
import type { Chain } from "viem";
|
|
2
2
|
export declare function getChainById(id: number): Chain | undefined;
|
|
3
3
|
export declare function chainIdToName(id: number): string | undefined;
|
|
4
4
|
export declare function getExplorerUrl(chain: Chain, txHash: string): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { b3Viem } from "../../shared/constants/chains/b3Viem.js";
|
|
1
2
|
import { supportedChains } from "../../shared/constants/chains/supported.js";
|
|
2
|
-
import { b3 } from "viem/chains";
|
|
3
3
|
const baseChainBaseUrl = "https://basescan.org";
|
|
4
4
|
export function getChainById(id) {
|
|
5
5
|
return Object.values(supportedChains).find(chain => chain.id === id);
|
|
@@ -9,7 +9,7 @@ export function chainIdToName(id) {
|
|
|
9
9
|
return name === "Base Mainnet" ? "Base" : name === "The Open Network" ? "Open Network" : name;
|
|
10
10
|
}
|
|
11
11
|
export function getExplorerUrl(chain, txHash) {
|
|
12
|
-
if (chain.id ===
|
|
12
|
+
if (chain.id === b3Viem.id) {
|
|
13
13
|
return "https://explorer.b3.fun/b3/tx/" + txHash;
|
|
14
14
|
}
|
|
15
15
|
let baseUrl = chain.blockExplorers?.default.url;
|