-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c8c78b2
commit ee21abb
Showing
21 changed files
with
1,012 additions
and
61 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
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
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
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export * from './interfaces'; | ||
export * from './providers'; | ||
export * from './wallet.service'; |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export interface Wallet { | ||
address: string; | ||
providerType: string; | ||
} | ||
|
||
export interface WalletOptions { | ||
provider?: string; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { NetworkNames, prepareNetworkName } from '../../network'; | ||
import { prepareAddress, UniqueSubject } from '../../common'; | ||
import { MessagePayload, WalletProvider } from './interfaces'; | ||
import { Hash, Hex, TransactionRequest } from 'viem'; | ||
|
||
export abstract class DynamicWalletProvider implements WalletProvider { | ||
readonly address$ = new UniqueSubject<string>(); | ||
readonly networkName$ = new UniqueSubject<NetworkNames>(); | ||
|
||
protected constructor(readonly type: string) { | ||
// | ||
} | ||
|
||
get address(): string { | ||
return this.address$.value; | ||
} | ||
|
||
get networkName(): NetworkNames { | ||
return this.networkName$.value; | ||
} | ||
|
||
abstract signMessage(message: any, validatorAddress?: string): Promise<string>; | ||
|
||
abstract signUserOp(message: Hex): Promise<string>; | ||
|
||
abstract signTypedData(msg: MessagePayload): Promise<string> | ||
|
||
protected setAddress(address: string): void { | ||
this.address$.next(prepareAddress(address)); | ||
} | ||
|
||
protected setNetworkName(networkNameOrChainId: string | number): void { | ||
this.networkName$.next(prepareNetworkName(networkNameOrChainId)); | ||
} | ||
|
||
abstract eth_requestAccounts(address?: string): Promise<string[]>; | ||
|
||
abstract eth_accounts(address?: string): Promise<string[]>; | ||
|
||
abstract eth_sendTransaction(transaction: TransactionRequest): Promise<Hash>; | ||
|
||
abstract eth_signTransaction(transaction: TransactionRequest): Promise<string>; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export * from './dynamic.wallet-provider'; | ||
export * from './interfaces'; | ||
export * from './key.wallet-provider'; | ||
export * from './meta-mask.wallet-provider'; | ||
export * from './utils'; | ||
export * from './wallet-connect.wallet-provider'; | ||
export * from './wallet-connect-2.wallet-provider'; | ||
export * from './web3.wallet-provider'; | ||
export * from './web3eip1193.wallet-provider'; |
Oops, something went wrong.