@gurge/sdk-react-native 0.3.82 → 0.3.88
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/bootstrap.cjs +1 -1
- package/bootstrap.mjs +9 -0
- package/common/src/API/getCoingeckoPrice.cjs +1 -1
- package/common/src/API/proxyAccountsCalls.cjs +1 -1
- package/common/src/crypto/EddsaRN.cjs +1 -1
- package/common/src/crypto/ecdh-sealed-keys.cjs +1 -1
- package/common/src/crypto/ecdh-sealed-keys.mjs +12 -11
- package/common/src/crypto/ecdh.cjs +1 -1
- package/common/src/crypto/ecdh.mjs +0 -1
- package/common/src/crypto/poseidon.cjs +1 -1
- package/common/src/crypto/preProcessing.cjs +1 -1
- package/common/src/crypto/preProcessing.mjs +13 -12
- package/common/src/data-structures/AccountActions/AccountActions.cjs +1 -1
- package/common/src/data-structures/Hinkal/Hinkal.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaClaimUtxo.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaDeposit.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaDepositAndWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaProxySend.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaProxyShield.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaProxySwap.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaSwap.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaTransfer.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalSolanaWithdraw.cjs +1 -1
- package/common/src/data-structures/Hinkal/hinkalWithdrawStuckUtxos.cjs +1 -1
- package/common/src/data-structures/Hinkal/prepareDepositOnChainUtxosZkProof.cjs +1 -1
- package/common/src/data-structures/Hinkal/resetMerkleTrees.cjs +1 -1
- package/common/src/data-structures/TokenDBs/AlchemyPublicTokensDB.cjs +1 -1
- package/common/src/data-structures/TokenDBs/ArcPublicTokensDB.cjs +1 -1
- package/common/src/data-structures/TokenDBs/EventsPublicTokensDB.cjs +1 -1
- package/common/src/data-structures/crypto-keys/decodeUTXO.cjs +1 -1
- package/common/src/data-structures/crypto-keys/encryptDecryptUtxo.cjs +1 -1
- package/common/src/data-structures/crypto-keys/keys.cjs +1 -1
- package/common/src/data-structures/crypto-keys/keys.mjs +70 -69
- package/common/src/data-structures/event-service/evm/AbstractNullifierSnapshotService.cjs +1 -1
- package/common/src/data-structures/event-service/evm/BlockchainEventEmitter.cjs +1 -1
- package/common/src/data-structures/event-service/solana/AbstractSolanaNullifierSnapshotService.cjs +1 -1
- package/common/src/data-structures/event-service/solana/SolanaBlockchainEventEmitter.cjs +1 -1
- package/common/src/data-structures/http/BasicHttpClient.cjs +1 -1
- package/common/src/functions/pre-transaction/convert-okx-instructions.cjs +1 -1
- package/common/src/functions/pre-transaction/ensureAmountChanges.cjs +1 -1
- package/common/src/functions/pre-transaction/getSolanaCalldataHash.cjs +1 -1
- package/common/src/functions/pre-transaction/sendV0Transaction.cjs +1 -1
- package/common/src/functions/pre-transaction/solana.cjs +1 -1
- package/common/src/functions/pre-transaction/solanaTransfer.utils.cjs +1 -1
- package/common/src/functions/private-wallet/emporium.helpers.cjs +1 -1
- package/common/src/functions/private-wallet/emporium.swap.helpers.cjs +1 -1
- package/common/src/functions/snarkjs/common.snarkjs.cjs +1 -1
- package/common/src/functions/snarkjs/constructSolanaZkProof.cjs +1 -1
- package/common/src/functions/snarkjs/fetchOnChainRootHashes.cjs +1 -1
- package/common/src/functions/snarkjs/signedMessageHash.cjs +1 -1
- package/common/src/functions/snarkjs/verifyCommitmentValidationData.cjs +1 -1
- package/common/src/functions/utils/abi.utils.cjs +1 -1
- package/common/src/functions/utils/addresses.cjs +1 -1
- package/common/src/functions/utils/convertEmporiumOpToCallInfo.cjs +1 -1
- package/common/src/functions/utils/create-provider.cjs +1 -1
- package/common/src/functions/utils/encryptInputForEnclave.cjs +1 -1
- package/common/src/functions/utils/encryptInputForEnclave.mjs +25 -24
- package/common/src/functions/utils/external-action.utils.cjs +1 -1
- package/common/src/functions/utils/getSignerFromContract.cjs +1 -1
- package/common/src/functions/utils/getUtxosFromReceiptSolana.cjs +1 -1
- package/common/src/functions/utils/mnemonics.cjs +1 -1
- package/common/src/functions/utils/publicBalance.utils.cjs +1 -1
- package/common/src/functions/utils/solana-memo.cjs +1 -1
- package/common/src/functions/utils/solanaMint.utils.cjs +1 -1
- package/common/src/functions/utils/tron.utils.cjs +1 -1
- package/common/src/functions/utils/userAgent.cjs +1 -1
- package/common/src/functions/web3/etherFunctions.cjs +1 -1
- package/common/src/functions/web3/events/getInputUtxoAndBalance.cjs +1 -1
- package/common/src/functions/web3/events/getInputUtxosEnclave.cjs +1 -1
- package/common/src/functions/web3/events/getShieldedBalance.cjs +1 -1
- package/common/src/functions/web3/functionCalls/approveToken.cjs +1 -1
- package/common/src/functions/web3/functionCalls/constructBatchCall.cjs +1 -1
- package/common/src/functions/web3/functionCalls/transactCallDirect.cjs +1 -1
- package/common/src/functions/web3/getContractMetadata.cjs +1 -1
- package/common/src/functions/web3/okxAPI.cjs +1 -1
- package/common/src/functions/web3/uniswapAPI.cjs +1 -1
- package/common/src/mutexes/chainBalanceRwLock.cjs +1 -1
- package/common/src/mutexes/mutex.cjs +1 -1
- package/common/src/providers/EthersProviderAdapter.cjs +1 -1
- package/common/src/providers/SolanaProviderAdapter.cjs +1 -1
- package/common/src/providers/WagmiProviderAdapter.cjs +1 -1
- package/common/src/types/hinkal.types.cjs +1 -1
- package/common/src/webworker/utxoWorker/utxoWorkerLauncher.ts?worker&url.cjs +1 -1
- package/common/src/webworker/utxoWorker/utxoWorkerLauncher.ts?worker&url.mjs +1 -1
- package/common/src/webworker/viteWorkerURL.constant.mjs +3 -3
- package/common/src/webworker/zkProofWorker/zkProofWorkerLauncher.ts?worker&url.cjs +1 -1
- package/common/src/webworker/zkProofWorker/zkProofWorkerLauncher.ts?worker&url.mjs +1 -1
- package/package.json +5 -1
- package/react-native/HinkalProvider.cjs +1 -1
- package/react-native/HinkalWebViewWorker.cjs +1 -1
- package/react-native/bridge/HinkalRNWorker.cjs +1 -1
- package/shims/globals.cjs +11 -0
- package/vendor/libsodium/dist/modules/libsodium.cjs +1 -0
- package/vendor/libsodium/dist/modules/libsodium.mjs +3711 -0
- package/vendor/libsodium-wrappers/dist/modules/libsodium-wrappers.cjs +1 -0
- package/vendor/libsodium-wrappers/dist/modules/libsodium-wrappers.mjs +3623 -0
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import r from "
|
|
5
|
-
import
|
|
1
|
+
import { __toESM as e } from "../../../../_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import { safeJsonStringify as t } from "./serialize.utils.mjs";
|
|
3
|
+
import { require_libsodium_wrappers as n } from "../../../../vendor/libsodium-wrappers/dist/modules/libsodium-wrappers.mjs";
|
|
4
|
+
import { enclaveHandshakeService as r } from "./enclaveHandshakeService.mjs";
|
|
5
|
+
import { ethers as i } from "ethers";
|
|
6
|
+
import * as a from "node-forge";
|
|
6
7
|
//#region common/src/functions/utils/encryptInputForEnclave.ts
|
|
7
|
-
var
|
|
8
|
+
var o = /* @__PURE__ */ e(n()), s = (e) => typeof e == "bigint" || typeof e == "number" ? e.toString() : e, c = (e) => a.util.hexToBytes(e.replace("0x", "")), l = (e) => {
|
|
8
9
|
let t = structuredClone(e);
|
|
9
10
|
return Object.entries(t).forEach(([e, n]) => {
|
|
10
|
-
t[e] =
|
|
11
|
+
t[e] = s(n), Array.isArray(n) && (Array.isArray(n[0]) ? t[e] = n.map((e) => e.map(s)) : t[e] = n.map(s));
|
|
11
12
|
}), t;
|
|
12
|
-
}, c = (e, t) => {
|
|
13
|
-
let n = i.util.decode64(e), r = i.asn1.fromDer(i.util.createBuffer(n)), a = i.pki.publicKeyFromAsn1(r), o = i.util.binary.raw.encode(t), s = a.encrypt(o, "RSA-OAEP", {
|
|
14
|
-
md: i.md.sha1.create(),
|
|
15
|
-
mgf1: { md: i.md.sha1.create() }
|
|
16
|
-
});
|
|
17
|
-
return i.util.encode64(s);
|
|
18
|
-
}, l = (e, t) => {
|
|
19
|
-
let a = r.randombytes_buf(r.crypto_secretbox_NONCEBYTES), s = r.crypto_secretbox_easy(t, a, e), c = o(n.hexlify(a) + n.hexlify(s).slice(2));
|
|
20
|
-
return i.util.encode64(c);
|
|
21
13
|
}, u = (e, t) => {
|
|
22
|
-
let n = r.
|
|
14
|
+
let n = a.util.decode64(e), r = a.asn1.fromDer(a.util.createBuffer(n)), i = a.pki.publicKeyFromAsn1(r), o = a.util.binary.raw.encode(t), s = i.encrypt(o, "RSA-OAEP", {
|
|
15
|
+
md: a.md.sha1.create(),
|
|
16
|
+
mgf1: { md: a.md.sha1.create() }
|
|
17
|
+
});
|
|
18
|
+
return a.util.encode64(s);
|
|
19
|
+
}, d = (e, t) => {
|
|
20
|
+
let n = o.default.randombytes_buf(o.default.crypto_secretbox_NONCEBYTES), r = o.default.crypto_secretbox_easy(t, n, e), s = c(i.hexlify(n) + i.hexlify(r).slice(2));
|
|
21
|
+
return a.util.encode64(s);
|
|
22
|
+
}, f = (e, t) => {
|
|
23
|
+
let n = o.default.randombytes_buf(o.default.crypto_secretbox_KEYBYTES);
|
|
23
24
|
return {
|
|
24
|
-
keyCiphertext:
|
|
25
|
-
inputCiphertext:
|
|
25
|
+
keyCiphertext: u(t, n),
|
|
26
|
+
inputCiphertext: d(n, e)
|
|
26
27
|
};
|
|
27
|
-
},
|
|
28
|
-
let r = typeof
|
|
29
|
-
return
|
|
30
|
-
},
|
|
28
|
+
}, p = (e, n) => {
|
|
29
|
+
let r = typeof e == "string" ? e : t(l(e));
|
|
30
|
+
return f(new TextEncoder().encode(r), n);
|
|
31
|
+
}, m = async (e) => p(e, await r.getPublicKey()), h = async (e) => f(e, await r.getPublicKey());
|
|
31
32
|
//#endregion
|
|
32
|
-
export {
|
|
33
|
+
export { m as makeEnclaveHandshakeAndEncryptInput, h as makeEnclaveHandshakeAndEncryptUint8Array };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(
|
|
1
|
+
require("../../../../_virtual/_rolldown/runtime.cjs");const e=require(`../../constants/protocol.constants.cjs`);let t=require(`ethers`);var n=n=>n===0n?0n:BigInt(t.ethers.id(n))%e.CIRCOM_P;exports.getExternalActionIdHash=n;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(
|
|
1
|
+
require("../../../../_virtual/_rolldown/runtime.cjs");let e=require(`ethers`);var t=t=>{let{runner:n}=t;if(!(n instanceof e.ethers.AbstractSigner))throw Error(`expected signer`);return n},n=e=>{let{runner:t}=e;if(!t)throw Error(`expected provider`);return t.provider??t};exports.getProviderFromContract=n,exports.getSignerFromContract=t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(
|
|
1
|
+
require("../../../../_virtual/_rolldown/runtime.cjs"),require(`../../constants/chains.constants.cjs`);const e=require(`./caseInsensitive.utils.cjs`),t=require(`../../crypto/poseidon.cjs`),n=require(`../../data-structures/utxo/Utxo.cjs`);require(`../../data-structures/crypto-keys/encryptDecryptUtxo.cjs`);const r=require(`./bit.operations.cjs`),i=require(`./bytes32.utils.cjs`);let a=require(`ethers`),o=require(`@solana/web3.js`),s=require(`@coral-xyz/anchor`);var c=(c,l,u,d)=>[...new s.EventParser(l.programId,new s.BorshCoder(l.idl)).parseLogs(c.meta?.logMessages??[])].filter(({name:t})=>e.caseInsensitiveEqual(t,`newCommitment`)).filter(({data:e})=>e.encryptedOutput.length===0).map(e=>{let{onChainData:s}=e.data,[c,l,d,f,p,m,,h]=s.map(i.convertBytes32ToBigInt),[,g,_]=s,v=new o.PublicKey([...g.slice(16),..._.slice(16)]),y=t.poseidonHash(l,d),b=r.extractHighestBit(f)===1n,x=new n.Utxo({amount:c,timeStamp:h.toString(),nullifyingKey:u.getShieldedPrivateKey(),mintAddress:v.toBase58(),erc20TokenAddress:y,stealthAddress:a.ethers.toBeHex(p),isNewStyle:b,...b?{H0:[r.takeOffHighestBit(f),m]}:{randomization:f}});return x.getStealthAddress(),x}).filter(t=>e.caseInsensitiveEqual(t.erc20TokenAddress,d));exports.getOnChainUtxosFromReceiptSolana=c;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(
|
|
1
|
+
require("../../../../_virtual/_rolldown/runtime.cjs");let e=require(`ethers`);var t=t=>{let n=t.join(` `),r=e.ethers.toUtf8Bytes(n);return e.ethers.keccak256(r)};exports.generateHashFromSeedPhrases=t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(
|
|
1
|
+
require("../../../../_virtual/_rolldown/runtime.cjs"),require(`../../constants/chains.constants.cjs`);const e=require(`../../constants/protocol.constants.cjs`);require(`../../data-structures/http/index.cjs`),require(`./addresses.cjs`),require(`../../externalABIs/index.cjs`);const t=require(`../../error-handling/logger.cjs`);require(`./erc20tokenFunctions.cjs`);const n=require(`./create-provider.cjs`),r=require(`../../externalABIs/swapAbi.cjs`);require(`./ipfs.cjs`);let i=require(`ethers`);require(`@solana/web3.js`),require(`@solana/spl-token`);var a=async(t,n,a)=>{try{let o=a.erc20TokenAddress,s,c=new i.ethers.Contract(a.erc20TokenAddress,r.ERC20ABI,t);s=o===e.zeroAddress?await t.getBalance(n):await c?.balanceOf(n);let l=s;return l<=0n?null:{token:a,balance:l}}catch{return null}},o=async(a,o,s)=>{try{let t=n.createJsonRpcProvider(a),c=new i.ethers.Contract(s,r.ERC20ABI,t),l;return l=s===e.zeroAddress?await t.getBalance(o):await c?.balanceOf(o),l}catch{return t.Logger.error(`Failed to fetch public balance for address ${o}`),null}};exports.getPublicBalance=a,exports.getPublicBalanceByTokenAddress=o;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(
|
|
1
|
+
require("../../../../_virtual/_rolldown/runtime.cjs"),new(require(`@solana/web3.js`)).PublicKey(`MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(
|
|
1
|
+
require("../../../../_virtual/_rolldown/runtime.cjs");const e=require(`../../crypto/poseidon.cjs`);let t=require(`ethers`),n=require(`@solana/web3.js`);var r=e=>{let n=e.toBytes();return BigInt(t.ethers.hexlify(n))},i=t=>{let i=typeof t==`string`?new n.PublicKey(t):t,a=r(i),o=a/2n**128n,s=a%2n**128n;return{mintAccountPart1:o,mintAccountPart2:s,compressedAddress:e.poseidonHash(o,s),mintPublicKey:i}};exports.convertPublicKeyToBigint=r,exports.formatMintAddress=i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(
|
|
1
|
+
require("../../../../_virtual/_rolldown/runtime.cjs");const e=require(`../../constants/chains.constants.cjs`),t=require(`../../constants/protocol.constants.cjs`),n=require(`./caseInsensitive.utils.cjs`),r=require(`../../error-handling/error-codes.constants.cjs`),i=require(`../snarkjs/constant.cjs`),a=require(`../../data-structures/http/HttpClient.cjs`),o=require(`../../externalABIs/index.cjs`),s=require(`../../error-handling/logger.cjs`);let c=require(`ethers`),l=require(`tronweb`);var u=2000n,d=e=>{let t=e.trim(),n=t.startsWith(`0x`)?t.slice(2):t;if(!/^[0-9a-fA-F]{64}$/.test(n))throw Error(`Tron private key must be 32 bytes (64 hex characters), with or without 0x prefix`);return n},f=(t,n)=>{let r=e.networkRegistry[t].fetchRpcUrl,i=n?d(n):void 0,a=i?new l.TronWeb({fullHost:r,privateKey:i}):new l.TronWeb({fullHost:r});return n||a.setAddress(`T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb`),a},p=e=>e?.startsWith(`T`)?e:l.TronWeb.address.fromHex(e),m=e=>e.startsWith(`0x`)?p(e):e,h=e=>{if(e.startsWith(`0x`))return e;if(e.startsWith(`41`))return e.replace(`41`,`0x`);if(e.startsWith(`T`))return h(l.TronWeb.address.toHex(e));throw Error(`Failed to convert address to hex format`)},g=t=>{if(t===e.chainIds.tronNile)return`https://nile.trongrid.io`;if(t===e.chainIds.tronMainnet)return`https://api.trongrid.io`;throw Error(`Unsupported Tron chain for wallet RPC: ${t}`)},_=(e,t)=>e.map(e=>Array.isArray(e)?_(e,t):t(e)),v=(e,t,n)=>{let r=new c.ethers.Interface(e);if(!r.getFunction(t))throw Error(`${t} ABI is missing for Tron call data creation`);let i=_(n,e=>typeof e==`string`&&e.startsWith(`T`)?h(e):e);return r.encodeFunctionData(t,i)},y=(e,t,n)=>e?BigInt(Math.max((e[t]??0)-(e[n]??0),0)):0n,b=(e,t)=>{let n=e.find(e=>e.key===t);if(!n||typeof n.value!=`number`)throw Error(`Missing Tron chain parameter: ${t}`);return BigInt(n.value)},x=async e=>{let t=`${g(e)}/wallet/getchainparameters`,n=await a.httpClient.post(t,{});if(!n?.chainParameter?.length)throw Error(`Failed to fetch Tron chain parameters from wallet RPC`);return n.chainParameter},S=async(e,t)=>{let n=`${g(e)}/wallet/getaccountresource`,r=h(t),i=r.startsWith(`0x`)?`41${r.slice(2)}`:r;return await a.httpClient.post(n,{address:i,visible:!1})},C=async(e,n,r,i,a,o)=>{let s={input:a,callValue:Number(o),feeLimit:t.TRON_DEFAULT_FEE_LIMIT_SUN},[c,l]=await Promise.all([e.transactionBuilder.estimateEnergy(r,``,s,[],i),e.transactionBuilder.triggerConstantContract(r,``,s,[],i)]),d=await x(n),f=b(d,`getEnergyFee`),p=b(d,`getTransactionFee`),m=await S(n,i),h=BigInt(c?.energy_required??l?.energy_used??0),g=y(m,`EnergyLimit`,`EnergyUsed`),_=(h>g?h-g:0n)*f,v=BigInt(Math.ceil((l?.transaction?.raw_data_hex?.length??0)/2)),C=y(m,`freeNetLimit`,`freeNetUsed`)+y(m,`NetLimit`,`NetUsed`),w=_+(v>C?v-C:0n)*p,T=w+w*u/10000n;return T>BigInt(1e9)?BigInt(t.TRON_DEFAULT_FEE_LIMIT_SUN):T},w=e=>{let t=e[0].map(BigInt),n=e[1][0].map(BigInt),r=e[1][1].map(BigInt),i=e[2].map(BigInt),a=e[3].map(BigInt);return{a:t,b:[[n[1],n[0]],[r[1],r[0]]],c:i,publicSignals:a}},T=(e,t)=>{let n=c.ethers.AbiCoder.defaultAbiCoder().encode([`uint16`,`uint16`,`uint16`,`uint256`],[e.tokenNumber,e.nullifierAmount,e.outputAmount,t]);return BigInt(c.ethers.keccak256(n))},E=async(e,t,n,r,o,s)=>{let l=T(o,s),u=e.map(String),d=n.map(String),f=r.map(String),p={a:u,b:[t[0].map(String),t[1].map(String)],c:d,inputs:f,verifier_id:String(l)},m=await a.httpClient.post(`${i.ENCLAVE_URL}/sign-proof`,p),{v:h,r:g,s:_}=c.ethers.Signature.from(m.signature.trim());return{v:h,r:g,s:_}},D=e=>[e.rootHashHinkal,e.erc20TokenAddresses,e.tokenIds,e.amountChanges,e.onChainCreation,e.slippageValues,e.inputNullifiers,e.outCommitments,e.encryptedOutputs,[e.feeStructure.feeToken,e.feeStructure.flatFee,e.feeStructure.variableRate],e.timeStamp,[e.stealthAddressStructure.extraRandomization,e.stealthAddressStructure.stealthAddress,e.stealthAddressStructure.H0,e.stealthAddressStructure.H1],e.rootHashAccessToken,e.calldataHash,e.publicSignalCount,e.relay,e.externalAddress,e.externalActionId,e.externalActionMetadata,[e.hinkalLogicArgs.hinkalLogicAction,e.hinkalLogicArgs.inHinkalAddress,e.hinkalLogicArgs.executeApprovalChanges,e.hinkalLogicArgs.doPreTxApproval,e.hinkalLogicArgs.useApprovalUtxoData.map(e=>[e.approvalChanges,e.externalApprovalAddresses,e.conversionInHinkalAddress])],[e.hookData.preHookContract,e.hookData.hookContract,e.hookData.preHookMetadata,e.hookData.postHookMetadata],[e.signatureData.v,e.signatureData.r,e.signatureData.s,e.signatureData.accessKey,e.signatureData.nonce,e.signatureData.ethereumAddress],e.originalSender],O=async(e,t,n,r,i=!0)=>{if(e){let{a:e,b:a,c:o,publicSignals:s}=w(t),c=await E(e,a,o,s,n,BigInt(r.externalActionId)),l={v:c.v,r:c.r,s:c.s};return i&&(t[1]=[[t[1][0][1],t[1][0][0]],[t[1][1][1],t[1][1][0]]]),l}},k=(e,r)=>{let i=0n,a=new Map;for(let o=0;o<e.length;o+=1)if(n.caseInsensitiveEqual(e[o].erc20TokenAddress,t.zeroAddress))i+=r[o];else{let t=p(e[o].erc20TokenAddress);a.set(t,(a.get(t)??0n)+r[o])}return{totalTrxValue:i,tokensNeedingApproval:a}},A=async(e,n,i,a,o,c)=>{let l=BigInt(await e.trx.getBalance(a)),u=BigInt(t.TRON_DEFAULT_FEE_LIMIT_SUN);try{u=await C(e,n,i,a,o,c)}catch(e){s.Logger.error(`Error estimating Tron deposit fee`,e)}if(l<c+u)throw Error(r.insufficientResourcesErrorCodes.INSUFFICIENT_TRON_BALANCE_FOR_FEE)},j=async(e,n,r,i)=>{let a=Array.from(i.entries());for(let i=0;i<a.length;i+=1){let[s,c]=a[i],l=await e.contract(o.ERC20ABI,s).allowance(n,r).call({from:n});if(BigInt(String(l))<c){let{transaction:i}=await e.transactionBuilder.triggerSmartContract(s,`approve(address,uint256)`,{feeLimit:t.TRON_DEFAULT_FEE_LIMIT_SUN},[{type:`address`,value:r},{type:`uint256`,value:c.toString()}],n),a=await e.trx.sign(i),o=await e.trx.sendRawTransaction(a);if(!o.result){let e=o.code??`UNKNOWN`,t=o.message?Buffer.from(o.message,`hex`).toString():`no message`;throw Error(`Tron token approval failed: ${e} - ${t}`)}}}};exports.addressToHexFormat=h,exports.approveTronTokens=j,exports.assertTronSufficientBalance=A,exports.circomDataToArray=D,exports.createTronCallData=v,exports.createTronWeb=f,exports.estimateTronFeeSunWithPadding=C,exports.evmHexToTronBase58Address=p,exports.fetchTronAccountResources=S,exports.fetchTronChainParameters=x,exports.generateProofSignatureRemotely=E,exports.getAvailableResource=y,exports.getChainParameterValue=b,exports.getTronWalletRpcUrl=g,exports.getVerifierId=T,exports.normalizeTronPrivateKey=d,exports.parseZkCalldata=w,exports.reorderZkCallData=O,exports.splitTronTokensByNative=k,exports.toTronBase58IfHex=m;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(
|
|
1
|
+
require("../../../../_virtual/_rolldown/runtime.cjs"),new(require(`ua-parser-js`)).UAParser;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(
|
|
1
|
+
require("../../../../_virtual/_rolldown/runtime.cjs");const e=require(`../../error-handling/error-codes.constants.cjs`);let t=require(`ethers`);var n=e=>BigInt(t.ethers.hexlify(t.ethers.randomBytes(e))),r=(e,n)=>t.ethers.formatUnits(n,e.decimals),i=(n,r)=>{let i=10**(18-n.decimals);try{return t.ethers.parseUnits(r)/BigInt(i)}catch{throw Error(e.transactionErrorCodes.DECIMALS_LIMIT)}},a=(n,r,i)=>{let a=t.ethers.formatUnits(n,r.decimals),o=BigInt(10**(18-i));try{let e=t.ethers.parseUnits(a)/o;return t.ethers.formatUnits(e,i)}catch{throw Error(e.transactionErrorCodes.DECIMALS_LIMIT)}};exports.getAmountInToken=r,exports.getAmountInWei=i,exports.getAmountWithPrecision=a,exports.randomBigInt=n;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(
|
|
1
|
+
require("../../../../../_virtual/_rolldown/runtime.cjs");const e=require(`../../../constants/chains.constants.cjs`),t=require(`../../utils/caseInsensitive.utils.cjs`),n=require(`../../../data-structures/utxo/Utxo.cjs`),r=require(`../../utils/upToDateState.cjs`),i=require(`../../utils/cacheFunctions.cjs`),a=require(`../../utils/encodeTokenWithId.cjs`),o=require(`../../utils/solanaMint.utils.cjs`),s=require(`./getInputUtxosEnclave.cjs`),c=require(`../../utils/addresses.cjs`),l=require(`../../../API/scheduled-transactions-calls.cjs`),u=require(`../../utils/tron.utils.cjs`);var d=new(require(`async-mutex`)).Mutex,f=async(e,t)=>e.allowParallelBalanceLocalDecryption?t():d.runExclusive(t),p=e=>e?.[0]===0n&&e?.[1]===1n,m=async(e,t,n,a,o,s,c,l,u)=>f(e,async()=>{u+=1;let d=s.slice(u),{lastOutput:f,additionalEncryptedOutputs:p}=await e.utxoUtils.batchProcess(d,l,t,n),m=[...c,...p];return await r.checkAddressNotUpdated(e,a),i.setHinkalCache({lastOutput:f,encryptedOutputs:m},e,n,o),await e.utxoUtils.buildBatchProcess(m,t,n)}),h=async(e,t,n,r)=>{let{utxos:a,encryptedOutputs:o,lastOutput:c}=await s.getInputUtxosEnclave(e,n,t);return i.setHinkalCache({encryptedOutputs:o,lastOutput:c},e,n,r),a},g=async(e,t,n,r,i,a,o,s,c)=>{try{return await h(e,t,n,i)}catch{return m(e,t,n,r,i,a,o,s,c)}},_=e=>{if(Array.isArray(e))return e;if(e!==void 0)return[e]},v=async(e,t,n)=>await e.utxoUtils.batchFilterUtxosWithNullifier(t,n),y=(e,t,r,i,a,o,s,c)=>{for(e.sort((e,t)=>e.amount<=t.amount?1:-1);e.length<t||e.length>t&&e.length<6;)if(e.push(new n.Utxo({amount:0n,erc20TokenAddress:o,mintAddress:c,nullifyingKey:i,spendingPublicKey:a,isNewStyle:!0})),r)for(;e.length>6;)e.splice(e.length-1)},b=async({hinkal:e,chainId:t,passedShieldedPublicKey:n=void 0,ethAddress:a=void 0,resetCacheBefore:o=!1,allowRemoteDecryption:s=!1,useBlockedUtxos:c=!1})=>{let l=a??await e.getEthereumAddress(),u=n??e.userKeys.getShieldedPublicKey(),{userKeys:d}=e,f=e.encryptedOutputsByChain[t],h=e.nullifiersByChain[t],_=Array.from(f);o&&i.resetCache(e,t,u);let{encryptedOutputs:y,lastOutput:b}=i.getHinkalCache(e,t,u);await r.checkAddressNotUpdated(e,l);let x=b!==``,S=_.findIndex(e=>e.value===b),C=S>-1,w=!x&&S===-1,T=e.areMerkleTreeUpdatesDisabled(),E=!T&&(C||!s&&w),D=!T&&s&&w,O=!E&&!D,k=[];E?k=await m(e,d,t,l,u,_,y,b,S):D?k=await g(e,d,t,l,u,_,y,b,S):O&&(k=await e.utxoUtils.buildBatchProcess(y,d,t)),await r.checkAddressNotUpdated(e,l);let A=await v(e,k,h);return{inputUtxos:(c?A.filter(e=>e.isBlocked):A.filter(e=>!e.isBlocked)).filter(e=>!p(e.H0))}},x=async({hinkal:t,chainId:n,passedShieldedPublicKey:r=void 0,ethAddress:i=void 0,resetCacheBefore:a=!1,allowRemoteDecryption:o=!1})=>{let s=i??await t.getEthereumAddressByChain(n),d=c.hashEthereumAddress(e.isTronLike(n)?u.addressToHexFormat(s):s),{inputUtxos:f}=await b({hinkal:t,chainId:n,passedShieldedPublicKey:r,ethAddress:s,resetCacheBefore:a,allowRemoteDecryption:o,useBlockedUtxos:!0});if(!f.length)return{inputUtxos:[]};let{indexes:p}=await l.getScheduledTransactionsNullifierIndexes({hashedEthereumAddress:d,nullifiers:f.map(e=>e.getNullifier())});return{inputUtxos:p.map(e=>f[e]).filter(e=>!!e)}},S=async({hinkal:n,tokenWithId:r,minInput:i=2,sliceIfMore6:s=!0,chainId:c,passedShieldedPrivateKey:l=void 0,passedShieldedPublicKey:u=void 0,ethAddress:d=void 0,resetCacheBefore:f=!1,ensuredTokensWithId:p,allowRemoteDecryption:m=!1,useBlockedUtxos:h=!1})=>{let g=l??n.userKeys.getShieldedPrivateKey(),v=n.userKeys.getSpendingKeyPair().pubSpendingBJJPoint,{inputUtxos:S}=h?await x({hinkal:n,chainId:c,ethAddress:d,passedShieldedPrivateKey:l,resetCacheBefore:f,allowRemoteDecryption:m}):await b({hinkal:n,tokenWithId:r,minInput:i,sliceIfMore6:s,chainId:c,passedShieldedPrivateKey:l,passedShieldedPublicKey:u,ethAddress:d,resetCacheBefore:f,allowRemoteDecryption:m}),C=_(r),w=new Map;S.forEach(e=>{let n=e.getTokenAddress(c);if(C&&!C.some(e=>t.caseInsensitiveEqual(e.erc20TokenAddress,n)))return;let r=a.encodeTokenWithId(c,{erc20TokenAddress:n,tokenId:0}),i=w.get(r)??[];w.set(r,[...i,e])}),p?.forEach(e=>{let t=a.encodeTokenWithId(c,{erc20TokenAddress:e.erc20TokenAddress,tokenId:0});w.set(t,w.get(t)??[])});for(let[t,n]of w){let r=t.split(`-`)[0],a=Number(t.split(`-`)[1]),l=e.isSolanaLike(c),u=l?r:void 0;y(n,i,s,g,v,l?o.formatMintAddress(r).compressedAddress.toLowerCase():r.toLowerCase(),a,u)}return w};exports.attemptGetInputUtxosRemotely=g,exports.getInputUtxoAndBalance=b,exports.getInputUtxoAndBalanceOfStuckUtxos=x,exports.getInputUtxoAndBalancePerToken=S,exports.getInputUtxosRemotely=h;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(
|
|
1
|
+
require("../../../../../_virtual/_rolldown/runtime.cjs");const e=require(`../../../constants/chains.constants.cjs`),t=require(`../../../data-structures/crypto-keys/keys.cjs`),n=require(`../../../data-structures/utxo/Utxo.cjs`),r=require(`../../utils/encryptInputForEnclave.cjs`),i=require(`../../utils/solanaMint.utils.cjs`),a=require(`../../utils/customEnclaveFunctionsRegister.cjs`),o=require(`../../utils/serialize-utxos.utils.cjs`);let s=require(`ethers`),c=require(`@solana/web3.js`);var l=e=>{if(!e)return;let t=s.ethers.getBytes(e);if(t.length!==32)return;let n=new c.PublicKey(t),r=n.toBase58(),{compressedAddress:a}=i.formatMintAddress(n);return{mintBase58:r,compressedAddress:a}},u=async(e,t,n)=>{let{keyCiphertext:i,inputCiphertext:a}=await r.makeEnclaveHandshakeAndEncryptUint8Array(n);return e.getAPI().decryptUtxoEnclaveCall(t,i,a)},d=async(r,i,c)=>{let d=c.getShieldedPrivateKey(),{privateKey:f,publicKey:p}=t.UserKeys.getEncryptionKeyPair(d),m=c.getSpendingKeyPair().pubSpendingBJJPoint,h=s.ethers.solidityPacked([`uint256`,`uint256`,`uint256`],[p,f,d]),g=s.ethers.getBytes(h),_=a.getCustomUtxoDecryptor(),{utxos:v,lastOutput:y,encryptedOutputs:b}=await(_?_(i,g):u(r,i,g));return{utxos:v.map(t=>{let r=t;if(e.isSolanaLike(i)){let e=l(t.mintAddress);if(!e)throw Error(`Invalid mint address`);r={...r,erc20TokenAddress:e.compressedAddress,mintAddress:e.mintBase58}}return new n.Utxo({...o.deserializeUtxoConstructorParams(r),nullifyingKey:d,spendingPublicKey:m})}),encryptedOutputs:b,lastOutput:y}};exports.getInputUtxosEnclave=d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(
|
|
1
|
+
require("../../../../../_virtual/_rolldown/runtime.cjs");const e=require(`../../../constants/vite.constants.cjs`),t=require(`../../../constants/chains.constants.cjs`),n=require(`../../utils/caseInsensitive.utils.cjs`),r=require(`../../../error-handling/error-codes.constants.cjs`),i=require(`../etherFunctions.cjs`),a=require(`../../../data-structures/utxo/Utxo.cjs`),o=require(`../../../error-handling/customErrors/ErrorWithAmount.cjs`);require(`../../../error-handling/customErrors/index.cjs`);const s=require(`../../utils/encodeTokenWithId.cjs`),c=require(`../../utils/solanaMint.utils.cjs`),l=require(`./getInputUtxoAndBalance.cjs`),u=require(`../../../data-structures/TokenDBs/PrivateTokensDB.cjs`),d=require(`../../utils/map.utils.cjs`),f=require(`../../utils/mutexes.utils.cjs`),p=require(`../../utils/erc20tokenFunctions.cjs`);let m=require(`async-mutex`);var h=async(t,r,i,a,o,s=!1,c,h=!1,g=!1)=>d.getOrCreateMapValue(t.balanceFetchingMutexByChain,r,()=>new m.Mutex).runExclusive(async()=>f.getChainBalanceFetchingMutex(r).runShared(async()=>{let{inputUtxos:d}=g?await l.getInputUtxoAndBalanceOfStuckUtxos({hinkal:t,chainId:r,ethAddress:o,passedShieldedPrivateKey:i,resetCacheBefore:s,allowRemoteDecryption:c}):await l.getInputUtxoAndBalance({hinkal:t,sliceIfMore6:!1,chainId:r,passedShieldedPrivateKey:i,passedShieldedPublicKey:a,ethAddress:o,resetCacheBefore:s,allowRemoteDecryption:c});h&&e.isExtension&&await u.privateTokensDB.fetchAndUpdatePrivateTokens(d.map(e=>e.getTokenAddress(r)).filter(e=>e!==void 0),r,o);let f=(e.isExtension?await u.privateTokensDB.getPrivateTokens(r,o):await p.getErc20TokensForChainAPI(r)).map(e=>({token:e,balance:d.reduce((t,i)=>{let a=e.erc20TokenAddress;return n.caseInsensitiveEqual(a,i.getTokenAddress(r))?t+i.amount:t},0n),timestamp:d.filter(t=>n.caseInsensitiveEqual(t.getTokenAddress(r),e.erc20TokenAddress))[0]?.timeStamp,nfts:[]})),m=new Map;return f.forEach(e=>{m.set(e.token.erc20TokenAddress.toLowerCase(),e)}),m})),g=async(e,n,u,d,f=6,m=u.map(()=>0),h=!1,g=!1)=>{let{userKeys:_}=e,v=_.getSpendingKeyPair().pubSpendingBJJPoint,y=[],b=[];if(u.length===0)return[];if(h){for(let e=0;e<u.length;e+=1){let r=t.isSolanaLike(n),i=r?u[e]:void 0,o=r?c.formatMintAddress(u[e]).compressedAddress:u[e];y.push(Array.from({length:f},()=>new a.Utxo({amount:0n,erc20TokenAddress:o,mintAddress:i,nullifyingKey:_.getShieldedPrivateKey(),spendingPublicKey:v,isNewStyle:!0})))}return y}let x=await l.getInputUtxoAndBalancePerToken({hinkal:e,sliceIfMore6:!1,ensuredTokensWithId:u.map((e,t)=>({erc20TokenAddress:u[t],tokenId:m[t]})),allowRemoteDecryption:e.generateProofRemotely,useBlockedUtxos:g,chainId:n}),S=0;for(let e=0;e<u.length;e+=1){let t=x.get(s.encodeTokenWithId(n,{erc20TokenAddress:u[e],tokenId:m[e]}))??[];if(!t)throw Error(`Missing utxos for token`);S=Math.max(t.length,S),b.push(t)}if(S===2)return b;for(let[e,s]of b.entries())if(s.length>f){let t=s.slice(0,f),a=t.reduce((e,t)=>e+t.amount,0n);if(d[e]<0n&&a<-d[e]){let t=await p.getErc20TokenFromAPI(n,u[e]);if(!t)throw Error(`Token not found`);let s=t.decimals===18?6:2,c=Number(i.getAmountWithPrecision(a,t,s));throw new o.ErrorWithAmount(c,`${r.DIRECTLY_SHOW_MESSAGE_ERROR_CODES.UTXO_LIMITATIONS}. Please try again with ${c} ${t.symbol}, including gas fees.`)}y.push(t)}else if(s.length<=f){let r=[...s],i=f-s.length;for(;i>0;){--i;let o=t.isSolanaLike(n),s=o?u[e]:void 0,l=o?c.formatMintAddress(u[e]).compressedAddress:u[e];r.push(new a.Utxo({amount:0n,erc20TokenAddress:l,mintAddress:s,nullifyingKey:_.getShieldedPrivateKey(),spendingPublicKey:v,isNewStyle:!0}))}y.push(r)}return y};exports.addPaddingToUtxos=g,exports.getShieldedBalance=h;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(
|
|
1
|
+
require("../../../../../_virtual/_rolldown/runtime.cjs");const e=require(`../../../constants/chains.constants.cjs`),t=require(`../../../constants/protocol.constants.cjs`),n=require(`../../../types/ethereum-network.types.cjs`),r=require(`../../../types/token.types.cjs`),i=require(`../../utils/getContractAddress.cjs`),a=require(`../../utils/getSignerFromContract.cjs`),o=require(`./recoverTransactionFromError.cjs`);let s=require(`ethers`);var c=async(e,t,n)=>{let r=a.getSignerFromContract(n);return await n.allowance(await r.getAddress(),t.target)>=e},l=async(t,n,r,o,s)=>{if(e.getNonLocalhostChainId(n)!==e.chainIds.ethMainnet||o.symbol.toLowerCase()!==`usdt`||BigInt(await s.allowance(await a.getSignerFromContract(s).getAddress(),r.target))===0n)return;let c=await s.approve(i.getContractAddress(r),0n);c&&`hash`in c&&await t.waitForTransaction(n,c.hash)},u=async(u,d,f,p,m)=>{let h=u.getContractWithSigner(d,n.ContractType.ERC20Contract,m.erc20TokenAddress),g=m.approvalType??r.ApprovalType.Classic;if(g===r.ApprovalType.Classic||!u.isPermitterAvailable(d)){if(await c(p,f,h))return;await l(u,d,f,m,h);let t=d===e.chainIds.base?2:1;try{let e=await h.approve(i.getContractAddress(f),p);e&&`hash`in e&&await u.waitForTransaction(d,e.hash,t)}catch(e){if(!e?.transactionHash||!await o.recoverTransactionFromError(a.getProviderFromContract(h),e.transactionHash,t))throw e}return}let _=await u.getEthereumAddressByChain(d),v=u.getContract(d,n.ContractType.PermitterContract),y=await u.getContractWithFetcher(d,n.ContractType.ContractWithNonces,m.erc20TokenAddress).nonces(_),b=BigInt(Date.now()+t.permitSignatureValidFor)/1000n,x={owner:_,holder:_,spender:i.getContractAddress(v),value:p,nonce:y,deadline:b,expiry:b,allowed:!0},{v:S,r:C,s:w}=s.ethers.Signature.from(await u.signTypedData({name:await h.name(),chainId:d,version:`1`,verifyingContract:m.erc20TokenAddress},{Permit:g===r.ApprovalType.ERC20Permit?[{name:`owner`,type:`address`},{name:`spender`,type:`address`},{name:`value`,type:`uint256`},{name:`nonce`,type:`uint256`},{name:`deadline`,type:`uint256`}]:[{name:`holder`,type:`address`},{name:`spender`,type:`address`},{name:`nonce`,type:`uint256`},{name:`expiry`,type:`uint256`},{name:`allowed`,type:`bool`}]},x));if(g===r.ApprovalType.ERC20Permit){let e=new s.ethers.Interface([`function permit(address owner,address spender,uint256 value,uint256 deadline,uint8 v,bytes32 r,bytes32 s) external`]);return s.ethers.getBytesCopy(e.encodeFunctionData(`permit`,[x.owner,x.spender,x.value,x.deadline,S,s.ethers.getBytesCopy(C),s.ethers.getBytesCopy(w)])).slice(4)}let T=new s.ethers.Interface([`function permit(address holder,address spender,uint256 nonce,uint256 expiry,bool allowed,uint8 v,bytes32 r,bytes32 s) external`]);return s.ethers.getBytesCopy(T.encodeFunctionData(`permit`,[x.holder,x.spender,x.nonce,x.expiry,x.allowed,S,s.ethers.getBytesCopy(C),s.ethers.getBytesCopy(w)])).slice(4)};exports.approveTokenToHinkal=u;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(
|
|
1
|
+
require("../../../../../_virtual/_rolldown/runtime.cjs");const e=require(`../../../externalABIs/index.cjs`),t=require(`../../utils/getContractAddress.cjs`);let n=require(`ethers`);var r=(t,r)=>new n.ethers.Interface(e.ERC20ABI).encodeFunctionData(`approve`,[t,r]),i=(e,t,n,r)=>r.encodeFunctionData(`transact`,[e[0],e[1],e[2],t,n]),a=(e,t,n,r,i)=>i.encodeFunctionData(`prooflessDeposit`,[e,t,n,r]),o=(e,t,i,a,o,s)=>{let c=[];for(let a=0;a<e.length;a+=1){let o=e[a],s=t[a];o!==n.ethers.ZeroAddress&&s>0n&&c.push({to:o,value:`0x0`,data:r(i,s)})}return c.push({to:a,value:s>0n?`0x${s.toString(16)}`:`0x0`,data:o}),c},s=(e,a,o,s,c,l,u,d)=>{let f=[];for(let t=0;t<e.length;t+=1){let i=e[t],s=a[t];i!==n.ethers.ZeroAddress&&s>0n&&f.push({to:i,value:`0x0`,data:r(o,s)})}return f.push({to:t.getContractAddress(s),value:d>0n?`0x${d.toString(16)}`:`0x0`,data:i(c,l,u,s.interface)}),f},c=(e,t,n,r,i,a,o,s)=>e.encodeFunctionData(`prooflessDeposit`,[t,n,r,i,a,o,s]),l=(e,t,n,r,i,a,s,l,u,d,f,p)=>o(e,t,n,n,c(r,i,a,s,l,u,d,f),p),u=(e,n,r,i,s,c,l,u,d)=>{let f=a(s,c,l,u,i.interface);return o(e,n,r,t.getContractAddress(i),f,d)};exports.buildApproveAndDepositWrapperCalls=l,exports.buildApproveAndProoflessDepositCalls=u,exports.buildApproveAndTransactCalls=s;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(
|
|
1
|
+
require("../../../../../_virtual/_rolldown/runtime.cjs");const e=require(`../../../constants/protocol.constants.cjs`),t=require(`../../utils/time.utils.cjs`),n=require(`../../../types/ethereum-network.types.cjs`),r=require(`../../utils/getContractAddress.cjs`),i=require(`./recoverTransactionFromError.cjs`),a=require(`./approveTokensToHinkal.cjs`),o=require(`./constructBatchCall.cjs`),s=require(`./waitForErc20Approvals.cjs`);let c=require(`ethers`);var l=async(l,u,d,f,p,m,h,g,_,v=!0,y=!1)=>{let b=Array.isArray(d)?d:[d],x=Array.isArray(f)?f:[f];if(b.length!==x.length)throw Error(`token and amount length mismatch`);let S=l.getContractWithSigner(u,n.ContractType.HinkalContract),C=await l.getEthereumAddressByChain(u),w=g??S,T=_??S,E=`transact`,D=x.findIndex(({erc20TokenAddress:t})=>t===e.zeroAddress),O=x.some(({erc20TokenAddress:t})=>t!==e.zeroAddress),k=D===-1?0n:b[D],A=l.getProviderAdapter(u),j=await A.supportsBatchCall?.(u);if(!y&&O&&j&&A.sendBatchCallsTransaction){let e=o.buildApproveAndTransactCalls(x.map(e=>e.erc20TokenAddress),b,r.getContractAddress(w),T,p,h,m,k);return await A.sendBatchCallsTransaction(u,e)}if(!y&&(await a.approveTokensToHinkal(l,u,w,x,b),O)){let e=x.map(({erc20TokenAddress:e},t)=>({tokenAddress:e,requiredAmount:b[t]}));await s.waitForErc20Approvals(l,u,C,r.getContractAddress(w),e)}let M={value:k>0n?BigInt(k).toString():void 0,gasLimit:void 0},N,P=[p[0],p[1],p[2],h,m,{...M,from:C}],{runner:F}=T;if(!(F instanceof c.ethers.AbstractSigner))throw Error(`expected signer`);if(v)try{N=Number(await T[E].estimateGas(...P))}catch(e){console.log(`hinkalDeposit: gas estimation error`,{err:e})}let I=N&&N>=0?Math.ceil(N*12/10):void 0;I&&(P[5].gasLimit=I),await t.waitLittle();let L;try{L=y?await T[E].populateTransaction(...P):await T[E](...P)}catch(e){if(!e?.transactionHash)throw e;let t=await i.recoverTransactionFromError(F.provider,e.transactionHash);if(!t)throw e;L=t}return L};exports.transactCallDirect=l;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(
|
|
1
|
+
require("../../../../_virtual/_rolldown/runtime.cjs");const e=require(`../../constants/chains.constants.cjs`),t=require(`../../error-handling/error-codes.constants.cjs`),n=require(`../utils/tron.utils.cjs`),r=require(`../utils/create-provider.cjs`),i=require(`../../constants/contracts.constants.cjs`);let a=require(`ethers`);var o=(n,r)=>{let a=e.networkRegistry[r];if(!a)throw Error(t.transactionErrorCodes.UNSUPPORTED_NETWORK);let o=i.contractMetadataMapping[n];if(!o)throw Error(`Unsupported contractType: ${n}`);return o(a.contractData)},s=(e,t,r,i)=>{let s=o(e,t);if(!s.abi)throw Error(`No ABI configured for contractType: ${e}`);if(s.address&&r)throw Error(`Overriding address is not supported for contractType: ${e}`);let c=s.address??r;if(!c)throw Error(`No contractAddress configured for contractType: ${e}`);return new a.ethers.Contract(n.addressToHexFormat(c),s.abi,i)},c=(e,t,n=void 0)=>s(t,e,n,r.createJsonRpcProvider(e));exports.getContract=s,exports.getContractMetadata=o,exports.getContractWithFetcherByChainId=c;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(
|
|
1
|
+
require("../../../../_virtual/_rolldown/runtime.cjs");const e=require(`../utils/serialize.utils.cjs`),t=require(`../../constants/chains.constants.cjs`),n=require(`./etherFunctions.cjs`),r=require(`../pre-transaction/solana.cjs`),i=require(`../../API/callOkxAPI.cjs`);let a=require(`@solana/web3.js`);var o=(e,t,n,r,i=.7)=>({amount:`${n}`,chainIndex:`501`,fromTokenAddress:e.toString(),toTokenAddress:t.toString(),userWalletAddress:r,slippagePercent:`${i}`,directRoute:!0}),s=async(s,c,l,u,d=.5,f,p)=>{if(!t.isSolanaLike(s))throw Error(`OKX is only supported on Solana`);let m=n.randomBigInt(31),h=n.getAmountInWei(c,u),{hinkalAddress:g,originalDeployer:_}=t.networkRegistry[s].contractData;if(!_)throw Error(`No original deployer configured for Solana program`);if(p&&!f)throw Error(`Proxy wallet address is required`);let v=new a.PublicKey(g),y=new a.PublicKey(_),b=p&&f?new a.PublicKey(f):r.getSwapperAccountPublicKeyFromSalt(v,y,m),{okxResponse:x,status:S}=await i.callOkxAPI({quote:o(new a.PublicKey(c.erc20TokenAddress),new a.PublicKey(l.erc20TokenAddress),h,b.toString(),d)});if(S!==`success`)throw Error(`OKX API Fetch Error`);if(x.code!==`0`)throw Error(`OKX API error: ${x.msg}`);return{outSwapAmountValue:BigInt(x.data.routerResult.toTokenAmount),okxDataValue:e.safeJsonStringify({...x,swapperAccountSalt:m.toString()})}};exports.createOKXQuote=o,exports.getOKXPrice=s;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(
|
|
1
|
+
require("../../../../_virtual/_rolldown/runtime.cjs");const e=require(`../../constants/chains.constants.cjs`),t=require(`../../constants/protocol.constants.cjs`),n=require(`../../error-handling/error-codes.constants.cjs`),r=require(`./etherFunctions.cjs`),i=require(`../../types/ethereum-network.types.cjs`);require(`../../types/index.cjs`);const a=require(`../../error-handling/logError.cjs`);require(`../../error-handling/index.cjs`),require(`../../constants/index.cjs`);let o=require(`ethers`);var s=async(e,r,i,a)=>{let o=(await Promise.all([100,500,3e3,1e4].map(async e=>({poolAddress:await r.getPool(i,a,e),fee:e})))).filter(({poolAddress:e})=>e!==t.zeroAddress),s=await Promise.all(o.map(async t=>({poolAddress:t.poolAddress,fee:t.fee,token1Balance:await e.balanceOf(t.poolAddress)}))),c=s.map(e=>e.token1Balance).reduce((e,t)=>t>=e?t:e,0n);if(c===0n)throw Error(n.transactionErrorCodes.UNISWAP_NOT_ENOUGH_LIQUIDITY);return s.find(e=>e.token1Balance===c)},c=async(t,n,r,o,s,c)=>{try{if(!e.networkRegistry[n].quoterV2Address)throw Error(`No Quoter Contract Provided`);return(await t.getContractWithFetcherByChainId(n,i.ContractType.UniswapV3QuoterContract,e.networkRegistry[n].quoterV2Address).quoteExactInputSingle.staticCall({tokenIn:r.wrappedErc20TokenAddress??r.erc20TokenAddress,tokenOut:o.wrappedErc20TokenAddress??o.erc20TokenAddress,fee:s,amountIn:c,sqrtPriceLimitX96:0})).amountOut}catch(e){throw a.logError(e),e}},l=async(t,n,r,a)=>{try{let o=t.getContractWithFetcherByChainId(n,i.ContractType.UniswapV3FactoryContract,e.networkRegistry[n].uniswapV3FactoryAddress),{fee:c}=await s(t.getContractWithFetcherByChainId(n,i.ContractType.ERC20Contract,a.wrappedErc20TokenAddress??a.erc20TokenAddress),o,r.wrappedErc20TokenAddress??r.erc20TokenAddress,a.wrappedErc20TokenAddress??a.erc20TokenAddress);return c}catch(e){throw console.log(`Error in getUniswapFee`,e),e}},u=async(e,t,i,a,s)=>{try{let n=await l(e,t,a,s),u=o.ethers.AbiCoder.defaultAbiCoder().encode([`uint24`],[n]);return{tokenPrice:await c(e,t,a,s,n,r.getAmountInWei(a,i)),poolFee:u}}catch{throw Error(n.transactionErrorCodes.NO_UNISWAP_PRICE)}};exports.getUniswapFee=l,exports.getUniswapPrice=u,exports.getUniswapPriceHelper=c,exports.searchPoolAndFee=s;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(
|
|
1
|
+
require("../../../_virtual/_rolldown/runtime.cjs");let e=require(`async-mutex`);var t=class{readRegistryMutex=new e.Mutex;writeMutex=new e.Mutex;readers=0;writeMutexReleaser=null;async runShared(e){await this.acquireRead();try{return await e()}finally{await this.releaseRead()}}async runExclusive(e){return this.writeMutex.runExclusive(async()=>e(!0))}async acquireRead(){await this.readRegistryMutex.runExclusive(async()=>{this.readers+=1,this.readers===1&&(this.writeMutexReleaser=await this.writeMutex.acquire())})}async releaseRead(){await this.readRegistryMutex.runExclusive(async()=>{--this.readers,this.readers===0&&this.writeMutexReleaser&&(this.writeMutexReleaser(),this.writeMutexReleaser=null)})}};exports.ChainBalanceRwLock=t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(
|
|
1
|
+
require("../../../_virtual/_rolldown/runtime.cjs"),new(require(`async-mutex`)).Mutex;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(
|
|
1
|
+
require("../../../_virtual/_rolldown/runtime.cjs");const e=require(`../constants/chains.constants.cjs`),t=require(`../error-handling/error-codes.constants.cjs`),n=require(`../functions/utils/create-provider.cjs`),r=require(`../functions/web3/getContractMetadata.cjs`);let i=require(`ethers`);var a=class{signer;chainId;fetchProviders={};chainEventListener;constructor(){e.HINKAL_SUPPORTED_CHAINS.forEach(t=>{!e.isSolanaLike(t)&&!e.isTronLike(t)&&(this.fetchProviders[t]=n.createJsonRpcProvider(t))})}initConnector(){}initSigner(e){this.signer=e}async init(e){if(e&&(this.chainId=e),!this.chainId)throw Error(`No Chain Id In Provider Adapter`)}async disconnectFromConnector(){}async connectToConnector(){return 0}async waitForTransaction(e,n,r){if((await this.fetchProviders[e]?.waitForTransaction(n,r))?.status)return!0;throw Error(t.transactionErrorCodes.TRANSACTION_NOT_CONFIRMED)}async signMessage(e){if(!this.signer)throw Error(`IllegalState: no signer`);let n=await this.signer.signMessage(e);if(!n)throw Error(t.transactionErrorCodes.SIGNING_FAILED);if(n.includes(`error`))throw Error(t.transactionErrorCodes.SIGNATURE_UNSUPPORTED_PERSONAL_SIGN);return n}async signTypedData(e,t,n){return this.signer.signTypedData(e,t,n)}async switchNetwork(e){let t=this.fetchProviders[e.chainId];if(!t)throw Error(`switchNetwork illegal state: no provider`);this.signer=this.signer?.connect(t),this.chainEventListener?.onChainChanged(e.chainId)}async getAddress(){if(!this.signer)throw Error(`IllegalState: no signer`);let e=await this.signer.getAddress();if(!e)throw Error(`IllegalState`);return i.ethers.getAddress(e)}setChainEventListener(e){this.chainEventListener=e}onAccountChanged(){return this.init()}onChainChanged(e){return this.init(e)}release(){this.removeListeners()}removeListeners(){this.chainEventListener=void 0}getContract(e,t,n=void 0,i){return r.getContract(t,e,n,i)}getContractWithSigner(e,t,n=void 0){if(!this.signer)throw Error(`IllegalState: no signer`);return this.getContract(e,t,n,this.signer)}getContractWithFetcher(e,t,n=void 0){if(!this.fetchProviders[e])throw Error(`fetchProvider not initialized`);return this.getContract(e,t,n,this.fetchProviders[e])}async sendTransaction(e){if(!this.signer)throw Error(`IllegalState: no signer`);return await this.signer.sendTransaction(e)}async connectAndPatchProvider(){if(!this.signer)throw Error(`IllegalState: no signer`);let{chainId:e}=await this.signer.provider.getNetwork();return Number(e)}getChainId(){return this.chainId}isPermitterAvailable(){return!1}async getGasPrice(e){let t=(await this.fetchProviders[e]?.getFeeData())?.gasPrice;if(!t)throw Error(`Could not fetch gas price in getGasPrice`);return t}};new a;var o=()=>new a;exports.default=o;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(
|
|
1
|
+
require("../../../_virtual/_rolldown/runtime.cjs");const e=require(`../constants/chains.constants.cjs`),t=require(`../error-handling/error-codes.constants.cjs`),n=require(`../functions/utils/create-provider.cjs`);let r=require(`@coral-xyz/anchor`);var i=class{chainId;connection;wallet;ethereumAddress;connectHandler;disconnectHandler;chainEventListener;anchorProvider;constructor(t,r){let i=e.networkRegistry[t].fetchRpcUrl;if(!i)throw Error(`RPC URL not found for the specified chain ID`);this.connection=n.createCustomSolanaConnection(i),this.chainId=t,this.ethereumAddress=r}initConnector(e){this.wallet=e,this.initializeAnchorProvider()}async init(e){e&&(this.chainId=e)}async connectToConnector(){return this.chainId??0}async disconnectFromConnector(){}async connectAndPatchProvider(){if(!this.chainId)throw Error(`No Chain Id In Provider Adapter`);return this.chainId}getChainId(){return this.chainId}async waitForTransaction(e,n,r){try{return(await this.connection.confirmTransaction(n,`confirmed`)).value.err===null}catch{throw Error(t.transactionErrorCodes.TRANSACTION_NOT_CONFIRMED)}}async signMessage(e){if(!this.wallet?.signMessage)throw Error(t.transactionErrorCodes.SIGNING_FAILED);let n=typeof e==`string`?new TextEncoder().encode(e):e,{signature:r}=await this.wallet.signMessage(n,`utf8`);if(!r)throw Error(t.transactionErrorCodes.SIGNING_FAILED);return`0x${Buffer.from(r).toString(`hex`)}`}async signTransactionWithoutBroadcast(e){if(!this.wallet)throw Error(t.transactionErrorCodes.SIGNING_FAILED);let n=await this.wallet.signTransaction(e),r=Buffer.from(n.serializeMessage()).toString(`base64`),i=n.signatures.find(({publicKey:e})=>e.equals(this.wallet.publicKey))?.signature;if(!i)throw Error(t.transactionErrorCodes.SIGNING_FAILED);return{signature:`0x${Buffer.from(i).toString(`hex`)}`,transactionMessageB64:r}}async getAddress(){let e=this.ethereumAddress??this.wallet?.publicKey.toString();if(!e)throw Error(`IllegalState`);return e}setChainEventListener(e){this.chainEventListener=e,this.setupWalletListeners()}async switchNetwork(e){this.chainEventListener?.onChainChanged(e.chainId)}async signTypedData(e,t,n){throw Error(`Typed data signing not supported on Solana`)}async onAccountChanged(){return this.init()}async onChainChanged(e){return this.init(e)}release(){this.removeWalletListeners(),this.chainEventListener=void 0}getContract(e,t,n,r){throw Error(`Not implemented from SolanaProviderAdapter`)}getContractWithSigner(e,t,n){throw Error(`Not implemented from SolanaProviderAdapter`)}getContractWithFetcher(e,t,n){throw Error(`Not implemented from SolanaProviderAdapter`)}async sendTransaction(e){throw Error(`Not implemented from SolanaProviderAdapter`)}async getGasPrice(e){throw Error(`Not implemented from SolanaProviderAdapter`)}isPermitterAvailable(){return!1}getConnection(){return this.connection}initializeAnchorProvider(){if(!this.wallet)throw Error(`No wallet provided`);return this.anchorProvider=new r.AnchorProvider(this.connection,this.wallet,{preflightCommitment:`confirmed`,commitment:`confirmed`}),this.anchorProvider}getAnchorProvider(){return this.anchorProvider??this.initializeAnchorProvider()}getSolanaProgram(e){return new r.Program(e,this.getAnchorProvider())}getSolanaPublicKey(){if(!this.wallet)throw Error(`No wallet provided`);return this.wallet.publicKey}setupWalletListeners(){!this.wallet?.adapter||!this.chainEventListener||(this.connectHandler=e=>{if(!e){this.chainEventListener?.onChainChanged();return}if(!this.wallet)throw Error(`No wallet provided`);this.wallet={...this.wallet,publicKey:e},this.anchorProvider=new r.AnchorProvider(this.connection,this.wallet,{preflightCommitment:`confirmed`,commitment:`confirmed`}),this.chainEventListener?.onAccountChanged()},this.disconnectHandler=()=>{this.chainEventListener?.onChainChanged()},this.wallet.adapter.on(`connect`,this.connectHandler),this.wallet.adapter.on(`disconnect`,this.disconnectHandler))}removeWalletListeners(){this.wallet?.adapter&&this.connectHandler&&this.wallet.adapter.off(`connect`,this.connectHandler),this.wallet?.adapter&&this.disconnectHandler&&this.wallet.adapter.off(`disconnect`,this.disconnectHandler),this.connectHandler=void 0,this.disconnectHandler=void 0}isSolanaLedger(){if(!this.wallet)throw Error(`No wallet provided`);return this.wallet.isLedger??!1}},a=(e,t)=>new i(e,t);exports.SolanaProviderAdapter=i,exports.default=a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(
|
|
1
|
+
require("../../../_virtual/_rolldown/runtime.cjs");const e=require(`../constants/chains.constants.cjs`),t=require(`../error-handling/error-codes.constants.cjs`),n=require(`../types/eip5792.types.cjs`),r=require(`../error-handling/logger.cjs`),i=require(`../functions/utils/create-provider.cjs`),a=require(`../functions/web3/getContractMetadata.cjs`);let o=require(`ethers`),s=require(`wagmi`),c=require(`wagmi/actions`);var l=class l{connector;chainId;originalProvider;fetchProviders={};signer;chainEventListener;config;unsubscribeFns=[];constructor(){e.HINKAL_SUPPORTED_CHAINS.forEach(t=>{if(e.isSolanaLike(t))return;let{fetchRpcUrl:n}=e.networkRegistry[t];if(!n)throw Error(`No Fetch RPC URL In Provider Adapter`);this.fetchProviders[t]=n.includes(`wss`)?new o.ethers.WebSocketProvider(n):i.createJsonRpcProvider(t)})}initConnector(e){this.connector=e}initConfig(e){this.config=e}async init(e){if(!this.connector)throw Error(`No Connector In Provider Adapter`);if(e&&(this.chainId=e),!this.chainId)throw Error(`No Chain Id In Provider Adapter`);let t=await this.connector.getProvider();this.originalProvider=new o.ethers.BrowserProvider(t);let n=(await this.connector.getAccounts())?.[0];if(!n){this.chainEventListener&&this.chainEventListener.onChainChanged();return}this.signer=await this.walletClientToSigner({transport:t,account:n},this.chainId)}async disconnectFromConnector(){if(!this.config)throw Error(`No Config In Provider Adapter`);this.release(),await(0,c.disconnect)(this.config)}async connectToConnector(e){if(!this.config)throw Error(`No Config In Provider Adapter`);if(e.id===`walletConnect`)try{await(0,c.reconnect)(this.config,{connectors:[e]}),await(0,c.disconnect)(this.config)}catch{}try{return(await(0,c.connect)(this.config,{connector:e})).chainId}catch(n){if(n instanceof s.ConnectorAlreadyConnectedError)return e.getChainId();let r=t.transactionErrorCodes.CONNECTION_FAILED;throw n?.code===4001&&(r=t.UserFriendlyErrorCodes.YOU_CANCELED_REQUEST),Error(r)}}getChainId(){return this.chainId}async waitForTransaction(e,n,r){if((await this.fetchProviders[e]?.waitForTransaction(n,r))?.status)return!0;throw Error(t.transactionErrorCodes.TRANSACTION_NOT_CONFIRMED)}async signMessage(e){if(!this.config)throw Error(`No Config In Provider Adapter`);let n=await(0,c.signMessage)(this.config,{message:e});if(!n)throw Error(t.transactionErrorCodes.SIGNING_FAILED);if(n.includes(`error`))throw Error(t.transactionErrorCodes.SIGNATURE_UNSUPPORTED_PERSONAL_SIGN);return n}async signTypedData(e,t,n){return this.signer.signTypedData(e,t,n)}async switchNetwork(t){if(!this.config)throw Error(`No Config In Provider Adapter`);let n=e.getOnchainChainId(t.chainId);return(0,c.switchChain)(this.config,{chainId:n})}async getAddress(){if(!this.config)throw Error(`No Config In Provider Adapter`);let{address:e}=(0,c.getAccount)(this.config);if(!e)throw Error(`IllegalState`);return o.ethers.getAddress(e)}setChainEventListener(e){if(!this.config)throw Error(`No Config In Provider Adapter`);this.chainEventListener=e,this.chainEventListener&&(this.unsubscribeFns.push((0,c.watchAccount)(this.config,{onChange:({address:e},{address:t})=>{this.chainEventListener&&e!==t&&this.chainEventListener.onAccountChanged()}})),this.unsubscribeFns.push((0,c.watchChainId)(this.config,{onChange:e=>{this.chainEventListener&&this.chainEventListener.onChainChanged(e)}})))}onAccountChanged(){return this.init()}onChainChanged(e){return this.init(e)}release(){this.removeListeners()}removeListeners(){this.unsubscribeFns.forEach(e=>e()),this.unsubscribeFns=[]}getContract(e,t,n=void 0,r){return a.getContract(t,e,n,r)}getContractWithSigner(e,t,n=void 0){if(!this.signer)throw Error(`IllegalState: no signer`);return this.getContract(e,t,n,this.signer)}getContractWithFetcher(e,t,n=void 0){let r=this.fetchProviders[e];if(!r)throw Error(`fetchProvider not initialized`);return this.getContract(e,t,n,r)}async sendTransaction(e){if(!this.signer)throw Error(`IllegalState: no signer`);return await this.signer.sendTransaction(e)}async connectAndPatchProvider(e){return await this.connectToConnector(e)}isPermitterAvailable(){if(!this.chainId)throw Error(`Illegal state: no chainId`);return!!e.networkRegistry[this.chainId]?.contractData?.permitterAddress}async getGasPrice(e){let t=(await this.fetchProviders[e]?.getFeeData())?.gasPrice;if(!t)throw Error(`Could not fetch gas price in getGasPrice`);return t}static FALLBACK_METHODS=new Set([`eth_blockNumber`,`eth_call`]);wrapTransportWithRpcFallback(e,t){let n=this.fetchProviders[t];return n?{request:async t=>{let r=await e.request(t);return r==null&&l.FALLBACK_METHODS.has(t.method)?n.send(t.method,Array.isArray(t.params)?t.params:[]):r}}:e}async walletClientToSigner(e,t){let{account:n,transport:r}=e;return new o.ethers.BrowserProvider(this.wrapTransportWithRpcFallback(r,t)).getSigner(n)}async supportsBatchCall(t){if(!this.originalProvider)return!1;try{let n=await this.getAddress(),r=`0x${e.getOnchainChainId(t).toString(16)}`,i=await this.originalProvider.send(`wallet_getCapabilities`,[n,[r]]),a=i?.[r]||i?.[`0x0`];if(!a?.atomic)return!1;let o=typeof a.atomic==`string`?a.atomic:a.atomic?.status;return o===`supported`||o===`ready`}catch{return!1}}async waitForBatchTransactionStatus(e){if(!this.originalProvider)throw Error(`WagmiProviderAdapter: Provider not initialized`);for(let t=0;t<60;t+=1){await new Promise(e=>{setTimeout(()=>e(),1e3)});try{let t=await this.originalProvider.send(`wallet_getCallsStatus`,[e]);if(t.status===n.CallsStatus.Confirmed&&t.receipts?.[0]?.transactionHash)return t.receipts[0].transactionHash;if(t.status===n.CallsStatus.OffchainFailure||t.status===n.CallsStatus.ChainFailure||t.status===n.CallsStatus.PartialFailure)break}catch(e){r.Logger.log(`waitForBatchTransactionStatus:`,e)}}throw Error(`Batch transaction timed out or failed`)}async sendBatchCallsTransaction(t,n){if(!this.fetchProviders[t])throw Error(`WagmiProviderAdapter: fetchProvider not initialized`);if(!this.originalProvider)throw Error(`WagmiProviderAdapter: Provider not initialized`);let r=await this.getAddress(),i={version:`2.0.0`,chainId:`0x${e.getOnchainChainId(t).toString(16)}`,from:r,atomicRequired:!0,calls:n},a=await this.originalProvider.send(`wallet_sendCalls`,[i]),o=a?.id||a;if(!o||typeof o!=`string`)throw Error(`Invalid batch ID received from wallet_sendCalls`);let s=await this.waitForBatchTransactionStatus(o),c=await this.fetchProviders[t].getTransaction(s);if(!c)throw Error(`Transaction not found`);return c}};new l;var u=()=>new l;exports.default=u;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(
|
|
1
|
+
require("../../../_virtual/_rolldown/runtime.cjs");const e=require(`../constants/fees.constants.cjs`);let t=require(`viem`);var n=function(e){return e.BalanceChange=`BalanceChange`,e.AccountChanged=`AccountChanged`,e.ShowConnect=`ShowConnect`,e.ShowNetworkPopup=`ShowNetworkPopup`,e.MerkleTreeUpdated=`MerkleTreeUpdated`,e.MerkleTreeResetStarted=`MerkleTreeResetStarted`,e.MerkleTreeResetFinished=`MerkleTreeResetFinished`,e}({}),r=function(e){return e[e.UNISWAP=1]=`UNISWAP`,e[e.ODOS=1+e.UNISWAP]=`ODOS`,e[e.ONEINCH=1+e.ODOS]=`ONEINCH`,e[e.LIFI=1+e.ONEINCH]=`LIFI`,e[e.OKX=1+e.LIFI]=`OKX`,e[e.ALL=1+e.OKX]=`ALL`,e[e.NONE=1+e.ALL]=`NONE`,e}({}),i=function(e){return e[e.NONE=0]=`NONE`,e[e.APPROVE=1]=`APPROVE`,e[e.RELEASE_BUFFER=2]=`RELEASE_BUFFER`,e[e.EXECUTE=3]=`EXECUTE`,e}({}),a=e=>({hinkalLogicAction:i.NONE,executeApprovalChanges:Array(e).fill(0n),doPreTxApproval:!1,inHinkalAddress:0n,useApprovalUtxoData:Array(e).fill({approvalChanges:[0n],externalApprovalAddresses:[t.zeroAddress],conversionInHinkalAddress:[0n]})}),o={feeToken:e.defaultFeeToken,flatFee:0n,variableRate:0n},s=function(e){return e.PROTOCOL=`protocol`,e.PRIVATE_TRANSFER=`privateTransfer`,e}({});exports.EventType=n,exports.HinkalLogicAction=i,exports.IntegrationProvider=r,exports.LoginMessageMode=s,exports.defaultHinkalLogicArgs=a,exports.zeroFeeStructure=o;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=`/assets/utxoWorkerLauncher-
|
|
1
|
+
var e=`/assets/utxoWorkerLauncher-BT0VeiZB.js`;exports.default=e;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
const domain = 'https://storage.googleapis.com/hinkal-workers-staging';
|
|
3
3
|
|
|
4
4
|
const WORKER_CDN_URLS = {
|
|
5
|
-
ZKProof: domain + '/0.3.
|
|
6
|
-
SnarkJS: domain + '/0.3.
|
|
7
|
-
UTXO: domain + '/0.3.
|
|
5
|
+
ZKProof: domain + '/0.3.88/' + 'zkProofWorkerLauncher.js',
|
|
6
|
+
SnarkJS: domain + '/0.3.88/' + 'snarkjsWorkerLauncher.js',
|
|
7
|
+
UTXO: domain + '/0.3.88/' + 'utxoWorkerLauncher.js',
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
// Returns a blob:// URL which points
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=`/assets/zkProofWorkerLauncher-
|
|
1
|
+
var e=`/assets/zkProofWorkerLauncher-3TPbHuNd.js`;exports.default=e;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gurge/sdk-react-native",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.88",
|
|
4
4
|
"description": "Prebundled Hinkal SDK for React Native — no Metro config required.",
|
|
5
5
|
"homepage": "hinkal.io",
|
|
6
6
|
"author": {
|
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
"import": "./index.mjs",
|
|
22
22
|
"default": "./index.cjs"
|
|
23
23
|
},
|
|
24
|
+
"./bootstrap": {
|
|
25
|
+
"import": "./bootstrap.mjs",
|
|
26
|
+
"default": "./bootstrap.cjs"
|
|
27
|
+
},
|
|
24
28
|
"./providers/prepareEthersHinkal": {
|
|
25
29
|
"types": "./providers/prepareEthersHinkal.d.ts",
|
|
26
30
|
"import": "./providers/prepareEthersHinkal.mjs",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require("../_virtual/_rolldown/runtime.cjs");const e=require(`./HinkalWebViewWorker.cjs`);let t=require(`react/jsx-runtime`);var n=({children:n})=>(0,t.jsxs)(t.Fragment,{children:[n,(0,t.jsx)(e,{})]});exports.HinkalProvider=n;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require(
|
|
1
|
+
require("../_virtual/_rolldown/runtime.cjs");const e=require(`../common/src/webworker/workerFactory.cjs`),t=require(`../common/src/webworker/viteWorkerURL.constant.cjs`),n=require(`./bridge/serialization.utils.cjs`),r=require(`./bridge/HinkalRNWorker.cjs`);let i=require(`react-native`),a=require(`react`),o=require(`react-native-webview`),s=require(`react/jsx-runtime`);var c=`${new URL(Object.values(t.WORKER_CDN_URLS)[0]).origin}/`;e.WorkerFactory.rnWorkerFactory=e=>new r.HinkalRNWorker(e);var l=`
|
|
2
2
|
if (!window.__hinkalPageBoot) (function(){
|
|
3
3
|
window.__hinkalPageBoot = true;
|
|
4
4
|
var URLS = ${JSON.stringify(t.WORKER_CDN_URLS)};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(
|
|
1
|
+
require("../../_virtual/_rolldown/runtime.cjs");const e=require(`./serialization.utils.cjs`);let t=require(`react-native`);var n=class{onmessage=null;onerror=null;requestId=e.nextRequestId();subscription;constructor(e){this.variant=e,this.subscription=t.DeviceEventEmitter.addListener(`FROM_WEBVIEW_WORKER`,e=>{!e||e.requestId!==this.requestId||(e.type===`RESULT`?this.onmessage?.({data:e.data}):e.type===`ERROR`&&this.onerror?.(Error(e.error??`WebView worker error`)))})}postMessage(e){t.DeviceEventEmitter.emit(`TO_WEBVIEW_WORKER`,{__requestId:this.requestId,variant:this.variant,message:e})}terminate(){this.subscription?.remove?.(),this.subscription=null}};exports.HinkalRNWorker=n;
|
package/shims/globals.cjs
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import { Buffer } from "buffer";
|
|
2
2
|
import * as ReactNative from "react-native";
|
|
3
|
+
|
|
4
|
+
if (typeof globalThis.WebAssembly === "undefined") {
|
|
5
|
+
class WasmRuntimeError extends Error {
|
|
6
|
+
constructor(message) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.name = "RuntimeError";
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
globalThis.WebAssembly = { RuntimeError: WasmRuntimeError };
|
|
12
|
+
}
|
|
13
|
+
|
|
3
14
|
global.Buffer = Buffer;
|
|
4
15
|
|
|
5
16
|
// key-val-store probes indexedDB; without it the SDK falls back to FileKeyValStore (process.cwd).
|