@puzzlehq/types
Version:
Puzzle <3 Typescript
212 lines (211 loc) • 5.11 kB
TypeScript
import { z } from 'zod';
import { Transaction } from './aleo.js';
export type Account = {
_id: string;
address: string;
viewkey: string;
viewer: string;
created?: Date;
lastAccessed?: Date;
imported: boolean;
shared: boolean;
walletAddress?: string;
archivedHeight?: number;
archivedHeightTestnet?: number;
};
export type AccountAuth = {
address: string;
challenge?: string;
expiration_date?: Date;
};
export type EventTransition = {
transitionId: string;
programId: string;
functionId: string;
inputs: (string | null)[];
outputs: (string | null)[];
};
type TransitionCreate = {
transitionId: string;
programId: string;
functionId: string;
inputs?: string[];
outputs?: string[];
};
export type Asset = {
tokenId: string;
name: string;
symbol?: string;
programId: string;
decimals: number;
supply?: number;
max_supply?: number;
isARC20: boolean;
displayIfZero?: boolean;
recordName: string;
};
export type AssetV2 = {
tokenId: string;
name: string;
symbol?: string;
decimals: number;
supply?: number;
maxSupply?: number;
admin?: string;
externalAuthorizationRequired?: boolean;
externalAuthorizationParty?: string;
isMTSP: boolean;
programId: string;
recordName: string;
displayIfZero?: boolean;
iconURL?: string;
usageCount?: number;
priority: number;
coinbaseSymbol?: string;
};
type ClientInfo = {
client: 'ios' | 'android' | 'extension';
version: string;
device?: string;
};
export type Event = {
_id: string;
type: EventType;
owner: string;
status: EventStatus;
created: Date;
broadcast?: Date;
broadcastHeight?: number;
settled?: Date;
network: Network;
transactionId?: string;
height?: number;
description?: string;
visibility: Visibility;
fee: number;
feeCovered?: boolean;
feeCoverageType?: CoverageType;
functionId?: string;
programId?: string;
inputs: string[];
transitions: EventTransition[];
feeTransition?: EventTransition;
error?: string;
tokenIds?: string[];
giveawayId?: string;
clientInfo?: ClientInfo;
questRewardId?: string;
transaction?: Transaction;
};
export type EventCreate = {
type: EventType;
owner: string;
description?: string;
network: Network;
functionId?: string;
programId?: string;
visibility?: Visibility;
inputs?: string[];
transitions?: TransitionCreate[];
tokenIds?: string[];
clientInfo?: ClientInfo;
};
export type Record = {
_id: string;
eventId?: string;
height: number;
timestamp: Date;
ciphertext: string;
programId: string;
functionId: string;
name: string;
network: Network;
transactionId: string;
transitionId: string;
index: number;
status: RecordStatus;
owner?: string | null;
spentEventId?: string;
serialNumber?: string | null;
};
export declare enum RecordStatus {
Unspent = 'Unspent',
Pending = 'Pending',
Spent = 'Spent',
}
export type StringRecord = {
[key: string]: string | StringRecord;
};
export declare const getNestedProperty: (
data: StringRecord,
path: string[]
) => string | StringRecord | undefined;
export declare const getNestedStringProperty: (
data: StringRecord,
path: string[]
) => string | undefined;
export type RecordWithPlaintext = Record & {
plaintext: string;
microcredits: number;
data: StringRecord;
};
export type BalanceValues = {
private: number;
public: number;
};
export type Balance = AssetV2 & {
owner: string;
network: Network;
values: BalanceValues;
};
export declare enum EventType {
Deploy = 'Deploy',
Execute = 'Execute',
Send = 'Send',
Receive = 'Receive',
Join = 'Join',
Split = 'Split',
Shield = 'Shield',
Unshield = 'Unshield',
Referral = 'Referral',
Points = 'Points',
Spin = 'Spin',
Raffle = 'Raffle',
Mint = 'Mint',
StoreStock = 'Store Stock',
StorePurchase = 'Store Purchase',
StoreFulfillment = 'Store Fulfillment',
GiveawayEntry = 'Giveaway Entry',
GiveawayDraw = 'Giveaway Draw',
GiveawayWin = 'Giveaway Win',
SquashMint = 'Squash Mint',
SquashWater = 'Squash Water',
SquashLevelUp = 'Squash Level Up',
MysteryCity = 'Mystery City',
CreditsUpgrade = 'Credits Upgrade',
StreakFreeze = 'Streak Freeze',
DigitalAssetPurchase = 'Digital Asset Purchase',
}
export declare enum EventStatus {
Creating = 'Creating',
Pending = 'Pending',
Settled = 'Settled',
Failed = 'Failed',
}
export declare enum Visibility {
Private = 'Private',
Public = 'Public',
}
export declare enum Network {
AleoTestnet = 'AleoTestnet',
AleoMainnet = 'AleoMainnet',
}
export type CoverageType = 'pro' | 'all' | 'none';
export type EventCoverageType = CoverageType | 'all_pro';
export declare const networkPath: (network: Network) => string;
export declare const zodEventType: z.ZodNativeEnum<typeof EventType>;
export declare const zodEventStatus: z.ZodNativeEnum<typeof EventStatus>;
export declare const zodNetwork: z.ZodNativeEnum<typeof Network>;
export declare const zodVisibility: z.ZodNativeEnum<typeof Visibility>;
export declare const zodRecordStatus: z.ZodNativeEnum<typeof RecordStatus>;
export * from './aleo.js';