aa-schnorr-multisig-sdk
Version:
Account Abstraction Schnorr Multi-Signatures SDK
70 lines (69 loc) • 4.3 kB
TypeScript
import type { Provider } from "@ethersproject/providers";
import type { providers, Signer } from "ethers";
export declare const PROXY_FACTORY_ADDRESS = "0x4e59b44847b379578588920ca78fbf26c0b4956c";
export declare const ENTRY_POINT_ALCHEMY_ADDRESS = "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789";
/**
* Calculates offchain MultiSigSmartAccount address with create2.
* @param factoryAddress MultiSigSmartAccountFactory address
* @param accountImplementationAddress MultiSigSmartAccount implementation address
* @param combinedAddresses combined schnorr signers' public addresses used as contract owners
* @param salt salt text: string or number
* @returns predicted MultiSigSmartAccount address
*/
export declare function predictAccountAddrOffchain(factoryAddress: string, accountImplementationAddress: string, combinedAddresses: string[], salt: string): string;
/**
* Calculates offchain MultiSigSmartAccount address with create2
* @param salt salt text: string or number
* @param entryPointAddress Account Abstraction's Entry Point address (default: Alchemy Entry Point)
* @returns predicted MultiSigSmartAccount Factory address
*/
export declare function predictFactoryAddrOffchain(salt: string, entryPointAddress?: string): string;
/**
* Calculates offchain MultiSigSmartAccount implementation address with create2
* @param factoryAddress MultiSigSmartAccount Factory address.
* If not known, can be predicted with given `factorySalt` and `entryPointAddress` params
* @param factorySalt salt text: string or number - the same used for Factory deployment
* @param entryPointAddress Account Abstraction's Entry Point address (default: Alchemy Entry Point)
* @returns
*/
export declare function predictAccountImplementationAddrOffchain(factorySalt: string, factoryAddress?: string, entryPointAddress?: string): string;
/**
* Calculates MultiSigSmartAccount address with create2 and onchain data.
* @param factoryAddress MultiSigSmartAccountFactory address
* @param combinedAddresses combined schnorr signers' public addresses used as contract owners
* @param salt salt text: string or number
* @param ethersSignerOrProvider Signer or Provider type to call the Factory contract
* @returns predicted MultiSigSmartAccount address
*/
export declare function predictAccountAddrOnchain(factoryAddress: string, combinedAddresses: string[], salt: string, ethersSignerOrProvider: Signer | Provider): Promise<`0x${string}`>;
/**
* Determines if a given contract is deployed at the given address.
* @param address contract address
* @param provider provider to call contract
* @returns true if contract deployed or false otherwise
*/
export declare function isDeployed(address: string, provider: Provider): Promise<boolean>;
/**
* Helper for getting account implementation address from Account Factory
* @param factoryAddress deployed MultiSigSmartAccountFactory address
* @param ethersSignerOrProvider signer or provider to call contract
* @returns account implementation address
*/
export declare function getAccountImplementationAddress(factoryAddress: string, ethersSignerOrProvider: Signer | Provider): Promise<string>;
/**
* Checks if salt is Hex and if not - converts from string or number to hashed string with keccak256.
* @param salt salt text: string or number
* @returns hashed salt
*/
export declare const saltToHex: (salt: string) => string;
/**
* Creates MultiSigSmartAccount with create2 and onchain data.
* @param combinedAddresses combined schnorr signers' public addresses used as contract owners
* @param ethersSignerOrProvider Signer or Provider type to call the Factory contract
* @param salt optional salt text (string or number)
* @param factoryAddress optional MultiSigSmartAccountFactory address - if not given, the deployed factory address will be taken
* @param chainId optional chainId number needed to get deployed factory address only if factoryAddress not given
* @returns predicted MultiSigSmartAccount address
*/
export declare function createSmartAccount(combinedAddresses: string[], ethersSignerOrProvider: Signer | Provider, salt?: string, factoryAddress?: string, chainId?: number): Promise<`0x${string}`>;
export declare function getEvent(tx: providers.TransactionResponse, contract: any, eventName: string): Promise<any>;