npm install @ethsign/sign-sdk
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,
});
const contractId = 'xxxx'; // main contract id
const userAddress = '0xxxxxx'; // eth address
const contractInfo = await client.checkContractStatus(contractId, userAddress);
const contractId = contractInfo.contractId; // come from checkContractStatus response
const webApiKey = await client.generateWebApiKey(contractId);
import { SignWebClient } from '@ethsign/sign-sdk';
const webClient = new SignWebClient({
getApiKey: async () => {
return await getWebApiKey(); // request server side to get webApikey
},
});
const contractId = contractInfo.contractId; // come from checkContractStatus response
const password = 'xxx'; //optional,if contract is password protected
const previewUrl = await webClient.generatePreviewUrl(contractId, password);
const contractId = contractInfo.contractId; // come from checkContractStatus response
const password = 'xxx'; //optional,if contract is password protected
const res = await webClient.downloadContract(contractId, password);