yamata-adapter-sdk 1.0.21 → 1.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +85 -0
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +85 -0
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/index.umd.js +85 -0
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -28539,6 +28539,73 @@ class WebSocketClient {
|
|
|
28539
28539
|
});
|
|
28540
28540
|
}
|
|
28541
28541
|
|
|
28542
|
+
/**
|
|
28543
|
+
* Subscribe to trade settlement updates (requires authentication)
|
|
28544
|
+
* @returns {Promise<void>}
|
|
28545
|
+
*/
|
|
28546
|
+
async subscribeToTradeSettlementUpdates() {
|
|
28547
|
+
if (!this.isAuthenticated) {
|
|
28548
|
+
throw new Error('Must be authenticated to subscribe to trade settlement updates');
|
|
28549
|
+
}
|
|
28550
|
+
const message = {
|
|
28551
|
+
method: 'settlementUpdate.subscribe',
|
|
28552
|
+
params: {
|
|
28553
|
+
apiKey: this.config.apiKey
|
|
28554
|
+
},
|
|
28555
|
+
id: this.messageId++
|
|
28556
|
+
};
|
|
28557
|
+
return new Promise((resolve, reject) => {
|
|
28558
|
+
const timeout = setTimeout(() => {
|
|
28559
|
+
reject(new Error('Trade settlement update subscription timeout'));
|
|
28560
|
+
}, 10000);
|
|
28561
|
+
const subHandler = data => {
|
|
28562
|
+
if (data.method === 'subscribed' && data.id === message.id) {
|
|
28563
|
+
clearTimeout(timeout);
|
|
28564
|
+
this.off('message', subHandler);
|
|
28565
|
+
resolve(data.result);
|
|
28566
|
+
} else if (data.error && data.id === message.id) {
|
|
28567
|
+
clearTimeout(timeout);
|
|
28568
|
+
this.off('message', subHandler);
|
|
28569
|
+
reject(new Error(data.error.msg || 'Trade settlement update subscription failed'));
|
|
28570
|
+
}
|
|
28571
|
+
};
|
|
28572
|
+
this.on('message', subHandler);
|
|
28573
|
+
this._sendMessage(message);
|
|
28574
|
+
});
|
|
28575
|
+
}
|
|
28576
|
+
|
|
28577
|
+
/**
|
|
28578
|
+
* Unsubscribe from trade settlement updates
|
|
28579
|
+
* @returns {Promise<void>}
|
|
28580
|
+
*/
|
|
28581
|
+
async unsubscribeFromTradeSettlementUpdates() {
|
|
28582
|
+
const message = {
|
|
28583
|
+
method: 'settlementUpdate.unsubscribe',
|
|
28584
|
+
params: {
|
|
28585
|
+
apiKey: this.config.apiKey
|
|
28586
|
+
},
|
|
28587
|
+
id: this.messageId++
|
|
28588
|
+
};
|
|
28589
|
+
return new Promise((resolve, reject) => {
|
|
28590
|
+
const timeout = setTimeout(() => {
|
|
28591
|
+
reject(new Error('Trade settlement update unsubscription timeout'));
|
|
28592
|
+
}, 10000);
|
|
28593
|
+
const unsubHandler = data => {
|
|
28594
|
+
if (data.method === 'unsubscribed' && data.id === message.id) {
|
|
28595
|
+
clearTimeout(timeout);
|
|
28596
|
+
this.off('message', unsubHandler);
|
|
28597
|
+
resolve();
|
|
28598
|
+
} else if (data.error && data.id === message.id) {
|
|
28599
|
+
clearTimeout(timeout);
|
|
28600
|
+
this.off('message', unsubHandler);
|
|
28601
|
+
reject(new Error(data.error.msg || 'Trade settlement update unsubscription failed'));
|
|
28602
|
+
}
|
|
28603
|
+
};
|
|
28604
|
+
this.on('message', unsubHandler);
|
|
28605
|
+
this._sendMessage(message);
|
|
28606
|
+
});
|
|
28607
|
+
}
|
|
28608
|
+
|
|
28542
28609
|
/**
|
|
28543
28610
|
* Ping the WebSocket server
|
|
28544
28611
|
* @returns {Promise<Object>} Pong response
|
|
@@ -28944,6 +29011,8 @@ class YamataAdapterSDK {
|
|
|
28944
29011
|
this.stopUserDataStream = this.stopUserDataStream.bind(this);
|
|
28945
29012
|
this.subscribeToUserDataStream = this.subscribeToUserDataStream.bind(this);
|
|
28946
29013
|
this.unsubscribeFromUserDataStream = this.unsubscribeFromUserDataStream.bind(this);
|
|
29014
|
+
this.subscribeToTradeSettlementUpdates = this.subscribeToTradeSettlementUpdates.bind(this);
|
|
29015
|
+
this.unsubscribeFromTradeSettlementUpdates = this.unsubscribeFromTradeSettlementUpdates.bind(this);
|
|
28947
29016
|
this.pingWebSocket = this.pingWebSocket.bind(this);
|
|
28948
29017
|
this.startHeartbeat = this.startHeartbeat.bind(this);
|
|
28949
29018
|
this.stopHeartbeat = this.stopHeartbeat.bind(this);
|
|
@@ -29584,6 +29653,22 @@ class YamataAdapterSDK {
|
|
|
29584
29653
|
return this.websocket.unsubscribeFromUserDataStream();
|
|
29585
29654
|
}
|
|
29586
29655
|
|
|
29656
|
+
/**
|
|
29657
|
+
* Subscribe to trade settlement updates (requires authentication)
|
|
29658
|
+
* @returns {Promise<void>}
|
|
29659
|
+
*/
|
|
29660
|
+
async subscribeToTradeSettlementUpdates() {
|
|
29661
|
+
return this.websocket.subscribeToTradeSettlementUpdates();
|
|
29662
|
+
}
|
|
29663
|
+
|
|
29664
|
+
/**
|
|
29665
|
+
* Unsubscribe from trade settlement updates
|
|
29666
|
+
* @returns {Promise<void>}
|
|
29667
|
+
*/
|
|
29668
|
+
async unsubscribeFromTradeSettlementUpdates() {
|
|
29669
|
+
return this.websocket.unsubscribeFromTradeSettlementUpdates();
|
|
29670
|
+
}
|
|
29671
|
+
|
|
29587
29672
|
/**
|
|
29588
29673
|
* Ping WebSocket server
|
|
29589
29674
|
* @returns {Promise<Object>} Pong response
|