@credenza3/contracts-lib-sui 0.2.9 → 0.2.10

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.
@@ -12,6 +12,7 @@ export declare class CredenzaMetaLedgerV2 extends CredenzaSuiModule {
12
12
  amount: string;
13
13
  }[]>;
14
14
  getLifetimePoints(userAddress: string): Promise<number>;
15
+ getPointsPerEvent(userAddress: string, event: string): Promise<number>;
15
16
  getOwners(): Promise<string[]>;
16
17
  setOwner(recipient: string, isOwner: boolean): Promise<SuiTransactionResult>;
17
18
  }
@@ -4316,6 +4316,17 @@ var CredenzaMetaLedgerV2 = class extends CredenzaSuiModule {
4316
4316
  );
4317
4317
  return amount ? parseInt(amount) : 0;
4318
4318
  }
4319
+ async getPointsPerEvent(userAddress, event) {
4320
+ const configId = await this.getLoyaltyConfig();
4321
+ const res = await this.client.getObjectGrpc(configId);
4322
+ const points_per_event = await this.client.graphqlClient.getDynamicFieldValue(
4323
+ res.json.points_per_event?.id,
4324
+ "address",
4325
+ userAddress
4326
+ );
4327
+ const amount = await this.client.graphqlClient.getDynamicFieldValue(points_per_event?.id, "string", event);
4328
+ return amount ? parseInt(amount) : 0;
4329
+ }
4319
4330
  async getOwners() {
4320
4331
  const configId = await this.getLoyaltyConfig();
4321
4332
  const res = await this.client.getObjectGrpc(configId);
@@ -9231,7 +9242,7 @@ var SuiGraphqlClient = class {
9231
9242
  async getDynamicFieldValue(parentAddress, fieldNameType, fieldNameValue) {
9232
9243
  const variables = {
9233
9244
  address: parentAddress,
9234
- nameType: fieldNameType,
9245
+ nameType: fieldNameType === "string" ? "0x1::string::String" : fieldNameType,
9235
9246
  nameBcs: toBcsBase64(fieldNameType, fieldNameValue)
9236
9247
  };
9237
9248
  const data = await this.client.request(GET_DYNAMIC_FIELD_QUERY, variables);