@sentio/sdk 1.26.0 → 1.26.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/lib/aptos/aptos-processor.d.ts +1 -0
- package/lib/aptos/aptos-processor.js +2 -1
- package/lib/aptos/aptos-processor.js.map +1 -1
- package/lib/aptos/context.d.ts +2 -1
- package/lib/aptos/context.js +3 -1
- package/lib/aptos/context.js.map +1 -1
- package/lib/aptos/index.d.ts +1 -1
- package/lib/aptos/index.js +2 -1
- package/lib/aptos/index.js.map +1 -1
- package/lib/aptos-codegen/codegen.js +1 -0
- package/lib/aptos-codegen/codegen.js.map +1 -1
- package/lib/builtin/aptos/0x1.d.ts +171 -0
- package/lib/builtin/aptos/0x1.js +171 -0
- package/lib/builtin/aptos/0x1.js.map +1 -1
- package/lib/builtin/aptos/0x3.d.ts +31 -0
- package/lib/builtin/aptos/0x3.js +31 -0
- package/lib/builtin/aptos/0x3.js.map +1 -1
- package/lib/core/context.d.ts +2 -5
- package/lib/core/context.js +8 -11
- package/lib/core/context.js.map +1 -1
- package/lib/core/event-tracker.js +1 -1
- package/lib/core/event-tracker.js.map +1 -1
- package/lib/core/exporter.d.ts +14 -0
- package/lib/core/exporter.js +27 -0
- package/lib/core/exporter.js.map +1 -0
- package/lib/core/logger.js +1 -1
- package/lib/core/logger.js.map +1 -1
- package/lib/core/meter.js +2 -2
- package/lib/core/meter.js.map +1 -1
- package/lib/gen/processor/protos/processor.d.ts +32 -0
- package/lib/gen/processor/protos/processor.js +206 -3
- package/lib/gen/processor/protos/processor.js.map +1 -1
- package/lib/processor-state.d.ts +2 -0
- package/lib/processor-state.js +1 -0
- package/lib/processor-state.js.map +1 -1
- package/lib/service.d.ts +1 -0
- package/lib/service.js +19 -16
- package/lib/service.js.map +1 -1
- package/lib/tests/erc20.js +7 -0
- package/lib/tests/erc20.js.map +1 -1
- package/lib/tests/types/aptos/souffle.d.ts +14 -0
- package/lib/tests/types/aptos/souffle.js +14 -0
- package/lib/tests/types/aptos/souffle.js.map +1 -1
- package/package.json +1 -1
- package/src/aptos/aptos-processor.ts +7 -1
- package/src/aptos/context.ts +3 -1
- package/src/aptos/index.ts +1 -1
- package/src/aptos-codegen/codegen.ts +1 -0
- package/src/builtin/aptos/0x1.ts +171 -0
- package/src/builtin/aptos/0x3.ts +31 -0
- package/src/core/context.ts +10 -20
- package/src/core/event-tracker.ts +1 -1
- package/src/core/exporter.ts +33 -0
- package/src/core/logger.ts +1 -1
- package/src/core/meter.ts +2 -2
- package/src/gen/processor/protos/processor.ts +250 -1
- package/src/processor-state.ts +3 -0
- package/src/service.ts +21 -18
- package/src/tests/erc20.ts +7 -0
- package/src/tests/types/aptos/souffle.ts +28 -0
package/src/builtin/aptos/0x3.ts
CHANGED
|
@@ -218,6 +218,7 @@ export class token extends aptos.AptosBaseProcessor {
|
|
|
218
218
|
|
|
219
219
|
export namespace token {
|
|
220
220
|
export class BurnTokenEvent {
|
|
221
|
+
static TYPE_NAME = "0x3::token::BurnTokenEvent";
|
|
221
222
|
id: token.TokenId;
|
|
222
223
|
amount: bigint;
|
|
223
224
|
}
|
|
@@ -229,6 +230,7 @@ export namespace token {
|
|
|
229
230
|
}
|
|
230
231
|
|
|
231
232
|
export class CollectionData {
|
|
233
|
+
static TYPE_NAME = "0x3::token::CollectionData";
|
|
232
234
|
description: string;
|
|
233
235
|
name: string;
|
|
234
236
|
uri: string;
|
|
@@ -238,12 +240,14 @@ export namespace token {
|
|
|
238
240
|
}
|
|
239
241
|
|
|
240
242
|
export class CollectionMutabilityConfig {
|
|
243
|
+
static TYPE_NAME = "0x3::token::CollectionMutabilityConfig";
|
|
241
244
|
description: Boolean;
|
|
242
245
|
uri: Boolean;
|
|
243
246
|
maximum: Boolean;
|
|
244
247
|
}
|
|
245
248
|
|
|
246
249
|
export class Collections {
|
|
250
|
+
static TYPE_NAME = "0x3::token::Collections";
|
|
247
251
|
collection_data: table.Table<string, token.CollectionData>;
|
|
248
252
|
token_data: table.Table<token.TokenDataId, token.TokenData>;
|
|
249
253
|
create_collection_events: event.EventHandle<token.CreateCollectionEvent>;
|
|
@@ -252,6 +256,7 @@ export namespace token {
|
|
|
252
256
|
}
|
|
253
257
|
|
|
254
258
|
export class CreateCollectionEvent {
|
|
259
|
+
static TYPE_NAME = "0x3::token::CreateCollectionEvent";
|
|
255
260
|
creator: Address;
|
|
256
261
|
collection_name: string;
|
|
257
262
|
uri: string;
|
|
@@ -266,6 +271,7 @@ export namespace token {
|
|
|
266
271
|
}
|
|
267
272
|
|
|
268
273
|
export class CreateTokenDataEvent {
|
|
274
|
+
static TYPE_NAME = "0x3::token::CreateTokenDataEvent";
|
|
269
275
|
id: token.TokenDataId;
|
|
270
276
|
description: string;
|
|
271
277
|
maximum: bigint;
|
|
@@ -287,6 +293,7 @@ export namespace token {
|
|
|
287
293
|
}
|
|
288
294
|
|
|
289
295
|
export class DepositEvent {
|
|
296
|
+
static TYPE_NAME = "0x3::token::DepositEvent";
|
|
290
297
|
id: token.TokenId;
|
|
291
298
|
amount: bigint;
|
|
292
299
|
}
|
|
@@ -298,6 +305,7 @@ export namespace token {
|
|
|
298
305
|
}
|
|
299
306
|
|
|
300
307
|
export class MintTokenEvent {
|
|
308
|
+
static TYPE_NAME = "0x3::token::MintTokenEvent";
|
|
301
309
|
id: token.TokenDataId;
|
|
302
310
|
amount: bigint;
|
|
303
311
|
}
|
|
@@ -309,6 +317,7 @@ export namespace token {
|
|
|
309
317
|
}
|
|
310
318
|
|
|
311
319
|
export class MutateTokenPropertyMapEvent {
|
|
320
|
+
static TYPE_NAME = "0x3::token::MutateTokenPropertyMapEvent";
|
|
312
321
|
old_id: token.TokenId;
|
|
313
322
|
new_id: token.TokenId;
|
|
314
323
|
keys: string[];
|
|
@@ -323,18 +332,21 @@ export namespace token {
|
|
|
323
332
|
}
|
|
324
333
|
|
|
325
334
|
export class Royalty {
|
|
335
|
+
static TYPE_NAME = "0x3::token::Royalty";
|
|
326
336
|
royalty_points_numerator: bigint;
|
|
327
337
|
royalty_points_denominator: bigint;
|
|
328
338
|
payee_address: Address;
|
|
329
339
|
}
|
|
330
340
|
|
|
331
341
|
export class Token {
|
|
342
|
+
static TYPE_NAME = "0x3::token::Token";
|
|
332
343
|
id: token.TokenId;
|
|
333
344
|
amount: bigint;
|
|
334
345
|
token_properties: property_map.PropertyMap;
|
|
335
346
|
}
|
|
336
347
|
|
|
337
348
|
export class TokenData {
|
|
349
|
+
static TYPE_NAME = "0x3::token::TokenData";
|
|
338
350
|
maximum: bigint;
|
|
339
351
|
largest_property_version: bigint;
|
|
340
352
|
supply: bigint;
|
|
@@ -347,17 +359,20 @@ export namespace token {
|
|
|
347
359
|
}
|
|
348
360
|
|
|
349
361
|
export class TokenDataId {
|
|
362
|
+
static TYPE_NAME = "0x3::token::TokenDataId";
|
|
350
363
|
creator: Address;
|
|
351
364
|
collection: string;
|
|
352
365
|
name: string;
|
|
353
366
|
}
|
|
354
367
|
|
|
355
368
|
export class TokenId {
|
|
369
|
+
static TYPE_NAME = "0x3::token::TokenId";
|
|
356
370
|
token_data_id: token.TokenDataId;
|
|
357
371
|
property_version: bigint;
|
|
358
372
|
}
|
|
359
373
|
|
|
360
374
|
export class TokenMutabilityConfig {
|
|
375
|
+
static TYPE_NAME = "0x3::token::TokenMutabilityConfig";
|
|
361
376
|
maximum: Boolean;
|
|
362
377
|
uri: Boolean;
|
|
363
378
|
royalty: Boolean;
|
|
@@ -366,6 +381,7 @@ export namespace token {
|
|
|
366
381
|
}
|
|
367
382
|
|
|
368
383
|
export class TokenStore {
|
|
384
|
+
static TYPE_NAME = "0x3::token::TokenStore";
|
|
369
385
|
tokens: table.Table<token.TokenId, token.Token>;
|
|
370
386
|
direct_transfer: Boolean;
|
|
371
387
|
deposit_events: event.EventHandle<token.DepositEvent>;
|
|
@@ -375,6 +391,7 @@ export namespace token {
|
|
|
375
391
|
}
|
|
376
392
|
|
|
377
393
|
export class WithdrawCapability {
|
|
394
|
+
static TYPE_NAME = "0x3::token::WithdrawCapability";
|
|
378
395
|
token_owner: Address;
|
|
379
396
|
token_id: token.TokenId;
|
|
380
397
|
amount: bigint;
|
|
@@ -382,6 +399,7 @@ export namespace token {
|
|
|
382
399
|
}
|
|
383
400
|
|
|
384
401
|
export class WithdrawEvent {
|
|
402
|
+
static TYPE_NAME = "0x3::token::WithdrawEvent";
|
|
385
403
|
id: token.TokenId;
|
|
386
404
|
amount: bigint;
|
|
387
405
|
}
|
|
@@ -516,10 +534,12 @@ export namespace token {
|
|
|
516
534
|
|
|
517
535
|
export namespace property_map {
|
|
518
536
|
export class PropertyMap {
|
|
537
|
+
static TYPE_NAME = "0x3::property_map::PropertyMap";
|
|
519
538
|
map: simple_map.SimpleMap<string, property_map.PropertyValue>;
|
|
520
539
|
}
|
|
521
540
|
|
|
522
541
|
export class PropertyValue {
|
|
542
|
+
static TYPE_NAME = "0x3::property_map::PropertyValue";
|
|
523
543
|
value: string;
|
|
524
544
|
type: string;
|
|
525
545
|
}
|
|
@@ -593,16 +613,19 @@ export class token_coin_swap extends aptos.AptosBaseProcessor {
|
|
|
593
613
|
|
|
594
614
|
export namespace token_coin_swap {
|
|
595
615
|
export class TokenCoinSwap<T0> {
|
|
616
|
+
static TYPE_NAME = "0x3::token_coin_swap::TokenCoinSwap";
|
|
596
617
|
token_amount: bigint;
|
|
597
618
|
min_price_per_token: bigint;
|
|
598
619
|
}
|
|
599
620
|
|
|
600
621
|
export class TokenEscrow {
|
|
622
|
+
static TYPE_NAME = "0x3::token_coin_swap::TokenEscrow";
|
|
601
623
|
token: token.Token;
|
|
602
624
|
locked_until_secs: bigint;
|
|
603
625
|
}
|
|
604
626
|
|
|
605
627
|
export class TokenListingEvent {
|
|
628
|
+
static TYPE_NAME = "0x3::token_coin_swap::TokenListingEvent";
|
|
606
629
|
token_id: token.TokenId;
|
|
607
630
|
amount: bigint;
|
|
608
631
|
min_price: bigint;
|
|
@@ -617,16 +640,19 @@ export namespace token_coin_swap {
|
|
|
617
640
|
}
|
|
618
641
|
|
|
619
642
|
export class TokenListings<T0> {
|
|
643
|
+
static TYPE_NAME = "0x3::token_coin_swap::TokenListings";
|
|
620
644
|
listings: table.Table<token.TokenId, token_coin_swap.TokenCoinSwap<T0>>;
|
|
621
645
|
listing_events: event.EventHandle<token_coin_swap.TokenListingEvent>;
|
|
622
646
|
swap_events: event.EventHandle<token_coin_swap.TokenSwapEvent>;
|
|
623
647
|
}
|
|
624
648
|
|
|
625
649
|
export class TokenStoreEscrow {
|
|
650
|
+
static TYPE_NAME = "0x3::token_coin_swap::TokenStoreEscrow";
|
|
626
651
|
token_escrows: table.Table<token.TokenId, token_coin_swap.TokenEscrow>;
|
|
627
652
|
}
|
|
628
653
|
|
|
629
654
|
export class TokenSwapEvent {
|
|
655
|
+
static TYPE_NAME = "0x3::token_coin_swap::TokenSwapEvent";
|
|
630
656
|
token_id: token.TokenId;
|
|
631
657
|
token_buyer: Address;
|
|
632
658
|
token_amount: bigint;
|
|
@@ -757,6 +783,7 @@ export class token_transfers extends aptos.AptosBaseProcessor {
|
|
|
757
783
|
|
|
758
784
|
export namespace token_transfers {
|
|
759
785
|
export class PendingClaims {
|
|
786
|
+
static TYPE_NAME = "0x3::token_transfers::PendingClaims";
|
|
760
787
|
pending_claims: table.Table<token_transfers.TokenOfferId, token.Token>;
|
|
761
788
|
offer_events: event.EventHandle<token_transfers.TokenOfferEvent>;
|
|
762
789
|
cancel_offer_events: event.EventHandle<token_transfers.TokenCancelOfferEvent>;
|
|
@@ -764,6 +791,7 @@ export namespace token_transfers {
|
|
|
764
791
|
}
|
|
765
792
|
|
|
766
793
|
export class TokenCancelOfferEvent {
|
|
794
|
+
static TYPE_NAME = "0x3::token_transfers::TokenCancelOfferEvent";
|
|
767
795
|
to_address: Address;
|
|
768
796
|
token_id: token.TokenId;
|
|
769
797
|
amount: bigint;
|
|
@@ -776,6 +804,7 @@ export namespace token_transfers {
|
|
|
776
804
|
}
|
|
777
805
|
|
|
778
806
|
export class TokenClaimEvent {
|
|
807
|
+
static TYPE_NAME = "0x3::token_transfers::TokenClaimEvent";
|
|
779
808
|
to_address: Address;
|
|
780
809
|
token_id: token.TokenId;
|
|
781
810
|
amount: bigint;
|
|
@@ -788,6 +817,7 @@ export namespace token_transfers {
|
|
|
788
817
|
}
|
|
789
818
|
|
|
790
819
|
export class TokenOfferEvent {
|
|
820
|
+
static TYPE_NAME = "0x3::token_transfers::TokenOfferEvent";
|
|
791
821
|
to_address: Address;
|
|
792
822
|
token_id: token.TokenId;
|
|
793
823
|
amount: bigint;
|
|
@@ -800,6 +830,7 @@ export namespace token_transfers {
|
|
|
800
830
|
}
|
|
801
831
|
|
|
802
832
|
export class TokenOfferId {
|
|
833
|
+
static TYPE_NAME = "0x3::token_transfers::TokenOfferId";
|
|
803
834
|
to_addr: Address;
|
|
804
835
|
token_id: token.TokenId;
|
|
805
836
|
}
|
package/src/core/context.ts
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CounterResult,
|
|
3
|
-
GaugeResult,
|
|
4
|
-
LogResult,
|
|
5
|
-
DataDescriptor,
|
|
6
|
-
RecordMetaData,
|
|
7
|
-
EventTrackingResult,
|
|
8
|
-
ProcessResult,
|
|
9
|
-
} from '../gen'
|
|
1
|
+
import { DataDescriptor, RecordMetaData, ProcessResult } from '../gen'
|
|
10
2
|
import { BaseContract, EventFilter } from 'ethers'
|
|
11
3
|
import { Block, Log } from '@ethersproject/abstract-provider'
|
|
12
4
|
import { Meter, normalizeLabels } from './meter'
|
|
@@ -17,26 +9,24 @@ import { Labels } from './metadata'
|
|
|
17
9
|
import { SOL_MAINMET_ID, SUI_DEVNET_ID } from '../utils/chain'
|
|
18
10
|
|
|
19
11
|
export abstract class BaseContext {
|
|
20
|
-
gauges: GaugeResult[] = []
|
|
21
|
-
counters: CounterResult[] = []
|
|
22
|
-
logs: LogResult[] = []
|
|
23
|
-
events: EventTrackingResult[] = []
|
|
24
12
|
meter: Meter
|
|
25
13
|
logger: Logger
|
|
26
14
|
|
|
15
|
+
res: ProcessResult = {
|
|
16
|
+
counters: [],
|
|
17
|
+
events: [],
|
|
18
|
+
exports: [],
|
|
19
|
+
gauges: [],
|
|
20
|
+
logs: [],
|
|
21
|
+
}
|
|
22
|
+
|
|
27
23
|
protected constructor() {
|
|
28
24
|
this.meter = new Meter(this)
|
|
29
25
|
this.logger = new Logger(this)
|
|
30
26
|
}
|
|
31
27
|
|
|
32
28
|
getProcessResult(): ProcessResult {
|
|
33
|
-
|
|
34
|
-
gauges: this.gauges,
|
|
35
|
-
counters: this.counters,
|
|
36
|
-
logs: this.logs,
|
|
37
|
-
events: this.events,
|
|
38
|
-
}
|
|
39
|
-
return res
|
|
29
|
+
return this.res
|
|
40
30
|
}
|
|
41
31
|
|
|
42
32
|
abstract getMetaData(descriptor: DataDescriptor, labels: Labels): RecordMetaData
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { BaseContext } from './context'
|
|
2
|
+
import { DataDescriptor, ExportResult, ExportConfig_ExportType } from '@sentio/sdk'
|
|
3
|
+
|
|
4
|
+
export type Export = Record<string, any>
|
|
5
|
+
|
|
6
|
+
export interface ExporterOptions {
|
|
7
|
+
exportType: ExportConfig_ExportType
|
|
8
|
+
exportUrl: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export class Exporter {
|
|
12
|
+
static register(exporterName: string, options: ExporterOptions) {
|
|
13
|
+
const exporter = new Exporter(exporterName, options)
|
|
14
|
+
global.PROCESSOR_STATE.exporters.push(exporter)
|
|
15
|
+
return exporter
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
exportName: string
|
|
19
|
+
options: ExporterOptions
|
|
20
|
+
protected constructor(eventName: string, options: ExporterOptions) {
|
|
21
|
+
this.exportName = eventName
|
|
22
|
+
this.options = options
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
emit(ctx: BaseContext, data: Export) {
|
|
26
|
+
const res: ExportResult = {
|
|
27
|
+
metadata: ctx.getMetaData(DataDescriptor.fromPartial({ name: this.exportName }), {}),
|
|
28
|
+
payload: JSON.stringify(data),
|
|
29
|
+
runtimeInfo: undefined,
|
|
30
|
+
}
|
|
31
|
+
ctx.res.exports.push(res)
|
|
32
|
+
}
|
|
33
|
+
}
|
package/src/core/logger.ts
CHANGED
|
@@ -22,7 +22,7 @@ export class Logger extends DescriptorWithUsage {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
this.usage++
|
|
25
|
-
this.ctx.logs.push({
|
|
25
|
+
this.ctx.res.logs.push({
|
|
26
26
|
// name: this.name,
|
|
27
27
|
metadata: this.ctx.getMetaData(this.getShortDescriptor(), {}), // GetRecordMetaData(this.ctx, this, {}),
|
|
28
28
|
level,
|
package/src/core/meter.ts
CHANGED
|
@@ -65,7 +65,7 @@ export class Counter extends Metric {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
private record(ctx: BaseContext, value: Numberish, labels: Labels, add: boolean) {
|
|
68
|
-
ctx.counters.push({
|
|
68
|
+
ctx.res.counters.push({
|
|
69
69
|
metadata: ctx.getMetaData(this.getShortDescriptor(), labels),
|
|
70
70
|
metricValue: toMetricValue(value),
|
|
71
71
|
add: add,
|
|
@@ -95,7 +95,7 @@ export class CounterBinding {
|
|
|
95
95
|
|
|
96
96
|
export class Gauge extends Metric {
|
|
97
97
|
record(ctx: BaseContext, value: Numberish, labels: Labels = {}) {
|
|
98
|
-
ctx.gauges.push({
|
|
98
|
+
ctx.res.gauges.push({
|
|
99
99
|
metadata: ctx.getMetaData(this.getShortDescriptor(), labels),
|
|
100
100
|
metricValue: toMetricValue(value),
|
|
101
101
|
runtimeInfo: undefined,
|