Safient Contracts SDK
JavaScript SDK to manage and interact with the safe claims on Safient protocol.
Local installation
git clone https://github.com/safient/safient-contract-js.git
cd safient-contract-js
npm install
Running tests
Create a .env file in the root directory with INFURA_API_KEY
for mainnet or testnet deployment.
Testing the contracts
npm run test:contract
Testing the JS SDK
Run a local blockchain
npm run chain
Deploy the contract, run the test on a different terminal
npm run deploy:sdk
npm run test:sdk
Testing the contract & SDK
npm run deploy:sdk
npm run test
Getting started
npm i @safient/contracts
Usage
// If not injected web3 provider, create a jsonRpcProvider
const { JsonRpcProvider } = require('@ethersproject/providers');
const provider = new JsonRpcProvider('http://localhost:8545');
// Get signer and chainId from provider
(async () => {
const signer = await provider.getSigner();
const providerNetwork = await provider.getNetwork();
const chainId = providerNetwork.chainId;
})();
Initialization
import { SafientMain, Arbitrator, Types } from '@safient/contracts';
const safientMain = new SafientMain(signer, chainId);
const arbitrator = new Arbitrator(signer, chainId);
Building docs
Update the docs markdown
npm run build:docs
Run the docusaurus website locally
npm run serve:docs