@silvana-one/orderbook 1.1.20 → 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
  /**
@@ -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
  }