import type BigNumber from 'bignumber.js'; import type { DataItem, Signer, createData, deepHash, getCryptoDriver, stringToBuffer, DataItemCreateOptions, bundleAndSignData, } from '@irys/bundles'; import type Irys from './irys'; export type { DataItem, Signer, DataItemCreateOptions } from '@irys/bundles'; // common types shared between web and node versions export type CreateTxData = { amount: BigNumber.Value; to: string; fee?: string; }; // export type arbundles = typeof arbundles | typeof web@irys/bundles; export type bundles = { createData: typeof createData; DataItem: typeof DataItem; deepHash: typeof deepHash; stringToBuffer: typeof stringToBuffer; getCryptoDriver: typeof getCryptoDriver; bundleAndSignData: typeof bundleAndSignData; }; export type IrysTransaction = { sign: () => Promise; size: number; // uploadWithReceipt: (opts?: UploadOptions) => Promise; upload( opts: UploadOptions & { getReceiptSignature: true } ): Promise; upload(opts?: UploadOptions): Promise; isValid(): Promise; getPrice(): Promise; // fromRaw(rawTransaction: Buffer, IrysInstance: Irys): IrysTransaction; } & DataItem; export type IrysTransactonCtor = new ( data: string | Uint8Array, Irys: Pick, opts?: IrysTransactionCreateOptions ) => IrysTransaction; export type Tx = { from: string; to: string; amount: BigNumber; blockHeight?: BigNumber; pending: boolean; confirmed: boolean; }; export type TokenConfig = { irys: Irys; name: string; ticker: string; minConfirm?: number; wallet?: Wallet; providerUrl: string; isSlow?: boolean; opts?: Opts; }; export type Network = 'mainnet' | 'devnet' | string; export type IrysConfig = { timeout?: number; providerUrl?: string; contractAddress?: string; tokenOpts?: object; headers?: Record; debug?: boolean; }; export type Token = { isSlow: boolean; needsFee: boolean; base: [string, number]; name: string; get address(): string | undefined; ticker: string; irys: Irys; getTx(txId: string): Promise; ownerToAddress(owner: any): Promise; price(): Promise; sign(data: Uint8Array): Promise; getSigner(): Signer; verify(pub: any, data: Uint8Array, signature: Uint8Array): Promise; getCurrentHeight(): Promise; getFee( amount: BigNumber.Value, to?: string, multiplier?: BigNumber.Value ): Promise; sendTx(data: any): Promise; createTx( amount: BigNumber.Value, to: string, fee?: string | object ): Promise<{ txId: string | undefined; tx: any }>; getPublicKey(): Promise | (string | Buffer); ready?(): Promise; // createMultiSigTx?(amount: BigNumber.Value, to: string, opts: any, fee?: string): Promise; // addSignature?(multiTx: any, opts: any): Promise; // submitMultiSigTx?(multiTx: any, opts: any): Promise; }; export type Manifest = { manifest: 'irys/paths'; version: string; paths: Record>>; index?: Record<'path', string>; }; export type UploadResponse = { // The ID of the transaction id: string; // The public key of the node that received the transaction public: string; // The signature of this receipt signature: string; // the maximum expected block height for transaction inclusion deadlineHeight: number; // List of validator signatures validatorSignatures: { address: string; signature: string }[]; // The UNIX (MS precision) timestamp of when the node received the Tx. timestamp: number; // The receipt version version: '1.0.0'; // Injected verification function (same as Utils/Irys.verifyReceipt) verify: () => Promise; }; export type UploadReceipt = /* Required; */ UploadResponse; export type UploadReceiptData = Omit< UploadReceipt, 'verify' | 'validatorSignatures' >; export type FundResponse = { reward: string; target: string; quantity: string; id: string; }; export type WithdrawalResponse = { tx_id: string; requested: number; fee: number; final: number; }; export type CreateAndUploadOptions = DataItemCreateOptions & { upload?: UploadOptions; }; export type UploadOptions = { paidBy?: string }; export enum UploadHeaders { PAID_BY = 'x-irys-paid-by', } export type IrysTransactionCreateOptions = DataItemCreateOptions & { dataIsRawTransaction?: boolean; }; export type HashingAlgo = 'sha256' | 'sha384'; export type ProvenanceProof = { dataProtocol: 'Provenance-Confirmation' | string; hashingAlgo?: HashingAlgo | string; dataHash: string; uploadedFor?: string; prompt?: string; promptHash?: string; model?: string; }; export type TxGqlNode = { id: string; receipt: { deadlineHeight: number; signature: string; timestamp: number; version: string; }; tags: { name: string; value: string }[]; address: string; currency: string; signature: string; timetamp: number; }; export type TxGqlResponse = { data: { transactions: { edges: { node: TxGqlNode; }[]; pageInfo?: { endCursor: string | null; hasNextPage: boolean }; }; }; }; export type UnixEpochMs = number; // decoration type with internal type to hint at the data type // eslint-disable-next-line @typescript-eslint/no-unused-vars export type StringifiedNumber<_NumberType extends number> = string; export type Tag = { name: string; value: string }; export type Tags = Tag[];