Skip to content

Commit 68c8fc1

Browse files
authored
renders fee and expiration in unsigned transaction summary (#5556)
when reviewing an unsigned transaction it will be helpful to display the transaction fee and expiration these fields are shown when reviewing the transaction on a ledger device, so we should also display them on the CLI
1 parent fe3a9d5 commit 68c8fc1

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

ironfish-cli/src/utils/transaction.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ export async function renderTransactionDetails(
124124

125125
await _renderTransactionDetails(
126126
client,
127+
transaction.fee(),
128+
transaction.expiration(),
127129
transaction.mints,
128130
transaction.burns,
129131
account,
@@ -148,6 +150,8 @@ export async function renderUnsignedTransactionDetails(
148150

149151
await _renderTransactionDetails(
150152
client,
153+
unsignedTransaction.fee(),
154+
unsignedTransaction.expiration(),
151155
unsignedTransaction.mints,
152156
unsignedTransaction.burns,
153157
account,
@@ -158,6 +162,8 @@ export async function renderUnsignedTransactionDetails(
158162

159163
async function _renderTransactionDetails(
160164
client: RpcClient,
165+
fee: bigint,
166+
expiration: number,
161167
mints: MintDescription[],
162168
burns: BurnDescription[],
163169
account?: string,
@@ -169,6 +175,14 @@ async function _renderTransactionDetails(
169175
const assetIds = collectAssetIds(mints, burns, notes)
170176
const assetLookup = await getAssetVerificationByIds(client, assetIds, account, undefined)
171177

178+
logger.log('')
179+
logger.log('===================')
180+
logger.log('Transaction Summary')
181+
logger.log('===================')
182+
logger.log('')
183+
logger.log(`Fee ${CurrencyUtils.render(fee, true)}`)
184+
logger.log(`Expiration ${expiration}`)
185+
172186
if (mints.length > 0) {
173187
logger.log('')
174188
logger.log('==================')

ironfish/src/primitives/unsignedTransaction.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,4 +176,12 @@ export class UnsignedTransaction {
176176
this.returnReference()
177177
return publicKeyRandomness
178178
}
179+
180+
fee(): bigint {
181+
return this._fee
182+
}
183+
184+
expiration(): number {
185+
return this._expiration
186+
}
179187
}

0 commit comments

Comments
 (0)