diff --git a/packages/crypto-block/test/fixtures/block.ts b/packages/crypto-block/test/fixtures/block.ts index 9244cf539..f5d435bd3 100644 --- a/packages/crypto-block/test/fixtures/block.ts +++ b/packages/crypto-block/test/fixtures/block.ts @@ -66,7 +66,7 @@ export const blockDataWithTransactions: Contracts.Crypto.BlockData = { network: 30, nonce: BigNumber.ZERO, r: "880618343e206a7518fd970c4232440546b77d991976acb4c6a7040e10d668de", - recipientAddress: "0xbe89811e15f611c1db12e59679b6f3dc1f430155", + recipientAddress: "0xBe89811e15f611C1db12e59679b6F3DC1F430155", s: "5dd454bd405a43d530826e9223882bcb42bd9134a57e429617f15b130216bb31", senderAddress: "0xd1AD6bfA3540F25E21e6be808FB7F12562111CE5", senderPublicKey: "03dc6981461d4b82df3e7db49b20a674745cef0dc5e7165168fe26490f5a24895a", @@ -83,7 +83,7 @@ export const blockDataWithTransactions: Contracts.Crypto.BlockData = { network: 30, nonce: BigNumber.ONE, r: "9867329ee177952b05c56471d94dcf3a2fcd63b1164d1698ac50beb9793c5687", - recipientAddress: "0xbe89811e15f611c1db12e59679b6f3dc1f430155", + recipientAddress: "0xBe89811e15f611C1db12e59679b6F3DC1F430155", s: "2e27a586b3a935255d8f57eae63c97aef430f3c55a6a63db7185c0d8ff5c6a2c", senderAddress: "0xd1AD6bfA3540F25E21e6be808FB7F12562111CE5", senderPublicKey: "03dc6981461d4b82df3e7db49b20a674745cef0dc5e7165168fe26490f5a24895a", @@ -120,7 +120,7 @@ export const blockDataWithTransactionsJson: Contracts.Crypto.BlockJson = { network: 30, nonce: "0", r: "880618343e206a7518fd970c4232440546b77d991976acb4c6a7040e10d668de", - recipientAddress: "0xbe89811e15f611c1db12e59679b6f3dc1f430155", + recipientAddress: "0xBe89811e15f611C1db12e59679b6F3DC1F430155", s: "5dd454bd405a43d530826e9223882bcb42bd9134a57e429617f15b130216bb31", senderAddress: "0xd1AD6bfA3540F25E21e6be808FB7F12562111CE5", senderPublicKey: "03dc6981461d4b82df3e7db49b20a674745cef0dc5e7165168fe26490f5a24895a", @@ -137,7 +137,7 @@ export const blockDataWithTransactionsJson: Contracts.Crypto.BlockJson = { network: 30, nonce: "1", r: "9867329ee177952b05c56471d94dcf3a2fcd63b1164d1698ac50beb9793c5687", - recipientAddress: "0xbe89811e15f611c1db12e59679b6f3dc1f430155", + recipientAddress: "0xBe89811e15f611C1db12e59679b6F3DC1F430155", s: "2e27a586b3a935255d8f57eae63c97aef430f3c55a6a63db7185c0d8ff5c6a2c", senderAddress: "0xd1AD6bfA3540F25E21e6be808FB7F12562111CE5", senderPublicKey: "03dc6981461d4b82df3e7db49b20a674745cef0dc5e7165168fe26490f5a24895a", diff --git a/packages/crypto-transaction/source/deserializer.ts b/packages/crypto-transaction/source/deserializer.ts index 6e37ccb53..25a03e6fe 100644 --- a/packages/crypto-transaction/source/deserializer.ts +++ b/packages/crypto-transaction/source/deserializer.ts @@ -1,7 +1,7 @@ import { inject, injectable } from "@mainsail/container"; import { Contracts, Identifiers } from "@mainsail/contracts"; import { BigNumber } from "@mainsail/utils"; -import { decodeRlp, ethers } from "ethers"; +import { decodeRlp, ethers, getAddress } from "ethers"; @injectable() export class Deserializer implements Contracts.Crypto.TransactionDeserializer { @@ -16,11 +16,13 @@ export class Deserializer implements Contracts.Crypto.TransactionDeserializer { const decoded = decodeRlp(encodedRlp); + const recipientAddressRaw = this.#parseAddress(decoded[5].toString()); + data.network = Number(decoded[0]); data.nonce = BigNumber.make(this.#parseNumber(decoded[1].toString())); data.gasPrice = this.#parseNumber(decoded[3].toString()); data.gasLimit = this.#parseNumber(decoded[4].toString()); - data.recipientAddress = this.#parseAddress(decoded[5].toString()); + data.recipientAddress = recipientAddressRaw ? getAddress(recipientAddressRaw) : undefined; data.value = this.#parseBigNumber(decoded[6].toString()); data.data = this.#parseData(decoded[7].toString()); diff --git a/packages/test-framework/source/internal/signer.test.ts b/packages/test-framework/source/internal/signer.test.ts index 1a273ec6d..9a07300f6 100644 --- a/packages/test-framework/source/internal/signer.test.ts +++ b/packages/test-framework/source/internal/signer.test.ts @@ -100,7 +100,7 @@ describe<{ assert.defined(entity.data.v); assert.defined(entity.data.r); assert.defined(entity.data.s); - assert.equal(entity.data.recipientAddress, "0xd3d80a3df661414a76aad7738a136a8d7aaa1666"); + assert.equal(entity.data.recipientAddress, "0xD3D80a3Df661414a76aAd7738a136A8d7aAa1666"); assert.equal(entity.data.gasLimit, 21_000); assert.equal( entity.data.data,