|
1 | 1 | # thirdweb
|
2 | 2 |
|
| 3 | +## 5.99.0 |
| 4 | + |
| 5 | +### Minor Changes |
| 6 | + |
| 7 | +- [#7003](https://github.com/thirdweb-dev/js/pull/7003) [`58e343c`](https://github.com/thirdweb-dev/js/commit/58e343c10ccbab638f612591fb62761abc988b3e) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Breaking change: EIP-5792 support |
| 8 | + |
| 9 | + We've significantly improved our EIP-5792 apis, which come with some breaking changes: |
| 10 | + |
| 11 | + ### New Functions Added |
| 12 | + |
| 13 | + 1. **`useSendAndConfirmCalls`** |
| 14 | + |
| 15 | + - Description: Hook to send and wait for confirmation of EIP-5792 calls |
| 16 | + - Returns: React Query mutation object with transaction receipts |
| 17 | + - Example: |
| 18 | + |
| 19 | + ```tsx |
| 20 | + const { mutate: sendAndConfirmCalls, data: result } = |
| 21 | + useSendAndConfirmCalls(); |
| 22 | + await sendAndConfirmCalls({ |
| 23 | + client, |
| 24 | + calls: [tx1, tx2], |
| 25 | + }); |
| 26 | + console.log("Transaction hash:", result.receipts?.[0]?.transactionHash); |
| 27 | + ``` |
| 28 | + |
| 29 | + 2. **`useWaitForCallsReceipt`** |
| 30 | + - Description: Hook to wait for the receipt of EIP-5792 calls, perfect for splitting submitting the call and waiting for receipt |
| 31 | + - Returns: React Query object with call receipts |
| 32 | + - Example: |
| 33 | + ```tsx |
| 34 | + const { mutate: sendCalls, data: result } = useSendCalls(); |
| 35 | + const { data: receipt, isLoading } = useWaitForCallsReceipt(result); |
| 36 | + ``` |
| 37 | + |
| 38 | + ### Breaking Changes |
| 39 | + |
| 40 | + #### `useSendCalls` Changes |
| 41 | + |
| 42 | + **Before** |
| 43 | + |
| 44 | + ```tsx |
| 45 | + // mutation returns id a string |
| 46 | + const sendCalls = useSendCalls({ client }); |
| 47 | + ``` |
| 48 | + |
| 49 | + **After** |
| 50 | + |
| 51 | + ```tsx |
| 52 | + // no longer needs client |
| 53 | + // mutation returns an object with id |
| 54 | + const sendCalls = useSendCalls(); |
| 55 | + ``` |
| 56 | + |
| 57 | + Waiting for call receipts is now done separately, via the `useWaitForCallsReceipt`. |
| 58 | + |
| 59 | + **Before** |
| 60 | + |
| 61 | + ```tsx |
| 62 | + const { mutate: sendCalls, data: receipt } = useSendCalls({ |
| 63 | + client, |
| 64 | + waitForBundle: true, |
| 65 | + }); |
| 66 | + ``` |
| 67 | + |
| 68 | + **After** |
| 69 | + |
| 70 | + ```tsx |
| 71 | + const { mutate: sendCalls, data: result } = useSendCalls(); |
| 72 | + const { data: receipt, isLoading } = useWaitForCallsReceipt(result); |
| 73 | + ``` |
| 74 | + |
| 75 | + You can also use the helper `useSendAndConfirmCalls` to combine both submitting and waiting for confirmation. |
| 76 | + |
| 77 | + ```tsx |
| 78 | + const { mutate: sendAndConfirmCalls, data: receipt } = |
| 79 | + useSendAndConfirmCalls(); |
| 80 | + ``` |
| 81 | + |
| 82 | + #### `sendCalls` Changes |
| 83 | + |
| 84 | + **Before**: |
| 85 | + |
| 86 | + ```tsx |
| 87 | + // Old output type |
| 88 | + type SendCallsResult = string; |
| 89 | + ``` |
| 90 | + |
| 91 | + **After**: |
| 92 | + |
| 93 | + ```tsx |
| 94 | + // New output type |
| 95 | + type SendCallsResult = { |
| 96 | + id: string; |
| 97 | + client: ThirdwebClient; |
| 98 | + chain: Chain; |
| 99 | + wallet: Wallet; |
| 100 | + }; |
| 101 | + ``` |
| 102 | + |
3 | 103 | ## 5.98.2
|
4 | 104 |
|
5 | 105 | ### Patch Changes
|
|
0 commit comments