Skip to content

Commit

Permalink
blockchain-sdk-solana: add notification metadata examples
Browse files Browse the repository at this point in the history
  • Loading branch information
tsmbl committed Mar 14, 2024
1 parent e0a2899 commit 77cd2a6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/blockchain-sdk-solana/examples/e2e-dapp-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ async function main() {
.send({
title: 'New notification',
message: message.toString(),
actions: [
{
label: 'Open Dialect',
url: 'https://dialect.io',
},
],
})
.catch((e) => console.error(e));
}
Expand Down Expand Up @@ -79,5 +85,5 @@ async function getOrRegisterDapp() {

return createdDapp;
}
return dapp.messages.send({});
return dapp;
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ import {
message: 'Hello, world',
});

// Broadcast with metadata
await dapp.messages.send({
title: 'Hello',
message: 'Hello, world',
// Actions will be displayed in the notification as buttons, e.g. "Demo CTA" button will open "https://dialect.io" in the browser
// NB: Only one action is supported at the moment
actions: [{ label: 'Demo CTA', url: 'https://dialect.io' }],
});

// Unicast, but only to wallet channel (Dialect, Solflare or Step inboxes)
await dapp.messages.send({
title: 'Hello, dialectooooor',
Expand Down

0 comments on commit 77cd2a6

Please sign in to comment.