@orao-network/solana-vrf-cb
Version:
ORAO Verifiable Random Function with Callback for Solana.
844 lines (843 loc) • 34.5 kB
TypeScript
import { BN, Program, Provider, web3 } from "@coral-xyz/anchor";
import { TransactionInstruction, AddressLookupTableAccount } from "@solana/web3.js";
import { FulfilledRequestAccount, NetworkConfiguration, NetworkState, RequestAccount, Client, Callback, RequestAltAccount } from "./state";
import { OraoVrfCb } from "./types/orao_vrf_cb";
import IDL from "./types/orao_vrf_cb.json";
import { MethodsBuilder } from "@coral-xyz/anchor/dist/cjs/program/namespace/methods";
import { AllInstructionsMap, IdlTypes } from "@coral-xyz/anchor/dist/cjs/program/namespace/types";
export { Provider, MethodsBuilder, web3 };
export * from "./state";
export { IDL, OraoVrfCb };
/**
* Address of a deployed Callback VRF
*/
export declare const PROGRAM_ADDRESS: string;
/**
* Id of a deployed Callback VRF
*/
export declare const PROGRAM_ID: web3.PublicKey;
/**
* Maximum supported number of fulfill authorities.
*/
export declare const MAX_FULFILLMENT_AUTHORITIES: number;
export declare const CB_CONFIG_ACCOUNT_SEED: Buffer;
export declare const CB_CLIENT_ACCOUNT_SEED: Buffer;
export declare const CB_REQUEST_ACCOUNT_SEED: Buffer;
export declare const CB_REQUEST_ALT_ACCOUNT_SEED: Buffer;
/**
* Creates VRF Configuration PDA address (see helper {@link OraoCb.getNetworkState}).
*
* ```typescript
* const [address, bump] = networkStateAddress(knownBump);
* assert!(bump === knownBump);
* ```
*
* @param bump - known PDA bump
* @param [vrf_id=PROGRAM_ID] - you can override the program ID.
*/
export declare function networkStateAddress(bump: number, vrf_id?: web3.PublicKey): [web3.PublicKey, number];
/**
* Finds VRF Configuration PDA address (see helper {@link OraoCb.getNetworkState}).
*
* ```typescript
* const [address, bump] = networkStateAddress();
* ```
*
* @param [vrf_id=PROGRAM_ID] - you can override the program ID.
*/
export declare function networkStateAddress(vrf_id?: web3.PublicKey): [web3.PublicKey, number];
/**
* Creates Client PDA address for the given `program` and `state`.
* (see helper {@link OraoCb.getClient}).
*
* ```typescript
* const [address, bump] = clientAddress(program, state, knownBump);
* assert(bump === knownBump);
* ```
*
* @param program program address.
* @param state program's side client state address.
* @param bump - known PDA bump
* @param [vrf_id=PROGRAM_ID] - you can override the program ID.
*/
export declare function clientAddress(program: web3.PublicKey, state: web3.PublicKey, bump: number, vrf_id?: web3.PublicKey): [web3.PublicKey, number];
/**
* Finds Client PDA address for the given `program` and `state`.
* (see helper {@link OraoCb.getClient}).
*
* ```typescript
* const [address, bump] = clientAddress(program, state);
* ```
*
* @param program program address.
* @param state program's side client state address.
* @param [vrf_id=PROGRAM_ID] - you can override the program ID.
*/
export declare function clientAddress(program: web3.PublicKey, state: web3.PublicKey, vrf_id?: web3.PublicKey): [web3.PublicKey, number];
/**
* Creates RequestAltAccount PDA address and bump for the given `client` and `seed`
* (see helper {@link OraoCb.getRequestAltAccount}).
*
* ```typescript
* const [address, bump] = requestAltAccountAddress(client, seed, knownBump);
* assert(bump === knownBump);
* ```
*
* @param client client address.
* @param seed seed buffer.
* @param bump known PDA bump.
* @param [vrf_id=PROGRAM_ID] - you can override the program ID.
*/
export declare function requestAltAccountAddress(client: web3.PublicKey, seed: Buffer | Uint8Array, bump: number, vrf_id?: web3.PublicKey): [web3.PublicKey, number];
/**
* Finds RequestAltAccount PDA address and bump for the given `client` and `seed`
* (see helper {@link OraoCb.getRequestAltAccount}).
*
* ```typescript
* const [address, bump] = requestAltAccountAddress(client, seed);
* ```
*
* @param client client address.
* @param seed seed buffer.
* @param [vrf_id=PROGRAM_ID] - you can override the program ID.
*/
export declare function requestAltAccountAddress(client: web3.PublicKey, seed: Buffer | Uint8Array, vrf_id?: web3.PublicKey): [web3.PublicKey, number];
/**
* Creates RequestAccount PDA address and bump for the given `client` and `seed`
* (see helper {@link OraoCb.getRequestAccount}).
*
* ```typescript
* const [address, bump] = requestAccountAddress(client, seed, knownBump);
* assert(bump === knownBump);
* ```
*
* @param client client address.
* @param seed seed buffer.
* @param bump known PDA bump.
* @param [vrf_id=PROGRAM_ID] - you can override the program ID.
*/
export declare function requestAccountAddress(client: web3.PublicKey, seed: Buffer | Uint8Array, bump: number, vrf_id?: web3.PublicKey): [web3.PublicKey, number];
/**
* Finds RequestAccount PDA and bump for the given `client` and `seed`
* (see helper {@link OraoCb.getRequestAccount}).
*
* ```typescript
* const [address, bump] = requestAccountAddress(client, seed);
* ```
*
* @param client client address.
* @param seed seed buffer.
* @param [vrf_id=PROGRAM_ID] - you can override the program ID.
*/
export declare function requestAccountAddress(client: web3.PublicKey, seed: Buffer | Uint8Array, vrf_id?: web3.PublicKey): [web3.PublicKey, number];
/**
* Returns `true` if Byzantine quorum is achieved.
*
* @param count number of participants
* @param total total number of nodes
* @returns `true` if quorum is achieved
*/
export declare function quorum(count: number, total: number): boolean;
/**
* Compiles given `accounts` to a pair of `RemainingAccountAlt[]` and accountsHash
* given the list of lookup tables.
*
* This helper function can be used to populate the `CallbackAlt` structure fields.
*/
export declare function compileAccounts(accounts: IdlTypes<OraoVrfCb>["remainingAccount"], lookupTables: AddressLookupTableAccount[]): [IdlTypes<OraoVrfCb>["remainingAccountAlt"][], Uint8Array];
/** Orao VRF program */
export declare class OraoCb extends Program<OraoVrfCb> {
readonly _payer: web3.PublicKey;
get payer(): web3.PublicKey;
/**
* Constructs a new program given the provider.
*
* Make sure to choose the desired {@link web3.Commitment} when building your provider.
*
* @param provider - an object that implements the {@link Provider} interface.
* Make sure it uses the desired `CommitmentLevel`.
* @param [id=PROGRAM_ID] - you can override the program ID.
*/
constructor(provider: Provider, id?: web3.PublicKey);
/**
* Returns VRF configuration (throws if not initialized).
*
* ```typescript
* const state = await vrf.getNetworkState();
* console.log("Request fee is " + state.config.requestFee);
* ```
*
* @param commitment - you can override the provider's commitment level.
*/
getNetworkState(commitment?: web3.Commitment): Promise<NetworkState>;
/**
* Returns client PDA (or `null` if missing).
*
* ```typescript
* const client = await vrf.getClient(programAddress, stateAddress);
* console.log("Client:" + client);
* ```
*
* @param program - client program address
* @param state - client state address
* @param commitment - you can override the provider's commitment level.
*/
getClient(program: web3.PublicKey, state: web3.PublicKey, commitment?: web3.Commitment): Promise<Client>;
/**
* Returns client PDA (or `null` if missing).
*
* Throws if unable to deserialize.
*
* ```typescript
* const client = await vrf.getClient(clientAddress);
* console.log("Client:" + client);
* ```
*
* @param client - client PDA address
* @param commitment - you can override the provider's commitment level.
*/
getClient(client: web3.PublicKey, commitment?: web3.Commitment): Promise<Client>;
/**
* Returns request account data for the given client and seed (or `null` if missing).
*
* ```typescript
* const requestAccount = await vrf.getRequestAccount(clientAddress, seed);
* const fulfilled = requestAccount.getFulfilled();
* if (fulfilled == null) {
* console.error("Randomness is not yet fulfilled");
* } else {
* console.log("Randomness is fulfilled " + bs58.encode(fulfilled.randomness));
* }
* ```
*
* @param client - client address
* @param seed - seed buffer
* @param commitment - you can override the provider's commitment level.
*/
getRequestAccount(client: web3.PublicKey, seed: Uint8Array, commitment?: web3.Commitment): Promise<RequestAccount | null>;
/**
* Returns request account data at the given address (or `null` if missing).
*
* Throws if account couldn't be decoded.
*
* ```typescript
* const requestAccount = await vrf.getRequestAccount(accountAddress);
* const fulfilled = requestAccount.getFulfilled();
* if (fulfilled == null) {
* console.error("Randomness is not yet fulfilled");
* } else {
* console.log("Randomness is fulfilled " + bs58.encode(fulfilled.randomness));
* }
* ```
*
* @param accountAddress - request account address.
* @param commitment - you can override the provider's commitment level.
*/
getRequestAccount(accountAddress: web3.PublicKey, commitment?: web3.Commitment): Promise<RequestAccount | null>;
/**
* Returns request account data for the given client and seed (or `null` if missing).
*
* ```typescript
* const requestAccount = await vrf.getRequestAltAccount(clientAddress, seed);
* const fulfilled = requestAccount.getFulfilled();
* if (fulfilled == null) {
* console.error("Randomness is not yet fulfilled");
* } else {
* console.log("Randomness is fulfilled " + bs58.encode(fulfilled.randomness));
* }
* ```
*
* @param client - client address
* @param seed - seed buffer
* @param commitment - you can override the provider's commitment level.
*/
getRequestAltAccount(client: web3.PublicKey, seed: Uint8Array, commitment?: web3.Commitment): Promise<RequestAltAccount | null>;
/**
* Returns request account data at the given address (or `null` if missing).
*
* Throws if account couldn't be decoded.
*
* ```typescript
* const requestAccount = await vrf.getRequestAccount(accountAddress);
* const fulfilled = requestAccount.getFulfilled();
* if (fulfilled == null) {
* console.error("Randomness is not yet fulfilled");
* } else {
* console.log("Randomness is fulfilled " + bs58.encode(fulfilled.randomness));
* }
* ```
*
* @param accountAddress - request account address.
* @param commitment - you can override the provider's commitment level.
*/
getRequestAltAccount(accountAddress: web3.PublicKey, commitment?: web3.Commitment): Promise<RequestAltAccount | null>;
/**
* Waits for the given randomness to be fulfilled.
*
* @param client - client address
* @param seed - seed
* @param requestKind - whether it is regular request or ALT request
* @param commitment - you can override the provider's commitment level.
*/
waitFulfilled(client: web3.PublicKey, seed: Buffer | Uint8Array, requestKind: "regular" | "alt", commitment?: web3.Commitment): Promise<FulfilledRequestAccount>;
/**
* Waits for the given randomness to be fulfilled.
*
* @param accountAddress - randomness account address
* @param commitment - you can override the provider's commitment level.
*/
waitFulfilled(accountAddress: web3.PublicKey, commitment?: web3.Commitment): Promise<FulfilledRequestAccount>;
/**
* Returns available client balance.
* @param client — client PDA address
*/
clientBalance(client: web3.PublicKey): Promise<BN>;
/**
* Returns available client balance.
* @param program — client program address
* @param state — client state address
*/
clientBalance(program: web3.PublicKey, state: web3.PublicKey): Promise<BN>;
}
/**
* A convenient builder for the `Initialize` instruction.
*
* Note that by default it will guess and apply a prioritization fee (see
* {@link InitializeBuilder.withComputeUnitPrice} and {@link InitializeBuilder.withComputeUnitLimit}
* to opt-out)
*
* @hidden
*/
export declare class InitializeBuilder {
vrf: OraoCb;
requestFee: BN;
private computeBudgetConfig;
/**
* Creates a new init_network instruction builder.
*
* @param vrf ORAO VRF program instance.
* @param requestFee request fee (in lamports)
*/
constructor(vrf: OraoCb, requestFee: BN);
/**
* Adds a prioritization fee in micro-lamports (applied per compute unit).
*
* Adds `ComputeBudgetInstruction::SetComputeUnitPrice` to the request builder.
*
* * if not specified, then median fee of the last 150 confirmed
* slots is used (this is by default)
* * if zero, then compute unit price is not applied at all.
*/
withComputeUnitPrice(computeUnitPrice: bigint): InitializeBuilder;
/**
* Defines a multiplier that is applied to a median compute unit price.
*
* This is only applied if no compute_unit_price specified, i.e. if compute unit price
* is measured as a median fee of the last 150 confirmed slots.
*
* * if not specified, then no multiplier is applied (this is by default)
* * if specified, then applied as follows: `compute_unit_price = median * multiplier`
*/
withComputeUnitPriceMultiplier(multiplier: number): InitializeBuilder;
/** Defines a specific compute unit limit that the transaction is allowed to consume.
*
* Adds `ComputeBudgetInstruction::SetComputeUnitLimit` to the request builder.
*
* * if not specified, then compute unit limit is not applied at all
* (this is by default)
* * if specified, then applied as is
*/
withComputeUnitLimit(computeUnitLimit: number): InitializeBuilder;
/**
* Returns a {@link MethodsBuilder} instance for the `Initialize` instruction.
*
* Note, that compute budget instructions will be prepended to the returned
* instance (use {@link InitializeBuilder.withComputeUnitPrice} and
* {@link InitializeBuilder.withComputeUnitLimit} to opt-out).
*/
build(): Promise<MethodsBuilder<OraoVrfCb, AllInstructionsMap<OraoVrfCb>["initialize"]>>;
/**
* Performs an RPC call.
*
* @returns a transaction signature.
*/
rpc(): Promise<string>;
}
/**
* A convenient builder for the `Configure` instruction.
*
* Note that by default it will guess and apply a prioritization fee (see
* {@link ConfigureBuilder.withComputeUnitPrice} and {@link ConfigureBuilder.withComputeUnitLimit}
* to opt-out)
*
* @hidden
*/
export declare class ConfigureBuilder {
vrf: OraoCb;
newConfig: NetworkConfiguration;
private computeBudgetConfig;
/**
* Creates a new `Configure` instruction.
*
* @param vrf ORAO VRF program instance.
*/
constructor(vrf: OraoCb, newConfig: NetworkConfiguration);
/** Change configuration authority. */
withAuthority(authority: web3.PublicKey): ConfigureBuilder;
/** Change treasury account address. */
withTreasury(treasury: web3.PublicKey): ConfigureBuilder;
/** Change fee (in lamports). */
withFee(requestFee: BN): ConfigureBuilder;
/** Change callback deadline (in slots). */
withCallbackDeadline(callbackDeadline: BN): ConfigureBuilder;
/** Change fulfill authorities. */
withFulfillAuthorities(fulfillAuthorities: web3.PublicKey[]): ConfigureBuilder;
/**
* Adds a prioritization fee in micro-lamports (applied per compute unit).
*
* Adds `ComputeBudgetInstruction::SetComputeUnitPrice` to the request builder.
*
* * if not specified, then median fee of the last 150 confirmed
* slots is used (this is by default)
* * if zero, then compute unit price is not applied at all.
*/
withComputeUnitPrice(computeUnitPrice: bigint): ConfigureBuilder;
/**
* Defines a multiplier that is applied to a median compute unit price.
*
* This is only applied if no compute_unit_price specified, i.e. if compute unit price
* is measured as a median fee of the last 150 confirmed slots.
*
* * if not specified, then no multiplier is applied (this is by default)
* * if specified, then applied as follows: `compute_unit_price = median * multiplier`
*/
withComputeUnitPriceMultiplier(multiplier: number): ConfigureBuilder;
/** Defines a specific compute unit limit that the transaction is allowed to consume.
*
* Adds `ComputeBudgetInstruction::SetComputeUnitLimit` to the request builder.
*
* * if not specified, then compute unit limit is not applied at all
* (this is by default)
* * if specified, then applied as is
*/
withComputeUnitLimit(computeUnitLimit: number): ConfigureBuilder;
/**
* Returns a {@link MethodsBuilder} instance for the `UpdateNetwork` instruction.
*
* Note, that compute budget instructions will be prepended to the returned
* instance (use {@link ConfigureBuilder.withComputeUnitPrice} and
* {@link ConfigureBuilder.withComputeUnitLimit} to opt-out).
*/
build(): Promise<MethodsBuilder<OraoVrfCb, AllInstructionsMap<OraoVrfCb>["configure"]>>;
/**
* Performs an RPC call.
*
* @returns a transaction signature.
*/
rpc(): Promise<string>;
}
/**
* A convenient builder for the `Register` instruction.
*
* This instruction registers a new Callback VRF client. Every registration is performed for
* a pair of accounts:
* 1. Program account — it's a client program address capable of doing
* requests and handling callbacks (if any).
* 2. State account — it's an arbitrary PDA belonging to the client program that becomes
* a request authority, i.e. it must sign the `Request` CPI calls,
*
* Note that same program can be registered many times as long as unique state accounts are used
* for every registration.
*
* Note that by default it will guess and apply a prioritization fee (see
* {@link RegisterBuilder.withComputeUnitPrice} and {@link RegisterBuilder.withComputeUnitLimit}
* to opt-out)
*/
export declare class RegisterBuilder {
vrf: OraoCb;
program: web3.PublicKey;
state: web3.PublicKey;
stateSeeds: Array<Uint8Array>;
callback: Callback | null;
private computeBudgetConfig;
/**
* Creates a `Register` instruction builder with empty client-level callback.
*
* @param vrf ORAO VRF program instance.
* @param program program being registered
* @param state the state PDA of a client being registered
* @param stateSeeds `state` seeds and bump
*/
constructor(vrf: OraoCb, program: web3.PublicKey, state: web3.PublicKey, stateSeeds: Array<Uint8Array>);
/** Sets the client-level callback */
withCallback(callback: Callback | null): void;
/**
* Adds a prioritization fee in micro-lamports (applied per compute unit).
*
* Adds `ComputeBudgetInstruction::SetComputeUnitPrice` to the request builder.
*
* * if not specified, then median fee of the last 150 confirmed
* slots is used (this is by default)
* * if zero, then compute unit price is not applied at all.
*/
withComputeUnitPrice(computeUnitPrice: bigint): RegisterBuilder;
/**
* Defines a multiplier that is applied to a median compute unit price.
*
* This is only applied if no compute_unit_price specified, i.e. if compute unit price
* is measured as a median fee of the last 150 confirmed slots.
*
* * if not specified, then no multiplier is applied (this is by default)
* * if specified, then applied as follows: `compute_unit_price = median * multiplier`
*/
withComputeUnitPriceMultiplier(multiplier: number): RegisterBuilder;
/** Defines a specific compute unit limit that the transaction is allowed to consume.
*
* Adds `ComputeBudgetInstruction::SetComputeUnitLimit` to the request builder.
*
* * if not specified, then compute unit limit is not applied at all
* (this is by default)
* * if specified, then applied as is
*/
withComputeUnitLimit(computeUnitLimit: number): RegisterBuilder;
/**
* Returns a {@link MethodsBuilder} instance for the `Register` instruction.
*
* Note, that compute budget instructions will be prepended to the returned
* instance (use {@link RegisterBuilder.withComputeUnitPrice} and
* {@link RegisterBuilder.withComputeUnitLimit} to opt-out).
*/
build(): Promise<MethodsBuilder<OraoVrfCb, AllInstructionsMap<OraoVrfCb>["register"]>>;
/**
* Performs an RPC call.
*
* @returns a transaction signature.
*/
rpc(): Promise<string>;
}
/**
* A convenient builder for the `SetCallback` instruction.
*
* This instruction updates the client-level callback for a client (see {@link Callback});
*
* Note that by default it will guess and apply a prioritization fee (see
* {@link RegisterBuilder.withComputeUnitPrice} and {@link RegisterBuilder.withComputeUnitLimit}
* to opt-out)
*/
export declare class SetCallbackBuilder {
vrf: OraoCb;
client: web3.PublicKey;
newCallback: Callback | null;
private computeBudgetConfig;
/**
* Creates a `SetCallback` instruction builder.
*
* @param vrf ORAO VRF program instance.
* @param client
* @param newCallback new client-level callback
*/
constructor(vrf: OraoCb, client: web3.PublicKey, newCallback: Callback | null);
/**
* Adds a prioritization fee in micro-lamports (applied per compute unit).
*
* Adds `ComputeBudgetInstruction::SetComputeUnitPrice` to the request builder.
*
* * if not specified, then median fee of the last 150 confirmed
* slots is used (this is by default)
* * if zero, then compute unit price is not applied at all.
*/
withComputeUnitPrice(computeUnitPrice: bigint): SetCallbackBuilder;
/**
* Defines a multiplier that is applied to a median compute unit price.
*
* This is only applied if no compute_unit_price specified, i.e. if compute unit price
* is measured as a median fee of the last 150 confirmed slots.
*
* * if not specified, then no multiplier is applied (this is by default)
* * if specified, then applied as follows: `compute_unit_price = median * multiplier`
*/
withComputeUnitPriceMultiplier(multiplier: number): SetCallbackBuilder;
/** Defines a specific compute unit limit that the transaction is allowed to consume.
*
* Adds `ComputeBudgetInstruction::SetComputeUnitLimit` to the request builder.
*
* * if not specified, then compute unit limit is not applied at all
* (this is by default)
* * if specified, then applied as is
*/
withComputeUnitLimit(computeUnitLimit: number): SetCallbackBuilder;
/**
* Returns a {@link MethodsBuilder} instance for the `SetCallback` instruction.
*
* Note, that compute budget instructions will be prepended to the returned
* instance (use {@link SetCallbackBuilder.withComputeUnitPrice} and
* {@link SetCallbackBuilder.withComputeUnitLimit} to opt-out).
*/
build(): Promise<MethodsBuilder<OraoVrfCb, AllInstructionsMap<OraoVrfCb>["setCallback"]>>;
/**
* Performs an RPC call.
*
* @returns a transaction signature.
*/
rpc(): Promise<string>;
}
/**
* A convenient builder for the `Transfer` instruction.
*
* This instruction transfers client ownership to another account. Client owner is able
* to update client-level callback and withdraw client funds.
*
* Note that by default it will guess and apply a prioritization fee (see
* {@link RegisterBuilder.withComputeUnitPrice} and {@link RegisterBuilder.withComputeUnitLimit}
* to opt-out)
*/
export declare class TransferBuilder {
vrf: OraoCb;
client: web3.PublicKey;
newOwner: web3.PublicKey;
private computeBudgetConfig;
/**
* Creates a `Transfer` instruction builder.
*
* @param vrf ORAO VRF program instance.
* @param client
* @param newOwner new client owner
*/
constructor(vrf: OraoCb, client: web3.PublicKey, newOwner: web3.PublicKey);
/**
* Adds a prioritization fee in micro-lamports (applied per compute unit).
*
* Adds `ComputeBudgetInstruction::SetComputeUnitPrice` to the request builder.
*
* * if not specified, then median fee of the last 150 confirmed
* slots is used (this is by default)
* * if zero, then compute unit price is not applied at all.
*/
withComputeUnitPrice(computeUnitPrice: bigint): TransferBuilder;
/**
* Defines a multiplier that is applied to a median compute unit price.
*
* This is only applied if no compute_unit_price specified, i.e. if compute unit price
* is measured as a median fee of the last 150 confirmed slots.
*
* * if not specified, then no multiplier is applied (this is by default)
* * if specified, then applied as follows: `compute_unit_price = median * multiplier`
*/
withComputeUnitPriceMultiplier(multiplier: number): TransferBuilder;
/** Defines a specific compute unit limit that the transaction is allowed to consume.
*
* Adds `ComputeBudgetInstruction::SetComputeUnitLimit` to the request builder.
*
* * if not specified, then compute unit limit is not applied at all
* (this is by default)
* * if specified, then applied as is
*/
withComputeUnitLimit(computeUnitLimit: number): TransferBuilder;
/**
* Returns a {@link MethodsBuilder} instance for the `Transfer` instruction.
*
* Note, that compute budget instructions will be prepended to the returned
* instance (use {@link TransferBuilder.withComputeUnitPrice} and
* {@link TransferBuilder.withComputeUnitLimit} to opt-out).
*/
build(): Promise<MethodsBuilder<OraoVrfCb, AllInstructionsMap<OraoVrfCb>["transfer"]>>;
/**
* Performs an RPC call.
*
* @returns a transaction signature.
*/
rpc(): Promise<string>;
}
/**
* A convenient builder for the `Withdraw` instruction.
*
* This instructions withdraw funds from the {@link Client} PDA account. Note that you won't
* be able to withdraw past the rent exemption — use {@link OraoCb.clientBalance} to
* get the available balance.
*
* Note that by default it will guess and apply a prioritization fee (see
* {@link RegisterBuilder.withComputeUnitPrice} and {@link RegisterBuilder.withComputeUnitLimit}
* to opt-out)
*/
export declare class WithdrawBuilder {
vrf: OraoCb;
client: web3.PublicKey;
amount: BN;
private computeBudgetConfig;
/**
* Creates a `Withdraw` instruction builder.
*
* @param vrf ORAO VRF program instance.
* @param client
* @param amount amount to withdraw (in lamports)
*/
constructor(vrf: OraoCb, client: web3.PublicKey, amount: BN);
/**
* Adds a prioritization fee in micro-lamports (applied per compute unit).
*
* Adds `ComputeBudgetInstruction::SetComputeUnitPrice` to the request builder.
*
* * if not specified, then median fee of the last 150 confirmed
* slots is used (this is by default)
* * if zero, then compute unit price is not applied at all.
*/
withComputeUnitPrice(computeUnitPrice: bigint): WithdrawBuilder;
/**
* Defines a multiplier that is applied to a median compute unit price.
*
* This is only applied if no compute_unit_price specified, i.e. if compute unit price
* is measured as a median fee of the last 150 confirmed slots.
*
* * if not specified, then no multiplier is applied (this is by default)
* * if specified, then applied as follows: `compute_unit_price = median * multiplier`
*/
withComputeUnitPriceMultiplier(multiplier: number): WithdrawBuilder;
/** Defines a specific compute unit limit that the transaction is allowed to consume.
*
* Adds `ComputeBudgetInstruction::SetComputeUnitLimit` to the request builder.
*
* * if not specified, then compute unit limit is not applied at all
* (this is by default)
* * if specified, then applied as is
*/
withComputeUnitLimit(computeUnitLimit: number): WithdrawBuilder;
/**
* Returns a {@link MethodsBuilder} instance for the `Withdraw` instruction.
*
* Note, that compute budget instructions will be prepended to the returned
* instance (use {@link WithdrawBuilder.withComputeUnitPrice} and
* {@link WithdrawBuilder.withComputeUnitLimit} to opt-out).
*/
build(): Promise<MethodsBuilder<OraoVrfCb, AllInstructionsMap<OraoVrfCb>["withdraw"]>>;
/**
* Performs an RPC call.
*
* @returns a transaction signature.
*/
rpc(): Promise<string>;
}
/**
* A convenient builder for the `Fulfill` instruction.
*
* Note that by default it will guess and apply a prioritization fee (see
* {@link RegisterBuilder.withComputeUnitPrice} and {@link RegisterBuilder.withComputeUnitLimit}
* to opt-out)
*
* @hidden
*/
export declare class FulfillBuilder {
vrf: OraoCb;
client: web3.PublicKey;
seed: Uint8Array;
private computeBudgetConfig;
/**
* Creates a fulfill instruction builder.
*
* @param vrf ORAO VRF program instance.
* @param client the client that made the request
* @param seed seed value (32 bytes).
*/
constructor(vrf: OraoCb, client: web3.PublicKey, seed: Uint8Array);
/**
* Adds a prioritization fee in micro-lamports (applied per compute unit).
*
* Adds `ComputeBudgetInstruction::SetComputeUnitPrice` to the request builder.
*
* * if not specified, then median fee of the last 150 confirmed
* slots is used (this is by default)
* * if zero, then compute unit price is not applied at all.
*/
withComputeUnitPrice(computeUnitPrice: bigint): FulfillBuilder;
/**
* Defines a multiplier that is applied to a median compute unit price.
*
* This is only applied if no compute_unit_price specified, i.e. if compute unit price
* is measured as a median fee of the last 150 confirmed slots.
*
* * if not specified, then no multiplier is applied (this is by default)
* * if specified, then applied as follows: `compute_unit_price = median * multiplier`
*/
withComputeUnitPriceMultiplier(multiplier: number): FulfillBuilder;
/** Defines a specific compute unit limit that the transaction is allowed to consume.
*
* Adds `ComputeBudgetInstruction::SetComputeUnitLimit` to the request builder.
*
* * if not specified, then compute unit limit is not applied at all
* (this is by default)
* * if specified, then applied as is
*/
withComputeUnitLimit(computeUnitLimit: number): FulfillBuilder;
/**
* Returns a {@link MethodsBuilder} instance for the `Fulfill` instruction.
*
* Note, that compute budget instructions will be prepended to the returned
* instance (use {@link FulfillBuilder.withComputeUnitPrice} and
* {@link FulfillBuilder.withComputeUnitLimit} to opt-out).
*
* @param fulfillAuthority - public key of a fulfill authority
* @param signature - signature of a `client || seed`, performed by the fulfill authority
*/
build(fulfillAuthority: web3.PublicKey, signature: Uint8Array): Promise<MethodsBuilder<OraoVrfCb, AllInstructionsMap<OraoVrfCb>["fulfill"]>>;
/**
* Performs an RPC call.
*
* @param fulfillAuthority - public key of a fulfill authority
* @param signature - signature of a `client || seed`, performed by the fulfill authority
*
* @returns a transaction signature.
*/
rpc(fulfillAuthority: web3.PublicKey, signature: Uint8Array): Promise<string>;
}
/**
* A convenient builder for the `FulfillAlt` instruction.
*
* Note that by default it will guess and apply a prioritization fee (see
* {@link RegisterBuilder.withComputeUnitPrice} and {@link RegisterBuilder.withComputeUnitLimit}
* to opt-out)
*
* @hidden
*/
export declare class FulfillAltBuilder {
vrf: OraoCb;
client: web3.PublicKey;
seed: Uint8Array;
private computeBudgetConfig;
/**
* Creates a fulfill instruction builder.
*
* @param vrf ORAO VRF program instance.
* @param client the client that made the request
* @param seed seed value (32 bytes).
*/
constructor(vrf: OraoCb, client: web3.PublicKey, seed: Uint8Array);
/**
* Adds a prioritization fee in micro-lamports (applied per compute unit).
*
* Adds `ComputeBudgetInstruction::SetComputeUnitPrice` to the request builder.
*
* * if not specified, then median fee of the last 150 confirmed
* slots is used (this is by default)
* * if zero, then compute unit price is not applied at all.
*/
withComputeUnitPrice(computeUnitPrice: bigint): FulfillAltBuilder;
/**
* Defines a multiplier that is applied to a median compute unit price.
*
* This is only applied if no compute_unit_price specified, i.e. if compute unit price
* is measured as a median fee of the last 150 confirmed slots.
*
* * if not specified, then no multiplier is applied (this is by default)
* * if specified, then applied as follows: `compute_unit_price = median * multiplier`
*/
withComputeUnitPriceMultiplier(multiplier: number): FulfillAltBuilder;
/** Defines a specific compute unit limit that the transaction is allowed to consume.
*
* Adds `ComputeBudgetInstruction::SetComputeUnitLimit` to the request builder.
*
* * if not specified, then compute unit limit is not applied at all
* (this is by default)
* * if specified, then applied as is
*/
withComputeUnitLimit(computeUnitLimit: number): FulfillAltBuilder;
build_instructions(fulfillAuthority: web3.PublicKey, signature: Uint8Array, lookup_tables: AddressLookupTableAccount[]): Promise<TransactionInstruction[]>;
}