-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
53 changed files
with
6,575 additions
and
2 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,105 @@ | ||
/** | ||
* The exeuctor abi, used to execute transactions on the Biconomy Modular Smart Account | ||
*/ | ||
export const BiconomyExecuteAbi = [ | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: "address", | ||
name: "dest", | ||
type: "address" | ||
}, | ||
{ | ||
internalType: "uint256", | ||
name: "value", | ||
type: "uint256" | ||
}, | ||
{ | ||
internalType: "bytes", | ||
name: "func", | ||
type: "bytes" | ||
} | ||
], | ||
name: "execute_ncC", | ||
outputs: [], | ||
stateMutability: "nonpayable", | ||
type: "function" | ||
}, | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: "address[]", | ||
name: "dest", | ||
type: "address[]" | ||
}, | ||
{ | ||
internalType: "uint256[]", | ||
name: "value", | ||
type: "uint256[]" | ||
}, | ||
{ | ||
internalType: "bytes[]", | ||
name: "func", | ||
type: "bytes[]" | ||
} | ||
], | ||
name: "executeBatch_y6U", | ||
outputs: [], | ||
stateMutability: "nonpayable", | ||
type: "function" | ||
} | ||
] as const | ||
|
||
/** | ||
* The init abi, used to initialise Biconomy Modular Smart Account / setup default ECDSA module | ||
*/ | ||
export const BiconomyInitAbi = [ | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: "address", | ||
name: "handler", | ||
type: "address" | ||
}, | ||
{ | ||
internalType: "address", | ||
name: "moduleSetupContract", | ||
type: "address" | ||
}, | ||
{ | ||
internalType: "bytes", | ||
name: "moduleSetupData", | ||
type: "bytes" | ||
} | ||
], | ||
name: "init", | ||
outputs: [ | ||
{ | ||
internalType: "address", | ||
name: "", | ||
type: "address" | ||
} | ||
], | ||
stateMutability: "nonpayable", | ||
type: "function" | ||
}, | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: "address", | ||
name: "eoaOwner", | ||
type: "address" | ||
} | ||
], | ||
name: "initForSmartAccount", | ||
outputs: [ | ||
{ | ||
internalType: "address", | ||
name: "", | ||
type: "address" | ||
} | ||
], | ||
stateMutability: "nonpayable", | ||
type: "function" | ||
} | ||
] |
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,44 @@ | ||
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 BiconomySmartAccount, | ||
type SignerToBiconomySmartAccountParameters, | ||
signerToBiconomySmartAccount | ||
} from "./signerToBiconomySmartAccount" | ||
|
||
export type PrivateKeyToBiconomySmartAccountParameters< | ||
entryPoint extends ENTRYPOINT_ADDRESS_V06_TYPE | ||
> = Prettify< | ||
{ | ||
privateKey: Hex | ||
} & Omit<SignerToBiconomySmartAccountParameters<entryPoint>, "signer"> | ||
> | ||
|
||
/** | ||
* @description Creates a Biconomy Smart Account from a private key. | ||
* | ||
* @returns A Private Key Biconomy Smart Account using ECDSA as default validation module. | ||
*/ | ||
export async function privateKeyToBiconomySmartAccount< | ||
entryPoint extends ENTRYPOINT_ADDRESS_V06_TYPE, | ||
TTransport extends Transport = Transport, | ||
TChain extends Chain | undefined = Chain | undefined | ||
>( | ||
client: Client<TTransport, TChain, undefined>, | ||
{ | ||
privateKey, | ||
...rest | ||
}: PrivateKeyToBiconomySmartAccountParameters<entryPoint> | ||
): Promise<BiconomySmartAccount<entryPoint, TTransport, TChain>> { | ||
const privateKeyAccount = privateKeyToAccount(privateKey) | ||
return signerToBiconomySmartAccount< | ||
entryPoint, | ||
TTransport, | ||
TChain, | ||
"privateKey" | ||
>(client, { | ||
signer: privateKeyAccount, | ||
...rest | ||
}) | ||
} |
Oops, something went wrong.