@wuwei-labs/srsly
Version:
TypeScript SDK for SRSLY
61 lines • 2.15 kB
TypeScript
/**
* @purpose Create a pending affiliate (Affiliate member) for SRSLY vault
*
* Wraps slyvault's initMember instruction with Affiliate type pre-configured.
* Auto-fetches vault and nonce from parent 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 creating an affiliate
*/
export interface CreateAffiliateParams {
/**
* The affiliate's wallet - will earn a share of parent's fees
* Accepts string address, web3.js Keypair, or @solana/kit signer
*/
affiliate: UniversalSigner;
/**
* Parent's member state PDA address
*/
parentMemberState: Address | string;
/**
* Optional nonce for the affiliate slot.
* If not provided, uses vault.nextMemberNonce automatically.
*/
nonce?: number;
/**
* Optional separate authority for signing discount authorizations.
* If not provided, discount signing uses the main authority.
*/
discountAuthority?: Address | string | null;
/**
* Sets compute units to allocate for the transaction.
*/
computeUnits?: number;
}
/**
* Register a pending affiliate under a parent Normal member. The
* affiliate must be activated via `approveAffiliate` before earnings flow.
*
* @param params - Affiliate creation parameters
* @param config - Optional SDK configuration overrides
* @returns Prepared instruction(s)
*
* @example
* ```typescript
* import { createAffiliate } from '@wuwei-labs/srsly';
*
* // Create affiliate linked to parent member
* const ix = await createAffiliate({
* affiliate: wallet,
* parentMemberState: "PARENT_MEMBER_STATE_PDA",
* discountAuthority: "OPTIONAL_DISCOUNT_SIGNER", // optional, defaults to main authority
* // vault and nonce are auto-fetched from parent state
* });
* ```
*/
export declare function createAffiliate(params: CreateAffiliateParams, config?: Partial<SdkConfig>): Promise<InstructionResult>;
//# sourceMappingURL=createAffiliate.d.ts.map