Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
5f03ebb
[HistoricalBalances] add wallet level function (#157)
xinyu-li-cb Aug 15, 2024
e73df32
Expose toAddressId() method on Transaction class
drohit-cb Aug 15, 2024
2083d80
Add code review feedback
drohit-cb Aug 15, 2024
25c91ad
Merge pull request #158 from coinbase/add_to_address_field
drohit-cb Aug 15, 2024
1f28995
[chore] Bump client
alex-stone Aug 15, 2024
2115a0f
[PSDK-411] Pass address index on address creation
alex-stone Aug 15, 2024
02e2fc6
add webhook api
chaoyaji-cb Aug 14, 2024
95dbb68
Merge pull request #159 from coinbase/stone/pass-address-index
alex-stone Aug 16, 2024
e61a4b4
Merge pull request #156 from coinbase/webhook-api-v0.1.0
chaoyaji-cb Aug 16, 2024
eb064c1
move public methods to the top
drohit-cb Aug 19, 2024
e29b053
fix list balances
marchsu Aug 19, 2024
3865c1e
fix seq and tests
marchsu Aug 19, 2024
6ec92c6
Merge pull request #168 from coinbase/cleanup_staking
drohit-cb Aug 19, 2024
f8ed380
make toString more descriptive
marchsu Aug 19, 2024
9ad0446
update types address to addressId
marchsu Aug 19, 2024
1ba4699
rm balance toString
marchsu Aug 19, 2024
301f163
[chore] Cleanup unused constants
alex-stone Aug 20, 2024
30e986d
[PSDK-388] Dynamically update networks
alex-stone Aug 20, 2024
36ecc04
Enable polygon support for TS SDK address creation
alex-stone Aug 20, 2024
313302f
Merge pull request #169 from coinbase/stone/PSDK-388-dynamic-network-…
alex-stone Aug 20, 2024
8312dab
Merge pull request #167 from coinbase/fix-list-staking-balances
marchsu Aug 20, 2024
3455517
Remove user concept
alex-stone Aug 20, 2024
08bd12e
Add wallet model support for Dedicated ETH Staking
drohit-cb Aug 19, 2024
1d415e6
some minor enhancements
drohit-cb Aug 21, 2024
d24e66a
Update docs, readmes, and changelog
alex-stone Aug 21, 2024
5ae4706
Add correlation header with version and language
alex-stone Aug 21, 2024
e1ec49d
Address code review comment
drohit-cb Aug 21, 2024
9286008
Merge pull request #171 from coinbase/stone/correlation
alex-stone Aug 21, 2024
fb1c983
Merge pull request #165 from coinbase/add_dedicated_eth_staking_walle…
drohit-cb Aug 21, 2024
01efe44
[hotfix] patch for setting page (#173)
xinyu-li-cb Aug 21, 2024
3acfea5
Merge pull request #170 from coinbase/stone/remove-user-concept
alex-stone Aug 22, 2024
36fc811
init
shreifabdallah Aug 16, 2024
4a92b97
changelog & tests
shreifabdallah Aug 16, 2024
3d65318
new client
shreifabdallah Aug 20, 2024
b5fa0d7
new client
shreifabdallah Aug 20, 2024
229ae01
fix removed imports
shreifabdallah Aug 20, 2024
2b4fb48
undo unrelated diffs
shreifabdallah Aug 21, 2024
efff854
new api
shreifabdallah Aug 21, 2024
a5adce6
tests
shreifabdallah Aug 21, 2024
29c3736
mappers
shreifabdallah Aug 21, 2024
c322ee1
fix test
shreifabdallah Aug 21, 2024
617ea63
add comments
shreifabdallah Aug 22, 2024
ddc5535
Decouple create transfer/trade from wait
alex-stone Aug 21, 2024
f67abf0
contract event nodejs
jinghanx Aug 16, 2024
3a9cc13
split file
jinghanx Aug 22, 2024
36b50d4
[chore] Prepare v0.1.0 changelog and package version
alex-stone Aug 22, 2024
b77af77
[chore] Update changelog header
alex-stone Aug 22, 2024
451c638
[chore] Cleanup changelog changed headers
alex-stone Aug 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 11 additions & 15 deletions CAPABILITIES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,20 @@ those capabilities for the NodeJS SDK:
## Developer Wallets

| Concept | Base-Sepolia | Base-Mainnet | Ethereum-Holesky | Ethereum-Mainnet |
| ------------- | :----------: | :----------: | :--------------: | :--------------: |
| Addresses | ✅ | ✅ | ✅ | ✅ |
| Send | ✅ | ✅ | ✅ | ❌ |
| Trade | ❌ | ✅ | ❌ | ❌ |
| Faucet | ✅ | ❌ | ✅ | ❌ |
| Server-Signer | ✅ | ✅ | ❌ | ❌ |
| Stake [^1] | ❌ | ❌ | ✅ | ✅ |

[^1]: Currently only available for Shared ETH Staking.
|---------------|:------------:|:------------:|:----------------:|:----------------:|
| Addresses | ✅ | ✅ | ✅ | ✅ |
| Send | ✅ | ✅ | ✅ | ❌ |
| Trade | ❌ | ✅ | ❌ | ❌ |
| Faucet | ✅ | ❌ | ✅ | ❌ |
| Server-Signer | ✅ | ✅ | ❌ | ❌ |
| Stake | ❌ | ❌ | ✅ | ✅ |

## End-User Wallets

| Concept | Base-Sepolia | Base-Mainnet | Ethereum-Holesky | Ethereum-Mainnet |
| ------------------ | :----------: | :----------: | :--------------: | :--------------: |
| External Addresses | ✅ | ✅ | ✅ | ✅ |
| Stake [^2] | ❌ | ❌ | ✅ | ✅ |

[^2]: Dedicated ETH Staking is currently only available on Testnet (Ethereum-Holesky).
|--------------------|:------------:|:------------:|:----------------:|:----------------:|
| External Addresses | ✅ | ✅ | ✅ | ✅ |
| Stake | ❌ | ❌ | ✅ | ✅ |

## Testnet vs. Mainnet

Expand All @@ -32,4 +28,4 @@ The Coinbase SDK supports both testnets and mainnets.
- Testnets are for building and testing applications. Funds are not real, and you can get test currencies from a faucet.
- Mainnet is where the funds, contracts and applications are real.

Wallets, assets, etc, cannot be moved from testnet to mainnet (or vice versa).
Wallets, assets, etc. cannot be moved from testnet to mainnet (or vice versa).
31 changes: 30 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
# Coinbase Node.js SDK Changelog

## Unreleased

## [0.1.0] - 2024-08-22

### Added

- Add `listHistoricalBalances` wallet method, that lists the historical balances for the wallet's default address.
- Add toAddressId() method to Transaction class

### Removed

- Remove user concept from the SDK
- Remove "pending" status from StakingOperationStatusEnum
- Add staking operation class helper methods like `isTerminalState`, `isFailedState` and `isCompleteState`.
- Add validator status enum

### Changed

- The `createTransfer` and `createTrade` functions no longer wait for the transactions to confirm or
fail on-chain.
- Now they return a `Transfer` and `Trade` object respectively, which support the `wait`
function, e.g. `await transfer.wait()`.
- This ensures that the developer has a reference to the object in case there is a timeout while
waiting to land on-chain.
- Update `reload()` method to work with both External and Wallet address.
- Update `createStakingOperation` logic to make sure we only pull in newer unsigned txs from the server.
This is especially important for External Address use-case where tx signing and broadcast status is maintained on client side, and we risk overwriting the existing txs.
- Increase default timeout for `createStakingOperation` to 10 min.

## [0.0.16] - 2024-08-14

### Added
Expand All @@ -8,7 +37,7 @@
- Support for retrieving historical staking balances information
- USD value conversion details to the StakingReward object
- Gasless USDC Sends
- Support for Etherum-Mainnet and Polygon-Mainnet
- Support for Ethereum-Mainnet and Polygon-Mainnet

## [0.0.15] - 2024-08-12

Expand Down
36 changes: 20 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ nvm use node

Optional: Initialize the npm

This command initializes a new npm project with default settings and configures it to use ES modules by setting the type field to "module" in the package.json file.
This command initializes a new npm project with default settings and configures it to use ES modules by setting the type field to "module" in the package.json file.

```bash
npm init -y; npm pkg set type="module"
Expand All @@ -68,13 +68,13 @@ yarn add @coinbase/coinbase-sdk
CommonJs:

```javascript
const { Coinbase } = require("@coinbase/coinbase-sdk");
const { Coinbase, Wallet } = require("@coinbase/coinbase-sdk");
```

ES modules:

```typescript
import { Coinbase } from "@coinbase/coinbase-sdk";
import { Coinbase, Wallet } from "@coinbase/coinbase-sdk";
```

To start, [create a CDP API Key](https://portal.cdp.coinbase.com/access/api). Then, initialize the Platform SDK by passing your API Key name and API Key's private key via the `Coinbase` constructor:
Expand All @@ -98,34 +98,38 @@ Another way to initialize the SDK is by sourcing the API key from the json file
const coinbase = Coinbase.configureFromJson({ filePath: "path/to/your/api-key.json" });
```

This will allow you to authenticate with the Platform APIs and get access to the default `User`.
This will allow you to authenticate with the Platform APIs.

CommonJs:

```javascript
const { Coinbase } = require("@coinbase/coinbase-sdk");
const { Coinbase, Wallet } = require("@coinbase/coinbase-sdk");
const coinbase = Coinbase.configureFromJson("path/to/your/api-key.json");
coinbase.getDefaultUser().then(user => {
console.log(user);

// List all Wallets for the CDP Project.
Wallet.listWallets().then(wallets => {
console.log(wallets);
});
```

Or using ES modules and async/await:

```typescript
import { Coinbase } from "@coinbase/coinbase-sdk";
import { Coinbase, Wallet } from "@coinbase/coinbase-sdk";
const coinbase = Coinbase.configureFromJson("path/to/your/api-key.json");
const user = await coinbase.getDefaultUser();
console.log(user);

// List all Wallets for the CDP Project.
const wallets = await Wallet.listWallets();
console.log(wallets);
```

### Wallets, Addresses, and Transfers

Now, create a Wallet from the User. Wallets are created with a single default Address.
Now, create a Wallet which will default to the Base Sepolia testnet network (if not specified).

```typescript
// Create a Wallet with one Address by default.
const wallet = await user.createWallet();
const wallet = await Wallet.create();
```

Next, view the default Address of your Wallet. You will need this default Address in order to fund the Wallet for your first Transfer.
Expand All @@ -149,7 +153,7 @@ console.log(`Faucet transaction: ${faucetTransaction}`);
```typescript
// Create a new Wallet to transfer funds to.
// Then, we can transfer 0.00001 ETH out of the Wallet to another Wallet.
const anotherWallet = await user.createWallet();
const anotherWallet = await Wallet.create();
const transfer = await wallet.createTransfer({ amount: 0.00001, assetId: Coinbase.assets.Eth, destination: anotherWallet });
```

Expand All @@ -166,7 +170,7 @@ const transfer = await wallet.createTransfer({ amount: 0.00001, assetId: Coinbas

```typescript
// Create a Wallet on `base-mainnet` to trade assets with.
let mainnetWallet = await user.createWallet({ networkId: Coinbase.networks.BaseMainnet });
let mainnetWallet = await Wallet.create({ networkId: Coinbase.networks.BaseMainnet });

console.log(`Wallet successfully created: ${mainnetWallet}`);

Expand Down Expand Up @@ -212,13 +216,13 @@ The below code demonstrates how to re-instantiate a Wallet from the data export.

```typescript
// The Wallet can be re-instantiated using the exported data.
const importedWallet = await user.importWallet(data);
const importedWallet = await Wallet.import(data);
```

To import Wallets that were persisted to your local file system using `saveSeed`, use the below code.

```typescript
const userWallet = await user.getWallet(wallet.getId());
const userWallet = await Wallet.fetch(wallet.getId());
await userWallet.loadSeed(seedFilePath);
```

Expand Down
Loading