From dcbaba0fdfa9e0735cb67991822eefb24eef80f0 Mon Sep 17 00:00:00 2001 From: OGPoyraz Date: Mon, 14 Aug 2023 14:48:51 +0200 Subject: [PATCH] Add options bag to `addTransaction` public API method (#1576) --- .../src/TransactionController.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/transaction-controller/src/TransactionController.ts b/packages/transaction-controller/src/TransactionController.ts index b6deb4d17d..99d59f21a5 100644 --- a/packages/transaction-controller/src/TransactionController.ts +++ b/packages/transaction-controller/src/TransactionController.ts @@ -343,14 +343,20 @@ export class TransactionController extends BaseController< * if not provided. If A `:unapproved` hub event will be emitted once added. * * @param transaction - The transaction object to add. - * @param origin - The domain origin to append to the generated TransactionMeta. - * @param deviceConfirmedOn - An enum to indicate what device the transaction was confirmed to append to the generated TransactionMeta. + * @param opts - Additional options to control how the transaction is added. + * @param opts.deviceConfirmedOn - An enum to indicate what device confirmed the transaction. + * @param opts.origin - The origin of the transaction request, such as a dApp hostname. * @returns Object containing a promise resolving to the transaction hash if approved. */ async addTransaction( transaction: Transaction, - origin?: string, - deviceConfirmedOn?: WalletDevice, + { + deviceConfirmedOn, + origin, + }: { + deviceConfirmedOn?: WalletDevice; + origin?: string; + } = {}, ): Promise { const { providerConfig, network } = this.getNetworkState(); const { transactions } = this.state;