diff --git a/src/wallet.ts b/src/wallet.ts index 8cda833..f3a3337 100644 --- a/src/wallet.ts +++ b/src/wallet.ts @@ -32,7 +32,6 @@ import { import { getChangePubkeyLegacyMessage, getChangePubkeyMessage, MAX_TIMESTAMP, isNFT } from './utils'; import { Transaction, submitSignedTransaction } from './operations'; import { AbstractWallet } from './abstract-wallet'; - export { Transaction, RootstockOperation, submitSignedTransaction, submitSignedTransactionsBatch } from './operations'; export class Wallet extends AbstractWallet { @@ -66,6 +65,16 @@ export class Wallet extends AbstractWallet { throw new Error('If you passed signer, you must also pass ethSignerType.'); } + // Validate that ethWallet is valid Ethereum signer + if (!(ethWallet instanceof ethers.Signer)) { + throw new Error('Invalid Ethereum signer'); + } + + // validate that provider is valid rollup provider + if (!(provider instanceof SyncProvider)) { + throw new Error('Invalid rif-rollup provider'); + } + const ethMessageSigner = new EthMessageSigner(ethWallet, ethSignerType); const wallet = new Wallet( ethWallet,