PHP WebShell
Текущая директория: /opt/BitGoJS/node_modules/@aptos-labs/ts-sdk/dist/esm
Просмотр файла: chunk-4OV2A6PJ.mjs
import{a as K}from"./chunk-N62NUAHT.mjs";import{c as d}from"./chunk-2KSMV5KD.mjs";import{d as b,e as v,f as q,g as O,i as P,j as S,k as M,u as G}from"./chunk-VHNX2NUR.mjs";import{a as f}from"./chunk-ELXJ5A4B.mjs";import{a as k}from"./chunk-6ZOVTYLJ.mjs";import{a as T}from"./chunk-JMPHD4BP.mjs";import{b as C}from"./chunk-7N7FEBZA.mjs";import{c as _}from"./chunk-H3C3VTHS.mjs";import{a as g}from"./chunk-AKIO3OIT.mjs";import{b as i}from"./chunk-JNO7KPMG.mjs";import{a as w}from"./chunk-HBIDHQ2M.mjs";import{b as A,d as p}from"./chunk-372SLYVR.mjs";import{e as h}from"./chunk-F45G3GP3.mjs";import{e as y}from"./chunk-J7PJSK3J.mjs";async function R(e){let{aptosConfig:n,accountAddress:t}=e,{data:o}=await A({aptosConfig:n,originMethod:"getInfo",path:`accounts/${i.from(t).toString()}`});return o}async function Z(e){let{aptosConfig:n,accountAddress:t,options:o}=e;return p({aptosConfig:n,originMethod:"getModules",path:`accounts/${i.from(t).toString()}/modules`,params:{ledger_version:o?.ledgerVersion,start:o?.offset,limit:o?.limit??1e3}})}async function oo(e){return e.options?.ledgerVersion!==void 0?Q(e):w(async()=>Q(e),`module-${e.accountAddress}-${e.moduleName}`,1e3*60*5)()}async function Q(e){let{aptosConfig:n,accountAddress:t,moduleName:o,options:r}=e,{data:s}=await A({aptosConfig:n,originMethod:"getModule",path:`accounts/${i.from(t).toString()}/module/${o}`,params:{ledger_version:r?.ledgerVersion}});return s}async function eo(e){let{aptosConfig:n,accountAddress:t,options:o}=e;return p({aptosConfig:n,originMethod:"getTransactions",path:`accounts/${i.from(t).toString()}/transactions`,params:{start:o?.offset,limit:o?.limit}})}async function to(e){let{aptosConfig:n,accountAddress:t,options:o}=e;return p({aptosConfig:n,originMethod:"getResources",path:`accounts/${i.from(t).toString()}/resources`,params:{ledger_version:o?.ledgerVersion,start:o?.offset,limit:o?.limit??999}})}async function x(e){let{aptosConfig:n,accountAddress:t,resourceType:o,options:r}=e,{data:s}=await A({aptosConfig:n,originMethod:"getResource",path:`accounts/${i.from(t).toString()}/resource/${o}`,params:{ledger_version:r?.ledgerVersion}});return s.data}async function L(e){let{aptosConfig:n,authenticationKey:t,options:o}=e,r=await x({aptosConfig:n,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:o}),{address_map:{handle:s}}=r,c=i.from(t);try{let a=await K({aptosConfig:n,handle:s,data:{key:c.toString(),key_type:"address",value_type:"address"},options:o});return i.from(a)}catch(a){if(a instanceof h&&a.data.error_code==="table_item_not_found")return c;throw a}}async function no(e){let{aptosConfig:n,accountAddress:t}=e,r={owner_address:{_eq:i.from(t).toStringLong()},amount:{_gt:0}},c=await d({aptosConfig:n,query:{query:S,variables:{where_condition:r}},originMethod:"getAccountTokensCount"});return c.current_token_ownerships_v2_aggregate.aggregate?c.current_token_ownerships_v2_aggregate.aggregate.count:0}async function ro(e){let{aptosConfig:n,accountAddress:t,options:o}=e,s={owner_address:{_eq:i.from(t).toStringLong()},amount:{_gt:0}};o?.tokenStandard&&(s.token_standard={_eq:o?.tokenStandard});let c={query:O,variables:{where_condition:s,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function so(e){let{aptosConfig:n,accountAddress:t,collectionAddress:o,options:r}=e,s=i.from(t).toStringLong(),c=i.from(o).toStringLong(),a={owner_address:{_eq:s},current_token_data:{collection_id:{_eq:c}},amount:{_gt:0}};r?.tokenStandard&&(a.token_standard={_eq:r?.tokenStandard});let u={query:P,variables:{where_condition:a,offset:r?.offset,limit:r?.limit,order_by:r?.orderBy}};return(await d({aptosConfig:n,query:u,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function co(e){let{aptosConfig:n,accountAddress:t,options:o}=e,s={owner_address:{_eq:i.from(t).toStringLong()}};o?.tokenStandard&&(s.current_collection={token_standard:{_eq:o?.tokenStandard}});let c={query:q,variables:{where_condition:s,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function io(e){let{aptosConfig:n,accountAddress:t}=e,o=i.from(t).toStringLong(),s=await d({aptosConfig:n,query:{query:M,variables:{address:o}},originMethod:"getAccountTransactionsCount"});return s.account_transactions_aggregate.aggregate?s.account_transactions_aggregate.aggregate.count:0}async function ao(e){let{aptosConfig:n,accountAddress:t,coinType:o,faMetadataAddress:r}=e,s=o,c;if(o!==void 0&&r!==void 0)c=i.from(r).toStringLong();else if(o!==void 0&&r===void 0)o===y?c=i.A.toStringLong():c=k(i.A,o).toStringLong();else if(o===void 0&&r!==void 0){let m=i.from(r);c=m.toStringLong(),m===i.A&&(s=y)}else throw new Error("Either coinType, fungibleAssetAddress, or both must be provided");let a=i.from(t).toStringLong(),u={asset_type:{_eq:c}};s!==void 0&&(u={asset_type:{_in:[s,c]}});let l=await B({aptosConfig:n,accountAddress:a,options:{where:u}});return l[0]?l[0].amount:0}async function B(e){let{aptosConfig:n,accountAddress:t,options:o}=e,r=i.from(t).toStringLong(),s={...o?.where,owner_address:{_eq:r}},c={query:v,variables:{where_condition:s,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function uo(e){let{aptosConfig:n,accountAddress:t}=e,o=i.from(t).toStringLong(),s=await d({aptosConfig:n,query:{query:b,variables:{address:o}},originMethod:"getAccountCoinsCount"});if(!s.current_fungible_asset_balances_aggregate.aggregate)throw Error("Failed to get the count of account coins");return s.current_fungible_asset_balances_aggregate.aggregate.count}async function go(e){let{aptosConfig:n,accountAddress:t,options:o}=e,s={owner_address:{_eq:i.from(t).toStringLong()}},c={query:G,variables:{where_condition:s,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountOwnedObjects"})).current_objects}async function Ao(e){let{aptosConfig:n,privateKey:t}=e,o=new T(t.publicKey());if(t instanceof C){let s=g.fromPublicKey({publicKey:o}).derivedAddress();return f.fromPrivateKey({privateKey:t,address:s})}if(t instanceof _){let r=g.fromPublicKey({publicKey:o});if(await I({authKey:r,aptosConfig:n})){let u=r.derivedAddress();return f.fromPrivateKey({privateKey:t,address:u,legacy:!1})}let c=g.fromPublicKey({publicKey:o.publicKey});if(await I({authKey:c,aptosConfig:n})){let u=c.derivedAddress();return f.fromPrivateKey({privateKey:t,address:u,legacy:!0})}}throw new Error(`Can't derive account from private key ${t}`)}async function I(e){let{aptosConfig:n,authKey:t}=e,o=await L({aptosConfig:n,authenticationKey:t.derivedAddress()});try{return await R({aptosConfig:n,accountAddress:o}),!0}catch(r){if(r.status===404)return!1;throw new Error(`Error while looking for an account info ${o.toString()}`)}}export{R as a,Z as b,oo as c,eo as d,to as e,x as f,L as g,no as h,ro as i,so as j,co as k,io as l,ao as m,B as n,uo as o,go as p,Ao as q,I as r};
//# sourceMappingURL=chunk-4OV2A6PJ.mjs.mapВыполнить команду
Для локальной разработки. Не используйте в интернете!