@credenza3/contracts-lib-sui 0.2.9 → 0.2.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.
- package/dist/cjs/client/index.cjs +13 -2
- package/dist/cjs/client/index.cjs.map +2 -2
- package/dist/cjs/client/modules/CredenzaLedger/CredenzaMetaLedgerV2.d.ts +1 -0
- package/dist/esm/client/index.mjs +13 -2
- package/dist/esm/client/index.mjs.map +2 -2
- package/dist/esm/client/modules/CredenzaLedger/CredenzaMetaLedgerV2.d.ts +1 -0
- package/dist/umd/client/index.js +2 -2
- package/dist/umd/client/index.js.map +3 -3
- package/package.json +1 -1
|
@@ -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
|
}
|
|
@@ -4302,7 +4302,7 @@ var CredenzaMetaLedgerV2 = class extends CredenzaSuiModule {
|
|
|
4302
4302
|
async getUserEvents(userAddress) {
|
|
4303
4303
|
const data = await this.client.getOwnedObjectsGrpc(
|
|
4304
4304
|
userAddress,
|
|
4305
|
-
`${this.client.getPackageId()}::
|
|
4305
|
+
`${this.client.getPackageId()}::credenza_meta_loyalty_v2::PointsAddedUserEvent`
|
|
4306
4306
|
);
|
|
4307
4307
|
return data.map((data2) => data2.json);
|
|
4308
4308
|
}
|
|
@@ -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);
|