-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #108 from pimlicolabs/feat/wagmi-simple-account
Add all account connectors in wagmi & export account types in permissionless
- Loading branch information
Showing
22 changed files
with
546 additions
and
222 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"permissionless": patch | ||
--- | ||
|
||
Added account parameters types |
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,5 @@ | ||
--- | ||
"@permissionless/wagmi": patch | ||
--- | ||
|
||
Added account-specific connectors |
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
73 changes: 0 additions & 73 deletions
73
packages/permissionless/accounts/privateKeyToSafeSmartAccount.ts
This file was deleted.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
packages/permissionless/accounts/safe/privateKeyToSafeSmartAccount.ts
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,34 @@ | ||
import { type Chain, type Client, type Hex, type Transport } from "viem" | ||
import { privateKeyToAccount } from "viem/accounts" | ||
import type { Prettify } from "../../types" | ||
import { | ||
type SafeSmartAccount, | ||
type SignerToSafeSmartAccountParameters, | ||
signerToSafeSmartAccount | ||
} from "./signerToSafeSmartAccount" | ||
|
||
export type PrivateKeyToSafeSmartAccountParameters = Prettify< | ||
{ | ||
privateKey: Hex | ||
} & Omit<SignerToSafeSmartAccountParameters, "signer"> | ||
> | ||
|
||
/** | ||
* @description Creates an Simple Account from a private key. | ||
* | ||
* @returns A Private Key Simple Account. | ||
*/ | ||
export async function privateKeyToSafeSmartAccount< | ||
TTransport extends Transport = Transport, | ||
TChain extends Chain | undefined = Chain | undefined | ||
>( | ||
client: Client<TTransport, TChain, undefined>, | ||
{ privateKey, ...rest }: PrivateKeyToSafeSmartAccountParameters | ||
): Promise<SafeSmartAccount<TTransport, TChain>> { | ||
const privateKeyAccount = privateKeyToAccount(privateKey) | ||
|
||
return signerToSafeSmartAccount(client, { | ||
signer: privateKeyAccount, | ||
...rest | ||
}) | ||
} |
Oops, something went wrong.