@alchemy/aa-core
Version:
viem based SDK that enables interactions with ERC-4337 Smart Accounts. ABIs are based off the definitions generated in @account-abstraction/contracts
53 lines • 1.7 kB
JavaScript
import {} from "viem";
import { mnemonicToAccount, privateKeyToAccount } from "viem/accounts";
export class LocalAccountSigner {
constructor(inner) {
Object.defineProperty(this, "inner", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "signerType", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "signMessage", {
enumerable: true,
configurable: true,
writable: true,
value: (message) => {
return this.inner.signMessage({ message });
}
});
Object.defineProperty(this, "signTypedData", {
enumerable: true,
configurable: true,
writable: true,
value: async (params) => {
return this.inner.signTypedData(params);
}
});
Object.defineProperty(this, "getAddress", {
enumerable: true,
configurable: true,
writable: true,
value: async () => {
return this.inner.address;
}
});
this.inner = inner;
this.signerType = inner.type;
}
static mnemonicToAccountSigner(key, opts) {
const signer = mnemonicToAccount(key, opts);
return new LocalAccountSigner(signer);
}
static privateKeyToAccountSigner(key) {
const signer = privateKeyToAccount(key);
return new LocalAccountSigner(signer);
}
}
//# sourceMappingURL=local-account.js.map