@owney/sdk 0.7.37-beta.0 → 0.7.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +11 -11
- package/dist/index.js +11 -11
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4693,7 +4693,6 @@ function makeSponsoredDepositCallback(deps) {
|
|
|
4693
4693
|
// src/lib/walletconnect-switch.ts
|
|
4694
4694
|
var WALLET_SWITCH_TIMEOUT_MS = 12e4;
|
|
4695
4695
|
var HOLD_CHAIN_MS = 15e3;
|
|
4696
|
-
var MAX_RESENDS = 2;
|
|
4697
4696
|
var holds = /* @__PURE__ */ new Map();
|
|
4698
4697
|
function parseChainId(raw) {
|
|
4699
4698
|
if (typeof raw === "number") return raw;
|
|
@@ -4762,7 +4761,7 @@ async function switchWalletConnectChain(provider, chainId, timeoutMs = WALLET_SW
|
|
|
4762
4761
|
return true;
|
|
4763
4762
|
}
|
|
4764
4763
|
await requestSwitch(core, provider, chainId, timeoutMs);
|
|
4765
|
-
holdChain(core,
|
|
4764
|
+
holdChain(core, chainId);
|
|
4766
4765
|
return true;
|
|
4767
4766
|
}
|
|
4768
4767
|
async function requestSwitch(core, provider, chainId, timeoutMs) {
|
|
@@ -4801,26 +4800,27 @@ async function requestSwitch(core, provider, chainId, timeoutMs) {
|
|
|
4801
4800
|
} catch {
|
|
4802
4801
|
}
|
|
4803
4802
|
}
|
|
4804
|
-
function holdChain(core,
|
|
4803
|
+
function holdChain(core, chainId) {
|
|
4805
4804
|
if (typeof core.on !== "function" || typeof core.removeListener !== "function") {
|
|
4806
4805
|
return;
|
|
4807
4806
|
}
|
|
4808
|
-
let
|
|
4807
|
+
let repins = 0;
|
|
4809
4808
|
const listener = (raw) => {
|
|
4810
4809
|
const reported = parseChainId(raw);
|
|
4811
4810
|
debugLog("wc-switch", "wallet reported chain", {
|
|
4812
4811
|
reported,
|
|
4813
4812
|
holding: chainId,
|
|
4814
|
-
|
|
4813
|
+
repins
|
|
4815
4814
|
});
|
|
4816
4815
|
if (reported === void 0 || reported === chainId) return;
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4816
|
+
repins += 1;
|
|
4817
|
+
try {
|
|
4818
|
+
core.setDefaultChain(`eip155:${chainId}`);
|
|
4819
|
+
} catch (error) {
|
|
4820
|
+
debugLog("wc-switch", "session re-pin failed", {
|
|
4821
4821
|
error: error instanceof Error ? error.message : String(error)
|
|
4822
|
-
})
|
|
4823
|
-
|
|
4822
|
+
});
|
|
4823
|
+
}
|
|
4824
4824
|
};
|
|
4825
4825
|
const release = () => {
|
|
4826
4826
|
clearTimeout(timer);
|
package/dist/index.js
CHANGED
|
@@ -4673,7 +4673,6 @@ function makeSponsoredDepositCallback(deps) {
|
|
|
4673
4673
|
// src/lib/walletconnect-switch.ts
|
|
4674
4674
|
var WALLET_SWITCH_TIMEOUT_MS = 12e4;
|
|
4675
4675
|
var HOLD_CHAIN_MS = 15e3;
|
|
4676
|
-
var MAX_RESENDS = 2;
|
|
4677
4676
|
var holds = /* @__PURE__ */ new Map();
|
|
4678
4677
|
function parseChainId(raw) {
|
|
4679
4678
|
if (typeof raw === "number") return raw;
|
|
@@ -4742,7 +4741,7 @@ async function switchWalletConnectChain(provider, chainId, timeoutMs = WALLET_SW
|
|
|
4742
4741
|
return true;
|
|
4743
4742
|
}
|
|
4744
4743
|
await requestSwitch(core, provider, chainId, timeoutMs);
|
|
4745
|
-
holdChain(core,
|
|
4744
|
+
holdChain(core, chainId);
|
|
4746
4745
|
return true;
|
|
4747
4746
|
}
|
|
4748
4747
|
async function requestSwitch(core, provider, chainId, timeoutMs) {
|
|
@@ -4781,26 +4780,27 @@ async function requestSwitch(core, provider, chainId, timeoutMs) {
|
|
|
4781
4780
|
} catch {
|
|
4782
4781
|
}
|
|
4783
4782
|
}
|
|
4784
|
-
function holdChain(core,
|
|
4783
|
+
function holdChain(core, chainId) {
|
|
4785
4784
|
if (typeof core.on !== "function" || typeof core.removeListener !== "function") {
|
|
4786
4785
|
return;
|
|
4787
4786
|
}
|
|
4788
|
-
let
|
|
4787
|
+
let repins = 0;
|
|
4789
4788
|
const listener = (raw) => {
|
|
4790
4789
|
const reported = parseChainId(raw);
|
|
4791
4790
|
debugLog("wc-switch", "wallet reported chain", {
|
|
4792
4791
|
reported,
|
|
4793
4792
|
holding: chainId,
|
|
4794
|
-
|
|
4793
|
+
repins
|
|
4795
4794
|
});
|
|
4796
4795
|
if (reported === void 0 || reported === chainId) return;
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4796
|
+
repins += 1;
|
|
4797
|
+
try {
|
|
4798
|
+
core.setDefaultChain(`eip155:${chainId}`);
|
|
4799
|
+
} catch (error) {
|
|
4800
|
+
debugLog("wc-switch", "session re-pin failed", {
|
|
4801
4801
|
error: error instanceof Error ? error.message : String(error)
|
|
4802
|
-
})
|
|
4803
|
-
|
|
4802
|
+
});
|
|
4803
|
+
}
|
|
4804
4804
|
};
|
|
4805
4805
|
const release = () => {
|
|
4806
4806
|
clearTimeout(timer);
|