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
2 changes: 1 addition & 1 deletion modules/sdk-coin-sol/src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export const marinadeStakingActivateInstructionsIndexes = {

/** Const to check the order of the Jito Staking Activate instructions when decode */
export const jitoStakingActivateInstructionsIndexes = {
AtaInit: 0,
InitializeAssociatedTokenAccount: 0,
DepositSol: 1,
} as const;

Expand Down
6 changes: 5 additions & 1 deletion modules/sdk-coin-sol/src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,11 @@ export function matchTransactionTypeByInstructionsOrder(

// Check instructions by order using the index.
for (const keyName of instructionsKeys) {
const result = getInstructionType(instructionsCopy[instructionIndexes[keyName]]);
const index = instructionIndexes[keyName];
if (index >= instructionsCopy.length) {
return false;
}
const result = getInstructionType(instructionsCopy[index]);
if (result !== keyName) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,9 @@ describe('Sol Staking Activate Builder', () => {
const rawTx = tx.toBroadcastFormat();
should.equal(Utils.isValidRawTransaction(rawTx), true);
should.equal(rawTx, testData.JITO_STAKING_ACTIVATE_SIGNED_TX);
factory.from(testData.JITO_STAKING_ACTIVATE_SIGNED_TX);
const coin = coins.get('tsol');
const tx2 = new Transaction(coin);
tx2.fromRawTransaction(rawTx);
const builderFromRawTx = factory.from(rawTx);
const rebuiltTx = await builderFromRawTx.build();
rebuiltTx.toJson().instructionsData.should.deepEqual(txJson.instructionsData);
});

it('build a create and delegate staking signed tx with memo', async () => {
Expand Down
Loading