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 packages/networks/solana/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@multiplechain/solana",
"version": "0.4.4",
"version": "0.4.5",
"type": "module",
"main": "dist/index.cjs",
"module": "dist/index.es.js",
Expand Down
20 changes: 11 additions & 9 deletions packages/networks/solana/src/models/Transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,8 @@ export class Transaction implements TransactionInterface<ParsedTransactionWithMe
const instructions = data.transaction.message.instructions as ParsedInstruction[]

return await new Promise((resolve) => {
instructions.forEach((instruction) => {
if (
instruction.programId.equals(SystemProgram.programId) &&
(instruction.parsed.type === 'createAccount' ||
instruction.parsed.type === 'transfer')
) {
resolve(TransactionTypeEnum.COIN)
} else if (instruction.programId.equals(TOKEN_2022_PROGRAM_ID)) {
instructions.forEach((instruction, index) => {
if (instruction.programId.equals(TOKEN_2022_PROGRAM_ID)) {
resolve(TransactionTypeEnum.TOKEN)
} else if (instruction.programId.equals(TOKEN_PROGRAM_ID)) {
const postBalance = data.meta?.postTokenBalances?.find(
Expand All @@ -143,7 +137,15 @@ export class Transaction implements TransactionInterface<ParsedTransactionWithMe
} else {
resolve(TransactionTypeEnum.TOKEN)
}
} else {
} else if (
instruction.programId.equals(SystemProgram.programId) &&
(instruction.parsed.type === 'createAccount' ||
instruction.parsed.type === 'transfer')
) {
resolve(TransactionTypeEnum.COIN)
}

if (index === instructions.length - 1) {
resolve(TransactionTypeEnum.CONTRACT)
}
})
Expand Down