Skip to content

Commit

Permalink
embed: update types (#822)
Browse files Browse the repository at this point in the history
types: sync
  • Loading branch information
mPaella authored Oct 21, 2024
1 parent a11b10d commit 49a2551
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 3 deletions.
54 changes: 54 additions & 0 deletions packages/client/base/src/types/CryptoCurrency.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Keep in sync with crossmint-main @crossmint/common-types/payments/currencies/CryptoCurrency.ts

import type { ObjectValues } from "@crossmint/common-sdk-base";

export const StableCoin = {
USDC: "usdc",
USDCE: "usdce",
BUSD: "busd",
} as const;
export type StableCoin = ObjectValues<typeof StableCoin>;

export const Erc20Currency = {
...StableCoin,
WETH: "weth",
DEGEN: "degen",
BRETT: "brett",
TOSHI: "toshi",
EURC: "eurc",
} as const;
export type Erc20Currency = ObjectValues<typeof Erc20Currency>;

export const SplTokenCurrency = {
USDC: "usdc",
BONK: "bonk",
WIF: "wif",
MOTHER: "mother",
EURC: "eurc",
} as const;
export type SplTokenCurrency = ObjectValues<typeof SplTokenCurrency>;

export const EvmNativeCurrency = {
ETH: "eth",
MATIC: "matic",
POL: "pol",
SEI: "sei",
CHZ: "chz",
AVAX: "avax",
XAI: "xai",
FUEL: "fuel",
} as const;
export type EvmNativeCurrency = ObjectValues<typeof EvmNativeCurrency>;

export const CryptoCurrency = {
...EvmNativeCurrency,
...Erc20Currency,
...SplTokenCurrency,
SOL: "sol",
ADA: "ada",
BNB: "bnb",
SUI: "sui",
APT: "apt",
SFUEL: "sfuel",
} as const;
export type CryptoCurrency = ObjectValues<typeof CryptoCurrency>;
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Currency as FiatCurrency, Locale } from "@/types";
import type { CryptoCurrency } from "@/types/CryptoCurrency";

import type { BlockchainIncludingTestnet } from "@crossmint/common-sdk-base";

Expand Down Expand Up @@ -35,6 +36,7 @@ export type EmbeddedCheckoutV3AppearanceVariables = {
textPrimary?: string;
textSecondary?: string;
danger?: string;
warning?: string;
accent?: string;
};
};
Expand Down Expand Up @@ -80,6 +82,60 @@ export type EmbeddedCheckoutV3AppearanceRules = {
};
};
};
Tab?: {
borderRadius?: string;
font?: {
family?: string;
size?: string;
weight?: string;
};
colors?: {
text?: string;
background?: string;
border?: string;
boxShadow?: string;
};
hover?: {
colors?: {
text?: string;
background?: string;
border?: string;
boxShadow?: string;
};
};
selected?: {
colors?: {
text?: string;
background?: string;
border?: string;
boxShadow?: string;
};
};
};
PrimaryButton?: {
borderRadius?: string;
font?: {
family?: string;
size?: string;
weight?: string;
};
colors?: {
text?: string;
background?: string;
};
hover?: {
colors?: {
text?: string;
background?: string;
};
};
disabled?: {
colors?: {
text?: string;
background?: string;
};
};
};
};

export type EmbeddedCheckoutV3Payment = {
Expand All @@ -101,7 +157,7 @@ export type EmbeddedCheckoutV3FiatPayment = {
export type EmbeddedCheckoutV3CryptoPayment = {
enabled: boolean;
defaultChain?: BlockchainIncludingTestnet;
defaultCurrency?: string; // TODO: Make CryptoCurrency type
allowedCurrencies?: Partial<Record<BlockchainIncludingTestnet, false | string[]>>; // TODO: Replace string[] with CryptoCurrency[]
payer?: any; // TODO: Ethers, Viem, Solana
defaultCurrency?: CryptoCurrency;
// allowedCurrencies?: Partial<Record<BlockchainIncludingTestnet, false | CryptoCurrency[]>>; // TODO: Add this back when supported on crossmint-main
// payer?: any; // TODO: Add this back when supported on crossmint-main
};
1 change: 1 addition & 0 deletions packages/client/base/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export * from "./events";
export * from "./hosted";
export * from "./embed";
export * from "./system";
export * from "./CryptoCurrency";

export enum clientNames {
reactUi = "client-sdk-react-ui",
Expand Down

0 comments on commit 49a2551

Please sign in to comment.