Socket
Book a DemoInstallSign in
Socket

@gnosis.pm/safe-apps-react-sdk

Package Overview
Dependencies
Maintainers
4
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gnosis.pm/safe-apps-react-sdk

[![npm](https://img.shields.io/npm/v/@gnosis.pm/safe-apps-react-sdk)](https://www.npmjs.com/package/@gnosis.pm/safe-apps-react-sdk)

4.6.2
latest
npmnpm
Version published
Weekly downloads
280
164.15%
Maintainers
4
Weekly downloads
 
Created
Source

Safe Apps React SDK

npm

This SDK should provide a simple way to write a React.js Safe app

How to use

  • Add npm package
yarn add @gnosis.pm/safe-apps-react-sdk

npm i @gnosis.pm/safe-apps-react-sdk
  • Add SafeProvider Safe provider accepts loader and options props
// ... other imports
import SafeProvider from '@gnosis.pm/safe-apps-react-sdk';

ReactDOM.render(
  <React.StrictMode>
    <SafeProvider>
      <App /> // Your app
    </SafeProvider>
  </React.StrictMode>,
  document.getElementById('root'),
);
  • Use Safe Apps SDK Hook
// ... other imports
import { useSafeAppsSDK } from '@gnosis.pm/safe-apps-react-sdk';

const App = () => {
  const { sdk, connected, safe } = useSafeAppsSDK();
  return <div>{safe.safeAddress}</div>;
};

Usages

Send transactions

import { BaseTransaction } from '@gnosis.pm/safe-apps-sdk'

const txs: BaseTransaction[] = [
  {
    to: '0x31415629...',
    value: '0',
    data: '0xbaddad',
  },
  //...
];
// Returns a hash to identify the Safe transaction
const safeTxHash: string = await sdk.txs.send({ txs });

Load Safe transaction information

const safeTx: SafeTransaction = await sdk.txs.getBySafeTxHash(safeTxHash);

More scenarios

For all available sdk methods, please refer to the safe-apps-sdk documentation

FAQs

Package last updated on 01 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.