require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants/chains.constants.cjs`);require(`../../constants/protocol.constants.cjs`);const t=require(`../../functions/utils/addresses.cjs`),n=require(`../../error-handling/error-codes.constants.cjs`),r=require(`../../API/admin-calls.cjs`),i=require(`../../functions/utils/solanaMint.utils.cjs`),a=require(`../../functions/utils/token-check.utils.cjs`),o=require(`../../functions/pre-transaction/solana.cjs`),s=require(`../../functions/utils/create-provider.cjs`),c=require(`../../functions/pre-transaction/constructAdminData.cjs`),l=require(`../AccountActions/AccountActions.cjs`),u=require(`../../functions/pre-transaction/sendV0Transaction.cjs`);let d=require(`@solana/web3.js`),f=require(`@coral-xyz/anchor`),p=require(`@solana/spl-token`);var m=async({program:e,mintPublicKey:t,mintAddressString:n,tokenAmount:r,anchorStealthStructure:i,senderPublickey:a,originalDeployer:o,storageAccount:s,storageVault:c})=>{let l=new f.BN(r.toString()),u=n===`11111111111111111111111111111111`?null:t,d=n===`11111111111111111111111111111111`?null:void 0;return e.methods.prooflessDeposit(l,i).accounts({mint:u,signer:a,signerAta:d,originalDeployer:o,storageAccount:s,storageVault:c,storageVaultAta:d}).instruction()},h=async(r,a,c,u,f,h)=>{let g=h??r.getRecipientInfo();if(!t.isValidPrivateAddress(g))throw Error(n.transactionErrorCodes.RECIPIENT_FORMAT_INCORRECT);let _=l.AccountActions.getAddressFromSubAccount(a,f);if(!_)throw Error(`Public account address is not available`);let{hinkalIdl:v,hinkalAddress:y,originalDeployer:b}=e.networkRegistry[a].contractData;if(!v)throw Error(`No IDL configured for Solana program on this network`);if(!b)throw Error(`missing original deployer`);let x=r.getSolanaProgram(v),S=new d.PublicKey(b),C=new d.PublicKey(y),w=new d.PublicKey(_),{erc20TokenAddress:T}=c,{fetchRpcUrl:E}=e.networkRegistry[a];if(!E)throw Error(`RPC URL not found for the specified chain ID`);let D=s.createCustomSolanaConnection(E),{mintPublicKey:O}=i.formatMintAddress(T),k=O.toString(),A=o.getStorageAccountPublicKey(C,S),j=o.getStorageVaultPublicKey(C,S),M=await m({program:x,mintPublicKey:O,mintAddressString:k,tokenAmount:u,anchorStealthStructure:o.buildAnchorStealthAddressStructure(t.constructStealthAddressStructure(g)),senderPublickey:w,originalDeployer:S,storageAccount:A,storageVault:j}),N=c.is2022Program?p.TOKEN_2022_PROGRAM_ID:p.TOKEN_PROGRAM_ID;return{connection:D,senderAddress:_,senderPublickey:w,instructions:[M],storageAccount:A,programId:N}},g=async(e,t,n,i,o,s)=>{if(!i)throw Error(`subAccount is required`);let l=a.validateAndGetChainId([t]),[{connection:d,senderPublickey:f,instructions:p},m]=await Promise.all([h(e,l,t,n,i,o),e.getEthereumAddress()]),g=await u.sendProxyV0Transaction({connection:d,chainId:l,subAccount:i,payerPublicKey:f,instructions:p});return r.emitTxPublicData(c.constructAdminData(s,l,[t.erc20TokenAddress],[n],m)),g},_=async(e,t,n,r,i)=>{let{connection:o,senderPublickey:s,instructions:c}=await h(e,a.validateAndGetChainId([t]),t,n,r,i);return u.serializeProxyV0Transaction(o,s,c)};exports.getSolanaProxyShieldSerializedTransaction=_,exports.hinkalSolanaProxyShield=g;