@fuel-ts/account 0.78.0 → 0.79.0
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.
Potentially problematic release.
This version of @fuel-ts/account might be problematic. Click here for more details.
- package/dist/index.global.js +37 -40
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +38 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -24
- package/dist/index.mjs.map +1 -1
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/transaction-request/script-transaction-request.d.ts +3 -0
- package/dist/providers/transaction-request/script-transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/types.d.ts +5 -0
- package/dist/providers/transaction-request/types.d.ts.map +1 -1
- package/dist/providers/transaction-response/getDecodedLogs.d.ts +2 -2
- package/dist/providers/transaction-response/getDecodedLogs.d.ts.map +1 -1
- package/dist/providers/transaction-response/transaction-response.d.ts +5 -2
- package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
- package/dist/test-utils.global.js +37 -25
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +38 -11
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +36 -9
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +16 -16
package/dist/index.global.js
CHANGED
@@ -28952,9 +28952,9 @@ spurious results.`);
|
|
28952
28952
|
// ../versions/dist/index.mjs
|
28953
28953
|
function getBuiltinVersions() {
|
28954
28954
|
return {
|
28955
|
-
FORC: "0.
|
28955
|
+
FORC: "0.49.3",
|
28956
28956
|
FUEL_CORE: "0.22.1",
|
28957
|
-
FUELS: "0.
|
28957
|
+
FUELS: "0.79.0"
|
28958
28958
|
};
|
28959
28959
|
}
|
28960
28960
|
function parseVersion(version2) {
|
@@ -33196,18 +33196,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33196
33196
|
var Interface = class {
|
33197
33197
|
functions;
|
33198
33198
|
configurables;
|
33199
|
-
/*
|
33200
|
-
TODO: Refactor so that there's no need for externalLoggedTypes
|
33201
|
-
|
33202
|
-
This is dedicated to external contracts added via `<base-invocation-scope.ts>.addContracts()` method.
|
33203
|
-
This is used to decode logs from contracts other than the main contract
|
33204
|
-
we're interacting with.
|
33205
|
-
*/
|
33206
|
-
externalLoggedTypes;
|
33207
33199
|
jsonAbi;
|
33208
33200
|
constructor(jsonAbi) {
|
33209
33201
|
this.jsonAbi = jsonAbi;
|
33210
|
-
this.externalLoggedTypes = {};
|
33211
33202
|
this.functions = Object.fromEntries(
|
33212
33203
|
this.jsonAbi.functions.map((x) => [x.name, new FunctionFragment(this.jsonAbi, x.name)])
|
33213
33204
|
);
|
@@ -33248,20 +33239,12 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33248
33239
|
const fragment = typeof functionFragment === "string" ? this.getFunction(functionFragment) : functionFragment;
|
33249
33240
|
return fragment.decodeOutput(data);
|
33250
33241
|
}
|
33251
|
-
decodeLog(data, logId
|
33252
|
-
const isExternalLoggedType = this.externalLoggedTypes[receiptId];
|
33253
|
-
if (isExternalLoggedType) {
|
33254
|
-
const externalInterface = this.externalLoggedTypes[receiptId];
|
33255
|
-
return externalInterface.decodeLog(data, logId, receiptId);
|
33256
|
-
}
|
33242
|
+
decodeLog(data, logId) {
|
33257
33243
|
const { loggedType } = findOrThrow(this.jsonAbi.loggedTypes, (type3) => type3.logId === logId);
|
33258
33244
|
return AbiCoder.decode(this.jsonAbi, loggedType, arrayify(data), 0, {
|
33259
33245
|
encoding: this.jsonAbi.encoding
|
33260
33246
|
});
|
33261
33247
|
}
|
33262
|
-
updateExternalLoggedTypes(id, loggedTypes) {
|
33263
|
-
this.externalLoggedTypes[id] = loggedTypes;
|
33264
|
-
}
|
33265
33248
|
encodeConfigurable(name, value) {
|
33266
33249
|
const configurable = findOrThrow(
|
33267
33250
|
this.jsonAbi.configurables,
|
@@ -40124,6 +40107,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
40124
40107
|
script;
|
40125
40108
|
/** Script input data (parameters) */
|
40126
40109
|
scriptData;
|
40110
|
+
abis;
|
40127
40111
|
/**
|
40128
40112
|
* Constructor for `ScriptTransactionRequest`.
|
40129
40113
|
*
|
@@ -40134,6 +40118,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
40134
40118
|
this.gasLimit = bn(gasLimit);
|
40135
40119
|
this.script = arrayify(script ?? returnZeroScript.bytes);
|
40136
40120
|
this.scriptData = arrayify(scriptData ?? returnZeroScript.encodeScriptData());
|
40121
|
+
this.abis = rest.abis;
|
40137
40122
|
}
|
40138
40123
|
/**
|
40139
40124
|
* Converts the transaction request to a `TransactionScript`.
|
@@ -41019,6 +41004,19 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
41019
41004
|
return transactionSummary;
|
41020
41005
|
}
|
41021
41006
|
|
41007
|
+
// src/providers/transaction-response/getDecodedLogs.ts
|
41008
|
+
function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
|
41009
|
+
return receipts.reduce((logs, receipt) => {
|
41010
|
+
if (receipt.type === ReceiptType.LogData || receipt.type === ReceiptType.Log) {
|
41011
|
+
const interfaceToUse = new Interface(externalAbis[receipt.id] || mainAbi);
|
41012
|
+
const data = receipt.type === ReceiptType.Log ? new BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
|
41013
|
+
const [decodedLog] = interfaceToUse.decodeLog(data, receipt.val1.toNumber());
|
41014
|
+
logs.push(decodedLog);
|
41015
|
+
}
|
41016
|
+
return logs;
|
41017
|
+
}, []);
|
41018
|
+
}
|
41019
|
+
|
41022
41020
|
// src/providers/transaction-response/transaction-response.ts
|
41023
41021
|
var TransactionResponse2 = class {
|
41024
41022
|
/** Transaction ID */
|
@@ -41029,15 +41027,17 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
41029
41027
|
gasUsed = bn(0);
|
41030
41028
|
/** The graphql Transaction with receipts object. */
|
41031
41029
|
gqlTransaction;
|
41030
|
+
abis;
|
41032
41031
|
/**
|
41033
41032
|
* Constructor for `TransactionResponse`.
|
41034
41033
|
*
|
41035
41034
|
* @param id - The transaction ID.
|
41036
41035
|
* @param provider - The provider.
|
41037
41036
|
*/
|
41038
|
-
constructor(id, provider) {
|
41037
|
+
constructor(id, provider, abis) {
|
41039
41038
|
this.id = id;
|
41040
41039
|
this.provider = provider;
|
41040
|
+
this.abis = abis;
|
41041
41041
|
}
|
41042
41042
|
/**
|
41043
41043
|
* Async constructor for `TransactionResponse`. This method can be used to create
|
@@ -41047,8 +41047,8 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
41047
41047
|
* @param id - The transaction ID.
|
41048
41048
|
* @param provider - The provider.
|
41049
41049
|
*/
|
41050
|
-
static async create(id, provider) {
|
41051
|
-
const response = new TransactionResponse2(id, provider);
|
41050
|
+
static async create(id, provider, abis) {
|
41051
|
+
const response = new TransactionResponse2(id, provider, abis);
|
41052
41052
|
await response.fetch();
|
41053
41053
|
return response;
|
41054
41054
|
}
|
@@ -41152,6 +41152,14 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
41152
41152
|
gqlTransaction: this.gqlTransaction,
|
41153
41153
|
...transactionSummary
|
41154
41154
|
};
|
41155
|
+
if (this.abis) {
|
41156
|
+
const logs = getDecodedLogs(
|
41157
|
+
transactionSummary.receipts,
|
41158
|
+
this.abis.main,
|
41159
|
+
this.abis.otherContractsAbis
|
41160
|
+
);
|
41161
|
+
transactionResult.logs = logs;
|
41162
|
+
}
|
41155
41163
|
return transactionResult;
|
41156
41164
|
}
|
41157
41165
|
/**
|
@@ -41171,21 +41179,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
41171
41179
|
}
|
41172
41180
|
};
|
41173
41181
|
|
41174
|
-
// src/providers/transaction-response/getDecodedLogs.ts
|
41175
|
-
function getDecodedLogs(receipts, abiInterface) {
|
41176
|
-
return receipts.reduce((logs, r) => {
|
41177
|
-
if (r.type === ReceiptType.LogData) {
|
41178
|
-
logs.push(abiInterface.decodeLog(r.data, r.val1.toNumber(), r.id)[0]);
|
41179
|
-
}
|
41180
|
-
if (r.type === ReceiptType.Log) {
|
41181
|
-
logs.push(
|
41182
|
-
abiInterface.decodeLog(new BigNumberCoder("u64").encode(r.val0), r.val1.toNumber(), r.id)[0]
|
41183
|
-
);
|
41184
|
-
}
|
41185
|
-
return logs;
|
41186
|
-
}, []);
|
41187
|
-
}
|
41188
|
-
|
41189
41182
|
// src/providers/utils/auto-retry-fetch.ts
|
41190
41183
|
function getWaitDelay(options, retryAttemptNum) {
|
41191
41184
|
const duration = options.baseDelay ?? 150;
|
@@ -41520,6 +41513,10 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
41520
41513
|
await this.estimateTxDependencies(transactionRequest);
|
41521
41514
|
}
|
41522
41515
|
const encodedTransaction = hexlify(transactionRequest.toTransactionBytes());
|
41516
|
+
let abis;
|
41517
|
+
if (transactionRequest.type === TransactionType.Script) {
|
41518
|
+
abis = transactionRequest.abis;
|
41519
|
+
}
|
41523
41520
|
if (awaitExecution) {
|
41524
41521
|
const subscription = this.operations.submitAndAwait({ encodedTransaction });
|
41525
41522
|
for await (const { submitAndAwait } of subscription) {
|
@@ -41534,14 +41531,14 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
41534
41531
|
}
|
41535
41532
|
}
|
41536
41533
|
const transactionId2 = transactionRequest.getTransactionId(this.getChainId());
|
41537
|
-
const response = new TransactionResponse2(transactionId2, this);
|
41534
|
+
const response = new TransactionResponse2(transactionId2, this, abis);
|
41538
41535
|
await response.fetch();
|
41539
41536
|
return response;
|
41540
41537
|
}
|
41541
41538
|
const {
|
41542
41539
|
submit: { id: transactionId }
|
41543
41540
|
} = await this.operations.submit({ encodedTransaction });
|
41544
|
-
return new TransactionResponse2(transactionId, this);
|
41541
|
+
return new TransactionResponse2(transactionId, this, abis);
|
41545
41542
|
}
|
41546
41543
|
/**
|
41547
41544
|
* Executes a transaction without actually submitting it to the chain.
|