@scallop-io/sui-scallop-sdk 2.2.1 → 2.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scallop-io/sui-scallop-sdk",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
4
4
  "description": "Typescript sdk for interacting with Scallop contract on SUI",
5
5
  "keywords": [
6
6
  "sui",
@@ -55,11 +55,16 @@ const requireObligationInfo = async (
55
55
  throw new Error(`No obligation found for sender ${sender}`);
56
56
  }
57
57
 
58
- const selectedObligation =
59
- obligations.find(
60
- (obligation) =>
61
- obligation.id === obligationId || obligation.keyId === obligationKey
62
- ) ?? obligations[0];
58
+ const selectedObligation = obligations.find(
59
+ (obligation) =>
60
+ obligation.id === obligationId || obligation.keyId === obligationKey
61
+ );
62
+
63
+ if (!selectedObligation) {
64
+ throw new Error(
65
+ `No obligation found for sender ${sender} with id ${obligationId} or key ${obligationKey}`
66
+ );
67
+ }
63
68
 
64
69
  return {
65
70
  obligationId: selectedObligation.id,