UNPKG

@drift-labs/sdk

Version:
32 lines (31 loc) 1.66 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.grpcInsuranceFundStakeAccountSubscriber = void 0; const webSocketInsuranceFundStakeAccountSubscriber_1 = require("./webSocketInsuranceFundStakeAccountSubscriber"); const grpcAccountSubscriber_1 = require("./grpcAccountSubscriber"); class grpcInsuranceFundStakeAccountSubscriber extends webSocketInsuranceFundStakeAccountSubscriber_1.WebSocketInsuranceFundStakeAccountSubscriber { constructor(grpcConfigs, program, insuranceFundStakeAccountPublicKey, resubTimeoutMs) { super(program, insuranceFundStakeAccountPublicKey, resubTimeoutMs); this.grpcConfigs = grpcConfigs; } async subscribe(insuranceFundStakeAccount) { if (this.isSubscribed) { return true; } this.insuranceFundStakeDataAccountSubscriber = await grpcAccountSubscriber_1.grpcAccountSubscriber.create(this.grpcConfigs, 'insuranceFundStake', this.program, this.insuranceFundStakeAccountPublicKey, undefined, { resubTimeoutMs: this.resubTimeoutMs, }); if (insuranceFundStakeAccount) { this.insuranceFundStakeDataAccountSubscriber.setData(insuranceFundStakeAccount); } await this.insuranceFundStakeDataAccountSubscriber.subscribe((data) => { this.eventEmitter.emit('insuranceFundStakeAccountUpdate', data); this.eventEmitter.emit('update'); }); this.eventEmitter.emit('update'); this.isSubscribed = true; return true; } } exports.grpcInsuranceFundStakeAccountSubscriber = grpcInsuranceFundStakeAccountSubscriber;