@meshtrade/api-web 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 +68 -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 +7 -0
- package/dist/meshtrade/common/config.js +9 -0
- package/dist/meshtrade/common/connectInterceptors.d.ts +73 -0
- package/dist/meshtrade/common/connectInterceptors.js +126 -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_pb.d.ts +123 -0
- package/dist/meshtrade/compliance/client/v1/service_pb.js +45 -0
- package/dist/meshtrade/compliance/client/v1/service_web_meshts.d.ts +48 -0
- package/dist/meshtrade/compliance/client/v1/service_web_meshts.js +92 -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_pb.d.ts +343 -0
- package/dist/meshtrade/iam/api_user/v1/service_pb.js +86 -0
- package/dist/meshtrade/iam/api_user/v1/service_web_meshts.d.ts +84 -0
- package/dist/meshtrade/iam/api_user/v1/service_web_meshts.js +152 -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_pb.d.ts +306 -0
- package/dist/meshtrade/iam/group/v1/service_pb.js +75 -0
- package/dist/meshtrade/iam/group/v1/service_web_meshts.d.ts +60 -0
- package/dist/meshtrade/iam/group/v1/service_web_meshts.js +112 -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_pb.d.ts +379 -0
- package/dist/meshtrade/iam/user/v1/service_pb.js +90 -0
- package/dist/meshtrade/iam/user/v1/service_web_meshts.d.ts +78 -0
- package/dist/meshtrade/iam/user/v1/service_web_meshts.js +142 -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_pb.d.ts +102 -0
- package/dist/meshtrade/ledger/transaction/v1/service_pb.js +41 -0
- package/dist/meshtrade/ledger/transaction/v1/service_web_meshts.d.ts +50 -0
- package/dist/meshtrade/ledger/transaction/v1/service_web_meshts.js +91 -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_pb.d.ts +48 -0
- package/dist/meshtrade/market_data/price/v1/service_pb.js +27 -0
- package/dist/meshtrade/market_data/price/v1/service_web_meshts.d.ts +36 -0
- package/dist/meshtrade/market_data/price/v1/service_web_meshts.js +72 -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_pb.d.ts +162 -0
- package/dist/meshtrade/reporting/account_report/v1/service_pb.js +46 -0
- package/dist/meshtrade/reporting/account_report/v1/service_web_meshts.d.ts +42 -0
- package/dist/meshtrade/reporting/account_report/v1/service_web_meshts.js +82 -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_pb.d.ts +357 -0
- package/dist/meshtrade/trading/limit_order/v1/service_pb.js +73 -0
- package/dist/meshtrade/trading/limit_order/v1/service_web_meshts.d.ts +81 -0
- package/dist/meshtrade/trading/limit_order/v1/service_web_meshts.js +141 -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_pb.d.ts +34 -0
- package/dist/meshtrade/trading/market_order/v1/service_pb.js +22 -0
- package/dist/meshtrade/trading/market_order/v1/service_web_meshts.d.ts +36 -0
- package/dist/meshtrade/trading/market_order/v1/service_web_meshts.js +72 -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_pb.d.ts +559 -0
- package/dist/meshtrade/wallet/account/v1/service_pb.js +112 -0
- package/dist/meshtrade/wallet/account/v1/service_web_meshts.d.ts +84 -0
- package/dist/meshtrade/wallet/account/v1/service_web_meshts.js +152 -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("./market_order_pb"), exports);
|
|
30
|
+
__exportStar(require("./service_pb"), exports);
|
|
31
|
+
__exportStar(require("./service_web_meshts"), 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,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,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,36 @@
|
|
|
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
|
+
* Web client for interacting with the meshtrade.trading.market_order.v1 market order v1 API resource service.
|
|
7
|
+
* Uses Connect-ES with gRPC-Web transport for browser-compatible gRPC communication.
|
|
8
|
+
*/
|
|
9
|
+
export declare class MarketOrderServiceWeb {
|
|
10
|
+
private _client;
|
|
11
|
+
private readonly _config;
|
|
12
|
+
private readonly _interceptors;
|
|
13
|
+
/**
|
|
14
|
+
* Constructs an instance of MarketOrderServiceWeb.
|
|
15
|
+
* @param {ConfigOpts} [config] - Optional configuration for the client.
|
|
16
|
+
* @param {Interceptor[]} [interceptors] - For internal use by `withGroup`.
|
|
17
|
+
*/
|
|
18
|
+
constructor(config?: ConfigOpts, interceptors?: Interceptor[]);
|
|
19
|
+
/**
|
|
20
|
+
* Returns a new client instance configured to send the specified group
|
|
21
|
+
* resource name in the request headers for subsequent API calls.
|
|
22
|
+
*
|
|
23
|
+
* @param {string} group - The operating group context to inject into the request
|
|
24
|
+
* in the format `groups/{ulid}` where {ulid} is a 26-character ULID.
|
|
25
|
+
* Example: 'groups/01ARZ3NDEKTSV4YWVF8F5BH32'
|
|
26
|
+
* @returns {MarketOrderServiceWeb} A new, configured instance of the client.
|
|
27
|
+
* @throws {Error} If the group format is invalid (validation occurs in createGroupInterceptor)
|
|
28
|
+
*/
|
|
29
|
+
withGroup(group: string): MarketOrderServiceWeb;
|
|
30
|
+
/**
|
|
31
|
+
* Retrieves a market order.
|
|
32
|
+
* @param {GetMarketOrderRequest} request - The request object for getmarketorder.
|
|
33
|
+
* @returns {Promise<MarketOrder>} A promise that resolves with the market order.
|
|
34
|
+
*/
|
|
35
|
+
getMarketOrder(request: GetMarketOrderRequest): Promise<MarketOrder>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
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.MarketOrderServiceWeb = void 0;
|
|
7
|
+
const connect_1 = require("@connectrpc/connect");
|
|
8
|
+
const connect_web_1 = require("@connectrpc/connect-web");
|
|
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
|
+
* Web client for interacting with the meshtrade.trading.market_order.v1 market order v1 API resource service.
|
|
15
|
+
* Uses Connect-ES with gRPC-Web transport for browser-compatible gRPC communication.
|
|
16
|
+
*/
|
|
17
|
+
class MarketOrderServiceWeb {
|
|
18
|
+
/**
|
|
19
|
+
* Constructs an instance of MarketOrderServiceWeb.
|
|
20
|
+
* @param {ConfigOpts} [config] - Optional configuration for the client.
|
|
21
|
+
* @param {Interceptor[]} [interceptors] - For internal use by `withGroup`.
|
|
22
|
+
*/
|
|
23
|
+
constructor(config, interceptors) {
|
|
24
|
+
this._config = (0, config_1.getConfigFromOpts)(config);
|
|
25
|
+
this._interceptors = interceptors || [];
|
|
26
|
+
// Create the gRPC-Web transport with interceptors
|
|
27
|
+
const transport = (0, connect_web_1.createGrpcWebTransport)({
|
|
28
|
+
baseUrl: this._config.apiServerURL,
|
|
29
|
+
interceptors: this._interceptors,
|
|
30
|
+
// Enable credentials (cookies) for cross-origin requests
|
|
31
|
+
fetch: (input, init) => globalThis.fetch(input, { ...init, credentials: 'include' }),
|
|
32
|
+
});
|
|
33
|
+
// Construct the Connect-ES client
|
|
34
|
+
this._client = (0, connect_1.createClient)(service_pb_1.MarketOrderService, transport);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Returns a new client instance configured to send the specified group
|
|
38
|
+
* resource name in the request headers for subsequent API calls.
|
|
39
|
+
*
|
|
40
|
+
* @param {string} group - The operating group context to inject into the request
|
|
41
|
+
* in the format `groups/{ulid}` where {ulid} is a 26-character ULID.
|
|
42
|
+
* Example: 'groups/01ARZ3NDEKTSV4YWVF8F5BH32'
|
|
43
|
+
* @returns {MarketOrderServiceWeb} A new, configured instance of the client.
|
|
44
|
+
* @throws {Error} If the group format is invalid (validation occurs in createGroupInterceptor)
|
|
45
|
+
*/
|
|
46
|
+
withGroup(group) {
|
|
47
|
+
// Check if a group interceptor already exists.
|
|
48
|
+
// Group interceptors are identified by having a 'groupContext' property
|
|
49
|
+
const hasGroupInterceptor = this._interceptors.some((interceptor) => interceptor.groupContext !== undefined);
|
|
50
|
+
if (hasGroupInterceptor) {
|
|
51
|
+
throw new Error("Attempted to set group context twice. A group has already been set for this client instance.");
|
|
52
|
+
}
|
|
53
|
+
// Create a new interceptor for the group context
|
|
54
|
+
const groupInterceptor = (0, connectInterceptors_1.createGroupInterceptor)(group);
|
|
55
|
+
// Return a new client instance with the existing interceptors plus the new one
|
|
56
|
+
return new MarketOrderServiceWeb(this._config, [
|
|
57
|
+
...this._interceptors,
|
|
58
|
+
groupInterceptor,
|
|
59
|
+
]);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Retrieves a market order.
|
|
63
|
+
* @param {GetMarketOrderRequest} request - The request object for getmarketorder.
|
|
64
|
+
* @returns {Promise<MarketOrder>} A promise that resolves with the market order.
|
|
65
|
+
*/
|
|
66
|
+
getMarketOrder(request) {
|
|
67
|
+
// Validate request
|
|
68
|
+
(0, validation_1.validateRequest)(request);
|
|
69
|
+
return this._client.getMarketOrder(request);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.MarketOrderServiceWeb = MarketOrderServiceWeb;
|
|
@@ -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;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
|
|
2
|
+
import type { Decimal } from "./decimal_pb";
|
|
3
|
+
import type { Token } from "./token_pb";
|
|
4
|
+
import type { Message } from "@bufbuild/protobuf";
|
|
5
|
+
/**
|
|
6
|
+
* Describes the file meshtrade/type/v1/amount.proto.
|
|
7
|
+
*/
|
|
8
|
+
export declare const file_meshtrade_type_v1_amount: GenFile;
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* A canonical structure for representing a precise quantity of a specific
|
|
12
|
+
* digital asset.
|
|
13
|
+
* An Amount is a self-describing monetary value, pairing a Universal Token
|
|
14
|
+
* Identifier (the 'what') with a high-precision Decimal value (the 'how much').
|
|
15
|
+
* This model ensures that a quantity of an asset is never ambiguous.
|
|
16
|
+
*
|
|
17
|
+
* @generated from message meshtrade.type.v1.Amount
|
|
18
|
+
*/
|
|
19
|
+
export type Amount = Message<"meshtrade.type.v1.Amount"> & {
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* Token is the unit of account. This field uses the Universal Token Identifier to
|
|
23
|
+
* define exactly WHAT asset is being quantified.
|
|
24
|
+
*
|
|
25
|
+
* @generated from field: meshtrade.type.v1.Token token = 1;
|
|
26
|
+
*/
|
|
27
|
+
token?: Token;
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* Value is the magnitude of the amount, representing HOW MUCH of the specified
|
|
31
|
+
* token this value holds.
|
|
32
|
+
* CRITICAL: To prevent precision errors, this decimal value MUST be
|
|
33
|
+
* truncated to the exact number of decimal places supported by the
|
|
34
|
+
* token's native ledger.
|
|
35
|
+
*
|
|
36
|
+
* @generated from field: meshtrade.type.v1.Decimal value = 2;
|
|
37
|
+
*/
|
|
38
|
+
value?: Decimal;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Describes the message meshtrade.type.v1.Amount.
|
|
42
|
+
* Use `create(AmountSchema)` to create a new message.
|
|
43
|
+
*/
|
|
44
|
+
export declare const AmountSchema: GenMessage<Amount>;
|