@snowflake-so/safe-apps-provider
Version:
A React library provides Provider, Context API and hooks to support Snowflake Safe Apps integration.
53 lines (34 loc) • 1.33 kB
Markdown
# Safe Apps Provider
A React library provides Provider, Context API and hooks to support Snowflake Safe Apps integration.
## Installation
[](https://www.npmjs.com/package/@snowflake-so/safe-apps-provider)
```
npm install @snowflake-so/safe-apps-provider
yarn add @snowflake-so/safe-apps-provider
```
## Quick start guide
**Note**: The implemented application only works inner Snowflake Safe app.
Wrap your root component with `SafeProvider` and use the React hook `useSafeContext` to retrieve the data of the Snowflake Safe parent window.
```tsx
import React from "react";
import { useSafe, SafeProvider } from "@snowflake-so/safe-apps-provider";
const AppContent = () => {
const { safe } = useSafe();
return <div>{safe.safeInfo.vaultAddress}</div>;
};
const App = () => {
return (
<SafeProvider>
<AppContent />
</SafeProvider>
);
};
export default App;
```
## Support
### Struggle with the SDK integration?
If you have any problem with using the SDK in your system, drop a question our Snowflake Discord #sdk to receive a support from our engineers.
### Find a bug or want to contribute to Snowflake?
If you find a bug or have any problem and idea while using the SDK, you can create an issue on SDK Github.
License
MIT