Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.6.0 #557

Merged
merged 80 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
7a2dd00
deps: @ethereumjs/common->3.1.1, @ethereumjs/tx->4.1.2
legobeat May 9, 2023
fa7942b
deps: @ethersproject/abi->^5.7.0
legobeat May 9, 2023
fa5a0ec
deps: secp256k1->5.0.0
legobeat May 9, 2023
503533e
deps: buffer->^6.0.3
legobeat May 9, 2023
c7a48c0
deps: bs58check->^3.0.1
legobeat May 9, 2023
ce40030
deps: bignumber.js->9.1.1
legobeat May 9, 2023
c5adbbb
npm audit bumps
legobeat May 9, 2023
78dc3e6
Merge pull request #535 from legobeat/chore-deps-bumps
alex-miller-0 May 9, 2023
682658d
Revert "deps: bs58check->^3.0.1"
legobeat May 10, 2023
dd22a9f
devDeps: remove unused request-promise
legobeat May 9, 2023
02029c8
Merge pull request #536 from legobeat/devdeps-request
alex-miller-0 May 11, 2023
4e9a605
Merge pull request #537 from legobeat/restore-bs58check-2
alex-miller-0 May 11, 2023
8a8a1e3
fixes bignumber cbor decoding
netbonus Dec 8, 2023
98f249f
Improves firmware flag error in btc tests
netbonus Dec 18, 2023
58678d9
Merge pull request #539 from GridPlus/nb/btc
netbonus Dec 18, 2023
b2e4fb8
Runs prettier against entire codebase
netbonus Dec 18, 2023
89e26b3
Merge pull request #540 from GridPlus/nb/format
netbonus Dec 18, 2023
15d6810
adds `fetchAddress`
netbonus Feb 2, 2024
916fc99
adds handling for fetching more than 10 addresses
netbonus Feb 4, 2024
536f01b
Merge pull request #544 from GridPlus/nb/fetch-addr
netbonus Feb 6, 2024
876835b
removes break
netbonus Feb 6, 2024
3fc64c5
Merge branch 'dev' into nb/fetch-plus-n
netbonus Feb 6, 2024
32b5389
Merge pull request #545 from GridPlus/nb/fetch-plus-n
netbonus Feb 9, 2024
b0a769d
add solana tx version support
netbonus Feb 9, 2024
4de9d20
update name to APP_NAME
netbonus Feb 9, 2024
879260b
adds more tests
netbonus Feb 12, 2024
8ad20cd
adds alt test
netbonus Feb 12, 2024
a883e1c
add more address fetch reqs
netbonus Feb 26, 2024
6c1cf27
chore: forge init
netbonus Apr 21, 2024
b680f68
forge install: forge-std
netbonus Apr 21, 2024
d688467
adds basic test
netbonus Apr 21, 2024
39a97ba
forge install: openzeppelin-contracts
netbonus Apr 21, 2024
62756fb
wip
netbonus Apr 24, 2024
8fcf76a
wip
netbonus May 1, 2024
71368b7
simplify tests
netbonus May 6, 2024
1ecbbef
update chainid handling
netbonus May 6, 2024
a8453fd
Merge pull request #551 from GridPlus/nb/forge
netbonus May 8, 2024
f77ec65
chore: npm dedupe
legobeat May 30, 2024
c39b308
deps: js-sha@^0.8.0->^0.9.3
legobeat Feb 25, 2024
70c581d
chore: add js-sha3@^0.9.3 to overrides
legobeat May 30, 2024
7112a34
npm audit --fix
legobeat May 30, 2024
cb9d250
updates docs
netbonus May 14, 2024
ae6fa2d
Merge pull request #553 from GridPlus/nb/func-docs
netbonus Jun 4, 2024
052968d
Merge pull request #548 from legobeat/deps-js-sha3
netbonus Jun 4, 2024
1c2483f
adds logging to signing request
netbonus Jun 7, 2024
952131d
fix vertex/blur tests
netbonus Jun 7, 2024
1098822
bumps package to 2.6.0
netbonus Jun 7, 2024
d5ec1ff
Merge pull request #555 from GridPlus/nb/sign-err
netbonus Jun 10, 2024
89b0287
Merge pull request #556 from GridPlus/nb/eth-vertex-fix
netbonus Jun 10, 2024
68a8242
Merge pull request #554 from GridPlus/nb/bump-version
netbonus Jun 10, 2024
f7a837e
revert app name
netbonus Jun 13, 2024
b6c14ab
Merge branch 'dev' into nb/sol-ver
netbonus Jun 13, 2024
7ca7728
update package lock
netbonus Jun 13, 2024
19c8927
update sol test command
netbonus Jun 13, 2024
ad77963
update tests
netbonus Jun 13, 2024
15ff783
adds solana addresses fetching for bip44change
netbonus Jun 27, 2024
43c426a
adds fetch derivation address
netbonus Jun 27, 2024
d1fe2f2
update solana offset
netbonus Jul 1, 2024
f1b678d
remove test skip
netbonus Jul 1, 2024
b783c6d
fix name of new func
netbonus Jul 1, 2024
eae1410
Bump @babel/traverse from 7.20.10 to 7.24.7 in /example
dependabot[bot] Jul 1, 2024
56b40b9
Merge pull request #559 from GridPlus/nb/test-derivation-fetch
netbonus Jul 1, 2024
e0bc551
adds nufi tests
netbonus Jul 3, 2024
6e93426
Merge pull request #560 from GridPlus/dependabot/npm_and_yarn/example…
netbonus Jul 3, 2024
5f80b8c
fix lint issue
netbonus Jul 3, 2024
8898fe9
Merge branch 'main' into nb/sol-ver
netbonus Jul 3, 2024
99aa538
rename tests
netbonus Jul 3, 2024
68eb58c
Merge branch 'main' into dev
netbonus Jul 8, 2024
423e2d5
Restores files
netbonus Jul 8, 2024
3e04678
Merge branch 'dev' into fix-bignumber-decode
netbonus Jul 8, 2024
e6b0fe4
Merge pull request #538 from GridPlus/fix-bignumber-decode
netbonus Jul 9, 2024
08ccec5
Merge branch 'dev' into nb/sol-ver
netbonus Jul 9, 2024
70efa36
Merge pull request #546 from GridPlus/nb/sol-ver
netbonus Jul 9, 2024
614ac52
fix api tests
netbonus Jul 9, 2024
b6fc3b3
remove logs
netbonus Jul 9, 2024
1f50d75
Merge pull request #561 from GridPlus/nb/fix-api-tests
netbonus Jul 9, 2024
a68793d
fix test pairing to use simpler deviceid, pw, appname system
netbonus Jul 9, 2024
af6b35e
fixes linting
netbonus Jul 9, 2024
81aa724
fix lint
netbonus Jul 9, 2024
647c138
Merge pull request #562 from GridPlus/nb/fix-pairing-tests
netbonus Jul 9, 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
5 changes: 3 additions & 2 deletions .env.template
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
REUSE_KEY=0
APP_NAME="SDK Test"
DEVICE_ID=""
PASSWORD=""

ENC_PW=
ETHERSCAN_KEY=""
name="SDK Test"
baseUrl="https://signing.gridpl.us"
54 changes: 27 additions & 27 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
{
"env": {
"es6": false,
"mocha": true,
"node": true
},
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"root": true,
"globals": {
"expect": true,
"shallow": true,
"render": true,
"mount": true,
"beforeAll": true,
"cy": true
},
"rules": {
"eqeqeq": ["error"],
"no-var": ["warn"],
"no-duplicate-imports": ["error"],
"prefer-const": ["error"],
"prefer-spread": ["error"],
"no-console": ["off"],
"quotes": ["error", "single"],
"react/react-in-jsx-scope": "off",
"@typescript-eslint/no-explicit-any": "off"
"env": {
"es6": false,
"mocha": true,
"node": true
},
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"root": true,
"globals": {
"expect": true,
"shallow": true,
"render": true,
"mount": true,
"beforeAll": true,
"cy": true
},
"rules": {
"eqeqeq": ["error"],
"no-var": ["warn"],
"no-duplicate-imports": ["error"],
"prefer-const": ["error"],
"prefer-spread": ["error"],
"no-console": ["off"],
"quotes": ["error", "single"],
"react/react-in-jsx-scope": "off",
"@typescript-eslint/no-explicit-any": "off"
}
}
2 changes: 1 addition & 1 deletion .github/workflows/docs-build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v1
with:
node-version: 16.x
node-version: 18.x

- name: Install NPM packages for SDK
run: npm ci
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
docs/_build
docs/docs/reference
.DS_Store
dist
node_modules
coverage
.env
*.temp
~/node_modules
~/node_modules
cache
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "forge/lib/forge-std"]
path = forge/lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "forge/lib/openzeppelin-contracts"]
path = forge/lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16
24 changes: 12 additions & 12 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"overrides": [
{
"files": "**/src/*.ts",
"options": {
"parser": "typescript"
}
}
],
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all"
}
"overrides": [
{
"files": "**/src/*.ts",
"options": {
"parser": "typescript"
}
}
],
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all"
}
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ formats: all
python:
version: 3.7
install:
- requirements: docs/requirements.txt
- requirements: docs/requirements.txt
18 changes: 9 additions & 9 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"editor.codeActionsOnSave": {
"source.addMissingImports": true,
"source.organizeImports": true,
"source.formatDocument": true,
"source.fixAll": true
},
"editor.showUnused": true,
"editor.formatOnPaste": true,
"editor.formatOnSave": true
"editor.codeActionsOnSave": {
"source.addMissingImports": true,
"source.fixAll": true,
"source.formatDocument": true,
"source.organizeImports": true
},
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.showUnused": true
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

# GridPlus Lattice1 SDK

* **For help with this SDK, see the [GridPlus SDK Documentation](https://gridplus.github.io/gridplus-sdk)**
* **For help with your Lattice1 hardware, see the [Lattice1 Documentation](https://docs.gridplus.io)**
- **For help with this SDK, see the [GridPlus SDK Documentation](https://gridplus.github.io/gridplus-sdk)**
- **For help with your Lattice1 hardware, see the [Lattice1 Documentation](https://docs.gridplus.io)**

This SDK is designed to facilitate communication with a user's [Lattice1 hardware wallet](https://gridplus.io/lattice). Once paired to a given Lattice, an instance of this SDK is used to make encrypted requests for things like getting addresses/public keys and making signatures.

Expand Down
68 changes: 28 additions & 40 deletions docs/docs/addresses.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
id: "addresses"
id: 'addresses'
sidebar_position: 2
---

# 🔑 Addresses and Public Keys

Once your `Client` instance is connected, you can request a few different addresses and key types from the Lattice.
Once your connection is established, you can request a few different addresses and key types from the Lattice.

:::note

Expand All @@ -17,7 +17,7 @@ This section uses the following notation when discussing BIP32 derivation paths:

These addresses are 20-byte hex strings prefixed with `0x`. Lattice firmware places some restrictions based on derivation path, specifically that the `coin_type` must be supported (Ethereum uses coin type `60'`).

In practice, most apps just use the standard Ethereum `coin_type` (`60'`) when requesting addresses for other networks, but we do support some others (a vestige of an integration -- you probably won't ever need to use these):
In practice, most apps just use the standard Ethereum `coin_type` (`60'`) when requesting addresses for other networks, but we do support some others (a vestige of an integration -- you probably won't ever need to use these):

> `966', 700', 9006', 9005', 1007', 178', 137', 3731', 1010', 61', 108', 40', 889', 1987', 820', 6060', 1620', 1313114', 76', 246529', 246785', 1001', 227', 916', 464', 2221', 344', 73799', 246'`

Expand All @@ -27,44 +27,40 @@ Keep in mind that changing the `coin_type` will change all the requested address

```ts
const reqData = {
startPath: [ // Derivation path of the first requested address
0x80000000 + 44,
0x80000000 + 60,
0x80000000,
0,
0,
],
n: 5, // Number of sequential addresses on specified path to return (max 10)
startPath: [
// Derivation path of the first requested address
0x80000000 + 44,
0x80000000 + 60,
0x80000000,
0,
0,
],
n: 5, // Number of sequential addresses on specified path to return (max 10)
};

const addrs = await client.getAddresses(reqData);
const addrs = await fetchAddresses(reqData);
```

## ₿ Bitcoin addresses

The Lattice can also export Bitcoin formatted addresses. There are three types of addresses that can be fetched and the type is determined by the `purpose` index of the BIP32 derivation path.

* If `purpose = 44'`, *legacy* addresses (beginning with `1`) will be returned
* If `purpose = 49'`, *wrapped segwit* addresses (beginning with `3`) will be returned
* If `purpose = 84'`, *segwit v1* addresses (beginning with `bc1`) will be returned
- If `purpose = 44'`, _legacy_ addresses (beginning with `1`) will be returned
- If `purpose = 49'`, _wrapped segwit_ addresses (beginning with `3`) will be returned
- If `purpose = 84'`, _segwit v1_ addresses (beginning with `bc1`) will be returned

Keep in mind that `coin_type` `0'` is required when requesting BTC addresses.

### Example: requesting BTC segwit addresses

```ts
const reqData = {
startPath: [ // Derivation path of the first requested address
0x80000000 + 84,
0x80000000,
0x80000000,
0,
0,
]
// Derivation path of the first requested address
startPath: [0x80000000 + 84, 0x80000000, 0x80000000, 0, 0],
};

// `n` will be set to 1 if not specified -> 1 address returned
const addr0 = await client.getAddresses(reqData);
// `n` will be set to 10 if not specified -> 10 addresses returned
const addr0 = await fetchAddresses(reqData);
```

## 🗝️ Public Keys
Expand All @@ -78,7 +74,7 @@ Currently the derivation path must be at least 2 indices deep, but this restrict
For requesting public keys it is best to import `Constants` with:

```ts
import { Client, Constants } from 'gridplus-sdk'
import { Constants } from 'gridplus-sdk';
```

### 1️⃣ `secp256k1` curve
Expand All @@ -93,18 +89,13 @@ The public key has two 32 byte components and is of format: `04{X}{Y}`, meaning

```ts
const req = {
startPath: [ // Derivation path of the first requested pubkey
0x80000000 + 44,
0x80000000 + 60,
0x80000000,
0,
0,
],
// Derivation path of the first requested pubkey
startPath: [0x80000000 + 44, 0x80000000 + 60, 0x80000000, 0, 0],
n: 3,
flag: Constants.GET_ADDR_FLAGS.SECP256K1_PUB,
};

const pubkeys = await client.getAddresses(req);
const pubkeys = await fetchAddresses(req);
```

:::note
Expand All @@ -113,7 +104,7 @@ Since `startPath` is the same, this example returns public keys which can be con

### 2️⃣ `ed25519` curve

Used by Solana and a few others. ***Ed25519 requires all derivation path indices be hardened.***
Used by Solana and a few others. **_Ed25519 requires all derivation path indices be hardened._**

**Pubkey size: 32 bytes**

Expand All @@ -123,14 +114,11 @@ Some libraries prefix these keys with a `00` byte (making them 33 bytes), but we

```ts
const req = {
startPath: [ // Derivation path of the first requested pubkey
0x80000000 + 44,
0x80000000 + 60,
0x80000000,
],
// Derivation path of the first requested pubkey
startPath: [0x80000000 + 44, 0x80000000 + 60, 0x80000000],
n: 3,
flag: Constants.GET_ADDR_FLAGS.ED25519_PUB,
};

const pubkeys = await client.getAddresses(req);
const pubkeys = await fetchAddresses(req);
```
Loading
Loading