@credenza3/contracts-lib-sui 0.1.9 → 0.1.11

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.
@@ -6494,7 +6494,16 @@ var CredenzaLedger = class extends CredenzaSuiModule {
6494
6494
  StructType: capType
6495
6495
  }
6496
6496
  });
6497
- this.treasuryCap = treasury.data["0"].data.objectId;
6497
+ this.treasuryCap = treasury?.data?.["0"]?.data?.objectId;
6498
+ if (!this.treasuryCap) {
6499
+ const event_type = `${this.client.getPackageId()}::credenza_loyalty::LoyaltyConfigCreatedEvent`;
6500
+ const res = await this.client.suiClient.queryEvents({
6501
+ query: {
6502
+ MoveEventType: event_type
6503
+ }
6504
+ });
6505
+ this.treasuryCap = res.data["0"].parsedJson["id"];
6506
+ }
6498
6507
  } catch {
6499
6508
  throw new Error(`Loyalty treasury cap not found ${capType} for owner ${this.client.getSignerAddress()}`);
6500
6509
  }