@sentio/sdk-bundle 3.1.0-rc.4 → 3.2.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.
Files changed (80) hide show
  1. package/lib/aptos/builtin/0x1.js +6 -6
  2. package/lib/aptos/builtin/0x3.js +7 -7
  3. package/lib/aptos/builtin/0x4.js +7 -7
  4. package/lib/aptos/builtin/index.js +8 -8
  5. package/lib/aptos/ext/index.js +6 -6
  6. package/lib/aptos/index.js +6 -6
  7. package/lib/{chunk-Y2FX22WS.js → chunk-3OTGCX2I.js} +2 -2
  8. package/lib/{chunk-7CBYHDRP.js → chunk-64OFOYWX.js} +3 -3
  9. package/lib/{chunk-2R55GIR5.js → chunk-7P6ISWWR.js} +2 -2
  10. package/lib/{chunk-K7JXI2BE.js → chunk-A6KCJWA4.js} +5 -5
  11. package/lib/{chunk-S6KKBMOL.js → chunk-C3JICYMS.js} +3 -3
  12. package/lib/{chunk-4ZDQTABD.js → chunk-C3T6ZGHT.js} +6 -6
  13. package/lib/{chunk-6EPICSPE.js → chunk-C6F53R6B.js} +3 -3
  14. package/lib/{chunk-THDI7EX6.js → chunk-E2JIP2R5.js} +194 -5
  15. package/lib/{chunk-THDI7EX6.js.map → chunk-E2JIP2R5.js.map} +1 -1
  16. package/lib/{chunk-ZY5R3PQ7.js → chunk-E7PD7E3N.js} +4 -4
  17. package/lib/{chunk-SNJRCV7C.js → chunk-F4WMRFLF.js} +3 -3
  18. package/lib/{chunk-3NZVJHKD.js → chunk-PFV24XHX.js} +5 -5
  19. package/lib/{chunk-D3JSYEWW.js → chunk-PKSJIHVX.js} +2 -2
  20. package/lib/{chunk-2AUGKQV3.js → chunk-SAXCWDM2.js} +6 -6
  21. package/lib/{chunk-K5D4DEBD.js → chunk-SD76HDXA.js} +3 -3
  22. package/lib/{chunk-VMGCYU46.js → chunk-STQVTMGC.js} +6 -6
  23. package/lib/{chunk-LK5MZSEL.js → chunk-TL65K2NO.js} +3 -3
  24. package/lib/{chunk-HSE6KOCD.js → chunk-UB7MZOP3.js} +2 -2
  25. package/lib/{chunk-3KVZZTCO.js → chunk-V26TFF73.js} +4 -4
  26. package/lib/{chunk-IHUS7BH5.js → chunk-V6BWCM2L.js} +3 -3
  27. package/lib/{chunk-CHXSRL4K.js → chunk-VQVCY5QM.js} +5 -5
  28. package/lib/{chunk-GQMSTSID.js → chunk-VSWSP6E7.js} +4 -4
  29. package/lib/core/index.js +1 -1
  30. package/lib/eth/abi-decoder/decode-worker.js +2 -2
  31. package/lib/eth/builtin/eacaggregatorproxy.js +4 -4
  32. package/lib/eth/builtin/erc1155.js +5 -5
  33. package/lib/eth/builtin/erc20.js +4 -4
  34. package/lib/eth/builtin/erc721.js +4 -4
  35. package/lib/eth/builtin/index.js +6 -6
  36. package/lib/eth/builtin/weth9.js +5 -5
  37. package/lib/eth/index.js +4 -4
  38. package/lib/fuel/index.js +3 -3
  39. package/lib/index.js +1 -1
  40. package/lib/iota/builtin/0x1.js +9 -9
  41. package/lib/iota/builtin/0x2.js +10 -10
  42. package/lib/iota/builtin/0x3.js +11 -11
  43. package/lib/iota/builtin/index.js +11 -11
  44. package/lib/iota/ext/index.js +6 -6
  45. package/lib/iota/index.js +8 -8
  46. package/lib/move/index.js +2 -2
  47. package/lib/solana/builtin/index.js +2 -2
  48. package/lib/solana/index.js +2 -2
  49. package/lib/stark/index.js +2 -2
  50. package/lib/store/index.js +1 -1
  51. package/lib/sui/builtin/0x1.js +9 -9
  52. package/lib/sui/builtin/0x2.js +10 -10
  53. package/lib/sui/builtin/0x3.js +11 -11
  54. package/lib/sui/builtin/index.js +11 -11
  55. package/lib/sui/ext/index.js +6 -6
  56. package/lib/sui/index.js +8 -8
  57. package/lib/testing/index.js +37 -12
  58. package/lib/testing/index.js.map +1 -1
  59. package/lib/utils/index.js +4 -4
  60. package/package.json +2 -2
  61. /package/lib/{chunk-Y2FX22WS.js.map → chunk-3OTGCX2I.js.map} +0 -0
  62. /package/lib/{chunk-7CBYHDRP.js.map → chunk-64OFOYWX.js.map} +0 -0
  63. /package/lib/{chunk-2R55GIR5.js.map → chunk-7P6ISWWR.js.map} +0 -0
  64. /package/lib/{chunk-K7JXI2BE.js.map → chunk-A6KCJWA4.js.map} +0 -0
  65. /package/lib/{chunk-S6KKBMOL.js.map → chunk-C3JICYMS.js.map} +0 -0
  66. /package/lib/{chunk-4ZDQTABD.js.map → chunk-C3T6ZGHT.js.map} +0 -0
  67. /package/lib/{chunk-6EPICSPE.js.map → chunk-C6F53R6B.js.map} +0 -0
  68. /package/lib/{chunk-ZY5R3PQ7.js.map → chunk-E7PD7E3N.js.map} +0 -0
  69. /package/lib/{chunk-SNJRCV7C.js.map → chunk-F4WMRFLF.js.map} +0 -0
  70. /package/lib/{chunk-3NZVJHKD.js.map → chunk-PFV24XHX.js.map} +0 -0
  71. /package/lib/{chunk-D3JSYEWW.js.map → chunk-PKSJIHVX.js.map} +0 -0
  72. /package/lib/{chunk-2AUGKQV3.js.map → chunk-SAXCWDM2.js.map} +0 -0
  73. /package/lib/{chunk-K5D4DEBD.js.map → chunk-SD76HDXA.js.map} +0 -0
  74. /package/lib/{chunk-VMGCYU46.js.map → chunk-STQVTMGC.js.map} +0 -0
  75. /package/lib/{chunk-LK5MZSEL.js.map → chunk-TL65K2NO.js.map} +0 -0
  76. /package/lib/{chunk-HSE6KOCD.js.map → chunk-UB7MZOP3.js.map} +0 -0
  77. /package/lib/{chunk-3KVZZTCO.js.map → chunk-V26TFF73.js.map} +0 -0
  78. /package/lib/{chunk-IHUS7BH5.js.map → chunk-V6BWCM2L.js.map} +0 -0
  79. /package/lib/{chunk-CHXSRL4K.js.map → chunk-VQVCY5QM.js.map} +0 -0
  80. /package/lib/{chunk-GQMSTSID.js.map → chunk-VSWSP6E7.js.map} +0 -0
@@ -106,18 +106,18 @@ import {
106
106
  version,
107
107
  vesting,
108
108
  voting
109
- } from "../../chunk-K7JXI2BE.js";
109
+ } from "../../chunk-A6KCJWA4.js";
110
110
  import "../../chunk-JDTHJKBB.js";
111
111
  import "../../chunk-742S42NO.js";
112
112
  import "../../chunk-7IDGS56O.js";
113
- import "../../chunk-ZY5R3PQ7.js";
114
- import "../../chunk-Y2FX22WS.js";
115
- import "../../chunk-2R55GIR5.js";
116
- import "../../chunk-HSE6KOCD.js";
113
+ import "../../chunk-E7PD7E3N.js";
114
+ import "../../chunk-3OTGCX2I.js";
115
+ import "../../chunk-7P6ISWWR.js";
116
+ import "../../chunk-UB7MZOP3.js";
117
117
  import "../../chunk-WYM4IYMI.js";
118
118
  import "../../chunk-EZWWCMDA.js";
119
119
  import "../../chunk-ZR7UHHH2.js";
120
- import "../../chunk-THDI7EX6.js";
120
+ import "../../chunk-E2JIP2R5.js";
121
121
  import "../../chunk-J5UEW4B7.js";
122
122
  import "../../chunk-R7PMHHKJ.js";
123
123
  export {
@@ -6,19 +6,19 @@ import {
6
6
  token_coin_swap,
7
7
  token_event_store,
8
8
  token_transfers
9
- } from "../../chunk-6EPICSPE.js";
10
- import "../../chunk-K7JXI2BE.js";
9
+ } from "../../chunk-C6F53R6B.js";
10
+ import "../../chunk-A6KCJWA4.js";
11
11
  import "../../chunk-JDTHJKBB.js";
12
12
  import "../../chunk-742S42NO.js";
13
13
  import "../../chunk-7IDGS56O.js";
14
- import "../../chunk-ZY5R3PQ7.js";
15
- import "../../chunk-Y2FX22WS.js";
16
- import "../../chunk-2R55GIR5.js";
17
- import "../../chunk-HSE6KOCD.js";
14
+ import "../../chunk-E7PD7E3N.js";
15
+ import "../../chunk-3OTGCX2I.js";
16
+ import "../../chunk-7P6ISWWR.js";
17
+ import "../../chunk-UB7MZOP3.js";
18
18
  import "../../chunk-WYM4IYMI.js";
19
19
  import "../../chunk-EZWWCMDA.js";
20
20
  import "../../chunk-ZR7UHHH2.js";
21
- import "../../chunk-THDI7EX6.js";
21
+ import "../../chunk-E2JIP2R5.js";
22
22
  import "../../chunk-J5UEW4B7.js";
23
23
  import "../../chunk-R7PMHHKJ.js";
24
24
  export {
@@ -6,19 +6,19 @@ import {
6
6
  property_map,
7
7
  royalty,
8
8
  token
9
- } from "../../chunk-IHUS7BH5.js";
10
- import "../../chunk-K7JXI2BE.js";
9
+ } from "../../chunk-V6BWCM2L.js";
10
+ import "../../chunk-A6KCJWA4.js";
11
11
  import "../../chunk-JDTHJKBB.js";
12
12
  import "../../chunk-742S42NO.js";
13
13
  import "../../chunk-7IDGS56O.js";
14
- import "../../chunk-ZY5R3PQ7.js";
15
- import "../../chunk-Y2FX22WS.js";
16
- import "../../chunk-2R55GIR5.js";
17
- import "../../chunk-HSE6KOCD.js";
14
+ import "../../chunk-E7PD7E3N.js";
15
+ import "../../chunk-3OTGCX2I.js";
16
+ import "../../chunk-7P6ISWWR.js";
17
+ import "../../chunk-UB7MZOP3.js";
18
18
  import "../../chunk-WYM4IYMI.js";
19
19
  import "../../chunk-EZWWCMDA.js";
20
20
  import "../../chunk-ZR7UHHH2.js";
21
- import "../../chunk-THDI7EX6.js";
21
+ import "../../chunk-E2JIP2R5.js";
22
22
  import "../../chunk-J5UEW4B7.js";
23
23
  import "../../chunk-R7PMHHKJ.js";
24
24
  export {
@@ -1,24 +1,24 @@
1
1
  import { createRequire as createRequireSdkShim } from 'module'; const require = createRequireSdkShim(import.meta.url);
2
2
  import {
3
3
  x3_exports
4
- } from "../../chunk-6EPICSPE.js";
4
+ } from "../../chunk-C6F53R6B.js";
5
5
  import {
6
6
  x4_exports
7
- } from "../../chunk-IHUS7BH5.js";
7
+ } from "../../chunk-V6BWCM2L.js";
8
8
  import {
9
9
  x1_exports
10
- } from "../../chunk-K7JXI2BE.js";
10
+ } from "../../chunk-A6KCJWA4.js";
11
11
  import "../../chunk-JDTHJKBB.js";
12
12
  import "../../chunk-742S42NO.js";
13
13
  import "../../chunk-7IDGS56O.js";
14
- import "../../chunk-ZY5R3PQ7.js";
15
- import "../../chunk-Y2FX22WS.js";
16
- import "../../chunk-2R55GIR5.js";
17
- import "../../chunk-HSE6KOCD.js";
14
+ import "../../chunk-E7PD7E3N.js";
15
+ import "../../chunk-3OTGCX2I.js";
16
+ import "../../chunk-7P6ISWWR.js";
17
+ import "../../chunk-UB7MZOP3.js";
18
18
  import "../../chunk-WYM4IYMI.js";
19
19
  import "../../chunk-EZWWCMDA.js";
20
20
  import "../../chunk-ZR7UHHH2.js";
21
- import "../../chunk-THDI7EX6.js";
21
+ import "../../chunk-E2JIP2R5.js";
22
22
  import "../../chunk-J5UEW4B7.js";
23
23
  import "../../chunk-R7PMHHKJ.js";
24
24
 
@@ -11,18 +11,18 @@ import {
11
11
  isWhiteListToken,
12
12
  tokenTokenValueInUsd,
13
13
  whitelistTokens
14
- } from "../../chunk-K7JXI2BE.js";
14
+ } from "../../chunk-A6KCJWA4.js";
15
15
  import "../../chunk-JDTHJKBB.js";
16
16
  import "../../chunk-742S42NO.js";
17
17
  import "../../chunk-7IDGS56O.js";
18
- import "../../chunk-ZY5R3PQ7.js";
19
- import "../../chunk-Y2FX22WS.js";
20
- import "../../chunk-2R55GIR5.js";
21
- import "../../chunk-HSE6KOCD.js";
18
+ import "../../chunk-E7PD7E3N.js";
19
+ import "../../chunk-3OTGCX2I.js";
20
+ import "../../chunk-7P6ISWWR.js";
21
+ import "../../chunk-UB7MZOP3.js";
22
22
  import "../../chunk-WYM4IYMI.js";
23
23
  import "../../chunk-EZWWCMDA.js";
24
24
  import "../../chunk-ZR7UHHH2.js";
25
- import "../../chunk-THDI7EX6.js";
25
+ import "../../chunk-E2JIP2R5.js";
26
26
  import "../../chunk-J5UEW4B7.js";
27
27
  import {
28
28
  __name
@@ -18,20 +18,20 @@ import {
18
18
  RichAptosClientWithContext,
19
19
  defaultMoveCoder,
20
20
  defaultMoveCoderForClient
21
- } from "../chunk-K7JXI2BE.js";
21
+ } from "../chunk-A6KCJWA4.js";
22
22
  import "../chunk-JDTHJKBB.js";
23
23
  import "../chunk-742S42NO.js";
24
24
  import "../chunk-7IDGS56O.js";
25
- import "../chunk-ZY5R3PQ7.js";
26
- import "../chunk-Y2FX22WS.js";
27
- import "../chunk-2R55GIR5.js";
25
+ import "../chunk-E7PD7E3N.js";
26
+ import "../chunk-3OTGCX2I.js";
27
+ import "../chunk-7P6ISWWR.js";
28
28
  import {
29
29
  BUILTIN_TYPES
30
- } from "../chunk-HSE6KOCD.js";
30
+ } from "../chunk-UB7MZOP3.js";
31
31
  import "../chunk-WYM4IYMI.js";
32
32
  import "../chunk-EZWWCMDA.js";
33
33
  import "../chunk-ZR7UHHH2.js";
34
- import "../chunk-THDI7EX6.js";
34
+ import "../chunk-E2JIP2R5.js";
35
35
  import "../chunk-J5UEW4B7.js";
36
36
  import "../chunk-R7PMHHKJ.js";
37
37
  export {
@@ -2,7 +2,7 @@ import { createRequire as createRequireSdkShim } from 'module'; const require =
2
2
  import {
3
3
  ALL_ADDRESS,
4
4
  require_lib
5
- } from "./chunk-THDI7EX6.js";
5
+ } from "./chunk-E2JIP2R5.js";
6
6
  import {
7
7
  __name,
8
8
  __toESM
@@ -8352,4 +8352,4 @@ export {
8352
8352
  @noble/hashes/esm/utils.js:
8353
8353
  (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
8354
8354
  */
8355
- //# sourceMappingURL=chunk-Y2FX22WS.js.map
8355
+ //# sourceMappingURL=chunk-3OTGCX2I.js.map
@@ -3,7 +3,7 @@ import {
3
3
  HandlerRegister,
4
4
  getHandlerName,
5
5
  proxyProcessor
6
- } from "./chunk-2R55GIR5.js";
6
+ } from "./chunk-7P6ISWWR.js";
7
7
  import {
8
8
  ALL_ADDRESS,
9
9
  BaseContext,
@@ -26,7 +26,7 @@ import {
26
26
  deserializeReceipt,
27
27
  normalizeLabels,
28
28
  require_lib
29
- } from "./chunk-THDI7EX6.js";
29
+ } from "./chunk-E2JIP2R5.js";
30
30
  import {
31
31
  __name,
32
32
  __toESM
@@ -1250,4 +1250,4 @@ export {
1250
1250
  FuelAbstractProcessor,
1251
1251
  TypedCall
1252
1252
  };
1253
- //# sourceMappingURL=chunk-7CBYHDRP.js.map
1253
+ //# sourceMappingURL=chunk-64OFOYWX.js.map
@@ -1,7 +1,7 @@
1
1
  import { createRequire as createRequireSdkShim } from 'module'; const require = createRequireSdkShim(import.meta.url);
2
2
  import {
3
3
  require_lib
4
- } from "./chunk-THDI7EX6.js";
4
+ } from "./chunk-E2JIP2R5.js";
5
5
  import {
6
6
  __name,
7
7
  __toESM
@@ -92,4 +92,4 @@ export {
92
92
  proxyHandlers,
93
93
  HandlerRegister
94
94
  };
95
- //# sourceMappingURL=chunk-2R55GIR5.js.map
95
+ //# sourceMappingURL=chunk-7P6ISWWR.js.map
@@ -7,12 +7,12 @@ import {
7
7
  } from "./chunk-742S42NO.js";
8
8
  import {
9
9
  getPriceByType
10
- } from "./chunk-ZY5R3PQ7.js";
10
+ } from "./chunk-E7PD7E3N.js";
11
11
  import {
12
12
  HandlerRegister,
13
13
  getHandlerName,
14
14
  proxyProcessor
15
- } from "./chunk-2R55GIR5.js";
15
+ } from "./chunk-7P6ISWWR.js";
16
16
  import {
17
17
  ANY_TYPE,
18
18
  AbstractMoveCoder,
@@ -26,7 +26,7 @@ import {
26
26
  matchType,
27
27
  moduleQname,
28
28
  parseMoveType
29
- } from "./chunk-HSE6KOCD.js";
29
+ } from "./chunk-UB7MZOP3.js";
30
30
  import {
31
31
  Field,
32
32
  FpInvertBatch,
@@ -97,7 +97,7 @@ import {
97
97
  PartitionHandlerManager,
98
98
  normalizeLabels,
99
99
  require_lib
100
- } from "./chunk-THDI7EX6.js";
100
+ } from "./chunk-E2JIP2R5.js";
101
101
  import {
102
102
  __commonJS,
103
103
  __export,
@@ -40727,4 +40727,4 @@ export {
40727
40727
  @scure/bip32/lib/esm/index.js:
40728
40728
  (*! scure-bip32 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
40729
40729
  */
40730
- //# sourceMappingURL=chunk-K7JXI2BE.js.map
40730
+ //# sourceMappingURL=chunk-A6KCJWA4.js.map
@@ -12,11 +12,11 @@ import {
12
12
  getContractByABI,
13
13
  getProcessor,
14
14
  getProvider
15
- } from "./chunk-ZY5R3PQ7.js";
15
+ } from "./chunk-E7PD7E3N.js";
16
16
  import {
17
17
  encodeCallData,
18
18
  transformEtherError
19
- } from "./chunk-Y2FX22WS.js";
19
+ } from "./chunk-3OTGCX2I.js";
20
20
  import {
21
21
  __export,
22
22
  __name
@@ -701,4 +701,4 @@ export {
701
701
  mockURILog,
702
702
  erc1155_exports
703
703
  };
704
- //# sourceMappingURL=chunk-S6KKBMOL.js.map
704
+ //# sourceMappingURL=chunk-C3JICYMS.js.map
@@ -7,7 +7,7 @@ import {
7
7
  normalizeSuiAddress,
8
8
  normalizeSuiObjectId,
9
9
  suiBcs
10
- } from "./chunk-SNJRCV7C.js";
10
+ } from "./chunk-F4WMRFLF.js";
11
11
  import {
12
12
  IotaClient,
13
13
  IotaNetwork,
@@ -16,12 +16,12 @@ import {
16
16
  iotaBcs,
17
17
  normalizeIotaAddress,
18
18
  normalizeIotaObjectId
19
- } from "./chunk-LK5MZSEL.js";
19
+ } from "./chunk-TL65K2NO.js";
20
20
  import {
21
21
  HandlerRegister,
22
22
  getHandlerName,
23
23
  proxyProcessor
24
- } from "./chunk-2R55GIR5.js";
24
+ } from "./chunk-7P6ISWWR.js";
25
25
  import {
26
26
  ANY_TYPE,
27
27
  AbstractMoveCoder,
@@ -35,7 +35,7 @@ import {
35
35
  accountTypeString,
36
36
  moduleQname,
37
37
  parseMoveType
38
- } from "./chunk-HSE6KOCD.js";
38
+ } from "./chunk-UB7MZOP3.js";
39
39
  import {
40
40
  ALL_ADDRESS,
41
41
  AccountConfig,
@@ -46,7 +46,7 @@ import {
46
46
  PartitionHandlerManager,
47
47
  normalizeLabels,
48
48
  require_lib
49
- } from "./chunk-THDI7EX6.js";
49
+ } from "./chunk-E2JIP2R5.js";
50
50
  import {
51
51
  __name,
52
52
  __toESM
@@ -3447,4 +3447,4 @@ export {
3447
3447
  SuiPlugin,
3448
3448
  IotaPlugin
3449
3449
  };
3450
- //# sourceMappingURL=chunk-4ZDQTABD.js.map
3450
+ //# sourceMappingURL=chunk-C3T6ZGHT.js.map
@@ -5,11 +5,11 @@ import {
5
5
  defaultMoveCoder,
6
6
  defaultMoveCoderForClient,
7
7
  loadAllTypes
8
- } from "./chunk-K7JXI2BE.js";
8
+ } from "./chunk-A6KCJWA4.js";
9
9
  import {
10
10
  ANY_TYPE,
11
11
  TypeDescriptor
12
- } from "./chunk-HSE6KOCD.js";
12
+ } from "./chunk-UB7MZOP3.js";
13
13
  import {
14
14
  __export,
15
15
  __name
@@ -1794,4 +1794,4 @@ export {
1794
1794
  loadAllTypes2 as loadAllTypes,
1795
1795
  x3_exports
1796
1796
  };
1797
- //# sourceMappingURL=chunk-6EPICSPE.js.map
1797
+ //# sourceMappingURL=chunk-C6F53R6B.js.map
@@ -101773,6 +101773,7 @@ var baseSchema = (0, import_graphql4.buildASTSchema)(
101773
101773
  directive @jsonField on OBJECT # legacy
101774
101774
  directive @aggregation(intervals: [String!]! = ["hour"], source: String!) on OBJECT
101775
101775
  directive @aggregate(fn: String!, arg: String, cumulative: Boolean = false) on FIELD_DEFINITION
101776
+ directive @cache(sizeMB: Int!) on OBJECT
101776
101777
  ${customScalars.map((name) => "scalar " + name).join("\n")}
101777
101778
  `)
101778
101779
  );
@@ -102886,6 +102887,155 @@ function getStore() {
102886
102887
  __name(getStore, "getStore");
102887
102888
  import("node:process").then((p) => p.stdout.write(""));
102888
102889
 
102890
+ // src/store/cache.ts
102891
+ var CacheItemEntityName = "MemoryCacheItem";
102892
+ var MemoryCache = class {
102893
+ constructor(storeContext, context) {
102894
+ this.storeContext = storeContext;
102895
+ this.context = context;
102896
+ }
102897
+ static {
102898
+ __name(this, "MemoryCache");
102899
+ }
102900
+ /**
102901
+ * Retrieves a value from the cache.
102902
+ *
102903
+ * @typeParam T - The expected type of the cached value
102904
+ * @param key - The unique key identifying the cached value
102905
+ * @returns The cached value deserialized as type T, or null if not found
102906
+ *
102907
+ * @example
102908
+ * ```typescript
102909
+ * const user = await ctx.cache.get<{ name: string, score: number }>('user:123')
102910
+ * if (user) {
102911
+ * console.log(user.name, user.score)
102912
+ * }
102913
+ * ```
102914
+ */
102915
+ async get(key) {
102916
+ const promise = this.storeContext.sendRequest({
102917
+ get: {
102918
+ entity: CacheItemEntityName,
102919
+ id: key
102920
+ }
102921
+ });
102922
+ const data = await promise;
102923
+ if (data.entityList?.entities[0]) {
102924
+ const entityData = data.entityList?.entities[0]?.data;
102925
+ const value = entityData.fields["value"];
102926
+ return JSON.parse(value.stringValue);
102927
+ }
102928
+ return null;
102929
+ }
102930
+ /**
102931
+ * Stores a value in the cache.
102932
+ *
102933
+ * @typeParam T - The type of value being stored (must be JSON-serializable)
102934
+ * @param key - The unique key to store the value under
102935
+ * @param value - The value to cache (will be JSON serialized)
102936
+ *
102937
+ * @example
102938
+ * ```typescript
102939
+ * await ctx.cache.set('config', { threshold: 100, enabled: true })
102940
+ * await ctx.cache.set('lastPrice', 1234.56)
102941
+ * ```
102942
+ */
102943
+ async set(key, value) {
102944
+ const entityData = {
102945
+ fields: {
102946
+ id: {
102947
+ stringValue: key
102948
+ },
102949
+ value: {
102950
+ stringValue: JSON.stringify(value)
102951
+ }
102952
+ }
102953
+ };
102954
+ const request = {
102955
+ upsert: {
102956
+ entity: [CacheItemEntityName],
102957
+ id: [key],
102958
+ entityData: [entityData]
102959
+ }
102960
+ };
102961
+ await this.storeContext.sendRequest(request);
102962
+ }
102963
+ /**
102964
+ * Removes a value from the cache.
102965
+ *
102966
+ * @param key - The key of the value to remove
102967
+ *
102968
+ * @example
102969
+ * ```typescript
102970
+ * await ctx.cache.delete('temporaryData')
102971
+ * ```
102972
+ */
102973
+ async delete(key) {
102974
+ const request = {
102975
+ delete: {
102976
+ entity: [CacheItemEntityName],
102977
+ id: [key]
102978
+ }
102979
+ };
102980
+ await this.storeContext.sendRequest(request);
102981
+ }
102982
+ /**
102983
+ * Stores a value scoped to the current block number.
102984
+ *
102985
+ * The key is automatically prefixed with the block number, ensuring that
102986
+ * values set in different blocks don't collide. Useful for accumulating
102987
+ * per-block statistics or temporary computation results.
102988
+ *
102989
+ * @typeParam T - The type of value being stored (must be JSON-serializable)
102990
+ * @param key - The key to store the value under (will be prefixed with block number)
102991
+ * @param value - The value to cache
102992
+ *
102993
+ * @example
102994
+ * ```typescript
102995
+ * // Track transfers per block
102996
+ * let count = await ctx.cache.getInBlock<number>('transferCount') ?? 0
102997
+ * await ctx.cache.setInBlock('transferCount', count + 1)
102998
+ * ```
102999
+ */
103000
+ async setInBlock(key, value) {
103001
+ const block = this.context.getMetaData("for cache", {}).blockNumber;
103002
+ return this.set(`${block}-${key}`, value);
103003
+ }
103004
+ /**
103005
+ * Retrieves a value scoped to the current block number.
103006
+ *
103007
+ * Only returns values that were set in the same block using `setInBlock`.
103008
+ *
103009
+ * @typeParam T - The expected type of the cached value
103010
+ * @param key - The key to retrieve (block number prefix is added automatically)
103011
+ * @returns The cached value for this block, or null if not found
103012
+ *
103013
+ * @example
103014
+ * ```typescript
103015
+ * const blockVolume = await ctx.cache.getInBlock<bigint>('volume')
103016
+ * ```
103017
+ */
103018
+ async getInBlock(key) {
103019
+ const block = this.context.getMetaData("for cache", {}).blockNumber;
103020
+ return this.get(`${block}-${key}`);
103021
+ }
103022
+ /**
103023
+ * Removes a value scoped to the current block number.
103024
+ *
103025
+ * @param key - The key to delete (block number prefix is added automatically)
103026
+ *
103027
+ * @example
103028
+ * ```typescript
103029
+ * await ctx.cache.deleteInBlock('temporaryBlockData')
103030
+ * ```
103031
+ */
103032
+ async deleteInBlock(key) {
103033
+ const block = this.context.getMetaData("for cache", {}).blockNumber;
103034
+ return this.delete(`${block}-${key}`);
103035
+ }
103036
+ };
103037
+ import("node:process").then((p) => p.stdout.write(""));
103038
+
102889
103039
  // src/core/base-context.ts
102890
103040
  var BaseContext = class {
102891
103041
  static {
@@ -102894,6 +103044,7 @@ var BaseContext = class {
102894
103044
  meter;
102895
103045
  eventLogger;
102896
103046
  _store;
103047
+ _cache;
102897
103048
  baseLabels;
102898
103049
  active;
102899
103050
  _res = {
@@ -102955,6 +103106,36 @@ var BaseContext = class {
102955
103106
  }
102956
103107
  return this._store;
102957
103108
  }
103109
+ /**
103110
+ * Access the in-memory key-value cache.
103111
+ *
103112
+ * The cache allows storing and retrieving JSON-serializable values that persist
103113
+ * across handler invocations. Useful for caching computed results, tracking
103114
+ * cumulative state, or storing intermediate processing data.
103115
+ *
103116
+ * @returns The MemoryCache instance, or undefined if cache is not available
103117
+ *
103118
+ * @example
103119
+ * ```typescript
103120
+ * // Store and retrieve values
103121
+ * await ctx.cache.set('totalVolume', volume)
103122
+ * const cached = await ctx.cache.get<number>('totalVolume')
103123
+ *
103124
+ * // Block-scoped values (isolated per block)
103125
+ * await ctx.cache.setInBlock('blockCount', count)
103126
+ * ```
103127
+ *
103128
+ * @see {@link MemoryCache} for full API documentation
103129
+ */
103130
+ get cache() {
103131
+ if (!this._cache) {
103132
+ const dbContext = PluginManager3.INSTANCE.dbContextLocalStorage.getStore();
103133
+ if (dbContext) {
103134
+ this._cache = new MemoryCache(dbContext, this);
103135
+ }
103136
+ }
103137
+ return this._cache;
103138
+ }
102958
103139
  // this method must be called within the dbContextLocalStorage scope
102959
103140
  initStore() {
102960
103141
  const dbContext = PluginManager3.INSTANCE.dbContextLocalStorage.getStore();
@@ -103004,7 +103185,7 @@ var Exporter = class _Exporter extends NamedResultDescriptor {
103004
103185
  import("node:process").then((p) => p.stdout.write(""));
103005
103186
 
103006
103187
  // src/core/core-plugin.ts
103007
- import { Plugin, PluginManager as PluginManager4 } from "@sentio/runtime";
103188
+ import { GLOBAL_CONFIG, Plugin, PluginManager as PluginManager4 } from "@sentio/runtime";
103008
103189
  var CorePlugin = class extends Plugin {
103009
103190
  static {
103010
103191
  __name(this, "CorePlugin");
@@ -103033,9 +103214,17 @@ var CorePlugin = class extends Plugin {
103033
103214
  channel: exporter.channel
103034
103215
  });
103035
103216
  }
103036
- if (DatabaseSchemaState.INSTANCE.getValues().length > 0) {
103037
- const schemas = DatabaseSchemaState.INSTANCE.getValues();
103038
- const mergedSources = mergeSchemas(schemas);
103217
+ const schemas = DatabaseSchemaState.INSTANCE.getValues();
103218
+ let mergedSources = mergeSchemas(schemas);
103219
+ if (GLOBAL_CONFIG.cache?.enabled) {
103220
+ mergedSources += `
103221
+ type MemoryCacheItem @entity @cache(sizeMB: ${GLOBAL_CONFIG.cache.size || 100}) {
103222
+ id: ID!
103223
+ value: String!
103224
+ }
103225
+ `;
103226
+ }
103227
+ if (mergedSources.trim().length > 0) {
103039
103228
  config.dbSchema = {
103040
103229
  gqlSchema: mergedSources
103041
103230
  };
@@ -103490,4 +103679,4 @@ long/index.js:
103490
103679
  * SPDX-License-Identifier: Apache-2.0
103491
103680
  *)
103492
103681
  */
103493
- //# sourceMappingURL=chunk-THDI7EX6.js.map
103682
+ //# sourceMappingURL=chunk-E2JIP2R5.js.map