@subql/common-stellar 2.2.1-1 → 2.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/dist/.tsbuildinfo +1 -1
- package/dist/project/models.d.ts +44 -3
- package/dist/project/models.js +143 -1
- package/dist/project/models.js.map +1 -1
- package/dist/project/project.spec.js +25 -1
- package/dist/project/project.spec.js.map +1 -1
- package/dist/project/types.d.ts +2 -1
- package/dist/project/types.js.map +1 -1
- package/dist/project/utils.d.ts +5 -0
- package/dist/project/utils.js +21 -1
- package/dist/project/utils.js.map +1 -1
- package/dist/project/versioned/v1_0_0/model.d.ts +1 -0
- package/dist/project/versioned/v1_0_0/model.js +5 -0
- package/dist/project/versioned/v1_0_0/model.js.map +1 -1
- package/package.json +5 -4
- package/src/project/models.ts +112 -3
- package/src/project/project.spec.ts +31 -1
- package/src/project/types.ts +5 -1
- package/src/project/utils.ts +30 -0
- package/src/project/versioned/v1_0_0/model.ts +3 -0
- package/test/project_1.0.0.yaml +15 -1
|
@@ -23,13 +23,43 @@ describe('project.yaml', () => {
|
|
|
23
23
|
expect(() => loadStellarProjectManifest(path.join(projectsDir, 'project_1.0.0.yaml'))).not.toThrow();
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
it('get v1.0.0 deployment mapping filter', () => {
|
|
26
|
+
it('get v1.0.0 deployment mapping filter - transaction', () => {
|
|
27
27
|
const manifestVersioned = loadStellarProjectManifest(path.join(projectsDir, 'project_1.0.0.yaml'));
|
|
28
28
|
|
|
29
29
|
const deployment = manifestVersioned.asV1_0_0.deployment;
|
|
30
30
|
const filter = deployment.dataSources[0].mapping.handlers[0].filter;
|
|
31
31
|
const deploymentString = manifestVersioned.toDeployment();
|
|
32
32
|
expect(filter).not.toBeNull();
|
|
33
|
+
expect(deploymentString).toContain('account');
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('get v1.0.0 deployment mapping filter - operation', () => {
|
|
37
|
+
const manifestVersioned = loadStellarProjectManifest(path.join(projectsDir, 'project_1.0.0.yaml'));
|
|
38
|
+
|
|
39
|
+
const deployment = manifestVersioned.asV1_0_0.deployment;
|
|
40
|
+
const filter = deployment.dataSources[0].mapping.handlers[1].filter;
|
|
41
|
+
const deploymentString = manifestVersioned.toDeployment();
|
|
42
|
+
expect(filter).not.toBeNull();
|
|
43
|
+
expect(deploymentString).toContain('account_merge');
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('get v1.0.0 deployment mapping filter - effect', () => {
|
|
47
|
+
const manifestVersioned = loadStellarProjectManifest(path.join(projectsDir, 'project_1.0.0.yaml'));
|
|
48
|
+
|
|
49
|
+
const deployment = manifestVersioned.asV1_0_0.deployment;
|
|
50
|
+
const filter = deployment.dataSources[0].mapping.handlers[2].filter;
|
|
51
|
+
const deploymentString = manifestVersioned.toDeployment();
|
|
52
|
+
expect(filter).not.toBeNull();
|
|
53
|
+
expect(deploymentString).toContain('account_credited');
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('get v1.0.0 deployment mapping filter - events', () => {
|
|
57
|
+
const manifestVersioned = loadStellarProjectManifest(path.join(projectsDir, 'project_1.0.0.yaml'));
|
|
58
|
+
|
|
59
|
+
const deployment = manifestVersioned.asV1_0_0.deployment;
|
|
60
|
+
const filter = deployment.dataSources[0].mapping.handlers[3].filter;
|
|
61
|
+
const deploymentString = manifestVersioned.toDeployment();
|
|
62
|
+
expect(filter).not.toBeNull();
|
|
33
63
|
expect(deploymentString).toContain('COUNTER');
|
|
34
64
|
});
|
|
35
65
|
|
package/src/project/types.ts
CHANGED
|
@@ -13,7 +13,10 @@ export {
|
|
|
13
13
|
StellarHandlerKind,
|
|
14
14
|
SubqlDatasource as SubqlStellarDataSource,
|
|
15
15
|
SubqlCustomDatasource as SubqlStellarCustomDataSource,
|
|
16
|
-
|
|
16
|
+
StellarBlockFilter,
|
|
17
|
+
StellarTransactionFilter,
|
|
18
|
+
StellarOperationFilter,
|
|
19
|
+
StellarEffectFilter,
|
|
17
20
|
SubqlDatasourceProcessor,
|
|
18
21
|
SubqlHandlerFilter,
|
|
19
22
|
StellarDatasourceKind,
|
|
@@ -25,4 +28,5 @@ export type IStellarProjectManifest = IProjectManifest<SubqlDatasource>;
|
|
|
25
28
|
export interface StellarProjectNetworkConfig extends ProjectNetworkConfig {
|
|
26
29
|
genesisHash?: string;
|
|
27
30
|
chainId?: string;
|
|
31
|
+
soroban: string;
|
|
28
32
|
}
|
package/src/project/utils.ts
CHANGED
|
@@ -10,6 +10,36 @@ import {
|
|
|
10
10
|
SubqlRuntimeDatasource,
|
|
11
11
|
} from '@subql/types-stellar';
|
|
12
12
|
|
|
13
|
+
export function isBlockHandlerProcessor<B>(
|
|
14
|
+
hp: SecondLayerHandlerProcessor<StellarHandlerKind, unknown, unknown>
|
|
15
|
+
): hp is SecondLayerHandlerProcessor<StellarHandlerKind.Block, unknown, B> {
|
|
16
|
+
return hp.baseHandlerKind === StellarHandlerKind.Block;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function isTransactionHandlerProcessor<T>(
|
|
20
|
+
hp: SecondLayerHandlerProcessor<StellarHandlerKind, unknown, unknown>
|
|
21
|
+
): hp is SecondLayerHandlerProcessor<StellarHandlerKind.Transaction, unknown, T> {
|
|
22
|
+
return hp.baseHandlerKind === StellarHandlerKind.Transaction;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function isSorobanTransactionHandlerProcessor<T>(
|
|
26
|
+
hp: SecondLayerHandlerProcessor<StellarHandlerKind, unknown, unknown>
|
|
27
|
+
): hp is SecondLayerHandlerProcessor<StellarHandlerKind.SorobanTransaction, unknown, T> {
|
|
28
|
+
return hp.baseHandlerKind === StellarHandlerKind.SorobanTransaction;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function isOperationHandlerProcessor<O>(
|
|
32
|
+
hp: SecondLayerHandlerProcessor<StellarHandlerKind, unknown, unknown>
|
|
33
|
+
): hp is SecondLayerHandlerProcessor<StellarHandlerKind.Operation, unknown, O> {
|
|
34
|
+
return hp.baseHandlerKind === StellarHandlerKind.Operation;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function isEffectHandlerProcessor<E>(
|
|
38
|
+
hp: SecondLayerHandlerProcessor<StellarHandlerKind, unknown, unknown>
|
|
39
|
+
): hp is SecondLayerHandlerProcessor<StellarHandlerKind.Effects, unknown, E> {
|
|
40
|
+
return hp.baseHandlerKind === StellarHandlerKind.Effects;
|
|
41
|
+
}
|
|
42
|
+
|
|
13
43
|
export function isEventHandlerProcessor<E>(
|
|
14
44
|
hp: SecondLayerHandlerProcessor<StellarHandlerKind, unknown, unknown>
|
|
15
45
|
): hp is SecondLayerHandlerProcessor<StellarHandlerKind.Event, unknown, E> {
|
package/test/project_1.0.0.yaml
CHANGED
|
@@ -25,8 +25,22 @@ dataSources:
|
|
|
25
25
|
mapping:
|
|
26
26
|
file: './dist/index.js'
|
|
27
27
|
handlers:
|
|
28
|
+
- handler: handleTransaction
|
|
29
|
+
kind: stellar/TransactionHandler
|
|
30
|
+
filter:
|
|
31
|
+
account: 'GAKNXHJ5PCZYFIBNBWB4RCQHH6GDEO7Z334N74BOQUQCHKOURQEPMXCH'
|
|
32
|
+
- handler: handleOperation
|
|
33
|
+
kind: stellar/OperationHandler
|
|
34
|
+
filter:
|
|
35
|
+
source_account: 'GAKNXHJ5PCZYFIBNBWB4RCQHH6GDEO7Z334N74BOQUQCHKOURQEPMXCH'
|
|
36
|
+
type: 'account_merge'
|
|
37
|
+
- handler: handleEffect
|
|
38
|
+
kind: stellar/EffectHandler
|
|
39
|
+
filter:
|
|
40
|
+
type: 'account_credited'
|
|
41
|
+
account: 'GAKNXHJ5PCZYFIBNBWB4RCQHH6GDEO7Z334N74BOQUQCHKOURQEPMXCH'
|
|
28
42
|
- handler: handleEvent
|
|
29
|
-
kind:
|
|
43
|
+
kind: soroban/EventHandler
|
|
30
44
|
filter:
|
|
31
45
|
contractId: '34799b3411940249e73d21def8eb2c2b56b285ab8d1ca76d6780ec10a0e8f02e'
|
|
32
46
|
topics:
|