This package has been deprecated

Author message:

Deprecated in favor of @gnosis.pm/safe-apps-react-sdk

@rmeissner/safe-apps-react-sdk
TypeScript icon, indicating that this package has built-in type declarations

0.4.0 • Public • Published

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 @rmeissner/safe-apps-react-sdk
  • Add SafeProvider
// ... other imports
import SafeProvider from '@rmeissner/safe-apps-react-sdk';

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

const App = () => {
  const safe = useSafe()
  return (<div>{safe.info.safeAddress}</div>)
}

Usages

Send transactions

const txs: Transaction[] = [
  {
    "to": "0x31415629...",
    "value": "0",
    "data": "0xbaddad"
  },
  //...
]
// Returns a hash to identify the Safe transaction
const safeTxHash: string = await safe.sendTransactions(txs)

Load Safe transaction information

const safeTx: SafeTransaction = await safe.loadSafeTransaction(safeTxHash)

Readme

Keywords

none

Package Sidebar

Install

npm i @rmeissner/safe-apps-react-sdk

Weekly Downloads

1

Version

0.4.0

License

MIT

Unpacked Size

11 kB

Total Files

10

Last publish

Collaborators

  • rmeissner