diff --git a/.changeset/rude-flowers-tickle.md b/.changeset/rude-flowers-tickle.md new file mode 100644 index 00000000000..341e213e187 --- /dev/null +++ b/.changeset/rude-flowers-tickle.md @@ -0,0 +1,7 @@ +--- +"@fuel-ts/transactions": minor +"@fuel-ts/account": minor +"@fuel-ts/program": minor +--- + +chore!: remove receipts deprecated properties diff --git a/packages/account/src/providers/provider.test.ts b/packages/account/src/providers/provider.test.ts index 85278eb880a..49cb704f0d4 100644 --- a/packages/account/src/providers/provider.test.ts +++ b/packages/account/src/providers/provider.test.ts @@ -361,10 +361,6 @@ describe('Provider', () => { { type: ReceiptType.Log, id: ZeroBytes32, - val0: bn(202), - val1: bn(186), - val2: bn(0), - val3: bn(0), ra: bn(202), rb: bn(186), rc: bn(0), diff --git a/packages/account/src/providers/transaction-response/getDecodedLogs.ts b/packages/account/src/providers/transaction-response/getDecodedLogs.ts index bbea779d335..91bafef69c5 100644 --- a/packages/account/src/providers/transaction-response/getDecodedLogs.ts +++ b/packages/account/src/providers/transaction-response/getDecodedLogs.ts @@ -32,10 +32,10 @@ export function getDecodedLogs( const data = receipt.type === ReceiptType.Log - ? new BigNumberCoder('u64').encode(receipt.val0) + ? new BigNumberCoder('u64').encode(receipt.ra) : receipt.data; - const [decodedLog] = interfaceToUse.decodeLog(data, receipt.val1.toString()); + const [decodedLog] = interfaceToUse.decodeLog(data, receipt.rb.toString()); logs.push(decodedLog); } diff --git a/packages/account/src/providers/transaction-summary/operations.test.ts b/packages/account/src/providers/transaction-summary/operations.test.ts index b6d7cae9b70..60248d760dd 100644 --- a/packages/account/src/providers/transaction-summary/operations.test.ts +++ b/packages/account/src/providers/transaction-summary/operations.test.ts @@ -881,7 +881,6 @@ describe('operations', () => { const expected: TransactionResultTransferOutReceipt = { amount: bn('0x5f5e100'), assetId: '0x0000000000000000000000000000000000000000000000000000000000000000', - from: '0x0a98320d39c03337401a4e46263972a9af6ce69ec2f35a5420b1bd35784c74b1', id: '0x0a98320d39c03337401a4e46263972a9af6ce69ec2f35a5420b1bd35784c74b1', is: bn('0x4370'), pc: bn('0x57dc'), diff --git a/packages/account/src/providers/transaction-summary/operations.ts b/packages/account/src/providers/transaction-summary/operations.ts index e47e3f17cc1..89fc5bc20c9 100644 --- a/packages/account/src/providers/transaction-summary/operations.ts +++ b/packages/account/src/providers/transaction-summary/operations.ts @@ -389,7 +389,7 @@ function extractTransferOperationFromReceipt( changeOutputs: OutputChange[] ) { const { to: toAddress, assetId, amount } = receipt; - let { from: fromAddress } = receipt; + let { id: fromAddress } = receipt; const toType = contractInputs.some((input) => input.contractID === toAddress) ? AddressType.contract diff --git a/packages/account/src/providers/utils/receipts.test.ts b/packages/account/src/providers/utils/receipts.test.ts index a4442148e52..b6f31bc00c0 100644 --- a/packages/account/src/providers/utils/receipts.test.ts +++ b/packages/account/src/providers/utils/receipts.test.ts @@ -37,7 +37,7 @@ describe('assembleReceiptByType', () => { expect(receipt.type).toBe(ReceiptType.Call); expect(receipt.assetId).toStrictEqual(MOCK_GQL_RECEIPT_FRAGMENT.assetId); - expect(receipt.from).toStrictEqual(MOCK_GQL_RECEIPT_FRAGMENT.contractId); + expect(receipt.id).toStrictEqual(MOCK_GQL_RECEIPT_FRAGMENT.contractId); expect(receipt.to).toStrictEqual(MOCK_GQL_RECEIPT_FRAGMENT.to); expect(receipt.amount).toStrictEqual(new BN(MOCK_GQL_RECEIPT_FRAGMENT.amount)); expect(receipt.gas).toStrictEqual(new BN(MOCK_GQL_RECEIPT_FRAGMENT.gas)); @@ -113,10 +113,10 @@ describe('assembleReceiptByType', () => { expect(receipt.id).toStrictEqual(MOCK_GQL_RECEIPT_FRAGMENT.contractId); expect(receipt.is).toStrictEqual(new BN(MOCK_GQL_RECEIPT_FRAGMENT.is)); expect(receipt.pc).toStrictEqual(new BN(MOCK_GQL_RECEIPT_FRAGMENT.pc)); - expect(receipt.val0).toStrictEqual(new BN(MOCK_GQL_RECEIPT_FRAGMENT.ra)); - expect(receipt.val1).toStrictEqual(new BN(MOCK_GQL_RECEIPT_FRAGMENT.rb)); - expect(receipt.val2).toStrictEqual(new BN(MOCK_GQL_RECEIPT_FRAGMENT.rc)); - expect(receipt.val3).toStrictEqual(new BN(MOCK_GQL_RECEIPT_FRAGMENT.rd)); + expect(receipt.ra).toStrictEqual(new BN(MOCK_GQL_RECEIPT_FRAGMENT.ra)); + expect(receipt.rb).toStrictEqual(new BN(MOCK_GQL_RECEIPT_FRAGMENT.rb)); + expect(receipt.rc).toStrictEqual(new BN(MOCK_GQL_RECEIPT_FRAGMENT.rc)); + expect(receipt.rd).toStrictEqual(new BN(MOCK_GQL_RECEIPT_FRAGMENT.rd)); }); it('should return a ReceiptLogData receipt when GqlReceiptType.LogData is provided', () => { @@ -132,8 +132,8 @@ describe('assembleReceiptByType', () => { expect(receipt.pc).toStrictEqual(new BN(MOCK_GQL_RECEIPT_FRAGMENT.pc)); expect(receipt.ptr).toStrictEqual(new BN(MOCK_GQL_RECEIPT_FRAGMENT.ptr)); expect(receipt.len).toStrictEqual(new BN(MOCK_GQL_RECEIPT_FRAGMENT.len)); - expect(receipt.val0).toStrictEqual(new BN(MOCK_GQL_RECEIPT_FRAGMENT.ra)); - expect(receipt.val1).toStrictEqual(new BN(MOCK_GQL_RECEIPT_FRAGMENT.rb)); + expect(receipt.ra).toStrictEqual(new BN(MOCK_GQL_RECEIPT_FRAGMENT.ra)); + expect(receipt.rb).toStrictEqual(new BN(MOCK_GQL_RECEIPT_FRAGMENT.rb)); expect(receipt.data).toStrictEqual(MOCK_GQL_RECEIPT_FRAGMENT.data); }); @@ -144,7 +144,7 @@ describe('assembleReceiptByType', () => { }) as ReceiptTransfer; expect(receipt.type).toBe(ReceiptType.Transfer); - expect(receipt.from).toStrictEqual(MOCK_GQL_RECEIPT_FRAGMENT.contractId); + expect(receipt.id).toStrictEqual(MOCK_GQL_RECEIPT_FRAGMENT.contractId); expect(receipt.to).toStrictEqual(MOCK_GQL_RECEIPT_FRAGMENT.to); expect(receipt.assetId).toStrictEqual(MOCK_GQL_RECEIPT_FRAGMENT.assetId); expect(receipt.is).toStrictEqual(new BN(MOCK_GQL_RECEIPT_FRAGMENT.is)); @@ -159,7 +159,7 @@ describe('assembleReceiptByType', () => { }) as ReceiptTransferOut; expect(receipt.type).toBe(ReceiptType.TransferOut); - expect(receipt.from).toStrictEqual(MOCK_GQL_RECEIPT_FRAGMENT_TO_ADDRESS.contractId); + expect(receipt.id).toStrictEqual(MOCK_GQL_RECEIPT_FRAGMENT_TO_ADDRESS.contractId); expect(receipt.to).toStrictEqual(MOCK_GQL_RECEIPT_FRAGMENT_TO_ADDRESS.toAddress); expect(receipt.assetId).toStrictEqual(MOCK_GQL_RECEIPT_FRAGMENT_TO_ADDRESS.assetId); expect(receipt.is).toStrictEqual(new BN(MOCK_GQL_RECEIPT_FRAGMENT_TO_ADDRESS.is)); @@ -174,7 +174,7 @@ describe('assembleReceiptByType', () => { }) as ReceiptTransferOut; expect(receipt.type).toBe(ReceiptType.TransferOut); - expect(receipt.from).toStrictEqual(MOCK_GQL_RECEIPT_FRAGMENT.contractId); + expect(receipt.id).toStrictEqual(MOCK_GQL_RECEIPT_FRAGMENT.contractId); expect(receipt.to).toStrictEqual(MOCK_GQL_RECEIPT_FRAGMENT.to); expect(receipt.assetId).toStrictEqual(MOCK_GQL_RECEIPT_FRAGMENT.assetId); expect(receipt.is).toStrictEqual(new BN(MOCK_GQL_RECEIPT_FRAGMENT.is)); @@ -189,7 +189,7 @@ describe('assembleReceiptByType', () => { }) as ReceiptTransferOut; expect(receipt.type).toBe(ReceiptType.TransferOut); - expect(receipt.from).toStrictEqual(MOCK_GQL_RECEIPT_FRAGMENT_TO_ADDRESS.contractId); + expect(receipt.id).toStrictEqual(MOCK_GQL_RECEIPT_FRAGMENT_TO_ADDRESS.contractId); expect(receipt.to).toStrictEqual(MOCK_GQL_RECEIPT_FRAGMENT_TO_ADDRESS.toAddress); expect(receipt.assetId).toStrictEqual(MOCK_GQL_RECEIPT_FRAGMENT_TO_ADDRESS.assetId); expect(receipt.is).toStrictEqual(new BN(MOCK_GQL_RECEIPT_FRAGMENT_TO_ADDRESS.is)); diff --git a/packages/account/src/providers/utils/receipts.ts b/packages/account/src/providers/utils/receipts.ts index f2cd9deacf7..faa667023eb 100644 --- a/packages/account/src/providers/utils/receipts.ts +++ b/packages/account/src/providers/utils/receipts.ts @@ -70,7 +70,6 @@ export function assembleReceiptByType(receipt: GqlReceiptFragment) { const callReceipt: ReceiptCall = { type: ReceiptType.Call, id, - from: id, to: hexOrZero(receipt?.to), amount: bn(receipt.amount), assetId: hexOrZero(receipt.assetId), @@ -148,10 +147,6 @@ export function assembleReceiptByType(receipt: GqlReceiptFragment) { rb, rc, rd, - val0: ra, - val1: rb, - val2: rc, - val3: rd, pc: bn(receipt.pc), is: bn(receipt.is), }; @@ -167,8 +162,6 @@ export function assembleReceiptByType(receipt: GqlReceiptFragment) { id: hexOrZero(receipt.id || receipt.contractId), ra, rb, - val0: ra, - val1: rb, ptr: bn(receipt.ptr), len: bn(receipt.len), digest: hexOrZero(receipt.digest), @@ -184,7 +177,6 @@ export function assembleReceiptByType(receipt: GqlReceiptFragment) { const transferReceipt: ReceiptTransfer = { type: ReceiptType.Transfer, id, - from: id, to: hexOrZero(receipt.toAddress || receipt?.to), amount: bn(receipt.amount), assetId: hexOrZero(receipt.assetId), @@ -200,7 +192,6 @@ export function assembleReceiptByType(receipt: GqlReceiptFragment) { const transferOutReceipt: ReceiptTransferOut = { type: ReceiptType.TransferOut, id, - from: id, to: hexOrZero(receipt.toAddress || receipt.to), amount: bn(receipt.amount), assetId: hexOrZero(receipt.assetId), diff --git a/packages/account/test/fixtures/transaction-summary.ts b/packages/account/test/fixtures/transaction-summary.ts index 9ed7e2bd689..9b3b79cbc02 100644 --- a/packages/account/test/fixtures/transaction-summary.ts +++ b/packages/account/test/fixtures/transaction-summary.ts @@ -108,7 +108,6 @@ export const MOCK_OUTPUT_CONTRACT_CREATED: OutputContractCreated = { export const MOCK_RECEIPT_CALL: TransactionResultCallReceipt = { type: ReceiptType.Call, - from: '0x0000000000000000000000000000000000000000000000000000000000000000', id: '0x0000000000000000000000000000000000000000000000000000000000000000', to: '0x0a98320d39c03337401a4e46263972a9af6ce69ec2f35a5420b1bd35784c74b1', amount: bn(100000000), @@ -131,7 +130,6 @@ export const MOCK_RECEIPT_RETURN: TransactionResultReturnReceipt = { export const MOCK_RECEIPT_TRANSFER: TransactionResultTransferReceipt = { type: ReceiptType.Transfer, id: '0x0000000000000000000000000000000000000000000000000000000000000000', - from: '0x0000000000000000000000000000000000000000000000000000000000000000', to: '0xaab4884920fa4d3a35fc2977cc442b0caddf87e001ef62321b6c02f5ab0f4115', amount: bn(988), assetId: '0x0000000000000000000000000000000000000000000000000000000000000000', @@ -142,7 +140,6 @@ export const MOCK_RECEIPT_TRANSFER: TransactionResultTransferReceipt = { export const MOCK_RECEIPT_TRANSFER_OUT: TransactionResultTransferOutReceipt = { type: ReceiptType.TransferOut, id: '0x0a98320d39c03337401a4e46263972a9af6ce69ec2f35a5420b1bd35784c74b1', - from: '0x0a98320d39c03337401a4e46263972a9af6ce69ec2f35a5420b1bd35784c74b1', to: '0x3e7ddda4d0d3f8307ae5f1aed87623992c1c4decefec684936960775181b2302', amount: bn(100000000), assetId: '0x0000000000000000000000000000000000000000000000000000000000000000', diff --git a/packages/program/src/contract-call-script.ts b/packages/program/src/contract-call-script.ts index 1d892d65c77..b518d3d6fdf 100644 --- a/packages/program/src/contract-call-script.ts +++ b/packages/program/src/contract-call-script.ts @@ -103,8 +103,8 @@ const getMainCallReceipt = ( contractId: string ): TransactionResultCallReceipt | undefined => receipts.find( - ({ type, from, to }) => - type === ReceiptType.Call && from === SCRIPT_WRAPPER_CONTRACT_ID && to === contractId + ({ type, id, to }) => + type === ReceiptType.Call && id === SCRIPT_WRAPPER_CONTRACT_ID && to === contractId ); const scriptResultDecoder = (contractId: AbstractAddress) => (result: ScriptResult) => { diff --git a/packages/transactions/src/receipt.ts b/packages/transactions/src/receipt.ts index e8b76ed0eb6..2faa336927f 100644 --- a/packages/transactions/src/receipt.ts +++ b/packages/transactions/src/receipt.ts @@ -24,10 +24,6 @@ export enum ReceiptType /* u8 */ { export type ReceiptCall = { type: ReceiptType.Call; - /** - * @deprecated This property is deprecated and it will be removed soon. Use property `id` instead. - */ - from: string; /** Contract ID of current context if in an internal context, zero otherwise (b256) */ id: string; /** Contract ID of called contract (b256) */ @@ -108,28 +104,12 @@ export type ReceiptLog = { type: ReceiptType.Log; /** Contract ID of current context if in an internal context, zero otherwise (b256) */ id: string; - /** - * @deprecated This property is deprecated and it will be removed soon. Use property `ra` instead. - */ - val0: BN; /** Value of register $rA (u64) */ ra: BN; - /** - * @deprecated This property is deprecated and it will be removed soon. Use property `rb` instead. - */ - val1: BN; /** Value of register $rB (u64) */ rb: BN; - /** - * @deprecated This property is deprecated and it will be removed soon. Use property `rc` instead. - */ - val2: BN; /** Value of register $rC (u64) */ rc: BN; - /** - * @deprecated This property is deprecated and it will be removed soon. Use property `rd` instead. - */ - val3: BN; /** Value of register $rD (u64) */ rd: BN; /** Value of register $pc (u64) */ @@ -144,16 +124,8 @@ export type ReceiptLogData = { id: string; /** Value of register $rA (u64) */ ra: BN; - /** - * @deprecated This property is deprecated and it will be removed soon. Use property `ra` instead. - */ - val0: BN; /** Value of register $rB (u64) */ rb: BN; - /** - * @deprecated This property is deprecated and it will be removed soon. Use property `rb` instead. - */ - val1: BN; /** Value of register $rC (u64) */ ptr: BN; /** Value of register $rD (u64) */ @@ -170,10 +142,6 @@ export type ReceiptLogData = { export type ReceiptTransfer = { type: ReceiptType.Transfer; - /** - * @deprecated This property is deprecated and it will be removed soon. Use property `id` instead. - */ - from: string; /** Contract ID of current context if in an internal context, zero otherwise (b256) */ id: string; /** Contract ID of contract to transfer coins to (b256) */ @@ -190,10 +158,6 @@ export type ReceiptTransfer = { export type ReceiptTransferOut = { type: ReceiptType.TransferOut; - /** - * @deprecated This property is deprecated and it will be removed soon. Use property `id` instead. - */ - from: string; /** Contract ID of current context if in an internal context, zero otherwise (b256) */ id: string; /** Address to transfer coins to (b256) */