UNPKG

@aibtc/types

Version:

TypeScript types for AIBTC

76 lines (75 loc) 2.77 kB
import { StacksNetworkName } from "@stacks/network"; /** * @file Defines types and helper functions for AIBTC Agent Account contract interactions. * @packageDocumentation */ /** * Defines the approval types for contracts in the AIBTC Agent Account. * These correspond to the constants in the `aibtc-agent-account.clar` contract. */ export declare const AGENT_ACCOUNT_APPROVAL_TYPES: { readonly VOTING: 1; readonly SWAP: 2; readonly TOKEN: 3; }; /** * Represents the string keys for agent account approval types. * @example * let type: AgentAccountApprovalType = "VOTING"; */ export type AgentAccountApprovalType = keyof typeof AGENT_ACCOUNT_APPROVAL_TYPES; /** * Represents the response from the `get-configuration` function in the `aibtc-agent-account` contract. */ export interface AgentAccountConfiguration { account: string; agent: string; owner: string; sbtc: string; } /** * Represents the response from the `get-approval-types` function in the `aibtc-agent-account` contract. */ export interface AgentAccountApprovalTypes { proposalVoting: bigint; swap: bigint; token: bigint; } /** * Represents the response from the `get-agent-permissions` function in the `aibtc-agent-account` contract. */ export interface AgentAccountPermissions { canManageAssets: boolean; canUseProposals: boolean; canApproveRevokeContracts: boolean; canBuySell: boolean; } /** * Defines the default permissions for an agent account. * These values correspond to the initial data-var values in the contract. */ export declare const AGENT_ACCOUNT_DEFAULT_PERMISSIONS: AgentAccountPermissions; /** * Defines the default deployer principal for an agent account on each network. */ export declare const AGENT_ACCOUNT_DEFAULT_DEPLOYER: Record<StacksNetworkName, string>; /** * Validates and converts a user-provided approval type (string or number) into the correct numeric value. * Throws an error if the input is invalid. * * @param typeInput - The approval type to validate, can be a string (e.g., "VOTING") or a number (e.g., 1). * @returns The corresponding numeric approval type. * @throws {Error} If the `typeInput` is not a valid approval type. */ export declare function getAgentAccountApprovalType(typeInput: string | number): number; /** * Retrieves the default agent permissions. * @returns The default permissions. */ export declare function getAgentAccountDefaultPermissions(): AgentAccountPermissions; /** * Retrieves the default deployer address for an agent account for a given network. * @param network - The Stacks network name. * @returns The default deployer address for that network. */ export declare function getAgentAccountDefaultDeployer(network: StacksNetworkName): string;