Skip to content

CoboGlobal/cobo-waas2-js-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.8.0
  • 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/cobo-waas2 --save

Getting Started

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

const CoboWaas2 = require('@cobo/cobo-waas2');
// initial default api client
const apiClient = CoboWaas2.ApiClient.instance
// for dev env
// apiClient.setEnv(CoboWaas2.Env.DEV);

// by default, ed25519 is used
apiClient.setPrivateKey("<YOUR_API_PRIVATE_KEY_IN_HEX>");

// or secp256k1
// apiClient.setPrivateKey("<YOUR_API_PRIVATE_KEY_IN_HEX>", "SECP256K1");

// call api
const apiInstance = new CoboWaas2.WalletsApi();
const opts = {
  'wallet_type': new CoboWaas2.WalletType().Custodial,
  'wallet_subtype': new CoboWaas2.WalletSubtype().Asset,
  'chain_ids': "BTC,ETH",
  'limit': 10,
  'before': "",
  'after': ""
};
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.AddressBooksApi listAddressBooks GET /address_books List address book entries
CoboWaas2.DevelopersApi getApiKeyInfo GET /developers/api_key_info Get API key information
CoboWaas2.DevelopersApi listCallbackMessages GET /developers/callback_messages List all callback messages
CoboWaas2.DevelopersApi retryCallbackMessage POST /developers/callback_messages/{message_id}/retry Retry callback message
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 triggerTestWebhookEvent POST /webhooks/events/trigger Trigger test event
CoboWaas2.DevelopersWebhooksApi updateWebhookEndpointById PUT /webhooks/endpoints/{endpoint_id} Update webhook endpoint
CoboWaas2.OAuthApi getToken GET /oauth/token Get Org Access Token
CoboWaas2.OAuthApi refreshToken POST /oauth/token Refresh Org Access Token
CoboWaas2.StakingsApi createClaimActivity POST /stakings/activities/claim Create claim activity
CoboWaas2.StakingsApi createStakeActivity POST /stakings/activities/stake Create stake activity
CoboWaas2.StakingsApi createUnstakeActivity POST /stakings/activities/unstake Create unstake activity
CoboWaas2.StakingsApi createWithdrawActivity POST /stakings/activities/withdraw Create withdraw activity
CoboWaas2.StakingsApi getStakingActivityById GET /stakings/activities/{activity_id} Get staking activity details
CoboWaas2.StakingsApi getStakingById GET /stakings/{staking_id} Get staking position details
CoboWaas2.StakingsApi getStakingEstimationFee POST /stakings/estimate_fee Estimate staking fees
CoboWaas2.StakingsApi getStakingEstimationFeeV2 POST /stakings/estimate_fee_v2 Estimate staking fees v2
CoboWaas2.StakingsApi getStakingPoolById GET /stakings/pools/{pool_id} Get staking pool details
CoboWaas2.StakingsApi listStakingActivities GET /stakings/activities List staking activities
CoboWaas2.StakingsApi listStakingPools GET /stakings/pools List staking pools
CoboWaas2.StakingsApi listStakings GET /stakings List staking positions
CoboWaas2.TransactionsApi broadcastSignedTransactions POST /transactions/broadcast Broadcast signed transactions
CoboWaas2.TransactionsApi cancelTransactionById POST /transactions/{transaction_id}/cancel Cancel transaction
CoboWaas2.TransactionsApi checkLoopTransfers GET /transactions/check_loop_transfers Check Cobo Loop transfers
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 getTransactionApprovalDetail GET /transactions/{transaction_id}/approval_detail Get transaction approval information
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.TravelRuleApi getTransactionLimitation GET /travel_rule/transaction/limitation Retrieve transaction limitations
CoboWaas2.TravelRuleApi listSupportedCountries GET /travel_rule/transaction/countries List supported countries
CoboWaas2.TravelRuleApi submitDepositTravelRuleInfo POST /travel_rule/transaction/deposit/travel_rule_info Submit Deposit Transaction Travel Rule information
CoboWaas2.TravelRuleApi submitWithdrawTravelRuleInfo POST /travel_rule/transaction/withdraw/travel_rule_info Submit Withdraw Transaction Travel Rule information
CoboWaas2.WalletsApi checkAddressChainsValidity GET /wallets/check_address_chains_validity Check address validity across chains
CoboWaas2.WalletsApi checkAddressValidity GET /wallets/check_address_validity Check address validity
CoboWaas2.WalletsApi checkAddressesValidity GET /wallets/check_addresses_validity Check addresses 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 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.WalletsExchangeWalletApi listAssetBalancesForExchangeWallet GET /wallets/{wallet_id}/exchanges/assets List asset balances
CoboWaas2.WalletsExchangeWalletApi listExchanges GET /wallets/exchanges List supported exchanges
CoboWaas2.WalletsExchangeWalletApi listSupportedAssetsForExchange GET /wallets/exchanges/{exchange_id}/assets List supported assets
CoboWaas2.WalletsExchangeWalletApi listSupportedChainsForExchange GET /wallets/exchanges/{exchange_id}/assets/{asset_id}/chains List supported chains
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
CoboWaas2.WalletsSmartContractWalletsApi listSafeWalletDelegates POST /wallets/{wallet_id}/smart_contracts/delegates List Delegates

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