import { Transaction } from '../core/tx'; import { NonNil } from '../utils/types'; import { Kwil } from '../client/kwil'; import { DBBuilder, SignerSupplier } from '../core/builders'; import { DeployOrDrop, EnvironmentType } from '../core/enums'; import { AnySignatureType } from '../core/signature'; import { DbPayloadType } from '../core/payload'; /** * `DBBuilderImpl` class is an implementation of the `DBBuilder` interface. * It creates a transaction to deploy a new database on the Kwil network. */ export declare class DBBuilderImpl implements DBBuilder { private readonly client; private _payload; private _signer; private _signatureType; private _payloadType; private _identifier; private _chainId; private _description; /** * Initializes a new `DBBuilderImpl` instance. * * @param {Kwil} client = The Kwil client, used to call higher level methods on the Kwil class. * @param {DeployOrDrop} payloadType - The payload type for the database transaction. This should be `PayloadType.DEPLOY_DATABASE` or `PayloadType.DROP_DATABASE`. * @returns {DBBuilder} A new `DBBuilderImpl` instance. */ private constructor(); /** * Creates a new `DbBuilder` instance. * * @param {Kwil} client - The Kwil client, used to call higher level methods on the Kwil class. * @param {PayloadType} payloadType - The payload type for the database transaction. This should be `PayloadType.DEPLOY_DATABASE` or `PayloadType.DROP_DATABASE`. * @returns {DBBuilder} A new `DBBuilderImpl` instance. */ static of(client: NonNil>, payloadType: NonNil): NonNil>; /** * Specifies the signer for the database transaction. * * @param {SignerSupplier} signer - The signer for the database transaction. This can be a `Signer` from Ethers v5 or Ethers v6 or a custom signer function. Custom signers must be of the form `(message: Uint8Array, ...args: any[]) => Promise`. * @param {AnySignatureType} signatureType - The signature type for the database transaction. This is only required if the signer is a custom signer function. * @returns {DBBuilder} The current `DBBuilder` instance for chaining. * @throws Will throw an error if the signer is null or undefined. * @throws Will throw an error if the signature type is null or undefined. * @throws Will throw an error if it cannot infer the signature type from the signer. */ signer(signer: SignerSupplier, signatureType?: AnySignatureType): NonNil>; /** * The payload for the database deployment or database drop. * * @param {DbPayloadType} payload - The payload for the database deployment or database drop. This should be a callback function that resolves to either a `CompiledKuneiform` or `DropDbPayload` object, or just objects that match either of those interfaces. * @returns {DBBuilder} The current `DBBuilder` instance for chaining. * @throws Will throw an error if the payload is null or undefined. */ payload(payload: DbPayloadType): NonNil>; /** * Specifies the identifier (e.g. wallet, public key, etc) for the database deployment / drop. * * @param {string | Uint8Array} identifier - The identifier for the database deployment / drop. * @returns {DBBuilder} The current `DBBuilder` instance for chaining. * @throws Will throw an error if the identifier is null or undefined. */ publicKey(identifier: string | Uint8Array): NonNil>; /** * Specifies the chain ID for the network being used. * * @param {string} chainId - The chain ID for the network being used. * @returns {DBBuilder} The current `ActionBuilder` instance for chaining. */ chainId(chainId: string): NonNil>; /** * Specifies the descriptions to be included in the message that is signed. * * @param {string} description - The description to be included in the message that is signed. * @returns {DBBuilder} The current `DBBuilder` instance for chaining. * @throws Will throw an error if the description is null or undefined. */ description(description: string): NonNil>; /** * Builds a Transaction. This will call the kwil network to retrieve the nonce for the signer. * * @returns {Promise} - A promise that resolves to a `Transaction` object. The `Transaction` object can be broadcasted to the Kwil network using `kwil.broadcast(tx)`. * @throws Will throw an error if there are any errors in the payload. * @throws Will throw an error if there is an issue with the account retrieval. */ buildTx(): Promise; /** * Ensures the compiled kuneiform schema has all of the required fields for RLP encoding. * * @param payload * @returns */ private makePayloadEncodable; }