From b5f3f30291cf1ba549c2449343774303f030fde6 Mon Sep 17 00:00:00 2001 From: LuizAsFight Date: Mon, 16 Dec 2024 18:11:24 -0300 Subject: [PATCH 1/2] chore: include beforesign workaround --- packages/account/src/account.ts | 4 ++-- packages/account/src/connectors/fuel-connector.ts | 5 +++-- packages/account/src/connectors/types/data-type.ts | 5 +++++ packages/account/src/providers/provider.ts | 4 +++- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/account/src/account.ts b/packages/account/src/account.ts index 60484577999..bfd75ad895f 100644 --- a/packages/account/src/account.ts +++ b/packages/account/src/account.ts @@ -646,11 +646,11 @@ export class Account extends AbstractAccount { */ async sendTransaction( transactionRequestLike: TransactionRequestLike, - { estimateTxDependencies = true }: ProviderSendTxParams = {} + { estimateTxDependencies = true, onBeforeSend }: ProviderSendTxParams = {} ): Promise { if (this._connector) { return this.provider.getTransactionResponse( - await this._connector.sendTransaction(this.address.toString(), transactionRequestLike) + await this._connector.sendTransaction(this.address.toString(), transactionRequestLike, { onBeforeSend }) ); } const transactionRequest = transactionRequestify(transactionRequestLike); diff --git a/packages/account/src/connectors/fuel-connector.ts b/packages/account/src/connectors/fuel-connector.ts index 92d4346e932..d26f4582f56 100644 --- a/packages/account/src/connectors/fuel-connector.ts +++ b/packages/account/src/connectors/fuel-connector.ts @@ -14,6 +14,7 @@ import type { FuelEventArg, Version, SelectNetworkArguments, + SendTransactionParams, } from './types'; interface Connector { @@ -42,7 +43,7 @@ interface Connector { signTransaction(address: string, transaction: TransactionRequestLike): Promise; // #endregion fuel-connector-method-signTransaction // #region fuel-connector-method-sendTransaction - sendTransaction(address: string, transaction: TransactionRequestLike): Promise; + sendTransaction(address: string, transaction: TransactionRequestLike, params?: SendTransactionParams): Promise; // #endregion fuel-connector-method-sendTransaction // #region fuel-connector-method-currentAccount currentAccount(): Promise; @@ -196,7 +197,7 @@ export abstract class FuelConnector extends EventEmitter implements Connector { * * @returns The transaction id */ - async sendTransaction(_address: string, _transaction: TransactionRequestLike): Promise { + async sendTransaction(_address: string, _transaction: TransactionRequestLike, params?: SendTransactionParams): Promise { throw new FuelError(FuelError.CODES.NOT_IMPLEMENTED, 'Method not implemented.'); } diff --git a/packages/account/src/connectors/types/data-type.ts b/packages/account/src/connectors/types/data-type.ts index 04a63ad028d..df69cf07d98 100644 --- a/packages/account/src/connectors/types/data-type.ts +++ b/packages/account/src/connectors/types/data-type.ts @@ -1,5 +1,6 @@ import type { JsonAbi } from '@fuel-ts/abi-coder'; import type { RequireAtLeastOne } from 'type-fest'; +import type { TransactionRequest } from '../../providers'; /** * @name Version @@ -42,3 +43,7 @@ export type SelectNetworkArguments = RequireAtLeastOne TransactionRequest; +} \ No newline at end of file diff --git a/packages/account/src/providers/provider.ts b/packages/account/src/providers/provider.ts index 5f9ffe88f42..37186294aef 100644 --- a/packages/account/src/providers/provider.ts +++ b/packages/account/src/providers/provider.ts @@ -363,7 +363,9 @@ export type ProviderCallParams = UTXOValidationParams & EstimateTransactionParam /** * Provider Send transaction params */ -export type ProviderSendTxParams = EstimateTransactionParams; +export type ProviderSendTxParams = EstimateTransactionParams & { + onBeforeSend?: (txRequest: TransactionRequest) => TransactionRequest; +}; /** * URL - Consensus Params mapping. From 2dbae8e6b07c0a7aa11629780f25762d64ddfce3 Mon Sep 17 00:00:00 2001 From: LuizAsFight Date: Mon, 16 Dec 2024 18:13:48 -0300 Subject: [PATCH 2/2] chore --- .github/workflows/pr-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-release.yaml b/.github/workflows/pr-release.yaml index 6eeca1f3f04..593d7fce145 100644 --- a/.github/workflows/pr-release.yaml +++ b/.github/workflows/pr-release.yaml @@ -8,7 +8,7 @@ jobs: name: "Release PR to npm" runs-on: ubuntu-latest # comment out if:false to enable release PR to npm - if: false + # if: false permissions: write-all steps: - name: Checkout