Wallets Module
3 min

API Reference | |
|---|---|
NPM Package | |
CDN URL | |
IIFE namespace | sig$wallets |
Installation
npm i @signumjs/walletsBasic Usage
The wallets module offers easy-to-use abstractions to interact with wallets via one-way deep linking for mobile and desktop wallet and/or full-duplex communication with the XT Wallet.
The following example shows how to generate a (deep) link, that opens the Phoenix Wallet (Mobile or Desktop).
async function createPaymentLink(args) {
try {
const {recipient, amount, reference} = args
// In NodeJS the wallet will only generate the link,
// but running this code in the browser opens the deeplink
// which opens the Phoenix wallet, if installed
const wallet = new DeeplinkableWallet()
const recipientId = Address.create(recipient).getNumericId()
const result = await wallet.pay({
amount,
message: reference,
to: recipientId
})
console.info(`Your deeplink: ${result}`)
} catch (e) {
handleError(e);
}
}
(async () => {
await createPaymentLink({
recipient: 'S-9K9L-4CB5-88Y5-F5G4Z',
amount: 100.00,
reference: 'Donation'
});
})();