@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.
@@ -154,7 +154,11 @@ var extractRemainingArgs = (args, flagsToRemove) => {
154
154
  });
155
155
  return newArgs;
156
156
  };
157
- function getFinalStateConfigJSON({ stateConfig, chainConfig }) {
157
+ function getFinalStateConfigJSON({
158
+ stateConfig,
159
+ chainConfig,
160
+ includeInitialState = false
161
+ }) {
158
162
  const defaultCoins = defaultSnapshotConfigs.stateConfig.coins.map((coin) => ({
159
163
  ...coin,
160
164
  amount: "18446744073709551615"
@@ -165,6 +169,26 @@ function getFinalStateConfigJSON({ stateConfig, chainConfig }) {
165
169
  }));
166
170
  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);
167
171
  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);
172
+ if (includeInitialState) {
173
+ coins.push({
174
+ tx_id: "0x0000000000000000000000000000000000000000000000000000000000000001",
175
+ output_index: 0,
176
+ tx_pointer_block_height: 0,
177
+ tx_pointer_tx_idx: 0,
178
+ owner: "0x94ffcc53b892684acefaebc8a3d4a595e528a8cf664eeb3ef36f1020b0809d0d",
179
+ amount: "18446744073709551615",
180
+ asset_id: "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07"
181
+ });
182
+ coins.push({
183
+ tx_id: "0x0000000000000000000000000000000000000000000000000000000000000002",
184
+ output_index: 0,
185
+ tx_pointer_block_height: 0,
186
+ tx_pointer_tx_idx: 0,
187
+ owner: "0x09c0b2d1a486c439a87bcba6b46a7a1a23f3897cc83a94521a96da5c23bc58db",
188
+ amount: "18446744073709551615",
189
+ asset_id: "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07"
190
+ });
191
+ }
168
192
  if (!process.env.GENESIS_SECRET) {
169
193
  const pk = Signer.generatePrivateKey();
170
194
  const signer = new Signer(pk);
@@ -174,7 +198,7 @@ function getFinalStateConfigJSON({ stateConfig, chainConfig }) {
174
198
  owner: signer.address.toHexString(),
175
199
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
176
200
  amount: "18446744073709551615",
177
- asset_id: chainConfig.consensus_parameters.V1.base_asset_id,
201
+ asset_id: chainConfig.consensus_parameters.V2.base_asset_id,
178
202
  output_index: 0,
179
203
  tx_pointer_block_height: 0,
180
204
  tx_pointer_tx_idx: 0
@@ -195,7 +219,8 @@ var launchNode = async ({
195
219
  fuelCorePath = process.env.FUEL_CORE_PATH || void 0,
196
220
  loggingEnabled = true,
197
221
  basePath,
198
- snapshotConfig = defaultSnapshotConfigs
222
+ snapshotConfig = defaultSnapshotConfigs,
223
+ includeInitialState = false
199
224
  } = {}) => (
200
225
  // eslint-disable-next-line no-async-promise-executor
201
226
  new Promise(async (resolve, reject) => {
@@ -235,7 +260,14 @@ var launchNode = async ({
235
260
  const stateConfigPath = path.join(tempDir, metadata.table_encoding.Json.filepath);
236
261
  const stateTransitionPath = path.join(tempDir, "state_transition_bytecode.wasm");
237
262
  writeFileSync(chainConfigPath, JSON.stringify(snapshotConfig.chainConfig), "utf8");
238
- writeFileSync(stateConfigPath, getFinalStateConfigJSON(snapshotConfig), "utf8");
263
+ writeFileSync(
264
+ stateConfigPath,
265
+ getFinalStateConfigJSON({
266
+ ...snapshotConfig,
267
+ includeInitialState
268
+ }),
269
+ "utf8"
270
+ );
239
271
  writeFileSync(metadataPath, JSON.stringify(metadata), "utf8");
240
272
  writeFileSync(stateTransitionPath, JSON.stringify(""));
241
273
  snapshotDirToUse = tempDir;
@@ -10385,7 +10417,7 @@ async function setupTestProviderAndWallets({
10385
10417
  } = {}) {
10386
10418
  Symbol.dispose ??= Symbol("Symbol.dispose");
10387
10419
  const walletsConfig = new WalletsConfig(
10388
- nodeOptions.snapshotConfig?.chainConfig?.consensus_parameters?.V1?.base_asset_id ?? defaultSnapshotConfigs3.chainConfig.consensus_parameters.V1.base_asset_id,
10420
+ nodeOptions.snapshotConfig?.chainConfig?.consensus_parameters?.V2?.base_asset_id ?? defaultSnapshotConfigs3.chainConfig.consensus_parameters.V2.base_asset_id,
10389
10421
  {
10390
10422
  ...defaultWalletConfigOptions,
10391
10423
  ...walletsConfigOptions