@sentio/sdk 2.59.0-rc.23 → 2.59.0-rc.24
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 +3 -3
- package/lib/aptos/aptos-processor.d.ts.map +1 -1
- package/lib/aptos/aptos-processor.js +12 -6
- package/lib/aptos/aptos-processor.js.map +1 -1
- package/lib/aptos/builtin/0x1.d.ts +159 -159
- package/lib/aptos/builtin/0x1.d.ts.map +1 -1
- package/lib/aptos/builtin/0x1.js +316 -316
- package/lib/aptos/builtin/0x1.js.map +1 -1
- package/lib/aptos/builtin/0x3.d.ts +52 -52
- package/lib/aptos/builtin/0x3.d.ts.map +1 -1
- package/lib/aptos/builtin/0x3.js +102 -102
- package/lib/aptos/builtin/0x3.js.map +1 -1
- package/lib/aptos/builtin/0x4.d.ts +12 -12
- package/lib/aptos/builtin/0x4.d.ts.map +1 -1
- package/lib/aptos/builtin/0x4.js +22 -22
- package/lib/aptos/builtin/0x4.js.map +1 -1
- package/lib/aptos/codegen/codegen.js +10 -0
- package/lib/aptos/codegen/codegen.js.map +1 -1
- package/lib/aptos/index.d.ts +1 -0
- package/lib/aptos/index.d.ts.map +1 -1
- package/lib/aptos/index.js.map +1 -1
- package/lib/aptos/models.d.ts +5 -0
- package/lib/aptos/models.d.ts.map +1 -1
- package/lib/move/shared-network-codegen.d.ts.map +1 -1
- package/lib/move/shared-network-codegen.js +1 -0
- package/lib/move/shared-network-codegen.js.map +1 -1
- package/lib/sui/builtin/0x1.d.ts.map +1 -1
- package/lib/sui/builtin/0x1.js.map +1 -1
- package/lib/sui/builtin/0x2.d.ts.map +1 -1
- package/lib/sui/builtin/0x2.js.map +1 -1
- package/lib/sui/builtin/0x3.d.ts.map +1 -1
- package/lib/sui/builtin/0x3.js.map +1 -1
- package/lib/sui/models.d.ts +5 -0
- package/lib/sui/models.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/aptos/aptos-processor.ts +12 -8
- package/src/aptos/builtin/0x1.ts +317 -316
- package/src/aptos/builtin/0x3.ts +103 -102
- package/src/aptos/builtin/0x4.ts +23 -22
- package/src/aptos/codegen/codegen.ts +13 -1
- package/src/aptos/index.ts +2 -0
- package/src/aptos/models.ts +7 -0
- package/src/move/shared-network-codegen.ts +1 -0
- package/src/sui/builtin/0x1.ts +1 -0
- package/src/sui/builtin/0x2.ts +1 -0
- package/src/sui/builtin/0x3.ts +1 -0
- package/src/sui/models.ts +7 -0
package/src/aptos/builtin/0x4.ts
CHANGED
@@ -10,6 +10,7 @@ import {
|
|
10
10
|
AptosBaseProcessor,
|
11
11
|
AptosNetwork,
|
12
12
|
TypedFunctionPayload,
|
13
|
+
HandlerOptions,
|
13
14
|
AptosContext,
|
14
15
|
} from "@sentio/sdk/aptos";
|
15
16
|
|
@@ -45,26 +46,26 @@ export class token extends AptosBaseProcessor {
|
|
45
46
|
|
46
47
|
onEventMutation(
|
47
48
|
func: (event: token.MutationInstance, ctx: AptosContext) => void,
|
48
|
-
|
49
|
+
handlerOptions?: HandlerOptions<token.MutationInstance>,
|
49
50
|
eventFilter?: Omit<EventFilter, "type" | "account">,
|
50
51
|
): token {
|
51
52
|
this.onMoveEvent(
|
52
53
|
func,
|
53
54
|
{ ...(eventFilter ?? {}), type: "token::Mutation" },
|
54
|
-
|
55
|
+
handlerOptions,
|
55
56
|
);
|
56
57
|
return this;
|
57
58
|
}
|
58
59
|
|
59
60
|
onEventMutationEvent(
|
60
61
|
func: (event: token.MutationEventInstance, ctx: AptosContext) => void,
|
61
|
-
|
62
|
+
handlerOptions?: HandlerOptions<token.MutationEventInstance>,
|
62
63
|
eventFilter?: Omit<EventFilter, "type" | "account">,
|
63
64
|
): token {
|
64
65
|
this.onMoveEvent(
|
65
66
|
func,
|
66
67
|
{ ...(eventFilter ?? {}), type: "token::MutationEvent" },
|
67
|
-
|
68
|
+
handlerOptions,
|
68
69
|
);
|
69
70
|
return this;
|
70
71
|
}
|
@@ -446,26 +447,26 @@ export class collection extends AptosBaseProcessor {
|
|
446
447
|
|
447
448
|
onEventBurn(
|
448
449
|
func: (event: collection.BurnInstance, ctx: AptosContext) => void,
|
449
|
-
|
450
|
+
handlerOptions?: HandlerOptions<collection.BurnInstance>,
|
450
451
|
eventFilter?: Omit<EventFilter, "type" | "account">,
|
451
452
|
): collection {
|
452
453
|
this.onMoveEvent(
|
453
454
|
func,
|
454
455
|
{ ...(eventFilter ?? {}), type: "collection::Burn" },
|
455
|
-
|
456
|
+
handlerOptions,
|
456
457
|
);
|
457
458
|
return this;
|
458
459
|
}
|
459
460
|
|
460
461
|
onEventBurnEvent(
|
461
462
|
func: (event: collection.BurnEventInstance, ctx: AptosContext) => void,
|
462
|
-
|
463
|
+
handlerOptions?: HandlerOptions<collection.BurnEventInstance>,
|
463
464
|
eventFilter?: Omit<EventFilter, "type" | "account">,
|
464
465
|
): collection {
|
465
466
|
this.onMoveEvent(
|
466
467
|
func,
|
467
468
|
{ ...(eventFilter ?? {}), type: "collection::BurnEvent" },
|
468
|
-
|
469
|
+
handlerOptions,
|
469
470
|
);
|
470
471
|
return this;
|
471
472
|
}
|
@@ -475,13 +476,13 @@ export class collection extends AptosBaseProcessor {
|
|
475
476
|
event: collection.ConcurrentBurnEventInstance,
|
476
477
|
ctx: AptosContext,
|
477
478
|
) => void,
|
478
|
-
|
479
|
+
handlerOptions?: HandlerOptions<collection.ConcurrentBurnEventInstance>,
|
479
480
|
eventFilter?: Omit<EventFilter, "type" | "account">,
|
480
481
|
): collection {
|
481
482
|
this.onMoveEvent(
|
482
483
|
func,
|
483
484
|
{ ...(eventFilter ?? {}), type: "collection::ConcurrentBurnEvent" },
|
484
|
-
|
485
|
+
handlerOptions,
|
485
486
|
);
|
486
487
|
return this;
|
487
488
|
}
|
@@ -491,78 +492,78 @@ export class collection extends AptosBaseProcessor {
|
|
491
492
|
event: collection.ConcurrentMintEventInstance,
|
492
493
|
ctx: AptosContext,
|
493
494
|
) => void,
|
494
|
-
|
495
|
+
handlerOptions?: HandlerOptions<collection.ConcurrentMintEventInstance>,
|
495
496
|
eventFilter?: Omit<EventFilter, "type" | "account">,
|
496
497
|
): collection {
|
497
498
|
this.onMoveEvent(
|
498
499
|
func,
|
499
500
|
{ ...(eventFilter ?? {}), type: "collection::ConcurrentMintEvent" },
|
500
|
-
|
501
|
+
handlerOptions,
|
501
502
|
);
|
502
503
|
return this;
|
503
504
|
}
|
504
505
|
|
505
506
|
onEventMint(
|
506
507
|
func: (event: collection.MintInstance, ctx: AptosContext) => void,
|
507
|
-
|
508
|
+
handlerOptions?: HandlerOptions<collection.MintInstance>,
|
508
509
|
eventFilter?: Omit<EventFilter, "type" | "account">,
|
509
510
|
): collection {
|
510
511
|
this.onMoveEvent(
|
511
512
|
func,
|
512
513
|
{ ...(eventFilter ?? {}), type: "collection::Mint" },
|
513
|
-
|
514
|
+
handlerOptions,
|
514
515
|
);
|
515
516
|
return this;
|
516
517
|
}
|
517
518
|
|
518
519
|
onEventMintEvent(
|
519
520
|
func: (event: collection.MintEventInstance, ctx: AptosContext) => void,
|
520
|
-
|
521
|
+
handlerOptions?: HandlerOptions<collection.MintEventInstance>,
|
521
522
|
eventFilter?: Omit<EventFilter, "type" | "account">,
|
522
523
|
): collection {
|
523
524
|
this.onMoveEvent(
|
524
525
|
func,
|
525
526
|
{ ...(eventFilter ?? {}), type: "collection::MintEvent" },
|
526
|
-
|
527
|
+
handlerOptions,
|
527
528
|
);
|
528
529
|
return this;
|
529
530
|
}
|
530
531
|
|
531
532
|
onEventMutation(
|
532
533
|
func: (event: collection.MutationInstance, ctx: AptosContext) => void,
|
533
|
-
|
534
|
+
handlerOptions?: HandlerOptions<collection.MutationInstance>,
|
534
535
|
eventFilter?: Omit<EventFilter, "type" | "account">,
|
535
536
|
): collection {
|
536
537
|
this.onMoveEvent(
|
537
538
|
func,
|
538
539
|
{ ...(eventFilter ?? {}), type: "collection::Mutation" },
|
539
|
-
|
540
|
+
handlerOptions,
|
540
541
|
);
|
541
542
|
return this;
|
542
543
|
}
|
543
544
|
|
544
545
|
onEventMutationEvent(
|
545
546
|
func: (event: collection.MutationEventInstance, ctx: AptosContext) => void,
|
546
|
-
|
547
|
+
handlerOptions?: HandlerOptions<collection.MutationEventInstance>,
|
547
548
|
eventFilter?: Omit<EventFilter, "type" | "account">,
|
548
549
|
): collection {
|
549
550
|
this.onMoveEvent(
|
550
551
|
func,
|
551
552
|
{ ...(eventFilter ?? {}), type: "collection::MutationEvent" },
|
552
|
-
|
553
|
+
handlerOptions,
|
553
554
|
);
|
554
555
|
return this;
|
555
556
|
}
|
556
557
|
|
557
558
|
onEventSetMaxSupply(
|
558
559
|
func: (event: collection.SetMaxSupplyInstance, ctx: AptosContext) => void,
|
559
|
-
|
560
|
+
handlerOptions?: HandlerOptions<collection.SetMaxSupplyInstance>,
|
560
561
|
eventFilter?: Omit<EventFilter, "type" | "account">,
|
561
562
|
): collection {
|
562
563
|
this.onMoveEvent(
|
563
564
|
func,
|
564
565
|
{ ...(eventFilter ?? {}), type: "collection::SetMaxSupply" },
|
565
|
-
|
566
|
+
handlerOptions,
|
566
567
|
);
|
567
568
|
return this;
|
568
569
|
}
|
@@ -2,7 +2,7 @@ import * as fs from 'fs'
|
|
2
2
|
import chalk from 'chalk'
|
3
3
|
import path, { join } from 'path'
|
4
4
|
import { AptosCodegen as BaseAptosCodegen } from '@typemove/aptos/codegen'
|
5
|
-
import { InternalMoveModule, InternalMoveStruct } from '@typemove/move'
|
5
|
+
import { InternalMoveModule, InternalMoveStruct, normalizeToJSName } from '@typemove/move'
|
6
6
|
import { AptosNetwork, getRpcEndpoint } from '../network.js'
|
7
7
|
import { Event, MoveModuleBytecode, MoveResource } from '@aptos-labs/ts-sdk'
|
8
8
|
import { SharedNetworkCodegen } from '../../move/shared-network-codegen.js'
|
@@ -48,6 +48,18 @@ class AptosNetworkCodegen extends BaseAptosCodegen {
|
|
48
48
|
generateStructs(module: InternalMoveModule, struct: InternalMoveStruct, events: Set<string>) {
|
49
49
|
return generator.generateStructs(module, struct, events)
|
50
50
|
}
|
51
|
+
|
52
|
+
generateForOnEvents(module: InternalMoveModule, struct: InternalMoveStruct): string {
|
53
|
+
const moduleName = normalizeToJSName(module.name)
|
54
|
+
const source = `
|
55
|
+
onEvent${struct.name}(func: (event: ${moduleName}.${normalizeToJSName(struct.name)}Instance, ctx: ${
|
56
|
+
this.PREFIX
|
57
|
+
}Context) => void, handlerOptions?: HandlerOptions<${moduleName}.${normalizeToJSName(struct.name)}Instance>, eventFilter?: Omit<EventFilter, "type"|"account">): ${moduleName} {
|
58
|
+
this.onMoveEvent(func, {...eventFilter ?? {}, type: '${module.name}::${struct.name}' }, handlerOptions)
|
59
|
+
return this
|
60
|
+
}`
|
61
|
+
return source
|
62
|
+
}
|
51
63
|
})(network, this.chainAdapter)
|
52
64
|
}
|
53
65
|
|
package/src/aptos/index.ts
CHANGED
package/src/aptos/models.ts
CHANGED
@@ -9,6 +9,7 @@ import {
|
|
9
9
|
ValidatorTransactionResponse,
|
10
10
|
BlockEpilogueTransactionResponse
|
11
11
|
} from '@aptos-labs/ts-sdk'
|
12
|
+
import { MoveFetchConfig } from '@sentio/protos'
|
12
13
|
|
13
14
|
export type GeneralTransactionResponse =
|
14
15
|
| UserTransactionResponse
|
@@ -27,3 +28,9 @@ export type TypedFunctionPayload<T extends Array<any>> = EntryFunctionPayloadRes
|
|
27
28
|
*/
|
28
29
|
arguments_decoded: T
|
29
30
|
}
|
31
|
+
|
32
|
+
export type PartitionHandler<D> = (data: D) => string | Promise<string>
|
33
|
+
|
34
|
+
export type HandlerOptions<D> = Partial<MoveFetchConfig> & {
|
35
|
+
partitionKey?: string | PartitionHandler<D>
|
36
|
+
}
|
@@ -126,6 +126,7 @@ onEvent${struct.name}(func: (event: ${moduleName}.${normalizeToJSName(struct.nam
|
|
126
126
|
import {
|
127
127
|
${this.PREFIX}BindOptions, ${this.PREFIX}BaseProcessor,
|
128
128
|
${this.PREFIX}Network, TypedFunctionPayload,
|
129
|
+
HandlerOptions,
|
129
130
|
${this.PREFIX}Context } from "@sentio/sdk/${this.PREFIX.toLowerCase()}"
|
130
131
|
`
|
131
132
|
}
|
package/src/sui/builtin/0x1.ts
CHANGED
package/src/sui/builtin/0x2.ts
CHANGED
package/src/sui/builtin/0x3.ts
CHANGED
package/src/sui/models.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import type { SuiEvent, MoveCallSuiTransaction, SuiMoveObject } from '@mysten/sui/client'
|
2
2
|
import { DecodedStruct } from '@typemove/move'
|
3
|
+
import { MoveFetchConfig } from '@sentio/protos'
|
3
4
|
|
4
5
|
export type TypedEventInstance<T> = DecodedStruct<SuiEvent, T>
|
5
6
|
export type TypedSuiMoveObject<T> = DecodedStruct<SuiMoveObject, T>
|
@@ -10,3 +11,9 @@ export type TypedFunctionPayload<T extends Array<any>> = MoveCallSuiTransaction
|
|
10
11
|
*/
|
11
12
|
arguments_decoded: T
|
12
13
|
}
|
14
|
+
|
15
|
+
export type PartitionHandler<D> = (data: D) => string | Promise<string>
|
16
|
+
|
17
|
+
export type HandlerOptions<D> = Partial<MoveFetchConfig> & {
|
18
|
+
partitionKey?: string | PartitionHandler<D>
|
19
|
+
}
|