diff --git a/package-lock.json b/package-lock.json
index ad30e75..4c6e263 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@perawallet/connect",
- "version": "1.0.6",
+ "version": "1.0.7",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@perawallet/connect",
- "version": "1.0.6",
+ "version": "1.0.7",
"license": "ISC",
"dependencies": {
"@json-rpc-tools/utils": "^1.7.6",
diff --git a/package.json b/package.json
index b545d5a..4300ca3 100644
--- a/package.json
+++ b/package.json
@@ -1,5 +1,5 @@
{
- "version": "1.0.6",
+ "version": "1.0.7",
"name": "@perawallet/connect",
"description": "JavaScript SDK for integrating Pera Wallet to web applications.",
"main": "dist/index.js",
diff --git a/src/PeraWalletConnect.ts b/src/PeraWalletConnect.ts
index 7693db8..84cf12b 100644
--- a/src/PeraWalletConnect.ts
+++ b/src/PeraWalletConnect.ts
@@ -547,7 +547,15 @@ class PeraWalletConnect {
try {
try {
- const response = await this.connector!.sendCustomRequest(formattedSignTxnRequest);
+ const {silent} = await getPeraConnectConfig(this.network);
+
+ const response = await this.connector!.sendCustomRequest(
+ formattedSignTxnRequest,
+ {
+ forcePushNotification: !silent
+ }
+ );
+
// We send the full txn group to the mobile wallet.
// Therefore, we first filter out txns that were not signed by the wallet.
// These are received as `null`.
diff --git a/src/modal/peraWalletConnectModalUtils.ts b/src/modal/peraWalletConnectModalUtils.ts
index ae36a98..c0440d8 100644
--- a/src/modal/peraWalletConnectModalUtils.ts
+++ b/src/modal/peraWalletConnectModalUtils.ts
@@ -43,11 +43,13 @@ function createModalWrapperOnDOM(modalId: string) {
function openPeraWalletConnectModal(modalConfig: PeraWalletModalConfig) {
return (uri: string) => {
- const root = createModalWrapperOnDOM(PERA_WALLET_CONNECT_MODAL_ID);
- const newURI = `${uri}&algorand=true`;
- const {isWebWalletAvailable, shouldDisplayNewBadge, shouldUseSound} = modalConfig;
+ if (!document.getElementById(PERA_WALLET_CONNECT_MODAL_ID)) {
+ const root = createModalWrapperOnDOM(PERA_WALLET_CONNECT_MODAL_ID);
+ const newURI = `${uri}&algorand=true`;
+ const {isWebWalletAvailable, shouldDisplayNewBadge, shouldUseSound} = modalConfig;
- root.innerHTML = ``;
+ root.innerHTML = ``;
+ }
};
}
diff --git a/src/util/api/peraWalletConnectApi.ts b/src/util/api/peraWalletConnectApi.ts
index 7e69729..2814f59 100644
--- a/src/util/api/peraWalletConnectApi.ts
+++ b/src/util/api/peraWalletConnectApi.ts
@@ -19,6 +19,7 @@ function fetchPeraConnectConfig(network: PeraWalletNetwork) {
use_sound: boolean | undefined;
display_new_badge: boolean | undefined;
servers: string[] | undefined;
+ silent: boolean | undefined;
}>(configURL, {cache: "no-store"});
}
@@ -31,7 +32,8 @@ async function getPeraConnectConfig(network: PeraWalletNetwork) {
webWalletURL: "",
isWebWalletAvailable: false,
shouldDisplayNewBadge: false,
- shouldUseSound: true
+ shouldUseSound: true,
+ silent: false
};
try {
@@ -49,6 +51,10 @@ async function getPeraConnectConfig(network: PeraWalletNetwork) {
peraWalletConfig.shouldUseSound = response.use_sound!;
}
+ if (typeof response.silent !== "undefined") {
+ peraWalletConfig.silent = response.silent!;
+ }
+
peraWalletConfig = {
...peraWalletConfig,
bridgeURL: shuffleArray(response.servers || [])[0] || "",
diff --git a/src/util/api/peraWalletConnectApiTypes.ts b/src/util/api/peraWalletConnectApiTypes.ts
index 62ec5e7..cd906b6 100644
--- a/src/util/api/peraWalletConnectApiTypes.ts
+++ b/src/util/api/peraWalletConnectApiTypes.ts
@@ -4,4 +4,5 @@ export interface PeraWalletConfig {
isWebWalletAvailable: boolean;
shouldDisplayNewBadge: boolean;
shouldUseSound: boolean;
+ silent: boolean;
}