Set of tools to create and process wallet notifications
yarn add wallet-notify
{
text: "Hello, I'm a wallet notification!", // <-- required
thumbnailUrl: "https://me.com/my-logo.gif",
}
// OR
{
text: "Hello, I'm a wallet notification. Click to go to my website.", // <-- required
thumbnailUrl: "https://me.com/my-logo.gif",
actionUrl: "https://me.com/do-that-thing"
}
// OR
{
text: 'Hello, I’m a wallet notification. Click to buy crypto kitty', // <-- required
thumbnailUrl: "https://me.com/my-logo.gif",
actionTx: {
to: '0x...', // <-- required
amount: 0,
data: '0xdeadbeef'
}
}
// OR
{
t: 'Hello, I’m a short version notation notification',
tu: 'http://smal.co/pic.gif'
au: 'http://smal.co'
}
import WalletNotify from 'wallet-notify'
const notification = {
text: 'Hello World',
thumbnailUrl: 'https://www.publicdomainpictures.net/pictures/200000/velka/unicorn-icon.jpg',
actionUrl: 'https://ethwaterloo.com'
}
const tx = await WalletNotify.send({
notification
to: addressOrAddressArray,
web3: web3,
gasPrice: gasPrice,
gasLimit: gasLimit,
})
// OR
const data = WalletNotify.encode(notification)
const tx = await provider.transactionSend({
...,
data
})
import WalletNotify from 'wallet-notify'
// ... listen to incoming transactions
const notification = WalletNotify.decode(tx)
if (notification) {
// render as a notification
}
// render as a transaction