@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,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("./account_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
|
+
// ===================================================================
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { Interceptor } from "@connectrpc/connect";
|
|
2
|
+
import { AddSignatoriesToAccountRequest, AddSignatoriesToAccountResponse, CreateAccountRequest, GetAccountByNumberRequest, GetAccountRequest, ListAccountsRequest, ListAccountsResponse, OpenAccountRequest, OpenAccountResponse, RemoveSignatoriesFromAccountRequest, RemoveSignatoriesFromAccountResponse, SearchAccountsRequest, SearchAccountsResponse, UpdateAccountRequest } from "./service_pb";
|
|
3
|
+
import { Account } from "./account_pb";
|
|
4
|
+
import { ConfigOpts } from "../../../common/config";
|
|
5
|
+
/**
|
|
6
|
+
* Node.js client for interacting with the meshtrade.wallet.account.v1 account 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 AccountServiceNode({ apiServerURL: "http://localhost:10000" });
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* 2. **API Key Authentication** (backend services):
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const client = new AccountServiceNode({
|
|
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 AccountServiceNode({
|
|
28
|
+
* apiServerURL: "https://api.example.com",
|
|
29
|
+
* jwtToken: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare class AccountServiceNode {
|
|
34
|
+
private _client;
|
|
35
|
+
private readonly _config;
|
|
36
|
+
private readonly _interceptors;
|
|
37
|
+
/**
|
|
38
|
+
* Constructs an instance of AccountServiceNode.
|
|
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 {AccountServiceNode} 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): AccountServiceNode;
|
|
60
|
+
/**
|
|
61
|
+
* Creates a new account.
|
|
62
|
+
* @param {CreateAccountRequest} request - The request object for createaccount.
|
|
63
|
+
* @returns {Promise<Account>} A promise that resolves with the account.
|
|
64
|
+
*/
|
|
65
|
+
createAccount(request: CreateAccountRequest): Promise<Account>;
|
|
66
|
+
/**
|
|
67
|
+
* Updates an existing account.
|
|
68
|
+
* @param {UpdateAccountRequest} request - The request object for updateaccount.
|
|
69
|
+
* @returns {Promise<Account>} A promise that resolves with the account.
|
|
70
|
+
*/
|
|
71
|
+
updateAccount(request: UpdateAccountRequest): Promise<Account>;
|
|
72
|
+
/**
|
|
73
|
+
* Performs openaccount operation on account.
|
|
74
|
+
* @param {OpenAccountRequest} request - The request object for openaccount.
|
|
75
|
+
* @returns {Promise<OpenAccountResponse>} A promise that resolves with the account.
|
|
76
|
+
*/
|
|
77
|
+
openAccount(request: OpenAccountRequest): Promise<OpenAccountResponse>;
|
|
78
|
+
/**
|
|
79
|
+
* Performs addsignatoriestoaccount operation on account.
|
|
80
|
+
* @param {AddSignatoriesToAccountRequest} request - The request object for addsignatoriestoaccount.
|
|
81
|
+
* @returns {Promise<AddSignatoriesToAccountResponse>} A promise that resolves with the account.
|
|
82
|
+
*/
|
|
83
|
+
addSignatoriesToAccount(request: AddSignatoriesToAccountRequest): Promise<AddSignatoriesToAccountResponse>;
|
|
84
|
+
/**
|
|
85
|
+
* Performs removesignatoriesfromaccount operation on account.
|
|
86
|
+
* @param {RemoveSignatoriesFromAccountRequest} request - The request object for removesignatoriesfromaccount.
|
|
87
|
+
* @returns {Promise<RemoveSignatoriesFromAccountResponse>} A promise that resolves with the account.
|
|
88
|
+
*/
|
|
89
|
+
removeSignatoriesFromAccount(request: RemoveSignatoriesFromAccountRequest): Promise<RemoveSignatoriesFromAccountResponse>;
|
|
90
|
+
/**
|
|
91
|
+
* Retrieves an account.
|
|
92
|
+
* @param {GetAccountRequest} request - The request object for getaccount.
|
|
93
|
+
* @returns {Promise<Account>} A promise that resolves with the account.
|
|
94
|
+
*/
|
|
95
|
+
getAccount(request: GetAccountRequest): Promise<Account>;
|
|
96
|
+
/**
|
|
97
|
+
* Retrieves an account.
|
|
98
|
+
* @param {GetAccountByNumberRequest} request - The request object for getaccountbynumber.
|
|
99
|
+
* @returns {Promise<Account>} A promise that resolves with the account.
|
|
100
|
+
*/
|
|
101
|
+
getAccountByNumber(request: GetAccountByNumberRequest): Promise<Account>;
|
|
102
|
+
/**
|
|
103
|
+
* Retrieves a list of accounts.
|
|
104
|
+
* @param {ListAccountsRequest} request - The request object for listaccounts.
|
|
105
|
+
* @returns {Promise<ListAccountsResponse>} A promise that resolves with the list of accounts.
|
|
106
|
+
*/
|
|
107
|
+
listAccounts(request: ListAccountsRequest): Promise<ListAccountsResponse>;
|
|
108
|
+
/**
|
|
109
|
+
* Searches for accounts.
|
|
110
|
+
* @param {SearchAccountsRequest} request - The request object for searchaccounts.
|
|
111
|
+
* @returns {Promise<SearchAccountsResponse>} A promise that resolves with the search results.
|
|
112
|
+
*/
|
|
113
|
+
searchAccounts(request: SearchAccountsRequest): Promise<SearchAccountsResponse>;
|
|
114
|
+
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// @generated by protoc-gen-meshts v1
|
|
3
|
+
// @generated from file meshtrade/wallet/account/v1/service.proto (package meshtrade.wallet.account.v1, syntax proto3)
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AccountServiceNode = 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.wallet.account.v1 account 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 AccountServiceNode({ apiServerURL: "http://localhost:10000" });
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* 2. **API Key Authentication** (backend services):
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const client = new AccountServiceNode({
|
|
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 AccountServiceNode({
|
|
36
|
+
* apiServerURL: "https://api.example.com",
|
|
37
|
+
* jwtToken: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
|
|
38
|
+
* });
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
class AccountServiceNode {
|
|
42
|
+
/**
|
|
43
|
+
* Constructs an instance of AccountServiceNode.
|
|
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.AccountService, 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 {AccountServiceNode} 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 AccountServiceNode(this._config, newInterceptors);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Creates a new account.
|
|
112
|
+
* @param {CreateAccountRequest} request - The request object for createaccount.
|
|
113
|
+
* @returns {Promise<Account>} A promise that resolves with the account.
|
|
114
|
+
*/
|
|
115
|
+
createAccount(request) {
|
|
116
|
+
// Validate request
|
|
117
|
+
(0, validation_1.validateRequest)(request);
|
|
118
|
+
return this._client.createAccount(request);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Updates an existing account.
|
|
122
|
+
* @param {UpdateAccountRequest} request - The request object for updateaccount.
|
|
123
|
+
* @returns {Promise<Account>} A promise that resolves with the account.
|
|
124
|
+
*/
|
|
125
|
+
updateAccount(request) {
|
|
126
|
+
// Validate request
|
|
127
|
+
(0, validation_1.validateRequest)(request);
|
|
128
|
+
return this._client.updateAccount(request);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Performs openaccount operation on account.
|
|
132
|
+
* @param {OpenAccountRequest} request - The request object for openaccount.
|
|
133
|
+
* @returns {Promise<OpenAccountResponse>} A promise that resolves with the account.
|
|
134
|
+
*/
|
|
135
|
+
openAccount(request) {
|
|
136
|
+
// Validate request
|
|
137
|
+
(0, validation_1.validateRequest)(request);
|
|
138
|
+
return this._client.openAccount(request);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Performs addsignatoriestoaccount operation on account.
|
|
142
|
+
* @param {AddSignatoriesToAccountRequest} request - The request object for addsignatoriestoaccount.
|
|
143
|
+
* @returns {Promise<AddSignatoriesToAccountResponse>} A promise that resolves with the account.
|
|
144
|
+
*/
|
|
145
|
+
addSignatoriesToAccount(request) {
|
|
146
|
+
// Validate request
|
|
147
|
+
(0, validation_1.validateRequest)(request);
|
|
148
|
+
return this._client.addSignatoriesToAccount(request);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Performs removesignatoriesfromaccount operation on account.
|
|
152
|
+
* @param {RemoveSignatoriesFromAccountRequest} request - The request object for removesignatoriesfromaccount.
|
|
153
|
+
* @returns {Promise<RemoveSignatoriesFromAccountResponse>} A promise that resolves with the account.
|
|
154
|
+
*/
|
|
155
|
+
removeSignatoriesFromAccount(request) {
|
|
156
|
+
// Validate request
|
|
157
|
+
(0, validation_1.validateRequest)(request);
|
|
158
|
+
return this._client.removeSignatoriesFromAccount(request);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Retrieves an account.
|
|
162
|
+
* @param {GetAccountRequest} request - The request object for getaccount.
|
|
163
|
+
* @returns {Promise<Account>} A promise that resolves with the account.
|
|
164
|
+
*/
|
|
165
|
+
getAccount(request) {
|
|
166
|
+
// Validate request
|
|
167
|
+
(0, validation_1.validateRequest)(request);
|
|
168
|
+
return this._client.getAccount(request);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Retrieves an account.
|
|
172
|
+
* @param {GetAccountByNumberRequest} request - The request object for getaccountbynumber.
|
|
173
|
+
* @returns {Promise<Account>} A promise that resolves with the account.
|
|
174
|
+
*/
|
|
175
|
+
getAccountByNumber(request) {
|
|
176
|
+
// Validate request
|
|
177
|
+
(0, validation_1.validateRequest)(request);
|
|
178
|
+
return this._client.getAccountByNumber(request);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Retrieves a list of accounts.
|
|
182
|
+
* @param {ListAccountsRequest} request - The request object for listaccounts.
|
|
183
|
+
* @returns {Promise<ListAccountsResponse>} A promise that resolves with the list of accounts.
|
|
184
|
+
*/
|
|
185
|
+
listAccounts(request) {
|
|
186
|
+
// Validate request
|
|
187
|
+
(0, validation_1.validateRequest)(request);
|
|
188
|
+
return this._client.listAccounts(request);
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Searches for accounts.
|
|
192
|
+
* @param {SearchAccountsRequest} request - The request object for searchaccounts.
|
|
193
|
+
* @returns {Promise<SearchAccountsResponse>} A promise that resolves with the search results.
|
|
194
|
+
*/
|
|
195
|
+
searchAccounts(request) {
|
|
196
|
+
// Validate request
|
|
197
|
+
(0, validation_1.validateRequest)(request);
|
|
198
|
+
return this._client.searchAccounts(request);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
exports.AccountServiceNode = AccountServiceNode;
|