Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ethereum-storage): add getter for eip-1559 support #1466

Merged
merged 3 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/ethereum-storage/src/ethereum-tx-submitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<ContractTransaction> {
const preparedTransaction = await this.prepareSubmit(ipfsHash, ipfsSize);
return await this.hashSubmitter.signer.sendTransaction(preparedTransaction);
Expand Down
6 changes: 6 additions & 0 deletions packages/ethereum-storage/test/ethereum-tx-submitter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,23 @@ 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',
data: /^0x.+/,
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 = {
Expand Down