Skip to content

Latest commit

 

History

History
410 lines (383 loc) · 33.4 KB

README.md

File metadata and controls

410 lines (383 loc) · 33.4 KB

cobo-waas2-js-sdk

CoboWaas2 - JavaScript client for cobo-waas2-js-sdk 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
  • Support for 80+ chains and 3000+ tokens
  • A comprehensive selection of webhook events
  • Flexible usage models for MPC wallets, including Organization-Controlled Wallets and User-Controlled Wallets
  • 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.

This SDK is automatically generated by the OpenAPI Generator project:

  • API version: v2
  • Package version: 1.0.1
  • Generator version: 7.6.0
  • Build package: org.openapitools.codegen.languages.JavascriptClientCodegen For more information, please visit https://www.cobo.com/waas

Installation

npm install cobo-waas2 --save

Getting Started

Please follow the installation instruction and execute the following JS code:

const CoboWaas2 = require('cobo-waas2');
// initial default api client
const apiClient = CoboWaas2.ApiClient.instance
// for dev env
// apiClient.setEnv(CoboWaas2.Env.DEV);
apiClient.setPrivateKey("<YOUR_API_PRIVATE_KEY_IN_HEX>");
// call api
const apiInstance = new CoboWaas2.WalletsApi();
const opts = {
  'wallet_type': CoboWaas2.WalletType.Custodial, // WalletType | The wallet type.  - `Custodial`: [Custodial Wallets](https://manuals.cobo.com/en/portal/custodial-wallets/introduction)  - `MPC`: [MPC Wallets](https://manuals.cobo.com/en/portal/mpc-wallets/introduction)  - `SmartContract`: [Smart Contract Wallets](https://manuals.cobo.com/en/portal/smart-contract-wallets/introduction)  - `Exchange`: [Exchange Wallets](https://manuals.cobo.com/en/portal/exchange-wallets/introduction)
  'wallet_subtype': CoboWaas2.WalletSubtype.Asset, // WalletSubtype | The wallet subtype.  - `Asset`: Custodial Wallets (Asset Wallets)  - `Web3`: Custodial Wallets (Web3 Wallets)  - `Main`: Exchange Wallets (Main Account)  - `Sub`: Exchange Wallets (Sub Account)  - `Org-Controlled`: MPC Wallets (Organization-Controlled Wallets)  - `User-Controlled`: MPC Wallets (User-Controlled Wallets)  - `Safe{Wallet}`: Smart Contract Wallets (Safe{Wallet})
  'chain_ids': "BTC,ETH", // String | A list of chain IDs, separated by comma. The chain ID is the unique identifier of a blockchain. You can retrieve the IDs of all the chains you can use by calling [List enabled chains](/v2/api-references/wallets/list-enabled-chains).
  'limit': 10, // Number | The maximum number of objects to return. For most operations, the value range is [1, 50].
  'before': "", // String | An object ID that serves as a starting point for retrieving data in reverse chronological order. For example, if you specify `before` as `RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1`, the request will retrieve a list of data objects that end before the object with the object ID `RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1`. You can set this parameter to the value of `pagination.before` in the response of the previous request.  - If you set both `after` and `before`, an error will occur.  - If you leave both `before` and `after` empty, the first page of data is returned.  - If you set `before` to `infinity`, the last page of data is returned.
  'after': "" // String | An object ID that acts as a starting point for retrieving data in chronological order. For example, if you specify `after` as `RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk`, the request will retrieve a list of data objects that start after the object with the object ID `RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk`. You can set this parameter to the value of `pagination.after` in the response of the previous request.  - If you set both `after` and `before`, an error will occur.  - If you leave both `before` and `after` empty, the first page of data is returned.
};
apiInstance.listSupportedChains(opts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Documentation for API Endpoints

All URIs are relative to https://api.dev.cobo.com/v2

Class Method HTTP request Description
CoboWaas2.DevelopersWebhooksApi createWebhookEndpoint POST /webhooks/endpoints Register webhook endpoint
CoboWaas2.DevelopersWebhooksApi getWebhookEndpointById GET /webhooks/endpoints/{endpoint_id} Get webhook endpoint information
CoboWaas2.DevelopersWebhooksApi getWebhookEventById GET /webhooks/endpoints/{endpoint_id}/events/{event_id} Retrieve event information
CoboWaas2.DevelopersWebhooksApi listWebhookEndpoints GET /webhooks/endpoints List webhook endpoints
CoboWaas2.DevelopersWebhooksApi listWebhookEventDefinitions GET /webhooks/events/definitions Get webhook event types
CoboWaas2.DevelopersWebhooksApi listWebhookEventLogs GET /webhooks/endpoints/{endpoint_id}/events/{event_id}/logs List webhook event logs
CoboWaas2.DevelopersWebhooksApi listWebhookEvents GET /webhooks/endpoints/{endpoint_id}/events List all webhook events
CoboWaas2.DevelopersWebhooksApi retryWebhookEventById POST /webhooks/endpoints/{endpoint_id}/events/{event_id}/retry Retry event
CoboWaas2.DevelopersWebhooksApi updateWebhookEndpointById PUT /webhooks/endpoints/{endpoint_id} Update webhook endpoint
CoboWaas2.TransactionsApi cancelTransactionById POST /transactions/{transaction_id}/cancel Cancel transaction
CoboWaas2.TransactionsApi createContractCallTransaction POST /transactions/contract_call Call smart contract
CoboWaas2.TransactionsApi createMessageSignTransaction POST /transactions/message_sign Sign message
CoboWaas2.TransactionsApi createTransferTransaction POST /transactions/transfer Transfer token
CoboWaas2.TransactionsApi dropTransactionById POST /transactions/{transaction_id}/drop Drop transaction
CoboWaas2.TransactionsApi estimateFee POST /transactions/estimate_fee Estimate transaction fee
CoboWaas2.TransactionsApi getTransactionById GET /transactions/{transaction_id} Get transaction information
CoboWaas2.TransactionsApi listTransactions GET /transactions List all transactions
CoboWaas2.TransactionsApi resendTransactionById POST /transactions/{transaction_id}/resend Resend transaction
CoboWaas2.TransactionsApi speedupTransactionById POST /transactions/{transaction_id}/speedup Speed up transaction
CoboWaas2.WalletsApi checkAddressValidity GET /wallets/check_address_validity Check address validity
CoboWaas2.WalletsApi createAddress POST /wallets/{wallet_id}/addresses Create addresses in wallet
CoboWaas2.WalletsApi createWallet POST /wallets Create wallet
CoboWaas2.WalletsApi deleteWalletById POST /wallets/{wallet_id}/delete Delete wallet
CoboWaas2.WalletsApi getAddress GET /wallets/{wallet_id}/addresses/{address} Get address information
CoboWaas2.WalletsApi getChainById GET /wallets/chains/{chain_id} Get chain information
CoboWaas2.WalletsApi getMaxTransferableValue GET /wallets/{wallet_id}/max_transferable_value Get maximum transferable value
CoboWaas2.WalletsApi getTokenById GET /wallets/tokens/{token_id} Get token information
CoboWaas2.WalletsApi getWalletById GET /wallets/{wallet_id} Get wallet information
CoboWaas2.WalletsApi listAddresses GET /wallets/{wallet_id}/addresses List wallet addresses
CoboWaas2.WalletsApi listEnabledChains GET /wallets/enabled_chains List enabled chains
CoboWaas2.WalletsApi listEnabledTokens GET /wallets/enabled_tokens List enabled tokens
CoboWaas2.WalletsApi listSupportedChains GET /wallets/chains List supported chains
CoboWaas2.WalletsApi listSupportedTokens GET /wallets/tokens List supported tokens
CoboWaas2.WalletsApi listTokenBalancesForAddress GET /wallets/{wallet_id}/addresses/{address}/tokens List token balances by address
CoboWaas2.WalletsApi listTokenBalancesForWallet GET /wallets/{wallet_id}/tokens List token balances by wallet
CoboWaas2.WalletsApi listUtxos GET /wallets/{wallet_id}/utxos List UTXOs
CoboWaas2.WalletsApi listWallets GET /wallets List all wallets
CoboWaas2.WalletsApi lockUtxos POST /wallets/{wallet_id}/utxos/lock Lock UTXOs
CoboWaas2.WalletsApi unlockUtxos POST /wallets/{wallet_id}/utxos/unlock Unlock UTXOs
CoboWaas2.WalletsApi updateWalletById PUT /wallets/{wallet_id} Update wallet
CoboWaas2.WalletsMPCWalletsApi cancelTssRequestById POST /wallets/mpc/vaults/{vault_id}/tss_requests/{tss_request_id}/cancel Cancel TSS request
CoboWaas2.WalletsMPCWalletsApi createKeyShareHolderGroup POST /wallets/mpc/vaults/{vault_id}/key_share_holder_groups Create key share holder group
CoboWaas2.WalletsMPCWalletsApi createMpcProject POST /wallets/mpc/projects Create project
CoboWaas2.WalletsMPCWalletsApi createMpcVault POST /wallets/mpc/vaults Create vault
CoboWaas2.WalletsMPCWalletsApi createTssRequest POST /wallets/mpc/vaults/{vault_id}/tss_requests Create TSS request
CoboWaas2.WalletsMPCWalletsApi deleteKeyShareHolderGroupById POST /wallets/mpc/vaults/{vault_id}/key_share_holder_groups/{key_share_holder_group_id}/delete Delete key share holder group
CoboWaas2.WalletsMPCWalletsApi getKeyShareHolderGroupById GET /wallets/mpc/vaults/{vault_id}/key_share_holder_groups/{key_share_holder_group_id} Get key share holder group information
CoboWaas2.WalletsMPCWalletsApi getMpcProjectById GET /wallets/mpc/projects/{project_id} Get project information
CoboWaas2.WalletsMPCWalletsApi getMpcVaultById GET /wallets/mpc/vaults/{vault_id} Get vault information
CoboWaas2.WalletsMPCWalletsApi getTssRequestById GET /wallets/mpc/vaults/{vault_id}/tss_requests/{tss_request_id} Get TSS request
CoboWaas2.WalletsMPCWalletsApi listCoboKeyHolders GET /wallets/mpc/cobo_key_share_holders List all Cobo key share holders
CoboWaas2.WalletsMPCWalletsApi listKeyShareHolderGroups GET /wallets/mpc/vaults/{vault_id}/key_share_holder_groups List all key share holder groups
CoboWaas2.WalletsMPCWalletsApi listMpcProjects GET /wallets/mpc/projects List all projects
CoboWaas2.WalletsMPCWalletsApi listMpcVaults GET /wallets/mpc/vaults List all vaults
CoboWaas2.WalletsMPCWalletsApi listTssRequests GET /wallets/mpc/vaults/{vault_id}/tss_requests List TSS requests
CoboWaas2.WalletsMPCWalletsApi updateKeyShareHolderGroupById PUT /wallets/mpc/vaults/{vault_id}/key_share_holder_groups/{key_share_holder_group_id} Update key share holder group
CoboWaas2.WalletsMPCWalletsApi updateMpcProjectById PUT /wallets/mpc/projects/{project_id} Update project name
CoboWaas2.WalletsMPCWalletsApi updateMpcVaultById PUT /wallets/mpc/vaults/{vault_id} Update vault name

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

CoboAuth

  • Type: API key
  • API key parameter name: BIZ-API-KEY
  • Location: HTTP header

OAuth2

  • Type: OAuth
  • Flow: accessCode
  • Authorization URL: https://auth.cobo.com/authorize
  • Scopes:
    • custodial_asset_wallet:create: Create access to custodial asset wallets
    • custodial_asset_wallet:add: Generate address access to custodial asset wallets
    • custodial_asset_wallet:edit: Change wallet name access to custodial asset wallets
    • custodial_asset_wallet:withdraw: Withdraw access to custodial asset wallets
    • mpc_organization_controlled_wallet:create: Create access to MPC organization-controlled wallets
    • mpc_organization_controlled_wallet:add: Generate address access to MPC organization-controlled wallets
    • mpc_organization_controlled_wallet:edit: Change wallet name access to MPC organization-controlled wallets
    • mpc_organization_controlled_wallet:withdraw: Withdraw access to MPC organization-controlled wallets
    • mpc_organization_controlled_wallet:contract_call: Contract call access to MPC organization-controlled wallets
    • mpc_organization_controlled_wallet:message_sign: Message sign access to MPC organization-controlled wallets
    • mpc_organization_controlled_vault:manage: Create/Edit access to MPC organization-controlled vaults
    • mpc_organization_controlled_key_group:manage: Create/Edit/Delete access to MPC organization-controlled key groups
    • mpc_organization_controlled_tss_request:manage: Create/Cancel access to MPC organization-controlled tss requests
    • mpc_user_controlled_wallet:create: Create access to MPC user-controlled wallets
    • mpc_user_controlled_wallet:add: Generate address access to MPC user-controlled wallets
    • mpc_user_controlled_wallet:edit: Change wallet name access to MPC user-controlled wallets
    • mpc_user_controlled_wallet:withdraw: Withdraw access to MPC user-controlled wallets
    • mpc_user_controlled_wallet:contract_call: Contract call access to MPC user-controlled wallets
    • mpc_user_controlled_wallet:message_sign: Message sign access to MPC user-controlled wallets
    • mpc_user_controlled_project:manage: Create/Edit access to MPC user-controlled projects
    • mpc_user_controlled_vault:manage: Create/Edit access to MPC user-controlled vaults
    • mpc_user_controlled_key_group:manage: Create/Edit/Delete access to MPC user-controlled key groups
    • mpc_user_controlled_tss_request:manage: Create/Cancel access to MPC user-controlled tss requests
    • webhook:resend: Resend access to webhook events
    • webhook_url:edit: Create/Edit access to webhook urls