@broxus/js-core
Version:
MobX-based JavaScript Core library
25 lines (24 loc) • 768 B
JavaScript
import { EverscaleStandaloneClient } from 'everscale-standalone-client';
export class StandaloneClientAdapter {
properties;
_provider;
constructor(properties) {
this.properties = properties;
//
}
async getProvider() {
if (this._provider) {
return this._provider;
}
const { connection = 'mainnetJrpc' } = { ...this.properties };
const connectionProperties = typeof connection === 'object' ? { ...connection } : connection;
this._provider = await EverscaleStandaloneClient.create({
...this.properties,
connection: connectionProperties,
});
return this._provider;
}
async hasProvider() {
return this._provider != null;
}
}