@sentio/sdk 2.35.1-rc.1 → 2.36.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 (46) hide show
  1. package/lib/aptos/aptos-plugin.d.ts.map +1 -1
  2. package/lib/aptos/aptos-plugin.js +30 -20
  3. package/lib/aptos/aptos-plugin.js.map +1 -1
  4. package/lib/fuel/asset-processor.d.ts +36 -0
  5. package/lib/fuel/asset-processor.d.ts.map +1 -0
  6. package/lib/fuel/asset-processor.js +85 -0
  7. package/lib/fuel/asset-processor.js.map +1 -0
  8. package/lib/fuel/base-processor.d.ts +1 -1
  9. package/lib/fuel/base-processor.d.ts.map +1 -1
  10. package/lib/fuel/base-processor.js +2 -1
  11. package/lib/fuel/base-processor.js.map +1 -1
  12. package/lib/fuel/context.js +2 -2
  13. package/lib/fuel/context.js.map +1 -1
  14. package/lib/fuel/fuel-plugin.d.ts.map +1 -1
  15. package/lib/fuel/fuel-plugin.js +17 -29
  16. package/lib/fuel/fuel-plugin.js.map +1 -1
  17. package/lib/fuel/fuel-processor.d.ts +3 -10
  18. package/lib/fuel/fuel-processor.d.ts.map +1 -1
  19. package/lib/fuel/fuel-processor.js +4 -7
  20. package/lib/fuel/fuel-processor.js.map +1 -1
  21. package/lib/fuel/index.d.ts +1 -0
  22. package/lib/fuel/index.d.ts.map +1 -1
  23. package/lib/fuel/index.js +1 -0
  24. package/lib/fuel/index.js.map +1 -1
  25. package/lib/fuel/transaction.d.ts +5 -2
  26. package/lib/fuel/transaction.d.ts.map +1 -1
  27. package/lib/fuel/transaction.js +37 -13
  28. package/lib/fuel/transaction.js.map +1 -1
  29. package/lib/fuel/types.d.ts +16 -0
  30. package/lib/fuel/types.d.ts.map +1 -0
  31. package/lib/fuel/types.js +5 -0
  32. package/lib/fuel/types.js.map +1 -0
  33. package/lib/testing/fuel-facet.d.ts.map +1 -1
  34. package/lib/testing/fuel-facet.js +13 -0
  35. package/lib/testing/fuel-facet.js.map +1 -1
  36. package/package.json +3 -3
  37. package/src/aptos/aptos-plugin.ts +38 -32
  38. package/src/fuel/asset-processor.ts +119 -0
  39. package/src/fuel/base-processor.ts +16 -11
  40. package/src/fuel/context.ts +2 -2
  41. package/src/fuel/fuel-plugin.ts +15 -32
  42. package/src/fuel/fuel-processor.ts +12 -16
  43. package/src/fuel/index.ts +2 -1
  44. package/src/fuel/transaction.ts +42 -14
  45. package/src/fuel/types.ts +18 -0
  46. package/src/testing/fuel-facet.ts +14 -0
@@ -17,9 +17,33 @@ export const DEFAULT_FUEL_FETCH_CONFIG: FuelFetchConfig = {
17
17
  includeFailed: false
18
18
  }
19
19
 
20
- export type FuelTransaction = TransactionSummary
20
+ export type FuelTransaction = TransactionSummary & {
21
+ blockNumber?: string
22
+ }
23
+
24
+ export function decodeFuelTransaction(gqlTransaction: any, provider: Provider): FuelTransaction {
25
+ const rawPayload = arrayify(gqlTransaction.rawPayload)
26
+
27
+ const [decodedTransaction] = new TransactionCoder().decode(rawPayload, 0)
28
+ const { gasPerByte, gasPriceFactor, maxInputs, gasCosts } = provider.getChain().consensusParameters
29
+ const blockNumber = gqlTransaction.status?.block?.header?.header
30
+ return {
31
+ ...assembleTransactionSummary({
32
+ id: gqlTransaction.id,
33
+ receipts: [],
34
+ transaction: decodedTransaction,
35
+ transactionBytes: rawPayload,
36
+ gqlTransactionStatus: gqlTransaction.status,
37
+ gasPerByte: bn(gasPerByte),
38
+ gasPriceFactor: bn(gasPriceFactor),
39
+ maxInputs,
40
+ gasCosts
41
+ }),
42
+ blockNumber
43
+ }
44
+ }
21
45
 
22
- export function decodeFuelTransaction(gqlTransaction: any, abiMap: AbiMap, provider: Provider): FuelTransaction {
46
+ export function decodeFuelTransactionWithAbi(gqlTransaction: any, abiMap: AbiMap, provider: Provider): FuelTransaction {
23
47
  const rawPayload = arrayify(gqlTransaction.rawPayload)
24
48
 
25
49
  const [decodedTransaction] = new TransactionCoder().decode(rawPayload, 0)
@@ -27,17 +51,21 @@ export function decodeFuelTransaction(gqlTransaction: any, abiMap: AbiMap, provi
27
51
  const receipts = gqlTransaction.receipts?.map(processGqlReceipt) || []
28
52
 
29
53
  const { gasPerByte, gasPriceFactor, maxInputs, gasCosts } = provider.getChain().consensusParameters
54
+ const blockNumber = gqlTransaction.status?.block?.header?.header
30
55
 
31
- return assembleTransactionSummary({
32
- id: gqlTransaction.id,
33
- receipts,
34
- transaction: decodedTransaction,
35
- transactionBytes: rawPayload,
36
- gqlTransactionStatus: gqlTransaction.status,
37
- gasPerByte: bn(gasPerByte),
38
- gasPriceFactor: bn(gasPriceFactor),
39
- abiMap,
40
- maxInputs,
41
- gasCosts
42
- })
56
+ return {
57
+ ...assembleTransactionSummary({
58
+ id: gqlTransaction.id,
59
+ receipts,
60
+ transaction: decodedTransaction,
61
+ transactionBytes: rawPayload,
62
+ gqlTransactionStatus: gqlTransaction.status,
63
+ gasPerByte: bn(gasPerByte),
64
+ gasPriceFactor: bn(gasPriceFactor),
65
+ abiMap,
66
+ maxInputs,
67
+ gasCosts
68
+ }),
69
+ blockNumber
70
+ }
43
71
  }
@@ -0,0 +1,18 @@
1
+ import { ListStateStorage } from '@sentio/runtime'
2
+ import { Data_FuelCall, FuelAssetHandlerConfig, FuelCallHandlerConfig, ProcessResult } from '@sentio/protos'
3
+
4
+ export interface FuelBaseProcessor<T> {
5
+ configure(): Promise<void>
6
+ config: T
7
+ callHandlers: CallHandler<Data_FuelCall>[]
8
+ }
9
+
10
+ export class FuelProcessorState extends ListStateStorage<FuelBaseProcessor<any>> {
11
+ static INSTANCE = new FuelProcessorState()
12
+ }
13
+
14
+ export type CallHandler<T> = {
15
+ handler: (call: T) => Promise<ProcessResult>
16
+ fetchConfig?: Partial<FuelCallHandlerConfig>
17
+ assetConfig?: Partial<FuelAssetHandlerConfig>
18
+ }
@@ -51,6 +51,20 @@ export class FuelFacet {
51
51
  res.push(binding)
52
52
  }
53
53
  }
54
+ for (const assetConfig of config.assetConfigs) {
55
+ const binding = {
56
+ data: {
57
+ fuelCall: {
58
+ transaction,
59
+ timestamp: new Date()
60
+ }
61
+ },
62
+ handlerIds: [assetConfig.handlerId],
63
+ handlerType: HandlerType.FUEL_CALL
64
+ }
65
+
66
+ res.push(binding)
67
+ }
54
68
  }
55
69
 
56
70
  return res