surfman 0.1.4 → 0.1.6

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.js CHANGED
@@ -1666,10 +1666,12 @@ var import_commander50 = require("commander");
1666
1666
  var import_sdk50 = require("@surfman/sdk");
1667
1667
  var import_fs2 = require("fs");
1668
1668
  function createExportSnapshotCommand() {
1669
- const command = new import_commander50.Command("export-snapshot").description("Export a snapshot of all accounts").option("--output <path>", "Output file path", "snapshot.json").option("--include-parsed", "Include parsed account data").option("--include-programs", "Include program accounts").option("--include-accounts <accounts...>", "Specific accounts to include").option("--exclude-accounts <accounts...>", "Specific accounts to exclude").option("--rpc <url>", "RPC URL", "http://localhost:8899").action(async (options) => {
1669
+ const command = new import_commander50.Command("export-snapshot").description("Export a snapshot of all accounts").option("--output <path>", "Output file path", "snapshot.json").option("--include-parsed", "Include parsed account data").option("--include-programs", "Include program accounts").option("--include-accounts <accounts...>", "Specific accounts to include").option("--exclude-accounts <accounts...>", "Specific accounts to exclude").option("--scope <scope>", "Snapshot scope: 'network' or 'preTransaction'", "network").option("--pre-transaction <signature>", "Transaction signature when using preTransaction scope").option("--rpc <url>", "RPC URL", "http://localhost:8899").action(async (options) => {
1670
1670
  try {
1671
1671
  const client = new import_sdk50.Surfman(options.rpc);
1672
- const config = {};
1672
+ const config = {
1673
+ scope: parseScopeOption(options.scope, options.preTransaction)
1674
+ };
1673
1675
  if (options.includeParsed) {
1674
1676
  config.includeParsedAccounts = true;
1675
1677
  }
@@ -1698,6 +1700,15 @@ function createExportSnapshotCommand() {
1698
1700
  });
1699
1701
  return command;
1700
1702
  }
1703
+ function parseScopeOption(scopeOption, preTransactionSignature) {
1704
+ if (scopeOption === "preTransaction") {
1705
+ if (!preTransactionSignature) {
1706
+ throw new Error("When using preTransaction scope you must provide --pre-transaction <signature>");
1707
+ }
1708
+ return { preTransaction: preTransactionSignature };
1709
+ }
1710
+ return "network";
1711
+ }
1701
1712
 
1702
1713
  // src/commands/cheatcodes/stream-account.ts
1703
1714
  var import_commander51 = require("commander");