@silvana-one/orderbook 1.1.26 → 1.1.28
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/node/index.cjs +336 -257
- package/dist/node/orderbook.d.ts +9 -4
- package/dist/node/orderbook.js +54 -119
- package/dist/node/orderbook.js.map +1 -1
- package/dist/node/proto/silvana/news/v1/news_pb.js +1 -1
- package/dist/node/proto/silvana/orderbook/v1/orderbook_pb.d.ts +313 -487
- package/dist/node/proto/silvana/orderbook/v1/orderbook_pb.js +115 -138
- package/dist/node/proto/silvana/orderbook/v1/orderbook_pb.js.map +1 -1
- package/dist/node/proto/silvana/pricing/v1/pricing_pb.js +1 -1
- package/dist/node/proto/silvana/settlement/v1/settlement_pb.d.ts +939 -226
- package/dist/node/proto/silvana/settlement/v1/settlement_pb.js +452 -26
- package/dist/node/proto/silvana/settlement/v1/settlement_pb.js.map +1 -1
- package/dist/node/settlement.d.ts +41 -30
- package/dist/node/settlement.js +40 -7
- package/dist/node/settlement.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/tsconfig.web.tsbuildinfo +1 -1
- package/dist/web/orderbook.d.ts +9 -4
- package/dist/web/orderbook.js +54 -119
- package/dist/web/orderbook.js.map +1 -1
- package/dist/web/proto/silvana/news/v1/news_pb.js +1 -1
- package/dist/web/proto/silvana/orderbook/v1/orderbook_pb.d.ts +313 -487
- package/dist/web/proto/silvana/orderbook/v1/orderbook_pb.js +115 -138
- package/dist/web/proto/silvana/orderbook/v1/orderbook_pb.js.map +1 -1
- package/dist/web/proto/silvana/pricing/v1/pricing_pb.js +1 -1
- package/dist/web/proto/silvana/settlement/v1/settlement_pb.d.ts +939 -226
- package/dist/web/proto/silvana/settlement/v1/settlement_pb.js +452 -26
- package/dist/web/proto/silvana/settlement/v1/settlement_pb.js.map +1 -1
- package/dist/web/settlement.d.ts +41 -30
- package/dist/web/settlement.js +40 -7
- package/dist/web/settlement.js.map +1 -1
- package/package.json +1 -1
- package/src/orderbook.ts +60 -121
- package/src/proto/silvana/news/v1/news_pb.ts +1 -1
- package/src/proto/silvana/orderbook/v1/orderbook_pb.ts +418 -649
- package/src/proto/silvana/pricing/v1/pricing_pb.ts +1 -1
- package/src/proto/silvana/settlement/v1/settlement_pb.ts +1161 -313
- package/src/settlement.ts +206 -31
package/src/settlement.ts
CHANGED
|
@@ -2,37 +2,174 @@ import { createClient, ConnectError } from "@connectrpc/connect";
|
|
|
2
2
|
import type { Transport } from "@connectrpc/connect";
|
|
3
3
|
import { create } from "@bufbuild/protobuf";
|
|
4
4
|
|
|
5
|
-
//
|
|
6
|
-
export * from "./proto/silvana/settlement/v1/settlement_pb.js";
|
|
7
|
-
|
|
5
|
+
// Import types needed for internal implementation
|
|
8
6
|
import {
|
|
9
7
|
SettlementService,
|
|
10
8
|
type GetPendingProposalsResponse,
|
|
11
9
|
type GetSettlementStatusResponse,
|
|
12
|
-
type UpdateSettlementProposalResponse,
|
|
13
10
|
type SaveDisclosedContractResponse,
|
|
14
11
|
type GetDisclosedContractsResponse,
|
|
15
12
|
type RecordSettlementResponse,
|
|
16
13
|
type RecordTransactionResponse,
|
|
17
14
|
type GetTransactionHistoryResponse,
|
|
15
|
+
type RecordSettlementEventResponse,
|
|
16
|
+
type GetSettlementHistoryResponse,
|
|
17
|
+
type UpdateProposalStatusResponse,
|
|
18
|
+
type GetSettlementProposalByIdResponse,
|
|
18
19
|
type DisclosedContractMessage,
|
|
20
|
+
type CantonNodeAuth,
|
|
21
|
+
type PreconfirmationDecision,
|
|
22
|
+
type CantonToServerMessage,
|
|
19
23
|
GetPendingProposalsRequestSchema,
|
|
20
24
|
GetSettlementStatusRequestSchema,
|
|
21
25
|
SubmitPreconfirmationRequestSchema,
|
|
22
|
-
UpdateSettlementProposalRequestSchema,
|
|
23
26
|
SaveDisclosedContractRequestSchema,
|
|
24
27
|
GetDisclosedContractsRequestSchema,
|
|
25
28
|
RecordSettlementRequestSchema,
|
|
26
29
|
RecordTransactionRequestSchema,
|
|
27
30
|
GetTransactionHistoryRequestSchema,
|
|
28
|
-
|
|
31
|
+
RecordSettlementEventRequestSchema,
|
|
32
|
+
GetSettlementHistoryRequestSchema,
|
|
33
|
+
UpdateProposalStatusRequestSchema,
|
|
34
|
+
GetSettlementProposalByIdRequestSchema,
|
|
35
|
+
TransactionType,
|
|
36
|
+
SenderType,
|
|
37
|
+
TransactionResult,
|
|
38
|
+
SettlementEventType,
|
|
39
|
+
RecordedByRole,
|
|
40
|
+
SettlementEventResult,
|
|
41
|
+
UpdateProposalStatusRequest_NewStatus,
|
|
42
|
+
} from "./proto/silvana/settlement/v1/settlement_pb.js";
|
|
43
|
+
|
|
44
|
+
// Export all types and schemas from the generated protobuf file
|
|
45
|
+
// Exclude ExternalAuth and ExternalAuthSchema as they conflict with orderbook exports
|
|
46
|
+
export {
|
|
47
|
+
file_proto_silvana_settlement_v1_settlement,
|
|
29
48
|
type CantonNodeAuth,
|
|
49
|
+
CantonNodeAuthSchema,
|
|
50
|
+
type SettlementInstrument,
|
|
51
|
+
SettlementInstrumentSchema,
|
|
52
|
+
type SettlementProposalMessage,
|
|
53
|
+
SettlementProposalMessageSchema,
|
|
54
|
+
type PreconfirmationRequest,
|
|
55
|
+
PreconfirmationRequestSchema,
|
|
30
56
|
type PreconfirmationDecision,
|
|
57
|
+
PreconfirmationDecisionSchema,
|
|
58
|
+
type DvpContractCreated,
|
|
59
|
+
DvpContractCreatedSchema,
|
|
60
|
+
type DvpContractAccepted,
|
|
61
|
+
DvpContractAcceptedSchema,
|
|
62
|
+
type AllocationStatus,
|
|
63
|
+
AllocationStatusSchema,
|
|
64
|
+
type SettlementExecutionStatus,
|
|
65
|
+
SettlementExecutionStatusSchema,
|
|
66
|
+
type UserServiceInfo,
|
|
67
|
+
UserServiceInfoSchema,
|
|
68
|
+
type SettlementHandshake,
|
|
69
|
+
SettlementHandshakeSchema,
|
|
70
|
+
type HandshakeAck,
|
|
71
|
+
HandshakeAckSchema,
|
|
72
|
+
type Heartbeat,
|
|
73
|
+
HeartbeatSchema,
|
|
74
|
+
type LiquidityProviderPing,
|
|
75
|
+
LiquidityProviderPingSchema,
|
|
76
|
+
type LiquidityProviderPong,
|
|
77
|
+
LiquidityProviderPongSchema,
|
|
78
|
+
type ServerToCantonMessage,
|
|
79
|
+
ServerToCantonMessageSchema,
|
|
31
80
|
type CantonToServerMessage,
|
|
81
|
+
CantonToServerMessageSchema,
|
|
82
|
+
type DvpCreationReport,
|
|
83
|
+
DvpCreationReportSchema,
|
|
84
|
+
type DvpAcceptanceReport,
|
|
85
|
+
DvpAcceptanceReportSchema,
|
|
86
|
+
type AllocationReport,
|
|
87
|
+
AllocationReportSchema,
|
|
88
|
+
type SettlementReport,
|
|
89
|
+
SettlementReportSchema,
|
|
90
|
+
type ErrorReport,
|
|
91
|
+
ErrorReportSchema,
|
|
92
|
+
type StatusUpdate,
|
|
93
|
+
StatusUpdateSchema,
|
|
94
|
+
type SettlementCommand,
|
|
95
|
+
SettlementCommandSchema,
|
|
96
|
+
type GetPendingProposalsRequest,
|
|
97
|
+
GetPendingProposalsRequestSchema,
|
|
98
|
+
type GetPendingProposalsResponse,
|
|
99
|
+
GetPendingProposalsResponseSchema,
|
|
100
|
+
type GetSettlementStatusRequest,
|
|
101
|
+
GetSettlementStatusRequestSchema,
|
|
102
|
+
type GetSettlementStatusResponse,
|
|
103
|
+
GetSettlementStatusResponseSchema,
|
|
104
|
+
type SubmitPreconfirmationRequest,
|
|
105
|
+
SubmitPreconfirmationRequestSchema,
|
|
106
|
+
type SaveDisclosedContractRequest,
|
|
107
|
+
SaveDisclosedContractRequestSchema,
|
|
108
|
+
type SaveDisclosedContractResponse,
|
|
109
|
+
SaveDisclosedContractResponseSchema,
|
|
110
|
+
type GetDisclosedContractsRequest,
|
|
111
|
+
GetDisclosedContractsRequestSchema,
|
|
112
|
+
type GetDisclosedContractsResponse,
|
|
113
|
+
GetDisclosedContractsResponseSchema,
|
|
114
|
+
type DisclosedContractMessage,
|
|
115
|
+
DisclosedContractMessageSchema,
|
|
116
|
+
type RecordSettlementRequest,
|
|
117
|
+
RecordSettlementRequestSchema,
|
|
118
|
+
type RecordSettlementResponse,
|
|
119
|
+
RecordSettlementResponseSchema,
|
|
120
|
+
type RecordTransactionRequest,
|
|
121
|
+
RecordTransactionRequestSchema,
|
|
122
|
+
type RecordTransactionResponse,
|
|
123
|
+
RecordTransactionResponseSchema,
|
|
124
|
+
type GetTransactionHistoryRequest,
|
|
125
|
+
GetTransactionHistoryRequestSchema,
|
|
126
|
+
type GetTransactionHistoryResponse,
|
|
127
|
+
GetTransactionHistoryResponseSchema,
|
|
128
|
+
type TransactionHistoryEntry,
|
|
129
|
+
TransactionHistoryEntrySchema,
|
|
130
|
+
type RecordSettlementEventRequest,
|
|
131
|
+
RecordSettlementEventRequestSchema,
|
|
132
|
+
type RecordSettlementEventResponse,
|
|
133
|
+
RecordSettlementEventResponseSchema,
|
|
134
|
+
type GetSettlementHistoryRequest,
|
|
135
|
+
GetSettlementHistoryRequestSchema,
|
|
136
|
+
type GetSettlementHistoryResponse,
|
|
137
|
+
GetSettlementHistoryResponseSchema,
|
|
138
|
+
type SettlementHistoryEntry,
|
|
139
|
+
SettlementHistoryEntrySchema,
|
|
140
|
+
type UpdateProposalStatusRequest,
|
|
141
|
+
UpdateProposalStatusRequestSchema,
|
|
142
|
+
UpdateProposalStatusRequest_NewStatus,
|
|
143
|
+
UpdateProposalStatusRequest_NewStatusSchema,
|
|
144
|
+
type UpdateProposalStatusResponse,
|
|
145
|
+
UpdateProposalStatusResponseSchema,
|
|
146
|
+
type GetSettlementProposalByIdRequest,
|
|
147
|
+
GetSettlementProposalByIdRequestSchema,
|
|
148
|
+
type GetSettlementProposalByIdResponse,
|
|
149
|
+
GetSettlementProposalByIdResponseSchema,
|
|
150
|
+
type DvpStepStatus,
|
|
151
|
+
DvpStepStatusSchema,
|
|
32
152
|
SettlementStage,
|
|
153
|
+
SettlementStageSchema,
|
|
154
|
+
PreconfirmationResponse,
|
|
155
|
+
PreconfirmationResponseSchema,
|
|
156
|
+
PartyRole,
|
|
157
|
+
PartyRoleSchema,
|
|
33
158
|
TransactionType,
|
|
159
|
+
TransactionTypeSchema,
|
|
34
160
|
SenderType,
|
|
161
|
+
SenderTypeSchema,
|
|
35
162
|
TransactionResult,
|
|
163
|
+
TransactionResultSchema,
|
|
164
|
+
SettlementEventType,
|
|
165
|
+
SettlementEventTypeSchema,
|
|
166
|
+
RecordedByRole,
|
|
167
|
+
RecordedByRoleSchema,
|
|
168
|
+
SettlementEventResult,
|
|
169
|
+
SettlementEventResultSchema,
|
|
170
|
+
DvpStepStatusEnum,
|
|
171
|
+
DvpStepStatusEnumSchema,
|
|
172
|
+
SettlementService,
|
|
36
173
|
} from "./proto/silvana/settlement/v1/settlement_pb.js";
|
|
37
174
|
|
|
38
175
|
/**
|
|
@@ -145,37 +282,75 @@ export class SettlementClient {
|
|
|
145
282
|
}
|
|
146
283
|
|
|
147
284
|
/**
|
|
148
|
-
*
|
|
285
|
+
* Record a settlement event to the settlement_proposal_history table
|
|
286
|
+
* Any party (buyer/seller/operator/system) can record events for DVP flow tracking
|
|
149
287
|
*/
|
|
150
|
-
async
|
|
288
|
+
async recordSettlementEvent(params: {
|
|
151
289
|
auth: CantonNodeAuth;
|
|
152
290
|
proposalId: string;
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
allocationSellerUpdateId?: string;
|
|
162
|
-
settledDvpCid?: string;
|
|
163
|
-
settlementUpdateId?: string;
|
|
164
|
-
settlementCompletionOffset?: string;
|
|
165
|
-
newStage?: SettlementStage;
|
|
291
|
+
recordedBy: string;
|
|
292
|
+
recordedByRole: RecordedByRole;
|
|
293
|
+
eventType: SettlementEventType;
|
|
294
|
+
submissionId?: string;
|
|
295
|
+
updateId?: string;
|
|
296
|
+
contractId?: string;
|
|
297
|
+
templateId?: string;
|
|
298
|
+
result: SettlementEventResult;
|
|
166
299
|
errorMessage?: string;
|
|
167
300
|
metadata?: any;
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
301
|
+
}): Promise<RecordSettlementEventResponse> {
|
|
302
|
+
return await this.wrapCall(async () => {
|
|
303
|
+
const request = create(RecordSettlementEventRequestSchema, params);
|
|
304
|
+
return await this.client.recordSettlementEvent(request);
|
|
305
|
+
}, 'recordSettlementEvent');
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Get settlement event history for a proposal
|
|
310
|
+
*/
|
|
311
|
+
async getSettlementHistory(params: {
|
|
312
|
+
auth: CantonNodeAuth;
|
|
313
|
+
proposalId: string;
|
|
314
|
+
eventType?: SettlementEventType;
|
|
315
|
+
result?: SettlementEventResult;
|
|
316
|
+
limit?: number;
|
|
317
|
+
offset?: number;
|
|
318
|
+
}): Promise<GetSettlementHistoryResponse> {
|
|
319
|
+
return await this.wrapCall(async () => {
|
|
320
|
+
const request = create(GetSettlementHistoryRequestSchema, params);
|
|
321
|
+
return await this.client.getSettlementHistory(request);
|
|
322
|
+
}, 'getSettlementHistory');
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Update proposal status (operator only)
|
|
327
|
+
*/
|
|
328
|
+
async updateProposalStatus(params: {
|
|
329
|
+
auth: CantonNodeAuth;
|
|
330
|
+
proposalId: string;
|
|
331
|
+
newStatus: UpdateProposalStatusRequest_NewStatus;
|
|
332
|
+
errorMessage?: string;
|
|
333
|
+
}): Promise<UpdateProposalStatusResponse> {
|
|
334
|
+
return await this.wrapCall(async () => {
|
|
335
|
+
const request = create(UpdateProposalStatusRequestSchema, params);
|
|
336
|
+
return await this.client.updateProposalStatus(request);
|
|
337
|
+
}, 'updateProposalStatus');
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Get a settlement proposal by ID
|
|
342
|
+
*/
|
|
343
|
+
async getSettlementProposalById(params: {
|
|
344
|
+
auth: CantonNodeAuth;
|
|
345
|
+
proposalId: string;
|
|
346
|
+
}): Promise<GetSettlementProposalByIdResponse> {
|
|
175
347
|
return await this.wrapCall(async () => {
|
|
176
|
-
const request = create(
|
|
177
|
-
|
|
178
|
-
|
|
348
|
+
const request = create(GetSettlementProposalByIdRequestSchema, {
|
|
349
|
+
cantonAuth: params.auth,
|
|
350
|
+
proposalId: params.proposalId,
|
|
351
|
+
});
|
|
352
|
+
return await this.client.getSettlementProposalById(request);
|
|
353
|
+
}, 'getSettlementProposalById');
|
|
179
354
|
}
|
|
180
355
|
|
|
181
356
|
/**
|