@fuel-ts/account 0.97.1 → 0.97.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.
@@ -192,7 +192,11 @@ var extractRemainingArgs = (args, flagsToRemove) => {
192
192
  });
193
193
  return newArgs;
194
194
  };
195
- function getFinalStateConfigJSON({ stateConfig, chainConfig }) {
195
+ function getFinalStateConfigJSON({
196
+ stateConfig,
197
+ chainConfig,
198
+ includeInitialState = false
199
+ }) {
196
200
  const defaultCoins = import_utils2.defaultSnapshotConfigs.stateConfig.coins.map((coin) => ({
197
201
  ...coin,
198
202
  amount: "18446744073709551615"
@@ -203,6 +207,26 @@ function getFinalStateConfigJSON({ stateConfig, chainConfig }) {
203
207
  }));
204
208
  const coins = defaultCoins.concat(stateConfig.coins.map((coin) => ({ ...coin, amount: coin.amount.toString() }))).filter((coin, index, self) => self.findIndex((c) => c.tx_id === coin.tx_id) === index);
205
209
  const messages = defaultMessages.concat(stateConfig.messages.map((msg) => ({ ...msg, amount: msg.amount.toString() }))).filter((msg, index, self) => self.findIndex((m) => m.nonce === msg.nonce) === index);
210
+ if (includeInitialState) {
211
+ coins.push({
212
+ tx_id: "0x0000000000000000000000000000000000000000000000000000000000000001",
213
+ output_index: 0,
214
+ tx_pointer_block_height: 0,
215
+ tx_pointer_tx_idx: 0,
216
+ owner: "0x94ffcc53b892684acefaebc8a3d4a595e528a8cf664eeb3ef36f1020b0809d0d",
217
+ amount: "18446744073709551615",
218
+ asset_id: "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07"
219
+ });
220
+ coins.push({
221
+ tx_id: "0x0000000000000000000000000000000000000000000000000000000000000002",
222
+ output_index: 0,
223
+ tx_pointer_block_height: 0,
224
+ tx_pointer_tx_idx: 0,
225
+ owner: "0x09c0b2d1a486c439a87bcba6b46a7a1a23f3897cc83a94521a96da5c23bc58db",
226
+ amount: "18446744073709551615",
227
+ asset_id: "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07"
228
+ });
229
+ }
206
230
  if (!process.env.GENESIS_SECRET) {
207
231
  const pk = Signer.generatePrivateKey();
208
232
  const signer = new Signer(pk);
@@ -212,7 +236,7 @@ function getFinalStateConfigJSON({ stateConfig, chainConfig }) {
212
236
  owner: signer.address.toHexString(),
213
237
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
214
238
  amount: "18446744073709551615",
215
- asset_id: chainConfig.consensus_parameters.V1.base_asset_id,
239
+ asset_id: chainConfig.consensus_parameters.V2.base_asset_id,
216
240
  output_index: 0,
217
241
  tx_pointer_block_height: 0,
218
242
  tx_pointer_tx_idx: 0
@@ -233,7 +257,8 @@ var launchNode = async ({
233
257
  fuelCorePath = process.env.FUEL_CORE_PATH || void 0,
234
258
  loggingEnabled = true,
235
259
  basePath,
236
- snapshotConfig = import_utils2.defaultSnapshotConfigs
260
+ snapshotConfig = import_utils2.defaultSnapshotConfigs,
261
+ includeInitialState = false
237
262
  } = {}) => (
238
263
  // eslint-disable-next-line no-async-promise-executor
239
264
  new Promise(async (resolve, reject) => {
@@ -273,7 +298,14 @@ var launchNode = async ({
273
298
  const stateConfigPath = import_path.default.join(tempDir, metadata.table_encoding.Json.filepath);
274
299
  const stateTransitionPath = import_path.default.join(tempDir, "state_transition_bytecode.wasm");
275
300
  (0, import_fs.writeFileSync)(chainConfigPath, JSON.stringify(snapshotConfig.chainConfig), "utf8");
276
- (0, import_fs.writeFileSync)(stateConfigPath, getFinalStateConfigJSON(snapshotConfig), "utf8");
301
+ (0, import_fs.writeFileSync)(
302
+ stateConfigPath,
303
+ getFinalStateConfigJSON({
304
+ ...snapshotConfig,
305
+ includeInitialState
306
+ }),
307
+ "utf8"
308
+ );
277
309
  (0, import_fs.writeFileSync)(metadataPath, JSON.stringify(metadata), "utf8");
278
310
  (0, import_fs.writeFileSync)(stateTransitionPath, JSON.stringify(""));
279
311
  snapshotDirToUse = tempDir;
@@ -10397,7 +10429,7 @@ async function setupTestProviderAndWallets({
10397
10429
  } = {}) {
10398
10430
  Symbol.dispose ??= Symbol("Symbol.dispose");
10399
10431
  const walletsConfig = new WalletsConfig(
10400
- nodeOptions.snapshotConfig?.chainConfig?.consensus_parameters?.V1?.base_asset_id ?? import_utils45.defaultSnapshotConfigs.chainConfig.consensus_parameters.V1.base_asset_id,
10432
+ nodeOptions.snapshotConfig?.chainConfig?.consensus_parameters?.V2?.base_asset_id ?? import_utils45.defaultSnapshotConfigs.chainConfig.consensus_parameters.V2.base_asset_id,
10401
10433
  {
10402
10434
  ...defaultWalletConfigOptions,
10403
10435
  ...walletsConfigOptions