PHP WebShell
Текущая директория: /opt/BitGoJS/node_modules/@aptos-labs/ts-sdk/dist/esm
Просмотр файла: chunk-46O23AOD.mjs
import{c as l}from"./chunk-AOROYJ74.mjs";import{a as k,b as c,d as A,e as g,f as P,g as z,h as D,i as m,j as L,l as R,m as X,n as q,o as H,p as J,q as K,s as i,t as Q}from"./chunk-BAEIZAP7.mjs";import{c as j}from"./chunk-4OV2A6PJ.mjs";import{b as S,c as I,d as x,e as M,f as O,g as C,h as _,i as V,n as G}from"./chunk-T6ADNZE5.mjs";import{b as d}from"./chunk-JNO7KPMG.mjs";import{a as y,c as F,d as s}from"./chunk-ZMMLM6ZJ.mjs";import{a as w,b as h,c as B,d as E,e as v,f as $,g as b}from"./chunk-42H7WETG.mjs";var Y=new TextEncoder;function sn(n){return n?.map(e=>c(e)?l(e):e)??[]}async function W(n,e,t,u){let r=await j({aptosConfig:u,accountAddress:n,moduleName:e});if(r.abi)return r.abi.exposed_functions.find(o=>o.name===t)}async function fn(n,e,t,u){let r=await W(n,e,t,u);if(!r)throw new Error(`Could not find entry function ABI for '${n}::${e}::${t}'`);if(!r.is_entry)throw new Error(`'${n}::${e}::${t}' is not an entry function`);let o=Q(r),T=[];for(let f=o;f<r.params.length;f+=1)T.push(l(r.params[f],{allowGenerics:!0}));return{signers:o,typeParameters:r.generic_type_params,parameters:T}}async function on(n,e,t,u){let r=await W(n,e,t,u);if(!r)throw new Error(`Could not find view function ABI for '${n}::${e}::${t}'`);if(!r.is_view)throw new Error(`'${n}::${e}::${t}' is not an view function`);let o=[];for(let f=0;f<r.params.length;f+=1)o.push(l(r.params[f],{allowGenerics:!0}));let T=[];for(let f=0;f<r.return.length;f+=1)T.push(l(r.return[f],{allowGenerics:!0}));return{typeParameters:r.generic_type_params,parameters:o,returnTypes:T}}function cn(n,e,t,u,r){if(u>=e.parameters.length)throw new Error(`Too many arguments for '${n}', expected ${e.parameters.length}`);let o=e.parameters[u];return U(t,o,u,r)}function U(n,e,t,u){return z(n)?(p(e,n,t),n):Z(n,e,t,u)}function Z(n,e,t,u){if(e.isBool()){if(k(n))return new w(n);if(c(n)){if(n==="true")return new w(!0);if(n==="false")return new w(!1)}i("boolean",t)}if(e.isAddress()){if(c(n))return d.fromString(n);i("string | AccountAddress",t)}if(e.isU8()){let r=A(n);if(r!==void 0)return new h(r);i("number | string",t)}if(e.isU16()){let r=A(n);if(r!==void 0)return new B(r);i("number | string",t)}if(e.isU32()){let r=A(n);if(r!==void 0)return new E(r);i("number | string",t)}if(e.isU64()){if(g(n))return new v(BigInt(n));i("bigint | number | string",t)}if(e.isU128()){if(g(n))return new $(BigInt(n));i("bigint | number | string",t)}if(e.isU256()){if(g(n))return new b(BigInt(n));i("bigint | number | string",t)}if(e.isGeneric()){let r=e.value;if(r<0||r>=u.length)throw new Error(`Generic argument ${e.toString()} is invalid for argument ${t}`);return U(n,u[r],t,u)}if(e.isVector()){if(e.value.isU8()){if(c(n))return y.U8(Y.encode(n));if(n instanceof Uint8Array)return y.U8(n);if(n instanceof ArrayBuffer)return y.U8(new Uint8Array(n))}if(Array.isArray(n))return new y(n.map(r=>U(r,e.value,t,u)));throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}if(e.isStruct()){if(e.isString()){if(c(n))return new F(n);i("string",t)}if(e.isObject()){if(c(n))return d.fromString(n);i("string | AccountAddress",t)}if(e.isOption()){if(P(n)){let r=e.value.typeArgs[0];return r instanceof S?new s(null):r instanceof V?new s(null):r instanceof I?new s(null):r instanceof x?new s(null):r instanceof M?new s(null):r instanceof O?new s(null):r instanceof C?new s(null):r instanceof _?new s(null):new s(null)}return new s(U(n,e.value.typeArgs[0],t,u))}throw new Error(`Unsupported struct input type for argument ${t}, type '${e.toString()}'`)}throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}function p(n,e,t){if(n.isBool()){if(D(e))return;i("Bool",t)}if(n.isAddress()){if(m(e))return;i("AccountAddress",t)}if(n.isU8()){if(R(e))return;i("U8",t)}if(n.isU16()){if(X(e))return;i("U16",t)}if(n.isU32()){if(q(e))return;i("U32",t)}if(n.isU64()){if(H(e))return;i("U64",t)}if(n.isU128()){if(J(e))return;i("U128",t)}if(n.isU256()){if(K(e))return;i("U256",t)}if(n.isVector()){if(e instanceof y){e.values.length>0&&p(n.value,e.values[0],t);return}i("MoveVector",t)}if(n instanceof G){if(n.isString()){if(L(e))return;i("MoveString",t)}if(n.isObject()){if(m(e))return;i("AccountAddress",t)}if(n.isOption()){if(e instanceof s){e.value!==void 0&&p(n.value.typeArgs[0],e.value,t);return}i("MoveOption",t)}}throw new Error(`Type mismatch for argument ${t}, expected '${n.toString()}'`)}export{sn as a,W as b,fn as c,on as d,cn as e,U as f};
//# sourceMappingURL=chunk-46O23AOD.mjs.mapВыполнить команду
Для локальной разработки. Не используйте в интернете!