@fuel-ts/account 0.94.7 → 0.94.9
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/dist/index.global.js +458 -435
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +25 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -3
- package/dist/index.mjs.map +1 -1
- package/dist/predicate/predicate.d.ts +9 -1
- package/dist/predicate/predicate.d.ts.map +1 -1
- package/dist/providers/fuel-graphql-subscriber.d.ts.map +1 -1
- package/dist/providers/transaction-summary/types.d.ts +16 -0
- package/dist/providers/transaction-summary/types.d.ts.map +1 -1
- package/dist/test-utils/launchNode.d.ts.map +1 -1
- package/dist/test-utils.global.js +355 -3226
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +1 -7
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +1 -7
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +17 -18
package/dist/index.js
CHANGED
@@ -10884,10 +10884,17 @@ var getPredicateRoot = (bytecode) => {
|
|
10884
10884
|
};
|
10885
10885
|
|
10886
10886
|
// src/predicate/predicate.ts
|
10887
|
+
function getDataOffset(binary) {
|
10888
|
+
const buffer = binary.buffer.slice(binary.byteOffset + 8, binary.byteOffset + 16);
|
10889
|
+
const dataView = new DataView(buffer);
|
10890
|
+
const dataOffset = dataView.getBigUint64(0, false);
|
10891
|
+
return Number(dataOffset);
|
10892
|
+
}
|
10887
10893
|
var Predicate = class extends Account {
|
10888
10894
|
bytes;
|
10889
10895
|
predicateData = [];
|
10890
10896
|
interface;
|
10897
|
+
loaderBytecode = "";
|
10891
10898
|
/**
|
10892
10899
|
* Creates an instance of the Predicate class.
|
10893
10900
|
*
|
@@ -10902,7 +10909,13 @@ var Predicate = class extends Account {
|
|
10902
10909
|
abi,
|
10903
10910
|
provider,
|
10904
10911
|
data,
|
10905
|
-
configurableConstants
|
10912
|
+
configurableConstants,
|
10913
|
+
/**
|
10914
|
+
* TODO: Implement a getBytes method within the Predicate class. This method should return the loaderBytecode if it is set.
|
10915
|
+
* The getBytes method should be used in all places where we use this.bytes.
|
10916
|
+
* Note: Do not set loaderBytecode to a default string here; it should remain undefined when not provided.
|
10917
|
+
*/
|
10918
|
+
loaderBytecode = ""
|
10906
10919
|
}) {
|
10907
10920
|
const { predicateBytes, predicateInterface } = Predicate.processPredicateData(
|
10908
10921
|
bytecode,
|
@@ -10913,6 +10926,7 @@ var Predicate = class extends Account {
|
|
10913
10926
|
super(address, provider);
|
10914
10927
|
this.bytes = predicateBytes;
|
10915
10928
|
this.interface = predicateInterface;
|
10929
|
+
this.loaderBytecode = loaderBytecode;
|
10916
10930
|
if (data !== void 0 && data.length > 0) {
|
10917
10931
|
this.predicateData = data;
|
10918
10932
|
}
|
@@ -11037,7 +11051,7 @@ var Predicate = class extends Account {
|
|
11037
11051
|
* @param abiInterface - The ABI interface of the predicate.
|
11038
11052
|
* @returns The mutated bytes with the configurable constants set.
|
11039
11053
|
*/
|
11040
|
-
static setConfigurableConstants(bytes, configurableConstants, abiInterface) {
|
11054
|
+
static setConfigurableConstants(bytes, configurableConstants, abiInterface, loaderBytecode) {
|
11041
11055
|
const mutatedBytes = bytes;
|
11042
11056
|
try {
|
11043
11057
|
if (!abiInterface) {
|
@@ -11063,6 +11077,15 @@ var Predicate = class extends Account {
|
|
11063
11077
|
const encoded = abiInterface.encodeConfigurable(key, value);
|
11064
11078
|
mutatedBytes.set(encoded, offset);
|
11065
11079
|
});
|
11080
|
+
if (loaderBytecode) {
|
11081
|
+
const offset = getDataOffset(bytes);
|
11082
|
+
const dataSection = mutatedBytes.slice(offset);
|
11083
|
+
const dataSectionLen = dataSection.length;
|
11084
|
+
const dataSectionLenBytes = new Uint8Array(8);
|
11085
|
+
const dataSectionLenDataView = new DataView(dataSectionLenBytes.buffer);
|
11086
|
+
dataSectionLenDataView.setBigUint64(0, BigInt(dataSectionLen), false);
|
11087
|
+
mutatedBytes.set((0, import_utils43.concat)([loaderBytecode, dataSectionLenBytes, dataSection]));
|
11088
|
+
}
|
11066
11089
|
} catch (err) {
|
11067
11090
|
throw new import_errors28.FuelError(
|
11068
11091
|
import_errors28.ErrorCode.INVALID_CONFIGURABLE_CONSTANTS,
|