From 5efa2b3dabdab5e8e2d8822cf446f1d831f3045d Mon Sep 17 00:00:00 2001 From: Shanshan Li Date: Wed, 18 Dec 2024 17:36:29 +0800 Subject: [PATCH] release v1.7.0 --- .openapi-generator/FILES | 29 ++- README.md | 19 +- docs/Activity.md | 2 +- docs/ActivityAction.md | 8 + docs/ActivityType.md | 2 + docs/AutoFuelType.md | 12 ++ docs/BabylonValidator.md | 8 +- docs/ContractCallParams.md | 1 + docs/CoreStakeExtra.md | 13 ++ docs/CoreStakingExtra.md | 14 ++ docs/CreateClaimActivity.md | 11 ++ docs/CreateClaimActivityRequest.md | 12 ++ docs/CreateStakeActivity.md | 2 +- docs/CreateStakeActivityExtra.md | 4 + docs/CreateStakeActivityRequest.md | 2 +- docs/CreateWithdrawActivity.md | 1 - docs/CreateWithdrawActivityRequest.md | 1 - docs/DevelopersWebhooksApi.md | 2 +- docs/EstimateClaimFee.md | 11 ++ docs/EstimateContractCallFeeParams.md | 2 +- docs/EstimateFeeParams.md | 2 +- docs/EstimateStakeFee.md | 2 +- docs/EstimateWithdrawFee.md | 1 - docs/EstimatedFee.md | 2 +- docs/EstimatedFixedFee.md | 2 +- docs/EstimatedUtxoFeeSlow.md | 2 +- docs/EthStakingExtra.md | 1 + docs/EthStakingExtraAllOfBeaconValidators.md | 14 ++ docs/FeeAmount.md | 2 +- docs/FeeRate.md | 2 +- docs/FixedFeeRate.md | 2 +- docs/GetStakingEstimationFeeRequest.md | 5 +- docs/MPCProject.md | 2 +- docs/MpcTransferSource.md | 2 +- docs/Pagination.md | 2 +- docs/PoolDetailsAllOfValidatorsInfo.md | 8 +- docs/StakingPoolId.md | 20 +++ docs/StakingPoolType.md | 2 + docs/Stakings.md | 4 +- docs/StakingsApi.md | 110 +++++++++++- docs/StakingsExtra.md | 5 + docs/StakingsValidatorInfo.md | 13 -- docs/TransactionRbf.md | 1 + docs/TransactionRbfSource.md | 2 +- docs/TransactionsApi.md | 4 +- docs/TransferParams.md | 1 + package.json | 5 +- src/ApiClient.js | 59 +++++- src/api/DevelopersWebhooksApi.js | 4 +- src/api/StakingsApi.js | 108 ++++++++++- src/api/TransactionsApi.js | 8 +- src/crypto/Ed25519Signer.js | 21 +++ src/crypto/Secp256k1Signer.js | 20 +++ src/index.js | 69 ++++++- src/model/Activity.js | 12 +- src/model/ActivityAction.js | 28 +++ src/model/ActivityType.js | 7 + src/model/AutoFuelType.js | 51 ++++++ src/model/BabylonValidator.js | 16 +- src/model/ContractCallParams.js | 9 + src/model/CoreStakeExtra.js | 151 ++++++++++++++++ src/model/CoreStakingExtra.js | 168 ++++++++++++++++++ src/model/CreateClaimActivity.js | 121 +++++++++++++ src/model/CreateClaimActivityRequest.js | 161 +++++++++++++++++ src/model/CreateStakeActivity.js | 12 +- src/model/CreateStakeActivityExtra.js | 70 +++++++- src/model/CreateStakeActivityRequest.js | 15 +- src/model/CreateWithdrawActivity.js | 13 -- src/model/CreateWithdrawActivityRequest.js | 18 -- src/model/EstimateClaimFee.js | 125 +++++++++++++ src/model/EstimateContractCallFeeParams.js | 4 +- src/model/EstimateFeeParams.js | 2 +- src/model/EstimateStakeFee.js | 15 +- src/model/EstimateWithdrawFee.js | 18 -- src/model/EstimatedFee.js | 2 +- src/model/EstimatedFixedFee.js | 8 +- src/model/EstimatedUtxoFeeSlow.js | 6 +- src/model/EthStakingExtra.js | 20 +++ .../EthStakingExtraAllOfBeaconValidators.js | 138 ++++++++++++++ src/model/FeeAmount.js | 2 +- src/model/FeeRate.js | 2 +- src/model/FixedFeeRate.js | 4 +- src/model/GetStakingEstimationFeeRequest.js | 58 ++++-- src/model/MPCProject.js | 8 +- src/model/MpcTransferSource.js | 2 +- src/model/Pagination.js | 4 +- src/model/StakingPoolId.js | 79 ++++++++ src/model/StakingPoolType.js | 7 + src/model/Stakings.js | 24 ++- src/model/StakingsExtra.js | 77 +++++++- src/model/StakingsValidatorInfo.js | 138 -------------- src/model/TransactionRbf.js | 9 + src/model/TransactionRbfSource.js | 2 +- src/model/TransactionRequestEvmEip1559Fee.js | 2 +- src/model/TransactionRequestEvmLegacyFee.js | 2 +- src/model/TransactionRequestFixedFee.js | 2 +- src/model/TransactionRequestUtxoFee.js | 2 +- src/model/TransferParams.js | 9 + test/api/StakingsApi.spec.js | 20 +++ test/model/AutoFuelType.spec.js | 56 ++++++ test/model/ContractCallParams.spec.js | 6 + ...torInfo.spec.js => CoreStakeExtra.spec.js} | 42 ++--- test/model/CoreStakingExtra.spec.js | 93 ++++++++++ test/model/CreateClaimActivity.spec.js | 75 ++++++++ test/model/CreateClaimActivityRequest.spec.js | 81 +++++++++ test/model/CreateStakeActivityExtra.spec.js | 24 +++ test/model/CreateWithdrawActivity.spec.js | 6 - .../CreateWithdrawActivityRequest.spec.js | 6 - test/model/EstimateClaimFee.spec.js | 75 ++++++++ test/model/EstimateWithdrawFee.spec.js | 6 - test/model/EthStakingExtra.spec.js | 6 + ...hStakingExtraAllOfBeaconValidators.spec.js | 93 ++++++++++ .../GetStakingEstimationFeeRequest.spec.js | 6 - test/model/MPCProject.spec.js | 4 +- test/model/StakingPoolId.spec.js | 56 ++++++ test/model/StakingsExtra.spec.js | 30 ++++ test/model/TransactionRbf.spec.js | 6 + test/model/TransferParams.spec.js | 6 + 118 files changed, 2544 insertions(+), 439 deletions(-) create mode 100644 docs/AutoFuelType.md create mode 100644 docs/CoreStakeExtra.md create mode 100644 docs/CoreStakingExtra.md create mode 100644 docs/CreateClaimActivity.md create mode 100644 docs/CreateClaimActivityRequest.md create mode 100644 docs/EstimateClaimFee.md create mode 100644 docs/EthStakingExtraAllOfBeaconValidators.md create mode 100644 docs/StakingPoolId.md delete mode 100644 docs/StakingsValidatorInfo.md create mode 100644 src/crypto/Ed25519Signer.js create mode 100644 src/crypto/Secp256k1Signer.js create mode 100644 src/model/AutoFuelType.js create mode 100644 src/model/CoreStakeExtra.js create mode 100644 src/model/CoreStakingExtra.js create mode 100644 src/model/CreateClaimActivity.js create mode 100644 src/model/CreateClaimActivityRequest.js create mode 100644 src/model/EstimateClaimFee.js create mode 100644 src/model/EthStakingExtraAllOfBeaconValidators.js create mode 100644 src/model/StakingPoolId.js delete mode 100644 src/model/StakingsValidatorInfo.js create mode 100644 test/model/AutoFuelType.spec.js rename test/model/{StakingsValidatorInfo.spec.js => CoreStakeExtra.spec.js} (62%) create mode 100644 test/model/CoreStakingExtra.spec.js create mode 100644 test/model/CreateClaimActivity.spec.js create mode 100644 test/model/CreateClaimActivityRequest.spec.js create mode 100644 test/model/EstimateClaimFee.spec.js create mode 100644 test/model/EthStakingExtraAllOfBeaconValidators.spec.js create mode 100644 test/model/StakingPoolId.spec.js diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index c8ace873..0dea2fb5 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -23,6 +23,7 @@ docs/ApiLogDetails.md docs/ApiLogSummary.md docs/AssetBalance.md docs/AssetInfo.md +docs/AutoFuelType.md docs/BabylonStakeEstimatedFee.md docs/BabylonStakeExtra.md docs/BabylonStakingExtra.md @@ -45,7 +46,11 @@ docs/ContractCallDestinationType.md docs/ContractCallParams.md docs/ContractCallSource.md docs/ContractCallSourceType.md +docs/CoreStakeExtra.md +docs/CoreStakingExtra.md docs/CreateAddressRequest.md +docs/CreateClaimActivity.md +docs/CreateClaimActivityRequest.md docs/CreateCustodialWalletParams.md docs/CreateExchangeWalletParams.md docs/CreateKeyShareHolder.md @@ -80,6 +85,7 @@ docs/EigenLayerLstStakeExtra.md docs/EigenLayerNativeStakeExtra.md docs/EigenlayerValidator.md docs/ErrorResponse.md +docs/EstimateClaimFee.md docs/EstimateContractCallFeeParams.md docs/EstimateFeeParams.md docs/EstimateFeeRequestType.md @@ -98,6 +104,7 @@ docs/EstimatedUtxoFeeSlow.md docs/EthStakeEstimatedFee.md docs/EthStakeExtra.md docs/EthStakingExtra.md +docs/EthStakingExtraAllOfBeaconValidators.md docs/EthUnstakeExtra.md docs/EvmContractCallDestination.md docs/EvmEIP191MessageSignDestination.md @@ -194,12 +201,12 @@ docs/SmartContractWalletOperationType.md docs/SmartContractWalletType.md docs/SourceGroup.md docs/StakeSourceType.md +docs/StakingPoolId.md docs/StakingPoolType.md docs/StakingSource.md docs/Stakings.md docs/StakingsApi.md docs/StakingsExtra.md -docs/StakingsValidatorInfo.md docs/SubWalletAssetBalance.md docs/TSSGroups.md docs/TSSRequest.md @@ -320,6 +327,8 @@ src/api/WalletsExchangeWalletApi.js src/api/WalletsMPCWalletsApi.js src/api/WalletsSmartContractWalletsApi.js src/crypto/ApiSigner.js +src/crypto/Ed25519Signer.js +src/crypto/Secp256k1Signer.js src/index.js src/model/Activity.js src/model/ActivityAction.js @@ -339,6 +348,7 @@ src/model/ApiLogDetails.js src/model/ApiLogSummary.js src/model/AssetBalance.js src/model/AssetInfo.js +src/model/AutoFuelType.js src/model/BabylonStakeEstimatedFee.js src/model/BabylonStakeExtra.js src/model/BabylonStakingExtra.js @@ -361,7 +371,11 @@ src/model/ContractCallDestinationType.js src/model/ContractCallParams.js src/model/ContractCallSource.js src/model/ContractCallSourceType.js +src/model/CoreStakeExtra.js +src/model/CoreStakingExtra.js src/model/CreateAddressRequest.js +src/model/CreateClaimActivity.js +src/model/CreateClaimActivityRequest.js src/model/CreateCustodialWalletParams.js src/model/CreateExchangeWalletParams.js src/model/CreateKeyShareHolder.js @@ -394,6 +408,7 @@ src/model/EigenLayerLstStakeExtra.js src/model/EigenLayerNativeStakeExtra.js src/model/EigenlayerValidator.js src/model/ErrorResponse.js +src/model/EstimateClaimFee.js src/model/EstimateContractCallFeeParams.js src/model/EstimateFeeParams.js src/model/EstimateFeeRequestType.js @@ -412,6 +427,7 @@ src/model/EstimatedUtxoFeeSlow.js src/model/EthStakeEstimatedFee.js src/model/EthStakeExtra.js src/model/EthStakingExtra.js +src/model/EthStakingExtraAllOfBeaconValidators.js src/model/EthUnstakeExtra.js src/model/EvmContractCallDestination.js src/model/EvmEIP191MessageSignDestination.js @@ -507,11 +523,11 @@ src/model/SmartContractWalletOperationType.js src/model/SmartContractWalletType.js src/model/SourceGroup.js src/model/StakeSourceType.js +src/model/StakingPoolId.js src/model/StakingPoolType.js src/model/StakingSource.js src/model/Stakings.js src/model/StakingsExtra.js -src/model/StakingsValidatorInfo.js src/model/SubWalletAssetBalance.js src/model/TSSGroups.js src/model/TSSRequest.js @@ -637,6 +653,7 @@ test/model/ApiLogDetails.spec.js test/model/ApiLogSummary.spec.js test/model/AssetBalance.spec.js test/model/AssetInfo.spec.js +test/model/AutoFuelType.spec.js test/model/BabylonStakeEstimatedFee.spec.js test/model/BabylonStakeExtra.spec.js test/model/BabylonStakingExtra.spec.js @@ -659,7 +676,11 @@ test/model/ContractCallDestinationType.spec.js test/model/ContractCallParams.spec.js test/model/ContractCallSource.spec.js test/model/ContractCallSourceType.spec.js +test/model/CoreStakeExtra.spec.js +test/model/CoreStakingExtra.spec.js test/model/CreateAddressRequest.spec.js +test/model/CreateClaimActivity.spec.js +test/model/CreateClaimActivityRequest.spec.js test/model/CreateCustodialWalletParams.spec.js test/model/CreateExchangeWalletParams.spec.js test/model/CreateKeyShareHolder.spec.js @@ -692,6 +713,7 @@ test/model/EigenLayerLstStakeExtra.spec.js test/model/EigenLayerNativeStakeExtra.spec.js test/model/EigenlayerValidator.spec.js test/model/ErrorResponse.spec.js +test/model/EstimateClaimFee.spec.js test/model/EstimateContractCallFeeParams.spec.js test/model/EstimateFeeParams.spec.js test/model/EstimateFeeRequestType.spec.js @@ -710,6 +732,7 @@ test/model/EstimatedUtxoFeeSlow.spec.js test/model/EthStakeEstimatedFee.spec.js test/model/EthStakeExtra.spec.js test/model/EthStakingExtra.spec.js +test/model/EthStakingExtraAllOfBeaconValidators.spec.js test/model/EthUnstakeExtra.spec.js test/model/EvmContractCallDestination.spec.js test/model/EvmEIP191MessageSignDestination.spec.js @@ -805,11 +828,11 @@ test/model/SmartContractWalletOperationType.spec.js test/model/SmartContractWalletType.spec.js test/model/SourceGroup.spec.js test/model/StakeSourceType.spec.js +test/model/StakingPoolId.spec.js test/model/StakingPoolType.spec.js test/model/StakingSource.spec.js test/model/Stakings.spec.js test/model/StakingsExtra.spec.js -test/model/StakingsValidatorInfo.spec.js test/model/SubWalletAssetBalance.spec.js test/model/TSSGroups.spec.js test/model/TSSRequest.spec.js diff --git a/README.md b/README.md index 89eedef2..c5ed5430 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ For more information about the WaaS 2.0 API, see [Introduction to WaaS 2.0](/v2/ This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - API version: v2 -- Package version: 1.6.0 +- Package version: 1.7.0 - Generator version: 7.6.0 - Build package: org.openapitools.codegen.languages.JavascriptClientCodegen For more information, please visit [https://www.cobo.com/waas](https://www.cobo.com/waas) @@ -36,7 +36,13 @@ const CoboWaas2 = require('@cobo/cobo-waas2'); const apiClient = CoboWaas2.ApiClient.instance // for dev env // apiClient.setEnv(CoboWaas2.Env.DEV); + +// by default, ed25519 is used apiClient.setPrivateKey(""); + +// or secp256k1 +// apiClient.setPrivateKey("", "SECP256K1"); + // call api const apiInstance = new CoboWaas2.WalletsApi(); const opts = { @@ -75,12 +81,14 @@ Class | Method | HTTP request | Description *CoboWaas2.DevelopersWebhooksApi* | [**updateWebhookEndpointById**](docs/DevelopersWebhooksApi.md#updateWebhookEndpointById) | **PUT** /webhooks/endpoints/{endpoint_id} | Update webhook endpoint *CoboWaas2.OAuthApi* | [**getToken**](docs/OAuthApi.md#getToken) | **GET** /oauth/token | Get Org Access Token *CoboWaas2.OAuthApi* | [**refreshToken**](docs/OAuthApi.md#refreshToken) | **POST** /oauth/token | Refresh Org Access Token +*CoboWaas2.StakingsApi* | [**createClaimActivity**](docs/StakingsApi.md#createClaimActivity) | **POST** /stakings/activities/claim | Create claim activity *CoboWaas2.StakingsApi* | [**createStakeActivity**](docs/StakingsApi.md#createStakeActivity) | **POST** /stakings/activities/stake | Create stake activity *CoboWaas2.StakingsApi* | [**createUnstakeActivity**](docs/StakingsApi.md#createUnstakeActivity) | **POST** /stakings/activities/unstake | Create unstake activity *CoboWaas2.StakingsApi* | [**createWithdrawActivity**](docs/StakingsApi.md#createWithdrawActivity) | **POST** /stakings/activities/withdraw | Create withdraw activity *CoboWaas2.StakingsApi* | [**getStakingActivityById**](docs/StakingsApi.md#getStakingActivityById) | **GET** /stakings/activities/{activity_id} | Get staking activity details *CoboWaas2.StakingsApi* | [**getStakingById**](docs/StakingsApi.md#getStakingById) | **GET** /stakings/{staking_id} | Get staking position details *CoboWaas2.StakingsApi* | [**getStakingEstimationFee**](docs/StakingsApi.md#getStakingEstimationFee) | **POST** /stakings/estimate_fee | Estimate staking fees +*CoboWaas2.StakingsApi* | [**getStakingEstimationFeeV2**](docs/StakingsApi.md#getStakingEstimationFeeV2) | **POST** /stakings/estimate_fee_v2 | Estimate staking fees *CoboWaas2.StakingsApi* | [**getStakingPoolById**](docs/StakingsApi.md#getStakingPoolById) | **GET** /stakings/pools/{pool_id} | Get staking pool details *CoboWaas2.StakingsApi* | [**listStakingActivities**](docs/StakingsApi.md#listStakingActivities) | **GET** /stakings/activities | List staking activities *CoboWaas2.StakingsApi* | [**listStakingPools**](docs/StakingsApi.md#listStakingPools) | **GET** /stakings/pools | List staking pools @@ -164,6 +172,7 @@ Class | Method | HTTP request | Description - [CoboWaas2.ApiLogSummary](docs/ApiLogSummary.md) - [CoboWaas2.AssetBalance](docs/AssetBalance.md) - [CoboWaas2.AssetInfo](docs/AssetInfo.md) + - [CoboWaas2.AutoFuelType](docs/AutoFuelType.md) - [CoboWaas2.BabylonStakeEstimatedFee](docs/BabylonStakeEstimatedFee.md) - [CoboWaas2.BabylonStakeExtra](docs/BabylonStakeExtra.md) - [CoboWaas2.BabylonStakingExtra](docs/BabylonStakingExtra.md) @@ -186,7 +195,11 @@ Class | Method | HTTP request | Description - [CoboWaas2.ContractCallParams](docs/ContractCallParams.md) - [CoboWaas2.ContractCallSource](docs/ContractCallSource.md) - [CoboWaas2.ContractCallSourceType](docs/ContractCallSourceType.md) + - [CoboWaas2.CoreStakeExtra](docs/CoreStakeExtra.md) + - [CoboWaas2.CoreStakingExtra](docs/CoreStakingExtra.md) - [CoboWaas2.CreateAddressRequest](docs/CreateAddressRequest.md) + - [CoboWaas2.CreateClaimActivity](docs/CreateClaimActivity.md) + - [CoboWaas2.CreateClaimActivityRequest](docs/CreateClaimActivityRequest.md) - [CoboWaas2.CreateCustodialWalletParams](docs/CreateCustodialWalletParams.md) - [CoboWaas2.CreateExchangeWalletParams](docs/CreateExchangeWalletParams.md) - [CoboWaas2.CreateKeyShareHolder](docs/CreateKeyShareHolder.md) @@ -219,6 +232,7 @@ Class | Method | HTTP request | Description - [CoboWaas2.EigenLayerNativeStakeExtra](docs/EigenLayerNativeStakeExtra.md) - [CoboWaas2.EigenlayerValidator](docs/EigenlayerValidator.md) - [CoboWaas2.ErrorResponse](docs/ErrorResponse.md) + - [CoboWaas2.EstimateClaimFee](docs/EstimateClaimFee.md) - [CoboWaas2.EstimateContractCallFeeParams](docs/EstimateContractCallFeeParams.md) - [CoboWaas2.EstimateFeeParams](docs/EstimateFeeParams.md) - [CoboWaas2.EstimateFeeRequestType](docs/EstimateFeeRequestType.md) @@ -237,6 +251,7 @@ Class | Method | HTTP request | Description - [CoboWaas2.EthStakeEstimatedFee](docs/EthStakeEstimatedFee.md) - [CoboWaas2.EthStakeExtra](docs/EthStakeExtra.md) - [CoboWaas2.EthStakingExtra](docs/EthStakingExtra.md) + - [CoboWaas2.EthStakingExtraAllOfBeaconValidators](docs/EthStakingExtraAllOfBeaconValidators.md) - [CoboWaas2.EthUnstakeExtra](docs/EthUnstakeExtra.md) - [CoboWaas2.EvmContractCallDestination](docs/EvmContractCallDestination.md) - [CoboWaas2.EvmEIP191MessageSignDestination](docs/EvmEIP191MessageSignDestination.md) @@ -332,11 +347,11 @@ Class | Method | HTTP request | Description - [CoboWaas2.SmartContractWalletType](docs/SmartContractWalletType.md) - [CoboWaas2.SourceGroup](docs/SourceGroup.md) - [CoboWaas2.StakeSourceType](docs/StakeSourceType.md) + - [CoboWaas2.StakingPoolId](docs/StakingPoolId.md) - [CoboWaas2.StakingPoolType](docs/StakingPoolType.md) - [CoboWaas2.StakingSource](docs/StakingSource.md) - [CoboWaas2.Stakings](docs/Stakings.md) - [CoboWaas2.StakingsExtra](docs/StakingsExtra.md) - - [CoboWaas2.StakingsValidatorInfo](docs/StakingsValidatorInfo.md) - [CoboWaas2.SubWalletAssetBalance](docs/SubWalletAssetBalance.md) - [CoboWaas2.TSSGroups](docs/TSSGroups.md) - [CoboWaas2.TSSRequest](docs/TSSRequest.md) diff --git a/docs/Activity.md b/docs/Activity.md index 74954a9f..f8736630 100644 --- a/docs/Activity.md +++ b/docs/Activity.md @@ -10,7 +10,7 @@ Name | Type | Description | Notes **type** | [**ActivityType**](ActivityType.md) | | [optional] **wallet_id** | **String** | The staker's wallet ID. | [optional] **address** | **String** | The staker's wallet address. | [optional] -**pool_id** | **String** | The ID of the staking pool. | +**pool_id** | [**StakingPoolId**](StakingPoolId.md) | | **token_id** | **String** | The token ID. | **staking_id** | **String** | The ID of the corresponding staking position. | [optional] **amount** | **String** | The staking amount. | diff --git a/docs/ActivityAction.md b/docs/ActivityAction.md index 48b079d7..a36e7a0e 100644 --- a/docs/ActivityAction.md +++ b/docs/ActivityAction.md @@ -9,6 +9,14 @@ * `BabylonConfirmation` (value: `"BabylonConfirmation"`) +* `DepositETH` (value: `"DepositETH"`) + +* `ClaimRewards` (value: `"ClaimRewards"`) + +* `ActivateValidator` (value: `"ActivateValidator"`) + +* `UnstakeETH` (value: `"UnstakeETH"`) + * `unknown_default_open_api` (value: `"unknown_default_open_api"`) diff --git a/docs/ActivityType.md b/docs/ActivityType.md index 9c958a9a..c4c6c1ba 100644 --- a/docs/ActivityType.md +++ b/docs/ActivityType.md @@ -9,6 +9,8 @@ * `Withdraw` (value: `"Withdraw"`) +* `Claim` (value: `"Claim"`) + * `unknown_default_open_api` (value: `"unknown_default_open_api"`) diff --git a/docs/AutoFuelType.md b/docs/AutoFuelType.md new file mode 100644 index 00000000..cbea7387 --- /dev/null +++ b/docs/AutoFuelType.md @@ -0,0 +1,12 @@ +# CoboWaas2.AutoFuelType + +## Enum + + +* `PassiveAutoFuel` (value: `"PassiveAutoFuel"`) + +* `ProActiveAutoFuel` (value: `"ProActiveAutoFuel"`) + +* `unknown_default_open_api` (value: `"unknown_default_open_api"`) + + diff --git a/docs/BabylonValidator.md b/docs/BabylonValidator.md index ad44e84e..18341897 100644 --- a/docs/BabylonValidator.md +++ b/docs/BabylonValidator.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **pool_type** | [**StakingPoolType**](StakingPoolType.md) | | -**icon_url** | **String** | The URL of the validator's icon. | +**icon_url** | **String** | The URL of the validator's icon. | [optional] **name** | **String** | The validator's name. | **priority** | **Number** | This property can be ignored. | [optional] -**public_key** | **String** | The public key of the validator. | -**commission_rate** | **Number** | The commission rate of the validator. | -**supported_pos_chains** | **[String]** | A list of supported Proof-of-Stake (PoS) chains. | +**public_key** | **String** | The public key of the validator. | [optional] +**commission_rate** | **Number** | The commission rate of the validator. | [optional] +**supported_pos_chains** | **[String]** | A list of supported Proof-of-Stake (PoS) chains. | [optional] diff --git a/docs/ContractCallParams.md b/docs/ContractCallParams.md index f9bcd288..a4bd95f0 100644 --- a/docs/ContractCallParams.md +++ b/docs/ContractCallParams.md @@ -11,5 +11,6 @@ Name | Type | Description | Notes **description** | **String** | The description of the contract call transaction. | [optional] **category_names** | **[String]** | The custom category for you to identify your transactions. | [optional] **fee** | [**TransactionRequestFee**](TransactionRequestFee.md) | | [optional] +**auto_fuel** | [**AutoFuelType**](AutoFuelType.md) | | [optional] diff --git a/docs/CoreStakeExtra.md b/docs/CoreStakeExtra.md new file mode 100644 index 00000000..0d9cae7a --- /dev/null +++ b/docs/CoreStakeExtra.md @@ -0,0 +1,13 @@ +# CoboWaas2.CoreStakeExtra + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**pool_type** | [**StakingPoolType**](StakingPoolType.md) | | +**timelock** | **Number** | The Unix timestamp (in seconds) when the staking position will be unlocked and available for withdrawal. | +**change_address** | **String** | The change address on the Bitcoin chain. If not provided, the source wallet's address will be used as the change address. | [optional] +**validator_address** | **String** | The validator's EVM address. | +**reward_address** | **String** | The EVM address to receive staking rewards. | + + diff --git a/docs/CoreStakingExtra.md b/docs/CoreStakingExtra.md new file mode 100644 index 00000000..bd9ea8e2 --- /dev/null +++ b/docs/CoreStakingExtra.md @@ -0,0 +1,14 @@ +# CoboWaas2.CoreStakingExtra + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**pool_type** | [**StakingPoolType**](StakingPoolType.md) | | +**pos_chain** | **String** | The Proof-of-Stake (PoS) chain. | +**staker_address** | **String** | The staker's Bitcoin address. | +**validator_address** | **String** | The validator's EVM address. | +**reward_address** | **String** | The EVM address to receive staking rewards. | +**timelock** | **Number** | The Unix timestamp (in seconds) when the staking position will be unlocked and available for withdrawal. | + + diff --git a/docs/CreateClaimActivity.md b/docs/CreateClaimActivity.md new file mode 100644 index 00000000..5511e26b --- /dev/null +++ b/docs/CreateClaimActivity.md @@ -0,0 +1,11 @@ +# CoboWaas2.CreateClaimActivity + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**request_id** | **String** | The request ID that is used to track a request. The request ID is provided by you and must be unique within your organization. | [optional] +**staking_id** | **String** | 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). | +**fee** | [**TransactionRequestFee**](TransactionRequestFee.md) | | [optional] + + diff --git a/docs/CreateClaimActivityRequest.md b/docs/CreateClaimActivityRequest.md new file mode 100644 index 00000000..418f7988 --- /dev/null +++ b/docs/CreateClaimActivityRequest.md @@ -0,0 +1,12 @@ +# CoboWaas2.CreateClaimActivityRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**request_id** | **String** | The request ID that is used to track a request. The request ID is provided by you and must be unique within your organization. | [optional] +**staking_id** | **String** | 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). | +**fee** | [**TransactionRequestFee**](TransactionRequestFee.md) | | [optional] +**app_initiator** | **String** | The initiator of the staking activity. If you do not specify this property, the WaaS service will automatically designate the API key as the initiator. | [optional] + + diff --git a/docs/CreateStakeActivity.md b/docs/CreateStakeActivity.md index c89f992f..43e319ca 100644 --- a/docs/CreateStakeActivity.md +++ b/docs/CreateStakeActivity.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **request_id** | **String** | The request ID that is used to track a request. The request ID is provided by you and must be unique within your organization. | [optional] **source** | [**StakingSource**](StakingSource.md) | | [optional] -**pool_id** | **String** | The ID of the staking pool. | +**pool_id** | [**StakingPoolId**](StakingPoolId.md) | | **amount** | **String** | The amount to stake. | **fee** | [**TransactionRequestFee**](TransactionRequestFee.md) | | **extra** | [**CreateStakeActivityExtra**](CreateStakeActivityExtra.md) | | diff --git a/docs/CreateStakeActivityExtra.md b/docs/CreateStakeActivityExtra.md index f1cd5e7c..07d17ad1 100644 --- a/docs/CreateStakeActivityExtra.md +++ b/docs/CreateStakeActivityExtra.md @@ -9,5 +9,9 @@ Name | Type | Description | Notes **stake_block_time** | **Number** | The number of blocks that need to be processed before the locked tokens are unlocked and become accessible. | **auto_broadcast** | **Boolean** | Whether to automatically broadcast the transaction. The default value is `true`. - `true`: Automatically broadcast the transaction. - `false`: The transaction will not be submitted to the blockchain automatically. You can call [Broadcast signed transactions](/v2/api-references/transactions/broadcast-signed-transactions) to broadcast the transaction to the blockchain, or retrieve the signed raw transaction data `raw_tx` by calling [Get transaction information](/v2/api-references/transactions/get-transaction-information) and broadcast it yourself. | [optional] **provider_name** | **String** | The name of the provider. | +**timelock** | **Number** | The Unix timestamp (in seconds) when the staking position will be unlocked and available for withdrawal. | +**change_address** | **String** | The change address on the Bitcoin chain. If not provided, the source wallet's address will be used as the change address. | [optional] +**validator_address** | **String** | The validator's EVM address. | +**reward_address** | **String** | The EVM address to receive staking rewards. | diff --git a/docs/CreateStakeActivityRequest.md b/docs/CreateStakeActivityRequest.md index 44cd55c7..21ef5539 100644 --- a/docs/CreateStakeActivityRequest.md +++ b/docs/CreateStakeActivityRequest.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **request_id** | **String** | The request ID that is used to track a request. The request ID is provided by you and must be unique within your organization. | [optional] **source** | [**StakingSource**](StakingSource.md) | | [optional] -**pool_id** | **String** | The ID of the staking pool. | +**pool_id** | [**StakingPoolId**](StakingPoolId.md) | | **amount** | **String** | The amount to stake. | **fee** | [**TransactionRequestFee**](TransactionRequestFee.md) | | **extra** | [**CreateStakeActivityExtra**](CreateStakeActivityExtra.md) | | diff --git a/docs/CreateWithdrawActivity.md b/docs/CreateWithdrawActivity.md index 58d1eb69..a677a558 100644 --- a/docs/CreateWithdrawActivity.md +++ b/docs/CreateWithdrawActivity.md @@ -7,7 +7,6 @@ Name | Type | Description | Notes **request_id** | **String** | The request ID that is used to track a request. The request ID is provided by you and must be unique within your organization. | [optional] **staking_id** | **String** | The ID of the corresponding staking position. | **amount** | **String** | The amount to withdraw. | [optional] -**address** | **String** | The withdrawal address. | [optional] **fee** | [**TransactionRequestFee**](TransactionRequestFee.md) | | diff --git a/docs/CreateWithdrawActivityRequest.md b/docs/CreateWithdrawActivityRequest.md index 0f2e45fc..5e0fe169 100644 --- a/docs/CreateWithdrawActivityRequest.md +++ b/docs/CreateWithdrawActivityRequest.md @@ -7,7 +7,6 @@ Name | Type | Description | Notes **request_id** | **String** | The request ID that is used to track a request. The request ID is provided by you and must be unique within your organization. | [optional] **staking_id** | **String** | The ID of the corresponding staking position. | **amount** | **String** | The amount to withdraw. | [optional] -**address** | **String** | The withdrawal address. | [optional] **fee** | [**TransactionRequestFee**](TransactionRequestFee.md) | | **app_initiator** | **String** | The initiator of the staking activity. If you do not specify this property, the WaaS service will automatically designate the API key as the initiator. | [optional] diff --git a/docs/DevelopersWebhooksApi.md b/docs/DevelopersWebhooksApi.md index defde2fb..3622829c 100644 --- a/docs/DevelopersWebhooksApi.md +++ b/docs/DevelopersWebhooksApi.md @@ -457,7 +457,7 @@ Name | Type | Description | Notes Trigger test event -This operation tests the functionality of your webhook endpoint by triggering a test webhook event. You only need to provide the event type. By default, the payload contains dummy data with no impact on your real business transactions or activities. You can optionally provide the `override_data` property to customize the payload. +This operation tests the functionality of your webhook endpoint by triggering a test webhook event. The test event will be sent to all the endpoints you have registered on Cobo Portal. You only need to provide the event type. By default, the payload contains dummy data with no impact on your real business transactions or activities. You can optionally provide the `override_data` property to customize the payload. ### Example diff --git a/docs/EstimateClaimFee.md b/docs/EstimateClaimFee.md new file mode 100644 index 00000000..36a92bcd --- /dev/null +++ b/docs/EstimateClaimFee.md @@ -0,0 +1,11 @@ +# CoboWaas2.EstimateClaimFee + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**activity_type** | [**ActivityType**](ActivityType.md) | | +**staking_id** | **String** | 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). | [optional] +**fee** | [**TransactionRequestFee**](TransactionRequestFee.md) | | [optional] + + diff --git a/docs/EstimateContractCallFeeParams.md b/docs/EstimateContractCallFeeParams.md index 0cf92657..a4e48598 100644 --- a/docs/EstimateContractCallFeeParams.md +++ b/docs/EstimateContractCallFeeParams.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **request_id** | **String** | The request ID that is used to track a transaction request. The request ID is provided by you and must be unique within your organization. It is recommended to use the same request ID as the transaction for which you want to estimate the transaction fee. | [optional] **request_type** | [**EstimateFeeRequestType**](EstimateFeeRequestType.md) | | -**chain_id** | **String** | 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). | +**chain_id** | **String** | The chain ID of the chain on which the smart contract is deployed. You can retrieve the IDs of all the chains you can use by calling [List enabled chains](/v2/api-references/wallets/list-enabled-chains). | **source** | [**ContractCallSource**](ContractCallSource.md) | | **destination** | [**ContractCallDestination**](ContractCallDestination.md) | | **fee_type** | [**FeeType**](FeeType.md) | | [optional] diff --git a/docs/EstimateFeeParams.md b/docs/EstimateFeeParams.md index 3fb6dcd3..0e455de5 100644 --- a/docs/EstimateFeeParams.md +++ b/docs/EstimateFeeParams.md @@ -10,6 +10,6 @@ Name | Type | Description | Notes **token_id** | **String** | The token ID of the transferred token. You can retrieve the IDs of all the tokens you can use by calling [List enabled tokens](/v2/api-references/wallets/list-enabled-tokens). | **destination** | [**ContractCallDestination**](ContractCallDestination.md) | | **fee_type** | [**FeeType**](FeeType.md) | | [optional] -**chain_id** | **String** | 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). | +**chain_id** | **String** | The chain ID of the chain on which the smart contract is deployed. You can retrieve the IDs of all the chains you can use by calling [List enabled chains](/v2/api-references/wallets/list-enabled-chains). | diff --git a/docs/EstimateStakeFee.md b/docs/EstimateStakeFee.md index 38811766..1be5f917 100644 --- a/docs/EstimateStakeFee.md +++ b/docs/EstimateStakeFee.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **activity_type** | [**ActivityType**](ActivityType.md) | | **request_id** | **String** | The request ID that is used to track a request. The request ID is provided by you and must be unique within your organization. | [optional] **source** | [**StakingSource**](StakingSource.md) | | [optional] -**pool_id** | **String** | The ID of the staking pool. | +**pool_id** | [**StakingPoolId**](StakingPoolId.md) | | **amount** | **String** | The amount to stake. | **fee** | [**TransactionRequestFee**](TransactionRequestFee.md) | | **extra** | [**CreateStakeActivityExtra**](CreateStakeActivityExtra.md) | | diff --git a/docs/EstimateWithdrawFee.md b/docs/EstimateWithdrawFee.md index 2a974ad8..d4e5f09b 100644 --- a/docs/EstimateWithdrawFee.md +++ b/docs/EstimateWithdrawFee.md @@ -8,7 +8,6 @@ Name | Type | Description | Notes **request_id** | **String** | The request ID that is used to track a request. The request ID is provided by you and must be unique within your organization. | [optional] **staking_id** | **String** | The ID of the corresponding staking position. | **amount** | **String** | The amount to withdraw. | [optional] -**address** | **String** | The withdrawal address. | [optional] **fee** | [**TransactionRequestFee**](TransactionRequestFee.md) | | diff --git a/docs/EstimatedFee.md b/docs/EstimatedFee.md index 470c90f5..923ce684 100644 --- a/docs/EstimatedFee.md +++ b/docs/EstimatedFee.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **fee_type** | [**FeeType**](FeeType.md) | | **token_id** | **String** | The token ID of the transaction fee. | **is_loop** | **Boolean** | Whether the transaction was executed as a [Cobo Loop](https://manuals.cobo.com/en/portal/custodial-wallets/cobo-loop) transfer. - `true`: The transaction was executed as a Cobo Loop transfer. - `false`: The transaction was not executed as a Cobo Loop transfer. | [optional] -**fee_amount** | **String** | The fee that you need to pay for the transaction. | +**fee_amount** | **String** | The transaction fee that you need to pay for the transaction. | **slow** | [**EstimatedUtxoFeeSlow**](EstimatedUtxoFeeSlow.md) | | [optional] **recommended** | [**EstimatedUtxoFeeSlow**](EstimatedUtxoFeeSlow.md) | | **fast** | [**EstimatedUtxoFeeSlow**](EstimatedUtxoFeeSlow.md) | | [optional] diff --git a/docs/EstimatedFixedFee.md b/docs/EstimatedFixedFee.md index f5731001..b0410b9a 100644 --- a/docs/EstimatedFixedFee.md +++ b/docs/EstimatedFixedFee.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**fee_amount** | **String** | The fee that you need to pay for the transaction. | +**fee_amount** | **String** | The transaction fee that you need to pay for the transaction. | **fee_type** | [**FeeType**](FeeType.md) | | **token_id** | **String** | The token ID of the transaction fee. | **is_loop** | **Boolean** | Whether the transaction was executed as a [Cobo Loop](https://manuals.cobo.com/en/portal/custodial-wallets/cobo-loop) transfer. - `true`: The transaction was executed as a Cobo Loop transfer. - `false`: The transaction was not executed as a Cobo Loop transfer. | [optional] diff --git a/docs/EstimatedUtxoFeeSlow.md b/docs/EstimatedUtxoFeeSlow.md index 954b34b3..bc2d132b 100644 --- a/docs/EstimatedUtxoFeeSlow.md +++ b/docs/EstimatedUtxoFeeSlow.md @@ -5,6 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **fee_rate** | **String** | The fee rate in sat/vByte. The fee rate represents the satoshis you are willing to pay for each byte of data that your transaction will consume on the blockchain. | -**fee_amount** | **String** | The fee that you need to pay for the transaction. | +**fee_amount** | **String** | The transaction fee that you need to pay for the transaction. | diff --git a/docs/EthStakingExtra.md b/docs/EthStakingExtra.md index e81b994b..77b80a18 100644 --- a/docs/EthStakingExtra.md +++ b/docs/EthStakingExtra.md @@ -6,5 +6,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **pool_type** | [**StakingPoolType**](StakingPoolType.md) | | **pos_chain** | **String** | The Proof-of-Stake (PoS) chain. | +**beacon_validators** | [**[EthStakingExtraAllOfBeaconValidators]**](EthStakingExtraAllOfBeaconValidators.md) | The list of validator information. | [optional] diff --git a/docs/EthStakingExtraAllOfBeaconValidators.md b/docs/EthStakingExtraAllOfBeaconValidators.md new file mode 100644 index 00000000..c6073b74 --- /dev/null +++ b/docs/EthStakingExtraAllOfBeaconValidators.md @@ -0,0 +1,14 @@ +# CoboWaas2.EthStakingExtraAllOfBeaconValidators + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**pubkey** | **String** | The public key of the validator. | [optional] +**status** | [**AmountStatus**](AmountStatus.md) | | [optional] +**apy** | **Number** | The annual percentage yield (APY) of the validator. | [optional] +**staked_amount** | **String** | The staked amount. | [optional] +**rewards_received** | **String** | The rewards received. | [optional] +**updated_timestamp** | **Number** | The time when the validator's status was last updated, in Unix timestamp format and measured in milliseconds. | [optional] + + diff --git a/docs/FeeAmount.md b/docs/FeeAmount.md index 9ea8eaca..4b492859 100644 --- a/docs/FeeAmount.md +++ b/docs/FeeAmount.md @@ -4,6 +4,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**fee_amount** | **String** | The fee that you need to pay for the transaction. | [optional] +**fee_amount** | **String** | The transaction fee that you need to pay for the transaction. | [optional] diff --git a/docs/FeeRate.md b/docs/FeeRate.md index 8a837e38..300b6a18 100644 --- a/docs/FeeRate.md +++ b/docs/FeeRate.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **fee_type** | [**FeeType**](FeeType.md) | | **token_id** | **String** | The token ID of the transaction fee. | -**fee_amount** | **String** | The fee that you need to pay for the transaction. | [optional] +**fee_amount** | **String** | The transaction fee that you need to pay for the transaction. | [optional] **slow** | [**UtxoFeeBasePrice**](UtxoFeeBasePrice.md) | | [optional] **recommended** | [**UtxoFeeBasePrice**](UtxoFeeBasePrice.md) | | **fast** | [**UtxoFeeBasePrice**](UtxoFeeBasePrice.md) | | [optional] diff --git a/docs/FixedFeeRate.md b/docs/FixedFeeRate.md index e0407c58..f02a8eaf 100644 --- a/docs/FixedFeeRate.md +++ b/docs/FixedFeeRate.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**fee_amount** | **String** | The fee that you need to pay for the transaction. | [optional] +**fee_amount** | **String** | The transaction fee that you need to pay for the transaction. | [optional] **fee_type** | [**FeeType**](FeeType.md) | | **token_id** | **String** | The token ID of the transaction fee. | diff --git a/docs/GetStakingEstimationFeeRequest.md b/docs/GetStakingEstimationFeeRequest.md index 4ca2f28f..2e9c3314 100644 --- a/docs/GetStakingEstimationFeeRequest.md +++ b/docs/GetStakingEstimationFeeRequest.md @@ -7,11 +7,10 @@ Name | Type | Description | Notes **activity_type** | [**ActivityType**](ActivityType.md) | | **request_id** | **String** | The request ID that is used to track a request. The request ID is provided by you and must be unique within your organization. | [optional] **source** | [**StakingSource**](StakingSource.md) | | [optional] -**pool_id** | **String** | The ID of the staking pool. | +**pool_id** | [**StakingPoolId**](StakingPoolId.md) | | **amount** | **String** | The amount to withdraw. | **fee** | [**TransactionRequestFee**](TransactionRequestFee.md) | | **extra** | [**CreateUnstakeActivityExtra**](CreateUnstakeActivityExtra.md) | | -**staking_id** | **String** | The ID of the corresponding staking position. | -**address** | **String** | The withdrawal address. | +**staking_id** | **String** | 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). | diff --git a/docs/MPCProject.md b/docs/MPCProject.md index 30903cfa..d91d3f92 100644 --- a/docs/MPCProject.md +++ b/docs/MPCProject.md @@ -9,6 +9,6 @@ Name | Type | Description | Notes **name** | **String** | The project name. | [optional] **participants** | **Number** | The number of key share holders in the project. | [optional] **threshold** | **Number** | The number of key share holders required to sign an operation in the project. | [optional] -**create_timestamp** | **Number** | The project's creation time in Unix timestamp format, measured in milliseconds. | [optional] +**created_timestamp** | **Number** | The project's creation time in Unix timestamp format, measured in milliseconds. | [optional] diff --git a/docs/MpcTransferSource.md b/docs/MpcTransferSource.md index efa1b040..4c3e0175 100644 --- a/docs/MpcTransferSource.md +++ b/docs/MpcTransferSource.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **source_type** | [**WalletSubtype**](WalletSubtype.md) | | **wallet_id** | **String** | The wallet ID. | -**address** | **String** | The wallet address. If you want to specify the UTXOs to be used, please provide the `included_utxos` property. If you specify both the `address` and `included_utxos` properties, the specified included UTXOs must belong to the address. You need to provide either the `address` or `included_utxos` property. If neither property is provided, the transfer will fail. | [optional] +**address** | **String** | The wallet address. If you want to specify the UTXOs to be used, please provide the `included_utxos` property. If you specify both the `address` and `included_utxos` properties, the specified included UTXOs must belong to the address. It is recommended to specify no more than 100 included UTXOs to ensure optimal transaction processing. You need to provide either the `address` or `included_utxos` property. If neither property is provided, the transfer will fail. | [optional] **included_utxos** | [**[TransactionUtxo]**](TransactionUtxo.md) | | [optional] **excluded_utxos** | [**[TransactionUtxo]**](TransactionUtxo.md) | | [optional] diff --git a/docs/Pagination.md b/docs/Pagination.md index 5a7f0f87..7e97d9db 100644 --- a/docs/Pagination.md +++ b/docs/Pagination.md @@ -6,6 +6,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **before** | **String** | An object ID that serves as a starting point for retrieving data in reverse chronological order for the next request. If this property is empty, it means that you have reached the start of the data records. | **after** | **String** | An object ID that acts as a starting point for retrieving data in chronological order for the next request. If this property is empty, it means that you have reached the end of the data records. | -**total_count** | **Number** | The total number of records that match the query, across all pages. | +**total_count** | **Number** | The total number of records that match the query criteria, unaffected by the pagination parameters (`before` , `after`, and `limit`). | diff --git a/docs/PoolDetailsAllOfValidatorsInfo.md b/docs/PoolDetailsAllOfValidatorsInfo.md index d91b8d7f..ebc58c45 100644 --- a/docs/PoolDetailsAllOfValidatorsInfo.md +++ b/docs/PoolDetailsAllOfValidatorsInfo.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **pool_type** | [**StakingPoolType**](StakingPoolType.md) | | -**icon_url** | **String** | The URL of the validator's icon. | +**icon_url** | **String** | The URL of the validator's icon. | [optional] **name** | **String** | The validator's name. | **priority** | **Number** | This property can be ignored. | [optional] -**public_key** | **String** | The public key of the validator. | -**commission_rate** | **Number** | The commission rate of the validator. | -**supported_pos_chains** | **[String]** | A list of supported Proof-of-Stake (PoS) chains. | +**public_key** | **String** | The public key of the validator. | [optional] +**commission_rate** | **Number** | The commission rate of the validator. | [optional] +**supported_pos_chains** | **[String]** | A list of supported Proof-of-Stake (PoS) chains. | [optional] diff --git a/docs/StakingPoolId.md b/docs/StakingPoolId.md new file mode 100644 index 00000000..a3929cb9 --- /dev/null +++ b/docs/StakingPoolId.md @@ -0,0 +1,20 @@ +# CoboWaas2.StakingPoolId + +## Enum + + +* `babylon_btc_signet` (value: `"babylon_btc_signet"`) + +* `babylon_btc` (value: `"babylon_btc"`) + +* `beacon_eth` (value: `"beacon_eth"`) + +* `beacon_eth_holesky` (value: `"beacon_eth_holesky"`) + +* `core_btc` (value: `"core_btc"`) + +* `core_xtn` (value: `"core_xtn"`) + +* `unknown_default_open_api` (value: `"unknown_default_open_api"`) + + diff --git a/docs/StakingPoolType.md b/docs/StakingPoolType.md index 2e43a02c..42d4968a 100644 --- a/docs/StakingPoolType.md +++ b/docs/StakingPoolType.md @@ -7,6 +7,8 @@ * `ETHBeacon` (value: `"ETHBeacon"`) +* `CoreBTC` (value: `"CoreBTC"`) + * `unknown_default_open_api` (value: `"unknown_default_open_api"`) diff --git a/docs/Stakings.md b/docs/Stakings.md index fc01643c..00585437 100644 --- a/docs/Stakings.md +++ b/docs/Stakings.md @@ -8,12 +8,12 @@ Name | Type | Description | Notes **wallet_id** | **String** | The staker's wallet ID. | **address** | **String** | The staker's wallet address. | **amounts** | [**[AmountDetailsInner]**](AmountDetailsInner.md) | The details about the staking amount. | -**pool_id** | **String** | The ID of the staking pool. | +**pool_id** | [**StakingPoolId**](StakingPoolId.md) | | **token_id** | **String** | The token ID. | **rewards_info** | **Object** | The information about the staking rewards. | [optional] **created_timestamp** | **Number** | The time when the staking position was created. | **updated_timestamp** | **Number** | The time when the staking position was last updated. | -**validator_info** | [**StakingsValidatorInfo**](StakingsValidatorInfo.md) | | +**validator_info** | [**BabylonValidator**](BabylonValidator.md) | | **extra** | [**StakingsExtra**](StakingsExtra.md) | | [optional] diff --git a/docs/StakingsApi.md b/docs/StakingsApi.md index 6cb46de7..f22938f8 100644 --- a/docs/StakingsApi.md +++ b/docs/StakingsApi.md @@ -4,12 +4,14 @@ All URIs are relative to *https://api.dev.cobo.com/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**createClaimActivity**](StakingsApi.md#createClaimActivity) | **POST** /stakings/activities/claim | Create claim activity [**createStakeActivity**](StakingsApi.md#createStakeActivity) | **POST** /stakings/activities/stake | Create stake activity [**createUnstakeActivity**](StakingsApi.md#createUnstakeActivity) | **POST** /stakings/activities/unstake | Create unstake activity [**createWithdrawActivity**](StakingsApi.md#createWithdrawActivity) | **POST** /stakings/activities/withdraw | Create withdraw activity [**getStakingActivityById**](StakingsApi.md#getStakingActivityById) | **GET** /stakings/activities/{activity_id} | Get staking activity details [**getStakingById**](StakingsApi.md#getStakingById) | **GET** /stakings/{staking_id} | Get staking position details [**getStakingEstimationFee**](StakingsApi.md#getStakingEstimationFee) | **POST** /stakings/estimate_fee | Estimate staking fees +[**getStakingEstimationFeeV2**](StakingsApi.md#getStakingEstimationFeeV2) | **POST** /stakings/estimate_fee_v2 | Estimate staking fees [**getStakingPoolById**](StakingsApi.md#getStakingPoolById) | **GET** /stakings/pools/{pool_id} | Get staking pool details [**listStakingActivities**](StakingsApi.md#listStakingActivities) | **GET** /stakings/activities | List staking activities [**listStakingPools**](StakingsApi.md#listStakingPools) | **GET** /stakings/pools | List staking pools @@ -17,6 +19,58 @@ Method | HTTP request | Description +## createClaimActivity + +> CreateStakeActivity201Response createClaimActivity(opts) + +Create claim activity + +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. + +### Example + +```javascript +const CoboWaas2 = require('@cobo/cobo-waas2'); +// Initialize the API client +const apiClient = CoboWaas2.ApiClient.instance +// Select the development environment. To use the production environment, replace `Env.DEV` with `Env.PROD` +apiClient.setEnv(CoboWaas2.Env.DEV); +// Replace `` with your private key +apiClient.setPrivateKey(""); +// Call the API +const apiInstance = new CoboWaas2.StakingsApi(); +const opts = { + 'CreateClaimActivityRequest': new CoboWaas2.CreateClaimActivityRequest() +}; +apiInstance.createClaimActivity(opts).then((data) => { + console.log('API called successfully. Returned data: ' + data); +}, (error) => { + console.error(error); +}); + +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **CreateClaimActivityRequest** | [**CreateClaimActivityRequest**](CreateClaimActivityRequest.md)| The request body to create a staking request. | [optional] + +### Return type + +[**CreateStakeActivity201Response**](CreateStakeActivity201Response.md) + +### Authorization + +[CoboAuth](../README.md#CoboAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + ## createStakeActivity > CreateStakeActivity201Response createStakeActivity(opts) @@ -257,7 +311,7 @@ apiInstance.getStakingById(staking_id).then((data) => { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **staking_id** | **String**| The ID of the staking position. You can retrieve a list of staking positions by calling [List staking positions](/v2/api-references/stakings/list-all-stakings). | + **staking_id** | **String**| 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). | ### Return type @@ -279,7 +333,7 @@ Name | Type | Description | Notes Estimate staking fees -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> +<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> ### Example @@ -325,6 +379,58 @@ Name | Type | Description | Notes - **Accept**: application/json +## getStakingEstimationFeeV2 + +> EthStakeEstimatedFee getStakingEstimationFeeV2(opts) + +Estimate staking fees + +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> + +### Example + +```javascript +const CoboWaas2 = require('@cobo/cobo-waas2'); +// Initialize the API client +const apiClient = CoboWaas2.ApiClient.instance +// Select the development environment. To use the production environment, replace `Env.DEV` with `Env.PROD` +apiClient.setEnv(CoboWaas2.Env.DEV); +// Replace `` with your private key +apiClient.setPrivateKey(""); +// Call the API +const apiInstance = new CoboWaas2.StakingsApi(); +const opts = { + 'GetStakingEstimationFeeRequest': new CoboWaas2.GetStakingEstimationFeeRequest() +}; +apiInstance.getStakingEstimationFeeV2(opts).then((data) => { + console.log('API called successfully. Returned data: ' + data); +}, (error) => { + console.error(error); +}); + +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **GetStakingEstimationFeeRequest** | [**GetStakingEstimationFeeRequest**](GetStakingEstimationFeeRequest.md)| The request body to get the estimated fee of a staking activity. | [optional] + +### Return type + +[**EthStakeEstimatedFee**](EthStakeEstimatedFee.md) + +### Authorization + +[CoboAuth](../README.md#CoboAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + ## getStakingPoolById > PoolDetails getStakingPoolById(pool_id) diff --git a/docs/StakingsExtra.md b/docs/StakingsExtra.md index 4bebddf4..9e483aa2 100644 --- a/docs/StakingsExtra.md +++ b/docs/StakingsExtra.md @@ -10,5 +10,10 @@ Name | Type | Description | Notes **unlock_block_height** | **Number** | The block height at which the bitcoins will be unlocked. | [optional] **stake_address** | **String** | The address receiving the staked bitcoins. | [optional] **unbond_address** | **String** | The address receiving the unlocked bitcoins. | [optional] +**beacon_validators** | [**[EthStakingExtraAllOfBeaconValidators]**](EthStakingExtraAllOfBeaconValidators.md) | The list of validator information. | [optional] +**staker_address** | **String** | The staker's Bitcoin address. | +**validator_address** | **String** | The validator's EVM address. | +**reward_address** | **String** | The EVM address to receive staking rewards. | +**timelock** | **Number** | The Unix timestamp (in seconds) when the staking position will be unlocked and available for withdrawal. | diff --git a/docs/StakingsValidatorInfo.md b/docs/StakingsValidatorInfo.md deleted file mode 100644 index 41e8d995..00000000 --- a/docs/StakingsValidatorInfo.md +++ /dev/null @@ -1,13 +0,0 @@ -# CoboWaas2.StakingsValidatorInfo - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**icon_url** | **String** | The URL of the validator's icon. | [optional] -**public_key** | **String** | The validator's public key. | [optional] -**name** | **String** | The validator's name. | [optional] -**address** | **String** | The wallet address of the validator. | [optional] -**commission_rate** | **String** | The commission rate of the validator. | [optional] - - diff --git a/docs/TransactionRbf.md b/docs/TransactionRbf.md index a8bfdd86..e2a97f27 100644 --- a/docs/TransactionRbf.md +++ b/docs/TransactionRbf.md @@ -9,5 +9,6 @@ Name | Type | Description | Notes **source** | [**TransactionRbfSource**](TransactionRbfSource.md) | | [optional] **category_names** | **[String]** | The custom category for you to identify your transactions. | [optional] **description** | **String** | The description of the RBF transaction. | [optional] +**auto_fuel** | [**AutoFuelType**](AutoFuelType.md) | | [optional] diff --git a/docs/TransactionRbfSource.md b/docs/TransactionRbfSource.md index 71130f80..10fc9c4d 100644 --- a/docs/TransactionRbfSource.md +++ b/docs/TransactionRbfSource.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **source_type** | [**WalletSubtype**](WalletSubtype.md) | | **wallet_id** | **String** | The wallet ID. | -**address** | **String** | The wallet address. If you want to specify the UTXOs to be used, please provide the `included_utxos` property. If you specify both the `address` and `included_utxos` properties, the specified included UTXOs must belong to the address. You need to provide either the `address` or `included_utxos` property. If neither property is provided, the transfer will fail. | [optional] +**address** | **String** | The wallet address. If you want to specify the UTXOs to be used, please provide the `included_utxos` property. If you specify both the `address` and `included_utxos` properties, the specified included UTXOs must belong to the address. It is recommended to specify no more than 100 included UTXOs to ensure optimal transaction processing. You need to provide either the `address` or `included_utxos` property. If neither property is provided, the transfer will fail. | [optional] **included_utxos** | [**[TransactionUtxo]**](TransactionUtxo.md) | | [optional] **excluded_utxos** | [**[TransactionUtxo]**](TransactionUtxo.md) | | [optional] diff --git a/docs/TransactionsApi.md b/docs/TransactionsApi.md index a21d3c1e..b43482d6 100644 --- a/docs/TransactionsApi.md +++ b/docs/TransactionsApi.md @@ -285,7 +285,7 @@ Name | Type | Description | Notes Transfer token -The operation transfers your assets from a wallet created on Cobo Protal 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> +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> ### Example @@ -391,7 +391,7 @@ Name | Type | Description | Notes Estimate transaction fee -This operation estimates the transaction fee rates of a token transfer or a contract call based on three different transaction speeds (slow, recommended, and fast), 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, and token ID of the transaction fee. The response can contain different properties based on the transaction fee model used by the chain, including EIP-1559 fee model, legacy fee model, UTXO fee model, and fixed fee model. +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). ### Example diff --git a/docs/TransferParams.md b/docs/TransferParams.md index a56b4e43..4014f321 100644 --- a/docs/TransferParams.md +++ b/docs/TransferParams.md @@ -11,5 +11,6 @@ Name | Type | Description | Notes **category_names** | **[String]** | The custom category for you to identify your transactions. | [optional] **description** | **String** | The description of the transfer. | [optional] **fee** | [**TransactionRequestFee**](TransactionRequestFee.md) | | [optional] +**auto_fuel** | [**AutoFuelType**](AutoFuelType.md) | | [optional] diff --git a/package.json b/package.json index 80ed538c..c7881f47 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@cobo/cobo-waas2", - "version": "1.6.0", + "version": "1.7.0", "description": "The Cobo Wallet-as-a-Service (WaaS) 2.0 API is the latest version of Cobo’s WaaS API offering. It enables you to access Cobo’s full suite of crypto wallet technologies with powerful and flexible access controls. By encapsulating complex security protocols and streamlining blockchain interactions, this API allows you to concentrate on your core business activities without worrying about the safety of your assets. The WaaS 2.0 API presents the following key features: - A unified API for Cobo’s [all four wallet types](https://manuals.cobo.com/en/portal/introduction#an-all-in-one-wallet-platform) - Support for 80+ chains and 3000+ tokens - A comprehensive selection of webhook events - Flexible usage models for MPC Wallets, including [Organization-Controlled Wallets](https://manuals.cobo.com/en/portal/mpc-wallets/ocw/introduction) and [User-Controlled Wallets](https://manuals.cobo.com/en/portal/mpc-wallets/ucw/introduction) - Programmatic control of smart contract wallets such as Safe{Wallet} with fine-grained access controls - Seamlessly transfer funds across multiple exchanges, including Binance, OKX, Bybit, Deribit, and more For more information about the WaaS 2.0 API, see [Introduction to WaaS 2.0](/v2/guides/overview/introduction). ", "license": "GPL 2.0", "main": "dist/index.js", @@ -17,7 +17,8 @@ "crypto-js": "^4.2.0", "express": "^4.21.1", "superagent": "^5.3.0", - "tweetnacl": "^1.0.3" + "tweetnacl": "^1.0.3", + "elliptic": "^6.6.1" }, "devDependencies": { "@babel/core": "^7.0.0", diff --git a/src/ApiClient.js b/src/ApiClient.js index 19612cc9..0375aa60 100644 --- a/src/ApiClient.js +++ b/src/ApiClient.js @@ -12,8 +12,10 @@ import superagent from "superagent"; import querystring from "querystring"; -import ApiSigner from "./crypto/ApiSigner"; import Env from "./Env"; +import Ed25519Signer from "./crypto/Ed25519Signer"; +import Secp256k1Signer from "./crypto/Secp256k1Signer"; +import * as CryptoJS from "crypto-js"; /** * @module ApiClient @@ -33,14 +35,23 @@ class ApiClient { * @param {Env} env * @param {String} privateKey */ - constructor(env = Env.PROD, privateKey = "" ) { + constructor(env = Env.PROD, privateKey = "", curve_type = "" , signer ) { /** * The base URL against which to resolve every API call's (relative) path. * @type {String} * @default https://api.dev.cobo.com/v2 */ this.basePath = env.basePath - this.privateKey = privateKey + if (privateKey) { + curve_type = curve_type || "ED25519" + if (curve_type === "ED25519") { + this.signer = new Ed25519Signer(privateKey) + } else if(curve_type === "SECP256k1") { + this.signer = new Secp256k1Signer(privateKey) + } + } else if(signer) { + this.signer = signer + } /** * The authentication methods to be included for all API calls. @@ -57,7 +68,7 @@ class ApiClient { * @default {} */ this.defaultHeaders = { - 'User-Agent': 'cobo-waas2-js-sdk/1.6.0' + 'User-Agent': 'cobo-waas2-js-sdk/1.7.0' }; /** @@ -102,12 +113,35 @@ class ApiClient { } + /*** + * + * @param env + */ setEnv(env) { this.basePath = env.basePath } - setPrivateKey(privateKey) { - this.privateKey = privateKey + /*** + * + * @param privateKey + */ + setPrivateKey(privateKey, curveType="ED25519") { + if (curveType === "ED25519") { + this.signer = new Ed25519Signer(privateKey); + } else if(curveType === "SECP256K1") { + this.signer = new Secp256k1Signer(privateKey); + } else { + throw new Error('Invalid curve type'+ curveType); + } + } + + + /*** + * + * @param signer + */ + setSigner(signer) { + this.signer = signer } /** @@ -423,8 +457,17 @@ class ApiClient { .filter((k) => queryParams[k] !== undefined && queryParams[k] !== '') .map((k) => { return k + '=' + encodeURIComponent(queryParams[k]).replace(/%20/g, "+");}).join('&') - var signer = new ApiSigner(this.privateKey) - request.set(signer.generateHeaders(new URL(url).pathname, httpMethod, bodyParam, queryStr)) + + const nonce = String(new Date().getTime()); + const strToSign = [httpMethod, new URL(url).pathname, nonce, queryStr, bodyParam?JSON.stringify(bodyParam):''].join('|'); + console.log("strToSign:", strToSign) + const hash2String = CryptoJS.SHA256(CryptoJS.SHA256(strToSign)).toString(CryptoJS.enc.Hex); + const headers = { + 'BIZ-API-KEY': this.signer.getPublicKey(), + "BIZ-API-NONCE": nonce, + "BIZ-API-SIGNATURE": this.signer.sign(hash2String) + } + request.set(headers) if (this.plugins !== null) { for (var index in this.plugins) { diff --git a/src/api/DevelopersWebhooksApi.js b/src/api/DevelopersWebhooksApi.js index 6330748d..03fda0a0 100644 --- a/src/api/DevelopersWebhooksApi.js +++ b/src/api/DevelopersWebhooksApi.js @@ -509,7 +509,7 @@ export default class DevelopersWebhooksApi { /** * Trigger test event - * This operation tests the functionality of your webhook endpoint by triggering a test webhook event. You only need to provide the event type. By default, the payload contains dummy data with no impact on your real business transactions or activities. You can optionally provide the `override_data` property to customize the payload. + * This operation tests the functionality of your webhook endpoint by triggering a test webhook event. The test event will be sent to all the endpoints you have registered on Cobo Portal. You only need to provide the event type. By default, the payload contains dummy data with no impact on your real business transactions or activities. You can optionally provide the `override_data` property to customize the payload. * @param {Object} opts Optional parameters * @param {module:model/TriggerTestWebhookEventRequest} [TriggerTestWebhookEventRequest] The request body used to trigger a test webhook event. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/TriggerTestWebhookEvent201Response} and HTTP response @@ -543,7 +543,7 @@ export default class DevelopersWebhooksApi { /** * Trigger test event - * This operation tests the functionality of your webhook endpoint by triggering a test webhook event. You only need to provide the event type. By default, the payload contains dummy data with no impact on your real business transactions or activities. You can optionally provide the `override_data` property to customize the payload. + * This operation tests the functionality of your webhook endpoint by triggering a test webhook event. The test event will be sent to all the endpoints you have registered on Cobo Portal. You only need to provide the event type. By default, the payload contains dummy data with no impact on your real business transactions or activities. You can optionally provide the `override_data` property to customize the payload. * @param {Object} opts Optional parameters * @param {module:model/TriggerTestWebhookEventRequest} opts.TriggerTestWebhookEventRequest The request body used to trigger a test webhook event. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/TriggerTestWebhookEvent201Response} diff --git a/src/api/StakingsApi.js b/src/api/StakingsApi.js index 3bf48191..9683b1cd 100644 --- a/src/api/StakingsApi.js +++ b/src/api/StakingsApi.js @@ -14,11 +14,13 @@ import ApiClient from "../ApiClient"; import Activity from '../model/Activity'; import ActivityStatus from '../model/ActivityStatus'; import ActivityType from '../model/ActivityType'; +import CreateClaimActivityRequest from '../model/CreateClaimActivityRequest'; import CreateStakeActivity201Response from '../model/CreateStakeActivity201Response'; import CreateStakeActivityRequest from '../model/CreateStakeActivityRequest'; import CreateUnstakeActivityRequest from '../model/CreateUnstakeActivityRequest'; import CreateWithdrawActivityRequest from '../model/CreateWithdrawActivityRequest'; import ErrorResponse from '../model/ErrorResponse'; +import EthStakeEstimatedFee from '../model/EthStakeEstimatedFee'; import GetStakingEstimationFee201Response from '../model/GetStakingEstimationFee201Response'; import GetStakingEstimationFeeRequest from '../model/GetStakingEstimationFeeRequest'; import ListStakingActivities200Response from '../model/ListStakingActivities200Response'; @@ -46,6 +48,55 @@ export default class StakingsApi { + /** + * Create claim activity + * This operation creates a claim request. Currently, only the Ethereum Beacon protocol supports this operation. 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. + * @param {Object} opts Optional parameters + * @param {module:model/CreateClaimActivityRequest} [CreateClaimActivityRequest] The request body to create a staking request. + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/CreateStakeActivity201Response} and HTTP response + */ + createClaimActivityWithHttpInfo(opts) { + opts = opts || {}; + let postBody = opts['CreateClaimActivityRequest']; + if (postBody && postBody.toJSON) { + postBody = postBody.toJSON() + } + + let pathParams = { + }; + let queryParams = { + }; + let headerParams = { + }; + let formParams = { + }; + + let authNames = ['CoboAuth']; + let contentTypes = ['application/json']; + let accepts = ['application/json']; + let returnType = CreateStakeActivity201Response; + return this.apiClient.callApi( + '/stakings/activities/claim', 'POST', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType, null + ); + } + + /** + * Create claim activity + * This operation creates a claim request. Currently, only the Ethereum Beacon protocol supports this operation. 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. + * @param {Object} opts Optional parameters + * @param {module:model/CreateClaimActivityRequest} opts.CreateClaimActivityRequest The request body to create a staking request. + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/CreateStakeActivity201Response} + */ + createClaimActivity(opts) { + return this.createClaimActivityWithHttpInfo(opts) + .then(function(response_and_data) { + return response_and_data.data; + }); + } + + /** * Create stake activity * 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. For the Babylon protocol, you can only select UTXO as the fee model. @@ -247,7 +298,7 @@ export default class StakingsApi { /** * Get staking position details * This operation retrieves the detailed information about a specified staking position. - * @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-all-stakings). + * @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). * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Stakings} and HTTP response */ getStakingByIdWithHttpInfo(staking_id) { @@ -284,7 +335,7 @@ export default class StakingsApi { /** * Get staking position details * This operation retrieves the detailed information about a specified staking position. - * @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-all-stakings). + * @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). * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Stakings} */ getStakingById(staking_id) { @@ -297,7 +348,7 @@ export default class StakingsApi { /** * Estimate staking fees - * 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. For the Babylon protocol, you can only select UTXO as the fee model. + * This operation is deprecated. Please use the [updated version](/v2/api-references/stakings/estimate-staking-fees-1) instead. 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. For the Babylon protocol, you can only select UTXO as the fee model. * @param {Object} opts Optional parameters * @param {module:model/GetStakingEstimationFeeRequest} [GetStakingEstimationFeeRequest] The request body to get the estimated fee of a staking activity. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetStakingEstimationFee201Response} and HTTP response @@ -331,7 +382,7 @@ export default class StakingsApi { /** * Estimate staking fees - * 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. For the Babylon protocol, you can only select UTXO as the fee model. + * This operation is deprecated. Please use the [updated version](/v2/api-references/stakings/estimate-staking-fees-1) instead. 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. For the Babylon protocol, you can only select UTXO as the fee model. * @param {Object} opts Optional parameters * @param {module:model/GetStakingEstimationFeeRequest} opts.GetStakingEstimationFeeRequest The request body to get the estimated fee of a staking activity. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetStakingEstimationFee201Response} @@ -344,6 +395,55 @@ export default class StakingsApi { } + /** + * Estimate staking fees + * This operation calculates the fee required for a staking activity based on factors such as network congestion and transaction complexity. For the Babylon protocol, you can only select UTXO as the fee model. + * @param {Object} opts Optional parameters + * @param {module:model/GetStakingEstimationFeeRequest} [GetStakingEstimationFeeRequest] The request body to get the estimated fee of a staking activity. + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/EthStakeEstimatedFee} and HTTP response + */ + getStakingEstimationFeeV2WithHttpInfo(opts) { + opts = opts || {}; + let postBody = opts['GetStakingEstimationFeeRequest']; + if (postBody && postBody.toJSON) { + postBody = postBody.toJSON() + } + + let pathParams = { + }; + let queryParams = { + }; + let headerParams = { + }; + let formParams = { + }; + + let authNames = ['CoboAuth']; + let contentTypes = ['application/json']; + let accepts = ['application/json']; + let returnType = EthStakeEstimatedFee; + return this.apiClient.callApi( + '/stakings/estimate_fee_v2', 'POST', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType, null + ); + } + + /** + * Estimate staking fees + * This operation calculates the fee required for a staking activity based on factors such as network congestion and transaction complexity. For the Babylon protocol, you can only select UTXO as the fee model. + * @param {Object} opts Optional parameters + * @param {module:model/GetStakingEstimationFeeRequest} opts.GetStakingEstimationFeeRequest The request body to get the estimated fee of a staking activity. + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/EthStakeEstimatedFee} + */ + getStakingEstimationFeeV2(opts) { + return this.getStakingEstimationFeeV2WithHttpInfo(opts) + .then(function(response_and_data) { + return response_and_data.data; + }); + } + + /** * Get staking pool details * This operation retrieves the detailed information about a specified staking pool. diff --git a/src/api/TransactionsApi.js b/src/api/TransactionsApi.js index 41f8167a..81e91792 100644 --- a/src/api/TransactionsApi.js +++ b/src/api/TransactionsApi.js @@ -310,7 +310,7 @@ export default class TransactionsApi { /** * Transfer token - * The operation transfers your assets from a wallet created on Cobo Protal 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. If you make transfers from Custodial Wallets, do not set the fee-related properties. Otherwise, the transaction will fail. You can transfer tokens to multiple addresses only if you use MPC Wallets as the transaction source. You should use the utxo_outputs property to specify the destination addresses. 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 0. + * 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. If you make transfers from Custodial Wallets, do not set the fee-related properties. Otherwise, the transaction will fail. You can transfer tokens to multiple addresses only if you use MPC Wallets as the transaction source. You should use the utxo_outputs property to specify the destination addresses. 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 0. * @param {Object} opts Optional parameters * @param {module:model/TransferParams} [TransferParams] The request body to create a transfer transaction * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/CreateTransferTransaction201Response} and HTTP response @@ -344,7 +344,7 @@ export default class TransactionsApi { /** * Transfer token - * The operation transfers your assets from a wallet created on Cobo Protal 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. If you make transfers from Custodial Wallets, do not set the fee-related properties. Otherwise, the transaction will fail. You can transfer tokens to multiple addresses only if you use MPC Wallets as the transaction source. You should use the utxo_outputs property to specify the destination addresses. 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 0. + * 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. If you make transfers from Custodial Wallets, do not set the fee-related properties. Otherwise, the transaction will fail. You can transfer tokens to multiple addresses only if you use MPC Wallets as the transaction source. You should use the utxo_outputs property to specify the destination addresses. 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 0. * @param {Object} opts Optional parameters * @param {module:model/TransferParams} opts.TransferParams The request body to create a transfer transaction * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/CreateTransferTransaction201Response} @@ -415,7 +415,7 @@ export default class TransactionsApi { /** * Estimate transaction fee - * This operation estimates the transaction fee rates of a token transfer or a contract call based on three different transaction speeds (slow, recommended, and fast), 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, and token ID of the transaction fee. The response can contain different properties based on the transaction fee model used by the chain, including EIP-1559 fee model, legacy fee model, UTXO fee model, and fixed fee model. + * 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). * @param {Object} opts Optional parameters * @param {module:model/EstimateFeeParams} [EstimateFeeParams] The request body to estimate the transaction fee of a token transfer or a contract call. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/EstimatedFee} and HTTP response @@ -449,7 +449,7 @@ export default class TransactionsApi { /** * Estimate transaction fee - * This operation estimates the transaction fee rates of a token transfer or a contract call based on three different transaction speeds (slow, recommended, and fast), 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, and token ID of the transaction fee. The response can contain different properties based on the transaction fee model used by the chain, including EIP-1559 fee model, legacy fee model, UTXO fee model, and fixed fee model. + * 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). * @param {Object} opts Optional parameters * @param {module:model/EstimateFeeParams} opts.EstimateFeeParams The request body to estimate the transaction fee of a token transfer or a contract call. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/EstimatedFee} diff --git a/src/crypto/Ed25519Signer.js b/src/crypto/Ed25519Signer.js new file mode 100644 index 00000000..93794158 --- /dev/null +++ b/src/crypto/Ed25519Signer.js @@ -0,0 +1,21 @@ +import {sign as ed25519} from 'tweetnacl' + +export default class Ed25519Signer { + constructor(privateKey) { + this.privateKey= privateKey + } + + sign(message_hash) { + const pk = this.getPublicKey(this.privateKey) + const skBytes = new Uint8Array(Buffer.from(this.privateKey + pk, 'hex')); + const messageBytes = new Uint8Array(Buffer.from(message_hash, 'hex')); + const signature = ed25519.detached(messageBytes, skBytes); + return Buffer.from(signature).toString('hex'); + } + + getPublicKey() { + const skBytes = new Uint8Array(Buffer.from(this.privateKey, 'hex')); + const pk = ed25519.keyPair.fromSeed(skBytes).publicKey; + return Buffer.from(pk).toString('hex'); + } +} diff --git a/src/crypto/Secp256k1Signer.js b/src/crypto/Secp256k1Signer.js new file mode 100644 index 00000000..6d1de469 --- /dev/null +++ b/src/crypto/Secp256k1Signer.js @@ -0,0 +1,20 @@ +import { ec as EC } from 'elliptic'; + +const ec = new EC('secp256k1'); + +export default class Secp256k1Signer { + constructor(privateKey) { + this.privateKey = privateKey; + this.keyPair = ec.keyFromPrivate(privateKey, 'hex'); + } + + sign(message) { + const messageHash = Buffer.from(message, 'hex'); + const signature = this.keyPair.sign(messageHash, { canonical: true }); + return Buffer.from(signature.toDER()).toString('hex'); + } + + getPublicKey() { + return this.keyPair.getPublic(true, 'hex'); + } +} diff --git a/src/index.js b/src/index.js index b2fc8edd..b3de01ab 100644 --- a/src/index.js +++ b/src/index.js @@ -10,6 +10,8 @@ */ import Env from "./Env"; +import Ed25519Signer from "./crypto/Ed25519Signer"; +import Secp256k1Signer from "./crypto/Secp256k1Signer"; import ApiClient from './ApiClient'; import Activity from './model/Activity'; import ActivityAction from './model/ActivityAction'; @@ -29,6 +31,7 @@ import ApiLogDetails from './model/ApiLogDetails'; import ApiLogSummary from './model/ApiLogSummary'; import AssetBalance from './model/AssetBalance'; import AssetInfo from './model/AssetInfo'; +import AutoFuelType from './model/AutoFuelType'; import BabylonStakeEstimatedFee from './model/BabylonStakeEstimatedFee'; import BabylonStakeExtra from './model/BabylonStakeExtra'; import BabylonStakingExtra from './model/BabylonStakingExtra'; @@ -51,7 +54,11 @@ import ContractCallDestinationType from './model/ContractCallDestinationType'; import ContractCallParams from './model/ContractCallParams'; import ContractCallSource from './model/ContractCallSource'; import ContractCallSourceType from './model/ContractCallSourceType'; +import CoreStakeExtra from './model/CoreStakeExtra'; +import CoreStakingExtra from './model/CoreStakingExtra'; import CreateAddressRequest from './model/CreateAddressRequest'; +import CreateClaimActivity from './model/CreateClaimActivity'; +import CreateClaimActivityRequest from './model/CreateClaimActivityRequest'; import CreateCustodialWalletParams from './model/CreateCustodialWalletParams'; import CreateExchangeWalletParams from './model/CreateExchangeWalletParams'; import CreateKeyShareHolder from './model/CreateKeyShareHolder'; @@ -84,6 +91,7 @@ import EigenLayerLstStakeExtra from './model/EigenLayerLstStakeExtra'; import EigenLayerNativeStakeExtra from './model/EigenLayerNativeStakeExtra'; import EigenlayerValidator from './model/EigenlayerValidator'; import ErrorResponse from './model/ErrorResponse'; +import EstimateClaimFee from './model/EstimateClaimFee'; import EstimateContractCallFeeParams from './model/EstimateContractCallFeeParams'; import EstimateFeeParams from './model/EstimateFeeParams'; import EstimateFeeRequestType from './model/EstimateFeeRequestType'; @@ -102,6 +110,7 @@ import EstimatedUtxoFeeSlow from './model/EstimatedUtxoFeeSlow'; import EthStakeEstimatedFee from './model/EthStakeEstimatedFee'; import EthStakeExtra from './model/EthStakeExtra'; import EthStakingExtra from './model/EthStakingExtra'; +import EthStakingExtraAllOfBeaconValidators from './model/EthStakingExtraAllOfBeaconValidators'; import EthUnstakeExtra from './model/EthUnstakeExtra'; import EvmContractCallDestination from './model/EvmContractCallDestination'; import EvmEIP191MessageSignDestination from './model/EvmEIP191MessageSignDestination'; @@ -197,11 +206,11 @@ import SmartContractWalletOperationType from './model/SmartContractWalletOperati import SmartContractWalletType from './model/SmartContractWalletType'; import SourceGroup from './model/SourceGroup'; import StakeSourceType from './model/StakeSourceType'; +import StakingPoolId from './model/StakingPoolId'; import StakingPoolType from './model/StakingPoolType'; import StakingSource from './model/StakingSource'; import Stakings from './model/Stakings'; import StakingsExtra from './model/StakingsExtra'; -import StakingsValidatorInfo from './model/StakingsValidatorInfo'; import SubWalletAssetBalance from './model/SubWalletAssetBalance'; import TSSGroups from './model/TSSGroups'; import TSSRequest from './model/TSSRequest'; @@ -341,10 +350,12 @@ import WalletsSmartContractWalletsApi from './api/WalletsSmartContractWalletsApi * *

* @module index -* @version 1.6.0 +* @version 1.7.0 */ export { Env, + Ed25519Signer, + Secp256k1Signer, /** * The ApiClient constructor. * @property {module:ApiClient} @@ -459,6 +470,12 @@ export { */ AssetInfo, + /** + * The AutoFuelType model constructor. + * @property {module:model/AutoFuelType} + */ + AutoFuelType, + /** * The BabylonStakeEstimatedFee model constructor. * @property {module:model/BabylonStakeEstimatedFee} @@ -591,12 +608,36 @@ export { */ ContractCallSourceType, + /** + * The CoreStakeExtra model constructor. + * @property {module:model/CoreStakeExtra} + */ + CoreStakeExtra, + + /** + * The CoreStakingExtra model constructor. + * @property {module:model/CoreStakingExtra} + */ + CoreStakingExtra, + /** * The CreateAddressRequest model constructor. * @property {module:model/CreateAddressRequest} */ CreateAddressRequest, + /** + * The CreateClaimActivity model constructor. + * @property {module:model/CreateClaimActivity} + */ + CreateClaimActivity, + + /** + * The CreateClaimActivityRequest model constructor. + * @property {module:model/CreateClaimActivityRequest} + */ + CreateClaimActivityRequest, + /** * The CreateCustodialWalletParams model constructor. * @property {module:model/CreateCustodialWalletParams} @@ -789,6 +830,12 @@ export { */ ErrorResponse, + /** + * The EstimateClaimFee model constructor. + * @property {module:model/EstimateClaimFee} + */ + EstimateClaimFee, + /** * The EstimateContractCallFeeParams model constructor. * @property {module:model/EstimateContractCallFeeParams} @@ -897,6 +944,12 @@ export { */ EthStakingExtra, + /** + * The EthStakingExtraAllOfBeaconValidators model constructor. + * @property {module:model/EthStakingExtraAllOfBeaconValidators} + */ + EthStakingExtraAllOfBeaconValidators, + /** * The EthUnstakeExtra model constructor. * @property {module:model/EthUnstakeExtra} @@ -1467,6 +1520,12 @@ export { */ StakeSourceType, + /** + * The StakingPoolId model constructor. + * @property {module:model/StakingPoolId} + */ + StakingPoolId, + /** * The StakingPoolType model constructor. * @property {module:model/StakingPoolType} @@ -1491,12 +1550,6 @@ export { */ StakingsExtra, - /** - * The StakingsValidatorInfo model constructor. - * @property {module:model/StakingsValidatorInfo} - */ - StakingsValidatorInfo, - /** * The SubWalletAssetBalance model constructor. * @property {module:model/SubWalletAssetBalance} diff --git a/src/model/Activity.js b/src/model/Activity.js index b3a08a12..7b912c06 100644 --- a/src/model/Activity.js +++ b/src/model/Activity.js @@ -13,6 +13,7 @@ import ApiClient from '../ApiClient'; import ActivityStatus from './ActivityStatus'; import ActivityTimeline from './ActivityTimeline'; import ActivityType from './ActivityType'; +import StakingPoolId from './StakingPoolId'; import TransactionInitiatorType from './TransactionInitiatorType'; import TransactionRequestFee from './TransactionRequestFee'; @@ -25,7 +26,7 @@ class Activity { * Constructs a new Activity. * The staking activity. * @alias module:model/Activity - * @param pool_id {String} The ID of the staking pool. + * @param pool_id {module:model/StakingPoolId} * @param token_id {String} The token ID. * @param amount {String} The staking amount. * @param status {module:model/ActivityStatus} @@ -77,7 +78,7 @@ class Activity { obj['address'] = ApiClient.convertToType(data['address'], 'String'); } if (data.hasOwnProperty('pool_id')) { - obj['pool_id'] = ApiClient.convertToType(data['pool_id'], 'String'); + obj['pool_id'] = StakingPoolId.constructFromObject(data['pool_id']); } if (data.hasOwnProperty('token_id')) { obj['token_id'] = ApiClient.convertToType(data['token_id'], 'String'); @@ -139,10 +140,6 @@ class Activity { throw new Error("Expected the field `address` to be a primitive type in the JSON string but got " + data['address']); } // ensure the json data is a string - if (data['pool_id'] && !(typeof data['pool_id'] === 'string' || data['pool_id'] instanceof String)) { - throw new Error("Expected the field `pool_id` to be a primitive type in the JSON string but got " + data['pool_id']); - } - // ensure the json data is a string if (data['token_id'] && !(typeof data['token_id'] === 'string' || data['token_id'] instanceof String)) { throw new Error("Expected the field `token_id` to be a primitive type in the JSON string but got " + data['token_id']); } @@ -218,8 +215,7 @@ Activity.prototype['wallet_id'] = undefined; Activity.prototype['address'] = undefined; /** - * The ID of the staking pool. - * @member {String} pool_id + * @member {module:model/StakingPoolId} pool_id */ Activity.prototype['pool_id'] = undefined; diff --git a/src/model/ActivityAction.js b/src/model/ActivityAction.js index be3f25d4..dd1e5a9d 100644 --- a/src/model/ActivityAction.js +++ b/src/model/ActivityAction.js @@ -38,6 +38,34 @@ export default class ActivityAction { "BabylonConfirmation" = "BabylonConfirmation"; + /** + * value: "DepositETH" + * @const + */ + "DepositETH" = "DepositETH"; + + + /** + * value: "ClaimRewards" + * @const + */ + "ClaimRewards" = "ClaimRewards"; + + + /** + * value: "ActivateValidator" + * @const + */ + "ActivateValidator" = "ActivateValidator"; + + + /** + * value: "UnstakeETH" + * @const + */ + "UnstakeETH" = "UnstakeETH"; + + /** * value: "unknown_default_open_api" * @const diff --git a/src/model/ActivityType.js b/src/model/ActivityType.js index 5aa831d4..179fbf20 100644 --- a/src/model/ActivityType.js +++ b/src/model/ActivityType.js @@ -38,6 +38,13 @@ export default class ActivityType { "Withdraw" = "Withdraw"; + /** + * value: "Claim" + * @const + */ + "Claim" = "Claim"; + + /** * value: "unknown_default_open_api" * @const diff --git a/src/model/AutoFuelType.js b/src/model/AutoFuelType.js new file mode 100644 index 00000000..d98b9f04 --- /dev/null +++ b/src/model/AutoFuelType.js @@ -0,0 +1,51 @@ +/** + * Cobo Wallet as a Service 2.0 + * + * Contact: help@cobo.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +import ApiClient from '../ApiClient'; +/** +* Enum class AutoFuelType. +* @enum {} +* @readonly +*/ +export default class AutoFuelType { + + /** + * value: "PassiveAutoFuel" + * @const + */ + "PassiveAutoFuel" = "PassiveAutoFuel"; + + + /** + * value: "ProActiveAutoFuel" + * @const + */ + "ProActiveAutoFuel" = "ProActiveAutoFuel"; + + + /** + * value: "unknown_default_open_api" + * @const + */ + "unknown_default_open_api" = "unknown_default_open_api"; + + + + /** + * Returns a AutoFuelType enum value from a Javascript object name. + * @param {Object} data The plain JavaScript object containing the name of the enum value. + * @return {module:model/AutoFuelType} The enum AutoFuelType value. + */ + static constructFromObject(object) { + return object; + } +} + diff --git a/src/model/BabylonValidator.js b/src/model/BabylonValidator.js index d9ec1852..791557c3 100644 --- a/src/model/BabylonValidator.js +++ b/src/model/BabylonValidator.js @@ -23,15 +23,11 @@ class BabylonValidator { * @alias module:model/BabylonValidator * @implements module:model/BaseStakeExtra * @param pool_type {module:model/StakingPoolType} - * @param icon_url {String} The URL of the validator's icon. * @param name {String} The validator's name. - * @param public_key {String} The public key of the validator. - * @param commission_rate {Number} The commission rate of the validator. - * @param supported_pos_chains {Array.} A list of supported Proof-of-Stake (PoS) chains. */ - constructor(pool_type, icon_url, name, public_key, commission_rate, supported_pos_chains) { + constructor(pool_type, name) { BaseStakeExtra.initialize(this, pool_type); - BabylonValidator.initialize(this, pool_type, icon_url, name, public_key, commission_rate, supported_pos_chains); + BabylonValidator.initialize(this, pool_type, name); } /** @@ -39,13 +35,9 @@ class BabylonValidator { * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). * Only for internal use. */ - static initialize(obj, pool_type, icon_url, name, public_key, commission_rate, supported_pos_chains) { + static initialize(obj, pool_type, name) { obj['pool_type'] = pool_type; - obj['icon_url'] = icon_url; obj['name'] = name; - obj['public_key'] = public_key; - obj['commission_rate'] = commission_rate; - obj['supported_pos_chains'] = supported_pos_chains; } /** @@ -120,7 +112,7 @@ class BabylonValidator { } -BabylonValidator.RequiredProperties = ["pool_type", "icon_url", "name", "public_key", "commission_rate", "supported_pos_chains"]; +BabylonValidator.RequiredProperties = ["pool_type", "name"]; /** * @member {module:model/StakingPoolType} pool_type diff --git a/src/model/ContractCallParams.js b/src/model/ContractCallParams.js index 8c026d83..8c6260ad 100644 --- a/src/model/ContractCallParams.js +++ b/src/model/ContractCallParams.js @@ -10,6 +10,7 @@ */ import ApiClient from '../ApiClient'; +import AutoFuelType from './AutoFuelType'; import ContractCallDestination from './ContractCallDestination'; import ContractCallSource from './ContractCallSource'; import TransactionRequestFee from './TransactionRequestFee'; @@ -77,6 +78,9 @@ class ContractCallParams { if (data.hasOwnProperty('fee')) { obj['fee'] = TransactionRequestFee.constructFromObject(data['fee']); } + if (data.hasOwnProperty('auto_fuel')) { + obj['auto_fuel'] = AutoFuelType.constructFromObject(data['auto_fuel']); + } } return obj; } @@ -175,6 +179,11 @@ ContractCallParams.prototype['category_names'] = undefined; */ ContractCallParams.prototype['fee'] = undefined; +/** + * @member {module:model/AutoFuelType} auto_fuel + */ +ContractCallParams.prototype['auto_fuel'] = undefined; + diff --git a/src/model/CoreStakeExtra.js b/src/model/CoreStakeExtra.js new file mode 100644 index 00000000..eb44236d --- /dev/null +++ b/src/model/CoreStakeExtra.js @@ -0,0 +1,151 @@ +/** + * Cobo Wallet as a Service 2.0 + * + * Contact: help@cobo.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +import ApiClient from '../ApiClient'; +import BaseStakeExtra from './BaseStakeExtra'; +import StakingPoolType from './StakingPoolType'; + +/** + * The CoreStakeExtra model module. + * @module model/CoreStakeExtra + */ +class CoreStakeExtra { + /** + * Constructs a new CoreStakeExtra. + * @alias module:model/CoreStakeExtra + * @implements module:model/BaseStakeExtra + * @param pool_type {module:model/StakingPoolType} + * @param timelock {Number} The Unix timestamp (in seconds) when the staking position will be unlocked and available for withdrawal. + * @param validator_address {String} The validator's EVM address. + * @param reward_address {String} The EVM address to receive staking rewards. + */ + constructor(pool_type, timelock, validator_address, reward_address) { + BaseStakeExtra.initialize(this, pool_type); + CoreStakeExtra.initialize(this, pool_type, timelock, validator_address, reward_address); + } + + /** + * Initializes the fields of this object. + * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). + * Only for internal use. + */ + static initialize(obj, pool_type, timelock, validator_address, reward_address) { + obj['pool_type'] = pool_type; + obj['timelock'] = timelock; + obj['validator_address'] = validator_address; + obj['reward_address'] = reward_address; + } + + /** + * Constructs a CoreStakeExtra from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/CoreStakeExtra} obj Optional instance to populate. + * @return {module:model/CoreStakeExtra} The populated CoreStakeExtra instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new CoreStakeExtra(); + BaseStakeExtra.constructFromObject(data, obj); + + if (data.hasOwnProperty('pool_type')) { + obj['pool_type'] = StakingPoolType.constructFromObject(data['pool_type']); + } + if (data.hasOwnProperty('timelock')) { + obj['timelock'] = ApiClient.convertToType(data['timelock'], 'Number'); + } + if (data.hasOwnProperty('change_address')) { + obj['change_address'] = ApiClient.convertToType(data['change_address'], 'String'); + } + if (data.hasOwnProperty('validator_address')) { + obj['validator_address'] = ApiClient.convertToType(data['validator_address'], 'String'); + } + if (data.hasOwnProperty('reward_address')) { + obj['reward_address'] = ApiClient.convertToType(data['reward_address'], 'String'); + } + } + return obj; + } + + /** + * Validates the JSON data with respect to CoreStakeExtra. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to CoreStakeExtra. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of CoreStakeExtra.RequiredProperties) { + if (!data.hasOwnProperty(property)) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['change_address'] && !(typeof data['change_address'] === 'string' || data['change_address'] instanceof String)) { + throw new Error("Expected the field `change_address` to be a primitive type in the JSON string but got " + data['change_address']); + } + // ensure the json data is a string + if (data['validator_address'] && !(typeof data['validator_address'] === 'string' || data['validator_address'] instanceof String)) { + throw new Error("Expected the field `validator_address` to be a primitive type in the JSON string but got " + data['validator_address']); + } + // ensure the json data is a string + if (data['reward_address'] && !(typeof data['reward_address'] === 'string' || data['reward_address'] instanceof String)) { + throw new Error("Expected the field `reward_address` to be a primitive type in the JSON string but got " + data['reward_address']); + } + + return true; + } + + +} + +CoreStakeExtra.RequiredProperties = ["pool_type", "timelock", "validator_address", "reward_address"]; + +/** + * @member {module:model/StakingPoolType} pool_type + */ +CoreStakeExtra.prototype['pool_type'] = undefined; + +/** + * The Unix timestamp (in seconds) when the staking position will be unlocked and available for withdrawal. + * @member {Number} timelock + */ +CoreStakeExtra.prototype['timelock'] = undefined; + +/** + * The change address on the Bitcoin chain. If not provided, the source wallet's address will be used as the change address. + * @member {String} change_address + */ +CoreStakeExtra.prototype['change_address'] = undefined; + +/** + * The validator's EVM address. + * @member {String} validator_address + */ +CoreStakeExtra.prototype['validator_address'] = undefined; + +/** + * The EVM address to receive staking rewards. + * @member {String} reward_address + */ +CoreStakeExtra.prototype['reward_address'] = undefined; + + +// Implement BaseStakeExtra interface: +/** + * @member {module:model/StakingPoolType} pool_type + */ +BaseStakeExtra.prototype['pool_type'] = undefined; + + + + +export default CoreStakeExtra; + diff --git a/src/model/CoreStakingExtra.js b/src/model/CoreStakingExtra.js new file mode 100644 index 00000000..ad34cc4b --- /dev/null +++ b/src/model/CoreStakingExtra.js @@ -0,0 +1,168 @@ +/** + * Cobo Wallet as a Service 2.0 + * + * Contact: help@cobo.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +import ApiClient from '../ApiClient'; +import BaseStakeExtra from './BaseStakeExtra'; +import StakingPoolType from './StakingPoolType'; + +/** + * The CoreStakingExtra model module. + * @module model/CoreStakingExtra + */ +class CoreStakingExtra { + /** + * Constructs a new CoreStakingExtra. + * @alias module:model/CoreStakingExtra + * @implements module:model/BaseStakeExtra + * @param pool_type {module:model/StakingPoolType} + * @param pos_chain {String} The Proof-of-Stake (PoS) chain. + * @param staker_address {String} The staker's Bitcoin address. + * @param validator_address {String} The validator's EVM address. + * @param reward_address {String} The EVM address to receive staking rewards. + * @param timelock {Number} The Unix timestamp (in seconds) when the staking position will be unlocked and available for withdrawal. + */ + constructor(pool_type, pos_chain, staker_address, validator_address, reward_address, timelock) { + BaseStakeExtra.initialize(this, pool_type); + CoreStakingExtra.initialize(this, pool_type, pos_chain, staker_address, validator_address, reward_address, timelock); + } + + /** + * Initializes the fields of this object. + * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). + * Only for internal use. + */ + static initialize(obj, pool_type, pos_chain, staker_address, validator_address, reward_address, timelock) { + obj['pool_type'] = pool_type; + obj['pos_chain'] = pos_chain; + obj['staker_address'] = staker_address; + obj['validator_address'] = validator_address; + obj['reward_address'] = reward_address; + obj['timelock'] = timelock; + } + + /** + * Constructs a CoreStakingExtra from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/CoreStakingExtra} obj Optional instance to populate. + * @return {module:model/CoreStakingExtra} The populated CoreStakingExtra instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new CoreStakingExtra(); + BaseStakeExtra.constructFromObject(data, obj); + + if (data.hasOwnProperty('pool_type')) { + obj['pool_type'] = StakingPoolType.constructFromObject(data['pool_type']); + } + if (data.hasOwnProperty('pos_chain')) { + obj['pos_chain'] = ApiClient.convertToType(data['pos_chain'], 'String'); + } + if (data.hasOwnProperty('staker_address')) { + obj['staker_address'] = ApiClient.convertToType(data['staker_address'], 'String'); + } + if (data.hasOwnProperty('validator_address')) { + obj['validator_address'] = ApiClient.convertToType(data['validator_address'], 'String'); + } + if (data.hasOwnProperty('reward_address')) { + obj['reward_address'] = ApiClient.convertToType(data['reward_address'], 'String'); + } + if (data.hasOwnProperty('timelock')) { + obj['timelock'] = ApiClient.convertToType(data['timelock'], 'Number'); + } + } + return obj; + } + + /** + * Validates the JSON data with respect to CoreStakingExtra. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to CoreStakingExtra. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of CoreStakingExtra.RequiredProperties) { + if (!data.hasOwnProperty(property)) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['pos_chain'] && !(typeof data['pos_chain'] === 'string' || data['pos_chain'] instanceof String)) { + throw new Error("Expected the field `pos_chain` to be a primitive type in the JSON string but got " + data['pos_chain']); + } + // ensure the json data is a string + if (data['staker_address'] && !(typeof data['staker_address'] === 'string' || data['staker_address'] instanceof String)) { + throw new Error("Expected the field `staker_address` to be a primitive type in the JSON string but got " + data['staker_address']); + } + // ensure the json data is a string + if (data['validator_address'] && !(typeof data['validator_address'] === 'string' || data['validator_address'] instanceof String)) { + throw new Error("Expected the field `validator_address` to be a primitive type in the JSON string but got " + data['validator_address']); + } + // ensure the json data is a string + if (data['reward_address'] && !(typeof data['reward_address'] === 'string' || data['reward_address'] instanceof String)) { + throw new Error("Expected the field `reward_address` to be a primitive type in the JSON string but got " + data['reward_address']); + } + + return true; + } + + +} + +CoreStakingExtra.RequiredProperties = ["pool_type", "pos_chain", "staker_address", "validator_address", "reward_address", "timelock"]; + +/** + * @member {module:model/StakingPoolType} pool_type + */ +CoreStakingExtra.prototype['pool_type'] = undefined; + +/** + * The Proof-of-Stake (PoS) chain. + * @member {String} pos_chain + */ +CoreStakingExtra.prototype['pos_chain'] = undefined; + +/** + * The staker's Bitcoin address. + * @member {String} staker_address + */ +CoreStakingExtra.prototype['staker_address'] = undefined; + +/** + * The validator's EVM address. + * @member {String} validator_address + */ +CoreStakingExtra.prototype['validator_address'] = undefined; + +/** + * The EVM address to receive staking rewards. + * @member {String} reward_address + */ +CoreStakingExtra.prototype['reward_address'] = undefined; + +/** + * The Unix timestamp (in seconds) when the staking position will be unlocked and available for withdrawal. + * @member {Number} timelock + */ +CoreStakingExtra.prototype['timelock'] = undefined; + + +// Implement BaseStakeExtra interface: +/** + * @member {module:model/StakingPoolType} pool_type + */ +BaseStakeExtra.prototype['pool_type'] = undefined; + + + + +export default CoreStakingExtra; + diff --git a/src/model/CreateClaimActivity.js b/src/model/CreateClaimActivity.js new file mode 100644 index 00000000..6e454388 --- /dev/null +++ b/src/model/CreateClaimActivity.js @@ -0,0 +1,121 @@ +/** + * Cobo Wallet as a Service 2.0 + * + * Contact: help@cobo.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +import ApiClient from '../ApiClient'; +import TransactionRequestFee from './TransactionRequestFee'; + +/** + * The CreateClaimActivity model module. + * @module model/CreateClaimActivity + */ +class CreateClaimActivity { + /** + * Constructs a new CreateClaimActivity. + * @alias module:model/CreateClaimActivity + * @param staking_id {String} 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). + */ + constructor(staking_id) { + + CreateClaimActivity.initialize(this, staking_id); + } + + /** + * Initializes the fields of this object. + * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). + * Only for internal use. + */ + static initialize(obj, staking_id) { + obj['staking_id'] = staking_id; + } + + /** + * Constructs a CreateClaimActivity from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/CreateClaimActivity} obj Optional instance to populate. + * @return {module:model/CreateClaimActivity} The populated CreateClaimActivity instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new CreateClaimActivity(); + + if (data.hasOwnProperty('request_id')) { + obj['request_id'] = ApiClient.convertToType(data['request_id'], 'String'); + } + if (data.hasOwnProperty('staking_id')) { + obj['staking_id'] = ApiClient.convertToType(data['staking_id'], 'String'); + } + if (data.hasOwnProperty('fee')) { + obj['fee'] = TransactionRequestFee.constructFromObject(data['fee']); + } + } + return obj; + } + + /** + * Validates the JSON data with respect to CreateClaimActivity. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to CreateClaimActivity. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of CreateClaimActivity.RequiredProperties) { + if (!data.hasOwnProperty(property)) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['request_id'] && !(typeof data['request_id'] === 'string' || data['request_id'] instanceof String)) { + throw new Error("Expected the field `request_id` to be a primitive type in the JSON string but got " + data['request_id']); + } + // ensure the json data is a string + if (data['staking_id'] && !(typeof data['staking_id'] === 'string' || data['staking_id'] instanceof String)) { + throw new Error("Expected the field `staking_id` to be a primitive type in the JSON string but got " + data['staking_id']); + } + // validate the optional field `fee` + if (data['fee']) { // data not null + if (!!TransactionRequestFee.validateJSON) { + TransactionRequestFee.validateJSON(data['fee']); + } + } + + return true; + } + + +} + +CreateClaimActivity.RequiredProperties = ["staking_id"]; + +/** + * The request ID that is used to track a request. The request ID is provided by you and must be unique within your organization. + * @member {String} request_id + */ +CreateClaimActivity.prototype['request_id'] = undefined; + +/** + * 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). + * @member {String} staking_id + */ +CreateClaimActivity.prototype['staking_id'] = undefined; + +/** + * @member {module:model/TransactionRequestFee} fee + */ +CreateClaimActivity.prototype['fee'] = undefined; + + + + + + +export default CreateClaimActivity; + diff --git a/src/model/CreateClaimActivityRequest.js b/src/model/CreateClaimActivityRequest.js new file mode 100644 index 00000000..174edee7 --- /dev/null +++ b/src/model/CreateClaimActivityRequest.js @@ -0,0 +1,161 @@ +/** + * Cobo Wallet as a Service 2.0 + * + * Contact: help@cobo.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +import ApiClient from '../ApiClient'; +import ActivityInitiator from './ActivityInitiator'; +import CreateClaimActivity from './CreateClaimActivity'; +import TransactionRequestFee from './TransactionRequestFee'; + +/** + * The CreateClaimActivityRequest model module. + * @module model/CreateClaimActivityRequest + */ +class CreateClaimActivityRequest { + /** + * Constructs a new CreateClaimActivityRequest. + * @alias module:model/CreateClaimActivityRequest + * @implements module:model/CreateClaimActivity + * @implements module:model/ActivityInitiator + * @param staking_id {String} 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). + */ + constructor(staking_id) { + CreateClaimActivity.initialize(this, staking_id);ActivityInitiator.initialize(this); + CreateClaimActivityRequest.initialize(this, staking_id); + } + + /** + * Initializes the fields of this object. + * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). + * Only for internal use. + */ + static initialize(obj, staking_id) { + obj['staking_id'] = staking_id; + } + + /** + * Constructs a CreateClaimActivityRequest from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/CreateClaimActivityRequest} obj Optional instance to populate. + * @return {module:model/CreateClaimActivityRequest} The populated CreateClaimActivityRequest instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new CreateClaimActivityRequest(); + CreateClaimActivity.constructFromObject(data, obj); + ActivityInitiator.constructFromObject(data, obj); + + if (data.hasOwnProperty('request_id')) { + obj['request_id'] = ApiClient.convertToType(data['request_id'], 'String'); + } + if (data.hasOwnProperty('staking_id')) { + obj['staking_id'] = ApiClient.convertToType(data['staking_id'], 'String'); + } + if (data.hasOwnProperty('fee')) { + obj['fee'] = TransactionRequestFee.constructFromObject(data['fee']); + } + if (data.hasOwnProperty('app_initiator')) { + obj['app_initiator'] = ApiClient.convertToType(data['app_initiator'], 'String'); + } + } + return obj; + } + + /** + * Validates the JSON data with respect to CreateClaimActivityRequest. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to CreateClaimActivityRequest. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of CreateClaimActivityRequest.RequiredProperties) { + if (!data.hasOwnProperty(property)) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['request_id'] && !(typeof data['request_id'] === 'string' || data['request_id'] instanceof String)) { + throw new Error("Expected the field `request_id` to be a primitive type in the JSON string but got " + data['request_id']); + } + // ensure the json data is a string + if (data['staking_id'] && !(typeof data['staking_id'] === 'string' || data['staking_id'] instanceof String)) { + throw new Error("Expected the field `staking_id` to be a primitive type in the JSON string but got " + data['staking_id']); + } + // validate the optional field `fee` + if (data['fee']) { // data not null + if (!!TransactionRequestFee.validateJSON) { + TransactionRequestFee.validateJSON(data['fee']); + } + } + // ensure the json data is a string + if (data['app_initiator'] && !(typeof data['app_initiator'] === 'string' || data['app_initiator'] instanceof String)) { + throw new Error("Expected the field `app_initiator` to be a primitive type in the JSON string but got " + data['app_initiator']); + } + + return true; + } + + +} + +CreateClaimActivityRequest.RequiredProperties = ["staking_id"]; + +/** + * The request ID that is used to track a request. The request ID is provided by you and must be unique within your organization. + * @member {String} request_id + */ +CreateClaimActivityRequest.prototype['request_id'] = undefined; + +/** + * 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). + * @member {String} staking_id + */ +CreateClaimActivityRequest.prototype['staking_id'] = undefined; + +/** + * @member {module:model/TransactionRequestFee} fee + */ +CreateClaimActivityRequest.prototype['fee'] = undefined; + +/** + * The initiator of the staking activity. If you do not specify this property, the WaaS service will automatically designate the API key as the initiator. + * @member {String} app_initiator + */ +CreateClaimActivityRequest.prototype['app_initiator'] = undefined; + + +// Implement CreateClaimActivity interface: +/** + * The request ID that is used to track a request. The request ID is provided by you and must be unique within your organization. + * @member {String} request_id + */ +CreateClaimActivity.prototype['request_id'] = undefined; +/** + * 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). + * @member {String} staking_id + */ +CreateClaimActivity.prototype['staking_id'] = undefined; +/** + * @member {module:model/TransactionRequestFee} fee + */ +CreateClaimActivity.prototype['fee'] = undefined; +// Implement ActivityInitiator interface: +/** + * The initiator of the staking activity. If you do not specify this property, the WaaS service will automatically designate the API key as the initiator. + * @member {String} app_initiator + */ +ActivityInitiator.prototype['app_initiator'] = undefined; + + + + +export default CreateClaimActivityRequest; + diff --git a/src/model/CreateStakeActivity.js b/src/model/CreateStakeActivity.js index aa24c059..07a07301 100644 --- a/src/model/CreateStakeActivity.js +++ b/src/model/CreateStakeActivity.js @@ -11,6 +11,7 @@ import ApiClient from '../ApiClient'; import CreateStakeActivityExtra from './CreateStakeActivityExtra'; +import StakingPoolId from './StakingPoolId'; import StakingSource from './StakingSource'; import TransactionRequestFee from './TransactionRequestFee'; @@ -22,7 +23,7 @@ class CreateStakeActivity { /** * Constructs a new CreateStakeActivity. * @alias module:model/CreateStakeActivity - * @param pool_id {String} The ID of the staking pool. + * @param pool_id {module:model/StakingPoolId} * @param amount {String} The amount to stake. * @param fee {module:model/TransactionRequestFee} * @param extra {module:model/CreateStakeActivityExtra} @@ -62,7 +63,7 @@ class CreateStakeActivity { obj['source'] = StakingSource.constructFromObject(data['source']); } if (data.hasOwnProperty('pool_id')) { - obj['pool_id'] = ApiClient.convertToType(data['pool_id'], 'String'); + obj['pool_id'] = StakingPoolId.constructFromObject(data['pool_id']); } if (data.hasOwnProperty('amount')) { obj['amount'] = ApiClient.convertToType(data['amount'], 'String'); @@ -100,10 +101,6 @@ class CreateStakeActivity { } } // ensure the json data is a string - if (data['pool_id'] && !(typeof data['pool_id'] === 'string' || data['pool_id'] instanceof String)) { - throw new Error("Expected the field `pool_id` to be a primitive type in the JSON string but got " + data['pool_id']); - } - // ensure the json data is a string if (data['amount'] && !(typeof data['amount'] === 'string' || data['amount'] instanceof String)) { throw new Error("Expected the field `amount` to be a primitive type in the JSON string but got " + data['amount']); } @@ -140,8 +137,7 @@ CreateStakeActivity.prototype['request_id'] = undefined; CreateStakeActivity.prototype['source'] = undefined; /** - * The ID of the staking pool. - * @member {String} pool_id + * @member {module:model/StakingPoolId} pool_id */ CreateStakeActivity.prototype['pool_id'] = undefined; diff --git a/src/model/CreateStakeActivityExtra.js b/src/model/CreateStakeActivityExtra.js index 5d785d2f..a565f6a9 100644 --- a/src/model/CreateStakeActivityExtra.js +++ b/src/model/CreateStakeActivityExtra.js @@ -11,6 +11,7 @@ import ApiClient from '../ApiClient'; import BabylonStakeExtra from './BabylonStakeExtra'; +import CoreStakeExtra from './CoreStakeExtra'; import EthStakeExtra from './EthStakeExtra'; import StakingPoolType from './StakingPoolType'; @@ -22,7 +23,7 @@ class CreateStakeActivityExtra { /** * Constructs a new CreateStakeActivityExtra. * @alias module:model/CreateStakeActivityExtra - * @param {(module:model/BabylonStakeExtra|module:model/EthStakeExtra)} instance The actual instance to initialize CreateStakeActivityExtra. + * @param {(module:model/BabylonStakeExtra|module:model/CoreStakeExtra|module:model/EthStakeExtra)} instance The actual instance to initialize CreateStakeActivityExtra. */ constructor(instance = null) { if (instance === null) { @@ -39,6 +40,10 @@ class CreateStakeActivityExtra { this.actualInstance = BabylonStakeExtra.constructFromObject(instance); match++; break; + case "CoreBTC": + this.actualInstance = CoreStakeExtra.constructFromObject(instance); + match++; + break; case "ETHBeacon": this.actualInstance = EthStakeExtra.constructFromObject(instance); match++; @@ -100,12 +105,37 @@ class CreateStakeActivityExtra { errorMessages.push("Failed to construct EthStakeExtra: " + err) } + try { + if (instance instanceof CoreStakeExtra) { + this.actualInstance = instance; + } else if(!!CoreStakeExtra.validateJSON && CoreStakeExtra.validateJSON(instance)){ + // plain JS object + // create CoreStakeExtra from JS object + this.actualInstance = CoreStakeExtra.constructFromObject(instance); + } else { + if(CoreStakeExtra.constructFromObject(instance)) { + if (!!CoreStakeExtra.constructFromObject(instance).toJSON) { + if (CoreStakeExtra.constructFromObject(instance).toJSON()) { + this.actualInstance = CoreStakeExtra.constructFromObject(instance); + } + } else { + this.actualInstance = CoreStakeExtra.constructFromObject(instance); + } + } + + } + match++; + } catch(err) { + // json data failed to deserialize into CoreStakeExtra + errorMessages.push("Failed to construct CoreStakeExtra: " + err) + } + // if (match > 1) { - // throw new Error("Multiple matches found constructing `CreateStakeActivityExtra` with oneOf schemas BabylonStakeExtra, EthStakeExtra. Input: " + JSON.stringify(instance)); + // throw new Error("Multiple matches found constructing `CreateStakeActivityExtra` with oneOf schemas BabylonStakeExtra, CoreStakeExtra, EthStakeExtra. Input: " + JSON.stringify(instance)); // } else if (match === 0) { // this.actualInstance = null; // clear the actual instance in case there are multiple matches - // throw new Error("No match found constructing `CreateStakeActivityExtra` with oneOf schemas BabylonStakeExtra, EthStakeExtra. Details: " + + // throw new Error("No match found constructing `CreateStakeActivityExtra` with oneOf schemas BabylonStakeExtra, CoreStakeExtra, EthStakeExtra. Details: " + // errorMessages.join(", ")); return; } else { // only 1 match @@ -125,16 +155,16 @@ class CreateStakeActivityExtra { } /** - * Gets the actual instance, which can be BabylonStakeExtra, EthStakeExtra. - * @return {(module:model/BabylonStakeExtra|module:model/EthStakeExtra)} The actual instance. + * Gets the actual instance, which can be BabylonStakeExtra, CoreStakeExtra, EthStakeExtra. + * @return {(module:model/BabylonStakeExtra|module:model/CoreStakeExtra|module:model/EthStakeExtra)} The actual instance. */ getActualInstance() { return this.actualInstance; } /** - * Sets the actual instance, which can be BabylonStakeExtra, EthStakeExtra. - * @param {(module:model/BabylonStakeExtra|module:model/EthStakeExtra)} obj The actual instance. + * Sets the actual instance, which can be BabylonStakeExtra, CoreStakeExtra, EthStakeExtra. + * @param {(module:model/BabylonStakeExtra|module:model/CoreStakeExtra|module:model/EthStakeExtra)} obj The actual instance. */ setActualInstance(obj) { this.actualInstance = CreateStakeActivityExtra.constructFromObject(obj).getActualInstance(); @@ -187,8 +217,32 @@ CreateStakeActivityExtra.prototype['auto_broadcast'] = undefined; */ CreateStakeActivityExtra.prototype['provider_name'] = undefined; +/** + * The Unix timestamp (in seconds) when the staking position will be unlocked and available for withdrawal. + * @member {Number} timelock + */ +CreateStakeActivityExtra.prototype['timelock'] = undefined; + +/** + * The change address on the Bitcoin chain. If not provided, the source wallet's address will be used as the change address. + * @member {String} change_address + */ +CreateStakeActivityExtra.prototype['change_address'] = undefined; + +/** + * The validator's EVM address. + * @member {String} validator_address + */ +CreateStakeActivityExtra.prototype['validator_address'] = undefined; + +/** + * The EVM address to receive staking rewards. + * @member {String} reward_address + */ +CreateStakeActivityExtra.prototype['reward_address'] = undefined; + -CreateStakeActivityExtra.OneOf = ["BabylonStakeExtra", "EthStakeExtra"]; +CreateStakeActivityExtra.OneOf = ["BabylonStakeExtra", "CoreStakeExtra", "EthStakeExtra"]; export default CreateStakeActivityExtra; diff --git a/src/model/CreateStakeActivityRequest.js b/src/model/CreateStakeActivityRequest.js index be7b4f2e..4ab08a4e 100644 --- a/src/model/CreateStakeActivityRequest.js +++ b/src/model/CreateStakeActivityRequest.js @@ -13,6 +13,7 @@ import ApiClient from '../ApiClient'; import ActivityInitiator from './ActivityInitiator'; import CreateStakeActivity from './CreateStakeActivity'; import CreateStakeActivityExtra from './CreateStakeActivityExtra'; +import StakingPoolId from './StakingPoolId'; import StakingSource from './StakingSource'; import TransactionRequestFee from './TransactionRequestFee'; @@ -26,7 +27,7 @@ class CreateStakeActivityRequest { * @alias module:model/CreateStakeActivityRequest * @implements module:model/CreateStakeActivity * @implements module:model/ActivityInitiator - * @param pool_id {String} The ID of the staking pool. + * @param pool_id {module:model/StakingPoolId} * @param amount {String} The amount to stake. * @param fee {module:model/TransactionRequestFee} * @param extra {module:model/CreateStakeActivityExtra} @@ -68,7 +69,7 @@ class CreateStakeActivityRequest { obj['source'] = StakingSource.constructFromObject(data['source']); } if (data.hasOwnProperty('pool_id')) { - obj['pool_id'] = ApiClient.convertToType(data['pool_id'], 'String'); + obj['pool_id'] = StakingPoolId.constructFromObject(data['pool_id']); } if (data.hasOwnProperty('amount')) { obj['amount'] = ApiClient.convertToType(data['amount'], 'String'); @@ -109,10 +110,6 @@ class CreateStakeActivityRequest { } } // ensure the json data is a string - if (data['pool_id'] && !(typeof data['pool_id'] === 'string' || data['pool_id'] instanceof String)) { - throw new Error("Expected the field `pool_id` to be a primitive type in the JSON string but got " + data['pool_id']); - } - // ensure the json data is a string if (data['amount'] && !(typeof data['amount'] === 'string' || data['amount'] instanceof String)) { throw new Error("Expected the field `amount` to be a primitive type in the JSON string but got " + data['amount']); } @@ -153,8 +150,7 @@ CreateStakeActivityRequest.prototype['request_id'] = undefined; CreateStakeActivityRequest.prototype['source'] = undefined; /** - * The ID of the staking pool. - * @member {String} pool_id + * @member {module:model/StakingPoolId} pool_id */ CreateStakeActivityRequest.prototype['pool_id'] = undefined; @@ -192,8 +188,7 @@ CreateStakeActivity.prototype['request_id'] = undefined; */ CreateStakeActivity.prototype['source'] = undefined; /** - * The ID of the staking pool. - * @member {String} pool_id + * @member {module:model/StakingPoolId} pool_id */ CreateStakeActivity.prototype['pool_id'] = undefined; /** diff --git a/src/model/CreateWithdrawActivity.js b/src/model/CreateWithdrawActivity.js index 10689f71..c41cac30 100644 --- a/src/model/CreateWithdrawActivity.js +++ b/src/model/CreateWithdrawActivity.js @@ -58,9 +58,6 @@ class CreateWithdrawActivity { if (data.hasOwnProperty('amount')) { obj['amount'] = ApiClient.convertToType(data['amount'], 'String'); } - if (data.hasOwnProperty('address')) { - obj['address'] = ApiClient.convertToType(data['address'], 'String'); - } if (data.hasOwnProperty('fee')) { obj['fee'] = TransactionRequestFee.constructFromObject(data['fee']); } @@ -92,10 +89,6 @@ class CreateWithdrawActivity { if (data['amount'] && !(typeof data['amount'] === 'string' || data['amount'] instanceof String)) { throw new Error("Expected the field `amount` to be a primitive type in the JSON string but got " + data['amount']); } - // ensure the json data is a string - if (data['address'] && !(typeof data['address'] === 'string' || data['address'] instanceof String)) { - throw new Error("Expected the field `address` to be a primitive type in the JSON string but got " + data['address']); - } // validate the optional field `fee` if (data['fee']) { // data not null if (!!TransactionRequestFee.validateJSON) { @@ -129,12 +122,6 @@ CreateWithdrawActivity.prototype['staking_id'] = undefined; */ CreateWithdrawActivity.prototype['amount'] = undefined; -/** - * The withdrawal address. - * @member {String} address - */ -CreateWithdrawActivity.prototype['address'] = undefined; - /** * @member {module:model/TransactionRequestFee} fee */ diff --git a/src/model/CreateWithdrawActivityRequest.js b/src/model/CreateWithdrawActivityRequest.js index 14cfd6a2..89f03e94 100644 --- a/src/model/CreateWithdrawActivityRequest.js +++ b/src/model/CreateWithdrawActivityRequest.js @@ -64,9 +64,6 @@ class CreateWithdrawActivityRequest { if (data.hasOwnProperty('amount')) { obj['amount'] = ApiClient.convertToType(data['amount'], 'String'); } - if (data.hasOwnProperty('address')) { - obj['address'] = ApiClient.convertToType(data['address'], 'String'); - } if (data.hasOwnProperty('fee')) { obj['fee'] = TransactionRequestFee.constructFromObject(data['fee']); } @@ -101,10 +98,6 @@ class CreateWithdrawActivityRequest { if (data['amount'] && !(typeof data['amount'] === 'string' || data['amount'] instanceof String)) { throw new Error("Expected the field `amount` to be a primitive type in the JSON string but got " + data['amount']); } - // ensure the json data is a string - if (data['address'] && !(typeof data['address'] === 'string' || data['address'] instanceof String)) { - throw new Error("Expected the field `address` to be a primitive type in the JSON string but got " + data['address']); - } // validate the optional field `fee` if (data['fee']) { // data not null if (!!TransactionRequestFee.validateJSON) { @@ -142,12 +135,6 @@ CreateWithdrawActivityRequest.prototype['staking_id'] = undefined; */ CreateWithdrawActivityRequest.prototype['amount'] = undefined; -/** - * The withdrawal address. - * @member {String} address - */ -CreateWithdrawActivityRequest.prototype['address'] = undefined; - /** * @member {module:model/TransactionRequestFee} fee */ @@ -176,11 +163,6 @@ CreateWithdrawActivity.prototype['staking_id'] = undefined; * @member {String} amount */ CreateWithdrawActivity.prototype['amount'] = undefined; -/** - * The withdrawal address. - * @member {String} address - */ -CreateWithdrawActivity.prototype['address'] = undefined; /** * @member {module:model/TransactionRequestFee} fee */ diff --git a/src/model/EstimateClaimFee.js b/src/model/EstimateClaimFee.js new file mode 100644 index 00000000..fd21027a --- /dev/null +++ b/src/model/EstimateClaimFee.js @@ -0,0 +1,125 @@ +/** + * Cobo Wallet as a Service 2.0 + * + * Contact: help@cobo.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +import ApiClient from '../ApiClient'; +import ActivityType from './ActivityType'; +import BaseEstimateStakingFee from './BaseEstimateStakingFee'; +import TransactionRequestFee from './TransactionRequestFee'; + +/** + * The EstimateClaimFee model module. + * @module model/EstimateClaimFee + */ +class EstimateClaimFee { + /** + * Constructs a new EstimateClaimFee. + * @alias module:model/EstimateClaimFee + * @implements module:model/BaseEstimateStakingFee + * @param activity_type {module:model/ActivityType} + */ + constructor(activity_type) { + BaseEstimateStakingFee.initialize(this, activity_type); + EstimateClaimFee.initialize(this, activity_type); + } + + /** + * Initializes the fields of this object. + * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). + * Only for internal use. + */ + static initialize(obj, activity_type) { + obj['activity_type'] = activity_type; + } + + /** + * Constructs a EstimateClaimFee from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/EstimateClaimFee} obj Optional instance to populate. + * @return {module:model/EstimateClaimFee} The populated EstimateClaimFee instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new EstimateClaimFee(); + BaseEstimateStakingFee.constructFromObject(data, obj); + + if (data.hasOwnProperty('activity_type')) { + obj['activity_type'] = ActivityType.constructFromObject(data['activity_type']); + } + if (data.hasOwnProperty('staking_id')) { + obj['staking_id'] = ApiClient.convertToType(data['staking_id'], 'String'); + } + if (data.hasOwnProperty('fee')) { + obj['fee'] = TransactionRequestFee.constructFromObject(data['fee']); + } + } + return obj; + } + + /** + * Validates the JSON data with respect to EstimateClaimFee. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to EstimateClaimFee. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of EstimateClaimFee.RequiredProperties) { + if (!data.hasOwnProperty(property)) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + // ensure the json data is a string + if (data['staking_id'] && !(typeof data['staking_id'] === 'string' || data['staking_id'] instanceof String)) { + throw new Error("Expected the field `staking_id` to be a primitive type in the JSON string but got " + data['staking_id']); + } + // validate the optional field `fee` + if (data['fee']) { // data not null + if (!!TransactionRequestFee.validateJSON) { + TransactionRequestFee.validateJSON(data['fee']); + } + } + + return true; + } + + +} + +EstimateClaimFee.RequiredProperties = ["activity_type"]; + +/** + * @member {module:model/ActivityType} activity_type + */ +EstimateClaimFee.prototype['activity_type'] = undefined; + +/** + * 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). + * @member {String} staking_id + */ +EstimateClaimFee.prototype['staking_id'] = undefined; + +/** + * @member {module:model/TransactionRequestFee} fee + */ +EstimateClaimFee.prototype['fee'] = undefined; + + +// Implement BaseEstimateStakingFee interface: +/** + * @member {module:model/ActivityType} activity_type + */ +BaseEstimateStakingFee.prototype['activity_type'] = undefined; + + + + +export default EstimateClaimFee; + diff --git a/src/model/EstimateContractCallFeeParams.js b/src/model/EstimateContractCallFeeParams.js index b301b0f9..624741bc 100644 --- a/src/model/EstimateContractCallFeeParams.js +++ b/src/model/EstimateContractCallFeeParams.js @@ -25,7 +25,7 @@ class EstimateContractCallFeeParams { * The information about a transaction that interacts with a smart contract * @alias module:model/EstimateContractCallFeeParams * @param request_type {module:model/EstimateFeeRequestType} - * @param chain_id {String} 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). + * @param chain_id {String} The chain ID of the chain on which the smart contract is deployed. You can retrieve the IDs of all the chains you can use by calling [List enabled chains](/v2/api-references/wallets/list-enabled-chains). * @param source {module:model/ContractCallSource} * @param destination {module:model/ContractCallDestination} */ @@ -132,7 +132,7 @@ EstimateContractCallFeeParams.prototype['request_id'] = undefined; EstimateContractCallFeeParams.prototype['request_type'] = undefined; /** - * 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). + * The chain ID of the chain on which the smart contract is deployed. You can retrieve the IDs of all the chains you can use by calling [List enabled chains](/v2/api-references/wallets/list-enabled-chains). * @member {String} chain_id */ EstimateContractCallFeeParams.prototype['chain_id'] = undefined; diff --git a/src/model/EstimateFeeParams.js b/src/model/EstimateFeeParams.js index a7aa64b6..861b307c 100644 --- a/src/model/EstimateFeeParams.js +++ b/src/model/EstimateFeeParams.js @@ -194,7 +194,7 @@ EstimateFeeParams.prototype['destination'] = undefined; EstimateFeeParams.prototype['fee_type'] = undefined; /** - * 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). + * The chain ID of the chain on which the smart contract is deployed. You can retrieve the IDs of all the chains you can use by calling [List enabled chains](/v2/api-references/wallets/list-enabled-chains). * @member {String} chain_id */ EstimateFeeParams.prototype['chain_id'] = undefined; diff --git a/src/model/EstimateStakeFee.js b/src/model/EstimateStakeFee.js index 882f145f..fe4a06c1 100644 --- a/src/model/EstimateStakeFee.js +++ b/src/model/EstimateStakeFee.js @@ -14,6 +14,7 @@ import ActivityType from './ActivityType'; import BaseEstimateStakingFee from './BaseEstimateStakingFee'; import CreateStakeActivity from './CreateStakeActivity'; import CreateStakeActivityExtra from './CreateStakeActivityExtra'; +import StakingPoolId from './StakingPoolId'; import StakingSource from './StakingSource'; import TransactionRequestFee from './TransactionRequestFee'; @@ -28,7 +29,7 @@ class EstimateStakeFee { * @implements module:model/BaseEstimateStakingFee * @implements module:model/CreateStakeActivity * @param activity_type {module:model/ActivityType} - * @param pool_id {String} The ID of the staking pool. + * @param pool_id {module:model/StakingPoolId} * @param amount {String} The amount to stake. * @param fee {module:model/TransactionRequestFee} * @param extra {module:model/CreateStakeActivityExtra} @@ -74,7 +75,7 @@ class EstimateStakeFee { obj['source'] = StakingSource.constructFromObject(data['source']); } if (data.hasOwnProperty('pool_id')) { - obj['pool_id'] = ApiClient.convertToType(data['pool_id'], 'String'); + obj['pool_id'] = StakingPoolId.constructFromObject(data['pool_id']); } if (data.hasOwnProperty('amount')) { obj['amount'] = ApiClient.convertToType(data['amount'], 'String'); @@ -112,10 +113,6 @@ class EstimateStakeFee { } } // ensure the json data is a string - if (data['pool_id'] && !(typeof data['pool_id'] === 'string' || data['pool_id'] instanceof String)) { - throw new Error("Expected the field `pool_id` to be a primitive type in the JSON string but got " + data['pool_id']); - } - // ensure the json data is a string if (data['amount'] && !(typeof data['amount'] === 'string' || data['amount'] instanceof String)) { throw new Error("Expected the field `amount` to be a primitive type in the JSON string but got " + data['amount']); } @@ -157,8 +154,7 @@ EstimateStakeFee.prototype['request_id'] = undefined; EstimateStakeFee.prototype['source'] = undefined; /** - * The ID of the staking pool. - * @member {String} pool_id + * @member {module:model/StakingPoolId} pool_id */ EstimateStakeFee.prototype['pool_id'] = undefined; @@ -195,8 +191,7 @@ CreateStakeActivity.prototype['request_id'] = undefined; */ CreateStakeActivity.prototype['source'] = undefined; /** - * The ID of the staking pool. - * @member {String} pool_id + * @member {module:model/StakingPoolId} pool_id */ CreateStakeActivity.prototype['pool_id'] = undefined; /** diff --git a/src/model/EstimateWithdrawFee.js b/src/model/EstimateWithdrawFee.js index b5da5591..e252e5af 100644 --- a/src/model/EstimateWithdrawFee.js +++ b/src/model/EstimateWithdrawFee.js @@ -70,9 +70,6 @@ class EstimateWithdrawFee { if (data.hasOwnProperty('amount')) { obj['amount'] = ApiClient.convertToType(data['amount'], 'String'); } - if (data.hasOwnProperty('address')) { - obj['address'] = ApiClient.convertToType(data['address'], 'String'); - } if (data.hasOwnProperty('fee')) { obj['fee'] = TransactionRequestFee.constructFromObject(data['fee']); } @@ -104,10 +101,6 @@ class EstimateWithdrawFee { if (data['amount'] && !(typeof data['amount'] === 'string' || data['amount'] instanceof String)) { throw new Error("Expected the field `amount` to be a primitive type in the JSON string but got " + data['amount']); } - // ensure the json data is a string - if (data['address'] && !(typeof data['address'] === 'string' || data['address'] instanceof String)) { - throw new Error("Expected the field `address` to be a primitive type in the JSON string but got " + data['address']); - } // validate the optional field `fee` if (data['fee']) { // data not null if (!!TransactionRequestFee.validateJSON) { @@ -146,12 +139,6 @@ EstimateWithdrawFee.prototype['staking_id'] = undefined; */ EstimateWithdrawFee.prototype['amount'] = undefined; -/** - * The withdrawal address. - * @member {String} address - */ -EstimateWithdrawFee.prototype['address'] = undefined; - /** * @member {module:model/TransactionRequestFee} fee */ @@ -179,11 +166,6 @@ CreateWithdrawActivity.prototype['staking_id'] = undefined; * @member {String} amount */ CreateWithdrawActivity.prototype['amount'] = undefined; -/** - * The withdrawal address. - * @member {String} address - */ -CreateWithdrawActivity.prototype['address'] = undefined; /** * @member {module:model/TransactionRequestFee} fee */ diff --git a/src/model/EstimatedFee.js b/src/model/EstimatedFee.js index ff5fb218..885b76cd 100644 --- a/src/model/EstimatedFee.js +++ b/src/model/EstimatedFee.js @@ -237,7 +237,7 @@ EstimatedFee.prototype['token_id'] = undefined; EstimatedFee.prototype['is_loop'] = undefined; /** - * The fee that you need to pay for the transaction. + * The transaction fee that you need to pay for the transaction. * @member {String} fee_amount */ EstimatedFee.prototype['fee_amount'] = undefined; diff --git a/src/model/EstimatedFixedFee.js b/src/model/EstimatedFixedFee.js index 707ef2b5..00190b1e 100644 --- a/src/model/EstimatedFixedFee.js +++ b/src/model/EstimatedFixedFee.js @@ -20,10 +20,10 @@ import FeeType from './FeeType'; class EstimatedFixedFee { /** * Constructs a new EstimatedFixedFee. - * In the fixed fee model, the transaction fee is a fixed amount within a certain amount of period regardless of the transaction size or network congestion, which can vary between different chains. + * The estimated transaction fee based on the fixed fee model. * @alias module:model/EstimatedFixedFee * @implements module:model/FeeAmount - * @param fee_amount {String} The fee that you need to pay for the transaction. + * @param fee_amount {String} The transaction fee that you need to pay for the transaction. * @param fee_type {module:model/FeeType} * @param token_id {String} The token ID of the transaction fee. */ @@ -101,7 +101,7 @@ class EstimatedFixedFee { EstimatedFixedFee.RequiredProperties = ["fee_amount", "fee_type", "token_id"]; /** - * The fee that you need to pay for the transaction. + * The transaction fee that you need to pay for the transaction. * @member {String} fee_amount */ EstimatedFixedFee.prototype['fee_amount'] = undefined; @@ -126,7 +126,7 @@ EstimatedFixedFee.prototype['is_loop'] = undefined; // Implement FeeAmount interface: /** - * The fee that you need to pay for the transaction. + * The transaction fee that you need to pay for the transaction. * @member {String} fee_amount */ FeeAmount.prototype['fee_amount'] = undefined; diff --git a/src/model/EstimatedUtxoFeeSlow.js b/src/model/EstimatedUtxoFeeSlow.js index 547075d4..d294e2d6 100644 --- a/src/model/EstimatedUtxoFeeSlow.js +++ b/src/model/EstimatedUtxoFeeSlow.js @@ -24,7 +24,7 @@ class EstimatedUtxoFeeSlow { * @implements module:model/UtxoFeeBasePrice * @implements module:model/FeeAmount * @param fee_rate {String} The fee rate in sat/vByte. The fee rate represents the satoshis you are willing to pay for each byte of data that your transaction will consume on the blockchain. - * @param fee_amount {String} The fee that you need to pay for the transaction. + * @param fee_amount {String} The transaction fee that you need to pay for the transaction. */ constructor(fee_rate, fee_amount) { UtxoFeeBasePrice.initialize(this);FeeAmount.initialize(this); @@ -100,7 +100,7 @@ EstimatedUtxoFeeSlow.RequiredProperties = ["fee_rate", "fee_amount"]; EstimatedUtxoFeeSlow.prototype['fee_rate'] = undefined; /** - * The fee that you need to pay for the transaction. + * The transaction fee that you need to pay for the transaction. * @member {String} fee_amount */ EstimatedUtxoFeeSlow.prototype['fee_amount'] = undefined; @@ -114,7 +114,7 @@ EstimatedUtxoFeeSlow.prototype['fee_amount'] = undefined; UtxoFeeBasePrice.prototype['fee_rate'] = undefined; // Implement FeeAmount interface: /** - * The fee that you need to pay for the transaction. + * The transaction fee that you need to pay for the transaction. * @member {String} fee_amount */ FeeAmount.prototype['fee_amount'] = undefined; diff --git a/src/model/EthStakingExtra.js b/src/model/EthStakingExtra.js index fd1eddee..0b726a0c 100644 --- a/src/model/EthStakingExtra.js +++ b/src/model/EthStakingExtra.js @@ -11,6 +11,7 @@ import ApiClient from '../ApiClient'; import BaseStakeExtra from './BaseStakeExtra'; +import EthStakingExtraAllOfBeaconValidators from './EthStakingExtraAllOfBeaconValidators'; import StakingPoolType from './StakingPoolType'; /** @@ -58,6 +59,9 @@ class EthStakingExtra { if (data.hasOwnProperty('pos_chain')) { obj['pos_chain'] = ApiClient.convertToType(data['pos_chain'], 'String'); } + if (data.hasOwnProperty('beacon_validators')) { + obj['beacon_validators'] = ApiClient.convertToType(data['beacon_validators'], [EthStakingExtraAllOfBeaconValidators]); + } } return obj; } @@ -78,6 +82,16 @@ class EthStakingExtra { if (data['pos_chain'] && !(typeof data['pos_chain'] === 'string' || data['pos_chain'] instanceof String)) { throw new Error("Expected the field `pos_chain` to be a primitive type in the JSON string but got " + data['pos_chain']); } + if (data['beacon_validators']) { // data not null + // ensure the json data is an array + if (!Array.isArray(data['beacon_validators'])) { + throw new Error("Expected the field `beacon_validators` to be an array in the JSON data but got " + data['beacon_validators']); + } + // validate the optional field `beacon_validators` (array) + for (const item of data['beacon_validators']) { + EthStakingExtraAllOfBeaconValidators.validateJSON(item); + }; + } return true; } @@ -98,6 +112,12 @@ EthStakingExtra.prototype['pool_type'] = undefined; */ EthStakingExtra.prototype['pos_chain'] = undefined; +/** + * The list of validator information. + * @member {Array.} beacon_validators + */ +EthStakingExtra.prototype['beacon_validators'] = undefined; + // Implement BaseStakeExtra interface: /** diff --git a/src/model/EthStakingExtraAllOfBeaconValidators.js b/src/model/EthStakingExtraAllOfBeaconValidators.js new file mode 100644 index 00000000..40bbcd42 --- /dev/null +++ b/src/model/EthStakingExtraAllOfBeaconValidators.js @@ -0,0 +1,138 @@ +/** + * Cobo Wallet as a Service 2.0 + * + * Contact: help@cobo.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +import ApiClient from '../ApiClient'; +import AmountStatus from './AmountStatus'; + +/** + * The EthStakingExtraAllOfBeaconValidators model module. + * @module model/EthStakingExtraAllOfBeaconValidators + */ +class EthStakingExtraAllOfBeaconValidators { + /** + * Constructs a new EthStakingExtraAllOfBeaconValidators. + * @alias module:model/EthStakingExtraAllOfBeaconValidators + */ + constructor() { + + EthStakingExtraAllOfBeaconValidators.initialize(this); + } + + /** + * Initializes the fields of this object. + * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). + * Only for internal use. + */ + static initialize(obj) { + } + + /** + * Constructs a EthStakingExtraAllOfBeaconValidators from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/EthStakingExtraAllOfBeaconValidators} obj Optional instance to populate. + * @return {module:model/EthStakingExtraAllOfBeaconValidators} The populated EthStakingExtraAllOfBeaconValidators instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new EthStakingExtraAllOfBeaconValidators(); + + if (data.hasOwnProperty('pubkey')) { + obj['pubkey'] = ApiClient.convertToType(data['pubkey'], 'String'); + } + if (data.hasOwnProperty('status')) { + obj['status'] = AmountStatus.constructFromObject(data['status']); + } + if (data.hasOwnProperty('apy')) { + obj['apy'] = ApiClient.convertToType(data['apy'], 'Number'); + } + if (data.hasOwnProperty('staked_amount')) { + obj['staked_amount'] = ApiClient.convertToType(data['staked_amount'], 'String'); + } + if (data.hasOwnProperty('rewards_received')) { + obj['rewards_received'] = ApiClient.convertToType(data['rewards_received'], 'String'); + } + if (data.hasOwnProperty('updated_timestamp')) { + obj['updated_timestamp'] = ApiClient.convertToType(data['updated_timestamp'], 'Number'); + } + } + return obj; + } + + /** + * Validates the JSON data with respect to EthStakingExtraAllOfBeaconValidators. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to EthStakingExtraAllOfBeaconValidators. + */ + static validateJSON(data) { + // ensure the json data is a string + if (data['pubkey'] && !(typeof data['pubkey'] === 'string' || data['pubkey'] instanceof String)) { + throw new Error("Expected the field `pubkey` to be a primitive type in the JSON string but got " + data['pubkey']); + } + // ensure the json data is a string + if (data['staked_amount'] && !(typeof data['staked_amount'] === 'string' || data['staked_amount'] instanceof String)) { + throw new Error("Expected the field `staked_amount` to be a primitive type in the JSON string but got " + data['staked_amount']); + } + // ensure the json data is a string + if (data['rewards_received'] && !(typeof data['rewards_received'] === 'string' || data['rewards_received'] instanceof String)) { + throw new Error("Expected the field `rewards_received` to be a primitive type in the JSON string but got " + data['rewards_received']); + } + + return true; + } + + +} + + + +/** + * The public key of the validator. + * @member {String} pubkey + */ +EthStakingExtraAllOfBeaconValidators.prototype['pubkey'] = undefined; + +/** + * @member {module:model/AmountStatus} status + */ +EthStakingExtraAllOfBeaconValidators.prototype['status'] = undefined; + +/** + * The annual percentage yield (APY) of the validator. + * @member {Number} apy + */ +EthStakingExtraAllOfBeaconValidators.prototype['apy'] = undefined; + +/** + * The staked amount. + * @member {String} staked_amount + */ +EthStakingExtraAllOfBeaconValidators.prototype['staked_amount'] = undefined; + +/** + * The rewards received. + * @member {String} rewards_received + */ +EthStakingExtraAllOfBeaconValidators.prototype['rewards_received'] = undefined; + +/** + * The time when the validator's status was last updated, in Unix timestamp format and measured in milliseconds. + * @member {Number} updated_timestamp + */ +EthStakingExtraAllOfBeaconValidators.prototype['updated_timestamp'] = undefined; + + + + + + +export default EthStakingExtraAllOfBeaconValidators; + diff --git a/src/model/FeeAmount.js b/src/model/FeeAmount.js index 57837df4..9e250381 100644 --- a/src/model/FeeAmount.js +++ b/src/model/FeeAmount.js @@ -72,7 +72,7 @@ class FeeAmount { /** - * The fee that you need to pay for the transaction. + * The transaction fee that you need to pay for the transaction. * @member {String} fee_amount */ FeeAmount.prototype['fee_amount'] = undefined; diff --git a/src/model/FeeRate.js b/src/model/FeeRate.js index 1b92016c..5dc1d99e 100644 --- a/src/model/FeeRate.js +++ b/src/model/FeeRate.js @@ -231,7 +231,7 @@ FeeRate.prototype['fee_type'] = undefined; FeeRate.prototype['token_id'] = undefined; /** - * The fee that you need to pay for the transaction. + * The transaction fee that you need to pay for the transaction. * @member {String} fee_amount */ FeeRate.prototype['fee_amount'] = undefined; diff --git a/src/model/FixedFeeRate.js b/src/model/FixedFeeRate.js index 4ae7e39a..db837424 100644 --- a/src/model/FixedFeeRate.js +++ b/src/model/FixedFeeRate.js @@ -96,7 +96,7 @@ class FixedFeeRate { FixedFeeRate.RequiredProperties = ["fee_type", "token_id"]; /** - * The fee that you need to pay for the transaction. + * The transaction fee that you need to pay for the transaction. * @member {String} fee_amount */ FixedFeeRate.prototype['fee_amount'] = undefined; @@ -115,7 +115,7 @@ FixedFeeRate.prototype['token_id'] = undefined; // Implement FeeAmount interface: /** - * The fee that you need to pay for the transaction. + * The transaction fee that you need to pay for the transaction. * @member {String} fee_amount */ FeeAmount.prototype['fee_amount'] = undefined; diff --git a/src/model/GetStakingEstimationFeeRequest.js b/src/model/GetStakingEstimationFeeRequest.js index fc0e8d76..c61fd8d0 100644 --- a/src/model/GetStakingEstimationFeeRequest.js +++ b/src/model/GetStakingEstimationFeeRequest.js @@ -12,9 +12,11 @@ import ApiClient from '../ApiClient'; import ActivityType from './ActivityType'; import CreateUnstakeActivityExtra from './CreateUnstakeActivityExtra'; +import EstimateClaimFee from './EstimateClaimFee'; import EstimateStakeFee from './EstimateStakeFee'; import EstimateUnstakeFee from './EstimateUnstakeFee'; import EstimateWithdrawFee from './EstimateWithdrawFee'; +import StakingPoolId from './StakingPoolId'; import StakingSource from './StakingSource'; import TransactionRequestFee from './TransactionRequestFee'; @@ -26,7 +28,7 @@ class GetStakingEstimationFeeRequest { /** * Constructs a new GetStakingEstimationFeeRequest. * @alias module:model/GetStakingEstimationFeeRequest - * @param {(module:model/EstimateStakeFee|module:model/EstimateUnstakeFee|module:model/EstimateWithdrawFee)} instance The actual instance to initialize GetStakingEstimationFeeRequest. + * @param {(module:model/EstimateClaimFee|module:model/EstimateStakeFee|module:model/EstimateUnstakeFee|module:model/EstimateWithdrawFee)} instance The actual instance to initialize GetStakingEstimationFeeRequest. */ constructor(instance = null) { if (instance === null) { @@ -39,6 +41,10 @@ class GetStakingEstimationFeeRequest { if (discriminatorValue) { switch(discriminatorValue) { + case "Claim": + this.actualInstance = EstimateClaimFee.constructFromObject(instance); + match++; + break; case "Stake": this.actualInstance = EstimateStakeFee.constructFromObject(instance); match++; @@ -133,12 +139,37 @@ class GetStakingEstimationFeeRequest { errorMessages.push("Failed to construct EstimateWithdrawFee: " + err) } + try { + if (instance instanceof EstimateClaimFee) { + this.actualInstance = instance; + } else if(!!EstimateClaimFee.validateJSON && EstimateClaimFee.validateJSON(instance)){ + // plain JS object + // create EstimateClaimFee from JS object + this.actualInstance = EstimateClaimFee.constructFromObject(instance); + } else { + if(EstimateClaimFee.constructFromObject(instance)) { + if (!!EstimateClaimFee.constructFromObject(instance).toJSON) { + if (EstimateClaimFee.constructFromObject(instance).toJSON()) { + this.actualInstance = EstimateClaimFee.constructFromObject(instance); + } + } else { + this.actualInstance = EstimateClaimFee.constructFromObject(instance); + } + } + + } + match++; + } catch(err) { + // json data failed to deserialize into EstimateClaimFee + errorMessages.push("Failed to construct EstimateClaimFee: " + err) + } + // if (match > 1) { - // throw new Error("Multiple matches found constructing `GetStakingEstimationFeeRequest` with oneOf schemas EstimateStakeFee, EstimateUnstakeFee, EstimateWithdrawFee. Input: " + JSON.stringify(instance)); + // throw new Error("Multiple matches found constructing `GetStakingEstimationFeeRequest` with oneOf schemas EstimateClaimFee, EstimateStakeFee, EstimateUnstakeFee, EstimateWithdrawFee. Input: " + JSON.stringify(instance)); // } else if (match === 0) { // this.actualInstance = null; // clear the actual instance in case there are multiple matches - // throw new Error("No match found constructing `GetStakingEstimationFeeRequest` with oneOf schemas EstimateStakeFee, EstimateUnstakeFee, EstimateWithdrawFee. Details: " + + // throw new Error("No match found constructing `GetStakingEstimationFeeRequest` with oneOf schemas EstimateClaimFee, EstimateStakeFee, EstimateUnstakeFee, EstimateWithdrawFee. Details: " + // errorMessages.join(", ")); return; } else { // only 1 match @@ -158,16 +189,16 @@ class GetStakingEstimationFeeRequest { } /** - * Gets the actual instance, which can be EstimateStakeFee, EstimateUnstakeFee, EstimateWithdrawFee. - * @return {(module:model/EstimateStakeFee|module:model/EstimateUnstakeFee|module:model/EstimateWithdrawFee)} The actual instance. + * Gets the actual instance, which can be EstimateClaimFee, EstimateStakeFee, EstimateUnstakeFee, EstimateWithdrawFee. + * @return {(module:model/EstimateClaimFee|module:model/EstimateStakeFee|module:model/EstimateUnstakeFee|module:model/EstimateWithdrawFee)} The actual instance. */ getActualInstance() { return this.actualInstance; } /** - * Sets the actual instance, which can be EstimateStakeFee, EstimateUnstakeFee, EstimateWithdrawFee. - * @param {(module:model/EstimateStakeFee|module:model/EstimateUnstakeFee|module:model/EstimateWithdrawFee)} obj The actual instance. + * Sets the actual instance, which can be EstimateClaimFee, EstimateStakeFee, EstimateUnstakeFee, EstimateWithdrawFee. + * @param {(module:model/EstimateClaimFee|module:model/EstimateStakeFee|module:model/EstimateUnstakeFee|module:model/EstimateWithdrawFee)} obj The actual instance. */ setActualInstance(obj) { this.actualInstance = GetStakingEstimationFeeRequest.constructFromObject(obj).getActualInstance(); @@ -208,8 +239,7 @@ GetStakingEstimationFeeRequest.prototype['request_id'] = undefined; GetStakingEstimationFeeRequest.prototype['source'] = undefined; /** - * The ID of the staking pool. - * @member {String} pool_id + * @member {module:model/StakingPoolId} pool_id */ GetStakingEstimationFeeRequest.prototype['pool_id'] = undefined; @@ -230,19 +260,13 @@ GetStakingEstimationFeeRequest.prototype['fee'] = undefined; GetStakingEstimationFeeRequest.prototype['extra'] = undefined; /** - * The ID of the corresponding staking position. + * 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). * @member {String} staking_id */ GetStakingEstimationFeeRequest.prototype['staking_id'] = undefined; -/** - * The withdrawal address. - * @member {String} address - */ -GetStakingEstimationFeeRequest.prototype['address'] = undefined; - -GetStakingEstimationFeeRequest.OneOf = ["EstimateStakeFee", "EstimateUnstakeFee", "EstimateWithdrawFee"]; +GetStakingEstimationFeeRequest.OneOf = ["EstimateClaimFee", "EstimateStakeFee", "EstimateUnstakeFee", "EstimateWithdrawFee"]; export default GetStakingEstimationFeeRequest; diff --git a/src/model/MPCProject.js b/src/model/MPCProject.js index 8badd92f..69b9f435 100644 --- a/src/model/MPCProject.js +++ b/src/model/MPCProject.js @@ -60,8 +60,8 @@ class MPCProject { if (data.hasOwnProperty('threshold')) { obj['threshold'] = ApiClient.convertToType(data['threshold'], 'Number'); } - if (data.hasOwnProperty('create_timestamp')) { - obj['create_timestamp'] = ApiClient.convertToType(data['create_timestamp'], 'Number'); + if (data.hasOwnProperty('created_timestamp')) { + obj['created_timestamp'] = ApiClient.convertToType(data['created_timestamp'], 'Number'); } } return obj; @@ -126,9 +126,9 @@ MPCProject.prototype['threshold'] = undefined; /** * The project's creation time in Unix timestamp format, measured in milliseconds. - * @member {Number} create_timestamp + * @member {Number} created_timestamp */ -MPCProject.prototype['create_timestamp'] = undefined; +MPCProject.prototype['created_timestamp'] = undefined; diff --git a/src/model/MpcTransferSource.js b/src/model/MpcTransferSource.js index 550e441f..f297796c 100644 --- a/src/model/MpcTransferSource.js +++ b/src/model/MpcTransferSource.js @@ -131,7 +131,7 @@ MpcTransferSource.prototype['source_type'] = undefined; MpcTransferSource.prototype['wallet_id'] = undefined; /** - * The wallet address. If you want to specify the UTXOs to be used, please provide the `included_utxos` property. If you specify both the `address` and `included_utxos` properties, the specified included UTXOs must belong to the address. You need to provide either the `address` or `included_utxos` property. If neither property is provided, the transfer will fail. + * The wallet address. If you want to specify the UTXOs to be used, please provide the `included_utxos` property. If you specify both the `address` and `included_utxos` properties, the specified included UTXOs must belong to the address. It is recommended to specify no more than 100 included UTXOs to ensure optimal transaction processing. You need to provide either the `address` or `included_utxos` property. If neither property is provided, the transfer will fail. * @member {String} address */ MpcTransferSource.prototype['address'] = undefined; diff --git a/src/model/Pagination.js b/src/model/Pagination.js index b90db0fb..98336b12 100644 --- a/src/model/Pagination.js +++ b/src/model/Pagination.js @@ -22,7 +22,7 @@ class Pagination { * @alias module:model/Pagination * @param before {String} An object ID that serves as a starting point for retrieving data in reverse chronological order for the next request. If this property is empty, it means that you have reached the start of the data records. * @param after {String} An object ID that acts as a starting point for retrieving data in chronological order for the next request. If this property is empty, it means that you have reached the end of the data records. - * @param total_count {Number} The total number of records that match the query, across all pages. + * @param total_count {Number} The total number of records that match the query criteria, unaffected by the pagination parameters (`before` , `after`, and `limit`). */ constructor(before, after, total_count) { @@ -106,7 +106,7 @@ Pagination.prototype['before'] = undefined; Pagination.prototype['after'] = undefined; /** - * The total number of records that match the query, across all pages. + * The total number of records that match the query criteria, unaffected by the pagination parameters (`before` , `after`, and `limit`). * @member {Number} total_count */ Pagination.prototype['total_count'] = undefined; diff --git a/src/model/StakingPoolId.js b/src/model/StakingPoolId.js new file mode 100644 index 00000000..d406156e --- /dev/null +++ b/src/model/StakingPoolId.js @@ -0,0 +1,79 @@ +/** + * Cobo Wallet as a Service 2.0 + * + * Contact: help@cobo.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +import ApiClient from '../ApiClient'; +/** +* Enum class StakingPoolId. +* @enum {} +* @readonly +*/ +export default class StakingPoolId { + + /** + * value: "babylon_btc_signet" + * @const + */ + "babylon_btc_signet" = "babylon_btc_signet"; + + + /** + * value: "babylon_btc" + * @const + */ + "babylon_btc" = "babylon_btc"; + + + /** + * value: "beacon_eth" + * @const + */ + "beacon_eth" = "beacon_eth"; + + + /** + * value: "beacon_eth_holesky" + * @const + */ + "beacon_eth_holesky" = "beacon_eth_holesky"; + + + /** + * value: "core_btc" + * @const + */ + "core_btc" = "core_btc"; + + + /** + * value: "core_xtn" + * @const + */ + "core_xtn" = "core_xtn"; + + + /** + * value: "unknown_default_open_api" + * @const + */ + "unknown_default_open_api" = "unknown_default_open_api"; + + + + /** + * Returns a StakingPoolId enum value from a Javascript object name. + * @param {Object} data The plain JavaScript object containing the name of the enum value. + * @return {module:model/StakingPoolId} The enum StakingPoolId value. + */ + static constructFromObject(object) { + return object; + } +} + diff --git a/src/model/StakingPoolType.js b/src/model/StakingPoolType.js index 53b7d4f4..eb7fc512 100644 --- a/src/model/StakingPoolType.js +++ b/src/model/StakingPoolType.js @@ -31,6 +31,13 @@ export default class StakingPoolType { "ETHBeacon" = "ETHBeacon"; + /** + * value: "CoreBTC" + * @const + */ + "CoreBTC" = "CoreBTC"; + + /** * value: "unknown_default_open_api" * @const diff --git a/src/model/Stakings.js b/src/model/Stakings.js index 78d1abcd..d8d99d13 100644 --- a/src/model/Stakings.js +++ b/src/model/Stakings.js @@ -11,8 +11,9 @@ import ApiClient from '../ApiClient'; import AmountDetailsInner from './AmountDetailsInner'; +import BabylonValidator from './BabylonValidator'; +import StakingPoolId from './StakingPoolId'; import StakingsExtra from './StakingsExtra'; -import StakingsValidatorInfo from './StakingsValidatorInfo'; /** * The Stakings model module. @@ -27,11 +28,11 @@ class Stakings { * @param wallet_id {String} The staker's wallet ID. * @param address {String} The staker's wallet address. * @param amounts {Array.} The details about the staking amount. - * @param pool_id {String} The ID of the staking pool. + * @param pool_id {module:model/StakingPoolId} * @param token_id {String} The token ID. * @param created_timestamp {Number} The time when the staking position was created. * @param updated_timestamp {Number} The time when the staking position was last updated. - * @param validator_info {module:model/StakingsValidatorInfo} + * @param validator_info {module:model/BabylonValidator} */ constructor(id, wallet_id, address, amounts, pool_id, token_id, created_timestamp, updated_timestamp, validator_info) { @@ -79,7 +80,7 @@ class Stakings { obj['amounts'] = ApiClient.convertToType(data['amounts'], [AmountDetailsInner]); } if (data.hasOwnProperty('pool_id')) { - obj['pool_id'] = ApiClient.convertToType(data['pool_id'], 'String'); + obj['pool_id'] = StakingPoolId.constructFromObject(data['pool_id']); } if (data.hasOwnProperty('token_id')) { obj['token_id'] = ApiClient.convertToType(data['token_id'], 'String'); @@ -94,7 +95,7 @@ class Stakings { obj['updated_timestamp'] = ApiClient.convertToType(data['updated_timestamp'], 'Number'); } if (data.hasOwnProperty('validator_info')) { - obj['validator_info'] = StakingsValidatorInfo.constructFromObject(data['validator_info']); + obj['validator_info'] = BabylonValidator.constructFromObject(data['validator_info']); } if (data.hasOwnProperty('extra')) { obj['extra'] = StakingsExtra.constructFromObject(data['extra']); @@ -138,17 +139,13 @@ class Stakings { }; } // ensure the json data is a string - if (data['pool_id'] && !(typeof data['pool_id'] === 'string' || data['pool_id'] instanceof String)) { - throw new Error("Expected the field `pool_id` to be a primitive type in the JSON string but got " + data['pool_id']); - } - // ensure the json data is a string if (data['token_id'] && !(typeof data['token_id'] === 'string' || data['token_id'] instanceof String)) { throw new Error("Expected the field `token_id` to be a primitive type in the JSON string but got " + data['token_id']); } // validate the optional field `validator_info` if (data['validator_info']) { // data not null - if (!!StakingsValidatorInfo.validateJSON) { - StakingsValidatorInfo.validateJSON(data['validator_info']); + if (!!BabylonValidator.validateJSON) { + BabylonValidator.validateJSON(data['validator_info']); } } // validate the optional field `extra` @@ -191,8 +188,7 @@ Stakings.prototype['address'] = undefined; Stakings.prototype['amounts'] = undefined; /** - * The ID of the staking pool. - * @member {String} pool_id + * @member {module:model/StakingPoolId} pool_id */ Stakings.prototype['pool_id'] = undefined; @@ -221,7 +217,7 @@ Stakings.prototype['created_timestamp'] = undefined; Stakings.prototype['updated_timestamp'] = undefined; /** - * @member {module:model/StakingsValidatorInfo} validator_info + * @member {module:model/BabylonValidator} validator_info */ Stakings.prototype['validator_info'] = undefined; diff --git a/src/model/StakingsExtra.js b/src/model/StakingsExtra.js index 2c9af863..76a9202e 100644 --- a/src/model/StakingsExtra.js +++ b/src/model/StakingsExtra.js @@ -11,7 +11,9 @@ import ApiClient from '../ApiClient'; import BabylonStakingExtra from './BabylonStakingExtra'; +import CoreStakingExtra from './CoreStakingExtra'; import EthStakingExtra from './EthStakingExtra'; +import EthStakingExtraAllOfBeaconValidators from './EthStakingExtraAllOfBeaconValidators'; import StakingPoolType from './StakingPoolType'; /** @@ -22,7 +24,7 @@ class StakingsExtra { /** * Constructs a new StakingsExtra. * @alias module:model/StakingsExtra - * @param {(module:model/BabylonStakingExtra|module:model/EthStakingExtra)} instance The actual instance to initialize StakingsExtra. + * @param {(module:model/BabylonStakingExtra|module:model/CoreStakingExtra|module:model/EthStakingExtra)} instance The actual instance to initialize StakingsExtra. */ constructor(instance = null) { if (instance === null) { @@ -39,6 +41,10 @@ class StakingsExtra { this.actualInstance = BabylonStakingExtra.constructFromObject(instance); match++; break; + case "CoreBTC": + this.actualInstance = CoreStakingExtra.constructFromObject(instance); + match++; + break; case "ETHBeacon": this.actualInstance = EthStakingExtra.constructFromObject(instance); match++; @@ -100,12 +106,37 @@ class StakingsExtra { errorMessages.push("Failed to construct EthStakingExtra: " + err) } + try { + if (instance instanceof CoreStakingExtra) { + this.actualInstance = instance; + } else if(!!CoreStakingExtra.validateJSON && CoreStakingExtra.validateJSON(instance)){ + // plain JS object + // create CoreStakingExtra from JS object + this.actualInstance = CoreStakingExtra.constructFromObject(instance); + } else { + if(CoreStakingExtra.constructFromObject(instance)) { + if (!!CoreStakingExtra.constructFromObject(instance).toJSON) { + if (CoreStakingExtra.constructFromObject(instance).toJSON()) { + this.actualInstance = CoreStakingExtra.constructFromObject(instance); + } + } else { + this.actualInstance = CoreStakingExtra.constructFromObject(instance); + } + } + + } + match++; + } catch(err) { + // json data failed to deserialize into CoreStakingExtra + errorMessages.push("Failed to construct CoreStakingExtra: " + err) + } + // if (match > 1) { - // throw new Error("Multiple matches found constructing `StakingsExtra` with oneOf schemas BabylonStakingExtra, EthStakingExtra. Input: " + JSON.stringify(instance)); + // throw new Error("Multiple matches found constructing `StakingsExtra` with oneOf schemas BabylonStakingExtra, CoreStakingExtra, EthStakingExtra. Input: " + JSON.stringify(instance)); // } else if (match === 0) { // this.actualInstance = null; // clear the actual instance in case there are multiple matches - // throw new Error("No match found constructing `StakingsExtra` with oneOf schemas BabylonStakingExtra, EthStakingExtra. Details: " + + // throw new Error("No match found constructing `StakingsExtra` with oneOf schemas BabylonStakingExtra, CoreStakingExtra, EthStakingExtra. Details: " + // errorMessages.join(", ")); return; } else { // only 1 match @@ -125,16 +156,16 @@ class StakingsExtra { } /** - * Gets the actual instance, which can be BabylonStakingExtra, EthStakingExtra. - * @return {(module:model/BabylonStakingExtra|module:model/EthStakingExtra)} The actual instance. + * Gets the actual instance, which can be BabylonStakingExtra, CoreStakingExtra, EthStakingExtra. + * @return {(module:model/BabylonStakingExtra|module:model/CoreStakingExtra|module:model/EthStakingExtra)} The actual instance. */ getActualInstance() { return this.actualInstance; } /** - * Sets the actual instance, which can be BabylonStakingExtra, EthStakingExtra. - * @param {(module:model/BabylonStakingExtra|module:model/EthStakingExtra)} obj The actual instance. + * Sets the actual instance, which can be BabylonStakingExtra, CoreStakingExtra, EthStakingExtra. + * @param {(module:model/BabylonStakingExtra|module:model/CoreStakingExtra|module:model/EthStakingExtra)} obj The actual instance. */ setActualInstance(obj) { this.actualInstance = StakingsExtra.constructFromObject(obj).getActualInstance(); @@ -193,8 +224,38 @@ StakingsExtra.prototype['stake_address'] = undefined; */ StakingsExtra.prototype['unbond_address'] = undefined; +/** + * The list of validator information. + * @member {Array.} beacon_validators + */ +StakingsExtra.prototype['beacon_validators'] = undefined; + +/** + * The staker's Bitcoin address. + * @member {String} staker_address + */ +StakingsExtra.prototype['staker_address'] = undefined; + +/** + * The validator's EVM address. + * @member {String} validator_address + */ +StakingsExtra.prototype['validator_address'] = undefined; + +/** + * The EVM address to receive staking rewards. + * @member {String} reward_address + */ +StakingsExtra.prototype['reward_address'] = undefined; + +/** + * The Unix timestamp (in seconds) when the staking position will be unlocked and available for withdrawal. + * @member {Number} timelock + */ +StakingsExtra.prototype['timelock'] = undefined; + -StakingsExtra.OneOf = ["BabylonStakingExtra", "EthStakingExtra"]; +StakingsExtra.OneOf = ["BabylonStakingExtra", "CoreStakingExtra", "EthStakingExtra"]; export default StakingsExtra; diff --git a/src/model/StakingsValidatorInfo.js b/src/model/StakingsValidatorInfo.js deleted file mode 100644 index a1d77aee..00000000 --- a/src/model/StakingsValidatorInfo.js +++ /dev/null @@ -1,138 +0,0 @@ -/** - * Cobo Wallet as a Service 2.0 - * - * Contact: help@cobo.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - * - */ - -import ApiClient from '../ApiClient'; - -/** - * The StakingsValidatorInfo model module. - * @module model/StakingsValidatorInfo - */ -class StakingsValidatorInfo { - /** - * Constructs a new StakingsValidatorInfo. - * The information about the validator. - * @alias module:model/StakingsValidatorInfo - */ - constructor() { - - StakingsValidatorInfo.initialize(this); - } - - /** - * Initializes the fields of this object. - * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). - * Only for internal use. - */ - static initialize(obj) { - } - - /** - * Constructs a StakingsValidatorInfo from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/StakingsValidatorInfo} obj Optional instance to populate. - * @return {module:model/StakingsValidatorInfo} The populated StakingsValidatorInfo instance. - */ - static constructFromObject(data, obj) { - if (data) { - obj = obj || new StakingsValidatorInfo(); - - if (data.hasOwnProperty('icon_url')) { - obj['icon_url'] = ApiClient.convertToType(data['icon_url'], 'String'); - } - if (data.hasOwnProperty('public_key')) { - obj['public_key'] = ApiClient.convertToType(data['public_key'], 'String'); - } - if (data.hasOwnProperty('name')) { - obj['name'] = ApiClient.convertToType(data['name'], 'String'); - } - if (data.hasOwnProperty('address')) { - obj['address'] = ApiClient.convertToType(data['address'], 'String'); - } - if (data.hasOwnProperty('commission_rate')) { - obj['commission_rate'] = ApiClient.convertToType(data['commission_rate'], 'String'); - } - } - return obj; - } - - /** - * Validates the JSON data with respect to StakingsValidatorInfo. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @return {boolean} to indicate whether the JSON data is valid with respect to StakingsValidatorInfo. - */ - static validateJSON(data) { - // ensure the json data is a string - if (data['icon_url'] && !(typeof data['icon_url'] === 'string' || data['icon_url'] instanceof String)) { - throw new Error("Expected the field `icon_url` to be a primitive type in the JSON string but got " + data['icon_url']); - } - // ensure the json data is a string - if (data['public_key'] && !(typeof data['public_key'] === 'string' || data['public_key'] instanceof String)) { - throw new Error("Expected the field `public_key` to be a primitive type in the JSON string but got " + data['public_key']); - } - // ensure the json data is a string - if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) { - throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']); - } - // ensure the json data is a string - if (data['address'] && !(typeof data['address'] === 'string' || data['address'] instanceof String)) { - throw new Error("Expected the field `address` to be a primitive type in the JSON string but got " + data['address']); - } - // ensure the json data is a string - if (data['commission_rate'] && !(typeof data['commission_rate'] === 'string' || data['commission_rate'] instanceof String)) { - throw new Error("Expected the field `commission_rate` to be a primitive type in the JSON string but got " + data['commission_rate']); - } - - return true; - } - - -} - - - -/** - * The URL of the validator's icon. - * @member {String} icon_url - */ -StakingsValidatorInfo.prototype['icon_url'] = undefined; - -/** - * The validator's public key. - * @member {String} public_key - */ -StakingsValidatorInfo.prototype['public_key'] = undefined; - -/** - * The validator's name. - * @member {String} name - */ -StakingsValidatorInfo.prototype['name'] = undefined; - -/** - * The wallet address of the validator. - * @member {String} address - */ -StakingsValidatorInfo.prototype['address'] = undefined; - -/** - * The commission rate of the validator. - * @member {String} commission_rate - */ -StakingsValidatorInfo.prototype['commission_rate'] = undefined; - - - - - - -export default StakingsValidatorInfo; - diff --git a/src/model/TransactionRbf.js b/src/model/TransactionRbf.js index c6c1aad8..ed7fa093 100644 --- a/src/model/TransactionRbf.js +++ b/src/model/TransactionRbf.js @@ -10,6 +10,7 @@ */ import ApiClient from '../ApiClient'; +import AutoFuelType from './AutoFuelType'; import TransactionRbfSource from './TransactionRbfSource'; import TransactionRequestFee from './TransactionRequestFee'; @@ -66,6 +67,9 @@ class TransactionRbf { if (data.hasOwnProperty('description')) { obj['description'] = ApiClient.convertToType(data['description'], 'String'); } + if (data.hasOwnProperty('auto_fuel')) { + obj['auto_fuel'] = AutoFuelType.constructFromObject(data['auto_fuel']); + } } return obj; } @@ -143,6 +147,11 @@ TransactionRbf.prototype['category_names'] = undefined; */ TransactionRbf.prototype['description'] = undefined; +/** + * @member {module:model/AutoFuelType} auto_fuel + */ +TransactionRbf.prototype['auto_fuel'] = undefined; + diff --git a/src/model/TransactionRbfSource.js b/src/model/TransactionRbfSource.js index a78e32b2..10fa7f96 100644 --- a/src/model/TransactionRbfSource.js +++ b/src/model/TransactionRbfSource.js @@ -145,7 +145,7 @@ TransactionRbfSource.prototype['source_type'] = undefined; TransactionRbfSource.prototype['wallet_id'] = undefined; /** - * The wallet address. If you want to specify the UTXOs to be used, please provide the `included_utxos` property. If you specify both the `address` and `included_utxos` properties, the specified included UTXOs must belong to the address. You need to provide either the `address` or `included_utxos` property. If neither property is provided, the transfer will fail. + * The wallet address. If you want to specify the UTXOs to be used, please provide the `included_utxos` property. If you specify both the `address` and `included_utxos` properties, the specified included UTXOs must belong to the address. It is recommended to specify no more than 100 included UTXOs to ensure optimal transaction processing. You need to provide either the `address` or `included_utxos` property. If neither property is provided, the transfer will fail. * @member {String} address */ TransactionRbfSource.prototype['address'] = undefined; diff --git a/src/model/TransactionRequestEvmEip1559Fee.js b/src/model/TransactionRequestEvmEip1559Fee.js index b44d2850..8c53d4d6 100644 --- a/src/model/TransactionRequestEvmEip1559Fee.js +++ b/src/model/TransactionRequestEvmEip1559Fee.js @@ -20,7 +20,7 @@ import FeeType from './FeeType'; class TransactionRequestEvmEip1559Fee { /** * Constructs a new TransactionRequestEvmEip1559Fee. - * The preset properties to limit transaction fee. In the EIP-1559 fee model, the transaction fee is calculated by multiplying the gas price and the gas units used by the transaction. This can be expressed as: Transaction fee = gas price * gas units used. You can specify the maximum gas fee per gas unit, maximum priority fee per gas unit, and the gas limit to limit the gas price, priority fee per gas unit, gas units used in the transaction. Switch between the tabs to display the properties for different transaction fee models. + * The preset properties to limit transaction fee. In the EIP-1559 fee model, the transaction fee is calculated by multiplying the gas price and the gas units used by the transaction. This can be expressed as: Transaction fee = gas price * gas units used. For more information about the EIP-1559 fee model, refer to [Fee models](/v2/guides/transactions/estimate-fees#fee-models). You can specify the maximum gas fee per gas unit, maximum priority fee per gas unit, and the gas limit to limit the gas price, priority fee per gas unit, gas units used in the transaction. Switch between the tabs to display the properties for different transaction fee models. * @alias module:model/TransactionRequestEvmEip1559Fee * @implements module:model/EvmEip1559FeeBasePrice * @param max_fee_per_gas {String} The maximum gas fee per gas unit used on the chain, in wei. diff --git a/src/model/TransactionRequestEvmLegacyFee.js b/src/model/TransactionRequestEvmLegacyFee.js index 151386d1..8e0f88b1 100644 --- a/src/model/TransactionRequestEvmLegacyFee.js +++ b/src/model/TransactionRequestEvmLegacyFee.js @@ -20,7 +20,7 @@ import FeeType from './FeeType'; class TransactionRequestEvmLegacyFee { /** * Constructs a new TransactionRequestEvmLegacyFee. - * The preset properties to limit transaction fee. In the legacy fee model, the transaction fee is calculated by multiplying the gas price by the gas units used by the transaction. This can be expressed as: Transaction fee = (gas price * gas units used). You can specify the gas limit to limit the gas units used in the transaction. Switch between the tabs to display the properties for different transaction fee models. + * The preset properties to limit transaction fee. In the legacy fee model, the transaction fee is calculated by multiplying the gas price by the gas units used by the transaction. This can be expressed as: Transaction fee = (gas price * gas units used). For more information about the legacy fee model, refer to [Fee models](/v2/guides/transactions/estimate-fees#fee-models). You can specify the gas limit to limit the gas units used in the transaction. Switch between the tabs to display the properties for different transaction fee models. * @alias module:model/TransactionRequestEvmLegacyFee * @implements module:model/EvmLegacyFeeBasePrice * @param gas_price {String} The gas price, in wei. The gas price represents the amount of ETH that must be paid to validators for processing transactions per gas unit used. diff --git a/src/model/TransactionRequestFixedFee.js b/src/model/TransactionRequestFixedFee.js index a2634299..60f7a85b 100644 --- a/src/model/TransactionRequestFixedFee.js +++ b/src/model/TransactionRequestFixedFee.js @@ -20,7 +20,7 @@ import MaxFeeAmount from './MaxFeeAmount'; class TransactionRequestFixedFee { /** * Constructs a new TransactionRequestFixedFee. - * The preset properties to limit transaction fee. In the fixed fee model, the transaction fee is a fixed amount within a certain amount of period regardless of the transaction size or network congestion, which can vary between different chains. You can specify the maximum fee amount to limit the transaction fee. The transaction will fail if the transaction fee exceeds the specified maximum fee amount. Switch between the tabs to display the properties for different transaction fee models. + * The preset properties to limit transaction fee. In the fixed fee model, the transaction fee is a fixed amount within a certain amount of period regardless of the transaction size or network congestion, which can vary between different chains. For more information about the fixed fee model, refer to [Fee models](/v2/guides/transactions/estimate-fees#fee-models). You can specify the maximum fee amount to limit the transaction fee. The transaction will fail if the transaction fee exceeds the specified maximum fee amount. Switch between the tabs to display the properties for different transaction fee models. * @alias module:model/TransactionRequestFixedFee * @implements module:model/MaxFeeAmount * @param fee_type {module:model/FeeType} diff --git a/src/model/TransactionRequestUtxoFee.js b/src/model/TransactionRequestUtxoFee.js index 13244dc9..e114cdea 100644 --- a/src/model/TransactionRequestUtxoFee.js +++ b/src/model/TransactionRequestUtxoFee.js @@ -20,7 +20,7 @@ import UtxoFeeBasePrice from './UtxoFeeBasePrice'; class TransactionRequestUtxoFee { /** * Constructs a new TransactionRequestUtxoFee. - * The preset properties to limit transaction fee. In the UTXO fee model, the transaction fee is calculated by multiplying the fee rate by the transaction size. This can be expressed as: Transaction fee = fee rate * transaction size. You can specify the maximum fee amount to limit the transaction fee. The transaction will fail if the transaction fee exceeds the specified maximum fee amount. Switch between the tabs to display the properties for different transaction fee models. + * The preset properties to limit transaction fee. In the UTXO fee model, the transaction fee is calculated by multiplying the fee rate by the transaction size. This can be expressed as: Transaction fee = fee rate * transaction size. For more information about the UTXO fee model, see [Fee models](/v2/guides/transactions/estimate-fees#fee-models). You can specify the maximum fee amount to limit the transaction fee. The transaction will fail if the transaction fee exceeds the specified maximum fee amount. Switch between the tabs to display the properties for different transaction fee models. * @alias module:model/TransactionRequestUtxoFee * @implements module:model/UtxoFeeBasePrice * @param fee_rate {String} The fee rate in sat/vByte. The fee rate represents the satoshis you are willing to pay for each byte of data that your transaction will consume on the blockchain. diff --git a/src/model/TransferParams.js b/src/model/TransferParams.js index 097441c3..e4683487 100644 --- a/src/model/TransferParams.js +++ b/src/model/TransferParams.js @@ -10,6 +10,7 @@ */ import ApiClient from '../ApiClient'; +import AutoFuelType from './AutoFuelType'; import TransactionRequestFee from './TransactionRequestFee'; import TransferDestination from './TransferDestination'; import TransferSource from './TransferSource'; @@ -77,6 +78,9 @@ class TransferParams { if (data.hasOwnProperty('fee')) { obj['fee'] = TransactionRequestFee.constructFromObject(data['fee']); } + if (data.hasOwnProperty('auto_fuel')) { + obj['auto_fuel'] = AutoFuelType.constructFromObject(data['auto_fuel']); + } } return obj; } @@ -175,6 +179,11 @@ TransferParams.prototype['description'] = undefined; */ TransferParams.prototype['fee'] = undefined; +/** + * @member {module:model/AutoFuelType} auto_fuel + */ +TransferParams.prototype['auto_fuel'] = undefined; + diff --git a/test/api/StakingsApi.spec.js b/test/api/StakingsApi.spec.js index 2e34904e..8177d012 100644 --- a/test/api/StakingsApi.spec.js +++ b/test/api/StakingsApi.spec.js @@ -36,6 +36,16 @@ import {ApiClient, Env} from "../../src/index.js"; }); describe('StakingsApi', function() { + describe('createClaimActivity', function() { + it('should call createClaimActivity successfully', function() { + //uncomment below and update the code to test createClaimActivity + //instance.createClaimActivity().then(function(data) { + // console.log(data); + //}, function(error) { + // console.error(error); + //}); + }); + }); describe('createStakeActivity', function() { it('should call createStakeActivity successfully', function() { //uncomment below and update the code to test createStakeActivity @@ -96,6 +106,16 @@ import {ApiClient, Env} from "../../src/index.js"; //}); }); }); + describe('getStakingEstimationFeeV2', function() { + it('should call getStakingEstimationFeeV2 successfully', function() { + //uncomment below and update the code to test getStakingEstimationFeeV2 + //instance.getStakingEstimationFeeV2().then(function(data) { + // console.log(data); + //}, function(error) { + // console.error(error); + //}); + }); + }); describe('getStakingPoolById', function() { it('should call getStakingPoolById successfully', function() { //uncomment below and update the code to test getStakingPoolById diff --git a/test/model/AutoFuelType.spec.js b/test/model/AutoFuelType.spec.js new file mode 100644 index 00000000..b23c9532 --- /dev/null +++ b/test/model/AutoFuelType.spec.js @@ -0,0 +1,56 @@ +/** + * Cobo Wallet as a Service 2.0 + * + * Contact: help@cobo.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', process.cwd()+'/src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require(process.cwd()+'/src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.CoboWaas2); + } +}(this, function(expect, CoboWaas2) { + 'use strict'; + + var instance; + + beforeEach(function() { + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('AutoFuelType', function() { + it('should create an instance of AutoFuelType', function() { + // uncomment below and update the code to test AutoFuelType + //var instance = new CoboWaas2.AutoFuelType(); + //expect(instance).to.be.a(CoboWaas2.AutoFuelType); + }); + + }); + +})); diff --git a/test/model/ContractCallParams.spec.js b/test/model/ContractCallParams.spec.js index 8fad4d9c..abe51131 100644 --- a/test/model/ContractCallParams.spec.js +++ b/test/model/ContractCallParams.spec.js @@ -94,6 +94,12 @@ //expect(instance).to.be(); }); + it('should have the property auto_fuel (base name: "auto_fuel")', function() { + // uncomment below and update the code to test the property auto_fuel + //var instance = new CoboWaas2.ContractCallParams(); + //expect(instance).to.be(); + }); + }); })); diff --git a/test/model/StakingsValidatorInfo.spec.js b/test/model/CoreStakeExtra.spec.js similarity index 62% rename from test/model/StakingsValidatorInfo.spec.js rename to test/model/CoreStakeExtra.spec.js index cb7f6bbd..91eb542d 100644 --- a/test/model/StakingsValidatorInfo.spec.js +++ b/test/model/CoreStakeExtra.spec.js @@ -26,7 +26,7 @@ var instance; beforeEach(function() { - instance = new CoboWaas2.StakingsValidatorInfo(); + instance = new CoboWaas2.CoreStakeExtra(); }); var getProperty = function(object, getter, property) { @@ -45,40 +45,40 @@ object[property] = value; } - describe('StakingsValidatorInfo', function() { - it('should create an instance of StakingsValidatorInfo', function() { - // uncomment below and update the code to test StakingsValidatorInfo - //var instance = new CoboWaas2.StakingsValidatorInfo(); - //expect(instance).to.be.a(CoboWaas2.StakingsValidatorInfo); + describe('CoreStakeExtra', function() { + it('should create an instance of CoreStakeExtra', function() { + // uncomment below and update the code to test CoreStakeExtra + //var instance = new CoboWaas2.CoreStakeExtra(); + //expect(instance).to.be.a(CoboWaas2.CoreStakeExtra); }); - it('should have the property icon_url (base name: "icon_url")', function() { - // uncomment below and update the code to test the property icon_url - //var instance = new CoboWaas2.StakingsValidatorInfo(); + it('should have the property pool_type (base name: "pool_type")', function() { + // uncomment below and update the code to test the property pool_type + //var instance = new CoboWaas2.CoreStakeExtra(); //expect(instance).to.be(); }); - it('should have the property public_key (base name: "public_key")', function() { - // uncomment below and update the code to test the property public_key - //var instance = new CoboWaas2.StakingsValidatorInfo(); + it('should have the property timelock (base name: "timelock")', function() { + // uncomment below and update the code to test the property timelock + //var instance = new CoboWaas2.CoreStakeExtra(); //expect(instance).to.be(); }); - it('should have the property name (base name: "name")', function() { - // uncomment below and update the code to test the property name - //var instance = new CoboWaas2.StakingsValidatorInfo(); + it('should have the property change_address (base name: "change_address")', function() { + // uncomment below and update the code to test the property change_address + //var instance = new CoboWaas2.CoreStakeExtra(); //expect(instance).to.be(); }); - it('should have the property address (base name: "address")', function() { - // uncomment below and update the code to test the property address - //var instance = new CoboWaas2.StakingsValidatorInfo(); + it('should have the property validator_address (base name: "validator_address")', function() { + // uncomment below and update the code to test the property validator_address + //var instance = new CoboWaas2.CoreStakeExtra(); //expect(instance).to.be(); }); - it('should have the property commission_rate (base name: "commission_rate")', function() { - // uncomment below and update the code to test the property commission_rate - //var instance = new CoboWaas2.StakingsValidatorInfo(); + it('should have the property reward_address (base name: "reward_address")', function() { + // uncomment below and update the code to test the property reward_address + //var instance = new CoboWaas2.CoreStakeExtra(); //expect(instance).to.be(); }); diff --git a/test/model/CoreStakingExtra.spec.js b/test/model/CoreStakingExtra.spec.js new file mode 100644 index 00000000..1c915476 --- /dev/null +++ b/test/model/CoreStakingExtra.spec.js @@ -0,0 +1,93 @@ +/** + * Cobo Wallet as a Service 2.0 + * + * Contact: help@cobo.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', process.cwd()+'/src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require(process.cwd()+'/src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.CoboWaas2); + } +}(this, function(expect, CoboWaas2) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new CoboWaas2.CoreStakingExtra(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('CoreStakingExtra', function() { + it('should create an instance of CoreStakingExtra', function() { + // uncomment below and update the code to test CoreStakingExtra + //var instance = new CoboWaas2.CoreStakingExtra(); + //expect(instance).to.be.a(CoboWaas2.CoreStakingExtra); + }); + + it('should have the property pool_type (base name: "pool_type")', function() { + // uncomment below and update the code to test the property pool_type + //var instance = new CoboWaas2.CoreStakingExtra(); + //expect(instance).to.be(); + }); + + it('should have the property pos_chain (base name: "pos_chain")', function() { + // uncomment below and update the code to test the property pos_chain + //var instance = new CoboWaas2.CoreStakingExtra(); + //expect(instance).to.be(); + }); + + it('should have the property staker_address (base name: "staker_address")', function() { + // uncomment below and update the code to test the property staker_address + //var instance = new CoboWaas2.CoreStakingExtra(); + //expect(instance).to.be(); + }); + + it('should have the property validator_address (base name: "validator_address")', function() { + // uncomment below and update the code to test the property validator_address + //var instance = new CoboWaas2.CoreStakingExtra(); + //expect(instance).to.be(); + }); + + it('should have the property reward_address (base name: "reward_address")', function() { + // uncomment below and update the code to test the property reward_address + //var instance = new CoboWaas2.CoreStakingExtra(); + //expect(instance).to.be(); + }); + + it('should have the property timelock (base name: "timelock")', function() { + // uncomment below and update the code to test the property timelock + //var instance = new CoboWaas2.CoreStakingExtra(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/test/model/CreateClaimActivity.spec.js b/test/model/CreateClaimActivity.spec.js new file mode 100644 index 00000000..1339e1f8 --- /dev/null +++ b/test/model/CreateClaimActivity.spec.js @@ -0,0 +1,75 @@ +/** + * Cobo Wallet as a Service 2.0 + * + * Contact: help@cobo.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', process.cwd()+'/src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require(process.cwd()+'/src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.CoboWaas2); + } +}(this, function(expect, CoboWaas2) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new CoboWaas2.CreateClaimActivity(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('CreateClaimActivity', function() { + it('should create an instance of CreateClaimActivity', function() { + // uncomment below and update the code to test CreateClaimActivity + //var instance = new CoboWaas2.CreateClaimActivity(); + //expect(instance).to.be.a(CoboWaas2.CreateClaimActivity); + }); + + it('should have the property request_id (base name: "request_id")', function() { + // uncomment below and update the code to test the property request_id + //var instance = new CoboWaas2.CreateClaimActivity(); + //expect(instance).to.be(); + }); + + it('should have the property staking_id (base name: "staking_id")', function() { + // uncomment below and update the code to test the property staking_id + //var instance = new CoboWaas2.CreateClaimActivity(); + //expect(instance).to.be(); + }); + + it('should have the property fee (base name: "fee")', function() { + // uncomment below and update the code to test the property fee + //var instance = new CoboWaas2.CreateClaimActivity(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/test/model/CreateClaimActivityRequest.spec.js b/test/model/CreateClaimActivityRequest.spec.js new file mode 100644 index 00000000..8b55dac4 --- /dev/null +++ b/test/model/CreateClaimActivityRequest.spec.js @@ -0,0 +1,81 @@ +/** + * Cobo Wallet as a Service 2.0 + * + * Contact: help@cobo.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', process.cwd()+'/src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require(process.cwd()+'/src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.CoboWaas2); + } +}(this, function(expect, CoboWaas2) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new CoboWaas2.CreateClaimActivityRequest(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('CreateClaimActivityRequest', function() { + it('should create an instance of CreateClaimActivityRequest', function() { + // uncomment below and update the code to test CreateClaimActivityRequest + //var instance = new CoboWaas2.CreateClaimActivityRequest(); + //expect(instance).to.be.a(CoboWaas2.CreateClaimActivityRequest); + }); + + it('should have the property request_id (base name: "request_id")', function() { + // uncomment below and update the code to test the property request_id + //var instance = new CoboWaas2.CreateClaimActivityRequest(); + //expect(instance).to.be(); + }); + + it('should have the property staking_id (base name: "staking_id")', function() { + // uncomment below and update the code to test the property staking_id + //var instance = new CoboWaas2.CreateClaimActivityRequest(); + //expect(instance).to.be(); + }); + + it('should have the property fee (base name: "fee")', function() { + // uncomment below and update the code to test the property fee + //var instance = new CoboWaas2.CreateClaimActivityRequest(); + //expect(instance).to.be(); + }); + + it('should have the property app_initiator (base name: "app_initiator")', function() { + // uncomment below and update the code to test the property app_initiator + //var instance = new CoboWaas2.CreateClaimActivityRequest(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/test/model/CreateStakeActivityExtra.spec.js b/test/model/CreateStakeActivityExtra.spec.js index 3c57c08d..dc9fc8b6 100644 --- a/test/model/CreateStakeActivityExtra.spec.js +++ b/test/model/CreateStakeActivityExtra.spec.js @@ -82,6 +82,30 @@ //expect(instance).to.be(); }); + it('should have the property timelock (base name: "timelock")', function() { + // uncomment below and update the code to test the property timelock + //var instance = new CoboWaas2.CreateStakeActivityExtra(); + //expect(instance).to.be(); + }); + + it('should have the property change_address (base name: "change_address")', function() { + // uncomment below and update the code to test the property change_address + //var instance = new CoboWaas2.CreateStakeActivityExtra(); + //expect(instance).to.be(); + }); + + it('should have the property validator_address (base name: "validator_address")', function() { + // uncomment below and update the code to test the property validator_address + //var instance = new CoboWaas2.CreateStakeActivityExtra(); + //expect(instance).to.be(); + }); + + it('should have the property reward_address (base name: "reward_address")', function() { + // uncomment below and update the code to test the property reward_address + //var instance = new CoboWaas2.CreateStakeActivityExtra(); + //expect(instance).to.be(); + }); + }); })); diff --git a/test/model/CreateWithdrawActivity.spec.js b/test/model/CreateWithdrawActivity.spec.js index 1a08419e..afb90372 100644 --- a/test/model/CreateWithdrawActivity.spec.js +++ b/test/model/CreateWithdrawActivity.spec.js @@ -70,12 +70,6 @@ //expect(instance).to.be(); }); - it('should have the property address (base name: "address")', function() { - // uncomment below and update the code to test the property address - //var instance = new CoboWaas2.CreateWithdrawActivity(); - //expect(instance).to.be(); - }); - it('should have the property fee (base name: "fee")', function() { // uncomment below and update the code to test the property fee //var instance = new CoboWaas2.CreateWithdrawActivity(); diff --git a/test/model/CreateWithdrawActivityRequest.spec.js b/test/model/CreateWithdrawActivityRequest.spec.js index aa3c23dd..7af982db 100644 --- a/test/model/CreateWithdrawActivityRequest.spec.js +++ b/test/model/CreateWithdrawActivityRequest.spec.js @@ -70,12 +70,6 @@ //expect(instance).to.be(); }); - it('should have the property address (base name: "address")', function() { - // uncomment below and update the code to test the property address - //var instance = new CoboWaas2.CreateWithdrawActivityRequest(); - //expect(instance).to.be(); - }); - it('should have the property fee (base name: "fee")', function() { // uncomment below and update the code to test the property fee //var instance = new CoboWaas2.CreateWithdrawActivityRequest(); diff --git a/test/model/EstimateClaimFee.spec.js b/test/model/EstimateClaimFee.spec.js new file mode 100644 index 00000000..a880f861 --- /dev/null +++ b/test/model/EstimateClaimFee.spec.js @@ -0,0 +1,75 @@ +/** + * Cobo Wallet as a Service 2.0 + * + * Contact: help@cobo.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', process.cwd()+'/src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require(process.cwd()+'/src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.CoboWaas2); + } +}(this, function(expect, CoboWaas2) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new CoboWaas2.EstimateClaimFee(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('EstimateClaimFee', function() { + it('should create an instance of EstimateClaimFee', function() { + // uncomment below and update the code to test EstimateClaimFee + //var instance = new CoboWaas2.EstimateClaimFee(); + //expect(instance).to.be.a(CoboWaas2.EstimateClaimFee); + }); + + it('should have the property activity_type (base name: "activity_type")', function() { + // uncomment below and update the code to test the property activity_type + //var instance = new CoboWaas2.EstimateClaimFee(); + //expect(instance).to.be(); + }); + + it('should have the property staking_id (base name: "staking_id")', function() { + // uncomment below and update the code to test the property staking_id + //var instance = new CoboWaas2.EstimateClaimFee(); + //expect(instance).to.be(); + }); + + it('should have the property fee (base name: "fee")', function() { + // uncomment below and update the code to test the property fee + //var instance = new CoboWaas2.EstimateClaimFee(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/test/model/EstimateWithdrawFee.spec.js b/test/model/EstimateWithdrawFee.spec.js index 13dab083..b7a1511e 100644 --- a/test/model/EstimateWithdrawFee.spec.js +++ b/test/model/EstimateWithdrawFee.spec.js @@ -76,12 +76,6 @@ //expect(instance).to.be(); }); - it('should have the property address (base name: "address")', function() { - // uncomment below and update the code to test the property address - //var instance = new CoboWaas2.EstimateWithdrawFee(); - //expect(instance).to.be(); - }); - it('should have the property fee (base name: "fee")', function() { // uncomment below and update the code to test the property fee //var instance = new CoboWaas2.EstimateWithdrawFee(); diff --git a/test/model/EthStakingExtra.spec.js b/test/model/EthStakingExtra.spec.js index 05d00302..ce4a38e1 100644 --- a/test/model/EthStakingExtra.spec.js +++ b/test/model/EthStakingExtra.spec.js @@ -64,6 +64,12 @@ //expect(instance).to.be(); }); + it('should have the property beacon_validators (base name: "beacon_validators")', function() { + // uncomment below and update the code to test the property beacon_validators + //var instance = new CoboWaas2.EthStakingExtra(); + //expect(instance).to.be(); + }); + }); })); diff --git a/test/model/EthStakingExtraAllOfBeaconValidators.spec.js b/test/model/EthStakingExtraAllOfBeaconValidators.spec.js new file mode 100644 index 00000000..7cb38207 --- /dev/null +++ b/test/model/EthStakingExtraAllOfBeaconValidators.spec.js @@ -0,0 +1,93 @@ +/** + * Cobo Wallet as a Service 2.0 + * + * Contact: help@cobo.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', process.cwd()+'/src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require(process.cwd()+'/src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.CoboWaas2); + } +}(this, function(expect, CoboWaas2) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new CoboWaas2.EthStakingExtraAllOfBeaconValidators(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('EthStakingExtraAllOfBeaconValidators', function() { + it('should create an instance of EthStakingExtraAllOfBeaconValidators', function() { + // uncomment below and update the code to test EthStakingExtraAllOfBeaconValidators + //var instance = new CoboWaas2.EthStakingExtraAllOfBeaconValidators(); + //expect(instance).to.be.a(CoboWaas2.EthStakingExtraAllOfBeaconValidators); + }); + + it('should have the property pubkey (base name: "pubkey")', function() { + // uncomment below and update the code to test the property pubkey + //var instance = new CoboWaas2.EthStakingExtraAllOfBeaconValidators(); + //expect(instance).to.be(); + }); + + it('should have the property status (base name: "status")', function() { + // uncomment below and update the code to test the property status + //var instance = new CoboWaas2.EthStakingExtraAllOfBeaconValidators(); + //expect(instance).to.be(); + }); + + it('should have the property apy (base name: "apy")', function() { + // uncomment below and update the code to test the property apy + //var instance = new CoboWaas2.EthStakingExtraAllOfBeaconValidators(); + //expect(instance).to.be(); + }); + + it('should have the property staked_amount (base name: "staked_amount")', function() { + // uncomment below and update the code to test the property staked_amount + //var instance = new CoboWaas2.EthStakingExtraAllOfBeaconValidators(); + //expect(instance).to.be(); + }); + + it('should have the property rewards_received (base name: "rewards_received")', function() { + // uncomment below and update the code to test the property rewards_received + //var instance = new CoboWaas2.EthStakingExtraAllOfBeaconValidators(); + //expect(instance).to.be(); + }); + + it('should have the property updated_timestamp (base name: "updated_timestamp")', function() { + // uncomment below and update the code to test the property updated_timestamp + //var instance = new CoboWaas2.EthStakingExtraAllOfBeaconValidators(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/test/model/GetStakingEstimationFeeRequest.spec.js b/test/model/GetStakingEstimationFeeRequest.spec.js index afdb8843..88c9a2af 100644 --- a/test/model/GetStakingEstimationFeeRequest.spec.js +++ b/test/model/GetStakingEstimationFeeRequest.spec.js @@ -100,12 +100,6 @@ //expect(instance).to.be(); }); - it('should have the property address (base name: "address")', function() { - // uncomment below and update the code to test the property address - //var instance = new CoboWaas2.GetStakingEstimationFeeRequest(); - //expect(instance).to.be(); - }); - }); })); diff --git a/test/model/MPCProject.spec.js b/test/model/MPCProject.spec.js index 96be1fdc..6a6a1c0c 100644 --- a/test/model/MPCProject.spec.js +++ b/test/model/MPCProject.spec.js @@ -82,8 +82,8 @@ //expect(instance).to.be(); }); - it('should have the property create_timestamp (base name: "create_timestamp")', function() { - // uncomment below and update the code to test the property create_timestamp + it('should have the property created_timestamp (base name: "created_timestamp")', function() { + // uncomment below and update the code to test the property created_timestamp //var instance = new CoboWaas2.MPCProject(); //expect(instance).to.be(); }); diff --git a/test/model/StakingPoolId.spec.js b/test/model/StakingPoolId.spec.js new file mode 100644 index 00000000..b53d5ba4 --- /dev/null +++ b/test/model/StakingPoolId.spec.js @@ -0,0 +1,56 @@ +/** + * Cobo Wallet as a Service 2.0 + * + * Contact: help@cobo.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', process.cwd()+'/src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require(process.cwd()+'/src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.CoboWaas2); + } +}(this, function(expect, CoboWaas2) { + 'use strict'; + + var instance; + + beforeEach(function() { + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('StakingPoolId', function() { + it('should create an instance of StakingPoolId', function() { + // uncomment below and update the code to test StakingPoolId + //var instance = new CoboWaas2.StakingPoolId(); + //expect(instance).to.be.a(CoboWaas2.StakingPoolId); + }); + + }); + +})); diff --git a/test/model/StakingsExtra.spec.js b/test/model/StakingsExtra.spec.js index c4bb71b8..06c97b3d 100644 --- a/test/model/StakingsExtra.spec.js +++ b/test/model/StakingsExtra.spec.js @@ -88,6 +88,36 @@ //expect(instance).to.be(); }); + it('should have the property beacon_validators (base name: "beacon_validators")', function() { + // uncomment below and update the code to test the property beacon_validators + //var instance = new CoboWaas2.StakingsExtra(); + //expect(instance).to.be(); + }); + + it('should have the property staker_address (base name: "staker_address")', function() { + // uncomment below and update the code to test the property staker_address + //var instance = new CoboWaas2.StakingsExtra(); + //expect(instance).to.be(); + }); + + it('should have the property validator_address (base name: "validator_address")', function() { + // uncomment below and update the code to test the property validator_address + //var instance = new CoboWaas2.StakingsExtra(); + //expect(instance).to.be(); + }); + + it('should have the property reward_address (base name: "reward_address")', function() { + // uncomment below and update the code to test the property reward_address + //var instance = new CoboWaas2.StakingsExtra(); + //expect(instance).to.be(); + }); + + it('should have the property timelock (base name: "timelock")', function() { + // uncomment below and update the code to test the property timelock + //var instance = new CoboWaas2.StakingsExtra(); + //expect(instance).to.be(); + }); + }); })); diff --git a/test/model/TransactionRbf.spec.js b/test/model/TransactionRbf.spec.js index 3ffb5265..6050e4b9 100644 --- a/test/model/TransactionRbf.spec.js +++ b/test/model/TransactionRbf.spec.js @@ -82,6 +82,12 @@ //expect(instance).to.be(); }); + it('should have the property auto_fuel (base name: "auto_fuel")', function() { + // uncomment below and update the code to test the property auto_fuel + //var instance = new CoboWaas2.TransactionRbf(); + //expect(instance).to.be(); + }); + }); })); diff --git a/test/model/TransferParams.spec.js b/test/model/TransferParams.spec.js index 51f923b0..f34a20d8 100644 --- a/test/model/TransferParams.spec.js +++ b/test/model/TransferParams.spec.js @@ -94,6 +94,12 @@ //expect(instance).to.be(); }); + it('should have the property auto_fuel (base name: "auto_fuel")', function() { + // uncomment below and update the code to test the property auto_fuel + //var instance = new CoboWaas2.TransferParams(); + //expect(instance).to.be(); + }); + }); }));