@rosen-bridge/abstract-extractor 2.1.0 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/dist/ergo/{AbstractErgoExtractor.d.ts → abstractErgoExtractor.d.ts} +3 -3
- package/dist/ergo/abstractErgoExtractor.d.ts.map +1 -0
- package/dist/ergo/{AbstractErgoExtractor.js → abstractErgoExtractor.js} +3 -3
- package/dist/ergo/{AbstractErgoExtractorAction.d.ts → abstractErgoExtractorAction.d.ts} +6 -4
- package/dist/ergo/abstractErgoExtractorAction.d.ts.map +1 -0
- package/dist/ergo/abstractErgoExtractorAction.js +219 -0
- package/dist/ergo/{AbstractErgoExtractorEntity.d.ts → abstractErgoExtractorEntity.d.ts} +1 -1
- package/dist/ergo/{AbstractErgoExtractorEntity.d.ts.map → abstractErgoExtractorEntity.d.ts.map} +1 -1
- package/dist/ergo/{AbstractErgoExtractorEntity.js → abstractErgoExtractorEntity.js} +1 -1
- package/dist/ergo/index.d.ts +6 -6
- package/dist/ergo/index.js +7 -7
- package/dist/ergo/initializable/{AbstractInitializable.d.ts → abstractInitializable.d.ts} +4 -4
- package/dist/ergo/initializable/{AbstractInitializable.d.ts.map → abstractInitializable.d.ts.map} +1 -1
- package/dist/ergo/initializable/abstractInitializable.js +162 -0
- package/dist/ergo/initializable/{AbstractInitializableAction.d.ts → abstractInitializableAction.d.ts} +4 -4
- package/dist/ergo/initializable/abstractInitializableAction.d.ts.map +1 -0
- package/dist/ergo/initializable/{AbstractInitializableAction.js → abstractInitializableAction.js} +2 -2
- package/dist/ergo/initializable/index.d.ts +2 -2
- package/dist/ergo/initializable/index.js +3 -3
- package/dist/{lib/ergo/network/AbstractNetwork.d.ts → ergo/network/abstractNetwork.d.ts} +1 -1
- package/dist/ergo/network/{AbstractNetwork.d.ts.map → abstractNetwork.d.ts.map} +1 -1
- package/dist/ergo/network/{AbstractNetwork.js → abstractNetwork.js} +1 -1
- package/dist/{lib/ergo/network/ExplorerNetwork.d.ts → ergo/network/explorerNetwork.d.ts} +2 -2
- package/dist/ergo/network/explorerNetwork.d.ts.map +1 -0
- package/dist/ergo/network/{ExplorerNetwork.js → explorerNetwork.js} +3 -3
- package/dist/ergo/network/{NodeNetwork.d.ts → nodeNetwork.d.ts} +2 -2
- package/dist/ergo/network/nodeNetwork.d.ts.map +1 -0
- package/dist/ergo/network/nodeNetwork.js +131 -0
- package/dist/ergo/utils.d.ts.map +1 -1
- package/dist/ergo/utils.js +1 -1
- package/package.json +24 -16
- package/.eslintignore +0 -1
- package/dist/ergo/AbstractErgoExtractor.d.ts.map +0 -1
- package/dist/ergo/AbstractErgoExtractorAction.d.ts.map +0 -1
- package/dist/ergo/AbstractErgoExtractorAction.js +0 -222
- package/dist/ergo/initializable/AbstractInitializable.js +0 -163
- package/dist/ergo/initializable/AbstractInitializableAction.d.ts.map +0 -1
- package/dist/ergo/network/AbstractNetwork.d.ts +0 -26
- package/dist/ergo/network/ExplorerNetwork.d.ts +0 -74
- package/dist/ergo/network/ExplorerNetwork.d.ts.map +0 -1
- package/dist/ergo/network/NodeNetwork.d.ts.map +0 -1
- package/dist/ergo/network/NodeNetwork.js +0 -131
- package/dist/lib/abstractExtractor.d.ts +0 -25
- package/dist/lib/abstractExtractor.d.ts.map +0 -1
- package/dist/lib/abstractExtractor.js +0 -3
- package/dist/lib/constants.d.ts +0 -4
- package/dist/lib/constants.d.ts.map +0 -1
- package/dist/lib/constants.js +0 -4
- package/dist/lib/ergo/AbstractErgoExtractor.d.ts +0 -80
- package/dist/lib/ergo/AbstractErgoExtractor.d.ts.map +0 -1
- package/dist/lib/ergo/AbstractErgoExtractor.js +0 -142
- package/dist/lib/ergo/AbstractErgoExtractorAction.d.ts +0 -92
- package/dist/lib/ergo/AbstractErgoExtractorAction.d.ts.map +0 -1
- package/dist/lib/ergo/AbstractErgoExtractorAction.js +0 -222
- package/dist/lib/ergo/AbstractErgoExtractorEntity.d.ts +0 -11
- package/dist/lib/ergo/AbstractErgoExtractorEntity.d.ts.map +0 -1
- package/dist/lib/ergo/AbstractErgoExtractorEntity.js +0 -57
- package/dist/lib/ergo/index.d.ts +0 -10
- package/dist/lib/ergo/index.d.ts.map +0 -1
- package/dist/lib/ergo/index.js +0 -10
- package/dist/lib/ergo/initializable/AbstractInitializable.d.ts +0 -48
- package/dist/lib/ergo/initializable/AbstractInitializable.d.ts.map +0 -1
- package/dist/lib/ergo/initializable/AbstractInitializable.js +0 -163
- package/dist/lib/ergo/initializable/AbstractInitializableAction.d.ts +0 -14
- package/dist/lib/ergo/initializable/AbstractInitializableAction.d.ts.map +0 -1
- package/dist/lib/ergo/initializable/AbstractInitializableAction.js +0 -16
- package/dist/lib/ergo/initializable/index.d.ts +0 -3
- package/dist/lib/ergo/initializable/index.d.ts.map +0 -1
- package/dist/lib/ergo/initializable/index.js +0 -3
- package/dist/lib/ergo/interfaces.d.ts +0 -47
- package/dist/lib/ergo/interfaces.d.ts.map +0 -1
- package/dist/lib/ergo/interfaces.js +0 -8
- package/dist/lib/ergo/network/AbstractNetwork.d.ts.map +0 -1
- package/dist/lib/ergo/network/AbstractNetwork.js +0 -3
- package/dist/lib/ergo/network/ExplorerNetwork.d.ts.map +0 -1
- package/dist/lib/ergo/network/ExplorerNetwork.js +0 -185
- package/dist/lib/ergo/network/NodeNetwork.d.ts +0 -60
- package/dist/lib/ergo/network/NodeNetwork.d.ts.map +0 -1
- package/dist/lib/ergo/network/NodeNetwork.js +0 -131
- package/dist/lib/ergo/utils.d.ts +0 -8
- package/dist/lib/ergo/utils.d.ts.map +0 -1
- package/dist/lib/ergo/utils.js +0 -16
- package/dist/lib/index.d.ts +0 -4
- package/dist/lib/index.d.ts.map +0 -1
- package/dist/lib/index.js +0 -4
- package/dist/tests/AbstractErgoExtractor.mock.d.ts +0 -11
- package/dist/tests/AbstractErgoExtractor.mock.d.ts.map +0 -1
- package/dist/tests/AbstractErgoExtractor.mock.js +0 -11
- package/dist/tests/AbstractErgoExtractor.spec.d.ts +0 -2
- package/dist/tests/AbstractErgoExtractor.spec.d.ts.map +0 -1
- package/dist/tests/AbstractErgoExtractor.spec.js +0 -240
- package/dist/tests/AbstractErgoExtractorAction.mock.d.ts +0 -15
- package/dist/tests/AbstractErgoExtractorAction.mock.d.ts.map +0 -1
- package/dist/tests/AbstractErgoExtractorAction.mock.js +0 -27
- package/dist/tests/AbstractErgoExtractorAction.spec.d.ts +0 -2
- package/dist/tests/AbstractErgoExtractorAction.spec.d.ts.map +0 -1
- package/dist/tests/AbstractErgoExtractorAction.spec.js +0 -221
- package/dist/tests/initializable/AbstractInitializable.mock.d.ts +0 -61
- package/dist/tests/initializable/AbstractInitializable.mock.d.ts.map +0 -1
- package/dist/tests/initializable/AbstractInitializable.mock.js +0 -18
- package/dist/tests/initializable/AbstractInitializable.spec.d.ts +0 -2
- package/dist/tests/initializable/AbstractInitializable.spec.d.ts.map +0 -1
- package/dist/tests/initializable/AbstractInitializable.spec.js +0 -299
- package/dist/tests/initializable/AbstractInitializableAction.mock.d.ts +0 -15
- package/dist/tests/initializable/AbstractInitializableAction.mock.d.ts.map +0 -1
- package/dist/tests/initializable/AbstractInitializableAction.mock.js +0 -27
- package/dist/tests/initializable/AbstractInitializableAction.spec.d.ts +0 -2
- package/dist/tests/initializable/AbstractInitializableAction.spec.d.ts.map +0 -1
- package/dist/tests/initializable/AbstractInitializableAction.spec.js +0 -54
- package/dist/tests/initializable/testData.d.ts +0 -94
- package/dist/tests/initializable/testData.d.ts.map +0 -1
- package/dist/tests/initializable/testData.js +0 -235
- package/dist/tests/network/ExplorerNetwork.spec.d.ts +0 -2
- package/dist/tests/network/ExplorerNetwork.spec.d.ts.map +0 -1
- package/dist/tests/network/ExplorerNetwork.spec.js +0 -61
- package/dist/tests/network/NodeNetwork.spec.d.ts +0 -2
- package/dist/tests/network/NodeNetwork.spec.d.ts.map +0 -1
- package/dist/tests/network/NodeNetwork.spec.js +0 -48
- package/dist/tests/network/testData.d.ts +0 -752
- package/dist/tests/network/testData.d.ts.map +0 -1
- package/dist/tests/network/testData.js +0 -1401
- package/dist/tests/testData.d.ts +0 -32
- package/dist/tests/testData.d.ts.map +0 -1
- package/dist/tests/testData.js +0 -121
- package/dist/tests/testUtils.d.ts +0 -9
- package/dist/tests/testUtils.d.ts.map +0 -1
- package/dist/tests/testUtils.js +0 -31
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/vitest.config.d.ts +0 -3
- package/dist/vitest.config.d.ts.map +0 -1
- package/dist/vitest.config.js +0 -18
- package/lib/abstractExtractor.ts +0 -31
- package/lib/constants.ts +0 -3
- package/lib/ergo/AbstractErgoExtractor.ts +0 -227
- package/lib/ergo/AbstractErgoExtractorAction.ts +0 -319
- package/lib/ergo/AbstractErgoExtractorEntity.ts +0 -32
- package/lib/ergo/index.ts +0 -9
- package/lib/ergo/initializable/AbstractInitializable.ts +0 -228
- package/lib/ergo/initializable/AbstractInitializableAction.ts +0 -33
- package/lib/ergo/initializable/index.ts +0 -2
- package/lib/ergo/interfaces.ts +0 -51
- package/lib/ergo/network/AbstractNetwork.ts +0 -29
- package/lib/ergo/network/ExplorerNetwork.ts +0 -237
- package/lib/ergo/network/NodeNetwork.ts +0 -169
- package/lib/ergo/utils.ts +0 -15
- package/lib/index.ts +0 -3
- package/tests/AbstractErgoExtractor.mock.ts +0 -33
- package/tests/AbstractErgoExtractor.spec.ts +0 -284
- package/tests/AbstractErgoExtractorAction.mock.ts +0 -45
- package/tests/AbstractErgoExtractorAction.spec.ts +0 -268
- package/tests/initializable/AbstractInitializable.mock.ts +0 -44
- package/tests/initializable/AbstractInitializable.spec.ts +0 -386
- package/tests/initializable/AbstractInitializableAction.mock.ts +0 -45
- package/tests/initializable/AbstractInitializableAction.spec.ts +0 -64
- package/tests/initializable/testData.ts +0 -283
- package/tests/network/ExplorerNetwork.spec.ts +0 -73
- package/tests/network/NodeNetwork.spec.ts +0 -56
- package/tests/network/testData.ts +0 -1708
- package/tests/testData.ts +0 -140
- package/tests/testUtils.ts +0 -22
- package/tsconfig.build.json +0 -9
- package/tsconfig.build.tsbuildinfo +0 -1
- package/tsconfig.json +0 -9
- package/vitest.config.ts +0 -18
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { DataSource } from '@rosen-bridge/extended-typeorm';
|
|
2
|
-
import { pick } from 'lodash-es';
|
|
3
|
-
import { BlockInfo } from '@rosen-bridge/scanner-interfaces';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
AbstractErgoExtractorEntity,
|
|
7
|
-
AbstractBoxData,
|
|
8
|
-
AbstractInitializableErgoExtractorAction,
|
|
9
|
-
} from '../../lib';
|
|
10
|
-
import { TestEntity } from '../testUtils';
|
|
11
|
-
|
|
12
|
-
export class TestInitializableErgoExtractorAction extends AbstractInitializableErgoExtractorAction<
|
|
13
|
-
AbstractBoxData,
|
|
14
|
-
AbstractErgoExtractorEntity
|
|
15
|
-
> {
|
|
16
|
-
constructor(dataSource: DataSource) {
|
|
17
|
-
super(dataSource, TestEntity);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* create the test database entity from data and block information
|
|
22
|
-
*/
|
|
23
|
-
createEntity = (
|
|
24
|
-
boxes: AbstractBoxData[],
|
|
25
|
-
block: BlockInfo,
|
|
26
|
-
extractor: string,
|
|
27
|
-
): Omit<AbstractErgoExtractorEntity, 'id'>[] => {
|
|
28
|
-
return boxes.map((box) => ({
|
|
29
|
-
boxId: box.boxId,
|
|
30
|
-
block: block.hash,
|
|
31
|
-
height: block.height,
|
|
32
|
-
serialized: box.serialized,
|
|
33
|
-
extractor: extractor,
|
|
34
|
-
}));
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* convert the database entity back to raw data
|
|
39
|
-
*/
|
|
40
|
-
convertEntityToData = (
|
|
41
|
-
entities: AbstractErgoExtractorEntity[],
|
|
42
|
-
): AbstractBoxData[] => {
|
|
43
|
-
return entities.map((data) => pick(data, ['boxId', 'serialized']));
|
|
44
|
-
};
|
|
45
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { DataSource, Repository } from '@rosen-bridge/extended-typeorm';
|
|
2
|
-
|
|
3
|
-
import { TestInitializableErgoExtractorAction } from './AbstractInitializableAction.mock';
|
|
4
|
-
import { createDatabase, TestEntity } from '../testUtils';
|
|
5
|
-
import { sampleEntities } from '../testData';
|
|
6
|
-
|
|
7
|
-
describe('AbstractErgoExtractorAction', () => {
|
|
8
|
-
let dataSource: DataSource;
|
|
9
|
-
let action: TestInitializableErgoExtractorAction;
|
|
10
|
-
let repository: Repository<TestEntity>;
|
|
11
|
-
beforeEach(async () => {
|
|
12
|
-
dataSource = await createDatabase();
|
|
13
|
-
action = new TestInitializableErgoExtractorAction(dataSource);
|
|
14
|
-
repository = dataSource.getRepository(TestEntity);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
describe('removeAllData', () => {
|
|
18
|
-
/**
|
|
19
|
-
* @target removeAllData should remove all available data related to this extractor
|
|
20
|
-
* @dependencies
|
|
21
|
-
* @scenario
|
|
22
|
-
* - insert 4 entities related to this extractor
|
|
23
|
-
* - run test (call `removeAllData`)
|
|
24
|
-
* @expected
|
|
25
|
-
* - to have 4 entities before removing
|
|
26
|
-
* - to have no remaining entities after remove
|
|
27
|
-
*/
|
|
28
|
-
it(`should remove all available data related to this extractor`, async () => {
|
|
29
|
-
await dataSource.getRepository(TestEntity).insert(sampleEntities);
|
|
30
|
-
const countBefore = await repository.count();
|
|
31
|
-
|
|
32
|
-
await action.removeAllData('extractor');
|
|
33
|
-
const countAfter = await repository.count();
|
|
34
|
-
|
|
35
|
-
expect(countBefore).toEqual(4);
|
|
36
|
-
expect(countAfter).toEqual(0);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* @target removeAllData should not remove any data related to another extractor
|
|
41
|
-
* @dependencies
|
|
42
|
-
* @scenario
|
|
43
|
-
* - insert 4 entities related to another extractor
|
|
44
|
-
* - run test (call `removeAllData`)
|
|
45
|
-
* @expected
|
|
46
|
-
* - to have 4 entities after removing
|
|
47
|
-
*/
|
|
48
|
-
it(`should not remove any data related to another extractor`, async () => {
|
|
49
|
-
await dataSource.getRepository(TestEntity).insert(
|
|
50
|
-
sampleEntities.map((entity) => ({
|
|
51
|
-
...entity,
|
|
52
|
-
extractor: 'extractor-new',
|
|
53
|
-
})),
|
|
54
|
-
);
|
|
55
|
-
const countBefore = await repository.count();
|
|
56
|
-
|
|
57
|
-
await action.removeAllData('extractor');
|
|
58
|
-
const countAfter = await repository.count();
|
|
59
|
-
|
|
60
|
-
expect(countBefore).toEqual(4);
|
|
61
|
-
expect(countAfter).toEqual(4);
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
});
|
|
@@ -1,283 +0,0 @@
|
|
|
1
|
-
export const ergoBoxes = [
|
|
2
|
-
{
|
|
3
|
-
boxId: '57d8334d8b6095393d9c6e471e25b477caba54adcc9757ea4f24d366fe72cdb3',
|
|
4
|
-
transactionId:
|
|
5
|
-
'793724eec1c6fa4ec68d93186c6403a071154cfc6e5931038791e447a69e1207',
|
|
6
|
-
blockId: '4674c0e9a4f26e24e083c8b5b3bbe0c63cd786c32a317f742be1228281b45b26',
|
|
7
|
-
value: 14948300000n,
|
|
8
|
-
index: 1,
|
|
9
|
-
creationHeight: 1252681,
|
|
10
|
-
inclusionHeight: 1252681,
|
|
11
|
-
ergoTree:
|
|
12
|
-
'0008cd03e5f5f63b27f9cdc47a9a8b799a26e5ee66a1e2a5d41d64640df3e64f4d050c18',
|
|
13
|
-
address: '9iD5jMoLjK9azTdigyT8z1QY6qHrA6gVrJamMF8MJ2qt45pJpDc',
|
|
14
|
-
assets: [
|
|
15
|
-
{
|
|
16
|
-
tokenId:
|
|
17
|
-
'e023c5f382b6e96fbd878f6811aac73345489032157ad5affb84aefd4956c297',
|
|
18
|
-
index: 0,
|
|
19
|
-
amount: 4983552n,
|
|
20
|
-
name: 'rsADA',
|
|
21
|
-
decimals: 6,
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
additionalRegisters: {},
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
boxId: '2708cc15be42eff988c7194c86912d305361c8c12cf9dae2b750dbf5c1519bd0',
|
|
28
|
-
transactionId:
|
|
29
|
-
'd18aaa53c20ff5a8989f6b26d2e84c9bd439abb7b61e9e53f48e73a6f311e712',
|
|
30
|
-
blockId: '95e73453f5824158e89946bf2efb6f7bf808c6c4b6d380d7f588e770a1de1ad0',
|
|
31
|
-
value: 14981300000n,
|
|
32
|
-
index: 2,
|
|
33
|
-
creationHeight: 1252677,
|
|
34
|
-
inclusionHeight: 1252677,
|
|
35
|
-
ergoTree:
|
|
36
|
-
'0008cd03e5f5f63b27f9cdc47a9a8b799a26e5ee66a1e2a5d41d64640df3e64f4d050c18',
|
|
37
|
-
address: '9iD5jMoLjK9azTdigyT8z1QY6qHrA6gVrJamMF8MJ2qt45pJpDc',
|
|
38
|
-
assets: [
|
|
39
|
-
{
|
|
40
|
-
tokenId:
|
|
41
|
-
'e023c5f382b6e96fbd878f6811aac73345489032157ad5affb84aefd4956c297',
|
|
42
|
-
index: 0,
|
|
43
|
-
amount: 4983552n,
|
|
44
|
-
name: 'rsADA',
|
|
45
|
-
decimals: 6,
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
additionalRegisters: {},
|
|
49
|
-
spentHeight: 1252680,
|
|
50
|
-
spentBlockId:
|
|
51
|
-
'9239ebca7b3b10701895e491a2213da4e07a37abc413d05434a5fab04993a19d',
|
|
52
|
-
spentTransactionId:
|
|
53
|
-
'b08fa920a6907d0e76eb0ad754439f1a26fa112b39f4de489620e4e6241930b7',
|
|
54
|
-
spentIndex: 1,
|
|
55
|
-
},
|
|
56
|
-
];
|
|
57
|
-
|
|
58
|
-
export const extractedData = {
|
|
59
|
-
boxId: 'boxId1',
|
|
60
|
-
address: 'address1',
|
|
61
|
-
serialized: 'serialized1',
|
|
62
|
-
blockId: 'blockId1',
|
|
63
|
-
height: 98,
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
export const transactionBatch = [
|
|
67
|
-
{
|
|
68
|
-
id: 'c0bd3194b04c7d44159d57a532d2d00f6db3c9a1e4aa1a7dc3dee6e8ae3f0f80',
|
|
69
|
-
inclusionHeight: 1320705,
|
|
70
|
-
blockId: 'b861e2134821fcf1fcdad7e6edd56c4e4495b42b2fd72762a4c79ed1db78b44b',
|
|
71
|
-
outputs: [
|
|
72
|
-
{
|
|
73
|
-
transactionId:
|
|
74
|
-
'c0bd3194b04c7d44159d57a532d2d00f6db3c9a1e4aa1a7dc3dee6e8ae3f0f80',
|
|
75
|
-
index: 0,
|
|
76
|
-
value: 1000000n,
|
|
77
|
-
ergoTree:
|
|
78
|
-
'100504000400050004000e20011d3364de07e5a26f0c4eef0852cddb387039a921b7154ef3cab22c6eda887fd803d601b2a5730000d602e4c6a70407d603b2db6501fe730100ea02d1ededededed93e4c672010407720293e4c67201050ec5720391e4c672010605730293c27201c2a793db63087201db6308a7938cb2db63087203730300017304cd7202',
|
|
79
|
-
creationHeight: 1320705,
|
|
80
|
-
assets: [
|
|
81
|
-
{
|
|
82
|
-
tokenId:
|
|
83
|
-
'8c27dd9d8a35aac1e3167d58858c0a8b4059b277da790552e37eba22df9b9035',
|
|
84
|
-
amount: 1n,
|
|
85
|
-
},
|
|
86
|
-
],
|
|
87
|
-
additionalRegisters: {
|
|
88
|
-
R4: '0702c1d434dac8765fc1269af82958d8aa350da53907096b35f7747cc372a7e6e69d',
|
|
89
|
-
R5: '0e2056b8b7c2ae45876ec9a79c575d66f6be1ead5498879f08df00b40daa62ae1b94',
|
|
90
|
-
R6: '058cee94aa09',
|
|
91
|
-
},
|
|
92
|
-
boxId:
|
|
93
|
-
'0881528fb109938778ec5da029b8e076b3ee8a48c3fbb46eadf020f3caa25800',
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
transactionId:
|
|
97
|
-
'c0bd3194b04c7d44159d57a532d2d00f6db3c9a1e4aa1a7dc3dee6e8ae3f0f80',
|
|
98
|
-
index: 1,
|
|
99
|
-
value: 1500000n,
|
|
100
|
-
ergoTree:
|
|
101
|
-
'1005040004000e36100204a00b08cd0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798ea02d192a39a8cc7a701730073011001020402d19683030193a38cc7b2a57300000193c2b2a57301007473027303830108cdeeac93b1a57304',
|
|
102
|
-
creationHeight: 1320705,
|
|
103
|
-
assets: [],
|
|
104
|
-
additionalRegisters: {},
|
|
105
|
-
boxId:
|
|
106
|
-
'6c92ec246cc30aa12353e35438f0a130dcd088be3535636b81fd73d131e32ac7',
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
transactionId:
|
|
110
|
-
'c0bd3194b04c7d44159d57a532d2d00f6db3c9a1e4aa1a7dc3dee6e8ae3f0f80',
|
|
111
|
-
index: 2,
|
|
112
|
-
value: 23278478571n,
|
|
113
|
-
ergoTree:
|
|
114
|
-
'0008cd02c1d434dac8765fc1269af82958d8aa350da53907096b35f7747cc372a7e6e69d',
|
|
115
|
-
creationHeight: 1320705,
|
|
116
|
-
assets: [],
|
|
117
|
-
additionalRegisters: {},
|
|
118
|
-
boxId:
|
|
119
|
-
'70b5811a0678f7e634dcff9b862467f2b5620f2a4e4ffd5a6a37f331b9194c68',
|
|
120
|
-
},
|
|
121
|
-
],
|
|
122
|
-
inputs: [
|
|
123
|
-
{
|
|
124
|
-
boxId:
|
|
125
|
-
'be50cf8b4bf156e082c1f48199811cec081b123834422ac64e9659b36bc029f2',
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
boxId:
|
|
129
|
-
'b6db0c5629850b62a58a9c0dae956e1ce14438f5d48ca75c3e55e60df17836cb',
|
|
130
|
-
},
|
|
131
|
-
],
|
|
132
|
-
dataInputs: [
|
|
133
|
-
{
|
|
134
|
-
boxId:
|
|
135
|
-
'56b8b7c2ae45876ec9a79c575d66f6be1ead5498879f08df00b40daa62ae1b94',
|
|
136
|
-
},
|
|
137
|
-
],
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
id: '41d16484deab78069aaa2fa7bce4797f55768bde4687d4357ac502e086d26d08',
|
|
141
|
-
inclusionHeight: 1320705,
|
|
142
|
-
blockId: 'b861e2134821fcf1fcdad7e6edd56c4e4495b42b2fd72762a4c79ed1db78b44b',
|
|
143
|
-
outputs: [
|
|
144
|
-
{
|
|
145
|
-
transactionId:
|
|
146
|
-
'41d16484deab78069aaa2fa7bce4797f55768bde4687d4357ac502e086d26d08',
|
|
147
|
-
index: 0,
|
|
148
|
-
value: 1000000n,
|
|
149
|
-
ergoTree:
|
|
150
|
-
'100504000400050004000e20011d3364de07e5a26f0c4eef0852cddb387039a921b7154ef3cab22c6eda887fd803d601b2a5730000d602e4c6a70407d603b2db6501fe730100ea02d1ededededed93e4c672010407720293e4c67201050ec5720391e4c672010605730293c27201c2a793db63087201db6308a7938cb2db63087203730300017304cd7202',
|
|
151
|
-
creationHeight: 1320701,
|
|
152
|
-
assets: [
|
|
153
|
-
{
|
|
154
|
-
tokenId:
|
|
155
|
-
'8c27dd9d8a35aac1e3167d58858c0a8b4059b277da790552e37eba22df9b9035',
|
|
156
|
-
amount: 1n,
|
|
157
|
-
},
|
|
158
|
-
],
|
|
159
|
-
additionalRegisters: {
|
|
160
|
-
R4: '0702c1d434dac8765fc1269af82958d8aa350da53907096b35f7747cc372a7e6e69d',
|
|
161
|
-
R5: '0e2056b8b7c2ae45876ec9a79c575d66f6be1ead5498879f08df00b40daa62ae1b94',
|
|
162
|
-
R6: '058cee94aa09',
|
|
163
|
-
},
|
|
164
|
-
boxId:
|
|
165
|
-
'be50cf8b4bf156e082c1f48199811cec081b123834422ac64e9659b36bc029f2',
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
transactionId:
|
|
169
|
-
'41d16484deab78069aaa2fa7bce4797f55768bde4687d4357ac502e086d26d08',
|
|
170
|
-
index: 1,
|
|
171
|
-
value: 1500000n,
|
|
172
|
-
ergoTree:
|
|
173
|
-
'1005040004000e36100204a00b08cd0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798ea02d192a39a8cc7a701730073011001020402d19683030193a38cc7b2a57300000193c2b2a57301007473027303830108cdeeac93b1a57304',
|
|
174
|
-
creationHeight: 1320701,
|
|
175
|
-
assets: [],
|
|
176
|
-
additionalRegisters: {},
|
|
177
|
-
boxId:
|
|
178
|
-
'9df85ba11e07c6fa7bd39f74731bb03538d36dedb5874f313bf6b32a3adddaa3',
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
transactionId:
|
|
182
|
-
'41d16484deab78069aaa2fa7bce4797f55768bde4687d4357ac502e086d26d08',
|
|
183
|
-
index: 2,
|
|
184
|
-
value: 3730116410n,
|
|
185
|
-
ergoTree:
|
|
186
|
-
'0008cd02c1d434dac8765fc1269af82958d8aa350da53907096b35f7747cc372a7e6e69d',
|
|
187
|
-
creationHeight: 1320701,
|
|
188
|
-
assets: [],
|
|
189
|
-
additionalRegisters: {},
|
|
190
|
-
boxId:
|
|
191
|
-
'0cf4f4a3638464612dc710ff0c9613e10e23e090bf8ad21f830277fa0a4f4c1b',
|
|
192
|
-
},
|
|
193
|
-
],
|
|
194
|
-
inputs: [
|
|
195
|
-
{
|
|
196
|
-
boxId:
|
|
197
|
-
'3715c953269a829641db0022f3a7ab67917911491c6f363ab863d7ad42785437',
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
boxId:
|
|
201
|
-
'88105776d682d645de57a1aa1569665ebfc57138ca9072c7472274dc0e1f6746',
|
|
202
|
-
},
|
|
203
|
-
],
|
|
204
|
-
dataInputs: [
|
|
205
|
-
{
|
|
206
|
-
boxId:
|
|
207
|
-
'56b8b7c2ae45876ec9a79c575d66f6be1ead5498879f08df00b40daa62ae1b94',
|
|
208
|
-
},
|
|
209
|
-
],
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
id: '0fbd5c82dc0a4316a40a9d1de4f0949c503b39c5fe0e3e113e26d43558285ef7',
|
|
213
|
-
inclusionHeight: 1320698,
|
|
214
|
-
blockId: '92eaff11a4a1c29b8654473258f9d837e9ce99fc0a8a4f27c484d5871afcde64',
|
|
215
|
-
outputs: [
|
|
216
|
-
{
|
|
217
|
-
transactionId:
|
|
218
|
-
'0fbd5c82dc0a4316a40a9d1de4f0949c503b39c5fe0e3e113e26d43558285ef7',
|
|
219
|
-
index: 0,
|
|
220
|
-
value: 1000000n,
|
|
221
|
-
ergoTree:
|
|
222
|
-
'100504000400050004000e20011d3364de07e5a26f0c4eef0852cddb387039a921b7154ef3cab22c6eda887fd803d601b2a5730000d602e4c6a70407d603b2db6501fe730100ea02d1ededededed93e4c672010407720293e4c67201050ec5720391e4c672010605730293c27201c2a793db63087201db6308a7938cb2db63087203730300017304cd7202',
|
|
223
|
-
creationHeight: 1320696,
|
|
224
|
-
assets: [
|
|
225
|
-
{
|
|
226
|
-
tokenId:
|
|
227
|
-
'8c27dd9d8a35aac1e3167d58858c0a8b4059b277da790552e37eba22df9b9035',
|
|
228
|
-
amount: 1n,
|
|
229
|
-
},
|
|
230
|
-
],
|
|
231
|
-
additionalRegisters: {
|
|
232
|
-
R4: '0702c1d434dac8765fc1269af82958d8aa350da53907096b35f7747cc372a7e6e69d',
|
|
233
|
-
R5: '0e2056b8b7c2ae45876ec9a79c575d66f6be1ead5498879f08df00b40daa62ae1b94',
|
|
234
|
-
R6: '058cee94aa09',
|
|
235
|
-
},
|
|
236
|
-
boxId:
|
|
237
|
-
'3715c953269a829641db0022f3a7ab67917911491c6f363ab863d7ad42785437',
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
transactionId:
|
|
241
|
-
'0fbd5c82dc0a4316a40a9d1de4f0949c503b39c5fe0e3e113e26d43558285ef7',
|
|
242
|
-
index: 1,
|
|
243
|
-
value: 1500000n,
|
|
244
|
-
ergoTree:
|
|
245
|
-
'1005040004000e36100204a00b08cd0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798ea02d192a39a8cc7a701730073011001020402d19683030193a38cc7b2a57300000193c2b2a57301007473027303830108cdeeac93b1a57304',
|
|
246
|
-
creationHeight: 1320696,
|
|
247
|
-
assets: [],
|
|
248
|
-
additionalRegisters: {},
|
|
249
|
-
boxId:
|
|
250
|
-
'ef31d4cea3cd9fa960d254d07742d759cf4076690d0fd1ffe442912bc8a0fb18',
|
|
251
|
-
},
|
|
252
|
-
{
|
|
253
|
-
transactionId:
|
|
254
|
-
'0fbd5c82dc0a4316a40a9d1de4f0949c503b39c5fe0e3e113e26d43558285ef7',
|
|
255
|
-
index: 2,
|
|
256
|
-
value: 23279978571n,
|
|
257
|
-
ergoTree:
|
|
258
|
-
'0008cd02c1d434dac8765fc1269af82958d8aa350da53907096b35f7747cc372a7e6e69d',
|
|
259
|
-
creationHeight: 1320696,
|
|
260
|
-
assets: [],
|
|
261
|
-
additionalRegisters: {},
|
|
262
|
-
boxId:
|
|
263
|
-
'b6db0c5629850b62a58a9c0dae956e1ce14438f5d48ca75c3e55e60df17836cb',
|
|
264
|
-
},
|
|
265
|
-
],
|
|
266
|
-
inputs: [
|
|
267
|
-
{
|
|
268
|
-
boxId:
|
|
269
|
-
'55cec880dcdce1c914de20a1fcaf949a76f1e5e5b2d474e351c9d11f2a00472c',
|
|
270
|
-
},
|
|
271
|
-
{
|
|
272
|
-
boxId:
|
|
273
|
-
'111d487d65d5ad5f715a6e0ff1bbd588596f73f7d8394eb7f50f1d278e482b88',
|
|
274
|
-
},
|
|
275
|
-
],
|
|
276
|
-
dataInputs: [
|
|
277
|
-
{
|
|
278
|
-
boxId:
|
|
279
|
-
'56b8b7c2ae45876ec9a79c575d66f6be1ead5498879f08df00b40daa62ae1b94',
|
|
280
|
-
},
|
|
281
|
-
],
|
|
282
|
-
},
|
|
283
|
-
];
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import ergoExplorerClientFactory from '@rosen-clients/ergo-explorer';
|
|
2
|
-
import { omit } from 'lodash-es';
|
|
3
|
-
|
|
4
|
-
import { ExplorerNetwork } from '../../lib';
|
|
5
|
-
import {
|
|
6
|
-
convertedBox,
|
|
7
|
-
explorerBox,
|
|
8
|
-
explorerTxInfo,
|
|
9
|
-
convertedTx,
|
|
10
|
-
explorerTx,
|
|
11
|
-
explorerBlockTx,
|
|
12
|
-
} from './testData';
|
|
13
|
-
|
|
14
|
-
vitest.mock('@rosen-clients/ergo-explorer');
|
|
15
|
-
|
|
16
|
-
describe('ExplorerNetwork', () => {
|
|
17
|
-
describe('convertBox', () => {
|
|
18
|
-
/**
|
|
19
|
-
* @target covertBox should properly convert explorer api box to ergo box
|
|
20
|
-
* @dependencies
|
|
21
|
-
* @scenario
|
|
22
|
-
* - mock getApiV1TransactionsP1 to return spending transaction
|
|
23
|
-
* - run test (call `covertBox`)
|
|
24
|
-
* @expected
|
|
25
|
-
* - to convert box properly
|
|
26
|
-
*/
|
|
27
|
-
it('should properly convert explorer api box to ergo box', async () => {
|
|
28
|
-
vitest.mocked(ergoExplorerClientFactory).mockReturnValue({
|
|
29
|
-
v1: {
|
|
30
|
-
getApiV1TransactionsP1: async () => explorerTxInfo,
|
|
31
|
-
},
|
|
32
|
-
} as unknown as ReturnType<typeof ergoExplorerClientFactory>);
|
|
33
|
-
const explorerNetwork = new ExplorerNetwork('explorer_url');
|
|
34
|
-
const ergoBox = await explorerNetwork['convertBox'](explorerBox);
|
|
35
|
-
expect(ergoBox).toEqual(convertedBox);
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
describe('convertTransaction', () => {
|
|
40
|
-
/**
|
|
41
|
-
* @target convertTransaction should properly convert explorer api tx to
|
|
42
|
-
* extractor transaction
|
|
43
|
-
* @dependencies
|
|
44
|
-
* @scenario
|
|
45
|
-
* - run test (call `convertTransaction`)
|
|
46
|
-
* @expected
|
|
47
|
-
* - to convert tx properly
|
|
48
|
-
*/
|
|
49
|
-
it('should properly convert explorer api tx to extractor transaction', async () => {
|
|
50
|
-
const explorerNetwork = new ExplorerNetwork('explorer_url');
|
|
51
|
-
const tx = await explorerNetwork['convertTransaction'](explorerTx);
|
|
52
|
-
expect(tx).toEqual(convertedTx);
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
describe('convertBlockTransaction', () => {
|
|
57
|
-
/**
|
|
58
|
-
* @target convertBlockTransaction should properly convert explorer api tx to
|
|
59
|
-
* transaction type
|
|
60
|
-
* @dependencies
|
|
61
|
-
* @scenario
|
|
62
|
-
* - run test (call `convertBlockTransaction`)
|
|
63
|
-
* @expected
|
|
64
|
-
* - to convert tx properly
|
|
65
|
-
*/
|
|
66
|
-
it('should properly convert explorer api tx to transaction type', async () => {
|
|
67
|
-
const explorerNetwork = new ExplorerNetwork('explorer_url');
|
|
68
|
-
const tx =
|
|
69
|
-
await explorerNetwork['convertBlockTransaction'](explorerBlockTx);
|
|
70
|
-
expect(tx).toEqual(omit(convertedTx, ['blockId', 'inclusionHeight']));
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
});
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import ergoNodeClientFactory from '@rosen-clients/ergo-node';
|
|
2
|
-
|
|
3
|
-
import { NodeNetwork } from '../../lib';
|
|
4
|
-
import {
|
|
5
|
-
convertedBox,
|
|
6
|
-
nodeBox,
|
|
7
|
-
nodeSpendingTxInfo,
|
|
8
|
-
nodeCreationTxInfo,
|
|
9
|
-
nodeTx,
|
|
10
|
-
convertedTx,
|
|
11
|
-
} from './testData';
|
|
12
|
-
|
|
13
|
-
vitest.mock('@rosen-clients/ergo-node');
|
|
14
|
-
|
|
15
|
-
describe('NodeNetwork', () => {
|
|
16
|
-
describe('convertBox', () => {
|
|
17
|
-
/**
|
|
18
|
-
* @target covertBox should properly convert node api box to ergo box
|
|
19
|
-
* @dependencies
|
|
20
|
-
* @scenario
|
|
21
|
-
* - mock getTxById to return creation and spending transaction
|
|
22
|
-
* - run test (call `covertBox`)
|
|
23
|
-
* @expected
|
|
24
|
-
* - to convert box properly
|
|
25
|
-
*/
|
|
26
|
-
it('should properly convert node api box to ergo box', async () => {
|
|
27
|
-
vitest.mocked(ergoNodeClientFactory).mockReturnValue({
|
|
28
|
-
getTxById: async (txId: string) => {
|
|
29
|
-
if (txId == nodeSpendingTxInfo.id) return nodeSpendingTxInfo;
|
|
30
|
-
else return nodeCreationTxInfo;
|
|
31
|
-
},
|
|
32
|
-
} as unknown as ReturnType<typeof ergoNodeClientFactory>);
|
|
33
|
-
const nodeNetwork = new NodeNetwork('node_url');
|
|
34
|
-
const ergoBox = await nodeNetwork['convertBox'](nodeBox);
|
|
35
|
-
expect(ergoBox).toEqual(convertedBox);
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
describe('convertTransaction', () => {
|
|
40
|
-
/**
|
|
41
|
-
* @target convertTransaction should properly convert node api tx to
|
|
42
|
-
* extractor transaction
|
|
43
|
-
* @dependencies
|
|
44
|
-
* @scenario
|
|
45
|
-
* - mock getTxById to return creation and spending transaction
|
|
46
|
-
* - run test (call `convertTransaction`)
|
|
47
|
-
* @expected
|
|
48
|
-
* - to convert tx properly
|
|
49
|
-
*/
|
|
50
|
-
it('should properly convert node api tx to extractor transaction', async () => {
|
|
51
|
-
const nodeNetwork = new NodeNetwork('node_url');
|
|
52
|
-
const tx = await nodeNetwork['convertTransaction'](nodeTx);
|
|
53
|
-
expect(tx).toEqual(convertedTx);
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
});
|