/** * @name perps/phoenix/phoenix-builder-onboarding * @description Trader onboarding builders for Phoenix perps. * * Registration and activation are two different on-chain steps: * - `RegisterTrader` creates the trader PDA — the account stays FROZEN with * no capabilities (flags=6: CAN_PLACE_LIMIT | CAN_PLACE_MARKET only). * - `OnboardTraderDelegated` enables ALL six capabilities (limit, market, * risk-increasing, risk-reducing, deposit, withdraw) — but its required * signer is Phoenix's own onboarder key, which only exists through * Phoenix's API co-signing flow: * POST /v1/exchange/build-register-ixs (returns onboarder-signed ixs) * POST /v1/exchange/send-register-ixs (Phoenix co-signs + submits) * * A user-signed RegisterTrader-only transaction therefore simulates * CapabilityDenied forever. These tools implement the documented * build → user-sign → Phoenix-co-signed-submit flow. * * All builders produce unsigned instruction data — NO signing happens * server-side. The user's authority signs in their browser; Phoenix's * onboarder signs inside send-register-ixs only. * * @module perps/phoenix/phoenix-builder-onboarding */ /** One wire instruction from build-register-ixs (pubkey/keys/data shape). */ export interface PhoenixApiInstruction { readonly programId: string; readonly keys: ReadonlyArray<{ readonly pubkey: string; readonly isSigner: boolean; readonly isWritable: boolean; }>; readonly data: ReadonlyArray; } export interface BuildOnboardInstructionsResult { /** Wire instructions for the browser to assemble, sign, and submit. */ readonly instructions: readonly PhoenixApiInstruction[]; /** Trader PDA that will be activated. */ readonly traderPda: string; /** Phoenix onboarder key that co-signs inside send-register-ixs. */ readonly traderOnboarder: string; /** Echoed fee payer. */ readonly txFeePayer: string; /** maxPositions used for the registration (32-128). */ readonly maxPositions: number; /** True when RegisterTrader must be included (account not yet created). */ readonly includeRegisterTrader: boolean; /** The instructions are NOT RPC-submittable alone — Phoenix must co-sign. */ readonly requiresPhoenixApiSubmit: true; readonly nextTool: 'sap_phoenix_submit_onboard_trader'; /** Safe state machine gates for client UIs. */ readonly safeToApprove: true; readonly approvalBlocked: false; /** Human-readable next step for agents and UIs. */ readonly instructions_note: string; } export interface SubmitOnboardResult { readonly success: true; readonly signature: string; readonly traderPda: string; /** True when RegisterTrader was included in the submitted transaction. */ readonly includeRegisterTrader: boolean; /** Post-submit verification hint: re-check trader state for active flags. */ readonly verification: string; } /** * Build delegated-onboarding instructions for a trader account. * Calls Phoenix's POST /v1/exchange/build-register-ixs — the only endpoint * that returns the OnboardTraderDelegated instruction set. * * @param params.traderAuthority — Trader authority wallet (base58). * @param params.txFeePayer — Wallet paying fees and rent (base58). Must NOT be the Phoenix onboarder. * @param params.maxPositions — Optional; defaults to 128 (min 32). */ export declare function buildOnboardInstructions(params: { traderAuthority: string; txFeePayer: string; maxPositions?: number; }): Promise; /** * Submit a user-signed onboarding transaction to Phoenix's co-signing API. * Phoenix validates it, adds the onboarder signature, simulates, verifies * the onboarder pays nothing, and broadcasts. Returns the signature. * * @param params.transaction — Base64-encoded fully assembled transaction, * signed by the fee payer (authority signature not required). * @param params.traderAuthority — Same authority used in buildOnboardInstructions. * @param params.txFeePayer — Same fee payer used in buildOnboardInstructions. */ export declare function submitOnboardTransaction(params: { transaction: string; traderAuthority: string; txFeePayer: string; }): Promise; //# sourceMappingURL=phoenix-builder-onboarding.d.ts.map