Class: CBAppClient
REST client for Coinbase's Coinbase App API: https://docs.cdp.coinbase.com/coinbase-app/docs/welcome
Extends
BaseRestClient
Constructors
Constructor
new CBAppClient(restClientOptions?: RestClientOptions, requestOptions?: AxiosRequestConfig): CBAppClient;Parameters
| Parameter | Type |
|---|---|
restClientOptions? | RestClientOptions |
requestOptions? | AxiosRequestConfig |
Returns
CBAppClient
Overrides
BaseRestClient.constructor
Methods
commitDeposit()
commitDeposit(params: object): Promise<CBAppTransfer>;Commit Deposit
Completes a deposit that is created in commit: false state.
Parameters
| Parameter | Type |
|---|---|
params | { account_id: string; deposit_id: string; } |
params.account_id | string |
params.deposit_id | string |
Returns
Promise<CBAppTransfer>
commitWithdrawal()
commitWithdrawal(params: object): Promise<CBAppTransfer>;Commit Withdrawal
Completes a withdrawal that is created in commit: false state.
Parameters
| Parameter | Type |
|---|---|
params | { account_id: string; withdrawal_id: string; } |
params.account_id | string |
params.withdrawal_id | string |
Returns
Promise<CBAppTransfer>
createAddress()
createAddress(params: object): Promise<{
data: CBAppAddress;
}>;Create Address
Creates a new address for an account. Addresses can be created for wallet account types.
Parameters
| Parameter | Type |
|---|---|
params | { account_id: string; name?: string; } |
params.account_id | string |
params.name? | string |
Returns
Promise<{ data: CBAppAddress; }>
deletePrivate()
deletePrivate(endpoint: string, params?: ParamsInRequest): Promise<any>;Parameters
| Parameter | Type |
|---|---|
endpoint | string |
params? | ParamsInRequest |
Returns
Promise<any>
Inherited from
BaseRestClient.deletePrivate
depositFunds()
depositFunds(params: CBAppDepositFundsRequest): Promise<CBAppTransfer>;Deposit Funds
Deposits user-defined amount of funds to a fiat account.
Parameters
| Parameter | Type |
|---|---|
params | CBAppDepositFundsRequest |
Returns
Promise<CBAppTransfer>
generateNewOrderId()
generateNewOrderId(): string;Returns
string
Inherited from
BaseRestClient.generateNewOrderId
get()
get(endpoint: string, params?: object): Promise<any>;Parameters
| Parameter | Type |
|---|---|
endpoint | string |
params? | object |
Returns
Promise<any>
Inherited from
BaseRestClient.get
getAccount()
getAccount(params: object): Promise<{
data: CBAppAccount;
}>;Show Account
Get a current user's account by account ID or currency string.
Parameters
| Parameter | Type |
|---|---|
params | { account_id: string; } |
params.account_id | string |
Returns
Promise<{ data: CBAppAccount; }>
getAccounts()
getAccounts(params?: object): Promise<{
data: CBAppAccount[];
pagination: CBAppPagination;
}>;List Accounts
List accounts accessible to the current credentials.
This endpoint is paginated. Omit paginationURL on the first request. Pass the previous response’s pagination.next_uri as paginationURL to fetch the next page. Stop when next_uri is null.
Parameters
| Parameter | Type |
|---|---|
params? | { paginationURL?: string; starting_after?: string; } |
params.paginationURL? | string |
params.starting_after? | string |
Returns
Promise<{ data: CBAppAccount[]; pagination: CBAppPagination; }>
getAddress()
getAddress(params: object): Promise<{
data: CBAppAddress;
}>;Get a single address for an account. Pass the account ID and address ID to select GET /v2/accounts/{account_id}/addresses/{addressId}. An address can belong to only one account; use createAddress() to create another address.
Parameters
| Parameter | Type |
|---|---|
params | { account_id: string; addressId: string; } |
params.account_id | string |
params.addressId | string |
Returns
Promise<{ data: CBAppAddress; }>
getAddresses()
getAddresses(params: object): Promise<{
data: CBAppAddress[];
pagination: CBAppPagination;
}>;List Addresses
Lists addresses for an account.
This endpoint is paginated. Omit paginationURL on the first request. Pass the previous response’s pagination.next_uri as paginationURL to fetch the next page. Stop when next_uri is null.
Parameters
| Parameter | Type |
|---|---|
params | { account_id: string; paginationURL?: string; } |
params.account_id | string |
params.paginationURL? | string |
Returns
Promise<{ data: CBAppAddress[]; pagination: CBAppPagination; }>
getAddressTransactions()
getAddressTransactions(params: object): Promise<{
data: CBAppTransaction[];
pagination: CBAppPagination;
}>;List transactions sent to a specific address. Pass the account ID and address ID.
This endpoint is paginated. Omit paginationURL on the first request. Pass the previous response’s pagination.next_uri as paginationURL to fetch the next page. Stop when next_uri is null.
Parameters
| Parameter | Type |
|---|---|
params | { account_id: string; addressId: string; paginationURL?: string; } |
params.account_id | string |
params.addressId | string |
params.paginationURL? | string |
Returns
Promise<{ data: CBAppTransaction[]; pagination: CBAppPagination; }>
getBuyPrice()
getBuyPrice(params: object): Promise<{
data: {
amount: string;
currency: string;
};
}>;Get Buy Price
Get the total price to buy one bitcoin or ether. This endpoint doesn't require authentication.
Parameters
| Parameter | Type |
|---|---|
params | { currencyPair: string; } |
params.currencyPair | string |
Returns
Promise<{ data: { amount: string; currency: string; }; }>
getClientType()
getClientType(): RestClientType;Defines the client type (affecting how requests & signatures behave)
Returns
RestClientType
Overrides
BaseRestClient.getClientType
getCoinbaseOneSubscription()
getCoinbaseOneSubscription(): Promise<{
data: CBAppCoinbaseOneSubscription;
}>;Get the user’s Coinbase One subscription status, tier, and current period end from GET /v2/subscriptions/coinbase-one. Requires the OAuth2 scope wallet:subscription:read and the Accept: application/json header. See available OAuth APIs.
Returns
Promise<{ data: CBAppCoinbaseOneSubscription; }>
getCryptocurrencies()
getCryptocurrencies(): Promise<CBAppCryptocurrency[]>;Get Cryptocurrencies
Lists known cryptocurrencies.
Returns
Promise<CBAppCryptocurrency[]>
getCurrentTime()
getCurrentTime(): Promise<{
data: {
epoch: number;
iso: string;
};
}>;Get Current Time
Get the API server time. This endpoint doesn't require authentication.
Returns
Promise<{ data: { epoch: number; iso: string; }; }>
getDeposit()
getDeposit(params: object): Promise<{
data: CBAppDepositWithdrawal;
}>;Show Deposit
Get one deposit by deposit Id.
Parameters
| Parameter | Type |
|---|---|
params | { account_id: string; deposit_id: string; } |
params.account_id | string |
params.deposit_id | string |
Returns
Promise<{ data: CBAppDepositWithdrawal; }>
getDeposits()
getDeposits(params: object): Promise<{
data: CBAppDepositWithdrawal[];
pagination: CBAppPagination;
}>;List Deposits
Lists fiat deposits for an account.
This endpoint is paginated. Omit paginationURL on the first request. Pass the previous response’s pagination.next_uri as paginationURL to fetch the next page. Stop when next_uri is null.
Parameters
| Parameter | Type |
|---|---|
params | { account_id: string; paginationURL?: string; } |
params.account_id | string |
params.paginationURL? | string |
Returns
Promise<{ data: CBAppDepositWithdrawal[]; pagination: CBAppPagination; }>
getExchangeRates()
getExchangeRates(params?: object): Promise<{
data: {
currency: string;
rates: {
[key: string]: string;
};
};
}>;Get Exchange Rates
Get current exchange rates. Default base currency is USD but it can be defined as any supported currency. Returned rates will define the exchange rate for one unit of the base currency.
Parameters
| Parameter | Type |
|---|---|
params? | { currency?: string; } |
params.currency? | string |
Returns
Promise<{ data: { currency: string; rates: { [key: string]: string; }; }; }>
getFiatCurrencies()
getFiatCurrencies(): Promise<{
data: CBAppFiatCurrency[];
}>;Get Fiat Currencies
Lists known fiat currencies. Currency codes conform to the ISO 4217 standard where possible. Currencies with no representation in ISO 4217 may use a custom code.
Returns
Promise<{ data: CBAppFiatCurrency[]; }>
getPrivate()
getPrivate(endpoint: string, params?: object): Promise<any>;Parameters
| Parameter | Type |
|---|---|
endpoint | string |
params? | object |
Returns
Promise<any>
Inherited from
BaseRestClient.getPrivate
getSellPrice()
getSellPrice(params: object): Promise<{
data: {
amount: string;
currency: string;
};
}>;Get Sell Price
Get the total price to sell one bitcoin or ether. This endpoint doesn't require authentication.
Parameters
| Parameter | Type |
|---|---|
params | { currencyPair: string; } |
params.currencyPair | string |
Returns
Promise<{ data: { amount: string; currency: string; }; }>
getSignTimestampMs()
getSignTimestampMs(): number;Timestamp used to sign the request. Override this method to implement your own timestamp/sync mechanism
Returns
number
Inherited from
BaseRestClient.getSignTimestampMs
getSpotPrice()
getSpotPrice(params: object): Promise<{
data: {
amount: string;
currency: string;
};
}>;Get Spot Price
Get the current market price for bitcoin. This is usually somewhere in between the buy and sell price. This endpoint doesn't require authentication.
Parameters
| Parameter | Type |
|---|---|
params | { currencyPair: string; date?: string; } |
params.currencyPair | string |
params.date? | string |
Returns
Promise<{ data: { amount: string; currency: string; }; }>
getTransaction()
getTransaction(params: object): Promise<{
data: CBAppTransaction;
}>;Show Transaction
Get a single transaction for an account.
Parameters
| Parameter | Type |
|---|---|
params | { account_id: string; transactionId: string; } |
params.account_id | string |
params.transactionId | string |
Returns
Promise<{ data: CBAppTransaction; }>
getTransactions()
getTransactions(params: object): Promise<{
data: CBAppTransaction[];
pagination: CBAppPagination;
}>;List Transactions
Lists the transactions of an account by account ID.
This endpoint is paginated. Omit paginationURL on the first request. Pass the previous response’s pagination.next_uri as paginationURL to fetch the next page. Stop when next_uri is null.
Parameters
| Parameter | Type |
|---|---|
params | { account_id: string; paginationURL?: string; } |
params.account_id | string |
params.paginationURL? | string |
Returns
Promise<{ data: CBAppTransaction[]; pagination: CBAppPagination; }>
getWithdrawal()
getWithdrawal(params: object): Promise<{
data: CBAppDepositWithdrawal;
}>;Show Withdrawal
Get a single withdrawal.
Parameters
| Parameter | Type |
|---|---|
params | { account_id: string; withdrawal_id: string; } |
params.account_id | string |
params.withdrawal_id | string |
Returns
Promise<{ data: CBAppDepositWithdrawal; }>
getWithdrawals()
getWithdrawals(params: object): Promise<{
data: CBAppDepositWithdrawal[];
pagination: CBAppPagination;
}>;List Withdrawals
Lists withdrawals for an account.
This endpoint is paginated. Omit paginationURL on the first request. Pass the previous response’s pagination.next_uri as paginationURL to fetch the next page. Stop when next_uri is null.
Parameters
| Parameter | Type |
|---|---|
params | { account_id: string; paginationURL?: string; } |
params.account_id | string |
params.paginationURL? | string |
Returns
Promise<{ data: CBAppDepositWithdrawal[]; pagination: CBAppPagination; }>
patchPrivate()
patchPrivate(endpoint: string, params?: ParamsInRequest): Promise<any>;Parameters
| Parameter | Type |
|---|---|
endpoint | string |
params? | ParamsInRequest |
Returns
Promise<any>
Inherited from
BaseRestClient.patchPrivate
post()
post(endpoint: string, params?: ParamsInRequest): Promise<any>;Parameters
| Parameter | Type |
|---|---|
endpoint | string |
params? | ParamsInRequest |
Returns
Promise<any>
Inherited from
BaseRestClient.post
postPrivate()
postPrivate(endpoint: string, params?: ParamsInRequest): Promise<any>;Parameters
| Parameter | Type |
|---|---|
endpoint | string |
params? | ParamsInRequest |
Returns
Promise<any>
Inherited from
BaseRestClient.postPrivate
putPrivate()
putPrivate(endpoint: string, params?: ParamsInRequest): Promise<any>;Parameters
| Parameter | Type |
|---|---|
endpoint | string |
params? | ParamsInRequest |
Returns
Promise<any>
Inherited from
BaseRestClient.putPrivate
sendMoney()
sendMoney(params: CBAppSendMoneyRequest): Promise<{
data: CBAppTransaction;
}>;Send supported crypto to a network address or recipient email address. Off-blockchain crypto transactions do not incur transaction fees.
See the Travel Rule data guide for required recipient information.
Parameters
| Parameter | Type |
|---|---|
params | CBAppSendMoneyRequest |
Returns
Promise<{ data: CBAppTransaction; }>
transferMoney()
transferMoney(params: CBAppTransferMoneyRequest): Promise<{
data: CBAppTransaction;
}>;Send a transfer transaction request to POST /v2/accounts/{account_id}/transactions. The SDK request type uses type: "transfer" with to, amount, and currency; it removes account_id from the body and uses it in the path.
Parameters
| Parameter | Type |
|---|---|
params | CBAppTransferMoneyRequest |
Returns
Promise<{ data: CBAppTransaction; }>
withdrawFunds()
withdrawFunds(params: CBAppWithdrawFundsRequest): Promise<CBAppTransfer>;Withdraw Funds
Withdraws a user-defined amount of funds from a fiat account.
Parameters
| Parameter | Type |
|---|---|
params | CBAppWithdrawFundsRequest |
Returns
Promise<CBAppTransfer>