0.15.1 • Published 2 years ago

@gnosis.pm/safe-apps-provider v0.15.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Safe Apps Provider

npm

This is a provider that follows common standards (e.g. EIP-1193) and can be used with various Web3 libraries (e.g. web3.js or Ethers)

How to use

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

npm i @gnosis.pm/safe-apps-provider

SafeAppProvider

The provider can be used with the safe-apps-react-sdk and common web3 libraries.

With Ethers.js

import React, { useMemo } from 'react';
import { ethers } from 'ethers';
import { useSafeAppsSDK } from '@gnosis.pm/safe-apps-react-sdk';
import { SafeAppProvider } from '@gnosis.pm/safe-apps-provider';

const App = () => {
  const { sdk, safe } = useSafeAppsSDK();
  const web3Provider = useMemo(() => new ethers.providers.Web3Provider(new SafeAppProvider(safe, sdk)), [sdk, safe]);

  // use provider with contracts

  return;
};

export default App;

With web3.js

import React, { useMemo } from 'react';
import Web3 from 'web3';
import { useSafeAppsSDK } from '@gnosis.pm/safe-apps-react-sdk';
import { SafeAppProvider } from '@gnosis.pm/safe-apps-provider';

const App = () => {
  const { sdk, safe } = useSafeAppsSDK();
  const web3Provider = useMemo(() => new Web3(new SafeAppProvider(safe, sdk)), [sdk, safe]);

  // use provider with contracts

  return;
};

export default App;

A note on gas limit

The ethereum transaction gas limit passed to the safe-apps-provider will be treated as safeTxGas, which is an equivalent of the ethereum transaction gas limit in the Safe context. To learn more about the safe transaction gas, read here:
https://github.com/safe-global/safe-contracts/blob/c36bcab46578a442862d043e12a83fec41143dec/docs/safe_tx_gas.md

If you don't want to pass a calculation and leave it to the Safe, pass 0 as the gas limit.

More scenarios

For the SDK overview documentation, please refer to the safe-apps-sdk documentation

0.15.0

2 years ago

0.15.1

2 years ago

0.14.0

2 years ago

0.13.0

2 years ago

0.13.1

2 years ago

0.13.2

2 years ago

0.12.0

2 years ago

0.11.1

2 years ago

0.11.2

2 years ago

0.11.3

2 years ago

0.11.0

3 years ago

0.9.3

3 years ago

0.10.1

3 years ago

0.10.2

3 years ago

0.10.3

3 years ago

0.10.0

3 years ago

0.9.2

3 years ago

0.9.0

3 years ago

0.9.1

3 years ago

0.8.1-next.1

3 years ago

0.8.1

3 years ago

0.8.1-next.0

3 years ago

0.8.0

3 years ago

0.8.0-next.3

3 years ago

0.7.2-next.2

3 years ago

0.7.2-next.1

3 years ago

0.7.2-next.0

3 years ago

0.7.1

3 years ago

0.7.0-next.1

3 years ago

0.7.0

3 years ago

0.7.0-next.0

3 years ago

0.6.0

3 years ago

0.5.0

3 years ago

0.3.0

4 years ago

0.4.0

4 years ago

0.2.4

4 years ago

0.2.3

4 years ago

0.2.1

4 years ago

0.2.2

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago