/**
* Substitutes amount at offset with `walletBalance(accounts[account_index]) - subtraction`
*/
export type AmountSubstitution = {
/**
* big or little endian
*/
is_big_endian: boolean;
/**
* At what offset substitution should be done
*/
offset: number;
/**
* index of account in TransactionInstruction.keys to get balance for
*/
account_index: number;
/**
* Amount to deduct from wallet balance
*/
subtraction: number;
};
/**
* Since we don't know submissionAuth at the moment of calldata preparation we can prepare substitution to replace
* account at `index` with actual ATA(submissionAuth, tokenMint) during execution
*/
export type WalletSubstitution = {
/**
* Token mint to calculate ATA for
*/
token_mint: string;
/**
* Account at this index will be replaced with ATA(submissionAuth, tokenMint) during execution
*/
index: number;
};
/** Please note that all PublicKey are formatted in string (toBase58), expense and reward are also passed in string, and internally we format it back to BigInt, so please pass the values accordingly.*/
export type PlainInstructionData = {
instruction: {
keys: { pubkey: string /** base 58*/; isSigner: boolean; isWritable: boolean }[];
programId: string; // base58
data: string;
};
substitutions?: {
amountSubstitutions?: AmountSubstitution[];
walletSubstitutions?: WalletSubstitution[];
};
expense?: string; // should be in BigInt value converted to string
reward?: string; // should be in BigInt value converted to string
isInMandatoryBlock?: boolean;
};