[Blockchain Watcher] (FIX - SOLANA) Map config for solana (#1331)

Map config for solana

Co-authored-by: julian merlo <julianmerlo@julians-MacBook-Pro.local>
This commit is contained in:
Julian 2024-04-18 18:04:02 -03:00 committed by GitHub
parent 10df6821c0
commit 2686bea37e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 26 additions and 13 deletions

View File

@ -50,8 +50,12 @@
"type": "NFT",
"methods": [
{
"methodId": "0xc6878519",
"method": "MethodCompleteTransfer"
"methodId": "02",
"method": "completeNativeInstruction"
},
{
"methodId": "03",
"method": "completeWrappedInstruction"
}
]
}

View File

@ -16,16 +16,6 @@ const SOLANA_CHAIN = "solana";
const connection = new Connection(configuration.chains.solana.rpcs[0]);
export interface ProgramParams {
instructions: string[];
vaaAccountIndex: number;
}
export type SolanaTransferRedeemedMapperOpts = {
programs: Record<string, ProgramParams>;
commitment?: Commitment;
};
export const solanaTransferRedeemedMapper = async (
transaction: solana.Transaction,
{ programs, commitment }: SolanaTransferRedeemedMapperOpts
@ -79,12 +69,13 @@ const processProgram = async (
const { sequence, emitterAddress, emitterChain } = message || {};
const txHash = transaction.transaction.signatures[0];
const protocol = findProtocol(SOLANA_CHAIN, programId, hexData, txHash);
const protocolMethod = protocol?.method ?? "unknown";
const protocolType = protocol?.type ?? "unknown";
logger.debug(
`[${chain}}] Redeemed transaction info: [hash: ${txHash}][VAA: ${emitterChain}/${emitterAddress.toString(
"hex"
)}/${sequence}][protocol: ${protocolType}]`
)}/${sequence}][protocol: ${protocolType}/${protocolMethod}]`
);
results.push({
@ -126,3 +117,13 @@ const normalizeCompileInstruction = (
return instruction;
}
};
export interface ProgramParams {
instructions: string[];
vaaAccountIndex: number;
}
export type SolanaTransferRedeemedMapperOpts = {
programs: Record<string, ProgramParams>;
commitment?: Commitment;
};

View File

@ -70,6 +70,10 @@ data:
"nTTh3bZ5Aer6xboWZe39RDEft4MeVxSQ8D1EYAVLZw9": {
"instructions": ["86d58f44eb66e860"],
"vaaAccountIndex": 3
},
"2rHhojZ7hpu1zA91nvZmT8TqWWvMcKmmNBCr2mKTtMq4": {
"instructions": ["02", "03"],
"vaaAccountIndex": 2
}
},
"metricName": "process_vaa_event"
@ -109,6 +113,10 @@ data:
"wormDTUJ6AWPNvk59vGQbDvGJmqbDTdgWgAqcLBCgUb": {
"instructions": ["02", "03", "09", "0a"],
"vaaAccountIndex": 2
},
"WnFt12ZrnzZrFZkt2xsNsaNWoQribnuQ5B5FrDbwDhD": {
"instructions": ["02", "03"],
"vaaAccountIndex": 2
}
},
"metricName": "process_vaa_event"