@cobo/cobo-waas2 1.1.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.
Files changed (498) hide show
  1. package/README.md +414 -0
  2. package/dist/ApiClient.js +747 -0
  3. package/dist/Env.js +19 -0
  4. package/dist/api/DevelopersWebhooksApi.js +508 -0
  5. package/dist/api/OAuthApi.js +145 -0
  6. package/dist/api/TransactionsApi.js +542 -0
  7. package/dist/api/WalletsApi.js +1200 -0
  8. package/dist/api/WalletsMPCWalletsApi.js +955 -0
  9. package/dist/crypto/ApiSigner.js +52 -0
  10. package/dist/index.js +1742 -0
  11. package/dist/model/Activity.js +302 -0
  12. package/dist/model/ActivityAction.js +66 -0
  13. package/dist/model/ActivityInitiator.js +87 -0
  14. package/dist/model/ActivityStatus.js +66 -0
  15. package/dist/model/ActivityTimeline.js +140 -0
  16. package/dist/model/ActivityType.js +81 -0
  17. package/dist/model/AddressEncoding.js +86 -0
  18. package/dist/model/AddressInfo.js +174 -0
  19. package/dist/model/AddressTransferDestination.js +182 -0
  20. package/dist/model/AddressTransferDestinationAccountOutput.js +138 -0
  21. package/dist/model/AddressTransferDestinationUtxoOutputsInner.js +136 -0
  22. package/dist/model/AmountDetailsInner.js +134 -0
  23. package/dist/model/AmountStatus.js +96 -0
  24. package/dist/model/AssetBalance.js +127 -0
  25. package/dist/model/AssetInfo.js +150 -0
  26. package/dist/model/BabylonStakeExtra.js +142 -0
  27. package/dist/model/BabylonValidator.js +199 -0
  28. package/dist/model/BaseContractCallSource.js +137 -0
  29. package/dist/model/BaseEstimateStakingFee.js +106 -0
  30. package/dist/model/BaseStakeExtra.js +107 -0
  31. package/dist/model/ChainInfo.js +172 -0
  32. package/dist/model/CheckAddressValidity200Response.js +106 -0
  33. package/dist/model/CoboSafeDelegate.js +143 -0
  34. package/dist/model/CoboSafeDelegateType.js +61 -0
  35. package/dist/model/ContractCallDestination.js +149 -0
  36. package/dist/model/ContractCallDestinationType.js +56 -0
  37. package/dist/model/ContractCallParams.js +198 -0
  38. package/dist/model/ContractCallSource.js +171 -0
  39. package/dist/model/ContractCallSourceType.js +66 -0
  40. package/dist/model/CreateAddressRequest.js +131 -0
  41. package/dist/model/CreateCustodialWalletParams.js +133 -0
  42. package/dist/model/CreateExchangeWalletParams.js +257 -0
  43. package/dist/model/CreateKeyShareHolder.js +119 -0
  44. package/dist/model/CreateKeyShareHolderGroupRequest.js +160 -0
  45. package/dist/model/CreateMpcProjectRequest.js +132 -0
  46. package/dist/model/CreateMpcVaultRequest.js +134 -0
  47. package/dist/model/CreateMpcWalletParams.js +166 -0
  48. package/dist/model/CreateSafeWalletParams.js +220 -0
  49. package/dist/model/CreateSmartContractWalletParams.js +185 -0
  50. package/dist/model/CreateStakeActivity.js +171 -0
  51. package/dist/model/CreateStakeActivityExtra.js +187 -0
  52. package/dist/model/CreateTransferTransaction201Response.js +136 -0
  53. package/dist/model/CreateTssRequestRequest.js +135 -0
  54. package/dist/model/CreateUnstakeActivity.js +137 -0
  55. package/dist/model/CreateWalletParams.js +229 -0
  56. package/dist/model/CreateWebhookEndpointRequest.js +139 -0
  57. package/dist/model/CreateWithdrawActivity.js +152 -0
  58. package/dist/model/CreatedWalletInfo.js +217 -0
  59. package/dist/model/CurveType.js +61 -0
  60. package/dist/model/CustodialTransferSource.js +122 -0
  61. package/dist/model/CustodialWalletInfo.js +163 -0
  62. package/dist/model/DeleteKeyShareHolderGroupById201Response.js +106 -0
  63. package/dist/model/DeleteWalletById201Response.js +106 -0
  64. package/dist/model/EigenLayerLstStakeExtra.js +129 -0
  65. package/dist/model/EigenLayerNativeStakeExtra.js +125 -0
  66. package/dist/model/EigenlayerValidator.js +159 -0
  67. package/dist/model/ErrorResponse.js +137 -0
  68. package/dist/model/EstimateContractCallFeeParams.js +178 -0
  69. package/dist/model/EstimateFeeParams.js +183 -0
  70. package/dist/model/EstimateFeeRequestType.js +61 -0
  71. package/dist/model/EstimateStakeFee.js +219 -0
  72. package/dist/model/EstimateTransferFeeParams.js +178 -0
  73. package/dist/model/EstimateUnstakeFee.js +177 -0
  74. package/dist/model/EstimateWithdrawFee.js +197 -0
  75. package/dist/model/EstimatedEvmEip1559Fee.js +164 -0
  76. package/dist/model/EstimatedEvmEip1559FeeSlow.js +168 -0
  77. package/dist/model/EstimatedEvmLegacyFee.js +164 -0
  78. package/dist/model/EstimatedEvmLegacyFeeSlow.js +148 -0
  79. package/dist/model/EstimatedFee.js +213 -0
  80. package/dist/model/EstimatedFixedFee.js +157 -0
  81. package/dist/model/EstimatedUtxoFee.js +164 -0
  82. package/dist/model/EstimatedUtxoFeeSlow.js +146 -0
  83. package/dist/model/EvmContractCallDestination.js +146 -0
  84. package/dist/model/EvmEIP191MessageSignDestination.js +122 -0
  85. package/dist/model/EvmEIP712MessageSignDestination.js +120 -0
  86. package/dist/model/EvmEip1559FeeBasePrice.js +101 -0
  87. package/dist/model/EvmEip1559FeeRate.js +164 -0
  88. package/dist/model/EvmLegacyFeeBasePrice.js +88 -0
  89. package/dist/model/EvmLegacyFeeRate.js +164 -0
  90. package/dist/model/ExchangeId.js +76 -0
  91. package/dist/model/ExchangeTransferDestination.js +152 -0
  92. package/dist/model/ExchangeTransferSource.js +137 -0
  93. package/dist/model/ExchangeWalletInfo.js +230 -0
  94. package/dist/model/ExtendedTokenInfo.js +294 -0
  95. package/dist/model/FeeAmount.js +88 -0
  96. package/dist/model/FeeGasLimit.js +88 -0
  97. package/dist/model/FeeRate.js +207 -0
  98. package/dist/model/FeeType.js +71 -0
  99. package/dist/model/FixedFeeRate.js +146 -0
  100. package/dist/model/GetToken200Response.js +135 -0
  101. package/dist/model/GetToken4XXResponse.js +124 -0
  102. package/dist/model/KeyShareHolder.js +137 -0
  103. package/dist/model/KeyShareHolderGroup.js +196 -0
  104. package/dist/model/KeyShareHolderGroupStatus.js +66 -0
  105. package/dist/model/KeyShareHolderGroupType.js +66 -0
  106. package/dist/model/KeyShareHolderStatus.js +71 -0
  107. package/dist/model/KeyShareHolderType.js +66 -0
  108. package/dist/model/ListAddresses200Response.js +121 -0
  109. package/dist/model/ListKeyShareHolderGroups200Response.js +121 -0
  110. package/dist/model/ListMpcProjects200Response.js +121 -0
  111. package/dist/model/ListMpcVaults200Response.js +121 -0
  112. package/dist/model/ListSupportedChains200Response.js +121 -0
  113. package/dist/model/ListSupportedTokens200Response.js +121 -0
  114. package/dist/model/ListTokenBalancesForAddress200Response.js +121 -0
  115. package/dist/model/ListTransactions200Response.js +121 -0
  116. package/dist/model/ListTssRequests200Response.js +121 -0
  117. package/dist/model/ListUtxos200Response.js +121 -0
  118. package/dist/model/ListWallets200Response.js +121 -0
  119. package/dist/model/ListWebhookEndpoints200Response.js +121 -0
  120. package/dist/model/ListWebhookEventDefinitions200ResponseInner.js +96 -0
  121. package/dist/model/ListWebhookEventLogs200Response.js +121 -0
  122. package/dist/model/ListWebhookEvents200Response.js +121 -0
  123. package/dist/model/LockUtxos201Response.js +83 -0
  124. package/dist/model/LockUtxosRequest.js +127 -0
  125. package/dist/model/LockUtxosRequestUtxosInner.js +136 -0
  126. package/dist/model/MPCDelegate.js +137 -0
  127. package/dist/model/MPCProject.js +141 -0
  128. package/dist/model/MPCVault.js +165 -0
  129. package/dist/model/MPCVaultType.js +61 -0
  130. package/dist/model/MPCWalletInfo.js +219 -0
  131. package/dist/model/MaxFeeAmount.js +88 -0
  132. package/dist/model/MaxTransferableValue.js +115 -0
  133. package/dist/model/MessageSignDestination.js +159 -0
  134. package/dist/model/MessageSignDestinationType.js +61 -0
  135. package/dist/model/MessageSignParams.js +184 -0
  136. package/dist/model/MessageSignSource.js +143 -0
  137. package/dist/model/MessageSignSourceType.js +61 -0
  138. package/dist/model/MpcContractCallSource.js +165 -0
  139. package/dist/model/MpcMessageSignSource.js +136 -0
  140. package/dist/model/MpcSigningGroup.js +101 -0
  141. package/dist/model/MpcTransferSource.js +194 -0
  142. package/dist/model/Pagination.js +137 -0
  143. package/dist/model/PoolDetails.js +363 -0
  144. package/dist/model/PoolDetailsAllOfValidatorsInfo.js +183 -0
  145. package/dist/model/PoolSummary.js +214 -0
  146. package/dist/model/RefreshTokenRequest.js +113 -0
  147. package/dist/model/ReplaceType.js +66 -0
  148. package/dist/model/RetryWebhookEventById201Response.js +83 -0
  149. package/dist/model/RootPubkey.js +97 -0
  150. package/dist/model/SafeContractCallSource.js +173 -0
  151. package/dist/model/SafeTransferSource.js +153 -0
  152. package/dist/model/SafeWallet.js +248 -0
  153. package/dist/model/SmartContractInitiator.js +126 -0
  154. package/dist/model/SmartContractWalletInfo.js +197 -0
  155. package/dist/model/SmartContractWalletOperationType.js +56 -0
  156. package/dist/model/SmartContractWalletType.js +56 -0
  157. package/dist/model/SourceGroup.js +124 -0
  158. package/dist/model/StakingPoolType.js +66 -0
  159. package/dist/model/StakingSource.js +171 -0
  160. package/dist/model/Stakings.js +295 -0
  161. package/dist/model/StakingsValidatorInfo.js +135 -0
  162. package/dist/model/SubWalletAssetBalance.js +140 -0
  163. package/dist/model/TSSGroups.js +110 -0
  164. package/dist/model/TSSRequest.js +133 -0
  165. package/dist/model/TSSRequestStatus.js +76 -0
  166. package/dist/model/TSSRequestType.js +66 -0
  167. package/dist/model/TokenBalance.js +127 -0
  168. package/dist/model/TokenBalanceBalance.js +154 -0
  169. package/dist/model/TokenInfo.js +231 -0
  170. package/dist/model/Transaction.js +443 -0
  171. package/dist/model/TransactionApprover.js +129 -0
  172. package/dist/model/TransactionBlockInfo.js +106 -0
  173. package/dist/model/TransactionCustodialAssetWalletSource.js +122 -0
  174. package/dist/model/TransactionDepositFromAddressSource.js +153 -0
  175. package/dist/model/TransactionDepositFromLoopSource.js +107 -0
  176. package/dist/model/TransactionDepositFromWalletSource.js +157 -0
  177. package/dist/model/TransactionDepositToAddressDestination.js +185 -0
  178. package/dist/model/TransactionDepositToWalletDestination.js +181 -0
  179. package/dist/model/TransactionDestination.js +329 -0
  180. package/dist/model/TransactionDestinationType.js +86 -0
  181. package/dist/model/TransactionDetail.js +607 -0
  182. package/dist/model/TransactionDetails.js +742 -0
  183. package/dist/model/TransactionEvmContractDestination.js +146 -0
  184. package/dist/model/TransactionEvmEip1559Fee.js +226 -0
  185. package/dist/model/TransactionEvmLegacyFee.js +195 -0
  186. package/dist/model/TransactionExchangeWalletSource.js +146 -0
  187. package/dist/model/TransactionFee.js +240 -0
  188. package/dist/model/TransactionFeeStationWalletSource.js +122 -0
  189. package/dist/model/TransactionFixedFee.js +157 -0
  190. package/dist/model/TransactionInitiatorType.js +71 -0
  191. package/dist/model/TransactionMPCWalletSource.js +194 -0
  192. package/dist/model/TransactionMessageSignEIP191Destination.js +122 -0
  193. package/dist/model/TransactionMessageSignEIP712Destination.js +120 -0
  194. package/dist/model/TransactionRawTxInfo.js +131 -0
  195. package/dist/model/TransactionRbf.js +167 -0
  196. package/dist/model/TransactionRbfSource.js +154 -0
  197. package/dist/model/TransactionReplacement.js +143 -0
  198. package/dist/model/TransactionRequestEvmEip1559Fee.js +182 -0
  199. package/dist/model/TransactionRequestEvmLegacyFee.js +162 -0
  200. package/dist/model/TransactionRequestFee.js +222 -0
  201. package/dist/model/TransactionRequestFixedFee.js +146 -0
  202. package/dist/model/TransactionRequestUtxoFee.js +161 -0
  203. package/dist/model/TransactionResend.js +111 -0
  204. package/dist/model/TransactionResult.js +137 -0
  205. package/dist/model/TransactionResultType.js +56 -0
  206. package/dist/model/TransactionSignatureResult.js +120 -0
  207. package/dist/model/TransactionSigner.js +147 -0
  208. package/dist/model/TransactionSmartContractSafeWalletSource.js +153 -0
  209. package/dist/model/TransactionSource.js +286 -0
  210. package/dist/model/TransactionSourceType.js +96 -0
  211. package/dist/model/TransactionStatus.js +106 -0
  212. package/dist/model/TransactionSubStatus.js +166 -0
  213. package/dist/model/TransactionTimeline.js +102 -0
  214. package/dist/model/TransactionTokeApproval.js +313 -0
  215. package/dist/model/TransactionTokenAmount.js +139 -0
  216. package/dist/model/TransactionTransferToAddressDestination.js +182 -0
  217. package/dist/model/TransactionTransferToAddressDestinationAccountOutput.js +113 -0
  218. package/dist/model/TransactionTransferToAddressDestinationUtxoOutputsInner.js +113 -0
  219. package/dist/model/TransactionTransferToWalletDestination.js +159 -0
  220. package/dist/model/TransactionType.js +76 -0
  221. package/dist/model/TransactionUtxo.js +97 -0
  222. package/dist/model/TransactionUtxoFee.js +170 -0
  223. package/dist/model/TransactionWebhookEventData.js +620 -0
  224. package/dist/model/TransferDestination.js +195 -0
  225. package/dist/model/TransferDestinationType.js +61 -0
  226. package/dist/model/TransferParams.js +198 -0
  227. package/dist/model/TransferSource.js +214 -0
  228. package/dist/model/UTXO.js +163 -0
  229. package/dist/model/UpdateCustodialWalletParams.js +120 -0
  230. package/dist/model/UpdateExchangeWalletParams.js +120 -0
  231. package/dist/model/UpdateGroupAction.js +56 -0
  232. package/dist/model/UpdateKeyShareHolderGroupByIdRequest.js +106 -0
  233. package/dist/model/UpdateMpcProjectByIdRequest.js +110 -0
  234. package/dist/model/UpdateMpcVaultByIdRequest.js +110 -0
  235. package/dist/model/UpdateMpcWalletParams.js +120 -0
  236. package/dist/model/UpdateSmartContractWalletParams.js +120 -0
  237. package/dist/model/UpdateWalletParams.js +185 -0
  238. package/dist/model/UpdateWebhookEndpointByIdRequest.js +132 -0
  239. package/dist/model/UtxoFeeBasePrice.js +88 -0
  240. package/dist/model/UtxoFeeRate.js +164 -0
  241. package/dist/model/WalletInfo.js +235 -0
  242. package/dist/model/WalletSubtype.js +86 -0
  243. package/dist/model/WalletType.js +71 -0
  244. package/dist/model/WebhookEndpoint.js +175 -0
  245. package/dist/model/WebhookEndpointStatus.js +81 -0
  246. package/dist/model/WebhookEvent.js +189 -0
  247. package/dist/model/WebhookEventData.js +299 -0
  248. package/dist/model/WebhookEventDataType.js +129 -0
  249. package/dist/model/WebhookEventLog.js +204 -0
  250. package/dist/model/WebhookEventStatus.js +66 -0
  251. package/dist/model/WebhookEventType.js +71 -0
  252. package/docs/Activity.md +23 -0
  253. package/docs/ActivityAction.md +14 -0
  254. package/docs/ActivityInitiator.md +9 -0
  255. package/docs/ActivityStatus.md +14 -0
  256. package/docs/ActivityTimeline.md +12 -0
  257. package/docs/ActivityType.md +20 -0
  258. package/docs/AddressEncoding.md +22 -0
  259. package/docs/AddressInfo.md +14 -0
  260. package/docs/AddressTransferDestination.md +14 -0
  261. package/docs/AddressTransferDestinationAccountOutput.md +11 -0
  262. package/docs/AddressTransferDestinationUtxoOutputsInner.md +11 -0
  263. package/docs/AmountDetailsInner.md +11 -0
  264. package/docs/AmountStatus.md +26 -0
  265. package/docs/AssetBalance.md +10 -0
  266. package/docs/AssetInfo.md +12 -0
  267. package/docs/BabylonStakeExtra.md +11 -0
  268. package/docs/BabylonValidator.md +27 -0
  269. package/docs/BaseContractCallSource.md +11 -0
  270. package/docs/BaseEstimateStakingFee.md +9 -0
  271. package/docs/BaseStakeExtra.md +9 -0
  272. package/docs/ChainInfo.md +14 -0
  273. package/docs/CheckAddressValidity200Response.md +9 -0
  274. package/docs/CoboSafeDelegate.md +11 -0
  275. package/docs/CoboSafeDelegateType.md +12 -0
  276. package/docs/ContractCallDestination.md +12 -0
  277. package/docs/ContractCallDestinationType.md +10 -0
  278. package/docs/ContractCallParams.md +15 -0
  279. package/docs/ContractCallSource.md +13 -0
  280. package/docs/ContractCallSourceType.md +14 -0
  281. package/docs/CreateAddressRequest.md +11 -0
  282. package/docs/CreateCustodialWalletParams.md +11 -0
  283. package/docs/CreateExchangeWalletParams.md +19 -0
  284. package/docs/CreateKeyShareHolder.md +12 -0
  285. package/docs/CreateKeyShareHolderGroupRequest.md +12 -0
  286. package/docs/CreateMpcProjectRequest.md +11 -0
  287. package/docs/CreateMpcVaultRequest.md +11 -0
  288. package/docs/CreateMpcWalletParams.md +12 -0
  289. package/docs/CreateSafeWalletParams.md +18 -0
  290. package/docs/CreateSmartContractWalletParams.md +18 -0
  291. package/docs/CreateStakeActivity.md +13 -0
  292. package/docs/CreateStakeActivityExtra.md +13 -0
  293. package/docs/CreateTransferTransaction201Response.md +11 -0
  294. package/docs/CreateTssRequestRequest.md +11 -0
  295. package/docs/CreateUnstakeActivity.md +11 -0
  296. package/docs/CreateWalletParams.md +20 -0
  297. package/docs/CreateWebhookEndpointRequest.md +11 -0
  298. package/docs/CreateWithdrawActivity.md +12 -0
  299. package/docs/CreatedWalletInfo.md +18 -0
  300. package/docs/CurveType.md +12 -0
  301. package/docs/CustodialTransferSource.md +10 -0
  302. package/docs/CustodialWalletInfo.md +13 -0
  303. package/docs/DeleteKeyShareHolderGroupById201Response.md +9 -0
  304. package/docs/DeleteWalletById201Response.md +9 -0
  305. package/docs/DevelopersWebhooksApi.md +496 -0
  306. package/docs/EigenLayerLstStakeExtra.md +10 -0
  307. package/docs/EigenLayerNativeStakeExtra.md +10 -0
  308. package/docs/EigenlayerValidator.md +13 -0
  309. package/docs/ErrorResponse.md +11 -0
  310. package/docs/EstimateContractCallFeeParams.md +14 -0
  311. package/docs/EstimateFeeParams.md +15 -0
  312. package/docs/EstimateFeeRequestType.md +12 -0
  313. package/docs/EstimateStakeFee.md +14 -0
  314. package/docs/EstimateTransferFeeParams.md +14 -0
  315. package/docs/EstimateUnstakeFee.md +12 -0
  316. package/docs/EstimateWithdrawFee.md +13 -0
  317. package/docs/EstimatedEvmEip1559Fee.md +13 -0
  318. package/docs/EstimatedEvmEip1559FeeSlow.md +11 -0
  319. package/docs/EstimatedEvmLegacyFee.md +13 -0
  320. package/docs/EstimatedEvmLegacyFeeSlow.md +10 -0
  321. package/docs/EstimatedFee.md +15 -0
  322. package/docs/EstimatedFixedFee.md +12 -0
  323. package/docs/EstimatedUtxoFee.md +13 -0
  324. package/docs/EstimatedUtxoFeeSlow.md +10 -0
  325. package/docs/EvmContractCallDestination.md +12 -0
  326. package/docs/EvmEIP191MessageSignDestination.md +10 -0
  327. package/docs/EvmEIP712MessageSignDestination.md +10 -0
  328. package/docs/EvmEip1559FeeBasePrice.md +10 -0
  329. package/docs/EvmEip1559FeeRate.md +13 -0
  330. package/docs/EvmLegacyFeeBasePrice.md +9 -0
  331. package/docs/EvmLegacyFeeRate.md +13 -0
  332. package/docs/ExchangeId.md +18 -0
  333. package/docs/ExchangeTransferDestination.md +12 -0
  334. package/docs/ExchangeTransferSource.md +11 -0
  335. package/docs/ExchangeWalletInfo.md +16 -0
  336. package/docs/ExtendedTokenInfo.md +19 -0
  337. package/docs/FeeAmount.md +9 -0
  338. package/docs/FeeGasLimit.md +9 -0
  339. package/docs/FeeRate.md +14 -0
  340. package/docs/FeeType.md +16 -0
  341. package/docs/FixedFeeRate.md +11 -0
  342. package/docs/GetToken200Response.md +13 -0
  343. package/docs/GetToken4XXResponse.md +10 -0
  344. package/docs/KeyShareHolder.md +14 -0
  345. package/docs/KeyShareHolderGroup.md +16 -0
  346. package/docs/KeyShareHolderGroupStatus.md +14 -0
  347. package/docs/KeyShareHolderGroupType.md +14 -0
  348. package/docs/KeyShareHolderStatus.md +16 -0
  349. package/docs/KeyShareHolderType.md +14 -0
  350. package/docs/ListAddresses200Response.md +10 -0
  351. package/docs/ListKeyShareHolderGroups200Response.md +10 -0
  352. package/docs/ListMpcProjects200Response.md +10 -0
  353. package/docs/ListMpcVaults200Response.md +10 -0
  354. package/docs/ListSupportedChains200Response.md +10 -0
  355. package/docs/ListSupportedTokens200Response.md +10 -0
  356. package/docs/ListTokenBalancesForAddress200Response.md +10 -0
  357. package/docs/ListTransactions200Response.md +10 -0
  358. package/docs/ListTssRequests200Response.md +10 -0
  359. package/docs/ListUtxos200Response.md +10 -0
  360. package/docs/ListWallets200Response.md +10 -0
  361. package/docs/ListWebhookEndpoints200Response.md +10 -0
  362. package/docs/ListWebhookEventDefinitions200ResponseInner.md +10 -0
  363. package/docs/ListWebhookEventLogs200Response.md +10 -0
  364. package/docs/ListWebhookEvents200Response.md +10 -0
  365. package/docs/LockUtxos201Response.md +9 -0
  366. package/docs/LockUtxosRequest.md +9 -0
  367. package/docs/LockUtxosRequestUtxosInner.md +11 -0
  368. package/docs/MPCDelegate.md +11 -0
  369. package/docs/MPCProject.md +14 -0
  370. package/docs/MPCVault.md +14 -0
  371. package/docs/MPCVaultType.md +12 -0
  372. package/docs/MPCWalletInfo.md +15 -0
  373. package/docs/MaxFeeAmount.md +9 -0
  374. package/docs/MaxTransferableValue.md +11 -0
  375. package/docs/MessageSignDestination.md +11 -0
  376. package/docs/MessageSignDestinationType.md +12 -0
  377. package/docs/MessageSignParams.md +14 -0
  378. package/docs/MessageSignSource.md +11 -0
  379. package/docs/MessageSignSourceType.md +12 -0
  380. package/docs/MpcContractCallSource.md +12 -0
  381. package/docs/MpcMessageSignSource.md +11 -0
  382. package/docs/MpcSigningGroup.md +10 -0
  383. package/docs/MpcTransferSource.md +13 -0
  384. package/docs/OAuthApi.md +112 -0
  385. package/docs/Pagination.md +11 -0
  386. package/docs/PoolDetails.md +24 -0
  387. package/docs/PoolDetailsAllOfValidatorsInfo.md +28 -0
  388. package/docs/PoolSummary.md +16 -0
  389. package/docs/RefreshTokenRequest.md +11 -0
  390. package/docs/ReplaceType.md +14 -0
  391. package/docs/RetryWebhookEventById201Response.md +9 -0
  392. package/docs/RootPubkey.md +10 -0
  393. package/docs/SafeContractCallSource.md +12 -0
  394. package/docs/SafeTransferSource.md +12 -0
  395. package/docs/SafeWallet.md +20 -0
  396. package/docs/SmartContractInitiator.md +10 -0
  397. package/docs/SmartContractWalletInfo.md +20 -0
  398. package/docs/SmartContractWalletOperationType.md +10 -0
  399. package/docs/SmartContractWalletType.md +10 -0
  400. package/docs/SourceGroup.md +10 -0
  401. package/docs/StakingPoolType.md +14 -0
  402. package/docs/StakingSource.md +13 -0
  403. package/docs/Stakings.md +22 -0
  404. package/docs/StakingsValidatorInfo.md +13 -0
  405. package/docs/SubWalletAssetBalance.md +11 -0
  406. package/docs/TSSGroups.md +11 -0
  407. package/docs/TSSRequest.md +13 -0
  408. package/docs/TSSRequestStatus.md +18 -0
  409. package/docs/TSSRequestType.md +14 -0
  410. package/docs/TokenBalance.md +10 -0
  411. package/docs/TokenBalanceBalance.md +12 -0
  412. package/docs/TokenInfo.md +19 -0
  413. package/docs/Transaction.md +36 -0
  414. package/docs/TransactionApprover.md +25 -0
  415. package/docs/TransactionBlockInfo.md +11 -0
  416. package/docs/TransactionCustodialAssetWalletSource.md +10 -0
  417. package/docs/TransactionDepositFromAddressSource.md +13 -0
  418. package/docs/TransactionDepositFromLoopSource.md +9 -0
  419. package/docs/TransactionDepositFromWalletSource.md +13 -0
  420. package/docs/TransactionDepositToAddressDestination.md +15 -0
  421. package/docs/TransactionDepositToWalletDestination.md +15 -0
  422. package/docs/TransactionDestination.md +26 -0
  423. package/docs/TransactionDestinationType.md +22 -0
  424. package/docs/TransactionDetail.md +37 -0
  425. package/docs/TransactionDetails.md +45 -0
  426. package/docs/TransactionEvmContractDestination.md +12 -0
  427. package/docs/TransactionEvmEip1559Fee.md +16 -0
  428. package/docs/TransactionEvmLegacyFee.md +14 -0
  429. package/docs/TransactionExchangeWalletSource.md +12 -0
  430. package/docs/TransactionFee.md +19 -0
  431. package/docs/TransactionFeeStationWalletSource.md +10 -0
  432. package/docs/TransactionFixedFee.md +12 -0
  433. package/docs/TransactionInitiatorType.md +16 -0
  434. package/docs/TransactionMPCWalletSource.md +13 -0
  435. package/docs/TransactionMessageSignEIP191Destination.md +10 -0
  436. package/docs/TransactionMessageSignEIP712Destination.md +10 -0
  437. package/docs/TransactionRawTxInfo.md +11 -0
  438. package/docs/TransactionRbf.md +13 -0
  439. package/docs/TransactionRbfSource.md +13 -0
  440. package/docs/TransactionReplacement.md +14 -0
  441. package/docs/TransactionRequestEvmEip1559Fee.md +13 -0
  442. package/docs/TransactionRequestEvmLegacyFee.md +12 -0
  443. package/docs/TransactionRequestFee.md +16 -0
  444. package/docs/TransactionRequestFixedFee.md +11 -0
  445. package/docs/TransactionRequestUtxoFee.md +12 -0
  446. package/docs/TransactionResend.md +9 -0
  447. package/docs/TransactionResult.md +10 -0
  448. package/docs/TransactionResultType.md +10 -0
  449. package/docs/TransactionSignatureResult.md +10 -0
  450. package/docs/TransactionSigner.md +28 -0
  451. package/docs/TransactionSmartContractSafeWalletSource.md +12 -0
  452. package/docs/TransactionSource.md +19 -0
  453. package/docs/TransactionSourceType.md +26 -0
  454. package/docs/TransactionStatus.md +30 -0
  455. package/docs/TransactionSubStatus.md +54 -0
  456. package/docs/TransactionTimeline.md +11 -0
  457. package/docs/TransactionTokeApproval.md +21 -0
  458. package/docs/TransactionTokenAmount.md +11 -0
  459. package/docs/TransactionTransferToAddressDestination.md +14 -0
  460. package/docs/TransactionTransferToAddressDestinationAccountOutput.md +11 -0
  461. package/docs/TransactionTransferToAddressDestinationUtxoOutputsInner.md +11 -0
  462. package/docs/TransactionTransferToWalletDestination.md +13 -0
  463. package/docs/TransactionType.md +18 -0
  464. package/docs/TransactionUtxo.md +10 -0
  465. package/docs/TransactionUtxoFee.md +13 -0
  466. package/docs/TransactionWebhookEventData.md +48 -0
  467. package/docs/TransactionsApi.md +562 -0
  468. package/docs/TransferDestination.md +17 -0
  469. package/docs/TransferDestinationType.md +12 -0
  470. package/docs/TransferParams.md +15 -0
  471. package/docs/TransferSource.md +15 -0
  472. package/docs/UTXO.md +16 -0
  473. package/docs/UpdateCustodialWalletParams.md +10 -0
  474. package/docs/UpdateExchangeWalletParams.md +10 -0
  475. package/docs/UpdateGroupAction.md +10 -0
  476. package/docs/UpdateKeyShareHolderGroupByIdRequest.md +9 -0
  477. package/docs/UpdateMpcProjectByIdRequest.md +9 -0
  478. package/docs/UpdateMpcVaultByIdRequest.md +9 -0
  479. package/docs/UpdateMpcWalletParams.md +10 -0
  480. package/docs/UpdateSmartContractWalletParams.md +10 -0
  481. package/docs/UpdateWalletParams.md +10 -0
  482. package/docs/UpdateWebhookEndpointByIdRequest.md +22 -0
  483. package/docs/UtxoFeeBasePrice.md +9 -0
  484. package/docs/UtxoFeeRate.md +13 -0
  485. package/docs/WalletInfo.md +18 -0
  486. package/docs/WalletSubtype.md +22 -0
  487. package/docs/WalletType.md +16 -0
  488. package/docs/WalletsApi.md +1198 -0
  489. package/docs/WalletsMPCWalletsApi.md +974 -0
  490. package/docs/WebhookEndpoint.md +14 -0
  491. package/docs/WebhookEndpointStatus.md +20 -0
  492. package/docs/WebhookEvent.md +16 -0
  493. package/docs/WebhookEventData.md +48 -0
  494. package/docs/WebhookEventDataType.md +20 -0
  495. package/docs/WebhookEventLog.md +17 -0
  496. package/docs/WebhookEventStatus.md +14 -0
  497. package/docs/WebhookEventType.md +16 -0
  498. package/package.json +49 -0
@@ -0,0 +1,747 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _superagent = _interopRequireDefault(require("superagent"));
8
+ var _querystring = _interopRequireDefault(require("querystring"));
9
+ var _ApiSigner = _interopRequireDefault(require("./crypto/ApiSigner"));
10
+ var _Env = _interopRequireDefault(require("./Env"));
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
12
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
13
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
14
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
15
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
16
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
17
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
18
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
19
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
20
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
21
+ * Cobo Wallet as a Service 2.0
22
+ *
23
+ * Contact: support@cobo.com
24
+ *
25
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
26
+ * https://openapi-generator.tech
27
+ * Do not edit the class manually.
28
+ *
29
+ */
30
+ /**
31
+ * @module ApiClient
32
+ */
33
+ /**
34
+ * Manages low level client-server communications, parameter marshalling, etc. There should not be any need for an
35
+ * application to use this class directly - the *Api and model classes provide the public API for the service. The
36
+ * contents of this file should be regarded as internal but are documented for completeness.
37
+ * @alias module:ApiClient
38
+ * @class
39
+ */
40
+ var ApiClient = /*#__PURE__*/function () {
41
+ /**
42
+ * The base URL against which to resolve every API call's (relative) path.
43
+ * Overrides the default value set in spec file if present
44
+ * @param {Env} env
45
+ * @param {String} privateKey
46
+ */
47
+ function ApiClient() {
48
+ var env = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _Env["default"].PROD;
49
+ var privateKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
50
+ _classCallCheck(this, ApiClient);
51
+ /**
52
+ * The base URL against which to resolve every API call's (relative) path.
53
+ * @type {String}
54
+ * @default https://api.dev.cobo.com/v2
55
+ */
56
+ this.basePath = env.basePath;
57
+ this.privateKey = privateKey;
58
+
59
+ /**
60
+ * The authentication methods to be included for all API calls.
61
+ * @type {Array.<String>}
62
+ */
63
+ this.authentications = {
64
+ 'CoboAuth': {
65
+ type: 'apiKey',
66
+ 'in': 'header',
67
+ name: 'BIZ-API-KEY'
68
+ },
69
+ 'OAuth2': {
70
+ type: 'oauth2'
71
+ }
72
+ };
73
+
74
+ /**
75
+ * The default HTTP headers to be included for all API calls.
76
+ * @type {Array.<String>}
77
+ * @default {}
78
+ */
79
+ this.defaultHeaders = {
80
+ 'User-Agent': 'cobo-waas2-js-sdk/1.1.1'
81
+ };
82
+
83
+ /**
84
+ * The default HTTP timeout for all API calls.
85
+ * @type {Number}
86
+ * @default 60000
87
+ */
88
+ this.timeout = 60000;
89
+
90
+ /**
91
+ * If set to false an additional timestamp parameter is added to all API GET calls to
92
+ * prevent browser caching
93
+ * @type {Boolean}
94
+ * @default true
95
+ */
96
+ this.cache = true;
97
+
98
+ /**
99
+ * If set to true, the client will save the cookies from each server
100
+ * response, and return them in the next request.
101
+ * @default false
102
+ */
103
+ this.enableCookies = false;
104
+
105
+ /*
106
+ * Used to save and return cookies in a node.js (non-browser) setting,
107
+ * if this.enableCookies is set to true.
108
+ */
109
+ if (typeof window === 'undefined') {
110
+ this.agent = new _superagent["default"].agent();
111
+ }
112
+
113
+ /*
114
+ * Allow user to override superagent agent
115
+ */
116
+ this.requestAgent = null;
117
+
118
+ /*
119
+ * Allow user to add superagent plugins
120
+ */
121
+ this.plugins = null;
122
+ }
123
+ return _createClass(ApiClient, [{
124
+ key: "setEnv",
125
+ value: function setEnv(env) {
126
+ this.basePath = env.basePath;
127
+ }
128
+ }, {
129
+ key: "setPrivateKey",
130
+ value: function setPrivateKey(privateKey) {
131
+ this.privateKey = privateKey;
132
+ }
133
+
134
+ /**
135
+ * @param {Object.<String, String>} header
136
+ */
137
+ }, {
138
+ key: "setHeader",
139
+ value: function setHeader(header) {
140
+ this.defaultHeaders = _objectSpread(_objectSpread({}, this.defaultHeaders), header);
141
+ }
142
+
143
+ /**
144
+ * Returns a string representation for an actual parameter.
145
+ * @param param The actual parameter.
146
+ * @returns {String} The string representation of <code>param</code>.
147
+ */
148
+ }, {
149
+ key: "paramToString",
150
+ value: function paramToString(param) {
151
+ if (param == undefined || param == null) {
152
+ return '';
153
+ }
154
+ if (param instanceof Date) {
155
+ return param.toJSON();
156
+ }
157
+ if (ApiClient.canBeJsonified(param)) {
158
+ return JSON.stringify(param);
159
+ }
160
+ return param.toString();
161
+ }
162
+
163
+ /**
164
+ * Returns a boolean indicating if the parameter could be JSON.stringified
165
+ * @param param The actual parameter
166
+ * @returns {Boolean} Flag indicating if <code>param</code> can be JSON.stringified
167
+ */
168
+ }, {
169
+ key: "buildUrl",
170
+ value:
171
+ /**
172
+ * Builds full URL by appending the given path to the base URL and replacing path parameter place-holders with parameter values.
173
+ * NOTE: query parameters are not handled here.
174
+ * @param {String} path The path to append to the base URL.
175
+ * @param {Object} pathParams The parameter values to append.
176
+ * @param {String} apiBasePath Base path defined in the path, operation level to override the default one
177
+ * @returns {String} The encoded path with parameter values substituted.
178
+ */
179
+ function buildUrl(path, pathParams, apiBasePath) {
180
+ var _this = this;
181
+ if (!path.match(/^\//)) {
182
+ path = '/' + path;
183
+ }
184
+ var url = this.basePath + path;
185
+
186
+ // use API (operation, path) base path if defined
187
+ if (apiBasePath !== null && apiBasePath !== undefined) {
188
+ url = apiBasePath + path;
189
+ }
190
+ url = url.replace(/\{([\w-\.#]+)\}/g, function (fullMatch, key) {
191
+ var value;
192
+ if (pathParams.hasOwnProperty(key)) {
193
+ value = _this.paramToString(pathParams[key]);
194
+ } else {
195
+ value = fullMatch;
196
+ }
197
+ return encodeURIComponent(value);
198
+ });
199
+ return url;
200
+ }
201
+
202
+ /**
203
+ * Checks whether the given content type represents JSON.<br>
204
+ * JSON content type examples:<br>
205
+ * <ul>
206
+ * <li>application/json</li>
207
+ * <li>application/json; charset=UTF8</li>
208
+ * <li>APPLICATION/JSON</li>
209
+ * </ul>
210
+ * @param {String} contentType The MIME content type to check.
211
+ * @returns {Boolean} <code>true</code> if <code>contentType</code> represents JSON, otherwise <code>false</code>.
212
+ */
213
+ }, {
214
+ key: "isJsonMime",
215
+ value: function isJsonMime(contentType) {
216
+ return Boolean(contentType != null && contentType.match(/^application\/json(;.*)?$/i));
217
+ }
218
+
219
+ /**
220
+ * Chooses a content type from the given array, with JSON preferred; i.e. return JSON if included, otherwise return the first.
221
+ * @param {Array.<String>} contentTypes
222
+ * @returns {String} The chosen content type, preferring JSON.
223
+ */
224
+ }, {
225
+ key: "jsonPreferredMime",
226
+ value: function jsonPreferredMime(contentTypes) {
227
+ for (var i = 0; i < contentTypes.length; i++) {
228
+ if (this.isJsonMime(contentTypes[i])) {
229
+ return contentTypes[i];
230
+ }
231
+ }
232
+ return contentTypes[0];
233
+ }
234
+
235
+ /**
236
+ * Checks whether the given parameter value represents file-like content.
237
+ * @param param The parameter to check.
238
+ * @returns {Boolean} <code>true</code> if <code>param</code> represents a file.
239
+ */
240
+ }, {
241
+ key: "isFileParam",
242
+ value: function isFileParam(param) {
243
+ // fs.ReadStream in Node.js and Electron (but not in runtime like browserify)
244
+ if (typeof require === 'function') {
245
+ var fs;
246
+ try {
247
+ fs = require('fs');
248
+ } catch (err) {}
249
+ if (fs && fs.ReadStream && param instanceof fs.ReadStream) {
250
+ return true;
251
+ }
252
+ }
253
+
254
+ // Buffer in Node.js
255
+ if (typeof Buffer === 'function' && param instanceof Buffer) {
256
+ return true;
257
+ }
258
+
259
+ // Blob in browser
260
+ if (typeof Blob === 'function' && param instanceof Blob) {
261
+ return true;
262
+ }
263
+
264
+ // File in browser (it seems File object is also instance of Blob, but keep this for safe)
265
+ if (typeof File === 'function' && param instanceof File) {
266
+ return true;
267
+ }
268
+ return false;
269
+ }
270
+
271
+ /**
272
+ * Normalizes parameter values:
273
+ * <ul>
274
+ * <li>remove nils</li>
275
+ * <li>keep files and arrays</li>
276
+ * <li>format to string with `paramToString` for other cases</li>
277
+ * </ul>
278
+ * @param {Object.<String, Object>} params The parameters as object properties.
279
+ * @returns {Object.<String, Object>} normalized parameters.
280
+ */
281
+ }, {
282
+ key: "normalizeParams",
283
+ value: function normalizeParams(params) {
284
+ var newParams = {};
285
+ for (var key in params) {
286
+ if (params.hasOwnProperty(key) && params[key] != undefined && params[key] != null) {
287
+ var value = params[key];
288
+ if (this.isFileParam(value) || Array.isArray(value)) {
289
+ newParams[key] = value;
290
+ } else {
291
+ newParams[key] = this.paramToString(value);
292
+ }
293
+ }
294
+ }
295
+ return newParams;
296
+ }
297
+
298
+ /**
299
+ * Builds a string representation of an array-type actual parameter, according to the given collection format.
300
+ * @param {Array} param An array parameter.
301
+ * @param {module:ApiClient.CollectionFormatEnum} collectionFormat The array element separator strategy.
302
+ * @returns {String|Array} A string representation of the supplied collection, using the specified delimiter. Returns
303
+ * <code>param</code> as is if <code>collectionFormat</code> is <code>multi</code>.
304
+ */
305
+ }, {
306
+ key: "buildCollectionParam",
307
+ value: function buildCollectionParam(param, collectionFormat) {
308
+ if (param == null) {
309
+ return null;
310
+ }
311
+ switch (collectionFormat) {
312
+ case 'csv':
313
+ return param.map(this.paramToString, this).join(',');
314
+ case 'ssv':
315
+ return param.map(this.paramToString, this).join(' ');
316
+ case 'tsv':
317
+ return param.map(this.paramToString, this).join('\t');
318
+ case 'pipes':
319
+ return param.map(this.paramToString, this).join('|');
320
+ case 'multi':
321
+ //return the array directly as SuperAgent will handle it as expected
322
+ return param.map(this.paramToString, this);
323
+ case 'passthrough':
324
+ return param;
325
+ default:
326
+ throw new Error('Unknown collection format: ' + collectionFormat);
327
+ }
328
+ }
329
+
330
+ /**
331
+ * Applies authentication headers to the request.
332
+ * @param {Object} request The request object created by a <code>superagent()</code> call.
333
+ * @param {Array.<String>} authNames An array of authentication method names.
334
+ */
335
+ }, {
336
+ key: "applyAuthToRequest",
337
+ value: function applyAuthToRequest(request, authNames) {
338
+ var _this2 = this;
339
+ authNames.forEach(function (authName) {
340
+ var auth = _this2.authentications[authName];
341
+ switch (auth.type) {
342
+ case 'basic':
343
+ if (auth.username || auth.password) {
344
+ request.auth(auth.username || '', auth.password || '');
345
+ }
346
+ break;
347
+ case 'bearer':
348
+ if (auth.accessToken) {
349
+ var localVarBearerToken = typeof auth.accessToken === 'function' ? auth.accessToken() : auth.accessToken;
350
+ request.set({
351
+ 'Authorization': 'Bearer ' + localVarBearerToken
352
+ });
353
+ }
354
+ break;
355
+ case 'apiKey':
356
+ if (auth.apiKey) {
357
+ var data = {};
358
+ if (auth.apiKeyPrefix) {
359
+ data[auth.name] = auth.apiKeyPrefix + ' ' + auth.apiKey;
360
+ } else {
361
+ data[auth.name] = auth.apiKey;
362
+ }
363
+ if (auth['in'] === 'header') {
364
+ request.set(data);
365
+ } else {
366
+ request.query(data);
367
+ }
368
+ }
369
+ break;
370
+ case 'oauth2':
371
+ if (auth.accessToken) {
372
+ request.set({
373
+ 'Authorization': 'Bearer ' + auth.accessToken
374
+ });
375
+ }
376
+ break;
377
+ default:
378
+ throw new Error('Unknown authentication type: ' + auth.type);
379
+ }
380
+ });
381
+ }
382
+
383
+ /**
384
+ * Deserializes an HTTP response body into a value of the specified type.
385
+ * @param {Object} response A SuperAgent response object.
386
+ * @param {(String|Array.<String>|Object.<String, Object>|Function)} returnType The type to return. Pass a string for simple types
387
+ * or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To
388
+ * return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type:
389
+ * all properties on <code>data<code> will be converted to this type.
390
+ * @returns A value of the specified type.
391
+ */
392
+ }, {
393
+ key: "deserialize",
394
+ value: function deserialize(response, returnType) {
395
+ if (response == null || returnType == null || response.status == 204) {
396
+ return null;
397
+ }
398
+
399
+ // Rely on SuperAgent for parsing response body.
400
+ // See http://visionmedia.github.io/superagent/#parsing-response-bodies
401
+ var data = response.body;
402
+ if (data == null || _typeof(data) === 'object' && typeof data.length === 'undefined' && !Object.keys(data).length) {
403
+ // SuperAgent does not always produce a body; use the unparsed response as a fallback
404
+ data = response.text;
405
+ }
406
+ return ApiClient.convertToType(data, returnType);
407
+ }
408
+
409
+ /**
410
+ * Invokes the REST service using the supplied settings and parameters.
411
+ * @param {String} path The base URL to invoke.
412
+ * @param {String} httpMethod The HTTP method to use.
413
+ * @param {Object.<String, String>} pathParams A map of path parameters and their values.
414
+ * @param {Object.<String, Object>} queryParams A map of query parameters and their values.
415
+ * @param {Object.<String, Object>} headerParams A map of header parameters and their values.
416
+ * @param {Object.<String, Object>} formParams A map of form parameters and their values.
417
+ * @param {Object} bodyParam The value to pass as the request body.
418
+ * @param {Array.<String>} authNames An array of authentication type names.
419
+ * @param {Array.<String>} contentTypes An array of request MIME types.
420
+ * @param {Array.<String>} accepts An array of acceptable response MIME types.
421
+ * @param {(String|Array|ObjectFunction)} returnType The required type to return; can be a string for simple types or the
422
+ * constructor for a complex type.
423
+ * @param {String} apiBasePath base path defined in the operation/path level to override the default one
424
+ * @returns {Promise} A {@link https://www.promisejs.org/|Promise} object.
425
+ */
426
+ }, {
427
+ key: "callApi",
428
+ value: function callApi(path, httpMethod, pathParams, queryParams, headerParams, formParams, bodyParam, authNames, contentTypes, accepts, returnType, apiBasePath) {
429
+ var _this3 = this;
430
+ var url = this.buildUrl(path, pathParams, apiBasePath);
431
+ var request = (0, _superagent["default"])(httpMethod, url);
432
+ // Filter out empty query parameters
433
+ queryParams = Object.keys(queryParams).filter(function (k) {
434
+ return queryParams[k] !== undefined && queryParams[k] !== '';
435
+ }).reduce(function (acc, key) {
436
+ acc[key] = queryParams[key];
437
+ return acc;
438
+ }, {});
439
+ var queryStr = Object.keys(queryParams).filter(function (k) {
440
+ return queryParams[k] !== undefined && queryParams[k] !== '';
441
+ }).map(function (k) {
442
+ return k + '=' + encodeURIComponent(queryParams[k]).replace(/%20/g, "+");
443
+ }).join('&');
444
+ var signer = new _ApiSigner["default"](this.privateKey);
445
+ request.set(signer.generateHeaders(new URL(url).pathname, httpMethod, bodyParam, queryStr));
446
+ if (this.plugins !== null) {
447
+ for (var index in this.plugins) {
448
+ if (this.plugins.hasOwnProperty(index)) {
449
+ request.use(this.plugins[index]);
450
+ }
451
+ }
452
+ }
453
+
454
+ // apply authentications
455
+ this.applyAuthToRequest(request, authNames);
456
+
457
+ // set query parameters
458
+ if (httpMethod.toUpperCase() === 'GET' && this.cache === false) {
459
+ queryParams['_'] = new Date().getTime();
460
+ }
461
+ request.query(this.normalizeParams(queryParams));
462
+
463
+ // set header parameters
464
+ request.set(this.defaultHeaders).set(this.normalizeParams(headerParams));
465
+
466
+ // set requestAgent if it is set by user
467
+ if (this.requestAgent) {
468
+ request.agent(this.requestAgent);
469
+ }
470
+
471
+ // set request timeout
472
+ request.timeout(this.timeout);
473
+ var contentType = this.jsonPreferredMime(contentTypes);
474
+ if (contentType) {
475
+ // Issue with superagent and multipart/form-data (https://github.com/visionmedia/superagent/issues/746)
476
+ if (contentType != 'multipart/form-data') {
477
+ request.type(contentType);
478
+ }
479
+ }
480
+ if (contentType === 'application/x-www-form-urlencoded') {
481
+ request.send(_querystring["default"].stringify(this.normalizeParams(formParams)));
482
+ } else if (contentType == 'multipart/form-data') {
483
+ var _formParams = this.normalizeParams(formParams);
484
+ for (var key in _formParams) {
485
+ if (_formParams.hasOwnProperty(key)) {
486
+ var _formParamsValue = _formParams[key];
487
+ if (this.isFileParam(_formParamsValue)) {
488
+ // file field
489
+ request.attach(key, _formParamsValue);
490
+ } else if (Array.isArray(_formParamsValue) && _formParamsValue.length && this.isFileParam(_formParamsValue[0])) {
491
+ // multiple files
492
+ _formParamsValue.forEach(function (file) {
493
+ return request.attach(key, file);
494
+ });
495
+ } else {
496
+ request.field(key, _formParamsValue);
497
+ }
498
+ }
499
+ }
500
+ } else if (bodyParam !== null && bodyParam !== undefined) {
501
+ if (!request.header['Content-Type']) {
502
+ request.type('application/json');
503
+ }
504
+ request.send(bodyParam);
505
+ }
506
+ var accept = this.jsonPreferredMime(accepts);
507
+ if (accept) {
508
+ request.accept(accept);
509
+ }
510
+ if (returnType === 'Blob') {
511
+ request.responseType('blob');
512
+ } else if (returnType === 'String') {
513
+ request.responseType('text');
514
+ }
515
+
516
+ // Attach previously saved cookies, if enabled
517
+ if (this.enableCookies) {
518
+ if (typeof window === 'undefined') {
519
+ this.agent._attachCookies(request);
520
+ } else {
521
+ request.withCredentials();
522
+ }
523
+ }
524
+ return new Promise(function (resolve, reject) {
525
+ request.end(function (error, response) {
526
+ if (error) {
527
+ var err = {};
528
+ if (response) {
529
+ err.status = response.status;
530
+ err.statusText = response.statusText;
531
+ err.body = response.body;
532
+ err.response = response;
533
+ }
534
+ err.error = error;
535
+ reject(err);
536
+ } else {
537
+ try {
538
+ var data = _this3.deserialize(response, returnType);
539
+ if (_this3.enableCookies && typeof window === 'undefined') {
540
+ _this3.agent._saveCookies(response);
541
+ }
542
+ resolve({
543
+ data: data,
544
+ response: response
545
+ });
546
+ } catch (err) {
547
+ reject(err);
548
+ }
549
+ }
550
+ });
551
+ });
552
+ }
553
+
554
+ /**
555
+ * Parses an ISO-8601 string representation or epoch representation of a date value.
556
+ * @param {String} str The date value as a string.
557
+ * @returns {Date} The parsed date object.
558
+ */
559
+ }, {
560
+ key: "hostSettings",
561
+ value:
562
+ /**
563
+ * Gets an array of host settings
564
+ * @returns An array of host settings
565
+ */
566
+ function hostSettings() {
567
+ return [{
568
+ 'url': "https://api.dev.cobo.com/v2",
569
+ 'description': "Development environment"
570
+ }, {
571
+ 'url': "https://api.cobo.com/v2",
572
+ 'description': "Production environment"
573
+ }];
574
+ }
575
+ }, {
576
+ key: "getBasePathFromSettings",
577
+ value: function getBasePathFromSettings(index) {
578
+ var variables = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
579
+ var servers = this.hostSettings();
580
+
581
+ // check array index out of bound
582
+ if (index < 0 || index >= servers.length) {
583
+ throw new Error("Invalid index " + index + " when selecting the host settings. Must be less than " + servers.length);
584
+ }
585
+ var server = servers[index];
586
+ var url = server['url'];
587
+
588
+ // go through variable and assign a value
589
+ for (var variable_name in server['variables']) {
590
+ if (variable_name in variables) {
591
+ var variable = server['variables'][variable_name];
592
+ if (!('enum_values' in variable) || variable['enum_values'].includes(variables[variable_name])) {
593
+ url = url.replace("{" + variable_name + "}", variables[variable_name]);
594
+ } else {
595
+ throw new Error("The variable `" + variable_name + "` in the host URL has invalid value " + variables[variable_name] + ". Must be " + server['variables'][variable_name]['enum_values'] + ".");
596
+ }
597
+ } else {
598
+ // use default value
599
+ url = url.replace("{" + variable_name + "}", server['variables'][variable_name]['default_value']);
600
+ }
601
+ }
602
+ return url;
603
+ }
604
+
605
+ /**
606
+ * Constructs a new map or array model from REST data.
607
+ * @param data {Object|Array} The REST data.
608
+ * @param obj {Object|Array} The target object or array.
609
+ */
610
+ }], [{
611
+ key: "canBeJsonified",
612
+ value: function canBeJsonified(str) {
613
+ if (typeof str !== 'string' && _typeof(str) !== 'object') return false;
614
+ try {
615
+ var type = str.toString();
616
+ return type === '[object Object]' || type === '[object Array]';
617
+ } catch (err) {
618
+ return false;
619
+ }
620
+ }
621
+ }, {
622
+ key: "parseDate",
623
+ value: function parseDate(str) {
624
+ if (isNaN(str)) {
625
+ return new Date(str.replace(/(\d)(T)(\d)/i, '$1 $3'));
626
+ }
627
+ return new Date(+str);
628
+ }
629
+
630
+ /**
631
+ * Converts a value to the specified type.
632
+ * @param {(String|Object)} data The data to convert, as a string or object.
633
+ * @param {(String|Array.<String>|Object.<String, Object>|Function)} type The type to return. Pass a string for simple types
634
+ * or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To
635
+ * return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type:
636
+ * all properties on <code>data<code> will be converted to this type.
637
+ * @returns An instance of the specified type or null or undefined if data is null or undefined.
638
+ */
639
+ }, {
640
+ key: "convertToType",
641
+ value: function convertToType(data, type) {
642
+ if (data === null || data === undefined) return data;
643
+ switch (type) {
644
+ case 'Boolean':
645
+ return Boolean(data);
646
+ case 'Integer':
647
+ return parseInt(data, 10);
648
+ case 'Number':
649
+ return parseFloat(data);
650
+ case 'String':
651
+ return String(data);
652
+ case 'Date':
653
+ return ApiClient.parseDate(String(data));
654
+ case 'Blob':
655
+ return data;
656
+ default:
657
+ if (type === Object) {
658
+ // generic object, return directly
659
+ return data;
660
+ } else if (typeof type.constructFromObject === 'function') {
661
+ // for model type like User and enum class
662
+ return type.constructFromObject(data);
663
+ } else if (Array.isArray(type)) {
664
+ // for array type like: ['String']
665
+ var itemType = type[0];
666
+ return data.map(function (item) {
667
+ return ApiClient.convertToType(item, itemType);
668
+ });
669
+ } else if (_typeof(type) === 'object') {
670
+ // for plain object type like: {'String': 'Integer'}
671
+ var keyType, valueType;
672
+ for (var k in type) {
673
+ if (type.hasOwnProperty(k)) {
674
+ keyType = k;
675
+ valueType = type[k];
676
+ break;
677
+ }
678
+ }
679
+ var result = {};
680
+ for (var k in data) {
681
+ if (data.hasOwnProperty(k)) {
682
+ var key = ApiClient.convertToType(k, keyType);
683
+ var value = ApiClient.convertToType(data[k], valueType);
684
+ result[key] = value;
685
+ }
686
+ }
687
+ return result;
688
+ } else {
689
+ // for unknown type, return the data directly
690
+ return data;
691
+ }
692
+ }
693
+ }
694
+ }, {
695
+ key: "constructFromObject",
696
+ value: function constructFromObject(data, obj, itemType) {
697
+ if (Array.isArray(data)) {
698
+ for (var i = 0; i < data.length; i++) {
699
+ if (data.hasOwnProperty(i)) obj[i] = ApiClient.convertToType(data[i], itemType);
700
+ }
701
+ } else {
702
+ for (var k in data) {
703
+ if (data.hasOwnProperty(k)) obj[k] = ApiClient.convertToType(data[k], itemType);
704
+ }
705
+ }
706
+ }
707
+ }]);
708
+ }();
709
+ /**
710
+ * Enumeration of collection format separator strategies.
711
+ * @enum {String}
712
+ * @readonly
713
+ */
714
+ ApiClient.CollectionFormatEnum = {
715
+ /**
716
+ * Comma-separated values. Value: <code>csv</code>
717
+ * @const
718
+ */
719
+ CSV: ',',
720
+ /**
721
+ * Space-separated values. Value: <code>ssv</code>
722
+ * @const
723
+ */
724
+ SSV: ' ',
725
+ /**
726
+ * Tab-separated values. Value: <code>tsv</code>
727
+ * @const
728
+ */
729
+ TSV: '\t',
730
+ /**
731
+ * Pipe(|)-separated values. Value: <code>pipes</code>
732
+ * @const
733
+ */
734
+ PIPES: '|',
735
+ /**
736
+ * Native array. Value: <code>multi</code>
737
+ * @const
738
+ */
739
+ MULTI: 'multi'
740
+ };
741
+
742
+ /**
743
+ * The default API client implementation.
744
+ * @type {module:ApiClient}
745
+ */
746
+ ApiClient.instance = new ApiClient();
747
+ var _default = exports["default"] = ApiClient;