@sentio/sdk 2.57.12-rc.j → 2.57.13-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 (250) hide show
  1. package/lib/core/template.d.ts +1 -5
  2. package/lib/core/template.d.ts.map +1 -1
  3. package/lib/core/template.js +1 -4
  4. package/lib/core/template.js.map +1 -1
  5. package/lib/store/store.d.ts +2 -2
  6. package/lib/store/store.d.ts.map +1 -1
  7. package/lib/store/store.js.map +1 -1
  8. package/package.json +3 -3
  9. package/src/core/template.ts +1 -6
  10. package/src/store/store.ts +2 -3
  11. package/lib/chunk-2F2KNF4Z.js +0 -71905
  12. package/lib/chunk-2F2KNF4Z.js.map +0 -1
  13. package/lib/chunk-43HP4DQZ.js +0 -47
  14. package/lib/chunk-43HP4DQZ.js.map +0 -1
  15. package/lib/chunk-4HPFNKDX.js +0 -6763
  16. package/lib/chunk-4HPFNKDX.js.map +0 -1
  17. package/lib/chunk-4OCWUYSJ.js +0 -898
  18. package/lib/chunk-4OCWUYSJ.js.map +0 -1
  19. package/lib/chunk-6UVWNOIX.js +0 -4207
  20. package/lib/chunk-6UVWNOIX.js.map +0 -1
  21. package/lib/chunk-73SHERGU.js +0 -23970
  22. package/lib/chunk-73SHERGU.js.map +0 -1
  23. package/lib/chunk-742S42NO.js +0 -1323
  24. package/lib/chunk-742S42NO.js.map +0 -1
  25. package/lib/chunk-7ECRTQD7.js +0 -26757
  26. package/lib/chunk-7ECRTQD7.js.map +0 -1
  27. package/lib/chunk-7IDGS56O.js +0 -5058
  28. package/lib/chunk-7IDGS56O.js.map +0 -1
  29. package/lib/chunk-7S6WQ4RL.js +0 -1069
  30. package/lib/chunk-7S6WQ4RL.js.map +0 -1
  31. package/lib/chunk-AZFMPZRN.js +0 -3613
  32. package/lib/chunk-AZFMPZRN.js.map +0 -1
  33. package/lib/chunk-BZCXYTDE.js +0 -1333
  34. package/lib/chunk-BZCXYTDE.js.map +0 -1
  35. package/lib/chunk-E2DS6WZF.js +0 -1690
  36. package/lib/chunk-E2DS6WZF.js.map +0 -1
  37. package/lib/chunk-GE6BRIGS.js +0 -1721
  38. package/lib/chunk-GE6BRIGS.js.map +0 -1
  39. package/lib/chunk-J3I3VNTV.js +0 -767
  40. package/lib/chunk-J3I3VNTV.js.map +0 -1
  41. package/lib/chunk-J3QOJ2RV.js +0 -661
  42. package/lib/chunk-J3QOJ2RV.js.map +0 -1
  43. package/lib/chunk-J5UEW4B7.js +0 -1351
  44. package/lib/chunk-J5UEW4B7.js.map +0 -1
  45. package/lib/chunk-LPSNAS2G.js +0 -460
  46. package/lib/chunk-LPSNAS2G.js.map +0 -1
  47. package/lib/chunk-LR232ZJV.js +0 -2593
  48. package/lib/chunk-LR232ZJV.js.map +0 -1
  49. package/lib/chunk-N36N7RXJ.js +0 -653
  50. package/lib/chunk-N36N7RXJ.js.map +0 -1
  51. package/lib/chunk-OJG2VJ5T.js +0 -7063
  52. package/lib/chunk-OJG2VJ5T.js.map +0 -1
  53. package/lib/chunk-ONBEMKI5.js +0 -323
  54. package/lib/chunk-ONBEMKI5.js.map +0 -1
  55. package/lib/chunk-PVX2LIM5.js +0 -205
  56. package/lib/chunk-PVX2LIM5.js.map +0 -1
  57. package/lib/chunk-R7PMHHKJ.js +0 -52
  58. package/lib/chunk-R7PMHHKJ.js.map +0 -1
  59. package/lib/chunk-RMT2JEWA.js +0 -7740
  60. package/lib/chunk-RMT2JEWA.js.map +0 -1
  61. package/lib/chunk-S6MJ3KIL.js +0 -27798
  62. package/lib/chunk-S6MJ3KIL.js.map +0 -1
  63. package/lib/chunk-UEFVZL4I.js +0 -199
  64. package/lib/chunk-UEFVZL4I.js.map +0 -1
  65. package/lib/chunk-UIBPOKNT.js +0 -945
  66. package/lib/chunk-UIBPOKNT.js.map +0 -1
  67. package/lib/chunk-ZR7UHHH2.js +0 -5
  68. package/lib/chunk-ZR7UHHH2.js.map +0 -1
  69. package/lib/multipart-parser-SQIYSR67.js +0 -368
  70. package/lib/multipart-parser-SQIYSR67.js.map +0 -1
  71. package/src/aptos/builtin/0x1.d.ts +0 -6451
  72. package/src/aptos/builtin/0x1.d.ts.map +0 -1
  73. package/src/aptos/builtin/0x1.js +0 -7138
  74. package/src/aptos/builtin/0x1.js.map +0 -1
  75. package/src/aptos/builtin/0x3.d.ts +0 -1122
  76. package/src/aptos/builtin/0x3.d.ts.map +0 -1
  77. package/src/aptos/builtin/0x3.js +0 -937
  78. package/src/aptos/builtin/0x3.js.map +0 -1
  79. package/src/aptos/builtin/0x4.d.ts +0 -551
  80. package/src/aptos/builtin/0x4.d.ts.map +0 -1
  81. package/src/aptos/builtin/0x4.js +0 -529
  82. package/src/aptos/builtin/0x4.js.map +0 -1
  83. package/src/aptos/builtin/index.d.ts +0 -4
  84. package/src/aptos/builtin/index.d.ts.map +0 -1
  85. package/src/aptos/builtin/index.js +0 -7
  86. package/src/aptos/builtin/index.js.map +0 -1
  87. package/src/eth/builtin/eacaggregatorproxy.d.ts +0 -5
  88. package/src/eth/builtin/eacaggregatorproxy.d.ts.map +0 -1
  89. package/src/eth/builtin/eacaggregatorproxy.js +0 -8
  90. package/src/eth/builtin/eacaggregatorproxy.js.map +0 -1
  91. package/src/eth/builtin/erc1155.d.ts +0 -5
  92. package/src/eth/builtin/erc1155.d.ts.map +0 -1
  93. package/src/eth/builtin/erc1155.js +0 -8
  94. package/src/eth/builtin/erc1155.js.map +0 -1
  95. package/src/eth/builtin/erc20.d.ts +0 -5
  96. package/src/eth/builtin/erc20.d.ts.map +0 -1
  97. package/src/eth/builtin/erc20.js +0 -8
  98. package/src/eth/builtin/erc20.js.map +0 -1
  99. package/src/eth/builtin/erc20bytes.d.ts +0 -5
  100. package/src/eth/builtin/erc20bytes.d.ts.map +0 -1
  101. package/src/eth/builtin/erc20bytes.js +0 -8
  102. package/src/eth/builtin/erc20bytes.js.map +0 -1
  103. package/src/eth/builtin/erc721.d.ts +0 -5
  104. package/src/eth/builtin/erc721.d.ts.map +0 -1
  105. package/src/eth/builtin/erc721.js +0 -8
  106. package/src/eth/builtin/erc721.js.map +0 -1
  107. package/src/eth/builtin/index.d.ts +0 -13
  108. package/src/eth/builtin/index.d.ts.map +0 -1
  109. package/src/eth/builtin/index.js +0 -16
  110. package/src/eth/builtin/index.js.map +0 -1
  111. package/src/eth/builtin/internal/EACAggregatorProxy.d.ts +0 -50
  112. package/src/eth/builtin/internal/EACAggregatorProxy.d.ts.map +0 -1
  113. package/src/eth/builtin/internal/EACAggregatorProxy.js +0 -2
  114. package/src/eth/builtin/internal/EACAggregatorProxy.js.map +0 -1
  115. package/src/eth/builtin/internal/ERC1155.d.ts +0 -57
  116. package/src/eth/builtin/internal/ERC1155.d.ts.map +0 -1
  117. package/src/eth/builtin/internal/ERC1155.js +0 -2
  118. package/src/eth/builtin/internal/ERC1155.js.map +0 -1
  119. package/src/eth/builtin/internal/ERC20.d.ts +0 -41
  120. package/src/eth/builtin/internal/ERC20.d.ts.map +0 -1
  121. package/src/eth/builtin/internal/ERC20.js +0 -2
  122. package/src/eth/builtin/internal/ERC20.js.map +0 -1
  123. package/src/eth/builtin/internal/ERC20Bytes.d.ts +0 -32
  124. package/src/eth/builtin/internal/ERC20Bytes.d.ts.map +0 -1
  125. package/src/eth/builtin/internal/ERC20Bytes.js +0 -2
  126. package/src/eth/builtin/internal/ERC20Bytes.js.map +0 -1
  127. package/src/eth/builtin/internal/ERC721.d.ts +0 -43
  128. package/src/eth/builtin/internal/ERC721.d.ts.map +0 -1
  129. package/src/eth/builtin/internal/ERC721.js +0 -2
  130. package/src/eth/builtin/internal/ERC721.js.map +0 -1
  131. package/src/eth/builtin/internal/WETH9.d.ts +0 -47
  132. package/src/eth/builtin/internal/WETH9.d.ts.map +0 -1
  133. package/src/eth/builtin/internal/WETH9.js +0 -2
  134. package/src/eth/builtin/internal/WETH9.js.map +0 -1
  135. package/src/eth/builtin/internal/common.d.ts +0 -3
  136. package/src/eth/builtin/internal/common.d.ts.map +0 -1
  137. package/src/eth/builtin/internal/common.js +0 -8
  138. package/src/eth/builtin/internal/common.js.map +0 -1
  139. package/src/eth/builtin/internal/eacaggregatorproxy-processor.d.ts +0 -373
  140. package/src/eth/builtin/internal/eacaggregatorproxy-processor.d.ts.map +0 -1
  141. package/src/eth/builtin/internal/eacaggregatorproxy-processor.js +0 -1355
  142. package/src/eth/builtin/internal/eacaggregatorproxy-processor.js.map +0 -1
  143. package/src/eth/builtin/internal/eacaggregatorproxy-test-utils.d.ts +0 -7
  144. package/src/eth/builtin/internal/eacaggregatorproxy-test-utils.d.ts.map +0 -1
  145. package/src/eth/builtin/internal/eacaggregatorproxy-test-utils.js +0 -55
  146. package/src/eth/builtin/internal/eacaggregatorproxy-test-utils.js.map +0 -1
  147. package/src/eth/builtin/internal/erc1155-processor.d.ts +0 -173
  148. package/src/eth/builtin/internal/erc1155-processor.d.ts.map +0 -1
  149. package/src/eth/builtin/internal/erc1155-processor.js +0 -596
  150. package/src/eth/builtin/internal/erc1155-processor.js.map +0 -1
  151. package/src/eth/builtin/internal/erc1155-test-utils.d.ts +0 -7
  152. package/src/eth/builtin/internal/erc1155-test-utils.d.ts.map +0 -1
  153. package/src/eth/builtin/internal/erc1155-test-utils.js +0 -55
  154. package/src/eth/builtin/internal/erc1155-test-utils.js.map +0 -1
  155. package/src/eth/builtin/internal/erc20-processor.d.ts +0 -244
  156. package/src/eth/builtin/internal/erc20-processor.d.ts.map +0 -1
  157. package/src/eth/builtin/internal/erc20-processor.js +0 -1109
  158. package/src/eth/builtin/internal/erc20-processor.js.map +0 -1
  159. package/src/eth/builtin/internal/erc20-test-utils.d.ts +0 -6
  160. package/src/eth/builtin/internal/erc20-test-utils.d.ts.map +0 -1
  161. package/src/eth/builtin/internal/erc20-test-utils.js +0 -44
  162. package/src/eth/builtin/internal/erc20-test-utils.js.map +0 -1
  163. package/src/eth/builtin/internal/erc20bytes-processor.d.ts +0 -144
  164. package/src/eth/builtin/internal/erc20bytes-processor.d.ts.map +0 -1
  165. package/src/eth/builtin/internal/erc20bytes-processor.js +0 -594
  166. package/src/eth/builtin/internal/erc20bytes-processor.js.map +0 -1
  167. package/src/eth/builtin/internal/erc20bytes-test-utils.d.ts +0 -5
  168. package/src/eth/builtin/internal/erc20bytes-test-utils.d.ts.map +0 -1
  169. package/src/eth/builtin/internal/erc20bytes-test-utils.js +0 -33
  170. package/src/eth/builtin/internal/erc20bytes-test-utils.js.map +0 -1
  171. package/src/eth/builtin/internal/erc721-processor.d.ts +0 -215
  172. package/src/eth/builtin/internal/erc721-processor.d.ts.map +0 -1
  173. package/src/eth/builtin/internal/erc721-processor.js +0 -895
  174. package/src/eth/builtin/internal/erc721-processor.js.map +0 -1
  175. package/src/eth/builtin/internal/erc721-test-utils.d.ts +0 -6
  176. package/src/eth/builtin/internal/erc721-test-utils.d.ts.map +0 -1
  177. package/src/eth/builtin/internal/erc721-test-utils.js +0 -44
  178. package/src/eth/builtin/internal/erc721-test-utils.js.map +0 -1
  179. package/src/eth/builtin/internal/factories/EACAggregatorProxy__factory.d.ts +0 -400
  180. package/src/eth/builtin/internal/factories/EACAggregatorProxy__factory.d.ts.map +0 -1
  181. package/src/eth/builtin/internal/factories/EACAggregatorProxy__factory.js +0 -524
  182. package/src/eth/builtin/internal/factories/EACAggregatorProxy__factory.js.map +0 -1
  183. package/src/eth/builtin/internal/factories/ERC1155__factory.d.ts +0 -251
  184. package/src/eth/builtin/internal/factories/ERC1155__factory.d.ts.map +0 -1
  185. package/src/eth/builtin/internal/factories/ERC1155__factory.js +0 -329
  186. package/src/eth/builtin/internal/factories/ERC1155__factory.js.map +0 -1
  187. package/src/eth/builtin/internal/factories/ERC20Bytes__factory.d.ts +0 -185
  188. package/src/eth/builtin/internal/factories/ERC20Bytes__factory.d.ts.map +0 -1
  189. package/src/eth/builtin/internal/factories/ERC20Bytes__factory.js +0 -251
  190. package/src/eth/builtin/internal/factories/ERC20Bytes__factory.js.map +0 -1
  191. package/src/eth/builtin/internal/factories/ERC20__factory.d.ts +0 -303
  192. package/src/eth/builtin/internal/factories/ERC20__factory.d.ts.map +0 -1
  193. package/src/eth/builtin/internal/factories/ERC20__factory.js +0 -401
  194. package/src/eth/builtin/internal/factories/ERC20__factory.js.map +0 -1
  195. package/src/eth/builtin/internal/factories/ERC721__factory.d.ts +0 -273
  196. package/src/eth/builtin/internal/factories/ERC721__factory.d.ts.map +0 -1
  197. package/src/eth/builtin/internal/factories/ERC721__factory.js +0 -361
  198. package/src/eth/builtin/internal/factories/ERC721__factory.js.map +0 -1
  199. package/src/eth/builtin/internal/factories/WETH9__factory.d.ts +0 -220
  200. package/src/eth/builtin/internal/factories/WETH9__factory.d.ts.map +0 -1
  201. package/src/eth/builtin/internal/factories/WETH9__factory.js +0 -294
  202. package/src/eth/builtin/internal/factories/WETH9__factory.js.map +0 -1
  203. package/src/eth/builtin/internal/factories/index.d.ts +0 -7
  204. package/src/eth/builtin/internal/factories/index.d.ts.map +0 -1
  205. package/src/eth/builtin/internal/factories/index.js +0 -10
  206. package/src/eth/builtin/internal/factories/index.js.map +0 -1
  207. package/src/eth/builtin/internal/index.d.ts +0 -14
  208. package/src/eth/builtin/internal/index.d.ts.map +0 -1
  209. package/src/eth/builtin/internal/index.js +0 -8
  210. package/src/eth/builtin/internal/index.js.map +0 -1
  211. package/src/eth/builtin/internal/weth9-processor.d.ts +0 -172
  212. package/src/eth/builtin/internal/weth9-processor.d.ts.map +0 -1
  213. package/src/eth/builtin/internal/weth9-processor.js +0 -729
  214. package/src/eth/builtin/internal/weth9-processor.js.map +0 -1
  215. package/src/eth/builtin/internal/weth9-test-utils.d.ts +0 -7
  216. package/src/eth/builtin/internal/weth9-test-utils.d.ts.map +0 -1
  217. package/src/eth/builtin/internal/weth9-test-utils.js +0 -55
  218. package/src/eth/builtin/internal/weth9-test-utils.js.map +0 -1
  219. package/src/eth/builtin/weth9.d.ts +0 -5
  220. package/src/eth/builtin/weth9.d.ts.map +0 -1
  221. package/src/eth/builtin/weth9.js +0 -8
  222. package/src/eth/builtin/weth9.js.map +0 -1
  223. package/src/solana/builtin/index.d.ts +0 -2
  224. package/src/solana/builtin/index.d.ts.map +0 -1
  225. package/src/solana/builtin/index.js +0 -2
  226. package/src/solana/builtin/index.js.map +0 -1
  227. package/src/solana/builtin/spl-token-processor.d.ts +0 -40
  228. package/src/solana/builtin/spl-token-processor.d.ts.map +0 -1
  229. package/src/solana/builtin/spl-token-processor.js +0 -254
  230. package/src/solana/builtin/spl-token-processor.js.map +0 -1
  231. package/src/solana/builtin/types.d.ts +0 -428
  232. package/src/solana/builtin/types.d.ts.map +0 -1
  233. package/src/solana/builtin/types.js +0 -201
  234. package/src/solana/builtin/types.js.map +0 -1
  235. package/src/sui/builtin/0x1.d.ts +0 -114
  236. package/src/sui/builtin/0x1.d.ts.map +0 -1
  237. package/src/sui/builtin/0x1.js +0 -159
  238. package/src/sui/builtin/0x1.js.map +0 -1
  239. package/src/sui/builtin/0x2.d.ts +0 -1250
  240. package/src/sui/builtin/0x2.d.ts.map +0 -1
  241. package/src/sui/builtin/0x2.js +0 -1511
  242. package/src/sui/builtin/0x2.js.map +0 -1
  243. package/src/sui/builtin/0x3.d.ts +0 -774
  244. package/src/sui/builtin/0x3.d.ts.map +0 -1
  245. package/src/sui/builtin/0x3.js +0 -720
  246. package/src/sui/builtin/0x3.js.map +0 -1
  247. package/src/sui/builtin/index.d.ts +0 -4
  248. package/src/sui/builtin/index.d.ts.map +0 -1
  249. package/src/sui/builtin/index.js +0 -7
  250. package/src/sui/builtin/index.js.map +0 -1
@@ -1,1069 +0,0 @@
1
- import { createRequire as createRequireSdkShim } from 'module'; const require = createRequireSdkShim(import.meta.url);
2
- import {
3
- getHandlerName,
4
- proxyProcessor
5
- } from "./chunk-43HP4DQZ.js";
6
- import {
7
- ALL_ADDRESS,
8
- BaseContext,
9
- BigNumberCoder,
10
- Contract,
11
- ContractConfig,
12
- HandlerType,
13
- InputType,
14
- Interface,
15
- OutputType,
16
- ProcessResult,
17
- Provider,
18
- ReceiptType,
19
- TemplateInstanceState,
20
- TransactionCoder,
21
- TransactionResponse,
22
- arrayify,
23
- assembleTransactionSummary,
24
- bn,
25
- normalizeLabels,
26
- processGqlReceipt
27
- } from "./chunk-2F2KNF4Z.js";
28
- import {
29
- require_lib
30
- } from "./chunk-73SHERGU.js";
31
- import {
32
- __name,
33
- __toESM
34
- } from "./chunk-R7PMHHKJ.js";
35
-
36
- // src/fuel/fuel-plugin.ts
37
- import { errorString, GLOBAL_CONFIG, mergeProcessResults as mergeProcessResults2, Plugin, PluginManager, USER_PROCESSOR } from "@sentio/runtime";
38
- var import_nice_grpc2 = __toESM(require_lib(), 1);
39
-
40
- // src/fuel/types.ts
41
- import { MapStateStorage } from "@sentio/runtime";
42
- var FuelProcessorState = class _FuelProcessorState extends MapStateStorage {
43
- static {
44
- __name(this, "FuelProcessorState");
45
- }
46
- static INSTANCE = new _FuelProcessorState();
47
- };
48
- import("node:process").then((p) => p.stdout.write(""));
49
-
50
- // src/fuel/network.ts
51
- import { FuelChainId } from "@sentio/chain";
52
- import { Endpoints } from "@sentio/runtime";
53
- var FuelNetwork = {
54
- MAIN_NET: FuelChainId.FUEL_MAINNET,
55
- TEST_NET: FuelChainId.FUEL_TESTNET
56
- };
57
- function getRpcEndpoint(network) {
58
- switch (network) {
59
- case FuelNetwork.TEST_NET:
60
- return "https://testnet.fuel.network/v1/graphql";
61
- }
62
- return "https://mainnet.fuel.network/v1/graphql";
63
- }
64
- __name(getRpcEndpoint, "getRpcEndpoint");
65
- function getProvider(network) {
66
- let chainServer = Endpoints.INSTANCE.chainServer.get(network);
67
- if (!chainServer) {
68
- chainServer = getRpcEndpoint(network);
69
- }
70
- return Provider.create(chainServer);
71
- }
72
- __name(getProvider, "getProvider");
73
- import("node:process").then((p) => p.stdout.write(""));
74
-
75
- // src/fuel/context.ts
76
- var FuelCall = class {
77
- constructor(funcScopes, callResult, isMultiCall, args, logs) {
78
- this.args = args;
79
- this.logs = logs;
80
- }
81
- static {
82
- __name(this, "FuelCall");
83
- }
84
- };
85
- var FuelContext = class extends BaseContext {
86
- constructor(chainId, contractAddress, contractName, timestamp, transaction, block) {
87
- super({});
88
- this.chainId = chainId;
89
- this.contractAddress = contractAddress;
90
- this.contractName = contractName;
91
- this.timestamp = timestamp;
92
- this.transaction = transaction;
93
- this.block = block;
94
- }
95
- static {
96
- __name(this, "FuelContext");
97
- }
98
- logIndex = -1;
99
- getChainId() {
100
- return this.chainId;
101
- }
102
- setLogIndex(logIndex) {
103
- this.logIndex = logIndex;
104
- }
105
- getMetaDataInternal(name, labels) {
106
- return {
107
- address: this.contractAddress,
108
- contractName: this.contractName,
109
- blockNumber: BigInt(this.block?.height?.toString() ?? (this.transaction?.blockNumber || 0)),
110
- transactionIndex: 0,
111
- transactionHash: this.transaction?.id || "",
112
- // TODO
113
- chainId: this.getChainId(),
114
- name,
115
- logIndex: this.logIndex,
116
- labels: normalizeLabels(labels)
117
- };
118
- }
119
- };
120
- var FuelContractContext = class extends FuelContext {
121
- constructor(chainId, contract, contractAddress, contractName, timestamp, transaction, block) {
122
- super(chainId, contractAddress, contractName, timestamp, transaction, block);
123
- this.chainId = chainId;
124
- this.contract = contract;
125
- this.contractAddress = contractAddress;
126
- this.contractName = contractName;
127
- this.timestamp = timestamp;
128
- this.transaction = transaction;
129
- this.block = block;
130
- }
131
- static {
132
- __name(this, "FuelContractContext");
133
- }
134
- get provider() {
135
- return this.contract.provider;
136
- }
137
- };
138
- import("node:process").then((p) => p.stdout.write(""));
139
-
140
- // src/fuel/transaction.ts
141
- var DEFAULT_FUEL_FETCH_CONFIG = {
142
- includeFailed: false
143
- };
144
- function findSenderFromInputs(inputs, baseAssetId) {
145
- for (const input of inputs || []) {
146
- if (input.type == InputType.Coin && input.assetId == baseAssetId) {
147
- return input.owner;
148
- }
149
- }
150
- return void 0;
151
- }
152
- __name(findSenderFromInputs, "findSenderFromInputs");
153
- function decodeFuelTransaction(gqlTransaction, provider) {
154
- const rawPayload = arrayify(gqlTransaction.rawPayload);
155
- const receipts = gqlTransaction?.status.receipts?.map(processGqlReceipt) || [];
156
- const [decodedTransaction] = new TransactionCoder().decode(rawPayload, 0);
157
- const { gasCosts, feeParameters, txParameters, baseAssetId } = provider.getChain().consensusParameters;
158
- const blockNumber = gqlTransaction.status?.block?.header?.height;
159
- const { gasPriceFactor, gasPerByte } = feeParameters;
160
- const { maxInputs, maxGasPerTx } = txParameters;
161
- const gqlTransactionStatus = {
162
- type: gqlTransaction.status?.__typename,
163
- ...gqlTransaction.status
164
- };
165
- return {
166
- ...assembleTransactionSummary({
167
- id: gqlTransaction.id,
168
- receipts,
169
- transaction: decodedTransaction,
170
- transactionBytes: rawPayload,
171
- gqlTransactionStatus,
172
- gasPerByte: bn(gasPerByte),
173
- gasPriceFactor: bn(gasPriceFactor),
174
- maxInputs,
175
- gasCosts,
176
- gasPrice: bn(gqlTransaction.gasPrice),
177
- maxGasPerTx,
178
- baseAssetId
179
- }),
180
- blockNumber,
181
- sender: findSenderFromInputs(decodedTransaction.inputs, baseAssetId)
182
- };
183
- }
184
- __name(decodeFuelTransaction, "decodeFuelTransaction");
185
- function decodeLog(receipt, abi) {
186
- if (receipt && (receipt.type === ReceiptType.LogData || receipt.type === ReceiptType.Log)) {
187
- const interfaceToUse = new Interface(abi);
188
- const data = receipt.type === ReceiptType.Log ? new BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
189
- const logId = receipt.val1.toString();
190
- const [decodedLog] = interfaceToUse.decodeLog(data, logId);
191
- return { logId, data: decodedLog };
192
- }
193
- return null;
194
- }
195
- __name(decodeLog, "decodeLog");
196
- async function decodeFuelTransactionWithAbi(gqlTransaction, abiMap, provider) {
197
- const rawPayload = arrayify(gqlTransaction.rawPayload);
198
- const [decodedTransaction] = new TransactionCoder().decode(rawPayload, 0);
199
- const receipts = gqlTransaction?.status.receipts?.map(processGqlReceipt) || [];
200
- const gqlTransactionStatus = {
201
- type: gqlTransaction.status?.__typename,
202
- ...gqlTransaction.status
203
- };
204
- const blockNumber = gqlTransactionStatus?.block?.header?.height;
205
- const abi = Object.values(abiMap)[0];
206
- const logs = [];
207
- receipts.forEach((receipt, idx) => {
208
- try {
209
- const log = decodeLog(receipt, abi);
210
- if (log) {
211
- logs.push({ ...log, receiptIndex: idx });
212
- }
213
- } catch (e) {
214
- console.warn("Failed to decode log", e);
215
- }
216
- });
217
- const txResponse = new TransactionResponse(gqlTransaction.status.transactionId, provider, {
218
- main: Object.values(abiMap)[0],
219
- otherContractsAbis: {}
220
- });
221
- txResponse.gqlTransaction = {
222
- ...gqlTransaction,
223
- status: gqlTransactionStatus
224
- };
225
- const summary = await txResponse.getTransactionSummary();
226
- return {
227
- /*...assembleTransactionSummary({
228
- id: gqlTransaction.id,
229
- receipts,
230
- transaction: decodedTransaction,
231
- transactionBytes: rawPayload,
232
- gqlTransactionStatus,
233
- gasPerByte: bn(gasPerByte),
234
- gasPriceFactor: bn(gasPriceFactor),
235
- abiMap,
236
- maxInputs,
237
- gasCosts,
238
- maxGasPerTx,
239
- gasPrice: bn(gqlTransaction.gasPrice)
240
- }),*/
241
- ...summary,
242
- blockNumber,
243
- logs,
244
- sender: findSenderFromInputs(decodedTransaction.inputs, provider.getChain().consensusParameters.baseAssetId)
245
- };
246
- }
247
- __name(decodeFuelTransactionWithAbi, "decodeFuelTransactionWithAbi");
248
- import("node:process").then((p) => p.stdout.write(""));
249
-
250
- // src/fuel/fuel-processor.ts
251
- var import_nice_grpc = __toESM(require_lib(), 1);
252
- var FuelProcessor = class _FuelProcessor {
253
- constructor(config) {
254
- this.config = config;
255
- return proxyProcessor(this);
256
- }
257
- static {
258
- __name(this, "FuelProcessor");
259
- }
260
- txHandlers = [];
261
- blockHandlers = [];
262
- receiptHandlers = [];
263
- provider;
264
- contract;
265
- static bind(config) {
266
- const processor = new _FuelProcessor(config);
267
- addFuelProcessor(config, processor);
268
- return processor;
269
- }
270
- latestGasPrice;
271
- async configure() {
272
- this.provider = await getProvider(this.config.chainId);
273
- this.provider.getLatestGasPrice = async () => {
274
- if (this.latestGasPrice) {
275
- return bn(this.latestGasPrice);
276
- }
277
- const { latestGasPrice } = await this.provider.operations.getLatestGasPrice();
278
- this.latestGasPrice = latestGasPrice?.gasPrice;
279
- return bn(latestGasPrice.gasPrice);
280
- };
281
- this.contract = new Contract(this.config.address, this.config.abi, this.provider);
282
- }
283
- onTransaction(handler, config = DEFAULT_FUEL_FETCH_CONFIG, handlerName = getHandlerName()) {
284
- const callHandler = {
285
- handlerName,
286
- handler: /* @__PURE__ */ __name(async (call) => {
287
- const abiMap = this.config.abi ? {
288
- [this.config.address]: this.config.abi
289
- } : {};
290
- const tx = await decodeFuelTransactionWithAbi(call.transaction, abiMap, this.provider);
291
- const ctx = new FuelContractContext(
292
- this.config.chainId,
293
- this.contract,
294
- this.config.address,
295
- this.config.name ?? this.config.address,
296
- call.timestamp || /* @__PURE__ */ new Date(0),
297
- tx,
298
- null
299
- );
300
- await handler(tx, ctx);
301
- return ctx.stopAndGetResult();
302
- }, "handler"),
303
- fetchConfig: {
304
- filters: [],
305
- ...config
306
- }
307
- };
308
- this.txHandlers.push(callHandler);
309
- return this;
310
- }
311
- // hide onCall for now
312
- onCall(nameFilter, handler, config = DEFAULT_FUEL_FETCH_CONFIG) {
313
- const names = new Set(Array.isArray(nameFilter) ? nameFilter : [nameFilter]);
314
- if (!this.config.abi) {
315
- throw new Error("ABI must be provided to use onCall");
316
- }
317
- const abi = this.config.abi;
318
- const filters = {};
319
- const abiInterface = new Interface(abi);
320
- for (const name of names) {
321
- try {
322
- const func = abiInterface.functions[name];
323
- const filter = bn(func.selector, "hex").toString();
324
- filters[func.name] = {
325
- function: filter,
326
- includeFailed: !!config.includeFailed
327
- };
328
- } catch (e) {
329
- console.error(e);
330
- }
331
- }
332
- const callHandler = {
333
- handlerName: getHandlerName(),
334
- handler: /* @__PURE__ */ __name(async (call) => {
335
- try {
336
- const gqlTransaction = call.transaction;
337
- const tx = await decodeFuelTransactionWithAbi(gqlTransaction, { [this.config.address]: abi }, this.provider);
338
- const ctx = new FuelContext(
339
- this.config.chainId,
340
- this.config.address,
341
- this.config.name ?? this.config.address,
342
- call.timestamp || /* @__PURE__ */ new Date(0),
343
- tx,
344
- null
345
- );
346
- for (const op of tx.operations) {
347
- for (const call2 of op.calls || []) {
348
- if (names.has(call2.functionName)) {
349
- const fn = this.contract.functions[call2.functionName];
350
- const args = Object.values(call2.argumentsProvided || {});
351
- const scope = fn(...args);
352
- const invocationResult = new FuelCall(scope, tx, false, call2.argumentsProvided, tx.logs);
353
- await handler(invocationResult, ctx);
354
- }
355
- }
356
- }
357
- return ctx.stopAndGetResult();
358
- } catch (e) {
359
- console.error(e);
360
- return {
361
- gauges: [],
362
- counters: [],
363
- events: [],
364
- exports: [],
365
- states: {
366
- configUpdated: false
367
- }
368
- };
369
- }
370
- }, "handler"),
371
- fetchConfig: {
372
- filters: Object.values(filters)
373
- }
374
- };
375
- this.txHandlers.push(callHandler);
376
- return this;
377
- }
378
- onLog(logIdFilter, handler, handlerName = getHandlerName()) {
379
- const logIds = new Set(Array.isArray(logIdFilter) ? logIdFilter : [logIdFilter]);
380
- const logHandler = {
381
- handlerName,
382
- handler: /* @__PURE__ */ __name(async ({ transaction, receiptIndex, timestamp }) => {
383
- try {
384
- const tx = decodeFuelTransaction(transaction, this.provider);
385
- const index = Number(receiptIndex);
386
- const receipt = tx.receipts[index];
387
- const log = decodeLog(receipt, this.config.abi);
388
- if (log) {
389
- const ctx = new FuelContractContext(
390
- this.config.chainId,
391
- this.contract,
392
- this.config.address,
393
- this.config.name ?? this.config.address,
394
- timestamp || /* @__PURE__ */ new Date(0),
395
- tx,
396
- null
397
- );
398
- ctx.setLogIndex(index);
399
- await handler({ receiptIndex: index, ...log }, ctx);
400
- return ctx.stopAndGetResult();
401
- } else {
402
- console.error(`Log with receipt index ${receiptIndex} not found in tx`);
403
- }
404
- } catch (e) {
405
- console.error(e);
406
- }
407
- return ProcessResult.fromPartial({});
408
- }, "handler"),
409
- receiptConfig: {
410
- log: {
411
- logIds: Array.from(logIds)
412
- }
413
- }
414
- };
415
- this.receiptHandlers.push(logHandler);
416
- return this;
417
- }
418
- /*
419
- * handle 'Transfer' and 'TransferOut' receipt for a specific contract id
420
- */
421
- onTransfer(filter, handler) {
422
- const { from, to, assetId } = filter;
423
- const h = {
424
- handlerName: getHandlerName(),
425
- handler: /* @__PURE__ */ __name(async ({ transaction, receiptIndex, timestamp }) => {
426
- try {
427
- const tx = decodeFuelTransaction(transaction, this.provider);
428
- const index = Number(receiptIndex);
429
- const receipt = tx.receipts[index];
430
- const ctx = new FuelContractContext(
431
- this.config.chainId,
432
- this.contract,
433
- this.config.address,
434
- this.config.name ?? this.config.address,
435
- timestamp || /* @__PURE__ */ new Date(0),
436
- tx,
437
- null
438
- );
439
- ctx.setLogIndex(index);
440
- await handler(receipt, ctx);
441
- } catch (e) {
442
- console.error(e);
443
- }
444
- return ProcessResult.fromPartial({});
445
- }, "handler"),
446
- receiptConfig: {
447
- transfer: {
448
- from,
449
- to,
450
- assetId
451
- }
452
- }
453
- };
454
- this.receiptHandlers.push(h);
455
- return this;
456
- }
457
- onInterval(handler, timeInterval, blockInterval, handlerName = getHandlerName()) {
458
- if (timeInterval) {
459
- if (timeInterval.backfillInterval < timeInterval.recentInterval) {
460
- timeInterval.backfillInterval = timeInterval.recentInterval;
461
- }
462
- }
463
- const processor = this;
464
- this.blockHandlers.push({
465
- blockInterval,
466
- timeIntervalInMinutes: timeInterval,
467
- handlerName,
468
- handler: /* @__PURE__ */ __name(async function(data) {
469
- const header = data.block;
470
- if (!header) {
471
- throw new import_nice_grpc.ServerError(import_nice_grpc.Status.INVALID_ARGUMENT, "Block is empty");
472
- }
473
- const block = {
474
- id: header.id,
475
- height: bn(header.height),
476
- time: header.time,
477
- header: {
478
- applicationHash: header.applicationHash,
479
- daHeight: bn(header.daHeight),
480
- eventInboxRoot: header.eventInboxRoot,
481
- messageOutboxRoot: header.messageOutboxRoot,
482
- prevRoot: header.prevRoot,
483
- stateTransitionBytecodeVersion: header.stateTransitionBytecodeVersion,
484
- transactionsCount: header.transactionsCount,
485
- transactionsRoot: header.transactionsRoot
486
- }
487
- };
488
- const ctx = new FuelContractContext(
489
- processor.config.chainId,
490
- processor.contract,
491
- processor.config.address,
492
- processor.config.name ?? processor.config.address,
493
- data.timestamp || /* @__PURE__ */ new Date(0),
494
- null,
495
- block
496
- );
497
- await handler(block, ctx);
498
- return ctx.stopAndGetResult();
499
- }, "handler")
500
- });
501
- return this;
502
- }
503
- onBlockInterval(handler, blockInterval = 250, backfillBlockInterval = 1e3) {
504
- return this.onInterval(
505
- handler,
506
- void 0,
507
- {
508
- recentInterval: blockInterval,
509
- backfillInterval: backfillBlockInterval
510
- }
511
- // fetchConfig,
512
- );
513
- }
514
- onTimeInterval(handler, timeIntervalInMinutes = 60, backfillTimeIntervalInMinutes = 240) {
515
- return this.onInterval(
516
- handler,
517
- { recentInterval: timeIntervalInMinutes, backfillInterval: backfillTimeIntervalInMinutes },
518
- void 0
519
- // fetchConfig
520
- );
521
- }
522
- };
523
- function getOptionsSignature(opts) {
524
- const sig = [opts.address];
525
- if (opts.chainId) {
526
- sig.push(opts.chainId);
527
- }
528
- if (opts.name) {
529
- sig.push(opts.name);
530
- }
531
- if (opts.startBlock) {
532
- sig.push(opts.startBlock.toString());
533
- }
534
- if (opts.endBlock) {
535
- sig.push(opts.endBlock.toString());
536
- }
537
- return sig.join("_");
538
- }
539
- __name(getOptionsSignature, "getOptionsSignature");
540
- function getFuelProcessor(opts) {
541
- const sig = getOptionsSignature(opts);
542
- return FuelProcessorState.INSTANCE.getValue(sig);
543
- }
544
- __name(getFuelProcessor, "getFuelProcessor");
545
- function addFuelProcessor(opts, processor) {
546
- const sig = getOptionsSignature(opts);
547
- FuelProcessorState.INSTANCE.getOrSetValue(sig, processor);
548
- }
549
- __name(addFuelProcessor, "addFuelProcessor");
550
- import("node:process").then((p) => p.stdout.write(""));
551
-
552
- // src/fuel/asset-processor.ts
553
- var FuelAssetProcessor = class _FuelAssetProcessor {
554
- constructor(config) {
555
- this.config = config;
556
- return proxyProcessor(this);
557
- }
558
- static {
559
- __name(this, "FuelAssetProcessor");
560
- }
561
- txHandlers = [];
562
- blockHandlers = [];
563
- provider;
564
- static bind(config) {
565
- const processor = new _FuelAssetProcessor(config);
566
- const sig = "assets_" + getOptionsSignature({
567
- ...config,
568
- address: "*"
569
- });
570
- FuelProcessorState.INSTANCE.getOrSetValue(sig, processor);
571
- return processor;
572
- }
573
- async configure() {
574
- this.provider = await getProvider(this.config.chainId);
575
- }
576
- onTransfer(filter, handler) {
577
- const filters = [];
578
- const assetIds = arrayify2(filter.assetId);
579
- const froms = arrayify2(filter.from);
580
- const tos = arrayify2(filter.to);
581
- for (const assetId of assetIds) {
582
- for (const from of froms) {
583
- for (const to of tos) {
584
- filters.push({
585
- assetId,
586
- fromAddress: from,
587
- toAddress: to
588
- });
589
- }
590
- }
591
- }
592
- const callHandler = {
593
- handlerName: getHandlerName(),
594
- handler: /* @__PURE__ */ __name(async (call) => {
595
- const gqlTransaction = call.transaction;
596
- const tx = decodeFuelTransaction(gqlTransaction, this.provider);
597
- const transfer = {
598
- from: [],
599
- to: []
600
- };
601
- for (const input of tx.transaction.inputs || []) {
602
- if (input.type == InputType.Coin) {
603
- transfer.from.push({
604
- address: input.owner,
605
- assetId: input.assetId,
606
- amount: BigInt(input.amount.toString(10))
607
- });
608
- }
609
- }
610
- for (const output of tx.transaction.outputs || []) {
611
- if (output.type == OutputType.Coin) {
612
- const value = output.amount.toString(10);
613
- transfer.to.push({
614
- address: output.to,
615
- amount: BigInt(value),
616
- assetId: output.assetId
617
- });
618
- }
619
- }
620
- const assetId = transfer.from[0].assetId || "";
621
- const ctx = new FuelContext(
622
- this.config.chainId,
623
- assetId,
624
- this.config.name ?? "",
625
- call.timestamp || /* @__PURE__ */ new Date(0),
626
- tx,
627
- null
628
- );
629
- await handler(transfer, ctx);
630
- return ctx.stopAndGetResult();
631
- }, "handler"),
632
- assetConfig: {
633
- filters
634
- }
635
- };
636
- this.txHandlers.push(callHandler);
637
- return this;
638
- }
639
- };
640
- function arrayify2(value) {
641
- if (value) {
642
- if (Array.isArray(value)) {
643
- return value.length > 0 ? value : [void 0];
644
- }
645
- return [value];
646
- }
647
- return [void 0];
648
- }
649
- __name(arrayify2, "arrayify");
650
- import("node:process").then((p) => p.stdout.write(""));
651
-
652
- // src/fuel/global-processor.ts
653
- import { mergeProcessResults } from "@sentio/runtime";
654
- var FuelGlobalProcessor = class _FuelGlobalProcessor {
655
- constructor(config) {
656
- this.config = config;
657
- return proxyProcessor(this);
658
- }
659
- static {
660
- __name(this, "FuelGlobalProcessor");
661
- }
662
- txHandlers = [];
663
- blockHandlers = [];
664
- provider;
665
- static bind(config) {
666
- const processor = new _FuelGlobalProcessor(config);
667
- const sig = "global_" + getOptionsSignature({
668
- ...config,
669
- address: ALL_ADDRESS
670
- });
671
- FuelProcessorState.INSTANCE.getOrSetValue(sig, processor);
672
- return processor;
673
- }
674
- async configure() {
675
- this.provider = await getProvider(this.config.chainId);
676
- }
677
- onTransaction(handler, config = DEFAULT_FUEL_FETCH_CONFIG) {
678
- const callHandler = {
679
- handlerName: getHandlerName(),
680
- handler: /* @__PURE__ */ __name(async (call) => {
681
- let tx;
682
- try {
683
- tx = decodeFuelTransaction(call.transaction, this.provider);
684
- } catch (e) {
685
- console.error("error decoding transaction", e);
686
- return mergeProcessResults([]);
687
- }
688
- const ctx = new FuelContext(
689
- this.config.chainId,
690
- ALL_ADDRESS,
691
- this.config.name ?? "*",
692
- call.timestamp || /* @__PURE__ */ new Date(0),
693
- tx,
694
- null
695
- );
696
- await handler(tx, ctx);
697
- return ctx.stopAndGetResult();
698
- }, "handler"),
699
- fetchConfig: {
700
- filters: [],
701
- ...config
702
- }
703
- };
704
- this.txHandlers.push(callHandler);
705
- return this;
706
- }
707
- };
708
- import("node:process").then((p) => p.stdout.write(""));
709
-
710
- // src/fuel/fuel-plugin.ts
711
- var FuelPlugin = class extends Plugin {
712
- static {
713
- __name(this, "FuelPlugin");
714
- }
715
- name = "FuelPlugin";
716
- handlers = {
717
- transactionHandlers: [],
718
- blockHandlers: [],
719
- receiptHandlers: []
720
- };
721
- async configure(config) {
722
- const handlers = {
723
- transactionHandlers: [],
724
- blockHandlers: [],
725
- receiptHandlers: []
726
- };
727
- for (const processor of FuelProcessorState.INSTANCE.getValues()) {
728
- const processorConfig = processor.config;
729
- const contractConfig = ContractConfig.fromPartial({
730
- processorType: USER_PROCESSOR,
731
- contract: {
732
- name: processorConfig.name,
733
- chainId: processorConfig.chainId.toString(),
734
- address: processorConfig.address || "*",
735
- abi: ""
736
- },
737
- startBlock: processorConfig.startBlock,
738
- endBlock: processorConfig.endBlock
739
- });
740
- for (const txHandler of processor.txHandlers) {
741
- const handlerId = handlers.transactionHandlers.push(txHandler.handler) - 1;
742
- const handlerName = txHandler.handlerName;
743
- if (processor instanceof FuelProcessor) {
744
- const fetchConfig = {
745
- handlerId,
746
- handlerName
747
- };
748
- contractConfig.fuelTransactionConfigs.push(fetchConfig);
749
- } else if (processor instanceof FuelAssetProcessor) {
750
- const assetConfig = txHandler.assetConfig;
751
- contractConfig.assetConfigs.push({
752
- filters: assetConfig?.filters || [],
753
- handlerId,
754
- handlerName
755
- });
756
- } else if (processor instanceof FuelGlobalProcessor) {
757
- const fetchConfig = {
758
- handlerId,
759
- handlerName,
760
- filters: []
761
- };
762
- contractConfig.fuelTransactionConfigs.push(fetchConfig);
763
- contractConfig.contract.address = "*";
764
- }
765
- }
766
- for (const receiptHandler of processor.receiptHandlers ?? []) {
767
- const handlerId = handlers.receiptHandlers.push(receiptHandler.handler) - 1;
768
- const handlerName = receiptHandler.handlerName;
769
- if (processor instanceof FuelProcessor) {
770
- contractConfig.fuelReceiptConfigs.push({
771
- ...receiptHandler.receiptConfig,
772
- handlerId,
773
- handlerName
774
- });
775
- }
776
- }
777
- for (const blockHandler of processor.blockHandlers) {
778
- const handlerId = handlers.blockHandlers.push(blockHandler.handler) - 1;
779
- contractConfig.intervalConfigs.push({
780
- slot: 0,
781
- slotInterval: blockHandler.blockInterval,
782
- minutes: 0,
783
- minutesInterval: blockHandler.timeIntervalInMinutes,
784
- handlerId,
785
- handlerName: blockHandler.handlerName,
786
- fetchConfig: void 0
787
- // fetchConfig: blockHandler.fetchConfig
788
- });
789
- }
790
- config.contractConfigs.push(contractConfig);
791
- }
792
- this.handlers = handlers;
793
- }
794
- supportedHandlers = [
795
- HandlerType.FUEL_TRANSACTION,
796
- HandlerType.FUEL_RECEIPT,
797
- HandlerType.FUEL_CALL,
798
- HandlerType.FUEL_BLOCK
799
- ];
800
- processBinding(request) {
801
- switch (request.handlerType) {
802
- case HandlerType.FUEL_TRANSACTION:
803
- return this.processTransaction(request);
804
- case HandlerType.FUEL_RECEIPT:
805
- return this.processReceipt(request);
806
- case HandlerType.FUEL_BLOCK:
807
- return this.processBlock(request);
808
- default:
809
- throw new import_nice_grpc2.ServerError(import_nice_grpc2.Status.INVALID_ARGUMENT, "No handle type registered " + request.handlerType);
810
- }
811
- }
812
- async start(request) {
813
- try {
814
- for (const processor of FuelProcessorState.INSTANCE.getValues()) {
815
- await processor.configure();
816
- }
817
- } catch (e) {
818
- throw new import_nice_grpc2.ServerError(import_nice_grpc2.Status.INTERNAL, "error starting FuelPlugin: " + errorString(e));
819
- }
820
- }
821
- stateDiff(config) {
822
- return TemplateInstanceState.INSTANCE.getValues().length !== config.templateInstances.length;
823
- }
824
- async processReceipt(binding) {
825
- const receipt = binding?.data?.fuelLog;
826
- if (!receipt?.transaction) {
827
- throw new import_nice_grpc2.ServerError(import_nice_grpc2.Status.INVALID_ARGUMENT, "transaction can't be null");
828
- }
829
- const promises = [];
830
- for (const handlerId of binding.handlerIds) {
831
- const promise = this.handlers.receiptHandlers[handlerId](receipt).catch((e) => {
832
- throw new import_nice_grpc2.ServerError(
833
- import_nice_grpc2.Status.INTERNAL,
834
- "error processing transaction: " + JSON.stringify(receipt) + "\n" + errorString(e)
835
- );
836
- });
837
- if (GLOBAL_CONFIG.execution.sequential) {
838
- await promise;
839
- }
840
- promises.push(promise);
841
- }
842
- return mergeProcessResults2(await Promise.all(promises));
843
- }
844
- async processTransaction(binding) {
845
- if (!binding.data?.fuelTransaction?.transaction) {
846
- throw new import_nice_grpc2.ServerError(import_nice_grpc2.Status.INVALID_ARGUMENT, "transaction can't be null");
847
- }
848
- const fuelTransaction = binding.data.fuelTransaction;
849
- const promises = [];
850
- for (const handlerId of binding.handlerIds) {
851
- const promise = this.handlers.transactionHandlers[handlerId](fuelTransaction).catch((e) => {
852
- throw new import_nice_grpc2.ServerError(
853
- import_nice_grpc2.Status.INTERNAL,
854
- "error processing transaction: " + JSON.stringify(fuelTransaction.transaction) + "\n" + errorString(e)
855
- );
856
- });
857
- if (GLOBAL_CONFIG.execution.sequential) {
858
- await promise;
859
- }
860
- promises.push(promise);
861
- }
862
- return mergeProcessResults2(await Promise.all(promises));
863
- }
864
- async processBlock(binding) {
865
- if (!binding.data?.fuelBlock?.block) {
866
- throw new import_nice_grpc2.ServerError(import_nice_grpc2.Status.INVALID_ARGUMENT, "Block can't be empty");
867
- }
868
- const ethBlock = binding.data.fuelBlock;
869
- const promises = [];
870
- for (const handlerId of binding.handlerIds) {
871
- const promise = this.handlers.blockHandlers[handlerId](ethBlock).catch((e) => {
872
- console.error("error processing block: ", e);
873
- throw new import_nice_grpc2.ServerError(
874
- import_nice_grpc2.Status.INTERNAL,
875
- "error processing block: " + ethBlock.block?.height + "\n" + errorString(e)
876
- );
877
- });
878
- if (GLOBAL_CONFIG.execution.sequential) {
879
- await promise;
880
- }
881
- promises.push(promise);
882
- }
883
- return mergeProcessResults2(await Promise.all(promises));
884
- }
885
- };
886
- PluginManager.INSTANCE.register(new FuelPlugin());
887
- import("node:process").then((p) => p.stdout.write(""));
888
-
889
- // src/fuel/fuel-processor-template.ts
890
- import { ListStateStorage } from "@sentio/runtime";
891
- var FuelProcessorTemplateProcessorState = class _FuelProcessorTemplateProcessorState extends ListStateStorage {
892
- static {
893
- __name(this, "FuelProcessorTemplateProcessorState");
894
- }
895
- static INSTANCE = new _FuelProcessorTemplateProcessorState();
896
- };
897
- var FuelBaseProcessorTemplate = class {
898
- static {
899
- __name(this, "FuelBaseProcessorTemplate");
900
- }
901
- id;
902
- binds = /* @__PURE__ */ new Set();
903
- blockHandlers = [];
904
- logHandlers = [];
905
- transactionHandlers = [];
906
- constructor() {
907
- this.id = FuelProcessorTemplateProcessorState.INSTANCE.getValues().length;
908
- FuelProcessorTemplateProcessorState.INSTANCE.addValue(this);
909
- return proxyProcessor(this);
910
- }
911
- /**
912
- * Bind template using {@param options}, using {@param ctx}'s network value if not provided in the option
913
- * @param options
914
- * @param ctx
915
- */
916
- bind(options, ctx) {
917
- const sig = getOptionsSignature({
918
- address: options.address,
919
- chainId: ctx.chainId
920
- });
921
- if (this.binds.has(sig)) {
922
- console.log(`Same address can be bind to one template only once, ignore duplicate bind: ${sig}`);
923
- return;
924
- }
925
- this.binds.add(sig);
926
- const processor = this.bindInternal({ ...options, chainId: ctx.chainId });
927
- for (const eh of this.logHandlers) {
928
- processor.onLog(eh.logIdFilter, eh.handler, eh.handlerName);
929
- }
930
- for (const bh of this.blockHandlers) {
931
- processor.onInterval(bh.handler, bh.timeIntervalInMinutes, bh.blockInterval, bh.handlerName);
932
- }
933
- for (const th of this.transactionHandlers) {
934
- processor.onTransaction(th.handler, void 0, th.handlerName);
935
- }
936
- const instance = {
937
- templateId: this.id,
938
- contract: {
939
- address: options.address,
940
- name: options.name || "",
941
- chainId: ctx.chainId,
942
- abi: ""
943
- },
944
- startBlock: BigInt(options.startBlock || 0),
945
- endBlock: BigInt(options.endBlock || 0),
946
- baseLabels: {}
947
- // baseLabels: options.baseLabels
948
- };
949
- TemplateInstanceState.INSTANCE.addValue(instance);
950
- ctx.update({
951
- states: {
952
- configUpdated: true
953
- }
954
- });
955
- }
956
- onLog(logIdFilter, handler) {
957
- this.logHandlers.push({
958
- logIdFilter,
959
- handlerName: getHandlerName(),
960
- handler
961
- // fetchConfig: { ...fetchConfig}
962
- });
963
- return this;
964
- }
965
- onBlockInterval(handler, blockInterval = 1e3, backfillBlockInterval = 4e3) {
966
- return this.onInterval(
967
- handler,
968
- void 0,
969
- {
970
- recentInterval: blockInterval,
971
- backfillInterval: backfillBlockInterval
972
- }
973
- // fetchConfig
974
- );
975
- }
976
- onTimeInterval(handler, timeIntervalInMinutes = 60, backfillBlockInterval = 240) {
977
- return this.onInterval(
978
- handler,
979
- { recentInterval: timeIntervalInMinutes, backfillInterval: backfillBlockInterval },
980
- void 0
981
- // fetchConfig
982
- );
983
- }
984
- onInterval(handler, timeInterval, blockInterval) {
985
- this.blockHandlers.push({
986
- handlerName: getHandlerName(),
987
- handler,
988
- timeIntervalInMinutes: timeInterval,
989
- blockInterval
990
- // fetchConfig: { ...fetchConfig }
991
- });
992
- return this;
993
- }
994
- onTransaction(handler, config = DEFAULT_FUEL_FETCH_CONFIG) {
995
- this.transactionHandlers.push({
996
- handlerName: getHandlerName(),
997
- handler,
998
- fetchConfig: config
999
- });
1000
- return this;
1001
- }
1002
- };
1003
- import("node:process").then((p) => p.stdout.write(""));
1004
-
1005
- // src/fuel/base-processor.ts
1006
- import { FuelChainId as FuelChainId2 } from "@sentio/chain";
1007
- var FuelAbstractProcessor = class extends FuelProcessor {
1008
- static {
1009
- __name(this, "FuelAbstractProcessor");
1010
- }
1011
- constructor(abi, config) {
1012
- if (!config) {
1013
- config = {
1014
- chainId: FuelChainId2.FUEL_MAINNET,
1015
- address: "*"
1016
- };
1017
- }
1018
- super({
1019
- ...config,
1020
- abi
1021
- });
1022
- return proxyProcessor(this);
1023
- }
1024
- };
1025
- var TypedCall = class {
1026
- static {
1027
- __name(this, "TypedCall");
1028
- }
1029
- args;
1030
- returnValue;
1031
- argsObject;
1032
- logs;
1033
- // constructor(call: FuelCall) {
1034
- // this.args = call.args as T
1035
- // this.returnValue = call.value as R
1036
- // this.argsObject = call.args
1037
- // this.logs = call.logs
1038
- // }
1039
- };
1040
- import("node:process").then((p) => p.stdout.write(""));
1041
-
1042
- // src/fuel/index.ts
1043
- import("node:process").then((p) => p.stdout.write(""));
1044
-
1045
- export {
1046
- FuelProcessorState,
1047
- FuelNetwork,
1048
- getRpcEndpoint,
1049
- getProvider,
1050
- FuelCall,
1051
- FuelContext,
1052
- FuelContractContext,
1053
- DEFAULT_FUEL_FETCH_CONFIG,
1054
- decodeFuelTransaction,
1055
- decodeLog,
1056
- decodeFuelTransactionWithAbi,
1057
- FuelProcessor,
1058
- getOptionsSignature,
1059
- getFuelProcessor,
1060
- addFuelProcessor,
1061
- FuelAssetProcessor,
1062
- FuelGlobalProcessor,
1063
- FuelPlugin,
1064
- FuelProcessorTemplateProcessorState,
1065
- FuelBaseProcessorTemplate,
1066
- FuelAbstractProcessor,
1067
- TypedCall
1068
- };
1069
- //# sourceMappingURL=chunk-7S6WQ4RL.js.map