h_test_1 0.0.40 → 0.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../../constants/chains.constants.cjs`),t=require(`../../utils/caseInsensitive.utils.cjs`),n=require(`../../utils/addresses.cjs`),r=require(`../../../API/scheduled-transactions-calls.cjs`),i=require(`../../../data-structures/utxo/Utxo.cjs`),a=require(`../../utils/upToDateState.cjs`),o=require(`../../utils/cacheFunctions.cjs`),s=require(`../../utils/encodeTokenWithId.cjs`),c=require(`../../utils/solanaMint.utils.cjs`),l=require(`./getInputUtxosEnclave.cjs`),u=require(`../../utils/tron.utils.cjs`);var d=new(require(`async-mutex`)).Mutex,f=async(e,t,n,r,i,s,c,l,u)=>d.runExclusive(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 a.checkAddressNotUpdated(e,r),o.setHinkalCache({lastOutput:f,encryptedOutputs:m},e,n,i),await e.utxoUtils.buildBatchProcess(m,t,n)}),p=async(e,t,n,r)=>{let{utxos:i,encryptedOutputs:a,lastOutput:s}=await l.getInputUtxosEnclave(e,n,t);return o.setHinkalCache({encryptedOutputs:a,lastOutput:s},e,n,r),i},m=async(e,t,n,r,i,a,o,s,c)=>{try{return await p(e,t,n,i)}catch{return f(e,t,n,r,i,a,o,s,c)}},h=e=>{if(Array.isArray(e))return e;if(e!==void 0)return[e]},g=async(e,t,n)=>await e.utxoUtils.batchFilterUtxosWithNullifier(t,n),_=(e,t,n,r,a,o,s)=>{for(e.sort((e,t)=>e.amount<=t.amount?1:-1);e.length<t||e.length>t&&e.length<6;)if(e.push(new i.Utxo({amount:0n,erc20TokenAddress:a,mintAddress:s,shieldedPrivateKey:r,tokenId:o})),n)for(;e.length>6;)e.splice(e.length-1)},v=async({hinkal:e,chainId:t,passedShieldedPublicKey:n=void 0,ethAddress:r=void 0,resetCacheBefore:i=!1,allowRemoteDecryption:s=!1,useBlockedUtxos:c=!1})=>{let l=r??await e.getEthereumAddress(),u=n??e.userKeys.getShieldedPublicKey(),{userKeys:d}=e,p=e.encryptedOutputsByChain[t],h=e.nullifiersByChain[t],_=Array.from(p);i&&o.resetCache(e,t,u);let{encryptedOutputs:v,lastOutput:y}=o.getHinkalCache(e,t,u);await a.checkAddressNotUpdated(e,l);let b=y!==``,x=_.findIndex(e=>e.value===y),S=x>-1,C=!b&&x===-1,w=e.areMerkleTreeUpdatesDisabled(),T=!w&&(S||!s&&C),E=!w&&s&&C,D=!T&&!E,O=[];T?O=await f(e,d,t,l,u,_,v,y,x):E?O=await m(e,d,t,l,u,_,v,y,x):D&&(O=await e.utxoUtils.buildBatchProcess(v,d,t)),await a.checkAddressNotUpdated(e,l);let k=await g(e,O,h);return{inputUtxos:c?k.filter(e=>e.isBlocked):k.filter(e=>!e.isBlocked)}},y=async({hinkal:t,chainId:i,passedShieldedPublicKey:a=void 0,ethAddress:o=void 0,resetCacheBefore:s=!1,allowRemoteDecryption:c=!1})=>{let l=o??await t.getEthereumAddressByChain(i),d=n.hashEthereumAddress(e.isTronLike(i)?u.addressToHexFormat(l):l),{inputUtxos:f}=await v({hinkal:t,chainId:i,passedShieldedPublicKey:a,ethAddress:l,resetCacheBefore:s,allowRemoteDecryption:c,useBlockedUtxos:!0});if(!f.length)return{inputUtxos:[]};let{indexes:p}=await r.getScheduledTransactionsNullifierIndexes({hashedEthereumAddress:d,nullifiers:f.map(e=>e.getNullifier())});return{inputUtxos:p.map(e=>f[e]).filter(e=>!!e)}},b=async({hinkal:n,tokenWithId:r,minInput:i=2,sliceIfMore6:a=!0,chainId:o,passedShieldedPrivateKey:l=void 0,passedShieldedPublicKey:u=void 0,ethAddress:d=void 0,resetCacheBefore:f=!1,ensuredTokensWithId:p,useBlockedUtxos:m=!1})=>{let g=l??n.userKeys.getShieldedPrivateKey()
|
|
1
|
+
require(`../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../../constants/chains.constants.cjs`),t=require(`../../utils/caseInsensitive.utils.cjs`),n=require(`../../utils/addresses.cjs`),r=require(`../../../API/scheduled-transactions-calls.cjs`),i=require(`../../../data-structures/utxo/Utxo.cjs`),a=require(`../../utils/upToDateState.cjs`),o=require(`../../utils/cacheFunctions.cjs`),s=require(`../../utils/encodeTokenWithId.cjs`),c=require(`../../utils/solanaMint.utils.cjs`),l=require(`./getInputUtxosEnclave.cjs`),u=require(`../../utils/tron.utils.cjs`);var d=new(require(`async-mutex`)).Mutex,f=async(e,t,n,r,i,s,c,l,u)=>d.runExclusive(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 a.checkAddressNotUpdated(e,r),o.setHinkalCache({lastOutput:f,encryptedOutputs:m},e,n,i),await e.utxoUtils.buildBatchProcess(m,t,n)}),p=async(e,t,n,r)=>{let{utxos:i,encryptedOutputs:a,lastOutput:s}=await l.getInputUtxosEnclave(e,n,t);return o.setHinkalCache({encryptedOutputs:a,lastOutput:s},e,n,r),i},m=async(e,t,n,r,i,a,o,s,c)=>{try{return await p(e,t,n,i)}catch{return f(e,t,n,r,i,a,o,s,c)}},h=e=>{if(Array.isArray(e))return e;if(e!==void 0)return[e]},g=async(e,t,n)=>await e.utxoUtils.batchFilterUtxosWithNullifier(t,n),_=(e,t,n,r,a,o,s)=>{for(e.sort((e,t)=>e.amount<=t.amount?1:-1);e.length<t||e.length>t&&e.length<6;)if(e.push(new i.Utxo({amount:0n,erc20TokenAddress:a,mintAddress:s,shieldedPrivateKey:r,tokenId:o})),n)for(;e.length>6;)e.splice(e.length-1)},v=async({hinkal:e,chainId:t,passedShieldedPublicKey:n=void 0,ethAddress:r=void 0,resetCacheBefore:i=!1,allowRemoteDecryption:s=!1,useBlockedUtxos:c=!1})=>{let l=r??await e.getEthereumAddress(),u=n??e.userKeys.getShieldedPublicKey(),{userKeys:d}=e,p=e.encryptedOutputsByChain[t],h=e.nullifiersByChain[t],_=Array.from(p);i&&o.resetCache(e,t,u);let{encryptedOutputs:v,lastOutput:y}=o.getHinkalCache(e,t,u);await a.checkAddressNotUpdated(e,l);let b=y!==``,x=_.findIndex(e=>e.value===y),S=x>-1,C=!b&&x===-1,w=e.areMerkleTreeUpdatesDisabled(),T=!w&&(S||!s&&C),E=!w&&s&&C,D=!T&&!E,O=[];T?O=await f(e,d,t,l,u,_,v,y,x):E?O=await m(e,d,t,l,u,_,v,y,x):D&&(O=await e.utxoUtils.buildBatchProcess(v,d,t)),await a.checkAddressNotUpdated(e,l);let k=await g(e,O,h);return{inputUtxos:c?k.filter(e=>e.isBlocked):k.filter(e=>!e.isBlocked)}},y=async({hinkal:t,chainId:i,passedShieldedPublicKey:a=void 0,ethAddress:o=void 0,resetCacheBefore:s=!1,allowRemoteDecryption:c=!1})=>{let l=o??await t.getEthereumAddressByChain(i),d=n.hashEthereumAddress(e.isTronLike(i)?u.addressToHexFormat(l):l),{inputUtxos:f}=await v({hinkal:t,chainId:i,passedShieldedPublicKey:a,ethAddress:l,resetCacheBefore:s,allowRemoteDecryption:c,useBlockedUtxos:!0});if(!f.length)return{inputUtxos:[]};let{indexes:p}=await r.getScheduledTransactionsNullifierIndexes({hashedEthereumAddress:d,nullifiers:f.map(e=>e.getNullifier())});return{inputUtxos:p.map(e=>f[e]).filter(e=>!!e)}},b=async({hinkal:n,tokenWithId:r,minInput:i=2,sliceIfMore6:a=!0,chainId:o,passedShieldedPrivateKey:l=void 0,passedShieldedPublicKey:u=void 0,ethAddress:d=void 0,resetCacheBefore:f=!1,ensuredTokensWithId:p,useBlockedUtxos:m=!1})=>{console.log(`getInputUtxoAndBalancePerToken 0 start`,{tokenWithId:r,minInput:i,sliceIfMore6:a,chainId:o,passedShieldedPrivateKey:l,passedShieldedPublicKey:u,ethAddress:d,resetCacheBefore:f,ensuredTokensWithId:p,useBlockedUtxos:m});let g=l??n.userKeys.getShieldedPrivateKey();console.log(`getInputUtxoAndBalancePerToken 1 useBlockedUtxos`,m);let{inputUtxos:b}=m?await y({hinkal:n,chainId:o,ethAddress:d,passedShieldedPrivateKey:l,resetCacheBefore:f}):await v({hinkal:n,tokenWithId:r,minInput:i,sliceIfMore6:a,chainId:o,passedShieldedPrivateKey:l,passedShieldedPublicKey:u,ethAddress:d,resetCacheBefore:f});console.log(`getInputUtxoAndBalancePerToken 2 inputUtxos`,b);let x=h(r);console.log(`getInputUtxoAndBalancePerToken 3 tokensWithId`,x);let S=new Map;b.forEach(e=>{let n=e.getTokenAddress(o);if(x&&!x.some(r=>t.caseInsensitiveEqual(r.erc20TokenAddress,n)&&r.tokenId===e.tokenId))return;let r=s.encodeTokenWithId(o,{erc20TokenAddress:n,tokenId:e.tokenId}),i=S.get(r)??[];S.set(r,[...i,e])}),console.log(`getInputUtxoAndBalancePerToken 4 inputUtxosPerToken`,S),p?.forEach(e=>{let t=s.encodeTokenWithId(o,{erc20TokenAddress:e.erc20TokenAddress,tokenId:e.tokenId});S.set(t,S.get(t)??[])}),console.log(`getInputUtxoAndBalancePerToken 5 ensuredTokensWithId`,p);for(let[t,n]of S){let r=t.split(`-`)[0],s=Number(t.split(`-`)[1]),l=e.isSolanaLike(o),u=l?r:void 0;_(n,i,a,g,l?c.formatMintAddress(r).compressedAddress.toLowerCase():r.toLowerCase(),s,u)}return console.log(`getInputUtxoAndBalancePerToken 6 inputUtxosPerToken`,S),S};exports.attemptGetInputUtxosRemotely=m,exports.getInputUtxoAndBalance=v,exports.getInputUtxoAndBalanceOfStuckUtxos=y,exports.getInputUtxoAndBalancePerToken=b,exports.getInputUtxosRemotely=p;
|
|
@@ -67,7 +67,21 @@ var h = new m(), g = async (e, t, n, r, i, a, s, c, u) => h.runExclusive(async (
|
|
|
67
67
|
});
|
|
68
68
|
return { inputUtxos: f.map((e) => d[e]).filter((e) => !!e) };
|
|
69
69
|
}, w = async ({ hinkal: t, tokenWithId: r, minInput: i = 2, sliceIfMore6: a = !0, chainId: o, passedShieldedPrivateKey: s = void 0, passedShieldedPublicKey: c = void 0, ethAddress: l = void 0, resetCacheBefore: f = !1, ensuredTokensWithId: p, useBlockedUtxos: m = !1 }) => {
|
|
70
|
-
|
|
70
|
+
console.log("getInputUtxoAndBalancePerToken 0 start", {
|
|
71
|
+
tokenWithId: r,
|
|
72
|
+
minInput: i,
|
|
73
|
+
sliceIfMore6: a,
|
|
74
|
+
chainId: o,
|
|
75
|
+
passedShieldedPrivateKey: s,
|
|
76
|
+
passedShieldedPublicKey: c,
|
|
77
|
+
ethAddress: l,
|
|
78
|
+
resetCacheBefore: f,
|
|
79
|
+
ensuredTokensWithId: p,
|
|
80
|
+
useBlockedUtxos: m
|
|
81
|
+
});
|
|
82
|
+
let h = s ?? t.userKeys.getShieldedPrivateKey();
|
|
83
|
+
console.log("getInputUtxoAndBalancePerToken 1 useBlockedUtxos", m);
|
|
84
|
+
let { inputUtxos: g } = m ? await C({
|
|
71
85
|
hinkal: t,
|
|
72
86
|
chainId: o,
|
|
73
87
|
ethAddress: l,
|
|
@@ -83,7 +97,11 @@ var h = new m(), g = async (e, t, n, r, i, a, s, c, u) => h.runExclusive(async (
|
|
|
83
97
|
passedShieldedPublicKey: c,
|
|
84
98
|
ethAddress: l,
|
|
85
99
|
resetCacheBefore: f
|
|
86
|
-
})
|
|
100
|
+
});
|
|
101
|
+
console.log("getInputUtxoAndBalancePerToken 2 inputUtxos", g);
|
|
102
|
+
let _ = y(r);
|
|
103
|
+
console.log("getInputUtxoAndBalancePerToken 3 tokensWithId", _);
|
|
104
|
+
let v = /* @__PURE__ */ new Map();
|
|
87
105
|
g.forEach((e) => {
|
|
88
106
|
let t = e.getTokenAddress(o);
|
|
89
107
|
if (_ && !_.some((r) => n(r.erc20TokenAddress, t) && r.tokenId === e.tokenId)) return;
|
|
@@ -92,18 +110,18 @@ var h = new m(), g = async (e, t, n, r, i, a, s, c, u) => h.runExclusive(async (
|
|
|
92
110
|
tokenId: e.tokenId
|
|
93
111
|
}), i = v.get(r) ?? [];
|
|
94
112
|
v.set(r, [...i, e]);
|
|
95
|
-
}), p?.forEach((e) => {
|
|
113
|
+
}), console.log("getInputUtxoAndBalancePerToken 4 inputUtxosPerToken", v), p?.forEach((e) => {
|
|
96
114
|
let t = u(o, {
|
|
97
115
|
erc20TokenAddress: e.erc20TokenAddress,
|
|
98
116
|
tokenId: e.tokenId
|
|
99
117
|
});
|
|
100
118
|
v.set(t, v.get(t) ?? []);
|
|
101
|
-
});
|
|
119
|
+
}), console.log("getInputUtxoAndBalancePerToken 5 ensuredTokensWithId", p);
|
|
102
120
|
for (let [t, n] of v) {
|
|
103
121
|
let r = t.split("-")[0], s = Number(t.split("-")[1]), c = e(o), l = c ? r : void 0;
|
|
104
122
|
x(n, i, a, h, c ? d(r).compressedAddress.toLowerCase() : r.toLowerCase(), s, l);
|
|
105
123
|
}
|
|
106
|
-
return v;
|
|
124
|
+
return console.log("getInputUtxoAndBalancePerToken 6 inputUtxosPerToken", v), v;
|
|
107
125
|
};
|
|
108
126
|
//#endregion
|
|
109
127
|
export { v as attemptGetInputUtxosRemotely, S as getInputUtxoAndBalance, C as getInputUtxoAndBalanceOfStuckUtxos, w as getInputUtxoAndBalancePerToken, _ as getInputUtxosRemotely };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
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(`../../utils/erc20tokenFunctions.cjs`),o=require(`../../../data-structures/utxo/Utxo.cjs`),s=require(`../../../error-handling/customErrors/ErrorWithAmount.cjs`);require(`../../../error-handling/customErrors/index.cjs`);const c=require(`../../utils/encodeTokenWithId.cjs`),l=require(`../../utils/solanaMint.utils.cjs`),u=require(`./getInputUtxoAndBalance.cjs`),d=require(`../../../data-structures/TokenDBs/PrivateTokensDB.cjs`),f=require(`../../utils/mutexes.utils.cjs`);var p=async(t,r,i,o,s,c=!1,l,p=!1,m=!1)=>f.getChainBalanceFetchingMutex(r).runExclusive(async()=>{let{inputUtxos:f}=m?await u.getInputUtxoAndBalanceOfStuckUtxos({hinkal:t,chainId:r,ethAddress:s,passedShieldedPrivateKey:i,resetCacheBefore:c,allowRemoteDecryption:l}):await u.getInputUtxoAndBalance({hinkal:t,sliceIfMore6:!1,chainId:r,passedShieldedPrivateKey:i,passedShieldedPublicKey:o,ethAddress:s,resetCacheBefore:c,allowRemoteDecryption:l});p&&e.isExtension&&await d.privateTokensDB.fetchAndUpdatePrivateTokens(f.map(e=>e.getTokenAddress(r)).filter(e=>e!==void 0),r,s);let h=(e.isExtension?await d.privateTokensDB.getPrivateTokens(r,s):a.getErc20TokensForChain(r)).map(e=>({token:e,balance:f.reduce((t,i)=>{let a=e.erc20TokenAddress;return n.caseInsensitiveEqual(a,i.getTokenAddress(r))?t+i.amount:t},0n),timestamp:f.filter(t=>n.caseInsensitiveEqual(t.getTokenAddress(r),e.erc20TokenAddress))[0]?.timeStamp,nfts:f.filter(t=>n.caseInsensitiveEqual(t.getTokenAddress(r),e.erc20TokenAddress)&&t.tokenId!==0).map(e=>({tokenId:e.tokenId,timestamp:e.timeStamp}))})),g=new Map;return h.forEach(e=>{g.set(e.token.erc20TokenAddress.toLowerCase(),e)}),g}),m=async(e,n,d,f,p=6,m=d.map(()=>0),h=!1,g=!1)=>{let{userKeys:_}=e,v=[],y=[];if(d.length===0)return[];let b=await u.getInputUtxoAndBalancePerToken({hinkal:e,sliceIfMore6:!1,ensuredTokensWithId:d.map((e,t)=>({erc20TokenAddress:d[t],tokenId:m[t]})),allowRemoteDecryption:!1,useBlockedUtxos:g,chainId:n})
|
|
1
|
+
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(`../../utils/erc20tokenFunctions.cjs`),o=require(`../../../data-structures/utxo/Utxo.cjs`),s=require(`../../../error-handling/customErrors/ErrorWithAmount.cjs`);require(`../../../error-handling/customErrors/index.cjs`);const c=require(`../../utils/encodeTokenWithId.cjs`),l=require(`../../utils/solanaMint.utils.cjs`),u=require(`./getInputUtxoAndBalance.cjs`),d=require(`../../../data-structures/TokenDBs/PrivateTokensDB.cjs`),f=require(`../../utils/mutexes.utils.cjs`);var p=async(t,r,i,o,s,c=!1,l,p=!1,m=!1)=>f.getChainBalanceFetchingMutex(r).runExclusive(async()=>{let{inputUtxos:f}=m?await u.getInputUtxoAndBalanceOfStuckUtxos({hinkal:t,chainId:r,ethAddress:s,passedShieldedPrivateKey:i,resetCacheBefore:c,allowRemoteDecryption:l}):await u.getInputUtxoAndBalance({hinkal:t,sliceIfMore6:!1,chainId:r,passedShieldedPrivateKey:i,passedShieldedPublicKey:o,ethAddress:s,resetCacheBefore:c,allowRemoteDecryption:l});p&&e.isExtension&&await d.privateTokensDB.fetchAndUpdatePrivateTokens(f.map(e=>e.getTokenAddress(r)).filter(e=>e!==void 0),r,s);let h=(e.isExtension?await d.privateTokensDB.getPrivateTokens(r,s):a.getErc20TokensForChain(r)).map(e=>({token:e,balance:f.reduce((t,i)=>{let a=e.erc20TokenAddress;return n.caseInsensitiveEqual(a,i.getTokenAddress(r))?t+i.amount:t},0n),timestamp:f.filter(t=>n.caseInsensitiveEqual(t.getTokenAddress(r),e.erc20TokenAddress))[0]?.timeStamp,nfts:f.filter(t=>n.caseInsensitiveEqual(t.getTokenAddress(r),e.erc20TokenAddress)&&t.tokenId!==0).map(e=>({tokenId:e.tokenId,timestamp:e.timeStamp}))})),g=new Map;return h.forEach(e=>{g.set(e.token.erc20TokenAddress.toLowerCase(),e)}),g}),m=async(e,n,d,f,p=6,m=d.map(()=>0),h=!1,g=!1)=>{console.log(`addPaddingToUtxos 0 start`,{erc20Addresses:d,amountChanges:f,maxInput:p,tokenIds:m,forceEmptyUtxos:h,useBlockedUtxos:g});let{userKeys:_}=e,v=[],y=[];if(d.length===0)return[];let b=await u.getInputUtxoAndBalancePerToken({hinkal:e,sliceIfMore6:!1,ensuredTokensWithId:d.map((e,t)=>({erc20TokenAddress:d[t],tokenId:m[t]})),allowRemoteDecryption:!1,useBlockedUtxos:g,chainId:n});console.log(`addPaddingToUtxos 1 inputUtxosPerToken`,b);let x=0;for(let e=0;e<d.length;e+=1)if(h===!1){let t=b.get(c.encodeTokenWithId(n,{erc20TokenAddress:d[e],tokenId:m[e]}))??[];if(!t)throw Error(`Missing utxos for token`);x=Math.max(t.length,x),y.push(t)}else y.push([]);return x===2?(console.log(`addPaddingToUtxos 2 inputUtxosArrayToBePadded`,y),y):(y.forEach((e,c)=>{if(e.length>p){let t=e.slice(0,p),o=t.reduce((e,t)=>e+t.amount,0n);if(f[c]<0n&&o<-f[c]){let e=a.getERC20Token(d[c],n),t=e.decimals===18?6:2,l=Number(i.getAmountWithPrecision(o,e,t));throw new s.ErrorWithAmount(l,`${r.DIRECTLY_SHOW_MESSAGE_ERROR_CODES.UTXO_LIMITATIONS}. Please try again with ${l} ${e.symbol}, including gas fees.`)}v.push(t)}else if(e.length<=p){let r=[...e],i=p-e.length;for(;i>0;){--i;let e=t.isSolanaLike(n),a=e?d[c]:void 0,s=e?l.formatMintAddress(d[c]).compressedAddress:d[c];r.push(new o.Utxo({amount:0n,erc20TokenAddress:s,mintAddress:a,shieldedPrivateKey:_.getShieldedPrivateKey(),tokenId:m[c]}))}v.push(r)}}),v)};exports.addPaddingToUtxos=m,exports.getShieldedBalance=p;
|
|
@@ -48,6 +48,14 @@ var g = async (t, r, i, a, s, c = !1, l, u = !1, p = !1) => h(r).runExclusive(as
|
|
|
48
48
|
_.set(e.token.erc20TokenAddress.toLowerCase(), e);
|
|
49
49
|
}), _;
|
|
50
50
|
}), _ = async (e, n, o, d, f = 6, m = o.map(() => 0), h = !1, g = !1) => {
|
|
51
|
+
console.log("addPaddingToUtxos 0 start", {
|
|
52
|
+
erc20Addresses: o,
|
|
53
|
+
amountChanges: d,
|
|
54
|
+
maxInput: f,
|
|
55
|
+
tokenIds: m,
|
|
56
|
+
forceEmptyUtxos: h,
|
|
57
|
+
useBlockedUtxos: g
|
|
58
|
+
});
|
|
51
59
|
let { userKeys: _ } = e, v = [], y = [];
|
|
52
60
|
if (o.length === 0) return [];
|
|
53
61
|
let b = await p({
|
|
@@ -60,7 +68,9 @@ var g = async (t, r, i, a, s, c = !1, l, u = !1, p = !1) => h(r).runExclusive(as
|
|
|
60
68
|
allowRemoteDecryption: !1,
|
|
61
69
|
useBlockedUtxos: g,
|
|
62
70
|
chainId: n
|
|
63
|
-
})
|
|
71
|
+
});
|
|
72
|
+
console.log("addPaddingToUtxos 1 inputUtxosPerToken", b);
|
|
73
|
+
let x = 0;
|
|
64
74
|
for (let e = 0; e < o.length; e += 1) if (h === !1) {
|
|
65
75
|
let t = b.get(l(n, {
|
|
66
76
|
erc20TokenAddress: o[e],
|
|
@@ -69,7 +79,7 @@ var g = async (t, r, i, a, s, c = !1, l, u = !1, p = !1) => h(r).runExclusive(as
|
|
|
69
79
|
if (!t) throw Error("Missing utxos for token");
|
|
70
80
|
x = Math.max(t.length, x), y.push(t);
|
|
71
81
|
} else y.push([]);
|
|
72
|
-
return x === 2 ? y : (y.forEach((e, l) => {
|
|
82
|
+
return x === 2 ? (console.log("addPaddingToUtxos 2 inputUtxosArrayToBePadded", y), y) : (y.forEach((e, l) => {
|
|
73
83
|
if (e.length > f) {
|
|
74
84
|
let t = e.slice(0, f), s = t.reduce((e, t) => e + t.amount, 0n);
|
|
75
85
|
if (d[l] < 0n && s < -d[l]) {
|