@wuwei-labs/srsly
Version:
TypeScript SDK for SRSLY
62 lines • 2.02 kB
TypeScript
/**
* @purpose Update affiliate settings (discount authority, authority transfer)
*
* Convenience wrapper around slyvault's affiliateUpdate instruction.
* Auto-fetches vault from affiliate member state.
*/
import { type Address } from '@solana/kit';
import { type InstructionResult } from '@wuwei-labs/slyvault';
import { type SdkConfig } from '../utils/config';
import { type UniversalSigner } from '../utils/signer';
/**
* Parameters for updating an affiliate
*/
export interface UpdateAffiliateParams {
/**
* Current affiliate authority
* Accepts string address, web3.js Keypair, or @solana/kit signer
*/
authority: UniversalSigner;
/**
* Affiliate member state PDA address
*/
affiliateState: Address | string;
/**
* Update the discount authority:
* - undefined: leave unchanged
* - null: clear the discount authority (use main authority for discount signing)
* - Address: set new discount authority
*/
discountAuthority?: Address | string | null;
/**
* New authority to transfer affiliate control to
* Must sign the transaction if provided
*/
newAuthority?: UniversalSigner;
/**
* Sets compute units to allocate for the transaction.
*/
computeUnits?: number;
}
/**
* Update an affiliate's discount-signing authority or transfer the
* affiliate seat to a new wallet.
*
* @param params - Update parameters
* @param config - Optional SDK configuration overrides
* @returns Prepared instruction(s)
*
* @example
* ```typescript
* import { updateAffiliate } from '@wuwei-labs/srsly';
*
* // Set discount authority for affiliate
* const ix = await updateAffiliate({
* authority: affiliateWallet,
* affiliateState: "AFFILIATE_STATE_PDA",
* discountAuthority: "DISCOUNT_AUTHORITY_ADDRESS"
* });
* ```
*/
export declare function updateAffiliate(params: UpdateAffiliateParams, config?: Partial<SdkConfig>): Promise<InstructionResult>;
//# sourceMappingURL=updateAffiliate.d.ts.map