@sentio/sdk 2.60.3 → 2.61.0-rc.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.
Files changed (44) hide show
  1. package/lib/aptos/builtin/0x1.d.ts +125 -0
  2. package/lib/aptos/builtin/0x1.d.ts.map +1 -1
  3. package/lib/aptos/builtin/0x1.js +150 -6
  4. package/lib/aptos/builtin/0x1.js.map +1 -1
  5. package/lib/aptos/builtin/0x3.d.ts +10 -0
  6. package/lib/aptos/builtin/0x3.d.ts.map +1 -1
  7. package/lib/aptos/builtin/0x3.js +8 -0
  8. package/lib/aptos/builtin/0x3.js.map +1 -1
  9. package/lib/aptos/builtin/0x4.d.ts +40 -0
  10. package/lib/aptos/builtin/0x4.d.ts.map +1 -1
  11. package/lib/aptos/builtin/0x4.js +48 -2
  12. package/lib/aptos/builtin/0x4.js.map +1 -1
  13. package/lib/aptos/codegen/codegen.js +2 -2
  14. package/lib/aptos/codegen/codegen.js.map +1 -1
  15. package/lib/aptos/ext/coin-event.test.js.map +1 -1
  16. package/lib/aptos/network.d.ts +2 -2
  17. package/lib/aptos/network.d.ts.map +1 -1
  18. package/lib/aptos/network.js +22 -15
  19. package/lib/aptos/network.js.map +1 -1
  20. package/lib/sui/builtin/0x1.d.ts +72 -107
  21. package/lib/sui/builtin/0x1.d.ts.map +1 -1
  22. package/lib/sui/builtin/0x1.js +53 -1
  23. package/lib/sui/builtin/0x1.js.map +1 -1
  24. package/lib/sui/builtin/0x2.d.ts +610 -807
  25. package/lib/sui/builtin/0x2.d.ts.map +1 -1
  26. package/lib/sui/builtin/0x2.js +158 -2
  27. package/lib/sui/builtin/0x2.js.map +1 -1
  28. package/lib/sui/builtin/0x3.d.ts +290 -362
  29. package/lib/sui/builtin/0x3.d.ts.map +1 -1
  30. package/lib/sui/builtin/0x3.js +105 -1
  31. package/lib/sui/builtin/0x3.js.map +1 -1
  32. package/package.json +10 -10
  33. package/src/aptos/abis/0x1.json +47 -3
  34. package/src/aptos/builtin/0x1.ts +520 -1
  35. package/src/aptos/builtin/0x3.ts +46 -0
  36. package/src/aptos/builtin/0x4.ts +151 -0
  37. package/src/aptos/codegen/codegen.ts +2 -2
  38. package/src/aptos/network.ts +22 -14
  39. package/src/sui/abis/0x1.json +52 -0
  40. package/src/sui/abis/0x2.json +134 -2
  41. package/src/sui/abis/0x3.json +180 -0
  42. package/src/sui/builtin/0x1.ts +143 -110
  43. package/src/sui/builtin/0x2.ts +796 -808
  44. package/src/sui/builtin/0x3.ts +422 -363
@@ -544,6 +544,22 @@ export class token extends AptosBaseProcessor {
544
544
  );
545
545
  return this;
546
546
  }
547
+
548
+ onEventWithdrawCapability(
549
+ func: (event: token.WithdrawCapabilityInstance, ctx: AptosContext) => void,
550
+ handlerOptions?: HandlerOptions<
551
+ MoveFetchConfig,
552
+ token.WithdrawCapabilityInstance
553
+ >,
554
+ eventFilter?: Omit<EventFilter, "type" | "account">,
555
+ ): token {
556
+ this.onMoveEvent(
557
+ func,
558
+ { ...(eventFilter ?? {}), type: "token::WithdrawCapability" },
559
+ handlerOptions,
560
+ );
561
+ return this;
562
+ }
547
563
  }
548
564
 
549
565
  export namespace token {
@@ -1219,6 +1235,12 @@ export namespace token {
1219
1235
  }
1220
1236
  }
1221
1237
 
1238
+ export type WithdrawCapabilityInstance =
1239
+ TypedEventInstance<WithdrawCapability> & {
1240
+ data_decoded: WithdrawCapability;
1241
+ type_arguments: [];
1242
+ };
1243
+
1222
1244
  export namespace entry {
1223
1245
  export async function burn(
1224
1246
  client: Aptos,
@@ -1740,6 +1762,25 @@ export class token_coin_swap extends AptosBaseProcessor {
1740
1762
  return this;
1741
1763
  }
1742
1764
 
1765
+ onEventTokenCoinSwap(
1766
+ func: (
1767
+ event: token_coin_swap.TokenCoinSwapInstance,
1768
+ ctx: AptosContext,
1769
+ ) => void,
1770
+ handlerOptions?: HandlerOptions<
1771
+ MoveFetchConfig,
1772
+ token_coin_swap.TokenCoinSwapInstance
1773
+ >,
1774
+ eventFilter?: Omit<EventFilter, "type" | "account">,
1775
+ ): token_coin_swap {
1776
+ this.onMoveEvent(
1777
+ func,
1778
+ { ...(eventFilter ?? {}), type: "token_coin_swap::TokenCoinSwap" },
1779
+ handlerOptions,
1780
+ );
1781
+ return this;
1782
+ }
1783
+
1743
1784
  onEventTokenListingEvent(
1744
1785
  func: (
1745
1786
  event: token_coin_swap.TokenListingEventInstance,
@@ -1799,6 +1840,11 @@ export namespace token_coin_swap {
1799
1840
  }
1800
1841
  }
1801
1842
 
1843
+ export type TokenCoinSwapInstance = TypedEventInstance<TokenCoinSwap<any>> & {
1844
+ data_decoded: TokenCoinSwap<any>;
1845
+ type_arguments: [string];
1846
+ };
1847
+
1802
1848
  export interface TokenEscrow {
1803
1849
  token: token.Token;
1804
1850
  locked_until_secs: bigint;
@@ -44,6 +44,32 @@ export class token extends AptosBaseProcessor {
44
44
  return new token({ ...token.DEFAULT_OPTIONS, ...options });
45
45
  }
46
46
 
47
+ onEventBurnRef(
48
+ func: (event: token.BurnRefInstance, ctx: AptosContext) => void,
49
+ handlerOptions?: HandlerOptions<MoveFetchConfig, token.BurnRefInstance>,
50
+ eventFilter?: Omit<EventFilter, "type" | "account">,
51
+ ): token {
52
+ this.onMoveEvent(
53
+ func,
54
+ { ...(eventFilter ?? {}), type: "token::BurnRef" },
55
+ handlerOptions,
56
+ );
57
+ return this;
58
+ }
59
+
60
+ onEventMutatorRef(
61
+ func: (event: token.MutatorRefInstance, ctx: AptosContext) => void,
62
+ handlerOptions?: HandlerOptions<MoveFetchConfig, token.MutatorRefInstance>,
63
+ eventFilter?: Omit<EventFilter, "type" | "account">,
64
+ ): token {
65
+ this.onMoveEvent(
66
+ func,
67
+ { ...(eventFilter ?? {}), type: "token::MutatorRef" },
68
+ handlerOptions,
69
+ );
70
+ return this;
71
+ }
72
+
47
73
  onEventMutation(
48
74
  func: (event: token.MutationInstance, ctx: AptosContext) => void,
49
75
  handlerOptions?: HandlerOptions<MoveFetchConfig, token.MutationInstance>,
@@ -90,6 +116,11 @@ export namespace token {
90
116
  }
91
117
  }
92
118
 
119
+ export type BurnRefInstance = TypedEventInstance<BurnRef> & {
120
+ data_decoded: BurnRef;
121
+ type_arguments: [];
122
+ };
123
+
93
124
  export interface MutatorRef {
94
125
  self: MoveAddressType;
95
126
  }
@@ -104,6 +135,11 @@ export namespace token {
104
135
  }
105
136
  }
106
137
 
138
+ export type MutatorRefInstance = TypedEventInstance<MutatorRef> & {
139
+ data_decoded: MutatorRef;
140
+ type_arguments: [];
141
+ };
142
+
107
143
  export interface Mutation {
108
144
  token_address: MoveAddressType;
109
145
  mutated_field_name: string;
@@ -400,6 +436,36 @@ export namespace token {
400
436
  }
401
437
  }
402
438
 
439
+ export class royalty extends AptosBaseProcessor {
440
+ constructor(options: AptosBindOptions) {
441
+ super("royalty", options);
442
+ }
443
+ static DEFAULT_OPTIONS: AptosBindOptions = {
444
+ address: "0x4",
445
+ network: AptosNetwork.MAIN_NET,
446
+ };
447
+
448
+ static bind(options: Partial<AptosBindOptions> = {}): royalty {
449
+ return new royalty({ ...royalty.DEFAULT_OPTIONS, ...options });
450
+ }
451
+
452
+ onEventMutatorRef(
453
+ func: (event: royalty.MutatorRefInstance, ctx: AptosContext) => void,
454
+ handlerOptions?: HandlerOptions<
455
+ MoveFetchConfig,
456
+ royalty.MutatorRefInstance
457
+ >,
458
+ eventFilter?: Omit<EventFilter, "type" | "account">,
459
+ ): royalty {
460
+ this.onMoveEvent(
461
+ func,
462
+ { ...(eventFilter ?? {}), type: "royalty::MutatorRef" },
463
+ handlerOptions,
464
+ );
465
+ return this;
466
+ }
467
+ }
468
+
403
469
  export namespace royalty {
404
470
  export interface MutatorRef {
405
471
  inner: _0x1.object$.ExtendRef;
@@ -415,6 +481,11 @@ export namespace royalty {
415
481
  }
416
482
  }
417
483
 
484
+ export type MutatorRefInstance = TypedEventInstance<MutatorRef> & {
485
+ data_decoded: MutatorRef;
486
+ type_arguments: [];
487
+ };
488
+
418
489
  export interface Royalty {
419
490
  numerator: bigint;
420
491
  denominator: bigint;
@@ -448,6 +519,22 @@ export class collection extends AptosBaseProcessor {
448
519
  return new collection({ ...collection.DEFAULT_OPTIONS, ...options });
449
520
  }
450
521
 
522
+ onEventMutatorRef(
523
+ func: (event: collection.MutatorRefInstance, ctx: AptosContext) => void,
524
+ handlerOptions?: HandlerOptions<
525
+ MoveFetchConfig,
526
+ collection.MutatorRefInstance
527
+ >,
528
+ eventFilter?: Omit<EventFilter, "type" | "account">,
529
+ ): collection {
530
+ this.onMoveEvent(
531
+ func,
532
+ { ...(eventFilter ?? {}), type: "collection::MutatorRef" },
533
+ handlerOptions,
534
+ );
535
+ return this;
536
+ }
537
+
451
538
  onEventBurn(
452
539
  func: (event: collection.BurnInstance, ctx: AptosContext) => void,
453
540
  handlerOptions?: HandlerOptions<MoveFetchConfig, collection.BurnInstance>,
@@ -625,6 +712,11 @@ export namespace collection {
625
712
  }
626
713
  }
627
714
 
715
+ export type MutatorRefInstance = TypedEventInstance<MutatorRef> & {
716
+ data_decoded: MutatorRef;
717
+ type_arguments: [];
718
+ };
719
+
628
720
  export interface Burn {
629
721
  collection: MoveAddressType;
630
722
  index: bigint;
@@ -2148,6 +2240,55 @@ export namespace aptos_token {
2148
2240
  }
2149
2241
  }
2150
2242
 
2243
+ export class property_map extends AptosBaseProcessor {
2244
+ constructor(options: AptosBindOptions) {
2245
+ super("property_map", options);
2246
+ }
2247
+ static DEFAULT_OPTIONS: AptosBindOptions = {
2248
+ address: "0x4",
2249
+ network: AptosNetwork.MAIN_NET,
2250
+ };
2251
+
2252
+ static bind(options: Partial<AptosBindOptions> = {}): property_map {
2253
+ return new property_map({ ...property_map.DEFAULT_OPTIONS, ...options });
2254
+ }
2255
+
2256
+ onEventMutatorRef(
2257
+ func: (event: property_map.MutatorRefInstance, ctx: AptosContext) => void,
2258
+ handlerOptions?: HandlerOptions<
2259
+ MoveFetchConfig,
2260
+ property_map.MutatorRefInstance
2261
+ >,
2262
+ eventFilter?: Omit<EventFilter, "type" | "account">,
2263
+ ): property_map {
2264
+ this.onMoveEvent(
2265
+ func,
2266
+ { ...(eventFilter ?? {}), type: "property_map::MutatorRef" },
2267
+ handlerOptions,
2268
+ );
2269
+ return this;
2270
+ }
2271
+
2272
+ onEventPropertyValue(
2273
+ func: (
2274
+ event: property_map.PropertyValueInstance,
2275
+ ctx: AptosContext,
2276
+ ) => void,
2277
+ handlerOptions?: HandlerOptions<
2278
+ MoveFetchConfig,
2279
+ property_map.PropertyValueInstance
2280
+ >,
2281
+ eventFilter?: Omit<EventFilter, "type" | "account">,
2282
+ ): property_map {
2283
+ this.onMoveEvent(
2284
+ func,
2285
+ { ...(eventFilter ?? {}), type: "property_map::PropertyValue" },
2286
+ handlerOptions,
2287
+ );
2288
+ return this;
2289
+ }
2290
+ }
2291
+
2151
2292
  export namespace property_map {
2152
2293
  export interface MutatorRef {
2153
2294
  self: MoveAddressType;
@@ -2163,6 +2304,11 @@ export namespace property_map {
2163
2304
  }
2164
2305
  }
2165
2306
 
2307
+ export type MutatorRefInstance = TypedEventInstance<MutatorRef> & {
2308
+ data_decoded: MutatorRef;
2309
+ type_arguments: [];
2310
+ };
2311
+
2166
2312
  export interface PropertyMap {
2167
2313
  inner: _0x1.simple_map.SimpleMap<string, property_map.PropertyValue>;
2168
2314
  }
@@ -2192,6 +2338,11 @@ export namespace property_map {
2192
2338
  }
2193
2339
  }
2194
2340
 
2341
+ export type PropertyValueInstance = TypedEventInstance<PropertyValue> & {
2342
+ data_decoded: PropertyValue;
2343
+ type_arguments: [];
2344
+ };
2345
+
2195
2346
  export namespace entry {}
2196
2347
  export namespace view {}
2197
2348
  }
@@ -3,7 +3,7 @@ import chalk from 'chalk'
3
3
  import path, { join } from 'path'
4
4
  import { AptosCodegen as BaseAptosCodegen } from '@typemove/aptos/codegen'
5
5
  import { InternalMoveModule, InternalMoveStruct, normalizeToJSName, camel, upperFirst } from '@typemove/move'
6
- import { AptosNetwork, getRpcEndpoint } from '../network.js'
6
+ import { AptosNetwork, getRpcConfig } from '../network.js'
7
7
  import { Event, MoveModuleBytecode, MoveResource } from '@aptos-labs/ts-sdk'
8
8
  import { SharedNetworkCodegen } from '../../move/shared-network-codegen.js'
9
9
  import { recursiveCodegen } from '../../core/codegen.js'
@@ -27,7 +27,7 @@ class AptosNetworkCodegen extends BaseAptosCodegen {
27
27
  SYSTEM_PACKAGE = '@sentio/sdk/aptos'
28
28
 
29
29
  constructor(network: AptosNetwork, useViewJson = false) {
30
- const endpoint = getRpcEndpoint(network)
30
+ const endpoint = getRpcConfig(network)
31
31
  super(endpoint, useViewJson)
32
32
  const generator = this
33
33
 
@@ -1,5 +1,5 @@
1
1
  import { AptosChainId } from '@sentio/chain'
2
- import { Aptos, AptosConfig } from '@aptos-labs/ts-sdk'
2
+ import { Aptos, AptosConfig, Network } from '@aptos-labs/ts-sdk'
3
3
  import { Labels } from '../core/index.js'
4
4
  import { Endpoints } from '@sentio/runtime'
5
5
  import { RichAptosClient } from './api.js'
@@ -29,28 +29,36 @@ export class AptosBindOptions {
29
29
  baseLabels?: Labels
30
30
  }
31
31
 
32
- export function getRpcEndpoint(network: AptosNetwork): string {
32
+ export function getRpcConfig(network: AptosNetwork, fullnode?: string | undefined): AptosConfig {
33
33
  switch (network) {
34
34
  case AptosNetwork.MAIN_NET:
35
- return 'https://mainnet.aptoslabs.com/v1'
35
+ return new AptosConfig({ network: Network.MAINNET, fullnode: fullnode ?? 'https://mainnet.aptoslabs.com/v1' })
36
36
  case AptosNetwork.TEST_NET:
37
- return 'https://testnet.aptoslabs.com/v1'
37
+ return new AptosConfig({ network: Network.TESTNET, fullnode: fullnode ?? 'https://testnet.aptoslabs.com/v1' })
38
38
  case AptosNetwork.MOVEMENT_MAIN_NET:
39
- return 'https://mainnet.movementnetwork.xyz/v1'
39
+ return new AptosConfig({
40
+ network: Network.CUSTOM,
41
+ fullnode: fullnode ?? 'https://mainnet.movementnetwork.xyz/v1'
42
+ })
40
43
  case AptosNetwork.MOVEMENT_TEST_NET:
41
- return 'https://aptos.testnet.bardock.movementlabs.xyz/v1'
44
+ return new AptosConfig({
45
+ network: Network.CUSTOM,
46
+ fullnode: fullnode ?? 'https://aptos.testnet.bardock.movementlabs.xyz/v1'
47
+ })
42
48
  case AptosNetwork.INITIA_ECHELON:
43
- return 'https://rpc.sentio.xyz/initia-aptos/v1'
49
+ return new AptosConfig({
50
+ network: Network.CUSTOM,
51
+ fullnode: fullnode ?? 'https://rpc.sentio.xyz/initia-aptos/v1'
52
+ })
44
53
  }
45
54
  }
46
55
 
47
56
  export function getClient(network: AptosNetwork): RichAptosClient {
48
- let chainServer = Endpoints.INSTANCE.chainServer.get(network)
49
- if (!chainServer) {
50
- chainServer = getRpcEndpoint(network)
51
- // throw new ServerError(Status.INTERNAL, 'RPC endpoint not provided')
52
- } else {
53
- chainServer = chainServer + '/v1'
57
+ let fullnode = Endpoints.INSTANCE.chainServer.get(network)
58
+ if (fullnode) {
59
+ if (!fullnode.endsWith('/v1')) {
60
+ fullnode = fullnode + '/v1'
61
+ }
54
62
  }
55
- return new RichAptosClient(new AptosConfig({ fullnode: chainServer }))
63
+ return new RichAptosClient(getRpcConfig(network, fullnode))
56
64
  }
@@ -4171,6 +4171,32 @@
4171
4171
  }
4172
4172
  ]
4173
4173
  },
4174
+ "skip": {
4175
+ "visibility": "Public",
4176
+ "isEntry": false,
4177
+ "typeParameters": [
4178
+ {
4179
+ "abilities": [
4180
+ "Drop"
4181
+ ]
4182
+ }
4183
+ ],
4184
+ "parameters": [
4185
+ {
4186
+ "Vector": {
4187
+ "TypeParameter": 0
4188
+ }
4189
+ },
4190
+ "U64"
4191
+ ],
4192
+ "return": [
4193
+ {
4194
+ "Vector": {
4195
+ "TypeParameter": 0
4196
+ }
4197
+ }
4198
+ ]
4199
+ },
4174
4200
  "swap": {
4175
4201
  "visibility": "Public",
4176
4202
  "isEntry": false,
@@ -4215,6 +4241,32 @@
4215
4241
  "TypeParameter": 0
4216
4242
  }
4217
4243
  ]
4244
+ },
4245
+ "take": {
4246
+ "visibility": "Public",
4247
+ "isEntry": false,
4248
+ "typeParameters": [
4249
+ {
4250
+ "abilities": [
4251
+ "Drop"
4252
+ ]
4253
+ }
4254
+ ],
4255
+ "parameters": [
4256
+ {
4257
+ "Vector": {
4258
+ "TypeParameter": 0
4259
+ }
4260
+ },
4261
+ "U64"
4262
+ ],
4263
+ "return": [
4264
+ {
4265
+ "Vector": {
4266
+ "TypeParameter": 0
4267
+ }
4268
+ }
4269
+ ]
4218
4270
  }
4219
4271
  }
4220
4272
  }
@@ -3,7 +3,12 @@
3
3
  "fileFormatVersion": 6,
4
4
  "address": "0x2",
5
5
  "name": "accumulator",
6
- "friends": [],
6
+ "friends": [
7
+ {
8
+ "address": "0x2",
9
+ "name": "balance"
10
+ }
11
+ ],
7
12
  "structs": {
8
13
  "AccumulatorRoot": {
9
14
  "abilities": {
@@ -25,9 +30,92 @@
25
30
  }
26
31
  }
27
32
  ]
33
+ },
34
+ "Key": {
35
+ "abilities": {
36
+ "abilities": [
37
+ "Copy",
38
+ "Drop",
39
+ "Store"
40
+ ]
41
+ },
42
+ "typeParameters": [
43
+ {
44
+ "constraints": {
45
+ "abilities": []
46
+ },
47
+ "isPhantom": true
48
+ }
49
+ ],
50
+ "fields": [
51
+ {
52
+ "name": "address",
53
+ "type": "Address"
54
+ }
55
+ ]
56
+ },
57
+ "U128": {
58
+ "abilities": {
59
+ "abilities": [
60
+ "Store"
61
+ ]
62
+ },
63
+ "typeParameters": [],
64
+ "fields": [
65
+ {
66
+ "name": "value",
67
+ "type": "U128"
68
+ }
69
+ ]
28
70
  }
29
71
  },
30
- "exposedFunctions": {}
72
+ "exposedFunctions": {
73
+ "accumulator_address": {
74
+ "visibility": "Friend",
75
+ "isEntry": false,
76
+ "typeParameters": [
77
+ {
78
+ "abilities": []
79
+ }
80
+ ],
81
+ "parameters": [
82
+ "Address"
83
+ ],
84
+ "return": [
85
+ "Address"
86
+ ]
87
+ },
88
+ "emit_deposit_event": {
89
+ "visibility": "Friend",
90
+ "isEntry": false,
91
+ "typeParameters": [
92
+ {
93
+ "abilities": []
94
+ }
95
+ ],
96
+ "parameters": [
97
+ "Address",
98
+ "Address",
99
+ "U64"
100
+ ],
101
+ "return": []
102
+ },
103
+ "emit_withdraw_event": {
104
+ "visibility": "Friend",
105
+ "isEntry": false,
106
+ "typeParameters": [
107
+ {
108
+ "abilities": []
109
+ }
110
+ ],
111
+ "parameters": [
112
+ "Address",
113
+ "Address",
114
+ "U64"
115
+ ],
116
+ "return": []
117
+ }
118
+ }
31
119
  },
32
120
  "address": {
33
121
  "fileFormatVersion": 6,
@@ -8306,6 +8394,10 @@
8306
8394
  "address": "0x2",
8307
8395
  "name": "dynamic_field",
8308
8396
  "friends": [
8397
+ {
8398
+ "address": "0x2",
8399
+ "name": "accumulator"
8400
+ },
8309
8401
  {
8310
8402
  "address": "0x2",
8311
8403
  "name": "config"
@@ -22654,6 +22746,46 @@
22654
22746
  "Address"
22655
22747
  ]
22656
22748
  },
22749
+ "gas_price": {
22750
+ "visibility": "Public",
22751
+ "isEntry": false,
22752
+ "typeParameters": [],
22753
+ "parameters": [
22754
+ {
22755
+ "Reference": {
22756
+ "Struct": {
22757
+ "address": "0x2",
22758
+ "module": "tx_context",
22759
+ "name": "TxContext",
22760
+ "typeArguments": []
22761
+ }
22762
+ }
22763
+ }
22764
+ ],
22765
+ "return": [
22766
+ "U64"
22767
+ ]
22768
+ },
22769
+ "reference_gas_price": {
22770
+ "visibility": "Public",
22771
+ "isEntry": false,
22772
+ "typeParameters": [],
22773
+ "parameters": [
22774
+ {
22775
+ "Reference": {
22776
+ "Struct": {
22777
+ "address": "0x2",
22778
+ "module": "tx_context",
22779
+ "name": "TxContext",
22780
+ "typeArguments": []
22781
+ }
22782
+ }
22783
+ }
22784
+ ],
22785
+ "return": [
22786
+ "U64"
22787
+ ]
22788
+ },
22657
22789
  "sender": {
22658
22790
  "visibility": "Public",
22659
22791
  "isEntry": false,