@1llet.xyz/erc4337-gasless-sdk 0.4.47 → 0.4.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -7
- package/dist/index.d.mts +2 -6
- package/dist/index.d.ts +2 -6
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -3
package/dist/index.mjs
CHANGED
|
@@ -668,13 +668,9 @@ var AccountAbstraction = class {
|
|
|
668
668
|
this.tokenService = new TokenService(chainConfig, this.publicClient);
|
|
669
669
|
this.userOpBuilder = new UserOpBuilder(chainConfig, this.bundlerClient, this.publicClient);
|
|
670
670
|
}
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
*/
|
|
675
|
-
async connect(privateKey) {
|
|
676
|
-
if (privateKey) {
|
|
677
|
-
const account = privateKeyToAccount(privateKey);
|
|
671
|
+
async connect(signer) {
|
|
672
|
+
if (typeof signer === "string") {
|
|
673
|
+
const account = privateKeyToAccount(signer);
|
|
678
674
|
this.owner = account.address;
|
|
679
675
|
const rpcUrl = this.chainConfig.rpcUrl || this.chainConfig.chain.rpcUrls.default.http[0];
|
|
680
676
|
this.walletClient = createWalletClient({
|
|
@@ -682,6 +678,10 @@ var AccountAbstraction = class {
|
|
|
682
678
|
chain: this.chainConfig.chain,
|
|
683
679
|
transport: http(rpcUrl)
|
|
684
680
|
});
|
|
681
|
+
} else if (signer && typeof signer === "object") {
|
|
682
|
+
this.walletClient = signer;
|
|
683
|
+
if (!this.walletClient.account) throw new Error("WalletClient must have an account");
|
|
684
|
+
this.owner = this.walletClient.account.address;
|
|
685
685
|
} else {
|
|
686
686
|
if (typeof window === "undefined" || !window.ethereum) {
|
|
687
687
|
throw new Error("MetaMask is not installed and no private key provided");
|