Open Phoenix Wallet for payment
1 min
Using the technique of deep linking makes it possible to call either the Signum Phoenix Desktop or Mobile wallet, navigate inside it and fills the send form automatically.
As deep linking requires to register the custom URI protocol on the OS this technique does not work with standalone installations. So, one need to use the setup.exe on Windows, or the .deb package on Linux.
const {DeeplinkableWallet} = require("@signumjs/wallets");
const {Address} = require("@signumjs/core");
async function payWithPhoenix({recipient, amount, reference}) {
try {
const wallet = new DeeplinkableWallet()
const recipientId = Address.create(recipient).getNumericId()
// In NodeJS the wallet will only generate the link,
// but running this code in the browser uses the deeplink
// which opens the Phoenix wallet, if installed
const result = await wallet.pay({
amount,
message: reference,
to: recipientId
})
console.info(`Your deeplink: ${result}`)
} catch (e) {
console.error(e);
}
}
(async () => {
await payWithPhoenix({
recipient: 'S-9K9L-4CB5-88Y5-F5G4Z',
amount: 100.00,
reference: 'Donation'
});
})();