@kapa123456789/sdk 0.0.51 → 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 +9 -7
- package/constants/vite.constants.cjs +1 -1
- package/constants/vite.constants.mjs +1 -3
- 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/{logError-BeqOtLse.js → logError-COJpTdjC.js} +1 -1
- package/webworker/package.json +1 -1
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.ts?worker&url.cjs +1 -1
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.ts?worker&url.mjs +1 -1
- package/webworker/snarkjsWorkerNode.cjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLauncher.ts?worker&url.cjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLauncher.ts?worker&url.mjs +1 -1
- package/webworker/utxoWorkerNode.cjs +1 -1
- package/webworker/viteWorkerURL.constant.cjs +21 -14
- package/webworker/viteWorkerURL.constant.mjs +21 -14
- package/webworker/{workerProxy-CR6nO2Zu.js → workerProxy-DPSmXOIl.js} +1 -1
- package/webworker/zkProofWorker/zkProofWorkerLauncher.ts?worker&url.cjs +1 -1
- package/webworker/zkProofWorker/zkProofWorkerLauncher.ts?worker&url.mjs +1 -1
- package/webworker/zkProofWorkerNode.cjs +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
|
|
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[];
|
|
@@ -180,9 +180,7 @@ var w = {
|
|
|
180
180
|
m.tronNile,
|
|
181
181
|
m.tronMainnet,
|
|
182
182
|
m.tronLocalnet
|
|
183
|
-
], E = [m.solanaMainnet, m.solanaLocalnet], D = (e) => [m.optimism, m.base].includes(e), O = (e) => E.includes(e), k = (e) => T.includes(e), A = p ? m.tronNile : m.tronMainnet
|
|
184
|
-
console.log("currentTronChainId", A || "undefined");
|
|
185
|
-
var j = [
|
|
183
|
+
], E = [m.solanaMainnet, m.solanaLocalnet], D = (e) => [m.optimism, m.base].includes(e), O = (e) => E.includes(e), k = (e) => T.includes(e), A = p ? m.tronNile : m.tronMainnet, j = [
|
|
186
184
|
m.ethMainnet,
|
|
187
185
|
m.optimism,
|
|
188
186
|
m.base,
|
|
@@ -191,10 +189,14 @@ var j = [
|
|
|
191
189
|
m.arcTestnet,
|
|
192
190
|
m.solanaMainnet,
|
|
193
191
|
A
|
|
194
|
-
], M =
|
|
195
|
-
|
|
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,
|
|
196
198
|
[t.Pay]: j,
|
|
197
|
-
[t.Bridge]:
|
|
199
|
+
[t.Bridge]: P
|
|
198
200
|
};
|
|
199
201
|
//#endregion
|
|
200
|
-
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
|
-
const e=require(`../functions/utils/enum.utils.cjs`);var t=function(e){return e.DEVELOPMENT=`development`,e.PLAYGROUND=`playground`,e.PRODUCTION=`production`,e.STAGING=`staging`,e}({}),n={[t.DEVELOPMENT]:[`localhost`,`192.`,`127.`],[t.PLAYGROUND]:[`playground`],[t.STAGING]:[`working`,`staging`]},r=typeof process<`u`&&process?.release?.name===`node`,i=typeof process<`u`&&process.versions!=null&&process.versions.node!=null,a=typeof __webpack_require__<`u`,o=typeof window<`u`&&window?.location?.protocol===`chrome-extension:`;function s(e,t){return t.some(t=>e.includes(t))}var c=()=>(require(`dotenv`).config({path:`DOTENV_OVERRIDE`in process.env?process.env.DOTENV_OVERRIDE:void 0}),process.env.DEPLOYMENT_MODE?.startsWith(`production`)?t.PRODUCTION:e.toEnumValue(t,process.env.DEPLOYMENT_MODE)||t.DEVELOPMENT),l=(()=>{if(!r&&typeof window>`u`)return;if(r)return c();if(window?.location?.protocol===`chrome-extension:`)return e.toEnumValue(t,WALLET_DEPLOYMENT_MODE)||t.STAGING;let i=window?.location?.host;return s(i,n[t.DEVELOPMENT])?t.DEVELOPMENT:s(i,n[t.PLAYGROUND])?t.PLAYGROUND:s(i,n[t.STAGING])?t.STAGING:t.PRODUCTION})(),u=l===t.DEVELOPMENT,d=l===t.PLAYGROUND,f=l===t.STAGING
|
|
1
|
+
const e=require(`../functions/utils/enum.utils.cjs`);var t=function(e){return e.DEVELOPMENT=`development`,e.PLAYGROUND=`playground`,e.PRODUCTION=`production`,e.STAGING=`staging`,e}({}),n={[t.DEVELOPMENT]:[`localhost`,`192.`,`127.`],[t.PLAYGROUND]:[`playground`],[t.STAGING]:[`working`,`staging`]},r=typeof process<`u`&&process?.release?.name===`node`,i=typeof process<`u`&&process.versions!=null&&process.versions.node!=null,a=typeof __webpack_require__<`u`,o=typeof window<`u`&&window?.location?.protocol===`chrome-extension:`;function s(e,t){return t.some(t=>e.includes(t))}var c=()=>(require(`dotenv`).config({path:`DOTENV_OVERRIDE`in process.env?process.env.DOTENV_OVERRIDE:void 0}),process.env.DEPLOYMENT_MODE?.startsWith(`production`)?t.PRODUCTION:e.toEnumValue(t,process.env.DEPLOYMENT_MODE)||t.DEVELOPMENT),l=(()=>{if(!r&&typeof window>`u`)return;if(r)return c();if(window?.location?.protocol===`chrome-extension:`)return e.toEnumValue(t,WALLET_DEPLOYMENT_MODE)||t.STAGING;let i=window?.location?.host;return s(i,n[t.DEVELOPMENT])?t.DEVELOPMENT:s(i,n[t.PLAYGROUND])?t.PLAYGROUND:s(i,n[t.STAGING])?t.STAGING:t.PRODUCTION})(),u=l===t.DEVELOPMENT,d=l===t.PLAYGROUND,f=l===t.STAGING,p=f||u||d,m=p||r&&l===t.PRODUCTION;exports.DEPLOYMENT_MODE=t,exports.deploymentMode=l,exports.isDevelopment=u,exports.isExtension=o,exports.isNode=i,exports.isNotClientProduction=m,exports.isNotProduction=p,exports.isPlayground=d,exports.isStaging=f,exports.isWebpack=a;
|
|
@@ -21,8 +21,6 @@ var l = () => (e("dotenv").config({ path: "DOTENV_OVERRIDE" in process.env ? pro
|
|
|
21
21
|
if (window?.location?.protocol === "chrome-extension:") return t(n, WALLET_DEPLOYMENT_MODE) || n.STAGING;
|
|
22
22
|
let e = window?.location?.host;
|
|
23
23
|
return c(e, r[n.DEVELOPMENT]) ? n.DEVELOPMENT : c(e, r[n.PLAYGROUND]) ? n.PLAYGROUND : c(e, r[n.STAGING]) ? n.STAGING : n.PRODUCTION;
|
|
24
|
-
})(), d = u === n.DEVELOPMENT, f = u === n.PLAYGROUND, p = u === n.STAGING;
|
|
25
|
-
console.log("deploymentMode", u || "undefined");
|
|
26
|
-
var m = p || d || f, h = m || i && u === n.PRODUCTION;
|
|
24
|
+
})(), d = u === n.DEVELOPMENT, f = u === n.PLAYGROUND, p = u === n.STAGING, m = p || d || f, h = m || i && u === n.PRODUCTION;
|
|
27
25
|
//#endregion
|
|
28
26
|
export { n as DEPLOYMENT_MODE, u as deploymentMode, d as isDevelopment, s as isExtension, a as isNode, h as isNotClientProduction, m as isNotProduction, f as isPlayground, p as isStaging, o as isWebpack };
|
|
@@ -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;
|