Skip to content

Commit

Permalink
Updating documentation and npm scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
erdimaden committed Jun 3, 2024
1 parent 638faf4 commit 4f01261
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ jobs:
NAME: ${{ secrets.NAME }}
PRIVATEKEY: ${{ secrets.PRIVATEKEY }}
SEED: ${{ secrets.SEED }}
- run: npm install
- run: npm ci
- run: npm publish --dry-run
- run: npm run test:dry-run
- run: npm run test:e2e

13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,16 +165,16 @@ In order to persist the data for the Wallet, you will need to implement a store
await store(data);
```

For convenience during testing, we provide a `saveWallet` method that stores the Wallet data in your local file system. This is an insecure method of storing wallet seeds and should only be used for development purposes.
For convenience during testing, we provide a `saveSeed` method that stores the Wallet data in your local file system. This is an insecure method of storing wallet seeds and should only be used for development purposes.

```typescript
user.saveWallet(wallet);
user.saveSeed(wallet);
```

To encrypt the saved data, set encrypt to true. Note that your CDP API key also serves as the encryption key for the data persisted locally. To re-instantiate wallets with encrypted data, ensure that your SDK is configured with the same API key when invoking `saveWallet` and `loadWallets`.
To encrypt the saved data, set encrypt to true. Note that your CDP API key also serves as the encryption key for the data persisted locally. To re-instantiate wallets with encrypted data, ensure that your SDK is configured with the same API key when invoking `saveSeed` and `loadWallets`.

```typescript
user.saveWallet(wallet, true);
user.saveSeed(wallet, true);
```

The below code demonstrates how to re-instantiate a Wallet from the data export.
Expand Down Expand Up @@ -239,6 +239,11 @@ To run a specific test, run (for example):
```bash
npx jest ./src/coinbase/tests/wallet_test.ts
```
To run e2e tests, run:

```bash
npm run test:dry-run && NAME="placeholder" PRIVATE_KEY="placeholder" SEED="placeholder" && npm run test:e2e
```

### Generating Documentation

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"format-check": "prettier -c .prettierrc --check \"**/*.{ts,js,cjs,json,md}\"",
"check": "tsc --noEmit",
"test": "npx jest --no-cache --testMatch=**/*_test.ts",
"test:dry-run": "npm install && npm ci && npm publish --dry-run",
"test:e2e": "npx jest --no-cache --testMatch=**/e2e.ts",
"clean": "rm -rf dist/*",
"build": "tsc",
Expand Down

0 comments on commit 4f01261

Please sign in to comment.