fix analitics
This commit is contained in:
parent
67029d46ff
commit
899e56388f
|
@ -23,7 +23,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@blockworks-foundation/mango-feeds": "0.1.7",
|
"@blockworks-foundation/mango-feeds": "0.1.7",
|
||||||
"@blockworks-foundation/mango-mints-redemption": "^0.0.10",
|
"@blockworks-foundation/mango-mints-redemption": "^0.0.10",
|
||||||
"@blockworks-foundation/mango-v4": "0.31.3",
|
"@blockworks-foundation/mango-v4": "0.31.4",
|
||||||
"@blockworks-foundation/mango-v4-settings": "0.14.24",
|
"@blockworks-foundation/mango-v4-settings": "0.14.24",
|
||||||
"@blockworks-foundation/mangolana": "0.0.17",
|
"@blockworks-foundation/mangolana": "0.0.17",
|
||||||
"@headlessui/react": "1.6.6",
|
"@headlessui/react": "1.6.6",
|
||||||
|
|
|
@ -139,7 +139,7 @@ const initMangoClient = (
|
||||||
idsSource: 'api',
|
idsSource: 'api',
|
||||||
prependedGlobalAdditionalInstructions:
|
prependedGlobalAdditionalInstructions:
|
||||||
opts.prependedGlobalAdditionalInstructions,
|
opts.prependedGlobalAdditionalInstructions,
|
||||||
postSendTxCallback: (txCallbackOptions: TxCallbackOptions) => {
|
postSendTxCallback: async (txCallbackOptions: TxCallbackOptions) => {
|
||||||
if (telemetry) {
|
if (telemetry) {
|
||||||
telemetry('postSendTx', {
|
telemetry('postSendTx', {
|
||||||
props: { fee: opts.prioritizationFee },
|
props: { fee: opts.prioritizationFee },
|
||||||
|
|
|
@ -70,7 +70,8 @@ async function txConfirmationInner(
|
||||||
// search message ixs only (as opposed to inner)
|
// search message ixs only (as opposed to inner)
|
||||||
// it's ok to do this since Mango does not CPI into itself and these metrics are for the frontend only
|
// it's ok to do this since Mango does not CPI into itself and these metrics are for the frontend only
|
||||||
const messageInstructions =
|
const messageInstructions =
|
||||||
confirmedTxn?.transaction.message.compiledInstructions
|
confirmedTxn?.transaction.message.compiledInstructions ||
|
||||||
|
txCallbackOptions.instructions?.message.compiledInstructions
|
||||||
const instructionNames = []
|
const instructionNames = []
|
||||||
if (messageInstructions) {
|
if (messageInstructions) {
|
||||||
for (const ix of messageInstructions) {
|
for (const ix of messageInstructions) {
|
||||||
|
@ -84,9 +85,16 @@ async function txConfirmationInner(
|
||||||
const confirmed = confirmedTxn !== null
|
const confirmed = confirmedTxn !== null
|
||||||
const error =
|
const error =
|
||||||
confirmedTxn?.meta?.err !== null && confirmedTxn?.meta?.err !== undefined
|
confirmedTxn?.meta?.err !== null && confirmedTxn?.meta?.err !== undefined
|
||||||
|
const signBlockTime = await connection.getBlockTime(txSignatureBlockHash.slot)
|
||||||
|
let backupBlockTime = null
|
||||||
|
|
||||||
|
if (!confirmedTxn && signBlockTime) {
|
||||||
|
backupBlockTime = new Date(signBlockTime * 1000).toISOString()
|
||||||
|
}
|
||||||
|
|
||||||
const block_datetime = confirmedTxn?.blockTime
|
const block_datetime = confirmedTxn?.blockTime
|
||||||
? new Date(confirmedTxn.blockTime * 1000).toISOString()
|
? new Date(confirmedTxn.blockTime * 1000).toISOString()
|
||||||
: null
|
: backupBlockTime || new Date().toISOString()
|
||||||
|
|
||||||
const loaded_addresses =
|
const loaded_addresses =
|
||||||
(confirmedTxn?.meta?.loadedAddresses?.readonly.length ?? 0) +
|
(confirmedTxn?.meta?.loadedAddresses?.readonly.length ?? 0) +
|
||||||
|
@ -99,12 +107,12 @@ async function txConfirmationInner(
|
||||||
error,
|
error,
|
||||||
ui_confirmation_time_ms: elapsed,
|
ui_confirmation_time_ms: elapsed,
|
||||||
fetch_blockhash_slot: txSignatureBlockHash.slot,
|
fetch_blockhash_slot: txSignatureBlockHash.slot,
|
||||||
processed_slot: confirmedTxn?.slot,
|
processed_slot: confirmedTxn?.slot || txSignatureBlockHash.slot,
|
||||||
instruction_names: instructionNames.join(','),
|
instruction_names: instructionNames.join(','),
|
||||||
loaded_addresses,
|
loaded_addresses,
|
||||||
prioritization_fee,
|
prioritization_fee,
|
||||||
compute_units_consumed: confirmedTxn?.meta?.computeUnitsConsumed,
|
compute_units_consumed: confirmedTxn?.meta?.computeUnitsConsumed || 0,
|
||||||
fee_lamports: confirmedTxn?.meta?.fee,
|
fee_lamports: confirmedTxn?.meta?.fee || 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
await fetch(`${MANGO_DATA_API_URL}/transaction-confirmation`, {
|
await fetch(`${MANGO_DATA_API_URL}/transaction-confirmation`, {
|
||||||
|
|
|
@ -379,10 +379,10 @@
|
||||||
bn.js "^5.2.1"
|
bn.js "^5.2.1"
|
||||||
eslint-config-prettier "^9.0.0"
|
eslint-config-prettier "^9.0.0"
|
||||||
|
|
||||||
"@blockworks-foundation/mango-v4@0.31.3":
|
"@blockworks-foundation/mango-v4@0.31.4":
|
||||||
version "0.31.3"
|
version "0.31.4"
|
||||||
resolved "https://registry.yarnpkg.com/@blockworks-foundation/mango-v4/-/mango-v4-0.31.3.tgz#1ea59212d616141eca39da507db54e6596006c12"
|
resolved "https://registry.yarnpkg.com/@blockworks-foundation/mango-v4/-/mango-v4-0.31.4.tgz#46443099d1f3cac0ab88d251b052b4bc003b6e6a"
|
||||||
integrity sha512-D//lwMMaNpGyFTiS25DwU3hOUGYTkY903rZeEQycFQJoAP5/lJ8eH/YEp9KSqPu2Zg3RT8VKuzClKuJi+9UXaA==
|
integrity sha512-6Ni5eVMwtXmx0AE6rBLIMCa/FrZKNSk23C1sPU7mjY7UGqClGQQTuMMDFfuQ5VJAV39BE92x3QSoCmqc0YikHg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@blockworks-foundation/mango-v4-settings" "0.14.24"
|
"@blockworks-foundation/mango-v4-settings" "0.14.24"
|
||||||
"@blockworks-foundation/mangolana" "0.0.17"
|
"@blockworks-foundation/mangolana" "0.0.17"
|
||||||
|
|
Loading…
Reference in New Issue