-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Light account factory v2.0.0 setup * 1.1.0 support * Implemented light client signMessage * Light account v1.1.0 support * Preffify light account * Cleanup * Cleanup tests * Fix typo & call data encoding * Remove any mention of the v2.0.0 light account * Add changeset * Fix changeset typo
- Loading branch information
Showing
9 changed files
with
555 additions
and
4 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": minor | ||
--- | ||
|
||
Added Alchemy's LightAccount support v1.1.0 |
5 changes: 5 additions & 0 deletions
5
packages/permissionless-test/mock-aa-infra/alto/src/constants.ts
Large diffs are not rendered by default.
Oops, something went wrong.
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
37 changes: 37 additions & 0 deletions
37
packages/permissionless/accounts/light/privateKeyToLightSmartAccount.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,37 @@ | ||
import { type Chain, type Client, type Hex, type Transport } from "viem" | ||
import { privateKeyToAccount } from "viem/accounts" | ||
import type { ENTRYPOINT_ADDRESS_V06_TYPE, Prettify } from "../../types" | ||
import { | ||
type LightSmartAccount, | ||
type SignerToLightSmartAccountParameters, | ||
signerToLightSmartAccount | ||
} from "./signerToLightSmartAccount" | ||
|
||
export type PrivateKeyToLightSmartAccountParameters< | ||
entryPoint extends ENTRYPOINT_ADDRESS_V06_TYPE | ||
> = Prettify< | ||
{ | ||
privateKey: Hex | ||
} & Omit<SignerToLightSmartAccountParameters<entryPoint>, "signer"> | ||
> | ||
|
||
/** | ||
* @description Creates an Simple Account from a private key. | ||
* | ||
* @returns A Private Key Simple Account. | ||
*/ | ||
export async function privateKeyToLightSmartAccount< | ||
entryPoint extends ENTRYPOINT_ADDRESS_V06_TYPE, | ||
TTransport extends Transport = Transport, | ||
TChain extends Chain | undefined = Chain | undefined | ||
>( | ||
client: Client<TTransport, TChain, undefined>, | ||
{ privateKey, ...rest }: PrivateKeyToLightSmartAccountParameters<entryPoint> | ||
): Promise<LightSmartAccount<entryPoint, TTransport, TChain>> { | ||
const privateKeyAccount = privateKeyToAccount(privateKey) | ||
|
||
return signerToLightSmartAccount(client, { | ||
signer: privateKeyAccount, | ||
...rest | ||
}) | ||
} |
Oops, something went wrong.