@silvana-one/orderbook 1.1.20 → 1.1.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/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
  /**
@@ -158,6 +165,8 @@ export class SettlementClient {
158
165
  newStage?: SettlementStage;
159
166
  errorMessage?: string;
160
167
  metadata?: any;
168
+ buyerFeeSent?: boolean;
169
+ sellerFeeSent?: boolean;
161
170
  }): Promise<UpdateSettlementProposalResponse> {
162
171
  return await this.wrapCall(async () => {
163
172
  const request = create(UpdateSettlementProposalRequestSchema, params);
@@ -209,4 +218,54 @@ export class SettlementClient {
209
218
  return await this.client.recordSettlement(request);
210
219
  }, 'recordSettlement');
211
220
  }
221
+
222
+ /**
223
+ * Record a transaction in history
224
+ */
225
+ async recordTransaction(params: {
226
+ auth: CantonNodeAuth;
227
+ txType: TransactionType;
228
+ senderParty: string;
229
+ senderType: SenderType;
230
+ result: TransactionResult;
231
+ updateId?: string;
232
+ submissionId?: string;
233
+ settlementProposalId?: string;
234
+ marketId?: string;
235
+ counterparty?: string;
236
+ contractId?: string;
237
+ choiceName?: string;
238
+ amount?: string;
239
+ rewardsAmount?: string;
240
+ rewardsRound?: bigint;
241
+ trafficRequest?: bigint;
242
+ trafficResponse?: bigint;
243
+ trafficTotal?: bigint;
244
+ activityMarkerCreated?: bigint;
245
+ errorMessage?: string;
246
+ metadata?: any;
247
+ }): Promise<RecordTransactionResponse> {
248
+ return await this.wrapCall(async () => {
249
+ const request = create(RecordTransactionRequestSchema, params);
250
+ return await this.client.recordTransaction(request);
251
+ }, 'recordTransaction');
252
+ }
253
+
254
+ /**
255
+ * Get transaction history with optional filters
256
+ */
257
+ async getTransactionHistory(params: {
258
+ auth: CantonNodeAuth;
259
+ senderParty?: string;
260
+ txType?: TransactionType;
261
+ settlementProposalId?: string;
262
+ result?: TransactionResult;
263
+ limit?: number;
264
+ offset?: number;
265
+ }): Promise<GetTransactionHistoryResponse> {
266
+ return await this.wrapCall(async () => {
267
+ const request = create(GetTransactionHistoryRequestSchema, params);
268
+ return await this.client.getTransactionHistory(request);
269
+ }, 'getTransactionHistory');
270
+ }
212
271
  }