@coinbase-sample/prime-sdk-ts 0.1.0
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.
- package/LICENSE +0 -0
- package/README.md +98 -0
- package/dist/activities/index.d.ts +33 -0
- package/dist/activities/index.js +73 -0
- package/dist/activities/service.d.ts +18 -0
- package/dist/activities/service.js +54 -0
- package/dist/activities/types.d.ts +47 -0
- package/dist/activities/types.js +2 -0
- package/dist/addressBooks/index.d.ts +29 -0
- package/dist/addressBooks/index.js +57 -0
- package/dist/addressBooks/service.d.ts +11 -0
- package/dist/addressBooks/service.js +38 -0
- package/dist/addressBooks/types.d.ts +29 -0
- package/dist/addressBooks/types.js +2 -0
- package/dist/allocations/index.d.ts +35 -0
- package/dist/allocations/index.js +83 -0
- package/dist/allocations/service.d.ts +14 -0
- package/dist/allocations/service.js +65 -0
- package/dist/allocations/types.d.ts +46 -0
- package/dist/allocations/types.js +2 -0
- package/dist/assets/index.d.ts +27 -0
- package/dist/assets/index.js +27 -0
- package/dist/assets/service.d.ts +10 -0
- package/dist/assets/service.js +27 -0
- package/dist/assets/types.d.ts +20 -0
- package/dist/assets/types.js +2 -0
- package/dist/balances/index.d.ts +31 -0
- package/dist/balances/index.js +49 -0
- package/dist/balances/types.d.ts +39 -0
- package/dist/balances/types.js +2 -0
- package/dist/client.d.ts +20 -0
- package/dist/client.js +31 -0
- package/dist/commission/index.d.ts +27 -0
- package/dist/commission/index.js +27 -0
- package/dist/commission/types.d.ts +20 -0
- package/dist/commission/types.js +2 -0
- package/dist/constants.d.ts +22 -0
- package/dist/constants.js +25 -0
- package/dist/credentials/index.d.ts +7 -0
- package/dist/credentials/index.js +81 -0
- package/dist/errors/index.d.ts +22 -0
- package/dist/errors/index.js +31 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +50 -0
- package/dist/invoices/index.d.ts +27 -0
- package/dist/invoices/index.js +27 -0
- package/dist/invoices/service.d.ts +10 -0
- package/dist/invoices/service.js +27 -0
- package/dist/invoices/types.d.ts +20 -0
- package/dist/invoices/types.js +2 -0
- package/dist/model/Activity.d.ts +73 -0
- package/dist/model/Activity.js +21 -0
- package/dist/model/ActivityMetadataAccount.d.ts +23 -0
- package/dist/model/ActivityMetadataAccount.js +21 -0
- package/dist/model/ActivityMetadataConsensus.d.ts +29 -0
- package/dist/model/ActivityMetadataConsensus.js +21 -0
- package/dist/model/ActivityMetadataTransactions.d.ts +23 -0
- package/dist/model/ActivityMetadataTransactions.js +21 -0
- package/dist/model/AddressBookEntry.d.ts +69 -0
- package/dist/model/AddressBookEntry.js +21 -0
- package/dist/model/AggregatedFiatBalance.d.ts +23 -0
- package/dist/model/AggregatedFiatBalance.js +21 -0
- package/dist/model/Allocation.d.ts +78 -0
- package/dist/model/Allocation.js +21 -0
- package/dist/model/AllocationLeg.d.ts +33 -0
- package/dist/model/AllocationLeg.js +21 -0
- package/dist/model/AmountDue.d.ts +33 -0
- package/dist/model/AmountDue.js +21 -0
- package/dist/model/Asset.d.ts +41 -0
- package/dist/model/Asset.js +21 -0
- package/dist/model/AssetChange.d.ts +35 -0
- package/dist/model/AssetChange.js +21 -0
- package/dist/model/Balance.d.ts +69 -0
- package/dist/model/Balance.js +21 -0
- package/dist/model/BlockchainAddress.d.ts +23 -0
- package/dist/model/BlockchainAddress.js +21 -0
- package/dist/model/CancelOrderResponse.d.ts +25 -0
- package/dist/model/CancelOrderResponse.js +21 -0
- package/dist/model/Commission.d.ts +33 -0
- package/dist/model/Commission.js +21 -0
- package/dist/model/CreateAllocationRequest.d.ts +52 -0
- package/dist/model/CreateAllocationRequest.js +21 -0
- package/dist/model/CreateAllocationResponse.d.ts +23 -0
- package/dist/model/CreateAllocationResponse.js +21 -0
- package/dist/model/CreateAllocationResponseBody.d.ts +33 -0
- package/dist/model/CreateAllocationResponseBody.js +21 -0
- package/dist/model/CreateConversionRequest.d.ts +41 -0
- package/dist/model/CreateConversionRequest.js +21 -0
- package/dist/model/CreateConversionResponse.d.ts +49 -0
- package/dist/model/CreateConversionResponse.js +21 -0
- package/dist/model/CreateNetAllocationResponse.d.ts +23 -0
- package/dist/model/CreateNetAllocationResponse.js +21 -0
- package/dist/model/CreateNetAllocationResponseBody.d.ts +41 -0
- package/dist/model/CreateNetAllocationResponseBody.js +21 -0
- package/dist/model/CreateOrderRequest.d.ts +40 -0
- package/dist/model/CreateOrderRequest.js +21 -0
- package/dist/model/CreateOrderResponse.d.ts +25 -0
- package/dist/model/CreateOrderResponse.js +21 -0
- package/dist/model/CreatePortfolioAddressBookEntryRequest.d.ts +37 -0
- package/dist/model/CreatePortfolioAddressBookEntryRequest.js +21 -0
- package/dist/model/CreatePortfolioAddressBookEntryResponse.d.ts +25 -0
- package/dist/model/CreatePortfolioAddressBookEntryResponse.js +21 -0
- package/dist/model/CreateWalletRequest.d.ts +26 -0
- package/dist/model/CreateWalletRequest.js +21 -0
- package/dist/model/CreateWalletResponse.d.ts +26 -0
- package/dist/model/CreateWalletResponse.js +21 -0
- package/dist/model/CreateWalletTransferResponse.d.ts +61 -0
- package/dist/model/CreateWalletTransferResponse.js +21 -0
- package/dist/model/CreateWalletWithdrawalRequest.d.ts +39 -0
- package/dist/model/CreateWalletWithdrawalRequest.js +21 -0
- package/dist/model/CreateWalletWithdrawalResponse.d.ts +56 -0
- package/dist/model/CreateWalletWithdrawalResponse.js +21 -0
- package/dist/model/DefiBalance.d.ts +24 -0
- package/dist/model/DefiBalance.js +21 -0
- package/dist/model/DestinationAlloc.d.ts +41 -0
- package/dist/model/DestinationAlloc.js +21 -0
- package/dist/model/DisplayUser.d.ts +33 -0
- package/dist/model/DisplayUser.js +21 -0
- package/dist/model/EntityUser.d.ts +39 -0
- package/dist/model/EntityUser.js +21 -0
- package/dist/model/EstimatedNetworkFees.d.ts +29 -0
- package/dist/model/EstimatedNetworkFees.js +21 -0
- package/dist/model/Fill.d.ts +59 -0
- package/dist/model/Fill.js +21 -0
- package/dist/model/GetActivityResponse.d.ts +23 -0
- package/dist/model/GetActivityResponse.js +21 -0
- package/dist/model/GetAllocationResponse.d.ts +23 -0
- package/dist/model/GetAllocationResponse.js +21 -0
- package/dist/model/GetAllocationsByClientNettingIdResponse.d.ts +23 -0
- package/dist/model/GetAllocationsByClientNettingIdResponse.js +21 -0
- package/dist/model/GetEntityActivitiesResponse.d.ts +25 -0
- package/dist/model/GetEntityActivitiesResponse.js +21 -0
- package/dist/model/GetEntityAssetsResponse.d.ts +23 -0
- package/dist/model/GetEntityAssetsResponse.js +21 -0
- package/dist/model/GetEntityPaymentMethodDetailsResponse.d.ts +23 -0
- package/dist/model/GetEntityPaymentMethodDetailsResponse.js +21 -0
- package/dist/model/GetEntityPaymentMethodsResponse.d.ts +23 -0
- package/dist/model/GetEntityPaymentMethodsResponse.js +21 -0
- package/dist/model/GetEntityUsersResponse.d.ts +28 -0
- package/dist/model/GetEntityUsersResponse.js +21 -0
- package/dist/model/GetInvoicesResponse.d.ts +23 -0
- package/dist/model/GetInvoicesResponse.js +21 -0
- package/dist/model/GetOpenOrdersResponse.d.ts +25 -0
- package/dist/model/GetOpenOrdersResponse.js +21 -0
- package/dist/model/GetOrderFillsResponse.d.ts +25 -0
- package/dist/model/GetOrderFillsResponse.js +21 -0
- package/dist/model/GetOrderResponse.d.ts +23 -0
- package/dist/model/GetOrderResponse.js +21 -0
- package/dist/model/GetOrdersResponse.d.ts +25 -0
- package/dist/model/GetOrdersResponse.js +21 -0
- package/dist/model/GetPortfolioActivitiesResponse.d.ts +25 -0
- package/dist/model/GetPortfolioActivitiesResponse.js +21 -0
- package/dist/model/GetPortfolioActivityResponse.d.ts +23 -0
- package/dist/model/GetPortfolioActivityResponse.js +21 -0
- package/dist/model/GetPortfolioAddressBookResponse.d.ts +28 -0
- package/dist/model/GetPortfolioAddressBookResponse.js +21 -0
- package/dist/model/GetPortfolioAllocationsResponse.d.ts +28 -0
- package/dist/model/GetPortfolioAllocationsResponse.js +21 -0
- package/dist/model/GetPortfolioBalancesResponse.d.ts +31 -0
- package/dist/model/GetPortfolioBalancesResponse.js +21 -0
- package/dist/model/GetPortfolioCommissionResponse.d.ts +23 -0
- package/dist/model/GetPortfolioCommissionResponse.js +21 -0
- package/dist/model/GetPortfolioFillsResponse.d.ts +25 -0
- package/dist/model/GetPortfolioFillsResponse.js +21 -0
- package/dist/model/GetPortfolioProductsResponse.d.ts +25 -0
- package/dist/model/GetPortfolioProductsResponse.js +21 -0
- package/dist/model/GetPortfolioResponse.d.ts +23 -0
- package/dist/model/GetPortfolioResponse.js +21 -0
- package/dist/model/GetPortfolioTransactionsResponse.d.ts +25 -0
- package/dist/model/GetPortfolioTransactionsResponse.js +21 -0
- package/dist/model/GetPortfolioUsersResponse.d.ts +28 -0
- package/dist/model/GetPortfolioUsersResponse.js +21 -0
- package/dist/model/GetPortfoliosResponse.d.ts +26 -0
- package/dist/model/GetPortfoliosResponse.js +21 -0
- package/dist/model/GetPostTradeCreditResponse.d.ts +23 -0
- package/dist/model/GetPostTradeCreditResponse.js +21 -0
- package/dist/model/GetTransactionResponse.d.ts +23 -0
- package/dist/model/GetTransactionResponse.js +21 -0
- package/dist/model/GetWalletBalanceResponse.d.ts +23 -0
- package/dist/model/GetWalletBalanceResponse.js +21 -0
- package/dist/model/GetWalletDepositInstructionsResponse.d.ts +25 -0
- package/dist/model/GetWalletDepositInstructionsResponse.js +21 -0
- package/dist/model/GetWalletResponse.d.ts +23 -0
- package/dist/model/GetWalletResponse.js +21 -0
- package/dist/model/GetWalletTransactionsResponse.d.ts +25 -0
- package/dist/model/GetWalletTransactionsResponse.js +21 -0
- package/dist/model/GetWalletsResponse.d.ts +25 -0
- package/dist/model/GetWalletsResponse.js +21 -0
- package/dist/model/Invoice.d.ts +32 -0
- package/dist/model/Invoice.js +21 -0
- package/dist/model/InvoiceItem.d.ts +30 -0
- package/dist/model/InvoiceItem.js +21 -0
- package/dist/model/ListWeb3WalletBalancesResponse.d.ts +30 -0
- package/dist/model/ListWeb3WalletBalancesResponse.js +21 -0
- package/dist/model/MatchMetadata.d.ts +29 -0
- package/dist/model/MatchMetadata.js +21 -0
- package/dist/model/NFTCollection.d.ts +25 -0
- package/dist/model/NFTCollection.js +21 -0
- package/dist/model/NFTItem.d.ts +25 -0
- package/dist/model/NFTItem.js +21 -0
- package/dist/model/Order.d.ts +105 -0
- package/dist/model/Order.js +21 -0
- package/dist/model/OrderPreviewRequest.d.ts +36 -0
- package/dist/model/OrderPreviewRequest.js +21 -0
- package/dist/model/PaginatedResponse.d.ts +31 -0
- package/dist/model/PaginatedResponse.js +21 -0
- package/dist/model/PaymentMethodDestination.d.ts +22 -0
- package/dist/model/PaymentMethodDestination.js +21 -0
- package/dist/model/PaymentMethodDetails.d.ts +28 -0
- package/dist/model/PaymentMethodDetails.js +21 -0
- package/dist/model/PaymentMethodSummary.d.ts +28 -0
- package/dist/model/PaymentMethodSummary.js +21 -0
- package/dist/model/PortfolioUser.d.ts +43 -0
- package/dist/model/PortfolioUser.js +21 -0
- package/dist/model/PostOrderPreviewResponse.d.ts +83 -0
- package/dist/model/PostOrderPreviewResponse.js +21 -0
- package/dist/model/PostTradeCreditInformation.d.ts +63 -0
- package/dist/model/PostTradeCreditInformation.js +21 -0
- package/dist/model/Product.d.ts +58 -0
- package/dist/model/Product.js +21 -0
- package/dist/model/Transaction.d.ts +97 -0
- package/dist/model/Transaction.js +21 -0
- package/dist/model/TransactionMetadata.d.ts +23 -0
- package/dist/model/TransactionMetadata.js +21 -0
- package/dist/model/TransferLocation.d.ts +27 -0
- package/dist/model/TransferLocation.js +21 -0
- package/dist/model/UserAction.d.ts +31 -0
- package/dist/model/UserAction.js +21 -0
- package/dist/model/Wallet.d.ts +28 -0
- package/dist/model/Wallet.js +21 -0
- package/dist/model/WalletCryptoDepositInstructions.d.ts +43 -0
- package/dist/model/WalletCryptoDepositInstructions.js +21 -0
- package/dist/model/WalletFiatDepositInstructions.d.ts +28 -0
- package/dist/model/WalletFiatDepositInstructions.js +21 -0
- package/dist/model/Web3Asset.d.ts +38 -0
- package/dist/model/Web3Asset.js +21 -0
- package/dist/model/Web3Balance.d.ts +29 -0
- package/dist/model/Web3Balance.js +21 -0
- package/dist/model/assets.d.ts +13 -0
- package/dist/model/assets.js +2 -0
- package/dist/model/createATransferBetweenTwoWallets.d.ts +37 -0
- package/dist/model/createATransferBetweenTwoWallets.js +21 -0
- package/dist/model/enums/Action.d.ts +26 -0
- package/dist/model/enums/Action.js +30 -0
- package/dist/model/enums/ActivityCategory.d.ts +28 -0
- package/dist/model/enums/ActivityCategory.js +32 -0
- package/dist/model/enums/ActivityLevel.d.ts +24 -0
- package/dist/model/enums/ActivityLevel.js +28 -0
- package/dist/model/enums/ActivitySecondaryType.d.ts +28 -0
- package/dist/model/enums/ActivitySecondaryType.js +32 -0
- package/dist/model/enums/ActivityStatus.d.ts +28 -0
- package/dist/model/enums/ActivityStatus.js +32 -0
- package/dist/model/enums/ActivityType.d.ts +63 -0
- package/dist/model/enums/ActivityType.js +67 -0
- package/dist/model/enums/AddressBookType.d.ts +24 -0
- package/dist/model/enums/AddressBookType.js +28 -0
- package/dist/model/enums/AllocationSizeType.d.ts +25 -0
- package/dist/model/enums/AllocationSizeType.js +29 -0
- package/dist/model/enums/AllocationStatus.d.ts +26 -0
- package/dist/model/enums/AllocationStatus.js +30 -0
- package/dist/model/enums/AssetChangeType.d.ts +27 -0
- package/dist/model/enums/AssetChangeType.js +31 -0
- package/dist/model/enums/DestinationType.d.ts +25 -0
- package/dist/model/enums/DestinationType.js +29 -0
- package/dist/model/enums/HierarchyType.d.ts +24 -0
- package/dist/model/enums/HierarchyType.js +28 -0
- package/dist/model/enums/InvoiceState.d.ts +26 -0
- package/dist/model/enums/InvoiceState.js +30 -0
- package/dist/model/enums/InvoiceType.d.ts +27 -0
- package/dist/model/enums/InvoiceType.js +31 -0
- package/dist/model/enums/OrderSide.d.ts +27 -0
- package/dist/model/enums/OrderSide.js +31 -0
- package/dist/model/enums/OrderStatus.d.ts +31 -0
- package/dist/model/enums/OrderStatus.js +35 -0
- package/dist/model/enums/OrderType.d.ts +31 -0
- package/dist/model/enums/OrderType.js +35 -0
- package/dist/model/enums/PaymentMethodType.d.ts +28 -0
- package/dist/model/enums/PaymentMethodType.js +32 -0
- package/dist/model/enums/PortfolioBalanceType.d.ts +25 -0
- package/dist/model/enums/PortfolioBalanceType.js +29 -0
- package/dist/model/enums/ProductPermissions.d.ts +25 -0
- package/dist/model/enums/ProductPermissions.js +29 -0
- package/dist/model/enums/SortDirection.d.ts +23 -0
- package/dist/model/enums/SortDirection.js +27 -0
- package/dist/model/enums/TimeInForceType.d.ts +29 -0
- package/dist/model/enums/TimeInForceType.js +33 -0
- package/dist/model/enums/TransactionStatus.d.ts +46 -0
- package/dist/model/enums/TransactionStatus.js +50 -0
- package/dist/model/enums/TransactionType.d.ts +57 -0
- package/dist/model/enums/TransactionType.js +61 -0
- package/dist/model/enums/TransferLocationType.d.ts +28 -0
- package/dist/model/enums/TransferLocationType.js +32 -0
- package/dist/model/enums/UserRole.d.ts +34 -0
- package/dist/model/enums/UserRole.js +38 -0
- package/dist/model/enums/VisibilityStatus.d.ts +25 -0
- package/dist/model/enums/VisibilityStatus.js +29 -0
- package/dist/model/enums/WalletDepositInstructionType.d.ts +29 -0
- package/dist/model/enums/WalletDepositInstructionType.js +33 -0
- package/dist/model/enums/WalletType.d.ts +30 -0
- package/dist/model/enums/WalletType.js +34 -0
- package/dist/model/portfolio.d.ts +41 -0
- package/dist/model/portfolio.js +21 -0
- package/dist/model/services/activitityService.d.ts +33 -0
- package/dist/model/services/activitityService.js +2 -0
- package/dist/model/services/addressBookService.d.ts +14 -0
- package/dist/model/services/addressBookService.js +2 -0
- package/dist/model/services/allocationService.d.ts +24 -0
- package/dist/model/services/allocationService.js +2 -0
- package/dist/model/services/assetService.d.ts +5 -0
- package/dist/model/services/assetService.js +2 -0
- package/dist/model/services/balanceService.d.ts +24 -0
- package/dist/model/services/balanceService.js +2 -0
- package/dist/model/services/commissionService.d.ts +5 -0
- package/dist/model/services/commissionService.js +2 -0
- package/dist/model/services/invoiceService.d.ts +5 -0
- package/dist/model/services/invoiceService.js +2 -0
- package/dist/model/services/orderService.d.ts +62 -0
- package/dist/model/services/orderService.js +2 -0
- package/dist/model/services/pagination.d.ts +9 -0
- package/dist/model/services/pagination.js +2 -0
- package/dist/model/services/paymentMethodsService.d.ts +10 -0
- package/dist/model/services/paymentMethodsService.js +2 -0
- package/dist/model/services/portfolioService.d.ts +15 -0
- package/dist/model/services/portfolioService.js +2 -0
- package/dist/model/services/productService.d.ts +6 -0
- package/dist/model/services/productService.js +2 -0
- package/dist/model/services/shared.d.ts +6 -0
- package/dist/model/services/shared.js +2 -0
- package/dist/model/services/transactionService.d.ts +47 -0
- package/dist/model/services/transactionService.js +2 -0
- package/dist/model/services/usersService.d.ts +9 -0
- package/dist/model/services/usersService.js +2 -0
- package/dist/model/services/walletService.d.ts +27 -0
- package/dist/model/services/walletService.js +2 -0
- package/dist/orders/index.d.ts +41 -0
- package/dist/orders/index.js +119 -0
- package/dist/orders/types.d.ts +77 -0
- package/dist/orders/types.js +2 -0
- package/dist/paymentMethods/index.d.ts +29 -0
- package/dist/paymentMethods/index.js +36 -0
- package/dist/paymentMethods/service.d.ts +11 -0
- package/dist/paymentMethods/service.js +36 -0
- package/dist/paymentMethods/types.d.ts +25 -0
- package/dist/paymentMethods/types.js +2 -0
- package/dist/portfolio/service.d.ts +12 -0
- package/dist/portfolio/service.js +42 -0
- package/dist/portfolios/index.d.ts +31 -0
- package/dist/portfolios/index.js +45 -0
- package/dist/portfolios/types.d.ts +30 -0
- package/dist/portfolios/types.js +2 -0
- package/dist/products/index.d.ts +27 -0
- package/dist/products/index.js +27 -0
- package/dist/products/types.d.ts +21 -0
- package/dist/products/types.js +2 -0
- package/dist/shared/pagination.d.ts +24 -0
- package/dist/shared/pagination.js +2 -0
- package/dist/shared/toCamelCase.d.ts +1 -0
- package/dist/shared/toCamelCase.js +23 -0
- package/dist/transactions/index.d.ts +37 -0
- package/dist/transactions/index.js +101 -0
- package/dist/transactions/types.d.ts +62 -0
- package/dist/transactions/types.js +2 -0
- package/dist/users/index.d.ts +29 -0
- package/dist/users/index.js +36 -0
- package/dist/users/service.d.ts +11 -0
- package/dist/users/service.js +36 -0
- package/dist/users/types.d.ts +24 -0
- package/dist/users/types.js +2 -0
- package/dist/wallets/index.d.ts +33 -0
- package/dist/wallets/index.js +73 -0
- package/dist/wallets/types.d.ts +42 -0
- package/dist/wallets/types.js +2 -0
- package/package.json +38 -0
package/LICENSE
ADDED
|
File without changes
|
package/README.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Coinbase Prime API TypeScript SDK
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Welcome to the Coinbase Prime API TypeScript SDK. This TypeScript project was created to allow developers to easily plug into the [Coinbase Prime API](https://docs.cdp.coinbase.com/prime/docs/welcome).
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## License
|
|
10
|
+
|
|
11
|
+
The _Prime Typescript SDK_ sample library is free and open source and released under the [Apache License, Version 2.0](LICENSE).
|
|
12
|
+
|
|
13
|
+
The application and code are only available for demonstration purposes.
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
Here are a few examples requests:
|
|
18
|
+
|
|
19
|
+
**[List Portfolios](https://docs.cdp.coinbase.com/prime/reference/primerestapi_getportfolios)**
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
client
|
|
23
|
+
.listPortfolios()
|
|
24
|
+
.then((result) => {
|
|
25
|
+
console.log(result);
|
|
26
|
+
})
|
|
27
|
+
.catch((error) => {
|
|
28
|
+
console.error(error.message);
|
|
29
|
+
});
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**[Get Assets](https://docs.cdp.coinbase.com/prime/reference/primerestapi_getentityassets)**
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
client
|
|
36
|
+
.listAssets({entityId: "somePortfolioId"})
|
|
37
|
+
.then((result) => {
|
|
38
|
+
console.log(result);
|
|
39
|
+
})
|
|
40
|
+
.catch((error) => {
|
|
41
|
+
console.error(error.message);
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**[Create Order](https://docs.cdp.coinbase.com/prime/reference/primerestapi_createorder)**
|
|
46
|
+
|
|
47
|
+
_$10 Market Buy on BTC-USD_
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
client
|
|
51
|
+
.createOrder({
|
|
52
|
+
portfolioId: "somePortfolioId",
|
|
53
|
+
productId: "BTC-USD",
|
|
54
|
+
side: OrderSide.BUY,
|
|
55
|
+
type: OrderType.Market,
|
|
56
|
+
baseQuantity: "0.0001"
|
|
57
|
+
})
|
|
58
|
+
.then((result) => {
|
|
59
|
+
console.log(result);
|
|
60
|
+
})
|
|
61
|
+
.catch((error) => {
|
|
62
|
+
console.error(error.message);
|
|
63
|
+
});
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Development Installation
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
npm install
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Build and Use
|
|
75
|
+
|
|
76
|
+
To build the project, run the following command:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
npm run build
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
_Note: To avoid potential issues, do not forget to build your project again after making any changes to it._
|
|
83
|
+
|
|
84
|
+
After building the project, each `.ts` file will have its `.js` counterpart generated.
|
|
85
|
+
|
|
86
|
+
To run a file, use the following command:
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
node dist/{INSERT-FILENAME}.js
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
For example, a `main.ts` file would be run like:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
node dist/main.js
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2024-present Coinbase Global, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { CoinbaseCallOptions } from '@coinbase-sample/core-ts';
|
|
17
|
+
import { CoinbasePrimeClient } from '../client';
|
|
18
|
+
import { CoinbasePrimeClientException, CoinbasePrimeException } from '../errors';
|
|
19
|
+
import { GetActivityRequest, GetActivityResponse, GetPortfolioActivitiesRequest, GetPortfolioActivityResponse, ListPortfolioActivitiesRequest, ListPortfolioActivitiesResponse, ListEntityActivitiesRequest, ListEntityActivitiesResponse } from './types';
|
|
20
|
+
export interface IActivitiesService {
|
|
21
|
+
getActivity(request: GetActivityRequest): Promise<GetActivityResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
22
|
+
getPortfolioActivity(request: GetPortfolioActivitiesRequest): Promise<GetPortfolioActivityResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
23
|
+
listEntityActivities(request: ListEntityActivitiesRequest): Promise<ListEntityActivitiesResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
24
|
+
listPortfolioActivities(request: ListPortfolioActivitiesRequest): Promise<ListPortfolioActivitiesResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
25
|
+
}
|
|
26
|
+
export declare class ActivitiesService implements IActivitiesService {
|
|
27
|
+
private client;
|
|
28
|
+
constructor(client: CoinbasePrimeClient);
|
|
29
|
+
getActivity(request: GetActivityRequest, options?: CoinbaseCallOptions): Promise<GetActivityResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
30
|
+
getPortfolioActivity(request: GetPortfolioActivitiesRequest, options?: CoinbaseCallOptions): Promise<GetPortfolioActivityResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
31
|
+
listEntityActivities(request: ListEntityActivitiesRequest, options?: CoinbaseCallOptions): Promise<ListEntityActivitiesResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
32
|
+
listPortfolioActivities(request: ListPortfolioActivitiesRequest, options?: CoinbaseCallOptions): Promise<ListPortfolioActivitiesResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright 2024-present Coinbase Global, Inc.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.ActivitiesService = void 0;
|
|
28
|
+
class ActivitiesService {
|
|
29
|
+
constructor(client) {
|
|
30
|
+
this.client = client;
|
|
31
|
+
}
|
|
32
|
+
getActivity(request, options) {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
const response = yield this.client.request({
|
|
35
|
+
url: `activities/${request.activityId}`,
|
|
36
|
+
callOptions: options,
|
|
37
|
+
});
|
|
38
|
+
return response.data;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
getPortfolioActivity(request, options) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
const response = yield this.client.request({
|
|
44
|
+
url: `portfolios/${request.portfolioId}/activities/${request.activityId}`,
|
|
45
|
+
callOptions: options,
|
|
46
|
+
});
|
|
47
|
+
return response.data;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
listEntityActivities(request, options) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
const queryParams = Object.assign(Object.assign({}, request), { entityId: undefined });
|
|
53
|
+
const response = yield this.client.request({
|
|
54
|
+
url: `entities/${request.entityId}/activities`,
|
|
55
|
+
queryParams,
|
|
56
|
+
callOptions: options,
|
|
57
|
+
});
|
|
58
|
+
return response.data;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
listPortfolioActivities(request, options) {
|
|
62
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
const queryParams = Object.assign(Object.assign({}, request), { portfolioId: undefined });
|
|
64
|
+
const response = yield this.client.request({
|
|
65
|
+
url: `portfolios/${request.portfolioId}/activities`,
|
|
66
|
+
queryParams,
|
|
67
|
+
callOptions: options,
|
|
68
|
+
});
|
|
69
|
+
return response.data;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.ActivitiesService = ActivitiesService;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CoinbaseCallOptions } from '../../../core-ts/dist';
|
|
2
|
+
import { CoinbasePrimeClient } from '../client';
|
|
3
|
+
import { CoinbasePrimeClientException, CoinbasePrimeException } from '../errors';
|
|
4
|
+
import { GetActivityRequest, GetActivityResponse, GetPortfolioActivitiesRequest, GetPortfolioActivityResponse, ListPortfolioActivitiesRequest, ListPortfolioActivitiesResponse, ListEntityActivitiesRequest, ListEntityActivitiesResponse } from '../model/services/activitityService';
|
|
5
|
+
export interface ActivitiesService {
|
|
6
|
+
getActivity(request: GetActivityRequest): Promise<GetActivityResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
7
|
+
getPortfolioActivity(request: GetPortfolioActivitiesRequest): Promise<GetPortfolioActivityResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
8
|
+
listEntityActivities(request: ListEntityActivitiesRequest): Promise<ListEntityActivitiesResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
9
|
+
listPortfolioActivities(request: ListPortfolioActivitiesRequest): Promise<ListPortfolioActivitiesResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
10
|
+
}
|
|
11
|
+
export declare class AssetService implements AssetService {
|
|
12
|
+
private client;
|
|
13
|
+
constructor(client: CoinbasePrimeClient);
|
|
14
|
+
getActivity(request: GetActivityRequest, options?: CoinbaseCallOptions): Promise<GetActivityResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
15
|
+
getPortfolioActivity(request: GetPortfolioActivitiesRequest, options?: CoinbaseCallOptions): Promise<GetPortfolioActivityResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
16
|
+
listEntityActivities(request: ListEntityActivitiesRequest, options?: CoinbaseCallOptions): Promise<ListEntityActivitiesResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
17
|
+
listPortfolioActivities(request: ListPortfolioActivitiesRequest, options?: CoinbaseCallOptions): Promise<ListPortfolioActivitiesResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AssetService = void 0;
|
|
13
|
+
class AssetService {
|
|
14
|
+
constructor(client) {
|
|
15
|
+
this.client = client;
|
|
16
|
+
}
|
|
17
|
+
getActivity(request, options) {
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
const response = yield this.client.request({
|
|
20
|
+
url: `activities/${request.activityId}`,
|
|
21
|
+
callOptions: options,
|
|
22
|
+
});
|
|
23
|
+
return response.data;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
getPortfolioActivity(request, options) {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
const response = yield this.client.request({
|
|
29
|
+
url: `portfolios/${request.portfolioId}/activities/${request.activityId}`,
|
|
30
|
+
callOptions: options,
|
|
31
|
+
});
|
|
32
|
+
return response.data;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
listEntityActivities(request, options) {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
const response = yield this.client.request({
|
|
38
|
+
url: `entities/${request.entityId}/activities`,
|
|
39
|
+
callOptions: options,
|
|
40
|
+
});
|
|
41
|
+
return response.data;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
listPortfolioActivities(request, options) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
const response = yield this.client.request({
|
|
47
|
+
url: `portfolios/${request.portfolioId}/activities/${request.activityId}`,
|
|
48
|
+
callOptions: options,
|
|
49
|
+
});
|
|
50
|
+
return response.data;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.AssetService = AssetService;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2024-present Coinbase Global, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Pagination } from '../shared/pagination';
|
|
17
|
+
import { ActivityCategory } from '../model/enums/ActivityCategory';
|
|
18
|
+
import { ActivityStatus } from '../model/enums/ActivityStatus';
|
|
19
|
+
import { GetActivityResponse as internalGet } from '../model/GetActivityResponse';
|
|
20
|
+
import { GetEntityActivitiesResponse } from '../model/GetEntityActivitiesResponse';
|
|
21
|
+
import { GetPortfolioActivitiesResponse } from '../model/GetPortfolioActivitiesResponse';
|
|
22
|
+
import { GetPortfolioActivityResponse as internalGetPortAct } from '../model/GetPortfolioActivityResponse';
|
|
23
|
+
export type ActivityFilters = Pagination & {
|
|
24
|
+
symbols?: string[];
|
|
25
|
+
categories?: ActivityCategory[];
|
|
26
|
+
statuses?: ActivityStatus[];
|
|
27
|
+
startTime?: string;
|
|
28
|
+
endTime?: string;
|
|
29
|
+
};
|
|
30
|
+
export type GetActivityRequest = {
|
|
31
|
+
activityId: string;
|
|
32
|
+
};
|
|
33
|
+
export type GetActivityResponse = internalGet;
|
|
34
|
+
export type ListEntityActivitiesRequest = Pagination & ActivityFilters & {
|
|
35
|
+
entityId: string;
|
|
36
|
+
activityLevel?: string;
|
|
37
|
+
};
|
|
38
|
+
export type ListEntityActivitiesResponse = GetEntityActivitiesResponse;
|
|
39
|
+
export type ListPortfolioActivitiesRequest = Pagination & ActivityFilters & {
|
|
40
|
+
portfolioId: string;
|
|
41
|
+
};
|
|
42
|
+
export type ListPortfolioActivitiesResponse = GetPortfolioActivitiesResponse;
|
|
43
|
+
export type GetPortfolioActivitiesRequest = {
|
|
44
|
+
portfolioId: string;
|
|
45
|
+
activityId: string;
|
|
46
|
+
};
|
|
47
|
+
export type GetPortfolioActivityResponse = internalGetPortAct;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2024-present Coinbase Global, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { CoinbaseCallOptions } from '@coinbase-sample/core-ts';
|
|
17
|
+
import { CoinbasePrimeClient } from '../client';
|
|
18
|
+
import { CoinbasePrimeClientException, CoinbasePrimeException } from '../errors';
|
|
19
|
+
import { ListAddressBooksRequest, ListAddressBooksResponse, CreateAddressBookRequest, CreateAddressBookResponse } from './types';
|
|
20
|
+
export interface IAddressBooksService {
|
|
21
|
+
listAddressBooks(request: ListAddressBooksRequest, options?: CoinbaseCallOptions): Promise<ListAddressBooksResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
22
|
+
createAddressBook(request: CreateAddressBookRequest, options?: CoinbaseCallOptions): Promise<CreateAddressBookResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
23
|
+
}
|
|
24
|
+
export declare class AddressBooksService implements IAddressBooksService {
|
|
25
|
+
private client;
|
|
26
|
+
constructor(client: CoinbasePrimeClient);
|
|
27
|
+
listAddressBooks(request: ListAddressBooksRequest, options?: CoinbaseCallOptions): Promise<ListAddressBooksResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
28
|
+
createAddressBook(request: CreateAddressBookRequest, options?: CoinbaseCallOptions): Promise<CreateAddressBookResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AddressBooksService = void 0;
|
|
13
|
+
/**
|
|
14
|
+
* Copyright 2024-present Coinbase Global, Inc.
|
|
15
|
+
*
|
|
16
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
17
|
+
* you may not use this file except in compliance with the License.
|
|
18
|
+
* You may obtain a copy of the License at
|
|
19
|
+
*
|
|
20
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
21
|
+
*
|
|
22
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
23
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
24
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
25
|
+
* See the License for the specific language governing permissions and
|
|
26
|
+
* limitations under the License.
|
|
27
|
+
*/
|
|
28
|
+
const core_ts_1 = require("@coinbase-sample/core-ts");
|
|
29
|
+
class AddressBooksService {
|
|
30
|
+
constructor(client) {
|
|
31
|
+
this.client = client;
|
|
32
|
+
}
|
|
33
|
+
listAddressBooks(request, options) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const queryParams = Object.assign(Object.assign({}, request), { portfolioId: undefined });
|
|
36
|
+
const response = yield this.client.request({
|
|
37
|
+
url: `portfolios/${request.portfolioId}/address_book`,
|
|
38
|
+
queryParams,
|
|
39
|
+
callOptions: options,
|
|
40
|
+
});
|
|
41
|
+
return response.data;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
createAddressBook(request, options) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
const bodyParams = Object.assign(Object.assign({}, request), { portfolioId: undefined });
|
|
47
|
+
const response = yield this.client.request({
|
|
48
|
+
url: `portfolios/${request.portfolioId}/address_book`,
|
|
49
|
+
bodyParams,
|
|
50
|
+
method: core_ts_1.Method.POST,
|
|
51
|
+
callOptions: options,
|
|
52
|
+
});
|
|
53
|
+
return response.data;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.AddressBooksService = AddressBooksService;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CoinbasePrimeClient } from '../client';
|
|
2
|
+
import { CoinbasePrimeClientException, CoinbasePrimeException } from '../errors';
|
|
3
|
+
import { ListAddressBooksRequest, ListAddressBooksResponse, CreateAddressBookRequest, CreateAddressBookResponse } from '../model/services/addressBookService';
|
|
4
|
+
export interface AssetService {
|
|
5
|
+
listAddressBooks(request: ListAddressBooksRequest): Promise<ListAddressBooksResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
6
|
+
createAddressBook(request: CreateAddressBookRequest): Promise<CreateAddressBookResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
7
|
+
}
|
|
8
|
+
export declare class AssetService implements AssetService {
|
|
9
|
+
private client;
|
|
10
|
+
constructor(client: CoinbasePrimeClient);
|
|
11
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AssetService = void 0;
|
|
13
|
+
class AssetService {
|
|
14
|
+
constructor(client) {
|
|
15
|
+
this.client = client;
|
|
16
|
+
}
|
|
17
|
+
listAddressBooks(request, options) {
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
const response = yield this.client.request({
|
|
20
|
+
url: `portfolios/${request.portfolioId}/address_book`,
|
|
21
|
+
callOptions: options,
|
|
22
|
+
});
|
|
23
|
+
return response.data;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
createAddressBook(request, options) {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
const bodyParams = Object.assign(Object.assign({}, request), { portfolioId: null });
|
|
29
|
+
const response = yield this.client.request({
|
|
30
|
+
url: `portfolios/${request.portfolioId}/address_book`,
|
|
31
|
+
bodyParams,
|
|
32
|
+
callOptions: options,
|
|
33
|
+
});
|
|
34
|
+
return response.data;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.AssetService = AssetService;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2024-present Coinbase Global, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { GetPortfolioAddressBookResponse } from '../model/GetPortfolioAddressBookResponse';
|
|
17
|
+
import { CreatePortfolioAddressBookEntryRequest } from '../model/CreatePortfolioAddressBookEntryRequest';
|
|
18
|
+
import { CreatePortfolioAddressBookEntryResponse } from '../model/CreatePortfolioAddressBookEntryResponse';
|
|
19
|
+
import { Pagination } from '../shared/pagination';
|
|
20
|
+
export type ListAddressBooksRequest = Pagination & {
|
|
21
|
+
portfolioId: string;
|
|
22
|
+
currencySymbol?: string;
|
|
23
|
+
search?: string;
|
|
24
|
+
};
|
|
25
|
+
export type ListAddressBooksResponse = GetPortfolioAddressBookResponse;
|
|
26
|
+
export type CreateAddressBookRequest = CreatePortfolioAddressBookEntryRequest & {
|
|
27
|
+
portfolioId: string;
|
|
28
|
+
};
|
|
29
|
+
export type CreateAddressBookResponse = CreatePortfolioAddressBookEntryResponse;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2024-present Coinbase Global, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { CoinbaseCallOptions } from '@coinbase-sample/core-ts';
|
|
17
|
+
import { CoinbasePrimeClient } from '../client';
|
|
18
|
+
import { CoinbasePrimeClientException, CoinbasePrimeException } from '../errors';
|
|
19
|
+
import { CreateAllocationRequest, CreateAllocationResponse, CreateNetAllocationRequest, CreateNetAllocationResponse, ListPortfolioAllocationsRequest, ListPortfolioAllocationsResponse, ListNetAllocationsRequest, ListNetAllocationsResponse, GetAllocationRequest, GetAllocationResponse } from './types';
|
|
20
|
+
export interface IAllocationService {
|
|
21
|
+
createAllocation(request: CreateAllocationRequest, options?: CoinbaseCallOptions): Promise<CreateAllocationResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
22
|
+
createNetAllocation(request: CreateNetAllocationRequest, options?: CoinbaseCallOptions): Promise<CreateNetAllocationResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
23
|
+
listPortfolioAllocations(request: ListPortfolioAllocationsRequest, options?: CoinbaseCallOptions): Promise<ListPortfolioAllocationsResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
24
|
+
listNetAllocations(request: CreateNetAllocationRequest, options?: CoinbaseCallOptions): Promise<ListNetAllocationsResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
25
|
+
getAllocation(request: GetAllocationRequest, options?: CoinbaseCallOptions): Promise<GetAllocationResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
26
|
+
}
|
|
27
|
+
export declare class AllocationService implements IAllocationService {
|
|
28
|
+
private client;
|
|
29
|
+
constructor(client: CoinbasePrimeClient);
|
|
30
|
+
createAllocation(request: CreateAllocationRequest, options?: CoinbaseCallOptions): Promise<CreateAllocationResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
31
|
+
createNetAllocation(request: CreateNetAllocationRequest, options?: CoinbaseCallOptions): Promise<CreateNetAllocationResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
32
|
+
listPortfolioAllocations(request: ListPortfolioAllocationsRequest, options?: CoinbaseCallOptions): Promise<ListPortfolioAllocationsResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
33
|
+
listNetAllocations(request: ListNetAllocationsRequest, options?: CoinbaseCallOptions): Promise<ListNetAllocationsResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
34
|
+
getAllocation(request: GetAllocationRequest, options?: CoinbaseCallOptions): Promise<GetAllocationResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AllocationService = void 0;
|
|
13
|
+
/**
|
|
14
|
+
* Copyright 2024-present Coinbase Global, Inc.
|
|
15
|
+
*
|
|
16
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
17
|
+
* you may not use this file except in compliance with the License.
|
|
18
|
+
* You may obtain a copy of the License at
|
|
19
|
+
*
|
|
20
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
21
|
+
*
|
|
22
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
23
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
24
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
25
|
+
* See the License for the specific language governing permissions and
|
|
26
|
+
* limitations under the License.
|
|
27
|
+
*/
|
|
28
|
+
const core_ts_1 = require("@coinbase-sample/core-ts");
|
|
29
|
+
class AllocationService {
|
|
30
|
+
constructor(client) {
|
|
31
|
+
this.client = client;
|
|
32
|
+
}
|
|
33
|
+
createAllocation(request, options) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const response = yield this.client.request({
|
|
36
|
+
url: `allocations`,
|
|
37
|
+
bodyParams: request,
|
|
38
|
+
method: core_ts_1.Method.POST,
|
|
39
|
+
callOptions: options,
|
|
40
|
+
});
|
|
41
|
+
return response.data;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
createNetAllocation(request, options) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
const response = yield this.client.request({
|
|
47
|
+
url: `allocations/net`,
|
|
48
|
+
bodyParams: request,
|
|
49
|
+
method: core_ts_1.Method.POST,
|
|
50
|
+
callOptions: options,
|
|
51
|
+
});
|
|
52
|
+
return response.data;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
listPortfolioAllocations(request, options) {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
const response = yield this.client.request({
|
|
58
|
+
url: `portfolios/${request.portfolioId}/allocations`,
|
|
59
|
+
callOptions: options,
|
|
60
|
+
});
|
|
61
|
+
return response.data;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
listNetAllocations(request, options) {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
const response = yield this.client.request({
|
|
67
|
+
url: `portfolios/${request.portfolioId}/allocations/net/${request.nettingId}`,
|
|
68
|
+
callOptions: options,
|
|
69
|
+
});
|
|
70
|
+
return response.data;
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
getAllocation(request, options) {
|
|
74
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
+
const response = yield this.client.request({
|
|
76
|
+
url: `portfolios/${request.portfolioId}/allocations/${request.allocationId}`,
|
|
77
|
+
callOptions: options,
|
|
78
|
+
});
|
|
79
|
+
return response.data;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
exports.AllocationService = AllocationService;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CoinbasePrimeClient } from '../client';
|
|
2
|
+
import { CoinbasePrimeClientException, CoinbasePrimeException } from '../errors';
|
|
3
|
+
import { CreateAllocationRequest, CreateAllocationResponse, CreateNetAllocationRequest, CreateNetAllocationResponse, ListPortfolioAllocationsRequest, ListPortfolioAllocationsResponse, ListNetAllocationsResponse, GetAllocationRequest, GetAllocationResponse } from '../model/services/allocationService';
|
|
4
|
+
export interface AssetService {
|
|
5
|
+
createAllocation(request: CreateAllocationRequest): Promise<CreateAllocationResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
6
|
+
createNetAllocation(request: CreateNetAllocationRequest): Promise<CreateNetAllocationResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
7
|
+
listPortfolioAllocations(request: ListPortfolioAllocationsRequest): Promise<ListPortfolioAllocationsResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
8
|
+
listNetAllocations(request: CreateNetAllocationRequest): Promise<ListNetAllocationsResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
9
|
+
getAllocation(request: GetAllocationRequest): Promise<GetAllocationResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
|
|
10
|
+
}
|
|
11
|
+
export declare class AssetService implements AssetService {
|
|
12
|
+
private client;
|
|
13
|
+
constructor(client: CoinbasePrimeClient);
|
|
14
|
+
}
|