0.3.1 • Published 5 years ago
wallet-notify v0.3.1
wallet-notify
Set of tools to create and process wallet notifications
yarn add wallet-notify
Notification format
{
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'
}
Send notification
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
})
Receive notification
import WalletNotify from 'wallet-notify'
// ... listen to incoming transactions
const notification = WalletNotify.decode(tx)
if (notification) {
// render as a notification
}
// render as a transaction
0.3.1
5 years ago
0.3.0
5 years ago
0.2.15
5 years ago
0.2.14
5 years ago
0.2.13
5 years ago
0.2.12
5 years ago
0.2.11
5 years ago
0.2.10
5 years ago
0.2.9
5 years ago
0.2.8
5 years ago
0.2.7
5 years ago
0.2.6
5 years ago
0.2.5
5 years ago
0.2.4
5 years ago
0.2.3
5 years ago
0.2.2
5 years ago
0.2.1
5 years ago
0.2.0
5 years ago
0.1.1
5 years ago
0.1.0
5 years ago