irys-complete-toolkit
Version:
Complete Irys SDK toolkit supporting all chains, tokens, and features
183 lines (182 loc) • 4.33 kB
TypeScript
/**
* Irys Toolkit Types
* Complete type definitions for all Irys functionality
*/
export type IrysNetwork = 'mainnet' | 'devnet' | 'testnet';
export interface SupportedToken {
name: string;
symbol: string;
blockchain: string;
parameterValue: string;
nodeSupport: boolean;
browserSupport: boolean;
packageName: string;
className: string;
}
export declare const SUPPORTED_TOKENS: Record<string, SupportedToken>;
export interface IrysTag {
name: string;
value: string;
}
export interface UploadOptions {
tags?: IrysTag[];
anchor?: string;
upload?: {
paidBy?: string;
};
}
export interface IrysReceipt {
id: string;
timestamp: number;
version: string;
public: string;
signature: string;
deadlineHeight: number;
block?: number;
validatorSignatures?: any[];
verify(): Promise<boolean>;
}
export interface BalanceApproval {
amount: string;
payingAddress: string;
approvedAddress: string;
expiresBy: number;
timestamp: number;
token: string;
}
export interface CreateApprovalOptions {
amount: string | number;
approvedAddress: string;
expiresInSeconds?: number;
}
export interface FolderUploadOptions {
indexFile?: string;
batchSize?: number;
keepDeleted?: boolean;
}
export interface GraphQLTag {
name: string;
values?: string[];
}
export interface GraphQLQueryOptions {
ids?: string[];
owner?: string;
token?: string;
tags?: GraphQLTag[];
timestamp?: {
from?: number;
to?: number;
};
first?: number;
after?: string;
order?: 'ASC' | 'DESC';
}
export interface GraphQLTransaction {
id: string;
address: string;
token: string;
receipt?: any;
tags: IrysTag[];
timestamp: number;
}
export interface GraphQLResponse {
data: {
transactions: {
edges: {
node: GraphQLTransaction;
cursor: string;
}[];
pageInfo: {
hasNextPage: boolean;
endCursor: string;
};
};
};
}
export type EthersProvider = any;
export type ViemProvider = any;
export type SolanaProvider = any;
export type AptosProvider = any;
export interface NodeSDKConfig {
token: string;
network?: IrysNetwork;
privateKey: string;
rpcUrl?: string;
}
export interface WebSDKConfig {
token: string;
network?: IrysNetwork;
provider: EthersProvider | ViemProvider | SolanaProvider | AptosProvider;
providerType: 'ethers-v5' | 'ethers-v6' | 'viem-v2' | 'solana' | 'aptos';
}
export interface CLIUploadOptions {
network?: IrysNetwork;
token: string;
privateKey: string;
tags?: Record<string, string>;
providerUrl?: string;
}
export interface CLIBalanceOptions {
network?: IrysNetwork;
token: string;
address: string;
providerUrl?: string;
}
export interface AccountInfo {
address: string;
balance: string;
token: string;
}
export interface TransactionInfo {
id: string;
owner: string;
target?: string;
quantity: string;
reward: string;
last_tx: string;
tags: IrysTag[];
data_size: string;
data_root: string;
signature: string;
block?: {
height: number;
timestamp: number;
};
}
export declare class IrysError extends Error {
code?: string;
details?: any;
constructor(message: string, code?: string, details?: any);
}
export declare class InsufficientFundsError extends IrysError {
constructor(required: string, available: string);
}
export declare class NetworkError extends IrysError {
statusCode?: number;
constructor(message: string, statusCode?: number);
}
export type DataInput = string | Buffer | Uint8Array | ArrayBuffer | Blob | File;
export interface MutableReferenceOptions {
rootTxId: string;
data: DataInput;
tags?: IrysTag[];
}
export interface NFTMetadata {
name: string;
description: string;
image: string;
animation_url?: string;
attributes?: Array<{
trait_type: string;
value: string | number;
}>;
[key: string]: any;
}
export interface OnchainFolder {
[path: string]: string;
}
export interface ManifestData {
manifest: string;
version: string;
paths: OnchainFolder;
}