@dorafactory/maci-sdk 0.0.19 → 0.0.20

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/browser.mjs CHANGED
@@ -25946,11 +25946,12 @@ var Http = class {
25946
25946
  );
25947
25947
  }
25948
25948
  }
25949
- async fetchRest(path) {
25949
+ async fetchRest(path, options) {
25950
25950
  try {
25951
25951
  const fetchFn = this.getFetch();
25952
25952
  const response = await fetchFn(`${this.restEndpoint}${path}`, {
25953
- ...this.defaultOptions
25953
+ ...this.defaultOptions,
25954
+ ...options
25954
25955
  });
25955
25956
  if (!response.ok) {
25956
25957
  throw new HttpError(
@@ -29873,6 +29874,16 @@ var OracleCertificate = class {
29873
29874
  const signatureData = await response.json();
29874
29875
  return signatureData;
29875
29876
  }
29877
+ async feegrantAllowance(granter, grantee) {
29878
+ const response = await this.http.fetchRest(
29879
+ `/cosmos/feegrant/v1beta1/allowance/${granter}/${grantee}`
29880
+ );
29881
+ return {
29882
+ granter,
29883
+ grantee,
29884
+ spend_limit: response.allowance.allowance.allowance.spend_limit
29885
+ };
29886
+ }
29876
29887
  };
29877
29888
 
29878
29889
  // src/libs/circom/index.ts
@@ -30212,6 +30223,24 @@ var MACI = class {
30212
30223
  }
30213
30224
  return response.data.signUpEvents[0].stateIdx;
30214
30225
  }
30226
+ async feegrantAllowance({
30227
+ address,
30228
+ contractAddress
30229
+ }) {
30230
+ try {
30231
+ const response = await this.oracleCertificate.feegrantAllowance(
30232
+ contractAddress,
30233
+ address
30234
+ );
30235
+ return response;
30236
+ } catch (error) {
30237
+ return {
30238
+ granter: contractAddress,
30239
+ grantee: address,
30240
+ spend_limit: []
30241
+ };
30242
+ }
30243
+ }
30215
30244
  // only for maci and oracle maci, amaci will set the voice credit when deploy the contract
30216
30245
  async queryWhitelistBalanceOf({
30217
30246
  signer,