Skip to content

Commit

Permalink
fix: use correct window path to access Coin98 APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
iamcrazycoder committed Oct 10, 2023
1 parent 6410c87 commit 0cffdfd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions packages/sdk/src/browser-wallets/coin98/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ export async function getAddresses(network: Network) {
}

let targetNetwork: UnisatNetwork = "livenet"
const connectedNetwork = await window.coin98.getNetwork()
const connectedNetwork = await window.coin98.bitcoin.getNetwork()

if (network === "testnet") {
targetNetwork = network
}

if (connectedNetwork !== targetNetwork) {
await window.coin98.switchNetwork(targetNetwork)
await window.coin98.bitcoin.switchNetwork(targetNetwork)
}

const accounts = await window.coin98.requestAccounts()
const publicKey = await window.coin98.getPublicKey()
const accounts = await window.coin98.bitcoin.requestAccounts()
const publicKey = await window.coin98.bitcoin.getPublicKey()

if (!accounts[0]) {
return []
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk/src/browser-wallets/coin98/signatures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export async function signPsbt(
}

const psbtHex = psbt.toHex()
const signedPsbtHex = await window.coin98.signPsbt(psbtHex, { autoFinalized: finalize })
const signedPsbtHex = await window.coin98.bitcoin.signPsbt(psbtHex, { autoFinalized: finalize })
if (!signedPsbtHex) {
throw new Error("Failed to sign psbt hex using Coin98")
}
Expand All @@ -35,7 +35,7 @@ export async function signMessage(message: string) {
throw new Error("Coin98 not installed.")
}

const signature = await window.coin98.signMessage(message)
const signature = await window.coin98.bitcoin.signMessage(message)

if (!signature) {
throw new Error("Failed to sign message using Coin98")
Expand Down

0 comments on commit 0cffdfd

Please sign in to comment.