From 7e1bfb1d99c401d8985a46a1eed0b3c184b8ab04 Mon Sep 17 00:00:00 2001 From: rileystephens28 Date: Mon, 17 Jun 2024 13:56:52 -0500 Subject: [PATCH] Remove Qi logic --- src/signers/abstract-signer.ts | 41 ++++++---------------------------- 1 file changed, 7 insertions(+), 34 deletions(-) diff --git a/src/signers/abstract-signer.ts b/src/signers/abstract-signer.ts index ec547a8f..a849508b 100644 --- a/src/signers/abstract-signer.ts +++ b/src/signers/abstract-signer.ts @@ -3,13 +3,8 @@ * sufficent for most developers, but this is provided to fascilitate more complex Signers. */ import { AddressLike, resolveAddress, validateAddress } from '../address/index.js'; -import { defineProperties, getBigInt, resolveProperties, assert, assertArgument, isQiAddress } from '../utils/index.js'; -import { - addressFromTransactionRequest, - copyRequest, - QiTransactionRequest, - QuaiTransactionRequest, -} from '../providers/provider.js'; +import { defineProperties, getBigInt, resolveProperties, assert, assertArgument } from '../utils/index.js'; +import { addressFromTransactionRequest, copyRequest, QuaiTransactionRequest } from '../providers/provider.js'; import type { TypedDataDomain, TypedDataField } from '../hash/index.js'; import type { TransactionLike } from '../transaction/index.js'; @@ -17,7 +12,7 @@ import type { TransactionLike } from '../transaction/index.js'; import type { BlockTag, Provider, TransactionRequest, TransactionResponse } from '../providers/provider.js'; import type { Signer } from './signer.js'; import { getTxType } from '../utils/index.js'; -import { QiTransaction, QiTransactionLike, QuaiTransaction, QuaiTransactionLike } from '../transaction/index.js'; +import { QuaiTransaction, QuaiTransactionLike } from '../transaction/index.js'; import { toZone, Zone } from '../constants/index.js'; function checkProvider(signer: AbstractSigner, operation: string): Provider { @@ -155,19 +150,6 @@ export abstract class AbstractSigner

{ - const pop = { - inputsUTXO: tx.inputs, - outputsUTXO: tx.outputs, - chainId: tx.chainId, - type: 2, - }; - - //@TOOD: Don't await all over the place; save them up for - // the end for better batching - return await resolveProperties(pop); - } - async estimateGas(tx: TransactionRequest): Promise { return checkProvider(this, 'estimateGas').estimateGas(await this.populateCall(tx)); } @@ -178,22 +160,13 @@ export abstract class AbstractSigner

{ const provider = checkProvider(this, 'sendTransaction'); - const sender = await this.getAddress(); const zone = await this.zoneFromAddress(addressFromTransactionRequest(tx)); + const pop = await this.populateQuaiTransaction(tx as QuaiTransactionRequest); + const txObj = QuaiTransaction.from(pop); - let pop; - let txObj; - if (isQiAddress(sender)) { - pop = await this.populateQiTransaction(tx); - txObj = QiTransaction.from(pop); - } else { - pop = await this.populateQuaiTransaction(tx as QuaiTransactionRequest); - txObj = QuaiTransaction.from(pop); - } - + const sender = await this.getAddress(); const signedTx = await this.signTransaction(txObj); - - return await provider.broadcastTransaction(zone, signedTx, 'from' in tx ? tx.from : undefined); + return await provider.broadcastTransaction(zone, signedTx, sender); } abstract signTransaction(tx: TransactionRequest): Promise;