PHP WebShell
Текущая директория: /opt/BitGoJS/node_modules/@aptos-labs/ts-sdk/dist/esm
Просмотр файла: chunk-LPVGVTWT.mjs
import{a as w,c as cn,d as un,e as $}from"./chunk-46O23AOD.mjs";import{r as sn,u as f}from"./chunk-BAEIZAP7.mjs";import{a as rn}from"./chunk-4OV2A6PJ.mjs";import{b as on}from"./chunk-WFK3XRQX.mjs";import{a as an}from"./chunk-2KSMV5KD.mjs";import{a as en}from"./chunk-G4KAHJXB.mjs";import{a as y}from"./chunk-F2WY2DEY.mjs";import{a as tn}from"./chunk-7T26VA2W.mjs";import{a as Q,c as Y,d as nn}from"./chunk-XOLU6UP3.mjs";import{c as X,d as z,e as L,f as F,g as Z,h as j,i as J}from"./chunk-333QBK32.mjs";import{b as D,d as R,e as M,f as T}from"./chunk-IK2NYNKG.mjs";import{a as q,b as l,d as h,e as B,f as E}from"./chunk-HMMNQFVM.mjs";import{a as H}from"./chunk-OPO5EYF7.mjs";import{a as O,b as V}from"./chunk-TCXYTPUR.mjs";import{a as x,b as p}from"./chunk-JMPHD4BP.mjs";import{a as G}from"./chunk-7N7FEBZA.mjs";import{a as v}from"./chunk-U3T4ZT7B.mjs";import{i as b,j as k}from"./chunk-PXMNAP2Q.mjs";import{b as N,d as W}from"./chunk-H3C3VTHS.mjs";import{b as u}from"./chunk-JNO7KPMG.mjs";import{a as C}from"./chunk-HBIDHQ2M.mjs";import{a as _}from"./chunk-CDEYH77E.mjs";import{g as S}from"./chunk-D3OEQLUE.mjs";import{b as K,c as U}from"./chunk-J7PJSK3J.mjs";import{b as P}from"./chunk-SPRNSFUV.mjs";import{sha3_256 as gn}from"@noble/hashes/sha3";async function Hn(n){if(sn(n))return hn(n);let{moduleAddress:e,moduleName:t,functionName:i}=f(n.function),r=await An({key:"entry-function",moduleAddress:e,moduleName:t,functionName:i,aptosConfig:n.aptosConfig,abi:n.abi,fetch:cn});return pn({...n,abi:r})}function pn(n){let e=n.abi,{moduleAddress:t,moduleName:i,functionName:r}=f(n.function),a=w(n.typeArguments);if(a.length!==e.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${e.typeParameters.length}, received ${a.length}`);let o=n.functionArguments.map((s,d)=>$(n.function,e,s,d,a));if(o.length!==e.parameters.length)throw new Error(`Too few arguments for '${t}::${i}::${r}', expected ${e.parameters.length} but got ${o.length}`);let c=F.build(`${t}::${i}`,r,a,o);if("multisigAddress"in n){let s=u.from(n.multisigAddress);return new L(new j(s,new J(c)))}return new z(c)}async function Xn(n){let{moduleAddress:e,moduleName:t,functionName:i}=f(n.function),r=await An({key:"view-function",moduleAddress:e,moduleName:t,functionName:i,aptosConfig:n.aptosConfig,abi:n.abi,fetch:un});return ln({abi:r,...n})}function ln(n){let e=n.abi,{moduleAddress:t,moduleName:i,functionName:r}=f(n.function),a=w(n.typeArguments);if(a.length!==e.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${e.typeParameters.length}, received ${a.length}`);let o=n?.functionArguments?.map((c,s)=>$(n.function,e,c,s,a))??[];if(o.length!==e.parameters.length)throw new Error(`Too few arguments for '${t}::${i}::${r}', expected ${e.parameters.length} but got ${o.length}`);return F.build(`${t}::${i}`,r,a,o)}function hn(n){return new X(new Z(P.fromHexInput(n.bytecode).toUint8Array(),w(n.typeArguments),n.functionArguments))}async function Tn(n){let{aptosConfig:e,sender:t,payload:i,options:r,feePayerAddress:a}=n,o=async()=>S[e.network]?{chainId:S[e.network]}:{chainId:(await an({aptosConfig:e})).chain_id},c=async()=>r?.gasUnitPrice?{gasEstimate:r.gasUnitPrice}:{gasEstimate:(await on({aptosConfig:e})).gas_estimate},s=async()=>{let g=async()=>r?.accountSequenceNumber!==void 0?r.accountSequenceNumber:(await rn({aptosConfig:e,accountAddress:t})).sequence_number;if(a&&u.from(a).equals(u.ZERO))try{return await g()}catch{return 0}else return g()},[{chainId:d},{gasEstimate:m},I]=await Promise.all([o(),c(),s()]),{maxGasAmount:mn,gasUnitPrice:yn,expireTimestamp:fn}={maxGasAmount:r?.maxGasAmount?BigInt(r.maxGasAmount):BigInt(2e5),gasUnitPrice:r?.gasUnitPrice??BigInt(m),expireTimestamp:r?.expireTimestamp??BigInt(Math.floor(Date.now()/1e3)+20)};return new Q(u.from(t),BigInt(I),i,BigInt(mn),BigInt(yn),BigInt(fn),new H(d))}async function zn(n){let{aptosConfig:e,sender:t,payload:i,options:r,feePayerAddress:a}=n,o=await Tn({aptosConfig:e,sender:t,payload:i,options:r,feePayerAddress:a});if("secondarySignerAddresses"in n){let c=n.secondarySignerAddresses?.map(s=>u.from(s))??[];return new en(o,c,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}return new tn(o,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}function Ln(n){let{signerPublicKey:e,transaction:t,secondarySignersPublicKeys:i,feePayerPublicKey:r}=n,a=A(e);if(t.feePayerAddress){let c=new nn(t.rawTransaction,t.secondarySignerAddresses??[],t.feePayerAddress),s=[];t.secondarySignerAddresses&&(i?s=i.map(I=>A(I)):s=Array.from({length:t.secondarySignerAddresses.length},()=>A(void 0)));let d=A(r),m=new M(a,t.secondarySignerAddresses??[],s,{address:t.feePayerAddress,authenticator:d});return new y(c.raw_txn,m).bcsToBytes()}if(t.secondarySignerAddresses){let c=new Y(t.rawTransaction,t.secondarySignerAddresses),s=[];i?s=i.map(m=>A(m)):s=Array.from({length:t.secondarySignerAddresses.length},()=>A(void 0));let d=new R(a,t.secondarySignerAddresses,s);return new y(c.raw_txn,d).bcsToBytes()}let o;if(a instanceof l)o=new D(a.public_key,a.signature);else if(a instanceof h||a instanceof B)o=new T(a);else if(a instanceof E)o=new T(a);else throw new Error("Invalid public key");return new y(t.rawTransaction,o).bcsToBytes()}function A(n){if(!n)return new E;let t=b.isInstance(n)||v.isInstance(n)||G.isInstance(n)?new x(n):n,i=new W(new Uint8Array(64));if(N.isInstance(t))return new l(t,i);if(x.isInstance(t))return b.isInstance(t.publicKey)?new h(t,new p(k.getSimulationSignature())):new h(t,new p(i));if(O.isInstance(t))return new B(t,new V({signatures:t.publicKeys.map(()=>new p(i)),bitmap:t.createBitmap({bits:Array(t.publicKeys.length).fill(0).map((r,a)=>a)})}));throw new Error("Unsupported PublicKey used for simulations")}function wn(n){let{transaction:e,feePayerAuthenticator:t,additionalSignersAuthenticators:i}=n,r=_(q,n.senderAuthenticator),a;if(e.feePayerAddress){if(!t)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");a=new M(r,e.secondarySignerAddresses??[],i??[],{address:e.feePayerAddress,authenticator:t})}else if(e.secondarySignerAddresses){if(!i)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");a=new R(r,e.secondarySignerAddresses,i)}else r instanceof l?a=new D(r.public_key,r.signature):a=new T(r);return new y(e.rawTransaction,a).bcsToBytes()}function dn(n){let e=gn.create();for(let t of n)e.update(t);return e.digest()}var In=dn(["APTOS::Transaction"]);function Zn(n){let e=wn(n);return new P(dn([In,new Uint8Array([0]),e])).toString()}async function An({key:n,moduleAddress:e,moduleName:t,functionName:i,aptosConfig:r,abi:a,fetch:o}){return a!==void 0?a:C(async()=>o(e,t,i,r),`${n}-${r.network}-${e}-${t}-${i}`,1e3*60*5)()}export{Hn as a,pn as b,Xn as c,ln as d,Tn as e,zn as f,Ln as g,A as h,wn as i,dn as j,Zn as k};
//# sourceMappingURL=chunk-LPVGVTWT.mjs.mapВыполнить команду
Для локальной разработки. Не используйте в интернете!