Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .changeset/beige-cougars-drop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
"@macalinao/clients-voter-stake-registry": patch
"@macalinao/clients-orca-whirlpools": patch
"@macalinao/clients-kamino-lending": patch
"@macalinao/clients-spl-governance": patch
"@macalinao/clients-spl-stake-pool": patch
"@macalinao/clients-token-metadata": patch
"@macalinao/coda-visitors": patch
"@macalinao/coda": patch
---

Adds more account defaults
5 changes: 4 additions & 1 deletion bun.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"": {
"name": "@macalinao/coda-monorepo",
"devDependencies": {
"@biomejs/biome": "^2.2.6",
"@biomejs/biome": "^2.2.7",
"@changesets/cli": "^2.29.7",
"@macalinao/biome-config": "^0.1.2",
"husky": "^9.1.7",
Expand Down Expand Up @@ -175,6 +175,7 @@
"name": "@macalinao/coda-visitors",
"version": "0.1.6",
"dependencies": {
"@solana-program/memo": "^0.9.0",
"@solana-program/system": "^0.9.0",
"@solana-program/token": "^0.7.0",
"@solana-program/token-2022": "^0.6.0",
Expand Down Expand Up @@ -705,6 +706,8 @@

"@shikijs/vscode-textmate": ["@shikijs/[email protected]", "", {}, "sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg=="],

"@solana-program/memo": ["@solana-program/[email protected]", "", { "peerDependencies": { "@solana/kit": "^4.0" } }, "sha512-I544p9gFeaguGbM+U09tjc9Prbs71vh7votxRahEoiOlxVID9NtZTah4KQnL0jK7JboxFxXo4+VOBaIE3HYPOw=="],

"@solana-program/system": ["@solana-program/[email protected]", "", { "peerDependencies": { "@solana/kit": "^4.0" } }, "sha512-yu+i0SZ+c+0E9Cy+btoMiCbxRnP/FLQuv/Ba8l2klZApAiOX1Ja/2IGkctFV36fglsI7PwD9czkSkHm8og+QeA=="],

"@solana-program/token": ["@solana-program/[email protected]", "", { "peerDependencies": { "@solana/kit": "^4.0" } }, "sha512-Rx9vTsU15lLbjLmzrnLhPG4ZBlzkvyr7sRAH5ciA3dtSocpprkMEHQslDteE9+5rKkuYoIUl7Qki4l2IMY0P2w=="],
Expand Down
2 changes: 1 addition & 1 deletion clients/kamino-lending/coda.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export default defineConfig({
]),
},
{
account: /sysvarInfo|instructionSysvarAccount/,
account: /sysvarInfo|[\w+][iI]nstructionSysvarAccount/,
defaultValue: SYSVAR_INSTRUCTIONS_VALUE_NODE,
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ export type DepositAndWithdrawInstruction<
| AccountMeta = string,
TAccountDepositAccountsCollateralTokenProgram extends
| string
| AccountMeta = string,
| AccountMeta = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
TAccountDepositAccountsLiquidityTokenProgram extends
| string
| AccountMeta = string,
| AccountMeta = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
TAccountDepositAccountsInstructionSysvarAccount extends
| string
| AccountMeta = string,
| AccountMeta = "Sysvar1nstructions1111111111111111111111111",
TAccountWithdrawAccountsOwner extends string | AccountMeta = string,
TAccountWithdrawAccountsObligation extends string | AccountMeta = string,
TAccountWithdrawAccountsLendingMarket extends string | AccountMeta = string,
Expand Down Expand Up @@ -113,13 +113,13 @@ export type DepositAndWithdrawInstruction<
| AccountMeta = string,
TAccountWithdrawAccountsCollateralTokenProgram extends
| string
| AccountMeta = string,
| AccountMeta = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
TAccountWithdrawAccountsLiquidityTokenProgram extends
| string
| AccountMeta = string,
| AccountMeta = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
TAccountWithdrawAccountsInstructionSysvarAccount extends
| string
| AccountMeta = string,
| AccountMeta = "Sysvar1nstructions1111111111111111111111111",
TAccountDepositFarmsAccountsObligationFarmUserState extends
| string
| AccountMeta = string,
Expand Down Expand Up @@ -337,9 +337,9 @@ export interface DepositAndWithdrawInput<
depositAccountsReserveDestinationDepositCollateral: Address<TAccountDepositAccountsReserveDestinationDepositCollateral>;
depositAccountsUserSourceLiquidity: Address<TAccountDepositAccountsUserSourceLiquidity>;
depositAccountsPlaceholderUserDestinationCollateral?: Address<TAccountDepositAccountsPlaceholderUserDestinationCollateral>;
depositAccountsCollateralTokenProgram: Address<TAccountDepositAccountsCollateralTokenProgram>;
depositAccountsLiquidityTokenProgram: Address<TAccountDepositAccountsLiquidityTokenProgram>;
depositAccountsInstructionSysvarAccount: Address<TAccountDepositAccountsInstructionSysvarAccount>;
depositAccountsCollateralTokenProgram?: Address<TAccountDepositAccountsCollateralTokenProgram>;
depositAccountsLiquidityTokenProgram?: Address<TAccountDepositAccountsLiquidityTokenProgram>;
depositAccountsInstructionSysvarAccount?: Address<TAccountDepositAccountsInstructionSysvarAccount>;
withdrawAccountsOwner: TransactionSigner<TAccountWithdrawAccountsOwner>;
withdrawAccountsObligation: Address<TAccountWithdrawAccountsObligation>;
withdrawAccountsLendingMarket: Address<TAccountWithdrawAccountsLendingMarket>;
Expand All @@ -351,9 +351,9 @@ export interface DepositAndWithdrawInput<
withdrawAccountsReserveLiquiditySupply: Address<TAccountWithdrawAccountsReserveLiquiditySupply>;
withdrawAccountsUserDestinationLiquidity: Address<TAccountWithdrawAccountsUserDestinationLiquidity>;
withdrawAccountsPlaceholderUserDestinationCollateral?: Address<TAccountWithdrawAccountsPlaceholderUserDestinationCollateral>;
withdrawAccountsCollateralTokenProgram: Address<TAccountWithdrawAccountsCollateralTokenProgram>;
withdrawAccountsLiquidityTokenProgram: Address<TAccountWithdrawAccountsLiquidityTokenProgram>;
withdrawAccountsInstructionSysvarAccount: Address<TAccountWithdrawAccountsInstructionSysvarAccount>;
withdrawAccountsCollateralTokenProgram?: Address<TAccountWithdrawAccountsCollateralTokenProgram>;
withdrawAccountsLiquidityTokenProgram?: Address<TAccountWithdrawAccountsLiquidityTokenProgram>;
withdrawAccountsInstructionSysvarAccount?: Address<TAccountWithdrawAccountsInstructionSysvarAccount>;
depositFarmsAccountsObligationFarmUserState?: Address<TAccountDepositFarmsAccountsObligationFarmUserState>;
depositFarmsAccountsReserveFarmState?: Address<TAccountDepositFarmsAccountsReserveFarmState>;
withdrawFarmsAccountsObligationFarmUserState?: Address<TAccountWithdrawFarmsAccountsObligationFarmUserState>;
Expand Down Expand Up @@ -616,6 +616,30 @@ export function getDepositAndWithdrawInstruction<
const args = { ...input };

// Resolve default values.
if (!accounts.depositAccountsCollateralTokenProgram.value) {
accounts.depositAccountsCollateralTokenProgram.value =
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" as Address<"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA">;
}
if (!accounts.depositAccountsLiquidityTokenProgram.value) {
accounts.depositAccountsLiquidityTokenProgram.value =
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" as Address<"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA">;
}
if (!accounts.depositAccountsInstructionSysvarAccount.value) {
accounts.depositAccountsInstructionSysvarAccount.value =
"Sysvar1nstructions1111111111111111111111111" as Address<"Sysvar1nstructions1111111111111111111111111">;
}
if (!accounts.withdrawAccountsCollateralTokenProgram.value) {
accounts.withdrawAccountsCollateralTokenProgram.value =
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" as Address<"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA">;
}
if (!accounts.withdrawAccountsLiquidityTokenProgram.value) {
accounts.withdrawAccountsLiquidityTokenProgram.value =
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" as Address<"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA">;
}
if (!accounts.withdrawAccountsInstructionSysvarAccount.value) {
accounts.withdrawAccountsInstructionSysvarAccount.value =
"Sysvar1nstructions1111111111111111111111111" as Address<"Sysvar1nstructions1111111111111111111111111">;
}
if (!accounts.farmsProgram.value) {
accounts.farmsProgram.value = FARMS_PROGRAM_ADDRESS;
accounts.farmsProgram.isWritable = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,12 @@ export type LiquidateObligationAndRedeemReserveCollateralInstruction<
TAccountCollateralTokenProgram extends
| string
| AccountMeta = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
TAccountRepayLiquidityTokenProgram extends string | AccountMeta = string,
TAccountWithdrawLiquidityTokenProgram extends string | AccountMeta = string,
TAccountRepayLiquidityTokenProgram extends
| string
| AccountMeta = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
TAccountWithdrawLiquidityTokenProgram extends
| string
| AccountMeta = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
TAccountInstructionSysvarAccount extends
| string
| AccountMeta = "Sysvar1nstructions1111111111111111111111111",
Expand Down Expand Up @@ -233,8 +237,8 @@ export interface LiquidateObligationAndRedeemReserveCollateralAsyncInput<
userDestinationCollateral: Address<TAccountUserDestinationCollateral>;
userDestinationLiquidity: Address<TAccountUserDestinationLiquidity>;
collateralTokenProgram?: Address<TAccountCollateralTokenProgram>;
repayLiquidityTokenProgram: Address<TAccountRepayLiquidityTokenProgram>;
withdrawLiquidityTokenProgram: Address<TAccountWithdrawLiquidityTokenProgram>;
repayLiquidityTokenProgram?: Address<TAccountRepayLiquidityTokenProgram>;
withdrawLiquidityTokenProgram?: Address<TAccountWithdrawLiquidityTokenProgram>;
instructionSysvarAccount?: Address<TAccountInstructionSysvarAccount>;
liquidityAmount: LiquidateObligationAndRedeemReserveCollateralInstructionDataArgs["liquidityAmount"];
minAcceptableReceivedLiquidityAmount: LiquidateObligationAndRedeemReserveCollateralInstructionDataArgs["minAcceptableReceivedLiquidityAmount"];
Expand Down Expand Up @@ -402,6 +406,14 @@ export async function getLiquidateObligationAndRedeemReserveCollateralInstructio
accounts.collateralTokenProgram.value =
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" as Address<"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA">;
}
if (!accounts.repayLiquidityTokenProgram.value) {
accounts.repayLiquidityTokenProgram.value =
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" as Address<"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA">;
}
if (!accounts.withdrawLiquidityTokenProgram.value) {
accounts.withdrawLiquidityTokenProgram.value =
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" as Address<"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA">;
}
if (!accounts.instructionSysvarAccount.value) {
accounts.instructionSysvarAccount.value =
"Sysvar1nstructions1111111111111111111111111" as Address<"Sysvar1nstructions1111111111111111111111111">;
Expand Down Expand Up @@ -499,8 +511,8 @@ export interface LiquidateObligationAndRedeemReserveCollateralInput<
userDestinationCollateral: Address<TAccountUserDestinationCollateral>;
userDestinationLiquidity: Address<TAccountUserDestinationLiquidity>;
collateralTokenProgram?: Address<TAccountCollateralTokenProgram>;
repayLiquidityTokenProgram: Address<TAccountRepayLiquidityTokenProgram>;
withdrawLiquidityTokenProgram: Address<TAccountWithdrawLiquidityTokenProgram>;
repayLiquidityTokenProgram?: Address<TAccountRepayLiquidityTokenProgram>;
withdrawLiquidityTokenProgram?: Address<TAccountWithdrawLiquidityTokenProgram>;
instructionSysvarAccount?: Address<TAccountInstructionSysvarAccount>;
liquidityAmount: LiquidateObligationAndRedeemReserveCollateralInstructionDataArgs["liquidityAmount"];
minAcceptableReceivedLiquidityAmount: LiquidateObligationAndRedeemReserveCollateralInstructionDataArgs["minAcceptableReceivedLiquidityAmount"];
Expand Down Expand Up @@ -661,6 +673,14 @@ export function getLiquidateObligationAndRedeemReserveCollateralInstruction<
accounts.collateralTokenProgram.value =
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" as Address<"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA">;
}
if (!accounts.repayLiquidityTokenProgram.value) {
accounts.repayLiquidityTokenProgram.value =
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" as Address<"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA">;
}
if (!accounts.withdrawLiquidityTokenProgram.value) {
accounts.withdrawLiquidityTokenProgram.value =
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" as Address<"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA">;
}
if (!accounts.instructionSysvarAccount.value) {
accounts.instructionSysvarAccount.value =
"Sysvar1nstructions1111111111111111111111111" as Address<"Sysvar1nstructions1111111111111111111111111">;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,16 @@ export type LiquidateObligationAndRedeemReserveCollateralV2Instruction<
| AccountMeta = string,
TAccountLiquidationAccountsCollateralTokenProgram extends
| string
| AccountMeta = string,
| AccountMeta = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
TAccountLiquidationAccountsRepayLiquidityTokenProgram extends
| string
| AccountMeta = string,
| AccountMeta = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
TAccountLiquidationAccountsWithdrawLiquidityTokenProgram extends
| string
| AccountMeta = string,
| AccountMeta = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
TAccountLiquidationAccountsInstructionSysvarAccount extends
| string
| AccountMeta = string,
| AccountMeta = "Sysvar1nstructions1111111111111111111111111",
TAccountCollateralFarmsAccountsV2ObligationFarmUserState extends
| string
| AccountMeta = string,
Expand Down Expand Up @@ -305,10 +305,10 @@ export interface LiquidateObligationAndRedeemReserveCollateralV2Input<
liquidationAccountsUserSourceLiquidity: Address<TAccountLiquidationAccountsUserSourceLiquidity>;
liquidationAccountsUserDestinationCollateral: Address<TAccountLiquidationAccountsUserDestinationCollateral>;
liquidationAccountsUserDestinationLiquidity: Address<TAccountLiquidationAccountsUserDestinationLiquidity>;
liquidationAccountsCollateralTokenProgram: Address<TAccountLiquidationAccountsCollateralTokenProgram>;
liquidationAccountsRepayLiquidityTokenProgram: Address<TAccountLiquidationAccountsRepayLiquidityTokenProgram>;
liquidationAccountsWithdrawLiquidityTokenProgram: Address<TAccountLiquidationAccountsWithdrawLiquidityTokenProgram>;
liquidationAccountsInstructionSysvarAccount: Address<TAccountLiquidationAccountsInstructionSysvarAccount>;
liquidationAccountsCollateralTokenProgram?: Address<TAccountLiquidationAccountsCollateralTokenProgram>;
liquidationAccountsRepayLiquidityTokenProgram?: Address<TAccountLiquidationAccountsRepayLiquidityTokenProgram>;
liquidationAccountsWithdrawLiquidityTokenProgram?: Address<TAccountLiquidationAccountsWithdrawLiquidityTokenProgram>;
liquidationAccountsInstructionSysvarAccount?: Address<TAccountLiquidationAccountsInstructionSysvarAccount>;
collateralFarmsAccountsV2ObligationFarmUserState?: Address<TAccountCollateralFarmsAccountsV2ObligationFarmUserState>;
collateralFarmsAccountsV2ReserveFarmState?: Address<TAccountCollateralFarmsAccountsV2ReserveFarmState>;
debtFarmsAccountsObligationFarmUserState?: Address<TAccountDebtFarmsAccountsObligationFarmUserState>;
Expand Down Expand Up @@ -517,6 +517,22 @@ export function getLiquidateObligationAndRedeemReserveCollateralV2Instruction<
const args = { ...input };

// Resolve default values.
if (!accounts.liquidationAccountsCollateralTokenProgram.value) {
accounts.liquidationAccountsCollateralTokenProgram.value =
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" as Address<"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA">;
}
if (!accounts.liquidationAccountsRepayLiquidityTokenProgram.value) {
accounts.liquidationAccountsRepayLiquidityTokenProgram.value =
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" as Address<"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA">;
}
if (!accounts.liquidationAccountsWithdrawLiquidityTokenProgram.value) {
accounts.liquidationAccountsWithdrawLiquidityTokenProgram.value =
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" as Address<"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA">;
}
if (!accounts.liquidationAccountsInstructionSysvarAccount.value) {
accounts.liquidationAccountsInstructionSysvarAccount.value =
"Sysvar1nstructions1111111111111111111111111" as Address<"Sysvar1nstructions1111111111111111111111111">;
}
if (!accounts.farmsProgram.value) {
accounts.farmsProgram.value = FARMS_PROGRAM_ADDRESS;
accounts.farmsProgram.isWritable = false;
Expand Down
Loading