{"_id":"@consensolabs/claims-test","_rev":"1-f22858218d1f0aca8887e8bc26d4a535","name":"@consensolabs/claims-test","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@consensolabs/claims-test","version":"0.1.0","description":"JavaScript SDK to manage and interact with the safe claims on Safient protocol.","keywords":["Web3","Ethereum","Safient","IPFS","Crypto"],"scripts":{"prettier":"prettier --write 'contracts/**/*.sol'","clean":"hardhat clean","compile":"hardhat compile","chain":"hardhat node","test":"hardhat test","deploy":"hardhat run scripts/deploy.js","build":"tsc -p tsconfig.json"},"repository":{"type":"git","url":"git+https://github.com/safient/safient-claims-js.git"},"main":"dist/index.js","types":"dist/index.d.ts","prepublish":"tsc","author":{"name":"Safient","email":"hello@safient.io"},"devDependencies":{"@types/node":"^15.6.1","typescript":"^4.2.4"},"publishConfig":{"access":"public"},"dependencies":{"@ethersproject/address":"^5.2.0","@ethersproject/bignumber":"^5.2.0","@ethersproject/contracts":"^5.2.0","@ethersproject/logger":"^5.2.0","@ethersproject/providers":"^5.2.0","@ethersproject/units":"^5.2.0","@nomiclabs/hardhat-ethers":"^2.0.2","@nomiclabs/hardhat-waffle":"^2.0.1","chai":"^4.3.4","chai-as-promised":"^7.1.1","chalk":"^2.4.2","ethereum-waffle":"^3.3.0","ethers":"^5.3.0","hardhat":"^2.3.0","ramda":"^0.27.1"},"gitHead":"c56b522ef71d06fee718cd3d731720451d79fcbd","bugs":{"url":"https://github.com/safient/safient-claims-js/issues"},"homepage":"https://github.com/safient/safient-claims-js#readme","_id":"@consensolabs/claims-test@0.1.0","_nodeVersion":"16.4.0","_npmVersion":"7.19.0","dist":{"integrity":"sha512-blQh8c+PkM419Wbafn6+KxWccMF6TnkXPi0tG838f9OgQOKJxTf8aHyQp5pdHPzYDIrqMoC50H5WODEDjFYfWw==","shasum":"b631c82f57538227713af2101c1aa75212d25637","tarball":"https://registry.npmjs.org/@consensolabs/claims-test/-/claims-test-0.1.0.tgz","fileCount":17,"unpackedSize":123828,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg2YE8CRA9TVsSAnZWagAAmdgP/iCBQIk7I2ebJ+EwJCSS\nM4c2+SmtlvMY/xul6friv/FltS88PTHbncOte452Cizm/gWHQ7NWdh4o1HTO\nt99NhGC7tKWzDGFe+p5PXM69V7I6wzdlR+kkvrUjCfPOsw5Ur8mCIiZuuFMH\ncYnI0bJ++6/VzAS/wUl5W4eyMzSuXOQcJDDvxiQu8jHHKAMAuSmtmmlw0Q1v\nPjL1ocUVgHHAx5C1wK7SxKUt9+ksTYSLvLKgWC6TOw3LxDvdk6rRMuJkV2Cb\n7VZdK+xRmy9ZLbKX+u8apIFqvH3VStoazs/JJBdxlOZa6ccvRgPVLIaVzWpE\nungdUAFLi/3Zq/Uno15jaqrFRbkTLz3k2op6WZBY3LMu242G0arp2HPL8a9r\nCi9UacgHzGIwcWsJ7XT+GeEFnP3q1nklzfc+b+eXfnLnoGrGGFL8qUOEBy7Z\n/QpoCKhfz0oW1yne+LtWIJcqHJR0UmItKAXI2Pgxae+KnyVOMUDJkyhkTAM0\ndbXWQO8K57furnV3fE1E3zk6XL2Fga5FI526yQIUYCPsp4mVswVRcLcNHBcG\n/Q1lOvb1cAqOd0Lp8ZDZnmX+fnU5kX4Rt6ToEJpXvISUvYB6A6uM2s6Flxpg\nmUcfSqu0qLYgKN7+Ietq4RJOg4GZ7jqViKRQgZsU7/bHGz4WK7F2qqwHwpJM\nDqBW\r\n=RqMV\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCl8aTKWhxJ0uN4/T+WQWL8tznTVFkWADlTy3KVmkgcDAIhANEXNdmi9I9daS+CXzF4KqZ4zfXowAXWnx/PlAZdITx5"}]},"_npmUser":{"name":"koshikraj","email":"koshik.raj@gmail.com"},"directories":{},"maintainers":[{"name":"koshikraj","email":"koshik.raj@gmail.com"},{"name":"abhinav-anshul","email":"contact.abhinavanshul@gmail.com"},{"name":"shubham23","email":"tiwari.23.shubham@gmail.com"},{"name":"consensolabs-ci","email":"ci@consensolabs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/claims-test_0.1.0_1624867131568_0.5513297545972142"},"_hasShrinkwrap":false}},"time":{"created":"2021-06-28T07:58:51.293Z","0.1.0":"2021-06-28T07:58:51.688Z","modified":"2022-04-05T00:58:51.463Z"},"maintainers":[{"name":"koshikraj","email":"koshik.raj@gmail.com"},{"name":"abhinav-anshul","email":"contact.abhinavanshul@gmail.com"},{"name":"shubham23","email":"tiwari.23.shubham@gmail.com"},{"name":"consensolabs-ci","email":"ci@consensolabs.com"}],"description":"JavaScript SDK to manage and interact with the safe claims on Safient protocol.","homepage":"https://github.com/safient/safient-claims-js#readme","keywords":["Web3","Ethereum","Safient","IPFS","Crypto"],"repository":{"type":"git","url":"git+https://github.com/safient/safient-claims-js.git"},"author":{"name":"Safient","email":"hello@safient.io"},"bugs":{"url":"https://github.com/safient/safient-claims-js/issues"},"readme":"# Safient Claims\n\nJavaScript SDK to manage and interact with the safe claims on Safient protocol.\n\n## Installation\n\n```bash\n  git clone https://github.com/safient/safient-claims-js.git\n  cd safient-claims-js\n  npm install\n```\n\n## Running Tests\n\nCompile the TS code\n\n```bash\n  npx tsc\n```\n\nRun the chain on a separate terminal \n\n```bash\n  npm run chain\n```\n\nRun the tests\n\n```bash\n  npm run test\n```\n\n## Getting started\n\n```bash\n  npm install safient-claims\n```\n\n## Usage\n\n```javascript\n// If not injected web3 provider, create a jsonRpcProvider\nconst { JsonRpcProvider } = require('@ethersproject/providers');\nconst provider = new JsonRpcProvider('http://localhost:8545');\n\n// Get chainId from provider\n(async () => {\n  const providerNetwork = await provider.getNetwork();\n  const chainId = providerNetwork.chainId;\n})();\n```\n\n## Initialization\n\n```javascript\nimport { SafientClaims } from 'safient-claims';\n\nconst sc = new SafientClaims(provider, chainId);\n```\n\n### Arbitrator\n\n```\nsc.arbitrator.getArbitrationFee\n```\n\n### SafientMain\n\n```\nsc.safientMain.createSafe\nsc.safientMain.createClaim\nsc.safientMain.submitEvidence\nsc.safientMain.depositSafeFunds\nsc.safientMain.recoverSafeFunds\nsc.safientMain.setTotalClaimsAllowed\nsc.safientMain.getTotalNumberOfSafes\nsc.safientMain.getTotalNumberOfClaims\nsc.safientMain.getAllSafes\nsc.safientMain.getAllClaims\nsc.safientMain.getSafeBySafeId\nsc.safientMain.getClaimByClaimId\nsc.safientMain.getClaimsOnSafeBySafeId\nsc.safientMain.getClaimStatus\nsc.safientMain.getTotalClaimsAllowed\nsc.safientMain.getSafientMainContractBalance\n```\n\n## API details\n\n### Arbitrator\n\n#### Get Arbitration Fee\n\n```javascript\nconst getArbitrationFee = async () => {\n  try {\n    const fee = await sc.arbitrator.getArbitrationFee();\n    console.log(fee);\n  } catch (e) {\n    console.log(e.message);\n  }\n};\n```\n\n| Returns           | Type     | Description                |\n| :---------------- | :------- | :------------------------- |\n| `Arbitration fee` | `number` | Arbitration fee in **ETH** |\n\n### SafientMain\n\n#### Create Safe\n\n```javascript\nconst createSafe = async (inheritorAddress, metaevidenceURI, value) => {\n  try {\n    const tx = await sc.safientMain.createSafe(inheritorAddress, metaevidenceURI, value);\n    console.log(tx);\n  } catch (e) {\n    console.log(e.message);\n  }\n};\n```\n\n| Parameter          | Type     | Description                                                                        |\n| :----------------- | :------- | :--------------------------------------------------------------------------------- |\n| `inheritorAddress` | `string` | **Required**. Address of the beneficiary who can claim to inherit this safe        |\n| `metaevidenceURI`  | `string` | **Required**. IPFS URI pointing to the metaevidence related to arbitration details |\n| `value`            | `string` | **Required**. Safe maintanence fee in **Gwei**, minimum arbitration fee required   |\n\n<br />\n\n| Returns                | Type     | Description                              |\n| :--------------------- | :------- | :--------------------------------------- |\n| `Transaction Response` | `object` | Includes all properties of a transaction |\n\n#### Create Claim\n\n```javascript\nconst createClaim = async (safeId, evidenceURI) => {\n  try {\n    const tx = await sc.safientMain.createClaim(safeId, evidenceURI);\n    console.log(tx);\n  } catch (e) {\n    console.log(e.message);\n  }\n};\n```\n\n| Parameter     | Type     | Description                                                                    |\n| :------------ | :------- | :----------------------------------------------------------------------------- |\n| `safeId`      | `number` | **Required**. Id of the safe                                                   |\n| `evidenceURI` | `string` | **Required**. IPFS URI pointing to the evidence submitted by the claim creator |\n| `signer`      | `string` | **Optional & for test only**. Specific signer account for test purpose         |\n\n<br />\n\n| Returns                | Type     | Description                              |\n| :--------------------- | :------- | :--------------------------------------- |\n| `Transaction Response` | `object` | Includes all properties of a transaction |\n\n#### Submit Evidence\n\n```javascript\nconst submitEvidence = async (disputeId, evidenceURI) => {\n  try {\n    const tx = await sc.safientMain.submitEvidence(disputeId, evidenceURI);\n    console.log(tx);\n  } catch (e) {\n    console.log(e.message);\n  }\n};\n```\n\n| Parameter     | Type     | Description                                                                    |\n| :------------ | :------- | :----------------------------------------------------------------------------- |\n| `disputeId`   | `number` | **Required**. Id of the dispute representing the claim                         |\n| `evidenceURI` | `string` | **Required**. IPFS URI pointing to the evidence submitted by the claim creator |\n| `signer`      | `string` | **Optional & for test only**. Specific signer account for test purpose         |\n\n<br />\n\n| Returns                | Type     | Description                              |\n| :--------------------- | :------- | :--------------------------------------- |\n| `Transaction Response` | `object` | Includes all properties of a transaction |\n\n#### Deposit Safe Funds\n\n```javascript\nconst depositSafeFunds = async (safeId, value) => {\n  try {\n    const tx = await sc.safientMain.depositSafeFunds(safeId, value);\n    console.log(tx);\n  } catch (e) {\n    console.log(e.message);\n  }\n};\n```\n\n| Parameter | Type     | Description                     |\n| :-------- | :------- | :------------------------------ |\n| `safeId`  | `number` | **Required**. Id of the safe    |\n| `value`   | `string` | **Required**. Funds in **Gwei** |\n\n<br />\n\n| Returns                | Type     | Description                              |\n| :--------------------- | :------- | :--------------------------------------- |\n| `Transaction Response` | `object` | Includes all properties of a transaction |\n\n#### Recover Safe Funds\n\n> Only **safe's current owner** can execute this\n\n```javascript\nconst recoverSafeFunds = async (safeId) => {\n  try {\n    const tx = await sc.safientMain.recoverSafeFunds(safeId);\n    console.log(tx);\n  } catch (e) {\n    console.log(e.message);\n  }\n};\n```\n\n| Parameter | Type     | Description                                                            |\n| :-------- | :------- | :--------------------------------------------------------------------- |\n| `safeId`  | `number` | **Required**. Id of the safe                                           |\n| `signer`  | `string` | **Optional & for test only**. Specific signer account for test purpose |\n\n<br />\n\n| Returns                | Type     | Description                              |\n| :--------------------- | :------- | :--------------------------------------- |\n| `Transaction Response` | `object` | Includes all properties of a transaction |\n\n#### Set Total Claims Allowed\n\n> Only **SafientMain contract deployer** can execute this\n\n```javascript\nconst setTotalClaimsAllowed = async (claimsAllowed) => {\n  try {\n    const tx = await sc.safientMain.setTotalClaimsAllowed(claimsAllowed);\n    console.log(tx);\n  } catch (e) {\n    console.log(e.message);\n  }\n};\n```\n\n| Parameter       | Type     | Description                                                            |\n| :-------------- | :------- | :--------------------------------------------------------------------- |\n| `claimsAllowed` | `number` | **Required**. Number of total claims allowed                           |\n| `signer`        | `string` | **Optional & for test only**. Specific signer account for test purpose |\n\n<br />\n\n| Returns                | Type     | Description                              |\n| :--------------------- | :------- | :--------------------------------------- |\n| `Transaction Response` | `object` | Includes all properties of a transaction |\n\n#### Get Total Number Of Safes\n\n```javascript\nconst getTotalNumberOfSafes = async () => {\n  try {\n    const numOfSafes = await sc.safientMain.getTotalNumberOfSafes();\n    console.log(numOfSafes);\n  } catch (e) {\n    console.log(e.message);\n  }\n};\n```\n\n| Returns              | Type     | Description                                  |\n| :------------------- | :------- | :------------------------------------------- |\n| `Total no. of safes` | `number` | Total number of safes created on SafientMain |\n\n#### Get Total Number Of Claims\n\n```javascript\nconst getTotalNumberOfClaims = async () => {\n  try {\n    const numOfClaims = await sc.safientMain.getTotalNumberOfClaims();\n    console.log(numOfClaims);\n  } catch (e) {\n    console.log(e.message);\n  }\n};\n```\n\n| Returns               | Type     | Description                                   |\n| :-------------------- | :------- | :-------------------------------------------- |\n| `Total no. of claims` | `number` | Total number of claims created on SafientMain |\n\n#### Get All Safes\n\n```javascript\nconst getAllSafes = async () => {\n  try {\n    const safes = await sc.safientMain.getAllSafes();\n    console.log(safes);\n  } catch (e) {\n    console.log(e.message);\n  }\n};\n```\n\n| Returns          | Type     | Description                                   |\n| :--------------- | :------- | :-------------------------------------------- |\n| `Array of safes` | `Safe[]` | Array of all the safes created on SafientMain |\n\n> Type **Safe**\n\n| Property           | Type        | Description                                           |\n| :----------------- | :---------- | :---------------------------------------------------- |\n| `safeId`           | `BigNumber` | Id of the safe                                        |\n| `safeCreatedBy`    | `string`    | Address of the safe creator                           |\n| `safeCurrentOwner` | `string`    | Address of the current safe owner                     |\n| `safeInheritor`    | `string`    | Address of the safe inheritor (beneficiary)           |\n| `metaEvidenceId`   | `Bigumber`  | Id used to uniquely identify a piece of meta-evidence |\n| `claimsCount`      | `Bigumber`  | Number of claims made on this safe                    |\n| `safeFunds`        | `Bigumber`  | Total safe funds in **Gwei**                          |\n\n#### Get All Claims\n\n```javascript\nconst getAllClaims = async () => {\n  try {\n    const claims = await sc.safientMain.getAllClaims();\n    console.log(claims);\n  } catch (e) {\n    console.log(e.message);\n  }\n};\n```\n\n| Returns           | Type      | Description                                    |\n| :---------------- | :-------- | :--------------------------------------------- |\n| `Array of claims` | `Claim[]` | Array of all the claims created on SafientMain |\n\n> Type **Claim**\n\n| Property          | Type        | Description                                                                    |\n| :---------------- | :---------- | :----------------------------------------------------------------------------- |\n| `safeId`          | `BigNumber` | Id of the safe                                                                 |\n| `disputeId`       | `BigNumber` | Id of the dispute representing the claim                                       |\n| `claimedBy`       | `string`    | Address of the claim creator                                                   |\n| `metaEvidenceId`  | `BigNumber` | Id used to uniquely identify a piece of meta-evidence                          |\n| `evidenceGroupId` | `Bigumber`  | Id used to identify a group of evidence related to a dispute                   |\n| `status`          | `number`    | Claim status represented by **0**, **1**, **2** or **3**                       |\n| `result`          | `string`    | Claim result represented by **Passed**, **Failed** or **Refused To Arbitrate** |\n\n#### Get Safe By Safe Id\n\n```javascript\nconst getSafeBySafeId = async (safeId) => {\n  try {\n    const safe = await sc.safientMain.getSafeBySafeId(safeId);\n    console.log(safe);\n  } catch (e) {\n    console.log(e.message);\n  }\n};\n```\n\n| Parameter | Type     | Description                  |\n| :-------- | :------- | :--------------------------- |\n| `safeId`  | `number` | **Required**. Id of the safe |\n\n<br />\n\n| Returns | Type   | Description               |\n| :------ | :----- | :------------------------ |\n| `Safe`  | `Safe` | Safe containing safe data |\n\n#### Get Claim By Claim Id\n\n```javascript\nconst getClaimByClaimId = async (claimId) => {\n  try {\n    const claim = await sc.safientMain.getClaimByClaimId(claimId);\n    console.log(claim);\n  } catch (e) {\n    console.log(e.message);\n  }\n};\n```\n\n| Parameter | Type     | Description                   |\n| :-------- | :------- | :---------------------------- |\n| `claimId` | `number` | **Required**. Id of the claim |\n\n<br />\n\n| Returns | Type    | Description                 |\n| :------ | :------ | :-------------------------- |\n| `Claim` | `Claim` | Claim containing claim data |\n\n#### Get All Claims On A Safe By Safe Id\n\n```javascript\nconst getClaimsOnSafeBySafeId = async (safeId) => {\n  try {\n    const claims = await sc.safientMain.getClaimsOnSafeBySafeId(safeId);\n    console.log(claims);\n  } catch (e) {\n    console.log(e.message);\n  }\n};\n```\n\n| Parameter | Type     | Description                  |\n| :-------- | :------- | :--------------------------- |\n| `safeId`  | `number` | **Required**. Id of the safe |\n\n<br />\n\n| Returns           | Type      | Description                       |\n| :---------------- | :-------- | :-------------------------------- |\n| `Array of claims` | `Claim[]` | Array of all the claims on a safe |\n\n#### Get Claim Status\n\n```javascript\nconst getClaimStatus = async (claimId) => {\n  try {\n    const claimStatus = await sc.safientMain.getClaimStatus(safeId);\n    console.log(claimStatus);\n  } catch (e) {\n    console.log(e.message);\n  }\n};\n```\n\n| Parameter | Type     | Description                   |\n| :-------- | :------- | :---------------------------- |\n| `claimId` | `number` | **Required**. Id of the claim |\n\n<br />\n\n| Returns        | Type     | Description                                                                                |\n| :------------- | :------- | :----------------------------------------------------------------------------------------- |\n| `claim status` | `string` | Claim status represented by **Active**, **Passed**, **Failed** or **Refused To Arbitrate** |\n\n#### Get Total No. Of Claims Allowed On A Safe\n\n```javascript\nconst getTotalClaimsAllowed = async () => {\n  try {\n    const claimsAllowed = await sc.safientMain.getTotalClaimsAllowed();\n    console.log(claimsAllowed);\n  } catch (e) {\n    console.log(e.message);\n  }\n};\n```\n\n| Returns                       | Type     | Description                           |\n| :---------------------------- | :------- | :------------------------------------ |\n| `Total no. of claims allowed` | `number` | Total no. of claims allowed on a safe |\n\n#### Get SafientMain Contract Total Balance\n\n```javascript\nconst getSafientMainContractBalance = async () => {\n  try {\n    const balance = await sc.safientMain.getSafientMainContractBalance();\n    console.log(balance);\n  } catch (e) {\n    console.log(e.message);\n  }\n};\n```\n\n| Returns                        | Type     | Description                           |\n| :----------------------------- | :------- | :------------------------------------ |\n| `SafientMain contract balance` | `number` | Total balance of SafientMain contract |\n","readmeFilename":"README.md"}