From e68194bdc590d811d4bf66dde12f99659861a110 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 13 Jul 2023 11:33:57 -0400 Subject: [PATCH] 1.x - update submit work and contract.myMethod.send docs (#6229) * update submit work and contract send docs * update types * fix linter * update whitespace * update changelog * update changelog --- CHANGELOG.md | 1 + docs/web3-eth-contract.rst | 2 +- docs/web3-eth.rst | 4 ++-- packages/web3-eth/types/index.d.ts | 4 +++- packages/web3-eth/types/tests/eth.tests.ts | 12 +++++------- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b229ca1fe97..c83d25e1b7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -686,3 +686,4 @@ Released with 1.0.0-beta.37 code base. - Builds fixed by updating all typescript versions to 4.9.5 (#6238) - ABI encoding for large negative `int`s (#6239) +- Updated type file for `submitWork` parameters, accepts 3 parameters instead of an array (#5200) \ No newline at end of file diff --git a/docs/web3-eth-contract.rst b/docs/web3-eth-contract.rst index b2b9098db0f..d1849aba9a0 100644 --- a/docs/web3-eth-contract.rst +++ b/docs/web3-eth-contract.rst @@ -870,7 +870,7 @@ methods.myMethod.send .. code-block:: javascript - myContract.methods.myMethod([param1[, param2[, ...]]]).send(options[, callback]) + myContract.methods.myMethod(param1, param2, ...).send(options[, callback]) Will send a transaction to the smart contract and execute its method. Note this can alter the smart contract state. diff --git a/docs/web3-eth.rst b/docs/web3-eth.rst index 10affa057f6..8c6fb56cc7b 100644 --- a/docs/web3-eth.rst +++ b/docs/web3-eth.rst @@ -2015,11 +2015,11 @@ Example .. code-block:: javascript - web3.eth.submitWork([ + web3.eth.submitWork( "0x0000000000000001", "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", "0xD1FE5700000000000000000000000000D1FE5700000000000000000000000000" - ]) + ) .then(console.log); > true diff --git a/packages/web3-eth/types/index.d.ts b/packages/web3-eth/types/index.d.ts index 1faa5444cd3..5c8a55199b9 100644 --- a/packages/web3-eth/types/index.d.ts +++ b/packages/web3-eth/types/index.d.ts @@ -386,7 +386,9 @@ export class Eth { ): Promise; submitWork( - data: [string, string, string], + nonce: string, + powHash: string, + digest: string, callback?: (error: Error, result: boolean) => void ): Promise; diff --git a/packages/web3-eth/types/tests/eth.tests.ts b/packages/web3-eth/types/tests/eth.tests.ts index 0a18f3f7df8..1a8c1be2fcd 100644 --- a/packages/web3-eth/types/tests/eth.tests.ts +++ b/packages/web3-eth/types/tests/eth.tests.ts @@ -580,19 +580,17 @@ eth.getWork(); eth.getWork((error: Error, result: string[]) => {}); // $ExpectType Promise -eth.submitWork([ +eth.submitWork( '0x0000000000000001', '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef', '0xD1FE5700000000000000000000000000D1FE5700000000000000000000000000' -]); +); // $ExpectType Promise eth.submitWork( - [ - '0x0000000000000001', - '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef', - '0xD1FE5700000000000000000000000000D1FE5700000000000000000000000000' - ], + '0x0000000000000001', + '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef', + '0xD1FE5700000000000000000000000000D1FE5700000000000000000000000000', (error: Error, result: boolean) => {} );