>
6 | ): string {
7 | switch (environment) {
8 | case "development":
9 | return customMap?.development || "http://localhost:3000";
10 | case "staging":
11 | return customMap?.staging || "https://staging.crossmint.com";
12 | case "production":
13 | return customMap?.production || "https://www.crossmint.com";
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/apps/wallets/quickstart-devkit/lib/utils.ts:
--------------------------------------------------------------------------------
1 | import { clsx, type ClassValue } from "clsx";
2 | import { twMerge } from "tailwind-merge";
3 |
4 | export function cn(...inputs: ClassValue[]) {
5 | return twMerge(clsx(inputs));
6 | }
7 |
8 | export function formatDate(timestamp: number) {
9 | const date = new Date(timestamp * 1000);
10 | return date.toLocaleDateString() + " " + date.toLocaleTimeString();
11 | }
12 |
13 | export function shortenAddress(addr: string) {
14 | return addr ? addr.slice(0, 6) + "..." + addr.slice(-4) : "";
15 | }
16 |
17 | export function shortenHash(hash: string) {
18 | return hash ? hash.slice(0, 8) + "..." + hash.slice(-6) : "";
19 | }
20 |
--------------------------------------------------------------------------------
/packages/client/ui/react-ui/src/icons/twitter.tsx:
--------------------------------------------------------------------------------
1 | export function TwitterIcon({ style }: { style?: React.CSSProperties }) {
2 | return (
3 |
9 | );
10 | }
11 |
--------------------------------------------------------------------------------
/packages/client/verifiable-credentials/typedoc.json:
--------------------------------------------------------------------------------
1 | {
2 | "entryPoints": ["src/index.ts"],
3 | "out": "docs",
4 | "plugin": ["typedoc-plugin-markdown", "typedoc-plugin-frontmatter", "./custom-plugin.mjs"],
5 | "tsconfig": "tsconfig.typedoc.json",
6 | "fileExtension": ".mdx",
7 | "skipErrorChecking": true,
8 | "excludeNotDocumented": false,
9 | "excludeInternal": true,
10 | "excludePrivate": true,
11 | "excludeProtected": true,
12 | "sanitizeComments": true,
13 | "hidePageHeader": true,
14 | "hideBreadcrumbs": true,
15 | "hidePageTitle": true,
16 | "parametersFormat": "table",
17 | "classPropertiesFormat": "table"
18 | }
19 |
--------------------------------------------------------------------------------
/apps/auth/remix-ssr/app/entry.client.tsx:
--------------------------------------------------------------------------------
1 | /**
2 | * By default, Remix will handle hydrating your app on the client for you.
3 | * You are free to delete this file if you'd like to, but if you ever want it revealed again, you can run `npx remix reveal` ✨
4 | * For more information, see https://remix.run/file-conventions/entry.client
5 | */
6 |
7 | import { RemixBrowser } from "@remix-run/react";
8 | import { startTransition, StrictMode } from "react";
9 | import { hydrateRoot } from "react-dom/client";
10 |
11 | startTransition(() => {
12 | hydrateRoot(
13 | document,
14 |
15 |
16 |
17 | );
18 | });
19 |
--------------------------------------------------------------------------------
/apps/wallets/smart-wallet/next/src/components/signin-auth-button.tsx:
--------------------------------------------------------------------------------
1 | "use client";
2 |
3 | import { useAuth } from "@crossmint/client-sdk-react-ui";
4 |
5 | import { Button } from "./button";
6 | import { Typography } from "./typography";
7 |
8 | export const SignInAuthButton = () => {
9 | const { login } = useAuth();
10 |
11 | return (
12 |
13 |
16 |
17 | );
18 | };
19 |
--------------------------------------------------------------------------------
/packages/client/rn-window/src/rn-webview/Child.ts:
--------------------------------------------------------------------------------
1 | import type { EventMap, EventEmitterWithHandshakeOptions } from "@crossmint/client-sdk-window";
2 | import { HandshakeChild } from "@crossmint/client-sdk-window";
3 | import { RNWebViewTransport } from "../transport/RNWebViewTransport";
4 |
5 | export class RNWebViewChild extends HandshakeChild<
6 | IncomingEvents,
7 | OutgoingEvents
8 | > {
9 | constructor(options?: EventEmitterWithHandshakeOptions) {
10 | const transport = new RNWebViewTransport();
11 | super(transport, options);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/tsconfig.base.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES6",
4 | "moduleResolution": "node",
5 | "strict": true,
6 | "experimentalDecorators": true,
7 | "esModuleInterop": true,
8 | "isolatedModules": true,
9 | "resolveJsonModule": true,
10 | "declaration": true,
11 | "declarationMap": true,
12 | "sourceMap": true,
13 | "outDir": "dist",
14 | "noEmitOnError": true,
15 | "forceConsistentCasingInFileNames": true,
16 | "lib": ["DOM", "ES6"],
17 | "noErrorTruncation": true
18 | },
19 | "exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.test.tsx"]
20 | }
21 |
--------------------------------------------------------------------------------
/packages/client/base/src/utils/tasks.ts:
--------------------------------------------------------------------------------
1 | export type CancellableTask = {
2 | cancel: () => void;
3 | };
4 |
5 | export function queueTask(callback: () => void, endTime: number): CancellableTask {
6 | let cancelled = false;
7 |
8 | function checkTime() {
9 | if (cancelled) {
10 | return;
11 | }
12 |
13 | const timeLeft = endTime - Date.now();
14 | if (timeLeft <= 0) {
15 | callback();
16 | } else {
17 | requestAnimationFrame(checkTime);
18 | }
19 | }
20 |
21 | checkTime();
22 |
23 | return {
24 | cancel: () => {
25 | cancelled = true;
26 | },
27 | };
28 | }
29 |
--------------------------------------------------------------------------------
/packages/client/ui/react-ui/src/icons/alert.tsx:
--------------------------------------------------------------------------------
1 | export function AlertIcon({ customColor = "#f44336" }: { customColor?: string }) {
2 | return (
3 |
18 | );
19 | }
20 |
--------------------------------------------------------------------------------
/packages/client/ui/react-ui/src/icons/phone.tsx:
--------------------------------------------------------------------------------
1 | import type { SVGProps } from "react";
2 |
3 | export function PhoneIcon(props: SVGProps) {
4 | return (
5 |
20 | );
21 | }
22 |
--------------------------------------------------------------------------------
/packages/client/ui/react-ui/src/utils/createCrossmintApiClient.ts:
--------------------------------------------------------------------------------
1 | import { LIB_VERSION } from "@/consts/version";
2 | import { type Crossmint, CrossmintApiClient, type CrossmintApiClientInternalConfig } from "@crossmint/common-sdk-base";
3 |
4 | export function createCrossmintApiClient(
5 | crossmint: Crossmint,
6 | apiKeyExpectations?: CrossmintApiClientInternalConfig["apiKeyExpectations"]
7 | ) {
8 | return new CrossmintApiClient(crossmint, {
9 | internalConfig: {
10 | sdkMetadata: {
11 | name: "@crossmint/client-sdk-react-ui",
12 | version: LIB_VERSION,
13 | },
14 | apiKeyExpectations,
15 | },
16 | });
17 | }
18 |
--------------------------------------------------------------------------------
/packages/common/base/src/blockchain/utils/evm/chainIdToBlockchain.ts:
--------------------------------------------------------------------------------
1 | import type { EVMBlockchainIncludingTestnet } from "../../types";
2 | import { BLOCKCHAIN_TO_CHAIN_ID } from "./blockchainToChainId";
3 |
4 | export const CHAIN_ID_TO_BLOCKCHAIN: Record = Object.entries(
5 | BLOCKCHAIN_TO_CHAIN_ID
6 | ).reduce(
7 | (acc, [key, value]) => {
8 | acc[value] = key as EVMBlockchainIncludingTestnet;
9 | return acc;
10 | },
11 | {} as Record
12 | );
13 |
14 | export function chainIdToBlockchain(chainId: number): EVMBlockchainIncludingTestnet | undefined {
15 | return CHAIN_ID_TO_BLOCKCHAIN[chainId];
16 | }
17 |
--------------------------------------------------------------------------------
/packages/client/wallets/smart-wallet/typedoc.json:
--------------------------------------------------------------------------------
1 | {
2 | "entryPoints": ["src/index.ts"],
3 | "out": "docs",
4 | "plugin": ["typedoc-plugin-markdown", "typedoc-plugin-frontmatter", "./custom-plugin.mjs"],
5 | "tsconfig": "tsconfig.typedoc.json",
6 | "fileExtension": ".mdx",
7 | "skipErrorChecking": true,
8 | "excludeNotDocumented": false,
9 | "excludeInternal": true,
10 | "excludePrivate": true,
11 | "excludeProtected": true,
12 | "sanitizeComments": true,
13 | "hidePageHeader": true,
14 | "hideBreadcrumbs": true,
15 | "hidePageTitle": true,
16 | "parametersFormat": "table",
17 | "classPropertiesFormat": "table"
18 | // "theme": "crossmintTheme"
19 | }
20 |
--------------------------------------------------------------------------------
/apps/auth/remix-ssr/tailwind.config.ts:
--------------------------------------------------------------------------------
1 | import type { Config } from "tailwindcss";
2 |
3 | export default {
4 | content: ["./app/**/{**,.client,.server}/**/*.{js,jsx,ts,tsx}"],
5 | theme: {
6 | extend: {
7 | fontFamily: {
8 | sans: [
9 | '"Inter"',
10 | "ui-sans-serif",
11 | "system-ui",
12 | "sans-serif",
13 | '"Apple Color Emoji"',
14 | '"Segoe UI Emoji"',
15 | '"Segoe UI Symbol"',
16 | '"Noto Color Emoji"',
17 | ],
18 | },
19 | },
20 | },
21 | plugins: [],
22 | } satisfies Config;
23 |
--------------------------------------------------------------------------------
/apps/wallets/quickstart-devkit/public/xlm.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/packages/client/auth/src/utils/cookies.ts:
--------------------------------------------------------------------------------
1 | export function getCookie(name: string): string | undefined {
2 | const crossmintRefreshToken = document.cookie.split("; ").find((row) => row.startsWith(name));
3 | return crossmintRefreshToken ? crossmintRefreshToken.split("=")[1] : undefined;
4 | }
5 |
6 | export function setCookie(name: string, value: string, expiresAt?: string) {
7 | const expiresInUtc = expiresAt ? new Date(expiresAt).toUTCString() : "";
8 | document.cookie = `${name}=${value}; ${expiresAt ? `expires=${expiresInUtc};` : ""} path=/; SameSite=Lax;`;
9 | }
10 |
11 | export function deleteCookie(name: string) {
12 | document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`;
13 | }
14 |
--------------------------------------------------------------------------------
/packages/client/react-base/src/providers/LoggerProvider.tsx:
--------------------------------------------------------------------------------
1 | import { type Context, createContext, useContext } from "react";
2 | import type { SdkLogger } from "@crossmint/common-sdk-base";
3 |
4 | type LoggerContext = Context;
5 |
6 | export const createLoggerContext = (): LoggerContext => createContext(null);
7 |
8 | /**
9 | * Hook to access the SDK logger instance
10 | * Must be used within LoggerProvider
11 | */
12 | export function useLogger(LoggerContext: LoggerContext): SdkLogger {
13 | const logger = useContext(LoggerContext);
14 | if (logger == null) {
15 | throw new Error("useLogger must be used within LoggerProvider");
16 | }
17 | return logger;
18 | }
19 |
--------------------------------------------------------------------------------
/packages/client/ui/react-native/src/utils/createCrossmintApiClient.ts:
--------------------------------------------------------------------------------
1 | import { type Crossmint, CrossmintApiClient, type CrossmintApiClientInternalConfig } from "@crossmint/common-sdk-base";
2 | import packageJson from "../../package.json";
3 |
4 | export function createCrossmintApiClient(
5 | crossmint: Crossmint,
6 | apiKeyExpectations?: CrossmintApiClientInternalConfig["apiKeyExpectations"]
7 | ) {
8 | return new CrossmintApiClient(crossmint, {
9 | internalConfig: {
10 | sdkMetadata: {
11 | name: "@crossmint/client-sdk-react-native-ui",
12 | version: packageJson.version,
13 | },
14 | apiKeyExpectations,
15 | },
16 | });
17 | }
18 |
--------------------------------------------------------------------------------
/packages/client/verifiable-credentials/src/verifiableCredentialsSDK/onchainServices/ABI/ERC7572.ts:
--------------------------------------------------------------------------------
1 | import { abi_ERC_721 } from "./ERC721";
2 |
3 | export const abi_ERC_7572 = [
4 | ...abi_ERC_721,
5 | // ERC-7572 additional functions
6 | {
7 | anonymous: false,
8 | inputs: [],
9 | name: "ContractURIUpdated",
10 | type: "event",
11 | },
12 | {
13 | inputs: [],
14 | name: "contractURI",
15 | outputs: [
16 | {
17 | internalType: "string",
18 | name: "",
19 | type: "string",
20 | },
21 | ],
22 | stateMutability: "view",
23 | type: "function",
24 | },
25 | ];
26 |
--------------------------------------------------------------------------------
/apps/wallets/smart-wallet/next/src/icons/logout.tsx:
--------------------------------------------------------------------------------
1 | export const LogoutIcon = ({ className }: { className?: string }) => (
2 |
18 | );
19 |
--------------------------------------------------------------------------------
/packages/client/signers/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@crossmint/client-signers",
3 | "version": "0.1.2",
4 | "repository": "https://github.com/Crossmint/crossmint-sdk",
5 | "license": "Apache-2.0",
6 | "author": "Paella Labs Inc",
7 | "sideEffects": false,
8 | "type": "module",
9 | "exports": {
10 | "import": "./dist/index.js",
11 | "require": "./dist/index.cjs"
12 | },
13 | "main": "./dist/index.cjs",
14 | "module": "./dist/index.js",
15 | "types": "./dist/index.d.ts",
16 | "files": ["dist", "LICENSE"],
17 | "scripts": {
18 | "build": "tsup",
19 | "dev": "tsup --watch"
20 | },
21 | "dependencies": {
22 | "zod": "3.22.4"
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/packages/client/wallets/walletconnect/src/types/wallet/index.ts:
--------------------------------------------------------------------------------
1 | import type {
2 | GetAddress,
3 | GetSupportedChains,
4 | SendEthersTransaction,
5 | SignMessage,
6 | SignSolanaTransaction,
7 | SignTypedData,
8 | } from "./features";
9 |
10 | export type CrossmintWalletConnectCommonWallet = SignMessage & GetSupportedChains & GetAddress;
11 | export type CrossmintWalletConnectEVMWallet = CrossmintWalletConnectCommonWallet &
12 | SendEthersTransaction &
13 | SignTypedData;
14 | export type CrossmintWalletConnectSolanaWallet = CrossmintWalletConnectCommonWallet & SignSolanaTransaction;
15 |
16 | export type CrossmintWalletConnectWallet = CrossmintWalletConnectEVMWallet | CrossmintWalletConnectSolanaWallet;
17 |
--------------------------------------------------------------------------------
/packages/wallets/typedoc.json:
--------------------------------------------------------------------------------
1 | {
2 | "entryPoints": ["src/index.ts"],
3 | "out": "docs",
4 | "plugin": ["typedoc-plugin-markdown", "typedoc-plugin-frontmatter", "./typedoc-custom-plugin.mjs"],
5 | "tsconfig": "tsconfig.typedoc.json",
6 | "fileExtension": ".mdx",
7 | "skipErrorChecking": true,
8 | "excludeNotDocumented": false,
9 | "excludeInternal": true,
10 | "excludePrivate": true,
11 | "excludeProtected": true,
12 | "sanitizeComments": true,
13 | "hidePageHeader": true,
14 | "hideBreadcrumbs": true,
15 | "hidePageTitle": true,
16 | "parametersFormat": "table",
17 | "classPropertiesFormat": "table",
18 | "gitRevision": "main"
19 | // "theme": "crossmintTheme"
20 | }
21 |
--------------------------------------------------------------------------------
/apps/payments/nextjs/app/payment-method-management/components/ClientProviders.tsx:
--------------------------------------------------------------------------------
1 | "use client";
2 |
3 | import { CrossmintAuthProvider } from "@crossmint/client-sdk-react-ui";
4 | import { CrossmintProvider } from "@crossmint/client-sdk-react-ui";
5 |
6 | export function ClientProviders({ children }: { children: React.ReactNode }) {
7 | return (
8 |
9 | {children}
10 |
11 | );
12 | }
13 |
--------------------------------------------------------------------------------
/packages/client/window/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@crossmint/client-sdk-window",
3 | "version": "1.0.7",
4 | "repository": "https://github.com/Crossmint/crossmint-sdk",
5 | "license": "Apache-2.0",
6 | "author": "Paella Labs Inc",
7 | "sideEffects": false,
8 | "type": "module",
9 | "exports": {
10 | "import": "./dist/index.js",
11 | "require": "./dist/index.cjs"
12 | },
13 | "main": "./dist/index.cjs",
14 | "module": "./dist/index.js",
15 | "types": "./dist/index.d.ts",
16 | "files": ["dist", "LICENSE"],
17 | "scripts": {
18 | "build": "tsup",
19 | "dev": "tsup --watch"
20 | },
21 | "dependencies": {
22 | "zod": "3.22.4"
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/packages/common/base/src/apiKey/utils/validateApiKeyAndGetCrossmintBaseUrl.ts:
--------------------------------------------------------------------------------
1 | import { CROSSMINT_DEV_URL, CROSSMINT_PROD_URL, CROSSMINT_STG_URL } from "../consts";
2 | import type { APIKeyEnvironmentPrefix } from "../types";
3 | import { validateAPIKey } from "../validateAPIKey";
4 |
5 | const urlMap: Record = {
6 | development: CROSSMINT_DEV_URL,
7 | staging: CROSSMINT_STG_URL,
8 | production: CROSSMINT_PROD_URL,
9 | };
10 |
11 | export function validateApiKeyAndGetCrossmintBaseUrl(apiKey: string) {
12 | const result = validateAPIKey(apiKey);
13 | if (!result.isValid) {
14 | throw new Error("Crossmint API key is invalid");
15 | }
16 | return urlMap[result.environment];
17 | }
18 |
--------------------------------------------------------------------------------
/apps/auth/nextjs-ssr/src/app/api/refresh/route.ts:
--------------------------------------------------------------------------------
1 | import { createCrossmint, CrossmintAuth } from "@crossmint/server-sdk";
2 | import type { NextRequest } from "next/server";
3 |
4 | export async function POST(request: NextRequest) {
5 | try {
6 | const crossmint = createCrossmint({
7 | apiKey: process.env.SERVER_CROSSMINT_API_KEY || "",
8 | });
9 | const crossmintAuth = CrossmintAuth.from(crossmint, {
10 | cookieOptions: {
11 | httpOnly: true,
12 | },
13 | });
14 | const response = await crossmintAuth.handleCustomRefresh(request);
15 |
16 | return response as Response;
17 | } catch (error) {
18 | console.error(error);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/packages/client/signers-cryptography/src/providers/key-providers/ecdh-provider.ts:
--------------------------------------------------------------------------------
1 | import { deriveSymmetricKey } from "../../primitives";
2 | import type { KeyPairProvider, PublicKeyProvider, SymmetricKeyProvider } from "./interfaces";
3 |
4 | export class ECDHKeyProvider implements SymmetricKeyProvider {
5 | constructor(
6 | private readonly keyPairProvider: KeyPairProvider,
7 | private readonly publicKeyProvider: PublicKeyProvider
8 | ) {}
9 |
10 | async getSymmetricKey(): Promise {
11 | const publicKey = await this.publicKeyProvider.getPublicKey();
12 | const keyPair = await this.keyPairProvider.getKeyPair();
13 |
14 | return deriveSymmetricKey(keyPair.privateKey, publicKey);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/packages/client/ui/react-ui/src/icons/passkey.tsx:
--------------------------------------------------------------------------------
1 | export default function PasskeyIcon() {
2 | return (
3 |
17 | );
18 | }
19 |
--------------------------------------------------------------------------------
/packages/client/base/src/types/events/internal/index.ts:
--------------------------------------------------------------------------------
1 | import type { IncomingInternalEvents, OutgoingInternalEvents } from "./events";
2 | import type { CrossmintInternalEventMap } from "./payloads";
3 |
4 | export * from "./events";
5 | export * from "./payloads";
6 |
7 | export type IncomingInternalEvent = {
8 | [K in IncomingInternalEvents]: {
9 | type: K;
10 | payload: CrossmintInternalEventMap[K];
11 | };
12 | }[IncomingInternalEvents];
13 |
14 | export type OutgoingInternalEvent = {
15 | [K in OutgoingInternalEvents]: {
16 | type: K;
17 | payload: CrossmintInternalEventMap[K];
18 | };
19 | }[OutgoingInternalEvents];
20 |
21 | export type CrossmintInternalEvent = IncomingInternalEvent | OutgoingInternalEvent;
22 |
--------------------------------------------------------------------------------
/apps/payments/nextjs/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "lib": ["dom", "dom.iterable", "esnext"],
4 | "allowJs": true,
5 | "skipLibCheck": true,
6 | "strict": true,
7 | "noEmit": true,
8 | "esModuleInterop": true,
9 | "module": "esnext",
10 | "moduleResolution": "bundler",
11 | "resolveJsonModule": true,
12 | "isolatedModules": true,
13 | "jsx": "preserve",
14 | "target": "ES2020",
15 | "incremental": true,
16 | "plugins": [
17 | {
18 | "name": "next"
19 | }
20 | ]
21 | },
22 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
23 | "exclude": ["node_modules"]
24 | }
25 |
--------------------------------------------------------------------------------
/packages/client/ui/react-native/src/utils/embed/userAgent.ts:
--------------------------------------------------------------------------------
1 | import { Platform } from "react-native";
2 | import * as Device from "expo-device";
3 |
4 | export const osVersion = Device.osVersion || "0";
5 | export const modelName = Device.modelName || "Unknown";
6 |
7 | export const userAgent =
8 | Platform.OS === "ios"
9 | ? `Mozilla/5.0 (iPhone; CPU iPhone OS ${osVersion
10 | .toString()
11 | .replace(/\./g, "_")} like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/${Math.floor(
12 | Number(osVersion) / 2
13 | )}.0 Mobile/15E148 Safari/604.1`
14 | : `Mozilla/5.0 (Linux; Android ${osVersion}; ${modelName}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.181 Mobile Safari/537.36`;
15 |
--------------------------------------------------------------------------------
/packages/common/base/src/blockchain/types/nft.ts:
--------------------------------------------------------------------------------
1 | import type { Blockchain } from ".";
2 | import type { EVMBlockchainIncludingTestnet } from "./evm";
3 |
4 | export interface EVMNFT {
5 | chain: EVMBlockchainIncludingTestnet;
6 | contractAddress: string;
7 | tokenId: string;
8 | }
9 |
10 | export interface SolanaNFT {
11 | mintHash: string;
12 | chain: "solana";
13 | }
14 |
15 | export type NFTLocator = `${T}:${string}${T extends EVMBlockchainIncludingTestnet
16 | ? `:${string}`
17 | : ""}`;
18 |
19 | export type NFT = SolanaNFT | EVMNFT;
20 |
21 | export type NFTOrNFTLocator =
22 | | NFT
23 | | NFTLocator<"solana">
24 | | NFTLocator<"ethereum">
25 | | NFTLocator<"polygon">
26 | | NFTLocator<"bsc">;
27 |
--------------------------------------------------------------------------------
/apps/auth/nextjs-ssr/src/providers/CrossmintProviders.tsx:
--------------------------------------------------------------------------------
1 | "use client";
2 |
3 | import type { ReactNode } from "react";
4 | import { CrossmintProvider, CrossmintAuthProvider } from "@crossmint/client-sdk-react-ui";
5 |
6 | export default function CrossmintProviders({ children }: { children: ReactNode }) {
7 | return (
8 |
9 |
14 | {children}
15 |
16 |
17 | );
18 | }
19 |
--------------------------------------------------------------------------------
/apps/wallets/smart-wallet/next/src/components/secured-by-crossmint.tsx:
--------------------------------------------------------------------------------
1 | import { CrossmintLeaf } from "@/icons/crossmint-leaf";
2 | import { cn } from "@/lib/utils";
3 |
4 | import { Typography } from "./typography";
5 |
6 | export const SecuredByCrossmint = ({ className }: { className?: string }) => {
7 | return (
8 |
15 |
16 |
17 |
18 | Secured by Crossmint
19 |
20 | );
21 | };
22 |
--------------------------------------------------------------------------------
/packages/client/ui/react-ui/src/hooks/useAuth.ts:
--------------------------------------------------------------------------------
1 | import { useContext } from "react";
2 | import type { CrossmintAuthBaseContextType } from "@crossmint/client-sdk-react-base";
3 | import type { OAuthProvider } from "@crossmint/common-sdk-auth";
4 | import { AuthContext } from "@/providers";
5 |
6 | export interface CrossmintAuthContext extends CrossmintAuthBaseContextType {
7 | experimental_loginWithOAuth: (provider: OAuthProvider) => Promise;
8 | }
9 |
10 | export function useCrossmintAuth(): CrossmintAuthContext {
11 | const context = useContext(AuthContext);
12 | if (context == null) {
13 | throw new Error("useCrossmintAuth must be used within a CrossmintAuthProvider");
14 | }
15 | return context;
16 | }
17 |
18 | export const useAuth = useCrossmintAuth;
19 |
--------------------------------------------------------------------------------
/apps/auth/nextjs-ssr/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@crossmint/auth-ssr-nextjs-demo",
3 | "version": "0.4.142",
4 | "private": true,
5 | "scripts": {
6 | "dev": "next dev",
7 | "build": "next build",
8 | "start": "next start",
9 | "lint": "next lint"
10 | },
11 | "dependencies": {
12 | "@crossmint/client-sdk-react-ui": "workspace:*",
13 | "@crossmint/server-sdk": "workspace:*",
14 | "react": "^18",
15 | "react-dom": "^18",
16 | "next": "14.2.26"
17 | },
18 | "devDependencies": {
19 | "typescript": "^5",
20 | "@types/node": "^20",
21 | "@types/react": "^18",
22 | "@types/react-dom": "^18",
23 | "postcss": "^8",
24 | "tailwindcss": "^3.4.1"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/packages/client/ui/react-ui/src/components/auth/methods/email/EmailAuthFlow.tsx:
--------------------------------------------------------------------------------
1 | import { useState } from "react";
2 | import { EmailOTPInput } from "./EmailOTPInput";
3 | import { EmailSignIn } from "./EmailSignIn";
4 | import { useAuthForm } from "@/providers/auth/AuthFormProvider";
5 | import type { OtpEmailPayload } from "@/types/auth";
6 |
7 | export function EmailAuthFlow() {
8 | const { step } = useAuthForm();
9 | const [otpEmailData, setOtpEmailData] = useState(null);
10 |
11 | if (step === "otp") {
12 | return ;
13 | }
14 | if (step === "initial") {
15 | return ;
16 | }
17 |
18 | return null;
19 | }
20 |
--------------------------------------------------------------------------------
/apps/auth/remix-ssr/app/routes/api.logout.tsx:
--------------------------------------------------------------------------------
1 | import { createCrossmint, CrossmintAuth } from "@crossmint/server-sdk";
2 | import type { ActionFunctionArgs } from "@remix-run/node";
3 |
4 | export async function action({ request }: ActionFunctionArgs) {
5 | if (request.method !== "POST") {
6 | return new Response(null, { status: 405 });
7 | }
8 |
9 | try {
10 | const crossmint = createCrossmint({
11 | apiKey: process.env.SERVER_CROSSMINT_API_KEY || "",
12 | });
13 | const crossmintAuth = CrossmintAuth.from(crossmint);
14 | const response = await crossmintAuth.logout(request);
15 |
16 | return response;
17 | } catch (error) {
18 | console.error(error);
19 | return new Response(null, { status: 500 });
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/apps/auth/nextjs-ssr/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "lib": ["dom", "dom.iterable", "esnext"],
4 | "allowJs": true,
5 | "skipLibCheck": true,
6 | "strict": true,
7 | "noEmit": true,
8 | "esModuleInterop": true,
9 | "module": "esnext",
10 | "moduleResolution": "bundler",
11 | "resolveJsonModule": true,
12 | "isolatedModules": true,
13 | "jsx": "preserve",
14 | "incremental": true,
15 | "plugins": [
16 | {
17 | "name": "next"
18 | }
19 | ],
20 | "paths": {
21 | "@/*": ["./src/*"]
22 | }
23 | },
24 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
25 | "exclude": ["node_modules"]
26 | }
27 |
--------------------------------------------------------------------------------
/apps/payments/nextjs/components/hosted-v3/HostedCheckoutV3ClientProviders.tsx:
--------------------------------------------------------------------------------
1 | import { CrossmintCheckoutProvider, CrossmintProvider } from "@crossmint/client-sdk-react-ui";
2 | import type { ReactNode } from "react";
3 |
4 | export function HostedCheckoutV3ClientProviders({ children }: { children: ReactNode }) {
5 | return (
6 |
10 | {children}
11 |
12 | );
13 | }
14 |
--------------------------------------------------------------------------------
/packages/client/ui/react-ui/src/components/common/CrossmintLogoV2/consts.ts:
--------------------------------------------------------------------------------
1 | export const CROSSMINT_LOGO_DEFAULT_COLORS = {
2 | light: {
3 | icon: {
4 | type: "gradient",
5 | from: "#5edd4d",
6 | to: "#05ce6c",
7 | },
8 | text: "#222",
9 | },
10 | dark: {
11 | icon: {
12 | type: "gradient",
13 | from: "#5edd4d",
14 | to: "#05ce6c",
15 | },
16 | text: "#fff",
17 | },
18 | } as const;
19 |
20 | export const CROSSMINT_LOGO_DEFAULTS = {
21 | colors: CROSSMINT_LOGO_DEFAULT_COLORS.light,
22 | displayType: "icon-and-text",
23 | } as const;
24 |
25 | export const CROSSMINT_LOGO_VIEWBOXES = {
26 | "icon-only": "0 0 86 86",
27 | "icon-and-text": "0 0 459.2 86",
28 | } as const;
29 |
--------------------------------------------------------------------------------
/apps/auth/remix-ssr/app/routes/api.refresh.tsx:
--------------------------------------------------------------------------------
1 | import { createCrossmint, CrossmintAuth } from "@crossmint/server-sdk";
2 | import type { ActionFunctionArgs } from "@remix-run/node";
3 |
4 | export async function action({ request }: ActionFunctionArgs) {
5 | if (request.method !== "POST") {
6 | return new Response(null, { status: 405 });
7 | }
8 |
9 | try {
10 | const crossmint = createCrossmint({
11 | apiKey: process.env.SERVER_CROSSMINT_API_KEY || "",
12 | });
13 | const crossmintAuth = CrossmintAuth.from(crossmint);
14 | const response = await crossmintAuth.handleCustomRefresh(request);
15 |
16 | return response;
17 | } catch (error) {
18 | console.error(error);
19 | return new Response(null, { status: 500 });
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/packages/common/auth/src/types/authmaterial.ts:
--------------------------------------------------------------------------------
1 | import type { SDKExternalUser } from "./user";
2 |
3 | export type AuthMaterialBasic = {
4 | jwt?: string;
5 | refreshToken: string;
6 | };
7 |
8 | export type AuthMaterial = {
9 | jwt: string;
10 | refreshToken: RefreshToken;
11 | };
12 |
13 | export type AuthMaterialWithUser = AuthMaterial & {
14 | user: SDKExternalUser;
15 | };
16 |
17 | export type AuthMaterialResponse = {
18 | jwt: string;
19 | refresh: RefreshToken;
20 | user: SDKExternalUser;
21 | };
22 |
23 | export type AuthSession = {
24 | jwt: string;
25 | refreshToken: RefreshToken;
26 | userId: string;
27 | };
28 |
29 | interface RefreshToken {
30 | secret: string;
31 | expiresAt: string;
32 | }
33 |
34 | export type OAuthProvider = "google" | "twitter";
35 |
--------------------------------------------------------------------------------
/apps/wallets/quickstart-devkit/.env.template:
--------------------------------------------------------------------------------
1 | # REMINDER: When setting up the Crossmint API key, update JWT authentication by adding your preferred auth provider under "3P Auth Providers"
2 | NEXT_PUBLIC_CROSSMINT_API_KEY=
3 | # Bring your own auth (BYOA) keys (Not needed when using Crossmint Auth)
4 | NEXT_PUBLIC_PRIVY_APP_ID=
5 | NEXT_PUBLIC_DYNAMIC_ENV_ID=
6 | # EVM
7 | NEXT_PUBLIC_EVM_CHAIN="optimism-sepolia"
8 | # FIREBASE (optional - only necessary when testing with firebase)
9 | NEXT_PUBLIC_FIREBASE_API_KEY=
10 | NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=
11 | NEXT_PUBLIC_FIREBASE_PROJECT_ID=
12 | NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=
13 | NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=
14 | NEXT_PUBLIC_FIREBASE_APP_ID=
15 | # Playwright E2E
16 | MAILOSAUR_API_KEY=
17 | MAILOSAUR_SERVER_ID=
18 | MAILOSAUR_PHONE_NUMBER=
19 | TESTS_CROSSMINT_API_KEY=
--------------------------------------------------------------------------------
/apps/wallets/quickstart-devkit/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.*
7 | .yarn/*
8 | !.yarn/patches
9 | !.yarn/plugins
10 | !.yarn/releases
11 | !.yarn/versions
12 |
13 | # testing
14 | /coverage
15 |
16 | # next.js
17 | /.next/
18 | /out/
19 |
20 | # production
21 | /build
22 |
23 | # misc
24 | .DS_Store
25 | *.pem
26 |
27 | # debug
28 | npm-debug.log*
29 | yarn-debug.log*
30 | yarn-error.log*
31 | .pnpm-debug.log*
32 |
33 | # env files (can opt-in for committing if needed)
34 | .env
35 |
36 | # vercel
37 | .vercel
38 |
39 | # typescript
40 | *.tsbuildinfo
41 | next-env.d.ts
42 |
43 | # Playwright
44 | node_modules/
45 | /test-results/
46 | /playwright-report/
47 | /blob-report/
48 | /playwright/.cache/
49 |
--------------------------------------------------------------------------------
/apps/payments/nextjs/app/payment-method-management/page.tsx:
--------------------------------------------------------------------------------
1 | "use client";
2 |
3 | import { AuthButton } from "../../components/common/AuthButton";
4 | import { ClientProviders } from "./components/ClientProviders";
5 | import { useCrossmintAuth, CrossmintPaymentMethodManagement } from "@crossmint/client-sdk-react-ui";
6 |
7 | export default function PaymentMethodManagementPage() {
8 | return (
9 |
10 |
11 |
12 |
13 | );
14 | }
15 |
16 | function PaymentMethodManagementWrapper() {
17 | const { jwt } = useCrossmintAuth();
18 |
19 | if (jwt == null) {
20 | return Please login to continue
;
21 | }
22 |
23 | return ;
24 | }
25 |
--------------------------------------------------------------------------------
/packages/client/ui/react-native/src/types/auth.ts:
--------------------------------------------------------------------------------
1 | import type { ReactNode } from "react";
2 | import type { CrossmintAuthBaseContextType, CrossmintAuthBaseProviderProps } from "@crossmint/client-sdk-react-base";
3 | import type { AuthMaterialWithUser, OAuthProvider, SDKExternalUser } from "@crossmint/common-sdk-auth";
4 |
5 | export interface RNAuthContext extends CrossmintAuthBaseContextType {
6 | user?: SDKExternalUser;
7 | loginWithOAuth: (provider: OAuthProvider) => Promise;
8 | createAuthSession: (urlOrOneTimeSecret: string) => Promise;
9 | }
10 |
11 | export interface RNCrossmintAuthProviderProps extends CrossmintAuthBaseProviderProps {
12 | prefetchOAuthUrls?: boolean;
13 | authModalTitle?: string;
14 | children: ReactNode;
15 | appSchema?: string | string[];
16 | }
17 |
--------------------------------------------------------------------------------
/packages/common/base/src/apiKey/types.ts:
--------------------------------------------------------------------------------
1 | export const APIKeyUsageOriginPrefix = {
2 | CLIENT: "ck",
3 | SERVER: "sk",
4 | } as const;
5 | export type APIKeyUsageOriginPrefix = (typeof APIKeyUsageOriginPrefix)[keyof typeof APIKeyUsageOriginPrefix];
6 |
7 | export const APIKeyEnvironmentPrefix = {
8 | DEVELOPMENT: "development",
9 | STAGING: "staging",
10 | PRODUCTION: "production",
11 | } as const;
12 | export type APIKeyEnvironmentPrefix = (typeof APIKeyEnvironmentPrefix)[keyof typeof APIKeyEnvironmentPrefix];
13 |
14 | export type APIKeyPrefix = `${APIKeyUsageOriginPrefix}_${APIKeyEnvironmentPrefix}`;
15 |
16 | export const APIKeyUsageOrigin = {
17 | CLIENT: "client",
18 | SERVER: "server",
19 | } as const;
20 | export type APIKeyUsageOrigin = (typeof APIKeyUsageOrigin)[keyof typeof APIKeyUsageOrigin];
21 |
--------------------------------------------------------------------------------
/packages/client/wallets/walletconnect/src/types/UIConfig.ts:
--------------------------------------------------------------------------------
1 | import type { CoreTypes } from "@walletconnect/types";
2 |
3 | export type CrossmintWalletConnectUIConfig = {
4 | colors?: CrossmintWalletConnectUIConfigColors;
5 | metadata: Omit & { icon: string };
6 | };
7 |
8 | export type CrossmintWalletConnectRequiredUIConfig = {
9 | colors: Required;
10 | metadata: CrossmintWalletConnectUIConfig["metadata"];
11 | };
12 |
13 | export type CrossmintWalletConnectUIConfigColors = {
14 | textPrimary?: string;
15 | textSecondary?: string;
16 | textLink?: string;
17 | textAccentButton?: string;
18 | accent?: string;
19 | background?: string;
20 | backgroundSecondary?: string;
21 | border?: string;
22 | danger?: string;
23 | };
24 |
--------------------------------------------------------------------------------
/packages/client/window/src/windows/Child.ts:
--------------------------------------------------------------------------------
1 | import type { EventMap } from "../EventEmitter";
2 | import type { EventEmitterWithHandshakeOptions } from "../handshake";
3 | import { HandshakeChild } from "../handshake/Child";
4 | import { WindowTransport } from "../transport/WindowTransport";
5 |
6 | export class ChildWindow extends HandshakeChild<
7 | IncomingEvents,
8 | OutgoingEvents
9 | > {
10 | constructor(
11 | parentWindow: Window,
12 | targetOrigin: string | string[],
13 | options?: Omit, "targetOrigin">
14 | ) {
15 | const transport = new WindowTransport(parentWindow, targetOrigin);
16 | super(transport, options);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/packages/common/base/src/logger/types.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Log level enum
3 | */
4 | export type LogLevel = "debug" | "info" | "warn" | "error";
5 |
6 | /**
7 | * Context object that can be attached to logs
8 | */
9 | export interface LogContext {
10 | [key: string]: unknown;
11 | }
12 |
13 | /**
14 | * Log entry structure
15 | */
16 | export interface LogEntry {
17 | level: LogLevel;
18 | message: string;
19 | context: LogContext;
20 | timestamp: number;
21 | }
22 |
23 | /**
24 | * Sink interface for log output destinations
25 | */
26 | export interface LogSink {
27 | /**
28 | * Unique identifier for the sink
29 | * Used to prevent duplicate sinks from being added
30 | */
31 | id: string;
32 | /**
33 | * Write a log entry to the sink
34 | */
35 | write(entry: LogEntry): void;
36 | }
37 |
--------------------------------------------------------------------------------
/packages/client/ui/react-ui/src/components/CrossmintNFTDetail.tsx:
--------------------------------------------------------------------------------
1 | import { assertValidValidateNFTDetailProps, getNFTDetailSrc } from "@crossmint/client-sdk-base";
2 | import type { NFTDetailProps } from "@crossmint/common-sdk-base";
3 |
4 | import { LIB_VERSION } from "../consts/version";
5 |
6 | export function CrossmintNFTDetail(props: NFTDetailProps) {
7 | assertValidValidateNFTDetailProps(props);
8 |
9 | const src = getNFTDetailSrc(props, LIB_VERSION);
10 |
11 | return (
12 |
24 | );
25 | }
26 |
--------------------------------------------------------------------------------
/packages/client/verifiable-credentials/src/verifiableCredentialsSDK/types/verifiableCredential.ts:
--------------------------------------------------------------------------------
1 | import type { Nft } from "./nft";
2 |
3 | export interface VerifiableCredential {
4 | id: string;
5 | credentialSubject: any;
6 | validUntil?: string;
7 | name?: string;
8 | description?: string;
9 | nft: Nft;
10 | issuer: { id: string };
11 | type: string[];
12 | validFrom: string;
13 | "@context": string[];
14 | proof?: { proofValue: string; [key: string]: any };
15 | }
16 |
17 | export interface EncryptedVerifiableCredential {
18 | id: string;
19 | payload: string;
20 | }
21 |
22 | /**
23 | * VerifiableCredentialType
24 | * A wrapper type for VerifiableCredential and EncryptedVerifiableCredential
25 | */
26 | export type VerifiableCredentialType = VerifiableCredential | EncryptedVerifiableCredential;
27 |
--------------------------------------------------------------------------------
/packages/common/auth/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@crossmint/common-sdk-auth",
3 | "version": "1.0.64",
4 | "repository": "https://github.com/Crossmint/crossmint-sdk",
5 | "license": "Apache-2.0",
6 | "author": "Paella Labs Inc",
7 | "sideEffects": false,
8 | "type": "module",
9 | "main": "./dist/index.cjs",
10 | "module": "./dist/index.js",
11 | "types": "./dist/index.d.ts",
12 | "exports": {
13 | "import": "./dist/index.js",
14 | "require": "./dist/index.cjs"
15 | },
16 | "files": ["dist", "LICENSE"],
17 | "scripts": {
18 | "build": "tsup",
19 | "dev": "tsup --watch",
20 | "test": "vitest run"
21 | },
22 | "dependencies": {
23 | "@crossmint/client-sdk-base": "workspace:*",
24 | "@crossmint/common-sdk-base": "workspace:*"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/apps/wallets/smart-wallet/next/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "lib": ["dom", "dom.iterable", "esnext"],
4 | "allowJs": true,
5 | "skipLibCheck": true,
6 | "strict": true,
7 | "noEmit": true,
8 | "esModuleInterop": true,
9 | "module": "esnext",
10 | "moduleResolution": "bundler",
11 | "resolveJsonModule": true,
12 | "isolatedModules": true,
13 | "jsx": "preserve",
14 | "target": "ES2020",
15 | "incremental": true,
16 | "plugins": [
17 | {
18 | "name": "next"
19 | }
20 | ],
21 | "paths": {
22 | "@/*": ["./src/*"]
23 | }
24 | },
25 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
26 | "exclude": ["node_modules"]
27 | }
28 |
--------------------------------------------------------------------------------
/apps/wallets/quickstart-devkit/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2017",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": true,
8 | "noEmit": true,
9 | "esModuleInterop": true,
10 | "module": "esnext",
11 | "moduleResolution": "bundler",
12 | "resolveJsonModule": true,
13 | "isolatedModules": true,
14 | "jsx": "preserve",
15 | "incremental": true,
16 | "plugins": [
17 | {
18 | "name": "next"
19 | }
20 | ],
21 | "paths": {
22 | "@/*": ["./*"]
23 | }
24 | },
25 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "next.config.mjs"],
26 | "exclude": ["node_modules"]
27 | }
28 |
--------------------------------------------------------------------------------
/packages/common/base/src/blockchain/utils/isValidAddress.ts:
--------------------------------------------------------------------------------
1 | // EVM address: 0x followed by 40 hex chars
2 | export function isValidEvmAddress(address: string): boolean {
3 | return /^0x[a-fA-F0-9]{40}$/.test(address);
4 | }
5 |
6 | // Solana address: base58, 32-44 chars, not starting with 0x
7 | export function isValidSolanaAddress(address: string): boolean {
8 | return /^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(address);
9 | }
10 |
11 | // Stellar address: starts with "G" followed by 56 alphanumeric characters
12 | export function isValidStellarAddress(address: string): boolean {
13 | return /^[G|C][A-Z0-9]{55}$/.test(address);
14 | }
15 |
16 | // General: valid if EVM, Solana or Stellar
17 | export function isValidAddress(address: string): boolean {
18 | return isValidEvmAddress(address) || isValidSolanaAddress(address) || isValidStellarAddress(address);
19 | }
20 |
--------------------------------------------------------------------------------
/packages/client/wallets/walletconnect/src/components/common/Loader.tsx:
--------------------------------------------------------------------------------
1 | import { useCrossmintWalletConnect } from "@/hooks/useCrossmintWalletConnect";
2 |
3 | interface Loader {
4 | size?: number;
5 | className?: string;
6 | color?: string;
7 | }
8 |
9 | export default function Loader({ color, size, className }: Loader) {
10 | const { uiConfig } = useCrossmintWalletConnect();
11 | return (
12 |
13 |
21 |
22 | );
23 | }
24 |
--------------------------------------------------------------------------------
/packages/server/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@crossmint/server-sdk",
3 | "version": "1.2.54",
4 | "repository": "https://github.com/Crossmint/crossmint-sdk",
5 | "license": "Apache-2.0",
6 | "author": "Paella Labs Inc",
7 | "sideEffects": false,
8 | "type": "module",
9 | "exports": {
10 | "import": "./dist/index.js",
11 | "require": "./dist/index.cjs"
12 | },
13 | "main": "./dist/index.cjs",
14 | "module": "./dist/index.js",
15 | "types": "./dist/index.d.ts",
16 | "files": ["dist", "LICENSE"],
17 | "scripts": {
18 | "build": "tsup",
19 | "dev": "tsup --watch",
20 | "test:vitest": "vitest run"
21 | },
22 | "dependencies": {
23 | "@crossmint/common-sdk-auth": "workspace:*",
24 | "@crossmint/common-sdk-base": "workspace:*",
25 | "jose": "5.9.6"
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/packages/client/base/src/types/payment-method-management/OrderIntents.ts:
--------------------------------------------------------------------------------
1 | import type { ObjectValues } from "@crossmint/common-sdk-base";
2 |
3 | export const OrderIntentPhase = {
4 | REQUIRES_PAYMENT: "requires-payment-method",
5 | REQUIRES_VERIFICATION: "requires-verification",
6 | ACTIVE: "active",
7 | EXPIRED: "expired",
8 | };
9 | export type OrderIntentPhase = ObjectValues;
10 | export interface OrderIntentBase {
11 | orderIntentId: string;
12 | phase: OrderIntentPhase;
13 | mandates: any[];
14 | }
15 |
16 | export interface OrderIntent extends OrderIntentBase {
17 | payment: {
18 | paymentMethodId: string;
19 | externalOrderIntentId: string;
20 | };
21 | }
22 |
23 | export interface VerificationConfig {
24 | btProjectId: string;
25 | btJwt: string;
26 | environment: "production" | "sandbox";
27 | }
28 |
--------------------------------------------------------------------------------
/packages/client/ui/react-ui/src/components/CrossmintNFTCollectionView.tsx:
--------------------------------------------------------------------------------
1 | import { assertValidNFTCollectionViewProps, getNFTCollectionViewSrc } from "@crossmint/client-sdk-base";
2 | import type { NFTCollectionViewProps } from "@crossmint/common-sdk-base";
3 |
4 | import { LIB_VERSION } from "../consts/version";
5 |
6 | export function CrossmintNFTCollectionView(props: NFTCollectionViewProps) {
7 | assertValidNFTCollectionViewProps(props);
8 |
9 | const src = getNFTCollectionViewSrc(props, LIB_VERSION);
10 |
11 | return (
12 |
24 | );
25 | }
26 |
--------------------------------------------------------------------------------
/packages/client/ui/react-ui/src/providers/CrossmintProvider.tsx:
--------------------------------------------------------------------------------
1 | import {
2 | CrossmintProvider as BaseCrossmintProvider,
3 | initReactLogger,
4 | createLoggerContext,
5 | } from "@crossmint/client-sdk-react-base";
6 | import type { CrossmintConfig } from "@crossmint/common-sdk-base";
7 | import packageJson from "../../package.json";
8 | import { useMemo, type ReactNode } from "react";
9 |
10 | export const LoggerContext = createLoggerContext();
11 |
12 | export function CrossmintProvider({ apiKey, ...props }: CrossmintConfig & { children: ReactNode }) {
13 | const logger = useMemo(() => {
14 | return initReactLogger(apiKey, packageJson.name, packageJson.version);
15 | }, [apiKey]);
16 | return (
17 |
18 |
19 |
20 | );
21 | }
22 |
--------------------------------------------------------------------------------
/packages/client/base/src/types/events/internal/payloads.ts:
--------------------------------------------------------------------------------
1 | import type { EmptyObject } from "@/types/system";
2 |
3 | import type { Blockchain } from "@crossmint/common-sdk-base";
4 |
5 | import { CrossmintInternalEvents } from "./events";
6 |
7 | interface IncomingInternalEventMap {
8 | [CrossmintInternalEvents.UI_HEIGHT_CHANGED]: { height: number };
9 | [CrossmintInternalEvents.CRYPTO_PAYMENT_INCOMING_TRANSACTION]: { serializedTransaction: string };
10 | [CrossmintInternalEvents.CRYPTO_CHAIN_SWITCH]: { chain: Blockchain };
11 | }
12 |
13 | interface OutgoingInternalEventMap {
14 | [CrossmintInternalEvents.PARAMS_UPDATE]: any;
15 | [CrossmintInternalEvents.CRYPTO_PAYMENT_USER_ACCEPTED]: { txId: string };
16 | [CrossmintInternalEvents.CRYPTO_PAYMENT_USER_REJECTED]: EmptyObject;
17 | }
18 |
19 | export type CrossmintInternalEventMap = IncomingInternalEventMap & OutgoingInternalEventMap;
20 |
--------------------------------------------------------------------------------
/packages/client/signers-cryptography/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@crossmint/client-signers-cryptography",
3 | "version": "0.0.4",
4 | "repository": "https://github.com/Crossmint/crossmint-sdk",
5 | "license": "Apache-2.0",
6 | "author": "Paella Labs Inc",
7 | "sideEffects": false,
8 | "type": "module",
9 | "exports": {
10 | "import": "./dist/index.js",
11 | "require": "./dist/index.cjs"
12 | },
13 | "main": "./dist/index.cjs",
14 | "module": "./dist/index.js",
15 | "types": "./dist/index.d.ts",
16 | "files": ["dist", "LICENSE"],
17 | "scripts": {
18 | "build": "tsup",
19 | "dev": "tsup --watch",
20 | "test:vitest": "vitest run"
21 | },
22 | "dependencies": {
23 | "@hpke/core": "^1.7.5",
24 | "@noble/ciphers": "^1.3.0",
25 | "zod": "3.22.4",
26 | "bs58": "^6.0.0"
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/packages/client/base/src/types/embed/v3/events/incoming.ts:
--------------------------------------------------------------------------------
1 | import { z } from "zod";
2 |
3 | export const embeddedCheckoutV3IncomingEvents = {
4 | "ui:height.changed": z.object({
5 | height: z.number(),
6 | }),
7 | "crypto:load": z.object({}),
8 | "crypto:connect-wallet.show": z.object({
9 | show: z.boolean(),
10 | }),
11 | "crypto:send-transaction": z.object({
12 | chain: z.string(),
13 | serializedTransaction: z.string(),
14 | }),
15 | "crypto:sign-message": z.object({
16 | message: z.string(),
17 | }),
18 | "order:updated": z.object({
19 | order: z.any().optional(),
20 | orderClientSecret: z.string().optional(),
21 | }),
22 | "order:creation-failed": z.object({
23 | errorMessage: z.string(),
24 | }),
25 | };
26 | export type EmbeddedCheckoutV3IncomingEventMap = typeof embeddedCheckoutV3IncomingEvents;
27 |
--------------------------------------------------------------------------------
/packages/client/base/src/utils/appendObjectToQueryParams.ts:
--------------------------------------------------------------------------------
1 | export function appendObjectToQueryParams>(queryParams: URLSearchParams, props: T): void {
2 | for (const [key, value] of Object.entries(props)) {
3 | if (!value || typeof value === "function") {
4 | continue;
5 | }
6 |
7 | if (typeof value === "object") {
8 | queryParams.append(
9 | key,
10 | JSON.stringify(value, (_, val) => (typeof val === "function" ? "function" : val))
11 | );
12 | } else if (typeof value === "string") {
13 | if (value === "undefined") {
14 | continue;
15 | }
16 | queryParams.append(key, value);
17 | } else if (["boolean", "number"].includes(typeof value)) {
18 | queryParams.append(key, value.toString());
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/packages/client/ui/react-native/src/hooks/useAuth.ts:
--------------------------------------------------------------------------------
1 | import { useContext } from "react";
2 | import type { CrossmintAuthBaseContextType } from "@crossmint/client-sdk-react-base";
3 | import type { AuthMaterialWithUser, OAuthProvider } from "@crossmint/common-sdk-auth";
4 | import { AuthContext } from "@/providers/CrossmintAuthProvider";
5 |
6 | interface RNCrossmintAuthContext extends CrossmintAuthBaseContextType {
7 | loginWithOAuth: (provider: OAuthProvider) => Promise;
8 | createAuthSession: (urlOrOneTimeSecret: string) => Promise;
9 | }
10 |
11 | export function useCrossmintAuth(): RNCrossmintAuthContext {
12 | const context = useContext(AuthContext);
13 | if (context == null) {
14 | throw new Error("useCrossmintAuth must be used within a CrossmintAuthProvider");
15 | }
16 | return context;
17 | }
18 |
19 | export const useAuth = useCrossmintAuth;
20 |
--------------------------------------------------------------------------------
/packages/client/wallets/walletconnect/src/wallets/WalletConnectEVMAAWallet.ts:
--------------------------------------------------------------------------------
1 | import type { CrossmintWalletConnectEVMWallet } from "@/types/wallet";
2 | import type { TransactionRequest } from "@ethersproject/abstract-provider";
3 |
4 | export class WalletConnectEVMAAWallet implements CrossmintWalletConnectEVMWallet {
5 | // TODO: Wallets team to ensure removing this class
6 | constructor(private aaWallet: any) {}
7 |
8 | getSupportedChains() {
9 | return [this.aaWallet.chain];
10 | }
11 |
12 | async getAddress() {
13 | return this.aaWallet.getAddress();
14 | }
15 |
16 | async signMessage(message: Uint8Array) {
17 | return this.aaWallet.signMessage(message);
18 | }
19 |
20 | async sendTransaction(transaction: TransactionRequest) {
21 | const response = await this.aaWallet.sendTransaction(transaction);
22 | return response;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/packages/wallets/src/signers/evm-api-key.ts:
--------------------------------------------------------------------------------
1 | import type { ApiKeyInternalSignerConfig, Signer } from "./types";
2 |
3 | export class EVMApiKeySigner implements Signer {
4 | type = "api-key" as const;
5 |
6 | constructor(private readonly config: ApiKeyInternalSignerConfig) {}
7 |
8 | locator() {
9 | return this.config.locator;
10 | }
11 |
12 | async signMessage() {
13 | return await Promise.reject(
14 | new Error(
15 | "API key signers do not support direct message signing - signatures are handled automatically by the backend"
16 | )
17 | );
18 | }
19 | async signTransaction() {
20 | return await Promise.reject(
21 | new Error(
22 | "API key signers do not support direct transaction signing - transaction are handled automatically by the backend"
23 | )
24 | );
25 | }
26 | }
27 |
--------------------------------------------------------------------------------