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.tsdiffbeforeafterboth371 api: ApiPromise | null;371 api: ApiPromise | null;372 forcedNetwork: TNetworks | null;372 forcedNetwork: TNetworks | null;373 network: TNetworks | null;373 network: TNetworks | null;374 wsEndpoint: string | null;374 chainLog: IUniqueHelperLog[];375 chainLog: IUniqueHelperLog[];375 children: ChainHelperBase[];376 children: ChainHelperBase[];376 address: AddressGroup;377 address: AddressGroup;386 this.api = null;387 this.api = null;387 this.forcedNetwork = null;388 this.forcedNetwork = null;388 this.network = null;389 this.network = null;390 this.wsEndpoint = null;389 this.chainLog = [];391 this.chainLog = [];390 this.children = [];392 this.children = [];391 this.address = new AddressGroup(this);393 this.address = new AddressGroup(this);405 return newHelper;407 return newHelper;406 }408 }409410 getEndpoint(): string {411 if (this.wsEndpoint === null) throw Error('No connection was established');412 return this.wsEndpoint;413 }407414408 getApi(): ApiPromise {415 getApi(): ApiPromise {409 if(this.api === null) throw Error('API not initialized');416 if(this.api === null) throw Error('API not initialized');436 async connect(wsEndpoint: string, listeners?: IApiListeners) {443 async connect(wsEndpoint: string, listeners?: IApiListeners) {437 if (this.api !== null) throw Error('Already connected');444 if (this.api !== null) throw Error('Already connected');438 const {api, network} = await ChainHelperBase.createConnection(wsEndpoint, listeners, this.forcedNetwork);445 const {api, network} = await ChainHelperBase.createConnection(wsEndpoint, listeners, this.forcedNetwork);446 this.wsEndpoint = wsEndpoint;439 this.api = api;447 this.api = api;440 this.network = network;448 this.network = network;441 }449 }