declare const global: any; const isBrowser = typeof window !== 'undefined'; const safeWindow = isBrowser ? window : global; import { getProvider, Provider } from './modules/read/getProvider'; import { getNetworks, GetNetworksOutput } from './modules/read/getNetworks'; import { getAccount, Account } from './modules/read/getAccount'; import { getPublicKey, PublicKeyOutput } from './modules/read/getPublicKey'; import { getBalance, GetBalanceArgs, BalanceResults } from './modules/read/getBalance'; import { getStorage, GetStorageArgs, GetStorageOutput } from './modules/read/getStorage'; import { invokeRead, InvokeReadArgs } from './modules/read/invokeRead'; import { verifyMessage, VerifyMessageInput, VerifyMessageOutput } from './modules/read/verifyMessage'; import { getBlock, BlockDetails, GetBlockInputArgs } from './modules/read/getBlock'; import { getBlockHeight, GetBlockHeightInputArgs } from './modules/read/getBlockHeight'; import { getTransaction, TransactionInputArgs, TransactionDetails } from './modules/read/getTransaction'; import { getApplicationLog, ApplicationLog } from './modules/read/getApplicationLog'; import { send, SendArgs, SendOutput } from './modules/write/send'; import { invoke, InvokeArgs, InvokeOutput } from './modules/write/invoke'; import { invokeMulti, InvokeMultiArgs } from './modules/write/invokeMulti'; import { deploy, DeployArgs, DeployOutput } from './modules/write/deploy'; import { signMessage, SignMessageInput, Signature } from './modules/write/signMessage'; import { disconnect } from './modules/disconnect'; import { addEventListener, removeEventListener } from './modules/eventListener'; import { ArgumentDataType, EventName, BLOCKCHAIN } from './constants'; import { initMessaging } from './messaging'; import { methodSelector } from './modules/utils'; class O3dapiNeo { static blockchain = BLOCKCHAIN; isAvailable = Boolean(safeWindow._o3dapi.isAvailable); getProvider = getProvider; getNetworks = getNetworks; getAccount = getAccount; getPublicKey = getPublicKey; getBalance: getBalance = methodSelector(this, 'getBalance', getBalance); getStorage: getStorage = methodSelector(this, 'getStorage', getStorage); invokeRead: invokeRead = methodSelector(this, 'invokeRead', invokeRead); verifyMessage: verifyMessage = methodSelector(this, 'verifyMessage', verifyMessage, false); getBlock: getBlock = methodSelector(this, 'getBlock', getBlock); getBlockHeight: getBlockHeight = methodSelector(this, 'getBlockHeight', getBlockHeight); getTransaction: getTransaction = methodSelector(this, 'getTransaction', getTransaction); getApplicationLog: getApplicationLog = methodSelector(this, 'getApplicationLog', getApplicationLog); send = send; invoke = invoke; invokeMulti = invokeMulti; deploy = deploy; signMessage = signMessage; addEventListener = addEventListener; removeEventListener = removeEventListener; disconnect = disconnect; Constants = { EventName, ArgumentDataType, }; private clientPlugin; constructor(sendMessageMethod, addEventListenerMethod) { initMessaging(sendMessageMethod, addEventListenerMethod); } setClientPlugin(plugin) { this.clientPlugin = plugin; } } export default O3dapiNeo; export type getProvider = () => Promise; export type getNetworks = () => Promise; export type getAccount = () => Promise; export type getPublicKey = () => Promise; export type getBalance = (data: GetBalanceArgs) => Promise; export type getStorage = (data: GetStorageArgs) => Promise; export type invokeRead = (data: InvokeReadArgs) => Promise; export type verifyMessage = (data: VerifyMessageInput) => Promise; export type getBlock = (data: GetBlockInputArgs) => Promise; export type getBlockHeight = (data: GetBlockHeightInputArgs) => Promise; export type getTransaction = (data: TransactionInputArgs) => Promise; export type getApplicationLog = (data: TransactionInputArgs) => Promise; export type send = (data: SendArgs) => Promise; export type invoke = (data: InvokeArgs) => Promise; export type invokeMulti = (data: InvokeMultiArgs) => Promise; export type deploy = (data: DeployArgs) => Promise; export type signMessage = (data: SignMessageInput) => Promise; export type disconnect = () => Promise; export type addEventListener = (event: EventName, callback: Function) => void; export type removeEventListener = (event: EventName) => void;