diff --git a/src/networkProviders/providers.dev.net.spec.ts b/src/networkProviders/providers.dev.net.spec.ts index 3c5a09e7..4a7760d1 100644 --- a/src/networkProviders/providers.dev.net.spec.ts +++ b/src/networkProviders/providers.dev.net.spec.ts @@ -274,12 +274,18 @@ describe("test network providers on devnet: Proxy and API", function () { ) { // Proxy and API exhibit differences in the "function" field, in case of move-balance transactions. apiResponse.function = proxyResponse.function; - + apiResponse.raw = {}; + apiResponse.smartContractResults.map((x) => (x.raw = {})); + apiResponse.smartContractResults.map((x) => x.logs.events.map((e) => (e.raw = {}))); + apiResponse.logs.events.map((e) => (e.raw = {})); // Ignore fields which are not present on API response: proxyResponse.epoch = 0; - proxyResponse.blockNonce = 0; - proxyResponse.hyperblockNonce = 0; - proxyResponse.hyperblockHash = ""; + proxyResponse.blockHash = ""; + proxyResponse.miniblockHash = ""; + proxyResponse.raw = {}; + proxyResponse.smartContractResults.map((x) => (x.raw = {})); + proxyResponse.smartContractResults.map((x) => x.logs.events.map((e) => (e.raw = {}))); + proxyResponse.logs.events.map((e) => (e.raw = {})); } it("should have the same response for transactions with events", async function () { diff --git a/src/smartContracts/smartContractTransactionsOutcomeParser.spec.ts b/src/smartContracts/smartContractTransactionsOutcomeParser.spec.ts index 1f1b151d..b835dbf6 100644 --- a/src/smartContracts/smartContractTransactionsOutcomeParser.spec.ts +++ b/src/smartContracts/smartContractTransactionsOutcomeParser.spec.ts @@ -17,7 +17,7 @@ describe("test smart contract transactions outcome parser", () => { const parser = new SmartContractTransactionsOutcomeParser(); const transactionOnNetwork = new TransactionOnNetwork({ - nonce: 7, + nonce: 7n, logs: new TransactionLogs({ events: [ new TransactionEvent({ @@ -52,7 +52,7 @@ describe("test smart contract transactions outcome parser", () => { const parser = new SmartContractTransactionsOutcomeParser(); const transactionOnNetwork = new TransactionOnNetwork({ - nonce: 7, + nonce: 7n, logs: new TransactionLogs({ events: [ new TransactionEvent({ @@ -77,7 +77,7 @@ describe("test smart contract transactions outcome parser", () => { it("parses execute outcome, without ABI", function () { const parser = new SmartContractTransactionsOutcomeParser(); const transactionOnNetwork = new TransactionOnNetwork({ - nonce: 7, + nonce: 7n, smartContractResults: [new SmartContractResult({ data: Buffer.from("@6f6b@2a") })], }); @@ -94,7 +94,7 @@ describe("test smart contract transactions outcome parser", () => { }); const transactionOnNetwork = new TransactionOnNetwork({ - nonce: 7, + nonce: 7n, function: "getUltimateAnswer", smartContractResults: [new SmartContractResult({ data: Buffer.from("@6f6b@2a") })], }); @@ -113,7 +113,7 @@ describe("test smart contract transactions outcome parser", () => { }); const transactionOnNetwork = new TransactionOnNetwork({ - nonce: 7, + nonce: 7n, smartContractResults: [new SmartContractResult({ data: Buffer.from("@6f6b@2a") })], }); diff --git a/src/transactionEvents.ts b/src/transactionEvents.ts index 5aadce52..48df23cc 100644 --- a/src/transactionEvents.ts +++ b/src/transactionEvents.ts @@ -1,6 +1,7 @@ import { Address } from "./address"; export class TransactionEvent { + raw: Record = {}; address: Address = Address.empty(); identifier: string = ""; topics: Uint8Array[] = []; @@ -25,8 +26,8 @@ export class TransactionEvent { result.topics = (responsePart.topics || []).map((topic) => Buffer.from(topic, "base64")); result.data = Buffer.from(responsePart.data ?? "", "base64"); - result.additionalData = (responsePart.additionalData || []).map((data) => Buffer.from(data, "base64")); + result.raw = responsePart; return result; } diff --git a/src/transactionOnNetwork.ts b/src/transactionOnNetwork.ts index 0e7b4f49..ebb81f2c 100644 --- a/src/transactionOnNetwork.ts +++ b/src/transactionOnNetwork.ts @@ -32,26 +32,29 @@ export function prepareTransactionForBroadcasting(transaction: Transaction): any } export class TransactionOnNetwork { + raw: Record = {}; isCompleted?: boolean; hash: string = ""; type: string = ""; - nonce: number = 0; - round: number = 0; + nonce: bigint = 0n; + round: bigint = 0n; epoch: number = 0; - value: string = ""; + value: bigint = 0n; receiver: Address = Address.empty(); sender: Address = Address.empty(); - gasLimit: number = 0; - gasPrice: number = 0; + senderShard: number = 0; + receiverShard: number = 0; + gasLimit: bigint = 0n; + gasPrice: bigint = 0n; function: string = ""; data: Buffer = Buffer.from([]); + version: number = 0; + options: number = 0; signature: string = ""; status: TransactionStatus = TransactionStatus.createUnknown(); timestamp: number = 0; - - blockNonce: number = 0; - hyperblockNonce: number = 0; - hyperblockHash: string = ""; + miniblockHash: string = ""; + blockHash: string = ""; smartContractResults: SmartContractResult[] = []; logs: TransactionLogs = new TransactionLogs(); @@ -105,23 +108,25 @@ export class TransactionOnNetwork { let result = new TransactionOnNetwork(); result.hash = txHash; result.type = response.type || ""; - result.nonce = response.nonce || 0; - result.round = response.round; + result.nonce = BigInt(response.nonce || 0); + result.round = BigInt(response.round || 0); result.epoch = response.epoch || 0; - result.value = (response.value || 0).toString(); + result.value = BigInt((response.value || 0).toString()); result.sender = new Address(response.sender); result.receiver = new Address(response.receiver); - result.gasPrice = response.gasPrice || 0; - result.gasLimit = response.gasLimit || 0; + result.gasPrice = BigInt(response.gasPrice) || 0n; + result.gasLimit = BigInt(response.gasLimit) || 0n; result.function = response.function || ""; result.data = Buffer.from(response.data || "", "base64"); + result.version = response.version || 1; + result.options = response.options || 0; + result.data = Buffer.from(response.data || "", "base64"); result.status = new TransactionStatus(response.status); result.timestamp = response.timestamp || 0; - - result.blockNonce = response.blockNonce || 0; - result.hyperblockNonce = response.hyperblockNonce || 0; - result.hyperblockHash = response.hyperblockHash || ""; + result.miniblockHash = response.miniblockHash || ""; + result.blockHash = response.blockHash || ""; result.logs = TransactionLogs.fromHttpResponse(response.logs || {}); + // result.raw = response; return result; } diff --git a/src/transactionsOutcomeParsers/transactionEventsParser.spec.ts b/src/transactionsOutcomeParsers/transactionEventsParser.spec.ts index d5fb21d2..5770853a 100644 --- a/src/transactionsOutcomeParsers/transactionEventsParser.spec.ts +++ b/src/transactionsOutcomeParsers/transactionEventsParser.spec.ts @@ -42,7 +42,7 @@ describe("test transaction events parser", () => { }); const transactionOnNetwork = new TransactionOnNetwork({ - nonce: 7, + nonce: 7n, smartContractResults: [ new SmartContractResult({ data: Buffer.from("@6f6b"), @@ -92,7 +92,7 @@ describe("test transaction events parser", () => { }); const transactionOnNetwork = new TransactionOnNetwork({ - nonce: 7, + nonce: 7n, smartContractResults: [new SmartContractResult({ data: Buffer.from("@6f6b") })], logs: new TransactionLogs({ events: [