@ethsign/sign-sdk
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

sign-sdk

Installation

npm install @ethsign/sign-sdk

Usage

server side

init
import { privateKeyToAccount } from 'viem/accounts';
import { SignClient } from '@ethsign/sign-sdk';
const privateKey = '0xxxxxx'; // eth private key
const tenantId = 'xxxx'; //sent us your publicKey to get it
const client = new SignClient({
  account: privateKeyToAccount(privateKey),
  tenantId: tenantId,
});

check contract status

const contractId = 'xxxx'; // main contract id
const userAddress = '0xxxxxx'; // eth address

const contractInfo = await client.checkContractStatus(contractId, userAddress);

generate webApiKey

const contractId = contractInfo.contractId; // come from checkContractStatus response
const webApiKey = await client.generateWebApiKey(contractId);

client side

init

import { SignWebClient } from '@ethsign/sign-sdk';

const webClient = new SignWebClient({
  getApiKey: async () => {
    return await getWebApiKey(); // request server side to get webApikey
  },
});
generate previewUrl
const contractId = contractInfo.contractId; // come from checkContractStatus response
const password = 'xxx'; //optional,if contract is password protected
const previewUrl = await webClient.generatePreviewUrl(contractId, password);
download contract
const contractId = contractInfo.contractId; // come from checkContractStatus response
const password = 'xxx'; //optional,if contract is password protected
const res = await webClient.downloadContract(contractId, password);

Readme

Keywords

none

Package Sidebar

Install

npm i @ethsign/sign-sdk

Weekly Downloads

5

Version

0.1.0

License

ISC

Unpacked Size

27.5 kB

Total Files

28

Last publish

Collaborators

  • evanyan
  • tinystone007
  • ethsign-jayhu
  • boyuanx