diff --git a/packages/ethereum-storage/src/ethereum-tx-submitter.ts b/packages/ethereum-storage/src/ethereum-tx-submitter.ts index 3fdacbc70..e87d4d712 100644 --- a/packages/ethereum-storage/src/ethereum-tx-submitter.ts +++ b/packages/ethereum-storage/src/ethereum-tx-submitter.ts @@ -75,7 +75,12 @@ export class EthereumTransactionSubmitter implements StorageTypes.ITransactionSu this.enableEip1559 = await isEip1559Supported(this.provider, this.logger); } - /** Submits an IPFS hash, with fees according to `ipfsSize` */ + /** Returns whether EIP-1559 is supported by the underlying provider. */ + supportsEip1559() { + return this.enableEip1559; + } + + /** Submits an IPFS hash, with fees according to `ipfsSize` */ async submit(ipfsHash: string, ipfsSize: number): Promise { const preparedTransaction = await this.prepareSubmit(ipfsHash, ipfsSize); return await this.hashSubmitter.signer.sendTransaction(preparedTransaction); diff --git a/packages/ethereum-storage/test/ethereum-tx-submitter.test.ts b/packages/ethereum-storage/test/ethereum-tx-submitter.test.ts index b7ebcdcad..7409fb7ba 100644 --- a/packages/ethereum-storage/test/ethereum-tx-submitter.test.ts +++ b/packages/ethereum-storage/test/ethereum-tx-submitter.test.ts @@ -13,6 +13,10 @@ describe(EthereumTransactionSubmitter, () => { await txSubmitter.initialize(); }); + it('can retrieve whether the provider supports eip-1559', () => { + expect(txSubmitter.supportsEip1559()).toBe(true); + }); + it('can prepareSubmit', async () => { expect(await txSubmitter.prepareSubmit('hash', 1)).toMatchObject({ to: '0xf25186b5081ff5ce73482ad761db0eb0d25abfbf', @@ -20,10 +24,12 @@ describe(EthereumTransactionSubmitter, () => { value: BigNumber.from(0), }); }); + it('can submit', async () => { const tx = await txSubmitter.submit('hash', 1); expect(tx.hash).toMatch(/^0x.+/); }); + it('can debug transactions', async () => { const debugMock = jest.fn(); const logger = {