Skip to content

Commit

Permalink
US-2105 Will now allow the user to pass resolvers to the WalletConnec…
Browse files Browse the repository at this point in the history
…tAdapter.ts.
  • Loading branch information
Freshenext committed Jan 19, 2024
1 parent fada470 commit e679572
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/walletAdapters/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rsksmart/rif-wallet-adapters",
"version": "1.0.3",
"version": "1.1.0",
"description": "Wallet Adapters for everyday use",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
18 changes: 11 additions & 7 deletions packages/walletAdapters/src/WalletConnectAdapter.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import { Signer } from '@ethersproject/abstract-signer'
import { RIFWallet } from '@rsksmart/rif-wallet-core'
import { PersonalSignResolver, SendTransactionResolver, SignTypedDataResolver } from './resolvers'
import { RPCAdapter } from './RPCAdapter'
import { IResolver, RPCAdapter } from './RPCAdapter'

export class WalletConnectAdapter extends RPCAdapter {
constructor(signer: Signer) {
super([
new SendTransactionResolver(signer),
new PersonalSignResolver(signer),
new SignTypedDataResolver(signer as unknown as RIFWallet),
])
constructor(signer: Signer, resolvers: IResolver[] = []) {
let resolversToUse = resolvers
if (resolvers.length === 0) {
resolversToUse = [
new SendTransactionResolver(signer),
new PersonalSignResolver(signer),
new SignTypedDataResolver(signer as RIFWallet),
]
}
super(resolversToUse)
}
}

0 comments on commit e679572

Please sign in to comment.