Skip to content

Commit 3f50577

Browse files
committed
Added unwrap to the token docs
1 parent 6cd8870 commit 3f50577

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/wait-for-token.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,18 @@ The `forToken` function returns a result object with the following properties:
270270
timeout error.
271271
</ParamField>
272272

273+
### unwrap()
274+
275+
We provide a handy `.unwrap()` method that will throw an error if the result is not ok. This means your happy path is a lot cleaner.
276+
277+
```ts
278+
const approval = await wait.forToken<ApprovalToken>(tokenId).unwrap();
279+
// unwrap means an error will throw if the waitpoint times out 👆
280+
281+
// This is the actual data you sent to the token now, not a result object
282+
console.log("Approval", approval);
283+
```
284+
273285
### Example
274286

275287
```ts

0 commit comments

Comments
 (0)