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 5a8d209
Show file tree
Hide file tree
Showing 3 changed files with 12 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 test:dry-run
- run: npm run test:e2e

14 changes: 10 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 @@ -240,6 +240,12 @@ To run a specific test, run (for example):
npx jest ./src/coinbase/tests/wallet_test.ts
```

To run e2e tests, run:

```bash
npm test:dry-run && test:e2e
```

### Generating Documentation

To generate documentation from the TypeDoc comments, run:
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 5a8d209

Please sign in to comment.