@aibtc/types
Version:
TypeScript types for AIBTC
68 lines (67 loc) • 2.65 kB
TypeScript
import { ClarityVersion } from "@stacks/transactions";
import { KnownAddresses } from "../utilities/known-addresses";
import { ContractSubtype, ContractType } from "../utilities/contract-types";
import { KnownTraits } from "../utilities/known-traits";
export interface AddressDependency {
ref: keyof KnownAddresses;
key: string;
}
export interface TraitDependency {
ref: keyof KnownTraits;
key: string;
}
export interface ContractDependency {
key: string;
category: ContractType;
subcategory: ContractSubtype<ContractType>;
}
export interface RuntimeValue {
key: string;
}
export interface ContractResponse {
name: string;
displayName?: string;
type: ContractType;
subtype: ContractSubtype<ContractType>;
source?: string;
hash?: string;
deploymentOrder: number;
clarityVersion?: ClarityVersion;
}
export declare abstract class ContractBase {
readonly name: string;
readonly type: ContractType;
readonly subtype: ContractSubtype<ContractType>;
readonly deploymentOrder: number;
readonly templatePath: string;
readonly clarityVersion: ClarityVersion | undefined;
protected _displayName?: string;
protected _source?: string;
protected _hash?: string;
static generateTemplatePath(type: ContractType, name: string): string;
readonly requiredAddresses: AddressDependency[];
readonly requiredTraits: TraitDependency[];
readonly requiredContractAddresses: ContractDependency[];
readonly requiredRuntimeValues: RuntimeValue[];
constructor(name: string, type: ContractType, subtype: ContractSubtype<ContractType>, deploymentOrder: number, templatePath: string, clarityVersion?: ClarityVersion);
get displayName(): string | undefined;
get source(): string | undefined;
get hash(): string | undefined;
setDisplayName(displayName: string): this;
setSource(source: string): this;
setHash(hash: string): this;
addAddressDependency(ref: keyof KnownAddresses, key: string): this;
addTraitDependency(ref: keyof KnownTraits, key: string): this;
addContractDependency(key: string, category: ContractType, subcategory: ContractSubtype<ContractType>): this;
addRuntimeValue(key: string): this;
/**
* Scan the template content for /g/ variables and add them as dependencies
* @param templateContent The content of the template file
*/
scanTemplateVariables(templateContent: string): this;
/**
* Get all dependencies for this contract
*/
getDependencies(): Array<AddressDependency | TraitDependency | ContractDependency | RuntimeValue>;
toRegistryEntry(): any;
}