UNPKG

@signumjs/wallets

Version:

Wallets communication package for DApps in the Signum Network

37 lines 1.4 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GenericDeeplinkableWallet = void 0; const standards_1 = require("@signumjs/standards"); const isNodeJS_1 = require("../isNodeJS"); class GenericDeeplinkableWallet { redirectProxy; openInBrowser; constructor(options) { this.openInBrowser = options?.openInBrowser === undefined ? true : options.openInBrowser; this.redirectProxy = options?.redirectProxy || 'https://burst-balance-alert.vercel.app/api/redirect?url='; if ((0, isNodeJS_1.isNodeJS)()) { this.openInBrowser = false; } } eventuallyOpenInBrowser(url) { if (this.openInBrowser) { window.open(url, 'SignumJS Deeplinking', 'noopener noreferrer'); } return Promise.resolve(url); } mountDeeplink(action, payload) { const link = standards_1.src22.createDeeplink({ action, payload }); return this.redirectProxy + encodeURIComponent(link); } confirm(unsignedTransaction) { return this.eventuallyOpenInBrowser(this.mountDeeplink('confirm', { unsignedTransaction })); } sendEncryptedMessage(_args) { return Promise.reject(new Error('Not supported yet')); } } exports.GenericDeeplinkableWallet = GenericDeeplinkableWallet; //# sourceMappingURL=genericDeeplinkableWallet.js.map