Commit 7e1dd0d
authored
Change sign rewards message payload (#554)
Changes the SignRewardsMessage request payload from
```ts
{
account: {
address: ""
},
message: ""
}
```
to
```ts
{
accountId: "",
message: ""
}
```
This allows to read the account from state via
`this.#accountsService.findById(accountId);` instead of
`this.#accountsService.findByAddress(address);`, to benefit from more
efficient lookup.
Also adds a button in test dapp to test the endpoint:
<img width="255" height="165" alt="image"
src="https://github.com/user-attachments/assets/ff5313f8-b759-498f-b1b0-47937fdcf2d1"
/>
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Change signRewardsMessage to use accountId instead of address and add
a test dapp UI/handler to invoke it.
>
> - **Snap**:
> - **API change**: `signRewardsMessage` now accepts `accountId` (UUID)
instead of `account.address`; OpenRPC schema and examples updated.
> - **Handler**: use `accountsService.findById(accountId)` and validate
rewards message address against `account.address` before `signMessage`.
> - **Validation**: update request structs to `accountId`; keep
`RewardsMessage` parsing/validation.
> - **RPC wiring**: add `TestDappRpcRequestMethod.SignRewardsMessage`
route that forwards to `ClientRequestMethod.SignRewardsMessage`.
> - **Permissions**: allow `TestDappRpcRequestMethod.SignRewardsMessage`
for dev dapp origins.
> - **Tests**: update unit tests to use `accountId` and `findById`
assertions.
> - **Site**:
> - Add `ClientRequest` component with "Sign Rewards Message" button;
lists accounts via keyring, invokes `signRewardsMessage`, and shows
success toast.
> - Register `ClientRequest` in `Handlers`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
3b21090. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent ff710bd commit 7e1dd0d
File tree
10 files changed
+95
-26
lines changed- packages
- site/src/components/Handlers
- snap
- src
- core/handlers
- onClientRequest
- onRpcRequest
10 files changed
+95
-26
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
695 | 695 | | |
696 | 696 | | |
697 | 697 | | |
698 | | - | |
699 | | - | |
| 698 | + | |
| 699 | + | |
700 | 700 | | |
701 | 701 | | |
702 | | - | |
| 702 | + | |
703 | 703 | | |
704 | 704 | | |
705 | 705 | | |
| |||
741 | 741 | | |
742 | 742 | | |
743 | 743 | | |
744 | | - | |
745 | | - | |
746 | | - | |
747 | | - | |
| 744 | + | |
| 745 | + | |
748 | 746 | | |
749 | 747 | | |
750 | 748 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
Lines changed: 5 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
534 | 534 | | |
535 | 535 | | |
536 | 536 | | |
537 | | - | |
| 537 | + | |
538 | 538 | | |
539 | 539 | | |
540 | 540 | | |
| |||
543 | 543 | | |
544 | 544 | | |
545 | 545 | | |
546 | | - | |
547 | | - | |
548 | | - | |
| 546 | + | |
549 | 547 | | |
550 | 548 | | |
551 | 549 | | |
| |||
570 | 568 | | |
571 | 569 | | |
572 | 570 | | |
573 | | - | |
| 571 | + | |
574 | 572 | | |
575 | 573 | | |
576 | 574 | | |
| |||
595 | 593 | | |
596 | 594 | | |
597 | 595 | | |
598 | | - | |
| 596 | + | |
599 | 597 | | |
600 | 598 | | |
601 | 599 | | |
| |||
604 | 602 | | |
605 | 603 | | |
606 | 604 | | |
607 | | - | |
| 605 | + | |
608 | 606 | | |
609 | 607 | | |
610 | 608 | | |
| |||
Lines changed: 5 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
297 | 297 | | |
298 | 298 | | |
299 | 299 | | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
| 300 | + | |
304 | 301 | | |
305 | 302 | | |
306 | | - | |
| 303 | + | |
307 | 304 | | |
308 | | - | |
| 305 | + | |
309 | 306 | | |
310 | 307 | | |
311 | 308 | | |
312 | 309 | | |
313 | 310 | | |
314 | 311 | | |
315 | | - | |
| 312 | + | |
316 | 313 | | |
317 | | - | |
| 314 | + | |
318 | 315 | | |
319 | 316 | | |
320 | 317 | | |
| |||
Lines changed: 1 addition & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
211 | | - | |
212 | | - | |
213 | | - | |
| 211 | + | |
214 | 212 | | |
215 | 213 | | |
216 | 214 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
60 | 71 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
0 commit comments