Compare commits

...

5 Commits

Author SHA1 Message Date
Denis Angell
3c668f41b8 Publish
- @transia/xrpl@2.7.3-alpha.21
2023-12-15 12:09:52 +01:00
Denis Angell
aeb29a20a1 add fee estimation to autofill 2023-12-15 12:09:25 +01:00
Denis Angell
8c814482e5 Publish
- @transia/xrpl@2.7.3-alpha.20
2023-12-10 14:51:07 +01:00
Denis Angell
5b57ea8b77 add hook emissions to metadata 2023-12-10 14:49:51 +01:00
Denis Angell
7663e6049f always use open ledger fee 2023-12-10 14:48:53 +01:00
4 changed files with 23 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@transia/xrpl",
"version": "2.7.3-alpha.19",
"version": "2.7.3-alpha.21",
"license": "ISC",
"description": "A TypeScript/JavaScript API for interacting with the XRP Ledger in Node.js and the browser",
"files": [

View File

@@ -14,6 +14,17 @@ export interface HookExecution {
}
}
export interface HookEmission {
HookEmission: {
EmitGeneration: number
EmitBurden: string
EmitParentTxnID: string
EmitNonce: string
EmitCallback: string
EmitHookHash: string
}
}
export interface CreatedNode {
CreatedNode: {
LedgerEntryType: string
@@ -75,6 +86,7 @@ export function isDeletedNode(node: Node): node is DeletedNode {
export interface TransactionMetadata {
HookExecutions?: HookExecution[]
HookEmissions?: HookEmission[]
AffectedNodes: Node[]
DeliveredAmount?: Amount
// "unavailable" possible for transactions before 2014-01-20

View File

@@ -2,6 +2,7 @@ import {
xAddressToClassicAddress,
isValidXAddress,
} from '@transia/ripple-address-codec'
import { encode } from '@transia/ripple-binary-codec'
import BigNumber from 'bignumber.js'
import type { Client } from '..'
@@ -11,7 +12,7 @@ import { Transaction } from '../models/transactions'
import { setTransactionFlagsToNumber } from '../models/utils/flags'
import { xrpToDrops } from '../utils'
import { getFeeXrp } from './getFeeXrp'
import { getFeeEstimateXrp, getFeeXrp } from './getFeeXrp'
// Expire unconfirmed transactions after 20 ledger versions, approximately 1 minute, by default
const LEDGER_OFFSET = 20
@@ -60,7 +61,13 @@ async function autofill<T extends Transaction>(
promises.push(checkAccountDeleteBlockers(this, tx))
}
return Promise.all(promises).then(() => tx)
await Promise.all(promises).then(() => tx)
const copyTx = { ...tx }
copyTx.SigningPubKey = ``
const tx_blob = encode(copyTx)
// eslint-disable-next-line require-atomic-updates -- ignore
tx.Fee = await getFeeEstimateXrp(this, tx_blob)
return tx
}
function setValidAddresses(tx: Transaction): void {

View File

@@ -60,5 +60,5 @@ export async function getFeeEstimateXrp(
command: 'fee',
tx_blob: txBlob,
})
return response.result.drops.base_fee
return response.result.drops.open_ledger_fee
}