-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathsorting-transactions.ts
More file actions
41 lines (35 loc) · 1.34 KB
/
sorting-transactions.ts
File metadata and controls
41 lines (35 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* eslint-disable */
import Arweave from 'arweave';
import {
ArweaveGatewayInteractionsLoader,
BlockHeightInteractionsSorter,
Contract, DefaultEvaluationOptions, LexicographicalInteractionsSorter,
LoggerFactory, RedstoneGatewayInteractionsLoader,
Warp,
WarpNodeFactory
} from '../src';
import {TsLogFactory} from '../src/logging/node/TsLogFactory';
import fs from 'fs';
import path from 'path';
import ArLocal from 'arlocal';
import {JWKInterface} from 'arweave/node/lib/wallet';
async function main() {
LoggerFactory.use(new TsLogFactory());
LoggerFactory.INST.logLevel('error');
LoggerFactory.INST.logLevel('info', 'sorting');
const logger = LoggerFactory.INST.create('sorting');
const arweave = Arweave.init({
host: 'arweave.net',
port: 443,
protocol: 'https'
});
const interactionsLoader = new RedstoneGatewayInteractionsLoader("https://gateway.redstone.finance/", {confirmed: true});
const lexSorting = new LexicographicalInteractionsSorter(arweave);
const interactions = await interactionsLoader.load("KT45jaf8n9UwgkEareWxPgLJk4oMWpI5NODgYVIF1fY", 0, 903341);
const sorted = await lexSorting.sort([...interactions]);
logger.info("\n\nLexicographical");
sorted.forEach(v => {
logger.info(`${v.node.block.height}:${v.node.id}: [${v.node.sortKey}]`);
});
}
main().catch((e) => console.error(e));