Skip to content

Commit

Permalink
Merge pull request #469 from GridPlus/dl/fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
douglance committed Sep 23, 2022
2 parents 09080b8 + 6ea65fe commit f649f77
Show file tree
Hide file tree
Showing 8 changed files with 355 additions and 384 deletions.
5 changes: 5 additions & 0 deletions docs/docs/signing.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ const req = {
const sig = await client.sign(req)
```

:::note
When using the `gridplus-sdk` in a Node.js application with a version of Node lower than v18, you will need to patch the `fetch()` API in the global scope. One solution is to use the `node-fetch` package. See [the `node-fetch` README](https://github.com/node-fetch/node-fetch#installation) for instructions. Other options are available on NPM.
:::

## 📃 Message Decoders

By default, the message will be displayed on the Lattice's screen in either ASCII or hex -- if the message contains only ASCII, it will be displayed as such; otherwise it will get printed as a hex string. This means the Lattice can produce a signature for any message you like. However, there are additional decoders that make the request more readable on the Lattice. These decoders can be accessed inside of `Constants`:
Expand All @@ -61,6 +65,7 @@ const encodings = Constants.SIGNING.ENCODINGS
If you do not wish to specify a decoder, you can leave this field empty and the message will display either as ASCII or a hex string on the device.

### Example: Using the EVM Decoder

```ts
const tx = EthTxFactory.fromTxData(txData, { common: req.common });
const req = {
Expand Down

0 comments on commit f649f77

Please sign in to comment.