@owney/sdk 0.7.32 → 0.7.33
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 +6 -4
- package/dist/index.js +6 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4592,7 +4592,7 @@ function makeSponsoredDepositCallback(deps) {
|
|
|
4592
4592
|
var WALLET_SWITCH_TIMEOUT_MS = 12e4;
|
|
4593
4593
|
var HOLD_CHAIN_MS = 15e3;
|
|
4594
4594
|
var MAX_RESENDS = 2;
|
|
4595
|
-
var holds = /* @__PURE__ */ new
|
|
4595
|
+
var holds = /* @__PURE__ */ new Map();
|
|
4596
4596
|
function parseChainId(raw) {
|
|
4597
4597
|
if (typeof raw === "number") return raw;
|
|
4598
4598
|
if (typeof raw !== "string") return void 0;
|
|
@@ -4613,7 +4613,7 @@ function walletConnectCore(provider) {
|
|
|
4613
4613
|
async function switchWalletConnectChain(provider, chainId, timeoutMs = WALLET_SWITCH_TIMEOUT_MS) {
|
|
4614
4614
|
const core = walletConnectCore(provider);
|
|
4615
4615
|
if (!core) return false;
|
|
4616
|
-
holds.get(core)?.();
|
|
4616
|
+
holds.get(core.session.topic)?.();
|
|
4617
4617
|
await requestSwitch(core, provider, chainId, timeoutMs);
|
|
4618
4618
|
holdChain(core, provider, chainId);
|
|
4619
4619
|
return true;
|
|
@@ -4675,11 +4675,13 @@ function holdChain(core, provider, chainId) {
|
|
|
4675
4675
|
const release = () => {
|
|
4676
4676
|
clearTimeout(timer);
|
|
4677
4677
|
core.removeListener?.("chainChanged", listener);
|
|
4678
|
-
if (holds.get(core) === release)
|
|
4678
|
+
if (holds.get(core.session.topic) === release) {
|
|
4679
|
+
holds.delete(core.session.topic);
|
|
4680
|
+
}
|
|
4679
4681
|
};
|
|
4680
4682
|
const timer = setTimeout(release, HOLD_CHAIN_MS);
|
|
4681
4683
|
core.on("chainChanged", listener);
|
|
4682
|
-
holds.set(core, release);
|
|
4684
|
+
holds.set(core.session.topic, release);
|
|
4683
4685
|
}
|
|
4684
4686
|
function withWalletConnectSwitch(provider) {
|
|
4685
4687
|
if (!walletConnectCore(provider)) return provider;
|
package/dist/index.js
CHANGED
|
@@ -4572,7 +4572,7 @@ function makeSponsoredDepositCallback(deps) {
|
|
|
4572
4572
|
var WALLET_SWITCH_TIMEOUT_MS = 12e4;
|
|
4573
4573
|
var HOLD_CHAIN_MS = 15e3;
|
|
4574
4574
|
var MAX_RESENDS = 2;
|
|
4575
|
-
var holds = /* @__PURE__ */ new
|
|
4575
|
+
var holds = /* @__PURE__ */ new Map();
|
|
4576
4576
|
function parseChainId(raw) {
|
|
4577
4577
|
if (typeof raw === "number") return raw;
|
|
4578
4578
|
if (typeof raw !== "string") return void 0;
|
|
@@ -4593,7 +4593,7 @@ function walletConnectCore(provider) {
|
|
|
4593
4593
|
async function switchWalletConnectChain(provider, chainId, timeoutMs = WALLET_SWITCH_TIMEOUT_MS) {
|
|
4594
4594
|
const core = walletConnectCore(provider);
|
|
4595
4595
|
if (!core) return false;
|
|
4596
|
-
holds.get(core)?.();
|
|
4596
|
+
holds.get(core.session.topic)?.();
|
|
4597
4597
|
await requestSwitch(core, provider, chainId, timeoutMs);
|
|
4598
4598
|
holdChain(core, provider, chainId);
|
|
4599
4599
|
return true;
|
|
@@ -4655,11 +4655,13 @@ function holdChain(core, provider, chainId) {
|
|
|
4655
4655
|
const release = () => {
|
|
4656
4656
|
clearTimeout(timer);
|
|
4657
4657
|
core.removeListener?.("chainChanged", listener);
|
|
4658
|
-
if (holds.get(core) === release)
|
|
4658
|
+
if (holds.get(core.session.topic) === release) {
|
|
4659
|
+
holds.delete(core.session.topic);
|
|
4660
|
+
}
|
|
4659
4661
|
};
|
|
4660
4662
|
const timer = setTimeout(release, HOLD_CHAIN_MS);
|
|
4661
4663
|
core.on("chainChanged", listener);
|
|
4662
|
-
holds.set(core, release);
|
|
4664
|
+
holds.set(core.session.topic, release);
|
|
4663
4665
|
}
|
|
4664
4666
|
function withWalletConnectSwitch(provider) {
|
|
4665
4667
|
if (!walletConnectCore(provider)) return provider;
|