Skip to content

Commit

Permalink
1.x - update submit work and contract.myMethod.send docs (#6229)
Browse files Browse the repository at this point in the history
* update submit work and contract send docs

* update types

* fix linter

* update whitespace

* update changelog

* update changelog
  • Loading branch information
Alex authored Jul 13, 2023
1 parent 47b9769 commit e68194b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion docs/web3-eth-contract.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions docs/web3-eth.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2015,11 +2015,11 @@ Example

.. code-block:: javascript
web3.eth.submitWork([
web3.eth.submitWork(
"0x0000000000000001",
"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"0xD1FE5700000000000000000000000000D1FE5700000000000000000000000000"
])
)
.then(console.log);
> true
Expand Down
4 changes: 3 additions & 1 deletion packages/web3-eth/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,9 @@ export class Eth {
): Promise<string[]>;

submitWork(
data: [string, string, string],
nonce: string,
powHash: string,
digest: string,
callback?: (error: Error, result: boolean) => void
): Promise<boolean>;

Expand Down
12 changes: 5 additions & 7 deletions packages/web3-eth/types/tests/eth.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -580,19 +580,17 @@ eth.getWork();
eth.getWork((error: Error, result: string[]) => {});

// $ExpectType Promise<boolean>
eth.submitWork([
eth.submitWork(
'0x0000000000000001',
'0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
'0xD1FE5700000000000000000000000000D1FE5700000000000000000000000000'
]);
);

// $ExpectType Promise<boolean>
eth.submitWork(
[
'0x0000000000000001',
'0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
'0xD1FE5700000000000000000000000000D1FE5700000000000000000000000000'
],
'0x0000000000000001',
'0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
'0xD1FE5700000000000000000000000000D1FE5700000000000000000000000000',
(error: Error, result: boolean) => {}
);

Expand Down

0 comments on commit e68194b

Please sign in to comment.