Skip to content

Commit

Permalink
add network to polka api
Browse files Browse the repository at this point in the history
  • Loading branch information
NorbertBodziony committed Aug 10, 2023
1 parent 678dc56 commit 91f39a0
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions sdk/packages/selector-polkadot/src/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,27 +308,35 @@ export class NightlyConnectAdapter implements Injected {
}

connectToStandardWallet = async (walletName: string, onSuccess: () => void) => {
console.log('connect to standard ')
if (this._modal) {
this._modal.setStandardWalletConnectProgress(true)
}
console.log({ walletName })
const adapter = this.walletsList.find((w) => w.name === walletName)?.injectedWallet
if (typeof adapter === 'undefined') {
if (this._modal) {
this._modal.setStandardWalletConnectProgress(false)
}
throw new Error('Wallet not found')
}
console.log({ adapter })

try {
const inject = await adapter!.enable!('Nightly Connect') // TODO should we also use connect?
console.log({ inject })

persistRecentStandardWalletForNetwork(walletName, this.network)
persistStandardConnectForNetwork(this.network)
this._innerStandardAdapter = inject
this._innerStandardAdapter = {
...inject,
signer: {
...inject.signer,
signPayload: inject.signer.signPayload
? // @ts-expect-error We want to also pass network to signPayload
(payload) => inject.signer.signPayload!(payload, this.network)
: undefined,
signRaw: inject.signer.signRaw
? // @ts-expect-error We want to also pass network to signPayload
(payload) => inject.signer.signRaw!(payload, this.network)
: undefined
}
}
this._connected = true
this._connecting = false
this._modal?.closeModal()
Expand Down

0 comments on commit 91f39a0

Please sign in to comment.