@sentio/sdk 2.35.1-rc.1 → 2.36.0-rc.1
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.
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"aptos-plugin.d.ts","sourceRoot":"","sources":["../../src/aptos/aptos-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"aptos-plugin.d.ts","sourceRoot":"","sources":["../../src/aptos/aptos-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmD,MAAM,EAAiC,MAAM,iBAAiB,CAAA;AACxH,OAAO,EAGL,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,WAAW,EAIX,qBAAqB,EACrB,aAAa,EACb,YAAY,EACb,MAAM,gBAAgB,CAAA;AAevB,UAAU,QAAQ;IAChB,kBAAkB,EAAE,CAAC,CAAC,KAAK,EAAE,aAAa,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC,EAAE,CAAA;IACxE,iBAAiB,EAAE,CAAC,CAAC,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC,EAAE,CAAA;IACrE,qBAAqB,EAAE,CAAC,CAAC,mBAAmB,EAAE,gBAAgB,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC,EAAE,CAAA;CAC7F;AACD,qBAAa,WAAY,SAAQ,MAAM;IACrC,IAAI,EAAE,MAAM,CAAgB;IAC5B,QAAQ,EAAE,QAAQ,CAIjB;IAEK,KAAK,CAAC,OAAO,EAAE,YAAY;IAuB3B,SAAS,CAAC,MAAM,EAAE,qBAAqB;IAiF7C,iBAAiB,gBAA0E;IAErF,cAAc,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC;IAa5D,iBAAiB,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC;IAsB/D,oBAAoB,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC;IAsBlE,wBAAwB,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC;CAmB7E"}
|
@@ -1,18 +1,18 @@
|
|
1
|
-
import { errorString, mergeProcessResults, Plugin, PluginManager, USER_PROCESSOR } from '@sentio/runtime';
|
2
|
-
import { AccountConfig, ContractConfig, HandlerType, MoveOwnerType
|
1
|
+
import { errorString, GLOBAL_CONFIG, mergeProcessResults, Plugin, PluginManager, USER_PROCESSOR } from '@sentio/runtime';
|
2
|
+
import { AccountConfig, ContractConfig, HandlerType, MoveOwnerType } from '@sentio/protos';
|
3
3
|
import { ServerError, Status } from 'nice-grpc';
|
4
4
|
import { AptosProcessorState, AptosResourceProcessorState } from './aptos-processor.js';
|
5
5
|
import { initCoinList } from './ext/coin.js';
|
6
6
|
import { AptosChainId } from '@sentio/chain';
|
7
7
|
import { AptosResourcesContext } from './context.js';
|
8
|
-
import { AptosResourceProcessorTemplateState
|
8
|
+
import { AptosResourceProcessorTemplateState } from './aptos-resource-processor-template.js';
|
9
9
|
import { AptosNetwork } from './network.js';
|
10
10
|
export class AptosPlugin extends Plugin {
|
11
11
|
name = 'AptosPlugin';
|
12
12
|
handlers = {
|
13
13
|
aptosEventHandlers: [],
|
14
14
|
aptosCallHandlers: [],
|
15
|
-
aptosResourceHandlers: []
|
15
|
+
aptosResourceHandlers: []
|
16
16
|
};
|
17
17
|
async start(request) {
|
18
18
|
await initCoinList();
|
@@ -25,7 +25,7 @@ export class AptosPlugin extends Plugin {
|
|
25
25
|
template.bind({
|
26
26
|
address: instance.contract?.address || '',
|
27
27
|
network: instance.contract?.chainId || AptosNetwork.MAIN_NET,
|
28
|
-
startVersion: instance.startBlock || 0n
|
28
|
+
startVersion: instance.startBlock || 0n
|
29
29
|
}, NoopContext);
|
30
30
|
}
|
31
31
|
}
|
@@ -33,7 +33,7 @@ export class AptosPlugin extends Plugin {
|
|
33
33
|
const handlers = {
|
34
34
|
aptosEventHandlers: [],
|
35
35
|
aptosCallHandlers: [],
|
36
|
-
aptosResourceHandlers: []
|
36
|
+
aptosResourceHandlers: []
|
37
37
|
};
|
38
38
|
for (const aptosProcessor of AptosProcessorState.INSTANCE.getValues()) {
|
39
39
|
const contractConfig = ContractConfig.fromPartial({
|
@@ -42,9 +42,9 @@ export class AptosPlugin extends Plugin {
|
|
42
42
|
name: aptosProcessor.moduleName,
|
43
43
|
chainId: aptosProcessor.getChainId(),
|
44
44
|
address: aptosProcessor.config.address,
|
45
|
-
abi: ''
|
45
|
+
abi: ''
|
46
46
|
},
|
47
|
-
startBlock: aptosProcessor.config.startVersion
|
47
|
+
startBlock: aptosProcessor.config.startVersion
|
48
48
|
});
|
49
49
|
// 1. Prepare event handlers
|
50
50
|
for (const handler of aptosProcessor.eventHandlers) {
|
@@ -53,11 +53,11 @@ export class AptosPlugin extends Plugin {
|
|
53
53
|
filters: handler.filters.map((f) => {
|
54
54
|
return {
|
55
55
|
type: f.type,
|
56
|
-
account: f.account || ''
|
56
|
+
account: f.account || ''
|
57
57
|
};
|
58
58
|
}),
|
59
59
|
fetchConfig: handler.fetchConfig,
|
60
|
-
handlerId
|
60
|
+
handlerId
|
61
61
|
};
|
62
62
|
contractConfig.moveEventConfigs.push(eventHandlerConfig);
|
63
63
|
}
|
@@ -71,11 +71,11 @@ export class AptosPlugin extends Plugin {
|
|
71
71
|
typeArguments: filter.typeArguments || [],
|
72
72
|
withTypeArguments: !!filter.typeArguments,
|
73
73
|
includeFailed: filter.includeFailed || false,
|
74
|
-
publicKeyPrefix: filter.publicKeyPrefix || ''
|
74
|
+
publicKeyPrefix: filter.publicKeyPrefix || ''
|
75
75
|
};
|
76
76
|
}),
|
77
77
|
fetchConfig: handler.fetchConfig,
|
78
|
-
handlerId
|
78
|
+
handlerId
|
79
79
|
};
|
80
80
|
contractConfig.moveCallConfigs.push(functionHandlerConfig);
|
81
81
|
}
|
@@ -85,7 +85,7 @@ export class AptosPlugin extends Plugin {
|
|
85
85
|
const accountConfig = AccountConfig.fromPartial({
|
86
86
|
address: aptosProcessor.config.address,
|
87
87
|
chainId: aptosProcessor.getChainId(),
|
88
|
-
startBlock: aptosProcessor.config.startVersion
|
88
|
+
startBlock: aptosProcessor.config.startVersion
|
89
89
|
});
|
90
90
|
for (const handler of aptosProcessor.resourcesHandlers) {
|
91
91
|
const handlerId = handlers.aptosResourceHandlers.push(handler.handler) - 1;
|
@@ -96,11 +96,11 @@ export class AptosPlugin extends Plugin {
|
|
96
96
|
minutesInterval: handler.timeIntervalInMinutes,
|
97
97
|
slot: 0,
|
98
98
|
slotInterval: handler.versionInterval,
|
99
|
-
fetchConfig: undefined
|
99
|
+
fetchConfig: undefined
|
100
100
|
},
|
101
101
|
type: handler.type || '',
|
102
102
|
ownerType: MoveOwnerType.ADDRESS,
|
103
|
-
fetchConfig: undefined
|
103
|
+
fetchConfig: undefined
|
104
104
|
});
|
105
105
|
}
|
106
106
|
config.accountConfigs.push(accountConfig);
|
@@ -127,10 +127,13 @@ export class AptosPlugin extends Plugin {
|
|
127
127
|
const promises = [];
|
128
128
|
const event = binding.data.aptEvent;
|
129
129
|
for (const handlerId of binding.handlerIds) {
|
130
|
-
|
131
|
-
promises.push(this.handlers.aptosEventHandlers[handlerId](event).catch((e) => {
|
130
|
+
const promise = this.handlers.aptosEventHandlers[handlerId](event).catch((e) => {
|
132
131
|
throw new ServerError(Status.INTERNAL, 'error processing event: ' + JSON.stringify(event) + '\n' + errorString(e));
|
133
|
-
})
|
132
|
+
});
|
133
|
+
if (GLOBAL_CONFIG.execution.sequential) {
|
134
|
+
await promise;
|
135
|
+
}
|
136
|
+
promises.push(promise);
|
134
137
|
}
|
135
138
|
return mergeProcessResults(await Promise.all(promises));
|
136
139
|
}
|
@@ -141,9 +144,13 @@ export class AptosPlugin extends Plugin {
|
|
141
144
|
const resource = binding.data.aptResource;
|
142
145
|
const promises = [];
|
143
146
|
for (const handlerId of binding.handlerIds) {
|
144
|
-
|
147
|
+
const promise = this.handlers.aptosResourceHandlers[handlerId](resource).catch((e) => {
|
145
148
|
throw new ServerError(Status.INTERNAL, 'error processing resource: ' + JSON.stringify(resource) + '\n' + errorString(e));
|
146
|
-
})
|
149
|
+
});
|
150
|
+
if (GLOBAL_CONFIG.execution.sequential) {
|
151
|
+
await promise;
|
152
|
+
}
|
153
|
+
promises.push(promise);
|
147
154
|
}
|
148
155
|
return mergeProcessResults(await Promise.all(promises));
|
149
156
|
}
|
@@ -158,6 +165,9 @@ export class AptosPlugin extends Plugin {
|
|
158
165
|
const promise = this.handlers.aptosCallHandlers[handlerId](call).catch((e) => {
|
159
166
|
throw new ServerError(Status.INTERNAL, 'error processing call: ' + JSON.stringify(call) + '\n' + errorString(e));
|
160
167
|
});
|
168
|
+
if (GLOBAL_CONFIG.execution.sequential) {
|
169
|
+
await promise;
|
170
|
+
}
|
161
171
|
promises.push(promise);
|
162
172
|
}
|
163
173
|
return mergeProcessResults(await Promise.all(promises));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"aptos-plugin.js","sourceRoot":"","sources":["../../src/aptos/aptos-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;
|
1
|
+
{"version":3,"file":"aptos-plugin.js","sourceRoot":"","sources":["../../src/aptos/aptos-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AACxH,OAAO,EACL,aAAa,EACb,cAAc,EAKd,WAAW,EAGX,aAAa,EAId,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAE/C,OAAO,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAA;AAEvF,OAAO,EAAE,YAAY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,QAAQ,CAAC,QAAQ,CAAC,IAAI,WAAW,EAAE,CAAC,CAAA;AAElD,MAAM,WAAW,GAAG,IAAI,qBAAqB,CAAC,YAAY,CAAC,aAAa,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAA"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sentio/sdk",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.36.0-rc.1",
|
4
4
|
"license": "Apache-2.0",
|
5
5
|
"type": "module",
|
6
6
|
"exports": {
|
@@ -77,8 +77,8 @@
|
|
77
77
|
"typedoc": "^0.25.7",
|
78
78
|
"utility-types": "^3.11.0",
|
79
79
|
"yaml": "^2.3.4",
|
80
|
-
"@sentio/protos": "2.
|
81
|
-
"@sentio/runtime": "^2.
|
80
|
+
"@sentio/protos": "2.36.0-rc.1",
|
81
|
+
"@sentio/runtime": "^2.36.0-rc.1"
|
82
82
|
},
|
83
83
|
"peerDependencies": {
|
84
84
|
"tsup": "npm:@sentio/tsup@^6.7.2"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { errorString, mergeProcessResults, Plugin, PluginManager, USER_PROCESSOR } from '@sentio/runtime'
|
1
|
+
import { errorString, GLOBAL_CONFIG, mergeProcessResults, Plugin, PluginManager, USER_PROCESSOR } from '@sentio/runtime'
|
2
2
|
import {
|
3
3
|
AccountConfig,
|
4
4
|
ContractConfig,
|
@@ -12,7 +12,7 @@ import {
|
|
12
12
|
MoveOwnerType,
|
13
13
|
ProcessConfigResponse,
|
14
14
|
ProcessResult,
|
15
|
-
StartRequest
|
15
|
+
StartRequest
|
16
16
|
} from '@sentio/protos'
|
17
17
|
|
18
18
|
import { ServerError, Status } from 'nice-grpc'
|
@@ -24,7 +24,7 @@ import { AptosChainId } from '@sentio/chain'
|
|
24
24
|
import { AptosResourcesContext } from './context.js'
|
25
25
|
import {
|
26
26
|
AptosResourceProcessorTemplate,
|
27
|
-
AptosResourceProcessorTemplateState
|
27
|
+
AptosResourceProcessorTemplateState
|
28
28
|
} from './aptos-resource-processor-template.js'
|
29
29
|
import { AptosNetwork } from './network.js'
|
30
30
|
|
@@ -38,7 +38,7 @@ export class AptosPlugin extends Plugin {
|
|
38
38
|
handlers: Handlers = {
|
39
39
|
aptosEventHandlers: [],
|
40
40
|
aptosCallHandlers: [],
|
41
|
-
aptosResourceHandlers: []
|
41
|
+
aptosResourceHandlers: []
|
42
42
|
}
|
43
43
|
|
44
44
|
async start(request: StartRequest) {
|
@@ -57,7 +57,7 @@ export class AptosPlugin extends Plugin {
|
|
57
57
|
{
|
58
58
|
address: instance.contract?.address || '',
|
59
59
|
network: <AptosNetwork>instance.contract?.chainId || AptosNetwork.MAIN_NET,
|
60
|
-
startVersion: instance.startBlock || 0n
|
60
|
+
startVersion: instance.startBlock || 0n
|
61
61
|
},
|
62
62
|
NoopContext
|
63
63
|
)
|
@@ -68,7 +68,7 @@ export class AptosPlugin extends Plugin {
|
|
68
68
|
const handlers: Handlers = {
|
69
69
|
aptosEventHandlers: [],
|
70
70
|
aptosCallHandlers: [],
|
71
|
-
aptosResourceHandlers: []
|
71
|
+
aptosResourceHandlers: []
|
72
72
|
}
|
73
73
|
for (const aptosProcessor of AptosProcessorState.INSTANCE.getValues()) {
|
74
74
|
const contractConfig = ContractConfig.fromPartial({
|
@@ -77,9 +77,9 @@ export class AptosPlugin extends Plugin {
|
|
77
77
|
name: aptosProcessor.moduleName,
|
78
78
|
chainId: aptosProcessor.getChainId(),
|
79
79
|
address: aptosProcessor.config.address,
|
80
|
-
abi: ''
|
80
|
+
abi: ''
|
81
81
|
},
|
82
|
-
startBlock: aptosProcessor.config.startVersion
|
82
|
+
startBlock: aptosProcessor.config.startVersion
|
83
83
|
})
|
84
84
|
// 1. Prepare event handlers
|
85
85
|
for (const handler of aptosProcessor.eventHandlers) {
|
@@ -88,11 +88,11 @@ export class AptosPlugin extends Plugin {
|
|
88
88
|
filters: handler.filters.map((f) => {
|
89
89
|
return {
|
90
90
|
type: f.type,
|
91
|
-
account: f.account || ''
|
91
|
+
account: f.account || ''
|
92
92
|
}
|
93
93
|
}),
|
94
94
|
fetchConfig: handler.fetchConfig,
|
95
|
-
handlerId
|
95
|
+
handlerId
|
96
96
|
}
|
97
97
|
contractConfig.moveEventConfigs.push(eventHandlerConfig)
|
98
98
|
}
|
@@ -107,11 +107,11 @@ export class AptosPlugin extends Plugin {
|
|
107
107
|
typeArguments: filter.typeArguments || [],
|
108
108
|
withTypeArguments: !!filter.typeArguments,
|
109
109
|
includeFailed: filter.includeFailed || false,
|
110
|
-
publicKeyPrefix: filter.publicKeyPrefix || ''
|
110
|
+
publicKeyPrefix: filter.publicKeyPrefix || ''
|
111
111
|
}
|
112
112
|
}),
|
113
113
|
fetchConfig: handler.fetchConfig,
|
114
|
-
handlerId
|
114
|
+
handlerId
|
115
115
|
}
|
116
116
|
contractConfig.moveCallConfigs.push(functionHandlerConfig)
|
117
117
|
}
|
@@ -122,7 +122,7 @@ export class AptosPlugin extends Plugin {
|
|
122
122
|
const accountConfig = AccountConfig.fromPartial({
|
123
123
|
address: aptosProcessor.config.address,
|
124
124
|
chainId: aptosProcessor.getChainId(),
|
125
|
-
startBlock: aptosProcessor.config.startVersion
|
125
|
+
startBlock: aptosProcessor.config.startVersion
|
126
126
|
})
|
127
127
|
for (const handler of aptosProcessor.resourcesHandlers) {
|
128
128
|
const handlerId = handlers.aptosResourceHandlers.push(handler.handler) - 1
|
@@ -133,11 +133,11 @@ export class AptosPlugin extends Plugin {
|
|
133
133
|
minutesInterval: handler.timeIntervalInMinutes,
|
134
134
|
slot: 0,
|
135
135
|
slotInterval: handler.versionInterval,
|
136
|
-
fetchConfig: undefined
|
136
|
+
fetchConfig: undefined
|
137
137
|
},
|
138
138
|
type: handler.type || '',
|
139
139
|
ownerType: MoveOwnerType.ADDRESS,
|
140
|
-
fetchConfig: undefined
|
140
|
+
fetchConfig: undefined
|
141
141
|
})
|
142
142
|
}
|
143
143
|
config.accountConfigs.push(accountConfig)
|
@@ -168,15 +168,16 @@ export class AptosPlugin extends Plugin {
|
|
168
168
|
const event = binding.data.aptEvent
|
169
169
|
|
170
170
|
for (const handlerId of binding.handlerIds) {
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
171
|
+
const promise = this.handlers.aptosEventHandlers[handlerId](event).catch((e) => {
|
172
|
+
throw new ServerError(
|
173
|
+
Status.INTERNAL,
|
174
|
+
'error processing event: ' + JSON.stringify(event) + '\n' + errorString(e)
|
175
|
+
)
|
176
|
+
})
|
177
|
+
if (GLOBAL_CONFIG.execution.sequential) {
|
178
|
+
await promise
|
179
|
+
}
|
180
|
+
promises.push(promise)
|
180
181
|
}
|
181
182
|
return mergeProcessResults(await Promise.all(promises))
|
182
183
|
}
|
@@ -189,14 +190,16 @@ export class AptosPlugin extends Plugin {
|
|
189
190
|
|
190
191
|
const promises: Promise<ProcessResult>[] = []
|
191
192
|
for (const handlerId of binding.handlerIds) {
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
193
|
+
const promise = this.handlers.aptosResourceHandlers[handlerId](resource).catch((e) => {
|
194
|
+
throw new ServerError(
|
195
|
+
Status.INTERNAL,
|
196
|
+
'error processing resource: ' + JSON.stringify(resource) + '\n' + errorString(e)
|
197
|
+
)
|
198
|
+
})
|
199
|
+
if (GLOBAL_CONFIG.execution.sequential) {
|
200
|
+
await promise
|
201
|
+
}
|
202
|
+
promises.push(promise)
|
200
203
|
}
|
201
204
|
return mergeProcessResults(await Promise.all(promises))
|
202
205
|
}
|
@@ -213,6 +216,9 @@ export class AptosPlugin extends Plugin {
|
|
213
216
|
const promise = this.handlers.aptosCallHandlers[handlerId](call).catch((e) => {
|
214
217
|
throw new ServerError(Status.INTERNAL, 'error processing call: ' + JSON.stringify(call) + '\n' + errorString(e))
|
215
218
|
})
|
219
|
+
if (GLOBAL_CONFIG.execution.sequential) {
|
220
|
+
await promise
|
221
|
+
}
|
216
222
|
promises.push(promise)
|
217
223
|
}
|
218
224
|
return mergeProcessResults(await Promise.all(promises))
|