Skip to content

Commit

Permalink
chore: refactored interface
Browse files Browse the repository at this point in the history
  • Loading branch information
petertonysmith94 committed Jan 10, 2025
1 parent 4f312e4 commit 5d67f18
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
5 changes: 4 additions & 1 deletion packages/account/src/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { BytesLike } from '@fuel-ts/utils';
import { arrayify, hexlify, isDefined } from '@fuel-ts/utils';
import { clone } from 'ramda';

import type { AccountSendTxParams, FuelConnector } from './connectors';
import type { FuelConnector, FuelConnectorSendTxParams } from './connectors';
import type {
TransactionRequest,
CoinQuantityLike,
Expand All @@ -30,6 +30,7 @@ import type {
Coin,
TransactionCostParams,
TransactionResponse,
ProviderSendTxParams,
} from './providers';
import {
withdrawScript,
Expand Down Expand Up @@ -65,6 +66,8 @@ export type ContractTransferParams = {
assetId: BytesLike;
};

export type AccountSendTxParams = ProviderSendTxParams & FuelConnectorSendTxParams;

export type EstimatedTxParams = Pick<
TransactionCost,
'estimatedPredicates' | 'addedSignatures' | 'requiredQuantities' | 'updateMaxFee' | 'gasPrice'
Expand Down
6 changes: 3 additions & 3 deletions packages/account/src/connectors/fuel-connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type {
FuelEventArg,
Version,
SelectNetworkArguments,
AccountSendTxParams,
FuelConnectorSendTxParams,
} from './types';

interface Connector {
Expand Down Expand Up @@ -46,7 +46,7 @@ interface Connector {
sendTransaction(
address: string,
transaction: TransactionRequestLike,
params?: AccountSendTxParams
params?: FuelConnectorSendTxParams
): Promise<string>;
// #endregion fuel-connector-method-sendTransaction
// #region fuel-connector-method-currentAccount
Expand Down Expand Up @@ -204,7 +204,7 @@ export abstract class FuelConnector extends EventEmitter implements Connector {
async sendTransaction(
_address: string,
_transaction: TransactionRequestLike,
_params?: AccountSendTxParams
_params?: FuelConnectorSendTxParams
): Promise<string> {
throw new FuelError(FuelError.CODES.NOT_IMPLEMENTED, 'Method not implemented.');
}
Expand Down
6 changes: 3 additions & 3 deletions packages/account/src/connectors/types/data-type.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { JsonAbi } from '@fuel-ts/abi-coder';
import type { RequireAtLeastOne } from 'type-fest';

import type { ProviderSendTxParams, TransactionRequest } from '../../providers';
import type { TransactionRequest } from '../../providers';

/**
* @name Version
Expand Down Expand Up @@ -46,9 +46,9 @@ export type SelectNetworkArguments = RequireAtLeastOne<Network, 'chainId' | 'url
export type FuelABI = JsonAbi;

/**
* Additional params for the sendTransaction method (for connectors).
* Params for the sendTransaction method (for connectors).
*/
export type AccountSendTxParams = ProviderSendTxParams & {
export type FuelConnectorSendTxParams = {
skipCustomFee?: boolean;
onBeforeSend?: (txRequest: TransactionRequest) => Promise<TransactionRequest>;
};

0 comments on commit 5d67f18

Please sign in to comment.