generated from rsksmart/rif-web-sdk-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
US-2105 Will now allow the user to pass resolvers to the WalletConnec…
…tAdapter.ts.
- Loading branch information
1 parent
fada470
commit e679572
Showing
2 changed files
with
12 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |