@gurge/sdk 0.3.11 → 0.3.13

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@gurge/sdk",
3
- "version": "0.3.11",
3
+ "version": "0.3.13",
4
4
  "homepage": "hinkal.io",
5
5
  "author": {
6
6
  "name": "Hinkal Protocol"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gurge/sdk",
3
- "version": "0.3.11",
3
+ "version": "0.3.13",
4
4
  "homepage": "hinkal.io",
5
5
  "author": {
6
6
  "name": "Hinkal Protocol"
@@ -1 +1 @@
1
- const e=require(`../common/src/constants/chains.constants.cjs`),t=require(`../common/src/types/hinkal.types.cjs`);require(`../common/src/types/index.cjs`);const n=require(`../common/src/data-structures/Hinkal/Hinkal.cjs`),r=require(`../internal/token.utils.cjs`);var i=class{hinkalCommon;constructor(e){this.hinkalCommon=new n.Hinkal(e)}getProviderAdapter(e){return this.hinkalCommon.getProviderAdapter(e)}initProviderAdapter(e,t){return this.hinkalCommon.initProviderAdapter(e,t)}initUserKeys(e=t.LoginMessageMode.PROTOCOL){return this.hinkalCommon.initUserKeys(e)}initUserKeysWithSignature(e){return this.hinkalCommon.initUserKeysWithSignature(e)}initUserKeysFromSeedPhrases(e){return this.hinkalCommon.initUserKeysFromSeedPhrases(e)}storeAndGetInitialSignature(e,t=!1,n){return this.hinkalCommon.storeAndGetInitialSignature(e,t,n)}resetProviderAdapters(){return this.hinkalCommon.resetProviderAdapters()}disconnectFromConnector(){return this.hinkalCommon.disconnectFromConnector()}signMessage(e){return this.hinkalCommon.signMessage(e)}signTypedData(e,t,n){return this.hinkalCommon.signTypedData(e,t,n)}getSupportedChains(){return this.hinkalCommon.getSupportedChains()}isSelectedNetworkSupported(e){return this.hinkalCommon.isSelectedNetworkSupported(e)}switchNetwork(t){let n=e.networkRegistry[t];if(!n)throw Error(`Network with chainId ${t} not supported`);return this.hinkalCommon.switchNetwork(n)}resetMerkle(e){return this.hinkalCommon.resetMerkle(e)}resetMerkleTreesIfNecessary(e){return this.hinkalCommon.resetMerkleTreesIfNecessary(e)}get privateBalancesWithUSD(){return r.mapPrivateBalances(this.hinkalCommon.privateBalancesWithUSD)}onPrivateBalancesWithUSDChange(e){return this.hinkalCommon.onPrivateBalancesWithUSDChange(t=>e(r.mapPrivateBalances(t)))}async getTotalBalance(e,t=!1,n=!1){return(await this.hinkalCommon.getTotalBalance(e,void 0,void 0,t,n)).map(r.mapTokenBalance)}async getStuckShieldedBalances(e,t=!1,n=!1){return(await this.hinkalCommon.getStuckShieldedBalances(e,void 0,void 0,t,n)).map(r.mapTokenBalance)}monitorConnectedAddress(e){return this.hinkalCommon.monitorConnectedAddress(e)}getSupportedPassportLinks(){return this.hinkalCommon.getSupportedPassportLinks()}checkAccessToken(e,t){return this.hinkalCommon.checkAccessToken(e,t)}waitForTransaction(e,t,n){return this.hinkalCommon.waitForTransaction(e,t,n)}getSolanaPublicKey(){return this.hinkalCommon.getSolanaPublicKey()}getEthereumAddress(){return this.hinkalCommon.getEthereumAddress()}getEthereumAddressByChain(e){return this.hinkalCommon.getEthereumAddressByChain(e)}getRecipientInfo(){return this.hinkalCommon.getRecipientInfo()}getShieldedPublicKey(){return this.hinkalCommon.userKeys.getShieldedPublicKey()}async prooflessDeposit(e,t,n,i){return this.hinkalCommon.prooflessDeposit(await r.resolveErc20Tokens(e,t),n,i)}async prooflessDepositWithPublicFee(e,t,n,i,a){return this.hinkalCommon.prooflessDepositWithPublicFee(await r.resolveErc20Token(e,t),n,i,a)}async deposit(e,t,n,i,a){return this.hinkalCommon.deposit(await r.resolveErc20Tokens(e,t),n,i,a)}async depositSolana(e,t,n){return this.hinkalCommon.depositSolana(n,await r.resolveErc20Token(e,t))}async depositForOther(e,t,n,i,a,o){return this.hinkalCommon.depositForOther(await r.resolveErc20Tokens(e,t),n,i,a,o)}async depositSolanaForOther(e,t,n,i){return this.hinkalCommon.depositSolanaForOther(n,await r.resolveErc20Token(e,t),i)}async depositAndWithdraw(e,t,n,i,a,o,s){return this.hinkalCommon.depositAndWithdraw(await r.resolveErc20Token(e,t),n,i,a,o,void 0,void 0,void 0,s)}async depositAndBridge(e,t,n,i,a,o){return this.hinkalCommon.depositAndBridge(await r.resolveErc20Token(e,t),n,i,a,void 0,void 0,void 0,o)}async nearDepositAndBridge(e,t,n,i,a,o,s){return this.hinkalCommon.nearDepositAndBridge(await r.resolveErc20Token(e,t),n,i,a,o,s)}async claimUtxo(e,t,n,i,a){return this.hinkalCommon.claimUtxo(await r.resolveErc20Token(e,t),n,i,a)}async transfer(e,t,n,i,a,o){return this.hinkalCommon.transfer(await r.resolveErc20Tokens(e,t),n,i,a,o)}async withdraw(e,t,n,i,a,o,s){return this.hinkalCommon.withdraw(await r.resolveErc20Tokens(e,t),n,i,a,o,s)}async withdrawStuckUtxos(e,t,n){return this.hinkalCommon.withdrawStuckUtxos(await r.resolveErc20Token(e,t),n)}async swap(e,t,n,i,a,o,s){return this.hinkalCommon.swap(await r.resolveErc20Tokens(e,t),n,i,a,o,s)}async actionPrivateWallet(e,t,n,i,a,o,s,c,l){return this.hinkalCommon.actionPrivateWallet(e,await r.resolveErc20Tokens(e,t),n,i,a,await r.resolveCommonTokenChanges(e,o),s,c,l)}async proxySwap(e,t,n,i,a,o,s,c,l){return this.hinkalCommon.proxySwap(await r.resolveErc20Tokens(e,t),n,i,a,o,s,c,l)}async proxyToPrivate(e,t,n,i,a,o,s){return this.hinkalCommon.proxyToPrivate(await r.resolveErc20Tokens(e,t),n,i,a,o,s)}async proxySend(e,t,n,i,a,o,s){return this.hinkalCommon.proxySend(await r.resolveErc20Tokens(e,t),n,i,a,o,s)}};exports.Hinkal=i;
1
+ const e=require(`../common/src/constants/chains.constants.cjs`),t=require(`../common/src/types/hinkal.types.cjs`);require(`../common/src/types/index.cjs`);const n=require(`../common/src/data-structures/Hinkal/Hinkal.cjs`),r=require(`../internal/token.utils.cjs`);var i=class{hinkalCommon;mappedPrivateBalancesSource;mappedPrivateBalances={};constructor(e){this.hinkalCommon=new n.Hinkal(e)}getProviderAdapter(e){return this.hinkalCommon.getProviderAdapter(e)}initProviderAdapter(e,t){return this.hinkalCommon.initProviderAdapter(e,t)}initUserKeys(e=t.LoginMessageMode.PROTOCOL){return this.hinkalCommon.initUserKeys(e)}initUserKeysWithSignature(e){return this.hinkalCommon.initUserKeysWithSignature(e)}initUserKeysFromSeedPhrases(e){return this.hinkalCommon.initUserKeysFromSeedPhrases(e)}storeAndGetInitialSignature(e,t=!1,n){return this.hinkalCommon.storeAndGetInitialSignature(e,t,n)}resetProviderAdapters(){return this.hinkalCommon.resetProviderAdapters()}disconnectFromConnector(){return this.hinkalCommon.disconnectFromConnector()}signMessage(e){return this.hinkalCommon.signMessage(e)}signTypedData(e,t,n){return this.hinkalCommon.signTypedData(e,t,n)}getSupportedChains(){return this.hinkalCommon.getSupportedChains()}isSelectedNetworkSupported(e){return this.hinkalCommon.isSelectedNetworkSupported(e)}switchNetwork(t){let n=e.networkRegistry[t];if(!n)throw Error(`Network with chainId ${t} not supported`);return this.hinkalCommon.switchNetwork(n)}resetMerkle(e){return this.hinkalCommon.resetMerkle(e)}resetMerkleTreesIfNecessary(e){return this.hinkalCommon.resetMerkleTreesIfNecessary(e)}getMappedPrivateBalances(e){return e===this.mappedPrivateBalancesSource?this.mappedPrivateBalances:(this.mappedPrivateBalancesSource=e,this.mappedPrivateBalances=r.mapPrivateBalances(e),this.mappedPrivateBalances)}get privateBalancesWithUSD(){return this.getMappedPrivateBalances(this.hinkalCommon.privateBalancesWithUSD)}onPrivateBalancesWithUSDChange(e){return this.hinkalCommon.onPrivateBalancesWithUSDChange(t=>e(this.getMappedPrivateBalances(t)))}async getTotalBalance(e,t=!1,n=!1){return(await this.hinkalCommon.getTotalBalance(e,void 0,void 0,t,n)).map(r.mapTokenBalance)}async getStuckShieldedBalances(e,t=!1,n=!1){return(await this.hinkalCommon.getStuckShieldedBalances(e,void 0,void 0,t,n)).map(r.mapTokenBalance)}monitorConnectedAddress(e){return this.hinkalCommon.monitorConnectedAddress(e)}getSupportedPassportLinks(){return this.hinkalCommon.getSupportedPassportLinks()}checkAccessToken(e,t){return this.hinkalCommon.checkAccessToken(e,t)}waitForTransaction(e,t,n){return this.hinkalCommon.waitForTransaction(e,t,n)}getSolanaPublicKey(){return this.hinkalCommon.getSolanaPublicKey()}getEthereumAddress(){return this.hinkalCommon.getEthereumAddress()}getEthereumAddressByChain(e){return this.hinkalCommon.getEthereumAddressByChain(e)}getRecipientInfo(){return this.hinkalCommon.getRecipientInfo()}getShieldedPublicKey(){return this.hinkalCommon.userKeys.getShieldedPublicKey()}async prooflessDeposit(e,t,n,i){return this.hinkalCommon.prooflessDeposit(await r.resolveErc20Tokens(e,t),n,i)}async prooflessDepositWithPublicFee(e,t,n,i,a){return this.hinkalCommon.prooflessDepositWithPublicFee(await r.resolveErc20Token(e,t),n,i,a)}async deposit(e,t,n,i,a){return this.hinkalCommon.deposit(await r.resolveErc20Tokens(e,t),n,i,a)}async depositSolana(e,t,n){return this.hinkalCommon.depositSolana(n,await r.resolveErc20Token(e,t))}async depositForOther(e,t,n,i,a,o){return this.hinkalCommon.depositForOther(await r.resolveErc20Tokens(e,t),n,i,a,o)}async depositSolanaForOther(e,t,n,i){return this.hinkalCommon.depositSolanaForOther(n,await r.resolveErc20Token(e,t),i)}async depositAndWithdraw(e,t,n,i,a,o,s){return this.hinkalCommon.depositAndWithdraw(await r.resolveErc20Token(e,t),n,i,a,o,void 0,void 0,void 0,s)}async depositAndBridge(e,t,n,i,a,o){return this.hinkalCommon.depositAndBridge(await r.resolveErc20Token(e,t),n,i,a,void 0,void 0,void 0,o)}async nearDepositAndBridge(e,t,n,i,a,o,s){return this.hinkalCommon.nearDepositAndBridge(await r.resolveErc20Token(e,t),n,i,a,o,s)}async claimUtxo(e,t,n,i,a){return this.hinkalCommon.claimUtxo(await r.resolveErc20Token(e,t),n,i,a)}async transfer(e,t,n,i,a,o){return this.hinkalCommon.transfer(await r.resolveErc20Tokens(e,t),n,i,a,o)}async withdraw(e,t,n,i,a,o,s){return this.hinkalCommon.withdraw(await r.resolveErc20Tokens(e,t),n,i,a,o,s)}async withdrawStuckUtxos(e,t,n){return this.hinkalCommon.withdrawStuckUtxos(await r.resolveErc20Token(e,t),n)}async swap(e,t,n,i,a,o,s){return this.hinkalCommon.swap(await r.resolveErc20Tokens(e,t),n,i,a,o,s)}async actionPrivateWallet(e,t,n,i,a,o,s,c,l){return this.hinkalCommon.actionPrivateWallet(e,await r.resolveErc20Tokens(e,t),n,i,a,await r.resolveCommonTokenChanges(e,o),s,c,l)}async proxySwap(e,t,n,i,a,o,s,c,l){return this.hinkalCommon.proxySwap(await r.resolveErc20Tokens(e,t),n,i,a,o,s,c,l)}async proxyToPrivate(e,t,n,i,a,o,s){return this.hinkalCommon.proxyToPrivate(await r.resolveErc20Tokens(e,t),n,i,a,o,s)}async proxySend(e,t,n,i,a,o,s){return this.hinkalCommon.proxySend(await r.resolveErc20Tokens(e,t),n,i,a,o,s)}};exports.Hinkal=i;
@@ -6,6 +6,8 @@ import { PublicKey } from '@solana/web3.js';
6
6
  import { IHinkal, IProviderAdapter, PrivateBalancesState, TokenBalance, TokenChanges } from '../types';
7
7
  export declare class Hinkal<ConnectorType> implements IHinkal<ConnectorType> {
8
8
  private readonly hinkalCommon;
9
+ private mappedPrivateBalancesSource;
10
+ private mappedPrivateBalances;
9
11
  constructor(hinkalConfig?: HinkalConfig);
10
12
  getProviderAdapter(chainId?: number): IProviderAdapter;
11
13
  initProviderAdapter(connector: ConnectorType, providerAdapter: IProviderAdapter<ConnectorType>): Promise<void>;
@@ -22,6 +24,7 @@ export declare class Hinkal<ConnectorType> implements IHinkal<ConnectorType> {
22
24
  switchNetwork(chainId: number): Promise<unknown>;
23
25
  resetMerkle(chainIdsToReset?: number[]): Promise<void>;
24
26
  resetMerkleTreesIfNecessary(chainIdsToCheck?: number[]): Promise<void>;
27
+ private getMappedPrivateBalances;
25
28
  get privateBalancesWithUSD(): PrivateBalancesState;
26
29
  onPrivateBalancesWithUSDChange(callback: (state: PrivateBalancesState) => void): () => void;
27
30
  getTotalBalance(chainId: number, resetCacheBefore?: boolean, updateTokensListBefore?: boolean): Promise<TokenBalance[]>;
@@ -6,6 +6,8 @@ import { mapPrivateBalances as r, mapTokenBalance as i, resolveCommonTokenChange
6
6
  //#region libs/shared/sdk/src/services/Hinkal.ts
7
7
  var c = class {
8
8
  hinkalCommon;
9
+ mappedPrivateBalancesSource;
10
+ mappedPrivateBalances = {};
9
11
  constructor(e) {
10
12
  this.hinkalCommon = new n(e);
11
13
  }
@@ -56,11 +58,14 @@ var c = class {
56
58
  resetMerkleTreesIfNecessary(e) {
57
59
  return this.hinkalCommon.resetMerkleTreesIfNecessary(e);
58
60
  }
61
+ getMappedPrivateBalances(e) {
62
+ return e === this.mappedPrivateBalancesSource ? this.mappedPrivateBalances : (this.mappedPrivateBalancesSource = e, this.mappedPrivateBalances = r(e), this.mappedPrivateBalances);
63
+ }
59
64
  get privateBalancesWithUSD() {
60
- return r(this.hinkalCommon.privateBalancesWithUSD);
65
+ return this.getMappedPrivateBalances(this.hinkalCommon.privateBalancesWithUSD);
61
66
  }
62
67
  onPrivateBalancesWithUSDChange(e) {
63
- return this.hinkalCommon.onPrivateBalancesWithUSDChange((t) => e(r(t)));
68
+ return this.hinkalCommon.onPrivateBalancesWithUSDChange((t) => e(this.getMappedPrivateBalances(t)));
64
69
  }
65
70
  async getTotalBalance(e, t = !1, n = !1) {
66
71
  return (await this.hinkalCommon.getTotalBalance(e, void 0, void 0, t, n)).map(i);