import { Base64String, HexString, Nillable, NonNil } from "../utils/types"; import { Signature } from "./signature"; import { PayloadType, SerializationType, BytesEncodingStatus, PayloadBytesTypes } from "./enums"; /** * `TxReceipt` is the interface for a payload structure for a a response from the Kwil `broadcast` GRPC endpoint {@link https://github.com/kwilteam/proto/blob/main/kwil/tx/v1/broadcast.proto}. */ export interface TxReceipt { get tx_hash(): HexString; } /** * `TxnData` is the interface for a payload structure for a a request to the Kwil `broadcast` GRPC endpoint {@link https://github.com/kwilteam/proto/blob/main/kwil/tx/v1/broadcast.proto}. */ export interface TxnData { signature: Signature; body: TxBody; sender: Nillable; serialization: SerializationType; } interface TxBody { desc: string; payload: Nillable; type: PayloadType; fee: Nillable; nonce: number | null; chain_id: string; } /** * `Transaction` is the payload structure for a a request to the Kwil `broadcast` GRPC endpoint {@link https://github.com/kwilteam/proto/blob/main/kwil/tx/v1/broadcast.proto}. * All bytes in the payload are base64 encoded. */ export type Transaction = BaseTransaction; /** * `BaseTransaction` is the base class for a payload structure for a a request to the Kwil `broadcast` GRPC endpoint {@link https://github.com/kwilteam/proto/blob/main/kwil/tx/v1/broadcast.proto}. * Bytes in the transaction can be typed to be either base64 encoded or Uint8Array. Uint8Array should be used when building the transaction within the SDK, and base64 should be used for the final transaction to be send over GRPC. * * @template {BytesEncodingStatus.BASE64_ENCODED | BytesEncodingStatus.UINT8_ENCODED} T - The type of bytes in the transaction. Can be either base64 encoded or Uint8Array. * @implements {TxnData} - The transaction data interface. */ export declare class BaseTransaction implements TxnData { protected readonly data: Readonly>; constructor(data?: NonNil>); get txData(): Readonly>; isSigned(): boolean; get signature(): Readonly>; get sender(): Nillable; get body(): Readonly>; get serialization(): SerializationType; } export declare namespace Txn { /** * Creates a new instance of the `BaseTransaction` class. * Bytes in the transaction can be typed to be either base64 encoded or Uint8Array. Uint8Array should be used when building the transaction within the SDK, and base64 should be used for the final transaction to be send over GRPC. * * @template {BytesEncodingStatus.BASE64_ENCODED | BytesEncodingStatus.UINT8_ENCODED} T - The type of bytes in the transaction. Can be either base64 encoded or Uint8Array. * @param {(tx: TxnData) => void} configure - A function that takes in a `TxnData` object and sets fields on it. * @returns {BaseTransaction} - A new instance of the `BaseTransaction` class. */ function create(configure: (tx: TxnData) => void): NonNil>; /** * Copies an existing instance of the `BaseTransaction` class and modifies certain fields. * * Bytes in the transaction can be typed to be either base64 encoded or Uint8Array. Uint8Array should be used when building the transaction within the SDK, and base64 should be used for the final transaction to be send over GRPC. * * @template {BytesEncodingStatus.BASE64_ENCODED | BytesEncodingStatus.UINT8_ENCODED} T - The type of bytes in the transaction. Can be either base64 encoded or Uint8Array. * @param {BaseTransaction} source - The transaction to copy. It can be using either bytes types. * @param {(tx: TxnData) => void} configure - A function that takes in a `TxnData` object and sets fields on it. * @returns {BaseTransaction} - A new instance of the `BaseTransaction` class. */ function copy(source: NonNil>, configure: (tx: TxnData) => void): NonNil>; } export {};