@safient/contracts
v0.1.19-alpha
Published
JavaScript SDK to manage and interact with the safe claims on Safient protocol.
Maintainers
Readme
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 installRunning tests
Create a .env file in the root directory with INFURA_API_KEY for mainnet or testnet deployment.
Testing the contracts
npm run test:contractTesting the JS SDK
Run a local blockchain
npm run chainDeploy the contract, run the test on a different terminal
npm run deploy:sdk
npm run test:sdkTesting the contract & SDK
npm run deploy:sdk
npm run testGetting started
npm i @safient/contractsUsage
// 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:docsRun the docusaurus website locally
npm run serve:docs