Compare commits

...
Author SHA1 Message Date
Jonas DanielsGitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>GitHub Action
654aaa2171 Version Packages (#2211)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: GitHub Action <[email protected]>
2024-01-29 18:12:25 -08:00
Joaquim VergesandGitHub 627d209927 update chains (#2232) 2024-01-30 01:02:21 +00:00
iketwandGitHub 57320957aa [RN] Adds ability to delete the ews active account (#2199) 2024-01-29 21:36:40 +00:00
Joaquim VergesandGitHub 6fdade6c45 [ServiceUtils] Option to include policy checks (#2230) 2024-01-29 20:59:41 +00:00
6d25586d08 [react, wallets] Add XDEFI wallet (#2218)
Co-authored-by: Manan Tank <[email protected]>
2024-01-26 19:21:41 +00:00
Manan TankandGitHub 4d89dc1efa [wallets] Update Safe SDK (#2221) 2024-01-26 17:57:28 +00:00
FirekeeperandGitHub a5653f07f8 [Docs] Document deployOnSign (#2223) 2024-01-26 17:54:54 +00:00
Manan TankandGitHub 7f35caff5d [react, react-native] update defaultTokens used in ConnectWallet (#2217) 2024-01-26 16:47:12 +00:00
FirekeeperandGitHub bf90fa5005 [AA] Option to not deploy SW on sign message (#2222) 2024-01-26 01:06:15 +00:00
FirekeeperandGitHub 3d63a2cb69 [SDK] Add erc1155.transferBatch (#2220) 2024-01-26 00:02:40 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Manan Tank
466b1e75dc Bump @radix-ui/react-tooltip from 1.0.6 to 1.0.7 (#2204)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Manan Tank <[email protected]>
2024-01-25 22:39:43 +00:00
Manan TankandGitHub 3dfc003902 [react] Allow uppercase email address in ConnectWallet (#2219) 2024-01-25 21:39:30 +00:00
Joaquim VergesandGitHub b34737d27a [SDK] switch to LRU caches (#2215) 2024-01-25 20:24:26 +00:00
1a5d41cc8a feat(auth): Next.js App Router support (#2106)
Signed-off-by: Adam Majmudar <[email protected]>
Co-authored-by: Adam Majmudar <[email protected]>
2024-01-25 00:25:14 +00:00
Tair AsimandGitHub a5541a1c55 service-utils: update api key metadata (#2210) 2024-01-23 19:36:39 +00:00
Tair AsimandGitHub 13e389a63e service-utils: polish usage hit error code (#2200) 2024-01-23 17:06:30 +00:00
Jonas DanielsGitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>GitHub Action
6884815428 Version Packages (#2195)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: GitHub Action <[email protected]>
2024-01-22 17:19:49 -08:00
Joaquim VergesandGitHub f29f91d7e0 [React] show embedded wallet free tier error msg in connect (#2209) 2024-01-23 00:54:30 +00:00
Manan TankandGitHub 212b2e7bc2 [react, react-native] ConnectWallet Details Modal UI, hide testnet faucet link by default (#2197) 2024-01-22 20:03:03 +00:00
iketwandGitHub 3f2ee85a1a chore: synced chains with db (#2203) 2024-01-22 18:56:10 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
24450ed7ac Bump vite from 3.2.7 to 3.2.8 (#2201)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-22 16:13:32 +00:00
Kien NgoandGitHub ba978f55b0 [react-core] Update code sample for useTokenSupply (#2202) 2024-01-21 05:06:08 +00:00
iketwandGitHub 94e4dc9aab [RN] UI improvements (#2198) 2024-01-18 22:52:26 +00:00
Manan TankandGitHub 67656c7131 Add missing react-native in release-artifacts (#2196) 2024-01-17 23:57:58 +00:00
168 changed files with 238145 additions and 133112 deletions
+1
View File
@@ -53,6 +53,7 @@ jobs:
git status
git add packages/react/typedoc/documentation.json
git add packages/react-core/typedoc/documentation.json
git add packages/react-native/typedoc/documentation.json
git add packages/sdk/typedoc/documentation.json
git add packages/storage/typedoc/documentation.json
git add packages/wallets/typedoc/documentation.json
+16
View File
@@ -1,5 +1,21 @@
# @thirdweb-dev/auth
## 4.1.26
### Patch Changes
- [#2106](https://github.com/thirdweb-dev/js/pull/2106) [`1a5d41cc`](https://github.com/thirdweb-dev/js/commit/1a5d41cc8afeef5f9882753473aad3bc0c7757ac) Thanks [@hsynlms](https://github.com/hsynlms)! - Add support for Next.js App Router
- Updated dependencies [[`a5653f07`](https://github.com/thirdweb-dev/js/commit/a5653f07f82e3f94e193d2b90c9d0c163223583c), [`bf90fa50`](https://github.com/thirdweb-dev/js/commit/bf90fa5005358e040475627ae23a474f7b263803), [`6fdade6c`](https://github.com/thirdweb-dev/js/commit/6fdade6c45f5d93fb3571d33720ab8103a7d002c), [`4d89dc1e`](https://github.com/thirdweb-dev/js/commit/4d89dc1efa2412b1e121cd14b1e2e72c667fceb0)]:
- @thirdweb-dev/wallets@2.4.4
## 4.1.25
### Patch Changes
- Updated dependencies []:
- @thirdweb-dev/wallets@2.4.3
## 4.1.24
### Patch Changes
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/auth",
"version": "4.1.24",
"version": "4.1.26",
"main": "dist/thirdweb-dev-auth.cjs.js",
"module": "dist/thirdweb-dev-auth.esm.js",
"browser": {
@@ -111,7 +111,7 @@
"express": "^4.18.1",
"fastify": "^4.24.2",
"mocha": "^10.2.0",
"next": "^12.3.4",
"next": "^13.4",
"next-auth": "^4.22.3",
"prettier": "^3.1.1",
"typescript": "^5.3.3"
+62
View File
@@ -0,0 +1,62 @@
import type { GenericAuthWallet } from "@thirdweb-dev/wallets";
import { z } from "zod";
import { Json, LoginPayloadOutputSchema, User } from "../../core";
export const PayloadBodySchema = z.object({
address: z.string(),
chainId: z.string().optional(),
});
export const ActiveBodySchema = z.object({
address: z.string(),
});
export const LoginPayloadBodySchema = z.object({
payload: LoginPayloadOutputSchema,
});
export type ThirdwebAuthRoute =
| "payload"
| "login"
| "logout"
| "user"
| "switch-account";
export type ThirdwebAuthUser<
TData extends Json = Json,
TSession extends Json = Json,
> = User<TSession> & {
data?: TData;
};
export type ThirdwebAuthConfigShared = {
domain: string;
wallet: GenericAuthWallet;
authOptions?: {
statement?: string;
uri?: string;
version?: string;
chainId?: string;
resources?: string[];
validateNonce?:
| ((nonce: string) => void)
| ((nonce: string) => Promise<void>);
validateTokenId?:
| ((tokenId: string) => void)
| ((tokenId: string) => Promise<void>);
loginPayloadDurationInSeconds?: number;
tokenDurationInSeconds?: number;
refreshIntervalInSeconds?: number;
};
cookieOptions?: {
domain?: string;
path?: string;
sameSite?: "lax" | "strict" | "none";
secure?: boolean;
};
};
export type ThirdwebNextContext = {
params?: Record<string, string | string[]>
};
+18 -74
View File
@@ -1,77 +1,21 @@
import { Json, ThirdwebAuth as ThirdwebAuthSDK } from "../core";
import { getUser } from "./helpers/user";
import payloadHandler from "./routes/payload";
import loginHandler from "./routes/login";
import logoutHandler from "./routes/logout";
import userHandler from "./routes/user";
import switchAccountHandler from "./routes/switch-account";
import {
// Next.js Pages Router support
// default and backward compatible
export { ThirdwebAuth } from './router-pages'
export type {
ThirdwebAuthConfig,
ThirdwebAuthContext,
} from './router-pages/types'
// Next.js App Router support
export { ThirdwebAuth as ThirdwebAuthAppRouter } from './router-app'
export type {
ThirdwebAuthConfig as ThirdwebAuthAppRouterConfig,
ThirdwebAuthContext as ThirdwebAuthAppRouterContext,
} from './router-app/types'
// common types
export type {
ThirdwebAuthRoute,
} from "./types";
import { NextRequest } from "next/server";
import {
GetServerSidePropsContext,
NextApiRequest,
NextApiResponse,
} from "next/types";
export * from "./types";
async function ThirdwebAuthRouter(
req: NextApiRequest,
res: NextApiResponse,
ctx: ThirdwebAuthContext,
) {
// Catch-all route must be named with [...thirdweb]
const { thirdweb } = req.query;
const action = thirdweb?.[0] as ThirdwebAuthRoute;
switch (action) {
case "payload":
return await payloadHandler(req, res, ctx);
case "login":
return await loginHandler(req, res, ctx);
case "user":
return await userHandler(req, res, ctx);
case "logout":
return await logoutHandler(req, res, ctx);
case "switch-account":
return await switchAccountHandler(req, res, ctx);
default:
return res.status(400).json({
message: "Invalid route for authentication.",
});
}
}
export function ThirdwebAuth<
TData extends Json = Json,
TSession extends Json = Json,
>(cfg: ThirdwebAuthConfig<TData, TSession>) {
const ctx = {
...cfg,
auth: new ThirdwebAuthSDK(cfg.wallet, cfg.domain),
};
function ThirdwebAuthHandler(
...args: [] | [NextApiRequest, NextApiResponse]
) {
if (args.length === 0) {
return async (req: NextApiRequest, res: NextApiResponse) =>
await ThirdwebAuthRouter(req, res, ctx as ThirdwebAuthContext);
}
return ThirdwebAuthRouter(args[0], args[1], ctx as ThirdwebAuthContext);
}
return {
ThirdwebAuthHandler,
getUser: (
req: GetServerSidePropsContext["req"] | NextRequest | NextApiRequest,
) => {
return getUser<TData, TSession>(req, ctx);
},
};
}
ThirdwebAuthUser,
ThirdwebNextContext,
} from './common/types'
@@ -0,0 +1,75 @@
import { cookies, headers } from "next/headers";
import {
THIRDWEB_AUTH_ACTIVE_ACCOUNT_COOKIE,
THIRDWEB_AUTH_TOKEN_COOKIE_PREFIX,
} from "../../../constants";
import type { Json } from "../../../core";
import type { ThirdwebAuthUser } from "../../common/types";
import type { ThirdwebAuthContext } from "../types";
export function getCookie(cookie: string): string | undefined {
return cookies().get(cookie)?.value;
}
export function getActiveCookie(): string | undefined {
const activeAccount = getCookie(THIRDWEB_AUTH_ACTIVE_ACCOUNT_COOKIE);
if (activeAccount) {
return `${THIRDWEB_AUTH_TOKEN_COOKIE_PREFIX}_${activeAccount}`;
}
// If active account is not present, then use the old default
return THIRDWEB_AUTH_TOKEN_COOKIE_PREFIX;
}
export function getToken(): string | undefined {
const headerList = headers();
if (headerList.has("authorization")) {
const authorizationHeader = headerList.get("authorization")?.split(" ");
if (authorizationHeader?.length === 2) {
return authorizationHeader[1];
}
}
const activeCookie = getActiveCookie();
if (!activeCookie) {
return undefined;
}
return getCookie(activeCookie);
}
export async function getUser<
TData extends Json = Json,
TSession extends Json = Json,
>(
ctx: ThirdwebAuthContext<TData, TSession>
): Promise<ThirdwebAuthUser<TData, TSession> | null> {
const token = getToken();
if (!token) {
return null;
}
let authenticatedUser: ThirdwebAuthUser<TData, TSession>;
try {
authenticatedUser = await ctx.auth.authenticate<TSession>(token, {
validateTokenId: async (tokenId: string) => {
if (ctx.authOptions?.validateTokenId) {
await ctx.authOptions?.validateTokenId(tokenId);
}
},
});
} catch (err) {
return null;
}
if (ctx.callbacks?.onUser) {
const data = await ctx.callbacks.onUser(authenticatedUser);
if (data) {
return { ...authenticatedUser, data };
}
}
return authenticatedUser;
}
@@ -0,0 +1,76 @@
import type { NextRequest } from "next/server";
import type { Json } from "../../core";
import { ThirdwebAuth as ThirdwebAuthSDK } from "../../core";
import { getUser } from "./helpers/user";
import payloadHandler from "./routes/payload";
import loginHandler from "./routes/login";
import logoutHandler from "./routes/logout";
import userHandler from "./routes/user";
import switchAccountHandler from "./routes/switch-account";
import type {
ThirdwebAuthConfig,
ThirdwebAuthContext,
} from "./types";
import type {
ThirdwebAuthRoute,
ThirdwebNextContext,
} from "../common/types";
export type {
ThirdwebAuthConfig,
ThirdwebAuthContext,
} from "./types";
export async function ThirdwebAuthRouter(
req: NextRequest,
ctx: ThirdwebNextContext,
authCtx: ThirdwebAuthContext,
) {
// Catch-all route must be named with [...thirdweb]
const action = ctx.params?.thirdweb?.[0] as ThirdwebAuthRoute;
switch (action) {
case "payload":
return await payloadHandler(req, authCtx);
case "login":
return await loginHandler(req, authCtx);
case "user":
return await userHandler(req, authCtx);
case "logout":
return await logoutHandler(req, authCtx);
case "switch-account":
return await switchAccountHandler(req, authCtx);
default:
return Response.json(
{ message: "Invalid route for authentication." },
{ status: 400},
);
}
}
export function ThirdwebAuth<
TData extends Json = Json,
TSession extends Json = Json,
>(cfg: ThirdwebAuthConfig<TData, TSession>) {
const authCtx = {
...cfg,
auth: new ThirdwebAuthSDK(cfg.wallet, cfg.domain),
};
async function ThirdwebAuthHandler(...args: [] | [NextRequest, ThirdwebNextContext]) {
if (args.length === 0) {
return async (req: NextRequest, ctx: ThirdwebNextContext): Promise<void | Response> =>
await ThirdwebAuthRouter(req, ctx, authCtx as ThirdwebAuthContext);
}
return ThirdwebAuthRouter(args[0], args[1], authCtx as ThirdwebAuthContext);
}
return {
ThirdwebAuthHandler,
getUser: async () => {
return await getUser<TData, TSession>(authCtx);
},
};
}
@@ -0,0 +1,123 @@
import type { NextRequest } from "next/server";
import { NextResponse } from "next/server";
import {
THIRDWEB_AUTH_ACTIVE_ACCOUNT_COOKIE,
THIRDWEB_AUTH_TOKEN_COOKIE_PREFIX,
} from "../../../constants";
import type { GenerateOptionsWithOptionalDomain } from "../../../core";
import type { ThirdwebAuthContext } from "../types";
import { LoginPayloadBodySchema } from "../types";
export default async function handler(
req: NextRequest,
ctx: ThirdwebAuthContext,
) {
if (req.method !== "POST") {
return Response.json(
{ error: "Invalid method. Only POST supported" },
{ status: 405 },
);
}
const reqBody = await req.json();
const parsedPayload = LoginPayloadBodySchema.safeParse(reqBody);
// Get signed login payload from the frontend
if (!parsedPayload.success) {
return Response.json(
{ error: "Invalid login payload" },
{ status: 400 },
);
}
const payload = parsedPayload.data.payload;
const validateNonce = async (nonce: string) => {
if (ctx.authOptions?.validateNonce) {
await ctx.authOptions?.validateNonce(nonce);
}
};
const getSession = async (address: string) => {
if (ctx.callbacks?.onLogin) {
return ctx.callbacks.onLogin(address);
}
};
const expirationTime = ctx.authOptions?.tokenDurationInSeconds
? new Date(Date.now() + 1000 * ctx.authOptions.tokenDurationInSeconds)
: undefined;
const generateOptions: GenerateOptionsWithOptionalDomain = {
verifyOptions: {
statement: ctx.authOptions?.statement,
uri: ctx.authOptions?.uri,
version: ctx.authOptions?.version,
chainId: ctx.authOptions?.chainId,
validateNonce,
resources: ctx.authOptions?.resources,
},
expirationTime,
session: getSession,
};
let token: string;
try {
// Generate an access token with the SDK using the signed payload
token = await ctx.auth.generate(payload, generateOptions);
} catch (err: any) {
if (err.message) {
return Response.json(
{ error: err.message },
{ status: 400 },
);
} else if (typeof err === "string") {
return Response.json(
{ error: err },
{ status: 400 },
);
} else {
return Response.json(
{ error: "Invalid login payload" },
{ status: 400 },
);
}
}
if (ctx.callbacks?.onToken) {
await ctx.callbacks.onToken(token);
}
const {
payload: { exp },
} = ctx.auth.parseToken(token);
// Securely set httpOnly cookie on request to prevent XSS on frontend
// And set path to / to enable thirdweb_auth_token usage on all endpoints
const response = NextResponse.json({ token }, { status: 200 });
response.cookies.set({
name: `${THIRDWEB_AUTH_TOKEN_COOKIE_PREFIX}_${payload.payload.address}`,
value: token,
domain: ctx.cookieOptions?.domain,
path: ctx.cookieOptions?.path || "/",
sameSite: ctx.cookieOptions?.sameSite || "none",
expires: new Date(exp * 1000),
httpOnly: true,
secure: ctx.cookieOptions?.secure || true,
});
response.cookies.set({
name: THIRDWEB_AUTH_ACTIVE_ACCOUNT_COOKIE,
value: payload.payload.address,
domain: ctx.cookieOptions?.domain,
path: ctx.cookieOptions?.path || "/",
sameSite: ctx.cookieOptions?.sameSite || "none",
expires: new Date(exp * 1000),
httpOnly: true,
secure: ctx.cookieOptions?.secure || true,
});
// Send token in body and as cookie for frontend and backend use cases
return response;
}
@@ -0,0 +1,51 @@
import type { NextRequest } from "next/server";
import { NextResponse } from "next/server";
import { getActiveCookie, getUser } from "../helpers/user";
import type { ThirdwebAuthContext } from "../types";
export default async function handler(
req: NextRequest,
ctx: ThirdwebAuthContext,
) {
if (req.method !== "POST") {
return Response.json(
{ error: "Invalid method. Only POST supported" },
{ status: 405 },
);
}
const activeCookie = getActiveCookie();
if (!activeCookie) {
return Response.json(
{ error: "No logged in user to logout" },
{ status: 400 },
);
}
if (ctx.callbacks?.onLogout) {
const user = await getUser(ctx);
if (user) {
await ctx.callbacks.onLogout(user);
}
}
// Set the access token to 'none' and expire in 5 seconds
const response = NextResponse.json(
{ message: "Successfully logged out" },
{ status: 200 },
);
response.cookies.set({
name: activeCookie,
value: '',
domain: ctx.cookieOptions?.domain,
path: ctx.cookieOptions?.path || "/",
sameSite: ctx.cookieOptions?.sameSite || "none",
expires: new Date(Date.now() + 5 * 1000),
httpOnly: true,
secure: ctx.cookieOptions?.secure || true,
});
return response;
}
@@ -0,0 +1,44 @@
import type { NextRequest } from "next/server";
import type { ThirdwebAuthContext } from "../types";
import { PayloadBodySchema } from "../types";
export default async function handler(
req: NextRequest,
ctx: ThirdwebAuthContext,
) {
if (req.method !== "POST") {
return Response.json(
{ error: "Invalid method. Only POST supported" },
{ status: 405 },
);
}
const reqBody = await req.json();
const parsedPayload = PayloadBodySchema.safeParse(reqBody);
if (!parsedPayload.success) {
return Response.json(
{ error: "Please provide an address" },
{ status: 400 },
);
}
// TODO: Add nonce generation + custom expiration + invalid before
const payload = await ctx.auth.payload({
address: parsedPayload.data.address,
statement: ctx.authOptions?.statement,
uri: ctx.authOptions?.uri,
version: ctx.authOptions?.version,
chainId: parsedPayload.data.chainId || ctx.authOptions?.chainId,
resources: ctx.authOptions?.resources,
expirationTime: ctx.authOptions?.loginPayloadDurationInSeconds
? new Date(
Date.now() + 1000 * ctx.authOptions.loginPayloadDurationInSeconds,
)
: undefined,
});
const response = Response.json({ payload }, { status: 200 });
return response;
}
@@ -0,0 +1,68 @@
import type { NextRequest } from "next/server";
import { NextResponse } from "next/server";
import type { ThirdwebAuthContext } from "../types";
import { ActiveBodySchema } from "../types";
import {
THIRDWEB_AUTH_ACTIVE_ACCOUNT_COOKIE,
THIRDWEB_AUTH_DEFAULT_TOKEN_DURATION_IN_SECONDS,
THIRDWEB_AUTH_TOKEN_COOKIE_PREFIX,
} from "../../../constants";
import { getCookie } from "../helpers/user";
export default async function handler(
req: NextRequest,
ctx: ThirdwebAuthContext,
) {
if (req.method !== "POST") {
return Response.json(
{ error: "Invalid method. Only POST supported" },
{ status: 405 },
);
}
const reqBody = await req.json();
const parsedPayload = ActiveBodySchema.safeParse(reqBody);
if (!parsedPayload.success) {
return Response.json(
{ error: "Please provide an address" },
{ status: 400 },
);
}
let cookieExpiration: Date;
const cookie = getCookie(`${THIRDWEB_AUTH_TOKEN_COOKIE_PREFIX}_${parsedPayload.data.address}`);
if (cookie) {
// If the new account is already logged in, get the expiration time from the cookie
const {
payload: { exp },
} = ctx.auth.parseToken(cookie);
cookieExpiration = new Date(exp * 1000);
} else if (ctx.authOptions?.tokenDurationInSeconds) {
// Otherwise, if we have a token duration in seconds, set it to that
cookieExpiration = new Date(
Date.now() + 1000 * ctx.authOptions.tokenDurationInSeconds,
);
} else {
// Otherwise, just default to 24 hours
cookieExpiration = new Date(
Date.now() + 1000 * THIRDWEB_AUTH_DEFAULT_TOKEN_DURATION_IN_SECONDS,
);
}
const response = NextResponse.json('', { status: 200 });
response.cookies.set({
name: THIRDWEB_AUTH_ACTIVE_ACCOUNT_COOKIE,
value: parsedPayload.data.address,
domain: ctx.cookieOptions?.domain,
path: ctx.cookieOptions?.path || "/",
sameSite: ctx.cookieOptions?.sameSite || "none",
expires: cookieExpiration,
httpOnly: true,
secure: ctx.cookieOptions?.secure || true,
});
return response;
}
@@ -0,0 +1,76 @@
import type { NextRequest } from "next/server";
import { NextResponse } from "next/server";
import {
THIRDWEB_AUTH_ACTIVE_ACCOUNT_COOKIE,
THIRDWEB_AUTH_DEFAULT_REFRESH_INTERVAL_IN_SECONDS,
THIRDWEB_AUTH_TOKEN_COOKIE_PREFIX,
} from "../../../constants";
import { getToken, getUser } from "../helpers/user";
import type { ThirdwebAuthContext } from "../types";
export default async function handler(
req: NextRequest,
ctx: ThirdwebAuthContext,
) {
if (req.method !== "GET") {
return Response.json(
{ error: "Invalid method. Only GET supported" },
{ status: 405 },
);
}
const user = await getUser(ctx);
const response = NextResponse.json(user, { status: 200 });
// Importantly, make sure the user was actually logged in before refreshing
if (user) {
const token = getToken();
if (token) {
const payload = ctx.auth.parseToken(token);
const refreshDate = ctx.authOptions?.refreshIntervalInSeconds
? new Date(
payload.payload.iat * 1000 +
ctx.authOptions.refreshIntervalInSeconds * 1000,
)
: new Date(
payload.payload.iat * 1000 +
THIRDWEB_AUTH_DEFAULT_REFRESH_INTERVAL_IN_SECONDS * 1000,
);
if (new Date() > refreshDate) {
const expirationTime = ctx.authOptions?.tokenDurationInSeconds
? new Date(Date.now() + 1000 * ctx.authOptions.tokenDurationInSeconds)
: undefined;
const refreshedToken = await ctx.auth.refresh(token, expirationTime);
const refreshedPayload = ctx.auth.parseToken(refreshedToken);
response.cookies.set({
name: `${THIRDWEB_AUTH_TOKEN_COOKIE_PREFIX}_${user.address}`,
value: refreshedToken,
domain: ctx.cookieOptions?.domain,
path: ctx.cookieOptions?.path || "/",
sameSite: ctx.cookieOptions?.sameSite || "none",
expires: new Date(refreshedPayload.payload.exp * 1000),
httpOnly: true,
secure: ctx.cookieOptions?.secure || true,
});
response.cookies.set({
name: THIRDWEB_AUTH_ACTIVE_ACCOUNT_COOKIE,
value: user.address,
domain: ctx.cookieOptions?.domain,
path: ctx.cookieOptions?.path || "/",
sameSite: ctx.cookieOptions?.sameSite || "none",
expires: new Date(refreshedPayload.payload.exp * 1000),
httpOnly: true,
secure: ctx.cookieOptions?.secure || true,
});
}
}
}
return response;
}
@@ -0,0 +1,35 @@
import type { Json, ThirdwebAuth, User } from "../../../core";
import type { ThirdwebAuthConfigShared } from '../../common/types'
export {
ActiveBodySchema,
LoginPayloadBodySchema,
PayloadBodySchema
} from '../../common/types'
export type ThirdwebAuthConfig<
TData extends Json = Json,
TSession extends Json = Json,
> = ThirdwebAuthConfigShared & {
callbacks?: {
onLogin?:
| ((address: string) => void | TSession)
| ((address: string) => Promise<void | TSession>);
onToken?:
| ((token: string) => void)
| ((token: string) => Promise<void>);
onUser?:
| ((user: User<TSession>) => void | TData)
| ((user: User<TSession>) => Promise<void | TData>);
onLogout?:
| ((user: User) => void)
| ((user: User) => Promise<void>);
};
};
export type ThirdwebAuthContext<
TData extends Json = Json,
TSession extends Json = Json,
> = Omit<Omit<ThirdwebAuthConfig<TData, TSession>, "wallet">, "domain"> & {
auth: ThirdwebAuth;
};
@@ -1,18 +1,19 @@
import {
THIRDWEB_AUTH_ACTIVE_ACCOUNT_COOKIE,
THIRDWEB_AUTH_TOKEN_COOKIE_PREFIX,
} from "../../constants";
import { Json } from "../../core";
import { ThirdwebAuthContext, ThirdwebAuthUser } from "../types";
import { GetServerSidePropsContext, NextApiRequest } from "next";
import { NextRequest } from "next/server";
} from "../../../constants";
import type { Json } from "../../../core";
import type { ThirdwebAuthContext } from "../types";
import type { ThirdwebAuthUser } from "../../common/types";
import type { GetServerSidePropsContext, NextApiRequest } from "next";
import type { NextRequest } from "next/server";
export function getCookie(
req: GetServerSidePropsContext["req"] | NextRequest | NextApiRequest,
cookie: string,
): string | undefined {
if (typeof req.cookies.get === "function") {
return req.cookies.get(cookie);
return req.cookies.get(cookie)?.value;
}
return (req.cookies as any)[cookie];
@@ -0,0 +1,77 @@
import { Json, ThirdwebAuth as ThirdwebAuthSDK } from "../../core";
import { getUser } from "./helpers/user";
import payloadHandler from "./routes/payload";
import loginHandler from "./routes/login";
import logoutHandler from "./routes/logout";
import userHandler from "./routes/user";
import switchAccountHandler from "./routes/switch-account";
import {
ThirdwebAuthConfig,
ThirdwebAuthContext,
ThirdwebAuthRoute,
} from "./types";
import { NextRequest } from "next/server";
import {
GetServerSidePropsContext,
NextApiRequest,
NextApiResponse,
} from "next/types";
export * from "./types";
async function ThirdwebAuthRouter(
req: NextApiRequest,
res: NextApiResponse,
ctx: ThirdwebAuthContext,
) {
// Catch-all route must be named with [...thirdweb]
const { thirdweb } = req.query;
const action = thirdweb?.[0] as ThirdwebAuthRoute;
switch (action) {
case "payload":
return await payloadHandler(req, res, ctx);
case "login":
return await loginHandler(req, res, ctx);
case "user":
return await userHandler(req, res, ctx);
case "logout":
return await logoutHandler(req, res, ctx);
case "switch-account":
return await switchAccountHandler(req, res, ctx);
default:
return res.status(400).json({
message: "Invalid route for authentication.",
});
}
}
export function ThirdwebAuth<
TData extends Json = Json,
TSession extends Json = Json,
>(cfg: ThirdwebAuthConfig<TData, TSession>) {
const ctx = {
...cfg,
auth: new ThirdwebAuthSDK(cfg.wallet, cfg.domain),
};
function ThirdwebAuthHandler(
...args: [] | [NextApiRequest, NextApiResponse]
) {
if (args.length === 0) {
return async (req: NextApiRequest, res: NextApiResponse) =>
await ThirdwebAuthRouter(req, res, ctx as ThirdwebAuthContext);
}
return ThirdwebAuthRouter(args[0], args[1], ctx as ThirdwebAuthContext);
}
return {
ThirdwebAuthHandler,
getUser: (
req: GetServerSidePropsContext["req"] | NextRequest | NextApiRequest,
) => {
return getUser<TData, TSession>(req, ctx);
},
};
}
@@ -1,11 +1,12 @@
import {
THIRDWEB_AUTH_ACTIVE_ACCOUNT_COOKIE,
THIRDWEB_AUTH_TOKEN_COOKIE_PREFIX,
} from "../../constants";
import { GenerateOptionsWithOptionalDomain } from "../../core";
import { LoginPayloadBodySchema, ThirdwebAuthContext } from "../types";
} from "../../../constants";
import type { GenerateOptionsWithOptionalDomain } from "../../../core";
import type { ThirdwebAuthContext } from "../types";
import { LoginPayloadBodySchema } from "../types";
import { serialize } from "cookie";
import { NextApiRequest, NextApiResponse } from "next";
import type { NextApiRequest, NextApiResponse } from "next";
export default async function handler(
req: NextApiRequest,
@@ -1,7 +1,7 @@
import { getActiveCookie, getUser } from "../helpers/user";
import { ThirdwebAuthContext } from "../types";
import type { ThirdwebAuthContext } from "../types";
import { serialize } from "cookie";
import { NextApiRequest, NextApiResponse } from "next";
import type { NextApiRequest, NextApiResponse } from "next";
export default async function handler(
req: NextApiRequest,
@@ -10,14 +10,14 @@ export default async function handler(
) {
if (req.method !== "POST") {
return res.status(405).json({
error: "Invalid method. Only POST supported.",
error: "Invalid method. Only POST supported",
});
}
const activeCookie = getActiveCookie(req);
if (!activeCookie) {
return res.status(400).json({
error: "No logged in user to logout.",
error: "No logged in user to logout",
});
}
@@ -1,5 +1,6 @@
import { PayloadBodySchema, ThirdwebAuthContext } from "../types";
import { NextApiRequest, NextApiResponse } from "next";
import type { ThirdwebAuthContext } from "../types";
import { PayloadBodySchema } from "../types";
import type { NextApiRequest, NextApiResponse } from "next";
export default async function handler(
req: NextApiRequest,
@@ -8,7 +9,7 @@ export default async function handler(
) {
if (req.method !== "POST") {
return res.status(405).json({
error: "Invalid method. Only POST supported.",
error: "Invalid method. Only POST supported",
});
}
@@ -1,12 +1,13 @@
import { serialize } from "cookie";
import { getCookie } from "../helpers/user";
import { ActiveBodySchema, ThirdwebAuthContext } from "../types";
import { NextApiRequest, NextApiResponse } from "next";
import type { ThirdwebAuthContext } from "../types";
import { ActiveBodySchema } from "../types";
import type { NextApiRequest, NextApiResponse } from "next";
import {
THIRDWEB_AUTH_ACTIVE_ACCOUNT_COOKIE,
THIRDWEB_AUTH_DEFAULT_TOKEN_DURATION_IN_SECONDS,
THIRDWEB_AUTH_TOKEN_COOKIE_PREFIX,
} from "../../constants";
} from "../../../constants";
export default async function handler(
req: NextApiRequest,
@@ -15,7 +16,7 @@ export default async function handler(
) {
if (req.method !== "POST") {
return res.status(405).json({
error: "Invalid method. Only POST supported.",
error: "Invalid method. Only POST supported",
});
}
@@ -3,10 +3,10 @@ import {
THIRDWEB_AUTH_ACTIVE_ACCOUNT_COOKIE,
THIRDWEB_AUTH_DEFAULT_REFRESH_INTERVAL_IN_SECONDS,
THIRDWEB_AUTH_TOKEN_COOKIE_PREFIX,
} from "../../constants";
} from "../../../constants";
import { getToken, getUser } from "../helpers/user";
import { ThirdwebAuthContext } from "../types";
import { NextApiRequest, NextApiResponse } from "next";
import type { ThirdwebAuthContext } from "../types";
import type { NextApiRequest, NextApiResponse } from "next";
export default async function handler(
req: NextApiRequest,
@@ -14,8 +14,8 @@ export default async function handler(
ctx: ThirdwebAuthContext,
) {
if (req.method !== "GET") {
return res.status(400).json({
error: "Invalid method. Only GET supported.",
return res.status(405).json({
error: "Invalid method. Only GET supported",
});
}
@@ -0,0 +1,48 @@
import type { Json, ThirdwebAuth, User } from "../../../core";
import type { GetServerSidePropsContext, NextApiRequest } from "next";
import type { NextRequest } from "next/server";
import type { ThirdwebAuthConfigShared } from '../../common/types'
export {
ActiveBodySchema,
LoginPayloadBodySchema,
PayloadBodySchema
} from '../../common/types'
type RequestType =
| GetServerSidePropsContext["req"]
| NextRequest
| NextApiRequest;
export type ThirdwebAuthConfig<
TData extends Json = Json,
TSession extends Json = Json,
> = ThirdwebAuthConfigShared & {
callbacks?: {
onLogin?:
| ((address: string, req: NextApiRequest) => void | TSession)
| ((address: string, req: NextApiRequest) => Promise<void | TSession>);
onToken?:
| ((token: string, req: NextApiRequest) => void)
| ((token: string, req: NextApiRequest) => Promise<void>);
onUser?:
| (<TRequestType extends RequestType = RequestType>(
user: User<TSession>,
req: TRequestType,
) => void | TData)
| (<TRequestType extends RequestType = RequestType>(
user: User<TSession>,
req: TRequestType,
) => Promise<void | TData>);
onLogout?:
| ((user: User, req: NextApiRequest) => void)
| ((user: User, req: NextApiRequest) => Promise<void>);
};
};
export type ThirdwebAuthContext<
TData extends Json = Json,
TSession extends Json = Json,
> = Omit<Omit<ThirdwebAuthConfig<TData, TSession>, "wallet">, "domain"> & {
auth: ThirdwebAuth;
};
-94
View File
@@ -1,94 +0,0 @@
import { Json, LoginPayloadOutputSchema, ThirdwebAuth, User } from "../../core";
import type { GenericAuthWallet } from "@thirdweb-dev/wallets";
import { GetServerSidePropsContext, NextApiRequest } from "next";
import { NextRequest } from "next/server";
import { z } from "zod";
export const PayloadBodySchema = z.object({
address: z.string(),
chainId: z.string().optional(),
});
export const ActiveBodySchema = z.object({
address: z.string(),
});
export const LoginPayloadBodySchema = z.object({
payload: LoginPayloadOutputSchema,
});
type RequestType =
| GetServerSidePropsContext["req"]
| NextRequest
| NextApiRequest;
export type ThirdwebAuthRoute =
| "payload"
| "login"
| "logout"
| "user"
| "switch-account";
export type ThirdwebAuthUser<
TData extends Json = Json,
TSession extends Json = Json,
> = User<TSession> & {
data?: TData;
};
export type ThirdwebAuthConfig<
TData extends Json = Json,
TSession extends Json = Json,
> = {
domain: string;
wallet: GenericAuthWallet;
authOptions?: {
statement?: string;
uri?: string;
version?: string;
chainId?: string;
resources?: string[];
validateNonce?:
| ((nonce: string) => void)
| ((nonce: string) => Promise<void>);
validateTokenId?:
| ((tokenId: string) => void)
| ((tokenId: string) => Promise<void>);
loginPayloadDurationInSeconds?: number;
tokenDurationInSeconds?: number;
refreshIntervalInSeconds?: number;
};
cookieOptions?: {
domain?: string;
path?: string;
sameSite?: "lax" | "strict" | "none";
secure?: boolean;
};
callbacks?: {
onLogin?:
| ((address: string, req: NextApiRequest) => void | TSession)
| ((address: string, req: NextApiRequest) => Promise<void | TSession>);
onToken?:
| ((token: string, req: NextApiRequest) => void)
| ((token: string, req: NextApiRequest) => Promise<void>);
onUser?:
| (<TRequestType extends RequestType = RequestType>(
user: User<TSession>,
req: TRequestType,
) => void | TData)
| (<TRequestType extends RequestType = RequestType>(
user: User<TSession>,
req: TRequestType,
) => Promise<void | TData>);
onLogout?:
| ((user: User, req: NextApiRequest) => void)
| ((user: User, req: NextApiRequest) => Promise<void>);
};
};
export type ThirdwebAuthContext<
TData extends Json = Json,
TSession extends Json = Json,
> = Omit<Omit<ThirdwebAuthConfig<TData, TSession>, "wallet">, "domain"> & {
auth: ThirdwebAuth;
};
+12
View File
@@ -1,5 +1,17 @@
# @thirdweb-dev/chains
## 0.1.66
### Patch Changes
- [#2232](https://github.com/thirdweb-dev/js/pull/2232) [`627d2099`](https://github.com/thirdweb-dev/js/commit/627d20992770670ab0c954ceea0b8679ce4f3088) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Update chains
## 0.1.65
### Patch Changes
- [#2203](https://github.com/thirdweb-dev/js/pull/2203) [`3f2ee85a`](https://github.com/thirdweb-dev/js/commit/3f2ee85a1ab70e74aefe7f458379a2ccaf4058a9) Thanks [@iketw](https://github.com/iketw)! - Syncs Chains
## 0.1.64
### Patch Changes
+33
View File
@@ -0,0 +1,33 @@
import type { Chain } from "../src/types";
export default {
"chain": "1220",
"chainId": 1220,
"explorers": [
{
"name": "flagscan",
"url": "https://testnet-scan.flagscan.io/",
"standard": "EIP3091"
}
],
"faucets": [],
"features": [],
"icon": {
"url": "ipfs://QmXo2p1i4zsbTNEu41EjjrhdmbKFDGHEHeADXZ3x2fgNKE/1682003789585.jpeg",
"width": 3600,
"height": 3600,
"format": "jpeg"
},
"infoURL": "https://flagblockchain.com/",
"name": "Flag Testnet",
"nativeCurrency": {
"name": "FLAG",
"symbol": "FLAG",
"decimals": 18
},
"networkId": 1220,
"redFlags": [],
"rpc": [],
"shortName": "Flag",
"slug": "flag-testnet",
"testnet": true
} as const satisfies Chain;
+27 -22
View File
@@ -1,37 +1,42 @@
import type { Chain } from "../src/types";
export default {
"chain": "Jumbo",
"chain": "INNOVATOR",
"chainId": 129,
"explorers": [
{
"name": "ProtoJumbo",
"url": "https://protojumbo.jumbochain.org",
"standard": "EIP3091"
"name": "Innovator Explorer",
"url": "https://evm.innovatorchain.com",
"standard": "none",
"icon": {
"url": "ipfs://QmYtUimyqHkkFxYdbXXRbUqNg2VLPUg6Uu2C2nmFWowiZM",
"width": 551,
"height": 540,
"format": "png"
}
}
],
"faucets": [
"https://protojumbo.jumbochain.org/faucet-smart"
],
"features": [
{
"name": "EIP155"
}
],
"infoURL": "https://jumbochain.org",
"name": "ProtoJumbo Testnet",
"faucets": [],
"features": [],
"icon": {
"url": "ipfs://QmVJBGeFYZXMQqicNdzctMfvPN5CrtRrfZBTw3CEpkCBsS",
"width": 1500,
"height": 1500,
"format": "png"
},
"infoURL": "https://innovatorchain.com",
"name": "Innovator Chain",
"nativeCurrency": {
"name": "JNFTC",
"symbol": "JNFTC",
"name": "INOV8",
"symbol": "INOV8",
"decimals": 18
},
"networkId": 129,
"rpc": [
"https://protojumbo-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://innovator-chain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://129.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://testnode.jumbochain.org"
"https://rpc.innovatorchain.com"
],
"shortName": "ProtoJumbo",
"slip44": 1,
"slug": "protojumbo-testnet",
"testnet": true
"shortName": "Innovator",
"slug": "innovator-chain",
"testnet": false
} as const satisfies Chain;
+40
View File
@@ -0,0 +1,40 @@
import type { Chain } from "../src/types";
export default {
"chain": "Rari",
"chainId": 1380012617,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "ipfs://QmdAX6818vZ3bAsPRv1DZGrc7qc8XTrgCnRLWrMecixhXb/RARI%20Chain%20Logomark%20Color.png",
"width": 512,
"height": 512,
"format": "png"
},
"infoURL": "https://rari-mainnet.caldera.dev/",
"name": "Rari Mainnet",
"nativeCurrency": {
"name": "Ether",
"symbol": "ETH",
"decimals": 18
},
"networkId": 1380012617,
"parent": {
"type": "L2",
"chain": "eip155-1",
"bridges": [
{
"url": "https://rari.calderabridge.xyz/"
}
]
},
"redFlags": [],
"rpc": [
"https://rari.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://1380012617.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://mainnet.rpc.rarichain.org/http"
],
"shortName": "rari",
"slug": "rari",
"testnet": false
} as const satisfies Chain;
+31
View File
@@ -0,0 +1,31 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 141221,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "Xantus Testnet",
"nativeCurrency": {
"name": "Xantus Testnet Token",
"symbol": "XAN",
"decimals": 18
},
"networkId": 141221,
"redFlags": [],
"rpc": [
"https://xantus-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://141221.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/xantustest/testnet/rpc"
],
"shortName": "Xantus Testnet",
"slug": "xantus-testnet",
"testnet": true
} as const satisfies Chain;
+7 -7
View File
@@ -4,8 +4,8 @@ export default {
"chainId": 1501,
"explorers": [
{
"name": "bevm scan",
"url": "https://scan.bevm.io",
"name": "bevm canary scan",
"url": "https://scan-canary.bevm.io",
"standard": "none"
}
],
@@ -18,7 +18,7 @@ export default {
"format": "png"
},
"infoURL": "https://chainx.org",
"name": "BEVM",
"name": "BEVM Canary",
"nativeCurrency": {
"name": "BTC",
"symbol": "BTC",
@@ -27,12 +27,12 @@ export default {
"networkId": 1501,
"redFlags": [],
"rpc": [
"https://bevm.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://bevm-canary.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://1501.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc-1.bevm.io/",
"https://rpc-2.bevm.io/"
"https://rpc-canary-1.bevm.io/",
"https://rpc-canary-2.bevm.io/"
],
"shortName": "chainx",
"slug": "bevm",
"slug": "bevm-canary",
"testnet": false
} as const satisfies Chain;
+47
View File
@@ -0,0 +1,47 @@
import type { Chain } from "../src/types";
export default {
"chain": "ETH",
"chainId": 168587773,
"explorers": [
{
"name": "Blast Sepolia Explorer",
"url": "https://testnet.blastscan.io",
"standard": "EIP3091",
"icon": {
"url": "ipfs://bafybeifc2h3x7jgy4x4nmg2m54ghbvmkfu6oweujambwefzqzew5vujhsi",
"width": 400,
"height": 400,
"format": "jpg"
}
}
],
"faucets": [
"https://faucet.quicknode.com/blast/sepolia"
],
"icon": {
"url": "ipfs://bafybeifc2h3x7jgy4x4nmg2m54ghbvmkfu6oweujambwefzqzew5vujhsi",
"width": 400,
"height": 400,
"format": "jpg"
},
"infoURL": "https://blast.io/",
"name": "Blast Sepolia Testnet",
"nativeCurrency": {
"name": "Sepolia Ether",
"symbol": "ETH",
"decimals": 18
},
"networkId": 168587773,
"parent": {
"type": "L2",
"chain": "eip155-11155111"
},
"rpc": [
"https://blast-sepolia-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://168587773.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://sepolia.blast.io"
],
"shortName": "blastsepolia",
"slug": "blast-sepolia-testnet",
"testnet": true
} as const satisfies Chain;
+34
View File
@@ -0,0 +1,34 @@
import type { Chain } from "../src/types";
export default {
"chain": "ECLIPSE",
"chainId": 17172,
"explorers": [
{
"name": "ECLIPSE Explorer",
"url": "https://subnets-test.avax.network/eclipse",
"standard": "EIP3091"
}
],
"faucets": [],
"features": [
{
"name": "EIP1559"
}
],
"infoURL": "http://eclipsenet.io",
"name": "Eclipse Subnet",
"nativeCurrency": {
"name": "Eclipse",
"symbol": "ECLP",
"decimals": 16
},
"networkId": 17172,
"rpc": [
"https://eclipse-subnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://17172.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/eclipse/testnet/rpc"
],
"shortName": "eclipse",
"slug": "eclipse-subnet",
"testnet": true
} as const satisfies Chain;
+23
View File
@@ -0,0 +1,23 @@
import type { Chain } from "../src/types";
export default {
"chain": "Magnet",
"chainId": 19527,
"explorers": [],
"faucets": [],
"infoURL": "https://magnet.magport.io/",
"name": "Magnet Network",
"nativeCurrency": {
"name": "Magnet Network",
"symbol": "DOT",
"decimals": 18
},
"networkId": 19527,
"rpc": [
"https://magnet-network.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://19527.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://magnet-rpc.magport.io/"
],
"shortName": "mgt",
"slug": "magnet-network",
"testnet": false
} as const satisfies Chain;
+3 -5
View File
@@ -9,9 +9,7 @@ export default {
"standard": "EIP3091"
}
],
"faucets": [
"https://faucet.mainnetz.io"
],
"faucets": [],
"icon": {
"url": "ipfs://QmT5gJ5weBiLT3GoYuF5yRTRLdPLCVZ3tXznfqW7M8fxgG",
"width": 400,
@@ -21,7 +19,7 @@ export default {
"infoURL": "https://mainnetz.io",
"name": "MainnetZ Mainnet",
"nativeCurrency": {
"name": "mainnetz",
"name": "MainnetZ",
"symbol": "NetZ",
"decimals": 18
},
@@ -32,7 +30,7 @@ export default {
"https://mainnet-rpc.mainnetz.io",
"https://eu-rpc.mainnetz.io"
],
"shortName": "NetZm",
"shortName": "netz",
"slug": "z-mainnet",
"testnet": false
} as const satisfies Chain;
+39
View File
@@ -0,0 +1,39 @@
import type { Chain } from "../src/types";
export default {
"chain": "JONO11",
"chainId": 20765,
"explorers": [
{
"name": "JONO11 Explorer",
"url": "https://subnets-test.avax.network/jono11",
"standard": "EIP3091"
}
],
"faucets": [],
"features": [
{
"name": "EIP1559"
}
],
"icon": {
"url": "ipfs://bafkreievzx4ke62dtc77o47x7vs7nn67ghzrwku6h5dxo3hwcsqfeblke4",
"width": 612,
"height": 612,
"format": "png"
},
"name": "Jono11 Subnet",
"nativeCurrency": {
"name": "Jono11 Token",
"symbol": "JONO",
"decimals": 18
},
"networkId": 20765,
"rpc": [
"https://jono11-subnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://20765.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/jono11/testnet/rpc"
],
"shortName": "jono11",
"slug": "jono11-subnet",
"testnet": true
} as const satisfies Chain;
+37
View File
@@ -0,0 +1,37 @@
import type { Chain } from "../src/types";
export default {
"chain": "AAH",
"chainId": 21133,
"explorers": [
{
"name": "AAH Blockscout",
"url": "https://exp.c4ex.net",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmY7HDEj3vnTZzCmenotr48nYyD13R2Fyd5t12R9ARu4wJ",
"width": 256,
"height": 256,
"format": "png"
}
}
],
"faucets": [
"https://t.me/c4eiAirdrop"
],
"infoURL": "https://c4ex.net",
"name": "All About Healthy",
"nativeCurrency": {
"name": "AAH",
"symbol": "AAH",
"decimals": 18
},
"networkId": 21133,
"rpc": [
"https://all-about-healthy.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://21133.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.c4ex.net"
],
"shortName": "aah",
"slug": "all-about-healthy",
"testnet": false
} as const satisfies Chain;
+19 -19
View File
@@ -1,37 +1,37 @@
import type { Chain } from "../src/types";
export default {
"chain": "ETH",
"chain": "Flag",
"chainId": 220,
"explorers": [
{
"name": "scalind",
"url": "https://explorer-sepolia.scalind.com",
"name": "flagscan",
"url": "https://scan.flagscan.io",
"standard": "EIP3091"
}
],
"faucets": [
"https://faucet.scalind.com"
],
"faucets": [],
"features": [],
"icon": {
"url": "ipfs://QmayuauUTSkYxbT1xi2AkkG5VLEMDhcMeZ18WZHiApPa9M",
"width": 512,
"height": 512,
"format": "png"
"url": "ipfs://QmXo2p1i4zsbTNEu41EjjrhdmbKFDGHEHeADXZ3x2fgNKE/1682003789585.jpeg",
"width": 200,
"height": 200,
"format": "jpeg"
},
"infoURL": "https://scalind.com",
"name": "Scalind Testnet",
"infoURL": "https://flagblockchain.com/",
"name": "Flag Mainnet",
"nativeCurrency": {
"name": "Sepolia Ether",
"symbol": "ETH",
"name": "Flag",
"symbol": "Flag",
"decimals": 18
},
"networkId": 220,
"redFlags": [],
"rpc": [
"https://scalind-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://flag.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://220.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc-sepolia.scalind.com"
"https://mainnet.flagscan.io/"
],
"shortName": "sepscal",
"slug": "scalind-testnet",
"testnet": true
"shortName": "Flag",
"slug": "flag",
"testnet": false
} as const satisfies Chain;
+12 -1
View File
@@ -3,6 +3,17 @@ export default {
"chain": "Kanazawa",
"chainId": 222000222,
"explorers": [
{
"name": "explorer",
"url": "https://testnet.meldscan.io",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmRhB4AbjDrhvwfSAQi2JvKirFiDWxzJvKEvG8S8AdDdED",
"width": 4000,
"height": 4000,
"format": "png"
}
},
{
"name": "explorer",
"url": "https://subnets-test.avax.network/meld",
@@ -34,7 +45,7 @@ export default {
"rpc": [
"https://kanazawa.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://222000222.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/meld/testnet/rpc"
"https://testnet-rpc.meld.com"
],
"shortName": "kanazawa",
"slip44": 1,
+4 -1
View File
@@ -37,7 +37,10 @@ export default {
"https://kava-rpc.gateway.pokt.network",
"wss://wevm.kava.io",
"https://kava-evm.publicnode.com",
"wss://kava-evm.publicnode.com"
"wss://kava-evm.publicnode.com",
"https://evm.kava-rpc.com",
"https://rpc.ankr.com/kava_evm",
"wss://wevm.kava-rpc.com"
],
"shortName": "kava",
"slug": "kava",
+35
View File
@@ -0,0 +1,35 @@
import type { Chain } from "../src/types";
export default {
"chain": "LiquidLayer",
"chainId": 25186,
"explorers": [
{
"name": "LiquidLayer Mainnet Explorer",
"url": "https://scan.liquidlayer.network",
"standard": "EIP3091"
}
],
"faucets": [],
"icon": {
"url": "ipfs://bafkreiayuuzfpcgwjll4us4hquvpqa5gwq3lbiedv4qftmlwcxhcyjzzpq",
"width": 500,
"height": 500,
"format": "png"
},
"infoURL": "https://scan.liquidlayer.network",
"name": "LiquidLayer Mainnet",
"nativeCurrency": {
"name": "LiquidLayer",
"symbol": "LILA",
"decimals": 18
},
"networkId": 25186,
"rpc": [
"https://liquidlayer.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://25186.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://mainnet.liquidlayer.network"
],
"shortName": "LILA",
"slug": "liquidlayer",
"testnet": false
} as const satisfies Chain;
+2 -12
View File
@@ -13,17 +13,6 @@ export default {
"height": 540,
"format": "png"
}
},
{
"name": "etherscan",
"url": "https://kromascan.com/",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmYtUimyqHkkFxYdbXXRbUqNg2VLPUg6Uu2C2nmFWowiZM",
"width": 551,
"height": 540,
"format": "png"
}
}
],
"faucets": [],
@@ -55,7 +44,8 @@ export default {
"rpc": [
"https://kroma.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://255.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://api.kroma.network"
"https://api.kroma.network",
"https://1rpc.io/kroma"
],
"shortName": "kroma",
"slug": "kroma",
+1 -3
View File
@@ -9,9 +9,7 @@ export default {
"standard": "EIP3091"
}
],
"faucets": [
"https://faucet.egonscan.com"
],
"faucets": [],
"icon": {
"url": "ipfs://QmNZiMmzMQYjyGtNSghtzLg4UooYhDgMQsa677DAP5KsBg",
"width": 512,
+3 -3
View File
@@ -11,9 +11,9 @@ export default {
],
"faucets": [],
"icon": {
"url": "ipfs://QmXLmYMqZ2ZKyaaEjayNjLai4RUo2YmorUDwkk95xmdTUr",
"width": 80,
"height": 80,
"url": "ipfs://bafkreievnqg3xjokaty4kfbxxbrzm5v5y7exbaaia2txrh4sfgrqsalfym",
"width": 128,
"height": 128,
"format": "png"
},
"infoURL": "https://ancient8.gg/",
+3 -3
View File
@@ -11,9 +11,9 @@ export default {
],
"faucets": [],
"icon": {
"url": "ipfs://QmXLmYMqZ2ZKyaaEjayNjLai4RUo2YmorUDwkk95xmdTUr",
"width": 80,
"height": 80,
"url": "ipfs://bafkreievnqg3xjokaty4kfbxxbrzm5v5y7exbaaia2txrh4sfgrqsalfym",
"width": 128,
"height": 128,
"format": "png"
},
"infoURL": "https://ancient8.gg/",
+31
View File
@@ -0,0 +1,31 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 28982,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "Testnet",
"nativeCurrency": {
"name": "Testnet Token",
"symbol": "RUI",
"decimals": 18
},
"networkId": 28982,
"redFlags": [],
"rpc": [
"https://testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://28982.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
],
"shortName": "Testnet",
"slug": "testnet",
"testnet": true
} as const satisfies Chain;
+42
View File
@@ -0,0 +1,42 @@
import type { Chain } from "../src/types";
export default {
"chain": "ETH",
"chainId": 32001,
"explorers": [
{
"name": "W3Gamez Holesky Explorer",
"url": "https://w3gamez-holesky.web3games.com",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmUc57w3UTHiWapNW9oQb1dP57ymtdemTTbpvGkjVHBRCo",
"width": 192,
"height": 192,
"format": "png"
}
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmaQdiE7vwxKeuWCjk4nKBikcpg4XCzQkFWGrAZHmMKnrq",
"width": 400,
"height": 400,
"format": "png"
},
"infoURL": "https://web3games.com/",
"name": "W3Gamez Holesky Testnet",
"nativeCurrency": {
"name": "W3Gamez Testnet Ether",
"symbol": "ETH",
"decimals": 18
},
"networkId": 32001,
"rpc": [
"https://w3gamez-holesky-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://32001.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc-holesky.w3gamez.network"
],
"shortName": "w3gamez",
"slip44": 1,
"slug": "w3gamez-holesky-testnet",
"testnet": true
} as const satisfies Chain;
+35
View File
@@ -0,0 +1,35 @@
import type { Chain } from "../src/types";
export default {
"chain": "CVM",
"chainId": 323,
"explorers": [
{
"name": "Blockscout",
"url": "https://explorer.cosvm.net",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmYtUimyqHkkFxYdbXXRbUqNg2VLPUg6Uu2C2nmFWowiZM",
"width": 551,
"height": 540,
"format": "png"
}
}
],
"faucets": [],
"infoURL": "https://cosvm.network",
"name": "Cosvm Mainnet",
"nativeCurrency": {
"name": "Cosvm",
"symbol": "CVM",
"decimals": 18
},
"networkId": 323,
"rpc": [
"https://cosvm.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://323.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.cosvm.net"
],
"shortName": "cvm",
"slug": "cosvm",
"testnet": false
} as const satisfies Chain;
+12 -1
View File
@@ -3,6 +3,17 @@ export default {
"chain": "MELD",
"chainId": 333000333,
"explorers": [
{
"name": "explorer",
"url": "https://meldscan.io",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmRhB4AbjDrhvwfSAQi2JvKirFiDWxzJvKEvG8S8AdDdED",
"width": 4000,
"height": 4000,
"format": "png"
}
},
{
"name": "explorer",
"url": "https://subnets.avax.network/meld",
@@ -34,7 +45,7 @@ export default {
"rpc": [
"https://meld.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://333000333.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/meld/mainnet/rpc"
"https://rpc-1.meld.com"
],
"shortName": "meld",
"slug": "meld",
+1 -3
View File
@@ -9,9 +9,7 @@ export default {
"standard": "EIP3091"
}
],
"faucets": [
"https://faucet.securechain.ai"
],
"faucets": [],
"icon": {
"url": "ipfs://Qme2Z8VFYjhHGfLQPBnfseNpEdRfmTDy7VXqrdH4AHETJf",
"width": 150,
+14 -7
View File
@@ -6,17 +6,23 @@ export default {
{
"name": "AlveyScan",
"url": "https://alveyscan.com",
"standard": "EIP3091"
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmTuY2Goyxpuy5GmA32EMYZBwxRcGsahiMFgfeBixSk7rb",
"width": 2048,
"height": 1538,
"format": "png"
}
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmSwczpPLBG6ob1a8WLoujthiCPzwEyJNp7WdKRi52qbWX",
"width": 310,
"height": 310,
"url": "ipfs://QmTuY2Goyxpuy5GmA32EMYZBwxRcGsahiMFgfeBixSk7rb",
"width": 2048,
"height": 1538,
"format": "png"
},
"infoURL": "https://alveyscan.com/rpc",
"infoURL": "https://alveychain.com/",
"name": "AlveyChain Mainnet",
"nativeCurrency": {
"name": "AlveyCoin",
@@ -27,8 +33,9 @@ export default {
"rpc": [
"https://alveychain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://3797.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.alveychain.com/rpc",
"https://rpc2.alvey.io/rpc"
"https://elves-core1.alvey.io",
"https://elves-core2.alvey.io",
"https://elves-core3.alvey.io"
],
"shortName": "alv",
"slug": "alveychain",
+51
View File
@@ -0,0 +1,51 @@
import type { Chain } from "../src/types";
export default {
"chain": "FIL",
"chainId": 380,
"explorers": [
{
"name": "ZKAmoeba Test Explorer",
"url": "https://testnetexplorer.zkamoeba.com",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmRTChjmiwh9HrGsLh9qECsH7WHQAhqT5Ww8S34s8ME2Cp",
"width": 512,
"height": 512,
"format": "png"
}
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmRTChjmiwh9HrGsLh9qECsH7WHQAhqT5Ww8S34s8ME2Cp",
"width": 512,
"height": 512,
"format": "png"
},
"infoURL": "https://testnet.zkamoeba.com",
"name": "ZKAmoeba Testnet",
"nativeCurrency": {
"name": "filecoin",
"symbol": "FIL",
"decimals": 18
},
"networkId": 380,
"parent": {
"type": "L2",
"chain": "eip155-314",
"bridges": [
{
"url": "https://testnet.zkamoeba.com/en/bridge"
}
]
},
"rpc": [
"https://zkamoeba-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://380.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.testnet.zkamoeba.com:4050/",
"https://rpc1.testnet.zkamoeba.com:4050/"
],
"shortName": "zkamoeba-test",
"slug": "zkamoeba-testnet",
"testnet": true
} as const satisfies Chain;
+50
View File
@@ -0,0 +1,50 @@
import type { Chain } from "../src/types";
export default {
"chain": "FIL",
"chainId": 381,
"explorers": [
{
"name": "ZKAmoeba Explorer",
"url": "https://explorer.zkamoeba.com",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmRTChjmiwh9HrGsLh9qECsH7WHQAhqT5Ww8S34s8ME2Cp",
"width": 512,
"height": 512,
"format": "png"
}
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmRTChjmiwh9HrGsLh9qECsH7WHQAhqT5Ww8S34s8ME2Cp",
"width": 512,
"height": 512,
"format": "png"
},
"infoURL": "https://www.zkamoeba.com",
"name": "ZKAmoeba Mainnet",
"nativeCurrency": {
"name": "filecoin",
"symbol": "FIL",
"decimals": 18
},
"networkId": 381,
"parent": {
"type": "L2",
"chain": "eip155-314",
"bridges": [
{
"url": "https://www.zkamoeba.com/en/bridge"
}
]
},
"rpc": [
"https://zkamoeba.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://381.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.mainnet.zkamoeba.com/rpc"
],
"shortName": "zkamoeba",
"slug": "zkamoeba",
"testnet": false
} as const satisfies Chain;
+31
View File
@@ -0,0 +1,31 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 50059,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "QI0122I1 Testnet",
"nativeCurrency": {
"name": "QI0122I1 Testnet Token",
"symbol": "MPX",
"decimals": 18
},
"networkId": 50059,
"redFlags": [],
"rpc": [
"https://qi0122i1-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://50059.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
],
"shortName": "QI0122I1 Testnet",
"slug": "qi0122i1-testnet",
"testnet": true
} as const satisfies Chain;
+31
View File
@@ -0,0 +1,31 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 53383,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "Jambon's Testnet",
"nativeCurrency": {
"name": "Jambon's Testnet Token",
"symbol": "GNF",
"decimals": 18
},
"networkId": 53383,
"redFlags": [],
"rpc": [
"https://jambon-s-testnet-jambon's testnet-53383.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://53383.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avacloud-dev.io/c37c3f83-6d95-4473-b5c7-626fad519f50"
],
"shortName": "Jambon's Testnet",
"slug": "jambon-s-testnet-jambon's testnet-53383",
"testnet": true
} as const satisfies Chain;
+4 -1
View File
@@ -16,6 +16,7 @@ export default {
}
],
"faucets": [],
"features": [],
"icon": {
"url": "ipfs://QmQB48m15TzhUFrmu56QCRQjkrkgUaKfgCmKE8o3RzmuPJ",
"width": 500,
@@ -30,10 +31,12 @@ export default {
"decimals": 18
},
"networkId": 53935,
"redFlags": [],
"rpc": [
"https://dfk-chain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://53935.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc",
"https://avax-pokt.nodies.app/ext/bc/q2aTwKuyzgs8pynF7UXBZCU7DejbZbZ6EUyHr3JQzYgwNPUPi/rpc"
],
"shortName": "DFK",
"slug": "dfk-chain",
+31
View File
@@ -0,0 +1,31 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 56400,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "Testnet Zeroone",
"nativeCurrency": {
"name": "Testnet Zeroone Token",
"symbol": "ZERO",
"decimals": 18
},
"networkId": 56400,
"redFlags": [],
"rpc": [
"https://testnet-zeroone.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://56400.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/testnetzer/testnet/rpc"
],
"shortName": "Testnet Zeroone",
"slug": "testnet-zeroone",
"testnet": true
} as const satisfies Chain;
+34
View File
@@ -0,0 +1,34 @@
import type { Chain } from "../src/types";
export default {
"chain": "EIOB",
"chainId": 612,
"explorers": [
{
"name": "EIOB Explorer",
"url": "https://explorer.eiob.xyz",
"standard": "none"
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmfJLG2mXgSqKx2V3A2jzTwt4vkozvQTTXkRy3os27wEVm",
"width": 48,
"height": 48,
"format": "png"
},
"name": "EIOB Mainnet",
"nativeCurrency": {
"name": "EIOB",
"symbol": "EIOB",
"decimals": 18
},
"networkId": 612,
"rpc": [
"https://eiob.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://612.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.eiob.xyz"
],
"shortName": "eiob",
"slug": "eiob",
"testnet": false
} as const satisfies Chain;
+35
View File
@@ -0,0 +1,35 @@
import type { Chain } from "../src/types";
export default {
"chain": "BSTC",
"chainId": 7007,
"explorers": [
{
"name": "blockscout",
"url": "https://bstscan.com",
"standard": "EIP3091"
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmPko9BJhR5FWTsThcwUFnnnjgLjrXVDm1n98dCuaQNW59",
"width": 506,
"height": 652,
"format": "png"
},
"infoURL": "https://bstchain.io",
"name": "BST Chain",
"nativeCurrency": {
"name": "BST Chain",
"symbol": "BSTC",
"decimals": 18
},
"networkId": 7007,
"rpc": [
"https://bst-chain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://7007.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.bstchain.io/"
],
"shortName": "BSTC",
"slug": "bst-chain",
"testnet": false
} as const satisfies Chain;
+31
View File
@@ -0,0 +1,31 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 7207,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "QI M 2401222",
"nativeCurrency": {
"name": "QI M 2401222 Token",
"symbol": "HZU",
"decimals": 18
},
"networkId": 7207,
"redFlags": [],
"rpc": [
"https://qi-m-2401222.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://7207.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avacloud-dev.io/f14d837e-de8f-446d-8222-0077f26e6694"
],
"shortName": "QI M 2401222",
"slug": "qi-m-2401222",
"testnet": true
} as const satisfies Chain;
+42
View File
@@ -0,0 +1,42 @@
import type { Chain } from "../src/types";
export default {
"chain": "Kinto Mainnet",
"chainId": 7887,
"explorers": [
{
"name": "Kinto Explorer",
"url": "https://explorer.kinto.xyz",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmZw4zfR4Q8MD6MZRwkQrMeiiiu77AJffHdCMdemt4R2VM",
"width": 400,
"height": 400,
"format": "jpg"
}
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmZw4zfR4Q8MD6MZRwkQrMeiiiu77AJffHdCMdemt4R2VM",
"width": 400,
"height": 400,
"format": "jpg"
},
"infoURL": "https://kinto.xyz",
"name": "Kinto Mainnet",
"nativeCurrency": {
"name": "Ethereum",
"symbol": "ETH",
"decimals": 18
},
"networkId": 7887,
"rpc": [
"https://kinto.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://7887.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.kinto.xyz/http",
"https://kinto-mainnet.calderachain.xyz/http"
],
"shortName": "kintoMainnet",
"slug": "kinto",
"testnet": false
} as const satisfies Chain;
+31
View File
@@ -0,0 +1,31 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 79338,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "QR0122I1 Testnet",
"nativeCurrency": {
"name": "QR0122I1 Testnet Token",
"symbol": "JVTX",
"decimals": 18
},
"networkId": 79338,
"redFlags": [],
"rpc": [
"https://qr0122i1-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://79338.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/qr0122i1te/testnet/rpc"
],
"shortName": "QR0122I1 Testnet",
"slug": "qr0122i1-testnet",
"testnet": true
} as const satisfies Chain;
+26 -3
View File
@@ -2,11 +2,29 @@ import type { Chain } from "../src/types";
export default {
"chain": "Berachain",
"chainId": 80085,
"explorers": [],
"explorers": [
{
"name": "Beratrail",
"url": "https://artio.beratrail.io",
"standard": "none",
"icon": {
"url": "ipfs://QmW2xrDkSqBB7qgftp5PUecEGg4zwUBJgSN45CaR7CKJMr",
"width": 256,
"height": 256,
"format": "png"
}
}
],
"faucets": [
"https://artio.faucet.berachain.com/"
"https://artio.faucet.berachain.com"
],
"features": [],
"icon": {
"url": "ipfs://QmW2xrDkSqBB7qgftp5PUecEGg4zwUBJgSN45CaR7CKJMr",
"width": 256,
"height": 256,
"format": "png"
},
"infoURL": "https://www.berachain.com/",
"name": "Berachain Artio",
"nativeCurrency": {
@@ -16,7 +34,12 @@ export default {
},
"networkId": 80085,
"redFlags": [],
"rpc": [],
"rpc": [
"https://berachain-artio.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://80085.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://artio.rpc.berachain.com",
"https://rpc.ankr.com/berachain_testnet"
],
"shortName": "bera-artio",
"slug": "berachain-artio",
"testnet": true
+31
View File
@@ -0,0 +1,31 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 83900,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "QI0122I1 Testnet",
"nativeCurrency": {
"name": "QI0122I1 Testnet Token",
"symbol": "XTT",
"decimals": 18
},
"networkId": 83900,
"redFlags": [],
"rpc": [
"https://qi0122i1-testnet-qi0122i1 testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://83900.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avacloud-test.io/a5f62fea-1375-4ddd-b88f-72b56b435259"
],
"shortName": "QI0122I1 Testnet",
"slug": "qi0122i1-testnet-qi0122i1 testnet",
"testnet": true
} as const satisfies Chain;
+31
View File
@@ -0,0 +1,31 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 84623,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "QI M 2401221",
"nativeCurrency": {
"name": "QI M 2401221 Token",
"symbol": "HZU",
"decimals": 18
},
"networkId": 84623,
"redFlags": [],
"rpc": [
"https://qi-m-2401221.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://84623.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avacloud-dev.io/f14d837e-de8f-446d-8222-0077f26e6694"
],
"shortName": "QI M 2401221",
"slug": "qi-m-2401221",
"testnet": true
} as const satisfies Chain;
+31
View File
@@ -0,0 +1,31 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 85023,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "NishiOgikubo Subnet",
"nativeCurrency": {
"name": "NishiOgikubo Subnet Token",
"symbol": "NOS",
"decimals": 18
},
"networkId": 85023,
"redFlags": [],
"rpc": [
"https://nishiogikubo-subnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://85023.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/nishiogiku/testnet/rpc"
],
"shortName": "NishiOgikubo Subnet",
"slug": "nishiogikubo-subnet",
"testnet": true
} as const satisfies Chain;
+31
View File
@@ -0,0 +1,31 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 85678,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "QI0122I1 Testnet",
"nativeCurrency": {
"name": "QI0122I1 Testnet Token",
"symbol": "KIP",
"decimals": 18
},
"networkId": 85678,
"redFlags": [],
"rpc": [
"https://qi0122i1-testnet-qi0122i1 testnet-85678.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://85678.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
],
"shortName": "QI0122I1 Testnet",
"slug": "qi0122i1-testnet-qi0122i1 testnet-85678",
"testnet": true
} as const satisfies Chain;
+36
View File
@@ -0,0 +1,36 @@
import type { Chain } from "../src/types";
export default {
"chain": "Hypr",
"chainId": 881,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "ipfs://bafybeie6wdqkhub4p346rixkvft3l2bxa3kzo4q6dh5c5vgq6oejwlhu4a/",
"width": 3600,
"height": 3600,
"format": "PNG"
},
"infoURL": "https://www.hypr.network",
"name": "Hypr Mainnet",
"nativeCurrency": {
"name": "Ether",
"symbol": "ETH",
"decimals": 18
},
"networkId": 881,
"parent": {
"type": "OP Stack",
"chain": "OP",
"bridges": []
},
"redFlags": [],
"rpc": [
"https://hypr.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://881.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.hypr.network"
],
"shortName": "ether",
"slug": "hypr",
"testnet": false
} as const satisfies Chain;
+35
View File
@@ -0,0 +1,35 @@
import type { Chain } from "../src/types";
export default {
"chain": "Ancient8",
"chainId": 888888888,
"explorers": [
{
"name": "Ancient8 Explorer",
"url": "https://scan.ancient8.gg",
"standard": "EIP3091"
}
],
"faucets": [],
"icon": {
"url": "ipfs://bafkreievnqg3xjokaty4kfbxxbrzm5v5y7exbaaia2txrh4sfgrqsalfym",
"width": 128,
"height": 128,
"format": "png"
},
"infoURL": "https://ancient8.gg/",
"name": "Ancient8",
"nativeCurrency": {
"name": "Ether",
"symbol": "ETH",
"decimals": 18
},
"networkId": 888888888,
"rpc": [
"https://ancient8.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://888888888.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.ancient8.gg"
],
"shortName": "ancient8",
"slug": "ancient8",
"testnet": false
} as const satisfies Chain;
+1 -1
View File
@@ -19,7 +19,7 @@ export default {
}
],
"icon": {
"url": "ipfs://QmfGHivFXtqs1CZvrBbLsRXAukWiLqgUF5erWaLNK55pDV",
"url": "ipfs://QmWvTUSCcQ17mDiKg3w1X5nW3q4wZGuVsZ9vwzJ8S9oCns",
"width": 200,
"height": 200,
"format": "png"
+43
View File
@@ -0,0 +1,43 @@
import type { Chain } from "../src/types";
export default {
"chain": "Nexa",
"chainId": 9024,
"explorers": [
{
"name": "Nexablock Explorer",
"url": "https://nexablockscan.io",
"standard": "none",
"icon": {
"url": "ipfs://bafkreib2t2lcaoh6iixrx4gjjvepws5tlsszfla5hb36b3mgyq7clve35y",
"width": 192,
"height": 192,
"format": "png"
}
}
],
"faucets": [
"https://nexablockscan.io/faucet"
],
"icon": {
"url": "ipfs://bafkreib2t2lcaoh6iixrx4gjjvepws5tlsszfla5hb36b3mgyq7clve35y",
"width": 192,
"height": 192,
"format": "png"
},
"infoURL": "https://www.nexablock.io/",
"name": "Nexa Block",
"nativeCurrency": {
"name": "Nexa Token",
"symbol": "NEXB",
"decimals": 18
},
"networkId": 9024,
"rpc": [
"https://nexa-block.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://9024.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc-testnet-nodes.nexablockscan.io"
],
"shortName": "Nexa",
"slug": "nexa-block",
"testnet": true
} as const satisfies Chain;
+3 -3
View File
@@ -5,12 +5,12 @@ export default {
"explorers": [
{
"name": "Astria EVM Dusknet Explorer",
"url": "https://explorer.evm.dusk-2.devnet.astria.org",
"url": "https://explorer.evm.dusk-3.devnet.astria.org",
"standard": "EIP3091"
}
],
"faucets": [
"https://faucet.evm.dusk-2.devnet.astria.org/"
"https://faucet.evm.dusk-3.devnet.astria.org/"
],
"icon": {
"url": "ipfs://QmVbzZYXdVFY3uFaWQd7iSRtdM2UKWohj9fVqqEwxcw2RV",
@@ -29,7 +29,7 @@ export default {
"rpc": [
"https://astria-evm-dusknet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://912559.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.evm.dusk-2.devnet.astria.org"
"https://rpc.evm.dusk-3.devnet.astria.org"
],
"shortName": "ria-dev",
"slug": "astria-evm-dusknet",
+37
View File
@@ -0,0 +1,37 @@
import type { Chain } from "../src/types";
export default {
"chain": "LILA",
"chainId": 93572,
"explorers": [
{
"name": "LiquidLayer Testnet Explorer",
"url": "https://testnet-scan.liquidlayer.network",
"standard": "EIP3091"
}
],
"faucets": [
"https://claim.liquidlayer.network"
],
"icon": {
"url": "ipfs://bafkreiayuuzfpcgwjll4us4hquvpqa5gwq3lbiedv4qftmlwcxhcyjzzpq",
"width": 500,
"height": 500,
"format": "png"
},
"infoURL": "https://testnet-scan.liquidlayer.network",
"name": "LiquidLayer Testnet",
"nativeCurrency": {
"name": "LiquidLayer Testnet",
"symbol": "LILA",
"decimals": 18
},
"networkId": 93572,
"rpc": [
"https://liquidlayer-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://93572.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://testnet.liquidlayer.network"
],
"shortName": "tLILA",
"slug": "liquidlayer-testnet",
"testnet": true
} as const satisfies Chain;
+31
View File
@@ -0,0 +1,31 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 94565,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "T 0117",
"nativeCurrency": {
"name": "T 0117 Token",
"symbol": "RUI",
"decimals": 18
},
"networkId": 94565,
"redFlags": [],
"rpc": [
"https://t-0117.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://94565.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
],
"shortName": "T 0117",
"slug": "t-0117",
"testnet": true
} as const satisfies Chain;
+39
View File
@@ -0,0 +1,39 @@
import type { Chain } from "../src/types";
export default {
"chain": "JONO12",
"chainId": 955081,
"explorers": [
{
"name": "JONO12 Explorer",
"url": "https://subnets-test.avax.network/jono12",
"standard": "EIP3091"
}
],
"faucets": [],
"features": [
{
"name": "EIP1559"
}
],
"icon": {
"url": "ipfs://bafkreievzx4ke62dtc77o47x7vs7nn67ghzrwku6h5dxo3hwcsqfeblke4",
"width": 612,
"height": 612,
"format": "png"
},
"name": "Jono12 Subnet",
"nativeCurrency": {
"name": "Jono12 Token",
"symbol": "JONO",
"decimals": 18
},
"networkId": 955081,
"rpc": [
"https://jono12-subnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://955081.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/jono12/testnet/rpc"
],
"shortName": "jono12",
"slug": "jono12-subnet",
"testnet": true
} as const satisfies Chain;
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/chains",
"version": "0.1.64",
"version": "0.1.66",
"main": "dist/thirdweb-dev-chains.cjs.js",
"module": "dist/thirdweb-dev-chains.esm.js",
"exports": {
File diff suppressed because one or more lines are too long
+20
View File
@@ -1,5 +1,25 @@
# thirdweb
## 0.13.34
### Patch Changes
- Updated dependencies [[`a5653f07`](https://github.com/thirdweb-dev/js/commit/a5653f07f82e3f94e193d2b90c9d0c163223583c), [`b34737d2`](https://github.com/thirdweb-dev/js/commit/b34737d27a71706cd1117485a6e522e50f5ae4d5), [`bf90fa50`](https://github.com/thirdweb-dev/js/commit/bf90fa5005358e040475627ae23a474f7b263803), [`1a5d41cc`](https://github.com/thirdweb-dev/js/commit/1a5d41cc8afeef5f9882753473aad3bc0c7757ac), [`627d2099`](https://github.com/thirdweb-dev/js/commit/627d20992770670ab0c954ceea0b8679ce4f3088), [`3d63a2cb`](https://github.com/thirdweb-dev/js/commit/3d63a2cb696310507798889e3e148339de4e3dfe), [`6fdade6c`](https://github.com/thirdweb-dev/js/commit/6fdade6c45f5d93fb3571d33720ab8103a7d002c), [`4d89dc1e`](https://github.com/thirdweb-dev/js/commit/4d89dc1efa2412b1e121cd14b1e2e72c667fceb0)]:
- @thirdweb-dev/wallets@2.4.4
- @thirdweb-dev/sdk@4.0.29
- @thirdweb-dev/auth@4.1.26
- @thirdweb-dev/chains@0.1.66
## 0.13.33
### Patch Changes
- Updated dependencies [[`3f2ee85a`](https://github.com/thirdweb-dev/js/commit/3f2ee85a1ab70e74aefe7f458379a2ccaf4058a9)]:
- @thirdweb-dev/chains@0.1.65
- @thirdweb-dev/sdk@4.0.28
- @thirdweb-dev/wallets@2.4.3
- @thirdweb-dev/auth@4.1.25
## 0.13.32
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "thirdweb",
"main": "dist/cli/index.js",
"version": "0.13.32",
"version": "0.13.34",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
+22
View File
@@ -1,5 +1,27 @@
# @thirdweb-dev/react-core
## 4.4.1
### Patch Changes
- Updated dependencies [[`a5653f07`](https://github.com/thirdweb-dev/js/commit/a5653f07f82e3f94e193d2b90c9d0c163223583c), [`b34737d2`](https://github.com/thirdweb-dev/js/commit/b34737d27a71706cd1117485a6e522e50f5ae4d5), [`bf90fa50`](https://github.com/thirdweb-dev/js/commit/bf90fa5005358e040475627ae23a474f7b263803), [`1a5d41cc`](https://github.com/thirdweb-dev/js/commit/1a5d41cc8afeef5f9882753473aad3bc0c7757ac), [`627d2099`](https://github.com/thirdweb-dev/js/commit/627d20992770670ab0c954ceea0b8679ce4f3088), [`3d63a2cb`](https://github.com/thirdweb-dev/js/commit/3d63a2cb696310507798889e3e148339de4e3dfe), [`6fdade6c`](https://github.com/thirdweb-dev/js/commit/6fdade6c45f5d93fb3571d33720ab8103a7d002c), [`4d89dc1e`](https://github.com/thirdweb-dev/js/commit/4d89dc1efa2412b1e121cd14b1e2e72c667fceb0)]:
- @thirdweb-dev/wallets@2.4.4
- @thirdweb-dev/sdk@4.0.29
- @thirdweb-dev/auth@4.1.26
- @thirdweb-dev/chains@0.1.66
## 4.4.0
### Patch Changes
- [#2202](https://github.com/thirdweb-dev/js/pull/2202) [`ba978f55`](https://github.com/thirdweb-dev/js/commit/ba978f55b0c6a7458801a7c02f28db3266718e14) Thanks [@kien-ngo](https://github.com/kien-ngo)! - Update code sample for useTokenSupply
- Updated dependencies [[`3f2ee85a`](https://github.com/thirdweb-dev/js/commit/3f2ee85a1ab70e74aefe7f458379a2ccaf4058a9)]:
- @thirdweb-dev/chains@0.1.65
- @thirdweb-dev/sdk@4.0.28
- @thirdweb-dev/wallets@2.4.3
- @thirdweb-dev/auth@4.1.25
## 4.3.2
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react-core",
"version": "4.3.2",
"version": "4.4.1",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-core",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
@@ -22,6 +22,7 @@ import type {
TokenBoundSmartWallet,
TrustWallet,
WalletConnect,
XDEFIWallet,
walletIds,
} from "@thirdweb-dev/wallets";
import { WalletInstance } from "../types/wallet";
@@ -54,6 +55,7 @@ export type WalletIdToWalletTypeMap = {
oneKey: OneKeyWallet;
cryptoDefiWallet: CryptoDefiWallet;
rabby: RabbyWallet;
xdefi: XDEFIWallet;
};
/**
@@ -40,7 +40,8 @@ import invariant from "tiny-invariant";
* import { useTokenSupply } from "@thirdweb-dev/react";
*
* function App() {
* const { data, isLoading, error } = useTokenSupply(contractAddress);
* const { contract } = useContract(contractAddress);
* const { data, isLoading, error } = useTokenSupply(contract);
* }
* ```
*
File diff suppressed because it is too large Load Diff
@@ -1,5 +1,9 @@
# @thirdweb-dev/react-native-compat
## 0.6.4
## 0.6.3
## 0.6.2
## 0.6.1
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@thirdweb-dev/react-native-compat",
"description": "Shims for Thirdweb in React Native Projects",
"version": "0.6.2",
"version": "0.6.4",
"author": "thirdweb eng <[email protected]>",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native-compat",
"license": "Apache-2.0",
+30
View File
@@ -1,5 +1,35 @@
# @thirdweb-dev/react-native
## 0.6.4
### Patch Changes
- [#2199](https://github.com/thirdweb-dev/js/pull/2199) [`57320957`](https://github.com/thirdweb-dev/js/commit/57320957aae56d063eca526a05df8bea8b38ba2a) Thanks [@iketw](https://github.com/iketw)! - Adds ability to delete the active ews account
- [#2217](https://github.com/thirdweb-dev/js/pull/2217) [`7f35caff`](https://github.com/thirdweb-dev/js/commit/7f35caff5d9d331e66125bab3797d7ca84f6cef1) Thanks [@MananTank](https://github.com/MananTank)! - Update defaultTokens used in ConnectWallet component's Send Funds screen
- Updated dependencies [[`a5653f07`](https://github.com/thirdweb-dev/js/commit/a5653f07f82e3f94e193d2b90c9d0c163223583c), [`b34737d2`](https://github.com/thirdweb-dev/js/commit/b34737d27a71706cd1117485a6e522e50f5ae4d5), [`bf90fa50`](https://github.com/thirdweb-dev/js/commit/bf90fa5005358e040475627ae23a474f7b263803), [`627d2099`](https://github.com/thirdweb-dev/js/commit/627d20992770670ab0c954ceea0b8679ce4f3088), [`3d63a2cb`](https://github.com/thirdweb-dev/js/commit/3d63a2cb696310507798889e3e148339de4e3dfe), [`6fdade6c`](https://github.com/thirdweb-dev/js/commit/6fdade6c45f5d93fb3571d33720ab8103a7d002c), [`4d89dc1e`](https://github.com/thirdweb-dev/js/commit/4d89dc1efa2412b1e121cd14b1e2e72c667fceb0)]:
- @thirdweb-dev/wallets@2.4.4
- @thirdweb-dev/sdk@4.0.29
- @thirdweb-dev/chains@0.1.66
- @thirdweb-dev/react-core@4.4.1
## 0.6.3
### Patch Changes
- [#2198](https://github.com/thirdweb-dev/js/pull/2198) [`94e4dc9a`](https://github.com/thirdweb-dev/js/commit/94e4dc9aab2b4fee0c444e10b2f860ed9f7c0fc9) Thanks [@iketw](https://github.com/iketw)! - UI improvements
- [#2197](https://github.com/thirdweb-dev/js/pull/2197) [`212b2e7b`](https://github.com/thirdweb-dev/js/commit/212b2e7bc28c8e88207a9935756f7e6133a5b7d3) Thanks [@MananTank](https://github.com/MananTank)! - - The "Request Testnet funds" button is now hidden by default in `ConnectWallet` Details Modal
- You can add it back by setting `hideTestnetFaucet` to `false` in the `ConnectWallet` component.
- Updated dependencies [[`3f2ee85a`](https://github.com/thirdweb-dev/js/commit/3f2ee85a1ab70e74aefe7f458379a2ccaf4058a9), [`ba978f55`](https://github.com/thirdweb-dev/js/commit/ba978f55b0c6a7458801a7c02f28db3266718e14)]:
- @thirdweb-dev/chains@0.1.65
- @thirdweb-dev/react-core@4.4.0
- @thirdweb-dev/sdk@4.0.28
- @thirdweb-dev/wallets@2.4.3
## 0.6.2
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react-native",
"version": "0.6.2",
"version": "0.6.4",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
@@ -50,7 +50,12 @@ export type ConnectWalletProps = {
/**
* Hide option to request testnet funds for testnets in dropdown
*
* The default is `false`
* By default it is `true`, If you want to show the "Request Testnet funds" link when user is connected to a testnet, set this prop to `false`
*
* @example
* ```tsx
* <ConnectWallet hideTestnetFaucet={false} />
* ```
*/
hideTestnetFaucet?: boolean;
@@ -220,6 +220,10 @@ export const ConnectWalletDetailsModal = ({
hideSwitchToPersonalWallet,
]);
// by default we hide faucet link
const showFaucet =
hideTestnetFaucet === undefined ? false : !hideTestnetFaucet;
return (
<ThemeProvider>
<TWModal isVisible={isVisible} onBackdropPress={onClosePress}>
@@ -288,7 +292,7 @@ export const ConnectWalletDetailsModal = ({
</Text>
</View>
<NetworkButton chain={chain} enableSwitchModal={true} />
{!hideTestnetFaucet && chain?.testnet && chain?.faucets?.length ? (
{showFaucet && chain?.testnet && chain?.faucets?.length ? (
<IconTextButton
mt="xs"
text={l.connect_wallet_details.request_testnet_funds}
@@ -6,7 +6,7 @@ import {
useConnect,
useWalletContext,
} from "@thirdweb-dev/react-core";
import { ReactNode, useMemo, useState } from "react";
import { ReactNode, useCallback, useMemo, useState } from "react";
import Box from "../../base/Box";
import Text from "../../base/Text";
import ThirdwebLogo from "../../../assets/thirdweb-logo";
@@ -112,6 +112,22 @@ export function ChooseWallet({
}
};
const getHeaderText = useCallback(() => {
if (typeof headerText === "string" && headerText.length === 0) {
return null;
}
if (!headerText || typeof headerText === "string") {
return (
<Text variant="headerBold" ml="xxs" fontSize={20} lineHeight={24}>
{headerText ? headerText : l.connect_wallet_details.connect}
</Text>
);
}
return headerText;
}, [headerText, l.connect_wallet_details.connect]);
const connect = useConnect();
const address = useAddress();
const {
@@ -150,9 +166,7 @@ export function ChooseWallet({
color={theme.colors.backgroundInverted}
/>
)}
<Text variant="headerBold" ml="xxs" fontSize={20} lineHeight={24}>
{headerText ? headerText : l.connect_wallet_details.connect}
</Text>
{getHeaderText()}
</Box>
}
subHeaderText={subHeaderText}
@@ -107,7 +107,16 @@ export type ConnectEmbedProps = {
};
export const ConnectEmbed = (props: ConnectEmbedProps) => {
return <ConnectEmbedUI {...props} isModal={false} />;
return (
<ConnectEmbedUI
container={{
borderRadius: "xxl",
paddingBottom: "lg",
}}
{...props}
isModal={false}
/>
);
};
export const ConnectEmbedUI = ({
@@ -27,11 +27,13 @@ export function ConnectingWallet({
const l = useLocale();
return (
<Box paddingHorizontal="xl">
<ConnectWalletHeader
onBackPress={onBackPress}
subHeaderText={subHeaderText}
onClose={onClose}
/>
<Box marginVertical="lg">
<ConnectWalletHeader
onBackPress={onBackPress}
subHeaderText={subHeaderText}
onClose={onClose}
/>
</Box>
<WalletLoadingThumbnail imageSize={85}>
<ImageSvgUri height={80} width={80} imageUrl={wallet.meta.iconURL} />
</WalletLoadingThumbnail>
@@ -21,7 +21,7 @@ const usdcIcon = `<svg data-name="86977684-12db-4850-8f30-233a7c267d11" viewBox=
const wrappedBtcIcon =
'<svg viewBox="0 0 109.26 109.26"><title>wrapped-bitcoin-wbtc</title><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><g id="Page-1"><g id="wbtc_colour" data-name="wbtc colour"><path id="Shape" fill="#5a5564" d="M89.09,22.93l-3,3a42.47,42.47,0,0,1,0,57.32l3,3a46.76,46.76,0,0,0,0-63.39Z"/><path id="Shape-2" data-name="Shape" fill="#5a5564" d="M26,23.19a42.47,42.47,0,0,1,57.32,0l3-3a46.76,46.76,0,0,0-63.39,0Z"/><path id="Shape-3" data-name="Shape" fill="#5a5564" d="M23.19,83.28a42.47,42.47,0,0,1,0-57.29l-3-3a46.76,46.76,0,0,0,0,63.39Z"/><path id="Shape-4" data-name="Shape" fill="#5a5564" d="M83.28,86.05a42.47,42.47,0,0,1-57.32,0l-3,3a46.76,46.76,0,0,0,63.39,0Z"/><path id="Shape-5" data-name="Shape" fill="#f09242" d="M73.57,44.62c-.6-6.26-6-8.36-12.83-9V27H55.46v8.46c-1.39,0-2.81,0-4.22,0V27H46v8.68H35.29v5.65s3.9-.07,3.84,0a2.73,2.73,0,0,1,3,2.32V67.41a1.85,1.85,0,0,1-.64,1.29,1.83,1.83,0,0,1-1.36.46c.07.06-3.84,0-3.84,0l-1,6.31H45.9v8.82h5.28V75.6H55.4v8.65h5.29V75.53c8.92-.54,15.14-2.74,15.92-11.09.63-6.72-2.53-9.72-7.58-10.93C72.1,52,74,49.2,73.57,44.62ZM66.17,63.4c0,6.56-11.24,5.81-14.82,5.81V57.57C54.93,57.58,66.17,56.55,66.17,63.4ZM63.72,47c0,6-9.38,5.27-12.36,5.27V41.69C54.34,41.69,63.72,40.75,63.72,47Z"/><path id="Shape-6" data-name="Shape" fill="#282138" d="M54.62,109.26a54.63,54.63,0,1,1,54.64-54.64A54.63,54.63,0,0,1,54.62,109.26Zm0-105A50.34,50.34,0,1,0,105,54.62,50.34,50.34,0,0,0,54.62,4.26Z"/></g></g></g></g></svg>';
const maticIcon = `<svg width="1024" height="1024" viewBox="0 0 1024 1024" fill="none" >
const maticIcon = `<svg width="1024" height="1024" viewBox="0 0 1024 1024" fill="none" >
<circle cx="512" cy="512" r="512" fill="#8247E5"/>
<path d="M681.469 402.456C669.189 395.312 653.224 395.312 639.716 402.456L543.928 457.228L478.842 492.949L383.055 547.721C370.774 554.865 354.81 554.865 341.301 547.721L265.162 504.856C252.882 497.712 244.286 484.614 244.286 470.325V385.786C244.286 371.498 251.654 358.4 265.162 351.256L340.073 309.581C352.353 302.437 368.318 302.437 381.827 309.581L456.737 351.256C469.018 358.4 477.614 371.498 477.614 385.786V440.558L542.7 403.646V348.874C542.7 334.586 535.332 321.488 521.824 314.344L383.055 235.758C370.774 228.614 354.81 228.614 341.301 235.758L200.076 314.344C186.567 321.488 179.199 334.586 179.199 348.874V507.237C179.199 521.525 186.567 534.623 200.076 541.767L341.301 620.353C353.582 627.498 369.546 627.498 383.055 620.353L478.842 566.772L543.928 529.86L639.716 476.279C651.996 469.135 667.961 469.135 681.469 476.279L756.38 517.953C768.66 525.098 777.257 538.195 777.257 552.484V637.023C777.257 651.312 769.888 664.409 756.38 671.553L681.469 714.419C669.189 721.563 653.224 721.563 639.716 714.419L564.805 672.744C552.525 665.6 543.928 652.502 543.928 638.214V583.442L478.842 620.353V675.125C478.842 689.414 486.21 702.512 499.719 709.656L640.944 788.242C653.224 795.386 669.189 795.386 682.697 788.242L823.922 709.656C836.203 702.512 844.799 689.414 844.799 675.125V516.763C844.799 502.474 837.431 489.377 823.922 482.232L681.469 402.456Z" fill="white"/>
</svg>
@@ -136,6 +136,12 @@ export const defaultTokens: SupportedTokens = {
},
{
address: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
name: "USD Coin (Bridged)",
symbol: "USDC.e",
icon: usdcIcon,
},
{
address: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
name: "USD Coin",
symbol: "USDC",
icon: usdcIcon,
@@ -245,7 +251,7 @@ export const defaultTokens: SupportedTokens = {
icon: wrappedEthIcon,
},
{
address: "0xc7198437980c041c805A1EDcbA50c1Ce5db95118",
address: "0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7",
name: "Tether USD",
symbol: "USDT",
icon: tetherUsdIcon,
@@ -57,13 +57,13 @@ export const ModalHeaderTextClose = ({
<View />
)}
</Box>
<Box flexDirection="row" justifyContent="space-between" mt="md">
{typeof subHeaderText === "string" ? (
{!subHeaderText ? null : typeof subHeaderText === "string" ? (
<Box mt="md">
<Text variant="subHeader">{subHeaderText}</Text>
) : (
subHeaderText
)}
</Box>
</Box>
) : (
<Box mt="md">{subHeaderText}</Box>
)}
</>
);
};
@@ -14,6 +14,7 @@ import { utils } from "ethers";
import {
authEndpoint,
customJwt,
deleteActiveAccount,
sendVerificationEmail,
socialLogin,
validateEmailOTP,
@@ -178,6 +179,10 @@ export class EmbeddedWalletConnector extends Connector<EmbeddedWalletConnectionA
});
}
async deleteActiveAccount() {
return deleteActiveAccount({ clientId: this.options.clientId });
}
private async socialLogin(oauthOption: OauthOption): Promise<AuthResult> {
try {
const { storedToken, email } = await socialLogin(
@@ -6,6 +6,7 @@ import {
SendEmailOtpReturnType,
} from "@thirdweb-dev/wallets";
import {
deleteAccount,
generateAuthTokenFromCognitoEmailOtp,
getEmbeddedWalletUserDetail,
sendUserManagedEmailOtp,
@@ -372,3 +373,20 @@ export async function authEndpoint(
);
}
}
export async function deleteActiveAccount(options: {
clientId: string;
}): Promise<boolean> {
await verifyClientId(options.clientId);
let result;
try {
result = await deleteAccount({
clientId: options.clientId,
});
} catch (e) {
throw new Error(createErrorMessage("Error deleting the active account", e));
}
return result;
}
@@ -1,6 +1,6 @@
import { CognitoUserSession } from "amazon-cognito-identity-js";
import {
ROUTE_GET_EMBEDDED_WALLET_DETAILS,
ROUTE_EMBEDDED_WALLET_DETAILS,
ROUTE_STORE_USER_SHARES,
ROUTE_VERIFY_THIRDWEB_CLIENT_ID,
ROUTE_VERIFY_COGNITO_OTP,
@@ -89,7 +89,7 @@ export async function getEmbeddedWalletUserDetail(args: {
email?: string;
clientId: string;
}) {
const url = new URL(ROUTE_GET_EMBEDDED_WALLET_DETAILS);
const url = new URL(ROUTE_EMBEDDED_WALLET_DETAILS);
if (args) {
if (args.email) {
url.searchParams.append("email", args.email);
@@ -296,3 +296,22 @@ export async function getUserShares(clientId: string, getShareUrl: URL) {
);
}
}
export async function deleteAccount(args: { clientId: string }) {
const url = new URL(ROUTE_EMBEDDED_WALLET_DETAILS);
const resp = await authFetchEmbeddedWalletUser(
{ clientId: args.clientId },
url.href,
{
method: "DELETE",
},
);
if (!resp.ok) {
const error = await resp.json();
throw new Error(
`Something went wrong deleting the active account: ${error.message}`,
);
}
return await resp.json();
}
@@ -26,7 +26,7 @@ export const DOMAIN_URL_2023 = "https://embedded-wallet.thirdweb.com";
const BASE_URL_2023 = `${DOMAIN_URL_2023}/`;
const ROUTE_2023_10_20_API_BASE_PATH = `${BASE_URL_2023}api/2023-10-20`;
export const ROUTE_GET_EMBEDDED_WALLET_DETAILS = `${ROUTE_2023_10_20_API_BASE_PATH}/embedded-wallet/embedded-wallet-user-details`;
export const ROUTE_EMBEDDED_WALLET_DETAILS = `${ROUTE_2023_10_20_API_BASE_PATH}/embedded-wallet/embedded-wallet-user-details`;
export const ROUTE_VERIFY_COGNITO_OTP = `${ROUTE_2023_10_20_API_BASE_PATH}/embedded-wallet/validate-cognito-email-otp`;
export const ROUTE_COGNITO_IDENTITY_POOL_URL = `cognito-idp.${AWS_REGION}.amazonaws.com/${COGNITO_USER_POOL_ID}`;
@@ -83,6 +83,10 @@ export class EmbeddedWallet extends AbstractClientWallet<
return connector.authenticate(params);
}
async deleteActiveAccount() {
return this.connector?.deleteActiveAccount();
}
getMeta(): WalletMeta {
const strategy = this.connector?.getConnectedAuthStrategy();
const meta = (this.constructor as typeof AbstractClientWallet).meta;
File diff suppressed because it is too large Load Diff
+35
View File
@@ -1,5 +1,40 @@
# @thirdweb-dev/react
## 4.4.1
### Patch Changes
- [#2219](https://github.com/thirdweb-dev/js/pull/2219) [`3dfc0039`](https://github.com/thirdweb-dev/js/commit/3dfc003902d9cc757b80937ac68032ff39a54b1c) Thanks [@MananTank](https://github.com/MananTank)! - Allow uppercase letters in email in embeddedWallet, magicLink, paperWallet in ConnectWallet UI
- [#2217](https://github.com/thirdweb-dev/js/pull/2217) [`7f35caff`](https://github.com/thirdweb-dev/js/commit/7f35caff5d9d331e66125bab3797d7ca84f6cef1) Thanks [@MananTank](https://github.com/MananTank)! - Update defaultTokens used in ConnectWallet component's Send Funds screen
- Updated dependencies [[`a5653f07`](https://github.com/thirdweb-dev/js/commit/a5653f07f82e3f94e193d2b90c9d0c163223583c), [`b34737d2`](https://github.com/thirdweb-dev/js/commit/b34737d27a71706cd1117485a6e522e50f5ae4d5), [`bf90fa50`](https://github.com/thirdweb-dev/js/commit/bf90fa5005358e040475627ae23a474f7b263803), [`627d2099`](https://github.com/thirdweb-dev/js/commit/627d20992770670ab0c954ceea0b8679ce4f3088), [`3d63a2cb`](https://github.com/thirdweb-dev/js/commit/3d63a2cb696310507798889e3e148339de4e3dfe), [`6fdade6c`](https://github.com/thirdweb-dev/js/commit/6fdade6c45f5d93fb3571d33720ab8103a7d002c), [`4d89dc1e`](https://github.com/thirdweb-dev/js/commit/4d89dc1efa2412b1e121cd14b1e2e72c667fceb0)]:
- @thirdweb-dev/wallets@2.4.4
- @thirdweb-dev/sdk@4.0.29
- @thirdweb-dev/chains@0.1.66
- @thirdweb-dev/react-core@4.4.1
## 4.4.0
### Minor Changes
- [#2197](https://github.com/thirdweb-dev/js/pull/2197) [`212b2e7b`](https://github.com/thirdweb-dev/js/commit/212b2e7bc28c8e88207a9935756f7e6133a5b7d3) Thanks [@MananTank](https://github.com/MananTank)! - - Change ConnectWallet Details dropdown to a Modal with a few UI improvements.
- Because of this the `dropdownPosition` prop has been removed from `ConnectWallet` component
- The "Request Testnet funds" button is now hidden by default in the new Modal UI.
- You can add it back by setting `hideTestnetFaucet` to `false` in the `ConnectWallet` component.
### Patch Changes
- [#2209](https://github.com/thirdweb-dev/js/pull/2209) [`f29f91d7`](https://github.com/thirdweb-dev/js/commit/f29f91d7e0837b2084d7257288e80ef2cbc70942) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Show specific error message for embedded wallet limits reached
- Updated dependencies [[`3f2ee85a`](https://github.com/thirdweb-dev/js/commit/3f2ee85a1ab70e74aefe7f458379a2ccaf4058a9), [`ba978f55`](https://github.com/thirdweb-dev/js/commit/ba978f55b0c6a7458801a7c02f28db3266718e14)]:
- @thirdweb-dev/chains@0.1.65
- @thirdweb-dev/react-core@4.4.0
- @thirdweb-dev/sdk@4.0.28
- @thirdweb-dev/wallets@2.4.3
## 4.3.2
### Patch Changes
+2 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react",
"version": "4.3.2",
"version": "4.4.1",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
@@ -114,12 +114,11 @@
"@headlessui/react": "1.7.6",
"@radix-ui/colors": "^0.1.9",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-dropdown-menu": "^2.0.5",
"@radix-ui/react-focus-scope": "^1.0.4",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-popover": "^1.0.6",
"@radix-ui/react-tabs": "^1.0.4",
"@radix-ui/react-tooltip": "^1.0.6",
"@radix-ui/react-tooltip": "^1.0.7",
"@tanstack/react-query": "^4.33.0",
"@thirdweb-dev/chains": "workspace:*",
"@thirdweb-dev/payments": "workspace:*",

Some files were not shown because too many files have changed in this diff Show More