-
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.
🚧 Base smart wallet supporting privy
- Loading branch information
1 parent
32d9e9d
commit 891d2e4
Showing
14 changed files
with
360 additions
and
212 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
39 changes: 39 additions & 0 deletions
39
packages/wallet/app/context/wallet/smartWallet/FrakFallbackSmartWallet.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,39 @@ | ||
import { baseFrakWallet } from "@/context/wallet/smartWallet/baseFrakWallet"; | ||
import type { SmartAccountV06 } from "@/context/wallet/smartWallet/utils"; | ||
import { KernelWallet } from "@frak-labs/app-essentials"; | ||
import type { Address, Chain, Client, Hex, Transport } from "viem"; | ||
|
||
export type FrakFallbackWalelt = SmartAccountV06; | ||
|
||
/** | ||
* Build a kernel smart account from a private key, that use the ECDSA signer behind the scene | ||
* @param client | ||
* @param authenticatorId | ||
* @param signatureProvider | ||
*/ | ||
export async function frakFallbackWalletSmartAccount< | ||
TTransport extends Transport, | ||
TChain extends Chain, | ||
>( | ||
client: Client<TTransport, TChain>, | ||
{ | ||
ecdsaAddress, | ||
signatureProvider, | ||
preDeterminedAccountAddress, | ||
}: { | ||
ecdsaAddress: Address; | ||
signatureProvider: (args: { hash: Hex }) => Promise<Hex>; | ||
preDeterminedAccountAddress?: Address; | ||
} | ||
): Promise<FrakFallbackWalelt> { | ||
return baseFrakWallet(client, { | ||
getSignature: signatureProvider, | ||
getStubSignature: () => | ||
"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c", | ||
generateInitCode: () => | ||
KernelWallet.getFallbackWalletInitCode({ | ||
ecdsaAddress, | ||
}), | ||
preDeterminedAccountAddress, | ||
}); | ||
} |
Oops, something went wrong.