React widget to be installed within other React applications for interacting with The Ethereum Postal Service.
yarn add wagmi https://github.com/EthereumPostalService/eps-widget
import { EPSWidget } from 'eps-widget';
export function someContainer() {
return (
<div>
<EPSWidget></EPSWidget>
<div>
)
}
contractAddress
– if not supplied, defaults to EPS (0x2156fcCff55637317D211B62318007309378fB95
)encryptedDestination
– if supplied, only displays message fields, sends all postage to the encrypted address
The most common usecase of widget will be to allow website users to send postage to the website owner without knowing the owner's address. This can be enabled by pre-encrypting the address and passing the encrypted postal address into the widget.
To pre-encrypt a destination address:
yarn add https://github.com/EthereumPostalService/eps-scripts --save-dev
ts-node ./node_modules/eps-scripts/encrypt-interactive.ts -r <rpc url>
Then pass the value to the widget.
import { EPSWidget } from 'eps-widget';
export function someContainer() {
return (
<div>
<EPSWidget encryptedDestination={"<encrypted address>"}></EPSWidget>
<div>
)
}
yarn start
spins up storybook at localhost:6060yarn build
packages into./dist
- Wagmi should be installed by the repository owner (peer dependencies)
- Depends on ethers v5 rather than v6 due to Wagmi
- Node 18 can cause build failures:
export NODE_OPTIONS=--openssl-legacy-provider
- Package includes a "prepare" script to build which runs every time there is an install from Github. This can complicate. Consider including a pre-built ./dist.