@@ -344,6 +344,10 @@ export default class FireFly extends HttpBase {
344
344
return this . getOne < FireFlyTokenPoolResponse > ( `/tokens/pools/${ nameOrId } ` , options ) ;
345
345
}
346
346
347
+ async deleteTokenPool ( nameOrId : string , options ?: FireFlyDeleteOptions ) {
348
+ await this . deleteOne ( `/tokens/pools/${ nameOrId } ` , options ) ;
349
+ }
350
+
347
351
mintTokens ( transfer : FireFlyTokenMintRequest , options ?: FireFlyCreateOptions ) {
348
352
return this . createOne < FireFlyTokenTransferResponse > ( '/tokens/mint' , transfer , options ) ;
349
353
}
@@ -608,26 +612,34 @@ export default class FireFly extends HttpBase {
608
612
subscriptions : string | string [ ] | FireFlySubscriptionBase ,
609
613
callback : FireFlyWebSocketCallback ,
610
614
socketOptions ?: WebSocket . ClientOptions | http . ClientRequestArgs ,
611
- afterConnect ?: FireFlyWebSocketConnectCallback ,
615
+ fireflySocketOptions ?: Partial < FireFlyWebSocketOptions > | FireFlyWebSocketConnectCallback ,
612
616
) : FireFlyWebSocket {
617
+ if ( typeof fireflySocketOptions === 'function' ) {
618
+ // Legacy compatibility (afterConnect callback passed as 4th arg)
619
+ fireflySocketOptions = < FireFlyWebSocketOptions > {
620
+ afterConnect : fireflySocketOptions ,
621
+ } ;
622
+ }
613
623
const options : FireFlyWebSocketOptions = {
614
624
host : this . options . websocket . host ,
615
625
namespace : this . options . namespace ,
616
626
username : this . options . username ,
617
627
password : this . options . password ,
618
- subscriptions : [ ] ,
619
- autoack : false ,
620
628
reconnectDelay : this . options . websocket . reconnectDelay ,
621
629
heartbeatInterval : this . options . websocket . heartbeatInterval ,
622
- socketOptions : socketOptions ,
623
- afterConnect : afterConnect ,
630
+ autoack : false ,
631
+ ...fireflySocketOptions ,
632
+ socketOptions,
633
+ subscriptions : [ ] ,
624
634
} ;
625
635
626
636
const handler : FireFlyWebSocketCallback = ( socket , event ) => {
627
637
this . queue = this . queue . finally ( ( ) => callback ( socket , event ) ) ;
628
- this . queue . then ( ( ) => {
629
- socket . ack ( event ) ;
630
- } ) ;
638
+ if ( ! options . noack ) {
639
+ this . queue . then ( ( ) => {
640
+ socket . ack ( event ) ;
641
+ } ) ;
642
+ }
631
643
} ;
632
644
633
645
if ( Array . isArray ( subscriptions ) ) {
0 commit comments