@cobo/cobo-waas2 1.9.0 → 1.10.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 (89) hide show
  1. package/README.md +40 -4
  2. package/dist/ApiClient.js +1 -1
  3. package/dist/api/DevelopersApi.js +4 -4
  4. package/dist/api/StakingsApi.js +400 -6
  5. package/dist/api/SwapsApi.js +360 -0
  6. package/dist/api/TransactionsApi.js +4 -4
  7. package/dist/index.js +164 -3
  8. package/dist/model/AddressesEventData.js +4 -4
  9. package/dist/model/AddressesEventDataAllOfAddresses.js +295 -0
  10. package/dist/model/BTCEIP191MessageSignDestination.js +1 -1
  11. package/dist/model/BabylonAirdropPop.js +186 -0
  12. package/dist/model/BabylonAirdropRegistration.js +172 -0
  13. package/dist/model/BabylonEligibleAirdrop.js +157 -0
  14. package/dist/model/BabylonRegistrationRequestStatus.js +66 -0
  15. package/dist/model/BabylonRegistrationStatus.js +66 -0
  16. package/dist/model/BabylonStakingRegistration.js +185 -0
  17. package/dist/model/ContractCallSource.js +6 -0
  18. package/dist/model/CreateBabylonAirdropRegistration201Response.js +87 -0
  19. package/dist/model/CreateBabylonAirdropRegistrationRequest.js +105 -0
  20. package/dist/model/CreateBabylonStakingRegistration201Response.js +87 -0
  21. package/dist/model/CreateBabylonStakingRegistrationRequest.js +103 -0
  22. package/dist/model/CreateSwapActivityRequest.js +153 -0
  23. package/dist/model/CreateSwapQuote201Response.js +264 -0
  24. package/dist/model/CreateSwapQuoteRequest.js +166 -0
  25. package/dist/model/ListBabylonAirdropRegistrations200Response.js +123 -0
  26. package/dist/model/ListBabylonEligibleAirdrops200Response.js +123 -0
  27. package/dist/model/ListBabylonEligibleStakings200Response.js +123 -0
  28. package/dist/model/ListBabylonEligibleStakings200ResponseDataInner.js +141 -0
  29. package/dist/model/ListBabylonStakingRegistrations200Response.js +123 -0
  30. package/dist/model/{SwapSummary.js → ListEnableTokenPairs200Response.js} +51 -49
  31. package/dist/model/ListSwapActivities200Response.js +123 -0
  32. package/dist/model/MessageSignSource.js +6 -0
  33. package/dist/model/MpcContractCallSource.js +16 -0
  34. package/dist/model/MpcMessageSignSource.js +16 -0
  35. package/dist/model/MpcSigningGroup.js +27 -4
  36. package/dist/model/MpcTransferSource.js +16 -0
  37. package/dist/model/QueryGuardPubkey200ResponseAddressesInner.js +2 -2
  38. package/dist/model/StakingPoolId.js +30 -0
  39. package/dist/model/StakingPoolType.js +15 -0
  40. package/dist/model/SwapQuote.js +203 -0
  41. package/dist/model/TransactionDestination.js +4 -4
  42. package/dist/model/TransactionRawTxInfo.js +16 -0
  43. package/dist/model/TransactionRbfSource.js +6 -0
  44. package/dist/model/TransactionUtxoChange.js +101 -0
  45. package/dist/model/TransferSource.js +6 -0
  46. package/dist/model/WebhookEventData.js +2 -2
  47. package/docs/AddressesEventData.md +1 -1
  48. package/docs/AddressesEventDataAllOfAddresses.md +19 -0
  49. package/docs/BabylonAirdropPop.md +14 -0
  50. package/docs/BabylonAirdropRegistration.md +16 -0
  51. package/docs/BabylonEligibleAirdrop.md +14 -0
  52. package/docs/BabylonRegistrationRequestStatus.md +14 -0
  53. package/docs/BabylonRegistrationStatus.md +14 -0
  54. package/docs/BabylonStakingRegistration.md +17 -0
  55. package/docs/ContractCallSource.md +1 -0
  56. package/docs/CreateBabylonAirdropRegistration201Response.md +9 -0
  57. package/docs/CreateBabylonAirdropRegistrationRequest.md +10 -0
  58. package/docs/CreateBabylonStakingRegistration201Response.md +9 -0
  59. package/docs/CreateBabylonStakingRegistrationRequest.md +10 -0
  60. package/docs/CreateSwapActivityRequest.md +12 -0
  61. package/docs/CreateSwapQuote201Response.md +17 -0
  62. package/docs/CreateSwapQuoteRequest.md +13 -0
  63. package/docs/DevelopersApi.md +2 -2
  64. package/docs/ListBabylonAirdropRegistrations200Response.md +10 -0
  65. package/docs/ListBabylonEligibleAirdrops200Response.md +10 -0
  66. package/docs/ListBabylonEligibleStakings200Response.md +10 -0
  67. package/docs/ListBabylonEligibleStakings200ResponseDataInner.md +13 -0
  68. package/docs/ListBabylonStakingRegistrations200Response.md +10 -0
  69. package/docs/ListEnableTokenPairs200Response.md +10 -0
  70. package/docs/ListSwapActivities200Response.md +10 -0
  71. package/docs/MessageSignSource.md +1 -0
  72. package/docs/MpcContractCallSource.md +1 -0
  73. package/docs/MpcMessageSignSource.md +1 -0
  74. package/docs/MpcSigningGroup.md +1 -1
  75. package/docs/MpcTransferSource.md +1 -0
  76. package/docs/QueryGuardPubkey200ResponseAddressesInner.md +1 -1
  77. package/docs/StakingPoolId.md +12 -0
  78. package/docs/StakingPoolType.md +6 -0
  79. package/docs/StakingsApi.md +449 -1
  80. package/docs/SwapQuote.md +16 -0
  81. package/docs/SwapsApi.md +348 -0
  82. package/docs/TransactionRawTxInfo.md +1 -0
  83. package/docs/TransactionRbfSource.md +1 -0
  84. package/docs/TransactionUtxoChange.md +10 -0
  85. package/docs/TransactionsApi.md +2 -2
  86. package/docs/TransferSource.md +1 -0
  87. package/docs/WebhookEventData.md +1 -1
  88. package/package.json +2 -2
  89. package/docs/SwapSummary.md +0 -10
@@ -0,0 +1,153 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _ApiClient = _interopRequireDefault(require("../ApiClient"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
9
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
10
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
11
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
12
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
13
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
14
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
15
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
16
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
17
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
18
+ * Cobo Wallet as a Service 2.0
19
+ *
20
+ * Contact: help@cobo.com
21
+ *
22
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
23
+ * https://openapi-generator.tech
24
+ * Do not edit the class manually.
25
+ *
26
+ */
27
+ /**
28
+ * The CreateSwapActivityRequest model module.
29
+ * @module model/CreateSwapActivityRequest
30
+ */
31
+ var CreateSwapActivityRequest = /*#__PURE__*/function () {
32
+ /**
33
+ * Constructs a new <code>CreateSwapActivityRequest</code>.
34
+ * @alias module:model/CreateSwapActivityRequest
35
+ * @param wallet_id {String} The unique identifier of the wallet.
36
+ * @param quote_id {String} The unique identifier of the quote.
37
+ * @param slippage_tolerance {String} The slippage tolerance for the swap.
38
+ */
39
+ function CreateSwapActivityRequest(wallet_id, quote_id, slippage_tolerance) {
40
+ _classCallCheck(this, CreateSwapActivityRequest);
41
+ CreateSwapActivityRequest.initialize(this, wallet_id, quote_id, slippage_tolerance);
42
+ }
43
+
44
+ /**
45
+ * Initializes the fields of this object.
46
+ * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
47
+ * Only for internal use.
48
+ */
49
+ return _createClass(CreateSwapActivityRequest, null, [{
50
+ key: "initialize",
51
+ value: function initialize(obj, wallet_id, quote_id, slippage_tolerance) {
52
+ obj['wallet_id'] = wallet_id;
53
+ obj['quote_id'] = quote_id;
54
+ obj['slippage_tolerance'] = slippage_tolerance;
55
+ }
56
+
57
+ /**
58
+ * Constructs a <code>CreateSwapActivityRequest</code> from a plain JavaScript object, optionally creating a new instance.
59
+ * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
60
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
61
+ * @param {module:model/CreateSwapActivityRequest} obj Optional instance to populate.
62
+ * @return {module:model/CreateSwapActivityRequest} The populated <code>CreateSwapActivityRequest</code> instance.
63
+ */
64
+ }, {
65
+ key: "constructFromObject",
66
+ value: function constructFromObject(data, obj) {
67
+ if (data) {
68
+ obj = obj || new CreateSwapActivityRequest();
69
+ if (data.hasOwnProperty('wallet_id')) {
70
+ obj['wallet_id'] = _ApiClient["default"].convertToType(data['wallet_id'], 'String');
71
+ }
72
+ if (data.hasOwnProperty('quote_id')) {
73
+ obj['quote_id'] = _ApiClient["default"].convertToType(data['quote_id'], 'String');
74
+ }
75
+ if (data.hasOwnProperty('slippage_tolerance')) {
76
+ obj['slippage_tolerance'] = _ApiClient["default"].convertToType(data['slippage_tolerance'], 'String');
77
+ }
78
+ if (data.hasOwnProperty('app_initiator')) {
79
+ obj['app_initiator'] = _ApiClient["default"].convertToType(data['app_initiator'], 'String');
80
+ }
81
+ }
82
+ return obj;
83
+ }
84
+
85
+ /**
86
+ * Validates the JSON data with respect to <code>CreateSwapActivityRequest</code>.
87
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
88
+ * @return {boolean} to indicate whether the JSON data is valid with respect to <code>CreateSwapActivityRequest</code>.
89
+ */
90
+ }, {
91
+ key: "validateJSON",
92
+ value: function validateJSON(data) {
93
+ // check to make sure all required properties are present in the JSON string
94
+ var _iterator = _createForOfIteratorHelper(CreateSwapActivityRequest.RequiredProperties),
95
+ _step;
96
+ try {
97
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
98
+ var property = _step.value;
99
+ if (!data.hasOwnProperty(property)) {
100
+ throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
101
+ }
102
+ }
103
+ // ensure the json data is a string
104
+ } catch (err) {
105
+ _iterator.e(err);
106
+ } finally {
107
+ _iterator.f();
108
+ }
109
+ if (data['wallet_id'] && !(typeof data['wallet_id'] === 'string' || data['wallet_id'] instanceof String)) {
110
+ throw new Error("Expected the field `wallet_id` to be a primitive type in the JSON string but got " + data['wallet_id']);
111
+ }
112
+ // ensure the json data is a string
113
+ if (data['quote_id'] && !(typeof data['quote_id'] === 'string' || data['quote_id'] instanceof String)) {
114
+ throw new Error("Expected the field `quote_id` to be a primitive type in the JSON string but got " + data['quote_id']);
115
+ }
116
+ // ensure the json data is a string
117
+ if (data['slippage_tolerance'] && !(typeof data['slippage_tolerance'] === 'string' || data['slippage_tolerance'] instanceof String)) {
118
+ throw new Error("Expected the field `slippage_tolerance` to be a primitive type in the JSON string but got " + data['slippage_tolerance']);
119
+ }
120
+ // ensure the json data is a string
121
+ if (data['app_initiator'] && !(typeof data['app_initiator'] === 'string' || data['app_initiator'] instanceof String)) {
122
+ throw new Error("Expected the field `app_initiator` to be a primitive type in the JSON string but got " + data['app_initiator']);
123
+ }
124
+ return true;
125
+ }
126
+ }]);
127
+ }();
128
+ CreateSwapActivityRequest.RequiredProperties = ["wallet_id", "quote_id", "slippage_tolerance"];
129
+
130
+ /**
131
+ * The unique identifier of the wallet.
132
+ * @member {String} wallet_id
133
+ */
134
+ CreateSwapActivityRequest.prototype['wallet_id'] = undefined;
135
+
136
+ /**
137
+ * The unique identifier of the quote.
138
+ * @member {String} quote_id
139
+ */
140
+ CreateSwapActivityRequest.prototype['quote_id'] = undefined;
141
+
142
+ /**
143
+ * The slippage tolerance for the swap.
144
+ * @member {String} slippage_tolerance
145
+ */
146
+ CreateSwapActivityRequest.prototype['slippage_tolerance'] = undefined;
147
+
148
+ /**
149
+ * The initiator of the app activity. If you do not specify this property, the WaaS service will automatically designate the API key as the initiator.
150
+ * @member {String} app_initiator
151
+ */
152
+ CreateSwapActivityRequest.prototype['app_initiator'] = undefined;
153
+ var _default = exports["default"] = CreateSwapActivityRequest;
@@ -0,0 +1,264 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _ApiClient = _interopRequireDefault(require("../ApiClient"));
8
+ var _SwapQuote = _interopRequireDefault(require("./SwapQuote"));
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
10
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
11
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
12
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
13
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
14
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
15
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
16
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
17
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
18
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
19
+ * Cobo Wallet as a Service 2.0
20
+ *
21
+ * Contact: help@cobo.com
22
+ *
23
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
24
+ * https://openapi-generator.tech
25
+ * Do not edit the class manually.
26
+ *
27
+ */
28
+ /**
29
+ * The CreateSwapQuote201Response model module.
30
+ * @module model/CreateSwapQuote201Response
31
+ */
32
+ var CreateSwapQuote201Response = /*#__PURE__*/function () {
33
+ /**
34
+ * Constructs a new <code>CreateSwapQuote201Response</code>.
35
+ * @alias module:model/CreateSwapQuote201Response
36
+ * @implements module:model/SwapQuote
37
+ * @param pay_amount {String} The amount of tokens to pay.
38
+ * @param receive_amount {String} The amount of tokens to receive.
39
+ * @param fee_amount {String} The amount of tokens to pay for fee.
40
+ * @param quote_expired_timestamp {Number} The time when the quote will expire, in Unix timestamp format, measured in milliseconds.
41
+ * @param quote_id {String} The unique identifier of this quote.
42
+ */
43
+ function CreateSwapQuote201Response(pay_amount, receive_amount, fee_amount, quote_expired_timestamp, quote_id) {
44
+ _classCallCheck(this, CreateSwapQuote201Response);
45
+ _SwapQuote["default"].initialize(this, pay_amount, receive_amount, fee_amount, quote_expired_timestamp);
46
+ CreateSwapQuote201Response.initialize(this, pay_amount, receive_amount, fee_amount, quote_expired_timestamp, quote_id);
47
+ }
48
+
49
+ /**
50
+ * Initializes the fields of this object.
51
+ * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
52
+ * Only for internal use.
53
+ */
54
+ return _createClass(CreateSwapQuote201Response, null, [{
55
+ key: "initialize",
56
+ value: function initialize(obj, pay_amount, receive_amount, fee_amount, quote_expired_timestamp, quote_id) {
57
+ obj['pay_amount'] = pay_amount;
58
+ obj['receive_amount'] = receive_amount;
59
+ obj['fee_amount'] = fee_amount;
60
+ obj['quote_expired_timestamp'] = quote_expired_timestamp;
61
+ obj['quote_id'] = quote_id;
62
+ }
63
+
64
+ /**
65
+ * Constructs a <code>CreateSwapQuote201Response</code> from a plain JavaScript object, optionally creating a new instance.
66
+ * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
67
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
68
+ * @param {module:model/CreateSwapQuote201Response} obj Optional instance to populate.
69
+ * @return {module:model/CreateSwapQuote201Response} The populated <code>CreateSwapQuote201Response</code> instance.
70
+ */
71
+ }, {
72
+ key: "constructFromObject",
73
+ value: function constructFromObject(data, obj) {
74
+ if (data) {
75
+ obj = obj || new CreateSwapQuote201Response();
76
+ _SwapQuote["default"].constructFromObject(data, obj);
77
+ if (data.hasOwnProperty('pay_amount')) {
78
+ obj['pay_amount'] = _ApiClient["default"].convertToType(data['pay_amount'], 'String');
79
+ }
80
+ if (data.hasOwnProperty('receive_amount')) {
81
+ obj['receive_amount'] = _ApiClient["default"].convertToType(data['receive_amount'], 'String');
82
+ }
83
+ if (data.hasOwnProperty('fee_amount')) {
84
+ obj['fee_amount'] = _ApiClient["default"].convertToType(data['fee_amount'], 'String');
85
+ }
86
+ if (data.hasOwnProperty('min_pay_amount')) {
87
+ obj['min_pay_amount'] = _ApiClient["default"].convertToType(data['min_pay_amount'], 'String');
88
+ }
89
+ if (data.hasOwnProperty('max_pay_amount')) {
90
+ obj['max_pay_amount'] = _ApiClient["default"].convertToType(data['max_pay_amount'], 'String');
91
+ }
92
+ if (data.hasOwnProperty('min_receive_amount')) {
93
+ obj['min_receive_amount'] = _ApiClient["default"].convertToType(data['min_receive_amount'], 'String');
94
+ }
95
+ if (data.hasOwnProperty('max_receive_amount')) {
96
+ obj['max_receive_amount'] = _ApiClient["default"].convertToType(data['max_receive_amount'], 'String');
97
+ }
98
+ if (data.hasOwnProperty('quote_expired_timestamp')) {
99
+ obj['quote_expired_timestamp'] = _ApiClient["default"].convertToType(data['quote_expired_timestamp'], 'Number');
100
+ }
101
+ if (data.hasOwnProperty('quote_id')) {
102
+ obj['quote_id'] = _ApiClient["default"].convertToType(data['quote_id'], 'String');
103
+ }
104
+ }
105
+ return obj;
106
+ }
107
+
108
+ /**
109
+ * Validates the JSON data with respect to <code>CreateSwapQuote201Response</code>.
110
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
111
+ * @return {boolean} to indicate whether the JSON data is valid with respect to <code>CreateSwapQuote201Response</code>.
112
+ */
113
+ }, {
114
+ key: "validateJSON",
115
+ value: function validateJSON(data) {
116
+ // check to make sure all required properties are present in the JSON string
117
+ var _iterator = _createForOfIteratorHelper(CreateSwapQuote201Response.RequiredProperties),
118
+ _step;
119
+ try {
120
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
121
+ var property = _step.value;
122
+ if (!data.hasOwnProperty(property)) {
123
+ throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
124
+ }
125
+ }
126
+ // ensure the json data is a string
127
+ } catch (err) {
128
+ _iterator.e(err);
129
+ } finally {
130
+ _iterator.f();
131
+ }
132
+ if (data['pay_amount'] && !(typeof data['pay_amount'] === 'string' || data['pay_amount'] instanceof String)) {
133
+ throw new Error("Expected the field `pay_amount` to be a primitive type in the JSON string but got " + data['pay_amount']);
134
+ }
135
+ // ensure the json data is a string
136
+ if (data['receive_amount'] && !(typeof data['receive_amount'] === 'string' || data['receive_amount'] instanceof String)) {
137
+ throw new Error("Expected the field `receive_amount` to be a primitive type in the JSON string but got " + data['receive_amount']);
138
+ }
139
+ // ensure the json data is a string
140
+ if (data['fee_amount'] && !(typeof data['fee_amount'] === 'string' || data['fee_amount'] instanceof String)) {
141
+ throw new Error("Expected the field `fee_amount` to be a primitive type in the JSON string but got " + data['fee_amount']);
142
+ }
143
+ // ensure the json data is a string
144
+ if (data['min_pay_amount'] && !(typeof data['min_pay_amount'] === 'string' || data['min_pay_amount'] instanceof String)) {
145
+ throw new Error("Expected the field `min_pay_amount` to be a primitive type in the JSON string but got " + data['min_pay_amount']);
146
+ }
147
+ // ensure the json data is a string
148
+ if (data['max_pay_amount'] && !(typeof data['max_pay_amount'] === 'string' || data['max_pay_amount'] instanceof String)) {
149
+ throw new Error("Expected the field `max_pay_amount` to be a primitive type in the JSON string but got " + data['max_pay_amount']);
150
+ }
151
+ // ensure the json data is a string
152
+ if (data['min_receive_amount'] && !(typeof data['min_receive_amount'] === 'string' || data['min_receive_amount'] instanceof String)) {
153
+ throw new Error("Expected the field `min_receive_amount` to be a primitive type in the JSON string but got " + data['min_receive_amount']);
154
+ }
155
+ // ensure the json data is a string
156
+ if (data['max_receive_amount'] && !(typeof data['max_receive_amount'] === 'string' || data['max_receive_amount'] instanceof String)) {
157
+ throw new Error("Expected the field `max_receive_amount` to be a primitive type in the JSON string but got " + data['max_receive_amount']);
158
+ }
159
+ // ensure the json data is a string
160
+ if (data['quote_id'] && !(typeof data['quote_id'] === 'string' || data['quote_id'] instanceof String)) {
161
+ throw new Error("Expected the field `quote_id` to be a primitive type in the JSON string but got " + data['quote_id']);
162
+ }
163
+ return true;
164
+ }
165
+ }]);
166
+ }();
167
+ CreateSwapQuote201Response.RequiredProperties = ["pay_amount", "receive_amount", "fee_amount", "quote_expired_timestamp", "quote_id"];
168
+
169
+ /**
170
+ * The amount of tokens to pay.
171
+ * @member {String} pay_amount
172
+ */
173
+ CreateSwapQuote201Response.prototype['pay_amount'] = undefined;
174
+
175
+ /**
176
+ * The amount of tokens to receive.
177
+ * @member {String} receive_amount
178
+ */
179
+ CreateSwapQuote201Response.prototype['receive_amount'] = undefined;
180
+
181
+ /**
182
+ * The amount of tokens to pay for fee.
183
+ * @member {String} fee_amount
184
+ */
185
+ CreateSwapQuote201Response.prototype['fee_amount'] = undefined;
186
+
187
+ /**
188
+ * The minimum amount of tokens to pay.
189
+ * @member {String} min_pay_amount
190
+ */
191
+ CreateSwapQuote201Response.prototype['min_pay_amount'] = undefined;
192
+
193
+ /**
194
+ * The maximum amount of tokens to pay.
195
+ * @member {String} max_pay_amount
196
+ */
197
+ CreateSwapQuote201Response.prototype['max_pay_amount'] = undefined;
198
+
199
+ /**
200
+ * The minimum amount of tokens to receive.
201
+ * @member {String} min_receive_amount
202
+ */
203
+ CreateSwapQuote201Response.prototype['min_receive_amount'] = undefined;
204
+
205
+ /**
206
+ * The maximum amount of tokens to receive.
207
+ * @member {String} max_receive_amount
208
+ */
209
+ CreateSwapQuote201Response.prototype['max_receive_amount'] = undefined;
210
+
211
+ /**
212
+ * The time when the quote will expire, in Unix timestamp format, measured in milliseconds.
213
+ * @member {Number} quote_expired_timestamp
214
+ */
215
+ CreateSwapQuote201Response.prototype['quote_expired_timestamp'] = undefined;
216
+
217
+ /**
218
+ * The unique identifier of this quote.
219
+ * @member {String} quote_id
220
+ */
221
+ CreateSwapQuote201Response.prototype['quote_id'] = undefined;
222
+
223
+ // Implement SwapQuote interface:
224
+ /**
225
+ * The amount of tokens to pay.
226
+ * @member {String} pay_amount
227
+ */
228
+ _SwapQuote["default"].prototype['pay_amount'] = undefined;
229
+ /**
230
+ * The amount of tokens to receive.
231
+ * @member {String} receive_amount
232
+ */
233
+ _SwapQuote["default"].prototype['receive_amount'] = undefined;
234
+ /**
235
+ * The amount of tokens to pay for fee.
236
+ * @member {String} fee_amount
237
+ */
238
+ _SwapQuote["default"].prototype['fee_amount'] = undefined;
239
+ /**
240
+ * The minimum amount of tokens to pay.
241
+ * @member {String} min_pay_amount
242
+ */
243
+ _SwapQuote["default"].prototype['min_pay_amount'] = undefined;
244
+ /**
245
+ * The maximum amount of tokens to pay.
246
+ * @member {String} max_pay_amount
247
+ */
248
+ _SwapQuote["default"].prototype['max_pay_amount'] = undefined;
249
+ /**
250
+ * The minimum amount of tokens to receive.
251
+ * @member {String} min_receive_amount
252
+ */
253
+ _SwapQuote["default"].prototype['min_receive_amount'] = undefined;
254
+ /**
255
+ * The maximum amount of tokens to receive.
256
+ * @member {String} max_receive_amount
257
+ */
258
+ _SwapQuote["default"].prototype['max_receive_amount'] = undefined;
259
+ /**
260
+ * The time when the quote will expire, in Unix timestamp format, measured in milliseconds.
261
+ * @member {Number} quote_expired_timestamp
262
+ */
263
+ _SwapQuote["default"].prototype['quote_expired_timestamp'] = undefined;
264
+ var _default = exports["default"] = CreateSwapQuote201Response;
@@ -0,0 +1,166 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _ApiClient = _interopRequireDefault(require("../ApiClient"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
9
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
10
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
11
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
12
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
13
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
14
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
15
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
16
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
17
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
18
+ * Cobo Wallet as a Service 2.0
19
+ *
20
+ * Contact: help@cobo.com
21
+ *
22
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
23
+ * https://openapi-generator.tech
24
+ * Do not edit the class manually.
25
+ *
26
+ */
27
+ /**
28
+ * The CreateSwapQuoteRequest model module.
29
+ * @module model/CreateSwapQuoteRequest
30
+ */
31
+ var CreateSwapQuoteRequest = /*#__PURE__*/function () {
32
+ /**
33
+ * Constructs a new <code>CreateSwapQuoteRequest</code>.
34
+ * @alias module:model/CreateSwapQuoteRequest
35
+ * @param wallet_id {String} The unique identifier of the wallet.
36
+ * @param pay_token_id {String} Unique id of the token to pay.
37
+ * @param receive_token_id {String} Unique id of the token to receive.
38
+ */
39
+ function CreateSwapQuoteRequest(wallet_id, pay_token_id, receive_token_id) {
40
+ _classCallCheck(this, CreateSwapQuoteRequest);
41
+ CreateSwapQuoteRequest.initialize(this, wallet_id, pay_token_id, receive_token_id);
42
+ }
43
+
44
+ /**
45
+ * Initializes the fields of this object.
46
+ * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
47
+ * Only for internal use.
48
+ */
49
+ return _createClass(CreateSwapQuoteRequest, null, [{
50
+ key: "initialize",
51
+ value: function initialize(obj, wallet_id, pay_token_id, receive_token_id) {
52
+ obj['wallet_id'] = wallet_id;
53
+ obj['pay_token_id'] = pay_token_id;
54
+ obj['receive_token_id'] = receive_token_id;
55
+ }
56
+
57
+ /**
58
+ * Constructs a <code>CreateSwapQuoteRequest</code> from a plain JavaScript object, optionally creating a new instance.
59
+ * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
60
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
61
+ * @param {module:model/CreateSwapQuoteRequest} obj Optional instance to populate.
62
+ * @return {module:model/CreateSwapQuoteRequest} The populated <code>CreateSwapQuoteRequest</code> instance.
63
+ */
64
+ }, {
65
+ key: "constructFromObject",
66
+ value: function constructFromObject(data, obj) {
67
+ if (data) {
68
+ obj = obj || new CreateSwapQuoteRequest();
69
+ if (data.hasOwnProperty('wallet_id')) {
70
+ obj['wallet_id'] = _ApiClient["default"].convertToType(data['wallet_id'], 'String');
71
+ }
72
+ if (data.hasOwnProperty('pay_token_id')) {
73
+ obj['pay_token_id'] = _ApiClient["default"].convertToType(data['pay_token_id'], 'String');
74
+ }
75
+ if (data.hasOwnProperty('receive_token_id')) {
76
+ obj['receive_token_id'] = _ApiClient["default"].convertToType(data['receive_token_id'], 'String');
77
+ }
78
+ if (data.hasOwnProperty('pay_amount')) {
79
+ obj['pay_amount'] = _ApiClient["default"].convertToType(data['pay_amount'], 'String');
80
+ }
81
+ if (data.hasOwnProperty('receive_amount')) {
82
+ obj['receive_amount'] = _ApiClient["default"].convertToType(data['receive_amount'], 'String');
83
+ }
84
+ }
85
+ return obj;
86
+ }
87
+
88
+ /**
89
+ * Validates the JSON data with respect to <code>CreateSwapQuoteRequest</code>.
90
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
91
+ * @return {boolean} to indicate whether the JSON data is valid with respect to <code>CreateSwapQuoteRequest</code>.
92
+ */
93
+ }, {
94
+ key: "validateJSON",
95
+ value: function validateJSON(data) {
96
+ // check to make sure all required properties are present in the JSON string
97
+ var _iterator = _createForOfIteratorHelper(CreateSwapQuoteRequest.RequiredProperties),
98
+ _step;
99
+ try {
100
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
101
+ var property = _step.value;
102
+ if (!data.hasOwnProperty(property)) {
103
+ throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
104
+ }
105
+ }
106
+ // ensure the json data is a string
107
+ } catch (err) {
108
+ _iterator.e(err);
109
+ } finally {
110
+ _iterator.f();
111
+ }
112
+ if (data['wallet_id'] && !(typeof data['wallet_id'] === 'string' || data['wallet_id'] instanceof String)) {
113
+ throw new Error("Expected the field `wallet_id` to be a primitive type in the JSON string but got " + data['wallet_id']);
114
+ }
115
+ // ensure the json data is a string
116
+ if (data['pay_token_id'] && !(typeof data['pay_token_id'] === 'string' || data['pay_token_id'] instanceof String)) {
117
+ throw new Error("Expected the field `pay_token_id` to be a primitive type in the JSON string but got " + data['pay_token_id']);
118
+ }
119
+ // ensure the json data is a string
120
+ if (data['receive_token_id'] && !(typeof data['receive_token_id'] === 'string' || data['receive_token_id'] instanceof String)) {
121
+ throw new Error("Expected the field `receive_token_id` to be a primitive type in the JSON string but got " + data['receive_token_id']);
122
+ }
123
+ // ensure the json data is a string
124
+ if (data['pay_amount'] && !(typeof data['pay_amount'] === 'string' || data['pay_amount'] instanceof String)) {
125
+ throw new Error("Expected the field `pay_amount` to be a primitive type in the JSON string but got " + data['pay_amount']);
126
+ }
127
+ // ensure the json data is a string
128
+ if (data['receive_amount'] && !(typeof data['receive_amount'] === 'string' || data['receive_amount'] instanceof String)) {
129
+ throw new Error("Expected the field `receive_amount` to be a primitive type in the JSON string but got " + data['receive_amount']);
130
+ }
131
+ return true;
132
+ }
133
+ }]);
134
+ }();
135
+ CreateSwapQuoteRequest.RequiredProperties = ["wallet_id", "pay_token_id", "receive_token_id"];
136
+
137
+ /**
138
+ * The unique identifier of the wallet.
139
+ * @member {String} wallet_id
140
+ */
141
+ CreateSwapQuoteRequest.prototype['wallet_id'] = undefined;
142
+
143
+ /**
144
+ * Unique id of the token to pay.
145
+ * @member {String} pay_token_id
146
+ */
147
+ CreateSwapQuoteRequest.prototype['pay_token_id'] = undefined;
148
+
149
+ /**
150
+ * Unique id of the token to receive.
151
+ * @member {String} receive_token_id
152
+ */
153
+ CreateSwapQuoteRequest.prototype['receive_token_id'] = undefined;
154
+
155
+ /**
156
+ * Amount of tokens to pay. For example \"0.5 BTC\". Note: Either pay_amount or receive_amount must be provided, but not both.
157
+ * @member {String} pay_amount
158
+ */
159
+ CreateSwapQuoteRequest.prototype['pay_amount'] = undefined;
160
+
161
+ /**
162
+ * Amount of tokens to receive. For example \"0.5 ETH_WBTC\". Note: Either pay_amount or receive_amount must be provided, but not both.
163
+ * @member {String} receive_amount
164
+ */
165
+ CreateSwapQuoteRequest.prototype['receive_amount'] = undefined;
166
+ var _default = exports["default"] = CreateSwapQuoteRequest;