difftreelog
fix add wsEndpoint to playgrnd helpers
in: master
2 files changed
tests/src/util/playgrounds/unique.dev.tsdiffbeforeafterboth117 });117 });118 await this.api.isReadyOrError;118 await this.api.isReadyOrError;119 this.network = await UniqueHelper.detectNetwork(this.api);119 this.network = await UniqueHelper.detectNetwork(this.api);120 this.wsEndpoint = wsEndpoint;120 }121 }121}122}122123339 'chainql', 340 'chainql', 340 [341 [341 `--tla-code=data=${kvStr}`,342 `--tla-code=data=${kvStr}`,342 '-e', 'function(data) cql.dump(cql.chain("wss://ws-opal.unique.network:443").latest._meta, data, {omit_empty:true})',343 '-e', `function(data) cql.dump(cql.chain("${this.helper.getEndpoint()}").latest._meta, data, {omit_empty:true})`,343 ],344 ],344 );345 );345346tests/src/util/playgrounds/unique.tsdiffbeforeafterboth--- a/tests/src/util/playgrounds/unique.ts
+++ b/tests/src/util/playgrounds/unique.ts
@@ -371,6 +371,7 @@
api: ApiPromise | null;
forcedNetwork: TNetworks | null;
network: TNetworks | null;
+ wsEndpoint: string | null;
chainLog: IUniqueHelperLog[];
children: ChainHelperBase[];
address: AddressGroup;
@@ -386,6 +387,7 @@
this.api = null;
this.forcedNetwork = null;
this.network = null;
+ this.wsEndpoint = null;
this.chainLog = [];
this.children = [];
this.address = new AddressGroup(this);
@@ -405,6 +407,11 @@
return newHelper;
}
+ getEndpoint(): string {
+ if (this.wsEndpoint === null) throw Error('No connection was established');
+ return this.wsEndpoint;
+ }
+
getApi(): ApiPromise {
if(this.api === null) throw Error('API not initialized');
return this.api;
@@ -436,6 +443,7 @@
async connect(wsEndpoint: string, listeners?: IApiListeners) {
if (this.api !== null) throw Error('Already connected');
const {api, network} = await ChainHelperBase.createConnection(wsEndpoint, listeners, this.forcedNetwork);
+ this.wsEndpoint = wsEndpoint;
this.api = api;
this.network = network;
}