@cobo/cobo-waas2 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -58,6 +58,31 @@ var WalletInfo = /*#__PURE__*/function () {
58
58
  }
59
59
  var match = 0;
60
60
  var errorMessages = [];
61
+ var discriminatorValue = instance["wallet_type"];
62
+ if (discriminatorValue) {
63
+ switch (discriminatorValue) {
64
+ case "Custodial":
65
+ this.actualInstance = _CustodialWalletInfo["default"].constructFromObject(instance);
66
+ match++;
67
+ break;
68
+ case "Exchange":
69
+ this.actualInstance = _ExchangeWalletInfo["default"].constructFromObject(instance);
70
+ match++;
71
+ break;
72
+ case "MPC":
73
+ this.actualInstance = _MPCWalletInfo["default"].constructFromObject(instance);
74
+ match++;
75
+ break;
76
+ case "SmartContract":
77
+ this.actualInstance = _SmartContractWalletInfo["default"].constructFromObject(instance);
78
+ match++;
79
+ break;
80
+ default:
81
+ errorMessages.push("Unrecognized discriminator value: " + discriminatorValue);
82
+ break;
83
+ }
84
+ return;
85
+ }
61
86
  try {
62
87
  if (instance instanceof _CustodialWalletInfo["default"]) {
63
88
  this.actualInstance = instance;
@@ -65,8 +90,16 @@ var WalletInfo = /*#__PURE__*/function () {
65
90
  // plain JS object
66
91
  // create CustodialWalletInfo from JS object
67
92
  this.actualInstance = _CustodialWalletInfo["default"].constructFromObject(instance);
68
- } else if (_CustodialWalletInfo["default"].constructFromObject(instance)) {
69
- this.actualInstance = _CustodialWalletInfo["default"].constructFromObject(instance);
93
+ } else {
94
+ if (_CustodialWalletInfo["default"].constructFromObject(instance)) {
95
+ if (!!_CustodialWalletInfo["default"].constructFromObject(instance).toJSON) {
96
+ if (_CustodialWalletInfo["default"].constructFromObject(instance).toJSON()) {
97
+ this.actualInstance = _CustodialWalletInfo["default"].constructFromObject(instance);
98
+ }
99
+ } else {
100
+ this.actualInstance = _CustodialWalletInfo["default"].constructFromObject(instance);
101
+ }
102
+ }
70
103
  }
71
104
  match++;
72
105
  } catch (err) {
@@ -80,8 +113,16 @@ var WalletInfo = /*#__PURE__*/function () {
80
113
  // plain JS object
81
114
  // create MPCWalletInfo from JS object
82
115
  this.actualInstance = _MPCWalletInfo["default"].constructFromObject(instance);
83
- } else if (_MPCWalletInfo["default"].constructFromObject(instance)) {
84
- this.actualInstance = _MPCWalletInfo["default"].constructFromObject(instance);
116
+ } else {
117
+ if (_MPCWalletInfo["default"].constructFromObject(instance)) {
118
+ if (!!_MPCWalletInfo["default"].constructFromObject(instance).toJSON) {
119
+ if (_MPCWalletInfo["default"].constructFromObject(instance).toJSON()) {
120
+ this.actualInstance = _MPCWalletInfo["default"].constructFromObject(instance);
121
+ }
122
+ } else {
123
+ this.actualInstance = _MPCWalletInfo["default"].constructFromObject(instance);
124
+ }
125
+ }
85
126
  }
86
127
  match++;
87
128
  } catch (err) {
@@ -95,8 +136,16 @@ var WalletInfo = /*#__PURE__*/function () {
95
136
  // plain JS object
96
137
  // create SmartContractWalletInfo from JS object
97
138
  this.actualInstance = _SmartContractWalletInfo["default"].constructFromObject(instance);
98
- } else if (_SmartContractWalletInfo["default"].constructFromObject(instance)) {
99
- this.actualInstance = _SmartContractWalletInfo["default"].constructFromObject(instance);
139
+ } else {
140
+ if (_SmartContractWalletInfo["default"].constructFromObject(instance)) {
141
+ if (!!_SmartContractWalletInfo["default"].constructFromObject(instance).toJSON) {
142
+ if (_SmartContractWalletInfo["default"].constructFromObject(instance).toJSON()) {
143
+ this.actualInstance = _SmartContractWalletInfo["default"].constructFromObject(instance);
144
+ }
145
+ } else {
146
+ this.actualInstance = _SmartContractWalletInfo["default"].constructFromObject(instance);
147
+ }
148
+ }
100
149
  }
101
150
  match++;
102
151
  } catch (err) {
@@ -110,8 +159,16 @@ var WalletInfo = /*#__PURE__*/function () {
110
159
  // plain JS object
111
160
  // create ExchangeWalletInfo from JS object
112
161
  this.actualInstance = _ExchangeWalletInfo["default"].constructFromObject(instance);
113
- } else if (_ExchangeWalletInfo["default"].constructFromObject(instance)) {
114
- this.actualInstance = _ExchangeWalletInfo["default"].constructFromObject(instance);
162
+ } else {
163
+ if (_ExchangeWalletInfo["default"].constructFromObject(instance)) {
164
+ if (!!_ExchangeWalletInfo["default"].constructFromObject(instance).toJSON) {
165
+ if (_ExchangeWalletInfo["default"].constructFromObject(instance).toJSON()) {
166
+ this.actualInstance = _ExchangeWalletInfo["default"].constructFromObject(instance);
167
+ }
168
+ } else {
169
+ this.actualInstance = _ExchangeWalletInfo["default"].constructFromObject(instance);
170
+ }
171
+ }
115
172
  }
116
173
  match++;
117
174
  } catch (err) {
@@ -63,6 +63,23 @@ var WebhookEventData = /*#__PURE__*/function () {
63
63
  }
64
64
  var match = 0;
65
65
  var errorMessages = [];
66
+ var discriminatorValue = instance["data_type"];
67
+ if (discriminatorValue) {
68
+ switch (discriminatorValue) {
69
+ case "TSSRequest":
70
+ this.actualInstance = _TSSRequestWebhookEventData["default"].constructFromObject(instance);
71
+ match++;
72
+ break;
73
+ case "Transaction":
74
+ this.actualInstance = _TransactionWebhookEventData["default"].constructFromObject(instance);
75
+ match++;
76
+ break;
77
+ default:
78
+ errorMessages.push("Unrecognized discriminator value: " + discriminatorValue);
79
+ break;
80
+ }
81
+ return;
82
+ }
66
83
  try {
67
84
  if (instance instanceof _TransactionWebhookEventData["default"]) {
68
85
  this.actualInstance = instance;
@@ -70,8 +87,16 @@ var WebhookEventData = /*#__PURE__*/function () {
70
87
  // plain JS object
71
88
  // create TransactionWebhookEventData from JS object
72
89
  this.actualInstance = _TransactionWebhookEventData["default"].constructFromObject(instance);
73
- } else if (_TransactionWebhookEventData["default"].constructFromObject(instance)) {
74
- this.actualInstance = _TransactionWebhookEventData["default"].constructFromObject(instance);
90
+ } else {
91
+ if (_TransactionWebhookEventData["default"].constructFromObject(instance)) {
92
+ if (!!_TransactionWebhookEventData["default"].constructFromObject(instance).toJSON) {
93
+ if (_TransactionWebhookEventData["default"].constructFromObject(instance).toJSON()) {
94
+ this.actualInstance = _TransactionWebhookEventData["default"].constructFromObject(instance);
95
+ }
96
+ } else {
97
+ this.actualInstance = _TransactionWebhookEventData["default"].constructFromObject(instance);
98
+ }
99
+ }
75
100
  }
76
101
  match++;
77
102
  } catch (err) {
@@ -85,8 +110,16 @@ var WebhookEventData = /*#__PURE__*/function () {
85
110
  // plain JS object
86
111
  // create TSSRequestWebhookEventData from JS object
87
112
  this.actualInstance = _TSSRequestWebhookEventData["default"].constructFromObject(instance);
88
- } else if (_TSSRequestWebhookEventData["default"].constructFromObject(instance)) {
89
- this.actualInstance = _TSSRequestWebhookEventData["default"].constructFromObject(instance);
113
+ } else {
114
+ if (_TSSRequestWebhookEventData["default"].constructFromObject(instance)) {
115
+ if (!!_TSSRequestWebhookEventData["default"].constructFromObject(instance).toJSON) {
116
+ if (_TSSRequestWebhookEventData["default"].constructFromObject(instance).toJSON()) {
117
+ this.actualInstance = _TSSRequestWebhookEventData["default"].constructFromObject(instance);
118
+ }
119
+ } else {
120
+ this.actualInstance = _TSSRequestWebhookEventData["default"].constructFromObject(instance);
121
+ }
122
+ }
90
123
  }
91
124
  match++;
92
125
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cobo/cobo-waas2",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "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). ",
5
5
  "license": "GPL 2.0",
6
6
  "main": "dist/index.js",