diff --git a/.changeset/cold-sheep-reflect.md b/.changeset/cold-sheep-reflect.md deleted file mode 100644 index 1935a90f8fa..00000000000 --- a/.changeset/cold-sheep-reflect.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -"@fuel-ts/abi-coder": minor -"@fuel-ts/contract": minor ---- - -Add support to flat abi on interface diff --git a/.changeset/curvy-bears-tell.md b/.changeset/curvy-bears-tell.md deleted file mode 100644 index f04cf63ed34..00000000000 --- a/.changeset/curvy-bears-tell.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -"@fuel-ts/contract": minor -"@fuel-ts/script": minor ---- - -Failures now output the reason diff --git a/.changeset/eight-baboons-repeat.md b/.changeset/eight-baboons-repeat.md deleted file mode 100644 index 2453bdd5482..00000000000 --- a/.changeset/eight-baboons-repeat.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@fuel-ts/wallet-manager": minor ---- - -Change default derivation from non-hardened to hardened address. And add custom derive path config. diff --git a/.changeset/tidy-parrots-care.md b/.changeset/tidy-parrots-care.md deleted file mode 100644 index 03777dfa9ad..00000000000 --- a/.changeset/tidy-parrots-care.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -"@fuel-ts/providers": minor -"@fuel-ts/wallet": minor ---- - -Add `excludeId` to getCoinsToSpend diff --git a/.changeset/weak-dancers-tell.md b/.changeset/weak-dancers-tell.md deleted file mode 100644 index 13c31f50fc2..00000000000 --- a/.changeset/weak-dancers-tell.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -"@fuel-ts/abi-coder": patch -"@fuel-ts/contract": patch ---- - -add option type improvement diff --git a/packages/abi-coder/CHANGELOG.md b/packages/abi-coder/CHANGELOG.md index e67a8a550ae..10b8038a03b 100644 --- a/packages/abi-coder/CHANGELOG.md +++ b/packages/abi-coder/CHANGELOG.md @@ -1,5 +1,20 @@ # Change Log +## 0.13.0 + +### Minor Changes + +- [#466](https://github.com/FuelLabs/fuels-ts/pull/466) [`745e65b`](https://github.com/FuelLabs/fuels-ts/commit/745e65bc563ab8cace6f73e2715a6eaaae93fda5) Thanks [@luizstacio](https://github.com/luizstacio)! - Add support to flat abi on interface + +* [#458](https://github.com/FuelLabs/fuels-ts/pull/458) [`9190cee`](https://github.com/FuelLabs/fuels-ts/commit/9190cee45529b6c3fcffb2a12b1ef6319b2b39df) Thanks [@LuizAsFight](https://github.com/LuizAsFight)! - Upgrade compatibility to fuel-core v0.10.1 + +### Patch Changes + +- [#471](https://github.com/FuelLabs/fuels-ts/pull/471) [`dfb2612`](https://github.com/FuelLabs/fuels-ts/commit/dfb261222c17cf6f158f475d91b3414996300066) Thanks [@camsjams](https://github.com/camsjams)! - add option type improvement + +- Updated dependencies []: + - @fuel-ts/math@0.13.0 + ## 0.12.0 ### Minor Changes diff --git a/packages/abi-coder/package.json b/packages/abi-coder/package.json index b7c96303441..eca55aff4d2 100644 --- a/packages/abi-coder/package.json +++ b/packages/abi-coder/package.json @@ -1,6 +1,6 @@ { "name": "@fuel-ts/abi-coder", - "version": "0.12.0", + "version": "0.13.0", "description": "", "author": "Fuel Labs (https://fuel.network/)", "typedocMain": "src/index.ts", diff --git a/packages/address/CHANGELOG.md b/packages/address/CHANGELOG.md index 7b536d8d01a..ef654abf73c 100644 --- a/packages/address/CHANGELOG.md +++ b/packages/address/CHANGELOG.md @@ -1,5 +1,14 @@ # Change Log +## 0.13.0 + +### Patch Changes + +- Updated dependencies []: + - @fuel-ts/constants@0.13.0 + - @fuel-ts/interfaces@0.13.0 + - @fuel-ts/keystore@0.13.0 + ## 0.12.0 ### Minor Changes diff --git a/packages/address/package.json b/packages/address/package.json index eb36d4dde84..b513556c3e5 100644 --- a/packages/address/package.json +++ b/packages/address/package.json @@ -1,6 +1,6 @@ { "name": "@fuel-ts/address", - "version": "0.12.0", + "version": "0.13.0", "description": "Utilities for encoding and decoding addresses", "author": "Fuel Labs (https://fuel.network/)", "typedocMain": "./src/index.ts", diff --git a/packages/constants/CHANGELOG.md b/packages/constants/CHANGELOG.md index 1d11496ea60..22204decfdd 100644 --- a/packages/constants/CHANGELOG.md +++ b/packages/constants/CHANGELOG.md @@ -1,5 +1,7 @@ # Change Log +## 0.13.0 + ## 0.12.0 ## 0.11.0 diff --git a/packages/constants/package.json b/packages/constants/package.json index 74cd90edf49..7a13ef18a76 100644 --- a/packages/constants/package.json +++ b/packages/constants/package.json @@ -1,6 +1,6 @@ { "name": "@fuel-ts/constants", - "version": "0.12.0", + "version": "0.13.0", "description": "", "author": "Fuel Labs (https://fuel.network/)", "typedocMain": "src/index.ts", diff --git a/packages/contract/CHANGELOG.md b/packages/contract/CHANGELOG.md index 7bf0b6716c2..219894db21d 100644 --- a/packages/contract/CHANGELOG.md +++ b/packages/contract/CHANGELOG.md @@ -1,5 +1,33 @@ # Change Log +## 0.13.0 + +### Minor Changes + +- [#466](https://github.com/FuelLabs/fuels-ts/pull/466) [`745e65b`](https://github.com/FuelLabs/fuels-ts/commit/745e65bc563ab8cace6f73e2715a6eaaae93fda5) Thanks [@luizstacio](https://github.com/luizstacio)! - Add support to flat abi on interface + +* [#456](https://github.com/FuelLabs/fuels-ts/pull/456) [`48285d4`](https://github.com/FuelLabs/fuels-ts/commit/48285d48b6929e3104c480dddb18d2878be6c478) Thanks [@QuinnLee](https://github.com/QuinnLee)! - Failures now output the reason + +- [#458](https://github.com/FuelLabs/fuels-ts/pull/458) [`9190cee`](https://github.com/FuelLabs/fuels-ts/commit/9190cee45529b6c3fcffb2a12b1ef6319b2b39df) Thanks [@LuizAsFight](https://github.com/LuizAsFight)! - Upgrade compatibility to fuel-core v0.10.1 + +### Patch Changes + +- [#471](https://github.com/FuelLabs/fuels-ts/pull/471) [`dfb2612`](https://github.com/FuelLabs/fuels-ts/commit/dfb261222c17cf6f158f475d91b3414996300066) Thanks [@camsjams](https://github.com/camsjams)! - add option type improvement + +- Updated dependencies [[`745e65b`](https://github.com/FuelLabs/fuels-ts/commit/745e65bc563ab8cace6f73e2715a6eaaae93fda5), [`48285d4`](https://github.com/FuelLabs/fuels-ts/commit/48285d48b6929e3104c480dddb18d2878be6c478), [`9190cee`](https://github.com/FuelLabs/fuels-ts/commit/9190cee45529b6c3fcffb2a12b1ef6319b2b39df), [`5d4d6ce`](https://github.com/FuelLabs/fuels-ts/commit/5d4d6ce7fa1a23deae3f41be94c9fe2ee9851772), [`dfb2612`](https://github.com/FuelLabs/fuels-ts/commit/dfb261222c17cf6f158f475d91b3414996300066)]: + - @fuel-ts/abi-coder@0.13.0 + - @fuel-ts/script@0.13.0 + - @fuel-ts/providers@0.13.0 + - @fuel-ts/transactions@0.13.0 + - @fuel-ts/wallet@0.13.0 + - @fuel-ts/address@0.13.0 + - @fuel-ts/constants@0.13.0 + - @fuel-ts/interfaces@0.13.0 + - @fuel-ts/keystore@0.13.0 + - @fuel-ts/math@0.13.0 + - @fuel-ts/merkle@0.13.0 + - @fuel-ts/sparsemerkle@0.13.0 + ## 0.12.0 ### Minor Changes diff --git a/packages/contract/package.json b/packages/contract/package.json index 80de3e562b3..f12a6c60641 100644 --- a/packages/contract/package.json +++ b/packages/contract/package.json @@ -1,6 +1,6 @@ { "name": "@fuel-ts/contract", - "version": "0.12.0", + "version": "0.13.0", "description": "", "author": "Fuel Labs (https://fuel.network/)", "typedocMain": "src/index.ts", diff --git a/packages/contract/src/__test__/call-test-contract/call-test-contract.test.ts b/packages/contract/src/__test__/call-test-contract/call-test-contract.test.ts index e9355696f39..ccd00b73aeb 100644 --- a/packages/contract/src/__test__/call-test-contract/call-test-contract.test.ts +++ b/packages/contract/src/__test__/call-test-contract/call-test-contract.test.ts @@ -1,56 +1,25 @@ -import type { Interface, JsonAbi } from '@fuel-ts/abi-coder'; import { NativeAssetId } from '@fuel-ts/constants'; import { BN, bn, toHex } from '@fuel-ts/math'; -import { Provider } from '@fuel-ts/providers'; -import type { Wallet } from '@fuel-ts/wallet'; -import { TestUtils } from '@fuel-ts/wallet'; import { readFileSync } from 'fs'; import { join } from 'path'; -import type Contract from '../../contracts/contract'; -import ContractFactory from '../../contracts/contract-factory'; +import { createSetupConfig } from '../test-utils'; import abiJSON from './out/debug/call-test-flat-abi.json'; const contractBytecode = readFileSync(join(__dirname, './out/debug/call-test.bin')); -let contractInstance: Contract; -const deployContract = async (factory: ContractFactory, useCache: boolean = true) => { - if (contractInstance && useCache) return contractInstance; - if (!useCache) { - return factory.deployContract({ - gasPrice: 1, - bytePrice: 1, - }); - } - contractInstance = await factory.deployContract(); - return contractInstance; -}; - -let walletInstance: Wallet; -const createWallet = async () => { - if (walletInstance) return walletInstance; - const provider = new Provider('http://127.0.0.1:4000/graphql'); - walletInstance = await TestUtils.generateTestWallet(provider, [ - [5_000_000, NativeAssetId], - [5_000_000, '0x0101010101010101010101010101010101010101010101010101010101010101'], - ]); - return walletInstance; -}; - -export const setup = async (abi: JsonAbi | Interface = abiJSON, useCache: boolean = true) => { - // Create wallet - const wallet = await createWallet(); - const factory = new ContractFactory(contractBytecode, abi, wallet); - const contract = await deployContract(factory, useCache); - return contract; -}; +const setupContract = createSetupConfig({ + contractBytecode, + abi: abiJSON, + cache: true, +}); const U64_MAX = bn(2).pow(64).sub(1); describe('CallTestContract', () => { it.each([0, 1337, U64_MAX.sub(1)])('can call a contract with u64 (%p)', async (num) => { - const contract = await setup(); + const contract = await setupContract(); const { value } = await contract.functions.foo(num).call(); expect(value.toHex()).toEqual(bn(num).add(1).toHex()); }); @@ -63,14 +32,14 @@ describe('CallTestContract', () => { [{ a: false, b: U64_MAX.sub(1) }], [{ a: true, b: U64_MAX.sub(1) }], ])('can call a contract with structs (%p)', async (struct) => { - const contract = await setup(); + const contract = await setupContract(); const { value } = await contract.functions.boo(struct).call(); expect(value.a).toEqual(!struct.a); expect(value.b.toHex()).toEqual(bn(struct.b).add(1).toHex()); }); it('can call a function with empty arguments', async () => { - const contract = await setup(); + const contract = await setupContract(); const { value: value0 } = await contract.functions.barfoo(0).call(); expect(value0.toHex()).toEqual(toHex(63)); @@ -80,25 +49,29 @@ describe('CallTestContract', () => { }); it('function with empty return output configured should resolve undefined', async () => { - const contract = await setup([ - { - type: 'function', - name: 'return_void', - outputs: [{ type: '()', name: 'foo' }], - }, - ]); + const contract = await setupContract({ + abi: [ + { + type: 'function', + name: 'return_void', + outputs: [{ type: '()', name: 'foo' }], + }, + ], + }); const { value } = await contract.functions.return_void().call(); expect(value).toEqual(undefined); }); it('function with empty return should resolve undefined', async () => { - const contract = await setup([ - { - type: 'function', - name: 'return_void', - }, - ]); + const contract = await setupContract({ + abi: [ + { + type: 'function', + name: 'return_void', + }, + ], + }); // Call method with no params but with no result and no value on config const { value } = await await contract.functions.return_void().call(); @@ -173,7 +146,7 @@ describe('CallTestContract', () => { ])( `Test call with multiple arguments and different types -> %s`, async (method, { values, expected }) => { - const contract = await setup(); + const contract = await setupContract(); const { value } = await contract.functions[method](...values).call(); @@ -186,17 +159,19 @@ describe('CallTestContract', () => { ); it('Forward amount value on contract call', async () => { - const contract = await setup([ - { - type: 'function', - name: 'return_context_amount', - outputs: [ - { - type: 'u64', - }, - ], - }, - ]); + const contract = await setupContract({ + abi: [ + { + type: 'function', + name: 'return_context_amount', + outputs: [ + { + type: 'u64', + }, + ], + }, + ], + }); const { value } = await contract.functions .return_context_amount() .callParams({ @@ -207,17 +182,19 @@ describe('CallTestContract', () => { }); it('Forward asset_id on contract call', async () => { - const contract = await setup([ - { - type: 'function', - name: 'return_context_asset', - outputs: [ - { - type: 'b256', - }, - ], - }, - ]); + const contract = await setupContract({ + abi: [ + { + type: 'function', + name: 'return_context_amount', + outputs: [ + { + type: 'u64', + }, + ], + }, + ], + }); const assetId = '0x0101010101010101010101010101010101010101010101010101010101010101'; const { value } = await contract.functions @@ -230,17 +207,19 @@ describe('CallTestContract', () => { }); it('Forward asset_id on contract simulate call', async () => { - const contract = await setup([ - { - type: 'function', - name: 'return_context_asset', - outputs: [ - { - type: 'b256', - }, - ], - }, - ]); + const contract = await setupContract({ + abi: [ + { + type: 'function', + name: 'return_context_asset', + outputs: [ + { + type: 'b256', + }, + ], + }, + ], + }); const assetId = '0x0101010101010101010101010101010101010101010101010101010101010101'; const { value } = await contract.functions @@ -253,7 +232,7 @@ describe('CallTestContract', () => { }); it('can make multiple calls', async () => { - const contract = await setup(); + const contract = await setupContract(); const num = 1337; const numC = 10; diff --git a/packages/contract/src/__test__/contract.test.ts b/packages/contract/src/__test__/contract.test.ts index 97183ebf765..f4979791f54 100644 --- a/packages/contract/src/__test__/contract.test.ts +++ b/packages/contract/src/__test__/contract.test.ts @@ -4,10 +4,22 @@ import type { BN } from '@fuel-ts/math'; import { bn, multiply, toHex, toNumber } from '@fuel-ts/math'; import { Provider } from '@fuel-ts/providers'; import { TestUtils } from '@fuel-ts/wallet'; +import { readFileSync } from 'fs'; +import { join } from 'path'; import Contract from '../contracts/contract'; -import { setup } from './call-test-contract/call-test-contract.test'; +import abiJSON from './call-test-contract/out/debug/call-test-flat-abi.json'; +import { createSetupConfig } from './test-utils'; + +const contractBytecode = readFileSync( + join(__dirname, './call-test-contract/out/debug/call-test.bin') +); + +const setupContract = createSetupConfig({ + contractBytecode, + abi: abiJSON, +}); const jsonFragment = { type: 'function', @@ -16,6 +28,8 @@ const jsonFragment = { outputs: [], }; +const txPointer = '0x00000000000000000000000000000000'; + const complexFragment = { inputs: [ { @@ -86,7 +100,7 @@ describe('Contract', () => { }); it('should fail to execute call if gasLimit is too low', async () => { - const contract = await setup(); + const contract = await setupContract(); let failed; try { @@ -104,16 +118,18 @@ describe('Contract', () => { }); it('adds multiple contracts on invocation', async () => { - const contract = await setup(); - const otherContract = await setup(undefined, false); + const contract = await setupContract(); + const otherContract = await setupContract({ + cache: false, + }); const scope = contract.functions .call_external_foo(1336, otherContract.id) .addContracts([otherContract.id]); expect(scope.transactionRequest.getContractInputs()).toEqual([ - { contractId: contract.id.toB256(), type: 1 }, - { contractId: otherContract.id.toB256(), type: 1 }, + { contractId: contract.id.toB256(), type: 1, txPointer }, + { contractId: otherContract.id.toB256(), type: 1, txPointer }, ]); expect(scope.transactionRequest.getContractOutputs()).toEqual([ @@ -126,8 +142,10 @@ describe('Contract', () => { }); it('adds multiple contracts on multicalls', async () => { - const contract = await setup(); - const otherContract = await setup(undefined, false); + const contract = await setupContract(); + const otherContract = await setupContract({ + cache: false, + }); const scope = contract .multiCall([ @@ -137,8 +155,8 @@ describe('Contract', () => { .addContracts([otherContract.id]); expect(scope.transactionRequest.getContractInputs()).toEqual([ - { contractId: contract.id.toB256(), type: 1 }, - { contractId: otherContract.id.toB256(), type: 1 }, + { contractId: contract.id.toB256(), type: 1, txPointer }, + { contractId: otherContract.id.toB256(), type: 1, txPointer }, ]); expect(scope.transactionRequest.getContractOutputs()).toEqual([ @@ -151,7 +169,7 @@ describe('Contract', () => { }); it('submits multiple calls', async () => { - const contract = await setup(); + const contract = await setupContract(); const { value: results } = await contract .multiCall([contract.functions.foo(1336), contract.functions.foo(1336)]) @@ -160,7 +178,7 @@ describe('Contract', () => { }); it('should fail to execute multiple calls if gasLimit is too low', async () => { - const contract = await setup(); + const contract = await setupContract(); let failed; try { @@ -178,16 +196,16 @@ describe('Contract', () => { }); it('adds multiple contracts on multicalls', async () => { - const contract = await setup(); - const otherContract = await setup(undefined, false); + const contract = await setupContract(); + const otherContract = await setupContract({ cache: false }); const scope = contract .multiCall([contract.functions.foo(1336)]) .addContracts([otherContract.id]); expect(scope.transactionRequest.getContractInputs()).toEqual([ - { contractId: contract.id.toB256(), type: 1 }, - { contractId: otherContract.id.toB256(), type: 1 }, + { contractId: contract.id.toB256(), type: 1, txPointer }, + { contractId: otherContract.id.toB256(), type: 1, txPointer }, ]); expect(scope.transactionRequest.getContractOutputs()).toEqual([ @@ -200,7 +218,7 @@ describe('Contract', () => { }); it('dryRuns multiple calls', async () => { - const contract = await setup(); + const contract = await setupContract(); const { value: results } = await contract .multiCall([contract.functions.foo(1336), contract.functions.foo(1336)]) @@ -209,7 +227,7 @@ describe('Contract', () => { }); it('simulates multiple calls', async () => { - const contract = await setup(); + const contract = await setupContract(); const { value, callResult, gasUsed } = await contract .multiCall([contract.functions.foo(1336), contract.functions.foo(1336)]) @@ -220,7 +238,7 @@ describe('Contract', () => { }); it('Returns gasUsed and transactionId', async () => { - const contract = await setup(); + const contract = await setupContract(); const { transactionId, gasUsed } = await contract .multiCall([contract.functions.foo(1336), contract.functions.foo(1336)]) @@ -230,7 +248,7 @@ describe('Contract', () => { }); it('Single call with forwarding a alt token', async () => { - const contract = await setup(); + const contract = await setupContract(); const { value } = await contract.functions .return_context_amount() .callParams({ @@ -239,7 +257,6 @@ describe('Contract', () => { }) .txParams({ gasPrice: 1, - bytePrice: 1, gasLimit: 2000000, }) .call(); @@ -247,7 +264,7 @@ describe('Contract', () => { }); it('MultiCall with multiple forwarding', async () => { - const contract = await setup(); + const contract = await setupContract(); const { value } = await contract .multiCall([ @@ -263,7 +280,6 @@ describe('Contract', () => { ]) .txParams({ gasPrice: 1, - bytePrice: 1, gasLimit: 2000000, }) .call<[BN, BN, BN]>(); @@ -271,7 +287,7 @@ describe('Contract', () => { }); it('Check if gas per call is lower than transaction', async () => { - const contract = await setup(); + const contract = await setupContract(); await expect(async () => { await contract @@ -287,7 +303,6 @@ describe('Contract', () => { ]) .txParams({ gasPrice: 1, - bytePrice: 1, gasLimit: 100, }) .call<[BN, BN, BN]>(); @@ -297,7 +312,7 @@ describe('Contract', () => { }); it('can forward gas to multicall calls', async () => { - const contract = await setup(); + const contract = await setupContract(); const { value } = await contract .multiCall([ @@ -312,7 +327,6 @@ describe('Contract', () => { ]) .txParams({ gasPrice: 1, - bytePrice: 1, gasLimit: 1_000_000, }) .call<[BN, BN]>(); @@ -328,7 +342,7 @@ describe('Contract', () => { }); it('Get transaction cost', async () => { - const contract = await setup(); + const contract = await setupContract(); const invocationScope = contract.multiCall([ contract.functions.return_context_amount().callParams({ @@ -340,14 +354,12 @@ describe('Contract', () => { ]); const transactionCost = await invocationScope.getTransactionCost(); - expect(toNumber(transactionCost.bytePrice)).toBe(0); expect(toNumber(transactionCost.gasPrice)).toBe(0); expect(toNumber(transactionCost.fee)).toBeGreaterThanOrEqual(0); expect(toNumber(transactionCost.gasUsed)).toBeGreaterThan(1000); const { value } = await invocationScope .txParams({ - bytePrice: transactionCost.bytePrice, gasPrice: transactionCost.gasPrice, gasLimit: transactionCost.gasUsed, }) @@ -356,8 +368,8 @@ describe('Contract', () => { expect(JSON.stringify(value)).toEqual(JSON.stringify([bn(100), bn(200)])); }); - it('Get transaction cost with bytePrice and gasPrice 1', async () => { - const contract = await setup(); + it('Get transaction cost with gasPrice 1', async () => { + const contract = await setupContract(); const invocationScope = contract .multiCall([ @@ -370,22 +382,19 @@ describe('Contract', () => { ]) .txParams({ gasPrice: 1, - bytePrice: 1, }); - // Get transaction cost using bytePrice and gasPrice from + // Get transaction cost using gasPrice from // invocation scope const transactionCost = await invocationScope.getTransactionCost(); - expect(toNumber(transactionCost.bytePrice)).toBe(1); expect(toNumber(transactionCost.gasPrice)).toBe(1); - expect(toNumber(transactionCost.fee)).toBeGreaterThanOrEqual(2); + expect(toNumber(transactionCost.fee)).toBeGreaterThanOrEqual(1); expect(toNumber(transactionCost.gasUsed)).toBeGreaterThan(1000); // Test that gasUsed is correctly calculated // and can be used as gasLimit const { value } = await invocationScope .txParams({ - bytePrice: transactionCost.bytePrice, gasPrice: transactionCost.gasPrice, gasLimit: transactionCost.gasUsed, }) @@ -394,8 +403,8 @@ describe('Contract', () => { expect(JSON.stringify(value)).toEqual(JSON.stringify([bn(100), bn(200)])); }); - it('Get transaction cost with bytePrice and gasPrice 2', async () => { - const contract = await setup(); + it('Get transaction cost with gasPrice 2', async () => { + const contract = await setupContract(); const invocationScope = contract.multiCall([ contract.functions.return_context_amount().callParams({ @@ -405,23 +414,20 @@ describe('Contract', () => { forward: [200, AltToken], }), ]); - // Get transaction cost using bytePrice and gasPrice + // Get transaction cost using gasPrice // override by SDK user const transactionCost = await invocationScope.getTransactionCost({ gasPrice: 2, - bytePrice: 2, }); - expect(toNumber(transactionCost.bytePrice)).toBe(2); expect(toNumber(transactionCost.gasPrice)).toBe(2); - expect(toNumber(transactionCost.fee)).toBeGreaterThanOrEqual(4); + expect(toNumber(transactionCost.fee)).toBeGreaterThanOrEqual(2); expect(toNumber(transactionCost.gasUsed)).toBeGreaterThan(1000); // Test that gasUsed is correctly calculated // and can be used as gasLimit const { value } = await invocationScope .txParams({ - bytePrice: transactionCost.bytePrice, gasPrice: transactionCost.gasPrice, gasLimit: transactionCost.gasUsed, }) @@ -431,7 +437,7 @@ describe('Contract', () => { }); it('Fail before submit if gasLimit is lower than gasUsed', async () => { - const contract = await setup(); + const contract = await setupContract(); const invocationScope = contract.functions.return_context_amount().callParams({ forward: [100, NativeAssetId], @@ -451,7 +457,7 @@ describe('Contract', () => { }); it('calls array functions', async () => { - const contract = await setup(); + const contract = await setupContract(); const { value: arrayBoolean } = await contract.functions .take_array_boolean([true, false, false]) @@ -483,7 +489,7 @@ describe('Contract', () => { }); it('calls enum functions', async () => { - const contract = await setup(); + const contract = await setupContract(); const { value: enumB256ReturnValue } = await contract.functions .take_b256_enum({ diff --git a/packages/contract/src/__test__/test-utils.ts b/packages/contract/src/__test__/test-utils.ts index f577d6fd8a9..fcd8c8217fc 100644 --- a/packages/contract/src/__test__/test-utils.ts +++ b/packages/contract/src/__test__/test-utils.ts @@ -9,8 +9,8 @@ import type Contract from '../contracts/contract'; import ContractFactory from '../contracts/contract-factory'; let contractInstance: Contract; -const deployContract = async (factory: ContractFactory) => { - if (contractInstance) return contractInstance; +const deployContract = async (factory: ContractFactory, useCache: boolean = true) => { + if (contractInstance && useCache) return contractInstance; contractInstance = await factory.deployContract(); return contractInstance; }; @@ -26,16 +26,24 @@ const createWallet = async () => { return walletInstance; }; -export const setup = async ({ - contractBytecode, - abi, -}: { +export type SetupConfig = { contractBytecode: BytesLike; abi: JsonAbi | Interface; -}) => { + cache?: boolean; +}; + +export const setup = async ({ contractBytecode, abi, cache }: SetupConfig) => { // Create wallet const wallet = await createWallet(); const factory = new ContractFactory(contractBytecode, abi, wallet); - const contract = await deployContract(factory); + const contract = await deployContract(factory, cache); return contract; }; + +export const createSetupConfig = + (defaultConfig: SetupConfig) => async (config?: Partial) => + setup({ + contractBytecode: defaultConfig.contractBytecode, + abi: defaultConfig.abi, + ...config, + }); diff --git a/packages/contract/src/contracts/contract-factory.ts b/packages/contract/src/contracts/contract-factory.ts index ca4eda0b8b0..baee868969e 100644 --- a/packages/contract/src/contracts/contract-factory.ts +++ b/packages/contract/src/contracts/contract-factory.ts @@ -79,13 +79,13 @@ export default class ContractFactory { const request = new CreateTransactionRequest({ gasPrice: 0, gasLimit: MAX_GAS_PER_TX, - bytePrice: 0, bytecodeWitnessIndex: 0, witnesses: [this.bytecode], ...options, }); request.addContractCreatedOutput(contractId, stateRoot); await this.wallet.fund(request); + const response = await this.wallet.sendTransaction(request); await response.wait(); diff --git a/packages/contract/src/contracts/functions/base-invocation-scope.ts b/packages/contract/src/contracts/functions/base-invocation-scope.ts index ef1d99db99d..8b304953d01 100644 --- a/packages/contract/src/contracts/functions/base-invocation-scope.ts +++ b/packages/contract/src/contracts/functions/base-invocation-scope.ts @@ -134,7 +134,7 @@ export class BaseInvocationScope { /** * Run a valid transaction in dryRun mode and returns useful details about - * gasUsed, gasPrice, bytePrice and transaction estimate fee in native coins. + * gasUsed, gasPrice and transaction estimate fee in native coins. */ async getTransactionCost(options?: TransactionCostOptions) { const provider = (this.contract.wallet?.provider || this.contract.provider) as Provider; @@ -143,7 +143,6 @@ export class BaseInvocationScope { await this.prepareTransaction(options); const request = transactionRequestify(this.transactionRequest); request.gasPrice = bn(toNumber(request.gasPrice) || toNumber(options?.gasPrice || 0)); - request.bytePrice = bn(toNumber(request.bytePrice) || toNumber(options?.bytePrice || 0)); const txCost = await provider.getTransactionCost(request, options?.tolerance); return txCost; @@ -170,7 +169,6 @@ export class BaseInvocationScope { request.gasLimit = bn(txParams.gasLimit || request.gasLimit); request.gasPrice = bn(txParams.gasPrice || request.gasPrice); - request.bytePrice = bn(txParams.bytePrice || request.bytePrice); request.addVariableOutputs(this.txParameters?.variableOutputs || 0); return this; diff --git a/packages/contract/src/contracts/multicall/Forc.toml b/packages/contract/src/contracts/multicall/Forc.toml index 88b54e64dc9..ff0555ca392 100644 --- a/packages/contract/src/contracts/multicall/Forc.toml +++ b/packages/contract/src/contracts/multicall/Forc.toml @@ -3,3 +3,4 @@ name = "multicall" license = "Apache-2.0" [dependencies] +std = { path = "/Users/luizstacio/fuels/sway/sway-lib-std" } \ No newline at end of file diff --git a/packages/contract/src/contracts/multicall/src/buf.sw b/packages/contract/src/contracts/multicall/src/buf.sw index 0084822a0df..10f83f1d288 100644 --- a/packages/contract/src/contracts/multicall/src/buf.sw +++ b/packages/contract/src/contracts/multicall/src/buf.sw @@ -43,7 +43,7 @@ impl Buffer { } /// Copies and appends `buf` to the `Buffer`. - pub fn extend_from_buf(mut self, buf: Self) -> u64 { + pub fn extend_from_buf(ref mut self, buf: Self) -> u64 { if (buf.len == 0) { return self.len; } @@ -60,7 +60,7 @@ impl Buffer { old_len } - pub fn extend_from_ptr(mut self, ptr: u64, len: u64) -> u64 { + pub fn extend_from_ptr(ref mut self, ptr: u64, len: u64) -> u64 { if (len == 0) { return self.len; } diff --git a/packages/contract/src/contracts/multicall/src/main.sw b/packages/contract/src/contracts/multicall/src/main.sw index 9311ccb0555..d11d5cebeb3 100644 --- a/packages/contract/src/contracts/multicall/src/main.sw +++ b/packages/contract/src/contracts/multicall/src/main.sw @@ -10,6 +10,7 @@ use std::mem::*; use std::tx::tx_script_data; use std::option::*; use std::revert::*; +use std::logging::log; use buf::*; use contract_call::*; @@ -46,23 +47,12 @@ fn get_var_data() -> Buffer { } fn main(script_data: ScriptData) -> ScriptReturn { - // TODO: Remove this line when the bug is fixed: https://github.com/FuelLabs/sway/issues/1585 - asm(r1: 0x0000000000000000000000000000000000000000000000000000000000000000) { - }; - - // Our script data is a fixed-size struct followed by a variable-length array of bytes. - // ScriptData can represent only this fixed-size part, - // and we will use a RawPointer to access the variable-length part, - // which contains reference type call arguments' data - let script_data = tx_script_data::(); let var_data = get_var_data(); - - let mut call_returns: [Option; - 5] = null_of::<[Option; - 5]>(); + let mut call_returns: [Option; 5] = null_of::<[Option; 5]>(); let mut ret_data = ~Buffer::new(); let mut i = 0; let calls_len = size_of_val(script_data.calls) / size_of::>(); + while i < calls_len { match script_data.calls[i] { Option::Some(call) => { diff --git a/packages/contract/src/contracts/multicall/static-out/multicall-bin-hash b/packages/contract/src/contracts/multicall/static-out/multicall-bin-hash index c2e5963cc33..4604ddaa268 100644 --- a/packages/contract/src/contracts/multicall/static-out/multicall-bin-hash +++ b/packages/contract/src/contracts/multicall/static-out/multicall-bin-hash @@ -1 +1 @@ -0x71e7b6dc3265b49590c6cad582b1afd367d348b8c5105a300d200a1c87aa7efe \ No newline at end of file +0x705a6f548a3eb8591508092d89cda0803e4a30ad0d43354caa0c6493f2e7b7a9 \ No newline at end of file diff --git a/packages/contract/src/contracts/multicall/static-out/multicall-bin.ts b/packages/contract/src/contracts/multicall/static-out/multicall-bin.ts index 5ddd5392b5b..b642515f2b8 100644 --- a/packages/contract/src/contracts/multicall/static-out/multicall-bin.ts +++ b/packages/contract/src/contracts/multicall/static-out/multicall-bin.ts @@ -1 +1 @@ -export default '0x90000004470000000000000000000d485dfcc00110fff3001a5c5000910008485d43f00e104103005d43f0045d47f0055d451000104514005d43f0067340001190000012900000135d4510005041746850417468604112d05d47f0045d43f0055d41000010450440504174105f5d1082504174105d4570825d43f00710450440504174285f5d10855d43f0085d4500005d43f00720451400504173605f5d106c504174285d497085504173605d41706c1a445000910000105f4520005f4500015041783850417838604110105d47f00926440000504470015041724050417240604110a05d43f00a26400000504070011a445000910000105f4500005d43f00a5f450001504174585041745860411010504173305d43f00a5f5d006650417468504100005d47f0075d43f00b12451400504172e05f5d105c504173305d457066504172e05d41705c1641140073400055900000645041746850450000504173305d4170665541009010411400504570685045706860450090504170685d4500005d43f00c13411400734000f690000323504972401a445000910000a050411000604120a05041773850417738604110a05d43f00a26400000504070011a445000910000105f4500005d43f00a5f45000150417178504171786041101050597178505577385d43f006134100007340007d900000815d43f00a364000005d43f00a900000825d43f00a504177385d53f0095d43f00a13414400734000889000008a5d416001900000b65d43f00a5d456001504173e85f5d107d5d41600110454400504173a85f5d10755d4d60005d496001504173a85d4570751541148073400099900000aa2644000050447001504173885f5d10715d43f00a15412400734000a1900000a6504173885d417071284134805d43f00a900000a75d43f00a504173885d4d7071900000aa5f593000504173a85d4170755f5900015d456000504173e85d41707d10410440284155005d43f00a504173e85d41707d50557178505174585d4540015d43f00a13411400734000bd900000bf5d415001900000ee5d43f00a5d455001504173f05f5d107e5d4550015d41400110450440504173b05f5d10765d4d50005d495001504173b05d45707615411480734000cf900000e02644000050447001504173905f5d10725d43f00a15412400734000d7900000dc504173905d417072284134805d43f00a900000dd5d43f00a504173905d4d7072900000e05f553000504173b05d4170765f5500015d4940005d455000504173f05d41707e104504405d414001284524005d43f00a504173f05d41707e504171785d450000504171785d41000125450000504577385d43f0092545000050417068504500085041718850417188604110885041718850450028504170f8504170f860411018504170f85d4500005d43f00a134114007340010690000112504170f85d450002504177d85f5d10fb504177d85d4970fb1a445000910000185d43f00a5f4500005f4520029000014f504170f85d4500005d43f00c134114007340011890000134504170f8504100085d450000504173c85f5d1079504170f8504100085d450001504173585f5d106b504178385d450000504173c85d41707910450440504173585d41706b1a485000910000105f4910005f4900011a445000910000185d43f00c5f45000050411008604120109000014f504170f8504100085d450000504173d05f5d107a504170f8504100085d450001504173705f5d106e504178385d450000504173d05d41707a10450440504173705d41706e1a485000910000105f4910005f4900011a445000910000185d43f00c5f4500005041100860412010504172e8504172e8604110185041718850550000504171885d510004504572e850417188504d0040504170005041700060411018504170005d4500005d43f00a134114007340016290000169504170005d450002504177e05f5d10fc504177e05d4570fc9000017e504170005d4500005d43f00c134114007340016f9000017750417000504100085d450000504174185f5d1083504174185d4570839000017e50417000504100085d450000504174305f5d1086504174305d457086504173005f5d1060504173005d4970601a4450009100003050411000604150205f4540045f45200550417210504172106041103050453000504170185041701860411010504170185d4500005d43f00c13411400734001959000019c504170185d450001504171285f5d1025504171285d457025900001a5504170185d4500005d43f00a13411400734001a2900001a45d47f00a900001a55d47f00a504171305f5d102650453010504170285041702860411028504170285d4500005d43f00c13411400734001b1900001b8504170285045000850417338504173386041102050497338900001cb504170285d4500005d43f00a13411400734001be900001c51a485000910000205d47f00e104513005041200060411020900001cb1a485000910000205d47f00e10451300504120006041102050417138504171386041202050453038504170505041705060411010504170505d4500005d43f00c13411400734001d8900001df504170505d450001504173205f5d1064504173205d457064900001e8504170505d4500005d43f00a13411400734001e5900001e71a44a000900001e81a44a000504173285f5d1065504d7210504171305d49702650457138504173285d4170652d4d24501a44e000504170605f5d100c504170605d45700c5d43f00a13411400734001fa900002051a44d000504178085f5d1101504178085d4971011a445000910000185d43f00a5f4500005f4520029000021a504170605d45700c504173685f5d106d1a44d000504174385f5d1087504174385d457087504173685d41706d1a485000910000105f4910005f4900011a445000910000185d43f00c5f450000504110086041201050417440504174406041101850457440504171105041711060411018504171105d4500005d43f00a134114007340022790000233504171105d450002504178305f5d1106504178305d4971061a445000910000185d43f00a5f4500005f452002900002f4504171105d4500005d43f00c13411400734002399000029750417110504100085d450000504174085f5d108150417110504100085d450001504173785f5d106f504174085d457081504173785d41706f1a485000910000105f4910005f49000150417158504171586041201050557458505171585d4540015d43f00a1341140073400255900002575d455001900002865d43f00a5d455001504173f85f5d107f5d4550015d41400110450440504173b85f5d10775d4d50005d495001504173b85d4570771541148073400267900002782644000050447001504173985f5d10735d43f00a154124007340026f90000274504173985d417073284134805d43f00a900002755d43f00a504173985d4d7073900002785f553000504173b85d4170775f5500015d4940005d455000504173f85d41707f104504405d414001284524005d43f00a504173f85d45707f504173d85f5d107b504173d85d45707b504173785d41706f1a485000910000105f4910005f4900011a445000910000185d43f00c5f4500005041100860412010900002f450417110504100085d450000504174205f5d108450417110504100085d450001504173805f5d1070504174205d457084504173805d4170701a485000910000105f4910005f49000150417168504171686041201050557458505171685d4540015d43f00a13411400734002b3900002b55d455001900002e45d43f00a5d455001504174005f5d10805d4550015d41400110450440504173c05f5d10785d4d50005d495001504173c05d45707815411480734002c5900002d62644000050447001504173a05f5d10745d43f00a15412400734002cd900002d2504173a05d417074284134805d43f00a900002d35d43f00a504173a05d4d7074900002d65f553000504173c05d4170785f5500015d4940005d455000504174005d417080104504405d414001284524005d43f00a504174005d457080504173e05f5d107c504173e05d45707c504173805d4170701a485000910000105f4910005f4900011a445000910000185d43f00c5f4500005041100860412010504173085041730860411018504973081a445000910000205d43f00c5f4500005041100860412018504177e8504177e86041102050457240504173305d41706655490020104914805d43f006134100007340030a9000030e5d43f00a364000005d43f00a9000030f5d43f00a504577e85d43f00673400313900003205d43f00613410000734003179000031b5d43f00a364000005d43f00a9000031c5d43f00a5d43f00d284914005d43f00a900003215f4910005d43f00a9000034b504178101a445000910000205d43f00a5f450000504178106041102050457240504173305d41706655490020104914805d43f0061341000073400333900003375d43f00a364000005d43f00a900003385d43f00a504578105d43f0067340033c900003495d43f0061341000073400340900003445d43f00a364000005d43f00a900003455d43f00a5d43f00d284914005d43f00a9000034a5f4910005d43f00a50417330504173305d4570665d43f00c104104405f5d00669000004e000000000000000000000000000000000000000000000000000000000000000000000000000028700000000000002828000000000000000100000000000002d0000000000000283000000000000000a000000000000000000000000000000090000000000000000100000000000000200000000000000d48'; +export default '0x90000004470000000000000000000cd45dfcc00110fff3001a5c5000910005b861440006724002d0164114005b40100d360000006158000c61440001504175305f5d10a6504175305d4570a6504171385f5d1027504171385d417027134100007340001a9000001f1a445000910000085d43f0005f4500009000002b504171385d4170271341004073400024900000291a445000910000085d43f0015f4500009000002b360000001a44000050417528504175286041100850457528504170085041700860411008504170085d4100001341000073400037900000396144000c9000003b360000001a440000504174305f5d1086504174305d4570865d43f00210450440504174485f5d108961440001504175405f5d10a8504175405d4570a8504171405f5d1028504171405d417028134100007340004f900000541a445000910000085d43f0005f45000090000060504171405d41702813410040734000599000005e1a445000910000085d43f0015f45000090000060360000001a44000050417538504175386041100850457538504170005041700060411008504170005d410000134100007340006c9000006e6144000690000078504170005d410000134100407340007390000076360000001a44000090000078360000001a4400005d43f00220451400504173805f5d1070504174485d497089504173805d4170701a445000910000105f4520005f450001504175a8504175a8604110105d47f00326440000504470015041726050417260604110a026000000504070011a445000910000105f4500005f440001504174785041747860411010504173505f5c006a5d47f0025d43f00412451400504173005f5d1060504173505d45706a504173005d41706016411400734000a4900000b150496000504173505d41706a5545009010452440504170785041707860411090504170785d41000013410040734001249000031f504972601a445000910000a050411000604120a05041748850417488604110a026000000504070011a445000910000105f4500005f44000150417198504171986041101050517198505574885d454001504174085f5d10815d4540015d43f00310450440504173c85f5d10795d4140005d4d4001504573c85d457079154914c0734800d3900000e12644000050487001504573a85f5d207515453000734400da900000de504573a85d457075284504c0900000de504173a85d417075900000e15f510000504173c85d4170795f5100015d454000504174085d417081104504405d43f0032845540050557198505174785d41400113410000734000f1900000f35d4150019000011c5d455001504174105f5d10825d4550015d41400110450440504173d05f5d107a5d4150005d4d5001504573d05d45707a154914c073480102900001102644000050487001504573b05f5d207615453000734401099000010d504573b05d457076284504c09000010d504173b05d417076900001105f550000504173d05d41707a5f5500015d4940005d455000504174105d417082104504405d414001284524005d417082504171985d450000504171985d41000125450000504574885d43f003254500005041707850450008504171a8504171a860411088504171a850450028504171085041710860411018504171085d41000013410000734001339000013f504171085d450002504175485f5d10a9504175485d4970a91a445000910000185d43f0005f4500005f4520029000017b504171085d41000013410040734001449000016050417108504100085d450000504173e85f5d107d50417108504100085d450001504173785f5d106f504175a85d450000504173e85d41707d10450440504173785d41706f1a485000910000105f4910005f4900011a445000910000185d43f0015f45000050411008604120109000017b50417108504100085d450000504173f05f5d107e50417108504100085d450001504173905f5d1072504175a85d450000504173f05d41707e10450440504173905d4170721a485000910000105f4910005f4900011a445000910000185d43f0015f4500005041100860412010504173085041730860411018504171a850550000504171a85d51000450457308504171a8504d0040504170105041701060411018504170105d410000134100007340018d90000194504170105d450002504175505f5d10aa504175505d4570aa900001a8504170105d4100001341004073400199900001a150417010504100085d450000504174385f5d1087504174385d457087900001a850417010504100085d450000504174505f5d108a504174505d45708a504173205f5d1064504173205d4970641a4450009100003050411000604150205f4540045f45200550417230504172306041103050453000504170285041702860411010504170285d41000013410040734001be900001c5504170285d450001504171485f5d1029504171485d457029900001cd504170285d41000013410000734001ca900001cc1a440000900001cd1a440000504171505f5d102a50453010504170385041703860411028504170385d41000013410040734001d8900001df504170385045000850417358504173586041102050497358900001f1504170385d41000013410000734001e4900001eb1a485000910000205d47f00a104513005041200060411020900001f11a485000910000205d47f00a10451300504120006041102050417158504171586041202050453038504170605041706060411010504170605d41000013410040734001fd90000204504170605d450001504173405f5d1068504173405d4570689000020c504170605d41000013410000734002099000020b1a44a0009000020c1a44a000504173485f5d1069504d7230504171505d49702a50457158504173485d4170692d4d24501a44e000504170705f5d100e504170705d41700e134100007340021d900002281a44d000504175785f5d10af504175785d4570af1a485000910000185d43f0005f4900005f4910029000023d504170705d45700e504173885f5d10711a44d000504174585f5d108b504174585d49708b504173885d4170711a445000910000105f4520005f4500011a485000910000185d43f0015f490000504120086041101050417460504174606041201850457460504171205041712060411018504171205d410000134100007340024990000255504171205d450002504175a05f5d10b4504175a05d4970b41a445000910000185d43f0005f4500005f45200290000309504171205d410000134100407340025a900002b250417120504100085d450000504174285f5d108550417120504100085d450001504173985f5d1073504174285d497085504173985d4170731a445000910000105f4520005f45000150417178504171786041101050557478505171785d4140011341000073400275900002775d455001900002a15d455001504174185f5d10835d4550015d41400110450440504173d85f5d107b5d4150005d4d5001504573d85d45707b154914c073480286900002942644000050487001504573b85f5d2077154530007344028d90000291504573b85d457077284504c090000291504173b85d417077900002945f550000504173d85d41707b5f5500015d4940005d455000504174185d417083104504405d41400128452400504174185d457083504173f85f5d107f504173f85d45707f504173985d4170731a485000910000105f4910005f4900011a445000910000185d43f0015f45000050411008604120109000030950417120504100085d450000504174405f5d108850417120504100085d450001504173a05f5d1074504174405d497088504173a05d4170741a445000910000105f4520005f45000150417188504171886041101050557478505171885d41400113410000734002cd900002cf5d455001900002f95d455001504174205f5d10845d4550015d41400110450440504173e05f5d107c5d4150005d4d5001504573e05d45707c154914c0734802de900002ec2644000050487001504573c05f5d207815453000734402e5900002e9504573c05d457078284504c0900002e9504173c05d417078900002ec5f550000504173e05d41707c5f5500015d4940005d455000504174205d417084104504405d41400128452400504174205d457084504174005f5d1080504174005d457080504173a05d4170741a485000910000105f4910005f4900011a445000910000185d43f0015f4500005041100860412010504173285041732860411018504973281a445000910000205d43f0015f450000504110086041201850417558504175586041102050457260504173505d41706a5549002010491480504575585d43f009284914009000032e504175801a445000910000205d43f0005f450000504175806041102050457260504173505d41706a5549002010491480504575805d43f0092849140050417350504173505d41706a104014005f5d006a9000009d470000000000000000000000000000000000000100000000000002d000000000000000a00000000000000090000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000cfc'; diff --git a/packages/contract/src/contracts/multicall/static-out/multicall-flat-abi.json b/packages/contract/src/contracts/multicall/static-out/multicall-flat-abi.json new file mode 100644 index 00000000000..e4d163f8ac0 --- /dev/null +++ b/packages/contract/src/contracts/multicall/static-out/multicall-flat-abi.json @@ -0,0 +1,235 @@ +{ + "types": [ + { + "typeId": 0, + "type": "()", + "components": [], + "typeParameters": null + }, + { + "typeId": 1, + "type": "(_, _)", + "components": [ + { + "name": "__tuple_element", + "type": 13, + "typeArguments": null + }, + { + "name": "__tuple_element", + "type": 13, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 2, + "type": "[_; 5]", + "components": [ + { + "name": "__array_element", + "type": 6, + "typeArguments": [ + { + "name": "", + "type": 10, + "typeArguments": null + } + ] + } + ], + "typeParameters": null + }, + { + "typeId": 3, + "type": "[_; 5]", + "components": [ + { + "name": "__array_element", + "type": 6, + "typeArguments": [ + { + "name": "", + "type": 5, + "typeArguments": null + } + ] + } + ], + "typeParameters": null + }, + { + "typeId": 4, + "type": "b256", + "components": null, + "typeParameters": null + }, + { + "typeId": 5, + "type": "enum CallValue", + "components": [ + { + "name": "Value", + "type": 13, + "typeArguments": null + }, + { + "name": "Data", + "type": 1, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 6, + "type": "enum Option", + "components": [ + { + "name": "None", + "type": 0, + "typeArguments": null + }, + { + "name": "Some", + "type": 7, + "typeArguments": null + } + ], + "typeParameters": [7] + }, + { + "typeId": 7, + "type": "generic T", + "components": null, + "typeParameters": null + }, + { + "typeId": 8, + "type": "struct CallParameters", + "components": [ + { + "name": "amount", + "type": 6, + "typeArguments": [ + { + "name": "", + "type": 13, + "typeArguments": null + } + ] + }, + { + "name": "asset_id", + "type": 6, + "typeArguments": [ + { + "name": "", + "type": 9, + "typeArguments": null + } + ] + }, + { + "name": "gas", + "type": 6, + "typeArguments": [ + { + "name": "", + "type": 13, + "typeArguments": null + } + ] + } + ], + "typeParameters": null + }, + { + "typeId": 9, + "type": "struct ContractId", + "components": [ + { + "name": "value", + "type": 4, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 10, + "type": "struct MulticallCall", + "components": [ + { + "name": "contract_id", + "type": 9, + "typeArguments": null + }, + { + "name": "fn_selector", + "type": 13, + "typeArguments": null + }, + { + "name": "fn_arg", + "type": 5, + "typeArguments": null + }, + { + "name": "parameters", + "type": 8, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 11, + "type": "struct ScriptData", + "components": [ + { + "name": "calls", + "type": 2, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 12, + "type": "struct ScriptReturn", + "components": [ + { + "name": "call_returns", + "type": 3, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 13, + "type": "u64", + "components": null, + "typeParameters": null + } + ], + "functions": [ + { + "inputs": [ + { + "name": "script_data", + "type": 11, + "typeArguments": null + } + ], + "name": "main", + "output": { + "name": "", + "type": 12, + "typeArguments": null + } + } + ] +} diff --git a/packages/contract/src/contracts/multicall/static-out/multicall.bin b/packages/contract/src/contracts/multicall/static-out/multicall.bin index 1fe4c222d15..7928dc026cd 100644 Binary files a/packages/contract/src/contracts/multicall/static-out/multicall.bin and b/packages/contract/src/contracts/multicall/static-out/multicall.bin differ diff --git a/packages/contract/src/types.ts b/packages/contract/src/types.ts index d89764fb9c2..edf574a0052 100644 --- a/packages/contract/src/types.ts +++ b/packages/contract/src/types.ts @@ -11,7 +11,6 @@ export type CallParams = Partial<{ }>; export type TxParams = Partial<{ - bytePrice: BigNumberish; gasPrice: BigNumberish; gasLimit: BigNumberish; variableOutputs: number; @@ -45,7 +44,6 @@ export type InvocationScopeLike = { export type TransactionCostOptions = Partial<{ fundTransaction: boolean; - bytePrice: BigNumberish; gasPrice: BigNumberish; tolerance: number; }>; diff --git a/packages/example-contract/CHANGELOG.md b/packages/example-contract/CHANGELOG.md index 6e9618d03b0..7153f7f668f 100644 --- a/packages/example-contract/CHANGELOG.md +++ b/packages/example-contract/CHANGELOG.md @@ -1,5 +1,13 @@ # Change Log +## 0.13.0 + +### Patch Changes + +- Updated dependencies [[`9190cee`](https://github.com/FuelLabs/fuels-ts/commit/9190cee45529b6c3fcffb2a12b1ef6319b2b39df), [`5d4d6ce`](https://github.com/FuelLabs/fuels-ts/commit/5d4d6ce7fa1a23deae3f41be94c9fe2ee9851772)]: + - @fuel-ts/wallet@0.13.0 + - fuels@0.13.0 + ## 0.12.0 ### Patch Changes diff --git a/packages/example-contract/package.json b/packages/example-contract/package.json index 7db804965af..068835f2e63 100644 --- a/packages/example-contract/package.json +++ b/packages/example-contract/package.json @@ -1,6 +1,6 @@ { "name": "@fuel-ts/example-contract", - "version": "0.12.0", + "version": "0.13.0", "description": "", "author": "Fuel Labs (https://fuel.network/)", "scripts": { diff --git a/packages/forc-bin/package.json b/packages/forc-bin/package.json index 18086ce4c05..f9f4ec60531 100644 --- a/packages/forc-bin/package.json +++ b/packages/forc-bin/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "forc-bin", - "version": "0.20.2", + "version": "0.22.1", "description": "", "author": "Fuel Labs (https://fuel.network/)", "typedocMain": "src/index.ts", diff --git a/packages/fuels/CHANGELOG.md b/packages/fuels/CHANGELOG.md index a0aa16e0d4b..5c0d3fe5d9c 100644 --- a/packages/fuels/CHANGELOG.md +++ b/packages/fuels/CHANGELOG.md @@ -1,5 +1,33 @@ # Change Log +## 0.13.0 + +### Patch Changes + +- Updated dependencies [[`745e65b`](https://github.com/FuelLabs/fuels-ts/commit/745e65bc563ab8cace6f73e2715a6eaaae93fda5), [`48285d4`](https://github.com/FuelLabs/fuels-ts/commit/48285d48b6929e3104c480dddb18d2878be6c478), [`61d6e6b`](https://github.com/FuelLabs/fuels-ts/commit/61d6e6b3d0fde7f28d3a94a967ce0ac85c2f1bf7), [`9190cee`](https://github.com/FuelLabs/fuels-ts/commit/9190cee45529b6c3fcffb2a12b1ef6319b2b39df), [`5d4d6ce`](https://github.com/FuelLabs/fuels-ts/commit/5d4d6ce7fa1a23deae3f41be94c9fe2ee9851772), [`dfb2612`](https://github.com/FuelLabs/fuels-ts/commit/dfb261222c17cf6f158f475d91b3414996300066)]: + - @fuel-ts/abi-coder@0.13.0 + - @fuel-ts/contract@0.13.0 + - @fuel-ts/wallet-manager@0.13.0 + - @fuel-ts/providers@0.13.0 + - @fuel-ts/testcases@0.13.0 + - @fuel-ts/transactions@0.13.0 + - @fuel-ts/wallet@0.13.0 + - @fuel-ts/predicate@0.13.0 + - @fuel-ts/hasher@0.13.0 + - @fuel-ts/address@0.13.0 + - @fuel-ts/signer@0.13.0 + - @fuel-ts/hdwallet@0.13.0 + - @fuel-ts/constants@0.13.0 + - @fuel-ts/interfaces@0.13.0 + - @fuel-ts/keystore@0.13.0 + - @fuel-ts/math@0.13.0 + - @fuel-ts/merkle@0.13.0 + - @fuel-ts/merkle-shared@0.13.0 + - @fuel-ts/merklesum@0.13.0 + - @fuel-ts/mnemonic@0.13.0 + - @fuel-ts/sparsemerkle@0.13.0 + - @fuel-ts/wordlists@0.13.0 + ## 0.12.0 ### Patch Changes diff --git a/packages/fuels/package.json b/packages/fuels/package.json index 861a0209e1c..d60fbfb340d 100644 --- a/packages/fuels/package.json +++ b/packages/fuels/package.json @@ -1,6 +1,6 @@ { "name": "fuels", - "version": "0.12.0", + "version": "0.13.0", "description": "", "author": "Fuel Labs (https://fuel.network/)", "typedocMain": "src/index.ts", diff --git a/packages/hasher/CHANGELOG.md b/packages/hasher/CHANGELOG.md index 57269a5ab94..00bb231407c 100644 --- a/packages/hasher/CHANGELOG.md +++ b/packages/hasher/CHANGELOG.md @@ -1,5 +1,14 @@ # Change Log +## 0.13.0 + +### Patch Changes + +- Updated dependencies [[`9190cee`](https://github.com/FuelLabs/fuels-ts/commit/9190cee45529b6c3fcffb2a12b1ef6319b2b39df), [`5d4d6ce`](https://github.com/FuelLabs/fuels-ts/commit/5d4d6ce7fa1a23deae3f41be94c9fe2ee9851772)]: + - @fuel-ts/providers@0.13.0 + - @fuel-ts/transactions@0.13.0 + - @fuel-ts/constants@0.13.0 + ## 0.12.0 ### Patch Changes diff --git a/packages/hasher/package.json b/packages/hasher/package.json index 9ef6c54c106..d33313490bf 100644 --- a/packages/hasher/package.json +++ b/packages/hasher/package.json @@ -1,6 +1,6 @@ { "name": "@fuel-ts/hasher", - "version": "0.12.0", + "version": "0.13.0", "description": "Sha256 hash utility for Fuel", "author": "Fuel Labs (https://fuel.network/)", "typedocMain": "./src/index.ts", diff --git a/packages/hdwallet/CHANGELOG.md b/packages/hdwallet/CHANGELOG.md index cd68dd5e21b..605b92486b1 100644 --- a/packages/hdwallet/CHANGELOG.md +++ b/packages/hdwallet/CHANGELOG.md @@ -1,5 +1,14 @@ # Change Log +## 0.13.0 + +### Patch Changes + +- Updated dependencies []: + - @fuel-ts/signer@0.13.0 + - @fuel-ts/math@0.13.0 + - @fuel-ts/mnemonic@0.13.0 + ## 0.12.0 ### Patch Changes diff --git a/packages/hdwallet/package.json b/packages/hdwallet/package.json index 53d8ac1689d..d928db7fd3f 100644 --- a/packages/hdwallet/package.json +++ b/packages/hdwallet/package.json @@ -1,6 +1,6 @@ { "name": "@fuel-ts/hdwallet", - "version": "0.12.0", + "version": "0.13.0", "description": "The Hierarchal Desterministic (HD) Wallet", "author": "Fuel Labs (https://fuel.network/)", "typedocMain": "./src/index.ts", diff --git a/packages/interfaces/CHANGELOG.md b/packages/interfaces/CHANGELOG.md index f462bc03f5b..be64701c5b5 100644 --- a/packages/interfaces/CHANGELOG.md +++ b/packages/interfaces/CHANGELOG.md @@ -1,5 +1,7 @@ # Change Log +## 0.13.0 + ## 0.12.0 ### Minor Changes diff --git a/packages/interfaces/package.json b/packages/interfaces/package.json index cb05c995d5f..d07d0ee5ac6 100644 --- a/packages/interfaces/package.json +++ b/packages/interfaces/package.json @@ -1,6 +1,6 @@ { "name": "@fuel-ts/interfaces", - "version": "0.12.0", + "version": "0.13.0", "description": "", "author": "Fuel Labs (https://fuel.network/)", "typedocMain": "src/index.ts", diff --git a/packages/keystore/CHANGELOG.md b/packages/keystore/CHANGELOG.md index eb313db435c..a7b9695f10a 100644 --- a/packages/keystore/CHANGELOG.md +++ b/packages/keystore/CHANGELOG.md @@ -1,5 +1,7 @@ # Change Log +## 0.13.0 + ## 0.12.0 ## 0.11.0 diff --git a/packages/keystore/package.json b/packages/keystore/package.json index 7bd5811ae54..ca10089f2f2 100644 --- a/packages/keystore/package.json +++ b/packages/keystore/package.json @@ -1,6 +1,6 @@ { "name": "@fuel-ts/keystore", - "version": "0.12.0", + "version": "0.13.0", "description": "Utilities for encrypting and decrypting data", "author": "Fuel Labs (https://fuel.network/)", "typedocMain": "./src/index.ts", diff --git a/packages/math/CHANGELOG.md b/packages/math/CHANGELOG.md index 62e37a09bad..5c91f11ea81 100644 --- a/packages/math/CHANGELOG.md +++ b/packages/math/CHANGELOG.md @@ -1,5 +1,7 @@ # Change Log +## 0.13.0 + ## 0.12.0 ## 0.11.0 diff --git a/packages/math/package.json b/packages/math/package.json index 73d124f3fb7..825c2e242bc 100644 --- a/packages/math/package.json +++ b/packages/math/package.json @@ -1,6 +1,6 @@ { "name": "@fuel-ts/math", - "version": "0.12.0", + "version": "0.13.0", "description": "", "author": "Fuel Labs (https://fuel.network/)", "typedocMain": "src/index.ts", diff --git a/packages/merkle-shared/CHANGELOG.md b/packages/merkle-shared/CHANGELOG.md index afc06c1020d..b63a57bc636 100644 --- a/packages/merkle-shared/CHANGELOG.md +++ b/packages/merkle-shared/CHANGELOG.md @@ -1,5 +1,12 @@ # Change Log +## 0.13.0 + +### Patch Changes + +- Updated dependencies []: + - @fuel-ts/math@0.13.0 + ## 0.12.0 ### Patch Changes diff --git a/packages/merkle-shared/package.json b/packages/merkle-shared/package.json index 9d0099b663b..e2bfff4cdeb 100644 --- a/packages/merkle-shared/package.json +++ b/packages/merkle-shared/package.json @@ -1,6 +1,6 @@ { "name": "@fuel-ts/merkle-shared", - "version": "0.12.0", + "version": "0.13.0", "description": "", "author": "Fuel Labs (https://fuel.network/)", "main": "src/index.ts", diff --git a/packages/merkle/CHANGELOG.md b/packages/merkle/CHANGELOG.md index e2af0c1a75e..4cc4cf32ab7 100644 --- a/packages/merkle/CHANGELOG.md +++ b/packages/merkle/CHANGELOG.md @@ -1,5 +1,12 @@ # Change Log +## 0.13.0 + +### Patch Changes + +- Updated dependencies []: + - @fuel-ts/merkle-shared@0.13.0 + ## 0.12.0 ### Patch Changes diff --git a/packages/merkle/package.json b/packages/merkle/package.json index 89a785b682f..439013aca3c 100644 --- a/packages/merkle/package.json +++ b/packages/merkle/package.json @@ -1,6 +1,6 @@ { "name": "@fuel-ts/merkle", - "version": "0.12.0", + "version": "0.13.0", "description": "", "author": "Fuel Labs (https://fuel.network/)", "typedocMain": "src/index.ts", diff --git a/packages/merklesum/CHANGELOG.md b/packages/merklesum/CHANGELOG.md index ee6a6fd9ba3..8433323da6b 100644 --- a/packages/merklesum/CHANGELOG.md +++ b/packages/merklesum/CHANGELOG.md @@ -1,5 +1,12 @@ # Change Log +## 0.13.0 + +### Patch Changes + +- Updated dependencies []: + - @fuel-ts/merkle-shared@0.13.0 + ## 0.12.0 ### Patch Changes diff --git a/packages/merklesum/package.json b/packages/merklesum/package.json index 630e976fec8..4e1254f9fa4 100644 --- a/packages/merklesum/package.json +++ b/packages/merklesum/package.json @@ -1,6 +1,6 @@ { "name": "@fuel-ts/merklesum", - "version": "0.12.0", + "version": "0.13.0", "description": "", "author": "Fuel Labs (https://fuel.network/)", "typedocMain": "src/index.ts", diff --git a/packages/mnemonic/CHANGELOG.md b/packages/mnemonic/CHANGELOG.md index 8054204a42b..b2545526f87 100644 --- a/packages/mnemonic/CHANGELOG.md +++ b/packages/mnemonic/CHANGELOG.md @@ -1,5 +1,13 @@ # Change Log +## 0.13.0 + +### Patch Changes + +- Updated dependencies []: + - @fuel-ts/keystore@0.13.0 + - @fuel-ts/wordlists@0.13.0 + ## 0.12.0 ### Patch Changes diff --git a/packages/mnemonic/package.json b/packages/mnemonic/package.json index f2fcfd68988..0e1d076ed99 100644 --- a/packages/mnemonic/package.json +++ b/packages/mnemonic/package.json @@ -1,6 +1,6 @@ { "name": "@fuel-ts/mnemonic", - "version": "0.12.0", + "version": "0.13.0", "description": "Mnemonic implementation from BIP39", "author": "Fuel Labs (https://fuel.network/)", "typedocMain": "./src/index.ts", diff --git a/packages/predicate/CHANGELOG.md b/packages/predicate/CHANGELOG.md index 32e009393d2..d116c3ff1d4 100644 --- a/packages/predicate/CHANGELOG.md +++ b/packages/predicate/CHANGELOG.md @@ -1,5 +1,16 @@ # Change Log +## 0.13.0 + +### Patch Changes + +- Updated dependencies [[`745e65b`](https://github.com/FuelLabs/fuels-ts/commit/745e65bc563ab8cace6f73e2715a6eaaae93fda5), [`48285d4`](https://github.com/FuelLabs/fuels-ts/commit/48285d48b6929e3104c480dddb18d2878be6c478), [`9190cee`](https://github.com/FuelLabs/fuels-ts/commit/9190cee45529b6c3fcffb2a12b1ef6319b2b39df), [`5d4d6ce`](https://github.com/FuelLabs/fuels-ts/commit/5d4d6ce7fa1a23deae3f41be94c9fe2ee9851772), [`dfb2612`](https://github.com/FuelLabs/fuels-ts/commit/dfb261222c17cf6f158f475d91b3414996300066)]: + - @fuel-ts/abi-coder@0.13.0 + - @fuel-ts/contract@0.13.0 + - @fuel-ts/wallet@0.13.0 + - @fuel-ts/address@0.13.0 + - @fuel-ts/interfaces@0.13.0 + ## 0.12.0 ### Minor Changes diff --git a/packages/predicate/package.json b/packages/predicate/package.json index 9070a48f394..79c652140c5 100644 --- a/packages/predicate/package.json +++ b/packages/predicate/package.json @@ -1,6 +1,6 @@ { "name": "@fuel-ts/predicate", - "version": "0.12.0", + "version": "0.13.0", "description": "", "author": "Fuel Labs (https://fuel.network/)", "typedocMain": "src/index.ts", diff --git a/packages/predicate/src/test-predicate-address/src/main.sw b/packages/predicate/src/test-predicate-address/src/main.sw index 14bfc327e2b..96dde76e4f5 100644 --- a/packages/predicate/src/test-predicate-address/src/main.sw +++ b/packages/predicate/src/test-predicate-address/src/main.sw @@ -1,9 +1,9 @@ predicate; -use std::tx::get_predicate_data; +use std::inputs::input_predicate_data; fn main() -> bool { - let received: b256 = get_predicate_data(); + let received: b256 = input_predicate_data(0); let expected: b256 = 0xef86afa9696cf0dc6385e2c407a6e159a1103cefb7e2ae0636fb33d3cb2a9e4a; received == expected diff --git a/packages/predicate/src/test-predicate-struct/src/main.sw b/packages/predicate/src/test-predicate-struct/src/main.sw index 6acd779b37d..4fb3eaf6518 100644 --- a/packages/predicate/src/test-predicate-struct/src/main.sw +++ b/packages/predicate/src/test-predicate-struct/src/main.sw @@ -1,6 +1,6 @@ predicate; -use std::tx::get_predicate_data; +use std::inputs::input_predicate_data; struct Validation { has_account: bool, @@ -8,7 +8,7 @@ struct Validation { } fn main() -> bool { - let received: Validation = get_predicate_data(); + let received: Validation = input_predicate_data(0); let expected_has_account: bool = true; let expected_total_complete: u64 = 100; diff --git a/packages/predicate/src/test-predicate-u32/src/main.sw b/packages/predicate/src/test-predicate-u32/src/main.sw index adf6c2b98b8..bf0b0a6ae1c 100644 --- a/packages/predicate/src/test-predicate-u32/src/main.sw +++ b/packages/predicate/src/test-predicate-u32/src/main.sw @@ -1,9 +1,9 @@ predicate; -use std::tx::get_predicate_data; +use std::inputs::input_predicate_data; fn main() -> bool { - let received: u32 = get_predicate_data(); + let received: u32 = input_predicate_data(0); let expected: u32 = 1078; received == expected diff --git a/packages/providers/CHANGELOG.md b/packages/providers/CHANGELOG.md index b9facd678be..7928a39f8aa 100644 --- a/packages/providers/CHANGELOG.md +++ b/packages/providers/CHANGELOG.md @@ -1,5 +1,24 @@ # Change Log +## 0.13.0 + +### Minor Changes + +- [#458](https://github.com/FuelLabs/fuels-ts/pull/458) [`9190cee`](https://github.com/FuelLabs/fuels-ts/commit/9190cee45529b6c3fcffb2a12b1ef6319b2b39df) Thanks [@LuizAsFight](https://github.com/LuizAsFight)! - Upgrade compatibility to fuel-core v0.10.1 + +* [#472](https://github.com/FuelLabs/fuels-ts/pull/472) [`5d4d6ce`](https://github.com/FuelLabs/fuels-ts/commit/5d4d6ce7fa1a23deae3f41be94c9fe2ee9851772) Thanks [@QuinnLee](https://github.com/QuinnLee)! - Add `excludeId` to getCoinsToSpend + +### Patch Changes + +- Updated dependencies [[`745e65b`](https://github.com/FuelLabs/fuels-ts/commit/745e65bc563ab8cace6f73e2715a6eaaae93fda5), [`9190cee`](https://github.com/FuelLabs/fuels-ts/commit/9190cee45529b6c3fcffb2a12b1ef6319b2b39df), [`dfb2612`](https://github.com/FuelLabs/fuels-ts/commit/dfb261222c17cf6f158f475d91b3414996300066)]: + - @fuel-ts/abi-coder@0.13.0 + - @fuel-ts/transactions@0.13.0 + - @fuel-ts/address@0.13.0 + - @fuel-ts/constants@0.13.0 + - @fuel-ts/interfaces@0.13.0 + - @fuel-ts/keystore@0.13.0 + - @fuel-ts/math@0.13.0 + ## 0.12.0 ### Minor Changes diff --git a/packages/providers/codegen.json b/packages/providers/codegen.json index d7d72984110..324502ec0a7 100644 --- a/packages/providers/codegen.json +++ b/packages/providers/codegen.json @@ -10,7 +10,6 @@ { "typescript-graphql-request": {} } ], "config": { - "strictScalars": true, "scalars": { "DateTime": "string", "HexString": "string", diff --git a/packages/providers/fuel-core-schema.graphql b/packages/providers/fuel-core-schema.graphql index 2e10e70ba91..b02c9fb8966 100644 --- a/packages/providers/fuel-core-schema.graphql +++ b/packages/providers/fuel-core-schema.graphql @@ -18,6 +18,11 @@ type BalanceConnection { A list of edges. """ edges: [BalanceEdge!]! + + """ + A list of nodes. + """ + nodes: [Balance!]! } """ @@ -30,7 +35,7 @@ type BalanceEdge { cursor: String! """ - "The item at the end of the edge + The item at the end of the edge """ node: Balance! } @@ -60,6 +65,11 @@ type BlockConnection { A list of edges. """ edges: [BlockEdge!]! + + """ + A list of nodes. + """ + nodes: [Block!]! } """ @@ -72,7 +82,7 @@ type BlockEdge { cursor: String! """ - "The item at the end of the edge + The item at the end of the edge """ node: Block! } @@ -120,6 +130,11 @@ type CoinConnection { A list of edges. """ edges: [CoinEdge!]! + + """ + A list of nodes. + """ + nodes: [Coin!]! } """ @@ -132,7 +147,7 @@ type CoinEdge { cursor: String! """ - "The item at the end of the edge + The item at the end of the edge """ node: Coin! } @@ -168,11 +183,12 @@ type ConsensusParameters { maxGasPerTx: U64! maxScriptLength: U64! maxScriptDataLength: U64! - maxStaticContracts: U64! maxStorageSlots: U64! maxPredicateLength: U64! maxPredicateDataLength: U64! gasPriceFactor: U64! + gasPerByte: U64! + maxMessageDataLength: U64! } type Contract { @@ -197,6 +213,11 @@ type ContractBalanceConnection { A list of edges. """ edges: [ContractBalanceEdge!]! + + """ + A list of nodes. + """ + nodes: [ContractBalance!]! } """ @@ -209,7 +230,7 @@ type ContractBalanceEdge { cursor: String! """ - "The item at the end of the edge + The item at the end of the edge """ node: ContractBalance! } @@ -250,13 +271,14 @@ type FailureStatus { scalar HexString -union Input = InputCoin | InputContract +union Input = InputCoin | InputContract | InputMessage type InputCoin { utxoId: UtxoId! owner: Address! amount: U64! assetId: AssetId! + txPointer: TxPointer! witnessIndex: Int! maturity: U64! predicate: HexString! @@ -267,9 +289,73 @@ type InputContract { utxoId: UtxoId! balanceRoot: Bytes32! stateRoot: Bytes32! + txPointer: TxPointer! contract: Contract! } +type InputMessage { + messageId: MessageId! + sender: Address! + recipient: Address! + amount: U64! + nonce: U64! + owner: Address! + witnessIndex: Int! + data: HexString! + predicate: HexString! + predicateData: HexString! +} + +type Message { + amount: U64! + sender: Address! + recipient: Address! + owner: Address! + nonce: U64! + data: [Int!]! + daHeight: U64! + fuelBlockSpend: U64 +} + +type MessageConnection { + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + A list of edges. + """ + edges: [MessageEdge!]! + + """ + A list of nodes. + """ + nodes: [Message!]! +} + +""" +An edge in a connection. +""" +type MessageEdge { + """ + A cursor for use in pagination + """ + cursor: String! + + """ + The item at the end of the edge + """ + node: Message! +} + +scalar MessageId + +type MessageOutput { + recipient: Address! + amount: U64! +} + type Mutation { startSession: ID! endSession(id: ID!): Boolean! @@ -289,6 +375,7 @@ type Mutation { Submits transaction to the txpool """ submit(tx: HexString!): Transaction! + produceBlocks(blocksToProduce: U64!): U64! } type NodeInfo { @@ -296,7 +383,6 @@ type NodeInfo { predicates: Boolean! vmBacktrace: Boolean! minGasPrice: U64! - minBytePrice: U64! maxTx: U64! maxDepth: U64! nodeVersion: String! @@ -305,7 +391,7 @@ type NodeInfo { union Output = CoinOutput | ContractOutput - | WithdrawalOutput + | MessageOutput | ChangeOutput | VariableOutput | ContractCreated @@ -463,6 +549,16 @@ type Query { before: String ): ContractBalanceConnection! nodeInfo: NodeInfo! + messages( + """ + address of the owner + """ + owner: Address + first: Int + after: String + last: Int + before: String + ): MessageConnection! } type Receipt { @@ -490,6 +586,10 @@ type Receipt { result: U64 gasUsed: U64 data: HexString + messageId: MessageId + sender: Address + recipient: Address + nonce: Bytes32 } enum ReceiptType { @@ -503,6 +603,7 @@ enum ReceiptType { TRANSFER TRANSFER_OUT SCRIPT_RESULT + MESSAGE_OUT } enum ReturnType { @@ -514,6 +615,7 @@ enum ReturnType { type RunResult { state: RunState! breakpoint: OutputBreakpoint + jsonReceipts: [String!]! } enum RunState { @@ -558,7 +660,6 @@ type Transaction { inputContracts: [Contract!]! gasPrice: U64! gasLimit: U64! - bytePrice: U64! maturity: U64! isScript: Boolean! inputs: [Input!]! @@ -572,7 +673,6 @@ type Transaction { bytecodeWitnessIndex: Int bytecodeLength: U64 salt: Salt - staticContracts: [Contract!] storageSlots: [HexString!] """ @@ -591,6 +691,11 @@ type TransactionConnection { A list of edges. """ edges: [TransactionEdge!]! + + """ + A list of nodes. + """ + nodes: [Transaction!]! } """ @@ -603,7 +708,7 @@ type TransactionEdge { cursor: String! """ - "The item at the end of the edge + The item at the end of the edge """ node: Transaction! } @@ -612,6 +717,8 @@ scalar TransactionId union TransactionStatus = SubmittedStatus | SuccessStatus | FailureStatus +scalar TxPointer + scalar U64 scalar UtxoId @@ -621,9 +728,3 @@ type VariableOutput { amount: U64! assetId: AssetId! } - -type WithdrawalOutput { - to: Address! - amount: U64! - assetId: AssetId! -} diff --git a/packages/providers/package.json b/packages/providers/package.json index beac14a4b1c..3d462dae9e7 100644 --- a/packages/providers/package.json +++ b/packages/providers/package.json @@ -1,6 +1,6 @@ { "name": "@fuel-ts/providers", - "version": "0.12.0", + "version": "0.13.0", "description": "", "author": "Fuel Labs (https://fuel.network/)", "typedocMain": "./src/index.ts", diff --git a/packages/providers/src/coin.ts b/packages/providers/src/coin.ts index 8946569a128..6961bcb7233 100644 --- a/packages/providers/src/coin.ts +++ b/packages/providers/src/coin.ts @@ -11,7 +11,7 @@ export type Coin = { amount: BN; owner: string; status: CoinStatus; - maturity: BN; + maturity: number; blockCreated: BN; }; diff --git a/packages/providers/src/operations.graphql b/packages/providers/src/operations.graphql index 3032ff3d342..c621f907f58 100644 --- a/packages/providers/src/operations.graphql +++ b/packages/providers/src/operations.graphql @@ -89,7 +89,6 @@ query getInfo { nodeInfo { nodeVersion minGasPrice - minBytePrice } } diff --git a/packages/providers/src/provider.test.ts b/packages/providers/src/provider.test.ts index cbeb933dd9f..dd2473318fe 100644 --- a/packages/providers/src/provider.test.ts +++ b/packages/providers/src/provider.test.ts @@ -13,7 +13,7 @@ describe('Provider', () => { const version = await provider.getVersion(); - expect(version).toEqual('0.9.6'); + expect(version).toEqual('0.10.1'); }); it('can call()', async () => { @@ -23,7 +23,6 @@ describe('Provider', () => { type: TransactionType.Script, gasPrice: 0, gasLimit: 1000000, - bytePrice: 0, script: /* Opcode::ADDI(0x10, REG_ZERO, 0xCA) @@ -43,15 +42,15 @@ describe('Provider', () => { val1: bn(186), val2: bn(0), val3: bn(0), - pc: bn(0x2878), - is: bn(0x2870), + pc: bn(0x2870), + is: bn(0x2868), }, { type: ReceiptType.Return, id: ZeroBytes32, val: bn(1), - pc: bn(0x287c), - is: bn(0x2870), + pc: bn(0x2874), + is: bn(0x2868), }, { type: ReceiptType.ScriptResult, @@ -75,7 +74,6 @@ describe('Provider', () => { type: TransactionType.Script, gasPrice: 0, gasLimit: 1000000, - bytePrice: 0, script: /* Opcode::ADDI(0x10, REG_ZERO, 0xCA) @@ -129,18 +127,17 @@ describe('Provider', () => { expect(endSessionSuccess).toEqual(true); }); - it('can get chain info including gasPriceFactor', async () => { + it('can get chain info including gasPriceFactor and gasPerByte', async () => { const provider = new Provider('http://127.0.0.1:4000/graphql'); const { consensusParameters } = await provider.getChain(); expect(toNumber(consensusParameters.gasPriceFactor)).toBeGreaterThan(0); }); - it('can get node info including minBytePrice and minGasPrice', async () => { + it('can get node info including minGasPrice', async () => { const provider = new Provider('http://127.0.0.1:4000/graphql'); - const { minBytePrice, minGasPrice } = await provider.getNodeInfo(); + const { minGasPrice } = await provider.getNodeInfo(); - expect(minBytePrice).toBeDefined(); expect(minGasPrice).toBeDefined(); }); }); diff --git a/packages/providers/src/provider.ts b/packages/providers/src/provider.ts index a2934228e27..69ad5416018 100644 --- a/packages/providers/src/provider.ts +++ b/packages/providers/src/provider.ts @@ -85,17 +85,13 @@ export type ChainInfo = { * Node information */ export type NodeInfo = { - minBytePrice: BN; minGasPrice: BN; nodeVersion: string; }; export type TransactionCost = { minGasPrice: BN; - minBytePrice: BN; gasPrice: BN; - bytePrice: BN; - byteSize: BN; gasUsed: BN; fee: BN; }; @@ -142,7 +138,6 @@ const processGqlChain = (chain: GqlChainInfoFragmentFragment): ChainInfo => ({ }); const processNodeInfo = (nodeInfo: GqlGetInfoQuery['nodeInfo']) => ({ - minBytePrice: bn(nodeInfo.minBytePrice), minGasPrice: bn(nodeInfo.minGasPrice), nodeVersion: nodeInfo.nodeVersion, }); @@ -165,7 +160,7 @@ export type CursorPaginationArgs = { export type BuildPredicateOptions = { fundTransaction?: boolean; -} & Pick; +} & Pick; /** * Provider Call transaction params @@ -239,10 +234,7 @@ export default class Provider { ): Promise { const transactionRequest = transactionRequestify(transactionRequestLike); const encodedTransaction = hexlify(transactionRequest.toTransactionBytes()); - const { gasUsed, minGasPrice, minBytePrice } = await this.getTransactionCost( - transactionRequest, - 0 - ); + const { gasUsed, minGasPrice } = await this.getTransactionCost(transactionRequest, 0); // Fail transaction before submit to avoid submit failure // Resulting in lost of funds on a OutOfGas situation. @@ -254,10 +246,6 @@ export default class Provider { throw new Error( `gasPrice(${transactionRequest.gasPrice}) is lower than the required ${minGasPrice}` ); - } else if (bn(minBytePrice).gt(bn(transactionRequest.bytePrice))) { - throw new Error( - `bytePrice(${transactionRequest.bytePrice}) is lower than the required ${minBytePrice}` - ); } const { @@ -302,34 +290,26 @@ export default class Provider { tolerance: number = 0.2 ): Promise { const transactionRequest = transactionRequestify(cloneDeep(transactionRequestLike)); - const { minBytePrice, minGasPrice } = await this.getNodeInfo(); - + const { minGasPrice } = await this.getNodeInfo(); const gasPrice = max(transactionRequest.gasPrice, minGasPrice); - const bytePrice = max(transactionRequest.bytePrice, minBytePrice); const margin = 1 + tolerance; // Set gasLimit to the maximum of the chain - // and bytePrice and gasPrice to 0 for measure + // and gasPrice to 0 for measure // Transaction without arrive to OutOfGas transactionRequest.gasLimit = MAX_GAS_PER_TX; - transactionRequest.bytePrice = bn(0); transactionRequest.gasPrice = bn(0); // Execute dryRun not validated transaction to query gasUsed const { receipts } = await this.call(transactionRequest); const gasUsed = multiply(getGasUsedFromReceipts(receipts), margin); - const byteSize = transactionRequest.chargeableByteSize(); const gasFee = calculatePriceWithFactor(gasUsed, gasPrice, GAS_PRICE_FACTOR); - const byteFee = calculatePriceWithFactor(byteSize, bytePrice, GAS_PRICE_FACTOR); return { minGasPrice, - minBytePrice, - bytePrice, gasPrice, gasUsed, - byteSize, - fee: bn(byteFee).add(gasFee), + fee: gasFee, }; } @@ -358,7 +338,7 @@ export default class Provider { amount: bn(coin.amount), owner: coin.owner, status: coin.status, - maturity: bn(coin.maturity), + maturity: bn(coin.maturity).toNumber(), blockCreated: bn(coin.blockCreated), })); } @@ -394,7 +374,7 @@ export default class Provider { assetId: coin.assetId, amount: bn(coin.amount), owner: coin.owner, - maturity: bn(coin.maturity), + maturity: bn(coin.maturity).toNumber(), blockCreated: bn(coin.blockCreated), })); } diff --git a/packages/providers/src/transaction-request/input.ts b/packages/providers/src/transaction-request/input.ts index 24a46cf6602..2e94ddbef7a 100644 --- a/packages/providers/src/transaction-request/input.ts +++ b/packages/providers/src/transaction-request/input.ts @@ -2,31 +2,46 @@ import type { BytesLike } from '@ethersproject/bytes'; import { arrayify, hexlify } from '@ethersproject/bytes'; import { ZeroBytes32 } from '@fuel-ts/constants'; import type { BigNumberish } from '@fuel-ts/math'; -import { bn } from '@fuel-ts/math'; +import { bn, toNumber } from '@fuel-ts/math'; import type { Input } from '@fuel-ts/transactions'; import { InputType } from '@fuel-ts/transactions'; export type CoinTransactionRequestInput = { type: InputType.Coin; + /** UTXO ID */ id: BytesLike; + /** Owning address or script hash */ owner: BytesLike; + /** Amount of coins */ amount: BigNumberish; + /** Asset ID of the coins */ assetId: BytesLike; + + /** Points to the TX whose output is being spent. (TxPointer) */ + txPointer: BytesLike; + /** Index of witness that authorizes spending the coin */ witnessIndex: number; + /** UTXO being spent must have been created at least this many blocks ago */ - maturity?: BigNumberish; + maturity?: number; + /** Predicate bytecode */ predicate?: BytesLike; + /** Predicate input data (parameters) */ predicateData?: BytesLike; }; export type ContractTransactionRequestInput = { type: InputType.Contract; + + /** Points to the TX whose output is being spent. (TxPointer) */ + txPointer: BytesLike; + /** Contract ID */ contractId: BytesLike; }; @@ -46,8 +61,12 @@ export const inputify = (value: TransactionRequestInput): Input => { owner: hexlify(value.owner), amount: bn(value.amount), assetId: hexlify(value.assetId), + txPointer: { + blockHeight: toNumber(arrayify(value.txPointer).slice(0, 8)), + txIndex: toNumber(arrayify(value.txPointer).slice(8, 16)), + }, witnessIndex: value.witnessIndex, - maturity: bn(value.maturity ?? 0), + maturity: value.maturity ?? 0, predicateLength: predicate.length, predicateDataLength: predicateData.length, predicate: hexlify(predicate), @@ -63,6 +82,10 @@ export const inputify = (value: TransactionRequestInput): Input => { }, balanceRoot: ZeroBytes32, stateRoot: ZeroBytes32, + txPointer: { + blockHeight: toNumber(arrayify(value.txPointer).slice(0, 8)), + txIndex: toNumber(arrayify(value.txPointer).slice(8, 16)), + }, contractID: hexlify(value.contractId), }; } diff --git a/packages/providers/src/transaction-request/transaction-request.ts b/packages/providers/src/transaction-request/transaction-request.ts index c65b758475b..90e40509467 100644 --- a/packages/providers/src/transaction-request/transaction-request.ts +++ b/packages/providers/src/transaction-request/transaction-request.ts @@ -10,9 +10,10 @@ import type { AbstractScript, } from '@fuel-ts/interfaces'; import type { BigNumberish, BN } from '@fuel-ts/math'; -import { bn } from '@fuel-ts/math'; +import { bn, multiply } from '@fuel-ts/math'; import type { Transaction } from '@fuel-ts/transactions'; import { + GAS_PER_BYTE, TransactionType, TransactionCoder, InputType, @@ -63,10 +64,8 @@ interface BaseTransactionRequestLike { gasPrice?: BigNumberish; /** Gas limit for transaction */ gasLimit?: BigNumberish; - /** Price per transaction byte */ - bytePrice?: BigNumberish; /** Block until which tx cannot be included */ - maturity?: BigNumberish; + maturity?: number; /** List of inputs */ inputs?: TransactionRequestInput[]; /** List of outputs */ @@ -98,7 +97,7 @@ export class NoWitnessByOwnerError extends Error { /** * The provider required at least 1 native coin - * even if the gasPrice and bytePrice are 0 + * even if the gasPrice = 0 */ export const MIN_TRANSACTION_AMOUNT = 1n; @@ -109,10 +108,8 @@ abstract class BaseTransactionRequest implements BaseTransactionRequestLike { gasPrice: BN; /** Gas limit for transaction */ gasLimit: BN; - /** Price per transaction byte */ - bytePrice: BN; /** Block until which tx cannot be included */ - maturity: BN; + maturity: number; /** List of inputs */ inputs: TransactionRequestInput[] = []; /** List of outputs */ @@ -123,7 +120,6 @@ abstract class BaseTransactionRequest implements BaseTransactionRequestLike { constructor({ gasPrice, gasLimit, - bytePrice, maturity, inputs, outputs, @@ -131,8 +127,7 @@ abstract class BaseTransactionRequest implements BaseTransactionRequestLike { }: BaseTransactionRequestLike = {}) { this.gasPrice = bn(gasPrice ?? 0); this.gasLimit = bn(gasLimit ?? 0); - this.bytePrice = bn(bytePrice ?? 0); - this.maturity = bn(maturity ?? 0); + this.maturity = maturity ?? 0; this.inputs = [...(inputs ?? [])]; this.outputs = [...(outputs ?? [])]; this.witnesses = [...(witnesses ?? [])]; @@ -148,7 +143,6 @@ abstract class BaseTransactionRequest implements BaseTransactionRequestLike { return { gasPrice: this.gasPrice, gasLimit: this.gasLimit, - bytePrice: this.bytePrice, maturity: this.maturity, inputs, outputs, @@ -259,6 +253,7 @@ abstract class BaseTransactionRequest implements BaseTransactionRequestLike { type: InputType.Coin, ...coin, witnessIndex, + txPointer: '0x00000000000000000000000000000000', }); // Find the ChangeOutput for the AssetId of the Coin @@ -330,21 +325,14 @@ abstract class BaseTransactionRequest implements BaseTransactionRequestLike { * Return the minimum amount in native coins required to create * a transaction. * - * Note: this is required even if the gasPrice and bytePrice - * are set to zero. + * Note: this is required even gasPrice = 0 */ calculateFee(): CoinQuantity { const gasFee = calculatePriceWithFactor(this.gasLimit, this.gasPrice, GAS_PRICE_FACTOR); - const byteFee = calculatePriceWithFactor( - this.chargeableByteSize(), - this.bytePrice, - GAS_PRICE_FACTOR - ); - const totalFee = gasFee.add(byteFee.isZero() ? bn(1) : byteFee); return { assetId: NativeAssetId, - amount: totalFee, + amount: gasFee.isZero() ? bn(1) : gasFee, }; } } @@ -438,6 +426,7 @@ export class ScriptTransactionRequest extends BaseTransactionRequest { const inputIndex = super.pushInput({ type: InputType.Contract, contractId: contractAddress.toB256(), + txPointer: '0x00000000000000000000000000000000', }); this.pushOutput({ @@ -452,8 +441,6 @@ export interface CreateTransactionRequestLike extends BaseTransactionRequestLike bytecodeWitnessIndex?: number; /** Salt */ salt?: BytesLike; - /** List of static contracts */ - staticContracts?: BytesLike[]; /** List of storage slots to initialize */ storageSlots?: TransactionRequestStorageSlot[]; } @@ -472,39 +459,32 @@ export class CreateTransactionRequest extends BaseTransactionRequest { bytecodeWitnessIndex: number; /** Salt */ salt: string; - /** List of static contracts */ - staticContracts: string[]; /** List of storage slots to initialize */ storageSlots: TransactionRequestStorageSlot[]; constructor({ bytecodeWitnessIndex, salt, - staticContracts, storageSlots, ...rest }: CreateTransactionRequestLike = {}) { super(rest); this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0; this.salt = hexlify(salt ?? ZeroBytes32); - this.staticContracts = [...(staticContracts?.map((value) => hexlify(value)) ?? [])]; this.storageSlots = [...(storageSlots ?? [])]; } toTransaction(): Transaction { const baseTransaction = this.getBaseTransaction(); const bytecodeWitnessIndex = this.bytecodeWitnessIndex; - const staticContracts = this.staticContracts ?? []; const storageSlots = this.storageSlots?.map(storageSlotify) ?? []; return { type: TransactionType.Create, ...baseTransaction, bytecodeLength: baseTransaction.witnesses[bytecodeWitnessIndex].dataLength / 4, bytecodeWitnessIndex, - staticContractsCount: staticContracts.length, storageSlotsCount: storageSlots.length, salt: this.salt ? hexlify(this.salt) : ZeroBytes32, - staticContracts: staticContracts.map((id) => hexlify(id)), storageSlots, }; } diff --git a/packages/script/CHANGELOG.md b/packages/script/CHANGELOG.md index 20788d29414..900cd84f671 100644 --- a/packages/script/CHANGELOG.md +++ b/packages/script/CHANGELOG.md @@ -1,5 +1,20 @@ # Change Log +## 0.13.0 + +### Minor Changes + +- [#456](https://github.com/FuelLabs/fuels-ts/pull/456) [`48285d4`](https://github.com/FuelLabs/fuels-ts/commit/48285d48b6929e3104c480dddb18d2878be6c478) Thanks [@QuinnLee](https://github.com/QuinnLee)! - Failures now output the reason + +### Patch Changes + +- Updated dependencies [[`745e65b`](https://github.com/FuelLabs/fuels-ts/commit/745e65bc563ab8cace6f73e2715a6eaaae93fda5), [`9190cee`](https://github.com/FuelLabs/fuels-ts/commit/9190cee45529b6c3fcffb2a12b1ef6319b2b39df), [`5d4d6ce`](https://github.com/FuelLabs/fuels-ts/commit/5d4d6ce7fa1a23deae3f41be94c9fe2ee9851772), [`dfb2612`](https://github.com/FuelLabs/fuels-ts/commit/dfb261222c17cf6f158f475d91b3414996300066)]: + - @fuel-ts/abi-coder@0.13.0 + - @fuel-ts/providers@0.13.0 + - @fuel-ts/transactions@0.13.0 + - @fuel-ts/wallet@0.13.0 + - @fuel-ts/constants@0.13.0 + ## 0.12.0 ### Patch Changes diff --git a/packages/script/package.json b/packages/script/package.json index eaaab5a2127..bba97d4dcfd 100644 --- a/packages/script/package.json +++ b/packages/script/package.json @@ -1,6 +1,6 @@ { "name": "@fuel-ts/script", - "version": "0.12.0", + "version": "0.13.0", "description": "", "author": "Fuel Labs (https://fuel.network/)", "typedocMain": "src/index.ts", diff --git a/packages/signer/CHANGELOG.md b/packages/signer/CHANGELOG.md index eb7041f0ce5..d0eef6a99d7 100644 --- a/packages/signer/CHANGELOG.md +++ b/packages/signer/CHANGELOG.md @@ -1,5 +1,14 @@ # Change Log +## 0.13.0 + +### Patch Changes + +- Updated dependencies []: + - @fuel-ts/hasher@0.13.0 + - @fuel-ts/address@0.13.0 + - @fuel-ts/keystore@0.13.0 + ## 0.12.0 ### Minor Changes diff --git a/packages/signer/package.json b/packages/signer/package.json index 267110e8e24..b13c729544a 100644 --- a/packages/signer/package.json +++ b/packages/signer/package.json @@ -1,6 +1,6 @@ { "name": "@fuel-ts/signer", - "version": "0.12.0", + "version": "0.13.0", "description": "Secp256k1 signer for the Fuel Network", "author": "Fuel Labs (https://fuel.network/)", "typedocMain": "./src/index.ts", diff --git a/packages/sparsemerkle/CHANGELOG.md b/packages/sparsemerkle/CHANGELOG.md index e2af0c1a75e..4cc4cf32ab7 100644 --- a/packages/sparsemerkle/CHANGELOG.md +++ b/packages/sparsemerkle/CHANGELOG.md @@ -1,5 +1,12 @@ # Change Log +## 0.13.0 + +### Patch Changes + +- Updated dependencies []: + - @fuel-ts/merkle-shared@0.13.0 + ## 0.12.0 ### Patch Changes diff --git a/packages/sparsemerkle/package.json b/packages/sparsemerkle/package.json index 3a9a66e30f9..7339e8f62be 100644 --- a/packages/sparsemerkle/package.json +++ b/packages/sparsemerkle/package.json @@ -1,6 +1,6 @@ { "name": "@fuel-ts/sparsemerkle", - "version": "0.12.0", + "version": "0.13.0", "description": "", "author": "Fuel Labs (https://fuel.network/)", "typedocMain": "src/index.ts", diff --git a/packages/testcases/CHANGELOG.md b/packages/testcases/CHANGELOG.md index 8a165fcbf7c..b1cd7449cd5 100644 --- a/packages/testcases/CHANGELOG.md +++ b/packages/testcases/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## 0.13.0 + +### Minor Changes + +- [#458](https://github.com/FuelLabs/fuels-ts/pull/458) [`9190cee`](https://github.com/FuelLabs/fuels-ts/commit/9190cee45529b6c3fcffb2a12b1ef6319b2b39df) Thanks [@LuizAsFight](https://github.com/LuizAsFight)! - Upgrade compatibility to fuel-core v0.10.1 + ## 0.12.0 ### Minor Changes diff --git a/packages/testcases/package.json b/packages/testcases/package.json index 085c929e7e6..7e253ba68f1 100644 --- a/packages/testcases/package.json +++ b/packages/testcases/package.json @@ -1,6 +1,6 @@ { "name": "@fuel-ts/testcases", - "version": "0.12.0", + "version": "0.13.0", "description": "", "author": "Fuel Labs (https://fuel.network/)", "files": [ diff --git a/packages/testcases/src/sendTransaction.json b/packages/testcases/src/sendTransaction.json index b9caab7902d..b55fc738146 100644 --- a/packages/testcases/src/sendTransaction.json +++ b/packages/testcases/src/sendTransaction.json @@ -3,7 +3,6 @@ "type": 0, "gasPrice": "0x00", "gasLimit": "0x0F4240", - "bytePrice": "0x00", "script": "0x24400000", "scriptData": "0x", "inputs": [ @@ -14,6 +13,7 @@ "amount": "0x01", "owner": "0xf1e92c42b90934aa6372e30bc568a326f6e66a1a0288595e6e3fbd392a4f3e6e", "maturity": 0, + "txPointer": "0x00000000000000000000000000000000", "witnessIndex": 0, "predicate": "0x", "predicateData": "0x" diff --git a/packages/testcases/src/signTransaction.json b/packages/testcases/src/signTransaction.json index bc14a4e7059..e6a17f82357 100644 --- a/packages/testcases/src/signTransaction.json +++ b/packages/testcases/src/signTransaction.json @@ -3,7 +3,6 @@ "type": 0, "gasPrice": "0x00", "gasLimit": "0x0F4240", - "bytePrice": "0x00", "script": "0x24400000", "scriptData": "0x", "inputs": [ @@ -14,6 +13,7 @@ "amount": "0x989680", "owner": "0xf1e92c42b90934aa6372e30bc568a326f6e66a1a0288595e6e3fbd392a4f3e6e", "maturity": 0, + "txPointer": "0x00000000000000000000000000000000", "witnessIndex": 0, "predicate": "0x", "predicateData": "0x" @@ -32,6 +32,6 @@ "privateKey": "0x5f70feeff1f229e4a95e1056e8b4d80d0b24b565674860cc213bdb07127ce1b1", "publicKey": "0x2f34bc0df4db0ec391792cedb05768832b49b1aa3a2dd8c30054d1af00f67d00b74b7acbbf3087c8e0b1a4c343db50aa471d21f278ff5ce09f07795d541fb47e", "address": "0xf1e92c42b90934aa6372e30bc568a326f6e66a1a0288595e6e3fbd392a4f3e6e", - "hashedTransaction": "0xabda624d33e5e15a34648e5d348b8fd4e4689d7fe01be4784d1040e9c374b506", - "signedTransaction": "0xa1287a24af13fc102cb9e60988b558d5575d7870032f64bafcc2deda2c99125fb25eca55a29a169de156cb30700965e2b26278fcc7ad375bc720440ea50ba3cb" + "hashedTransaction": "0xa60b5f900f07585e0a6e542c962286ca7ff2b8e7927a6be132289fec7567fa82", + "signedTransaction": "0x34482a581d1fe01ba84900581f5321a8b7d4ec65c3e7ca0de318ff8fcf45eb2c793c4b99e96400673e24b81b7aa47f042cad658f05a84e2f96f365eb0ce5a511" } diff --git a/packages/transactions/CHANGELOG.md b/packages/transactions/CHANGELOG.md index 346d68b968d..d52e38dddc6 100644 --- a/packages/transactions/CHANGELOG.md +++ b/packages/transactions/CHANGELOG.md @@ -1,5 +1,17 @@ # Change Log +## 0.13.0 + +### Minor Changes + +- [#458](https://github.com/FuelLabs/fuels-ts/pull/458) [`9190cee`](https://github.com/FuelLabs/fuels-ts/commit/9190cee45529b6c3fcffb2a12b1ef6319b2b39df) Thanks [@LuizAsFight](https://github.com/LuizAsFight)! - Upgrade compatibility to fuel-core v0.10.1 + +### Patch Changes + +- Updated dependencies [[`745e65b`](https://github.com/FuelLabs/fuels-ts/commit/745e65bc563ab8cace6f73e2715a6eaaae93fda5), [`9190cee`](https://github.com/FuelLabs/fuels-ts/commit/9190cee45529b6c3fcffb2a12b1ef6319b2b39df), [`dfb2612`](https://github.com/FuelLabs/fuels-ts/commit/dfb261222c17cf6f158f475d91b3414996300066)]: + - @fuel-ts/abi-coder@0.13.0 + - @fuel-ts/constants@0.13.0 + ## 0.12.0 ### Patch Changes diff --git a/packages/transactions/package.json b/packages/transactions/package.json index 36272147e31..3ae9b53bb0a 100644 --- a/packages/transactions/package.json +++ b/packages/transactions/package.json @@ -1,6 +1,6 @@ { "name": "@fuel-ts/transactions", - "version": "0.12.0", + "version": "0.13.0", "description": "", "author": "Fuel Labs (https://fuel.network/)", "typedocMain": "./src/index.ts", diff --git a/packages/transactions/src/coders/input.test.ts b/packages/transactions/src/coders/input.test.ts index 56c32751e0f..d4f6a33b2e3 100644 --- a/packages/transactions/src/coders/input.test.ts +++ b/packages/transactions/src/coders/input.test.ts @@ -14,8 +14,12 @@ describe('InputCoder', () => { owner: B256, amount: bn(0), assetId: B256, + txPointer: { + blockHeight: 0, + txIndex: 0, + }, witnessIndex: 0, - maturity: bn(0), + maturity: 0, predicateLength: 0, predicateDataLength: 0, predicate: '0x', @@ -25,7 +29,7 @@ describe('InputCoder', () => { const encoded = hexlify(new InputCoder().encode(input)); expect(encoded).toEqual( - '0x0000000000000000d5579c46dfcc7f18207013e65b44e4cb4e2c2298f4ac457ba8f82743f31e930b0000000000000000d5579c46dfcc7f18207013e65b44e4cb4e2c2298f4ac457ba8f82743f31e930b0000000000000000d5579c46dfcc7f18207013e65b44e4cb4e2c2298f4ac457ba8f82743f31e930b0000000000000000000000000000000000000000000000000000000000000000' + '0x0000000000000000d5579c46dfcc7f18207013e65b44e4cb4e2c2298f4ac457ba8f82743f31e930b0000000000000000d5579c46dfcc7f18207013e65b44e4cb4e2c2298f4ac457ba8f82743f31e930b0000000000000000d5579c46dfcc7f18207013e65b44e4cb4e2c2298f4ac457ba8f82743f31e930b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' ); const [decoded, offset] = new InputCoder().decode(arrayify(encoded), 0); @@ -41,12 +45,16 @@ describe('InputCoder', () => { balanceRoot: B256, stateRoot: B256, contractID: B256, + txPointer: { + blockHeight: 0, + txIndex: 0, + }, }; const encoded = hexlify(new InputCoder().encode(input)); expect(encoded).toEqual( - '0x0000000000000001d5579c46dfcc7f18207013e65b44e4cb4e2c2298f4ac457ba8f82743f31e930b0000000000000000d5579c46dfcc7f18207013e65b44e4cb4e2c2298f4ac457ba8f82743f31e930bd5579c46dfcc7f18207013e65b44e4cb4e2c2298f4ac457ba8f82743f31e930bd5579c46dfcc7f18207013e65b44e4cb4e2c2298f4ac457ba8f82743f31e930b' + '0x0000000000000001d5579c46dfcc7f18207013e65b44e4cb4e2c2298f4ac457ba8f82743f31e930b0000000000000000d5579c46dfcc7f18207013e65b44e4cb4e2c2298f4ac457ba8f82743f31e930bd5579c46dfcc7f18207013e65b44e4cb4e2c2298f4ac457ba8f82743f31e930b00000000000000000000000000000000d5579c46dfcc7f18207013e65b44e4cb4e2c2298f4ac457ba8f82743f31e930b' ); const [decoded, offset] = new InputCoder().decode(arrayify(encoded), 0); diff --git a/packages/transactions/src/coders/input.ts b/packages/transactions/src/coders/input.ts index 76c748766cd..7a999427de5 100644 --- a/packages/transactions/src/coders/input.ts +++ b/packages/transactions/src/coders/input.ts @@ -6,6 +6,8 @@ import U64Coder from '@fuel-ts/abi-coder/src/coders/u64'; import type { BN } from '@fuel-ts/math'; import { ByteArrayCoder } from './byte-array'; +import type { TxPointer } from './tx-pointer'; +import { TxPointerCoder } from './tx-pointer'; import type { UtxoId } from './utxo-id'; import { UtxoIdCoder } from './utxo-id'; @@ -16,24 +18,37 @@ export enum InputType /* u8 */ { export type InputCoin = { type: InputType.Coin; + /** UTXO ID (UtxoId) */ utxoID: UtxoId; + /** Owning address or script hash (b256) */ owner: string; + /** Amount of coins (u64) */ amount: BN; + /** Asset ID of the coins (b256) */ assetId: string; + + /** Points to the TX whose output is being spent. (TxPointer) */ + txPointer: TxPointer; + /** Index of witness that authorizes spending the coin (u8) */ witnessIndex: number; - /** UTXO being spent must have been created at least this many blocks ago (u64) */ - maturity: BN; + + /** UTXO being spent must have been created at least this many blocks ago (u32) */ + maturity: number; + /** Length of predicate, in instructions (u16) */ predicateLength: number; + /** Length of predicate input data, in bytes (u16) */ predicateDataLength: number; + /** Predicate bytecode (byte[]) */ predicate: string; + /** Predicate input data (parameters) (byte[]) */ predicateData: string; }; @@ -50,8 +65,9 @@ export class InputCoinCoder extends Coder { parts.push(new B256Coder().encode(value.owner)); parts.push(new U64Coder().encode(value.amount)); parts.push(new B256Coder().encode(value.assetId)); + parts.push(new TxPointerCoder().encode(value.txPointer)); parts.push(new NumberCoder('u8').encode(value.witnessIndex)); - parts.push(new U64Coder().encode(value.maturity)); + parts.push(new NumberCoder('u32').encode(value.maturity)); parts.push(new NumberCoder('u16').encode(value.predicateLength)); parts.push(new NumberCoder('u16').encode(value.predicateDataLength)); parts.push(new ByteArrayCoder(value.predicateLength).encode(value.predicate)); @@ -72,9 +88,11 @@ export class InputCoinCoder extends Coder { const amount = decoded; [decoded, o] = new B256Coder().decode(data, o); const assetId = decoded; + [decoded, o] = new TxPointerCoder().decode(data, o); + const txPointer = decoded; [decoded, o] = new NumberCoder('u8').decode(data, o); const witnessIndex = Number(decoded); - [decoded, o] = new U64Coder().decode(data, o); + [decoded, o] = new NumberCoder('u32').decode(data, o); const maturity = decoded; [decoded, o] = new NumberCoder('u16').decode(data, o); [decoded, o] = new NumberCoder('u16').decode(data, o); @@ -92,6 +110,7 @@ export class InputCoinCoder extends Coder { owner, amount, assetId, + txPointer, witnessIndex, maturity, predicateLength, @@ -110,12 +129,19 @@ export class InputCoinCoder extends Coder { export type InputContract = { type: InputType.Contract; + /** UTXO ID (UtxoId) */ utxoID: UtxoId; + /** Root of amount of coins owned by contract before transaction execution (b256) */ balanceRoot: string; + /** State root of contract before transaction execution (b256) */ stateRoot: string; + + /** Points to the TX whose output is being spent. (TxPointer) */ + txPointer: TxPointer; + /** Contract ID (b256) */ contractID: string; }; @@ -131,6 +157,7 @@ export class InputContractCoder extends Coder { parts.push(new UtxoIdCoder().encode(value.utxoID)); parts.push(new B256Coder().encode(value.balanceRoot)); parts.push(new B256Coder().encode(value.stateRoot)); + parts.push(new TxPointerCoder().encode(value.txPointer)); parts.push(new B256Coder().encode(value.contractID)); return concat(parts); @@ -146,6 +173,8 @@ export class InputContractCoder extends Coder { const balanceRoot = decoded; [decoded, o] = new B256Coder().decode(data, o); const stateRoot = decoded; + [decoded, o] = new TxPointerCoder().decode(data, o); + const txPointer = decoded; [decoded, o] = new B256Coder().decode(data, o); const contractID = decoded; @@ -155,6 +184,7 @@ export class InputContractCoder extends Coder { utxoID, balanceRoot, stateRoot, + txPointer, contractID, }, o, diff --git a/packages/transactions/src/coders/transaction.test.ts b/packages/transactions/src/coders/transaction.test.ts index cb50a9f35e5..2c8de1b8a79 100644 --- a/packages/transactions/src/coders/transaction.test.ts +++ b/packages/transactions/src/coders/transaction.test.ts @@ -12,8 +12,7 @@ describe('TransactionCoder', () => { type: TransactionType.Script, gasPrice: bn(0), gasLimit: bn(0), - bytePrice: bn(0), - maturity: bn(0), + maturity: 0, scriptLength: 0, scriptDataLength: 0, inputsCount: 0, @@ -30,7 +29,7 @@ describe('TransactionCoder', () => { const encoded = hexlify(new TransactionCoder().encode(transaction)); expect(encoded).toEqual( - '0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d5579c46dfcc7f18207013e65b44e4cb4e2c2298f4ac457ba8f82743f31e930b' + '0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d5579c46dfcc7f18207013e65b44e4cb4e2c2298f4ac457ba8f82743f31e930b' ); const [decoded, offset] = new TransactionCoder().decode(arrayify(encoded), 0); @@ -44,17 +43,14 @@ describe('TransactionCoder', () => { type: TransactionType.Create, gasPrice: bn(0), gasLimit: bn(0), - bytePrice: bn(0), - maturity: bn(0), + maturity: 0, bytecodeLength: 0, bytecodeWitnessIndex: 0, - staticContractsCount: 0, storageSlotsCount: 0, inputsCount: 0, outputsCount: 0, witnessesCount: 0, salt: B256, - staticContracts: [], storageSlots: [], inputs: [], outputs: [], @@ -64,7 +60,7 @@ describe('TransactionCoder', () => { const encoded = hexlify(new TransactionCoder().encode(transaction)); expect(encoded).toEqual( - '0x000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d5579c46dfcc7f18207013e65b44e4cb4e2c2298f4ac457ba8f82743f31e930b' + '0x0000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d5579c46dfcc7f18207013e65b44e4cb4e2c2298f4ac457ba8f82743f31e930b' ); const [decoded, offset] = new TransactionCoder().decode(arrayify(encoded), 0); diff --git a/packages/transactions/src/coders/transaction.ts b/packages/transactions/src/coders/transaction.ts index 2c815fcfddc..8c086995189 100644 --- a/packages/transactions/src/coders/transaction.ts +++ b/packages/transactions/src/coders/transaction.ts @@ -22,34 +22,46 @@ export enum TransactionType /* u8 */ { export type TransactionScript = { type: TransactionType.Script; + /** Gas price for transaction (u64) */ gasPrice: BN; + /** Gas limit for transaction (u64) */ gasLimit: BN; - /** Price per transaction byte (u64) */ - bytePrice: BN; - /** Block until which tx cannot be included (u64) */ - maturity: BN; + + /** Block until which tx cannot be included (u32) */ + maturity: number; + /** Script length, in instructions (u16) */ scriptLength: number; + /** Length of script input data, in bytes (u16) */ scriptDataLength: number; + /** Number of inputs (u8) */ inputsCount: number; + /** Number of outputs (u8) */ outputsCount: number; + /** Number of witnesses (u8) */ witnessesCount: number; + /** Merkle root of receipts (b256) */ receiptsRoot: string; + /** Script to execute (byte[]) */ script: string; + /** Script input data (parameters) (byte[]) */ scriptData: string; + /** List of inputs (Input[]) */ inputs: Input[]; + /** List of outputs (Output[]) */ outputs: Output[]; + /** List of witnesses (Witness[]) */ witnesses: Witness[]; }; @@ -64,8 +76,7 @@ export class TransactionScriptCoder extends Coder { + it('can encode TxPointer', () => { + const txPointer: TxPointer = { + blockHeight: 10, + txIndex: 1, + }; + + const encoded = hexlify(new TxPointerCoder().encode(txPointer)); + + expect(encoded).toEqual('0x000000000000000a0000000000000001'); + + const [decoded, offset] = new TxPointerCoder().decode(arrayify(encoded), 0); + + expect(offset).toEqual(16); + expect(decoded).toEqual(txPointer); + }); + it('does not encode bad TxPointer', () => { + const txPointer: TxPointer = { + // @ts-expect-error: Values shouldn't be assignable + blockHeight: B256, + // @ts-expect-error: Values shouldn't be assignable + txIndex: B256, + }; + + expect(() => { + new TxPointerCoder().encode(txPointer); + }).toThrow(); + }); +}); diff --git a/packages/transactions/src/coders/tx-pointer.ts b/packages/transactions/src/coders/tx-pointer.ts new file mode 100644 index 00000000000..5e9f1dbffea --- /dev/null +++ b/packages/transactions/src/coders/tx-pointer.ts @@ -0,0 +1,21 @@ +import { NumberCoder, StructCoder } from '@fuel-ts/abi-coder'; + +export type TxPointer = { + /** Block height (u32) */ + blockHeight: number; + + /** Transaction index (u16) */ + txIndex: number; +}; + +export class TxPointerCoder extends StructCoder<{ + blockHeight: NumberCoder; + txIndex: NumberCoder; +}> { + constructor() { + super('TxPointer', { + blockHeight: new NumberCoder('u32'), + txIndex: new NumberCoder('u16'), + }); + } +} diff --git a/packages/transactions/src/consts.ts b/packages/transactions/src/consts.ts index ef5f585f1b6..b805cbdd684 100644 --- a/packages/transactions/src/consts.ts +++ b/packages/transactions/src/consts.ts @@ -12,16 +12,19 @@ export const MAX_OUTPUTS = 8; /** Maximum number of witnesses. */ export const MAX_WITNESSES = 16; +/** Maximum gas per transaction. */ +export const MAX_GAS_PER_TX = bn(100000000); + /** * Gas Price factor this is used to calculate * This is used to calculate the gas fee in Native Coins. * Ex.: transactionFee = Math.ceil( / MAX_GAS_PER_TX); */ -export const MAX_GAS_PER_TX = bn(100000000); - -/** Maximum gas per transaction. */ export const GAS_PRICE_FACTOR = bn(1000000); +/** Gas charged per byte of the transaction. */ +export const GAS_PER_BYTE = bn(4); + // TODO: set max script length const /** Maximum length of script, in instructions. */ export const MAX_SCRIPT_LENGTH = 1024 * 1024 * 1024; diff --git a/packages/transactions/src/index.ts b/packages/transactions/src/index.ts index 557f88a330c..aadb3c15f53 100644 --- a/packages/transactions/src/index.ts +++ b/packages/transactions/src/index.ts @@ -4,5 +4,6 @@ export * from './coders/receipt'; export * from './coders/storage-slot'; export * from './coders/transaction'; export * from './coders/witness'; +export * from './coders/tx-pointer'; export * from './coders/utxo-id'; export * from './consts'; diff --git a/packages/typechain-target-fuels/CHANGELOG.md b/packages/typechain-target-fuels/CHANGELOG.md index bc591a37fe3..0d84c850236 100644 --- a/packages/typechain-target-fuels/CHANGELOG.md +++ b/packages/typechain-target-fuels/CHANGELOG.md @@ -1,5 +1,7 @@ # Change Log +## 0.13.0 + ## 0.12.0 ## 0.11.0 diff --git a/packages/typechain-target-fuels/package.json b/packages/typechain-target-fuels/package.json index 8cfc3162b74..056e274ea8e 100644 --- a/packages/typechain-target-fuels/package.json +++ b/packages/typechain-target-fuels/package.json @@ -1,6 +1,6 @@ { "name": "typechain-target-fuels", - "version": "0.12.0", + "version": "0.13.0", "description": "", "author": "Fuel Labs (https://fuel.network/)", "typedocMain": "src/index.ts", diff --git a/packages/wallet-manager/CHANGELOG.md b/packages/wallet-manager/CHANGELOG.md index 8c128dee063..93e239ca2eb 100644 --- a/packages/wallet-manager/CHANGELOG.md +++ b/packages/wallet-manager/CHANGELOG.md @@ -1,5 +1,22 @@ # Change Log +## 0.13.0 + +### Minor Changes + +- [#477](https://github.com/FuelLabs/fuels-ts/pull/477) [`61d6e6b`](https://github.com/FuelLabs/fuels-ts/commit/61d6e6b3d0fde7f28d3a94a967ce0ac85c2f1bf7) Thanks [@luizstacio](https://github.com/luizstacio)! - Change default derivation from non-hardened to hardened address. And add custom derive path config. + +* [#458](https://github.com/FuelLabs/fuels-ts/pull/458) [`9190cee`](https://github.com/FuelLabs/fuels-ts/commit/9190cee45529b6c3fcffb2a12b1ef6319b2b39df) Thanks [@LuizAsFight](https://github.com/LuizAsFight)! - Upgrade compatibility to fuel-core v0.10.1 + +### Patch Changes + +- Updated dependencies [[`9190cee`](https://github.com/FuelLabs/fuels-ts/commit/9190cee45529b6c3fcffb2a12b1ef6319b2b39df), [`5d4d6ce`](https://github.com/FuelLabs/fuels-ts/commit/5d4d6ce7fa1a23deae3f41be94c9fe2ee9851772)]: + - @fuel-ts/wallet@0.13.0 + - @fuel-ts/address@0.13.0 + - @fuel-ts/interfaces@0.13.0 + - @fuel-ts/keystore@0.13.0 + - @fuel-ts/mnemonic@0.13.0 + ## 0.12.0 ### Minor Changes diff --git a/packages/wallet-manager/package.json b/packages/wallet-manager/package.json index 8c1e4f7a34f..c4f225ef819 100644 --- a/packages/wallet-manager/package.json +++ b/packages/wallet-manager/package.json @@ -1,6 +1,6 @@ { "name": "@fuel-ts/wallet-manager", - "version": "0.12.0", + "version": "0.13.0", "description": "", "author": "Fuel Labs (https://fuel.network/)", "typedocMain": "./src/index.ts", diff --git a/packages/wallet/CHANGELOG.md b/packages/wallet/CHANGELOG.md index ac8a1892d14..a1793a19892 100644 --- a/packages/wallet/CHANGELOG.md +++ b/packages/wallet/CHANGELOG.md @@ -1,5 +1,27 @@ # Change Log +## 0.13.0 + +### Minor Changes + +- [#458](https://github.com/FuelLabs/fuels-ts/pull/458) [`9190cee`](https://github.com/FuelLabs/fuels-ts/commit/9190cee45529b6c3fcffb2a12b1ef6319b2b39df) Thanks [@LuizAsFight](https://github.com/LuizAsFight)! - Upgrade compatibility to fuel-core v0.10.1 + +* [#472](https://github.com/FuelLabs/fuels-ts/pull/472) [`5d4d6ce`](https://github.com/FuelLabs/fuels-ts/commit/5d4d6ce7fa1a23deae3f41be94c9fe2ee9851772) Thanks [@QuinnLee](https://github.com/QuinnLee)! - Add `excludeId` to getCoinsToSpend + +### Patch Changes + +- Updated dependencies [[`745e65b`](https://github.com/FuelLabs/fuels-ts/commit/745e65bc563ab8cace6f73e2715a6eaaae93fda5), [`9190cee`](https://github.com/FuelLabs/fuels-ts/commit/9190cee45529b6c3fcffb2a12b1ef6319b2b39df), [`5d4d6ce`](https://github.com/FuelLabs/fuels-ts/commit/5d4d6ce7fa1a23deae3f41be94c9fe2ee9851772), [`dfb2612`](https://github.com/FuelLabs/fuels-ts/commit/dfb261222c17cf6f158f475d91b3414996300066)]: + - @fuel-ts/abi-coder@0.13.0 + - @fuel-ts/providers@0.13.0 + - @fuel-ts/transactions@0.13.0 + - @fuel-ts/hasher@0.13.0 + - @fuel-ts/signer@0.13.0 + - @fuel-ts/hdwallet@0.13.0 + - @fuel-ts/constants@0.13.0 + - @fuel-ts/interfaces@0.13.0 + - @fuel-ts/math@0.13.0 + - @fuel-ts/mnemonic@0.13.0 + ## 0.12.0 ### Minor Changes diff --git a/packages/wallet/package.json b/packages/wallet/package.json index 1640360d98b..e14bc50be37 100644 --- a/packages/wallet/package.json +++ b/packages/wallet/package.json @@ -1,6 +1,6 @@ { "name": "@fuel-ts/wallet", - "version": "0.12.0", + "version": "0.13.0", "description": "", "author": "Fuel Labs (https://fuel.network/)", "typedocMain": "./src/index.ts", diff --git a/packages/wallet/src/test-utils.ts b/packages/wallet/src/test-utils.ts index 44bc03ac65d..f18034d6998 100644 --- a/packages/wallet/src/test-utils.ts +++ b/packages/wallet/src/test-utils.ts @@ -11,7 +11,6 @@ export const seedWallet = async (wallet: Wallet, quantities: CoinQuantityLike[]) // Create transaction const request = new ScriptTransactionRequest({ gasLimit: 10000, - bytePrice: 1, gasPrice: 1, }); request.addCoins(coins); diff --git a/packages/wallet/src/transfer.test.ts b/packages/wallet/src/transfer.test.ts index 00478b74ce3..8adb90358cd 100644 --- a/packages/wallet/src/transfer.test.ts +++ b/packages/wallet/src/transfer.test.ts @@ -30,7 +30,6 @@ describe('Wallet', () => { const result = await sender.transfer(receiver.address, 1, NativeAssetId, { gasLimit: 1, gasPrice: 1, - bytePrice: 1, }); await result.wait(); }).rejects.toThrowError(`gasLimit(${bn(1)}) is lower than the required (${bn(11)})`); diff --git a/packages/wallet/src/wallet.ts b/packages/wallet/src/wallet.ts index 58da5116384..4a3c14a49a9 100644 --- a/packages/wallet/src/wallet.ts +++ b/packages/wallet/src/wallet.ts @@ -205,7 +205,7 @@ export default class Wallet extends AbstractWallet { /** Asset ID of coins */ assetId: BytesLike = NativeAssetId, /** Tx Params */ - txParams: Pick = {} + txParams: Pick = {} ): Promise { const params = { gasLimit: MAX_GAS_PER_TX, ...txParams }; const request = new ScriptTransactionRequest(params); diff --git a/packages/wordlists/CHANGELOG.md b/packages/wordlists/CHANGELOG.md index c7d73b27004..3f4ffb7d18c 100644 --- a/packages/wordlists/CHANGELOG.md +++ b/packages/wordlists/CHANGELOG.md @@ -1,5 +1,7 @@ # Change Log +## 0.13.0 + ## 0.12.0 ## 0.11.0 diff --git a/packages/wordlists/package.json b/packages/wordlists/package.json index 9000caf6a4a..f26ccc3b135 100644 --- a/packages/wordlists/package.json +++ b/packages/wordlists/package.json @@ -1,6 +1,6 @@ { "name": "@fuel-ts/wordlists", - "version": "0.12.0", + "version": "0.13.0", "description": "", "author": "Fuel Labs (https://fuel.network/)", "main": "src/index.ts", diff --git a/services/fuel-core/Dockerfile b/services/fuel-core/Dockerfile index 51e1167dd79..9aae1ac525c 100644 --- a/services/fuel-core/Dockerfile +++ b/services/fuel-core/Dockerfile @@ -1,16 +1,14 @@ -FROM ghcr.io/fuellabs/fuel-core:v0.9.6 +FROM ghcr.io/fuellabs/fuel-core:v0.10.1 ARG IP=0.0.0.0 ARG PORT=4000 ARG MIN_GAS_PRICE=0 -ARG MIN_BYTE_PRICE=0 ARG DB_PATH=./mnt/db/ ENV IP="${IP}" ENV PORT="${PORT}" ENV DB_PATH="${DB_PATH}" ENV MIN_GAS_PRICE="${MIN_GAS_PRICE}" -ENV MIN_BYTE_PRICE="${MIN_BYTE_PRICE}" WORKDIR /root/ @@ -19,13 +17,12 @@ COPY chainConfig.json . # https://stackoverflow.com/a/44671685 # https://stackoverflow.com/a/40454758 # hadolint ignore=DL3025 -CMD exec ./fuel-core \ +CMD exec ./fuel-core run \ --ip ${IP} \ --port ${PORT} \ --db-path ${DB_PATH} \ --utxo-validation \ --min-gas-price ${MIN_GAS_PRICE} \ - --min-byte-price ${MIN_BYTE_PRICE} \ --vm-backtrace \ --predicates \ --chain ./chainConfig.json