@cobo/cobo-waas2 1.12.0 → 1.13.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 +54 -18
- package/dist/ApiClient.js +1 -1
- package/dist/api/FeeStationApi.js +18 -18
- package/dist/api/TransactionsApi.js +2 -2
- package/dist/api/WalletsApi.js +8 -8
- package/dist/index.js +260 -43
- package/dist/model/ActivityExtra.js +0 -23
- package/dist/model/AddressEncoding.js +15 -0
- package/dist/model/AddressesEventData.js +8 -3
- package/dist/model/BTCBIP137MessageSignDestination.js +122 -0
- package/dist/model/BTCBIP322MessageSignDestination.js +122 -0
- package/dist/model/BabylonStakingActivityDetailExtra.js +0 -39
- package/dist/model/{ListSwapActivities200Response.js → BankAccount.js} +51 -51
- package/dist/model/ChainsEventData.js +8 -3
- package/dist/model/CosmosAdr36MessageSignDestination.js +122 -0
- package/dist/model/CosmosContractCallDestination.js +152 -0
- package/dist/model/CosmosContractCallMessage.js +126 -0
- package/dist/model/CreateSettlement.js +174 -0
- package/dist/model/MPCVaultEventData.js +8 -3
- package/dist/model/{CreateSwapActivityRequest.js → Merchant.js} +45 -58
- package/dist/model/MessageSignDestination.js +111 -9
- package/dist/model/MessageSignDestinationType.js +15 -0
- package/dist/model/Order.js +306 -0
- package/dist/model/OrderStatus.js +76 -0
- package/dist/model/PaymentTransaction.js +201 -0
- package/dist/model/RefreshAddressBalancesByTokenRequest.js +2 -3
- package/dist/model/Refund.js +237 -0
- package/dist/model/RefundStatus.js +76 -0
- package/dist/model/RefundType.js +61 -0
- package/dist/model/SettleRequestStatus.js +76 -0
- package/dist/model/SettleStatus.js +76 -0
- package/dist/model/Settlement.js +168 -0
- package/dist/model/SettlementDetail.js +184 -0
- package/dist/model/SettlementInfo.js +175 -0
- package/dist/model/SettlementType.js +61 -0
- package/dist/model/SwapActivity.js +36 -5
- package/dist/model/SwapActivityStatus.js +66 -0
- package/dist/model/SwapActivityType.js +61 -0
- package/dist/model/SwapQuote.js +21 -34
- package/dist/model/{CreateSwapQuoteRequest.js → SwapToken.js} +73 -60
- package/dist/model/TSSRequestWebhookEventData.js +8 -3
- package/dist/model/TokenListing.js +230 -0
- package/dist/model/TokenListingEventData.js +363 -0
- package/dist/model/TokenListingRequestSource.js +61 -0
- package/dist/model/TokenListingRequestStatus.js +66 -0
- package/dist/model/TokensEventData.js +8 -3
- package/dist/model/Transaction.js +22 -5
- package/dist/model/TransactionBIP137Destination.js +122 -0
- package/dist/model/TransactionBIP322Destination.js +122 -0
- package/dist/model/TransactionBabylonBusinessInfo.js +138 -0
- package/dist/model/TransactionBabylonTxParameters.js +168 -0
- package/dist/model/TransactionCoreStakeInfo.js +168 -0
- package/dist/model/TransactionCosmosAdr36Destination.js +122 -0
- package/dist/model/TransactionCosmosContractDestination.js +152 -0
- package/dist/model/{ListEnableTokenPairs200Response.js → TransactionCosmosMessage.js} +54 -51
- package/dist/model/TransactionDestination.js +172 -8
- package/dist/model/TransactionDestinationType.js +20 -0
- package/dist/model/TransactionDetail.js +29 -7
- package/dist/model/TransactionDetails.js +29 -7
- package/dist/model/TransactionExtra.js +278 -0
- package/dist/model/TransactionExtraType.js +66 -0
- package/dist/model/TransactionFuelingInfo.js +3 -3
- package/dist/model/TransactionMessageSignBTCEIP191Destination.js +122 -0
- package/dist/model/TransactionRbfSource.js +37 -9
- package/dist/model/TransactionSelectedUtxo.js +2 -2
- package/dist/model/TransactionSubStatus.js +45 -0
- package/dist/model/TransactionWebhookEventData.js +37 -10
- package/dist/model/UpdateCustodialWalletParams.js +6 -4
- package/dist/model/UpdateExchangeWalletParams.js +6 -4
- package/dist/model/UpdateMpcWalletParams.js +6 -4
- package/dist/model/UpdateSmartContractWalletParams.js +6 -4
- package/dist/model/WalletInfoEventData.js +8 -3
- package/dist/model/WebhookEventData.js +81 -18
- package/dist/model/WebhookEventDataType.js +7 -2
- package/dist/model/WebhookEventType.js +10 -0
- package/docs/ActivityExtra.md +0 -4
- package/docs/AddressEncoding.md +6 -0
- package/docs/AddressesEventData.md +3 -1
- package/docs/BTCBIP137MessageSignDestination.md +10 -0
- package/docs/BTCBIP322MessageSignDestination.md +10 -0
- package/docs/BabylonStakingActivityDetailExtra.md +0 -4
- package/docs/BankAccount.md +10 -0
- package/docs/ChainsEventData.md +3 -1
- package/docs/CosmosAdr36MessageSignDestination.md +10 -0
- package/docs/CosmosContractCallDestination.md +11 -0
- package/docs/CosmosContractCallMessage.md +10 -0
- package/docs/CreateSettlement.md +14 -0
- package/docs/FeeStationApi.md +13 -13
- package/docs/MPCVaultEventData.md +3 -1
- package/docs/Merchant.md +11 -0
- package/docs/MessageSignDestination.md +3 -0
- package/docs/MessageSignDestinationType.md +6 -0
- package/docs/Order.md +23 -0
- package/docs/OrderStatus.md +18 -0
- package/docs/PaymentTransaction.md +16 -0
- package/docs/RefreshAddressBalancesByTokenRequest.md +1 -1
- package/docs/Refund.md +17 -0
- package/docs/RefundStatus.md +18 -0
- package/docs/RefundType.md +12 -0
- package/docs/SettleRequestStatus.md +18 -0
- package/docs/SettleStatus.md +18 -0
- package/docs/Settlement.md +12 -0
- package/docs/SettlementDetail.md +15 -0
- package/docs/SettlementInfo.md +14 -0
- package/docs/SettlementType.md +12 -0
- package/docs/SwapActivity.md +4 -1
- package/docs/SwapActivityStatus.md +14 -0
- package/docs/SwapActivityType.md +12 -0
- package/docs/SwapQuote.md +3 -4
- package/docs/SwapToken.md +14 -0
- package/docs/TSSRequestWebhookEventData.md +3 -1
- package/docs/TokenListing.md +19 -0
- package/docs/TokenListingEventData.md +45 -0
- package/docs/TokenListingRequestSource.md +12 -0
- package/docs/TokenListingRequestStatus.md +14 -0
- package/docs/TokensEventData.md +3 -1
- package/docs/Transaction.md +4 -3
- package/docs/TransactionBIP137Destination.md +10 -0
- package/docs/TransactionBIP322Destination.md +10 -0
- package/docs/TransactionBabylonBusinessInfo.md +11 -0
- package/docs/TransactionBabylonTxParameters.md +15 -0
- package/docs/TransactionCoreStakeInfo.md +14 -0
- package/docs/TransactionCosmosAdr36Destination.md +10 -0
- package/docs/TransactionCosmosContractDestination.md +11 -0
- package/docs/TransactionCosmosMessage.md +10 -0
- package/docs/TransactionDestination.md +4 -0
- package/docs/TransactionDestinationType.md +8 -0
- package/docs/TransactionDetail.md +4 -3
- package/docs/TransactionDetails.md +4 -3
- package/docs/TransactionExtra.md +21 -0
- package/docs/TransactionExtraType.md +14 -0
- package/docs/TransactionFuelingInfo.md +2 -2
- package/docs/TransactionMessageSignBTCEIP191Destination.md +10 -0
- package/docs/TransactionRbfSource.md +1 -1
- package/docs/TransactionSelectedUtxo.md +2 -2
- package/docs/TransactionSubStatus.md +18 -0
- package/docs/TransactionWebhookEventData.md +7 -4
- package/docs/TransactionsApi.md +1 -1
- package/docs/UpdateCustodialWalletParams.md +1 -1
- package/docs/UpdateExchangeWalletParams.md +1 -1
- package/docs/UpdateMpcWalletParams.md +1 -1
- package/docs/UpdateSmartContractWalletParams.md +1 -1
- package/docs/UpdateWalletParams.md +1 -1
- package/docs/WalletInfoEventData.md +3 -1
- package/docs/WalletsApi.md +5 -5
- package/docs/WebhookEventData.md +16 -8
- package/docs/WebhookEventDataType.md +3 -1
- package/docs/WebhookEventType.md +4 -0
- package/package.json +1 -1
- package/dist/api/SwapsApi.js +0 -360
- package/dist/model/CreateSwapQuote201Response.js +0 -264
- package/dist/model/SwapTokenPair.js +0 -100
- package/docs/CreateSwapActivityRequest.md +0 -12
- package/docs/CreateSwapQuote201Response.md +0 -17
- package/docs/CreateSwapQuoteRequest.md +0 -13
- package/docs/ListEnableTokenPairs200Response.md +0 -10
- package/docs/ListSwapActivities200Response.md +0 -10
- package/docs/SwapTokenPair.md +0 -10
- package/docs/SwapsApi.md +0 -348
package/dist/api/SwapsApi.js
DELETED
|
@@ -1,360 +0,0 @@
|
|
|
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 _CreateSwapActivityRequest = _interopRequireDefault(require("../model/CreateSwapActivityRequest"));
|
|
9
|
-
var _CreateSwapQuote201Response = _interopRequireDefault(require("../model/CreateSwapQuote201Response"));
|
|
10
|
-
var _CreateSwapQuoteRequest = _interopRequireDefault(require("../model/CreateSwapQuoteRequest"));
|
|
11
|
-
var _ErrorResponse = _interopRequireDefault(require("../model/ErrorResponse"));
|
|
12
|
-
var _ListEnableTokenPairs200Response = _interopRequireDefault(require("../model/ListEnableTokenPairs200Response"));
|
|
13
|
-
var _ListSwapActivities200Response = _interopRequireDefault(require("../model/ListSwapActivities200Response"));
|
|
14
|
-
var _SwapActivity = _interopRequireDefault(require("../model/SwapActivity"));
|
|
15
|
-
var _SwapQuote = _interopRequireDefault(require("../model/SwapQuote"));
|
|
16
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
17
|
-
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); }
|
|
18
|
-
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
19
|
-
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); } }
|
|
20
|
-
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
21
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
22
|
-
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); } /**
|
|
23
|
-
* Cobo Wallet as a Service 2.0
|
|
24
|
-
*
|
|
25
|
-
* Contact: help@cobo.com
|
|
26
|
-
*
|
|
27
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
28
|
-
* https://openapi-generator.tech
|
|
29
|
-
* Do not edit the class manually.
|
|
30
|
-
*
|
|
31
|
-
*/
|
|
32
|
-
/**
|
|
33
|
-
* Swaps service.
|
|
34
|
-
* @module api/SwapsApi
|
|
35
|
-
*/
|
|
36
|
-
var SwapsApi = exports["default"] = /*#__PURE__*/function () {
|
|
37
|
-
/**
|
|
38
|
-
* Constructs a new SwapsApi.
|
|
39
|
-
* @alias module:api/SwapsApi
|
|
40
|
-
* @class
|
|
41
|
-
* @param {module:ApiClient} [apiClient] Optional API client implementation to use,
|
|
42
|
-
* default to {@link module:ApiClient#instance} if unspecified.
|
|
43
|
-
*/
|
|
44
|
-
function SwapsApi(apiClient) {
|
|
45
|
-
_classCallCheck(this, SwapsApi);
|
|
46
|
-
this.apiClient = apiClient || _ApiClient["default"].instance;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Create Swap Activity
|
|
51
|
-
* This operation to create a swap activity.
|
|
52
|
-
* @param {module:model/CreateSwapActivityRequest} CreateSwapActivityRequest The request body for creating a swap activity.
|
|
53
|
-
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/SwapActivity} and HTTP response
|
|
54
|
-
*/
|
|
55
|
-
return _createClass(SwapsApi, [{
|
|
56
|
-
key: "createSwapActivityWithHttpInfo",
|
|
57
|
-
value: function createSwapActivityWithHttpInfo(CreateSwapActivityRequest) {
|
|
58
|
-
var postBody = CreateSwapActivityRequest;
|
|
59
|
-
if (postBody && postBody.toJSON) {
|
|
60
|
-
postBody = postBody.toJSON();
|
|
61
|
-
}
|
|
62
|
-
// verify the required parameter 'CreateSwapActivityRequest' is set
|
|
63
|
-
if (CreateSwapActivityRequest === undefined || CreateSwapActivityRequest === null) {
|
|
64
|
-
throw new Error("Missing the required parameter 'CreateSwapActivityRequest' when calling createSwapActivity");
|
|
65
|
-
}
|
|
66
|
-
var pathParams = {};
|
|
67
|
-
var queryParams = {};
|
|
68
|
-
var headerParams = {};
|
|
69
|
-
var formParams = {};
|
|
70
|
-
var authNames = ['OAuth2', 'CoboAuth'];
|
|
71
|
-
var contentTypes = ['application/json'];
|
|
72
|
-
var accepts = ['application/json'];
|
|
73
|
-
var returnType = _SwapActivity["default"];
|
|
74
|
-
return this.apiClient.callApi('/swaps/swap', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Create Swap Activity
|
|
79
|
-
* This operation to create a swap activity.
|
|
80
|
-
* @param {module:model/CreateSwapActivityRequest} CreateSwapActivityRequest The request body for creating a swap activity.
|
|
81
|
-
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/SwapActivity}
|
|
82
|
-
*/
|
|
83
|
-
}, {
|
|
84
|
-
key: "createSwapActivity",
|
|
85
|
-
value: function createSwapActivity(CreateSwapActivityRequest) {
|
|
86
|
-
return this.createSwapActivityWithHttpInfo(CreateSwapActivityRequest).then(function (response_and_data) {
|
|
87
|
-
return response_and_data.data;
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Create Swap Quote
|
|
93
|
-
* This operation retrieves a quote for swapping between two tokens. Either pay_amount or receive_amount must be provided.
|
|
94
|
-
* @param {module:model/CreateSwapQuoteRequest} CreateSwapQuoteRequest The request body for creating a swap activity.
|
|
95
|
-
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/CreateSwapQuote201Response} and HTTP response
|
|
96
|
-
*/
|
|
97
|
-
}, {
|
|
98
|
-
key: "createSwapQuoteWithHttpInfo",
|
|
99
|
-
value: function createSwapQuoteWithHttpInfo(CreateSwapQuoteRequest) {
|
|
100
|
-
var postBody = CreateSwapQuoteRequest;
|
|
101
|
-
if (postBody && postBody.toJSON) {
|
|
102
|
-
postBody = postBody.toJSON();
|
|
103
|
-
}
|
|
104
|
-
// verify the required parameter 'CreateSwapQuoteRequest' is set
|
|
105
|
-
if (CreateSwapQuoteRequest === undefined || CreateSwapQuoteRequest === null) {
|
|
106
|
-
throw new Error("Missing the required parameter 'CreateSwapQuoteRequest' when calling createSwapQuote");
|
|
107
|
-
}
|
|
108
|
-
var pathParams = {};
|
|
109
|
-
var queryParams = {};
|
|
110
|
-
var headerParams = {};
|
|
111
|
-
var formParams = {};
|
|
112
|
-
var authNames = ['OAuth2', 'CoboAuth'];
|
|
113
|
-
var contentTypes = ['application/json'];
|
|
114
|
-
var accepts = ['application/json'];
|
|
115
|
-
var returnType = _CreateSwapQuote201Response["default"];
|
|
116
|
-
return this.apiClient.callApi('/swaps/quote', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Create Swap Quote
|
|
121
|
-
* This operation retrieves a quote for swapping between two tokens. Either pay_amount or receive_amount must be provided.
|
|
122
|
-
* @param {module:model/CreateSwapQuoteRequest} CreateSwapQuoteRequest The request body for creating a swap activity.
|
|
123
|
-
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/CreateSwapQuote201Response}
|
|
124
|
-
*/
|
|
125
|
-
}, {
|
|
126
|
-
key: "createSwapQuote",
|
|
127
|
-
value: function createSwapQuote(CreateSwapQuoteRequest) {
|
|
128
|
-
return this.createSwapQuoteWithHttpInfo(CreateSwapQuoteRequest).then(function (response_and_data) {
|
|
129
|
-
return response_and_data.data;
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Get Swap Activity Details
|
|
135
|
-
* This operation retrieves the details of a swap activity.
|
|
136
|
-
* @param {String} activity_id The unique id of the activity.
|
|
137
|
-
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/SwapActivity} and HTTP response
|
|
138
|
-
*/
|
|
139
|
-
}, {
|
|
140
|
-
key: "getSwapActivityWithHttpInfo",
|
|
141
|
-
value: function getSwapActivityWithHttpInfo(activity_id) {
|
|
142
|
-
var postBody = null;
|
|
143
|
-
if (postBody && postBody.toJSON) {
|
|
144
|
-
postBody = postBody.toJSON();
|
|
145
|
-
}
|
|
146
|
-
// verify the required parameter 'activity_id' is set
|
|
147
|
-
if (activity_id === undefined || activity_id === null) {
|
|
148
|
-
throw new Error("Missing the required parameter 'activity_id' when calling getSwapActivity");
|
|
149
|
-
}
|
|
150
|
-
var pathParams = {
|
|
151
|
-
'activity_id': activity_id
|
|
152
|
-
};
|
|
153
|
-
var queryParams = {};
|
|
154
|
-
var headerParams = {};
|
|
155
|
-
var formParams = {};
|
|
156
|
-
var authNames = ['CoboAuth'];
|
|
157
|
-
var contentTypes = [];
|
|
158
|
-
var accepts = ['application/json'];
|
|
159
|
-
var returnType = _SwapActivity["default"];
|
|
160
|
-
return this.apiClient.callApi('/swaps/activities/{activity_id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Get Swap Activity Details
|
|
165
|
-
* This operation retrieves the details of a swap activity.
|
|
166
|
-
* @param {String} activity_id The unique id of the activity.
|
|
167
|
-
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/SwapActivity}
|
|
168
|
-
*/
|
|
169
|
-
}, {
|
|
170
|
-
key: "getSwapActivity",
|
|
171
|
-
value: function getSwapActivity(activity_id) {
|
|
172
|
-
return this.getSwapActivityWithHttpInfo(activity_id).then(function (response_and_data) {
|
|
173
|
-
return response_and_data.data;
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Get Current Swap Rate
|
|
179
|
-
* This operation retrieves the current market exchange rate and estimated amount for swapping between two tokens. Either pay_amount or receive_amount must be provided.
|
|
180
|
-
* @param {String} wallet_id The wallet ID.
|
|
181
|
-
* @param {String} pay_token_id Unique id of the token to pay.
|
|
182
|
-
* @param {String} receive_token_id Unique id of the token to receive.
|
|
183
|
-
* @param {Object} opts Optional parameters
|
|
184
|
-
* @param {String} [pay_amount] The amount of pay token to swap.
|
|
185
|
-
* @param {String} [receive_amount] The amount of token to receive.
|
|
186
|
-
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/SwapQuote} and HTTP response
|
|
187
|
-
*/
|
|
188
|
-
}, {
|
|
189
|
-
key: "getSwapQuoteWithHttpInfo",
|
|
190
|
-
value: function getSwapQuoteWithHttpInfo(wallet_id, pay_token_id, receive_token_id, opts) {
|
|
191
|
-
opts = opts || {};
|
|
192
|
-
var postBody = null;
|
|
193
|
-
if (postBody && postBody.toJSON) {
|
|
194
|
-
postBody = postBody.toJSON();
|
|
195
|
-
}
|
|
196
|
-
// verify the required parameter 'wallet_id' is set
|
|
197
|
-
if (wallet_id === undefined || wallet_id === null) {
|
|
198
|
-
throw new Error("Missing the required parameter 'wallet_id' when calling getSwapQuote");
|
|
199
|
-
}
|
|
200
|
-
// verify the required parameter 'pay_token_id' is set
|
|
201
|
-
if (pay_token_id === undefined || pay_token_id === null) {
|
|
202
|
-
throw new Error("Missing the required parameter 'pay_token_id' when calling getSwapQuote");
|
|
203
|
-
}
|
|
204
|
-
// verify the required parameter 'receive_token_id' is set
|
|
205
|
-
if (receive_token_id === undefined || receive_token_id === null) {
|
|
206
|
-
throw new Error("Missing the required parameter 'receive_token_id' when calling getSwapQuote");
|
|
207
|
-
}
|
|
208
|
-
var pathParams = {};
|
|
209
|
-
var queryParams = {
|
|
210
|
-
'wallet_id': wallet_id,
|
|
211
|
-
'pay_token_id': pay_token_id,
|
|
212
|
-
'receive_token_id': receive_token_id,
|
|
213
|
-
'pay_amount': opts['pay_amount'],
|
|
214
|
-
'receive_amount': opts['receive_amount']
|
|
215
|
-
};
|
|
216
|
-
var headerParams = {};
|
|
217
|
-
var formParams = {};
|
|
218
|
-
var authNames = ['CoboAuth'];
|
|
219
|
-
var contentTypes = [];
|
|
220
|
-
var accepts = ['application/json'];
|
|
221
|
-
var returnType = _SwapQuote["default"];
|
|
222
|
-
return this.apiClient.callApi('/swaps/quote', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* Get Current Swap Rate
|
|
227
|
-
* This operation retrieves the current market exchange rate and estimated amount for swapping between two tokens. Either pay_amount or receive_amount must be provided.
|
|
228
|
-
* @param {String} wallet_id The wallet ID.
|
|
229
|
-
* @param {String} pay_token_id Unique id of the token to pay.
|
|
230
|
-
* @param {String} receive_token_id Unique id of the token to receive.
|
|
231
|
-
* @param {Object} opts Optional parameters
|
|
232
|
-
* @param {String} opts.pay_amount The amount of pay token to swap.
|
|
233
|
-
* @param {String} opts.receive_amount The amount of token to receive.
|
|
234
|
-
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/SwapQuote}
|
|
235
|
-
*/
|
|
236
|
-
}, {
|
|
237
|
-
key: "getSwapQuote",
|
|
238
|
-
value: function getSwapQuote(wallet_id, pay_token_id, receive_token_id, opts) {
|
|
239
|
-
return this.getSwapQuoteWithHttpInfo(wallet_id, pay_token_id, receive_token_id, opts).then(function (response_and_data) {
|
|
240
|
-
return response_and_data.data;
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* List Supported Token Pairs
|
|
246
|
-
* This operation retrieves all supported token pairs for swaps in a specified wallet.
|
|
247
|
-
* @param {Object} opts Optional parameters
|
|
248
|
-
* @param {Number} [limit = 10)] The maximum number of objects to return. For most operations, the value range is [1, 50].
|
|
249
|
-
* @param {String} [before] This parameter specifies an object ID as a starting point for pagination, retrieving data before the specified object relative to the current dataset. Suppose the current data is ordered as Object A, Object B, and Object C. If you set `before` to the ID of Object C (`RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk`), the response will include Object B and Object A. **Notes**: - If you set both `after` and `before`, an error will occur. - If you leave both `before` and `after` empty, the first page of data is returned. - If you set it to `infinity`, the last page of data is returned.
|
|
250
|
-
* @param {String} [after] This parameter specifies an object ID as a starting point for pagination, retrieving data after the specified object relative to the current dataset. Suppose the current data is ordered as Object A, Object B, and Object C. If you set `after` to the ID of Object A (`RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk`), the response will include Object B and Object C. **Notes**: - If you set both `after` and `before`, an error will occur. - If you leave both `before` and `after` empty, the first page of data is returned.
|
|
251
|
-
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ListEnableTokenPairs200Response} and HTTP response
|
|
252
|
-
*/
|
|
253
|
-
}, {
|
|
254
|
-
key: "listEnableTokenPairsWithHttpInfo",
|
|
255
|
-
value: function listEnableTokenPairsWithHttpInfo(opts) {
|
|
256
|
-
opts = opts || {};
|
|
257
|
-
var postBody = null;
|
|
258
|
-
if (postBody && postBody.toJSON) {
|
|
259
|
-
postBody = postBody.toJSON();
|
|
260
|
-
}
|
|
261
|
-
var pathParams = {};
|
|
262
|
-
var queryParams = {
|
|
263
|
-
'limit': opts['limit'],
|
|
264
|
-
'before': opts['before'],
|
|
265
|
-
'after': opts['after']
|
|
266
|
-
};
|
|
267
|
-
var headerParams = {};
|
|
268
|
-
var formParams = {};
|
|
269
|
-
var authNames = ['CoboAuth'];
|
|
270
|
-
var contentTypes = [];
|
|
271
|
-
var accepts = ['application/json'];
|
|
272
|
-
var returnType = _ListEnableTokenPairs200Response["default"];
|
|
273
|
-
return this.apiClient.callApi('/swaps/enabled_pairs', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* List Supported Token Pairs
|
|
278
|
-
* This operation retrieves all supported token pairs for swaps in a specified wallet.
|
|
279
|
-
* @param {Object} opts Optional parameters
|
|
280
|
-
* @param {Number} opts.limit The maximum number of objects to return. For most operations, the value range is [1, 50]. (default to 10)
|
|
281
|
-
* @param {String} opts.before This parameter specifies an object ID as a starting point for pagination, retrieving data before the specified object relative to the current dataset. Suppose the current data is ordered as Object A, Object B, and Object C. If you set `before` to the ID of Object C (`RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk`), the response will include Object B and Object A. **Notes**: - If you set both `after` and `before`, an error will occur. - If you leave both `before` and `after` empty, the first page of data is returned. - If you set it to `infinity`, the last page of data is returned.
|
|
282
|
-
* @param {String} opts.after This parameter specifies an object ID as a starting point for pagination, retrieving data after the specified object relative to the current dataset. Suppose the current data is ordered as Object A, Object B, and Object C. If you set `after` to the ID of Object A (`RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk`), the response will include Object B and Object C. **Notes**: - If you set both `after` and `before`, an error will occur. - If you leave both `before` and `after` empty, the first page of data is returned.
|
|
283
|
-
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ListEnableTokenPairs200Response}
|
|
284
|
-
*/
|
|
285
|
-
}, {
|
|
286
|
-
key: "listEnableTokenPairs",
|
|
287
|
-
value: function listEnableTokenPairs(opts) {
|
|
288
|
-
return this.listEnableTokenPairsWithHttpInfo(opts).then(function (response_and_data) {
|
|
289
|
-
return response_and_data.data;
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* List Swap Activities
|
|
295
|
-
* This operation retrieves a list of swap activities.
|
|
296
|
-
* @param {Object} opts Optional parameters
|
|
297
|
-
* @param {module:model/String} [status]
|
|
298
|
-
* @param {Number} [min_updated_timestamp] The start time of the query. All staking activities updated after the specified time will be retrieved. The time is in Unix timestamp format, measured in milliseconds.
|
|
299
|
-
* @param {Number} [max_updated_timestamp] The end time of the query. All staking activities updated before the specified time will be retrieved. The time is in Unix timestamp format, measured in milliseconds.
|
|
300
|
-
* @param {String} [initiator] The activity initiator, which is your API key by default. You can also specify the initiator when creating the activity.
|
|
301
|
-
* @param {Number} [limit = 10)] The maximum number of objects to return. For most operations, the value range is [1, 50].
|
|
302
|
-
* @param {String} [before] This parameter specifies an object ID as a starting point for pagination, retrieving data before the specified object relative to the current dataset. Suppose the current data is ordered as Object A, Object B, and Object C. If you set `before` to the ID of Object C (`RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk`), the response will include Object B and Object A. **Notes**: - If you set both `after` and `before`, an error will occur. - If you leave both `before` and `after` empty, the first page of data is returned. - If you set it to `infinity`, the last page of data is returned.
|
|
303
|
-
* @param {String} [after] This parameter specifies an object ID as a starting point for pagination, retrieving data after the specified object relative to the current dataset. Suppose the current data is ordered as Object A, Object B, and Object C. If you set `after` to the ID of Object A (`RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk`), the response will include Object B and Object C. **Notes**: - If you set both `after` and `before`, an error will occur. - If you leave both `before` and `after` empty, the first page of data is returned.
|
|
304
|
-
* @param {String} [sort_by = '')] The field used for sorting.
|
|
305
|
-
* @param {module:model/String} [direction = '')] The sort direction. Possible values include: - `ASC`: Sort the results in ascending order. - `DESC`: Sort the results in descending order.
|
|
306
|
-
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ListSwapActivities200Response} and HTTP response
|
|
307
|
-
*/
|
|
308
|
-
}, {
|
|
309
|
-
key: "listSwapActivitiesWithHttpInfo",
|
|
310
|
-
value: function listSwapActivitiesWithHttpInfo(opts) {
|
|
311
|
-
opts = opts || {};
|
|
312
|
-
var postBody = null;
|
|
313
|
-
if (postBody && postBody.toJSON) {
|
|
314
|
-
postBody = postBody.toJSON();
|
|
315
|
-
}
|
|
316
|
-
var pathParams = {};
|
|
317
|
-
var queryParams = {
|
|
318
|
-
'status': opts['status'],
|
|
319
|
-
'min_updated_timestamp': opts['min_updated_timestamp'],
|
|
320
|
-
'max_updated_timestamp': opts['max_updated_timestamp'],
|
|
321
|
-
'initiator': opts['initiator'],
|
|
322
|
-
'limit': opts['limit'],
|
|
323
|
-
'before': opts['before'],
|
|
324
|
-
'after': opts['after'],
|
|
325
|
-
'sort_by': opts['sort_by'],
|
|
326
|
-
'direction': opts['direction']
|
|
327
|
-
};
|
|
328
|
-
var headerParams = {};
|
|
329
|
-
var formParams = {};
|
|
330
|
-
var authNames = ['CoboAuth'];
|
|
331
|
-
var contentTypes = [];
|
|
332
|
-
var accepts = ['application/json'];
|
|
333
|
-
var returnType = _ListSwapActivities200Response["default"];
|
|
334
|
-
return this.apiClient.callApi('/swaps/activities', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
/**
|
|
338
|
-
* List Swap Activities
|
|
339
|
-
* This operation retrieves a list of swap activities.
|
|
340
|
-
* @param {Object} opts Optional parameters
|
|
341
|
-
* @param {module:model/String} opts.status
|
|
342
|
-
* @param {Number} opts.min_updated_timestamp The start time of the query. All staking activities updated after the specified time will be retrieved. The time is in Unix timestamp format, measured in milliseconds.
|
|
343
|
-
* @param {Number} opts.max_updated_timestamp The end time of the query. All staking activities updated before the specified time will be retrieved. The time is in Unix timestamp format, measured in milliseconds.
|
|
344
|
-
* @param {String} opts.initiator The activity initiator, which is your API key by default. You can also specify the initiator when creating the activity.
|
|
345
|
-
* @param {Number} opts.limit The maximum number of objects to return. For most operations, the value range is [1, 50]. (default to 10)
|
|
346
|
-
* @param {String} opts.before This parameter specifies an object ID as a starting point for pagination, retrieving data before the specified object relative to the current dataset. Suppose the current data is ordered as Object A, Object B, and Object C. If you set `before` to the ID of Object C (`RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk`), the response will include Object B and Object A. **Notes**: - If you set both `after` and `before`, an error will occur. - If you leave both `before` and `after` empty, the first page of data is returned. - If you set it to `infinity`, the last page of data is returned.
|
|
347
|
-
* @param {String} opts.after This parameter specifies an object ID as a starting point for pagination, retrieving data after the specified object relative to the current dataset. Suppose the current data is ordered as Object A, Object B, and Object C. If you set `after` to the ID of Object A (`RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk`), the response will include Object B and Object C. **Notes**: - If you set both `after` and `before`, an error will occur. - If you leave both `before` and `after` empty, the first page of data is returned.
|
|
348
|
-
* @param {String} opts.sort_by The field used for sorting. (default to '')
|
|
349
|
-
* @param {module:model/String} opts.direction The sort direction. Possible values include: - `ASC`: Sort the results in ascending order. - `DESC`: Sort the results in descending order. (default to '')
|
|
350
|
-
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ListSwapActivities200Response}
|
|
351
|
-
*/
|
|
352
|
-
}, {
|
|
353
|
-
key: "listSwapActivities",
|
|
354
|
-
value: function listSwapActivities(opts) {
|
|
355
|
-
return this.listSwapActivitiesWithHttpInfo(opts).then(function (response_and_data) {
|
|
356
|
-
return response_and_data.data;
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
}]);
|
|
360
|
-
}();
|
|
@@ -1,264 +0,0 @@
|
|
|
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;
|