@wuwei-labs/srsly
Version:
TypeScript SDK for SRSLY
57 lines • 1.98 kB
TypeScript
/**
* @purpose Simplified deleteContract instruction wrapper
*
* Thin convenience wrapper around Codama-generated deleteContract instruction.
* Admin-only instruction to delete contract state for schema migrations.
* Returns lamports to the contract owner.
*/
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 deleting contract state
*/
export interface DeleteContractParams {
/**
* Admin authority (must be config.admin)
* Accepts string address, web3.js Keypair, or @solana/kit signer
*/
admin: UniversalSigner;
/**
* Owner wallet address who will receive the lamport refund
* Optional - auto-fetched from contract if not provided
* Required if contract state is corrupted and cannot be deserialized
*/
owner?: Address | string;
/**
* Contract state address to delete
* This is the contract account that cannot be deserialized
*/
contract: Address | string;
/**
* Sets compute units to allocate for the transaction.
* @example 100000
*/
computeUnits?: number;
}
/**
* Admin escape hatch to delete a corrupted ContractState (used during
* schema migrations). Returns rent to the contract owner.
*
* @param params - Delete contract parameters
* @param config - Optional SDK configuration overrides
* @returns Kit instruction (or web3.js if PublicKey in config)
*
* @example
* ```typescript
* // Admin deletes corrupted contract state
* const ix = await deleteContract({
* admin: adminWallet,
* owner: "OWNER_WALLET_ADDRESS",
* contract: "CONTRACT_STATE_ADDRESS"
* });
* ```
*/
export declare function deleteContract(params: DeleteContractParams, config?: Partial<SdkConfig>): Promise<ReturnType<typeof prepareInstructions>>;
//# sourceMappingURL=deleteContract.d.ts.map