@sofaws/dapp-core
Version:
A library to hold the main logic for a dapp on the Elrond Network
3 lines (2 loc) • 1.98 kB
JavaScript
import{h as a,s as T}from"./chunk-ZR7YL3KO.js";import{k as c}from"./chunk-P6M5SGWP.js";import{j as t,m as i}from"./chunk-HBP5N4FR.js";i();T();c();import{ExtensionProvider as m}from"@elrondnetwork/erdjs-extension-provider";import{HWProvider as d}from"@elrondnetwork/erdjs-hw-provider";import{WalletConnectProvider as g,WalletConnectV2Provider as w}from"@elrondnetwork/erdjs-wallet-connect-provider";import{WalletProvider as l}from"@elrondnetwork/erdjs-web-wallet-provider";var P="/dapp/init",U=e=>{switch(e==null?void 0:e.constructor){case l:return"wallet";case g:return"walletconnect";case w:return"walletconnectv2";case d:return"ledger";case m:return"extension";case s:return"";default:return"extra"}},I=e=>new l(`${e}${P}`),y=e=>t(void 0,null,function*(){if(!e.isInitialized())throw new Error("Unable to get version. Provider not initialized");let n=e.hwApp,{contractData:o,version:p}=yield n.getAppConfiguration();return{version:p,dataEnabled:o===a}}),r=e=>`Unable to perform ${e}, Provider not initialized`,s=class{init(){return Promise.resolve(!1)}login(n){throw new Error(r(`login with options: ${n}`))}logout(n){throw new Error(r(`logout with options: ${n}`))}getAddress(){throw new Error(r("getAddress"))}isInitialized(){return!1}isConnected(){return Promise.resolve(!1)}sendTransaction(n,o){throw new Error(r(`sendTransaction with transactions: ${n} options: ${o}`))}signTransaction(n,o){throw new Error(r(`signTransaction with transactions: ${n} options: ${o}`))}signTransactions(n,o){throw new Error(r(`signTransactions with transactions: ${n} options: ${o}`))}signMessage(n,o){throw new Error(r(`signTransactions with ${n} and options ${o}`))}sendCustomMessage({method:n,params:o}){throw new Error(r(`sendCustomMessage with method: ${n} params: ${o}`))}sendCustomRequest(n){throw new Error(r(`sendSessionEvent with options: ${n}`))}ping(){return Promise.resolve(!1)}},D=new s;export{P as a,U as b,I as c,y as d,s as e,D as f};
//# sourceMappingURL=chunk-3OBZU2S7.js.map