varaconnect
Version:
SDK to connect WalletConnect with Vara Network
32 lines (31 loc) • 850 B
JavaScript
import { GearApi } from "@gear-js/api";
export class ApiService {
constructor() {
this.api = null;
this.isReady = false;
this.error = null;
}
async initializeApi(providerAddress = "wss://testnet.vara.network") {
try {
const apiInstance = await GearApi.create({ providerAddress });
await apiInstance.isReady;
this.api = apiInstance;
this.isReady = true;
console.log("Gear API is ready");
}
catch (err) {
this.error = err.message;
console.error("Error initializing API:", err.message);
throw err;
}
}
getApi() {
return this.api;
}
getIsReady() {
return this.isReady;
}
getError() {
return this.error;
}
}