import {z} from 'zod' export type GetApiUnstableWalletsWalletLocatorTransfersArgs = {'X-API-KEY': string, walletLocator: string, cursor?: string | undefined, limit?: string | undefined, sort?: ('asc' | 'desc') | undefined, chain: 'arbitrum-sepolia' | 'arc-testnet' | 'avalanche-fuji' | 'curtis' | 'base-goerli' | 'base-sepolia' | 'bsc-testnet' | 'chiliz-spicy-testnet' | 'coti-testnet' | 'ethereum-goerli' | 'ethereum-sepolia' | 'hedera-testnet' | 'hypersonic-testnet' | 'lightlink-pegasus' | 'mantle-sepolia' | 'optimism-goerli' | 'optimism-sepolia' | 'polygon-amoy' | 'polygon-mumbai' | 'crossmint-private-testnet-ethereum' | 'crossmint-private-testnet-polygon' | 'rari-testnet' | 'scroll-sepolia' | 'sei-atlantic-2-testnet' | 'shape-sepolia' | 'skale-nebula-testnet' | 'soneium-minato-testnet' | 'space-testnet' | 'story-testnet' | 'verify-testnet' | 'viction-testnet' | 'xai-sepolia-testnet' | 'zkatana' | 'zkyoto' | 'zora-goerli' | 'zora-sepolia' | 'mode-sepolia' | 'u2u-nebulas' | 'zenchain-testnet' | 'abstract-testnet' | 'world-chain-sepolia' | 'plume-testnet' | 'flow-testnet' | 'tempo-testnet' | 'robinhood-chain-testnet' | 'ethereum' | 'polygon' | 'bsc' | 'optimism' | 'arbitrum' | 'base' | 'zora' | 'arbitrumnova' | 'astar-zkevm' | 'apechain' | 'hedera' | 'coti' | 'lightlink' | 'mantle' | 'skale-nebula' | 'sei-pacific-1' | 'chiliz' | 'avalanche' | 'xai' | 'shape' | 'rari' | 'scroll' | 'viction' | 'mode' | 'space' | 'soneium' | 'story' | 'u2u-solaris' | 'abstract' | 'world-chain' | 'plume' | 'flow' | 'tempo' | 'robinhood-chain' | 'solana' | 'stellar', tokens: string, status: 'successful' | 'failed', fromDate?: string | undefined, toDate?: string | undefined}; export type GetApiUnstableWalletsWalletLocatorTransfersOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; export const walletsActivityResponseUnstableDTO = z.object({nextCursor: z.string().optional(), previousCursor: z.string().optional(), data: z.array(z.union([z.object({sender: z.object({address: z.string(), chain: z.enum(["solana", "sui", "aptos", "xion", "stellar", "arbitrum-sepolia", "arc-testnet", "avalanche-fuji", "curtis", "base-goerli", "base-sepolia", "bsc-testnet", "chiliz-spicy-testnet", "coti-testnet", "ethereum-goerli", "ethereum-sepolia", "hedera-testnet", "hypersonic-testnet", "lightlink-pegasus", "mantle-sepolia", "optimism-goerli", "optimism-sepolia", "polygon-amoy", "polygon-mumbai", "crossmint-private-testnet-ethereum", "crossmint-private-testnet-polygon", "rari-testnet", "scroll-sepolia", "sei-atlantic-2-testnet", "shape-sepolia", "skale-nebula-testnet", "soneium-minato-testnet", "space-testnet", "story-testnet", "verify-testnet", "viction-testnet", "xai-sepolia-testnet", "zkatana", "zkyoto", "zora-goerli", "zora-sepolia", "mode-sepolia", "u2u-nebulas", "zenchain-testnet", "abstract-testnet", "world-chain-sepolia", "plume-testnet", "flow-testnet", "tempo-testnet", "robinhood-chain-testnet", "ethereum", "polygon", "bsc", "optimism", "arbitrum", "base", "zora", "arbitrumnova", "astar-zkevm", "apechain", "hedera", "coti", "lightlink", "mantle", "skale-nebula", "sei-pacific-1", "chiliz", "avalanche", "xai", "shape", "rari", "scroll", "viction", "mode", "space", "soneium", "story", "u2u-solaris", "abstract", "world-chain", "plume", "flow", "tempo", "robinhood-chain"]).optional(), locator: z.string(), owner: z.string().optional()}), recipient: z.object({address: z.string(), chain: z.enum(["solana", "sui", "aptos", "xion", "stellar", "arbitrum-sepolia", "arc-testnet", "avalanche-fuji", "curtis", "base-goerli", "base-sepolia", "bsc-testnet", "chiliz-spicy-testnet", "coti-testnet", "ethereum-goerli", "ethereum-sepolia", "hedera-testnet", "hypersonic-testnet", "lightlink-pegasus", "mantle-sepolia", "optimism-goerli", "optimism-sepolia", "polygon-amoy", "polygon-mumbai", "crossmint-private-testnet-ethereum", "crossmint-private-testnet-polygon", "rari-testnet", "scroll-sepolia", "sei-atlantic-2-testnet", "shape-sepolia", "skale-nebula-testnet", "soneium-minato-testnet", "space-testnet", "story-testnet", "verify-testnet", "viction-testnet", "xai-sepolia-testnet", "zkatana", "zkyoto", "zora-goerli", "zora-sepolia", "mode-sepolia", "u2u-nebulas", "zenchain-testnet", "abstract-testnet", "world-chain-sepolia", "plume-testnet", "flow-testnet", "tempo-testnet", "robinhood-chain-testnet", "ethereum", "polygon", "bsc", "optimism", "arbitrum", "base", "zora", "arbitrumnova", "astar-zkevm", "apechain", "hedera", "coti", "lightlink", "mantle", "skale-nebula", "sei-pacific-1", "chiliz", "avalanche", "xai", "shape", "rari", "scroll", "viction", "mode", "space", "soneium", "story", "u2u-solaris", "abstract", "world-chain", "plume", "flow", "tempo", "robinhood-chain"]).optional(), locator: z.string(), owner: z.string().optional()}), token: z.union([z.object({locator: z.string(), amount: z.string(), rawAmount: z.string(), contractAddress: z.string().optional(), symbol: z.string().optional(), decimals: z.number(), type: z.literal("fungible"), chain: z.enum(["arbitrum-sepolia", "arc-testnet", "avalanche-fuji", "curtis", "base-goerli", "base-sepolia", "bsc-testnet", "chiliz-spicy-testnet", "coti-testnet", "ethereum-goerli", "ethereum-sepolia", "hedera-testnet", "hypersonic-testnet", "lightlink-pegasus", "mantle-sepolia", "optimism-goerli", "optimism-sepolia", "polygon-amoy", "polygon-mumbai", "crossmint-private-testnet-ethereum", "crossmint-private-testnet-polygon", "rari-testnet", "scroll-sepolia", "sei-atlantic-2-testnet", "shape-sepolia", "skale-nebula-testnet", "soneium-minato-testnet", "space-testnet", "story-testnet", "verify-testnet", "viction-testnet", "xai-sepolia-testnet", "zkatana", "zkyoto", "zora-goerli", "zora-sepolia", "mode-sepolia", "u2u-nebulas", "zenchain-testnet", "abstract-testnet", "world-chain-sepolia", "plume-testnet", "flow-testnet", "tempo-testnet", "robinhood-chain-testnet", "ethereum", "polygon", "bsc", "optimism", "arbitrum", "base", "zora", "arbitrumnova", "astar-zkevm", "apechain", "hedera", "coti", "lightlink", "mantle", "skale-nebula", "sei-pacific-1", "chiliz", "avalanche", "xai", "shape", "rari", "scroll", "viction", "mode", "space", "soneium", "story", "u2u-solaris", "abstract", "world-chain", "plume", "flow", "tempo", "robinhood-chain"])}), z.object({locator: z.string(), amount: z.string(), rawAmount: z.string(), mintHash: z.string().optional(), symbol: z.string().optional(), decimals: z.number(), type: z.literal("fungible"), chain: z.literal("solana")}), z.object({locator: z.string(), amount: z.string(), rawAmount: z.string(), contractId: z.string().optional(), symbol: z.string().optional(), decimals: z.number(), type: z.literal("fungible"), chain: z.literal("stellar")})]), status: z.enum(["succeeded", "failed"]), transferId: z.string().optional(), completedAt: z.string(), onChain: z.object({txId: z.string(), explorerLink: z.string()}), type: z.literal("wallets.transfer.in")}), z.object({sender: z.object({address: z.string(), chain: z.enum(["solana", "sui", "aptos", "xion", "stellar", "arbitrum-sepolia", "arc-testnet", "avalanche-fuji", "curtis", "base-goerli", "base-sepolia", "bsc-testnet", "chiliz-spicy-testnet", "coti-testnet", "ethereum-goerli", "ethereum-sepolia", "hedera-testnet", "hypersonic-testnet", "lightlink-pegasus", "mantle-sepolia", "optimism-goerli", "optimism-sepolia", "polygon-amoy", "polygon-mumbai", "crossmint-private-testnet-ethereum", "crossmint-private-testnet-polygon", "rari-testnet", "scroll-sepolia", "sei-atlantic-2-testnet", "shape-sepolia", "skale-nebula-testnet", "soneium-minato-testnet", "space-testnet", "story-testnet", "verify-testnet", "viction-testnet", "xai-sepolia-testnet", "zkatana", "zkyoto", "zora-goerli", "zora-sepolia", "mode-sepolia", "u2u-nebulas", "zenchain-testnet", "abstract-testnet", "world-chain-sepolia", "plume-testnet", "flow-testnet", "tempo-testnet", "robinhood-chain-testnet", "ethereum", "polygon", "bsc", "optimism", "arbitrum", "base", "zora", "arbitrumnova", "astar-zkevm", "apechain", "hedera", "coti", "lightlink", "mantle", "skale-nebula", "sei-pacific-1", "chiliz", "avalanche", "xai", "shape", "rari", "scroll", "viction", "mode", "space", "soneium", "story", "u2u-solaris", "abstract", "world-chain", "plume", "flow", "tempo", "robinhood-chain"]).optional(), locator: z.string(), owner: z.string().optional()}), recipient: z.object({address: z.string(), chain: z.enum(["solana", "sui", "aptos", "xion", "stellar", "arbitrum-sepolia", "arc-testnet", "avalanche-fuji", "curtis", "base-goerli", "base-sepolia", "bsc-testnet", "chiliz-spicy-testnet", "coti-testnet", "ethereum-goerli", "ethereum-sepolia", "hedera-testnet", "hypersonic-testnet", "lightlink-pegasus", "mantle-sepolia", "optimism-goerli", "optimism-sepolia", "polygon-amoy", "polygon-mumbai", "crossmint-private-testnet-ethereum", "crossmint-private-testnet-polygon", "rari-testnet", "scroll-sepolia", "sei-atlantic-2-testnet", "shape-sepolia", "skale-nebula-testnet", "soneium-minato-testnet", "space-testnet", "story-testnet", "verify-testnet", "viction-testnet", "xai-sepolia-testnet", "zkatana", "zkyoto", "zora-goerli", "zora-sepolia", "mode-sepolia", "u2u-nebulas", "zenchain-testnet", "abstract-testnet", "world-chain-sepolia", "plume-testnet", "flow-testnet", "tempo-testnet", "robinhood-chain-testnet", "ethereum", "polygon", "bsc", "optimism", "arbitrum", "base", "zora", "arbitrumnova", "astar-zkevm", "apechain", "hedera", "coti", "lightlink", "mantle", "skale-nebula", "sei-pacific-1", "chiliz", "avalanche", "xai", "shape", "rari", "scroll", "viction", "mode", "space", "soneium", "story", "u2u-solaris", "abstract", "world-chain", "plume", "flow", "tempo", "robinhood-chain"]).optional(), locator: z.string(), owner: z.string().optional()}), token: z.union([z.object({locator: z.string(), amount: z.string(), rawAmount: z.string(), contractAddress: z.string().optional(), symbol: z.string().optional(), decimals: z.number(), type: z.literal("fungible"), chain: z.enum(["arbitrum-sepolia", "arc-testnet", "avalanche-fuji", "curtis", "base-goerli", "base-sepolia", "bsc-testnet", "chiliz-spicy-testnet", "coti-testnet", "ethereum-goerli", "ethereum-sepolia", "hedera-testnet", "hypersonic-testnet", "lightlink-pegasus", "mantle-sepolia", "optimism-goerli", "optimism-sepolia", "polygon-amoy", "polygon-mumbai", "crossmint-private-testnet-ethereum", "crossmint-private-testnet-polygon", "rari-testnet", "scroll-sepolia", "sei-atlantic-2-testnet", "shape-sepolia", "skale-nebula-testnet", "soneium-minato-testnet", "space-testnet", "story-testnet", "verify-testnet", "viction-testnet", "xai-sepolia-testnet", "zkatana", "zkyoto", "zora-goerli", "zora-sepolia", "mode-sepolia", "u2u-nebulas", "zenchain-testnet", "abstract-testnet", "world-chain-sepolia", "plume-testnet", "flow-testnet", "tempo-testnet", "robinhood-chain-testnet", "ethereum", "polygon", "bsc", "optimism", "arbitrum", "base", "zora", "arbitrumnova", "astar-zkevm", "apechain", "hedera", "coti", "lightlink", "mantle", "skale-nebula", "sei-pacific-1", "chiliz", "avalanche", "xai", "shape", "rari", "scroll", "viction", "mode", "space", "soneium", "story", "u2u-solaris", "abstract", "world-chain", "plume", "flow", "tempo", "robinhood-chain"])}), z.object({locator: z.string(), amount: z.string(), rawAmount: z.string(), mintHash: z.string().optional(), symbol: z.string().optional(), decimals: z.number(), type: z.literal("fungible"), chain: z.literal("solana")}), z.object({locator: z.string(), amount: z.string(), rawAmount: z.string(), contractId: z.string().optional(), symbol: z.string().optional(), decimals: z.number(), type: z.literal("fungible"), chain: z.literal("stellar")})]), status: z.enum(["succeeded", "failed"]), transferId: z.string().optional(), completedAt: z.string(), onChain: z.object({txId: z.string(), explorerLink: z.string()}).optional(), error: z.object({message: z.string(), reason: z.string(), revert: z.object({type: z.union([z.literal("contract_call"), z.literal("wallet_authorization"), z.literal("wallet_deployment")]), reason: z.string(), reasonData: z.union([z.string(), z.record(z.string(), z.unknown())]).optional(), explorerLink: z.string().optional(), simulationLink: z.string().optional()}).optional(), logs: z.object({}).optional()}).optional(), type: z.literal("wallets.transfer.out")})]))}); export const validateResponse = async ( schema: { readonly '~standard': { readonly validate: (value: unknown) => ({ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }) | Promise<{ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }> } }, value: unknown ): Promise => { const result = await schema['~standard'].validate(value) if (result.issues !== undefined) { const detail = result.issues .map(({ message, path }) => path?.length ? `${path.map((segment) => String(typeof segment === 'object' ? segment.key : segment)).join('.')}: ${message}` : message ) .join('; ') throw new Error(`Response does not match the schema: ${detail}`, { cause: { issues: result.issues } }) } return result.value }; /** * Get Wallet Activity (Unstable) * * GET /unstable/wallets/{walletLocator}/transfers */ export const getApiUnstableWalletsWalletLocatorTransfers = async (args: GetApiUnstableWalletsWalletLocatorTransfersArgs, options?: GetApiUnstableWalletsWalletLocatorTransfersOptions) => { const {baseUrl = "https://staging.crossmint.com/api", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (args['X-API-KEY'] != null) headers.set("X-API-KEY", String(args['X-API-KEY'])) if (args.cursor != null) query.append("cursor", String(args.cursor)) if (args.limit != null) query.append("limit", String(args.limit)) if (args.sort != null) query.append("sort", String(args.sort)) if (args.chain != null) query.append("chain", String(args.chain)) if (args.tokens != null) query.append("tokens", String(args.tokens)) if (args.status != null) query.append("status", String(args.status)) if (args.fromDate != null) query.append("fromDate", String(args.fromDate)) if (args.toDate != null) query.append("toDate", String(args.toDate)) const url = `${baseUrl.replace(/\/+$/, '')}/unstable/wallets/${encodeURIComponent(String(args.walletLocator))}/transfers${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return validateResponse(walletsActivityResponseUnstableDTO, await res.json()) };