Skip to content

Commit

Permalink
We shall multisig !!! (#20)
Browse files Browse the repository at this point in the history
* added support for custom walletclient

* removed extra logs and variables
  • Loading branch information
pranav-singhal authored Jan 4, 2024
1 parent f9f0429 commit 5bd0431
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/client/src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Chain, Hash } from 'viem';
import { Chain, Hash, WalletClient } from 'viem';

export type IToken = {
name: string;
Expand Down Expand Up @@ -45,6 +45,7 @@ export type ViemClientConfig = {
privateKey?: `0x${string}`;
mnemonic?: string;
chainId?: NetworkEnum;
walletClient?: WalletClient;
};

type Currency = {
Expand Down
11 changes: 11 additions & 0 deletions packages/client/src/viem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,17 @@ export class ViemClient {
return true;
}

/*
* If consumer passes a walletClient, we use that directly.
* This enabled the compatibility of the sdk with multisig wallets like safe
*/
if (config?.walletClient) {
console.log('SDK: viem client - wallet client object found', config?.walletClient);
this.client = config.walletClient;
console.log('SDK: viem client - initalised successfully with custom wallet client!');
return true;
}

// @ts-ignore
let browserProvider = globalThis?.ethereum || window?.ethereum;
if (browserProvider) {
Expand Down

0 comments on commit 5bd0431

Please sign in to comment.