Skip to content

Commit

Permalink
Try Catch in SDK (MystenLabs#19143)
Browse files Browse the repository at this point in the history
## Description 

Try catch in SDK

## Test plan 

How did you test the new or updated feature?

Testnet

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
- [ ] REST API:
  • Loading branch information
tonylee08 authored Aug 29, 2024
1 parent df95820 commit 339b8eb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/lucky-cobras-dance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@mysten/deepbook-v3': patch
---

Try catch for getOrder function
8 changes: 6 additions & 2 deletions sdk/deepbook-v3/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,12 @@ export class DeepBookClient {
expire_timestamp: bcs.u64(),
});

const orderInformation = res.results![0].returnValues![0][0];
return Order.parse(new Uint8Array(orderInformation));
try {
const orderInformation = res.results![0].returnValues![0][0];
return Order.parse(new Uint8Array(orderInformation));
} catch (e) {
return null;
}
}

/**
Expand Down

0 comments on commit 339b8eb

Please sign in to comment.