@kapa123456789/sdk 0.0.53 → 0.0.54
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/API/getServerURL.cjs +1 -1
- package/API/getServerURL.d.ts +8 -7
- package/API/getServerURL.mjs +12 -9
- package/constants/chains.constants.cjs +1 -1
- package/constants/chains.constants.d.ts +1 -0
- package/constants/chains.constants.mjs +8 -4
- package/data-structures/Hinkal/Hinkal.cjs +1 -1
- package/data-structures/Hinkal/Hinkal.mjs +107 -108
- package/data-structures/Hinkal/hinkalWithdraw.cjs +1 -1
- package/data-structures/Hinkal/hinkalWithdraw.mjs +31 -24
- package/index.cjs +1 -1
- package/index.mjs +312 -312
- package/package.json +1 -1
- package/types/hinkal.types.d.ts +0 -1
- package/webworker/package.json +1 -1
package/API/getServerURL.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../constants/vite.constants.cjs`),t=require(`../constants/server.constants.cjs`);var
|
|
1
|
+
const e=require(`../constants/vite.constants.cjs`),t=require(`../constants/chains.constants.cjs`),n=require(`../constants/server.constants.cjs`);var r=(()=>{switch(e.deploymentMode){case e.DEPLOYMENT_MODE.DEVELOPMENT:return n.STAGING_URL;case e.DEPLOYMENT_MODE.PLAYGROUND:return n.PLAYGROUND_URL;case e.DEPLOYMENT_MODE.STAGING:return n.STAGING_URL;case e.DEPLOYMENT_MODE.PRODUCTION:return n.PRODUCTION_URL;default:return n.PRODUCTION_URL}})(),i=()=>`${r}${n.SERVER_URL_ENDPOINT}`,a=()=>`${r}${n.RELAYER_URL_ENDPOINT}`,o=()=>`${r}${n.SNAPSHOT_SERVER_URL_ENDPOINT}`,s=()=>`${r}${n.DATA_SERVER_URL_ENDPOINT}`,c=()=>`${r}${n.FUND_COMPLIANCE_URL_ENDPOINT}`,l=()=>`${r}${n.WAAS_URL_ENDPOINT}`,u=i(),d=a(),f=o(),p=s(),m=c(),h=l(),g=e=>{t.isTronLike(e)&&(r=e===t.chainIds.tronMainnet?n.PRODUCTION_URL:n.STAGING_URL,u=i(),d=a(),f=o(),p=s(),m=c(),h=l())};Object.defineProperty(exports,`BACK_END_URL`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`DATA_SERVER_URL`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`FUND_COMPLIANCE_URL`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`RELAYER_URL`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`SERVER_URL`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`SNAPSHOT_SERVER_URL`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`WAAS_URL`,{enumerable:!0,get:function(){return h}}),exports.setBackendForTronChain=g;
|
package/API/getServerURL.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export declare
|
|
2
|
-
export declare
|
|
3
|
-
export declare
|
|
4
|
-
export declare
|
|
5
|
-
export declare
|
|
6
|
-
export declare
|
|
7
|
-
export declare
|
|
1
|
+
export declare let BACK_END_URL: string;
|
|
2
|
+
export declare let SERVER_URL: string;
|
|
3
|
+
export declare let RELAYER_URL: string;
|
|
4
|
+
export declare let SNAPSHOT_SERVER_URL: string;
|
|
5
|
+
export declare let DATA_SERVER_URL: string;
|
|
6
|
+
export declare let FUND_COMPLIANCE_URL: string;
|
|
7
|
+
export declare let WAAS_URL: string;
|
|
8
|
+
export declare const setBackendForTronChain: (tronChainId: number) => void;
|
package/API/getServerURL.mjs
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { DEPLOYMENT_MODE as e, deploymentMode as t } from "../constants/vite.constants.mjs";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { chainIds as n, isTronLike as r } from "../constants/chains.constants.mjs";
|
|
3
|
+
import { DATA_SERVER_URL_ENDPOINT as i, FUND_COMPLIANCE_URL_ENDPOINT as a, PLAYGROUND_URL as o, PRODUCTION_URL as s, RELAYER_URL_ENDPOINT as c, SERVER_URL_ENDPOINT as l, SNAPSHOT_SERVER_URL_ENDPOINT as u, STAGING_URL as d, WAAS_URL_ENDPOINT as f } from "../constants/server.constants.mjs";
|
|
4
|
+
var p = (() => {
|
|
4
5
|
switch (t) {
|
|
5
|
-
case e.DEVELOPMENT: return
|
|
6
|
-
case e.PLAYGROUND: return
|
|
7
|
-
case e.STAGING: return
|
|
8
|
-
case e.PRODUCTION: return
|
|
9
|
-
default: return
|
|
6
|
+
case e.DEVELOPMENT: return d;
|
|
7
|
+
case e.PLAYGROUND: return o;
|
|
8
|
+
case e.STAGING: return d;
|
|
9
|
+
case e.PRODUCTION: return s;
|
|
10
|
+
default: return s;
|
|
10
11
|
}
|
|
11
|
-
})(),
|
|
12
|
+
})(), m = () => `${p}${l}`, h = () => `${p}${c}`, g = () => `${p}${u}`, _ = () => `${p}${i}`, v = () => `${p}${a}`, y = () => `${p}${f}`, b = m(), x = h(), S = g(), C = _(), w = v(), T = y(), E = (e) => {
|
|
13
|
+
r(e) && (p = e === n.tronMainnet ? s : d, b = m(), x = h(), S = g(), C = _(), w = v(), T = y());
|
|
14
|
+
};
|
|
12
15
|
//#endregion
|
|
13
|
-
export {
|
|
16
|
+
export { p as BACK_END_URL, C as DATA_SERVER_URL, w as FUND_COMPLIANCE_URL, x as RELAYER_URL, b as SERVER_URL, S as SNAPSHOT_SERVER_URL, T as WAAS_URL, E as setBackendForTronChain };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../types/chains.types.cjs`),t=require(`./deploy-data/deploy-data-arbMainnet.json.cjs`),n=require(`./deploy-data/deploy-data-ethMainnet.json.cjs`),r=require(`./deploy-data/deploy-data-optimism.json.cjs`),i=require(`./deploy-data/deploy-data-polygon.json.cjs`),a=require(`./deploy-data/deploy-data-base.json.cjs`),o=require(`./deploy-data/deploy-data-localhost.json.cjs`),s=require(`./deploy-data/deploy-data-arcTestnet.json.cjs`),c=require(`./deploy-data/deploy-data-solana.json.cjs`),l=require(`./deploy-data/deploy-data-tronNile.json.cjs`),u=require(`./deploy-data/deploy-data-tronMainnet.json.cjs`),d=require(`./vite.constants.cjs`);var f={polygon:137,arbMainnet:42161,ethMainnet:1,bnbMainnet:56,optimism:10,base:8453,localhost:31337,arcTestnet:5042002,solanaMainnet:501,solanaLocalnet:102,tronNile:3448148188,tronLocalnet:103,tronMainnet:728126428},p=`4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ`,m=f.ethMainnet,h=e=>!![f.localhost].includes(e),g=e=>e?h(e)?m:e:m,_=`X4IiEZsSzGOrJq8tzq7Y3`,v=d.isNotProduction?_:`XzUgeU8YiIIzkD7j2GWnTsFUck7wGgK9`,y=`https://mainnet.helius-rpc.com/?api-key=24718f72-c710-45d6-853e-d447cf530579`,b={[f.ethMainnet]:{name:`Ethereum`,chainId:f.ethMainnet,rpcUrl:`https://rpc.ankr.com/eth`,fetchRpcUrl:`https://eth-mainnet.g.alchemy.com/v2/${v}`,wsRpcUrl:`wss://eth-mainnet.g.alchemy.com/v2/${v}`,supported:!0,contractData:n.default,quoterV2Address:`0x61fFE014bA17989E743c5F6cB21bF9697530B21e`,uniswapV3FactoryAddress:`0x1F98431c8aD98523631AE4a59f267346ea31F984`,priority:1,maxPageSize:9e5},[f.arbMainnet]:{name:`Arbitrum`,chainId:f.arbMainnet,rpcUrl:`https://endpoints.omniatech.io/v1/arbitrum/one/public`,fetchRpcUrl:`https://arb-mainnet.g.alchemy.com/v2/${v}`,wsRpcUrl:`wss://arb-mainnet.g.alchemy.com/v2/${v}`,supported:!0,contractData:t.default,quoterV2Address:`0x61fFE014bA17989E743c5F6cB21bF9697530B21e`,uniswapV3FactoryAddress:`0x1F98431c8aD98523631AE4a59f267346ea31F984`,priority:2,maxPageSize:5e5},[f.optimism]:{name:`Optimism`,chainId:f.optimism,rpcUrl:`https://optimism-mainnet.infura.io/v3/c26b99456bb6464bb498926ff5162903`,fetchRpcUrl:`https://opt-mainnet.g.alchemy.com/v2/${v}`,wsRpcUrl:`wss://opt-mainnet.g.alchemy.com/v2/${v}`,supported:!0,contractData:r.default,quoterV2Address:`0x61fFE014bA17989E743c5F6cB21bF9697530B21e`,uniswapV3FactoryAddress:`0x1F98431c8aD98523631AE4a59f267346ea31F984`,priority:3,maxPageSize:9e5},[f.polygon]:{name:`Polygon`,chainId:f.polygon,rpcUrl:`https://polygon-rpc.com`,fetchRpcUrl:`https://polygon-mainnet.g.alchemy.com/v2/${v}`,wsRpcUrl:`wss://polygon-mainnet.g.alchemy.com/v2/${v}`,supported:!0,contractData:i.default,quoterV2Address:`0x61fFE014bA17989E743c5F6cB21bF9697530B21e`,uniswapV3FactoryAddress:`0x1F98431c8aD98523631AE4a59f267346ea31F984`,priority:4,maxPageSize:9e5},[f.bnbMainnet]:{name:`BNB Chain`,chainId:f.bnbMainnet,rpcUrl:`https://bsc-dataseed.binance.org`,fetchRpcUrl:`https://bnb-mainnet.g.alchemy.com/v2/${v}`,wsRpcUrl:`wss://bnb-mainnet.g.alchemy.com/v2/${v}`,supported:!0,contractData:{},quoterV2Address:`0x78D78E420Da98ad378D7799bE8f4AF69033EB077`,uniswapV3FactoryAddress:`0xdB1d10011AD0Ff90774D0C6Bb92e5C5c8b4461F7`,priority:6},[f.base]:{name:`Base`,chainId:f.base,rpcUrl:`https://mainnet.base.org/`,fetchRpcUrl:`https://base-mainnet.g.alchemy.com/v2/${v}`,wsRpcUrl:`wss://base-mainnet.g.alchemy.com/v2/${v}`,supported:!0,contractData:a.default,quoterV2Address:`0x3d4e44Eb1374240CE5F1B871ab261CD16335B76a`,uniswapV3FactoryAddress:`0x33128a8fC17869897dcE68Ed026d694621f6FDfD`,priority:7,maxPageSize:5e5},[f.arcTestnet]:{name:`Arc Testnet`,chainId:f.arcTestnet,rpcUrl:`https://arc-testnet.g.alchemy.com/v2/${v}`,fetchRpcUrl:`https://arc-testnet.g.alchemy.com/v2/${v}`,wsRpcUrl:`wss://arc-testnet.g.alchemy.com/v2/${v}`,supported:!0,contractData:s.default,priority:8,maxPageSize:9999},[f.solanaMainnet]:{name:`Solana`,chainId:f.solanaMainnet,rpcUrl:`https://api.mainnet-beta.solana.com`,fetchRpcUrl:`https://mainnet.helius-rpc.com/?api-key=54ad9ec9-dad6-41de-b961-e3e8ea7a7188`,supported:!0,contractData:c.default,priority:8},[f.solanaLocalnet]:{name:`Solana Localnet`,chainId:f.solanaLocalnet,rpcUrl:`http://127.0.0.1:8899`,fetchRpcUrl:`http://127.0.0.1:8899`,supported:!0,contractData:c.default,priority:9},[f.tronNile]:{name:`Tron Nile`,chainId:f.tronNile,rpcUrl:`https://tron-testnet.g.alchemy.com/v2/${v}`,fetchRpcUrl:`https://tron-testnet.g.alchemy.com/v2/${v}`,supported:!0,contractData:l.default,priority:9,maxPageSize:5e5},[f.tronMainnet]:{name:`Tron`,chainId:f.tronMainnet,rpcUrl:`https://tron-mainnet.g.alchemy.com/v2/${v}`,fetchRpcUrl:`https://tron-mainnet.g.alchemy.com/v2/${v}`,supported:!0,priority:10,contractData:u.default,maxPageSize:5e5},...(d.isDevelopment,{})},x={name:`Localhost`,chainId:f.localhost,rpcUrl:`http://127.0.0.1:8545`,fetchRpcUrl:`http://127.0.0.1:8545`,supported:!0,contractData:o.default,quoterV2Address:b[m].quoterV2Address,uniswapV3FactoryAddress:b[m].uniswapV3FactoryAddress,priority:7};d.isDevelopment&&(b[f.localhost]=x);var S={[e.EthereumNetworkType.Mainnet]:[f.polygon,f.arbMainnet,f.ethMainnet,f.bnbMainnet,f.optimism,f.base,f.tronMainnet],[e.EthereumNetworkType.Testnet]:d.isNotProduction?[f.arcTestnet,f.tronNile]:[f.arcTestnet],[e.EthereumNetworkType.Local]:[f.localhost]},C=[f.tronNile,f.tronMainnet,f.tronLocalnet],w=[f.solanaMainnet,f.solanaLocalnet],T=e=>[f.optimism,f.base].includes(e),E=e=>w.includes(e),D=e=>C.includes(e),O=d.isNotProduction?f.tronNile:f.tronMainnet,k=[f.ethMainnet,f.optimism,f.base,f.polygon,f.arbMainnet,f.arcTestnet,f.solanaMainnet,O],A=k.filter(e=>!D(e)),
|
|
1
|
+
const e=require(`../types/chains.types.cjs`),t=require(`./deploy-data/deploy-data-arbMainnet.json.cjs`),n=require(`./deploy-data/deploy-data-ethMainnet.json.cjs`),r=require(`./deploy-data/deploy-data-optimism.json.cjs`),i=require(`./deploy-data/deploy-data-polygon.json.cjs`),a=require(`./deploy-data/deploy-data-base.json.cjs`),o=require(`./deploy-data/deploy-data-localhost.json.cjs`),s=require(`./deploy-data/deploy-data-arcTestnet.json.cjs`),c=require(`./deploy-data/deploy-data-solana.json.cjs`),l=require(`./deploy-data/deploy-data-tronNile.json.cjs`),u=require(`./deploy-data/deploy-data-tronMainnet.json.cjs`),d=require(`./vite.constants.cjs`);var f={polygon:137,arbMainnet:42161,ethMainnet:1,bnbMainnet:56,optimism:10,base:8453,localhost:31337,arcTestnet:5042002,solanaMainnet:501,solanaLocalnet:102,tronNile:3448148188,tronLocalnet:103,tronMainnet:728126428},p=`4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ`,m=f.ethMainnet,h=e=>!![f.localhost].includes(e),g=e=>e?h(e)?m:e:m,_=`X4IiEZsSzGOrJq8tzq7Y3`,v=d.isNotProduction?_:`XzUgeU8YiIIzkD7j2GWnTsFUck7wGgK9`,y=`https://mainnet.helius-rpc.com/?api-key=24718f72-c710-45d6-853e-d447cf530579`,b={[f.ethMainnet]:{name:`Ethereum`,chainId:f.ethMainnet,rpcUrl:`https://rpc.ankr.com/eth`,fetchRpcUrl:`https://eth-mainnet.g.alchemy.com/v2/${v}`,wsRpcUrl:`wss://eth-mainnet.g.alchemy.com/v2/${v}`,supported:!0,contractData:n.default,quoterV2Address:`0x61fFE014bA17989E743c5F6cB21bF9697530B21e`,uniswapV3FactoryAddress:`0x1F98431c8aD98523631AE4a59f267346ea31F984`,priority:1,maxPageSize:9e5},[f.arbMainnet]:{name:`Arbitrum`,chainId:f.arbMainnet,rpcUrl:`https://endpoints.omniatech.io/v1/arbitrum/one/public`,fetchRpcUrl:`https://arb-mainnet.g.alchemy.com/v2/${v}`,wsRpcUrl:`wss://arb-mainnet.g.alchemy.com/v2/${v}`,supported:!0,contractData:t.default,quoterV2Address:`0x61fFE014bA17989E743c5F6cB21bF9697530B21e`,uniswapV3FactoryAddress:`0x1F98431c8aD98523631AE4a59f267346ea31F984`,priority:2,maxPageSize:5e5},[f.optimism]:{name:`Optimism`,chainId:f.optimism,rpcUrl:`https://optimism-mainnet.infura.io/v3/c26b99456bb6464bb498926ff5162903`,fetchRpcUrl:`https://opt-mainnet.g.alchemy.com/v2/${v}`,wsRpcUrl:`wss://opt-mainnet.g.alchemy.com/v2/${v}`,supported:!0,contractData:r.default,quoterV2Address:`0x61fFE014bA17989E743c5F6cB21bF9697530B21e`,uniswapV3FactoryAddress:`0x1F98431c8aD98523631AE4a59f267346ea31F984`,priority:3,maxPageSize:9e5},[f.polygon]:{name:`Polygon`,chainId:f.polygon,rpcUrl:`https://polygon-rpc.com`,fetchRpcUrl:`https://polygon-mainnet.g.alchemy.com/v2/${v}`,wsRpcUrl:`wss://polygon-mainnet.g.alchemy.com/v2/${v}`,supported:!0,contractData:i.default,quoterV2Address:`0x61fFE014bA17989E743c5F6cB21bF9697530B21e`,uniswapV3FactoryAddress:`0x1F98431c8aD98523631AE4a59f267346ea31F984`,priority:4,maxPageSize:9e5},[f.bnbMainnet]:{name:`BNB Chain`,chainId:f.bnbMainnet,rpcUrl:`https://bsc-dataseed.binance.org`,fetchRpcUrl:`https://bnb-mainnet.g.alchemy.com/v2/${v}`,wsRpcUrl:`wss://bnb-mainnet.g.alchemy.com/v2/${v}`,supported:!0,contractData:{},quoterV2Address:`0x78D78E420Da98ad378D7799bE8f4AF69033EB077`,uniswapV3FactoryAddress:`0xdB1d10011AD0Ff90774D0C6Bb92e5C5c8b4461F7`,priority:6},[f.base]:{name:`Base`,chainId:f.base,rpcUrl:`https://mainnet.base.org/`,fetchRpcUrl:`https://base-mainnet.g.alchemy.com/v2/${v}`,wsRpcUrl:`wss://base-mainnet.g.alchemy.com/v2/${v}`,supported:!0,contractData:a.default,quoterV2Address:`0x3d4e44Eb1374240CE5F1B871ab261CD16335B76a`,uniswapV3FactoryAddress:`0x33128a8fC17869897dcE68Ed026d694621f6FDfD`,priority:7,maxPageSize:5e5},[f.arcTestnet]:{name:`Arc Testnet`,chainId:f.arcTestnet,rpcUrl:`https://arc-testnet.g.alchemy.com/v2/${v}`,fetchRpcUrl:`https://arc-testnet.g.alchemy.com/v2/${v}`,wsRpcUrl:`wss://arc-testnet.g.alchemy.com/v2/${v}`,supported:!0,contractData:s.default,priority:8,maxPageSize:9999},[f.solanaMainnet]:{name:`Solana`,chainId:f.solanaMainnet,rpcUrl:`https://api.mainnet-beta.solana.com`,fetchRpcUrl:`https://mainnet.helius-rpc.com/?api-key=54ad9ec9-dad6-41de-b961-e3e8ea7a7188`,supported:!0,contractData:c.default,priority:8},[f.solanaLocalnet]:{name:`Solana Localnet`,chainId:f.solanaLocalnet,rpcUrl:`http://127.0.0.1:8899`,fetchRpcUrl:`http://127.0.0.1:8899`,supported:!0,contractData:c.default,priority:9},[f.tronNile]:{name:`Tron Nile`,chainId:f.tronNile,rpcUrl:`https://tron-testnet.g.alchemy.com/v2/${v}`,fetchRpcUrl:`https://tron-testnet.g.alchemy.com/v2/${v}`,supported:!0,contractData:l.default,priority:9,maxPageSize:5e5},[f.tronMainnet]:{name:`Tron`,chainId:f.tronMainnet,rpcUrl:`https://tron-mainnet.g.alchemy.com/v2/${v}`,fetchRpcUrl:`https://tron-mainnet.g.alchemy.com/v2/${v}`,supported:!0,priority:10,contractData:u.default,maxPageSize:5e5},...(d.isDevelopment,{})},x={name:`Localhost`,chainId:f.localhost,rpcUrl:`http://127.0.0.1:8545`,fetchRpcUrl:`http://127.0.0.1:8545`,supported:!0,contractData:o.default,quoterV2Address:b[m].quoterV2Address,uniswapV3FactoryAddress:b[m].uniswapV3FactoryAddress,priority:7};d.isDevelopment&&(b[f.localhost]=x);var S={[e.EthereumNetworkType.Mainnet]:[f.polygon,f.arbMainnet,f.ethMainnet,f.bnbMainnet,f.optimism,f.base,f.tronMainnet],[e.EthereumNetworkType.Testnet]:d.isNotProduction?[f.arcTestnet,f.tronNile]:[f.arcTestnet],[e.EthereumNetworkType.Local]:[f.localhost]},C=[f.tronNile,f.tronMainnet,f.tronLocalnet],w=[f.solanaMainnet,f.solanaLocalnet],T=e=>[f.optimism,f.base].includes(e),E=e=>w.includes(e),D=e=>C.includes(e),O=d.isNotProduction?f.tronNile:f.tronMainnet,k=[f.ethMainnet,f.optimism,f.base,f.polygon,f.arbMainnet,f.arcTestnet,f.solanaMainnet,O],A=e=>{k.forEach((t,n)=>{D(t)&&(k[n]=e)})},j=k.filter(e=>!D(e)),M=k.filter(e=>!D(e)&&e!==f.arcTestnet),N=k.filter(e=>!E(e)&&!D(e)),P=e=>N.includes(e),F={[e.NetworkFilterType.Wallet]:j,[e.NetworkFilterType.Pay]:k,[e.NetworkFilterType.Bridge]:M};exports.ALCHEMY_API_KEY=v,exports.ALCHEMY_TEST_KEY=_,exports.BRIDGE_SUPPORTED_CHAINS=M,exports.EVM_CHAIN_IDS=N,exports.FILTER_CHAIN_MAP=F,exports.HELIUS_RPC_URL=y,exports.HINKAL_SUPPORTED_CHAINS=k,exports.SOLANA_CHAIN_IDS=w,exports.TRON_CHAIN_IDS=C,exports.WALLET_SUPPORTED_CHAINS=j,exports.chainIds=f,exports.chainIdsByType=S,exports.currentTronChainId=O,exports.getNonLocalhostChainId=g,exports.isEvmChain=P,exports.isLocalNetwork=h,exports.isOptimismLike=T,exports.isSolanaLike=E,exports.isTronLike=D,exports.localhostNetwork=m,exports.networkRegistry=b,exports.setHinkalTronChainId=A,exports.solanaChainIdStr=p;
|
|
@@ -35,6 +35,7 @@ export declare const isSolanaLike: (chainId: number) => boolean;
|
|
|
35
35
|
export declare const isTronLike: (chainId: number) => boolean;
|
|
36
36
|
export declare const currentTronChainId: number;
|
|
37
37
|
export declare const HINKAL_SUPPORTED_CHAINS: number[];
|
|
38
|
+
export declare const setHinkalTronChainId: (tronChainId: number) => void;
|
|
38
39
|
export declare const WALLET_SUPPORTED_CHAINS: number[];
|
|
39
40
|
export declare const BRIDGE_SUPPORTED_CHAINS: number[];
|
|
40
41
|
export declare const EVM_CHAIN_IDS: number[];
|
|
@@ -189,10 +189,14 @@ var w = {
|
|
|
189
189
|
m.arcTestnet,
|
|
190
190
|
m.solanaMainnet,
|
|
191
191
|
A
|
|
192
|
-
], M =
|
|
193
|
-
|
|
192
|
+
], M = (e) => {
|
|
193
|
+
j.forEach((t, n) => {
|
|
194
|
+
k(t) && (j[n] = e);
|
|
195
|
+
});
|
|
196
|
+
}, N = j.filter((e) => !k(e)), P = j.filter((e) => !k(e) && e !== m.arcTestnet), F = j.filter((e) => !O(e) && !k(e)), I = (e) => F.includes(e), L = {
|
|
197
|
+
[t.Wallet]: N,
|
|
194
198
|
[t.Pay]: j,
|
|
195
|
-
[t.Bridge]:
|
|
199
|
+
[t.Bridge]: P
|
|
196
200
|
};
|
|
197
201
|
//#endregion
|
|
198
|
-
export { b as ALCHEMY_API_KEY, y as ALCHEMY_TEST_KEY,
|
|
202
|
+
export { b as ALCHEMY_API_KEY, y as ALCHEMY_TEST_KEY, P as BRIDGE_SUPPORTED_CHAINS, F as EVM_CHAIN_IDS, L as FILTER_CHAIN_MAP, x as HELIUS_RPC_URL, j as HINKAL_SUPPORTED_CHAINS, E as SOLANA_CHAIN_IDS, T as TRON_CHAIN_IDS, N as WALLET_SUPPORTED_CHAINS, m as chainIds, w as chainIdsByType, A as currentTronChainId, v as getNonLocalhostChainId, I as isEvmChain, _ as isLocalNetwork, D as isOptimismLike, O as isSolanaLike, k as isTronLike, g as localhostNetwork, S as networkRegistry, M as setHinkalTronChainId, h as solanaChainIdStr };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../types/ethereum-network.types.cjs`),t=require(`../../functions/utils/serialize.utils.cjs`),n=require(`../../constants/vite.constants.cjs`),r=require(`../../constants/chains.constants.cjs`),i=require(`../../types/hinkal.types.cjs`),a=require(`../../API/API.cjs`),o=require(`../../constants/kyc.constants.cjs`),s=require(`../../error-handling/error-codes.constants.cjs`),c=require(`../../functions/utils/erc20tokenFunctions.cjs`);require(`../../API/index.cjs`);const l=require(`../../crypto/poseidon.cjs`),u=require(`../crypto-keys/keys.cjs`),d=require(`../../functions/pre-transaction/solana.cjs`),f=require(`./hinkalCheckSolanaTokenRegistry.cjs`),p=require(`../../functions/web3/functionCalls/accessTokenCalls.cjs`),m=require(`../../functions/utils/token-check.utils.cjs`),h=require(`../TokenDBs/PrivateTokensDB.cjs`),ee=require(`../../functions/web3/events/getShieldedBalance.cjs`),g=require(`../../functions/utils/reloadPage.cjs`),_=require(`../../functions/utils/cacheDevice.utils.cjs`),v=require(`../../functions/web3/getContractMetadata.cjs`),y=require(`../../providers/SolanaProviderAdapter.cjs`),b=require(`./hinkalCheckTokenRegistry.cjs`),x=require(`../merkle-tree/MerkleTree.cjs`);require(`../merkle-tree/index.cjs`);const S=require(`../../functions/web3/fetchSolanaMerkleTreeRootHash.cjs`),C=require(`./hinkalDeposit.cjs`),te=require(`../../functions/private-wallet/emporium.helpers.cjs`),w=require(`../../functions/kyc/checkTokenLimitsUSD.cjs`),T=require(`./hinkalDepositAndWithdraw.cjs`),E=require(`./hinkalSolanaDeposit.cjs`),D=require(`./hinkalSwap.cjs`),O=require(`./hinkalWithdraw.cjs`),k=require(`./resetMerkleTrees.cjs`),A=require(`../MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.cjs`),j=require(`./hinkalPrivateWallet.cjs`),M=require(`./hinkalGetRecipientInfo.cjs`),N=require(`./hinkalSignSubAccount.cjs`),P=require(`./hinkalActionReceive.cjs`);require(`../TokenDBs/index.cjs`);const F=require(`./hinkalProoflessDeposit.cjs`),I=require(`./hinkalProxySwap.cjs`),L=require(`./hinkalMultiSend.cjs`),R=require(`./hinkalTransfer.cjs`),ne=require(`./hinkalProxyToPrivate.cjs`),z=require(`../../providers/TronProviderAdapter.cjs`),B=require(`./hinkalSolanaDepositAndWithdraw.cjs`),V=require(`./hinkalSolanaWithdraw.cjs`),H=require(`./hinkalSolanaTransfer.cjs`),U=require(`./hinkalSolanaSwap.cjs`),W=require(`./hinkalSolanaProxySend.cjs`),G=require(`./hinkalSolanaProxySwap.cjs`),K=require(`./hinkalSolanaProxyShield.cjs`),q=require(`./hinkalDepositAndBridge.cjs`),J=require(`./hinkalClaimUtxo.cjs`),Y=require(`./hinkalSolanaProoflessDeposit.cjs`),X=require(`./hinkalSolanaClaimUtxo.cjs`),Z=require(`./hinkalWithdrawStuckUtxos.cjs`);let Q=require(`ethers`),$=require(`@solana/web3.js`);var re=class{ethereumProviderAdapter;solanaProviderAdapter;tronProviderAdapter;userKeys;signingMessage=`Login to Hinkal Protocol`;privateTransferSigningMessage=`Login to Hinkal's Private Transfer App`;merkleTreeHinkalByChain={};merkleTreeAccessTokenByChain={};nullifiersByChain={};encryptedOutputsByChain={};commitmentsSnapshotServiceByChain={};nullifierSnapshotServiceByChain={};accessTokenSnapshotServiceByChain={};utxoUtils;lastCallState=new Map;cacheDevice;generateProofRemotely;disableMerkleTreeUpdates;tronChainId;constructor(e){this.userKeys=new u.UserKeys(void 0),console.log(`hinkalConfig`,e||`undefined`),console.log(`currentTronChainId`,r.currentTronChainId||`undefined`),this.tronChainId=e?.tronChainOverride??r.currentTronChainId,console.log(`this.tronChainId`,this.tronChainId||`undefined`);let t=[...r.HINKAL_SUPPORTED_CHAINS.filter(e=>!r.isTronLike(e)),this.tronChainId];console.log(`chainsToSeed`,t||`undefined`),t.forEach(e=>{this.merkleTreeHinkalByChain[e]=x.MerkleTree.create(l.poseidonFunction,0n),this.merkleTreeAccessTokenByChain[e]=x.MerkleTree.create(l.poseidonFunction,0n),this.nullifiersByChain[e]=new Set,this.encryptedOutputsByChain[e]=[]}),this.generateProofRemotely=e?.generateProofRemotely??!0,this.utxoUtils=new A.MultiThreadedUtxoUtils,this.cacheDevice=_.createCacheDevice(e),this.disableMerkleTreeUpdates=e?.disableMerkleTreeUpdates??!1}enforceRateLimit(e,n,r=1e3){let i=Date.now(),a=t.CustomJSONStringify(n),o=this.lastCallState.get(e);if(o&&o.argsKey===a&&i-o.timestamp<r)throw Error(`${e} was already called with the same arguments`);this.lastCallState.set(e,{timestamp:i,argsKey:a})}getProviderAdapter(e){let t=e;t||=this.ethereumProviderAdapter?r.chainIds.ethMainnet:this.solanaProviderAdapter?r.chainIds.solanaMainnet:r.chainIds.tronMainnet;let n;if(n=r.isSolanaLike(t)?this.solanaProviderAdapter:r.isTronLike(t)?this.tronProviderAdapter:this.ethereumProviderAdapter,!n)throw Error(`ProviderAdapter is not initialized`);return n}async initProviderAdapter(e,t){let n=r.chainIds.ethMainnet;console.log(`this.tronChainId`,this.tronChainId),t instanceof y.SolanaProviderAdapter?n=r.chainIds.solanaMainnet:t instanceof z.TronProviderAdapter&&(n=this.tronChainId),await this.updateProviderAdapter(n,t),t.initConnector(e);let i=await t.connectAndPatchProvider(e);await t.init(i),await this.setListeners()}getSigningMessage(e=i.LoginMessageMode.PROTOCOL){switch(e){case i.LoginMessageMode.PRIVATE_TRANSFER:return this.privateTransferSigningMessage;case i.LoginMessageMode.PROTOCOL:default:return this.signingMessage}}async initUserKeys(e=i.LoginMessageMode.PROTOCOL){let t=this.getSigningMessage(e);this.userKeys=new u.UserKeys(await this.getProviderAdapter().signMessage(t))}initUserKeysWithSignature(e){this.userKeys=new u.UserKeys(e)}async initUserKeysFromSeedPhrases(e){let t=e.join(` `),n=Q.ethers.toUtf8Bytes(t),r=Q.ethers.keccak256(n);this.userKeys=new u.UserKeys(r)}async resetMerkle(e){this.disableMerkleTreeUpdates||(e?.every(e=>this.isSelectedNetworkSupported(e))??!0)&&await k.resetMerkleTrees(this,e)}getTronWeb(){let e=this.tronProviderAdapter;if(!e)throw Error(`Tron provider adapter not initialized`);if(!(e instanceof z.TronProviderAdapter))throw Error(`Tron provider adapter is not a TronProviderAdapter`);let t=e.getTronWeb();if(!t)throw Error(`TronWeb not available`);return t}getSupportedChains(){return this.ethereumProviderAdapter&&this.solanaProviderAdapter?r.WALLET_SUPPORTED_CHAINS:this.ethereumProviderAdapter?r.HINKAL_SUPPORTED_CHAINS.filter(e=>!r.isSolanaLike(e)&&!r.isTronLike(e)):this.solanaProviderAdapter?r.HINKAL_SUPPORTED_CHAINS.filter(e=>r.isSolanaLike(e)):this.tronProviderAdapter?[this.tronChainId]:[]}async waitForTransaction(e,t,n=1){return!!await this.getProviderAdapter(e).waitForTransaction(e,t,n)}getContract(e,t,n=void 0){return this.getProviderAdapter(e).getContract(e,t,n)}getContractWithFetcherByChainId(e,t,n=void 0){return v.getContractWithFetcherByChainId(e,t,n)}async signMessage(e){return await this.getProviderAdapter().signMessage(e)}async signTypedData(e,t,n){return await this.getProviderAdapter().signTypedData(e,t,n)}async signWithSubAccount(e,t,n,r){return N.hinkalSignSubAccount(e,t,n,r)}getContractWithSigner(e,t,n=``){return this.getProviderAdapter(e).getContractWithSigner(e,t,n)}getContractWithFetcher(e,t,n=``){return this.getProviderAdapter(e).getContractWithFetcher(e,t,n)}isSelectedNetworkSupported(e){return!!r.networkRegistry[e]}async switchNetwork(e){try{await this.getProviderAdapter().switchNetwork(e)}catch{throw Error(s.transactionErrorCodes.FAILED_TO_SWITCH_NETWORKS)}}isPermitterAvailable(e){return this.getProviderAdapter(e).isPermitterAvailable()}async disconnectFromConnector(){await this.ethereumProviderAdapter?.disconnectFromConnector(),await this.solanaProviderAdapter?.disconnectFromConnector(),await this.tronProviderAdapter?.disconnectFromConnector()}async resetProviderAdapters(){this.ethereumProviderAdapter=void 0,this.solanaProviderAdapter=void 0,this.tronProviderAdapter=void 0}async updateProviderAdapter(e,t){try{r.isSolanaLike(e)?(this.solanaProviderAdapter&&this.solanaProviderAdapter.release(),this.solanaProviderAdapter=t):r.isTronLike(e)?(this.tronProviderAdapter&&this.tronProviderAdapter.release(),this.tronProviderAdapter=t):(this.ethereumProviderAdapter&&this.ethereumProviderAdapter.release(),this.ethereumProviderAdapter=t)}catch(e){throw console.error(e),Error(`updateProviderAdapter failed, please try again.`)}}async setListeners(){this.ethereumProviderAdapter?.setChainEventListener({onAccountChanged:()=>{this.onAccountChanged()},onChainChanged:e=>{this.onChainChanged(e)}}),this.solanaProviderAdapter?.setChainEventListener({onAccountChanged:()=>{this.onAccountChanged()},onChainChanged:e=>{this.onChainChanged(e)}}),this.tronProviderAdapter?.setChainEventListener({onAccountChanged:()=>{this.onAccountChanged()},onChainChanged:e=>{this.onChainChanged(e)}})}async onAccountChanged(){await this.ethereumProviderAdapter?.onAccountChanged(),await this.solanaProviderAdapter?.onAccountChanged(),await this.tronProviderAdapter?.onAccountChanged();let e=i.EventType.AccountChanged;typeof document<`u`?document?.dispatchEvent(new Event(e)):process?.emit(`message`,e,void 0)}async onChainChanged(e){e?await this.getProviderAdapter(e).onChainChanged(e):(await this.disconnectFromConnector(),g.reloadPage())}async monitorConnectedAddress(e){await a.API.monitor(await this.getEthereumAddressByChain(e))}async getBalances(e,t,n,r,i=!1,a,o=!1){return ee.getShieldedBalance(this,e,t,n,r,i,this.generateProofRemotely,a,o)}async getTotalBalance(e,t,r,i=!1,a,o=!1){let s=r??await this.getEthereumAddressByChain(e),l=t??this.userKeys,u=await this.getBalances(e,l.getShieldedPrivateKey(),l.getShieldedPublicKey(),s,i,a,o),d=n.isExtension?await h.privateTokensDB.getPrivateTokens(e,s):c.getErc20TokensForChain(e),f=[];return d.forEach(e=>{let t=e.erc20TokenAddress.toLowerCase(),n=u.get(t),r={token:e,balance:n?.balance??0n,timestamp:n?.timestamp||`0`,nfts:n?.nfts||[]};f.push(r)}),f}async getStuckShieldedBalances(e,t,n){return(await this.getTotalBalance(e,t,n,!1,!1,!0)).filter(e=>e.balance>0n)}getSupportedPassportLinks(){return o.supportedPassportLinks}checkAccessToken(e,t){return p.checkHinkalAccessToken(this,e,t)}checkExternalTokenLimitsUSD(e,t,n){return w.checkTokenLimitsUSD(e,t,n)}async getHinkalTreeRootHash(t){if(r.isSolanaLike(t)){let{hinkalIdl:e,hinkalAddress:n,originalDeployer:i}=r.networkRegistry[t].contractData;if(!e||!n||!i)throw Error(`Missing Solana configuration for chain ${t}`);let a=new $.PublicKey(i),o=d.getMerkleAccountPublicKey(new $.PublicKey(n),a);return S.fetchSolanaMerkleTreeRootHash(this.getSolanaProgram(e),o)}return this.getContractWithFetcherByChainId(t,e.ContractType.HinkalContract).getRootHash()}async getAccessTokenTreeRootHash(t){if(r.isSolanaLike(t)){let{hinkalIdl:e,hinkalAddress:n,originalDeployer:i}=r.networkRegistry[t].contractData;if(!e||!n||!i)throw Error(`Missing Solana configuration for chain ${t}`);let a=new $.PublicKey(i),o=d.getAccessTokenMerkleAccountPublicKey(new $.PublicKey(n),a);return S.fetchSolanaMerkleTreeRootHash(this.getSolanaProgram(e),o)}return this.getContractWithFetcherByChainId(t,e.ContractType.AccessTokenContract).getRootHash()}async resetMerkleTreesIfNecessary(e){let t=(await Promise.all((e??this.getSupportedChains()).map(async e=>{let[t,n]=await Promise.all([this.getHinkalTreeRootHash(e),this.getAccessTokenTreeRootHash(e)]);return{chainId:e,needsReset:BigInt(t)!==this.merkleTreeHinkalByChain[e].getRootHash()||BigInt(n)!==this.merkleTreeAccessTokenByChain[e].getRootHash()}}))).filter(e=>e.needsReset).map(e=>e.chainId);t.length>0&&(console.log(`resetting merkle tree in resetMerkleTreesIfNecessary for chains:`,t),await this.resetMerkle(t))}async getEthereumAddress(){let e=this.ethereumProviderAdapter??this.solanaProviderAdapter??this.tronProviderAdapter;if(!e)throw Error(`No provider adapter initialized`);return e.getAddress()}getEthereumAddressByChain(e){return this.getProviderAdapter(e).getAddress()}async getRandomRelay(e,t=!1){return(await a.API.getIdleRelay(e,t)).relay}getGasPrice(e){let t=this.getProviderAdapter(e);if(!t)throw Error(`Illegal State of providerAdapter in Hinkal: no providerAdapter initialized`);return t.getGasPrice(e)}getAPI(){return a.API}snapshotsClearInterval(){this.getSupportedChains().forEach(e=>{this.commitmentsSnapshotServiceByChain[e]?.intervalClear(),this.accessTokenSnapshotServiceByChain[e]?.intervalClear(),this.nullifierSnapshotServiceByChain[e]?.intervalClear()})}checkTokenRegistry(t,n,i){if(r.isSolanaLike(t)){let{hinkalIdl:e,hinkalAddress:a,originalDeployer:o}=r.networkRegistry[t].contractData;if(!e||!a||!o)throw Error(`missing solana data`);return f.hinkalCheckSolanaTokenRegistry(this.getSolanaProgram(e),new $.PublicKey(o),n,i)}return r.isTronLike(t)?b.hinkalCheckTronTokenRegistry(n,i,t):b.hinkalCheckTokenRegistry(this.getContractWithFetcher(t,e.ContractType.HinkalHelperContract),n,i)}getRecipientInfo(){return M.getRecipientInfo(this)}async deposit(e,t,n=!0,r=!1){return C.hinkalDeposit(this,e,t,n,r)}async depositSolana(e,t){return E.hinkalSolanaDeposit(this,e,t)}async depositForOther(e,t,n,r=!0,i=!1){return this.enforceRateLimit(this.depositForOther.name,[e,t,n]),C.hinkalDepositForOther(this,e,t,n,r,i)}async depositSolanaForOther(e,t,n){return this.enforceRateLimit(this.depositSolanaForOther.name,[e,t,n]),E.hinkalSolanaDepositForOther(this,e,t,n)}async depositAndWithdraw(e,t,n,i,a,o,s,c,l=!0){return r.isSolanaLike(m.validateAndGetChainId([e]))?B.hinkalSolanaDepositAndWithdraw(this,e,t,n,i,a,o,s,c):T.hinkalDepositAndWithdraw(this,e,t,n,i,a,o,s,c,l)}async claimUtxo(e,t,n,i){return r.isSolanaLike(m.validateAndGetChainId([e]))?X.hinkalSolanaClaimUtxo(this,e,t,n,i):J.hinkalClaimUtxo(this,e,t,n,i)}async depositAndBridge(e,t,n,r,i,a,o,s=!0){return q.hinkalDepositAndBridge(this,e,t,n,r,i,a,o,s)}async prooflessDeposit(e,t,n,i){return r.isSolanaLike(m.validateAndGetChainId(e))?Y.hinkalSolanaProoflessDeposit(this,e,t,n,i):F.hinkalProoflessDeposit(this,e,t,n,i)}getSolanaProgram(e){if(!this.solanaProviderAdapter)throw Error(`No provider adapter initialized`);if(!(`getSolanaProgram`in this.solanaProviderAdapter))throw Error(`Current provider adapter is not a Solana provider adapter`);return this.solanaProviderAdapter.getSolanaProgram(e)}getSolanaPublicKey(){if(!this.solanaProviderAdapter)throw Error(`No provider adapter initialized`);if(!(`getSolanaPublicKey`in this.solanaProviderAdapter))throw Error(`Current provider adapter is not a Solana provider adapter`);return this.solanaProviderAdapter.getSolanaPublicKey()}async transfer(e,t,n,i,a,o){return r.isSolanaLike(m.validateAndGetChainId(e))?H.hinkalSolanaTransfer(this,e,t,n,i,a,o):R.hinkalTransfer(this,e,t,n,i,a,o)}async withdraw(e,t,n,i,a,o,s){return r.isSolanaLike(m.validateAndGetChainId(e))?V.hinkalSolanaWithdraw(this,e,t,n,a,o,s):O.hinkalWithdraw(this,e,t,n,i,a,o,s)}async withdrawStuckUtxos(e,t){return Z.hinkalWithdrawStuckUtxos(this,e,t)}async swap(e,t,n,i,a,o,s){return r.isSolanaLike(m.validateAndGetChainId(e))?this.swapSolana(e,t,i,a,o):D.hinkalSwap(this,e,t,n,i,a,o,s)}async swapSolana(e,t,n,r,i){let a=JSON.parse(n),o=BigInt(a.swapperAccountSalt),{instructionLists:s,addressLookupTableAccount:c}=a.data;return U.hinkalSolanaSwap(this,e,t,o,s,c,r,i)}async actionReceive(e,t,n,i,a,o){if(!a)throw Error(`subAccount is required`);return r.isSolanaLike(m.validateAndGetChainId(e))?K.hinkalSolanaProxyShield(this,e[0],t[0],a,void 0,o):P.hinkalActionReceive(this,e,t,n,i,a,o)}async actionPrivateWallet(e,t,n,r,i,a,o,s,c,l,u=!1,d,f,p){return this.enforceRateLimit(this.actionPrivateWallet.name,[e,t,n,r,i,a,o,s,c,p]),j.hinkalPrivateWallet(this,e,t,n,r,i,a,o,s,c,l,u,d,f,p)}async proxySwap(e,t,n,i,a,o,s,c,l=!1,u,d){return r.isSolanaLike(m.validateAndGetChainId(e))?G.hinkalSolanaProxySwap(this,e,t,i,o,n,s,c,d):I.hinkalProxySwap(this,e,t,n,i,a,o,s,c,l,u,d)}async proxyToPrivate(e,t,n,i,a,o,s){return r.isSolanaLike(m.validateAndGetChainId(e))?(this.enforceRateLimit(this.proxyToPrivate.name,[e[0],t[0],n,i]),K.hinkalSolanaProxyShield(this,e[0],t[0],n,i,s)):ne.hinkalProxyToPrivate(this,e,t,i,a,o,n,s)}async proxySend(e,t,n,i,a,o,s){let c=m.validateAndGetChainId(e);if(r.isSolanaLike(c))return W.hinkalSolanaProxySend(this,e[0],t[0],n,i,s);let l=te.createTransaferEmporiumOpsBatch(this,c,e.map(e=>e.erc20TokenAddress),t,i),u=e.map((e,n)=>({token:e,amount:-1n*t[n]}));return await this.actionPrivateWallet(c,[],[],[],l,u,n,a,o,void 0,void 0,void 0,s,void 0)}async multiSendPrivateRecipients(e,t,n){return this.enforceRateLimit(this.multiSendPrivateRecipients.name,[e,t,n]),L.hinkalMultiSendPrivateRecipients(this,e,t,n)}areMerkleTreeUpdatesDisabled(){return this.disableMerkleTreeUpdates}updateMerkleTreeUpdates(e){this.disableMerkleTreeUpdates=e}};exports.Hinkal=re;
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../types/ethereum-network.types.cjs`),t=require(`../../functions/utils/serialize.utils.cjs`),n=require(`../../constants/vite.constants.cjs`),r=require(`../../constants/chains.constants.cjs`),i=require(`../../types/hinkal.types.cjs`),a=require(`../../API/getServerURL.cjs`),o=require(`../../API/API.cjs`),s=require(`../../constants/kyc.constants.cjs`),c=require(`../../error-handling/error-codes.constants.cjs`),l=require(`../../functions/utils/erc20tokenFunctions.cjs`);require(`../../API/index.cjs`);const u=require(`../../crypto/poseidon.cjs`),d=require(`../crypto-keys/keys.cjs`),f=require(`../../functions/pre-transaction/solana.cjs`),p=require(`./hinkalCheckSolanaTokenRegistry.cjs`),m=require(`../../functions/web3/functionCalls/accessTokenCalls.cjs`),h=require(`../../functions/utils/token-check.utils.cjs`),ee=require(`../TokenDBs/PrivateTokensDB.cjs`),te=require(`../../functions/web3/events/getShieldedBalance.cjs`),g=require(`../../functions/utils/reloadPage.cjs`),_=require(`../../functions/utils/cacheDevice.utils.cjs`),v=require(`../../functions/web3/getContractMetadata.cjs`),y=require(`../../providers/SolanaProviderAdapter.cjs`),b=require(`./hinkalCheckTokenRegistry.cjs`),x=require(`../merkle-tree/MerkleTree.cjs`);require(`../merkle-tree/index.cjs`);const S=require(`../../functions/web3/fetchSolanaMerkleTreeRootHash.cjs`),C=require(`./hinkalDeposit.cjs`),w=require(`../../functions/private-wallet/emporium.helpers.cjs`),T=require(`../../functions/kyc/checkTokenLimitsUSD.cjs`),E=require(`./hinkalDepositAndWithdraw.cjs`),D=require(`./hinkalSolanaDeposit.cjs`),O=require(`./hinkalSwap.cjs`),k=require(`./hinkalWithdraw.cjs`),A=require(`./resetMerkleTrees.cjs`),j=require(`../MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.cjs`),M=require(`./hinkalPrivateWallet.cjs`),N=require(`./hinkalGetRecipientInfo.cjs`),P=require(`./hinkalSignSubAccount.cjs`),F=require(`./hinkalActionReceive.cjs`);require(`../TokenDBs/index.cjs`);const I=require(`./hinkalProoflessDeposit.cjs`),L=require(`./hinkalProxySwap.cjs`),R=require(`./hinkalMultiSend.cjs`),ne=require(`./hinkalTransfer.cjs`),z=require(`./hinkalProxyToPrivate.cjs`),B=require(`../../providers/TronProviderAdapter.cjs`),V=require(`./hinkalSolanaDepositAndWithdraw.cjs`),H=require(`./hinkalSolanaWithdraw.cjs`),U=require(`./hinkalSolanaTransfer.cjs`),W=require(`./hinkalSolanaSwap.cjs`),G=require(`./hinkalSolanaProxySend.cjs`),K=require(`./hinkalSolanaProxySwap.cjs`),q=require(`./hinkalSolanaProxyShield.cjs`),J=require(`./hinkalDepositAndBridge.cjs`),Y=require(`./hinkalClaimUtxo.cjs`),X=require(`./hinkalSolanaProoflessDeposit.cjs`),Z=require(`./hinkalSolanaClaimUtxo.cjs`),re=require(`./hinkalWithdrawStuckUtxos.cjs`);let Q=require(`ethers`),$=require(`@solana/web3.js`);var ie=class{ethereumProviderAdapter;solanaProviderAdapter;tronProviderAdapter;userKeys;signingMessage=`Login to Hinkal Protocol`;privateTransferSigningMessage=`Login to Hinkal's Private Transfer App`;merkleTreeHinkalByChain={};merkleTreeAccessTokenByChain={};nullifiersByChain={};encryptedOutputsByChain={};commitmentsSnapshotServiceByChain={};nullifierSnapshotServiceByChain={};accessTokenSnapshotServiceByChain={};utxoUtils;lastCallState=new Map;cacheDevice;generateProofRemotely;disableMerkleTreeUpdates;tronChainId;constructor(e){this.userKeys=new d.UserKeys(void 0),console.log(`hinkalConfig`,e||`undefined`),console.log(`currentTronChainId`,r.currentTronChainId||`undefined`),this.tronChainId=e?.tronChainOverride??r.currentTronChainId,r.setHinkalTronChainId(this.tronChainId),a.setBackendForTronChain(this.tronChainId),r.HINKAL_SUPPORTED_CHAINS.forEach(e=>{this.merkleTreeHinkalByChain[e]=x.MerkleTree.create(u.poseidonFunction,0n),this.merkleTreeAccessTokenByChain[e]=x.MerkleTree.create(u.poseidonFunction,0n),this.nullifiersByChain[e]=new Set,this.encryptedOutputsByChain[e]=[]}),this.generateProofRemotely=e?.generateProofRemotely??!0,this.utxoUtils=new j.MultiThreadedUtxoUtils,this.cacheDevice=_.createCacheDevice(e),this.disableMerkleTreeUpdates=e?.disableMerkleTreeUpdates??!1}enforceRateLimit(e,n,r=1e3){let i=Date.now(),a=t.CustomJSONStringify(n),o=this.lastCallState.get(e);if(o&&o.argsKey===a&&i-o.timestamp<r)throw Error(`${e} was already called with the same arguments`);this.lastCallState.set(e,{timestamp:i,argsKey:a})}getProviderAdapter(e){let t=e;t||=this.ethereumProviderAdapter?r.chainIds.ethMainnet:this.solanaProviderAdapter?r.chainIds.solanaMainnet:r.chainIds.tronMainnet;let n;if(n=r.isSolanaLike(t)?this.solanaProviderAdapter:r.isTronLike(t)?this.tronProviderAdapter:this.ethereumProviderAdapter,!n)throw Error(`ProviderAdapter is not initialized`);return n}async initProviderAdapter(e,t){let n=r.chainIds.ethMainnet;console.log(`this.tronChainId`,this.tronChainId),t instanceof y.SolanaProviderAdapter?n=r.chainIds.solanaMainnet:t instanceof B.TronProviderAdapter&&(n=this.tronChainId),await this.updateProviderAdapter(n,t),t.initConnector(e);let i=await t.connectAndPatchProvider(e);await t.init(i),await this.setListeners()}getSigningMessage(e=i.LoginMessageMode.PROTOCOL){switch(e){case i.LoginMessageMode.PRIVATE_TRANSFER:return this.privateTransferSigningMessage;case i.LoginMessageMode.PROTOCOL:default:return this.signingMessage}}async initUserKeys(e=i.LoginMessageMode.PROTOCOL){let t=this.getSigningMessage(e);this.userKeys=new d.UserKeys(await this.getProviderAdapter().signMessage(t))}initUserKeysWithSignature(e){this.userKeys=new d.UserKeys(e)}async initUserKeysFromSeedPhrases(e){let t=e.join(` `),n=Q.ethers.toUtf8Bytes(t),r=Q.ethers.keccak256(n);this.userKeys=new d.UserKeys(r)}async resetMerkle(e){this.disableMerkleTreeUpdates||(e?.every(e=>this.isSelectedNetworkSupported(e))??!0)&&await A.resetMerkleTrees(this,e)}getTronWeb(){let e=this.tronProviderAdapter;if(!e)throw Error(`Tron provider adapter not initialized`);if(!(e instanceof B.TronProviderAdapter))throw Error(`Tron provider adapter is not a TronProviderAdapter`);let t=e.getTronWeb();if(!t)throw Error(`TronWeb not available`);return t}getSupportedChains(){return this.ethereumProviderAdapter&&this.solanaProviderAdapter?r.WALLET_SUPPORTED_CHAINS:this.ethereumProviderAdapter?r.HINKAL_SUPPORTED_CHAINS.filter(e=>!r.isSolanaLike(e)&&!r.isTronLike(e)):this.solanaProviderAdapter?r.HINKAL_SUPPORTED_CHAINS.filter(e=>r.isSolanaLike(e)):this.tronProviderAdapter?[this.tronChainId]:[]}async waitForTransaction(e,t,n=1){return!!await this.getProviderAdapter(e).waitForTransaction(e,t,n)}getContract(e,t,n=void 0){return this.getProviderAdapter(e).getContract(e,t,n)}getContractWithFetcherByChainId(e,t,n=void 0){return v.getContractWithFetcherByChainId(e,t,n)}async signMessage(e){return await this.getProviderAdapter().signMessage(e)}async signTypedData(e,t,n){return await this.getProviderAdapter().signTypedData(e,t,n)}async signWithSubAccount(e,t,n,r){return P.hinkalSignSubAccount(e,t,n,r)}getContractWithSigner(e,t,n=``){return this.getProviderAdapter(e).getContractWithSigner(e,t,n)}getContractWithFetcher(e,t,n=``){return this.getProviderAdapter(e).getContractWithFetcher(e,t,n)}isSelectedNetworkSupported(e){return!!r.networkRegistry[e]}async switchNetwork(e){try{await this.getProviderAdapter().switchNetwork(e)}catch{throw Error(c.transactionErrorCodes.FAILED_TO_SWITCH_NETWORKS)}}isPermitterAvailable(e){return this.getProviderAdapter(e).isPermitterAvailable()}async disconnectFromConnector(){await this.ethereumProviderAdapter?.disconnectFromConnector(),await this.solanaProviderAdapter?.disconnectFromConnector(),await this.tronProviderAdapter?.disconnectFromConnector()}async resetProviderAdapters(){this.ethereumProviderAdapter=void 0,this.solanaProviderAdapter=void 0,this.tronProviderAdapter=void 0}async updateProviderAdapter(e,t){try{r.isSolanaLike(e)?(this.solanaProviderAdapter&&this.solanaProviderAdapter.release(),this.solanaProviderAdapter=t):r.isTronLike(e)?(this.tronProviderAdapter&&this.tronProviderAdapter.release(),this.tronProviderAdapter=t):(this.ethereumProviderAdapter&&this.ethereumProviderAdapter.release(),this.ethereumProviderAdapter=t)}catch(e){throw console.error(e),Error(`updateProviderAdapter failed, please try again.`)}}async setListeners(){this.ethereumProviderAdapter?.setChainEventListener({onAccountChanged:()=>{this.onAccountChanged()},onChainChanged:e=>{this.onChainChanged(e)}}),this.solanaProviderAdapter?.setChainEventListener({onAccountChanged:()=>{this.onAccountChanged()},onChainChanged:e=>{this.onChainChanged(e)}}),this.tronProviderAdapter?.setChainEventListener({onAccountChanged:()=>{this.onAccountChanged()},onChainChanged:e=>{this.onChainChanged(e)}})}async onAccountChanged(){await this.ethereumProviderAdapter?.onAccountChanged(),await this.solanaProviderAdapter?.onAccountChanged(),await this.tronProviderAdapter?.onAccountChanged();let e=i.EventType.AccountChanged;typeof document<`u`?document?.dispatchEvent(new Event(e)):process?.emit(`message`,e,void 0)}async onChainChanged(e){e?await this.getProviderAdapter(e).onChainChanged(e):(await this.disconnectFromConnector(),g.reloadPage())}async monitorConnectedAddress(e){await o.API.monitor(await this.getEthereumAddressByChain(e))}async getBalances(e,t,n,r,i=!1,a,o=!1){return te.getShieldedBalance(this,e,t,n,r,i,this.generateProofRemotely,a,o)}async getTotalBalance(e,t,r,i=!1,a,o=!1){let s=r??await this.getEthereumAddressByChain(e),c=t??this.userKeys,u=await this.getBalances(e,c.getShieldedPrivateKey(),c.getShieldedPublicKey(),s,i,a,o),d=n.isExtension?await ee.privateTokensDB.getPrivateTokens(e,s):l.getErc20TokensForChain(e),f=[];return d.forEach(e=>{let t=e.erc20TokenAddress.toLowerCase(),n=u.get(t),r={token:e,balance:n?.balance??0n,timestamp:n?.timestamp||`0`,nfts:n?.nfts||[]};f.push(r)}),f}async getStuckShieldedBalances(e,t,n){return(await this.getTotalBalance(e,t,n,!1,!1,!0)).filter(e=>e.balance>0n)}getSupportedPassportLinks(){return s.supportedPassportLinks}checkAccessToken(e,t){return m.checkHinkalAccessToken(this,e,t)}checkExternalTokenLimitsUSD(e,t,n){return T.checkTokenLimitsUSD(e,t,n)}async getHinkalTreeRootHash(t){if(r.isSolanaLike(t)){let{hinkalIdl:e,hinkalAddress:n,originalDeployer:i}=r.networkRegistry[t].contractData;if(!e||!n||!i)throw Error(`Missing Solana configuration for chain ${t}`);let a=new $.PublicKey(i),o=f.getMerkleAccountPublicKey(new $.PublicKey(n),a);return S.fetchSolanaMerkleTreeRootHash(this.getSolanaProgram(e),o)}return this.getContractWithFetcherByChainId(t,e.ContractType.HinkalContract).getRootHash()}async getAccessTokenTreeRootHash(t){if(r.isSolanaLike(t)){let{hinkalIdl:e,hinkalAddress:n,originalDeployer:i}=r.networkRegistry[t].contractData;if(!e||!n||!i)throw Error(`Missing Solana configuration for chain ${t}`);let a=new $.PublicKey(i),o=f.getAccessTokenMerkleAccountPublicKey(new $.PublicKey(n),a);return S.fetchSolanaMerkleTreeRootHash(this.getSolanaProgram(e),o)}return this.getContractWithFetcherByChainId(t,e.ContractType.AccessTokenContract).getRootHash()}async resetMerkleTreesIfNecessary(e){let t=(await Promise.all((e??this.getSupportedChains()).map(async e=>{let[t,n]=await Promise.all([this.getHinkalTreeRootHash(e),this.getAccessTokenTreeRootHash(e)]);return{chainId:e,needsReset:BigInt(t)!==this.merkleTreeHinkalByChain[e].getRootHash()||BigInt(n)!==this.merkleTreeAccessTokenByChain[e].getRootHash()}}))).filter(e=>e.needsReset).map(e=>e.chainId);t.length>0&&(console.log(`resetting merkle tree in resetMerkleTreesIfNecessary for chains:`,t),await this.resetMerkle(t))}async getEthereumAddress(){let e=this.ethereumProviderAdapter??this.solanaProviderAdapter??this.tronProviderAdapter;if(!e)throw Error(`No provider adapter initialized`);return e.getAddress()}getEthereumAddressByChain(e){return this.getProviderAdapter(e).getAddress()}async getRandomRelay(e,t=!1){return(await o.API.getIdleRelay(e,t)).relay}getGasPrice(e){let t=this.getProviderAdapter(e);if(!t)throw Error(`Illegal State of providerAdapter in Hinkal: no providerAdapter initialized`);return t.getGasPrice(e)}getAPI(){return o.API}snapshotsClearInterval(){this.getSupportedChains().forEach(e=>{this.commitmentsSnapshotServiceByChain[e]?.intervalClear(),this.accessTokenSnapshotServiceByChain[e]?.intervalClear(),this.nullifierSnapshotServiceByChain[e]?.intervalClear()})}checkTokenRegistry(t,n,i){if(r.isSolanaLike(t)){let{hinkalIdl:e,hinkalAddress:a,originalDeployer:o}=r.networkRegistry[t].contractData;if(!e||!a||!o)throw Error(`missing solana data`);return p.hinkalCheckSolanaTokenRegistry(this.getSolanaProgram(e),new $.PublicKey(o),n,i)}return r.isTronLike(t)?b.hinkalCheckTronTokenRegistry(n,i,t):b.hinkalCheckTokenRegistry(this.getContractWithFetcher(t,e.ContractType.HinkalHelperContract),n,i)}getRecipientInfo(){return N.getRecipientInfo(this)}async deposit(e,t,n=!0,r=!1){return C.hinkalDeposit(this,e,t,n,r)}async depositSolana(e,t){return D.hinkalSolanaDeposit(this,e,t)}async depositForOther(e,t,n,r=!0,i=!1){return this.enforceRateLimit(this.depositForOther.name,[e,t,n]),C.hinkalDepositForOther(this,e,t,n,r,i)}async depositSolanaForOther(e,t,n){return this.enforceRateLimit(this.depositSolanaForOther.name,[e,t,n]),D.hinkalSolanaDepositForOther(this,e,t,n)}async depositAndWithdraw(e,t,n,i,a,o,s,c,l=!0){return r.isSolanaLike(h.validateAndGetChainId([e]))?V.hinkalSolanaDepositAndWithdraw(this,e,t,n,i,a,o,s,c):E.hinkalDepositAndWithdraw(this,e,t,n,i,a,o,s,c,l)}async claimUtxo(e,t,n,i){return r.isSolanaLike(h.validateAndGetChainId([e]))?Z.hinkalSolanaClaimUtxo(this,e,t,n,i):Y.hinkalClaimUtxo(this,e,t,n,i)}async depositAndBridge(e,t,n,r,i,a,o,s=!0){return J.hinkalDepositAndBridge(this,e,t,n,r,i,a,o,s)}async prooflessDeposit(e,t,n,i){return r.isSolanaLike(h.validateAndGetChainId(e))?X.hinkalSolanaProoflessDeposit(this,e,t,n,i):I.hinkalProoflessDeposit(this,e,t,n,i)}getSolanaProgram(e){if(!this.solanaProviderAdapter)throw Error(`No provider adapter initialized`);if(!(`getSolanaProgram`in this.solanaProviderAdapter))throw Error(`Current provider adapter is not a Solana provider adapter`);return this.solanaProviderAdapter.getSolanaProgram(e)}getSolanaPublicKey(){if(!this.solanaProviderAdapter)throw Error(`No provider adapter initialized`);if(!(`getSolanaPublicKey`in this.solanaProviderAdapter))throw Error(`Current provider adapter is not a Solana provider adapter`);return this.solanaProviderAdapter.getSolanaPublicKey()}async transfer(e,t,n,i,a,o){return r.isSolanaLike(h.validateAndGetChainId(e))?U.hinkalSolanaTransfer(this,e,t,n,i,a,o):ne.hinkalTransfer(this,e,t,n,i,a,o)}async withdraw(e,t,n,i,a,o,s){return r.isSolanaLike(h.validateAndGetChainId(e))?H.hinkalSolanaWithdraw(this,e,t,n,a,o,s):k.hinkalWithdraw(this,e,t,n,i,a,o,s)}async withdrawStuckUtxos(e,t){return re.hinkalWithdrawStuckUtxos(this,e,t)}async swap(e,t,n,i,a,o,s){return r.isSolanaLike(h.validateAndGetChainId(e))?this.swapSolana(e,t,i,a,o):O.hinkalSwap(this,e,t,n,i,a,o,s)}async swapSolana(e,t,n,r,i){let a=JSON.parse(n),o=BigInt(a.swapperAccountSalt),{instructionLists:s,addressLookupTableAccount:c}=a.data;return W.hinkalSolanaSwap(this,e,t,o,s,c,r,i)}async actionReceive(e,t,n,i,a,o){if(!a)throw Error(`subAccount is required`);return r.isSolanaLike(h.validateAndGetChainId(e))?q.hinkalSolanaProxyShield(this,e[0],t[0],a,void 0,o):F.hinkalActionReceive(this,e,t,n,i,a,o)}async actionPrivateWallet(e,t,n,r,i,a,o,s,c,l,u=!1,d,f,p){return this.enforceRateLimit(this.actionPrivateWallet.name,[e,t,n,r,i,a,o,s,c,p]),M.hinkalPrivateWallet(this,e,t,n,r,i,a,o,s,c,l,u,d,f,p)}async proxySwap(e,t,n,i,a,o,s,c,l=!1,u,d){return r.isSolanaLike(h.validateAndGetChainId(e))?K.hinkalSolanaProxySwap(this,e,t,i,o,n,s,c,d):L.hinkalProxySwap(this,e,t,n,i,a,o,s,c,l,u,d)}async proxyToPrivate(e,t,n,i,a,o,s){return r.isSolanaLike(h.validateAndGetChainId(e))?(this.enforceRateLimit(this.proxyToPrivate.name,[e[0],t[0],n,i]),q.hinkalSolanaProxyShield(this,e[0],t[0],n,i,s)):z.hinkalProxyToPrivate(this,e,t,i,a,o,n,s)}async proxySend(e,t,n,i,a,o,s){let c=h.validateAndGetChainId(e);if(r.isSolanaLike(c))return G.hinkalSolanaProxySend(this,e[0],t[0],n,i,s);let l=w.createTransaferEmporiumOpsBatch(this,c,e.map(e=>e.erc20TokenAddress),t,i),u=e.map((e,n)=>({token:e,amount:-1n*t[n]}));return await this.actionPrivateWallet(c,[],[],[],l,u,n,a,o,void 0,void 0,void 0,s,void 0)}async multiSendPrivateRecipients(e,t,n){return this.enforceRateLimit(this.multiSendPrivateRecipients.name,[e,t,n]),R.hinkalMultiSendPrivateRecipients(this,e,t,n)}areMerkleTreeUpdatesDisabled(){return this.disableMerkleTreeUpdates}updateMerkleTreeUpdates(e){this.disableMerkleTreeUpdates=e}};exports.Hinkal=ie;
|
|
@@ -1,65 +1,66 @@
|
|
|
1
1
|
import { ContractType as e } from "../../types/ethereum-network.types.mjs";
|
|
2
2
|
import { CustomJSONStringify as t } from "../../functions/utils/serialize.utils.mjs";
|
|
3
3
|
import { isExtension as n } from "../../constants/vite.constants.mjs";
|
|
4
|
-
import { HINKAL_SUPPORTED_CHAINS as r, WALLET_SUPPORTED_CHAINS as i, chainIds as a, currentTronChainId as o, isSolanaLike as s, isTronLike as c, networkRegistry as l } from "../../constants/chains.constants.mjs";
|
|
5
|
-
import { EventType as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
4
|
+
import { HINKAL_SUPPORTED_CHAINS as r, WALLET_SUPPORTED_CHAINS as i, chainIds as a, currentTronChainId as o, isSolanaLike as s, isTronLike as c, networkRegistry as l, setHinkalTronChainId as u } from "../../constants/chains.constants.mjs";
|
|
5
|
+
import { EventType as d, LoginMessageMode as f } from "../../types/hinkal.types.mjs";
|
|
6
|
+
import { setBackendForTronChain as p } from "../../API/getServerURL.mjs";
|
|
7
|
+
import { API as m } from "../../API/API.mjs";
|
|
8
|
+
import { supportedPassportLinks as h } from "../../constants/kyc.constants.mjs";
|
|
9
|
+
import { transactionErrorCodes as g } from "../../error-handling/error-codes.constants.mjs";
|
|
10
|
+
import { getErc20TokensForChain as ee } from "../../functions/utils/erc20tokenFunctions.mjs";
|
|
10
11
|
import "../../API/index.mjs";
|
|
11
|
-
import { poseidonFunction as
|
|
12
|
-
import { UserKeys as
|
|
13
|
-
import { getAccessTokenMerkleAccountPublicKey as
|
|
14
|
-
import { hinkalCheckSolanaTokenRegistry as
|
|
15
|
-
import { checkHinkalAccessToken as
|
|
12
|
+
import { poseidonFunction as _ } from "../../crypto/poseidon.mjs";
|
|
13
|
+
import { UserKeys as v } from "../crypto-keys/keys.mjs";
|
|
14
|
+
import { getAccessTokenMerkleAccountPublicKey as te, getMerkleAccountPublicKey as ne } from "../../functions/pre-transaction/solana.mjs";
|
|
15
|
+
import { hinkalCheckSolanaTokenRegistry as re } from "./hinkalCheckSolanaTokenRegistry.mjs";
|
|
16
|
+
import { checkHinkalAccessToken as ie } from "../../functions/web3/functionCalls/accessTokenCalls.mjs";
|
|
16
17
|
import { validateAndGetChainId as y } from "../../functions/utils/token-check.utils.mjs";
|
|
17
|
-
import { privateTokensDB as
|
|
18
|
-
import { getShieldedBalance as
|
|
19
|
-
import { reloadPage as
|
|
20
|
-
import { createCacheDevice as
|
|
21
|
-
import { getContractWithFetcherByChainId as
|
|
22
|
-
import { SolanaProviderAdapter as
|
|
23
|
-
import { hinkalCheckTokenRegistry as
|
|
24
|
-
import { MerkleTree as
|
|
18
|
+
import { privateTokensDB as b } from "../TokenDBs/PrivateTokensDB.mjs";
|
|
19
|
+
import { getShieldedBalance as x } from "../../functions/web3/events/getShieldedBalance.mjs";
|
|
20
|
+
import { reloadPage as S } from "../../functions/utils/reloadPage.mjs";
|
|
21
|
+
import { createCacheDevice as C } from "../../functions/utils/cacheDevice.utils.mjs";
|
|
22
|
+
import { getContractWithFetcherByChainId as w } from "../../functions/web3/getContractMetadata.mjs";
|
|
23
|
+
import { SolanaProviderAdapter as T } from "../../providers/SolanaProviderAdapter.mjs";
|
|
24
|
+
import { hinkalCheckTokenRegistry as E, hinkalCheckTronTokenRegistry as D } from "./hinkalCheckTokenRegistry.mjs";
|
|
25
|
+
import { MerkleTree as O } from "../merkle-tree/MerkleTree.mjs";
|
|
25
26
|
import "../merkle-tree/index.mjs";
|
|
26
|
-
import { fetchSolanaMerkleTreeRootHash as
|
|
27
|
-
import { hinkalDeposit as
|
|
28
|
-
import { createTransaferEmporiumOpsBatch as
|
|
29
|
-
import { checkTokenLimitsUSD as
|
|
30
|
-
import { hinkalDepositAndWithdraw as
|
|
31
|
-
import { hinkalSolanaDeposit as
|
|
32
|
-
import { hinkalSwap as
|
|
33
|
-
import { hinkalWithdraw as
|
|
34
|
-
import { resetMerkleTrees as
|
|
35
|
-
import { MultiThreadedUtxoUtils as
|
|
36
|
-
import { hinkalPrivateWallet as
|
|
37
|
-
import { getRecipientInfo as
|
|
38
|
-
import { hinkalSignSubAccount as
|
|
39
|
-
import { hinkalActionReceive as
|
|
27
|
+
import { fetchSolanaMerkleTreeRootHash as k } from "../../functions/web3/fetchSolanaMerkleTreeRootHash.mjs";
|
|
28
|
+
import { hinkalDeposit as A, hinkalDepositForOther as j } from "./hinkalDeposit.mjs";
|
|
29
|
+
import { createTransaferEmporiumOpsBatch as M } from "../../functions/private-wallet/emporium.helpers.mjs";
|
|
30
|
+
import { checkTokenLimitsUSD as N } from "../../functions/kyc/checkTokenLimitsUSD.mjs";
|
|
31
|
+
import { hinkalDepositAndWithdraw as P } from "./hinkalDepositAndWithdraw.mjs";
|
|
32
|
+
import { hinkalSolanaDeposit as F, hinkalSolanaDepositForOther as I } from "./hinkalSolanaDeposit.mjs";
|
|
33
|
+
import { hinkalSwap as L } from "./hinkalSwap.mjs";
|
|
34
|
+
import { hinkalWithdraw as R } from "./hinkalWithdraw.mjs";
|
|
35
|
+
import { resetMerkleTrees as z } from "./resetMerkleTrees.mjs";
|
|
36
|
+
import { MultiThreadedUtxoUtils as ae } from "../MultiThreadedUtxoUtils/MultiThreadedUtxoUtils.mjs";
|
|
37
|
+
import { hinkalPrivateWallet as B } from "./hinkalPrivateWallet.mjs";
|
|
38
|
+
import { getRecipientInfo as V } from "./hinkalGetRecipientInfo.mjs";
|
|
39
|
+
import { hinkalSignSubAccount as H } from "./hinkalSignSubAccount.mjs";
|
|
40
|
+
import { hinkalActionReceive as U } from "./hinkalActionReceive.mjs";
|
|
40
41
|
import "../TokenDBs/index.mjs";
|
|
41
|
-
import { hinkalProoflessDeposit as
|
|
42
|
-
import { hinkalProxySwap as
|
|
43
|
-
import { hinkalMultiSendPrivateRecipients as
|
|
44
|
-
import { hinkalTransfer as
|
|
45
|
-
import { hinkalProxyToPrivate as
|
|
46
|
-
import { TronProviderAdapter as
|
|
47
|
-
import { hinkalSolanaDepositAndWithdraw as
|
|
48
|
-
import { hinkalSolanaWithdraw as
|
|
49
|
-
import { hinkalSolanaTransfer as
|
|
50
|
-
import { hinkalSolanaSwap as
|
|
51
|
-
import { hinkalSolanaProxySend as
|
|
52
|
-
import { hinkalSolanaProxySwap as
|
|
53
|
-
import { hinkalSolanaProxyShield as
|
|
54
|
-
import { hinkalDepositAndBridge as
|
|
55
|
-
import { hinkalClaimUtxo as
|
|
56
|
-
import { hinkalSolanaProoflessDeposit as
|
|
57
|
-
import { hinkalSolanaClaimUtxo as
|
|
58
|
-
import { hinkalWithdrawStuckUtxos as
|
|
42
|
+
import { hinkalProoflessDeposit as W } from "./hinkalProoflessDeposit.mjs";
|
|
43
|
+
import { hinkalProxySwap as G } from "./hinkalProxySwap.mjs";
|
|
44
|
+
import { hinkalMultiSendPrivateRecipients as K } from "./hinkalMultiSend.mjs";
|
|
45
|
+
import { hinkalTransfer as q } from "./hinkalTransfer.mjs";
|
|
46
|
+
import { hinkalProxyToPrivate as J } from "./hinkalProxyToPrivate.mjs";
|
|
47
|
+
import { TronProviderAdapter as Y } from "../../providers/TronProviderAdapter.mjs";
|
|
48
|
+
import { hinkalSolanaDepositAndWithdraw as oe } from "./hinkalSolanaDepositAndWithdraw.mjs";
|
|
49
|
+
import { hinkalSolanaWithdraw as se } from "./hinkalSolanaWithdraw.mjs";
|
|
50
|
+
import { hinkalSolanaTransfer as ce } from "./hinkalSolanaTransfer.mjs";
|
|
51
|
+
import { hinkalSolanaSwap as le } from "./hinkalSolanaSwap.mjs";
|
|
52
|
+
import { hinkalSolanaProxySend as X } from "./hinkalSolanaProxySend.mjs";
|
|
53
|
+
import { hinkalSolanaProxySwap as ue } from "./hinkalSolanaProxySwap.mjs";
|
|
54
|
+
import { hinkalSolanaProxyShield as Z } from "./hinkalSolanaProxyShield.mjs";
|
|
55
|
+
import { hinkalDepositAndBridge as de } from "./hinkalDepositAndBridge.mjs";
|
|
56
|
+
import { hinkalClaimUtxo as fe } from "./hinkalClaimUtxo.mjs";
|
|
57
|
+
import { hinkalSolanaProoflessDeposit as pe } from "./hinkalSolanaProoflessDeposit.mjs";
|
|
58
|
+
import { hinkalSolanaClaimUtxo as me } from "./hinkalSolanaClaimUtxo.mjs";
|
|
59
|
+
import { hinkalWithdrawStuckUtxos as he } from "./hinkalWithdrawStuckUtxos.mjs";
|
|
59
60
|
import { ethers as Q } from "ethers";
|
|
60
61
|
import { PublicKey as $ } from "@solana/web3.js";
|
|
61
62
|
//#region libs/shared/common/src/data-structures/Hinkal/Hinkal.ts
|
|
62
|
-
var
|
|
63
|
+
var ge = class {
|
|
63
64
|
ethereumProviderAdapter;
|
|
64
65
|
solanaProviderAdapter;
|
|
65
66
|
tronProviderAdapter;
|
|
@@ -80,11 +81,9 @@ var me = class {
|
|
|
80
81
|
disableMerkleTreeUpdates;
|
|
81
82
|
tronChainId;
|
|
82
83
|
constructor(e) {
|
|
83
|
-
this.userKeys = new
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
this.merkleTreeHinkalByChain[e] = D.create(h, 0n), this.merkleTreeAccessTokenByChain[e] = D.create(h, 0n), this.nullifiersByChain[e] = /* @__PURE__ */ new Set(), this.encryptedOutputsByChain[e] = [];
|
|
87
|
-
}), this.generateProofRemotely = e?.generateProofRemotely ?? !0, this.utxoUtils = new z(), this.cacheDevice = S(e), this.disableMerkleTreeUpdates = e?.disableMerkleTreeUpdates ?? !1;
|
|
84
|
+
this.userKeys = new v(void 0), console.log("hinkalConfig", e || "undefined"), console.log("currentTronChainId", o || "undefined"), this.tronChainId = e?.tronChainOverride ?? o, u(this.tronChainId), p(this.tronChainId), r.forEach((e) => {
|
|
85
|
+
this.merkleTreeHinkalByChain[e] = O.create(_, 0n), this.merkleTreeAccessTokenByChain[e] = O.create(_, 0n), this.nullifiersByChain[e] = /* @__PURE__ */ new Set(), this.encryptedOutputsByChain[e] = [];
|
|
86
|
+
}), this.generateProofRemotely = e?.generateProofRemotely ?? !0, this.utxoUtils = new ae(), this.cacheDevice = C(e), this.disableMerkleTreeUpdates = e?.disableMerkleTreeUpdates ?? !1;
|
|
88
87
|
}
|
|
89
88
|
enforceRateLimit(e, n, r = 1e3) {
|
|
90
89
|
let i = Date.now(), a = t(n), o = this.lastCallState.get(e);
|
|
@@ -103,35 +102,35 @@ var me = class {
|
|
|
103
102
|
}
|
|
104
103
|
async initProviderAdapter(e, t) {
|
|
105
104
|
let n = a.ethMainnet;
|
|
106
|
-
console.log("this.tronChainId", this.tronChainId), t instanceof
|
|
105
|
+
console.log("this.tronChainId", this.tronChainId), t instanceof T ? n = a.solanaMainnet : t instanceof Y && (n = this.tronChainId), await this.updateProviderAdapter(n, t), t.initConnector(e);
|
|
107
106
|
let r = await t.connectAndPatchProvider(e);
|
|
108
107
|
await t.init(r), await this.setListeners();
|
|
109
108
|
}
|
|
110
|
-
getSigningMessage(e =
|
|
109
|
+
getSigningMessage(e = f.PROTOCOL) {
|
|
111
110
|
switch (e) {
|
|
112
|
-
case
|
|
113
|
-
case
|
|
111
|
+
case f.PRIVATE_TRANSFER: return this.privateTransferSigningMessage;
|
|
112
|
+
case f.PROTOCOL:
|
|
114
113
|
default: return this.signingMessage;
|
|
115
114
|
}
|
|
116
115
|
}
|
|
117
|
-
async initUserKeys(e =
|
|
116
|
+
async initUserKeys(e = f.PROTOCOL) {
|
|
118
117
|
let t = this.getSigningMessage(e);
|
|
119
|
-
this.userKeys = new
|
|
118
|
+
this.userKeys = new v(await this.getProviderAdapter().signMessage(t));
|
|
120
119
|
}
|
|
121
120
|
initUserKeysWithSignature(e) {
|
|
122
|
-
this.userKeys = new
|
|
121
|
+
this.userKeys = new v(e);
|
|
123
122
|
}
|
|
124
123
|
async initUserKeysFromSeedPhrases(e) {
|
|
125
124
|
let t = e.join(" "), n = Q.toUtf8Bytes(t), r = Q.keccak256(n);
|
|
126
|
-
this.userKeys = new
|
|
125
|
+
this.userKeys = new v(r);
|
|
127
126
|
}
|
|
128
127
|
async resetMerkle(e) {
|
|
129
|
-
this.disableMerkleTreeUpdates || (e?.every((e) => this.isSelectedNetworkSupported(e)) ?? !0) && await
|
|
128
|
+
this.disableMerkleTreeUpdates || (e?.every((e) => this.isSelectedNetworkSupported(e)) ?? !0) && await z(this, e);
|
|
130
129
|
}
|
|
131
130
|
getTronWeb() {
|
|
132
131
|
let e = this.tronProviderAdapter;
|
|
133
132
|
if (!e) throw Error("Tron provider adapter not initialized");
|
|
134
|
-
if (!(e instanceof
|
|
133
|
+
if (!(e instanceof Y)) throw Error("Tron provider adapter is not a TronProviderAdapter");
|
|
135
134
|
let t = e.getTronWeb();
|
|
136
135
|
if (!t) throw Error("TronWeb not available");
|
|
137
136
|
return t;
|
|
@@ -146,7 +145,7 @@ var me = class {
|
|
|
146
145
|
return this.getProviderAdapter(e).getContract(e, t, n);
|
|
147
146
|
}
|
|
148
147
|
getContractWithFetcherByChainId(e, t, n = void 0) {
|
|
149
|
-
return
|
|
148
|
+
return w(e, t, n);
|
|
150
149
|
}
|
|
151
150
|
async signMessage(e) {
|
|
152
151
|
return await this.getProviderAdapter().signMessage(e);
|
|
@@ -155,7 +154,7 @@ var me = class {
|
|
|
155
154
|
return await this.getProviderAdapter().signTypedData(e, t, n);
|
|
156
155
|
}
|
|
157
156
|
async signWithSubAccount(e, t, n, r) {
|
|
158
|
-
return
|
|
157
|
+
return H(e, t, n, r);
|
|
159
158
|
}
|
|
160
159
|
getContractWithSigner(e, t, n = "") {
|
|
161
160
|
return this.getProviderAdapter(e).getContractWithSigner(e, t, n);
|
|
@@ -170,7 +169,7 @@ var me = class {
|
|
|
170
169
|
try {
|
|
171
170
|
await this.getProviderAdapter().switchNetwork(e);
|
|
172
171
|
} catch {
|
|
173
|
-
throw Error(
|
|
172
|
+
throw Error(g.FAILED_TO_SWITCH_NETWORKS);
|
|
174
173
|
}
|
|
175
174
|
}
|
|
176
175
|
isPermitterAvailable(e) {
|
|
@@ -215,20 +214,20 @@ var me = class {
|
|
|
215
214
|
}
|
|
216
215
|
async onAccountChanged() {
|
|
217
216
|
await this.ethereumProviderAdapter?.onAccountChanged(), await this.solanaProviderAdapter?.onAccountChanged(), await this.tronProviderAdapter?.onAccountChanged();
|
|
218
|
-
let e =
|
|
217
|
+
let e = d.AccountChanged;
|
|
219
218
|
typeof document < "u" ? document?.dispatchEvent(new Event(e)) : process?.emit("message", e, void 0);
|
|
220
219
|
}
|
|
221
220
|
async onChainChanged(e) {
|
|
222
|
-
e ? await this.getProviderAdapter(e).onChainChanged(e) : (await this.disconnectFromConnector(),
|
|
221
|
+
e ? await this.getProviderAdapter(e).onChainChanged(e) : (await this.disconnectFromConnector(), S());
|
|
223
222
|
}
|
|
224
223
|
async monitorConnectedAddress(e) {
|
|
225
|
-
await
|
|
224
|
+
await m.monitor(await this.getEthereumAddressByChain(e));
|
|
226
225
|
}
|
|
227
226
|
async getBalances(e, t, n, r, i = !1, a, o = !1) {
|
|
228
|
-
return
|
|
227
|
+
return x(this, e, t, n, r, i, this.generateProofRemotely, a, o);
|
|
229
228
|
}
|
|
230
229
|
async getTotalBalance(e, t, r, i = !1, a, o = !1) {
|
|
231
|
-
let s = r ?? await this.getEthereumAddressByChain(e), c = t ?? this.userKeys, l = await this.getBalances(e, c.getShieldedPrivateKey(), c.getShieldedPublicKey(), s, i, a, o), u = n ? await
|
|
230
|
+
let s = r ?? await this.getEthereumAddressByChain(e), c = t ?? this.userKeys, l = await this.getBalances(e, c.getShieldedPrivateKey(), c.getShieldedPublicKey(), s, i, a, o), u = n ? await b.getPrivateTokens(e, s) : ee(e), d = [];
|
|
232
231
|
return u.forEach((e) => {
|
|
233
232
|
let t = e.erc20TokenAddress.toLowerCase(), n = l.get(t), r = {
|
|
234
233
|
token: e,
|
|
@@ -243,20 +242,20 @@ var me = class {
|
|
|
243
242
|
return (await this.getTotalBalance(e, t, n, !1, !1, !0)).filter((e) => e.balance > 0n);
|
|
244
243
|
}
|
|
245
244
|
getSupportedPassportLinks() {
|
|
246
|
-
return
|
|
245
|
+
return h;
|
|
247
246
|
}
|
|
248
247
|
checkAccessToken(e, t) {
|
|
249
|
-
return
|
|
248
|
+
return ie(this, e, t);
|
|
250
249
|
}
|
|
251
250
|
checkExternalTokenLimitsUSD(e, t, n) {
|
|
252
|
-
return
|
|
251
|
+
return N(e, t, n);
|
|
253
252
|
}
|
|
254
253
|
async getHinkalTreeRootHash(t) {
|
|
255
254
|
if (s(t)) {
|
|
256
255
|
let { hinkalIdl: e, hinkalAddress: n, originalDeployer: r } = l[t].contractData;
|
|
257
256
|
if (!e || !n || !r) throw Error(`Missing Solana configuration for chain ${t}`);
|
|
258
|
-
let i = new $(r), a =
|
|
259
|
-
return
|
|
257
|
+
let i = new $(r), a = ne(new $(n), i);
|
|
258
|
+
return k(this.getSolanaProgram(e), a);
|
|
260
259
|
}
|
|
261
260
|
return this.getContractWithFetcherByChainId(t, e.HinkalContract).getRootHash();
|
|
262
261
|
}
|
|
@@ -264,8 +263,8 @@ var me = class {
|
|
|
264
263
|
if (s(t)) {
|
|
265
264
|
let { hinkalIdl: e, hinkalAddress: n, originalDeployer: r } = l[t].contractData;
|
|
266
265
|
if (!e || !n || !r) throw Error(`Missing Solana configuration for chain ${t}`);
|
|
267
|
-
let i = new $(r), a =
|
|
268
|
-
return
|
|
266
|
+
let i = new $(r), a = te(new $(n), i);
|
|
267
|
+
return k(this.getSolanaProgram(e), a);
|
|
269
268
|
}
|
|
270
269
|
return this.getContractWithFetcherByChainId(t, e.AccessTokenContract).getRootHash();
|
|
271
270
|
}
|
|
@@ -288,7 +287,7 @@ var me = class {
|
|
|
288
287
|
return this.getProviderAdapter(e).getAddress();
|
|
289
288
|
}
|
|
290
289
|
async getRandomRelay(e, t = !1) {
|
|
291
|
-
return (await
|
|
290
|
+
return (await m.getIdleRelay(e, t)).relay;
|
|
292
291
|
}
|
|
293
292
|
getGasPrice(e) {
|
|
294
293
|
let t = this.getProviderAdapter(e);
|
|
@@ -296,7 +295,7 @@ var me = class {
|
|
|
296
295
|
return t.getGasPrice(e);
|
|
297
296
|
}
|
|
298
297
|
getAPI() {
|
|
299
|
-
return
|
|
298
|
+
return m;
|
|
300
299
|
}
|
|
301
300
|
snapshotsClearInterval() {
|
|
302
301
|
this.getSupportedChains().forEach((e) => {
|
|
@@ -307,44 +306,44 @@ var me = class {
|
|
|
307
306
|
if (s(t)) {
|
|
308
307
|
let { hinkalIdl: e, hinkalAddress: i, originalDeployer: a } = l[t].contractData;
|
|
309
308
|
if (!e || !i || !a) throw Error("missing solana data");
|
|
310
|
-
return
|
|
309
|
+
return re(this.getSolanaProgram(e), new $(a), n, r);
|
|
311
310
|
}
|
|
312
|
-
return c(t) ?
|
|
311
|
+
return c(t) ? D(n, r, t) : E(this.getContractWithFetcher(t, e.HinkalHelperContract), n, r);
|
|
313
312
|
}
|
|
314
313
|
getRecipientInfo() {
|
|
315
|
-
return
|
|
314
|
+
return V(this);
|
|
316
315
|
}
|
|
317
316
|
async deposit(e, t, n = !0, r = !1) {
|
|
318
|
-
return
|
|
317
|
+
return A(this, e, t, n, r);
|
|
319
318
|
}
|
|
320
319
|
async depositSolana(e, t) {
|
|
321
|
-
return
|
|
320
|
+
return F(this, e, t);
|
|
322
321
|
}
|
|
323
322
|
async depositForOther(e, t, n, r = !0, i = !1) {
|
|
324
323
|
return this.enforceRateLimit(this.depositForOther.name, [
|
|
325
324
|
e,
|
|
326
325
|
t,
|
|
327
326
|
n
|
|
328
|
-
]),
|
|
327
|
+
]), j(this, e, t, n, r, i);
|
|
329
328
|
}
|
|
330
329
|
async depositSolanaForOther(e, t, n) {
|
|
331
330
|
return this.enforceRateLimit(this.depositSolanaForOther.name, [
|
|
332
331
|
e,
|
|
333
332
|
t,
|
|
334
333
|
n
|
|
335
|
-
]),
|
|
334
|
+
]), I(this, e, t, n);
|
|
336
335
|
}
|
|
337
336
|
async depositAndWithdraw(e, t, n, r, i, a, o, c, l = !0) {
|
|
338
|
-
return s(y([e])) ?
|
|
337
|
+
return s(y([e])) ? oe(this, e, t, n, r, i, a, o, c) : P(this, e, t, n, r, i, a, o, c, l);
|
|
339
338
|
}
|
|
340
339
|
async claimUtxo(e, t, n, r) {
|
|
341
|
-
return s(y([e])) ?
|
|
340
|
+
return s(y([e])) ? me(this, e, t, n, r) : fe(this, e, t, n, r);
|
|
342
341
|
}
|
|
343
342
|
async depositAndBridge(e, t, n, r, i, a, o, s = !0) {
|
|
344
|
-
return
|
|
343
|
+
return de(this, e, t, n, r, i, a, o, s);
|
|
345
344
|
}
|
|
346
345
|
async prooflessDeposit(e, t, n, r) {
|
|
347
|
-
return s(y(e)) ?
|
|
346
|
+
return s(y(e)) ? pe(this, e, t, n, r) : W(this, e, t, n, r);
|
|
348
347
|
}
|
|
349
348
|
getSolanaProgram(e) {
|
|
350
349
|
if (!this.solanaProviderAdapter) throw Error("No provider adapter initialized");
|
|
@@ -357,24 +356,24 @@ var me = class {
|
|
|
357
356
|
return this.solanaProviderAdapter.getSolanaPublicKey();
|
|
358
357
|
}
|
|
359
358
|
async transfer(e, t, n, r, i, a) {
|
|
360
|
-
return s(y(e)) ?
|
|
359
|
+
return s(y(e)) ? ce(this, e, t, n, r, i, a) : q(this, e, t, n, r, i, a);
|
|
361
360
|
}
|
|
362
361
|
async withdraw(e, t, n, r, i, a, o) {
|
|
363
|
-
return s(y(e)) ?
|
|
362
|
+
return s(y(e)) ? se(this, e, t, n, i, a, o) : R(this, e, t, n, r, i, a, o);
|
|
364
363
|
}
|
|
365
364
|
async withdrawStuckUtxos(e, t) {
|
|
366
|
-
return
|
|
365
|
+
return he(this, e, t);
|
|
367
366
|
}
|
|
368
367
|
async swap(e, t, n, r, i, a, o) {
|
|
369
|
-
return s(y(e)) ? this.swapSolana(e, t, r, i, a) :
|
|
368
|
+
return s(y(e)) ? this.swapSolana(e, t, r, i, a) : L(this, e, t, n, r, i, a, o);
|
|
370
369
|
}
|
|
371
370
|
async swapSolana(e, t, n, r, i) {
|
|
372
371
|
let a = JSON.parse(n), o = BigInt(a.swapperAccountSalt), { instructionLists: s, addressLookupTableAccount: c } = a.data;
|
|
373
|
-
return
|
|
372
|
+
return le(this, e, t, o, s, c, r, i);
|
|
374
373
|
}
|
|
375
374
|
async actionReceive(e, t, n, r, i, a) {
|
|
376
375
|
if (!i) throw Error("subAccount is required");
|
|
377
|
-
return s(y(e)) ?
|
|
376
|
+
return s(y(e)) ? Z(this, e[0], t[0], i, void 0, a) : U(this, e, t, n, r, i, a);
|
|
378
377
|
}
|
|
379
378
|
async actionPrivateWallet(e, t, n, r, i, a, o, s, c, l, u = !1, d, f, p) {
|
|
380
379
|
return this.enforceRateLimit(this.actionPrivateWallet.name, [
|
|
@@ -388,10 +387,10 @@ var me = class {
|
|
|
388
387
|
s,
|
|
389
388
|
c,
|
|
390
389
|
p
|
|
391
|
-
]),
|
|
390
|
+
]), B(this, e, t, n, r, i, a, o, s, c, l, u, d, f, p);
|
|
392
391
|
}
|
|
393
392
|
async proxySwap(e, t, n, r, i, a, o, c, l = !1, u, d) {
|
|
394
|
-
return s(y(e)) ?
|
|
393
|
+
return s(y(e)) ? ue(this, e, t, r, a, n, o, c, d) : G(this, e, t, n, r, i, a, o, c, l, u, d);
|
|
395
394
|
}
|
|
396
395
|
async proxyToPrivate(e, t, n, r, i, a, o) {
|
|
397
396
|
return s(y(e)) ? (this.enforceRateLimit(this.proxyToPrivate.name, [
|
|
@@ -399,12 +398,12 @@ var me = class {
|
|
|
399
398
|
t[0],
|
|
400
399
|
n,
|
|
401
400
|
r
|
|
402
|
-
]),
|
|
401
|
+
]), Z(this, e[0], t[0], n, r, o)) : J(this, e, t, r, i, a, n, o);
|
|
403
402
|
}
|
|
404
403
|
async proxySend(e, t, n, r, i, a, o) {
|
|
405
404
|
let c = y(e);
|
|
406
|
-
if (s(c)) return
|
|
407
|
-
let l =
|
|
405
|
+
if (s(c)) return X(this, e[0], t[0], n, r, o);
|
|
406
|
+
let l = M(this, c, e.map((e) => e.erc20TokenAddress), t, r), u = e.map((e, n) => ({
|
|
408
407
|
token: e,
|
|
409
408
|
amount: -1n * t[n]
|
|
410
409
|
}));
|
|
@@ -415,7 +414,7 @@ var me = class {
|
|
|
415
414
|
e,
|
|
416
415
|
t,
|
|
417
416
|
n
|
|
418
|
-
]),
|
|
417
|
+
]), K(this, e, t, n);
|
|
419
418
|
}
|
|
420
419
|
areMerkleTreeUpdatesDisabled() {
|
|
421
420
|
return this.disableMerkleTreeUpdates;
|
|
@@ -425,4 +424,4 @@ var me = class {
|
|
|
425
424
|
}
|
|
426
425
|
};
|
|
427
426
|
//#endregion
|
|
428
|
-
export {
|
|
427
|
+
export { ge as Hinkal };
|