@silvana-one/orderbook 1.1.19 → 1.1.21

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/src/settlement.ts CHANGED
@@ -13,6 +13,8 @@ import {
13
13
  type SaveDisclosedContractResponse,
14
14
  type GetDisclosedContractsResponse,
15
15
  type RecordSettlementResponse,
16
+ type RecordTransactionResponse,
17
+ type GetTransactionHistoryResponse,
16
18
  type DisclosedContractMessage,
17
19
  GetPendingProposalsRequestSchema,
18
20
  GetSettlementStatusRequestSchema,
@@ -21,11 +23,16 @@ import {
21
23
  SaveDisclosedContractRequestSchema,
22
24
  GetDisclosedContractsRequestSchema,
23
25
  RecordSettlementRequestSchema,
26
+ RecordTransactionRequestSchema,
27
+ GetTransactionHistoryRequestSchema,
24
28
  CantonToServerMessageSchema,
25
29
  type CantonNodeAuth,
26
30
  type PreconfirmationDecision,
27
31
  type CantonToServerMessage,
28
32
  SettlementStage,
33
+ TransactionType,
34
+ SenderType,
35
+ TransactionResult,
29
36
  } from "./proto/silvana/settlement/v1/settlement_pb.js";
30
37
 
31
38
  /**
@@ -142,7 +149,7 @@ export class SettlementClient {
142
149
  */
143
150
  async updateSettlementProposal(params: {
144
151
  auth: CantonNodeAuth;
145
- proposalId: bigint;
152
+ proposalId: string;
146
153
  expectedVersion: bigint;
147
154
  dvpProposalCid?: string;
148
155
  dvpProposalUpdateId?: string;
@@ -170,7 +177,7 @@ export class SettlementClient {
170
177
  */
171
178
  async saveDisclosedContract(params: {
172
179
  auth: CantonNodeAuth;
173
- proposalId: bigint;
180
+ proposalId: string;
174
181
  contract: DisclosedContractMessage;
175
182
  }): Promise<SaveDisclosedContractResponse> {
176
183
  return await this.wrapCall(async () => {
@@ -184,7 +191,7 @@ export class SettlementClient {
184
191
  */
185
192
  async getDisclosedContracts(params: {
186
193
  auth: CantonNodeAuth;
187
- proposalId: bigint;
194
+ proposalId: string;
188
195
  owner?: string;
189
196
  }): Promise<GetDisclosedContractsResponse> {
190
197
  return await this.wrapCall(async () => {
@@ -199,7 +206,7 @@ export class SettlementClient {
199
206
  */
200
207
  async recordSettlement(params: {
201
208
  auth: CantonNodeAuth;
202
- proposalId: bigint;
209
+ proposalId: string;
203
210
  settledDvpCid: string;
204
211
  settlementUpdateId: string;
205
212
  settlementCompletionOffset: string;
@@ -209,4 +216,54 @@ export class SettlementClient {
209
216
  return await this.client.recordSettlement(request);
210
217
  }, 'recordSettlement');
211
218
  }
219
+
220
+ /**
221
+ * Record a transaction in history
222
+ */
223
+ async recordTransaction(params: {
224
+ auth: CantonNodeAuth;
225
+ txType: TransactionType;
226
+ senderParty: string;
227
+ senderType: SenderType;
228
+ result: TransactionResult;
229
+ updateId?: string;
230
+ submissionId?: string;
231
+ settlementProposalId?: string;
232
+ marketId?: string;
233
+ counterparty?: string;
234
+ contractId?: string;
235
+ choiceName?: string;
236
+ amount?: string;
237
+ rewardsAmount?: string;
238
+ rewardsRound?: bigint;
239
+ trafficRequest?: bigint;
240
+ trafficResponse?: bigint;
241
+ trafficTotal?: bigint;
242
+ activityMarkerCreated?: bigint;
243
+ errorMessage?: string;
244
+ metadata?: any;
245
+ }): Promise<RecordTransactionResponse> {
246
+ return await this.wrapCall(async () => {
247
+ const request = create(RecordTransactionRequestSchema, params);
248
+ return await this.client.recordTransaction(request);
249
+ }, 'recordTransaction');
250
+ }
251
+
252
+ /**
253
+ * Get transaction history with optional filters
254
+ */
255
+ async getTransactionHistory(params: {
256
+ auth: CantonNodeAuth;
257
+ senderParty?: string;
258
+ txType?: TransactionType;
259
+ settlementProposalId?: string;
260
+ result?: TransactionResult;
261
+ limit?: number;
262
+ offset?: number;
263
+ }): Promise<GetTransactionHistoryResponse> {
264
+ return await this.wrapCall(async () => {
265
+ const request = create(GetTransactionHistoryRequestSchema, params);
266
+ return await this.client.getTransactionHistory(request);
267
+ }, 'getTransactionHistory');
268
+ }
212
269
  }