@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.
Files changed (186) hide show
  1. package/README.md +93 -0
  2. package/dist/buf/validate/validate_pb.d.ts +4597 -0
  3. package/dist/buf/validate/validate_pb.js +354 -0
  4. package/dist/google/type/date_pb.d.ts +52 -0
  5. package/dist/google/type/date_pb.js +26 -0
  6. package/dist/meshtrade/common/config.d.ts +50 -0
  7. package/dist/meshtrade/common/config.js +34 -0
  8. package/dist/meshtrade/common/connectInterceptors.d.ts +137 -0
  9. package/dist/meshtrade/common/connectInterceptors.js +233 -0
  10. package/dist/meshtrade/common/validation.d.ts +62 -0
  11. package/dist/meshtrade/common/validation.js +77 -0
  12. package/dist/meshtrade/compliance/client/v1/client_pb.d.ts +138 -0
  13. package/dist/meshtrade/compliance/client/v1/client_pb.js +23 -0
  14. package/dist/meshtrade/compliance/client/v1/company_pb.d.ts +313 -0
  15. package/dist/meshtrade/compliance/client/v1/company_pb.js +100 -0
  16. package/dist/meshtrade/compliance/client/v1/company_representative_pb.d.ts +81 -0
  17. package/dist/meshtrade/compliance/client/v1/company_representative_pb.js +22 -0
  18. package/dist/meshtrade/compliance/client/v1/company_representative_role_pb.d.ts +88 -0
  19. package/dist/meshtrade/compliance/client/v1/company_representative_role_pb.js +95 -0
  20. package/dist/meshtrade/compliance/client/v1/fund_pb.d.ts +65 -0
  21. package/dist/meshtrade/compliance/client/v1/fund_pb.js +18 -0
  22. package/dist/meshtrade/compliance/client/v1/identification_document_type_pb.d.ts +55 -0
  23. package/dist/meshtrade/compliance/client/v1/identification_document_type_pb.js +62 -0
  24. package/dist/meshtrade/compliance/client/v1/index.d.ts +16 -0
  25. package/dist/meshtrade/compliance/client/v1/index.js +59 -0
  26. package/dist/meshtrade/compliance/client/v1/industry_classification_pb.d.ts +86 -0
  27. package/dist/meshtrade/compliance/client/v1/industry_classification_pb.js +16 -0
  28. package/dist/meshtrade/compliance/client/v1/natural_person_connection_type_pb.d.ts +133 -0
  29. package/dist/meshtrade/compliance/client/v1/natural_person_connection_type_pb.js +140 -0
  30. package/dist/meshtrade/compliance/client/v1/natural_person_pb.d.ts +143 -0
  31. package/dist/meshtrade/compliance/client/v1/natural_person_pb.js +24 -0
  32. package/dist/meshtrade/compliance/client/v1/pep_status_pb.d.ts +46 -0
  33. package/dist/meshtrade/compliance/client/v1/pep_status_pb.js +53 -0
  34. package/dist/meshtrade/compliance/client/v1/service_node_meshts.d.ts +78 -0
  35. package/dist/meshtrade/compliance/client/v1/service_node_meshts.js +141 -0
  36. package/dist/meshtrade/compliance/client/v1/service_pb.d.ts +123 -0
  37. package/dist/meshtrade/compliance/client/v1/service_pb.js +45 -0
  38. package/dist/meshtrade/compliance/client/v1/source_of_income_and_wealth_pb.d.ts +180 -0
  39. package/dist/meshtrade/compliance/client/v1/source_of_income_and_wealth_pb.js +187 -0
  40. package/dist/meshtrade/compliance/client/v1/tax_residency_pb.d.ts +40 -0
  41. package/dist/meshtrade/compliance/client/v1/tax_residency_pb.js +17 -0
  42. package/dist/meshtrade/compliance/client/v1/trust_pb.d.ts +65 -0
  43. package/dist/meshtrade/compliance/client/v1/trust_pb.js +18 -0
  44. package/dist/meshtrade/compliance/client/v1/verification_status_pb.d.ts +57 -0
  45. package/dist/meshtrade/compliance/client/v1/verification_status_pb.js +64 -0
  46. package/dist/meshtrade/iam/api_user/v1/api_credentials_pb.d.ts +43 -0
  47. package/dist/meshtrade/iam/api_user/v1/api_credentials_pb.js +17 -0
  48. package/dist/meshtrade/iam/api_user/v1/api_user_pb.d.ts +152 -0
  49. package/dist/meshtrade/iam/api_user/v1/api_user_pb.js +95 -0
  50. package/dist/meshtrade/iam/api_user/v1/index.d.ts +4 -0
  51. package/dist/meshtrade/iam/api_user/v1/index.js +45 -0
  52. package/dist/meshtrade/iam/api_user/v1/service_node_meshts.d.ts +114 -0
  53. package/dist/meshtrade/iam/api_user/v1/service_node_meshts.js +201 -0
  54. package/dist/meshtrade/iam/api_user/v1/service_pb.d.ts +343 -0
  55. package/dist/meshtrade/iam/api_user/v1/service_pb.js +86 -0
  56. package/dist/meshtrade/iam/group/v1/group_pb.d.ts +58 -0
  57. package/dist/meshtrade/iam/group/v1/group_pb.js +17 -0
  58. package/dist/meshtrade/iam/group/v1/index.d.ts +3 -0
  59. package/dist/meshtrade/iam/group/v1/index.js +44 -0
  60. package/dist/meshtrade/iam/group/v1/service_node_meshts.d.ts +90 -0
  61. package/dist/meshtrade/iam/group/v1/service_node_meshts.js +161 -0
  62. package/dist/meshtrade/iam/group/v1/service_pb.d.ts +306 -0
  63. package/dist/meshtrade/iam/group/v1/service_pb.js +75 -0
  64. package/dist/meshtrade/iam/role/v1/index.d.ts +2 -0
  65. package/dist/meshtrade/iam/role/v1/index.js +43 -0
  66. package/dist/meshtrade/iam/role/v1/role.d.ts +71 -0
  67. package/dist/meshtrade/iam/role/v1/role.js +192 -0
  68. package/dist/meshtrade/iam/role/v1/role_pb.d.ts +164 -0
  69. package/dist/meshtrade/iam/role/v1/role_pb.js +171 -0
  70. package/dist/meshtrade/iam/user/v1/index.d.ts +3 -0
  71. package/dist/meshtrade/iam/user/v1/index.js +44 -0
  72. package/dist/meshtrade/iam/user/v1/service_node_meshts.d.ts +108 -0
  73. package/dist/meshtrade/iam/user/v1/service_node_meshts.js +191 -0
  74. package/dist/meshtrade/iam/user/v1/service_pb.d.ts +379 -0
  75. package/dist/meshtrade/iam/user/v1/service_pb.js +90 -0
  76. package/dist/meshtrade/iam/user/v1/user_pb.d.ts +58 -0
  77. package/dist/meshtrade/iam/user/v1/user_pb.js +17 -0
  78. package/dist/meshtrade/ledger/transaction/v1/index.d.ts +5 -0
  79. package/dist/meshtrade/ledger/transaction/v1/index.js +46 -0
  80. package/dist/meshtrade/ledger/transaction/v1/service_node_meshts.d.ts +80 -0
  81. package/dist/meshtrade/ledger/transaction/v1/service_node_meshts.js +140 -0
  82. package/dist/meshtrade/ledger/transaction/v1/service_pb.d.ts +102 -0
  83. package/dist/meshtrade/ledger/transaction/v1/service_pb.js +41 -0
  84. package/dist/meshtrade/ledger/transaction/v1/transaction_action_pb.d.ts +46 -0
  85. package/dist/meshtrade/ledger/transaction/v1/transaction_action_pb.js +53 -0
  86. package/dist/meshtrade/ledger/transaction/v1/transaction_state.d.ts +14 -0
  87. package/dist/meshtrade/ledger/transaction/v1/transaction_state.js +64 -0
  88. package/dist/meshtrade/ledger/transaction/v1/transaction_state_pb.d.ts +50 -0
  89. package/dist/meshtrade/ledger/transaction/v1/transaction_state_pb.js +57 -0
  90. package/dist/meshtrade/market_data/price/v1/index.d.ts +3 -0
  91. package/dist/meshtrade/market_data/price/v1/index.js +44 -0
  92. package/dist/meshtrade/market_data/price/v1/price_pb.d.ts +50 -0
  93. package/dist/meshtrade/market_data/price/v1/price_pb.js +19 -0
  94. package/dist/meshtrade/market_data/price/v1/service_node_meshts.d.ts +66 -0
  95. package/dist/meshtrade/market_data/price/v1/service_node_meshts.js +121 -0
  96. package/dist/meshtrade/market_data/price/v1/service_pb.d.ts +48 -0
  97. package/dist/meshtrade/market_data/price/v1/service_pb.js +27 -0
  98. package/dist/meshtrade/option/method_options/v1/index.d.ts +1 -0
  99. package/dist/meshtrade/option/method_options/v1/index.js +42 -0
  100. package/dist/meshtrade/option/method_options/v1/method_options_pb.d.ts +132 -0
  101. package/dist/meshtrade/option/method_options/v1/method_options_pb.js +108 -0
  102. package/dist/meshtrade/reporting/account_report/v1/account_report_pb.d.ts +136 -0
  103. package/dist/meshtrade/reporting/account_report/v1/account_report_pb.js +28 -0
  104. package/dist/meshtrade/reporting/account_report/v1/disclaimer_pb.d.ts +39 -0
  105. package/dist/meshtrade/reporting/account_report/v1/disclaimer_pb.js +16 -0
  106. package/dist/meshtrade/reporting/account_report/v1/fee_entry_pb.d.ts +66 -0
  107. package/dist/meshtrade/reporting/account_report/v1/fee_entry_pb.js +18 -0
  108. package/dist/meshtrade/reporting/account_report/v1/income_entry_pb.d.ts +139 -0
  109. package/dist/meshtrade/reporting/account_report/v1/income_entry_pb.js +80 -0
  110. package/dist/meshtrade/reporting/account_report/v1/index.d.ts +7 -0
  111. package/dist/meshtrade/reporting/account_report/v1/index.js +48 -0
  112. package/dist/meshtrade/reporting/account_report/v1/service_node_meshts.d.ts +72 -0
  113. package/dist/meshtrade/reporting/account_report/v1/service_node_meshts.js +131 -0
  114. package/dist/meshtrade/reporting/account_report/v1/service_pb.d.ts +162 -0
  115. package/dist/meshtrade/reporting/account_report/v1/service_pb.js +46 -0
  116. package/dist/meshtrade/reporting/account_report/v1/trading_statement_entry_pb.d.ts +80 -0
  117. package/dist/meshtrade/reporting/account_report/v1/trading_statement_entry_pb.js +18 -0
  118. package/dist/meshtrade/studio/instrument/v1/index.d.ts +3 -0
  119. package/dist/meshtrade/studio/instrument/v1/index.js +44 -0
  120. package/dist/meshtrade/studio/instrument/v1/instrument_pb.d.ts +53 -0
  121. package/dist/meshtrade/studio/instrument/v1/instrument_pb.js +18 -0
  122. package/dist/meshtrade/studio/instrument/v1/instrument_type_pb.d.ts +214 -0
  123. package/dist/meshtrade/studio/instrument/v1/instrument_type_pb.js +221 -0
  124. package/dist/meshtrade/studio/instrument/v1/unit_pb.d.ts +148 -0
  125. package/dist/meshtrade/studio/instrument/v1/unit_pb.js +155 -0
  126. package/dist/meshtrade/trading/limit_order/v1/index.d.ts +3 -0
  127. package/dist/meshtrade/trading/limit_order/v1/index.js +44 -0
  128. package/dist/meshtrade/trading/limit_order/v1/limit_order_pb.d.ts +211 -0
  129. package/dist/meshtrade/trading/limit_order/v1/limit_order_pb.js +111 -0
  130. package/dist/meshtrade/trading/limit_order/v1/service_node_meshts.d.ts +111 -0
  131. package/dist/meshtrade/trading/limit_order/v1/service_node_meshts.js +190 -0
  132. package/dist/meshtrade/trading/limit_order/v1/service_pb.d.ts +357 -0
  133. package/dist/meshtrade/trading/limit_order/v1/service_pb.js +73 -0
  134. package/dist/meshtrade/trading/market_order/v1/index.d.ts +3 -0
  135. package/dist/meshtrade/trading/market_order/v1/index.js +44 -0
  136. package/dist/meshtrade/trading/market_order/v1/market_order_pb.d.ts +20 -0
  137. package/dist/meshtrade/trading/market_order/v1/market_order_pb.js +16 -0
  138. package/dist/meshtrade/trading/market_order/v1/service_node_meshts.d.ts +66 -0
  139. package/dist/meshtrade/trading/market_order/v1/service_node_meshts.js +121 -0
  140. package/dist/meshtrade/trading/market_order/v1/service_pb.d.ts +34 -0
  141. package/dist/meshtrade/trading/market_order/v1/service_pb.js +22 -0
  142. package/dist/meshtrade/type/v1/address_pb.d.ts +82 -0
  143. package/dist/meshtrade/type/v1/address_pb.js +16 -0
  144. package/dist/meshtrade/type/v1/amount.d.ts +13 -0
  145. package/dist/meshtrade/type/v1/amount.js +68 -0
  146. package/dist/meshtrade/type/v1/amountWrapper.d.ts +74 -0
  147. package/dist/meshtrade/type/v1/amountWrapper.js +98 -0
  148. package/dist/meshtrade/type/v1/amount_pb.d.ts +44 -0
  149. package/dist/meshtrade/type/v1/amount_pb.js +18 -0
  150. package/dist/meshtrade/type/v1/contact_details_pb.d.ts +98 -0
  151. package/dist/meshtrade/type/v1/contact_details_pb.js +16 -0
  152. package/dist/meshtrade/type/v1/date.d.ts +49 -0
  153. package/dist/meshtrade/type/v1/date.js +136 -0
  154. package/dist/meshtrade/type/v1/date_pb.d.ts +50 -0
  155. package/dist/meshtrade/type/v1/date_pb.js +16 -0
  156. package/dist/meshtrade/type/v1/decimalConversions.d.ts +24 -0
  157. package/dist/meshtrade/type/v1/decimalConversions.js +39 -0
  158. package/dist/meshtrade/type/v1/decimal_pb.d.ts +24 -0
  159. package/dist/meshtrade/type/v1/decimal_pb.js +16 -0
  160. package/dist/meshtrade/type/v1/index.d.ts +15 -0
  161. package/dist/meshtrade/type/v1/index.js +56 -0
  162. package/dist/meshtrade/type/v1/ledger.d.ts +27 -0
  163. package/dist/meshtrade/type/v1/ledger.js +115 -0
  164. package/dist/meshtrade/type/v1/ledger_pb.d.ts +83 -0
  165. package/dist/meshtrade/type/v1/ledger_pb.js +90 -0
  166. package/dist/meshtrade/type/v1/sorting_pb.d.ts +35 -0
  167. package/dist/meshtrade/type/v1/sorting_pb.js +42 -0
  168. package/dist/meshtrade/type/v1/time_of_day.d.ts +74 -0
  169. package/dist/meshtrade/type/v1/time_of_day.js +199 -0
  170. package/dist/meshtrade/type/v1/time_of_day_pb.d.ts +67 -0
  171. package/dist/meshtrade/type/v1/time_of_day_pb.js +16 -0
  172. package/dist/meshtrade/type/v1/token.d.ts +4 -0
  173. package/dist/meshtrade/type/v1/token.js +23 -0
  174. package/dist/meshtrade/type/v1/tokenWrapper.d.ts +49 -0
  175. package/dist/meshtrade/type/v1/tokenWrapper.js +92 -0
  176. package/dist/meshtrade/type/v1/token_pb.d.ts +56 -0
  177. package/dist/meshtrade/type/v1/token_pb.js +17 -0
  178. package/dist/meshtrade/wallet/account/v1/account_pb.d.ts +264 -0
  179. package/dist/meshtrade/wallet/account/v1/account_pb.js +74 -0
  180. package/dist/meshtrade/wallet/account/v1/index.d.ts +3 -0
  181. package/dist/meshtrade/wallet/account/v1/index.js +44 -0
  182. package/dist/meshtrade/wallet/account/v1/service_node_meshts.d.ts +114 -0
  183. package/dist/meshtrade/wallet/account/v1/service_node_meshts.js +201 -0
  184. package/dist/meshtrade/wallet/account/v1/service_pb.d.ts +559 -0
  185. package/dist/meshtrade/wallet/account/v1/service_pb.js +112 -0
  186. package/package.json +171 -0
@@ -0,0 +1,20 @@
1
+ import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
2
+ import type { Message } from "@bufbuild/protobuf";
3
+ /**
4
+ * Describes the file meshtrade/trading/market_order/v1/market_order.proto.
5
+ */
6
+ export declare const file_meshtrade_trading_market_order_v1_market_order: GenFile;
7
+ /**
8
+ * @generated from message meshtrade.trading.market_order.v1.MarketOrder
9
+ */
10
+ export type MarketOrder = Message<"meshtrade.trading.market_order.v1.MarketOrder"> & {
11
+ /**
12
+ * @generated from field: string number = 1;
13
+ */
14
+ number: string;
15
+ };
16
+ /**
17
+ * Describes the message meshtrade.trading.market_order.v1.MarketOrder.
18
+ * Use `create(MarketOrderSchema)` to create a new message.
19
+ */
20
+ export declare const MarketOrderSchema: GenMessage<MarketOrder>;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ // @generated by protoc-gen-es v2.10.1 with parameter "target=ts"
3
+ // @generated from file meshtrade/trading/market_order/v1/market_order.proto (package meshtrade.trading.market_order.v1, syntax proto3)
4
+ /* eslint-disable */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.MarketOrderSchema = exports.file_meshtrade_trading_market_order_v1_market_order = void 0;
7
+ const codegenv2_1 = require("@bufbuild/protobuf/codegenv2");
8
+ /**
9
+ * Describes the file meshtrade/trading/market_order/v1/market_order.proto.
10
+ */
11
+ exports.file_meshtrade_trading_market_order_v1_market_order = (0, codegenv2_1.fileDesc)("CjRtZXNodHJhZGUvdHJhZGluZy9tYXJrZXRfb3JkZXIvdjEvbWFya2V0X29yZGVyLnByb3RvEiFtZXNodHJhZGUudHJhZGluZy5tYXJrZXRfb3JkZXIudjEiHQoLTWFya2V0T3JkZXISDgoGbnVtYmVyGAEgASgJQm8KKGNvLm1lc2h0cmFkZS5hcGkudHJhZGluZy5tYXJrZXRfb3JkZXIudjFaQ2dpdGh1Yi5jb20vbWVzaHRyYWRlL2FwaS9nby90cmFkaW5nL21hcmtldF9vcmRlci92MTttYXJrZXRfb3JkZXJfdjFiBnByb3RvMw");
12
+ /**
13
+ * Describes the message meshtrade.trading.market_order.v1.MarketOrder.
14
+ * Use `create(MarketOrderSchema)` to create a new message.
15
+ */
16
+ exports.MarketOrderSchema = (0, codegenv2_1.messageDesc)(exports.file_meshtrade_trading_market_order_v1_market_order, 0);
@@ -0,0 +1,66 @@
1
+ import { Interceptor } from "@connectrpc/connect";
2
+ import { GetMarketOrderRequest } from "./service_pb";
3
+ import { MarketOrder } from "./market_order_pb";
4
+ import { ConfigOpts } from "../../../common/config";
5
+ /**
6
+ * Node.js client for interacting with the meshtrade.trading.market_order.v1 market order v1 API resource service.
7
+ * Uses Connect-ES with gRPC transport for Node.js gRPC communication.
8
+ *
9
+ * Supports three authentication modes:
10
+ *
11
+ * 1. **No Authentication** (public APIs):
12
+ * ```typescript
13
+ * const client = new MarketOrderServiceNode({ apiServerURL: "http://localhost:10000" });
14
+ * ```
15
+ *
16
+ * 2. **API Key Authentication** (backend services):
17
+ * ```typescript
18
+ * const client = new MarketOrderServiceNode({
19
+ * apiServerURL: "https://api.example.com",
20
+ * apiKey: "your-api-key",
21
+ * group: "groups/01ARZ3NDEKTSV4YWVF8F5BH32"
22
+ * });
23
+ * ```
24
+ *
25
+ * 3. **JWT Token Authentication** (Next.js backend with user session):
26
+ * ```typescript
27
+ * const client = new MarketOrderServiceNode({
28
+ * apiServerURL: "https://api.example.com",
29
+ * jwtToken: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
30
+ * });
31
+ * ```
32
+ */
33
+ export declare class MarketOrderServiceNode {
34
+ private _client;
35
+ private readonly _config;
36
+ private readonly _interceptors;
37
+ /**
38
+ * Constructs an instance of MarketOrderServiceNode.
39
+ * @param {ConfigOpts} [config] - Optional configuration for the client.
40
+ * @param {Interceptor[]} [interceptors] - For internal use by `withGroup`.
41
+ */
42
+ constructor(config?: ConfigOpts, interceptors?: Interceptor[]);
43
+ /**
44
+ * Returns a new client instance configured to send the specified group
45
+ * resource name in the request headers for subsequent API calls.
46
+ *
47
+ * **Important**: This method only works with API key authentication.
48
+ * - For **API key auth**: Creates a new client with updated group context
49
+ * - For **JWT auth**: Throws error (group comes from JWT token claims)
50
+ * - For **no auth**: Throws error (group requires authentication)
51
+ *
52
+ * @param {string} group - The operating group context to inject into the request
53
+ * in the format `groups/{ulid}` where {ulid} is a 26-character ULID.
54
+ * Example: 'groups/01ARZ3NDEKTSV4YWVF8F5BH32'
55
+ * @returns {MarketOrderServiceNode} A new, configured instance of the client.
56
+ * @throws {Error} If used with JWT authentication or no authentication
57
+ * @throws {Error} If the group format is invalid
58
+ */
59
+ withGroup(group: string): MarketOrderServiceNode;
60
+ /**
61
+ * Retrieves a market order.
62
+ * @param {GetMarketOrderRequest} request - The request object for getmarketorder.
63
+ * @returns {Promise<MarketOrder>} A promise that resolves with the market order.
64
+ */
65
+ getMarketOrder(request: GetMarketOrderRequest): Promise<MarketOrder>;
66
+ }
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ // @generated by protoc-gen-meshts v1
3
+ // @generated from file meshtrade/trading/market_order/v1/service.proto (package meshtrade.trading.market_order.v1, syntax proto3)
4
+ /* eslint-disable */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.MarketOrderServiceNode = 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.trading.market_order.v1 market order 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 MarketOrderServiceNode({ apiServerURL: "http://localhost:10000" });
22
+ * ```
23
+ *
24
+ * 2. **API Key Authentication** (backend services):
25
+ * ```typescript
26
+ * const client = new MarketOrderServiceNode({
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 MarketOrderServiceNode({
36
+ * apiServerURL: "https://api.example.com",
37
+ * jwtToken: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
38
+ * });
39
+ * ```
40
+ */
41
+ class MarketOrderServiceNode {
42
+ /**
43
+ * Constructs an instance of MarketOrderServiceNode.
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.MarketOrderService, 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 {MarketOrderServiceNode} 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 MarketOrderServiceNode(this._config, newInterceptors);
109
+ }
110
+ /**
111
+ * Retrieves a market order.
112
+ * @param {GetMarketOrderRequest} request - The request object for getmarketorder.
113
+ * @returns {Promise<MarketOrder>} A promise that resolves with the market order.
114
+ */
115
+ getMarketOrder(request) {
116
+ // Validate request
117
+ (0, validation_1.validateRequest)(request);
118
+ return this._client.getMarketOrder(request);
119
+ }
120
+ }
121
+ exports.MarketOrderServiceNode = MarketOrderServiceNode;
@@ -0,0 +1,34 @@
1
+ import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
2
+ import type { MarketOrderSchema } from "./market_order_pb";
3
+ import type { Message } from "@bufbuild/protobuf";
4
+ /**
5
+ * Describes the file meshtrade/trading/market_order/v1/service.proto.
6
+ */
7
+ export declare const file_meshtrade_trading_market_order_v1_service: GenFile;
8
+ /**
9
+ * @generated from message meshtrade.trading.market_order.v1.GetMarketOrderRequest
10
+ */
11
+ export type GetMarketOrderRequest = Message<"meshtrade.trading.market_order.v1.GetMarketOrderRequest"> & {
12
+ /**
13
+ * @generated from field: string number = 1;
14
+ */
15
+ number: string;
16
+ };
17
+ /**
18
+ * Describes the message meshtrade.trading.market_order.v1.GetMarketOrderRequest.
19
+ * Use `create(GetMarketOrderRequestSchema)` to create a new message.
20
+ */
21
+ export declare const GetMarketOrderRequestSchema: GenMessage<GetMarketOrderRequest>;
22
+ /**
23
+ * @generated from service meshtrade.trading.market_order.v1.MarketOrderService
24
+ */
25
+ export declare const MarketOrderService: GenService<{
26
+ /**
27
+ * @generated from rpc meshtrade.trading.market_order.v1.MarketOrderService.GetMarketOrder
28
+ */
29
+ getMarketOrder: {
30
+ methodKind: "unary";
31
+ input: typeof GetMarketOrderRequestSchema;
32
+ output: typeof MarketOrderSchema;
33
+ };
34
+ }>;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ // @generated by protoc-gen-es v2.10.1 with parameter "target=ts"
3
+ // @generated from file meshtrade/trading/market_order/v1/service.proto (package meshtrade.trading.market_order.v1, syntax proto3)
4
+ /* eslint-disable */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.MarketOrderService = exports.GetMarketOrderRequestSchema = exports.file_meshtrade_trading_market_order_v1_service = void 0;
7
+ const codegenv2_1 = require("@bufbuild/protobuf/codegenv2");
8
+ const method_options_pb_1 = require("../../../option/method_options/v1/method_options_pb");
9
+ const market_order_pb_1 = require("./market_order_pb");
10
+ /**
11
+ * Describes the file meshtrade/trading/market_order/v1/service.proto.
12
+ */
13
+ exports.file_meshtrade_trading_market_order_v1_service = (0, codegenv2_1.fileDesc)("Ci9tZXNodHJhZGUvdHJhZGluZy9tYXJrZXRfb3JkZXIvdjEvc2VydmljZS5wcm90bxIhbWVzaHRyYWRlLnRyYWRpbmcubWFya2V0X29yZGVyLnYxIicKFUdldE1hcmtldE9yZGVyUmVxdWVzdBIOCgZudW1iZXIYASABKAkypQEKEk1hcmtldE9yZGVyU2VydmljZRKOAQoOR2V0TWFya2V0T3JkZXISOC5tZXNodHJhZGUudHJhZGluZy5tYXJrZXRfb3JkZXIudjEuR2V0TWFya2V0T3JkZXJSZXF1ZXN0Gi4ubWVzaHRyYWRlLnRyYWRpbmcubWFya2V0X29yZGVyLnYxLk1hcmtldE9yZGVyIhKytRgOCAEQAhoIwJaxAsGWsQJCbwooY28ubWVzaHRyYWRlLmFwaS50cmFkaW5nLm1hcmtldF9vcmRlci52MVpDZ2l0aHViLmNvbS9tZXNodHJhZGUvYXBpL2dvL3RyYWRpbmcvbWFya2V0X29yZGVyL3YxO21hcmtldF9vcmRlcl92MWIGcHJvdG8z", [method_options_pb_1.file_meshtrade_option_method_options_v1_method_options, market_order_pb_1.file_meshtrade_trading_market_order_v1_market_order]);
14
+ /**
15
+ * Describes the message meshtrade.trading.market_order.v1.GetMarketOrderRequest.
16
+ * Use `create(GetMarketOrderRequestSchema)` to create a new message.
17
+ */
18
+ exports.GetMarketOrderRequestSchema = (0, codegenv2_1.messageDesc)(exports.file_meshtrade_trading_market_order_v1_service, 0);
19
+ /**
20
+ * @generated from service meshtrade.trading.market_order.v1.MarketOrderService
21
+ */
22
+ exports.MarketOrderService = (0, codegenv2_1.serviceDesc)(exports.file_meshtrade_trading_market_order_v1_service, 0);
@@ -0,0 +1,82 @@
1
+ import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
2
+ import type { Message } from "@bufbuild/protobuf";
3
+ /**
4
+ * Describes the file meshtrade/type/v1/address.proto.
5
+ */
6
+ export declare const file_meshtrade_type_v1_address: GenFile;
7
+ /**
8
+ *
9
+ * Address is a physical postal address. It is designed to be flexible enough
10
+ * to accommodate various international address formats.
11
+ * Validation rules given are a guideline.
12
+ * A conclusive set of validation rules for an address can be found with the service/type using
13
+ * this entity.
14
+ *
15
+ * @generated from message meshtrade.type.v1.Address
16
+ */
17
+ export type Address = Message<"meshtrade.type.v1.Address"> & {
18
+ /**
19
+ *
20
+ * The unstructured lines of the address. This typically includes the street name,
21
+ * house number, apartment or suite number, and building name.
22
+ * It is recommended to have the most specific details (e.g., apartment number)
23
+ * in the first lines and the more general ones (e.g., street address) in the
24
+ * subsequent lines.
25
+ * Example: address_lines: 456 Oak Avenue, Apartment 3B, 123 Main Street.
26
+ * Required
27
+ *
28
+ * @generated from field: repeated string address_lines = 1;
29
+ */
30
+ addressLines: string[];
31
+ /**
32
+ *
33
+ * An optional field for a neighborhood, district, or suburb within a city.
34
+ * The usage of this field can vary by country.
35
+ * Optional
36
+ *
37
+ * @generated from field: string suburb = 2;
38
+ */
39
+ suburb: string;
40
+ /**
41
+ *
42
+ * The city, town, or village of the address.
43
+ * Required
44
+ *
45
+ * @generated from field: string city = 3;
46
+ */
47
+ city: string;
48
+ /**
49
+ *
50
+ * The top-level administrative subdivision of a country, such as a state,
51
+ * province, region, or prefecture.
52
+ * Required
53
+ *
54
+ * @generated from field: string province = 4;
55
+ */
56
+ province: string;
57
+ /**
58
+ *
59
+ * The ISO 3166-1 alpha-2 country code.
60
+ * This is the two-letter country code (e.g. "ZA" for South Africa,
61
+ * "NL" for the Netherlands). The value should be in uppercase.
62
+ * See https://www.iso.org/iso-3166-country-codes.html for a full list.
63
+ * Required
64
+ *
65
+ * @generated from field: string country_code = 5;
66
+ */
67
+ countryCode: string;
68
+ /**
69
+ *
70
+ * The postal code or ZIP code of the address.
71
+ * Although optional, strongly recommended where applicable.
72
+ * Optional
73
+ *
74
+ * @generated from field: string postal_code = 6;
75
+ */
76
+ postalCode: string;
77
+ };
78
+ /**
79
+ * Describes the message meshtrade.type.v1.Address.
80
+ * Use `create(AddressSchema)` to create a new message.
81
+ */
82
+ export declare const AddressSchema: GenMessage<Address>;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ // @generated by protoc-gen-es v2.10.1 with parameter "target=ts"
3
+ // @generated from file meshtrade/type/v1/address.proto (package meshtrade.type.v1, syntax proto3)
4
+ /* eslint-disable */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.AddressSchema = exports.file_meshtrade_type_v1_address = void 0;
7
+ const codegenv2_1 = require("@bufbuild/protobuf/codegenv2");
8
+ /**
9
+ * Describes the file meshtrade/type/v1/address.proto.
10
+ */
11
+ exports.file_meshtrade_type_v1_address = (0, codegenv2_1.fileDesc)("Ch9tZXNodHJhZGUvdHlwZS92MS9hZGRyZXNzLnByb3RvEhFtZXNodHJhZGUudHlwZS52MSJ7CgdBZGRyZXNzEhUKDWFkZHJlc3NfbGluZXMYASADKAkSDgoGc3VidXJiGAIgASgJEgwKBGNpdHkYAyABKAkSEAoIcHJvdmluY2UYBCABKAkSFAoMY291bnRyeV9jb2RlGAUgASgJEhMKC3Bvc3RhbF9jb2RlGAYgASgJQkcKGGNvLm1lc2h0cmFkZS5hcGkudHlwZS52MVorZ2l0aHViLmNvbS9tZXNodHJhZGUvYXBpL2dvL3R5cGUvdjE7dHlwZV92MWIGcHJvdG8z");
12
+ /**
13
+ * Describes the message meshtrade.type.v1.Address.
14
+ * Use `create(AddressSchema)` to create a new message.
15
+ */
16
+ exports.AddressSchema = (0, codegenv2_1.messageDesc)(exports.file_meshtrade_type_v1_address, 0);
@@ -0,0 +1,13 @@
1
+ import { Amount } from "./amount_pb";
2
+ import { Token } from "./token_pb";
3
+ import BigNumber from "bignumber.js";
4
+ import { Decimal } from "./decimal_pb";
5
+ /**
6
+ * Creates a new Amount of the given Token.
7
+ *
8
+ * @param {BigNumber | Decimal | string | undefined} amount - The amount in BigNumber, num.Decimal or string format.
9
+ * @param {Token} token - The token type that the amount is denominated in.
10
+ * @returns {Amount} Returns an Amount object that contains the value in Decimal format and the type of token.
11
+ */
12
+ export declare function newAmountOfToken(amount: BigNumber | Decimal | string | undefined, token?: Token): Amount;
13
+ export declare function amountIsUndefined(amount?: Amount): boolean;
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.newAmountOfToken = newAmountOfToken;
7
+ exports.amountIsUndefined = amountIsUndefined;
8
+ const protobuf_1 = require("@bufbuild/protobuf");
9
+ const amount_pb_1 = require("./amount_pb");
10
+ const decimalConversions_1 = require("./decimalConversions");
11
+ const ledger_1 = require("./ledger");
12
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
13
+ const ledger_pb_1 = require("./ledger_pb");
14
+ const token_1 = require("./token");
15
+ /**
16
+ * Creates a new Amount object using a BigNumber and a Token.
17
+ *
18
+ * @param {BigNumber} amount - The amount in BigNumber format to be converted to Decimal.
19
+ * @param {Token} token - The token type that the amount is denominated in.
20
+ * @returns {Amount} Returns an Amount object that contains the value in Decimal format and the type of token.
21
+ *
22
+ * @remarks
23
+ * This function leverages the bigNumberToDecimal function to convert the BigNumber amount into a Decimal object.
24
+ * The resulting Decimal object and the provided Token are then used to construct and return a new Amount object.
25
+ * NOTE: this performs the necessary truncation so that the resultant amount contains a valid number of
26
+ * decimal places for the target ledger.
27
+ */
28
+ function newAmountFromBigNumber(amount, token) {
29
+ return (0, protobuf_1.create)(amount_pb_1.AmountSchema, {
30
+ value: (0, decimalConversions_1.bigNumberToDecimal)(amount.decimalPlaces((0, ledger_1.getLedgerNoDecimalPlaces)(token?.ledger ?? ledger_pb_1.Ledger.UNSPECIFIED), bignumber_js_1.default.ROUND_HALF_DOWN)),
31
+ token: token,
32
+ });
33
+ }
34
+ /**
35
+ * Creates a new Amount of the given Token.
36
+ *
37
+ * @param {BigNumber | Decimal | string | undefined} amount - The amount in BigNumber, num.Decimal or string format.
38
+ * @param {Token} token - The token type that the amount is denominated in.
39
+ * @returns {Amount} Returns an Amount object that contains the value in Decimal format and the type of token.
40
+ */
41
+ function newAmountOfToken(amount, token) {
42
+ let value = new bignumber_js_1.default("0");
43
+ if (!amount) {
44
+ value = new bignumber_js_1.default("0");
45
+ }
46
+ else if (amount instanceof bignumber_js_1.default) {
47
+ value = amount;
48
+ }
49
+ else if (typeof amount === "object" && "value" in amount) {
50
+ // Check if it's a Decimal-like object
51
+ value = (0, decimalConversions_1.decimalToBigNumber)(amount);
52
+ }
53
+ else {
54
+ if (isNaN(Number(amount))) {
55
+ value = new bignumber_js_1.default("0");
56
+ }
57
+ else {
58
+ value = new bignumber_js_1.default(amount);
59
+ }
60
+ }
61
+ return newAmountFromBigNumber(value, token);
62
+ }
63
+ function amountIsUndefined(amount) {
64
+ if (!amount) {
65
+ return true;
66
+ }
67
+ return (0, token_1.tokenIsUndefined)(amount.token);
68
+ }
@@ -0,0 +1,74 @@
1
+ import { Amount } from "./amount_pb";
2
+ import { Token } from "./token_pb";
3
+ import { Decimal } from "./decimal_pb";
4
+ /**
5
+ * Wrapper class around a Amount.
6
+ *
7
+ * The AmountWrapper class provides convenience methods to manipulate and retrieve the
8
+ * Amount instance it wraps, along with its associated Token and value.
9
+ */
10
+ export declare class AmountWrapper {
11
+ private _amount;
12
+ /**
13
+ * Constructs an instance of the AmountWrapper class.
14
+ *
15
+ * This constructor initializes the AmountWrapper with a given Amount.
16
+ * If the amount is not provided or is undefined, a TypeError will be thrown.
17
+ * The amount argument is set to option (i.e. could be undefined) as objects
18
+ * returned by protobuf types are typically optionally undefined.
19
+ *
20
+ * @param {Amount} [amount] - The Amount to be wrapped. Must be defined.
21
+ *
22
+ * @throws {TypeError} If the amount is undefined.
23
+ */
24
+ constructor(amount?: Amount);
25
+ /**
26
+ * Retrieves the wrapped Amount.
27
+ *
28
+ * This getter provides access to the Amount instance that is wrapped by this class.
29
+ *
30
+ * @returns {Amount} The wrapped Amount.
31
+ */
32
+ get amount(): Amount;
33
+ /**
34
+ * Retrieves the token associated with the wrapped Amount.
35
+ *
36
+ * This getter returns the Token instance associated with the wrapped Amount.
37
+ * If the token is undefined, a TypeError will be thrown.
38
+ *
39
+ * @returns {Token} The token associated with the wrapped Amount.
40
+ * @throws {TypeError} If the token is undefined in the wrapped amount.
41
+ */
42
+ get token(): Token;
43
+ /**
44
+ * Retrieves the value associated with the wrapped Amount.
45
+ *
46
+ * This getter returns the Decimal value associated with the wrapped Amount.
47
+ * If the value is undefined, a TypeError will be thrown.
48
+ *
49
+ * @returns {Decimal} The value associated with the wrapped Amount.
50
+ * @throws {TypeError} If the value is undefined in the wrapped amount.
51
+ */
52
+ get value(): Decimal;
53
+ /**
54
+ * Sets a new value for the wrapped Amount.
55
+ *
56
+ * This method creates a new AmountWrapper instance with the provided value,
57
+ * which can be either a BigNumber or a Decimal. The new value is converted
58
+ * into a Amount using the associated token.
59
+ *
60
+ * @param {BigNumber | Decimal} value - The value to set for the wrapped Amount.
61
+ * @returns {AmountWrapper} A new AmountWrapper instance with the updated value.
62
+ */
63
+ setValue(value: BigNumber | Decimal): AmountWrapper;
64
+ /**
65
+ * Sets a new token for the wrapped Amount.
66
+ *
67
+ * This method creates a new AmountWrapper instance with the provided token.
68
+ * The current value of the wrapped Amount is associated with the new token.
69
+ *
70
+ * @param {Token} token - The new token to set for the wrapped Amount.
71
+ * @returns {AmountWrapper} A new AmountWrapper instance with the updated token.
72
+ */
73
+ setToken(token: Token): AmountWrapper;
74
+ }
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AmountWrapper = void 0;
4
+ const tokenWrapper_1 = require("./tokenWrapper");
5
+ /**
6
+ * Wrapper class around a Amount.
7
+ *
8
+ * The AmountWrapper class provides convenience methods to manipulate and retrieve the
9
+ * Amount instance it wraps, along with its associated Token and value.
10
+ */
11
+ class AmountWrapper {
12
+ /**
13
+ * Constructs an instance of the AmountWrapper class.
14
+ *
15
+ * This constructor initializes the AmountWrapper with a given Amount.
16
+ * If the amount is not provided or is undefined, a TypeError will be thrown.
17
+ * The amount argument is set to option (i.e. could be undefined) as objects
18
+ * returned by protobuf types are typically optionally undefined.
19
+ *
20
+ * @param {Amount} [amount] - The Amount to be wrapped. Must be defined.
21
+ *
22
+ * @throws {TypeError} If the amount is undefined.
23
+ */
24
+ constructor(amount) {
25
+ if (!amount) {
26
+ throw new TypeError("constructing amount wrapper with an undefined amount");
27
+ }
28
+ this._amount = amount;
29
+ }
30
+ /**
31
+ * Retrieves the wrapped Amount.
32
+ *
33
+ * This getter provides access to the Amount instance that is wrapped by this class.
34
+ *
35
+ * @returns {Amount} The wrapped Amount.
36
+ */
37
+ get amount() {
38
+ return this._amount;
39
+ }
40
+ /**
41
+ * Retrieves the token associated with the wrapped Amount.
42
+ *
43
+ * This getter returns the Token instance associated with the wrapped Amount.
44
+ * If the token is undefined, a TypeError will be thrown.
45
+ *
46
+ * @returns {Token} The token associated with the wrapped Amount.
47
+ * @throws {TypeError} If the token is undefined in the wrapped amount.
48
+ */
49
+ get token() {
50
+ const token = this._amount.token;
51
+ if (!token) {
52
+ throw new TypeError("token is undefined in wrapped amount");
53
+ }
54
+ return token;
55
+ }
56
+ /**
57
+ * Retrieves the value associated with the wrapped Amount.
58
+ *
59
+ * This getter returns the Decimal value associated with the wrapped Amount.
60
+ * If the value is undefined, a TypeError will be thrown.
61
+ *
62
+ * @returns {Decimal} The value associated with the wrapped Amount.
63
+ * @throws {TypeError} If the value is undefined in the wrapped amount.
64
+ */
65
+ get value() {
66
+ const value = this._amount.value;
67
+ if (!value) {
68
+ throw new TypeError("value is undefined in wrapped amount");
69
+ }
70
+ return value;
71
+ }
72
+ /**
73
+ * Sets a new value for the wrapped Amount.
74
+ *
75
+ * This method creates a new AmountWrapper instance with the provided value,
76
+ * which can be either a BigNumber or a Decimal. The new value is converted
77
+ * into a Amount using the associated token.
78
+ *
79
+ * @param {BigNumber | Decimal} value - The value to set for the wrapped Amount.
80
+ * @returns {AmountWrapper} A new AmountWrapper instance with the updated value.
81
+ */
82
+ setValue(value) {
83
+ return new AmountWrapper(new tokenWrapper_1.TokenWrapper(this.token).newAmountOf(value));
84
+ }
85
+ /**
86
+ * Sets a new token for the wrapped Amount.
87
+ *
88
+ * This method creates a new AmountWrapper instance with the provided token.
89
+ * The current value of the wrapped Amount is associated with the new token.
90
+ *
91
+ * @param {Token} token - The new token to set for the wrapped Amount.
92
+ * @returns {AmountWrapper} A new AmountWrapper instance with the updated token.
93
+ */
94
+ setToken(token) {
95
+ return new AmountWrapper(new tokenWrapper_1.TokenWrapper(token).newAmountOf(this.value));
96
+ }
97
+ }
98
+ exports.AmountWrapper = AmountWrapper;