@sentio/sdk 2.36.0-rc.2 → 2.36.0-rc.4
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.
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/fuel/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAmB,MAAM,kBAAkB,CAAA;AACvE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/fuel/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAmB,MAAM,kBAAkB,CAAA;AACvE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAA0B,oBAAoB,EAAE,MAAM,OAAO,CAAA;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAElD,MAAM,MAAM,QAAQ,GAAG,oBAAoB,CAAA;AAE3C,qBAAa,WAAY,SAAQ,WAAW;IAExC,QAAQ,CAAC,WAAW,EAAE,eAAe,GAAG,IAAI;IAC5C,QAAQ,CAAC,OAAO,EAAE,OAAO;gBADhB,WAAW,EAAE,eAAe,GAAG,IAAI,EACnC,OAAO,EAAE,OAAO;IAK3B,UAAU,IAAI,OAAO;IAIrB,SAAS,CAAC,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,cAAc;CAoB5E"}
|
package/lib/fuel/context.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import { BaseContext, normalizeLabels } from '../core/index.js';
|
2
|
+
import { BaseAssetId, InputType } from 'fuels';
|
2
3
|
export class FuelContext extends BaseContext {
|
3
4
|
transaction;
|
4
5
|
chainId;
|
@@ -11,8 +12,14 @@ export class FuelContext extends BaseContext {
|
|
11
12
|
return this.chainId;
|
12
13
|
}
|
13
14
|
getMetaDataInternal(name, labels) {
|
15
|
+
let address = '';
|
16
|
+
for (const input of this.transaction?.transaction?.inputs || []) {
|
17
|
+
if (input.type == InputType.Coin && input.assetId == BaseAssetId) {
|
18
|
+
address = input.owner;
|
19
|
+
}
|
20
|
+
}
|
14
21
|
return {
|
15
|
-
address
|
22
|
+
address,
|
16
23
|
contractName: this.transaction?.id || '', // TODO
|
17
24
|
blockNumber: BigInt(this.transaction?.blockNumber || 0),
|
18
25
|
transactionIndex: 0,
|
package/lib/fuel/context.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/fuel/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAU,eAAe,EAAE,MAAM,kBAAkB,CAAA;
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/fuel/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAU,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAGvE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAwB,MAAM,OAAO,CAAA;AAKpE,MAAM,OAAO,WAAY,SAAQ,WAAW;IAE/B;IACA;IAFX,YACW,WAAmC,EACnC,OAAgB;QAEzB,KAAK,CAAC,EAAE,CAAC,CAAA;QAHA,gBAAW,GAAX,WAAW,CAAwB;QACnC,YAAO,GAAP,OAAO,CAAS;IAG3B,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;IAES,mBAAmB,CAAC,IAAY,EAAE,MAAc;QACxD,IAAI,OAAO,GAAG,EAAE,CAAA;QAChB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,WAAW,EAAE,WAAW,EAAE,MAAM,IAAI,EAAE,EAAE,CAAC;YAChE,IAAI,KAAK,CAAC,IAAI,IAAI,SAAS,CAAC,IAAI,IAAI,KAAK,CAAC,OAAO,IAAI,WAAW,EAAE,CAAC;gBACjE,OAAO,GAAG,KAAK,CAAC,KAAK,CAAA;YACvB,CAAC;QACH,CAAC;QAED,OAAO;YACL,OAAO;YACP,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,EAAE,OAAO;YACjD,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,IAAI,CAAC,CAAC;YACvD,gBAAgB,EAAE,CAAC;YACnB,eAAe,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,EAAE,OAAO;YACpD,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE;YAC1B,IAAI,EAAE,IAAI;YACV,QAAQ,EAAE,CAAC,CAAC;YACZ,MAAM,EAAE,eAAe,CAAC,MAAM,CAAC;SAChC,CAAA;IACH,CAAC;CACF"}
|
package/lib/fuel/transaction.js
CHANGED
@@ -6,7 +6,7 @@ export function decodeFuelTransaction(gqlTransaction, provider) {
|
|
6
6
|
const rawPayload = arrayify(gqlTransaction.rawPayload);
|
7
7
|
const [decodedTransaction] = new TransactionCoder().decode(rawPayload, 0);
|
8
8
|
const { gasPerByte, gasPriceFactor, maxInputs, gasCosts } = provider.getChain().consensusParameters;
|
9
|
-
const blockNumber = gqlTransaction.status?.block?.header?.
|
9
|
+
const blockNumber = gqlTransaction.status?.block?.header?.height;
|
10
10
|
return {
|
11
11
|
...assembleTransactionSummary({
|
12
12
|
id: gqlTransaction.id,
|
@@ -27,7 +27,7 @@ export function decodeFuelTransactionWithAbi(gqlTransaction, abiMap, provider) {
|
|
27
27
|
const [decodedTransaction] = new TransactionCoder().decode(rawPayload, 0);
|
28
28
|
const receipts = gqlTransaction.receipts?.map(processGqlReceipt) || [];
|
29
29
|
const { gasPerByte, gasPriceFactor, maxInputs, gasCosts } = provider.getChain().consensusParameters;
|
30
|
-
const blockNumber = gqlTransaction.status?.block?.header?.
|
30
|
+
const blockNumber = gqlTransaction.status?.block?.header?.height;
|
31
31
|
return {
|
32
32
|
...assembleTransactionSummary({
|
33
33
|
id: gqlTransaction.id,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sentio/sdk",
|
3
|
-
"version": "2.36.0-rc.
|
3
|
+
"version": "2.36.0-rc.4",
|
4
4
|
"license": "Apache-2.0",
|
5
5
|
"type": "module",
|
6
6
|
"exports": {
|
@@ -77,8 +77,8 @@
|
|
77
77
|
"typedoc": "^0.25.7",
|
78
78
|
"utility-types": "^3.11.0",
|
79
79
|
"yaml": "^2.3.4",
|
80
|
-
"@sentio/protos": "2.36.0-rc.
|
81
|
-
"@sentio/runtime": "^2.36.0-rc.
|
80
|
+
"@sentio/protos": "2.36.0-rc.4",
|
81
|
+
"@sentio/runtime": "^2.36.0-rc.4"
|
82
82
|
},
|
83
83
|
"peerDependencies": {
|
84
84
|
"tsup": "npm:@sentio/tsup@^6.7.2"
|
package/src/fuel/context.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { BaseContext, Labels, normalizeLabels } from '../core/index.js'
|
2
2
|
import { ChainId } from '@sentio/chain'
|
3
3
|
import { RecordMetaData } from '@sentio/protos'
|
4
|
-
import { InvocationCallResult } from 'fuels'
|
4
|
+
import { BaseAssetId, InputType, InvocationCallResult } from 'fuels'
|
5
5
|
import { FuelTransaction } from './transaction.js'
|
6
6
|
|
7
7
|
export type FuelCall = InvocationCallResult
|
@@ -19,8 +19,15 @@ export class FuelContext extends BaseContext {
|
|
19
19
|
}
|
20
20
|
|
21
21
|
protected getMetaDataInternal(name: string, labels: Labels): RecordMetaData {
|
22
|
+
let address = ''
|
23
|
+
for (const input of this.transaction?.transaction?.inputs || []) {
|
24
|
+
if (input.type == InputType.Coin && input.assetId == BaseAssetId) {
|
25
|
+
address = input.owner
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
22
29
|
return {
|
23
|
-
address
|
30
|
+
address,
|
24
31
|
contractName: this.transaction?.id || '', // TODO
|
25
32
|
blockNumber: BigInt(this.transaction?.blockNumber || 0),
|
26
33
|
transactionIndex: 0,
|
package/src/fuel/transaction.ts
CHANGED
@@ -26,7 +26,7 @@ export function decodeFuelTransaction(gqlTransaction: any, provider: Provider):
|
|
26
26
|
|
27
27
|
const [decodedTransaction] = new TransactionCoder().decode(rawPayload, 0)
|
28
28
|
const { gasPerByte, gasPriceFactor, maxInputs, gasCosts } = provider.getChain().consensusParameters
|
29
|
-
const blockNumber = gqlTransaction.status?.block?.header?.
|
29
|
+
const blockNumber = gqlTransaction.status?.block?.header?.height
|
30
30
|
return {
|
31
31
|
...assembleTransactionSummary({
|
32
32
|
id: gqlTransaction.id,
|
@@ -51,7 +51,7 @@ export function decodeFuelTransactionWithAbi(gqlTransaction: any, abiMap: AbiMap
|
|
51
51
|
const receipts = gqlTransaction.receipts?.map(processGqlReceipt) || []
|
52
52
|
|
53
53
|
const { gasPerByte, gasPriceFactor, maxInputs, gasCosts } = provider.getChain().consensusParameters
|
54
|
-
const blockNumber = gqlTransaction.status?.block?.header?.
|
54
|
+
const blockNumber = gqlTransaction.status?.block?.header?.height
|
55
55
|
|
56
56
|
return {
|
57
57
|
...assembleTransactionSummary({
|