@hinkal/common 0.0.132 → 0.0.133

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.
@@ -1,5 +1,5 @@
1
1
  import { TransactionRequest, TransactionResponse } from '@ethersproject/providers';
2
- import { ContractMetadata, ContractType, EthereumNetwork } from '../../types';
2
+ import { ContractMetadata, ContractType, EthereumNetwork } from '../../types/ethereum-network.types';
3
3
  import { Contract, ethers } from 'ethers';
4
4
  export interface ChainEventListener {
5
5
  onAccountChanged(): void;
@@ -7,6 +7,7 @@ export interface ChainEventListener {
7
7
  }
8
8
  export interface IProviderAdapter<ConnectorType = unknown> {
9
9
  chainId: number | undefined;
10
+ initConnector(connector: ConnectorType): void;
10
11
  init(chainId?: number): Promise<void>;
11
12
  connectToConnector(connector: ConnectorType): Promise<number>;
12
13
  disconnectFromConnector(): Promise<void>;
package/index.mjs CHANGED
@@ -276557,21 +276557,28 @@ var doEval = function C(I) {
276557
276557
  }
276558
276558
  }
276559
276559
  return B;
276560
- }, callBind$2 = { exports: {} }, GetIntrinsic$3 = getIntrinsic, $defineProperty$2 = GetIntrinsic$3("%Object.defineProperty%", !0) || !1;
276561
- if ($defineProperty$2)
276562
- try {
276563
- $defineProperty$2({}, "a", { value: 1 });
276564
- } catch {
276565
- $defineProperty$2 = !1;
276566
- }
276567
- var esDefineProperty = $defineProperty$2, GetIntrinsic$2 = getIntrinsic, $gOPD = GetIntrinsic$2("%Object.getOwnPropertyDescriptor%", !0);
276560
+ }, callBind$2 = { exports: {} }, esDefineProperty, hasRequiredEsDefineProperty;
276561
+ function requireEsDefineProperty() {
276562
+ if (hasRequiredEsDefineProperty)
276563
+ return esDefineProperty;
276564
+ hasRequiredEsDefineProperty = 1;
276565
+ var C = getIntrinsic, I = C("%Object.defineProperty%", !0) || !1;
276566
+ if (I)
276567
+ try {
276568
+ I({}, "a", { value: 1 });
276569
+ } catch {
276570
+ I = !1;
276571
+ }
276572
+ return esDefineProperty = I, esDefineProperty;
276573
+ }
276574
+ var GetIntrinsic$2 = getIntrinsic, $gOPD = GetIntrinsic$2("%Object.getOwnPropertyDescriptor%", !0);
276568
276575
  if ($gOPD)
276569
276576
  try {
276570
276577
  $gOPD([], "length");
276571
276578
  } catch {
276572
276579
  $gOPD = null;
276573
276580
  }
276574
- var gopd$1 = $gOPD, $defineProperty$1 = esDefineProperty, $SyntaxError = syntax, $TypeError$1 = type, gopd = gopd$1, defineDataProperty$1 = function(I, l, Z) {
276581
+ var gopd$1 = $gOPD, $defineProperty$1 = requireEsDefineProperty(), $SyntaxError = syntax, $TypeError$1 = type, gopd = gopd$1, defineDataProperty$1 = function(I, l, Z) {
276575
276582
  if (!I || typeof I != "object" && typeof I != "function")
276576
276583
  throw new $TypeError$1("`obj` must be an object or a function`");
276577
276584
  if (typeof l != "string" && typeof l != "symbol")
@@ -276596,7 +276603,7 @@ var gopd$1 = $gOPD, $defineProperty$1 = esDefineProperty, $SyntaxError = syntax,
276596
276603
  I[l] = Z;
276597
276604
  else
276598
276605
  throw new $SyntaxError("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");
276599
- }, $defineProperty = esDefineProperty, hasPropertyDescriptors = function() {
276606
+ }, $defineProperty = requireEsDefineProperty(), hasPropertyDescriptors = function() {
276600
276607
  return !!$defineProperty;
276601
276608
  };
276602
276609
  hasPropertyDescriptors.hasArrayLengthDefineBug = function() {
@@ -276633,7 +276640,7 @@ var hasPropertyDescriptors_1 = hasPropertyDescriptors, GetIntrinsic$1 = getIntri
276633
276640
  )), I;
276634
276641
  };
276635
276642
  (function(C) {
276636
- var I = functionBind, l = getIntrinsic, Z = setFunctionLength, d = type, W = l("%Function.prototype.apply%"), T = l("%Function.prototype.call%"), B = l("%Reflect.apply%", !0) || I.call(T, W), o = esDefineProperty, D = l("%Math.max%");
276643
+ var I = functionBind, l = getIntrinsic, Z = setFunctionLength, d = type, W = l("%Function.prototype.apply%"), T = l("%Function.prototype.call%"), B = l("%Reflect.apply%", !0) || I.call(T, W), o = requireEsDefineProperty(), D = l("%Math.max%");
276637
276644
  C.exports = function(S) {
276638
276645
  if (typeof S != "function")
276639
276646
  throw new d("a function is required");
@@ -309020,7 +309027,7 @@ class Hinkal {
309020
309027
  this.userKeys = new UserKeys(void 0), this.merkleTreeHinkal = MerkleTree.create(poseidonFunction, 25n, 0n), this.merkleTreeAccessToken = MerkleTree.create(poseidonFunction, 25n, 0n), this.nullifiers = /* @__PURE__ */ new Set(), this.encryptedOutputs = [], this.transactionsManager = new TransactionsManager();
309021
309028
  }
309022
309029
  async initProviderAdapter(I, l) {
309023
- await this.updateProviderAdapter(l);
309030
+ await this.updateProviderAdapter(l), this.providerAdapter?.initConnector(I);
309024
309031
  const Z = await this.connectAndPatchProvider(I);
309025
309032
  await l.init(Z), await this.setListeners();
309026
309033
  }
@@ -397717,7 +397724,7 @@ const getZkMeAccessToken = async (C) => (await axios$3.get(`${getServerURL(C)}${
397717
397724
  getLimitedAnonymityStakingPoints,
397718
397725
  getUserAnonymityStakingPoints,
397719
397726
  getUserAnonymityStakingReferralPoints
397720
- }, exportProvider = async () => (await Promise.resolve().then(() => Wagmiv1ProviderAdapter)).providerAdapter;
397727
+ }, exportProvider = async () => (await Promise.resolve().then(() => Wagmiv1ProviderAdapter$1)).providerAdapter;
397721
397728
  class WorkerProxy {
397722
397729
  isNode = !1;
397723
397730
  /**
@@ -413788,7 +413795,7 @@ function watchNetwork(C, { selector: I = (l) => l } = {}) {
413788
413795
  }
413789
413796
  );
413790
413797
  }
413791
- class ProviderAdapter {
413798
+ class Wagmiv1ProviderAdapter {
413792
413799
  connector;
413793
413800
  chainId;
413794
413801
  originalProvider;
@@ -413965,10 +413972,10 @@ class ProviderAdapter {
413965
413972
  return new Web3Provider(d, W).getSigner(Z.address);
413966
413973
  }
413967
413974
  }
413968
- const providerAdapter = new ProviderAdapter(), Wagmiv1ProviderAdapter = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
413975
+ const wagmiv1ProviderAdapter = new Wagmiv1ProviderAdapter(), Wagmiv1ProviderAdapter$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
413969
413976
  __proto__: null,
413970
- ProviderAdapter,
413971
- providerAdapter
413977
+ Wagmiv1ProviderAdapter,
413978
+ wagmiv1ProviderAdapter
413972
413979
  }, Symbol.toStringTag, { value: "Module" }));
413973
413980
  export {
413974
413981
  ACCESS_TOKEN_MINTING_POINTS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hinkal/common",
3
- "version": "0.0.132",
3
+ "version": "0.0.133",
4
4
  "homepage": "hinkal.pro",
5
5
  "author": {
6
6
  "name": "Hinkal Protocol"
@@ -1,9 +1,10 @@
1
+ import { ChainEventListener, IProviderAdapter } from '../data-structures/provider-adapeter/IProviderAdapter';
2
+ import { ContractMetadata, ContractType, EthereumNetwork } from '../types/ethereum-network.types';
1
3
  import { TransactionRequest } from '@ethersproject/providers';
2
- import { ChainEventListener, ContractMetadata, ContractType, EthereumNetwork, IProviderAdapter } from '../index';
3
4
  import { ethers } from 'ethers';
4
5
  import { Connector } from 'wagmi';
5
6
  import { type WalletClient } from '@wagmi/core';
6
- export declare class ProviderAdapter implements IProviderAdapter<Connector> {
7
+ export declare class Wagmiv1ProviderAdapter implements IProviderAdapter<Connector> {
7
8
  private connector;
8
9
  chainId: number | undefined;
9
10
  private originalProvider;
@@ -41,4 +42,4 @@ export declare class ProviderAdapter implements IProviderAdapter<Connector> {
41
42
  getGasPrice(): Promise<bigint>;
42
43
  walletClientToSigner(walletClient: WalletClient, chainId: number): Promise<ethers.providers.JsonRpcSigner>;
43
44
  }
44
- export declare const providerAdapter: ProviderAdapter;
45
+ export declare const wagmiv1ProviderAdapter: Wagmiv1ProviderAdapter;
@@ -1,2 +1,2 @@
1
- import { IProviderAdapter } from '../data-structures';
1
+ import { IProviderAdapter } from '../data-structures/provider-adapeter/IProviderAdapter';
2
2
  export declare const exportProvider: <T = unknown>() => Promise<IProviderAdapter<T>>;