yamata-adapter-sdk 1.0.21 → 1.0.23
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 +89 -13
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +89 -13
- 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 +89 -13
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -23834,7 +23834,6 @@ class SafeOperationAPI {
|
|
|
23834
23834
|
* @param {string} addToQueueDto.id - Operation ID
|
|
23835
23835
|
* @param {Object} addToQueueDto.Ordersignatures - Order signatures
|
|
23836
23836
|
* @param {string} addToQueueDto.fillType - Fill type
|
|
23837
|
-
* @param {boolean} addToQueueDto.waitForSettlement - Wait for order to settle on-chain
|
|
23838
23837
|
* @returns {Promise<Object>} Queue response
|
|
23839
23838
|
*/
|
|
23840
23839
|
async addToQueue(addToQueueDto) {
|
|
@@ -23919,10 +23918,6 @@ class SafeOperationAPI {
|
|
|
23919
23918
|
var _initOpsCall$;
|
|
23920
23919
|
console.log('Starting Order Placement');
|
|
23921
23920
|
console.log('Order Details: ', order);
|
|
23922
|
-
|
|
23923
|
-
// uncomment when delayed settlement is implemented
|
|
23924
|
-
// const waitForSettlement = !order.isLP;
|
|
23925
|
-
const waitForSettlement = true;
|
|
23926
23921
|
const GME_LIMIT_ORDER_AMOUNT = 0.01;
|
|
23927
23922
|
let takerAmount = 0;
|
|
23928
23923
|
let makerAmount = 0;
|
|
@@ -24023,17 +24018,13 @@ class SafeOperationAPI {
|
|
|
24023
24018
|
const onChainExecution = await this.addToQueue({
|
|
24024
24019
|
id: orderOperations.id,
|
|
24025
24020
|
Ordersignatures: orderSignatures,
|
|
24026
|
-
fillType: orderOperations.fillType
|
|
24027
|
-
waitForSettlement
|
|
24021
|
+
fillType: orderOperations.fillType
|
|
24028
24022
|
});
|
|
24029
24023
|
if (onChainExecution.success === true) {
|
|
24030
|
-
if (!waitForSettlement) ;
|
|
24031
|
-
const fillType = orderOperations.fillType === 'FULL_FILL' ? 'Filled' : 'Partially Filled';
|
|
24032
24024
|
return {
|
|
24033
|
-
status:
|
|
24034
|
-
message: `✅ Order #${orderOperations.id}
|
|
24035
|
-
|
|
24036
|
-
id: orderOperations.id
|
|
24025
|
+
status: 'order_placed',
|
|
24026
|
+
message: `✅ Order #${orderOperations.id} has been placed`,
|
|
24027
|
+
id: orderOperations.matchingOrderID
|
|
24037
24028
|
};
|
|
24038
24029
|
}
|
|
24039
24030
|
} catch (error) {
|
|
@@ -28539,6 +28530,73 @@ class WebSocketClient {
|
|
|
28539
28530
|
});
|
|
28540
28531
|
}
|
|
28541
28532
|
|
|
28533
|
+
/**
|
|
28534
|
+
* Subscribe to trade settlement updates (requires authentication)
|
|
28535
|
+
* @returns {Promise<void>}
|
|
28536
|
+
*/
|
|
28537
|
+
async subscribeToTradeSettlementUpdates() {
|
|
28538
|
+
if (!this.isAuthenticated) {
|
|
28539
|
+
throw new Error('Must be authenticated to subscribe to trade settlement updates');
|
|
28540
|
+
}
|
|
28541
|
+
const message = {
|
|
28542
|
+
method: 'settlementUpdate.subscribe',
|
|
28543
|
+
params: {
|
|
28544
|
+
apiKey: this.config.apiKey
|
|
28545
|
+
},
|
|
28546
|
+
id: this.messageId++
|
|
28547
|
+
};
|
|
28548
|
+
return new Promise((resolve, reject) => {
|
|
28549
|
+
const timeout = setTimeout(() => {
|
|
28550
|
+
reject(new Error('Trade settlement update subscription timeout'));
|
|
28551
|
+
}, 10000);
|
|
28552
|
+
const subHandler = data => {
|
|
28553
|
+
if (data.method === 'subscribed' && data.id === message.id) {
|
|
28554
|
+
clearTimeout(timeout);
|
|
28555
|
+
this.off('message', subHandler);
|
|
28556
|
+
resolve(data.result);
|
|
28557
|
+
} else if (data.error && data.id === message.id) {
|
|
28558
|
+
clearTimeout(timeout);
|
|
28559
|
+
this.off('message', subHandler);
|
|
28560
|
+
reject(new Error(data.error.msg || 'Trade settlement update subscription failed'));
|
|
28561
|
+
}
|
|
28562
|
+
};
|
|
28563
|
+
this.on('message', subHandler);
|
|
28564
|
+
this._sendMessage(message);
|
|
28565
|
+
});
|
|
28566
|
+
}
|
|
28567
|
+
|
|
28568
|
+
/**
|
|
28569
|
+
* Unsubscribe from trade settlement updates
|
|
28570
|
+
* @returns {Promise<void>}
|
|
28571
|
+
*/
|
|
28572
|
+
async unsubscribeFromTradeSettlementUpdates() {
|
|
28573
|
+
const message = {
|
|
28574
|
+
method: 'settlementUpdate.unsubscribe',
|
|
28575
|
+
params: {
|
|
28576
|
+
apiKey: this.config.apiKey
|
|
28577
|
+
},
|
|
28578
|
+
id: this.messageId++
|
|
28579
|
+
};
|
|
28580
|
+
return new Promise((resolve, reject) => {
|
|
28581
|
+
const timeout = setTimeout(() => {
|
|
28582
|
+
reject(new Error('Trade settlement update unsubscription timeout'));
|
|
28583
|
+
}, 10000);
|
|
28584
|
+
const unsubHandler = data => {
|
|
28585
|
+
if (data.method === 'unsubscribed' && data.id === message.id) {
|
|
28586
|
+
clearTimeout(timeout);
|
|
28587
|
+
this.off('message', unsubHandler);
|
|
28588
|
+
resolve();
|
|
28589
|
+
} else if (data.error && data.id === message.id) {
|
|
28590
|
+
clearTimeout(timeout);
|
|
28591
|
+
this.off('message', unsubHandler);
|
|
28592
|
+
reject(new Error(data.error.msg || 'Trade settlement update unsubscription failed'));
|
|
28593
|
+
}
|
|
28594
|
+
};
|
|
28595
|
+
this.on('message', unsubHandler);
|
|
28596
|
+
this._sendMessage(message);
|
|
28597
|
+
});
|
|
28598
|
+
}
|
|
28599
|
+
|
|
28542
28600
|
/**
|
|
28543
28601
|
* Ping the WebSocket server
|
|
28544
28602
|
* @returns {Promise<Object>} Pong response
|
|
@@ -28944,6 +29002,8 @@ class YamataAdapterSDK {
|
|
|
28944
29002
|
this.stopUserDataStream = this.stopUserDataStream.bind(this);
|
|
28945
29003
|
this.subscribeToUserDataStream = this.subscribeToUserDataStream.bind(this);
|
|
28946
29004
|
this.unsubscribeFromUserDataStream = this.unsubscribeFromUserDataStream.bind(this);
|
|
29005
|
+
this.subscribeToTradeSettlementUpdates = this.subscribeToTradeSettlementUpdates.bind(this);
|
|
29006
|
+
this.unsubscribeFromTradeSettlementUpdates = this.unsubscribeFromTradeSettlementUpdates.bind(this);
|
|
28947
29007
|
this.pingWebSocket = this.pingWebSocket.bind(this);
|
|
28948
29008
|
this.startHeartbeat = this.startHeartbeat.bind(this);
|
|
28949
29009
|
this.stopHeartbeat = this.stopHeartbeat.bind(this);
|
|
@@ -29584,6 +29644,22 @@ class YamataAdapterSDK {
|
|
|
29584
29644
|
return this.websocket.unsubscribeFromUserDataStream();
|
|
29585
29645
|
}
|
|
29586
29646
|
|
|
29647
|
+
/**
|
|
29648
|
+
* Subscribe to trade settlement updates (requires authentication)
|
|
29649
|
+
* @returns {Promise<void>}
|
|
29650
|
+
*/
|
|
29651
|
+
async subscribeToTradeSettlementUpdates() {
|
|
29652
|
+
return this.websocket.subscribeToTradeSettlementUpdates();
|
|
29653
|
+
}
|
|
29654
|
+
|
|
29655
|
+
/**
|
|
29656
|
+
* Unsubscribe from trade settlement updates
|
|
29657
|
+
* @returns {Promise<void>}
|
|
29658
|
+
*/
|
|
29659
|
+
async unsubscribeFromTradeSettlementUpdates() {
|
|
29660
|
+
return this.websocket.unsubscribeFromTradeSettlementUpdates();
|
|
29661
|
+
}
|
|
29662
|
+
|
|
29587
29663
|
/**
|
|
29588
29664
|
* Ping WebSocket server
|
|
29589
29665
|
* @returns {Promise<Object>} Pong response
|