@credenza3/contracts-lib-sui 0.2.8 → 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
  }
@@ -8,10 +8,11 @@ export declare class CredenzaSuiSigner extends Signer {
8
8
  private credenzaApiSuiUrl;
9
9
  private credenzaAccessToken;
10
10
  private credenzaAccountSuiPublicKey;
11
+ private sponsorAddress;
11
12
  constructor(opts: CredenzaSuiSignerOptions);
12
13
  initialize(): Promise<void>;
13
14
  useSponsoredTransactions(value: boolean): void;
14
- getGasOwner(): string;
15
+ getGasOwner(): Promise<string>;
15
16
  sign(bytes: Uint8Array): ReturnType<Signer['sign']>;
16
17
  signTransaction(bytes: Uint8Array): ReturnType<Signer['signTransaction']>;
17
18
  getKeyScheme(): SignatureScheme;
@@ -1911,8 +1911,21 @@ var CredenzaSuiSigner = class extends import_cryptography.Signer {
1911
1911
  useSponsoredTransactions(value) {
1912
1912
  this.isCredenzaSponsoredTransactions = value;
1913
1913
  }
1914
- getGasOwner() {
1915
- return this.isCredenzaSponsoredTransactions ? DEFAULT_CREDENZA_SPONSOR_ADDRESS : this.toSuiAddress();
1914
+ async getGasOwner() {
1915
+ if (this.isCredenzaSponsoredTransactions) {
1916
+ if (!this.sponsorAddress) {
1917
+ try {
1918
+ const result = await fetch(`${this.credenzaApiSuiUrl}/accounts/sponsor-address`);
1919
+ const json = await result.json();
1920
+ this.sponsorAddress = json.address.toLowerCase();
1921
+ } catch {
1922
+ this.sponsorAddress = DEFAULT_CREDENZA_SPONSOR_ADDRESS;
1923
+ }
1924
+ }
1925
+ return this.sponsorAddress;
1926
+ } else {
1927
+ return this.toSuiAddress();
1928
+ }
1916
1929
  }
1917
1930
  async sign(bytes) {
1918
1931
  const result = await fetch(`${this.credenzaApiSuiUrl}/accounts/sign`, {