@wuwei-labs/srsly
Version:
TypeScript SDK for SRSLY
70 lines • 2.23 kB
TypeScript
/**
* @purpose Simplified createConfig instruction wrapper
*
* Thin convenience wrapper around Codama-generated createConfig instruction.
* One-time creation of the global program configuration.
*/
import { type Address } from '@solana/kit';
import { type SdkConfig } from '../utils/config';
import { type UniversalSigner } from '../utils/signer';
import { prepareInstructions } from '../utils/instructions';
/**
* Parameters for creating the global program configuration
*/
export interface CreateConfigParams {
/**
* Authority who will initialize the config
* Must be the authorized initializer keypair
* Accepts web3.js Keypair or @solana/kit signer
*/
authority: UniversalSigner;
/**
* Slyvault address for storing funds
*/
vault: Address | string;
/**
* Vault's associated token account
*/
vaultTokenAccount: Address | string;
/**
* Address Lookup Table account to be created
* Must be derived from authority + recent slot using the ALT program
*/
lookupTable: Address | string;
/**
* Recent slot used to derive the lookup table address
* Must match the slot used to derive the lookupTable address
*/
recentSlot: bigint | number;
/**
* Sets compute units to allocate for the transaction.
* @example 400000
*/
computeUnits?: number;
}
/**
* One-time initialization of the global program config. Required before
* any other instruction can run.
*
* @param params - Configuration creation parameters
* @param config - Optional SDK configuration overrides
* @returns Kit instruction (or web3.js if PublicKey in config)
*
* @example
* ```typescript
* // Create with default authority
* const ix = await createConfig({
* vault: vaultAddress,
* vaultTokenAccount: vaultTokenAccountAddress
* });
*
* // Create with custom authority
* const ix2 = await createConfig({
* authority: adminWallet,
* vault: vaultAddress,
* vaultTokenAccount: vaultTokenAccountAddress
* });
* ```
*/
export declare function createConfig(params: CreateConfigParams, config?: Partial<SdkConfig>): Promise<ReturnType<typeof prepareInstructions>>;
//# sourceMappingURL=createConfig.d.ts.map