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
136 changed files with 153567 additions and 144162 deletions
+9
View File
@@ -1,5 +1,14 @@
# @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
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/auth",
"version": "4.1.25",
"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;
};
+6
View File
@@ -1,5 +1,11 @@
# @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
+6
View File
@@ -10,6 +10,12 @@ export default {
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmUkFZC2ZmoYPTKf7AHdjwRPZoV2h1MCuHaGM4iu8SNFpi",
"width": 400,
"height": 400,
"format": "svg"
},
"infoURL": "https://shyft.network",
"name": "Shyft Testnet",
"nativeCurrency": {
+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;
+2 -2
View File
@@ -6,7 +6,7 @@ export default {
"faucets": [],
"features": [],
"icon": {
"url": "ipfs://QmUQWUvJxi5yNof638U42ihmUmfTzGiMaYgYatQqzvy3mr/rari.png",
"url": "ipfs://QmdAX6818vZ3bAsPRv1DZGrc7qc8XTrgCnRLWrMecixhXb/RARI%20Chain%20Logomark%20Color.png",
"width": 512,
"height": 512,
"format": "png"
@@ -32,7 +32,7 @@ export default {
"rpc": [
"https://rari.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://1380012617.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rari.calderachain.xyz/http"
"https://mainnet.rpc.rarichain.org/http"
],
"shortName": "rari",
"slug": "rari",
+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;
+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;
+13 -1
View File
@@ -6,12 +6,24 @@ export default {
{
"name": "Anytype Explorer",
"url": "https://explorer.anytype.io",
"standard": "EIP3091"
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmaARJiAQUn4Z6wG8GLEry3kTeBB3k6RfHzSZU9SPhBgcG",
"width": 200,
"height": 200,
"format": "png"
}
}
],
"faucets": [
"https://evm.anytype.io/faucet"
],
"icon": {
"url": "ipfs://QmaARJiAQUn4Z6wG8GLEry3kTeBB3k6RfHzSZU9SPhBgcG",
"width": 200,
"height": 200,
"format": "png"
},
"infoURL": "https://evm.anytype.io",
"name": "Anytype EVM Chain",
"nativeCurrency": {
+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;
+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;
+13 -1
View File
@@ -6,12 +6,24 @@ export default {
{
"name": "Kava Testnet Explorer",
"url": "http://testnet.kavascan.com",
"standard": "EIP3091"
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmdpRTk6oL1HRW9xC6cAc4Rnf9gs6zgdAcr4Z3HcLztusm",
"width": 1186,
"height": 360,
"format": "svg"
}
}
],
"faucets": [
"https://faucet.kava.io"
],
"icon": {
"url": "ipfs://QmdpRTk6oL1HRW9xC6cAc4Rnf9gs6zgdAcr4Z3HcLztusm",
"width": 1186,
"height": 360,
"format": "svg"
},
"infoURL": "https://www.kava.io",
"name": "Kava Testnet",
"nativeCurrency": {
+17 -2
View File
@@ -6,10 +6,22 @@ export default {
{
"name": "Kava EVM Explorer",
"url": "https://kavascan.com",
"standard": "EIP3091"
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmdpRTk6oL1HRW9xC6cAc4Rnf9gs6zgdAcr4Z3HcLztusm",
"width": 1186,
"height": 360,
"format": "svg"
}
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmdpRTk6oL1HRW9xC6cAc4Rnf9gs6zgdAcr4Z3HcLztusm",
"width": 1186,
"height": 360,
"format": "svg"
},
"infoURL": "https://www.kava.io",
"name": "Kava",
"nativeCurrency": {
@@ -25,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",
+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/",
+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;
+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;
+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;
+6
View File
@@ -10,6 +10,12 @@ export default {
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmUkFZC2ZmoYPTKf7AHdjwRPZoV2h1MCuHaGM4iu8SNFpi",
"width": 400,
"height": 400,
"format": "svg"
},
"infoURL": "https://shyft.network",
"name": "Shyft Mainnet",
"nativeCurrency": {
+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;
+24 -3
View File
@@ -2,9 +2,29 @@ import type { Chain } from "../src/types";
export default {
"chain": "Berachain",
"chainId": 80085,
"explorers": [],
"faucets": [],
"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"
],
"features": [],
"icon": {
"url": "ipfs://QmW2xrDkSqBB7qgftp5PUecEGg4zwUBJgSN45CaR7CKJMr",
"width": 256,
"height": 256,
"format": "png"
},
"infoURL": "https://www.berachain.com/",
"name": "Berachain Artio",
"nativeCurrency": {
@@ -17,7 +37,8 @@ export default {
"rpc": [
"https://berachain-artio.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://80085.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://artio.rpc.berachain.com/"
"https://artio.rpc.berachain.com",
"https://rpc.ankr.com/berachain_testnet"
],
"shortName": "bera-artio",
"slug": "berachain-artio",
+2 -2
View File
@@ -21,11 +21,11 @@ export default {
"networkId": 83900,
"redFlags": [],
"rpc": [
"https://qi0122i1-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"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",
"slug": "qi0122i1-testnet-qi0122i1 testnet",
"testnet": true
} as const satisfies Chain;
+2 -2
View File
@@ -21,11 +21,11 @@ export default {
"networkId": 85678,
"redFlags": [],
"rpc": [
"https://qi0122i1-testnet-qi0122i1 testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"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",
"slug": "qi0122i1-testnet-qi0122i1 testnet-85678",
"testnet": true
} 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;
+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.65",
"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
+10
View File
@@ -1,5 +1,15 @@
# 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
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "thirdweb",
"main": "dist/cli/index.js",
"version": "0.13.33",
"version": "0.13.34",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
+10
View File
@@ -1,5 +1,15 @@
# @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
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react-core",
"version": "4.4.0",
"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;
};
/**
File diff suppressed because it is too large Load Diff
@@ -1,5 +1,7 @@
# @thirdweb-dev/react-native-compat
## 0.6.4
## 0.6.3
## 0.6.2
+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.3",
"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",
+14
View File
@@ -1,5 +1,19 @@
# @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
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react-native",
"version": "0.6.3",
"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",
@@ -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,
@@ -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
+14
View File
@@ -1,5 +1,19 @@
# @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
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react",
"version": "4.4.0",
"version": "4.4.1",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
@@ -118,7 +118,7 @@
"@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:*",
@@ -204,6 +204,11 @@ import type { BytesLike } from "ethers";
* The entrypoint contract address. Uses v0.6 by default.
*
* Must be a `string`.
*
* #### deployOnSign
* Whether to deploy the smart wallet when the user signs a message. Defaults to true.
*
* Must be a `boolean`.
*
* @walletConnection
*/
+2 -1
View File
@@ -20,7 +20,7 @@ function extensionAndQRScanScreens(walletName: string) {
};
}
export function enDefault() {
export function enDefault(): ThirdwebLocale {
return {
connectWallet: {
signIn: "Sign in",
@@ -167,6 +167,7 @@ export function enDefault() {
metamaskWallet: extensionAndQRScanScreens("MetaMask"),
okxWallet: extensionAndQRScanScreens("OKX"),
phantomWallet: extensionAndQRScanScreens("Phantom"),
xdefiWallet: extensionAndQRScanScreens("XDEFI"),
rainbowWallet: extensionAndQRScanScreens("Rainbow"),
trustWallet: extensionAndQRScanScreens("Trust"),
zerionWallet: extensionAndQRScanScreens("Zerion"),
+1
View File
@@ -172,6 +172,7 @@ export function esDefault(): ThirdwebLocale {
coreWallet: extensionAndQRScanScreens("Core"),
coin98Wallet: extensionAndQRScanScreens("Coin98"),
phantomWallet: extensionAndQRScanScreens("Phantom"),
xdefiWallet: extensionAndQRScanScreens("XDEFI"),
rainbowWallet: extensionAndQRScanScreens("Rainbow"),
trustWallet: extensionAndQRScanScreens("Trust"),
zerionWallet: extensionAndQRScanScreens("Zerion"),
+1
View File
@@ -172,6 +172,7 @@ export function jaDefault(): ThirdwebLocale {
coreWallet: extensionAndQRScanScreens("Core"),
coin98Wallet: extensionAndQRScanScreens("Coin98"),
phantomWallet: extensionAndQRScanScreens("Phantom"),
xdefiWallet: extensionAndQRScanScreens("XDEFI"),
rainbowWallet: extensionAndQRScanScreens("Rainbow"),
trustWallet: extensionAndQRScanScreens("Trust"),
zerionWallet: extensionAndQRScanScreens("Zerion"),
+1
View File
@@ -172,6 +172,7 @@ export function tlDefault(): ThirdwebLocale {
metamaskWallet: extensionAndQRScanScreens("MetaMask"),
okxWallet: extensionAndQRScanScreens("OKX"),
phantomWallet: extensionAndQRScanScreens("Phantom"),
xdefiWallet: extensionAndQRScanScreens("XDEFI"),
rainbowWallet: extensionAndQRScanScreens("Rainbow"),
trustWallet: extensionAndQRScanScreens("Trust"),
zerionWallet: extensionAndQRScanScreens("Zerion"),
+1
View File
@@ -265,6 +265,7 @@ export type ThirdwebLocale = {
submitEmail: string;
};
phantomWallet: ExtensionAndQRScreensLocale;
xdefiWallet: ExtensionAndQRScreensLocale;
rabbyWallet: ExtensionAndQRScreensLocale;
rainbowWallet: ExtensionAndQRScreensLocale;
safeWallet: {
+6 -1
View File
@@ -43,6 +43,11 @@ export {
type PhantomWalletConfigOptions,
} from "./wallet/wallets/phantom/phantomWallet";
export {
xdefiWallet,
type XdefiWalletConfigOptions,
} from "./wallet/wallets/xdefi/xdefiWallet";
export {
rainbowWallet,
type RainbowWalletConfigOptions,
@@ -113,4 +118,4 @@ export type {
// at the moment we'll re-export everything from the evm package
export * from "./evm";
export * from "./payments";
export * from "./payments";
@@ -154,6 +154,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,
@@ -127,7 +127,7 @@ export const EmbeddedWalletFormUI = (props: {
name="email"
type="email"
errorMessage={(_input) => {
const input = _input.replace(/\+/g, "");
const input = _input.replace(/\+/g, "").toLowerCase();
const emailRegex =
/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,})$/g;
const isValidEmail = emailRegex.test(input);
@@ -395,7 +395,8 @@ const MagicUI: React.FC<{
name="magic-input"
type={type}
emptyErrorMessage={emptyErrorMessage}
errorMessage={(input) => {
errorMessage={(_input) => {
const input = _input.toLowerCase();
const isEmail = input.includes("@");
const isPhone = Number.isInteger(Number(input[input.length - 1]));
@@ -474,8 +475,8 @@ function useConnectMagic() {
data.type === "connect"
? {}
: isEmail
? { email: selectionData, chainId: activeChain.chainId }
: { phoneNumber: selectionData, chainId: activeChain.chainId },
? { email: selectionData, chainId: activeChain.chainId }
: { phoneNumber: selectionData, chainId: activeChain.chainId },
);
connected();
} catch (e) {
@@ -79,7 +79,7 @@ export const PaperFormUI = (props: {
name="email"
type="email"
errorMessage={(_input) => {
const input = _input.replace(/\+/g, "");
const input = _input.replace(/\+/g, "").toLowerCase();
const emailRegex = /^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,})$/g;
const isValidEmail = emailRegex.test(input);
if (!isValidEmail) {
@@ -0,0 +1,101 @@
import { ConnectUIProps } from "@thirdweb-dev/react-core";
import { ConnectingScreen } from "../../ConnectWallet/screens/ConnectingScreen";
import { useCallback, useEffect, useRef, useState } from "react";
import { GetStartedScreen } from "../../ConnectWallet/screens/GetStartedScreen";
import { XDEFIWallet } from "@thirdweb-dev/wallets";
import { wait } from "../../../utils/wait";
import { useTWLocale } from "../../../evm/providers/locale-provider";
export const XDefiConnectUI = (props: ConnectUIProps<XDEFIWallet>) => {
const [screen, setScreen] = useState<"connecting" | "get-started">(
"connecting",
);
const locale = useTWLocale().wallets.xdefiWallet;
const { walletConfig, connected } = props;
const [errorConnecting, setErrorConnecting] = useState(false);
const { connect } = props;
const hideBackButton = props.supportedWallets.length === 1;
const { goBack } = props;
const connectToExtension = useCallback(async () => {
try {
connectPrompted.current = true;
setScreen("connecting");
setErrorConnecting(false);
await wait(1000);
await connect();
connected();
} catch (e) {
setErrorConnecting(true);
console.error(e);
}
}, [connected, connect]);
const connectPrompted = useRef(false);
useEffect(() => {
if (connectPrompted.current) {
return;
}
const isInstalled = walletConfig.isInstalled
? walletConfig.isInstalled()
: false;
(async () => {
if (isInstalled) {
connectToExtension();
}
// if xdefi is not injected
else {
setScreen("get-started");
}
})();
}, [walletConfig, connected, connect, goBack, connectToExtension]);
if (screen === "connecting") {
return (
<ConnectingScreen
locale={{
getStartedLink: locale.getStartedLink,
instruction: locale.connectionScreen.instruction,
tryAgain: locale.connectionScreen.retry,
inProgress: locale.connectionScreen.inProgress,
failed: locale.connectionScreen.failed,
}}
hideBackButton={hideBackButton}
onBack={props.goBack}
walletName={walletConfig.meta.name}
walletIconURL={walletConfig.meta.iconURL}
onGetStarted={() => {
setScreen("get-started");
}}
onRetry={() => {
connectToExtension();
}}
errorConnecting={errorConnecting}
/>
);
}
if (screen === "get-started") {
return (
<GetStartedScreen
locale={{
scanToDownload: locale.getStartedScreen.instruction,
}}
walletIconURL={walletConfig.meta.iconURL}
walletName={walletConfig.meta.name}
chromeExtensionLink={walletConfig.meta.urls?.chrome}
googlePlayStoreLink={walletConfig.meta.urls?.android}
appleStoreLink={walletConfig.meta.urls?.ios}
onBack={() => {
props.goBack();
}}
/>
);
}
return null;
};
@@ -0,0 +1,57 @@
import type { WalletOptions, WalletConfig } from "@thirdweb-dev/react-core";
import { XDEFIWallet } from "@thirdweb-dev/wallets";
import { XDefiConnectUI } from "./XdefiConnectUI";
import { getInjectedXDEFIProvider } from "@thirdweb-dev/wallets";
/**
* @wallet
*/
export type XdefiWalletConfigOptions = {
/**
* If `true`, the wallet will be tagged as "recommended" in ConnectWallet Modal. Default is `false`
*/
recommended?: boolean;
};
/**
* A wallet configurator for [Phantom Wallet](https://phantom.app/) which allows integrating the wallet with React.
*
* It returns a [`WalletConfig`](https://portal.thirdweb.com/references/react/v4/WalletConfig) object which can be used to connect the wallet to via [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) component or [`useConnect`](https://portal.thirdweb.com/references/react/v4/useConnect) hook as mentioned in [Connecting Wallets](https://portal.thirdweb.com/react/v4/connecting-wallets) guide
*
* @example
* ```ts
* phantomWallet({
* recommended: true,
* })
* ```
*
* @param options -
* Optional configuration options for the wallet
*
* ### recommended (optional)
* If `true`, the wallet will be tagged as "recommended" in [`ConnectWallet`](https://portal.thirdweb.com/react/v4/components/ConnectWallet) Modal UI. Default is `false`
*
* @wallet
*/
export const xdefiWallet = (
options?: XdefiWalletConfigOptions,
): WalletConfig<XDEFIWallet> => {
return {
recommended: options?.recommended,
id: "XDEFI",
meta: {
name: "XDEFI Wallet",
urls: {
chrome:
"https://chromewebstore.google.com/detail/xdefi-wallet/hmeobnfnfcmdkdcmlblgagmfpfboieaf",
},
iconURL:
"data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='80' height='80' rx='12' fill='%23335DE5'/%3E%3Cpath d='M44.3735 42.8737C40.1971 45.4756 34.607 46.8157 28.9456 46.5293C24.1856 46.2952 20.2816 44.5779 17.9211 41.7548C15.8459 39.231 15.0418 35.9006 15.5865 32.0692C15.7711 30.7959 16.1495 29.5586 16.7084 28.4005L16.7862 28.2379C18.7456 24.4541 21.6534 21.2473 25.2235 18.933C28.7936 16.6188 32.9031 15.2768 37.1472 15.0392C41.3913 14.8017 45.624 15.6767 49.4287 17.5781C53.2333 19.4796 56.4788 22.3419 58.8457 25.8835C61.2128 29.4252 62.6196 33.5239 62.9277 37.7764C63.2359 42.029 62.4348 46.2887 60.6035 50.1363C58.772 53.9841 55.9733 57.2872 52.4827 59.7206C48.9923 62.154 44.9302 63.6337 40.6964 64.0144L40.9557 67C45.7093 66.5753 50.2705 64.9158 54.1899 62.1849C58.1096 59.4542 61.2523 55.7461 63.3084 51.4264C65.3647 47.1067 66.2635 42.3241 65.9163 37.5499C65.5691 32.7757 63.988 28.1746 61.3286 24.1998C58.6694 20.225 55.0235 17.0137 50.7504 14.8823C46.4772 12.7508 41.7242 11.7728 36.9596 12.0444C32.1951 12.3161 27.5832 13.8281 23.5784 16.4315C19.5736 19.0349 16.3141 22.64 14.1209 26.8914L14.0171 27.1061C13.3238 28.5432 12.8557 30.079 12.6293 31.6594C11.9808 36.3299 12.986 40.4864 15.6124 43.6869C18.4853 47.1864 23.161 49.268 28.7705 49.5411C35.5993 49.8859 42.389 48.019 47.2074 44.5844L44.3735 42.8737Z' fill='white'/%3E%3Cpath d='M50.0863 46.2693C47.3691 48.637 41.0527 52.9301 30.573 53.5155C18.8417 54.1661 13.952 50.3412 13.9066 50.3022L12.9598 51.4731L13.9131 50.3218L12 52.6244C12.2075 52.8 16.8962 56.5988 27.9077 56.5988C28.8091 56.5988 29.7559 56.5988 30.7416 56.5208C43.4069 55.8118 50.3652 50.2697 52.7906 47.9019L50.0863 46.2693Z' fill='white'/%3E%3Cpath d='M55.1712 49.366C53.5646 51.4845 51.5868 53.2919 49.3347 54.6999C41.397 59.8388 31.2999 60.5023 24.2313 60.1444L24.0822 63.1431C25.2689 63.2017 26.4103 63.2277 27.5192 63.2277C47.4541 63.2277 55.5085 54.1211 57.7588 50.8687L55.1647 49.34' fill='white'/%3E%3Cpath d='M54.4124 38.0117C55.7338 38.0117 56.805 36.9372 56.805 35.6117C56.805 34.2862 55.7338 33.2116 54.4124 33.2116C53.0908 33.2116 52.0195 34.2862 52.0195 35.6117C52.0195 36.9372 53.0908 38.0117 54.4124 38.0117Z' fill='white'/%3E%3C/svg%3E%0A",
},
create: (walletOptions: WalletOptions) => new XDEFIWallet(walletOptions),
connectUI: XDefiConnectUI,
isInstalled() {
return !!getInjectedXDEFIProvider();
},
};
};
File diff suppressed because it is too large Load Diff
+11
View File
@@ -1,5 +1,16 @@
# @thirdweb-dev/sdk
## 4.0.29
### Patch Changes
- [#2215](https://github.com/thirdweb-dev/js/pull/2215) [`b34737d2`](https://github.com/thirdweb-dev/js/commit/b34737d27a71706cd1117485a6e522e50f5ae4d5) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Switch to LRU caches for contract metadata
- [#2220](https://github.com/thirdweb-dev/js/pull/2220) [`3d63a2cb`](https://github.com/thirdweb-dev/js/commit/3d63a2cb696310507798889e3e148339de4e3dfe) Thanks [@0xFirekeeper](https://github.com/0xFirekeeper)! - [SDK] Add erc1155.transferBatch
- Updated dependencies [[`627d2099`](https://github.com/thirdweb-dev/js/commit/627d20992770670ab0c954ceea0b8679ce4f3088)]:
- @thirdweb-dev/chains@0.1.66
## 4.0.28
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/sdk",
"version": "4.0.28",
"version": "4.0.29",
"description": "The main thirdweb SDK.",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/sdk",
"license": "Apache-2.0",
@@ -2,8 +2,19 @@ import { ThirdwebStorage } from "@thirdweb-dev/storage";
import { fetchExtendedReleaseMetadata } from "../feature-detection/fetchExtendedReleaseMetadata";
import { fetchPreDeployMetadata } from "../feature-detection/fetchPreDeployMetadata";
import type { DeployMetadata } from "../../types/deploy/deploy-options";
import { createLruCache } from "../utils";
import {
FullPublishMetadata,
PreDeployMetadataFetched,
} from "../../schema/contracts/custom";
const deployMetadataCache: Record<string, any> = {};
type DeployAndPublishMetadata = {
compilerMetadata: PreDeployMetadataFetched;
extendedMetadata: FullPublishMetadata | undefined;
};
const deployMetadataCache =
/* @__PURE__ */ createLruCache<DeployAndPublishMetadata>(20);
/**
* @internal
@@ -12,8 +23,9 @@ export async function fetchAndCacheDeployMetadata(
publishMetadataUri: string,
storage: ThirdwebStorage,
): Promise<DeployMetadata> {
if (deployMetadataCache[publishMetadataUri]) {
return deployMetadataCache[publishMetadataUri];
const cached = deployMetadataCache.get(publishMetadataUri);
if (cached) {
return cached;
}
const compilerMetadata = await fetchPreDeployMetadata(
publishMetadataUri,
@@ -32,6 +44,6 @@ export async function fetchAndCacheDeployMetadata(
compilerMetadata,
extendedMetadata,
};
deployMetadataCache[publishMetadataUri] = data;
deployMetadataCache.put(publishMetadataUri, data);
return data;
}

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