React
Note: The package has not been published, please contact us or fill out this form for access
Built upon our core JavaScript package, the React SDK is tailored for projects leveraging React's dynamic ecosystem. Featuring an intuitive hook, it simplifies integration into existing React applications, particularly within bridging components. This wrapper aims to streamline the inclusion of insurance functionalities, making it an effortless addition to your React-based projects.
Installation
Basic Implementation
Provider Setup
Hook Setup
Types
Web3ShieldProvider
Prop | Type | Description |
---|---|---|
apiKey | string | Web3Shield Project API Key |
logs | boolean | Enable or disable logs, |
environment |
| Select which Web3Shield environment to operate in, |
useInsurance()
Parameter | Type | Description |
---|---|---|
user | string | Address of the user opting in for insurance |
amount | string | number | BigNumber | Amount of |
source | string | Chain ID of the source chain |
destination | string | Chain ID of the destination chain |
sourceToken | string | Address of the source token |
destinationToken | string | Address of the destination token |
Return Value | Type | Description |
---|---|---|
message | string | Relevant success/error message |
premium | float | Premium amount to be paid to cover |
premiumValue | float | Value of premium in USD |
minimumPremium | float | Minimum premium amount to be paid (in USD) |
timeLeft | number | Time left until insurance expires |
refetch | function | Manually trigger the refetching of insurance data |
Signing Implementation
Coming Soon
Last updated