import { TransactionRequest, ethers } from "ethers"; import { EvmProjectSigner } from "./signerPlugin"; import { Evm } from "../evm"; import { EvmKeyManagement } from "../types"; /** * Evm signer plugin for using Rippin's unsecure devnet keys. This should only * be used for development purposes and never in production. */ export class RippinPlaintextPlugin implements EvmProjectSigner { type = EvmKeyManagement.EXTERNAL; private _evm: Evm; projectId: string; /** @internal */ init = (evm: Evm) => { this._evm = evm; this.projectId = evm._rippin.projectId; evm.signTransaction = this.signTransaction; evm.keyManagementType = this.type; }; signTransaction = async (txRequest: TransactionRequest) => { const privateKey = await this._evm.getPrivateKey(); const wallet = new ethers.Wallet(privateKey); return wallet.signTransaction(txRequest); }; }