UNPKG

wowok_agent

Version:

Making It Easy for AI Agents to Communicate, Collaborate, Trade, and Trust.

856 lines (855 loc) 40 kB
import { EntrypointSchema, ObjectOwnerSchema, NameOrAddressSchema, NameSchema, WowAddressSchema, TokenTypeSchema, FaucetNetworkSchema } from "../common/index.js"; import { z } from "zod"; export const LocalMarkConstraints = { nameMaxLength: 64, tagMaxLength: 64, tagMaxCount: 50, }; export const LocalInfoConstraints = { nameMaxLength: 64, contentMaxLength: 300, contentMaxCount: 50, defaultName: "Address of delivery", }; export const AccountConstraints = { nameMaxLength: 64, }; export const ErrorResultSchema = z .object({ error: z.literal(true).describe("Always true for error responses"), code: z.string().optional().describe("Error code for programmatic handling"), message: z.string().describe("Human-readable error message"), details: z.record(z.string(), z.string()).optional().describe("Additional error context"), }) .describe("Error response structure"); export const createResultSchema = (successSchema) => z.union([ z.object({ success: z.literal(true), data: successSchema }), ErrorResultSchema, ]); export const CoinBalanceSchema = z.object({ coinType: z.string().describe("Coin type"), coinObjectCount: z.number().describe("Coin object count"), totalBalance: z.string().describe("Total balance"), lockedBalance: z.record(z.string(), z.string()).describe("Locked balance"), }).describe("Coin balance"); export const CoinStructSchema = z.object({ balance: z.string().describe("Coin balance"), coinObjectId: z.string().describe("Coin object ID"), coinType: z.string().describe("Coin type"), digest: z.string().describe("Transaction digest"), previousTransaction: z.string().describe("Previous transaction digest"), version: z.string().describe("Coin object version"), }).describe("Coin object"); export const PaginatedCoinsSchema = z.object({ data: z.array(CoinStructSchema).describe("Coin object list"), hasNextPage: z.boolean().describe("Whether there is a next page"), nextCursor: z.union([z.string(), z.null()]).optional().describe("Next query cursor"), }).describe("Paginated coin objects"); export const FaucetCoinInfoSchema = z.object({ amount: z.number().describe("Coin amount"), id: z.string().describe("Coin ID"), transferTxDigest: z.string().describe("Transfer transaction digest"), }).describe("Testnet faucet coin info"); export const EventIdSchema = z.object({ eventSeq: z.string().describe("Event sequence number"), txDigest: z.string().describe("Transaction digest"), }).describe("Event ID"); export const WowEventSchema = z.discriminatedUnion("bcsEncoding", [ z.object({ id: EventIdSchema.describe("Event ID"), packageId: z.string().describe("Package ID where event originated"), parsedJson: z.record(z.string(), z.union([z.string(), z.number(), z.boolean()])).describe("Parsed JSON value of the event"), sender: z.string().describe("Sender's address"), timestampMs: z.union([z.string(), z.null()]).optional().describe("UTC timestamp in milliseconds since epoch"), transactionModule: z.string().describe("Module where event originated"), type: z.string().describe("Move event type"), bcs: z.string().describe("BCS encoded event"), bcsEncoding: z.literal("base64").describe("BCS encoding format"), }), z.object({ id: EventIdSchema.describe("Event ID"), packageId: z.string().describe("Package ID where event originated"), parsedJson: z.record(z.string(), z.union([z.string(), z.number(), z.boolean()])).describe("Parsed JSON value of the event"), sender: z.string().describe("Sender's ID"), timestampMs: z.union([z.string(), z.null()]).optional().describe("UTC timestamp in milliseconds since epoch"), transactionModule: z.string().describe("Module where event originated"), type: z.string().describe("Move event type"), bcs: z.string().describe("BCS encoded event"), bcsEncoding: z.literal("base58").describe("BCS encoding format"), }), ]).describe("Blockchain event"); export const BalanceChangeSchema = z.object({ amount: z.string().describe("Balance change value, negative for spending, positive for receiving"), coinType: z.string().describe("Coin type"), owner: ObjectOwnerSchema.describe("Owner of the balance change"), }).describe("Balance change"); export const GasCostSummarySchema = z.object({ computationCost: z.string().describe("Computation/execution cost"), nonRefundableStorageFee: z.string().describe("Non-refundable storage fee"), storageCost: z.string().describe("Storage cost"), storageRebate: z.string().describe("Storage rebate"), }).describe("Transaction fee summary"); export const WowObjectRefSchema = z.object({ digest: z.string().describe("Base64 string of object digest"), objectId: z.string().describe("Hex code string representing object ID"), version: z.union([z.string(), z.number()]).describe("Object version"), }).describe("Wow object reference"); export const OwnedObjectRefSchema = z.object({ owner: ObjectOwnerSchema.describe("Owner"), reference: WowObjectRefSchema.describe("Object reference"), }).describe("Owned object reference"); export const TransactionBlockEffectsModifiedAtVersionsSchema = z.object({ objectId: z.string().describe("Object ID"), sequenceNumber: z.string().describe("Sequence number"), }).describe("Transaction block effects modified versions"); export const WowMoveAbortSchema = z.object({ error_code: z.union([z.string(), z.null()]).optional().describe("Error code"), function: z.union([z.string(), z.null()]).optional().describe("Function"), line: z.union([z.number(), z.null()]).optional().describe("Line number"), module_id: z.union([z.string(), z.null()]).optional().describe("Module ID"), }).describe("Wow Move abort"); export const ExecutionStatusSchema = z.object({ status: z.union([z.literal("success"), z.literal("failure")]).describe("Execution status"), error: z.string().optional().describe("Error message"), }).describe("Execution status"); export const WowGasDataSchema = z.object({ budget: z.string().describe("Budget"), owner: z.string().describe("Owner"), payment: z.array(WowObjectRefSchema).describe("Payment"), price: z.string().describe("Price"), }).describe("Wow gas data"); export const WowTransactionBlockKindSchema = z.object({ kind: z.string().describe("Transaction type"), }).passthrough().describe("Wow transaction block kind"); export const TransactionBlockDataSchema = z.object({ gasData: WowGasDataSchema.describe("Gas data"), messageVersion: z.literal("v1").describe("Message version"), sender: z.string().describe("Sender"), transaction: WowTransactionBlockKindSchema.describe("Transaction"), }).describe("Transaction block data"); export const WowTransactionBlockSchema = z.object({ data: TransactionBlockDataSchema.describe("Transaction data"), txSignatures: z.array(z.string()).describe("Transaction signatures"), }).describe("Wow transaction block"); export const WowObjectChangeSchema = z.discriminatedUnion("type", [ z.object({ type: z.literal("published"), digest: z.string().describe("Digest"), modules: z.array(z.string()).describe("Modules"), packageId: z.string().describe("Package ID"), version: z.union([z.string(), z.number()]).describe("Version"), }), z.object({ type: z.literal("transferred"), digest: z.string().describe("Digest"), objectId: z.string().describe("Object ID"), objectType: z.string().describe("Object type"), recipient: ObjectOwnerSchema.describe("Recipient"), sender: z.string().describe("Sender ID"), version: z.union([z.string(), z.number()]).describe("Version"), }), z.object({ type: z.literal("mutated"), digest: z.string().describe("Digest"), objectId: z.string().describe("Object ID"), objectType: z.string().describe("Object type"), owner: z.union([ObjectOwnerSchema, z.null()]).describe("Owner"), previousVersion: z.union([z.string(), z.number()]).describe("Previous version"), sender: z.string().describe("Sender"), version: z.union([z.string(), z.number()]).describe("Version"), }), z.object({ type: z.literal("deleted"), objectId: z.string().describe("Object ID"), objectType: z.string().describe("Object type"), sender: z.string().describe("Sender"), version: z.union([z.string(), z.number()]).describe("Version"), }), z.object({ type: z.literal("wrapped"), objectId: z.string().describe("Object ID"), objectType: z.string().describe("Object type"), sender: z.string().describe("Sender"), version: z.union([z.string(), z.number()]).describe("Version"), }), z.object({ type: z.literal("created"), digest: z.string().describe("Digest"), objectId: z.string().describe("Object ID"), objectType: z.string().describe("Object type"), owner: z.union([ObjectOwnerSchema, z.null()]).describe("Owner"), sender: z.string().describe("Sender"), version: z.union([z.string(), z.number()]).describe("Version"), }), ]).describe("Object change information"); export const TransactionEffectsSchema = z.object({ abortError: z.union([WowTransactionBlockSchema, z.null()]).optional().describe("Abort error if transaction failed with abort code"), created: z.array(OwnedObjectRefSchema).optional().describe("ObjectRef and owner of newly created objects"), deleted: z.array(WowObjectRefSchema).optional().describe("Object references (old refs) of now deleted objects"), dependencies: z.array(z.string()).optional().describe("Set of transaction digests this transaction depends on"), eventsDigest: z.union([z.string(), z.null()]).optional().describe("Digest of events emitted during execution"), executedEpoch: z.union([z.string(), z.number()]).describe("Epoch in which this transaction was executed"), gasObject: OwnedObjectRefSchema.describe("Updated gas object reference"), gasUsed: GasCostSummarySchema.describe("Gas used"), messageVersion: z.literal("v1").describe("Message version"), modifiedAtVersions: z.array(TransactionBlockEffectsModifiedAtVersionsSchema).optional().describe("Version of each modified (mutated or deleted) object before this transaction modified it"), mutated: z.array(OwnedObjectRefSchema).optional().describe("ObjectRef and owner of mutated objects, including gas object"), sharedObjects: z.array(WowObjectRefSchema).optional().describe("Object references of shared objects used in this transaction"), status: ExecutionStatusSchema.describe("Execution status"), transactionDigest: z.string().describe("Transaction digest"), unwrapped: z.array(OwnedObjectRefSchema).optional().describe("ObjectRef and owner of objects unwrapped in this transaction"), unwrappedThenDeleted: z.array(WowObjectRefSchema).optional().describe("Object references of objects previously wrapped in other objects but now deleted"), wrapped: z.array(WowObjectRefSchema).optional().describe("Object references of objects now wrapped in other objects"), }).describe("Transaction effects"); export const WowTransactionBlockResponseSchema = z.object({ balanceChanges: z.union([z.array(BalanceChangeSchema), z.null()]).optional().describe("Balance changes"), checkpoint: z.union([z.string(), z.null()]).optional().describe("Checkpoint number that this transaction is included in and thus completed"), confirmedLocalExecution: z.union([z.boolean(), z.null()]).optional().describe("Confirmed local execution"), digest: z.string().describe("Transaction digest"), effects: z.union([TransactionEffectsSchema, z.null()]).optional().describe("Transaction effects"), errors: z.array(z.string()).optional().describe("Error messages"), events: z.union([z.array(WowEventSchema), z.null()]).optional().describe("Events"), objectChanges: z.union([z.array(WowObjectChangeSchema), z.null()]).optional().describe("Object changes"), rawEffects: z.array(z.number()).optional().describe("Raw effects"), rawTransaction: z.string().optional().describe("Raw transaction"), timestampMs: z.union([z.string(), z.null()]).optional().describe("Timestamp"), transaction: z.union([WowTransactionBlockSchema, z.null()]).optional().describe("Transaction input data"), }).describe("Wow transaction block response"); export const MarkParamSchema = z .object({ name: z .object({ value: z .string() .max(LocalMarkConstraints.nameMaxLength, `Mark name exceeds maximum length of ${LocalMarkConstraints.nameMaxLength} bcs characters`) .describe(`Mark name value (max ${LocalMarkConstraints.nameMaxLength} bcs characters)`), replaceExistName: z .boolean() .optional() .default(false) .describe("If true, replace existing mark with same name; if false (default), throw error when name exists"), }) .optional() .describe("Mark naming configuration"), address: WowAddressSchema, tags: z .array(z .string() .max(LocalMarkConstraints.tagMaxLength, `Tag exceeds maximum length of ${LocalMarkConstraints.tagMaxLength} bcs characters`)) .max(LocalMarkConstraints.tagMaxCount, `Tag count exceeds maximum of ${LocalMarkConstraints.tagMaxCount}`) .optional() .describe(`Tags for categorization (max ${LocalMarkConstraints.tagMaxCount} tags, each max ${LocalMarkConstraints.tagMaxLength} bcs characters)`), }) .describe("LOCAL ONLY: Parameters for creating or updating a LOCAL mark. This data is stored privately on your device and will NEVER be published to the blockchain. For public on-chain marks, use the 'personal' tool instead."); export const MarkDataSchema = z .object({ name: z .string() .max(LocalMarkConstraints.nameMaxLength, `Mark name exceeds maximum length of ${LocalMarkConstraints.nameMaxLength} bcs characters`) .optional() .describe(`Mark name (max ${LocalMarkConstraints.nameMaxLength} bcs characters)`), address: WowAddressSchema, tags: z .array(z.string().max(LocalMarkConstraints.tagMaxLength, `Tag exceeds maximum length of ${LocalMarkConstraints.tagMaxLength} bcs characters`)) .max(LocalMarkConstraints.tagMaxCount, `Tag count exceeds maximum of ${LocalMarkConstraints.tagMaxCount}`) .optional() .describe(`Tags for categorization (max ${LocalMarkConstraints.tagMaxCount} tags, each max ${LocalMarkConstraints.tagMaxLength} bcs characters)`), createdAt: z .number() .optional() .describe("Unix timestamp (ms) when this mark was created"), updatedAt: z .number() .optional() .describe("Unix timestamp (ms) when this mark was last modified"), }) .describe("LOCAL PRIVATE: Local mark data structure for storing address names and tags privately on your device. This data is NEVER published to the blockchain."); export const InfoDataInnerSchema = z .object({ default: z .string() .max(LocalInfoConstraints.contentMaxLength, `Default value exceeds maximum length of ${LocalInfoConstraints.contentMaxLength} bcs characters`) .describe(`Primary/default value for this info (max ${LocalInfoConstraints.contentMaxLength} bcs characters)`), contents: z .array(z.string().max(LocalInfoConstraints.contentMaxLength, `Content item exceeds maximum length of ${LocalInfoConstraints.contentMaxLength} bcs characters`)) .max(LocalInfoConstraints.contentMaxCount, `Content count exceeds maximum of ${LocalInfoConstraints.contentMaxCount}`) .optional() .describe(`Additional content values (max ${LocalInfoConstraints.contentMaxCount} items, each max ${LocalInfoConstraints.contentMaxLength} bcs characters)`), createdAt: z .number() .optional() .describe("Unix timestamp (ms) when this info was created"), updatedAt: z .number() .optional() .describe("Unix timestamp (ms) when this info was last modified"), }) .describe("Info data inner structure"); export const InfoDataSchema = InfoDataInnerSchema.extend({ name: z .string() .max(LocalInfoConstraints.nameMaxLength, `Info name exceeds maximum length of ${LocalInfoConstraints.nameMaxLength} bcs characters`) .describe(`Unique identifier for this info entry (max ${LocalInfoConstraints.nameMaxLength} bcs characters)`), }).describe("LOCAL PRIVATE: Local info data structure for storing sensitive personal information like delivery addresses, phone numbers, etc. This data is stored ONLY on your device and NEVER published to the blockchain."); export const LocalMarkFilterSchema = z .object({ name: NameSchema .optional() .describe("Filter by mark name (supports fuzzy match)"), tags: z .array(z.string()) .optional() .describe("Filter by tags - returns marks that contain ANY of the specified tags"), address: WowAddressSchema .optional() .describe("Filter by address (exact match, format: 0x + 64 hex characters)"), createdAt: z .object({ gte: z .number() .optional() .describe("Filter marks created on or after this timestamp (ms)"), lte: z .number() .optional() .describe("Filter marks created on or before this timestamp (ms)"), }) .optional() .describe("Filter by creation time range"), updatedAt: z .object({ gte: z .number() .optional() .describe("Filter marks updated on or after this timestamp (ms)"), lte: z .number() .optional() .describe("Filter marks updated on or before this timestamp (ms)"), }) .optional() .describe("Filter by update time range"), }) .describe("Filter criteria for querying local marks. Multiple filters are combined with AND logic."); export const LocalInfoFilterSchema = z .object({ name: NameSchema .optional() .describe("Filter by info name (supports fuzzy match)"), default: z .string() .optional() .describe("Filter by default value (supports fuzzy match)"), contents: z .array(z.string()) .optional() .describe("Filter by contents - returns info that contains ANY of the specified content items"), createdAt: z .object({ gte: z .number() .optional() .describe("Filter info created on or after this timestamp (ms)"), lte: z .number() .optional() .describe("Filter info created on or before this timestamp (ms)"), }) .optional() .describe("Filter by creation time range"), updatedAt: z .object({ gte: z .number() .optional() .describe("Filter info updated on or after this timestamp (ms)"), lte: z .number() .optional() .describe("Filter info updated on or before this timestamp (ms)"), }) .optional() .describe("Filter by update time range"), }) .describe("Filter criteria for querying local info. Multiple filters are combined with AND logic."); export const QueryLocalInfoListSchema = z.object({ filter: LocalInfoFilterSchema.optional().describe("Local info filter"), }).describe("Query local info list parameters"); export const QueryAccountSchema = z .object({ name_or_address: NameOrAddressSchema.optional() .describe("Account name or address. Use empty string '' for the default account. Defaults to '' if omitted."), balance: z .boolean() .optional() .describe("Whether to query coin balance amount"), coin: z .object({ cursor: z .union([z.string(), z.null()]) .optional() .describe("Query cursor for pagination"), limit: z .union([z.number(), z.null()]) .optional() .describe("Maximum number of objects to return"), }) .optional() .describe("Whether to query coin object list"), token_type: TokenTypeSchema .optional() .describe("Token type; default token type is 0x2::wow::WOW"), network: EntrypointSchema .optional(), }) .describe("Used to query account's coin balance"); export const QueryAccountResultSchema = z.object({ name_or_address: NameOrAddressSchema.optional().describe("Account name or ID"), address: z.string().optional().describe("Account ID"), balance: CoinBalanceSchema.optional().describe("Coin balance details"), coin: PaginatedCoinsSchema.optional().describe("Paginated coin object list"), }).describe("Result of querying account's coin balance"); export const AccountOperationSchema = z .object({ gen: z .object({ name: NameSchema .optional() .describe(`Account name (max ${AccountConstraints.nameMaxLength} characters). Use empty string '' or omit for the default account.`), replaceExistName: z .boolean() .optional() .describe("If true, existing account with the same name will lose the name; if false (default), throw error when name exists"), m: z .union([NameSchema, z.null()]) .optional() .describe("Messenger name to enable messenger for this account (max 64 characters). If null, disable messenger. Omit to leave messenger unchanged."), }) .optional() .describe("Generate new account"), faucet: z .object({ name_or_address: NameOrAddressSchema.optional() .describe("Account name or address. Use empty string '' for the default account. Defaults to '' if omitted."), network: FaucetNetworkSchema, }) .optional() .describe("Distribute test coins from faucet to the specified account"), suspend: z .object({ name_or_address: NameOrAddressSchema.optional() .describe("Account name or address. Use empty string '' for the default account. Defaults to '' if omitted."), }) .optional() .describe("Remove account from active account list (cannot sign transactions), and delete its name"), resume: z .object({ address: WowAddressSchema, name: NameSchema.optional() .describe("New name for the resumed account. Omit to leave unnamed."), }) .optional() .describe("Add account back to active account list"), rename: z .object({ name_or_address: NameOrAddressSchema.optional() .describe(`Source account name or address. Use empty string '' for the default account. Defaults to '' if omitted. Can be a name or address.`), new_name: NameSchema .describe(`New account name (max ${AccountConstraints.nameMaxLength} characters). Must be a name (not an address).`), }) .optional() .describe("Rename account. name_or_address can be name or address, new_name must be a name."), swap_name: z .object({ name1: NameSchema.optional() .describe("First account name. Use empty string '' for the default account."), name2: NameSchema.optional() .describe("Second account name. Use empty string '' for the default account."), }) .optional() .describe("Swap the names of two accounts"), transfer: z .object({ name_or_address_from: NameOrAddressSchema.optional() .describe("Sender account name or address. Use empty string '' for the default account."), name_or_address_to: NameOrAddressSchema.optional() .describe("Recipient account name or address. Use empty string '' for the default account."), amount: z .union([z.number(), z.string()]) .describe("Amount of tokens to transfer"), token_type: z .string() .optional() .describe("Token type; default token type is 0x2::wow::WOW"), network: EntrypointSchema .optional() }) .optional() .describe("Transfer tokens from one account to another"), get: z .object({ name_or_address: NameOrAddressSchema.optional() .describe("Account name or address. Use empty string '' for the default account."), balance_required: z .union([z.string(), z.number()]) .describe("Required balance amount"), token_type: z .string() .optional() .describe("Token type; default token type is 0x2::wow::WOW"), network: EntrypointSchema .optional() }) .optional() .describe("Generate new coin object ID from account by required amount and return"), signData: z .object({ name_or_address: NameOrAddressSchema.optional() .describe("Account name or address. Use empty string '' for the default account."), data: z.string().describe("Data to sign. If data_encoding is not specified, treated as UTF-8 string."), data_encoding: z .union([ z.literal("utf8").describe("Data is UTF-8 encoded string"), z.literal("base64").describe("Data is base64 encoded bytes"), z.literal("hex").describe("Data is hex encoded bytes (with or without 0x prefix)"), ]) .optional() .describe("Encoding format of the data field. If not specified, defaults to utf8."), }) .optional() .describe("Sign data with account's private key"), messenger: z .object({ name_or_account: NameOrAddressSchema.optional() .describe("Account name or address. Use empty string '' for the default account. Defaults to '' if omitted."), m: z .union([NameSchema, z.null()]) .describe("Messenger name to enable messenger for this account (max 64 characters). If null, disable messenger."), }) .optional() .describe("Enable or disable messenger for an account"), }) .describe("Account operations"); export const AccountOperationResultSchema = z .object({ gen: z .object({ address: z.string().describe("Newly generated account ID"), name: NameSchema.optional().describe("Account name"), m: z .union([NameSchema, z.null()]) .optional() .describe("Messenger name if enabled"), }) .optional() .describe("Result of generating new account"), faucet: z .object({ name_or_address: NameOrAddressSchema.optional() .describe("Account name or address that received faucet coins"), result: z .array(FaucetCoinInfoSchema) .describe("List of distributed test coin info"), network: FaucetNetworkSchema, }) .optional() .describe("Result of distributing test coins from faucet to the specified account"), suspend: z .object({ name_or_address: NameOrAddressSchema.optional() .describe("Account name or address that was suspended"), success: z .boolean() .describe("True if account was successfully suspended, false if account does not exist"), }) .optional() .describe("Result of removing account from active account list (cannot sign transactions)"), resume: z .object({ address: WowAddressSchema.describe("Account ID that was resumed"), name: NameSchema.optional().describe("New name assigned to the account"), success: z .boolean() .describe("True if account was successfully resumed, false if account does not exist"), }) .optional() .describe("Result of adding account back to active account list"), rename: z .object({ name_or_address: NameOrAddressSchema.optional() .describe("Source account name or address that was renamed"), new_name: NameSchema.describe("New account name"), success: z .boolean() .describe("True if rename was successful, false if account not found or name already exists"), }) .optional() .describe("Result of renaming account"), swap_name: z .object({ name1: NameSchema.optional() .describe("First account name"), name2: NameSchema.optional() .describe("Second account name"), success: z .boolean() .describe("True if swap was successful, false if either account not found"), }) .optional() .describe("Result of swapping account names"), transfer: WowTransactionBlockResponseSchema.optional().describe("Result of token transfer transaction"), get: z .object({ coin_address: z .string() .optional() .describe("Newly generated coin object ID"), name_or_address: NameOrAddressSchema.optional() .describe("Account name or address"), balance_required: z .union([z.string(), z.number()]) .describe("Required coin object balance"), token_type: z .string() .optional() .describe("Token type; default token type is 0x2::wow::WOW"), network: EntrypointSchema .optional() }) .optional() .describe("Result of generating new coin object ID from account by required amount"), signData: z .object({ name_or_address: NameOrAddressSchema.optional() .describe("Account name or address used for signing"), signature: z.string().describe("Signature in hex format"), publicKey: z.string().describe("Public key in hex format"), address: z.string().describe("Account address"), }) .optional() .describe("Result of signing data with account"), messenger: z .object({ name_or_account: NameOrAddressSchema.optional() .describe("Account name or address"), m: z .union([NameSchema, z.null()]) .describe("Messenger name if enabled, null if disabled"), }) .optional() .describe("Result of enabling or disabling messenger for an account"), }) .describe("Results of account operations"); export const LocalMarkOperationSchema = z .object({ add: z .object({ op: z.literal("add").describe("Operation type: add marks"), data: z .array(MarkParamSchema) .min(1) .describe("Array of mark data to add (at least 1 item)"), }) .optional() .describe("Add one or more marks"), remove: z .object({ op: z.literal("remove").describe("Operation type: remove marks"), names: z .array(z.string()) .min(1) .describe("Array of mark names or addresses to remove"), }) .optional() .describe("Remove marks by name or address"), clear: z .object({ op: z.literal("clear").describe("Operation type: clear all marks"), }) .optional() .describe("Remove all marks"), }) .describe("Local mark operations. Exactly one operation type (add/remove/clear) must be specified."); export const LocalMarkOperationResultSchema = z.object({ clear: z.boolean().optional().describe("Whether all marks were successfully removed"), add: z.array(MarkDataSchema).optional().describe("List of added mark data"), remove: z.array(MarkDataSchema).optional().describe("List of removed mark data"), }).describe("Results of local mark operations for ID"); export const LocalInfoOperationSchema = z .object({ add: z .object({ op: z.literal("add").describe("Operation type: add info"), data: z .array(InfoDataSchema) .min(1) .describe("Array of info data to add (at least 1 item)"), }) .optional() .describe("Add one or more info entries"), remove: z .object({ op: z.literal("remove").describe("Operation type: remove info"), data: z .array(z.string()) .min(1) .describe("Array of info names to remove"), }) .optional() .describe("Remove info entries by name"), reset: z .object({ op: z.literal("reset").describe("Operation type: reset contents"), name: z.string().describe("Name of info entry to reset"), contents: z .array(z.string()) .describe("New content list to replace existing contents"), }) .optional() .describe("Reset the contents of an existing info entry"), clear: z .object({ op: z.literal("clear").describe("Operation type: clear all info"), }) .optional() .describe("Remove all info entries"), }) .describe("Local info operations. Exactly one operation type (add/remove/reset/clear) must be specified."); export const LocalInfoOperationResultSchema = z.object({ success: z.boolean().describe("Whether successful"), }).describe("Results of local info operations"); export const FetchTokenInfoOperationSchema = z.object({ tokenType: z.union([TokenTypeSchema, z.null()]).optional().describe("Token type; default token type is 0x2::wow::WOW"), alias: NameSchema.optional().describe("Token alias; used to quickly fetch token info"), network: EntrypointSchema.optional(), }).describe("Fetch token info to local and name it"); export const QueryLocalMarkListSchema = z.object({ filter: LocalMarkFilterSchema.optional().describe("Local mark filter"), }).describe("Query local mark list parameters"); export const QueryLocalMarkListResultSchema = z.object({ result: z.array(MarkDataSchema).describe("Local mark list"), }).describe("Query local mark list result"); export const AccountFilterSchema = z .object({ name: NameSchema .optional() .describe("Filter by account name (supports fuzzy match)"), address: WowAddressSchema .optional() .describe("Filter by account address (supports partial match, format: 0x + hex characters)"), suspended: z .boolean() .optional() .describe("Filter by suspension status. Omit to return all accounts regardless of status"), hasMessenger: z .boolean() .optional() .describe("Filter accounts with messenger enabled"), m: NameSchema .optional() .describe("Filter by messenger name (supports fuzzy match)"), createdAt: z .object({ gte: z .number() .optional() .describe("Filter accounts created on or after this timestamp (ms)"), lte: z .number() .optional() .describe("Filter accounts created on or before this timestamp (ms)"), }) .optional() .describe("Filter by creation time range"), updatedAt: z .object({ gte: z .number() .optional() .describe("Filter accounts updated on or after this timestamp (ms)"), lte: z .number() .optional() .describe("Filter accounts updated on or before this timestamp (ms)"), }) .optional() .describe("Filter by update time range"), }) .describe("Filter criteria for querying accounts. Multiple filters are combined with AND logic."); export const QueryAccountListSchema = z.object({ filter: AccountFilterSchema.optional().describe("Account filter"), }).describe("Query account list parameters"); export const AccountDataSchema = z.object({ name: z.string().optional().describe("Account name"), address: z.string().describe("Account address"), pubkey: z.string().optional().describe("Account public key"), secret: z.string().optional().describe("Account secret key"), suspended: z.boolean().optional().describe("Whether account is suspended"), createdAt: z.number().optional().describe("Timestamp when account was created"), updatedAt: z.number().optional().describe("Timestamp when account was last updated"), m: z.string().nullable().optional().describe("Messenger name, indicates this account has messenger enabled"), }).describe("Account data"); export const QueryAccountListResultSchema = z.object({ result: z.array(AccountDataSchema).describe("Account list"), }).describe("Query account list result"); export const QueryLocalInfoListResultSchema = z.object({ result: z.array(InfoDataSchema).describe("Local info list"), }).describe("Query local info list result"); export const TokenTypeInfoSchema = z.object({ type: z.string().describe("Token type"), alias: z.string().optional().describe("Token alias"), name: z.string().describe("Token name"), symbol: z.string().describe("Token symbol"), decimals: z.number().describe("Number of decimal places"), description: z.string().describe("Description of the token"), iconUrl: z.union([z.string(), z.null()]).optional().describe("URL for the token logo"), id: z.union([z.string(), z.null()]).optional().describe("Object id for the CoinMetadata object"), }).describe("Token type info"); export const TokenDataFilterSchema = z.object({ alias_or_name: NameSchema.optional().describe("Alias or name filter"), symbol: z.string().optional().describe("Token symbol"), type: z.string().optional().describe("Token type"), }).describe("Token data filter"); export const QueryLocalTokenListResultSchema = z.object({ result: z.array(TokenTypeInfoSchema).describe("Local token list"), }).describe("Query local token list result"); export const AccountOperationOutputSchema = z.discriminatedUnion("status", [ z.object({ status: z.literal("success"), data: AccountOperationResultSchema.describe("Success result data"), }), z.object({ status: z.literal("error"), error: z.string().describe("Error message"), }), ]).describe("Account operation output schema with discriminator"); export const AccountOperationOutputWrappedSchema = z.object({ result: AccountOperationOutputSchema, }).describe("Account operation output wrapped schema"); export const LocalMarkOperationOutputSchema = z.discriminatedUnion("status", [ z.object({ status: z.literal("success"), data: LocalMarkOperationResultSchema.describe("Success result data"), }), z.object({ status: z.literal("error"), error: z.string().describe("Error message"), }), ]).describe("Local mark operation output schema with discriminator"); export const LocalMarkOperationOutputWrappedSchema = z.object({ result: LocalMarkOperationOutputSchema, }).describe("Local mark operation output wrapped schema"); export const LocalInfoOperationOutputSchema = z.discriminatedUnion("status", [ z.object({ status: z.literal("success"), data: LocalInfoOperationResultSchema.describe("Success result data"), }), z.object({ status: z.literal("error"), error: z.string().describe("Error message"), }), ]).describe("Local info operation output schema with discriminator"); export const LocalInfoOperationOutputWrappedSchema = z.object({ result: LocalInfoOperationOutputSchema, }).describe("Local info operation output wrapped schema"); export * from "./wip.js";