@covalenthq/js-sign v1.0.22
js-sign · 
js-sign library allows browsers and Node.js clients to create signature payload in order to interact with Covalent API. Generally, only one function call is required to create the necessary signature.
Currently, when using some Covalent API endpoints, the only data that required signing is the wallet address.
Installation
Browser javascript
Embed the javascript source in html
<script src="https://cdn.jsdelivr.net/npm/@covalenthq/js-sign/dist/lib.min.js"></script>Node.JS
Installing module
npm i --save @covalenthq/js-signBuild from source
The output of the build process is located in dist folder,
npm run buildDownload from github gist
- Please download the single library, covalent-js-sign.js, directly from the github gist,
https://gist.github.com/cloggo/8f1b16ef2bdcfd663e587dba11f2d116#file-covalent-js-sign-js
Testing
All new code changes should be covered with unit tests. You can run the tests with the following command,
npm run testConfiguration and Setup
Private key
Provide private key to process.env.PRIVATE_KEY variable. You can use dotenv or any other way.
process.env.PRIVATE_KEY = ${YOUR_PRIVATE_KEY}Usage
// import only required for Node.JS
import covalent from '@covalenthq/js-sign';
// To create the payload that include both the typed data challenge and the signature in base64 encoding format,
const privateKey = process.env.PRIVATE_KEY;
const covalentMessage {
address: "0x71d094E5382CA33B25B92d3A75d5C6f269A78fAe",
chainId: 1
};
const payload = covalent.createSignaturePayloadB64(privateKey, covalentMessage);4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago