@cobo/cobo-waas2 1.5.0 → 1.7.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 +31 -5
- package/dist/ApiClient.js +56 -6
- package/dist/ServerDemo.js +80 -0
- package/dist/api/DevelopersApi.js +79 -0
- package/dist/api/DevelopersWebhooksApi.js +2 -2
- package/dist/api/OAuthApi.js +8 -8
- package/dist/api/StakingsApi.js +91 -7
- package/dist/api/TransactionsApi.js +4 -4
- package/dist/api/WalletsApi.js +58 -57
- package/dist/crypto/Ed25519Signer.js +36 -0
- package/dist/crypto/Secp256k1Signer.js +36 -0
- package/dist/index.js +153 -13
- package/dist/model/Activity.js +4 -8
- package/dist/model/ActivityAction.js +20 -0
- package/dist/model/ActivityType.js +5 -0
- package/dist/model/AddressTransferDestination.js +2 -2
- package/dist/model/AddressTransferDestinationUtxoOutputsInner.js +6 -17
- package/dist/model/AutoFuelType.js +61 -0
- package/dist/model/BabylonStakeEstimatedFee.js +118 -0
- package/dist/model/BabylonValidator.js +9 -12
- package/dist/model/CheckAddressChainsValidity200ResponseInner.js +121 -0
- package/dist/model/ContractCallParams.js +9 -0
- package/dist/model/CoreStakeExtra.js +170 -0
- package/dist/model/CoreStakingExtra.js +187 -0
- package/dist/model/CreateClaimActivity.js +139 -0
- package/dist/model/CreateClaimActivityRequest.js +182 -0
- package/dist/model/CreateSmartContractWalletParams.js +1 -1
- package/dist/model/CreateStakeActivity.js +4 -8
- package/dist/model/CreateStakeActivityExtra.js +94 -8
- package/dist/model/CreateStakeActivityRequest.js +5 -10
- package/dist/model/CreateUnstakeActivity.js +16 -0
- package/dist/model/CreateUnstakeActivityExtra.js +159 -0
- package/dist/model/CreateUnstakeActivityRequest.js +20 -0
- package/dist/model/CreateWithdrawActivity.js +0 -13
- package/dist/model/CreateWithdrawActivityRequest.js +0 -18
- package/dist/model/EstimateClaimFee.js +145 -0
- package/dist/model/EstimateContractCallFeeParams.js +6 -8
- package/dist/model/EstimateFeeParams.js +1 -1
- package/dist/model/EstimateStakeFee.js +5 -10
- package/dist/model/EstimateTransferFeeParams.js +4 -8
- package/dist/model/EstimateUnstakeFee.js +20 -0
- package/dist/model/EstimateWithdrawFee.js +0 -18
- package/dist/model/EstimatedEvmEip1559FeeSlow.js +3 -5
- package/dist/model/EstimatedEvmLegacyFeeSlow.js +3 -5
- package/dist/model/EstimatedFee.js +1 -1
- package/dist/model/EstimatedFixedFee.js +4 -4
- package/dist/model/EstimatedUtxoFeeSlow.js +3 -3
- package/dist/model/EthStakeEstimatedFee.js +112 -0
- package/dist/model/EthStakeExtra.js +131 -0
- package/dist/model/EthStakingExtra.js +162 -0
- package/dist/model/EthStakingExtraAllOfBeaconValidators.js +140 -0
- package/dist/model/EthUnstakeExtra.js +131 -0
- package/dist/model/FeeAmount.js +1 -1
- package/dist/model/FeeGasLimit.js +1 -2
- package/dist/model/FeeRate.js +1 -1
- package/dist/model/FixedFeeRate.js +2 -2
- package/dist/model/GetApiKeyInfo200Response.js +251 -0
- package/dist/model/GetStakingEstimationFee201Response.js +144 -43
- package/dist/model/GetStakingEstimationFeeRequest.js +41 -19
- package/dist/model/{GetToken200Response.js → GetToken2XXResponse.js} +21 -21
- package/dist/model/GetToken4XXResponse.js +12 -10
- package/dist/model/MPCDelegate.js +1 -1
- package/dist/model/MPCProject.js +4 -4
- package/dist/model/MpcTransferSource.js +2 -2
- package/dist/model/Pagination.js +2 -2
- package/dist/model/{RefreshToken201Response.js → RefreshToken2XXResponse.js} +21 -21
- package/dist/model/RoleScopes.js +128 -0
- package/dist/model/Scopes.js +142 -0
- package/dist/model/SmartContractWalletInfo.js +1 -1
- package/dist/model/StakingPoolId.js +81 -0
- package/dist/model/StakingPoolType.js +10 -0
- package/dist/model/Stakings.js +10 -14
- package/dist/model/StakingsExtra.js +95 -8
- package/dist/model/TransactionEvmEip1559Fee.js +2 -4
- package/dist/model/TransactionEvmLegacyFee.js +2 -4
- package/dist/model/TransactionFee.js +1 -2
- package/dist/model/TransactionRbf.js +9 -0
- package/dist/model/TransactionRbfSource.js +1 -1
- package/dist/model/TransactionRequestEvmEip1559Fee.js +2 -3
- package/dist/model/TransactionRequestEvmLegacyFee.js +2 -3
- package/dist/model/TransactionRequestFee.js +1 -2
- package/dist/model/TransactionRequestFixedFee.js +1 -1
- package/dist/model/TransactionRequestUtxoFee.js +1 -1
- package/dist/model/TransactionSource.js +1 -1
- package/dist/model/TransactionTransferToAddressDestinationUtxoOutputsInner.js +0 -13
- package/dist/model/TransferDestination.js +2 -2
- package/dist/model/TransferParams.js +9 -0
- package/docs/Activity.md +1 -1
- package/docs/ActivityAction.md +8 -0
- package/docs/ActivityType.md +2 -0
- package/docs/AddressTransferDestination.md +2 -2
- package/docs/AddressTransferDestinationUtxoOutputsInner.md +1 -2
- package/docs/AutoFuelType.md +12 -0
- package/docs/BabylonStakeEstimatedFee.md +12 -0
- package/docs/BabylonValidator.md +6 -4
- package/docs/CheckAddressChainsValidity200ResponseInner.md +10 -0
- package/docs/ContractCallParams.md +1 -0
- package/docs/CoreStakeExtra.md +13 -0
- package/docs/CoreStakingExtra.md +14 -0
- package/docs/CreateClaimActivity.md +11 -0
- package/docs/CreateClaimActivityRequest.md +12 -0
- package/docs/CreateStakeActivity.md +1 -1
- package/docs/CreateStakeActivityExtra.md +5 -0
- package/docs/CreateStakeActivityRequest.md +1 -1
- package/docs/CreateUnstakeActivity.md +1 -0
- package/docs/CreateUnstakeActivityExtra.md +10 -0
- package/docs/CreateUnstakeActivityRequest.md +1 -0
- package/docs/CreateWithdrawActivity.md +0 -1
- package/docs/CreateWithdrawActivityRequest.md +0 -1
- package/docs/DevelopersApi.md +55 -0
- package/docs/DevelopersWebhooksApi.md +1 -1
- package/docs/EstimateClaimFee.md +11 -0
- package/docs/EstimateContractCallFeeParams.md +2 -2
- package/docs/EstimateFeeParams.md +2 -2
- package/docs/EstimateStakeFee.md +1 -1
- package/docs/EstimateTransferFeeParams.md +2 -2
- package/docs/EstimateUnstakeFee.md +1 -0
- package/docs/EstimateWithdrawFee.md +0 -1
- package/docs/EstimatedEvmEip1559FeeSlow.md +1 -1
- package/docs/EstimatedEvmLegacyFeeSlow.md +1 -1
- package/docs/EstimatedFee.md +1 -1
- package/docs/EstimatedFixedFee.md +1 -1
- package/docs/EstimatedUtxoFeeSlow.md +1 -1
- package/docs/EthStakeEstimatedFee.md +11 -0
- package/docs/EthStakeExtra.md +10 -0
- package/docs/EthStakingExtra.md +11 -0
- package/docs/EthStakingExtraAllOfBeaconValidators.md +14 -0
- package/docs/EthUnstakeExtra.md +10 -0
- package/docs/FeeAmount.md +1 -1
- package/docs/FeeGasLimit.md +1 -1
- package/docs/FeeRate.md +1 -1
- package/docs/FixedFeeRate.md +1 -1
- package/docs/GetApiKeyInfo200Response.md +30 -0
- package/docs/GetStakingEstimationFee201Response.md +3 -0
- package/docs/GetStakingEstimationFeeRequest.md +3 -4
- package/docs/{GetToken200Response.md → GetToken2XXResponse.md} +1 -1
- package/docs/GetToken4XXResponse.md +1 -1
- package/docs/MPCProject.md +1 -1
- package/docs/MpcTransferSource.md +1 -1
- package/docs/OAuthApi.md +4 -4
- package/docs/Pagination.md +1 -1
- package/docs/PoolDetailsAllOfValidatorsInfo.md +6 -4
- package/docs/{RefreshToken201Response.md → RefreshToken2XXResponse.md} +1 -1
- package/docs/RoleScopes.md +10 -0
- package/docs/Scopes.md +13 -0
- package/docs/StakingPoolId.md +20 -0
- package/docs/StakingPoolType.md +4 -0
- package/docs/Stakings.md +2 -2
- package/docs/StakingsApi.md +108 -2
- package/docs/StakingsExtra.md +5 -0
- package/docs/TransactionEvmEip1559Fee.md +1 -1
- package/docs/TransactionEvmLegacyFee.md +1 -1
- package/docs/TransactionFee.md +1 -1
- package/docs/TransactionRbf.md +1 -0
- package/docs/TransactionRbfSource.md +1 -1
- package/docs/TransactionRequestEvmEip1559Fee.md +1 -1
- package/docs/TransactionRequestEvmLegacyFee.md +1 -1
- package/docs/TransactionRequestFee.md +1 -1
- package/docs/TransactionTransferToAddressDestinationUtxoOutputsInner.md +0 -1
- package/docs/TransactionsApi.md +2 -2
- package/docs/TransferDestination.md +2 -2
- package/docs/TransferParams.md +1 -0
- package/docs/WalletsApi.md +54 -54
- package/package.json +4 -2
- package/dist/model/StakingsValidatorInfo.js +0 -140
- package/docs/StakingsValidatorInfo.md +0 -13
package/dist/api/StakingsApi.js
CHANGED
|
@@ -8,11 +8,13 @@ var _ApiClient = _interopRequireDefault(require("../ApiClient"));
|
|
|
8
8
|
var _Activity = _interopRequireDefault(require("../model/Activity"));
|
|
9
9
|
var _ActivityStatus = _interopRequireDefault(require("../model/ActivityStatus"));
|
|
10
10
|
var _ActivityType = _interopRequireDefault(require("../model/ActivityType"));
|
|
11
|
+
var _CreateClaimActivityRequest = _interopRequireDefault(require("../model/CreateClaimActivityRequest"));
|
|
11
12
|
var _CreateStakeActivity201Response = _interopRequireDefault(require("../model/CreateStakeActivity201Response"));
|
|
12
13
|
var _CreateStakeActivityRequest = _interopRequireDefault(require("../model/CreateStakeActivityRequest"));
|
|
13
14
|
var _CreateUnstakeActivityRequest = _interopRequireDefault(require("../model/CreateUnstakeActivityRequest"));
|
|
14
15
|
var _CreateWithdrawActivityRequest = _interopRequireDefault(require("../model/CreateWithdrawActivityRequest"));
|
|
15
16
|
var _ErrorResponse = _interopRequireDefault(require("../model/ErrorResponse"));
|
|
17
|
+
var _EthStakeEstimatedFee = _interopRequireDefault(require("../model/EthStakeEstimatedFee"));
|
|
16
18
|
var _GetStakingEstimationFee201Response = _interopRequireDefault(require("../model/GetStakingEstimationFee201Response"));
|
|
17
19
|
var _GetStakingEstimationFeeRequest = _interopRequireDefault(require("../model/GetStakingEstimationFeeRequest"));
|
|
18
20
|
var _ListStakingActivities200Response = _interopRequireDefault(require("../model/ListStakingActivities200Response"));
|
|
@@ -54,13 +56,54 @@ var StakingsApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
/**
|
|
57
|
-
* Create
|
|
58
|
-
* This operation creates a
|
|
59
|
+
* Create claim activity
|
|
60
|
+
* This operation creates a claim request. <Note>Currently, only the Ethereum Beacon protocol supports this operation.</Note> For some protocols, you can use the `fee` property in the request body to specify the maximum fee you are willing to pay. The transaction will fail if the actual fee exceeds the specified maximum fee.
|
|
59
61
|
* @param {Object} opts Optional parameters
|
|
60
|
-
* @param {module:model/
|
|
62
|
+
* @param {module:model/CreateClaimActivityRequest} [CreateClaimActivityRequest] The request body to create a staking request.
|
|
61
63
|
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/CreateStakeActivity201Response} and HTTP response
|
|
62
64
|
*/
|
|
63
65
|
return _createClass(StakingsApi, [{
|
|
66
|
+
key: "createClaimActivityWithHttpInfo",
|
|
67
|
+
value: function createClaimActivityWithHttpInfo(opts) {
|
|
68
|
+
opts = opts || {};
|
|
69
|
+
var postBody = opts['CreateClaimActivityRequest'];
|
|
70
|
+
if (postBody && postBody.toJSON) {
|
|
71
|
+
postBody = postBody.toJSON();
|
|
72
|
+
}
|
|
73
|
+
var pathParams = {};
|
|
74
|
+
var queryParams = {};
|
|
75
|
+
var headerParams = {};
|
|
76
|
+
var formParams = {};
|
|
77
|
+
var authNames = ['CoboAuth'];
|
|
78
|
+
var contentTypes = ['application/json'];
|
|
79
|
+
var accepts = ['application/json'];
|
|
80
|
+
var returnType = _CreateStakeActivity201Response["default"];
|
|
81
|
+
return this.apiClient.callApi('/stakings/activities/claim', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Create claim activity
|
|
86
|
+
* This operation creates a claim request. <Note>Currently, only the Ethereum Beacon protocol supports this operation.</Note> For some protocols, you can use the `fee` property in the request body to specify the maximum fee you are willing to pay. The transaction will fail if the actual fee exceeds the specified maximum fee.
|
|
87
|
+
* @param {Object} opts Optional parameters
|
|
88
|
+
* @param {module:model/CreateClaimActivityRequest} opts.CreateClaimActivityRequest The request body to create a staking request.
|
|
89
|
+
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/CreateStakeActivity201Response}
|
|
90
|
+
*/
|
|
91
|
+
}, {
|
|
92
|
+
key: "createClaimActivity",
|
|
93
|
+
value: function createClaimActivity(opts) {
|
|
94
|
+
return this.createClaimActivityWithHttpInfo(opts).then(function (response_and_data) {
|
|
95
|
+
return response_and_data.data;
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Create stake activity
|
|
101
|
+
* This operation creates a staking request. For some protocols, you can use the `fee` property in the request body to specify the maximum fee you are willing to pay. The transaction will fail if the actual fee exceeds the specified maximum fee. <Note>For the Babylon protocol, you can only select UTXO as the fee model.</Note>
|
|
102
|
+
* @param {Object} opts Optional parameters
|
|
103
|
+
* @param {module:model/CreateStakeActivityRequest} [CreateStakeActivityRequest] The request body to create a staking request.
|
|
104
|
+
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/CreateStakeActivity201Response} and HTTP response
|
|
105
|
+
*/
|
|
106
|
+
}, {
|
|
64
107
|
key: "createStakeActivityWithHttpInfo",
|
|
65
108
|
value: function createStakeActivityWithHttpInfo(opts) {
|
|
66
109
|
opts = opts || {};
|
|
@@ -223,7 +266,7 @@ var StakingsApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
223
266
|
/**
|
|
224
267
|
* Get staking position details
|
|
225
268
|
* This operation retrieves the detailed information about a specified staking position.
|
|
226
|
-
* @param {String} staking_id The ID of the staking position. You can retrieve a list of staking positions by calling [List staking positions](/v2/api-references/stakings/list-
|
|
269
|
+
* @param {String} staking_id The ID of the staking position. You can retrieve a list of staking positions by calling [List staking positions](/v2/api-references/stakings/list-staking-positions).
|
|
227
270
|
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Stakings} and HTTP response
|
|
228
271
|
*/
|
|
229
272
|
}, {
|
|
@@ -253,7 +296,7 @@ var StakingsApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
253
296
|
/**
|
|
254
297
|
* Get staking position details
|
|
255
298
|
* This operation retrieves the detailed information about a specified staking position.
|
|
256
|
-
* @param {String} staking_id The ID of the staking position. You can retrieve a list of staking positions by calling [List staking positions](/v2/api-references/stakings/list-
|
|
299
|
+
* @param {String} staking_id The ID of the staking position. You can retrieve a list of staking positions by calling [List staking positions](/v2/api-references/stakings/list-staking-positions).
|
|
257
300
|
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Stakings}
|
|
258
301
|
*/
|
|
259
302
|
}, {
|
|
@@ -266,7 +309,7 @@ var StakingsApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
266
309
|
|
|
267
310
|
/**
|
|
268
311
|
* Estimate staking fees
|
|
269
|
-
* This operation calculates the fee required for a staking activity based on factors such as network congestion and transaction complexity. For some protocols, you can use the `fee.fee_rate` property in the request body to specify the fee rate you are willing to pay. The `fee.max_fee_amount` property in the request body will be ignored. <Note>For the Babylon protocol, you can only select UTXO as the fee model.</Note>
|
|
312
|
+
* <Note>This operation is deprecated. Please use the [updated version](/v2/api-references/stakings/estimate-staking-fees-1) instead.</Note> This operation calculates the fee required for a staking activity based on factors such as network congestion and transaction complexity. For some protocols, you can use the `fee.fee_rate` property in the request body to specify the fee rate you are willing to pay. The `fee.max_fee_amount` property in the request body will be ignored. <Note>For the Babylon protocol, you can only select UTXO as the fee model.</Note>
|
|
270
313
|
* @param {Object} opts Optional parameters
|
|
271
314
|
* @param {module:model/GetStakingEstimationFeeRequest} [GetStakingEstimationFeeRequest] The request body to get the estimated fee of a staking activity.
|
|
272
315
|
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetStakingEstimationFee201Response} and HTTP response
|
|
@@ -292,7 +335,7 @@ var StakingsApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
292
335
|
|
|
293
336
|
/**
|
|
294
337
|
* Estimate staking fees
|
|
295
|
-
* This operation calculates the fee required for a staking activity based on factors such as network congestion and transaction complexity. For some protocols, you can use the `fee.fee_rate` property in the request body to specify the fee rate you are willing to pay. The `fee.max_fee_amount` property in the request body will be ignored. <Note>For the Babylon protocol, you can only select UTXO as the fee model.</Note>
|
|
338
|
+
* <Note>This operation is deprecated. Please use the [updated version](/v2/api-references/stakings/estimate-staking-fees-1) instead.</Note> This operation calculates the fee required for a staking activity based on factors such as network congestion and transaction complexity. For some protocols, you can use the `fee.fee_rate` property in the request body to specify the fee rate you are willing to pay. The `fee.max_fee_amount` property in the request body will be ignored. <Note>For the Babylon protocol, you can only select UTXO as the fee model.</Note>
|
|
296
339
|
* @param {Object} opts Optional parameters
|
|
297
340
|
* @param {module:model/GetStakingEstimationFeeRequest} opts.GetStakingEstimationFeeRequest The request body to get the estimated fee of a staking activity.
|
|
298
341
|
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetStakingEstimationFee201Response}
|
|
@@ -305,6 +348,47 @@ var StakingsApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
305
348
|
});
|
|
306
349
|
}
|
|
307
350
|
|
|
351
|
+
/**
|
|
352
|
+
* Estimate staking fees
|
|
353
|
+
* This operation calculates the fee required for a staking activity based on factors such as network congestion and transaction complexity. <Note>For the Babylon protocol, you can only select UTXO as the fee model.</Note>
|
|
354
|
+
* @param {Object} opts Optional parameters
|
|
355
|
+
* @param {module:model/GetStakingEstimationFeeRequest} [GetStakingEstimationFeeRequest] The request body to get the estimated fee of a staking activity.
|
|
356
|
+
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/EthStakeEstimatedFee} and HTTP response
|
|
357
|
+
*/
|
|
358
|
+
}, {
|
|
359
|
+
key: "getStakingEstimationFeeV2WithHttpInfo",
|
|
360
|
+
value: function getStakingEstimationFeeV2WithHttpInfo(opts) {
|
|
361
|
+
opts = opts || {};
|
|
362
|
+
var postBody = opts['GetStakingEstimationFeeRequest'];
|
|
363
|
+
if (postBody && postBody.toJSON) {
|
|
364
|
+
postBody = postBody.toJSON();
|
|
365
|
+
}
|
|
366
|
+
var pathParams = {};
|
|
367
|
+
var queryParams = {};
|
|
368
|
+
var headerParams = {};
|
|
369
|
+
var formParams = {};
|
|
370
|
+
var authNames = ['CoboAuth'];
|
|
371
|
+
var contentTypes = ['application/json'];
|
|
372
|
+
var accepts = ['application/json'];
|
|
373
|
+
var returnType = _EthStakeEstimatedFee["default"];
|
|
374
|
+
return this.apiClient.callApi('/stakings/estimate_fee_v2', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Estimate staking fees
|
|
379
|
+
* This operation calculates the fee required for a staking activity based on factors such as network congestion and transaction complexity. <Note>For the Babylon protocol, you can only select UTXO as the fee model.</Note>
|
|
380
|
+
* @param {Object} opts Optional parameters
|
|
381
|
+
* @param {module:model/GetStakingEstimationFeeRequest} opts.GetStakingEstimationFeeRequest The request body to get the estimated fee of a staking activity.
|
|
382
|
+
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/EthStakeEstimatedFee}
|
|
383
|
+
*/
|
|
384
|
+
}, {
|
|
385
|
+
key: "getStakingEstimationFeeV2",
|
|
386
|
+
value: function getStakingEstimationFeeV2(opts) {
|
|
387
|
+
return this.getStakingEstimationFeeV2WithHttpInfo(opts).then(function (response_and_data) {
|
|
388
|
+
return response_and_data.data;
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
|
|
308
392
|
/**
|
|
309
393
|
* Get staking pool details
|
|
310
394
|
* This operation retrieves the detailed information about a specified staking pool.
|
|
@@ -279,7 +279,7 @@ var TransactionsApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
279
279
|
|
|
280
280
|
/**
|
|
281
281
|
* Transfer token
|
|
282
|
-
* The operation transfers your assets from a wallet created on Cobo
|
|
282
|
+
* The operation transfers your assets from a wallet created on Cobo Portal to another address. You need to specify details such as the sender address and recipient address, token ID, and the amount to transfer. You can specify the fee-related properties to limit the transaction fee. A transaction request for tracking is returned upon successful operation. <Note>If you make transfers from Custodial Wallets, do not set the fee-related properties. Otherwise, the transaction will fail.</Note> <Note>You can transfer tokens to multiple addresses only if you use MPC Wallets as the transaction source. You should use the <code>utxo_outputs</code> property to specify the destination addresses.</Note> <Info>If you initiate a transaction from a Smart Contract Wallet, a relevant transaction will be triggered from the Delegate to the Cobo Safe's address of the Smart Contract Wallet, with a transfer amount of <code>0</code>.</Info>
|
|
283
283
|
* @param {Object} opts Optional parameters
|
|
284
284
|
* @param {module:model/TransferParams} [TransferParams] The request body to create a transfer transaction
|
|
285
285
|
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/CreateTransferTransaction201Response} and HTTP response
|
|
@@ -305,7 +305,7 @@ var TransactionsApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
305
305
|
|
|
306
306
|
/**
|
|
307
307
|
* Transfer token
|
|
308
|
-
* The operation transfers your assets from a wallet created on Cobo
|
|
308
|
+
* The operation transfers your assets from a wallet created on Cobo Portal to another address. You need to specify details such as the sender address and recipient address, token ID, and the amount to transfer. You can specify the fee-related properties to limit the transaction fee. A transaction request for tracking is returned upon successful operation. <Note>If you make transfers from Custodial Wallets, do not set the fee-related properties. Otherwise, the transaction will fail.</Note> <Note>You can transfer tokens to multiple addresses only if you use MPC Wallets as the transaction source. You should use the <code>utxo_outputs</code> property to specify the destination addresses.</Note> <Info>If you initiate a transaction from a Smart Contract Wallet, a relevant transaction will be triggered from the Delegate to the Cobo Safe's address of the Smart Contract Wallet, with a transfer amount of <code>0</code>.</Info>
|
|
309
309
|
* @param {Object} opts Optional parameters
|
|
310
310
|
* @param {module:model/TransferParams} opts.TransferParams The request body to create a transfer transaction
|
|
311
311
|
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/CreateTransferTransaction201Response}
|
|
@@ -369,7 +369,7 @@ var TransactionsApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
369
369
|
|
|
370
370
|
/**
|
|
371
371
|
* Estimate transaction fee
|
|
372
|
-
* This operation estimates the transaction fee
|
|
372
|
+
* This operation estimates the transaction fee of a token transfer or a contract call based on the fee model that the chain uses, considering factors such as network congestion and transaction complexity. You need to specify the transaction information, including the request ID, request type, source address, destination address, token ID (only applicable to token transfers), and chain ID (only applicable to contract calls). The response can contain different properties based on the transaction fee model used by the chain. For the legacy, EIP-1559, and UTXO fee models, Cobo also supports three different transaction speed levels: slow, recommended, and fast. For more information about estimating transaction fees, refer to [Estimate transaction fee](/v2/guides/transactions/estimate-fees).
|
|
373
373
|
* @param {Object} opts Optional parameters
|
|
374
374
|
* @param {module:model/EstimateFeeParams} [EstimateFeeParams] The request body to estimate the transaction fee of a token transfer or a contract call.
|
|
375
375
|
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/EstimatedFee} and HTTP response
|
|
@@ -395,7 +395,7 @@ var TransactionsApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
395
395
|
|
|
396
396
|
/**
|
|
397
397
|
* Estimate transaction fee
|
|
398
|
-
* This operation estimates the transaction fee
|
|
398
|
+
* This operation estimates the transaction fee of a token transfer or a contract call based on the fee model that the chain uses, considering factors such as network congestion and transaction complexity. You need to specify the transaction information, including the request ID, request type, source address, destination address, token ID (only applicable to token transfers), and chain ID (only applicable to contract calls). The response can contain different properties based on the transaction fee model used by the chain. For the legacy, EIP-1559, and UTXO fee models, Cobo also supports three different transaction speed levels: slow, recommended, and fast. For more information about estimating transaction fees, refer to [Estimate transaction fee](/v2/guides/transactions/estimate-fees).
|
|
399
399
|
* @param {Object} opts Optional parameters
|
|
400
400
|
* @param {module:model/EstimateFeeParams} opts.EstimateFeeParams The request body to estimate the transaction fee of a token transfer or a contract call.
|
|
401
401
|
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/EstimatedFee}
|
package/dist/api/WalletsApi.js
CHANGED
|
@@ -7,6 +7,7 @@ exports["default"] = void 0;
|
|
|
7
7
|
var _ApiClient = _interopRequireDefault(require("../ApiClient"));
|
|
8
8
|
var _AddressInfo = _interopRequireDefault(require("../model/AddressInfo"));
|
|
9
9
|
var _ChainInfo = _interopRequireDefault(require("../model/ChainInfo"));
|
|
10
|
+
var _CheckAddressChainsValidity200ResponseInner = _interopRequireDefault(require("../model/CheckAddressChainsValidity200ResponseInner"));
|
|
10
11
|
var _CheckAddressValidity200Response = _interopRequireDefault(require("../model/CheckAddressValidity200Response"));
|
|
11
12
|
var _CheckAddressesValidity200ResponseInner = _interopRequireDefault(require("../model/CheckAddressesValidity200ResponseInner"));
|
|
12
13
|
var _CreateAddressRequest = _interopRequireDefault(require("../model/CreateAddressRequest"));
|
|
@@ -62,13 +63,64 @@ var WalletsApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
/**
|
|
65
|
-
* Check address validity
|
|
66
|
-
* This operation verifies if a given address is valid for a
|
|
67
|
-
* @param {String} chain_id The chain ID, which is the unique identifier of a blockchain. You can retrieve the IDs of all the chains you can use by calling [List enabled chains](/v2/api-references/wallets/list-enabled-chains).
|
|
66
|
+
* Check address validity across chains
|
|
67
|
+
* This operation verifies if a given address is valid for a list of chains.
|
|
68
68
|
* @param {String} address The wallet address.
|
|
69
|
-
* @
|
|
69
|
+
* @param {String} chain_ids A list of chain IDs, separated by comma. The chain ID is the unique identifier of a blockchain. You can retrieve the IDs of all the chains you can use by calling [List enabled chains](/v2/api-references/wallets/list-enabled-chains).
|
|
70
|
+
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Array.<module:model/CheckAddressChainsValidity200ResponseInner>} and HTTP response
|
|
70
71
|
*/
|
|
71
72
|
return _createClass(WalletsApi, [{
|
|
73
|
+
key: "checkAddressChainsValidityWithHttpInfo",
|
|
74
|
+
value: function checkAddressChainsValidityWithHttpInfo(address, chain_ids) {
|
|
75
|
+
var postBody = null;
|
|
76
|
+
if (postBody && postBody.toJSON) {
|
|
77
|
+
postBody = postBody.toJSON();
|
|
78
|
+
}
|
|
79
|
+
// verify the required parameter 'address' is set
|
|
80
|
+
if (address === undefined || address === null) {
|
|
81
|
+
throw new Error("Missing the required parameter 'address' when calling checkAddressChainsValidity");
|
|
82
|
+
}
|
|
83
|
+
// verify the required parameter 'chain_ids' is set
|
|
84
|
+
if (chain_ids === undefined || chain_ids === null) {
|
|
85
|
+
throw new Error("Missing the required parameter 'chain_ids' when calling checkAddressChainsValidity");
|
|
86
|
+
}
|
|
87
|
+
var pathParams = {};
|
|
88
|
+
var queryParams = {
|
|
89
|
+
'address': address,
|
|
90
|
+
'chain_ids': chain_ids
|
|
91
|
+
};
|
|
92
|
+
var headerParams = {};
|
|
93
|
+
var formParams = {};
|
|
94
|
+
var authNames = ['CoboAuth'];
|
|
95
|
+
var contentTypes = [];
|
|
96
|
+
var accepts = ['application/json'];
|
|
97
|
+
var returnType = [_CheckAddressChainsValidity200ResponseInner["default"]];
|
|
98
|
+
return this.apiClient.callApi('/wallets/check_address_chains_validity', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Check address validity across chains
|
|
103
|
+
* This operation verifies if a given address is valid for a list of chains.
|
|
104
|
+
* @param {String} address The wallet address.
|
|
105
|
+
* @param {String} chain_ids A list of chain IDs, separated by comma. The chain ID is the unique identifier of a blockchain. You can retrieve the IDs of all the chains you can use by calling [List enabled chains](/v2/api-references/wallets/list-enabled-chains).
|
|
106
|
+
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Array.<module:model/CheckAddressChainsValidity200ResponseInner>}
|
|
107
|
+
*/
|
|
108
|
+
}, {
|
|
109
|
+
key: "checkAddressChainsValidity",
|
|
110
|
+
value: function checkAddressChainsValidity(address, chain_ids) {
|
|
111
|
+
return this.checkAddressChainsValidityWithHttpInfo(address, chain_ids).then(function (response_and_data) {
|
|
112
|
+
return response_and_data.data;
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Check address validity
|
|
118
|
+
* This operation verifies if a given address is valid for a specific chain.
|
|
119
|
+
* @param {String} chain_id The chain ID, which is the unique identifier of a blockchain. You can retrieve the IDs of all the chains you can use by calling [List enabled chains](/v2/api-references/wallets/list-enabled-chains).
|
|
120
|
+
* @param {String} address The wallet address.
|
|
121
|
+
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/CheckAddressValidity200Response} and HTTP response
|
|
122
|
+
*/
|
|
123
|
+
}, {
|
|
72
124
|
key: "checkAddressValidityWithHttpInfo",
|
|
73
125
|
value: function checkAddressValidityWithHttpInfo(chain_id, address) {
|
|
74
126
|
var postBody = null;
|
|
@@ -297,57 +349,6 @@ var WalletsApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
297
349
|
});
|
|
298
350
|
}
|
|
299
351
|
|
|
300
|
-
/**
|
|
301
|
-
* Get address information
|
|
302
|
-
* This operation retrieves the detailed information about a specified address within a wallet.
|
|
303
|
-
* @param {String} wallet_id The wallet ID.
|
|
304
|
-
* @param {String} address The wallet address.
|
|
305
|
-
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Array.<module:model/AddressInfo>} and HTTP response
|
|
306
|
-
*/
|
|
307
|
-
}, {
|
|
308
|
-
key: "getAddressWithHttpInfo",
|
|
309
|
-
value: function getAddressWithHttpInfo(wallet_id, address) {
|
|
310
|
-
var postBody = null;
|
|
311
|
-
if (postBody && postBody.toJSON) {
|
|
312
|
-
postBody = postBody.toJSON();
|
|
313
|
-
}
|
|
314
|
-
// verify the required parameter 'wallet_id' is set
|
|
315
|
-
if (wallet_id === undefined || wallet_id === null) {
|
|
316
|
-
throw new Error("Missing the required parameter 'wallet_id' when calling getAddress");
|
|
317
|
-
}
|
|
318
|
-
// verify the required parameter 'address' is set
|
|
319
|
-
if (address === undefined || address === null) {
|
|
320
|
-
throw new Error("Missing the required parameter 'address' when calling getAddress");
|
|
321
|
-
}
|
|
322
|
-
var pathParams = {
|
|
323
|
-
'wallet_id': wallet_id,
|
|
324
|
-
'address': address
|
|
325
|
-
};
|
|
326
|
-
var queryParams = {};
|
|
327
|
-
var headerParams = {};
|
|
328
|
-
var formParams = {};
|
|
329
|
-
var authNames = ['CoboAuth'];
|
|
330
|
-
var contentTypes = [];
|
|
331
|
-
var accepts = ['application/json'];
|
|
332
|
-
var returnType = [_AddressInfo["default"]];
|
|
333
|
-
return this.apiClient.callApi('/wallets/{wallet_id}/addresses/{address}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* Get address information
|
|
338
|
-
* This operation retrieves the detailed information about a specified address within a wallet.
|
|
339
|
-
* @param {String} wallet_id The wallet ID.
|
|
340
|
-
* @param {String} address The wallet address.
|
|
341
|
-
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Array.<module:model/AddressInfo>}
|
|
342
|
-
*/
|
|
343
|
-
}, {
|
|
344
|
-
key: "getAddress",
|
|
345
|
-
value: function getAddress(wallet_id, address) {
|
|
346
|
-
return this.getAddressWithHttpInfo(wallet_id, address).then(function (response_and_data) {
|
|
347
|
-
return response_and_data.data;
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
|
|
351
352
|
/**
|
|
352
353
|
* Get chain information
|
|
353
354
|
* This operation retrieves the detailed information about a specified chain.
|
|
@@ -558,7 +559,7 @@ var WalletsApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
558
559
|
* @param {String} wallet_id The wallet ID.
|
|
559
560
|
* @param {Object} opts Optional parameters
|
|
560
561
|
* @param {String} [chain_ids] A list of chain IDs, separated by comma. The chain ID is the unique identifier of a blockchain. You can retrieve the IDs of all the chains you can use by calling [List enabled chains](/v2/api-references/wallets/list-enabled-chains).
|
|
561
|
-
* @param {String} [addresses] A list of wallet addresses, separated by comma.
|
|
562
|
+
* @param {String} [addresses] A list of wallet addresses, separated by comma. For addresses requiring a memo, append the memo after the address using the '|' separator (e.g., \"address|memo\").
|
|
562
563
|
* @param {Number} [limit = 10)] The maximum number of objects to return. For most operations, the value range is [1, 50].
|
|
563
564
|
* @param {String} [before] An object ID that serves as a starting point for retrieving data in reverse chronological order. For example, if you specify `before` as `RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1`, the request will retrieve a list of data objects that end before the object with the object ID `RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1`. You can set this parameter to the value of `pagination.before` in the response of the previous request. - 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 `before` to `infinity`, the last page of data is returned.
|
|
564
565
|
* @param {String} [after] An object ID that acts as a starting point for retrieving data in chronological order. For example, if you specify `after` as `RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk`, the request will retrieve a list of data objects that start after the object with the object ID `RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk`. You can set this parameter to the value of `pagination.after` in the response of the previous request. - 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.
|
|
@@ -601,7 +602,7 @@ var WalletsApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
601
602
|
* @param {String} wallet_id The wallet ID.
|
|
602
603
|
* @param {Object} opts Optional parameters
|
|
603
604
|
* @param {String} opts.chain_ids A list of chain IDs, separated by comma. The chain ID is the unique identifier of a blockchain. You can retrieve the IDs of all the chains you can use by calling [List enabled chains](/v2/api-references/wallets/list-enabled-chains).
|
|
604
|
-
* @param {String} opts.addresses A list of wallet addresses, separated by comma.
|
|
605
|
+
* @param {String} opts.addresses A list of wallet addresses, separated by comma. For addresses requiring a memo, append the memo after the address using the '|' separator (e.g., \"address|memo\").
|
|
605
606
|
* @param {Number} opts.limit The maximum number of objects to return. For most operations, the value range is [1, 50]. (default to 10)
|
|
606
607
|
* @param {String} opts.before An object ID that serves as a starting point for retrieving data in reverse chronological order. For example, if you specify `before` as `RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1`, the request will retrieve a list of data objects that end before the object with the object ID `RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1`. You can set this parameter to the value of `pagination.before` in the response of the previous request. - 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 `before` to `infinity`, the last page of data is returned.
|
|
607
608
|
* @param {String} opts.after An object ID that acts as a starting point for retrieving data in chronological order. For example, if you specify `after` as `RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk`, the request will retrieve a list of data objects that start after the object with the object ID `RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk`. You can set this parameter to the value of `pagination.after` in the response of the previous request. - 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.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _tweetnacl = require("tweetnacl");
|
|
8
|
+
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); }
|
|
9
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
10
|
+
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); } }
|
|
11
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
12
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
13
|
+
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); }
|
|
14
|
+
var Ed25519Signer = exports["default"] = /*#__PURE__*/function () {
|
|
15
|
+
function Ed25519Signer(privateKey) {
|
|
16
|
+
_classCallCheck(this, Ed25519Signer);
|
|
17
|
+
this.privateKey = privateKey;
|
|
18
|
+
}
|
|
19
|
+
return _createClass(Ed25519Signer, [{
|
|
20
|
+
key: "sign",
|
|
21
|
+
value: function sign(message_hash) {
|
|
22
|
+
var pk = this.getPublicKey(this.privateKey);
|
|
23
|
+
var skBytes = new Uint8Array(Buffer.from(this.privateKey + pk, 'hex'));
|
|
24
|
+
var messageBytes = new Uint8Array(Buffer.from(message_hash, 'hex'));
|
|
25
|
+
var signature = _tweetnacl.sign.detached(messageBytes, skBytes);
|
|
26
|
+
return Buffer.from(signature).toString('hex');
|
|
27
|
+
}
|
|
28
|
+
}, {
|
|
29
|
+
key: "getPublicKey",
|
|
30
|
+
value: function getPublicKey() {
|
|
31
|
+
var skBytes = new Uint8Array(Buffer.from(this.privateKey, 'hex'));
|
|
32
|
+
var pk = _tweetnacl.sign.keyPair.fromSeed(skBytes).publicKey;
|
|
33
|
+
return Buffer.from(pk).toString('hex');
|
|
34
|
+
}
|
|
35
|
+
}]);
|
|
36
|
+
}();
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _elliptic = require("elliptic");
|
|
8
|
+
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); }
|
|
9
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
10
|
+
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); } }
|
|
11
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
12
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
13
|
+
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); }
|
|
14
|
+
var ec = new _elliptic.ec('secp256k1');
|
|
15
|
+
var Secp256k1Signer = exports["default"] = /*#__PURE__*/function () {
|
|
16
|
+
function Secp256k1Signer(privateKey) {
|
|
17
|
+
_classCallCheck(this, Secp256k1Signer);
|
|
18
|
+
this.privateKey = privateKey;
|
|
19
|
+
this.keyPair = ec.keyFromPrivate(privateKey, 'hex');
|
|
20
|
+
}
|
|
21
|
+
return _createClass(Secp256k1Signer, [{
|
|
22
|
+
key: "sign",
|
|
23
|
+
value: function sign(message) {
|
|
24
|
+
var messageHash = Buffer.from(message, 'hex');
|
|
25
|
+
var signature = this.keyPair.sign(messageHash, {
|
|
26
|
+
canonical: true
|
|
27
|
+
});
|
|
28
|
+
return Buffer.from(signature.toDER()).toString('hex');
|
|
29
|
+
}
|
|
30
|
+
}, {
|
|
31
|
+
key: "getPublicKey",
|
|
32
|
+
value: function getPublicKey() {
|
|
33
|
+
return this.keyPair.getPublic(true, 'hex');
|
|
34
|
+
}
|
|
35
|
+
}]);
|
|
36
|
+
}();
|