Skip to content

Commit

Permalink
Merge pull request #7 from zhangjun1113/master
Browse files Browse the repository at this point in the history
Fix OneOf model validate issue
  • Loading branch information
cobosteven authored Aug 15, 2024
2 parents dffc05c + 13b1864 commit 3448d4b
Show file tree
Hide file tree
Showing 84 changed files with 523 additions and 3,511 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ For more information about the WaaS 2.0 API, see [Introduction to WaaS 2.0](http
This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: v2
- Package version: 1.1.1
- Package version: 1.1.2
- 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)
Expand Down
3,192 changes: 0 additions & 3,192 deletions package-lock.json

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cobo/cobo-waas2",
"version": "1.1.1",
"version": "1.1.2",
"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](https://www.cobo.com/developers/v2/guides/overview/introduction). ",
"license": "GPL 2.0",
"main": "dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/ApiClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class ApiClient {
* @default {}
*/
this.defaultHeaders = {
'User-Agent': 'cobo-waas2-js-sdk/1.1.1'
'User-Agent': 'cobo-waas2-js-sdk/1.1.2'
};

/**
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ import WalletsMPCWalletsApi from './api/WalletsMPCWalletsApi';
* </pre>
* </p>
* @module index
* @version 1.1.1
* @version 1.1.2
*/
export {
Env,
Expand Down
4 changes: 3 additions & 1 deletion src/model/Activity.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,9 @@ class Activity {
}
// validate the optional field `fee`
if (data['fee']) { // data not null
TransactionRequestFee.validateJSON(data['fee']);
if (!!TransactionRequestFee.validateJSON) {
TransactionRequestFee.validateJSON(data['fee']);
}
}

return true;
Expand Down
4 changes: 3 additions & 1 deletion src/model/AddressTransferDestination.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ class AddressTransferDestination {
}
// validate the optional field `account_output`
if (data['account_output']) { // data not null
AddressTransferDestinationAccountOutput.validateJSON(data['account_output']);
if (!!AddressTransferDestinationAccountOutput.validateJSON) {
AddressTransferDestinationAccountOutput.validateJSON(data['account_output']);
}
}
if (data['utxo_outputs']) { // data not null
// ensure the json data is an array
Expand Down
4 changes: 3 additions & 1 deletion src/model/AssetBalance.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ class AssetBalance {
}
// validate the optional field `balance`
if (data['balance']) { // data not null
TokenBalanceBalance.validateJSON(data['balance']);
if (!!TokenBalanceBalance.validateJSON) {
TokenBalanceBalance.validateJSON(data['balance']);
}
}

return true;
Expand Down
6 changes: 3 additions & 3 deletions src/model/CoboSafeDelegate.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ class CoboSafeDelegate {
try {
if (instance instanceof MPCDelegate) {
this.actualInstance = instance;
} else if(MPCDelegate.validateJSON(instance)){
} else if(!!MPCDelegate.validateJSON && MPCDelegate.validateJSON(instance)){
// plain JS object
// create MPCDelegate from JS object
this.actualInstance = MPCDelegate.constructFromObject(instance);
} else {
return;
} else if(MPCDelegate.constructFromObject(instance)){
this.actualInstance = MPCDelegate.constructFromObject(instance);
}
match++;
} catch(err) {
Expand Down
6 changes: 3 additions & 3 deletions src/model/ContractCallDestination.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ class ContractCallDestination {
try {
if (instance instanceof EvmContractCallDestination) {
this.actualInstance = instance;
} else if(EvmContractCallDestination.validateJSON(instance)){
} else if(!!EvmContractCallDestination.validateJSON && EvmContractCallDestination.validateJSON(instance)){
// plain JS object
// create EvmContractCallDestination from JS object
this.actualInstance = EvmContractCallDestination.constructFromObject(instance);
} else {
return;
} else if(EvmContractCallDestination.constructFromObject(instance)){
this.actualInstance = EvmContractCallDestination.constructFromObject(instance);
}
match++;
} catch(err) {
Expand Down
12 changes: 9 additions & 3 deletions src/model/ContractCallParams.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,15 @@ class ContractCallParams {
}
// validate the optional field `source`
if (data['source']) { // data not null
ContractCallSource.validateJSON(data['source']);
if (!!ContractCallSource.validateJSON) {
ContractCallSource.validateJSON(data['source']);
}
}
// validate the optional field `destination`
if (data['destination']) { // data not null
ContractCallDestination.validateJSON(data['destination']);
if (!!ContractCallDestination.validateJSON) {
ContractCallDestination.validateJSON(data['destination']);
}
}
// ensure the json data is a string
if (data['description'] && !(typeof data['description'] === 'string' || data['description'] instanceof String)) {
Expand All @@ -119,7 +123,9 @@ class ContractCallParams {
}
// validate the optional field `fee`
if (data['fee']) { // data not null
TransactionRequestFee.validateJSON(data['fee']);
if (!!TransactionRequestFee.validateJSON) {
TransactionRequestFee.validateJSON(data['fee']);
}
}

return true;
Expand Down
12 changes: 6 additions & 6 deletions src/model/ContractCallSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ class ContractCallSource {
try {
if (instance instanceof MpcContractCallSource) {
this.actualInstance = instance;
} else if(MpcContractCallSource.validateJSON(instance)){
} else if(!!MpcContractCallSource.validateJSON && MpcContractCallSource.validateJSON(instance)){
// plain JS object
// create MpcContractCallSource from JS object
this.actualInstance = MpcContractCallSource.constructFromObject(instance);
} else {
return;
} else if(MpcContractCallSource.constructFromObject(instance)){
this.actualInstance = MpcContractCallSource.constructFromObject(instance);
}
match++;
} catch(err) {
Expand All @@ -51,12 +51,12 @@ class ContractCallSource {
try {
if (instance instanceof SafeContractCallSource) {
this.actualInstance = instance;
} else if(SafeContractCallSource.validateJSON(instance)){
} else if(!!SafeContractCallSource.validateJSON && SafeContractCallSource.validateJSON(instance)){
// plain JS object
// create SafeContractCallSource from JS object
this.actualInstance = SafeContractCallSource.constructFromObject(instance);
} else {
return;
} else if(SafeContractCallSource.constructFromObject(instance)){
this.actualInstance = SafeContractCallSource.constructFromObject(instance);
}
match++;
} catch(err) {
Expand Down
4 changes: 3 additions & 1 deletion src/model/CreateSafeWalletParams.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ class CreateSafeWalletParams {
}
// validate the optional field `initiator`
if (data['initiator']) { // data not null
SmartContractInitiator.validateJSON(data['initiator']);
if (!!SmartContractInitiator.validateJSON) {
SmartContractInitiator.validateJSON(data['initiator']);
}
}

return true;
Expand Down
6 changes: 3 additions & 3 deletions src/model/CreateSmartContractWalletParams.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ class CreateSmartContractWalletParams {
try {
if (instance instanceof CreateSafeWalletParams) {
this.actualInstance = instance;
} else if(CreateSafeWalletParams.validateJSON(instance)){
} else if(!!CreateSafeWalletParams.validateJSON && CreateSafeWalletParams.validateJSON(instance)){
// plain JS object
// create CreateSafeWalletParams from JS object
this.actualInstance = CreateSafeWalletParams.constructFromObject(instance);
} else {
return;
} else if(CreateSafeWalletParams.constructFromObject(instance)){
this.actualInstance = CreateSafeWalletParams.constructFromObject(instance);
}
match++;
} catch(err) {
Expand Down
12 changes: 9 additions & 3 deletions src/model/CreateStakeActivity.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ class CreateStakeActivity {
}
// validate the optional field `source`
if (data['source']) { // data not null
StakingSource.validateJSON(data['source']);
if (!!StakingSource.validateJSON) {
StakingSource.validateJSON(data['source']);
}
}
// ensure the json data is a string
if (data['pool_id'] && !(typeof data['pool_id'] === 'string' || data['pool_id'] instanceof String)) {
Expand All @@ -100,11 +102,15 @@ class CreateStakeActivity {
}
// validate the optional field `fee`
if (data['fee']) { // data not null
TransactionRequestFee.validateJSON(data['fee']);
if (!!TransactionRequestFee.validateJSON) {
TransactionRequestFee.validateJSON(data['fee']);
}
}
// validate the optional field `extra`
if (data['extra']) { // data not null
CreateStakeActivityExtra.validateJSON(data['extra']);
if (!!CreateStakeActivityExtra.validateJSON) {
CreateStakeActivityExtra.validateJSON(data['extra']);
}
}

return true;
Expand Down
18 changes: 9 additions & 9 deletions src/model/CreateStakeActivityExtra.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ class CreateStakeActivityExtra {
try {
if (instance instanceof BabylonStakeExtra) {
this.actualInstance = instance;
} else if(BabylonStakeExtra.validateJSON(instance)){
} else if(!!BabylonStakeExtra.validateJSON && BabylonStakeExtra.validateJSON(instance)){
// plain JS object
// create BabylonStakeExtra from JS object
this.actualInstance = BabylonStakeExtra.constructFromObject(instance);
} else {
return;
} else if(BabylonStakeExtra.constructFromObject(instance)){
this.actualInstance = BabylonStakeExtra.constructFromObject(instance);
}
match++;
} catch(err) {
Expand All @@ -51,12 +51,12 @@ class CreateStakeActivityExtra {
try {
if (instance instanceof EigenLayerLstStakeExtra) {
this.actualInstance = instance;
} else if(EigenLayerLstStakeExtra.validateJSON(instance)){
} else if(!!EigenLayerLstStakeExtra.validateJSON && EigenLayerLstStakeExtra.validateJSON(instance)){
// plain JS object
// create EigenLayerLstStakeExtra from JS object
this.actualInstance = EigenLayerLstStakeExtra.constructFromObject(instance);
} else {
return;
} else if(EigenLayerLstStakeExtra.constructFromObject(instance)){
this.actualInstance = EigenLayerLstStakeExtra.constructFromObject(instance);
}
match++;
} catch(err) {
Expand All @@ -67,12 +67,12 @@ class CreateStakeActivityExtra {
try {
if (instance instanceof EigenLayerNativeStakeExtra) {
this.actualInstance = instance;
} else if(EigenLayerNativeStakeExtra.validateJSON(instance)){
} else if(!!EigenLayerNativeStakeExtra.validateJSON && EigenLayerNativeStakeExtra.validateJSON(instance)){
// plain JS object
// create EigenLayerNativeStakeExtra from JS object
this.actualInstance = EigenLayerNativeStakeExtra.constructFromObject(instance);
} else {
return;
} else if(EigenLayerNativeStakeExtra.constructFromObject(instance)){
this.actualInstance = EigenLayerNativeStakeExtra.constructFromObject(instance);
}
match++;
} catch(err) {
Expand Down
4 changes: 3 additions & 1 deletion src/model/CreateTssRequestRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ class CreateTssRequestRequest {
}
// validate the optional field `source_key_share_holder_group`
if (data['source_key_share_holder_group']) { // data not null
SourceGroup.validateJSON(data['source_key_share_holder_group']);
if (!!SourceGroup.validateJSON) {
SourceGroup.validateJSON(data['source_key_share_holder_group']);
}
}

return true;
Expand Down
4 changes: 3 additions & 1 deletion src/model/CreateUnstakeActivity.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ class CreateUnstakeActivity {
}
// validate the optional field `fee`
if (data['fee']) { // data not null
TransactionRequestFee.validateJSON(data['fee']);
if (!!TransactionRequestFee.validateJSON) {
TransactionRequestFee.validateJSON(data['fee']);
}
}

return true;
Expand Down
18 changes: 9 additions & 9 deletions src/model/CreateWalletParams.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ class CreateWalletParams {
try {
if (instance instanceof CreateCustodialWalletParams) {
this.actualInstance = instance;
} else if(CreateCustodialWalletParams.validateJSON(instance)){
} else if(!!CreateCustodialWalletParams.validateJSON && CreateCustodialWalletParams.validateJSON(instance)){
// plain JS object
// create CreateCustodialWalletParams from JS object
this.actualInstance = CreateCustodialWalletParams.constructFromObject(instance);
} else {
return;
} else if(CreateCustodialWalletParams.constructFromObject(instance)){
this.actualInstance = CreateCustodialWalletParams.constructFromObject(instance);
}
match++;
} catch(err) {
Expand All @@ -53,12 +53,12 @@ class CreateWalletParams {
try {
if (instance instanceof CreateMpcWalletParams) {
this.actualInstance = instance;
} else if(CreateMpcWalletParams.validateJSON(instance)){
} else if(!!CreateMpcWalletParams.validateJSON && CreateMpcWalletParams.validateJSON(instance)){
// plain JS object
// create CreateMpcWalletParams from JS object
this.actualInstance = CreateMpcWalletParams.constructFromObject(instance);
} else {
return;
} else if(CreateMpcWalletParams.constructFromObject(instance)){
this.actualInstance = CreateMpcWalletParams.constructFromObject(instance);
}
match++;
} catch(err) {
Expand All @@ -69,12 +69,12 @@ class CreateWalletParams {
try {
if (instance instanceof CreateExchangeWalletParams) {
this.actualInstance = instance;
} else if(CreateExchangeWalletParams.validateJSON(instance)){
} else if(!!CreateExchangeWalletParams.validateJSON && CreateExchangeWalletParams.validateJSON(instance)){
// plain JS object
// create CreateExchangeWalletParams from JS object
this.actualInstance = CreateExchangeWalletParams.constructFromObject(instance);
} else {
return;
} else if(CreateExchangeWalletParams.constructFromObject(instance)){
this.actualInstance = CreateExchangeWalletParams.constructFromObject(instance);
}
match++;
} catch(err) {
Expand Down
4 changes: 3 additions & 1 deletion src/model/CreateWithdrawActivity.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ class CreateWithdrawActivity {
}
// validate the optional field `fee`
if (data['fee']) { // data not null
TransactionRequestFee.validateJSON(data['fee']);
if (!!TransactionRequestFee.validateJSON) {
TransactionRequestFee.validateJSON(data['fee']);
}
}

return true;
Expand Down
18 changes: 9 additions & 9 deletions src/model/CreatedWalletInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ class CreatedWalletInfo {
try {
if (instance instanceof CustodialWalletInfo) {
this.actualInstance = instance;
} else if(CustodialWalletInfo.validateJSON(instance)){
} else if(!!CustodialWalletInfo.validateJSON && CustodialWalletInfo.validateJSON(instance)){
// plain JS object
// create CustodialWalletInfo from JS object
this.actualInstance = CustodialWalletInfo.constructFromObject(instance);
} else {
return;
} else if(CustodialWalletInfo.constructFromObject(instance)){
this.actualInstance = CustodialWalletInfo.constructFromObject(instance);
}
match++;
} catch(err) {
Expand All @@ -53,12 +53,12 @@ class CreatedWalletInfo {
try {
if (instance instanceof MPCWalletInfo) {
this.actualInstance = instance;
} else if(MPCWalletInfo.validateJSON(instance)){
} else if(!!MPCWalletInfo.validateJSON && MPCWalletInfo.validateJSON(instance)){
// plain JS object
// create MPCWalletInfo from JS object
this.actualInstance = MPCWalletInfo.constructFromObject(instance);
} else {
return;
} else if(MPCWalletInfo.constructFromObject(instance)){
this.actualInstance = MPCWalletInfo.constructFromObject(instance);
}
match++;
} catch(err) {
Expand All @@ -69,12 +69,12 @@ class CreatedWalletInfo {
try {
if (instance instanceof ExchangeWalletInfo) {
this.actualInstance = instance;
} else if(ExchangeWalletInfo.validateJSON(instance)){
} else if(!!ExchangeWalletInfo.validateJSON && ExchangeWalletInfo.validateJSON(instance)){
// plain JS object
// create ExchangeWalletInfo from JS object
this.actualInstance = ExchangeWalletInfo.constructFromObject(instance);
} else {
return;
} else if(ExchangeWalletInfo.constructFromObject(instance)){
this.actualInstance = ExchangeWalletInfo.constructFromObject(instance);
}
match++;
} catch(err) {
Expand Down
Loading

0 comments on commit 3448d4b

Please sign in to comment.