import {
composeSolanaRecoveryAction,
composeSolanaCancelRecoveryInstruction,
recomposeSolanaExecuteRecoveryInstruction,
} from '@glideco/recovery';
// Seat R (recovery key) proposes swapping a lost member:
const composed = composeSolanaRecoveryAction({
multisigPda: 'GrAkKfEpTKQuVHG2Y97Y2FF4i7y7Q5AHLK94KB5hwkhU',
transactionIndex: BigInt(7),
currentThreshold: 2,
creator: '4Nd1mBQtrMJVYVfKf2PX98HegncxXSystemRecoveryKey', // Seat R base58 pubkey
recoveryActionId: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890', // DB row UUID — embedded in on-chain memo
action: {
kind: 'swap_owner',
oldMember: '4Nd1mBQtrMJVYVfKf2PX98HegncxXLostKeyPubkey1', // base58 — lost key
newMember: 'DHmk7x1qGQUos2nsfQ3sJMnFHRWXYReplacementKey1', // base58 — replacement key
},
});
// composed.proposeInstructions — [configTxCreate, proposalCreate, proposalApprove] (EncodedInstruction[])
// composed.executeInstruction — pre-composed configTransactionExecute (EncodedInstruction)
// composed.innerTx — SolanaInnerTx payload to persist in DB for replay
// composed.multisigPda — echo of input
// composed.transactionIndex — decimal string of the u64 index
// composed.kind — 'swap_owner'
// composed.summary — human-readable one-liner for audit logs
// User-initiated veto before cooldown ends:
const cancel = composeSolanaCancelRecoveryInstruction({
multisigPda: 'GrAkKfEpTKQuVHG2Y97Y2FF4i7y7Q5AHLK94KB5hwkhU',
transactionIndex: BigInt(7),
member: 'UserSeatAPubkeyBase58xxxxxxxxxxxxxxxxxxxxxxxxxxxx', // user's Seat A pubkey
recoveryActionId: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890', // same DB row UUID — for cancel memo
});
// returns a single EncodedInstruction (proposalCancel)
// Execute after cooldown — recompose from the persisted inner_tx:
const exec = recomposeSolanaExecuteRecoveryInstruction({
innerTx: composed.innerTx, // SolanaInnerTx from DB — NOT re-derived from scratch
member: '4Nd1mBQtrMJVYVfKf2PX98HegncxXSystemRecoveryKey', // Seat R — any multisig member works
});
// returns a single EncodedInstruction (configTransactionExecute)