@bloks/utils
Advanced tools
Comparing version 27.7.0 to 27.8.0
import { ApiInterfaces, RpcInterfaces } from '@proton/js'; | ||
import { HistoryTransaction } from '@proton/wrap-constants'; | ||
@@ -273,3 +274,3 @@ declare function cloneDeepArrayOfObj(array: Array<object>): {}[]; | ||
id: string; | ||
block_time: Date; | ||
block_time: string; | ||
block_num: number; | ||
@@ -412,6 +413,7 @@ transaction_extensions: any[]; | ||
declare function historyTransformTransaction(transaction: RpcInterfaces.NativeTransaction): TransformedTransaction; | ||
declare function dexTransformTransaction(transaction: HistoryTransaction): TransformedTransaction; | ||
declare function hexToUint8Array(hex: string): Uint8Array; | ||
declare function urlBuilder(url: string, id: string, params: any): string; | ||
declare function urlBuilder(url: string, id: string | null | undefined, params: any): string; | ||
@@ -556,2 +558,2 @@ declare function copy(text: string): void; | ||
export { AccountRAMDelta, Act, Action, ActionData, ActionElement, ActionTrace, AtomicAsset, AtomicAssetsAccountResponse, AtomicAssetsIdResponse, Authorization, Dbop, DbopOp, DfuseAction, ExecutionBlockHeader, ExecutionTrace, ExecutionTraceReceipt, GetActionsDfuseResult, GetActionsHyperionResult, GetActionsNativeResult, Lifecycle, LifecycleTransaction, New, Nft, NftInterface, PurpleData, Ramop, Receipt, SimpleAsset, SimpleAssetsAccountResponse, Tableop, Total, TransactionElement, TransformedTransaction, bytesToString, charidx, cloneDeepArrayOfObj, copy, decodeName, dfuseDepthFirstExtract, dfuseTransformDeferredAction, dfuseTransformDeferredTransaction, dfuseTransformGetActions, dfuseTransformTrace, dfuseTransformTransaction, dfuseTransformTransactionResult, encodeName, fioKeyToActor, hexToUint8Array, historyTransformDeferredAction, historyTransformDeferredTransaction, historyTransformFlatTraces, historyTransformRecursiveTrace, historyTransformTransaction, hyperionTransformFlatTraces, hyperionTransformGetActions, hyperionTransformTransaction, isString, nativeTransformGetActions, parseAaNft, parseSaNft, sha, string_to_uint128_hash, urlBuilder, wait }; | ||
export { AccountRAMDelta, Act, Action, ActionData, ActionElement, ActionTrace, AtomicAsset, AtomicAssetsAccountResponse, AtomicAssetsIdResponse, Authorization, Dbop, DbopOp, DfuseAction, ExecutionBlockHeader, ExecutionTrace, ExecutionTraceReceipt, GetActionsDfuseResult, GetActionsHyperionResult, GetActionsNativeResult, Lifecycle, LifecycleTransaction, New, Nft, NftInterface, PurpleData, Ramop, Receipt, SimpleAsset, SimpleAssetsAccountResponse, Tableop, Total, TransactionElement, TransformedTransaction, bytesToString, charidx, cloneDeepArrayOfObj, copy, decodeName, dexTransformTransaction, dfuseDepthFirstExtract, dfuseTransformDeferredAction, dfuseTransformDeferredTransaction, dfuseTransformGetActions, dfuseTransformTrace, dfuseTransformTransaction, dfuseTransformTransactionResult, encodeName, fioKeyToActor, hexToUint8Array, historyTransformDeferredAction, historyTransformDeferredTransaction, historyTransformFlatTraces, historyTransformRecursiveTrace, historyTransformTransaction, hyperionTransformFlatTraces, hyperionTransformGetActions, hyperionTransformTransaction, isString, nativeTransformGetActions, parseAaNft, parseSaNft, sha, string_to_uint128_hash, urlBuilder, wait }; |
@@ -36,2 +36,3 @@ "use strict"; | ||
decodeName: () => decodeName, | ||
dexTransformTransaction: () => dexTransformTransaction, | ||
dfuseDepthFirstExtract: () => dfuseDepthFirstExtract, | ||
@@ -647,2 +648,76 @@ dfuseTransformDeferredAction: () => dfuseTransformDeferredAction, | ||
} | ||
function dexTransformTransaction(transaction) { | ||
const trace = transaction.trace.trace; | ||
const actionTraces = trace.action_traces; | ||
const res = { | ||
block_num: +transaction.trace.block_num, | ||
block_time: transaction.trace.block_timestamp, | ||
head_block_num: 0, | ||
id: trace.id, | ||
irreversible: transaction.irreversible, | ||
last_irreversible_block: 0, | ||
traces: actionTraces.map((actionTrace) => ({ | ||
action_ordinal: +actionTrace.action_ordinal, | ||
creator_action_ordinal: +actionTrace.creator_action_ordinal, | ||
closest_unnotified_ancestor_action_ordinal: 0, | ||
account_ram_deltas: actionTrace.account_ram_deltas.map((_) => ({ | ||
account: _.account, | ||
delta: +_.delta | ||
})), | ||
act: actionTrace.act, | ||
block_num: +transaction.trace.block_num, | ||
block_time: transaction.trace.block_timestamp, | ||
context_free: actionTrace.context_free === "true", | ||
elapsed: +actionTrace.elapsed, | ||
producer_block_id: null, | ||
receipt: { | ||
abi_sequence: +actionTrace.receipt.abi_sequence, | ||
act_digest: actionTrace.receipt.act_digest, | ||
auth_sequence: actionTrace.receipt.auth_sequence.map((_) => [_.account, +_.sequence]), | ||
code_sequence: +actionTrace.receipt.code_sequence, | ||
global_sequence: +actionTrace.receipt.global_sequence, | ||
receiver: actionTrace.receipt.receiver, | ||
recv_sequence: +actionTrace.receipt.recv_sequence | ||
}, | ||
receiver: actionTrace.receiver, | ||
trx_id: trace.id, | ||
account_disk_deltas: [], | ||
error_code: null, | ||
except: null, | ||
console: "" | ||
})), | ||
transaction_num: 0, | ||
trx: { | ||
receipt: { | ||
cpu_usage_us: parseInt(trace.cpu_usage_us, 10), | ||
net_usage_words: parseInt(trace.net_usage_words, 10), | ||
status: trace.status, | ||
trx: [ | ||
1, | ||
{ | ||
packed_trx: "", | ||
signatures: trace.partial.signatures, | ||
compression: "", | ||
packed_context_free_data: "" | ||
} | ||
] | ||
}, | ||
trx: { | ||
actions: actionTraces.map((actionTrace) => { | ||
return { | ||
...actionTrace.act, | ||
hex_data: void 0 | ||
}; | ||
}), | ||
context_free_data: trace.partial.context_free_data, | ||
delay_sec: +(trace.partial.delay_sec || 0), | ||
max_cpu_usage_ms: parseInt(trace.partial.max_cpu_usage_ms, 10), | ||
max_net_usage_words: parseInt(trace.partial.max_net_usage_words, 10), | ||
ref_block_num: parseInt(trace.partial.ref_block_num, 10), | ||
ref_block_prefix: parseInt(trace.partial.ref_block_prefix, 10) | ||
} | ||
} | ||
}; | ||
return historyTransformTransaction(res); | ||
} | ||
@@ -861,2 +936,3 @@ // src/serialization.ts | ||
decodeName, | ||
dexTransformTransaction, | ||
dfuseDepthFirstExtract, | ||
@@ -863,0 +939,0 @@ dfuseTransformDeferredAction, |
{ | ||
"name": "@bloks/utils", | ||
"version": "27.7.0", | ||
"version": "27.8.0", | ||
"author": "Metallicus", | ||
@@ -16,3 +16,3 @@ "module": "dist/index.mjs", | ||
"dependencies": { | ||
"@proton/js": "^27.10.0", | ||
"@proton/js": "^27.11.0", | ||
"fast-text-encoding": "^1.0.3", | ||
@@ -24,2 +24,3 @@ "long": "^4.0.0", | ||
"@proton/tsconfig": "1.5.0", | ||
"@proton/wrap-constants": "^0.2.156", | ||
"@types/jest": "^24.9.0", | ||
@@ -26,0 +27,0 @@ "@types/long": "^4.0.1", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
75382
2384
8
Updated@proton/js@^27.11.0