Skip to content

Commit

Permalink
Inject providers individually
Browse files Browse the repository at this point in the history
  • Loading branch information
victorkirov committed Feb 13, 2024
1 parent d13cbb5 commit ed0ce9a
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/inpage/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,28 @@ try {
if (document.currentScript?.dataset.isPriority) {
Object.defineProperties(window, {
StacksProvider: { get: () => StacksMethodsProvider, set: () => {} },
BitcoinProvider: { get: () => SatsMethodsProvider, set: () => {} },
});
} else {
window.StacksProvider = StacksMethodsProvider as StacksProvider;
}
} catch (e) {
console.log(
'Failed setting Xverse Stacks default provider. Another wallet may have already set it in an immutable way.',
);
console.error(e);
}

try {
if (document.currentScript?.dataset.isPriority) {
Object.defineProperties(window, {
BitcoinProvider: { get: () => SatsMethodsProvider, set: () => {} },
});
} else {
window.BitcoinProvider = SatsMethodsProvider;
}
} catch (e) {
console.log(
'Failed setting Xverse default providers. Another wallet may have already set them in an immutable way.',
'Failed setting Xverse Bitcoin default provider. Another wallet may have already set it in an immutable way.',
);
console.error(e);
}

0 comments on commit ed0ce9a

Please sign in to comment.