@meshtrade/api-node 1.30.0
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/README.md +93 -0
- package/dist/buf/validate/validate_pb.d.ts +4597 -0
- package/dist/buf/validate/validate_pb.js +354 -0
- package/dist/google/type/date_pb.d.ts +52 -0
- package/dist/google/type/date_pb.js +26 -0
- package/dist/meshtrade/common/config.d.ts +50 -0
- package/dist/meshtrade/common/config.js +34 -0
- package/dist/meshtrade/common/connectInterceptors.d.ts +137 -0
- package/dist/meshtrade/common/connectInterceptors.js +233 -0
- package/dist/meshtrade/common/validation.d.ts +62 -0
- package/dist/meshtrade/common/validation.js +77 -0
- package/dist/meshtrade/compliance/client/v1/client_pb.d.ts +138 -0
- package/dist/meshtrade/compliance/client/v1/client_pb.js +23 -0
- package/dist/meshtrade/compliance/client/v1/company_pb.d.ts +313 -0
- package/dist/meshtrade/compliance/client/v1/company_pb.js +100 -0
- package/dist/meshtrade/compliance/client/v1/company_representative_pb.d.ts +81 -0
- package/dist/meshtrade/compliance/client/v1/company_representative_pb.js +22 -0
- package/dist/meshtrade/compliance/client/v1/company_representative_role_pb.d.ts +88 -0
- package/dist/meshtrade/compliance/client/v1/company_representative_role_pb.js +95 -0
- package/dist/meshtrade/compliance/client/v1/fund_pb.d.ts +65 -0
- package/dist/meshtrade/compliance/client/v1/fund_pb.js +18 -0
- package/dist/meshtrade/compliance/client/v1/identification_document_type_pb.d.ts +55 -0
- package/dist/meshtrade/compliance/client/v1/identification_document_type_pb.js +62 -0
- package/dist/meshtrade/compliance/client/v1/index.d.ts +16 -0
- package/dist/meshtrade/compliance/client/v1/index.js +59 -0
- package/dist/meshtrade/compliance/client/v1/industry_classification_pb.d.ts +86 -0
- package/dist/meshtrade/compliance/client/v1/industry_classification_pb.js +16 -0
- package/dist/meshtrade/compliance/client/v1/natural_person_connection_type_pb.d.ts +133 -0
- package/dist/meshtrade/compliance/client/v1/natural_person_connection_type_pb.js +140 -0
- package/dist/meshtrade/compliance/client/v1/natural_person_pb.d.ts +143 -0
- package/dist/meshtrade/compliance/client/v1/natural_person_pb.js +24 -0
- package/dist/meshtrade/compliance/client/v1/pep_status_pb.d.ts +46 -0
- package/dist/meshtrade/compliance/client/v1/pep_status_pb.js +53 -0
- package/dist/meshtrade/compliance/client/v1/service_node_meshts.d.ts +78 -0
- package/dist/meshtrade/compliance/client/v1/service_node_meshts.js +141 -0
- package/dist/meshtrade/compliance/client/v1/service_pb.d.ts +123 -0
- package/dist/meshtrade/compliance/client/v1/service_pb.js +45 -0
- package/dist/meshtrade/compliance/client/v1/source_of_income_and_wealth_pb.d.ts +180 -0
- package/dist/meshtrade/compliance/client/v1/source_of_income_and_wealth_pb.js +187 -0
- package/dist/meshtrade/compliance/client/v1/tax_residency_pb.d.ts +40 -0
- package/dist/meshtrade/compliance/client/v1/tax_residency_pb.js +17 -0
- package/dist/meshtrade/compliance/client/v1/trust_pb.d.ts +65 -0
- package/dist/meshtrade/compliance/client/v1/trust_pb.js +18 -0
- package/dist/meshtrade/compliance/client/v1/verification_status_pb.d.ts +57 -0
- package/dist/meshtrade/compliance/client/v1/verification_status_pb.js +64 -0
- package/dist/meshtrade/iam/api_user/v1/api_credentials_pb.d.ts +43 -0
- package/dist/meshtrade/iam/api_user/v1/api_credentials_pb.js +17 -0
- package/dist/meshtrade/iam/api_user/v1/api_user_pb.d.ts +152 -0
- package/dist/meshtrade/iam/api_user/v1/api_user_pb.js +95 -0
- package/dist/meshtrade/iam/api_user/v1/index.d.ts +4 -0
- package/dist/meshtrade/iam/api_user/v1/index.js +45 -0
- package/dist/meshtrade/iam/api_user/v1/service_node_meshts.d.ts +114 -0
- package/dist/meshtrade/iam/api_user/v1/service_node_meshts.js +201 -0
- package/dist/meshtrade/iam/api_user/v1/service_pb.d.ts +343 -0
- package/dist/meshtrade/iam/api_user/v1/service_pb.js +86 -0
- package/dist/meshtrade/iam/group/v1/group_pb.d.ts +58 -0
- package/dist/meshtrade/iam/group/v1/group_pb.js +17 -0
- package/dist/meshtrade/iam/group/v1/index.d.ts +3 -0
- package/dist/meshtrade/iam/group/v1/index.js +44 -0
- package/dist/meshtrade/iam/group/v1/service_node_meshts.d.ts +90 -0
- package/dist/meshtrade/iam/group/v1/service_node_meshts.js +161 -0
- package/dist/meshtrade/iam/group/v1/service_pb.d.ts +306 -0
- package/dist/meshtrade/iam/group/v1/service_pb.js +75 -0
- package/dist/meshtrade/iam/role/v1/index.d.ts +2 -0
- package/dist/meshtrade/iam/role/v1/index.js +43 -0
- package/dist/meshtrade/iam/role/v1/role.d.ts +71 -0
- package/dist/meshtrade/iam/role/v1/role.js +192 -0
- package/dist/meshtrade/iam/role/v1/role_pb.d.ts +164 -0
- package/dist/meshtrade/iam/role/v1/role_pb.js +171 -0
- package/dist/meshtrade/iam/user/v1/index.d.ts +3 -0
- package/dist/meshtrade/iam/user/v1/index.js +44 -0
- package/dist/meshtrade/iam/user/v1/service_node_meshts.d.ts +108 -0
- package/dist/meshtrade/iam/user/v1/service_node_meshts.js +191 -0
- package/dist/meshtrade/iam/user/v1/service_pb.d.ts +379 -0
- package/dist/meshtrade/iam/user/v1/service_pb.js +90 -0
- package/dist/meshtrade/iam/user/v1/user_pb.d.ts +58 -0
- package/dist/meshtrade/iam/user/v1/user_pb.js +17 -0
- package/dist/meshtrade/ledger/transaction/v1/index.d.ts +5 -0
- package/dist/meshtrade/ledger/transaction/v1/index.js +46 -0
- package/dist/meshtrade/ledger/transaction/v1/service_node_meshts.d.ts +80 -0
- package/dist/meshtrade/ledger/transaction/v1/service_node_meshts.js +140 -0
- package/dist/meshtrade/ledger/transaction/v1/service_pb.d.ts +102 -0
- package/dist/meshtrade/ledger/transaction/v1/service_pb.js +41 -0
- package/dist/meshtrade/ledger/transaction/v1/transaction_action_pb.d.ts +46 -0
- package/dist/meshtrade/ledger/transaction/v1/transaction_action_pb.js +53 -0
- package/dist/meshtrade/ledger/transaction/v1/transaction_state.d.ts +14 -0
- package/dist/meshtrade/ledger/transaction/v1/transaction_state.js +64 -0
- package/dist/meshtrade/ledger/transaction/v1/transaction_state_pb.d.ts +50 -0
- package/dist/meshtrade/ledger/transaction/v1/transaction_state_pb.js +57 -0
- package/dist/meshtrade/market_data/price/v1/index.d.ts +3 -0
- package/dist/meshtrade/market_data/price/v1/index.js +44 -0
- package/dist/meshtrade/market_data/price/v1/price_pb.d.ts +50 -0
- package/dist/meshtrade/market_data/price/v1/price_pb.js +19 -0
- package/dist/meshtrade/market_data/price/v1/service_node_meshts.d.ts +66 -0
- package/dist/meshtrade/market_data/price/v1/service_node_meshts.js +121 -0
- package/dist/meshtrade/market_data/price/v1/service_pb.d.ts +48 -0
- package/dist/meshtrade/market_data/price/v1/service_pb.js +27 -0
- package/dist/meshtrade/option/method_options/v1/index.d.ts +1 -0
- package/dist/meshtrade/option/method_options/v1/index.js +42 -0
- package/dist/meshtrade/option/method_options/v1/method_options_pb.d.ts +132 -0
- package/dist/meshtrade/option/method_options/v1/method_options_pb.js +108 -0
- package/dist/meshtrade/reporting/account_report/v1/account_report_pb.d.ts +136 -0
- package/dist/meshtrade/reporting/account_report/v1/account_report_pb.js +28 -0
- package/dist/meshtrade/reporting/account_report/v1/disclaimer_pb.d.ts +39 -0
- package/dist/meshtrade/reporting/account_report/v1/disclaimer_pb.js +16 -0
- package/dist/meshtrade/reporting/account_report/v1/fee_entry_pb.d.ts +66 -0
- package/dist/meshtrade/reporting/account_report/v1/fee_entry_pb.js +18 -0
- package/dist/meshtrade/reporting/account_report/v1/income_entry_pb.d.ts +139 -0
- package/dist/meshtrade/reporting/account_report/v1/income_entry_pb.js +80 -0
- package/dist/meshtrade/reporting/account_report/v1/index.d.ts +7 -0
- package/dist/meshtrade/reporting/account_report/v1/index.js +48 -0
- package/dist/meshtrade/reporting/account_report/v1/service_node_meshts.d.ts +72 -0
- package/dist/meshtrade/reporting/account_report/v1/service_node_meshts.js +131 -0
- package/dist/meshtrade/reporting/account_report/v1/service_pb.d.ts +162 -0
- package/dist/meshtrade/reporting/account_report/v1/service_pb.js +46 -0
- package/dist/meshtrade/reporting/account_report/v1/trading_statement_entry_pb.d.ts +80 -0
- package/dist/meshtrade/reporting/account_report/v1/trading_statement_entry_pb.js +18 -0
- package/dist/meshtrade/studio/instrument/v1/index.d.ts +3 -0
- package/dist/meshtrade/studio/instrument/v1/index.js +44 -0
- package/dist/meshtrade/studio/instrument/v1/instrument_pb.d.ts +53 -0
- package/dist/meshtrade/studio/instrument/v1/instrument_pb.js +18 -0
- package/dist/meshtrade/studio/instrument/v1/instrument_type_pb.d.ts +214 -0
- package/dist/meshtrade/studio/instrument/v1/instrument_type_pb.js +221 -0
- package/dist/meshtrade/studio/instrument/v1/unit_pb.d.ts +148 -0
- package/dist/meshtrade/studio/instrument/v1/unit_pb.js +155 -0
- package/dist/meshtrade/trading/limit_order/v1/index.d.ts +3 -0
- package/dist/meshtrade/trading/limit_order/v1/index.js +44 -0
- package/dist/meshtrade/trading/limit_order/v1/limit_order_pb.d.ts +211 -0
- package/dist/meshtrade/trading/limit_order/v1/limit_order_pb.js +111 -0
- package/dist/meshtrade/trading/limit_order/v1/service_node_meshts.d.ts +111 -0
- package/dist/meshtrade/trading/limit_order/v1/service_node_meshts.js +190 -0
- package/dist/meshtrade/trading/limit_order/v1/service_pb.d.ts +357 -0
- package/dist/meshtrade/trading/limit_order/v1/service_pb.js +73 -0
- package/dist/meshtrade/trading/market_order/v1/index.d.ts +3 -0
- package/dist/meshtrade/trading/market_order/v1/index.js +44 -0
- package/dist/meshtrade/trading/market_order/v1/market_order_pb.d.ts +20 -0
- package/dist/meshtrade/trading/market_order/v1/market_order_pb.js +16 -0
- package/dist/meshtrade/trading/market_order/v1/service_node_meshts.d.ts +66 -0
- package/dist/meshtrade/trading/market_order/v1/service_node_meshts.js +121 -0
- package/dist/meshtrade/trading/market_order/v1/service_pb.d.ts +34 -0
- package/dist/meshtrade/trading/market_order/v1/service_pb.js +22 -0
- package/dist/meshtrade/type/v1/address_pb.d.ts +82 -0
- package/dist/meshtrade/type/v1/address_pb.js +16 -0
- package/dist/meshtrade/type/v1/amount.d.ts +13 -0
- package/dist/meshtrade/type/v1/amount.js +68 -0
- package/dist/meshtrade/type/v1/amountWrapper.d.ts +74 -0
- package/dist/meshtrade/type/v1/amountWrapper.js +98 -0
- package/dist/meshtrade/type/v1/amount_pb.d.ts +44 -0
- package/dist/meshtrade/type/v1/amount_pb.js +18 -0
- package/dist/meshtrade/type/v1/contact_details_pb.d.ts +98 -0
- package/dist/meshtrade/type/v1/contact_details_pb.js +16 -0
- package/dist/meshtrade/type/v1/date.d.ts +49 -0
- package/dist/meshtrade/type/v1/date.js +136 -0
- package/dist/meshtrade/type/v1/date_pb.d.ts +50 -0
- package/dist/meshtrade/type/v1/date_pb.js +16 -0
- package/dist/meshtrade/type/v1/decimalConversions.d.ts +24 -0
- package/dist/meshtrade/type/v1/decimalConversions.js +39 -0
- package/dist/meshtrade/type/v1/decimal_pb.d.ts +24 -0
- package/dist/meshtrade/type/v1/decimal_pb.js +16 -0
- package/dist/meshtrade/type/v1/index.d.ts +15 -0
- package/dist/meshtrade/type/v1/index.js +56 -0
- package/dist/meshtrade/type/v1/ledger.d.ts +27 -0
- package/dist/meshtrade/type/v1/ledger.js +115 -0
- package/dist/meshtrade/type/v1/ledger_pb.d.ts +83 -0
- package/dist/meshtrade/type/v1/ledger_pb.js +90 -0
- package/dist/meshtrade/type/v1/sorting_pb.d.ts +35 -0
- package/dist/meshtrade/type/v1/sorting_pb.js +42 -0
- package/dist/meshtrade/type/v1/time_of_day.d.ts +74 -0
- package/dist/meshtrade/type/v1/time_of_day.js +199 -0
- package/dist/meshtrade/type/v1/time_of_day_pb.d.ts +67 -0
- package/dist/meshtrade/type/v1/time_of_day_pb.js +16 -0
- package/dist/meshtrade/type/v1/token.d.ts +4 -0
- package/dist/meshtrade/type/v1/token.js +23 -0
- package/dist/meshtrade/type/v1/tokenWrapper.d.ts +49 -0
- package/dist/meshtrade/type/v1/tokenWrapper.js +92 -0
- package/dist/meshtrade/type/v1/token_pb.d.ts +56 -0
- package/dist/meshtrade/type/v1/token_pb.js +17 -0
- package/dist/meshtrade/wallet/account/v1/account_pb.d.ts +264 -0
- package/dist/meshtrade/wallet/account/v1/account_pb.js +74 -0
- package/dist/meshtrade/wallet/account/v1/index.d.ts +3 -0
- package/dist/meshtrade/wallet/account/v1/index.js +44 -0
- package/dist/meshtrade/wallet/account/v1/service_node_meshts.d.ts +114 -0
- package/dist/meshtrade/wallet/account/v1/service_node_meshts.js +201 -0
- package/dist/meshtrade/wallet/account/v1/service_pb.d.ts +559 -0
- package/dist/meshtrade/wallet/account/v1/service_pb.js +112 -0
- package/package.json +171 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// @generated by protoc-gen-meshts v1
|
|
3
|
+
// @generated from file meshtrade/ledger/transaction/v1/service.proto (package meshtrade.ledger.transaction.v1, syntax proto3)
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TransactionServiceNode = void 0;
|
|
7
|
+
const connect_1 = require("@connectrpc/connect");
|
|
8
|
+
const connect_node_1 = require("@connectrpc/connect-node");
|
|
9
|
+
const service_pb_1 = require("./service_pb");
|
|
10
|
+
const config_1 = require("../../../common/config");
|
|
11
|
+
const validation_1 = require("../../../common/validation");
|
|
12
|
+
const connectInterceptors_1 = require("../../../common/connectInterceptors");
|
|
13
|
+
/**
|
|
14
|
+
* Node.js client for interacting with the meshtrade.ledger.transaction.v1 transaction v1 API resource service.
|
|
15
|
+
* Uses Connect-ES with gRPC transport for Node.js gRPC communication.
|
|
16
|
+
*
|
|
17
|
+
* Supports three authentication modes:
|
|
18
|
+
*
|
|
19
|
+
* 1. **No Authentication** (public APIs):
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const client = new TransactionServiceNode({ apiServerURL: "http://localhost:10000" });
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* 2. **API Key Authentication** (backend services):
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const client = new TransactionServiceNode({
|
|
27
|
+
* apiServerURL: "https://api.example.com",
|
|
28
|
+
* apiKey: "your-api-key",
|
|
29
|
+
* group: "groups/01ARZ3NDEKTSV4YWVF8F5BH32"
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* 3. **JWT Token Authentication** (Next.js backend with user session):
|
|
34
|
+
* ```typescript
|
|
35
|
+
* const client = new TransactionServiceNode({
|
|
36
|
+
* apiServerURL: "https://api.example.com",
|
|
37
|
+
* jwtToken: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
|
|
38
|
+
* });
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
class TransactionServiceNode {
|
|
42
|
+
/**
|
|
43
|
+
* Constructs an instance of TransactionServiceNode.
|
|
44
|
+
* @param {ConfigOpts} [config] - Optional configuration for the client.
|
|
45
|
+
* @param {Interceptor[]} [interceptors] - For internal use by `withGroup`.
|
|
46
|
+
*/
|
|
47
|
+
constructor(config, interceptors) {
|
|
48
|
+
this._config = (0, config_1.getConfigFromOpts)(config);
|
|
49
|
+
// If interceptors are provided (from withGroup), use them
|
|
50
|
+
// Otherwise, create auth interceptors based on config
|
|
51
|
+
if (interceptors) {
|
|
52
|
+
this._interceptors = interceptors;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
this._interceptors = [];
|
|
56
|
+
// Add authentication interceptor based on configuration
|
|
57
|
+
if (this._config.apiKey && this._config.group) {
|
|
58
|
+
// API Key authentication mode
|
|
59
|
+
this._interceptors.push((0, connectInterceptors_1.createApiKeyInterceptor)(this._config.apiKey, this._config.group));
|
|
60
|
+
}
|
|
61
|
+
else if (this._config.jwtToken) {
|
|
62
|
+
// JWT authentication mode
|
|
63
|
+
this._interceptors.push((0, connectInterceptors_1.createJwtInterceptor)(this._config.jwtToken));
|
|
64
|
+
}
|
|
65
|
+
// If neither is configured, no authentication (public API mode)
|
|
66
|
+
}
|
|
67
|
+
// Create the gRPC transport for Node.js with interceptors
|
|
68
|
+
// Note: gRPC transport uses HTTP/2 by default
|
|
69
|
+
const transport = (0, connect_node_1.createGrpcTransport)({
|
|
70
|
+
baseUrl: this._config.apiServerURL,
|
|
71
|
+
interceptors: this._interceptors,
|
|
72
|
+
});
|
|
73
|
+
// Construct the Connect-ES client
|
|
74
|
+
this._client = (0, connect_1.createClient)(service_pb_1.TransactionService, transport);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Returns a new client instance configured to send the specified group
|
|
78
|
+
* resource name in the request headers for subsequent API calls.
|
|
79
|
+
*
|
|
80
|
+
* **Important**: This method only works with API key authentication.
|
|
81
|
+
* - For **API key auth**: Creates a new client with updated group context
|
|
82
|
+
* - For **JWT auth**: Throws error (group comes from JWT token claims)
|
|
83
|
+
* - For **no auth**: Throws error (group requires authentication)
|
|
84
|
+
*
|
|
85
|
+
* @param {string} group - The operating group context to inject into the request
|
|
86
|
+
* in the format `groups/{ulid}` where {ulid} is a 26-character ULID.
|
|
87
|
+
* Example: 'groups/01ARZ3NDEKTSV4YWVF8F5BH32'
|
|
88
|
+
* @returns {TransactionServiceNode} A new, configured instance of the client.
|
|
89
|
+
* @throws {Error} If used with JWT authentication or no authentication
|
|
90
|
+
* @throws {Error} If the group format is invalid
|
|
91
|
+
*/
|
|
92
|
+
withGroup(group) {
|
|
93
|
+
// Check authentication mode
|
|
94
|
+
if (this._config.jwtToken) {
|
|
95
|
+
throw new Error("Cannot use withGroup() with JWT authentication. " +
|
|
96
|
+
"The group context is determined by the JWT token claims.");
|
|
97
|
+
}
|
|
98
|
+
if (!this._config.apiKey) {
|
|
99
|
+
throw new Error("Cannot use withGroup() without authentication. " +
|
|
100
|
+
"Please configure API key authentication to use group context.");
|
|
101
|
+
}
|
|
102
|
+
// For API key authentication, create new client with updated group
|
|
103
|
+
// Replace the existing API key interceptor with one that has the new group
|
|
104
|
+
const newInterceptors = [
|
|
105
|
+
(0, connectInterceptors_1.createApiKeyInterceptor)(this._config.apiKey, group)
|
|
106
|
+
];
|
|
107
|
+
// Return a new client instance with updated group context
|
|
108
|
+
return new TransactionServiceNode(this._config, newInterceptors);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Retrieves a transaction.
|
|
112
|
+
* @param {GetTransactionStateRequest} request - The request object for gettransactionstate.
|
|
113
|
+
* @returns {Promise<GetTransactionStateResponse>} A promise that resolves with the transaction.
|
|
114
|
+
*/
|
|
115
|
+
getTransactionState(request) {
|
|
116
|
+
// Validate request
|
|
117
|
+
(0, validation_1.validateRequest)(request);
|
|
118
|
+
return this._client.getTransactionState(request);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Performs monitortransactionstate operation on transaction.
|
|
122
|
+
* Server-side streaming method with client-side validation and authentication.
|
|
123
|
+
* @param {MonitorTransactionStateRequest} request - The request object for monitortransactionstate.
|
|
124
|
+
* @returns {AsyncIterable<MonitorTransactionStateResponse>} An async iterable of MonitorTransactionStateResponse messages.
|
|
125
|
+
* @throws {Error} If request validation fails.
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* const stream = client.monitorTransactionState(request);
|
|
129
|
+
* for await (const response of stream) {
|
|
130
|
+
* // Process each response
|
|
131
|
+
* console.log(response);
|
|
132
|
+
* }
|
|
133
|
+
*/
|
|
134
|
+
monitorTransactionState(request) {
|
|
135
|
+
// Validate request before initiating stream
|
|
136
|
+
(0, validation_1.validateRequest)(request);
|
|
137
|
+
return this._client.monitorTransactionState(request);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
exports.TransactionServiceNode = TransactionServiceNode;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
|
|
2
|
+
import type { TransactionState } from "./transaction_state_pb";
|
|
3
|
+
import type { Message } from "@bufbuild/protobuf";
|
|
4
|
+
/**
|
|
5
|
+
* Describes the file meshtrade/ledger/transaction/v1/service.proto.
|
|
6
|
+
*/
|
|
7
|
+
export declare const file_meshtrade_ledger_transaction_v1_service: GenFile;
|
|
8
|
+
/**
|
|
9
|
+
* @generated from message meshtrade.ledger.transaction.v1.GetTransactionStateRequest
|
|
10
|
+
*/
|
|
11
|
+
export type GetTransactionStateRequest = Message<"meshtrade.ledger.transaction.v1.GetTransactionStateRequest"> & {
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* Name of the Transaction whose state is to be retrieved.
|
|
15
|
+
* Format: transactions/{ULIDv2}
|
|
16
|
+
*
|
|
17
|
+
* @generated from field: string name = 1;
|
|
18
|
+
*/
|
|
19
|
+
name: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Describes the message meshtrade.ledger.transaction.v1.GetTransactionStateRequest.
|
|
23
|
+
* Use `create(GetTransactionStateRequestSchema)` to create a new message.
|
|
24
|
+
*/
|
|
25
|
+
export declare const GetTransactionStateRequestSchema: GenMessage<GetTransactionStateRequest>;
|
|
26
|
+
/**
|
|
27
|
+
* @generated from message meshtrade.ledger.transaction.v1.GetTransactionStateResponse
|
|
28
|
+
*/
|
|
29
|
+
export type GetTransactionStateResponse = Message<"meshtrade.ledger.transaction.v1.GetTransactionStateResponse"> & {
|
|
30
|
+
/**
|
|
31
|
+
* @generated from field: meshtrade.ledger.transaction.v1.TransactionState state = 1;
|
|
32
|
+
*/
|
|
33
|
+
state: TransactionState;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Describes the message meshtrade.ledger.transaction.v1.GetTransactionStateResponse.
|
|
37
|
+
* Use `create(GetTransactionStateResponseSchema)` to create a new message.
|
|
38
|
+
*/
|
|
39
|
+
export declare const GetTransactionStateResponseSchema: GenMessage<GetTransactionStateResponse>;
|
|
40
|
+
/**
|
|
41
|
+
* @generated from message meshtrade.ledger.transaction.v1.MonitorTransactionStateRequest
|
|
42
|
+
*/
|
|
43
|
+
export type MonitorTransactionStateRequest = Message<"meshtrade.ledger.transaction.v1.MonitorTransactionStateRequest"> & {
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
* Name of the Transaction whose state is to be retrieved.
|
|
47
|
+
* Format: transactions/{ULIDv2}
|
|
48
|
+
*
|
|
49
|
+
* @generated from field: string name = 1;
|
|
50
|
+
*/
|
|
51
|
+
name: string;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Describes the message meshtrade.ledger.transaction.v1.MonitorTransactionStateRequest.
|
|
55
|
+
* Use `create(MonitorTransactionStateRequestSchema)` to create a new message.
|
|
56
|
+
*/
|
|
57
|
+
export declare const MonitorTransactionStateRequestSchema: GenMessage<MonitorTransactionStateRequest>;
|
|
58
|
+
/**
|
|
59
|
+
* @generated from message meshtrade.ledger.transaction.v1.MonitorTransactionStateResponse
|
|
60
|
+
*/
|
|
61
|
+
export type MonitorTransactionStateResponse = Message<"meshtrade.ledger.transaction.v1.MonitorTransactionStateResponse"> & {
|
|
62
|
+
/**
|
|
63
|
+
* @generated from field: meshtrade.ledger.transaction.v1.TransactionState state = 1;
|
|
64
|
+
*/
|
|
65
|
+
state: TransactionState;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Describes the message meshtrade.ledger.transaction.v1.MonitorTransactionStateResponse.
|
|
69
|
+
* Use `create(MonitorTransactionStateResponseSchema)` to create a new message.
|
|
70
|
+
*/
|
|
71
|
+
export declare const MonitorTransactionStateResponseSchema: GenMessage<MonitorTransactionStateResponse>;
|
|
72
|
+
/**
|
|
73
|
+
*
|
|
74
|
+
* TransactionService manages Transaction lifecycle.
|
|
75
|
+
*
|
|
76
|
+
* @generated from service meshtrade.ledger.transaction.v1.TransactionService
|
|
77
|
+
*/
|
|
78
|
+
export declare const TransactionService: GenService<{
|
|
79
|
+
/**
|
|
80
|
+
*
|
|
81
|
+
* Retrieves a single Transaction state by the unique identifier of the transaction
|
|
82
|
+
*
|
|
83
|
+
* @generated from rpc meshtrade.ledger.transaction.v1.TransactionService.GetTransactionState
|
|
84
|
+
*/
|
|
85
|
+
getTransactionState: {
|
|
86
|
+
methodKind: "unary";
|
|
87
|
+
input: typeof GetTransactionStateRequestSchema;
|
|
88
|
+
output: typeof GetTransactionStateResponseSchema;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
*
|
|
92
|
+
* Monitor Transaction state changes by the unique identifier of the transaction.
|
|
93
|
+
* Server-side streaming method that sends state updates as the transaction progresses.
|
|
94
|
+
*
|
|
95
|
+
* @generated from rpc meshtrade.ledger.transaction.v1.TransactionService.MonitorTransactionState
|
|
96
|
+
*/
|
|
97
|
+
monitorTransactionState: {
|
|
98
|
+
methodKind: "server_streaming";
|
|
99
|
+
input: typeof MonitorTransactionStateRequestSchema;
|
|
100
|
+
output: typeof MonitorTransactionStateResponseSchema;
|
|
101
|
+
};
|
|
102
|
+
}>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// @generated by protoc-gen-es v2.10.1 with parameter "target=ts"
|
|
3
|
+
// @generated from file meshtrade/ledger/transaction/v1/service.proto (package meshtrade.ledger.transaction.v1, syntax proto3)
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TransactionService = exports.MonitorTransactionStateResponseSchema = exports.MonitorTransactionStateRequestSchema = exports.GetTransactionStateResponseSchema = exports.GetTransactionStateRequestSchema = exports.file_meshtrade_ledger_transaction_v1_service = void 0;
|
|
7
|
+
const codegenv2_1 = require("@bufbuild/protobuf/codegenv2");
|
|
8
|
+
const validate_pb_1 = require("../../../../buf/validate/validate_pb");
|
|
9
|
+
const transaction_state_pb_1 = require("./transaction_state_pb");
|
|
10
|
+
const method_options_pb_1 = require("../../../option/method_options/v1/method_options_pb");
|
|
11
|
+
/**
|
|
12
|
+
* Describes the file meshtrade/ledger/transaction/v1/service.proto.
|
|
13
|
+
*/
|
|
14
|
+
exports.file_meshtrade_ledger_transaction_v1_service = (0, codegenv2_1.fileDesc)("Ci1tZXNodHJhZGUvbGVkZ2VyL3RyYW5zYWN0aW9uL3YxL3NlcnZpY2UucHJvdG8SH21lc2h0cmFkZS5sZWRnZXIudHJhbnNhY3Rpb24udjEibgoaR2V0VHJhbnNhY3Rpb25TdGF0ZVJlcXVlc3QSUAoEbmFtZRgBIAEoCUJCukg/yAEBcjoyNV50cmFuc2FjdGlvbnMvWzAxMjM0NTY3ODlBQkNERUZHSEpLTU5QUVJTVFZXWFlaXXsyNn0kmAEnIl8KG0dldFRyYW5zYWN0aW9uU3RhdGVSZXNwb25zZRJACgVzdGF0ZRgBIAEoDjIxLm1lc2h0cmFkZS5sZWRnZXIudHJhbnNhY3Rpb24udjEuVHJhbnNhY3Rpb25TdGF0ZSJyCh5Nb25pdG9yVHJhbnNhY3Rpb25TdGF0ZVJlcXVlc3QSUAoEbmFtZRgBIAEoCUJCukg/yAEBcjoyNV50cmFuc2FjdGlvbnMvWzAxMjM0NTY3ODlBQkNERUZHSEpLTU5QUVJTVFZXWFlaXXsyNn0kmAEnImMKH01vbml0b3JUcmFuc2FjdGlvblN0YXRlUmVzcG9uc2USQAoFc3RhdGUYASABKA4yMS5tZXNodHJhZGUubGVkZ2VyLnRyYW5zYWN0aW9uLnYxLlRyYW5zYWN0aW9uU3RhdGUygAMKElRyYW5zYWN0aW9uU2VydmljZRKsAQoTR2V0VHJhbnNhY3Rpb25TdGF0ZRI7Lm1lc2h0cmFkZS5sZWRnZXIudHJhbnNhY3Rpb24udjEuR2V0VHJhbnNhY3Rpb25TdGF0ZVJlcXVlc3QaPC5tZXNodHJhZGUubGVkZ2VyLnRyYW5zYWN0aW9uLnYxLkdldFRyYW5zYWN0aW9uU3RhdGVSZXNwb25zZSIasrUYFggBEAIaEMCfqwPBn6sDwp+rA8OfqwMSugEKF01vbml0b3JUcmFuc2FjdGlvblN0YXRlEj8ubWVzaHRyYWRlLmxlZGdlci50cmFuc2FjdGlvbi52MS5Nb25pdG9yVHJhbnNhY3Rpb25TdGF0ZVJlcXVlc3QaQC5tZXNodHJhZGUubGVkZ2VyLnRyYW5zYWN0aW9uLnYxLk1vbml0b3JUcmFuc2FjdGlvblN0YXRlUmVzcG9uc2UiGrK1GBYIARACGhDAn6sDwZ+rA8KfqwPDn6sDMAFCagomY28ubWVzaHRyYWRlLmFwaS5sZWRnZXIudHJhbnNhY3Rpb24udjFaQGdpdGh1Yi5jb20vbWVzaHRyYWRlL2FwaS9nby9sZWRnZXIvdHJhbnNhY3Rpb24vdjE7dHJhbnNhY3Rpb25fdjFiBnByb3RvMw", [validate_pb_1.file_buf_validate_validate, transaction_state_pb_1.file_meshtrade_ledger_transaction_v1_transaction_state, method_options_pb_1.file_meshtrade_option_method_options_v1_method_options]);
|
|
15
|
+
/**
|
|
16
|
+
* Describes the message meshtrade.ledger.transaction.v1.GetTransactionStateRequest.
|
|
17
|
+
* Use `create(GetTransactionStateRequestSchema)` to create a new message.
|
|
18
|
+
*/
|
|
19
|
+
exports.GetTransactionStateRequestSchema = (0, codegenv2_1.messageDesc)(exports.file_meshtrade_ledger_transaction_v1_service, 0);
|
|
20
|
+
/**
|
|
21
|
+
* Describes the message meshtrade.ledger.transaction.v1.GetTransactionStateResponse.
|
|
22
|
+
* Use `create(GetTransactionStateResponseSchema)` to create a new message.
|
|
23
|
+
*/
|
|
24
|
+
exports.GetTransactionStateResponseSchema = (0, codegenv2_1.messageDesc)(exports.file_meshtrade_ledger_transaction_v1_service, 1);
|
|
25
|
+
/**
|
|
26
|
+
* Describes the message meshtrade.ledger.transaction.v1.MonitorTransactionStateRequest.
|
|
27
|
+
* Use `create(MonitorTransactionStateRequestSchema)` to create a new message.
|
|
28
|
+
*/
|
|
29
|
+
exports.MonitorTransactionStateRequestSchema = (0, codegenv2_1.messageDesc)(exports.file_meshtrade_ledger_transaction_v1_service, 2);
|
|
30
|
+
/**
|
|
31
|
+
* Describes the message meshtrade.ledger.transaction.v1.MonitorTransactionStateResponse.
|
|
32
|
+
* Use `create(MonitorTransactionStateResponseSchema)` to create a new message.
|
|
33
|
+
*/
|
|
34
|
+
exports.MonitorTransactionStateResponseSchema = (0, codegenv2_1.messageDesc)(exports.file_meshtrade_ledger_transaction_v1_service, 3);
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* TransactionService manages Transaction lifecycle.
|
|
38
|
+
*
|
|
39
|
+
* @generated from service meshtrade.ledger.transaction.v1.TransactionService
|
|
40
|
+
*/
|
|
41
|
+
exports.TransactionService = (0, codegenv2_1.serviceDesc)(exports.file_meshtrade_ledger_transaction_v1_service, 0);
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { GenEnum, GenFile } from "@bufbuild/protobuf/codegenv2";
|
|
2
|
+
/**
|
|
3
|
+
* Describes the file meshtrade/ledger/transaction/v1/transaction_action.proto.
|
|
4
|
+
*/
|
|
5
|
+
export declare const file_meshtrade_ledger_transaction_v1_transaction_action: GenFile;
|
|
6
|
+
/**
|
|
7
|
+
* @generated from enum meshtrade.ledger.transaction.v1.TransactionAction
|
|
8
|
+
*/
|
|
9
|
+
export declare enum TransactionAction {
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* Unknown or not specified.
|
|
13
|
+
* This is a default value to prevent accidental assignment and should not be used.
|
|
14
|
+
*
|
|
15
|
+
* @generated from enum value: TRANSACTION_ACTION_UNSPECIFIED = 0;
|
|
16
|
+
*/
|
|
17
|
+
UNSPECIFIED = 0,
|
|
18
|
+
/**
|
|
19
|
+
* @generated from enum value: TRANSACTION_ACTION_DO_NOTHING = 1;
|
|
20
|
+
*/
|
|
21
|
+
DO_NOTHING = 1,
|
|
22
|
+
/**
|
|
23
|
+
* @generated from enum value: TRANSACTION_ACTION_BUILD = 2;
|
|
24
|
+
*/
|
|
25
|
+
BUILD = 2,
|
|
26
|
+
/**
|
|
27
|
+
* @generated from enum value: TRANSACTION_ACTION_COMMIT = 3;
|
|
28
|
+
*/
|
|
29
|
+
COMMIT = 3,
|
|
30
|
+
/**
|
|
31
|
+
* @generated from enum value: TRANSACTION_ACTION_SIGN = 4;
|
|
32
|
+
*/
|
|
33
|
+
SIGN = 4,
|
|
34
|
+
/**
|
|
35
|
+
* @generated from enum value: TRANSACTION_ACTION_MARK_PENDING = 5;
|
|
36
|
+
*/
|
|
37
|
+
MARK_PENDING = 5,
|
|
38
|
+
/**
|
|
39
|
+
* @generated from enum value: TRANSACTION_ACTION_SUBMIT = 6;
|
|
40
|
+
*/
|
|
41
|
+
SUBMIT = 6
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Describes the enum meshtrade.ledger.transaction.v1.TransactionAction.
|
|
45
|
+
*/
|
|
46
|
+
export declare const TransactionActionSchema: GenEnum<TransactionAction>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// @generated by protoc-gen-es v2.10.1 with parameter "target=ts"
|
|
3
|
+
// @generated from file meshtrade/ledger/transaction/v1/transaction_action.proto (package meshtrade.ledger.transaction.v1, syntax proto3)
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TransactionActionSchema = exports.TransactionAction = exports.file_meshtrade_ledger_transaction_v1_transaction_action = void 0;
|
|
7
|
+
const codegenv2_1 = require("@bufbuild/protobuf/codegenv2");
|
|
8
|
+
/**
|
|
9
|
+
* Describes the file meshtrade/ledger/transaction/v1/transaction_action.proto.
|
|
10
|
+
*/
|
|
11
|
+
exports.file_meshtrade_ledger_transaction_v1_transaction_action = (0, codegenv2_1.fileDesc)("CjhtZXNodHJhZGUvbGVkZ2VyL3RyYW5zYWN0aW9uL3YxL3RyYW5zYWN0aW9uX2FjdGlvbi5wcm90bxIfbWVzaHRyYWRlLmxlZGdlci50cmFuc2FjdGlvbi52MSr4AQoRVHJhbnNhY3Rpb25BY3Rpb24SIgoeVFJBTlNBQ1RJT05fQUNUSU9OX1VOU1BFQ0lGSUVEEAASIQodVFJBTlNBQ1RJT05fQUNUSU9OX0RPX05PVEhJTkcQARIcChhUUkFOU0FDVElPTl9BQ1RJT05fQlVJTEQQAhIdChlUUkFOU0FDVElPTl9BQ1RJT05fQ09NTUlUEAMSGwoXVFJBTlNBQ1RJT05fQUNUSU9OX1NJR04QBBIjCh9UUkFOU0FDVElPTl9BQ1RJT05fTUFSS19QRU5ESU5HEAUSHQoZVFJBTlNBQ1RJT05fQUNUSU9OX1NVQk1JVBAGQmoKJmNvLm1lc2h0cmFkZS5hcGkubGVkZ2VyLnRyYW5zYWN0aW9uLnYxWkBnaXRodWIuY29tL21lc2h0cmFkZS9hcGkvZ28vbGVkZ2VyL3RyYW5zYWN0aW9uL3YxO3RyYW5zYWN0aW9uX3YxYgZwcm90bzM");
|
|
12
|
+
/**
|
|
13
|
+
* @generated from enum meshtrade.ledger.transaction.v1.TransactionAction
|
|
14
|
+
*/
|
|
15
|
+
var TransactionAction;
|
|
16
|
+
(function (TransactionAction) {
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* Unknown or not specified.
|
|
20
|
+
* This is a default value to prevent accidental assignment and should not be used.
|
|
21
|
+
*
|
|
22
|
+
* @generated from enum value: TRANSACTION_ACTION_UNSPECIFIED = 0;
|
|
23
|
+
*/
|
|
24
|
+
TransactionAction[TransactionAction["UNSPECIFIED"] = 0] = "UNSPECIFIED";
|
|
25
|
+
/**
|
|
26
|
+
* @generated from enum value: TRANSACTION_ACTION_DO_NOTHING = 1;
|
|
27
|
+
*/
|
|
28
|
+
TransactionAction[TransactionAction["DO_NOTHING"] = 1] = "DO_NOTHING";
|
|
29
|
+
/**
|
|
30
|
+
* @generated from enum value: TRANSACTION_ACTION_BUILD = 2;
|
|
31
|
+
*/
|
|
32
|
+
TransactionAction[TransactionAction["BUILD"] = 2] = "BUILD";
|
|
33
|
+
/**
|
|
34
|
+
* @generated from enum value: TRANSACTION_ACTION_COMMIT = 3;
|
|
35
|
+
*/
|
|
36
|
+
TransactionAction[TransactionAction["COMMIT"] = 3] = "COMMIT";
|
|
37
|
+
/**
|
|
38
|
+
* @generated from enum value: TRANSACTION_ACTION_SIGN = 4;
|
|
39
|
+
*/
|
|
40
|
+
TransactionAction[TransactionAction["SIGN"] = 4] = "SIGN";
|
|
41
|
+
/**
|
|
42
|
+
* @generated from enum value: TRANSACTION_ACTION_MARK_PENDING = 5;
|
|
43
|
+
*/
|
|
44
|
+
TransactionAction[TransactionAction["MARK_PENDING"] = 5] = "MARK_PENDING";
|
|
45
|
+
/**
|
|
46
|
+
* @generated from enum value: TRANSACTION_ACTION_SUBMIT = 6;
|
|
47
|
+
*/
|
|
48
|
+
TransactionAction[TransactionAction["SUBMIT"] = 6] = "SUBMIT";
|
|
49
|
+
})(TransactionAction || (exports.TransactionAction = TransactionAction = {}));
|
|
50
|
+
/**
|
|
51
|
+
* Describes the enum meshtrade.ledger.transaction.v1.TransactionAction.
|
|
52
|
+
*/
|
|
53
|
+
exports.TransactionActionSchema = (0, codegenv2_1.enumDesc)(exports.file_meshtrade_ledger_transaction_v1_transaction_action, 0);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TransactionState } from "./transaction_state_pb";
|
|
2
|
+
export declare const allTransactionStates: TransactionState[];
|
|
3
|
+
/**
|
|
4
|
+
* Converts a TransactionState enum instance to a custom string representation.
|
|
5
|
+
* @param {TransactionState} transactionState - The transactionState to convert.
|
|
6
|
+
* @returns {string} The custom string representation of the transactionState.
|
|
7
|
+
*/
|
|
8
|
+
export declare function transactionStateToString(transactionState: TransactionState): string;
|
|
9
|
+
/**
|
|
10
|
+
* Converts a custom string representation to a TransactionState enum instance.
|
|
11
|
+
* @param {string} transactionStateStr - The custom string representation of the transactionState.
|
|
12
|
+
* @returns {TransactionState} The corresponding TransactionState enum instance.
|
|
13
|
+
*/
|
|
14
|
+
export declare function stringToTransactionState(transactionStateStr: string): TransactionState;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.allTransactionStates = void 0;
|
|
4
|
+
exports.transactionStateToString = transactionStateToString;
|
|
5
|
+
exports.stringToTransactionState = stringToTransactionState;
|
|
6
|
+
const transaction_state_pb_1 = require("./transaction_state_pb");
|
|
7
|
+
// Get all transactionStates as enum values
|
|
8
|
+
exports.allTransactionStates = Object.values(transaction_state_pb_1.TransactionState).filter((value) => typeof value === "number");
|
|
9
|
+
// Define explicit mappings between TransactionState enums and custom string representations
|
|
10
|
+
const networkToStringMapping = {
|
|
11
|
+
[transaction_state_pb_1.TransactionState.UNSPECIFIED]: "-",
|
|
12
|
+
[transaction_state_pb_1.TransactionState.DRAFT]: "Draft",
|
|
13
|
+
[transaction_state_pb_1.TransactionState.SIGNING_IN_PROGRESS]: "Signing in Progress",
|
|
14
|
+
[transaction_state_pb_1.TransactionState.PENDING]: "Pending",
|
|
15
|
+
[transaction_state_pb_1.TransactionState.SUBMISSION_IN_PROGRESS]: "Submission in Progress",
|
|
16
|
+
[transaction_state_pb_1.TransactionState.FAILED]: "Failed",
|
|
17
|
+
[transaction_state_pb_1.TransactionState.INDETERMINATE]: "Indeterminate",
|
|
18
|
+
[transaction_state_pb_1.TransactionState.SUCCESSFUL]: "Successful",
|
|
19
|
+
};
|
|
20
|
+
// Reverse mapping from string to TransactionState enum
|
|
21
|
+
const stringToTransactionStateMapping = {};
|
|
22
|
+
for (const [key, value] of Object.entries(networkToStringMapping)) {
|
|
23
|
+
stringToTransactionStateMapping[value] = Number(key);
|
|
24
|
+
}
|
|
25
|
+
class UnsupportedTransactionStateError extends Error {
|
|
26
|
+
constructor(transactionState) {
|
|
27
|
+
const message = `Unsupported TransactionState: ${transactionState}`;
|
|
28
|
+
super(message);
|
|
29
|
+
this.transactionState = transactionState;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Converts a TransactionState enum instance to a custom string representation.
|
|
34
|
+
* @param {TransactionState} transactionState - The transactionState to convert.
|
|
35
|
+
* @returns {string} The custom string representation of the transactionState.
|
|
36
|
+
*/
|
|
37
|
+
function transactionStateToString(transactionState) {
|
|
38
|
+
if (transactionState in networkToStringMapping) {
|
|
39
|
+
return networkToStringMapping[transactionState];
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
throw new UnsupportedTransactionStateError(transactionState);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
class UnsupportedTransactionStateStringError extends Error {
|
|
46
|
+
constructor(transactionStateStr) {
|
|
47
|
+
const message = `Unsupported transactionState string: ${transactionStateStr}`;
|
|
48
|
+
super(message);
|
|
49
|
+
this.transactionStateStr = transactionStateStr;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Converts a custom string representation to a TransactionState enum instance.
|
|
54
|
+
* @param {string} transactionStateStr - The custom string representation of the transactionState.
|
|
55
|
+
* @returns {TransactionState} The corresponding TransactionState enum instance.
|
|
56
|
+
*/
|
|
57
|
+
function stringToTransactionState(transactionStateStr) {
|
|
58
|
+
if (transactionStateStr in stringToTransactionStateMapping) {
|
|
59
|
+
return stringToTransactionStateMapping[transactionStateStr];
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
throw new UnsupportedTransactionStateStringError(transactionStateStr);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { GenEnum, GenFile } from "@bufbuild/protobuf/codegenv2";
|
|
2
|
+
/**
|
|
3
|
+
* Describes the file meshtrade/ledger/transaction/v1/transaction_state.proto.
|
|
4
|
+
*/
|
|
5
|
+
export declare const file_meshtrade_ledger_transaction_v1_transaction_state: GenFile;
|
|
6
|
+
/**
|
|
7
|
+
* @generated from enum meshtrade.ledger.transaction.v1.TransactionState
|
|
8
|
+
*/
|
|
9
|
+
export declare enum TransactionState {
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* Unknown or not specified.
|
|
13
|
+
* This is a default value to prevent accidental assignment and should not be used.
|
|
14
|
+
*
|
|
15
|
+
* @generated from enum value: TRANSACTION_STATE_UNSPECIFIED = 0;
|
|
16
|
+
*/
|
|
17
|
+
UNSPECIFIED = 0,
|
|
18
|
+
/**
|
|
19
|
+
* @generated from enum value: TRANSACTION_STATE_DRAFT = 1;
|
|
20
|
+
*/
|
|
21
|
+
DRAFT = 1,
|
|
22
|
+
/**
|
|
23
|
+
* @generated from enum value: TRANSACTION_STATE_SIGNING_IN_PROGRESS = 2;
|
|
24
|
+
*/
|
|
25
|
+
SIGNING_IN_PROGRESS = 2,
|
|
26
|
+
/**
|
|
27
|
+
* @generated from enum value: TRANSACTION_STATE_PENDING = 3;
|
|
28
|
+
*/
|
|
29
|
+
PENDING = 3,
|
|
30
|
+
/**
|
|
31
|
+
* @generated from enum value: TRANSACTION_STATE_SUBMISSION_IN_PROGRESS = 4;
|
|
32
|
+
*/
|
|
33
|
+
SUBMISSION_IN_PROGRESS = 4,
|
|
34
|
+
/**
|
|
35
|
+
* @generated from enum value: TRANSACTION_STATE_FAILED = 5;
|
|
36
|
+
*/
|
|
37
|
+
FAILED = 5,
|
|
38
|
+
/**
|
|
39
|
+
* @generated from enum value: TRANSACTION_STATE_INDETERMINATE = 6;
|
|
40
|
+
*/
|
|
41
|
+
INDETERMINATE = 6,
|
|
42
|
+
/**
|
|
43
|
+
* @generated from enum value: TRANSACTION_STATE_SUCCESSFUL = 7;
|
|
44
|
+
*/
|
|
45
|
+
SUCCESSFUL = 7
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Describes the enum meshtrade.ledger.transaction.v1.TransactionState.
|
|
49
|
+
*/
|
|
50
|
+
export declare const TransactionStateSchema: GenEnum<TransactionState>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// @generated by protoc-gen-es v2.10.1 with parameter "target=ts"
|
|
3
|
+
// @generated from file meshtrade/ledger/transaction/v1/transaction_state.proto (package meshtrade.ledger.transaction.v1, syntax proto3)
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TransactionStateSchema = exports.TransactionState = exports.file_meshtrade_ledger_transaction_v1_transaction_state = void 0;
|
|
7
|
+
const codegenv2_1 = require("@bufbuild/protobuf/codegenv2");
|
|
8
|
+
/**
|
|
9
|
+
* Describes the file meshtrade/ledger/transaction/v1/transaction_state.proto.
|
|
10
|
+
*/
|
|
11
|
+
exports.file_meshtrade_ledger_transaction_v1_transaction_state = (0, codegenv2_1.fileDesc)("CjdtZXNodHJhZGUvbGVkZ2VyL3RyYW5zYWN0aW9uL3YxL3RyYW5zYWN0aW9uX3N0YXRlLnByb3RvEh9tZXNodHJhZGUubGVkZ2VyLnRyYW5zYWN0aW9uLnYxKq8CChBUcmFuc2FjdGlvblN0YXRlEiEKHVRSQU5TQUNUSU9OX1NUQVRFX1VOU1BFQ0lGSUVEEAASGwoXVFJBTlNBQ1RJT05fU1RBVEVfRFJBRlQQARIpCiVUUkFOU0FDVElPTl9TVEFURV9TSUdOSU5HX0lOX1BST0dSRVNTEAISHQoZVFJBTlNBQ1RJT05fU1RBVEVfUEVORElORxADEiwKKFRSQU5TQUNUSU9OX1NUQVRFX1NVQk1JU1NJT05fSU5fUFJPR1JFU1MQBBIcChhUUkFOU0FDVElPTl9TVEFURV9GQUlMRUQQBRIjCh9UUkFOU0FDVElPTl9TVEFURV9JTkRFVEVSTUlOQVRFEAYSIAocVFJBTlNBQ1RJT05fU1RBVEVfU1VDQ0VTU0ZVTBAHQmoKJmNvLm1lc2h0cmFkZS5hcGkubGVkZ2VyLnRyYW5zYWN0aW9uLnYxWkBnaXRodWIuY29tL21lc2h0cmFkZS9hcGkvZ28vbGVkZ2VyL3RyYW5zYWN0aW9uL3YxO3RyYW5zYWN0aW9uX3YxYgZwcm90bzM");
|
|
12
|
+
/**
|
|
13
|
+
* @generated from enum meshtrade.ledger.transaction.v1.TransactionState
|
|
14
|
+
*/
|
|
15
|
+
var TransactionState;
|
|
16
|
+
(function (TransactionState) {
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* Unknown or not specified.
|
|
20
|
+
* This is a default value to prevent accidental assignment and should not be used.
|
|
21
|
+
*
|
|
22
|
+
* @generated from enum value: TRANSACTION_STATE_UNSPECIFIED = 0;
|
|
23
|
+
*/
|
|
24
|
+
TransactionState[TransactionState["UNSPECIFIED"] = 0] = "UNSPECIFIED";
|
|
25
|
+
/**
|
|
26
|
+
* @generated from enum value: TRANSACTION_STATE_DRAFT = 1;
|
|
27
|
+
*/
|
|
28
|
+
TransactionState[TransactionState["DRAFT"] = 1] = "DRAFT";
|
|
29
|
+
/**
|
|
30
|
+
* @generated from enum value: TRANSACTION_STATE_SIGNING_IN_PROGRESS = 2;
|
|
31
|
+
*/
|
|
32
|
+
TransactionState[TransactionState["SIGNING_IN_PROGRESS"] = 2] = "SIGNING_IN_PROGRESS";
|
|
33
|
+
/**
|
|
34
|
+
* @generated from enum value: TRANSACTION_STATE_PENDING = 3;
|
|
35
|
+
*/
|
|
36
|
+
TransactionState[TransactionState["PENDING"] = 3] = "PENDING";
|
|
37
|
+
/**
|
|
38
|
+
* @generated from enum value: TRANSACTION_STATE_SUBMISSION_IN_PROGRESS = 4;
|
|
39
|
+
*/
|
|
40
|
+
TransactionState[TransactionState["SUBMISSION_IN_PROGRESS"] = 4] = "SUBMISSION_IN_PROGRESS";
|
|
41
|
+
/**
|
|
42
|
+
* @generated from enum value: TRANSACTION_STATE_FAILED = 5;
|
|
43
|
+
*/
|
|
44
|
+
TransactionState[TransactionState["FAILED"] = 5] = "FAILED";
|
|
45
|
+
/**
|
|
46
|
+
* @generated from enum value: TRANSACTION_STATE_INDETERMINATE = 6;
|
|
47
|
+
*/
|
|
48
|
+
TransactionState[TransactionState["INDETERMINATE"] = 6] = "INDETERMINATE";
|
|
49
|
+
/**
|
|
50
|
+
* @generated from enum value: TRANSACTION_STATE_SUCCESSFUL = 7;
|
|
51
|
+
*/
|
|
52
|
+
TransactionState[TransactionState["SUCCESSFUL"] = 7] = "SUCCESSFUL";
|
|
53
|
+
})(TransactionState || (exports.TransactionState = TransactionState = {}));
|
|
54
|
+
/**
|
|
55
|
+
* Describes the enum meshtrade.ledger.transaction.v1.TransactionState.
|
|
56
|
+
*/
|
|
57
|
+
exports.TransactionStateSchema = (0, codegenv2_1.enumDesc)(exports.file_meshtrade_ledger_transaction_v1_transaction_state, 0);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ===================================================================
|
|
3
|
+
// AUTO-GENERATED SECTION - ONLY EDIT BELOW THE CLOSING COMMENT BLOCK
|
|
4
|
+
// ===================================================================
|
|
5
|
+
// This section is automatically managed by protoc-gen-meshts.
|
|
6
|
+
//
|
|
7
|
+
// DO NOT EDIT ANYTHING IN THIS SECTION MANUALLY!
|
|
8
|
+
// Your changes will be overwritten during code generation.
|
|
9
|
+
//
|
|
10
|
+
// To add custom exports, scroll down to the
|
|
11
|
+
// "MANUAL EXPORTS" section indicated below.
|
|
12
|
+
// ===================================================================
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
25
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
26
|
+
};
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
// Generated exports
|
|
29
|
+
__exportStar(require("./price_pb"), exports);
|
|
30
|
+
__exportStar(require("./service_node_meshts"), exports);
|
|
31
|
+
__exportStar(require("./service_pb"), exports);
|
|
32
|
+
// ===================================================================
|
|
33
|
+
// END OF AUTO-GENERATED SECTION
|
|
34
|
+
// ===================================================================
|
|
35
|
+
//
|
|
36
|
+
// MANUAL EXPORTS - ADD YOUR CUSTOM EXPORTS BELOW
|
|
37
|
+
//
|
|
38
|
+
// You can safely add your own export statements in this section.
|
|
39
|
+
// They will be preserved across code generation.
|
|
40
|
+
//
|
|
41
|
+
// Example:
|
|
42
|
+
// export * from "./my_custom_module";
|
|
43
|
+
// export { MyCustomClass } from "./another_module";
|
|
44
|
+
// ===================================================================
|