@sentio/sdk 2.36.0-rc.13 → 2.36.0-rc.15

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 (52) hide show
  1. package/lib/aptos/builtin/0x1.js +1 -1
  2. package/lib/aptos/builtin/0x1.js.map +1 -1
  3. package/lib/aptos/builtin/0x3.js +1 -1
  4. package/lib/aptos/builtin/0x3.js.map +1 -1
  5. package/lib/aptos/builtin/0x4.js +1 -1
  6. package/lib/aptos/builtin/0x4.js.map +1 -1
  7. package/lib/core/big-decimal.d.ts +6 -0
  8. package/lib/core/big-decimal.d.ts.map +1 -1
  9. package/lib/core/big-decimal.js +7 -0
  10. package/lib/core/big-decimal.js.map +1 -1
  11. package/lib/core/normalization.d.ts.map +1 -1
  12. package/lib/core/normalization.js +4 -0
  13. package/lib/core/normalization.js.map +1 -1
  14. package/lib/fuel/base-processor.d.ts +1 -1
  15. package/lib/fuel/base-processor.d.ts.map +1 -1
  16. package/lib/fuel/base-processor.js.map +1 -1
  17. package/lib/fuel/codegen/codegen.js +5 -5
  18. package/lib/fuel/codegen/codegen.js.map +1 -1
  19. package/lib/fuel/context.d.ts +2 -2
  20. package/lib/fuel/context.d.ts.map +1 -1
  21. package/lib/fuel/context.js.map +1 -1
  22. package/lib/fuel/fuel-processor.d.ts +2 -2
  23. package/lib/fuel/fuel-processor.d.ts.map +1 -1
  24. package/lib/fuel/fuel-processor.js +4 -2
  25. package/lib/fuel/fuel-processor.js.map +1 -1
  26. package/lib/fuel/transaction.d.ts +2 -1
  27. package/lib/fuel/transaction.d.ts.map +1 -1
  28. package/lib/fuel/transaction.js +18 -7
  29. package/lib/fuel/transaction.js.map +1 -1
  30. package/lib/fuel/types.d.ts +3 -2
  31. package/lib/fuel/types.d.ts.map +1 -1
  32. package/lib/sui/builtin/0x1.js +1 -1
  33. package/lib/sui/builtin/0x1.js.map +1 -1
  34. package/lib/sui/builtin/0x2.js +1 -1
  35. package/lib/sui/builtin/0x2.js.map +1 -1
  36. package/lib/sui/builtin/0x3.js +1 -1
  37. package/lib/sui/builtin/0x3.js.map +1 -1
  38. package/package.json +19 -19
  39. package/src/aptos/builtin/0x1.ts +1 -1
  40. package/src/aptos/builtin/0x3.ts +1 -1
  41. package/src/aptos/builtin/0x4.ts +1 -1
  42. package/src/core/big-decimal.ts +17 -0
  43. package/src/core/normalization.ts +4 -0
  44. package/src/fuel/base-processor.ts +1 -1
  45. package/src/fuel/codegen/codegen.ts +5 -5
  46. package/src/fuel/context.ts +1 -1
  47. package/src/fuel/fuel-processor.ts +9 -4
  48. package/src/fuel/transaction.ts +22 -9
  49. package/src/fuel/types.ts +3 -2
  50. package/src/sui/builtin/0x1.ts +1 -1
  51. package/src/sui/builtin/0x2.ts +1 -1
  52. package/src/sui/builtin/0x3.ts +1 -1
@@ -1,9 +1,10 @@
1
1
  import { AbiMap, assembleTransactionSummary, processGqlReceipt, Provider, TransactionSummary } from '@fuel-ts/account'
2
- import { ReceiptType, TransactionCoder } from '@fuel-ts/transactions'
2
+ import { Input, InputType, ReceiptType, TransactionCoder } from '@fuel-ts/transactions'
3
3
  import { bn } from '@fuel-ts/math'
4
4
  import { arrayify } from '@fuel-ts/utils'
5
- import { Interface, BigNumberCoder } from '@fuel-ts/abi-coder'
5
+ import { BigNumberCoder, Interface } from '@fuel-ts/abi-coder'
6
6
  import { FuelLog } from './types.js'
7
+ import { BaseAssetId } from '@fuel-ts/address/configs'
7
8
 
8
9
  export type FuelFetchConfig = {
9
10
  includeFailed?: boolean
@@ -15,7 +16,17 @@ export const DEFAULT_FUEL_FETCH_CONFIG: FuelFetchConfig = {
15
16
 
16
17
  export type FuelTransaction = TransactionSummary & {
17
18
  blockNumber?: string
18
- logs?: FuelLog[]
19
+ logs?: FuelLog<any>[]
20
+ sender?: string
21
+ }
22
+
23
+ function findSenderFromInputs(inputs: Input[] | undefined): string | undefined {
24
+ for (const input of inputs || []) {
25
+ if (input.type == InputType.Coin && input.assetId == BaseAssetId) {
26
+ return input.owner
27
+ }
28
+ }
29
+ return undefined
19
30
  }
20
31
 
21
32
  export function decodeFuelTransaction(gqlTransaction: any, provider: Provider): FuelTransaction {
@@ -40,7 +51,8 @@ export function decodeFuelTransaction(gqlTransaction: any, provider: Provider):
40
51
  maxInputs,
41
52
  gasCosts
42
53
  }),
43
- blockNumber
54
+ blockNumber,
55
+ sender: findSenderFromInputs(decodedTransaction.inputs)
44
56
  }
45
57
  }
46
58
 
@@ -61,8 +73,8 @@ export function decodeFuelTransactionWithAbi(gqlTransaction: any, abiMap: AbiMap
61
73
 
62
74
  const abi = Object.values(abiMap)[0]
63
75
 
64
- const logs: FuelLog[] = []
65
- for (const receipt of receipts) {
76
+ const logs = [] as FuelLog<any>[]
77
+ ;(receipts as any[]).forEach((receipt, idx) => {
66
78
  if (receipt.type === ReceiptType.LogData || receipt.type === ReceiptType.Log) {
67
79
  const interfaceToUse = new Interface(abi)
68
80
 
@@ -70,9 +82,9 @@ export function decodeFuelTransactionWithAbi(gqlTransaction: any, abiMap: AbiMap
70
82
 
71
83
  const logId = receipt.val1.toNumber()
72
84
  const [decodedLog] = interfaceToUse.decodeLog(data, logId)
73
- logs.push({ logId, decodedLog })
85
+ logs.push({ logId, data: decodedLog, receiptIndex: idx })
74
86
  }
75
- }
87
+ })
76
88
 
77
89
  return {
78
90
  ...assembleTransactionSummary({
@@ -88,6 +100,7 @@ export function decodeFuelTransactionWithAbi(gqlTransaction: any, abiMap: AbiMap
88
100
  gasCosts
89
101
  }),
90
102
  blockNumber,
91
- logs
103
+ logs,
104
+ sender: findSenderFromInputs(decodedTransaction.inputs)
92
105
  }
93
106
  }
package/src/fuel/types.ts CHANGED
@@ -20,7 +20,8 @@ export type CallHandler<T> = {
20
20
  }
21
21
  }
22
22
 
23
- export interface FuelLog {
23
+ export interface FuelLog<T> {
24
24
  logId: number
25
- decodedLog: any
25
+ data: T
26
+ receiptIndex: number
26
27
  }
@@ -2,7 +2,7 @@
2
2
  /* tslint:disable */
3
3
  /* eslint-disable */
4
4
 
5
- /* Generated modules for account 0x1 */
5
+ /* Generated types for 0x1, original address 0x1 */
6
6
 
7
7
  import { TypeDescriptor, ANY_TYPE } from "@typemove/move";
8
8
  import { MoveCoder, TypedEventInstance } from "@typemove/sui";
@@ -2,7 +2,7 @@
2
2
  /* tslint:disable */
3
3
  /* eslint-disable */
4
4
 
5
- /* Generated modules for account 0x2 */
5
+ /* Generated types for 0x2, original address 0x2 */
6
6
 
7
7
  import { TypeDescriptor, ANY_TYPE } from "@typemove/move";
8
8
  import { MoveCoder, TypedEventInstance } from "@typemove/sui";
@@ -2,7 +2,7 @@
2
2
  /* tslint:disable */
3
3
  /* eslint-disable */
4
4
 
5
- /* Generated modules for account 0x3 */
5
+ /* Generated types for 0x3, original address 0x3 */
6
6
 
7
7
  import { TypeDescriptor, ANY_TYPE } from "@typemove/move";
8
8
  import { MoveCoder, TypedEventInstance } from "@typemove/sui";