@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.
- package/lib/aptos/aptos-plugin.d.ts.map +1 -1
- package/lib/aptos/aptos-plugin.js +30 -20
- package/lib/aptos/aptos-plugin.js.map +1 -1
- package/lib/fuel/asset-processor.d.ts +36 -0
- package/lib/fuel/asset-processor.d.ts.map +1 -0
- package/lib/fuel/asset-processor.js +85 -0
- package/lib/fuel/asset-processor.js.map +1 -0
- package/lib/fuel/base-processor.d.ts +1 -1
- package/lib/fuel/base-processor.d.ts.map +1 -1
- package/lib/fuel/base-processor.js +2 -1
- package/lib/fuel/base-processor.js.map +1 -1
- package/lib/fuel/context.js +2 -2
- package/lib/fuel/context.js.map +1 -1
- package/lib/fuel/fuel-plugin.d.ts.map +1 -1
- package/lib/fuel/fuel-plugin.js +17 -29
- package/lib/fuel/fuel-plugin.js.map +1 -1
- package/lib/fuel/fuel-processor.d.ts +3 -10
- package/lib/fuel/fuel-processor.d.ts.map +1 -1
- package/lib/fuel/fuel-processor.js +4 -7
- package/lib/fuel/fuel-processor.js.map +1 -1
- package/lib/fuel/index.d.ts +1 -0
- package/lib/fuel/index.d.ts.map +1 -1
- package/lib/fuel/index.js +1 -0
- package/lib/fuel/index.js.map +1 -1
- package/lib/fuel/transaction.d.ts +5 -2
- package/lib/fuel/transaction.d.ts.map +1 -1
- package/lib/fuel/transaction.js +37 -13
- package/lib/fuel/transaction.js.map +1 -1
- package/lib/fuel/types.d.ts +16 -0
- package/lib/fuel/types.d.ts.map +1 -0
- package/lib/fuel/types.js +5 -0
- package/lib/fuel/types.js.map +1 -0
- package/lib/testing/fuel-facet.d.ts.map +1 -1
- package/lib/testing/fuel-facet.js +13 -0
- package/lib/testing/fuel-facet.js.map +1 -1
- package/package.json +3 -3
- package/src/aptos/aptos-plugin.ts +38 -32
- package/src/fuel/asset-processor.ts +119 -0
- package/src/fuel/base-processor.ts +16 -11
- package/src/fuel/context.ts +2 -2
- package/src/fuel/fuel-plugin.ts +15 -32
- package/src/fuel/fuel-processor.ts +12 -16
- package/src/fuel/index.ts +2 -1
- package/src/fuel/transaction.ts +42 -14
- package/src/fuel/types.ts +18 -0
- package/src/testing/fuel-facet.ts +14 -0
package/src/fuel/transaction.ts
CHANGED
@@ -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
|
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
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
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
|