@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.
Files changed (159) hide show
  1. package/README.md +54 -18
  2. package/dist/ApiClient.js +1 -1
  3. package/dist/api/FeeStationApi.js +18 -18
  4. package/dist/api/TransactionsApi.js +2 -2
  5. package/dist/api/WalletsApi.js +8 -8
  6. package/dist/index.js +260 -43
  7. package/dist/model/ActivityExtra.js +0 -23
  8. package/dist/model/AddressEncoding.js +15 -0
  9. package/dist/model/AddressesEventData.js +8 -3
  10. package/dist/model/BTCBIP137MessageSignDestination.js +122 -0
  11. package/dist/model/BTCBIP322MessageSignDestination.js +122 -0
  12. package/dist/model/BabylonStakingActivityDetailExtra.js +0 -39
  13. package/dist/model/{ListSwapActivities200Response.js → BankAccount.js} +51 -51
  14. package/dist/model/ChainsEventData.js +8 -3
  15. package/dist/model/CosmosAdr36MessageSignDestination.js +122 -0
  16. package/dist/model/CosmosContractCallDestination.js +152 -0
  17. package/dist/model/CosmosContractCallMessage.js +126 -0
  18. package/dist/model/CreateSettlement.js +174 -0
  19. package/dist/model/MPCVaultEventData.js +8 -3
  20. package/dist/model/{CreateSwapActivityRequest.js → Merchant.js} +45 -58
  21. package/dist/model/MessageSignDestination.js +111 -9
  22. package/dist/model/MessageSignDestinationType.js +15 -0
  23. package/dist/model/Order.js +306 -0
  24. package/dist/model/OrderStatus.js +76 -0
  25. package/dist/model/PaymentTransaction.js +201 -0
  26. package/dist/model/RefreshAddressBalancesByTokenRequest.js +2 -3
  27. package/dist/model/Refund.js +237 -0
  28. package/dist/model/RefundStatus.js +76 -0
  29. package/dist/model/RefundType.js +61 -0
  30. package/dist/model/SettleRequestStatus.js +76 -0
  31. package/dist/model/SettleStatus.js +76 -0
  32. package/dist/model/Settlement.js +168 -0
  33. package/dist/model/SettlementDetail.js +184 -0
  34. package/dist/model/SettlementInfo.js +175 -0
  35. package/dist/model/SettlementType.js +61 -0
  36. package/dist/model/SwapActivity.js +36 -5
  37. package/dist/model/SwapActivityStatus.js +66 -0
  38. package/dist/model/SwapActivityType.js +61 -0
  39. package/dist/model/SwapQuote.js +21 -34
  40. package/dist/model/{CreateSwapQuoteRequest.js → SwapToken.js} +73 -60
  41. package/dist/model/TSSRequestWebhookEventData.js +8 -3
  42. package/dist/model/TokenListing.js +230 -0
  43. package/dist/model/TokenListingEventData.js +363 -0
  44. package/dist/model/TokenListingRequestSource.js +61 -0
  45. package/dist/model/TokenListingRequestStatus.js +66 -0
  46. package/dist/model/TokensEventData.js +8 -3
  47. package/dist/model/Transaction.js +22 -5
  48. package/dist/model/TransactionBIP137Destination.js +122 -0
  49. package/dist/model/TransactionBIP322Destination.js +122 -0
  50. package/dist/model/TransactionBabylonBusinessInfo.js +138 -0
  51. package/dist/model/TransactionBabylonTxParameters.js +168 -0
  52. package/dist/model/TransactionCoreStakeInfo.js +168 -0
  53. package/dist/model/TransactionCosmosAdr36Destination.js +122 -0
  54. package/dist/model/TransactionCosmosContractDestination.js +152 -0
  55. package/dist/model/{ListEnableTokenPairs200Response.js → TransactionCosmosMessage.js} +54 -51
  56. package/dist/model/TransactionDestination.js +172 -8
  57. package/dist/model/TransactionDestinationType.js +20 -0
  58. package/dist/model/TransactionDetail.js +29 -7
  59. package/dist/model/TransactionDetails.js +29 -7
  60. package/dist/model/TransactionExtra.js +278 -0
  61. package/dist/model/TransactionExtraType.js +66 -0
  62. package/dist/model/TransactionFuelingInfo.js +3 -3
  63. package/dist/model/TransactionMessageSignBTCEIP191Destination.js +122 -0
  64. package/dist/model/TransactionRbfSource.js +37 -9
  65. package/dist/model/TransactionSelectedUtxo.js +2 -2
  66. package/dist/model/TransactionSubStatus.js +45 -0
  67. package/dist/model/TransactionWebhookEventData.js +37 -10
  68. package/dist/model/UpdateCustodialWalletParams.js +6 -4
  69. package/dist/model/UpdateExchangeWalletParams.js +6 -4
  70. package/dist/model/UpdateMpcWalletParams.js +6 -4
  71. package/dist/model/UpdateSmartContractWalletParams.js +6 -4
  72. package/dist/model/WalletInfoEventData.js +8 -3
  73. package/dist/model/WebhookEventData.js +81 -18
  74. package/dist/model/WebhookEventDataType.js +7 -2
  75. package/dist/model/WebhookEventType.js +10 -0
  76. package/docs/ActivityExtra.md +0 -4
  77. package/docs/AddressEncoding.md +6 -0
  78. package/docs/AddressesEventData.md +3 -1
  79. package/docs/BTCBIP137MessageSignDestination.md +10 -0
  80. package/docs/BTCBIP322MessageSignDestination.md +10 -0
  81. package/docs/BabylonStakingActivityDetailExtra.md +0 -4
  82. package/docs/BankAccount.md +10 -0
  83. package/docs/ChainsEventData.md +3 -1
  84. package/docs/CosmosAdr36MessageSignDestination.md +10 -0
  85. package/docs/CosmosContractCallDestination.md +11 -0
  86. package/docs/CosmosContractCallMessage.md +10 -0
  87. package/docs/CreateSettlement.md +14 -0
  88. package/docs/FeeStationApi.md +13 -13
  89. package/docs/MPCVaultEventData.md +3 -1
  90. package/docs/Merchant.md +11 -0
  91. package/docs/MessageSignDestination.md +3 -0
  92. package/docs/MessageSignDestinationType.md +6 -0
  93. package/docs/Order.md +23 -0
  94. package/docs/OrderStatus.md +18 -0
  95. package/docs/PaymentTransaction.md +16 -0
  96. package/docs/RefreshAddressBalancesByTokenRequest.md +1 -1
  97. package/docs/Refund.md +17 -0
  98. package/docs/RefundStatus.md +18 -0
  99. package/docs/RefundType.md +12 -0
  100. package/docs/SettleRequestStatus.md +18 -0
  101. package/docs/SettleStatus.md +18 -0
  102. package/docs/Settlement.md +12 -0
  103. package/docs/SettlementDetail.md +15 -0
  104. package/docs/SettlementInfo.md +14 -0
  105. package/docs/SettlementType.md +12 -0
  106. package/docs/SwapActivity.md +4 -1
  107. package/docs/SwapActivityStatus.md +14 -0
  108. package/docs/SwapActivityType.md +12 -0
  109. package/docs/SwapQuote.md +3 -4
  110. package/docs/SwapToken.md +14 -0
  111. package/docs/TSSRequestWebhookEventData.md +3 -1
  112. package/docs/TokenListing.md +19 -0
  113. package/docs/TokenListingEventData.md +45 -0
  114. package/docs/TokenListingRequestSource.md +12 -0
  115. package/docs/TokenListingRequestStatus.md +14 -0
  116. package/docs/TokensEventData.md +3 -1
  117. package/docs/Transaction.md +4 -3
  118. package/docs/TransactionBIP137Destination.md +10 -0
  119. package/docs/TransactionBIP322Destination.md +10 -0
  120. package/docs/TransactionBabylonBusinessInfo.md +11 -0
  121. package/docs/TransactionBabylonTxParameters.md +15 -0
  122. package/docs/TransactionCoreStakeInfo.md +14 -0
  123. package/docs/TransactionCosmosAdr36Destination.md +10 -0
  124. package/docs/TransactionCosmosContractDestination.md +11 -0
  125. package/docs/TransactionCosmosMessage.md +10 -0
  126. package/docs/TransactionDestination.md +4 -0
  127. package/docs/TransactionDestinationType.md +8 -0
  128. package/docs/TransactionDetail.md +4 -3
  129. package/docs/TransactionDetails.md +4 -3
  130. package/docs/TransactionExtra.md +21 -0
  131. package/docs/TransactionExtraType.md +14 -0
  132. package/docs/TransactionFuelingInfo.md +2 -2
  133. package/docs/TransactionMessageSignBTCEIP191Destination.md +10 -0
  134. package/docs/TransactionRbfSource.md +1 -1
  135. package/docs/TransactionSelectedUtxo.md +2 -2
  136. package/docs/TransactionSubStatus.md +18 -0
  137. package/docs/TransactionWebhookEventData.md +7 -4
  138. package/docs/TransactionsApi.md +1 -1
  139. package/docs/UpdateCustodialWalletParams.md +1 -1
  140. package/docs/UpdateExchangeWalletParams.md +1 -1
  141. package/docs/UpdateMpcWalletParams.md +1 -1
  142. package/docs/UpdateSmartContractWalletParams.md +1 -1
  143. package/docs/UpdateWalletParams.md +1 -1
  144. package/docs/WalletInfoEventData.md +3 -1
  145. package/docs/WalletsApi.md +5 -5
  146. package/docs/WebhookEventData.md +16 -8
  147. package/docs/WebhookEventDataType.md +3 -1
  148. package/docs/WebhookEventType.md +4 -0
  149. package/package.json +1 -1
  150. package/dist/api/SwapsApi.js +0 -360
  151. package/dist/model/CreateSwapQuote201Response.js +0 -264
  152. package/dist/model/SwapTokenPair.js +0 -100
  153. package/docs/CreateSwapActivityRequest.md +0 -12
  154. package/docs/CreateSwapQuote201Response.md +0 -17
  155. package/docs/CreateSwapQuoteRequest.md +0 -13
  156. package/docs/ListEnableTokenPairs200Response.md +0 -10
  157. package/docs/ListSwapActivities200Response.md +0 -10
  158. package/docs/SwapTokenPair.md +0 -10
  159. package/docs/SwapsApi.md +0 -348
@@ -1,100 +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
- 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 _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
11
- 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); } }
12
- function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
13
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
14
- 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); } /**
15
- * Cobo Wallet as a Service 2.0
16
- *
17
- * Contact: help@cobo.com
18
- *
19
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
20
- * https://openapi-generator.tech
21
- * Do not edit the class manually.
22
- *
23
- */
24
- /**
25
- * The SwapTokenPair model module.
26
- * @module model/SwapTokenPair
27
- */
28
- var SwapTokenPair = /*#__PURE__*/function () {
29
- /**
30
- * Constructs a new <code>SwapTokenPair</code>.
31
- * @alias module:model/SwapTokenPair
32
- */
33
- function SwapTokenPair() {
34
- _classCallCheck(this, SwapTokenPair);
35
- SwapTokenPair.initialize(this);
36
- }
37
-
38
- /**
39
- * Initializes the fields of this object.
40
- * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
41
- * Only for internal use.
42
- */
43
- return _createClass(SwapTokenPair, null, [{
44
- key: "initialize",
45
- value: function initialize(obj) {}
46
-
47
- /**
48
- * Constructs a <code>SwapTokenPair</code> from a plain JavaScript object, optionally creating a new instance.
49
- * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
50
- * @param {Object} data The plain JavaScript object bearing properties of interest.
51
- * @param {module:model/SwapTokenPair} obj Optional instance to populate.
52
- * @return {module:model/SwapTokenPair} The populated <code>SwapTokenPair</code> instance.
53
- */
54
- }, {
55
- key: "constructFromObject",
56
- value: function constructFromObject(data, obj) {
57
- if (data) {
58
- obj = obj || new SwapTokenPair();
59
- if (data.hasOwnProperty('pay_token_id')) {
60
- obj['pay_token_id'] = _ApiClient["default"].convertToType(data['pay_token_id'], 'String');
61
- }
62
- if (data.hasOwnProperty('receive_token_id')) {
63
- obj['receive_token_id'] = _ApiClient["default"].convertToType(data['receive_token_id'], 'String');
64
- }
65
- }
66
- return obj;
67
- }
68
-
69
- /**
70
- * Validates the JSON data with respect to <code>SwapTokenPair</code>.
71
- * @param {Object} data The plain JavaScript object bearing properties of interest.
72
- * @return {boolean} to indicate whether the JSON data is valid with respect to <code>SwapTokenPair</code>.
73
- */
74
- }, {
75
- key: "validateJSON",
76
- value: function validateJSON(data) {
77
- // ensure the json data is a string
78
- if (data['pay_token_id'] && !(typeof data['pay_token_id'] === 'string' || data['pay_token_id'] instanceof String)) {
79
- throw new Error("Expected the field `pay_token_id` to be a primitive type in the JSON string but got " + data['pay_token_id']);
80
- }
81
- // ensure the json data is a string
82
- if (data['receive_token_id'] && !(typeof data['receive_token_id'] === 'string' || data['receive_token_id'] instanceof String)) {
83
- throw new Error("Expected the field `receive_token_id` to be a primitive type in the JSON string but got " + data['receive_token_id']);
84
- }
85
- return true;
86
- }
87
- }]);
88
- }();
89
- /**
90
- * The source token symbol.
91
- * @member {String} pay_token_id
92
- */
93
- SwapTokenPair.prototype['pay_token_id'] = undefined;
94
-
95
- /**
96
- * The target token symbol.
97
- * @member {String} receive_token_id
98
- */
99
- SwapTokenPair.prototype['receive_token_id'] = undefined;
100
- var _default = exports["default"] = SwapTokenPair;
@@ -1,12 +0,0 @@
1
- # CoboWaas2.CreateSwapActivityRequest
2
-
3
- ## Properties
4
-
5
- Name | Type | Description | Notes
6
- ------------ | ------------- | ------------- | -------------
7
- **wallet_id** | **String** | The unique identifier of the wallet. |
8
- **quote_id** | **String** | The unique identifier of the quote. |
9
- **slippage_tolerance** | **String** | The slippage tolerance for the swap. |
10
- **app_initiator** | **String** | 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. | [optional]
11
-
12
-
@@ -1,17 +0,0 @@
1
- # CoboWaas2.CreateSwapQuote201Response
2
-
3
- ## Properties
4
-
5
- Name | Type | Description | Notes
6
- ------------ | ------------- | ------------- | -------------
7
- **pay_amount** | **String** | The amount of tokens to pay. |
8
- **receive_amount** | **String** | The amount of tokens to receive. |
9
- **fee_amount** | **String** | The amount of tokens to pay for fee. |
10
- **min_pay_amount** | **String** | The minimum amount of tokens to pay. | [optional]
11
- **max_pay_amount** | **String** | The maximum amount of tokens to pay. | [optional]
12
- **min_receive_amount** | **String** | The minimum amount of tokens to receive. | [optional]
13
- **max_receive_amount** | **String** | The maximum amount of tokens to receive. | [optional]
14
- **quote_expired_timestamp** | **Number** | The time when the quote will expire, in Unix timestamp format, measured in milliseconds. |
15
- **quote_id** | **String** | The unique identifier of this quote. |
16
-
17
-
@@ -1,13 +0,0 @@
1
- # CoboWaas2.CreateSwapQuoteRequest
2
-
3
- ## Properties
4
-
5
- Name | Type | Description | Notes
6
- ------------ | ------------- | ------------- | -------------
7
- **wallet_id** | **String** | The unique identifier of the wallet. |
8
- **pay_token_id** | **String** | Unique id of the token to pay. |
9
- **receive_token_id** | **String** | Unique id of the token to receive. |
10
- **pay_amount** | **String** | Amount of tokens to pay. For example \&quot;0.5 BTC\&quot;. Note: Either pay_amount or receive_amount must be provided, but not both. | [optional]
11
- **receive_amount** | **String** | Amount of tokens to receive. For example \&quot;0.5 ETH_WBTC\&quot;. Note: Either pay_amount or receive_amount must be provided, but not both. | [optional]
12
-
13
-
@@ -1,10 +0,0 @@
1
- # CoboWaas2.ListEnableTokenPairs200Response
2
-
3
- ## Properties
4
-
5
- Name | Type | Description | Notes
6
- ------------ | ------------- | ------------- | -------------
7
- **data** | [**[SwapTokenPair]**](SwapTokenPair.md) | | [optional]
8
- **pagination** | [**Pagination**](Pagination.md) | | [optional]
9
-
10
-
@@ -1,10 +0,0 @@
1
- # CoboWaas2.ListSwapActivities200Response
2
-
3
- ## Properties
4
-
5
- Name | Type | Description | Notes
6
- ------------ | ------------- | ------------- | -------------
7
- **data** | [**[SwapActivity]**](SwapActivity.md) | | [optional]
8
- **pagination** | [**Pagination**](Pagination.md) | | [optional]
9
-
10
-
@@ -1,10 +0,0 @@
1
- # CoboWaas2.SwapTokenPair
2
-
3
- ## Properties
4
-
5
- Name | Type | Description | Notes
6
- ------------ | ------------- | ------------- | -------------
7
- **pay_token_id** | **String** | The source token symbol. | [optional]
8
- **receive_token_id** | **String** | The target token symbol. | [optional]
9
-
10
-
package/docs/SwapsApi.md DELETED
@@ -1,348 +0,0 @@
1
- # CoboWaas2.SwapsApi
2
-
3
- All URIs are relative to *https://api.dev.cobo.com/v2*
4
-
5
- Method | HTTP request | Description
6
- ------------- | ------------- | -------------
7
- [**createSwapActivity**](SwapsApi.md#createSwapActivity) | **POST** /swaps/swap | Create Swap Activity
8
- [**createSwapQuote**](SwapsApi.md#createSwapQuote) | **POST** /swaps/quote | Create Swap Quote
9
- [**getSwapActivity**](SwapsApi.md#getSwapActivity) | **GET** /swaps/activities/{activity_id} | Get Swap Activity Details
10
- [**getSwapQuote**](SwapsApi.md#getSwapQuote) | **GET** /swaps/quote | Get Current Swap Rate
11
- [**listEnableTokenPairs**](SwapsApi.md#listEnableTokenPairs) | **GET** /swaps/enabled_pairs | List Supported Token Pairs
12
- [**listSwapActivities**](SwapsApi.md#listSwapActivities) | **GET** /swaps/activities | List Swap Activities
13
-
14
-
15
-
16
- ## createSwapActivity
17
-
18
- > SwapActivity createSwapActivity(CreateSwapActivityRequest)
19
-
20
- Create Swap Activity
21
-
22
- This operation to create a swap activity.
23
-
24
- ### Example
25
-
26
- ```javascript
27
- const CoboWaas2 = require('@cobo/cobo-waas2');
28
- // Initialize the API client
29
- const apiClient = CoboWaas2.ApiClient.instance
30
- // Select the development environment. To use the production environment, replace `Env.DEV` with `Env.PROD`
31
- apiClient.setEnv(CoboWaas2.Env.DEV);
32
- // Replace `<YOUR_PRIVATE_KEY>` with your private key
33
- apiClient.setPrivateKey("<YOUR_PRIVATE_KEY>");
34
- // Call the API
35
- const apiInstance = new CoboWaas2.SwapsApi();
36
- const CreateSwapActivityRequest = new CoboWaas2.CreateSwapActivityRequest();
37
- apiInstance.createSwapActivity(CreateSwapActivityRequest).then((data) => {
38
- console.log('API called successfully. Returned data: ' + data);
39
- }, (error) => {
40
- console.error(error);
41
- });
42
-
43
- ```
44
-
45
- ### Parameters
46
-
47
-
48
- Name | Type | Description | Notes
49
- ------------- | ------------- | ------------- | -------------
50
- **CreateSwapActivityRequest** | [**CreateSwapActivityRequest**](CreateSwapActivityRequest.md)| The request body for creating a swap activity. |
51
-
52
- ### Return type
53
-
54
- [**SwapActivity**](SwapActivity.md)
55
-
56
- ### Authorization
57
-
58
- [OAuth2](../README.md#OAuth2), [CoboAuth](../README.md#CoboAuth)
59
-
60
- ### HTTP request headers
61
-
62
- - **Content-Type**: application/json
63
- - **Accept**: application/json
64
-
65
-
66
- ## createSwapQuote
67
-
68
- > CreateSwapQuote201Response createSwapQuote(CreateSwapQuoteRequest)
69
-
70
- Create Swap Quote
71
-
72
- This operation retrieves a quote for swapping between two tokens. Either pay_amount or receive_amount must be provided.
73
-
74
- ### Example
75
-
76
- ```javascript
77
- const CoboWaas2 = require('@cobo/cobo-waas2');
78
- // Initialize the API client
79
- const apiClient = CoboWaas2.ApiClient.instance
80
- // Select the development environment. To use the production environment, replace `Env.DEV` with `Env.PROD`
81
- apiClient.setEnv(CoboWaas2.Env.DEV);
82
- // Replace `<YOUR_PRIVATE_KEY>` with your private key
83
- apiClient.setPrivateKey("<YOUR_PRIVATE_KEY>");
84
- // Call the API
85
- const apiInstance = new CoboWaas2.SwapsApi();
86
- const CreateSwapQuoteRequest = new CoboWaas2.CreateSwapQuoteRequest();
87
- apiInstance.createSwapQuote(CreateSwapQuoteRequest).then((data) => {
88
- console.log('API called successfully. Returned data: ' + data);
89
- }, (error) => {
90
- console.error(error);
91
- });
92
-
93
- ```
94
-
95
- ### Parameters
96
-
97
-
98
- Name | Type | Description | Notes
99
- ------------- | ------------- | ------------- | -------------
100
- **CreateSwapQuoteRequest** | [**CreateSwapQuoteRequest**](CreateSwapQuoteRequest.md)| The request body for creating a swap activity. |
101
-
102
- ### Return type
103
-
104
- [**CreateSwapQuote201Response**](CreateSwapQuote201Response.md)
105
-
106
- ### Authorization
107
-
108
- [OAuth2](../README.md#OAuth2), [CoboAuth](../README.md#CoboAuth)
109
-
110
- ### HTTP request headers
111
-
112
- - **Content-Type**: application/json
113
- - **Accept**: application/json
114
-
115
-
116
- ## getSwapActivity
117
-
118
- > SwapActivity getSwapActivity(activity_id)
119
-
120
- Get Swap Activity Details
121
-
122
- This operation retrieves the details of a swap activity.
123
-
124
- ### Example
125
-
126
- ```javascript
127
- const CoboWaas2 = require('@cobo/cobo-waas2');
128
- // Initialize the API client
129
- const apiClient = CoboWaas2.ApiClient.instance
130
- // Select the development environment. To use the production environment, replace `Env.DEV` with `Env.PROD`
131
- apiClient.setEnv(CoboWaas2.Env.DEV);
132
- // Replace `<YOUR_PRIVATE_KEY>` with your private key
133
- apiClient.setPrivateKey("<YOUR_PRIVATE_KEY>");
134
- // Call the API
135
- const apiInstance = new CoboWaas2.SwapsApi();
136
- const activity_id = "f47ac10b-58cc-4372-a567-0e02b2c3d479";
137
- apiInstance.getSwapActivity(activity_id).then((data) => {
138
- console.log('API called successfully. Returned data: ' + data);
139
- }, (error) => {
140
- console.error(error);
141
- });
142
-
143
- ```
144
-
145
- ### Parameters
146
-
147
-
148
- Name | Type | Description | Notes
149
- ------------- | ------------- | ------------- | -------------
150
- **activity_id** | **String**| The unique id of the activity. |
151
-
152
- ### Return type
153
-
154
- [**SwapActivity**](SwapActivity.md)
155
-
156
- ### Authorization
157
-
158
- [CoboAuth](../README.md#CoboAuth)
159
-
160
- ### HTTP request headers
161
-
162
- - **Content-Type**: Not defined
163
- - **Accept**: application/json
164
-
165
-
166
- ## getSwapQuote
167
-
168
- > SwapQuote getSwapQuote(wallet_id, pay_token_id, receive_token_id, opts)
169
-
170
- Get Current Swap Rate
171
-
172
- 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.
173
-
174
- ### Example
175
-
176
- ```javascript
177
- const CoboWaas2 = require('@cobo/cobo-waas2');
178
- // Initialize the API client
179
- const apiClient = CoboWaas2.ApiClient.instance
180
- // Select the development environment. To use the production environment, replace `Env.DEV` with `Env.PROD`
181
- apiClient.setEnv(CoboWaas2.Env.DEV);
182
- // Replace `<YOUR_PRIVATE_KEY>` with your private key
183
- apiClient.setPrivateKey("<YOUR_PRIVATE_KEY>");
184
- // Call the API
185
- const apiInstance = new CoboWaas2.SwapsApi();
186
- const wallet_id = "f47ac10b-58cc-4372-a567-0e02b2c3d479";
187
- const pay_token_id = "ETH";
188
- const receive_token_id = "USDT";
189
- const opts = {
190
- 'pay_amount': "1.5",
191
- 'receive_amount': "2000"
192
- };
193
- apiInstance.getSwapQuote(wallet_id, pay_token_id, receive_token_id, opts).then((data) => {
194
- console.log('API called successfully. Returned data: ' + data);
195
- }, (error) => {
196
- console.error(error);
197
- });
198
-
199
- ```
200
-
201
- ### Parameters
202
-
203
-
204
- Name | Type | Description | Notes
205
- ------------- | ------------- | ------------- | -------------
206
- **wallet_id** | **String**| The wallet ID. |
207
- **pay_token_id** | **String**| Unique id of the token to pay. |
208
- **receive_token_id** | **String**| Unique id of the token to receive. |
209
- **pay_amount** | **String**| The amount of pay token to swap. | [optional]
210
- **receive_amount** | **String**| The amount of token to receive. | [optional]
211
-
212
- ### Return type
213
-
214
- [**SwapQuote**](SwapQuote.md)
215
-
216
- ### Authorization
217
-
218
- [CoboAuth](../README.md#CoboAuth)
219
-
220
- ### HTTP request headers
221
-
222
- - **Content-Type**: Not defined
223
- - **Accept**: application/json
224
-
225
-
226
- ## listEnableTokenPairs
227
-
228
- > ListEnableTokenPairs200Response listEnableTokenPairs(opts)
229
-
230
- List Supported Token Pairs
231
-
232
- This operation retrieves all supported token pairs for swaps in a specified wallet.
233
-
234
- ### Example
235
-
236
- ```javascript
237
- const CoboWaas2 = require('@cobo/cobo-waas2');
238
- // Initialize the API client
239
- const apiClient = CoboWaas2.ApiClient.instance
240
- // Select the development environment. To use the production environment, replace `Env.DEV` with `Env.PROD`
241
- apiClient.setEnv(CoboWaas2.Env.DEV);
242
- // Replace `<YOUR_PRIVATE_KEY>` with your private key
243
- apiClient.setPrivateKey("<YOUR_PRIVATE_KEY>");
244
- // Call the API
245
- const apiInstance = new CoboWaas2.SwapsApi();
246
- const opts = {
247
- 'limit': 10,
248
- 'before': "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1",
249
- 'after': "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk"
250
- };
251
- apiInstance.listEnableTokenPairs(opts).then((data) => {
252
- console.log('API called successfully. Returned data: ' + data);
253
- }, (error) => {
254
- console.error(error);
255
- });
256
-
257
- ```
258
-
259
- ### Parameters
260
-
261
-
262
- Name | Type | Description | Notes
263
- ------------- | ------------- | ------------- | -------------
264
- **limit** | **Number**| The maximum number of objects to return. For most operations, the value range is [1, 50]. | [optional] [default to 10]
265
- **before** | **String**| 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 &#x60;before&#x60; to the ID of Object C (&#x60;RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk&#x60;), the response will include Object B and Object A. **Notes**: - If you set both &#x60;after&#x60; and &#x60;before&#x60;, an error will occur. - If you leave both &#x60;before&#x60; and &#x60;after&#x60; empty, the first page of data is returned. - If you set it to &#x60;infinity&#x60;, the last page of data is returned. | [optional]
266
- **after** | **String**| 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 &#x60;after&#x60; to the ID of Object A (&#x60;RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk&#x60;), the response will include Object B and Object C. **Notes**: - If you set both &#x60;after&#x60; and &#x60;before&#x60;, an error will occur. - If you leave both &#x60;before&#x60; and &#x60;after&#x60; empty, the first page of data is returned. | [optional]
267
-
268
- ### Return type
269
-
270
- [**ListEnableTokenPairs200Response**](ListEnableTokenPairs200Response.md)
271
-
272
- ### Authorization
273
-
274
- [CoboAuth](../README.md#CoboAuth)
275
-
276
- ### HTTP request headers
277
-
278
- - **Content-Type**: Not defined
279
- - **Accept**: application/json
280
-
281
-
282
- ## listSwapActivities
283
-
284
- > ListSwapActivities200Response listSwapActivities(opts)
285
-
286
- List Swap Activities
287
-
288
- This operation retrieves a list of swap activities.
289
-
290
- ### Example
291
-
292
- ```javascript
293
- const CoboWaas2 = require('@cobo/cobo-waas2');
294
- // Initialize the API client
295
- const apiClient = CoboWaas2.ApiClient.instance
296
- // Select the development environment. To use the production environment, replace `Env.DEV` with `Env.PROD`
297
- apiClient.setEnv(CoboWaas2.Env.DEV);
298
- // Replace `<YOUR_PRIVATE_KEY>` with your private key
299
- apiClient.setPrivateKey("<YOUR_PRIVATE_KEY>");
300
- // Call the API
301
- const apiInstance = new CoboWaas2.SwapsApi();
302
- const opts = {
303
- 'status': "Success",
304
- 'min_updated_timestamp': 1635744000000,
305
- 'max_updated_timestamp': 1635744000000,
306
- 'initiator': "steve@example.com",
307
- 'limit': 10,
308
- 'before': "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1",
309
- 'after': "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk",
310
- 'sort_by': "timestamp",
311
- 'direction': "ASC"
312
- };
313
- apiInstance.listSwapActivities(opts).then((data) => {
314
- console.log('API called successfully. Returned data: ' + data);
315
- }, (error) => {
316
- console.error(error);
317
- });
318
-
319
- ```
320
-
321
- ### Parameters
322
-
323
-
324
- Name | Type | Description | Notes
325
- ------------- | ------------- | ------------- | -------------
326
- **status** | **String**| | [optional]
327
- **min_updated_timestamp** | **Number**| 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. | [optional]
328
- **max_updated_timestamp** | **Number**| 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. | [optional]
329
- **initiator** | **String**| The activity initiator, which is your API key by default. You can also specify the initiator when creating the activity. | [optional]
330
- **limit** | **Number**| The maximum number of objects to return. For most operations, the value range is [1, 50]. | [optional] [default to 10]
331
- **before** | **String**| 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 &#x60;before&#x60; to the ID of Object C (&#x60;RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk&#x60;), the response will include Object B and Object A. **Notes**: - If you set both &#x60;after&#x60; and &#x60;before&#x60;, an error will occur. - If you leave both &#x60;before&#x60; and &#x60;after&#x60; empty, the first page of data is returned. - If you set it to &#x60;infinity&#x60;, the last page of data is returned. | [optional]
332
- **after** | **String**| 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 &#x60;after&#x60; to the ID of Object A (&#x60;RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk&#x60;), the response will include Object B and Object C. **Notes**: - If you set both &#x60;after&#x60; and &#x60;before&#x60;, an error will occur. - If you leave both &#x60;before&#x60; and &#x60;after&#x60; empty, the first page of data is returned. | [optional]
333
- **sort_by** | **String**| The field used for sorting. | [optional] [default to &#39;&#39;]
334
- **direction** | **String**| The sort direction. Possible values include: - &#x60;ASC&#x60;: Sort the results in ascending order. - &#x60;DESC&#x60;: Sort the results in descending order. | [optional] [default to &#39;&#39;]
335
-
336
- ### Return type
337
-
338
- [**ListSwapActivities200Response**](ListSwapActivities200Response.md)
339
-
340
- ### Authorization
341
-
342
- [CoboAuth](../README.md#CoboAuth)
343
-
344
- ### HTTP request headers
345
-
346
- - **Content-Type**: Not defined
347
- - **Accept**: application/json
348
-