[Blockchain Watcher] (EVM and SOLANA) Map fee value for evm and solana (#1518)
* Map fee value for evm and solana * Resolve test --------- Co-authored-by: julian merlo <julianmerlo@julians-MacBook-Pro-2.local>
This commit is contained in:
parent
5eec936372
commit
f9ff45d278
|
@ -65,12 +65,14 @@ export function populateTransaction(
|
|||
populatedTransactions: EvmTransaction[]
|
||||
) {
|
||||
filterTransactions.forEach((transaction) => {
|
||||
transaction.status = transactionReceipts[transaction.hash].status;
|
||||
transaction.effectiveGasPrice = transactionReceipts[transaction.hash].effectiveGasPrice;
|
||||
transaction.gasUsed = transactionReceipts[transaction.hash].gasUsed;
|
||||
transaction.timestamp = evmBlocks[transaction.blockHash].timestamp;
|
||||
transaction.status = transactionReceipts[transaction.hash].status;
|
||||
transaction.logs = transactionReceipts[transaction.hash].logs;
|
||||
transaction.environment = opts.environment;
|
||||
transaction.chainId = opts.chainId;
|
||||
transaction.chain = opts.chain;
|
||||
transaction.logs = transactionReceipts[transaction.hash].logs;
|
||||
populatedTransactions.push(transaction);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -59,6 +59,9 @@ export class PollSolanaTransactions extends RunPollingJob {
|
|||
);
|
||||
return [];
|
||||
}
|
||||
this.logger.info(
|
||||
`[get][exec] Processing blocks [fromSlot: ${range.fromSlot} - toSlot: ${range.toSlot}]`
|
||||
);
|
||||
|
||||
let fromBlock = await this.findValidBlock(range.fromSlot, (slot) => slot + 1);
|
||||
let toBlock = await this.findValidBlock(range.toSlot, (slot) => slot - 1);
|
||||
|
|
|
@ -84,6 +84,8 @@ export type EvmTransactionFoundAttributes = TransactionFoundAttributes & {
|
|||
v: string;
|
||||
value: string;
|
||||
protocol: string;
|
||||
gasUsed: string;
|
||||
effectiveGasPrice: string;
|
||||
};
|
||||
|
||||
export type InstructionFound = {
|
||||
|
@ -93,6 +95,7 @@ export type InstructionFound = {
|
|||
emitterAddress: string;
|
||||
sequence: number;
|
||||
protocol: string;
|
||||
fee: number | undefined;
|
||||
};
|
||||
|
||||
export enum TxStatus {
|
||||
|
|
|
@ -44,6 +44,8 @@ export type EvmTransaction = {
|
|||
environment: string;
|
||||
chain: string;
|
||||
logs: EvmTransactionLog[];
|
||||
gasUsed: string;
|
||||
effectiveGasPrice: string;
|
||||
};
|
||||
|
||||
export type EvmTransactionLog = { address: string; topics: string[]; data: string };
|
||||
|
@ -61,4 +63,6 @@ export type ReceiptTransaction = {
|
|||
status: string;
|
||||
transactionHash: string;
|
||||
logs: EvmTransactionLog[];
|
||||
gasUsed: string;
|
||||
effectiveGasPrice: string;
|
||||
};
|
||||
|
|
|
@ -8,6 +8,7 @@ export type Transaction = {
|
|||
};
|
||||
meta?: {
|
||||
innerInstructions?: CompiledInnerInstruction[] | null;
|
||||
fee: number;
|
||||
err?: {} | string | null;
|
||||
};
|
||||
blockTime?: number | null;
|
||||
|
|
|
@ -68,6 +68,8 @@ export const evmRedeemedTransactionFoundMapper = (
|
|||
gasPrice: transaction.gasPrice,
|
||||
maxFeePerGas: transaction.maxFeePerGas,
|
||||
maxPriorityFeePerGas: transaction.maxPriorityFeePerGas,
|
||||
gasUsed: transaction.gasUsed,
|
||||
effectiveGasPrice: transaction.effectiveGasPrice,
|
||||
nonce: transaction.nonce,
|
||||
r: transaction.r,
|
||||
s: transaction.s,
|
||||
|
|
|
@ -92,6 +92,7 @@ const processProgram = async (
|
|||
emitterAddress: emitterAddress.toString("hex"),
|
||||
sequence: Number(sequence),
|
||||
protocol: protocolType,
|
||||
fee: transaction.meta?.fee,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
|
@ -304,8 +304,10 @@ export class EvmJsonRPCBlockRepository implements EvmBlockRepository {
|
|||
.map((response) => {
|
||||
if (response.result?.status && response.result?.transactionHash) {
|
||||
return {
|
||||
status: response.result.status,
|
||||
effectiveGasPrice: response.result.effectiveGasPrice,
|
||||
transactionHash: response.result.transactionHash,
|
||||
gasUsed: response.result.gasUsed,
|
||||
status: response.result.status,
|
||||
logs: response.result.logs,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -315,8 +315,10 @@ const givenEvmBlockRepository = (
|
|||
.flat()
|
||||
.reduce((acc, tx) => {
|
||||
acc[tx.hash] = {
|
||||
status: "0x1",
|
||||
effectiveGasPrice: tx.effectiveGasPrice,
|
||||
transactionHash: tx.hash,
|
||||
gasUsed: tx.gasUsed,
|
||||
status: "0x1",
|
||||
logs: tx.logs,
|
||||
};
|
||||
return acc;
|
||||
|
@ -453,6 +455,8 @@ class TxBuilder {
|
|||
data: "0x0",
|
||||
},
|
||||
],
|
||||
gasUsed: "0x6efa0",
|
||||
effectiveGasPrice: "0x2fb1471cd",
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,6 +131,8 @@ const givenEvmBlockRepository = (height?: bigint, blocksAhead?: bigint) => {
|
|||
receiptResponse[`0x0${index}`] = {
|
||||
status: "0x1",
|
||||
transactionHash: `0x0${index}`,
|
||||
gasUsed: "0x6efa0",
|
||||
effectiveGasPrice: "0x2fb1471cd",
|
||||
logs: [
|
||||
{
|
||||
address: "0xf890982f9310df57d00f659cf4fd87e65aded8d7",
|
||||
|
|
|
@ -64,6 +64,8 @@ describe("evmRedeemedTransactionFoundMapper", () => {
|
|||
data: "0x",
|
||||
},
|
||||
],
|
||||
gasUsed: "0x6efa0",
|
||||
effectiveGasPrice: "0x2fb1471cd",
|
||||
},
|
||||
]);
|
||||
|
||||
|
@ -110,6 +112,8 @@ describe("evmRedeemedTransactionFoundMapper", () => {
|
|||
data: "0x",
|
||||
},
|
||||
],
|
||||
gasUsed: "0x6efa0",
|
||||
effectiveGasPrice: "0x2fb1471cd",
|
||||
},
|
||||
]);
|
||||
|
||||
|
@ -185,6 +189,8 @@ describe("evmRedeemedTransactionFoundMapper", () => {
|
|||
data: "0x00000000000000000000000000000000000000000000000000470de4df820000",
|
||||
},
|
||||
],
|
||||
gasUsed: "0x6efa0",
|
||||
effectiveGasPrice: "0x2fb1471cd",
|
||||
},
|
||||
]);
|
||||
|
||||
|
@ -266,6 +272,8 @@ describe("evmRedeemedTransactionFoundMapper", () => {
|
|||
timestamp: Date.now(),
|
||||
environment: "testnet",
|
||||
chain: "arbitrum-sepolia",
|
||||
gasUsed: "0x6efa0",
|
||||
effectiveGasPrice: "0x2fb1471cd",
|
||||
},
|
||||
]);
|
||||
|
||||
|
@ -320,6 +328,8 @@ describe("evmRedeemedTransactionFoundMapper", () => {
|
|||
data: "0x",
|
||||
},
|
||||
],
|
||||
gasUsed: "0x6efa0",
|
||||
effectiveGasPrice: "0x2fb1471cd",
|
||||
},
|
||||
]);
|
||||
|
||||
|
@ -365,6 +375,8 @@ describe("evmRedeemedTransactionFoundMapper", () => {
|
|||
data: "0x00000000000000000000000000000000000000000000000000000004b2cb597d",
|
||||
},
|
||||
],
|
||||
gasUsed: "0x6efa0",
|
||||
effectiveGasPrice: "0x2fb1471cd",
|
||||
},
|
||||
]);
|
||||
|
||||
|
@ -448,6 +460,8 @@ describe("evmRedeemedTransactionFoundMapper", () => {
|
|||
],
|
||||
},
|
||||
],
|
||||
gasUsed: "0x6efa0",
|
||||
effectiveGasPrice: "0x2fb1471cd",
|
||||
},
|
||||
]);
|
||||
|
||||
|
|
Loading…
Reference in New Issue