surfman 0.1.2 → 0.1.4
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/README.md +43 -10
- package/dist/index.js +888 -208
- package/dist/index.js.map +1 -1
- package/package.json +10 -3
- package/static/assets/index-iyPN8r4R.js +1892 -0
- package/static/index.html +13 -0
- package/static/vite.svg +1 -0
package/dist/index.js
CHANGED
|
@@ -24,12 +24,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
));
|
|
25
25
|
|
|
26
26
|
// src/index.ts
|
|
27
|
-
var
|
|
28
|
-
var
|
|
27
|
+
var import_commander57 = require("commander");
|
|
28
|
+
var import_chalk7 = __toESM(require("chalk"));
|
|
29
29
|
|
|
30
30
|
// src/commands/cheatcodes/time-travel.ts
|
|
31
31
|
var import_commander = require("commander");
|
|
32
|
-
var
|
|
32
|
+
var import_sdk = require("@surfman/sdk");
|
|
33
33
|
|
|
34
34
|
// src/utils/logger.ts
|
|
35
35
|
var import_chalk = __toESM(require("chalk"));
|
|
@@ -45,7 +45,7 @@ var logger = {
|
|
|
45
45
|
function createTimeTravelCommand() {
|
|
46
46
|
const command = new import_commander.Command("time-travel").description("Time travel to a specific epoch, slot, or timestamp").option("--rpc <url>", "RPC URL", "http://localhost:8899").option("--epoch <number>", "Absolute epoch number").option("--slot <number>", "Absolute slot number").option("--timestamp <number>", "Absolute timestamp (microseconds)").option("--relative <time>", "Relative time (e.g., +1d, +1w, +12h, +30m)").action(async (options) => {
|
|
47
47
|
try {
|
|
48
|
-
const client = new
|
|
48
|
+
const client = new import_sdk.Surfman(options.rpc);
|
|
49
49
|
let config = {};
|
|
50
50
|
if (options.epoch) {
|
|
51
51
|
config.absoluteEpoch = parseInt(options.epoch);
|
|
@@ -95,11 +95,11 @@ function createTimeTravelCommand() {
|
|
|
95
95
|
|
|
96
96
|
// src/commands/cheatcodes/set-account.ts
|
|
97
97
|
var import_commander2 = require("commander");
|
|
98
|
-
var
|
|
98
|
+
var import_sdk2 = require("@surfman/sdk");
|
|
99
99
|
function createSetAccountCommand() {
|
|
100
100
|
const command = new import_commander2.Command("set-account").description("Modify account data, lamports, owner, etc.").requiredOption("--pubkey <address>", "Account public key").option("--rpc <url>", "RPC URL", "http://localhost:8899").option("--data <hex>", "Account data (hex string)").option("--lamports <amount>", "Account lamports").option("--owner <address>", "Account owner").option("--executable", "Mark account as executable").option("--rent-epoch <epoch>", "Rent epoch").action(async (options) => {
|
|
101
101
|
try {
|
|
102
|
-
const client = new
|
|
102
|
+
const client = new import_sdk2.Surfman(options.rpc);
|
|
103
103
|
const update = {};
|
|
104
104
|
if (options.data) {
|
|
105
105
|
update.data = options.data;
|
|
@@ -136,11 +136,11 @@ function createSetAccountCommand() {
|
|
|
136
136
|
|
|
137
137
|
// src/commands/cheatcodes/set-program-authority.ts
|
|
138
138
|
var import_commander3 = require("commander");
|
|
139
|
-
var
|
|
139
|
+
var import_sdk3 = require("@surfman/sdk");
|
|
140
140
|
function createSetProgramAuthorityCommand() {
|
|
141
141
|
const command = new import_commander3.Command("set-program-authority").description("Set or remove program upgrade authority").requiredOption("--program-id <address>", "Program ID").option("--rpc <url>", "RPC URL", "http://localhost:8899").option("--new-authority <address>", "New authority address").option("--remove-authority", "Remove authority (make program immutable)").action(async (options) => {
|
|
142
142
|
try {
|
|
143
|
-
const client = new
|
|
143
|
+
const client = new import_sdk3.Surfman(options.rpc);
|
|
144
144
|
let newAuthority;
|
|
145
145
|
if (options.removeAuthority) {
|
|
146
146
|
newAuthority = null;
|
|
@@ -171,11 +171,11 @@ function createSetProgramAuthorityCommand() {
|
|
|
171
171
|
|
|
172
172
|
// src/commands/cheatcodes/pause-clock.ts
|
|
173
173
|
var import_commander4 = require("commander");
|
|
174
|
-
var
|
|
174
|
+
var import_sdk4 = require("@surfman/sdk");
|
|
175
175
|
function createPauseClockCommand() {
|
|
176
176
|
const command = new import_commander4.Command("pause-clock").description("Pause the Surfnet clock (freeze time progression)").option("--rpc <url>", "RPC URL", "http://localhost:8899").action(async (options) => {
|
|
177
177
|
try {
|
|
178
|
-
const client = new
|
|
178
|
+
const client = new import_sdk4.Surfman(options.rpc);
|
|
179
179
|
const result = await client.cheatcodes.pauseClock();
|
|
180
180
|
logger.success("Clock paused successfully!");
|
|
181
181
|
logger.log(` Absolute Slot: ${result.absoluteSlot}`);
|
|
@@ -195,11 +195,11 @@ function createPauseClockCommand() {
|
|
|
195
195
|
|
|
196
196
|
// src/commands/cheatcodes/resume-clock.ts
|
|
197
197
|
var import_commander5 = require("commander");
|
|
198
|
-
var
|
|
198
|
+
var import_sdk5 = require("@surfman/sdk");
|
|
199
199
|
function createResumeClockCommand() {
|
|
200
200
|
const command = new import_commander5.Command("resume-clock").description("Resume the Surfnet clock (restart time progression)").option("--rpc <url>", "RPC URL", "http://localhost:8899").action(async (options) => {
|
|
201
201
|
try {
|
|
202
|
-
const client = new
|
|
202
|
+
const client = new import_sdk5.Surfman(options.rpc);
|
|
203
203
|
const result = await client.cheatcodes.resumeClock();
|
|
204
204
|
logger.success("Clock resumed successfully!");
|
|
205
205
|
logger.log(` Absolute Slot: ${result.absoluteSlot}`);
|
|
@@ -219,11 +219,11 @@ function createResumeClockCommand() {
|
|
|
219
219
|
|
|
220
220
|
// src/commands/cheatcodes/get-local-signatures.ts
|
|
221
221
|
var import_commander6 = require("commander");
|
|
222
|
-
var
|
|
222
|
+
var import_sdk6 = require("@surfman/sdk");
|
|
223
223
|
function createGetLocalSignaturesCommand() {
|
|
224
224
|
const command = new import_commander6.Command("get-local-signatures").description("Get recent local transaction signatures").option("--rpc <url>", "RPC URL", "http://localhost:8899").option("--limit <number>", "Maximum number of signatures to return", "50").action(async (options) => {
|
|
225
225
|
try {
|
|
226
|
-
const client = new
|
|
226
|
+
const client = new import_sdk6.Surfman(options.rpc);
|
|
227
227
|
const limit = parseInt(options.limit);
|
|
228
228
|
const signatures = await client.cheatcodes.getLocalSignatures(limit);
|
|
229
229
|
logger.success(`Retrieved ${signatures.length} signature(s):`);
|
|
@@ -248,14 +248,14 @@ ${index + 1}. Signature: ${sig.signature}`);
|
|
|
248
248
|
|
|
249
249
|
// src/commands/cheatcodes/set-token-account.ts
|
|
250
250
|
var import_commander7 = require("commander");
|
|
251
|
-
var
|
|
251
|
+
var import_sdk7 = require("@surfman/sdk");
|
|
252
252
|
function createSetTokenAccountCommand() {
|
|
253
253
|
const command = new import_commander7.Command("set-token-account").description("Set or update token account properties").requiredOption("--owner <address>", "Token account owner address").requiredOption("--mint <address>", "Token mint address").option("--rpc <url>", "RPC URL", "http://localhost:8899").option("--amount <number>", "Token amount").option("--delegate <address>", 'Delegate address (use "none" to clear)').option("--state <state>", "Account state (initialized, frozen, etc.)").option("--delegated-amount <number>", "Delegated amount").option(
|
|
254
254
|
"--close-authority <address>",
|
|
255
255
|
'Close authority address (use "none" to clear)'
|
|
256
256
|
).option("--token-program <address>", "Token program address").action(async (options) => {
|
|
257
257
|
try {
|
|
258
|
-
const client = new
|
|
258
|
+
const client = new import_sdk7.Surfman(options.rpc);
|
|
259
259
|
const update = {};
|
|
260
260
|
if (options.amount) {
|
|
261
261
|
update.amount = parseInt(options.amount);
|
|
@@ -309,7 +309,7 @@ function createSetTokenAccountCommand() {
|
|
|
309
309
|
|
|
310
310
|
// src/commands/cheatcodes/reset-account.ts
|
|
311
311
|
var import_commander8 = require("commander");
|
|
312
|
-
var
|
|
312
|
+
var import_sdk8 = require("@surfman/sdk");
|
|
313
313
|
function createResetAccountCommand() {
|
|
314
314
|
const command = new import_commander8.Command("reset-account").description("Reset an account to its initial state").requiredOption("--pubkey <address>", "Account public key").option("--rpc <url>", "RPC URL", "http://localhost:8899").option(
|
|
315
315
|
"--include-owned",
|
|
@@ -317,7 +317,7 @@ function createResetAccountCommand() {
|
|
|
317
317
|
false
|
|
318
318
|
).action(async (options) => {
|
|
319
319
|
try {
|
|
320
|
-
const client = new
|
|
320
|
+
const client = new import_sdk8.Surfman(options.rpc);
|
|
321
321
|
const config = options.includeOwned ? { includeOwnedAccounts: true } : void 0;
|
|
322
322
|
await client.cheatcodes.resetAccount(options.pubkey, config);
|
|
323
323
|
logger.success(`Account ${options.pubkey} reset successfully!`);
|
|
@@ -334,7 +334,7 @@ function createResetAccountCommand() {
|
|
|
334
334
|
|
|
335
335
|
// src/commands/cheatcodes/reset-network.ts
|
|
336
336
|
var import_commander9 = require("commander");
|
|
337
|
-
var
|
|
337
|
+
var import_sdk9 = require("@surfman/sdk");
|
|
338
338
|
function createResetNetworkCommand() {
|
|
339
339
|
const command = new import_commander9.Command("reset-network").description("Reset the entire Surfnet network to initial state").option("--rpc <url>", "RPC URL", "http://localhost:8899").option("--confirm", "Confirm network reset (required)", false).action(async (options) => {
|
|
340
340
|
try {
|
|
@@ -347,7 +347,7 @@ function createResetNetworkCommand() {
|
|
|
347
347
|
);
|
|
348
348
|
process.exit(1);
|
|
349
349
|
}
|
|
350
|
-
const client = new
|
|
350
|
+
const client = new import_sdk9.Surfman(options.rpc);
|
|
351
351
|
logger.warn("Resetting network...");
|
|
352
352
|
await client.cheatcodes.resetNetwork();
|
|
353
353
|
logger.success("Network reset successfully!");
|
|
@@ -362,11 +362,11 @@ function createResetNetworkCommand() {
|
|
|
362
362
|
|
|
363
363
|
// src/commands/network/get-latest-blockhash.ts
|
|
364
364
|
var import_commander10 = require("commander");
|
|
365
|
-
var
|
|
365
|
+
var import_sdk10 = require("@surfman/sdk");
|
|
366
366
|
function createGetLatestBlockhashCommand() {
|
|
367
367
|
const command = new import_commander10.Command("get-latest-blockhash").description("Get the latest blockhash").option("--rpc <url>", "RPC URL", "http://localhost:8899").option("--commitment <level>", "Commitment level").action(async (options) => {
|
|
368
368
|
try {
|
|
369
|
-
const client = new
|
|
369
|
+
const client = new import_sdk10.Surfman(options.rpc);
|
|
370
370
|
const config = options.commitment ? { commitment: options.commitment } : void 0;
|
|
371
371
|
const result = await client.network.getLatestBlockhash(config);
|
|
372
372
|
logger.success("Latest blockhash retrieved:");
|
|
@@ -384,11 +384,11 @@ function createGetLatestBlockhashCommand() {
|
|
|
384
384
|
|
|
385
385
|
// src/commands/network/get-block.ts
|
|
386
386
|
var import_commander11 = require("commander");
|
|
387
|
-
var
|
|
387
|
+
var import_sdk11 = require("@surfman/sdk");
|
|
388
388
|
function createGetBlockCommand() {
|
|
389
389
|
const command = new import_commander11.Command("get-block").description("Get block information by slot").requiredOption("--slot <number>", "Slot number").option("--rpc <url>", "RPC URL", "http://localhost:8899").option("--encoding <type>", "Encoding type", "json").option("--rewards", "Include rewards", false).action(async (options) => {
|
|
390
390
|
try {
|
|
391
|
-
const client = new
|
|
391
|
+
const client = new import_sdk11.Surfman(options.rpc);
|
|
392
392
|
const slot = parseInt(options.slot);
|
|
393
393
|
const config = {
|
|
394
394
|
encoding: options.encoding,
|
|
@@ -424,11 +424,11 @@ function createGetBlockCommand() {
|
|
|
424
424
|
|
|
425
425
|
// src/commands/network/get-transaction.ts
|
|
426
426
|
var import_commander12 = require("commander");
|
|
427
|
-
var
|
|
427
|
+
var import_sdk12 = require("@surfman/sdk");
|
|
428
428
|
function createGetTransactionCommand() {
|
|
429
429
|
const command = new import_commander12.Command("get-transaction").description("Get transaction details by signature").requiredOption("--signature <sig>", "Transaction signature").option("--rpc <url>", "RPC URL", "http://localhost:8899").option("--encoding <type>", "Encoding type", "json").action(async (options) => {
|
|
430
430
|
try {
|
|
431
|
-
const client = new
|
|
431
|
+
const client = new import_sdk12.Surfman(options.rpc);
|
|
432
432
|
const config = {
|
|
433
433
|
encoding: options.encoding
|
|
434
434
|
};
|
|
@@ -465,11 +465,11 @@ function createGetTransactionCommand() {
|
|
|
465
465
|
|
|
466
466
|
// src/commands/network/send-transaction.ts
|
|
467
467
|
var import_commander13 = require("commander");
|
|
468
|
-
var
|
|
468
|
+
var import_sdk13 = require("@surfman/sdk");
|
|
469
469
|
function createSendTransactionCommand() {
|
|
470
470
|
const command = new import_commander13.Command("send-transaction").description("Send a signed transaction").requiredOption("--transaction <data>", "Base64 encoded transaction").option("--rpc <url>", "RPC URL", "http://localhost:8899").option("--skip-preflight", "Skip preflight checks", false).option("--encoding <type>", "Encoding type", "base64").action(async (options) => {
|
|
471
471
|
try {
|
|
472
|
-
const client = new
|
|
472
|
+
const client = new import_sdk13.Surfman(options.rpc);
|
|
473
473
|
const config = {
|
|
474
474
|
skipPreflight: options.skipPreflight,
|
|
475
475
|
encoding: options.encoding
|
|
@@ -492,11 +492,11 @@ function createSendTransactionCommand() {
|
|
|
492
492
|
|
|
493
493
|
// src/commands/network/get-cluster-nodes.ts
|
|
494
494
|
var import_commander14 = require("commander");
|
|
495
|
-
var
|
|
495
|
+
var import_sdk14 = require("@surfman/sdk");
|
|
496
496
|
function createGetClusterNodesCommand() {
|
|
497
497
|
const command = new import_commander14.Command("get-cluster-nodes").description("Get information about cluster nodes").option("--rpc <url>", "RPC URL", "http://localhost:8899").action(async (options) => {
|
|
498
498
|
try {
|
|
499
|
-
const client = new
|
|
499
|
+
const client = new import_sdk14.Surfman(options.rpc);
|
|
500
500
|
const nodes = await client.network.getClusterNodes();
|
|
501
501
|
logger.success(`Found ${nodes.length} cluster node(s):`);
|
|
502
502
|
nodes.forEach((node, index) => {
|
|
@@ -519,11 +519,11 @@ ${index + 1}. ${node.pubkey}`);
|
|
|
519
519
|
|
|
520
520
|
// src/commands/network/request-airdrop.ts
|
|
521
521
|
var import_commander15 = require("commander");
|
|
522
|
-
var
|
|
522
|
+
var import_sdk15 = require("@surfman/sdk");
|
|
523
523
|
function createRequestAirdropCommand() {
|
|
524
524
|
const command = new import_commander15.Command("request-airdrop").description("Request an airdrop of lamports").requiredOption("--pubkey <address>", "Public key to airdrop to").requiredOption("--lamports <amount>", "Amount in lamports").option("--rpc <url>", "RPC URL", "http://localhost:8899").option("--commitment <level>", "Commitment level").action(async (options) => {
|
|
525
525
|
try {
|
|
526
|
-
const client = new
|
|
526
|
+
const client = new import_sdk15.Surfman(options.rpc);
|
|
527
527
|
const lamports = parseInt(options.lamports);
|
|
528
528
|
const config = options.commitment ? { commitment: options.commitment } : void 0;
|
|
529
529
|
const signature = await client.network.requestAirdrop(
|
|
@@ -547,11 +547,11 @@ function createRequestAirdropCommand() {
|
|
|
547
547
|
|
|
548
548
|
// src/commands/network/get-blocks.ts
|
|
549
549
|
var import_commander16 = require("commander");
|
|
550
|
-
var
|
|
550
|
+
var import_sdk16 = require("@surfman/sdk");
|
|
551
551
|
function createGetBlocksCommand() {
|
|
552
552
|
const command = new import_commander16.Command("get-blocks").description("Get list of confirmed blocks between two slots").requiredOption("--start-slot <number>", "Start slot (inclusive)").option("--end-slot <number>", "End slot (exclusive)").option("--rpc <url>", "RPC URL", "http://localhost:8899").option("--commitment <level>", "Commitment level").action(async (options) => {
|
|
553
553
|
try {
|
|
554
|
-
const client = new
|
|
554
|
+
const client = new import_sdk16.Surfman(options.rpc);
|
|
555
555
|
const startSlot = parseInt(options.startSlot);
|
|
556
556
|
const endSlot = options.endSlot ? parseInt(options.endSlot) : void 0;
|
|
557
557
|
const config = options.commitment ? { commitment: options.commitment } : void 0;
|
|
@@ -576,11 +576,11 @@ function createGetBlocksCommand() {
|
|
|
576
576
|
|
|
577
577
|
// src/commands/network/get-signatures-for-address.ts
|
|
578
578
|
var import_commander17 = require("commander");
|
|
579
|
-
var
|
|
579
|
+
var import_sdk17 = require("@surfman/sdk");
|
|
580
580
|
function createGetSignaturesForAddressCommand() {
|
|
581
581
|
const command = new import_commander17.Command("get-signatures-for-address").description("Get confirmed signatures for transactions involving an address").requiredOption("--address <pubkey>", "Account address").option("--rpc <url>", "RPC URL", "http://localhost:8899").option("--limit <number>", "Maximum number of signatures", "10").option("--before <signature>", "Start searching backwards from this signature").option("--until <signature>", "Search until this signature").action(async (options) => {
|
|
582
582
|
try {
|
|
583
|
-
const client = new
|
|
583
|
+
const client = new import_sdk17.Surfman(options.rpc);
|
|
584
584
|
const config = {
|
|
585
585
|
limit: parseInt(options.limit)
|
|
586
586
|
};
|
|
@@ -617,11 +617,11 @@ ${index + 1}. ${sig.signature}`);
|
|
|
617
617
|
|
|
618
618
|
// src/commands/network/is-blockhash-valid.ts
|
|
619
619
|
var import_commander18 = require("commander");
|
|
620
|
-
var
|
|
620
|
+
var import_sdk18 = require("@surfman/sdk");
|
|
621
621
|
function createIsBlockhashValidCommand() {
|
|
622
622
|
const command = new import_commander18.Command("is-blockhash-valid").description("Check if a blockhash is still valid").requiredOption("--blockhash <hash>", "Blockhash to check").option("--rpc <url>", "RPC URL", "http://localhost:8899").option("--commitment <level>", "Commitment level").action(async (options) => {
|
|
623
623
|
try {
|
|
624
|
-
const client = new
|
|
624
|
+
const client = new import_sdk18.Surfman(options.rpc);
|
|
625
625
|
const config = options.commitment ? { commitment: options.commitment } : void 0;
|
|
626
626
|
const isValid = await client.network.isBlockhashValid(
|
|
627
627
|
options.blockhash,
|
|
@@ -644,11 +644,11 @@ function createIsBlockhashValidCommand() {
|
|
|
644
644
|
|
|
645
645
|
// src/commands/network/get-fee-for-message.ts
|
|
646
646
|
var import_commander19 = require("commander");
|
|
647
|
-
var
|
|
647
|
+
var import_sdk19 = require("@surfman/sdk");
|
|
648
648
|
function createGetFeeForMessageCommand() {
|
|
649
649
|
const command = new import_commander19.Command("get-fee-for-message").description("Get the fee required for a message").requiredOption("--message <data>", "Base64 encoded message").option("--rpc <url>", "RPC URL", "http://localhost:8899").option("--commitment <level>", "Commitment level").action(async (options) => {
|
|
650
650
|
try {
|
|
651
|
-
const client = new
|
|
651
|
+
const client = new import_sdk19.Surfman(options.rpc);
|
|
652
652
|
const config = options.commitment ? { commitment: options.commitment } : void 0;
|
|
653
653
|
const fee = await client.network.getFeeForMessage(
|
|
654
654
|
options.message,
|
|
@@ -670,11 +670,11 @@ function createGetFeeForMessageCommand() {
|
|
|
670
670
|
|
|
671
671
|
// src/commands/network/get-recent-prioritization-fees.ts
|
|
672
672
|
var import_commander20 = require("commander");
|
|
673
|
-
var
|
|
673
|
+
var import_sdk20 = require("@surfman/sdk");
|
|
674
674
|
function createGetRecentPrioritizationFeesCommand() {
|
|
675
675
|
const command = new import_commander20.Command("get-recent-prioritization-fees").description("Get recent prioritization fees").option("--rpc <url>", "RPC URL", "http://localhost:8899").option("--addresses <addresses...>", "Account addresses to filter by").action(async (options) => {
|
|
676
676
|
try {
|
|
677
|
-
const client = new
|
|
677
|
+
const client = new import_sdk20.Surfman(options.rpc);
|
|
678
678
|
const fees = await client.network.getRecentPrioritizationFees(
|
|
679
679
|
options.addresses
|
|
680
680
|
);
|
|
@@ -708,11 +708,11 @@ Recent samples (newest first):`);
|
|
|
708
708
|
|
|
709
709
|
// src/commands/network/get-block-time.ts
|
|
710
710
|
var import_commander21 = require("commander");
|
|
711
|
-
var
|
|
711
|
+
var import_sdk21 = require("@surfman/sdk");
|
|
712
712
|
function createGetBlockTimeCommand() {
|
|
713
713
|
const command = new import_commander21.Command("get-block-time").description("Get estimated production time of a block").requiredOption("--slot <number>", "Slot number").option("--rpc <url>", "RPC URL", "http://localhost:8899").action(async (options) => {
|
|
714
714
|
try {
|
|
715
|
-
const client = new
|
|
715
|
+
const client = new import_sdk21.Surfman(options.rpc);
|
|
716
716
|
const slot = parseInt(options.slot);
|
|
717
717
|
const blockTime = await client.network.getBlockTime(slot);
|
|
718
718
|
if (blockTime !== null) {
|
|
@@ -734,11 +734,11 @@ function createGetBlockTimeCommand() {
|
|
|
734
734
|
|
|
735
735
|
// src/commands/network/get-blocks-with-limit.ts
|
|
736
736
|
var import_commander22 = require("commander");
|
|
737
|
-
var
|
|
737
|
+
var import_sdk22 = require("@surfman/sdk");
|
|
738
738
|
function createGetBlocksWithLimitCommand() {
|
|
739
739
|
const command = new import_commander22.Command("get-blocks-with-limit").description("Get confirmed blocks starting at a slot with a limit").requiredOption("--start-slot <number>", "Start slot (inclusive)").requiredOption("--limit <number>", "Maximum number of blocks").option("--rpc <url>", "RPC URL", "http://localhost:8899").option("--commitment <level>", "Commitment level").action(async (options) => {
|
|
740
740
|
try {
|
|
741
|
-
const client = new
|
|
741
|
+
const client = new import_sdk22.Surfman(options.rpc);
|
|
742
742
|
const startSlot = parseInt(options.startSlot);
|
|
743
743
|
const limit = parseInt(options.limit);
|
|
744
744
|
const config = options.commitment ? { commitment: options.commitment } : void 0;
|
|
@@ -767,11 +767,11 @@ function createGetBlocksWithLimitCommand() {
|
|
|
767
767
|
|
|
768
768
|
// src/commands/network/get-first-available-block.ts
|
|
769
769
|
var import_commander23 = require("commander");
|
|
770
|
-
var
|
|
770
|
+
var import_sdk23 = require("@surfman/sdk");
|
|
771
771
|
function createGetFirstAvailableBlockCommand() {
|
|
772
772
|
const command = new import_commander23.Command("get-first-available-block").description("Get the slot of the lowest confirmed block").option("--rpc <url>", "RPC URL", "http://localhost:8899").action(async (options) => {
|
|
773
773
|
try {
|
|
774
|
-
const client = new
|
|
774
|
+
const client = new import_sdk23.Surfman(options.rpc);
|
|
775
775
|
const slot = await client.network.getFirstAvailableBlock();
|
|
776
776
|
logger.success(`First available block:`);
|
|
777
777
|
logger.log(` Slot: ${slot}`);
|
|
@@ -787,11 +787,11 @@ function createGetFirstAvailableBlockCommand() {
|
|
|
787
787
|
|
|
788
788
|
// src/commands/network/minimum-ledger-slot.ts
|
|
789
789
|
var import_commander24 = require("commander");
|
|
790
|
-
var
|
|
790
|
+
var import_sdk24 = require("@surfman/sdk");
|
|
791
791
|
function createMinimumLedgerSlotCommand() {
|
|
792
792
|
const command = new import_commander24.Command("minimum-ledger-slot").description("Get the minimum slot that the node has information about").option("--rpc <url>", "RPC URL", "http://localhost:8899").action(async (options) => {
|
|
793
793
|
try {
|
|
794
|
-
const client = new
|
|
794
|
+
const client = new import_sdk24.Surfman(options.rpc);
|
|
795
795
|
const slot = await client.network.minimumLedgerSlot();
|
|
796
796
|
logger.success(`Minimum ledger slot:`);
|
|
797
797
|
logger.log(` Slot: ${slot}`);
|
|
@@ -807,11 +807,11 @@ function createMinimumLedgerSlotCommand() {
|
|
|
807
807
|
|
|
808
808
|
// src/commands/network/get-signature-statuses.ts
|
|
809
809
|
var import_commander25 = require("commander");
|
|
810
|
-
var
|
|
810
|
+
var import_sdk25 = require("@surfman/sdk");
|
|
811
811
|
function createGetSignatureStatusesCommand() {
|
|
812
812
|
const command = new import_commander25.Command("get-signature-statuses").description("Get the statuses of a list of signatures").requiredOption("--signatures <sigs...>", "Transaction signatures").option("--rpc <url>", "RPC URL", "http://localhost:8899").option("--search-history", "Search transaction history", false).action(async (options) => {
|
|
813
813
|
try {
|
|
814
|
-
const client = new
|
|
814
|
+
const client = new import_sdk25.Surfman(options.rpc);
|
|
815
815
|
const config = options.searchHistory ? { searchTransactionHistory: true } : void 0;
|
|
816
816
|
const statuses = await client.network.getSignatureStatuses(
|
|
817
817
|
options.signatures,
|
|
@@ -848,11 +848,11 @@ ${index + 1}. ${sig}`);
|
|
|
848
848
|
|
|
849
849
|
// src/commands/network/simulate-transaction.ts
|
|
850
850
|
var import_commander26 = require("commander");
|
|
851
|
-
var
|
|
851
|
+
var import_sdk26 = require("@surfman/sdk");
|
|
852
852
|
function createSimulateTransactionCommand() {
|
|
853
853
|
const command = new import_commander26.Command("simulate-transaction").description("Simulate a transaction without committing it").requiredOption("--transaction <data>", "Base64 encoded transaction").option("--rpc <url>", "RPC URL", "http://localhost:8899").option("--sig-verify", "Enable signature verification", true).option("--commitment <level>", "Commitment level").option("--encoding <type>", "Encoding type", "base64").action(async (options) => {
|
|
854
854
|
try {
|
|
855
|
-
const client = new
|
|
855
|
+
const client = new import_sdk26.Surfman(options.rpc);
|
|
856
856
|
const config = {
|
|
857
857
|
sigVerify: options.sigVerify,
|
|
858
858
|
encoding: options.encoding
|
|
@@ -898,11 +898,11 @@ Return data: ${JSON.stringify(result.returnData)}`);
|
|
|
898
898
|
|
|
899
899
|
// src/commands/network/get-recent-performance-samples.ts
|
|
900
900
|
var import_commander27 = require("commander");
|
|
901
|
-
var
|
|
901
|
+
var import_sdk27 = require("@surfman/sdk");
|
|
902
902
|
function createGetRecentPerformanceSamplesCommand() {
|
|
903
903
|
const command = new import_commander27.Command("get-recent-performance-samples").description("Get recent performance samples").option("--rpc <url>", "RPC URL", "http://localhost:8899").option("--limit <number>", "Maximum number of samples", "10").action(async (options) => {
|
|
904
904
|
try {
|
|
905
|
-
const client = new
|
|
905
|
+
const client = new import_sdk27.Surfman(options.rpc);
|
|
906
906
|
const limit = parseInt(options.limit);
|
|
907
907
|
const samples = await client.network.getRecentPerformanceSamples(limit);
|
|
908
908
|
logger.success(`Retrieved ${samples.length} performance sample(s):`);
|
|
@@ -930,13 +930,115 @@ ${index + 1}. Slot ${sample.slot}`);
|
|
|
930
930
|
return command;
|
|
931
931
|
}
|
|
932
932
|
|
|
933
|
-
// src/commands/
|
|
933
|
+
// src/commands/network/get-inflation-reward.ts
|
|
934
934
|
var import_commander28 = require("commander");
|
|
935
|
-
var
|
|
935
|
+
var import_sdk28 = require("@surfman/sdk");
|
|
936
|
+
var import_chalk2 = __toESM(require("chalk"));
|
|
937
|
+
function createGetInflationRewardCommand() {
|
|
938
|
+
const command = new import_commander28.Command("get-inflation-reward").description("Get inflation rewards for a list of addresses").requiredOption("--addresses <addresses>", "Comma-separated list of addresses").option("--epoch <epoch>", "Epoch to query (default: current epoch)", parseInt).option("--commitment <level>", "Commitment level (processed, confirmed, finalized)").option("--rpc <url>", "RPC endpoint URL", "http://localhost:8899").action(async (options) => {
|
|
939
|
+
try {
|
|
940
|
+
const client = new import_sdk28.Surfman(options.rpc);
|
|
941
|
+
const addresses = options.addresses.split(",").map((addr) => addr.trim());
|
|
942
|
+
const config = {};
|
|
943
|
+
if (options.epoch !== void 0) config.epoch = options.epoch;
|
|
944
|
+
if (options.commitment) config.commitment = options.commitment;
|
|
945
|
+
const rewards = await client.network.getInflationReward(
|
|
946
|
+
addresses,
|
|
947
|
+
Object.keys(config).length > 0 ? config : void 0
|
|
948
|
+
);
|
|
949
|
+
console.log(import_chalk2.default.cyan("\n\u{1F4CA} Inflation Rewards:\n"));
|
|
950
|
+
rewards.forEach((reward, index) => {
|
|
951
|
+
console.log(import_chalk2.default.bold(`Address ${index + 1}: ${addresses[index]}`));
|
|
952
|
+
if (reward) {
|
|
953
|
+
console.log(` Epoch: ${import_chalk2.default.yellow(reward.epoch)}`);
|
|
954
|
+
console.log(` Effective Slot: ${import_chalk2.default.yellow(reward.effectiveSlot)}`);
|
|
955
|
+
console.log(` Amount: ${import_chalk2.default.green(reward.amount)} lamports`);
|
|
956
|
+
console.log(` Post Balance: ${import_chalk2.default.green(reward.postBalance)} lamports`);
|
|
957
|
+
if (reward.commission !== null && reward.commission !== void 0) {
|
|
958
|
+
console.log(` Commission: ${import_chalk2.default.yellow(reward.commission)}%`);
|
|
959
|
+
}
|
|
960
|
+
} else {
|
|
961
|
+
console.log(import_chalk2.default.gray(" No reward received"));
|
|
962
|
+
}
|
|
963
|
+
console.log();
|
|
964
|
+
});
|
|
965
|
+
} catch (error) {
|
|
966
|
+
console.error(import_chalk2.default.red("Error:"), error.message);
|
|
967
|
+
process.exit(1);
|
|
968
|
+
}
|
|
969
|
+
});
|
|
970
|
+
return command;
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
// src/commands/network/get-max-retransmit-slot.ts
|
|
974
|
+
var import_commander29 = require("commander");
|
|
975
|
+
var import_sdk29 = require("@surfman/sdk");
|
|
976
|
+
var import_chalk3 = __toESM(require("chalk"));
|
|
977
|
+
function createGetMaxRetransmitSlotCommand() {
|
|
978
|
+
const command = new import_commander29.Command("get-max-retransmit-slot").description("Get maximum retransmit slot").option("--rpc <url>", "RPC endpoint URL", "http://localhost:8899").action(async (options) => {
|
|
979
|
+
try {
|
|
980
|
+
const client = new import_sdk29.Surfman(options.rpc);
|
|
981
|
+
const slot = await client.network.getMaxRetransmitSlot();
|
|
982
|
+
console.log(import_chalk3.default.cyan("\n\u{1F4E1} Max Retransmit Slot:\n"));
|
|
983
|
+
console.log(import_chalk3.default.bold("Slot:"), import_chalk3.default.yellow(slot));
|
|
984
|
+
} catch (error) {
|
|
985
|
+
console.error(import_chalk3.default.red("Error:"), error.message);
|
|
986
|
+
process.exit(1);
|
|
987
|
+
}
|
|
988
|
+
});
|
|
989
|
+
return command;
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
// src/commands/network/get-max-shred-insert-slot.ts
|
|
993
|
+
var import_commander30 = require("commander");
|
|
994
|
+
var import_sdk30 = require("@surfman/sdk");
|
|
995
|
+
var import_chalk4 = __toESM(require("chalk"));
|
|
996
|
+
function createGetMaxShredInsertSlotCommand() {
|
|
997
|
+
const command = new import_commander30.Command("get-max-shred-insert-slot").description("Get maximum shred insert slot").option("--rpc <url>", "RPC endpoint URL", "http://localhost:8899").action(async (options) => {
|
|
998
|
+
try {
|
|
999
|
+
const client = new import_sdk30.Surfman(options.rpc);
|
|
1000
|
+
const slot = await client.network.getMaxShredInsertSlot();
|
|
1001
|
+
console.log(import_chalk4.default.cyan("\n\u{1F4E5} Max Shred Insert Slot:\n"));
|
|
1002
|
+
console.log(import_chalk4.default.bold("Slot:"), import_chalk4.default.yellow(slot));
|
|
1003
|
+
} catch (error) {
|
|
1004
|
+
console.error(import_chalk4.default.red("Error:"), error.message);
|
|
1005
|
+
process.exit(1);
|
|
1006
|
+
}
|
|
1007
|
+
});
|
|
1008
|
+
return command;
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
// src/commands/network/get-stake-minimum-delegation.ts
|
|
1012
|
+
var import_commander31 = require("commander");
|
|
1013
|
+
var import_sdk31 = require("@surfman/sdk");
|
|
1014
|
+
var import_chalk5 = __toESM(require("chalk"));
|
|
1015
|
+
function createGetStakeMinimumDelegationCommand() {
|
|
1016
|
+
const command = new import_commander31.Command("get-stake-minimum-delegation").description("Get minimum stake delegation amount").option("--commitment <level>", "Commitment level (processed, confirmed, finalized)").option("--rpc <url>", "RPC endpoint URL", "http://localhost:8899").action(async (options) => {
|
|
1017
|
+
try {
|
|
1018
|
+
const client = new import_sdk31.Surfman(options.rpc);
|
|
1019
|
+
const config = {};
|
|
1020
|
+
if (options.commitment) config.commitment = options.commitment;
|
|
1021
|
+
const lamports = await client.network.getStakeMinimumDelegation(
|
|
1022
|
+
Object.keys(config).length > 0 ? config : void 0
|
|
1023
|
+
);
|
|
1024
|
+
console.log(import_chalk5.default.cyan("\n\u{1F4B0} Stake Minimum Delegation:\n"));
|
|
1025
|
+
console.log(import_chalk5.default.bold("Lamports:"), import_chalk5.default.yellow(lamports));
|
|
1026
|
+
console.log(import_chalk5.default.bold("SOL:"), import_chalk5.default.yellow((lamports / 1e9).toFixed(9)));
|
|
1027
|
+
} catch (error) {
|
|
1028
|
+
console.error(import_chalk5.default.red("Error:"), error.message);
|
|
1029
|
+
process.exit(1);
|
|
1030
|
+
}
|
|
1031
|
+
});
|
|
1032
|
+
return command;
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
// src/commands/accounts/get-account-info.ts
|
|
1036
|
+
var import_commander32 = require("commander");
|
|
1037
|
+
var import_sdk32 = require("@surfman/sdk");
|
|
936
1038
|
function createGetAccountInfoCommand() {
|
|
937
|
-
const command = new
|
|
1039
|
+
const command = new import_commander32.Command("get-account-info").description("Get detailed information about an account").requiredOption("--pubkey <address>", "Account public key").option("--rpc <url>", "RPC URL", "http://localhost:8899").option("--encoding <type>", "Data encoding", "base64").option("--commitment <level>", "Commitment level").action(async (options) => {
|
|
938
1040
|
try {
|
|
939
|
-
const client = new
|
|
1041
|
+
const client = new import_sdk32.Surfman(options.rpc);
|
|
940
1042
|
const config = {
|
|
941
1043
|
encoding: options.encoding
|
|
942
1044
|
};
|
|
@@ -973,12 +1075,12 @@ function createGetAccountInfoCommand() {
|
|
|
973
1075
|
}
|
|
974
1076
|
|
|
975
1077
|
// src/commands/accounts/get-multiple-accounts.ts
|
|
976
|
-
var
|
|
977
|
-
var
|
|
1078
|
+
var import_commander33 = require("commander");
|
|
1079
|
+
var import_sdk33 = require("@surfman/sdk");
|
|
978
1080
|
function createGetMultipleAccountsCommand() {
|
|
979
|
-
const command = new
|
|
1081
|
+
const command = new import_commander33.Command("get-multiple-accounts").description("Get information for multiple accounts").requiredOption("--pubkeys <addresses...>", "Account public keys").option("--rpc <url>", "RPC URL", "http://localhost:8899").option("--encoding <type>", "Data encoding", "base64").option("--commitment <level>", "Commitment level").action(async (options) => {
|
|
980
1082
|
try {
|
|
981
|
-
const client = new
|
|
1083
|
+
const client = new import_sdk33.Surfman(options.rpc);
|
|
982
1084
|
const config = {
|
|
983
1085
|
encoding: options.encoding
|
|
984
1086
|
};
|
|
@@ -1013,12 +1115,12 @@ ${index + 1}. ${pubkey}`);
|
|
|
1013
1115
|
}
|
|
1014
1116
|
|
|
1015
1117
|
// src/commands/accounts/get-block-commitment.ts
|
|
1016
|
-
var
|
|
1017
|
-
var
|
|
1118
|
+
var import_commander34 = require("commander");
|
|
1119
|
+
var import_sdk34 = require("@surfman/sdk");
|
|
1018
1120
|
function createGetBlockCommitmentCommand() {
|
|
1019
|
-
const command = new
|
|
1121
|
+
const command = new import_commander34.Command("get-block-commitment").description("Get commitment information for a block").requiredOption("--slot <number>", "Block slot number").option("--rpc <url>", "RPC URL", "http://localhost:8899").action(async (options) => {
|
|
1020
1122
|
try {
|
|
1021
|
-
const client = new
|
|
1123
|
+
const client = new import_sdk34.Surfman(options.rpc);
|
|
1022
1124
|
const slot = parseInt(options.slot);
|
|
1023
1125
|
const commitment = await client.accounts.getBlockCommitment(slot);
|
|
1024
1126
|
logger.success(`Block commitment for slot ${slot}:`);
|
|
@@ -1047,12 +1149,12 @@ function createGetBlockCommitmentCommand() {
|
|
|
1047
1149
|
}
|
|
1048
1150
|
|
|
1049
1151
|
// src/commands/accounts/get-token-account-balance.ts
|
|
1050
|
-
var
|
|
1051
|
-
var
|
|
1152
|
+
var import_commander35 = require("commander");
|
|
1153
|
+
var import_sdk35 = require("@surfman/sdk");
|
|
1052
1154
|
function createGetTokenAccountBalanceCommand() {
|
|
1053
|
-
const command = new
|
|
1155
|
+
const command = new import_commander35.Command("get-token-account-balance").description("Get token balance of a token account").requiredOption("--pubkey <address>", "Token account public key").option("--rpc <url>", "RPC URL", "http://localhost:8899").option("--commitment <level>", "Commitment level").action(async (options) => {
|
|
1054
1156
|
try {
|
|
1055
|
-
const client = new
|
|
1157
|
+
const client = new import_sdk35.Surfman(options.rpc);
|
|
1056
1158
|
const config = options.commitment ? { commitment: options.commitment } : void 0;
|
|
1057
1159
|
const balance = await client.accounts.getTokenAccountBalance(
|
|
1058
1160
|
options.pubkey,
|
|
@@ -1078,12 +1180,12 @@ function createGetTokenAccountBalanceCommand() {
|
|
|
1078
1180
|
}
|
|
1079
1181
|
|
|
1080
1182
|
// src/commands/accounts/get-token-supply.ts
|
|
1081
|
-
var
|
|
1082
|
-
var
|
|
1183
|
+
var import_commander36 = require("commander");
|
|
1184
|
+
var import_sdk36 = require("@surfman/sdk");
|
|
1083
1185
|
function createGetTokenSupplyCommand() {
|
|
1084
|
-
const command = new
|
|
1186
|
+
const command = new import_commander36.Command("get-token-supply").description("Get total supply of a token").requiredOption("--mint <address>", "Token mint address").option("--rpc <url>", "RPC URL", "http://localhost:8899").option("--commitment <level>", "Commitment level").action(async (options) => {
|
|
1085
1187
|
try {
|
|
1086
|
-
const client = new
|
|
1188
|
+
const client = new import_sdk36.Surfman(options.rpc);
|
|
1087
1189
|
const config = options.commitment ? { commitment: options.commitment } : void 0;
|
|
1088
1190
|
const supply = await client.accounts.getTokenSupply(
|
|
1089
1191
|
options.mint,
|
|
@@ -1105,12 +1207,12 @@ function createGetTokenSupplyCommand() {
|
|
|
1105
1207
|
}
|
|
1106
1208
|
|
|
1107
1209
|
// src/commands/scan/get-program-accounts.ts
|
|
1108
|
-
var
|
|
1109
|
-
var
|
|
1210
|
+
var import_commander37 = require("commander");
|
|
1211
|
+
var import_sdk37 = require("@surfman/sdk");
|
|
1110
1212
|
function createGetProgramAccountsCommand() {
|
|
1111
|
-
const command = new
|
|
1213
|
+
const command = new import_commander37.Command("get-program-accounts").description("Get all accounts owned by a program").requiredOption("--program-id <address>", "Program public key").option("--rpc <url>", "RPC URL", "http://localhost:8899").option("--encoding <type>", "Data encoding", "base64").option("--with-context", "Include context in response", false).option("--data-size <number>", "Filter by data size").action(async (options) => {
|
|
1112
1214
|
try {
|
|
1113
|
-
const client = new
|
|
1215
|
+
const client = new import_sdk37.Surfman(options.rpc);
|
|
1114
1216
|
const config = {
|
|
1115
1217
|
encoding: options.encoding,
|
|
1116
1218
|
withContext: options.withContext
|
|
@@ -1146,12 +1248,12 @@ ${index + 1}. ${acc.pubkey}`);
|
|
|
1146
1248
|
}
|
|
1147
1249
|
|
|
1148
1250
|
// src/commands/scan/get-largest-accounts.ts
|
|
1149
|
-
var
|
|
1150
|
-
var
|
|
1251
|
+
var import_commander38 = require("commander");
|
|
1252
|
+
var import_sdk38 = require("@surfman/sdk");
|
|
1151
1253
|
function createGetLargestAccountsCommand() {
|
|
1152
|
-
const command = new
|
|
1254
|
+
const command = new import_commander38.Command("get-largest-accounts").description("Get the 20 largest accounts by lamport balance").option("--rpc <url>", "RPC URL", "http://localhost:8899").option("--filter <type>", "Filter type (circulating/nonCirculating)").option("--commitment <level>", "Commitment level").action(async (options) => {
|
|
1153
1255
|
try {
|
|
1154
|
-
const client = new
|
|
1256
|
+
const client = new import_sdk38.Surfman(options.rpc);
|
|
1155
1257
|
const config = {};
|
|
1156
1258
|
if (options.filter) {
|
|
1157
1259
|
config.filter = options.filter;
|
|
@@ -1180,12 +1282,12 @@ function createGetLargestAccountsCommand() {
|
|
|
1180
1282
|
}
|
|
1181
1283
|
|
|
1182
1284
|
// src/commands/scan/get-supply.ts
|
|
1183
|
-
var
|
|
1184
|
-
var
|
|
1285
|
+
var import_commander39 = require("commander");
|
|
1286
|
+
var import_sdk39 = require("@surfman/sdk");
|
|
1185
1287
|
function createGetSupplyCommand() {
|
|
1186
|
-
const command = new
|
|
1288
|
+
const command = new import_commander39.Command("get-supply").description("Get current supply information").option("--rpc <url>", "RPC URL", "http://localhost:8899").option("--exclude-accounts", "Exclude non-circulating accounts list", false).option("--commitment <level>", "Commitment level").action(async (options) => {
|
|
1187
1289
|
try {
|
|
1188
|
-
const client = new
|
|
1290
|
+
const client = new import_sdk39.Surfman(options.rpc);
|
|
1189
1291
|
const config = {
|
|
1190
1292
|
excludeNonCirculatingAccountsList: options.excludeAccounts
|
|
1191
1293
|
};
|
|
@@ -1213,12 +1315,12 @@ function createGetSupplyCommand() {
|
|
|
1213
1315
|
}
|
|
1214
1316
|
|
|
1215
1317
|
// src/commands/scan/get-token-largest-accounts.ts
|
|
1216
|
-
var
|
|
1217
|
-
var
|
|
1318
|
+
var import_commander40 = require("commander");
|
|
1319
|
+
var import_sdk40 = require("@surfman/sdk");
|
|
1218
1320
|
function createGetTokenLargestAccountsCommand() {
|
|
1219
|
-
const command = new
|
|
1321
|
+
const command = new import_commander40.Command("get-token-largest-accounts").description("Get largest holders of a specific token").requiredOption("--mint <address>", "Token mint address").option("--rpc <url>", "RPC URL", "http://localhost:8899").option("--commitment <level>", "Commitment level").action(async (options) => {
|
|
1220
1322
|
try {
|
|
1221
|
-
const client = new
|
|
1323
|
+
const client = new import_sdk40.Surfman(options.rpc);
|
|
1222
1324
|
const config = options.commitment ? { commitment: options.commitment } : void 0;
|
|
1223
1325
|
const accounts = await client.scan.getTokenLargestAccounts(
|
|
1224
1326
|
options.mint,
|
|
@@ -1242,12 +1344,12 @@ ${index + 1}. ${acc.address}`);
|
|
|
1242
1344
|
}
|
|
1243
1345
|
|
|
1244
1346
|
// src/commands/scan/get-token-accounts-by-owner.ts
|
|
1245
|
-
var
|
|
1246
|
-
var
|
|
1347
|
+
var import_commander41 = require("commander");
|
|
1348
|
+
var import_sdk41 = require("@surfman/sdk");
|
|
1247
1349
|
function createGetTokenAccountsByOwnerCommand() {
|
|
1248
|
-
const command = new
|
|
1350
|
+
const command = new import_commander41.Command("get-token-accounts-by-owner").description("Get all token accounts owned by an address").requiredOption("--owner <address>", "Owner wallet address").option("--rpc <url>", "RPC URL", "http://localhost:8899").option("--mint <address>", "Filter by token mint").option("--program-id <address>", "Filter by program ID").option("--encoding <type>", "Data encoding", "jsonParsed").action(async (options) => {
|
|
1249
1351
|
try {
|
|
1250
|
-
const client = new
|
|
1352
|
+
const client = new import_sdk41.Surfman(options.rpc);
|
|
1251
1353
|
if (!options.mint && !options.programId) {
|
|
1252
1354
|
logger.error("Must specify either --mint or --program-id filter");
|
|
1253
1355
|
process.exit(1);
|
|
@@ -1279,12 +1381,12 @@ ${index + 1}. ${acc.pubkey}`);
|
|
|
1279
1381
|
}
|
|
1280
1382
|
|
|
1281
1383
|
// src/commands/scan/get-token-accounts-by-delegate.ts
|
|
1282
|
-
var
|
|
1283
|
-
var
|
|
1384
|
+
var import_commander42 = require("commander");
|
|
1385
|
+
var import_sdk42 = require("@surfman/sdk");
|
|
1284
1386
|
function createGetTokenAccountsByDelegateCommand() {
|
|
1285
|
-
const command = new
|
|
1387
|
+
const command = new import_commander42.Command("get-token-accounts-by-delegate").description("Get token accounts delegated to an address").requiredOption("--delegate <address>", "Delegate address").option("--rpc <url>", "RPC URL", "http://localhost:8899").option("--mint <address>", "Filter by token mint").option("--program-id <address>", "Filter by program ID").option("--encoding <type>", "Data encoding", "jsonParsed").action(async (options) => {
|
|
1286
1388
|
try {
|
|
1287
|
-
const client = new
|
|
1389
|
+
const client = new import_sdk42.Surfman(options.rpc);
|
|
1288
1390
|
if (!options.mint && !options.programId) {
|
|
1289
1391
|
logger.error("Must specify either --mint or --program-id filter");
|
|
1290
1392
|
process.exit(1);
|
|
@@ -1315,79 +1417,635 @@ ${index + 1}. ${acc.pubkey}`);
|
|
|
1315
1417
|
return command;
|
|
1316
1418
|
}
|
|
1317
1419
|
|
|
1420
|
+
// src/commands/cheatcodes/clone-program-account.ts
|
|
1421
|
+
var import_commander43 = require("commander");
|
|
1422
|
+
var import_sdk43 = require("@surfman/sdk");
|
|
1423
|
+
function createCloneProgramAccountCommand() {
|
|
1424
|
+
const command = new import_commander43.Command("clone-program-account").description("Clone a program account from one program ID to another").requiredOption("--source <address>", "Source program ID").requiredOption("--destination <address>", "Destination program ID").option("--rpc <url>", "RPC URL", "http://localhost:8899").action(async (options) => {
|
|
1425
|
+
try {
|
|
1426
|
+
const client = new import_sdk43.Surfman(options.rpc);
|
|
1427
|
+
await client.cheatcodes.cloneProgramAccount(
|
|
1428
|
+
options.source,
|
|
1429
|
+
options.destination
|
|
1430
|
+
);
|
|
1431
|
+
logger.success(`Program cloned successfully!`);
|
|
1432
|
+
logger.log(`Source: ${options.source}`);
|
|
1433
|
+
logger.log(`Destination: ${options.destination}`);
|
|
1434
|
+
} catch (error) {
|
|
1435
|
+
logger.error(`Failed to clone program account: ${error.message}`);
|
|
1436
|
+
process.exit(1);
|
|
1437
|
+
}
|
|
1438
|
+
});
|
|
1439
|
+
return command;
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
// src/commands/cheatcodes/profile-transaction.ts
|
|
1443
|
+
var import_commander44 = require("commander");
|
|
1444
|
+
var import_sdk44 = require("@surfman/sdk");
|
|
1445
|
+
function createProfileTransactionCommand() {
|
|
1446
|
+
const command = new import_commander44.Command("profile-transaction").description("Profile a transaction to estimate compute units").requiredOption("--transaction <base64>", "Base64 encoded transaction data").option("--tag <tag>", "Optional tag for the transaction").option("--rpc <url>", "RPC URL", "http://localhost:8899").option("--depth <depth>", "Profile depth (full or shallow)", "full").action(async (options) => {
|
|
1447
|
+
try {
|
|
1448
|
+
const client = new import_sdk44.Surfman(options.rpc);
|
|
1449
|
+
const config = {
|
|
1450
|
+
depth: options.depth
|
|
1451
|
+
};
|
|
1452
|
+
const result = await client.cheatcodes.profileTransaction(
|
|
1453
|
+
options.transaction,
|
|
1454
|
+
options.tag,
|
|
1455
|
+
config
|
|
1456
|
+
);
|
|
1457
|
+
logger.success("Transaction profiled successfully!");
|
|
1458
|
+
logger.log("\nProfile Result:");
|
|
1459
|
+
logger.log(` UUID: ${result.uuid}`);
|
|
1460
|
+
if (result.signature) {
|
|
1461
|
+
logger.log(` Signature: ${result.signature}`);
|
|
1462
|
+
}
|
|
1463
|
+
logger.log(` Slot: ${result.slot}`);
|
|
1464
|
+
if (result.tag) {
|
|
1465
|
+
logger.log(` Tag: ${result.tag}`);
|
|
1466
|
+
}
|
|
1467
|
+
if (result.computeUnitsConsumed) {
|
|
1468
|
+
logger.log(` Compute Units: ${result.computeUnitsConsumed}`);
|
|
1469
|
+
}
|
|
1470
|
+
if (result.err) {
|
|
1471
|
+
logger.log(` Error: ${JSON.stringify(result.err, null, 2)}`);
|
|
1472
|
+
}
|
|
1473
|
+
if (result.logs && result.logs.length > 0) {
|
|
1474
|
+
logger.log("\nLogs:");
|
|
1475
|
+
result.logs.forEach((log) => logger.log(` ${log}`));
|
|
1476
|
+
}
|
|
1477
|
+
} catch (error) {
|
|
1478
|
+
logger.error(`Failed to profile transaction: ${error.message}`);
|
|
1479
|
+
process.exit(1);
|
|
1480
|
+
}
|
|
1481
|
+
});
|
|
1482
|
+
return command;
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
// src/commands/cheatcodes/get-profile-results-by-tag.ts
|
|
1486
|
+
var import_commander45 = require("commander");
|
|
1487
|
+
var import_sdk45 = require("@surfman/sdk");
|
|
1488
|
+
function createGetProfileResultsByTagCommand() {
|
|
1489
|
+
const command = new import_commander45.Command("get-profile-results-by-tag").description("Get all profiling results for a given tag").requiredOption("--tag <tag>", "Tag to retrieve profiling results for").option("--rpc <url>", "RPC URL", "http://localhost:8899").option("--depth <depth>", "Profile depth (full or shallow)", "shallow").action(async (options) => {
|
|
1490
|
+
try {
|
|
1491
|
+
const client = new import_sdk45.Surfman(options.rpc);
|
|
1492
|
+
const config = {
|
|
1493
|
+
depth: options.depth
|
|
1494
|
+
};
|
|
1495
|
+
const results = await client.cheatcodes.getProfileResultsByTag(
|
|
1496
|
+
options.tag,
|
|
1497
|
+
config
|
|
1498
|
+
);
|
|
1499
|
+
if (!results || results.length === 0) {
|
|
1500
|
+
logger.log(`No profile results found for tag: ${options.tag}`);
|
|
1501
|
+
return;
|
|
1502
|
+
}
|
|
1503
|
+
logger.success(`Found ${results.length} profile result(s) for tag: ${options.tag}
|
|
1504
|
+
`);
|
|
1505
|
+
results.forEach((result, index) => {
|
|
1506
|
+
logger.log(`Profile ${index + 1}:`);
|
|
1507
|
+
logger.log(` UUID: ${result.uuid}`);
|
|
1508
|
+
if (result.signature) {
|
|
1509
|
+
logger.log(` Signature: ${result.signature}`);
|
|
1510
|
+
}
|
|
1511
|
+
logger.log(` Slot: ${result.slot}`);
|
|
1512
|
+
if (result.computeUnitsConsumed) {
|
|
1513
|
+
logger.log(` Compute Units: ${result.computeUnitsConsumed}`);
|
|
1514
|
+
}
|
|
1515
|
+
if (result.err) {
|
|
1516
|
+
logger.log(` Error: ${JSON.stringify(result.err)}`);
|
|
1517
|
+
}
|
|
1518
|
+
logger.log("");
|
|
1519
|
+
});
|
|
1520
|
+
} catch (error) {
|
|
1521
|
+
logger.error(`Failed to get profile results: ${error.message}`);
|
|
1522
|
+
process.exit(1);
|
|
1523
|
+
}
|
|
1524
|
+
});
|
|
1525
|
+
return command;
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1528
|
+
// src/commands/cheatcodes/set-supply.ts
|
|
1529
|
+
var import_commander46 = require("commander");
|
|
1530
|
+
var import_sdk46 = require("@surfman/sdk");
|
|
1531
|
+
function createSetSupplyCommand() {
|
|
1532
|
+
const command = new import_commander46.Command("set-supply").description("Set or update network supply information").option("--total <lamports>", "Total supply in lamports").option("--circulating <lamports>", "Circulating supply in lamports").option("--non-circulating <lamports>", "Non-circulating supply in lamports").option("--non-circulating-accounts <accounts...>", "List of non-circulating account addresses").option("--rpc <url>", "RPC URL", "http://localhost:8899").action(async (options) => {
|
|
1533
|
+
try {
|
|
1534
|
+
const client = new import_sdk46.Surfman(options.rpc);
|
|
1535
|
+
const update = {};
|
|
1536
|
+
if (options.total) {
|
|
1537
|
+
update.total = parseInt(options.total);
|
|
1538
|
+
}
|
|
1539
|
+
if (options.circulating) {
|
|
1540
|
+
update.circulating = parseInt(options.circulating);
|
|
1541
|
+
}
|
|
1542
|
+
if (options.nonCirculating) {
|
|
1543
|
+
update.nonCirculating = parseInt(options.nonCirculating);
|
|
1544
|
+
}
|
|
1545
|
+
if (options.nonCirculatingAccounts) {
|
|
1546
|
+
update.nonCirculatingAccounts = options.nonCirculatingAccounts;
|
|
1547
|
+
}
|
|
1548
|
+
if (Object.keys(update).length === 0) {
|
|
1549
|
+
logger.error("No supply fields specified. Use --total, --circulating, etc.");
|
|
1550
|
+
process.exit(1);
|
|
1551
|
+
}
|
|
1552
|
+
await client.cheatcodes.setSupply(update);
|
|
1553
|
+
logger.success("Supply updated successfully!");
|
|
1554
|
+
logger.log("Updated fields:");
|
|
1555
|
+
Object.entries(update).forEach(([key, value]) => {
|
|
1556
|
+
logger.log(` ${key}: ${value}`);
|
|
1557
|
+
});
|
|
1558
|
+
} catch (error) {
|
|
1559
|
+
logger.error(`Failed to set supply: ${error.message}`);
|
|
1560
|
+
process.exit(1);
|
|
1561
|
+
}
|
|
1562
|
+
});
|
|
1563
|
+
return command;
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1566
|
+
// src/commands/cheatcodes/get-transaction-profile.ts
|
|
1567
|
+
var import_commander47 = require("commander");
|
|
1568
|
+
var import_sdk47 = require("@surfman/sdk");
|
|
1569
|
+
function createGetTransactionProfileCommand() {
|
|
1570
|
+
const command = new import_commander47.Command("get-transaction-profile").description("Get transaction profile by signature or UUID").requiredOption("--id <signatureOrUuid>", "Transaction signature or UUID").option("--type <type>", "ID type (signature or uuid)", "signature").option("--rpc <url>", "RPC URL", "http://localhost:8899").option("--depth <depth>", "Profile depth (full or shallow)", "full").action(async (options) => {
|
|
1571
|
+
try {
|
|
1572
|
+
const client = new import_sdk47.Surfman(options.rpc);
|
|
1573
|
+
const config = {
|
|
1574
|
+
depth: options.depth
|
|
1575
|
+
};
|
|
1576
|
+
const signatureOrUuid = options.type === "uuid" ? { Uuid: options.id } : { Signature: options.id };
|
|
1577
|
+
const result = await client.cheatcodes.getTransactionProfile(
|
|
1578
|
+
signatureOrUuid,
|
|
1579
|
+
config
|
|
1580
|
+
);
|
|
1581
|
+
if (!result) {
|
|
1582
|
+
logger.log(`No profile found for ${options.type}: ${options.id}`);
|
|
1583
|
+
return;
|
|
1584
|
+
}
|
|
1585
|
+
logger.success("Profile found!");
|
|
1586
|
+
logger.log("\nProfile Result:");
|
|
1587
|
+
logger.log(` UUID: ${result.uuid}`);
|
|
1588
|
+
if (result.signature) {
|
|
1589
|
+
logger.log(` Signature: ${result.signature}`);
|
|
1590
|
+
}
|
|
1591
|
+
logger.log(` Slot: ${result.slot}`);
|
|
1592
|
+
if (result.tag) {
|
|
1593
|
+
logger.log(` Tag: ${result.tag}`);
|
|
1594
|
+
}
|
|
1595
|
+
if (result.computeUnitsConsumed) {
|
|
1596
|
+
logger.log(` Compute Units: ${result.computeUnitsConsumed}`);
|
|
1597
|
+
}
|
|
1598
|
+
if (result.err) {
|
|
1599
|
+
logger.log(` Error: ${JSON.stringify(result.err, null, 2)}`);
|
|
1600
|
+
}
|
|
1601
|
+
if (result.logs && result.logs.length > 0) {
|
|
1602
|
+
logger.log("\nLogs:");
|
|
1603
|
+
result.logs.forEach((log) => logger.log(` ${log}`));
|
|
1604
|
+
}
|
|
1605
|
+
} catch (error) {
|
|
1606
|
+
logger.error(`Failed to get transaction profile: ${error.message}`);
|
|
1607
|
+
process.exit(1);
|
|
1608
|
+
}
|
|
1609
|
+
});
|
|
1610
|
+
return command;
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1613
|
+
// src/commands/cheatcodes/register-idl.ts
|
|
1614
|
+
var import_commander48 = require("commander");
|
|
1615
|
+
var import_sdk48 = require("@surfman/sdk");
|
|
1616
|
+
var import_fs = require("fs");
|
|
1617
|
+
function createRegisterIdlCommand() {
|
|
1618
|
+
const command = new import_commander48.Command("register-idl").description("Register an IDL for a program").requiredOption("--idl-file <path>", "Path to IDL JSON file").option("--slot <slot>", "Slot at which to register the IDL").option("--rpc <url>", "RPC URL", "http://localhost:8899").action(async (options) => {
|
|
1619
|
+
try {
|
|
1620
|
+
const client = new import_sdk48.Surfman(options.rpc);
|
|
1621
|
+
const idlContent = (0, import_fs.readFileSync)(options.idlFile, "utf-8");
|
|
1622
|
+
const idl = JSON.parse(idlContent);
|
|
1623
|
+
const slot = options.slot ? parseInt(options.slot) : void 0;
|
|
1624
|
+
await client.cheatcodes.registerIdl(idl, slot);
|
|
1625
|
+
logger.success("IDL registered successfully!");
|
|
1626
|
+
logger.log(` Program: ${idl.address}`);
|
|
1627
|
+
logger.log(` Name: ${idl.metadata.name}`);
|
|
1628
|
+
logger.log(` Version: ${idl.metadata.version}`);
|
|
1629
|
+
if (slot) {
|
|
1630
|
+
logger.log(` Slot: ${slot}`);
|
|
1631
|
+
}
|
|
1632
|
+
} catch (error) {
|
|
1633
|
+
logger.error(`Failed to register IDL: ${error.message}`);
|
|
1634
|
+
process.exit(1);
|
|
1635
|
+
}
|
|
1636
|
+
});
|
|
1637
|
+
return command;
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
// src/commands/cheatcodes/get-idl.ts
|
|
1641
|
+
var import_commander49 = require("commander");
|
|
1642
|
+
var import_sdk49 = require("@surfman/sdk");
|
|
1643
|
+
function createGetIdlCommand() {
|
|
1644
|
+
const command = new import_commander49.Command("get-idl").description("Get the registered IDL for a program").requiredOption("--program-id <address>", "Program ID").option("--slot <slot>", "Slot at which to query the IDL").option("--rpc <url>", "RPC URL", "http://localhost:8899").action(async (options) => {
|
|
1645
|
+
try {
|
|
1646
|
+
const client = new import_sdk49.Surfman(options.rpc);
|
|
1647
|
+
const slot = options.slot ? parseInt(options.slot) : void 0;
|
|
1648
|
+
const idl = await client.cheatcodes.getIdl(options.programId, slot);
|
|
1649
|
+
if (!idl) {
|
|
1650
|
+
logger.log(`No IDL found for program: ${options.programId}`);
|
|
1651
|
+
return;
|
|
1652
|
+
}
|
|
1653
|
+
logger.success("IDL found!");
|
|
1654
|
+
logger.log("\nIDL:");
|
|
1655
|
+
logger.log(JSON.stringify(idl, null, 2));
|
|
1656
|
+
} catch (error) {
|
|
1657
|
+
logger.error(`Failed to get IDL: ${error.message}`);
|
|
1658
|
+
process.exit(1);
|
|
1659
|
+
}
|
|
1660
|
+
});
|
|
1661
|
+
return command;
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1664
|
+
// src/commands/cheatcodes/export-snapshot.ts
|
|
1665
|
+
var import_commander50 = require("commander");
|
|
1666
|
+
var import_sdk50 = require("@surfman/sdk");
|
|
1667
|
+
var import_fs2 = require("fs");
|
|
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) => {
|
|
1670
|
+
try {
|
|
1671
|
+
const client = new import_sdk50.Surfman(options.rpc);
|
|
1672
|
+
const config = {};
|
|
1673
|
+
if (options.includeParsed) {
|
|
1674
|
+
config.includeParsedAccounts = true;
|
|
1675
|
+
}
|
|
1676
|
+
if (options.includePrograms || options.includeAccounts || options.excludeAccounts) {
|
|
1677
|
+
config.filter = {};
|
|
1678
|
+
if (options.includePrograms) {
|
|
1679
|
+
config.filter.includeProgramAccounts = true;
|
|
1680
|
+
}
|
|
1681
|
+
if (options.includeAccounts) {
|
|
1682
|
+
config.filter.includeAccounts = options.includeAccounts;
|
|
1683
|
+
}
|
|
1684
|
+
if (options.excludeAccounts) {
|
|
1685
|
+
config.filter.excludeAccounts = options.excludeAccounts;
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
const snapshot = await client.cheatcodes.exportSnapshot(config);
|
|
1689
|
+
(0, import_fs2.writeFileSync)(options.output, JSON.stringify(snapshot, null, 2));
|
|
1690
|
+
const accountCount = Object.keys(snapshot).length;
|
|
1691
|
+
logger.success(`Snapshot exported successfully!`);
|
|
1692
|
+
logger.log(` Accounts: ${accountCount}`);
|
|
1693
|
+
logger.log(` Output: ${options.output}`);
|
|
1694
|
+
} catch (error) {
|
|
1695
|
+
logger.error(`Failed to export snapshot: ${error.message}`);
|
|
1696
|
+
process.exit(1);
|
|
1697
|
+
}
|
|
1698
|
+
});
|
|
1699
|
+
return command;
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
// src/commands/cheatcodes/stream-account.ts
|
|
1703
|
+
var import_commander51 = require("commander");
|
|
1704
|
+
var import_sdk51 = require("@surfman/sdk");
|
|
1705
|
+
function createStreamAccountCommand() {
|
|
1706
|
+
const command = new import_commander51.Command("stream-account").description("Stream an account from the data source").requiredOption("--pubkey <address>", "Account public key").option("--include-owned", "Include owned accounts").option("--rpc <url>", "RPC URL", "http://localhost:8899").action(async (options) => {
|
|
1707
|
+
try {
|
|
1708
|
+
const client = new import_sdk51.Surfman(options.rpc);
|
|
1709
|
+
const config = options.includeOwned ? { includeOwnedAccounts: true } : void 0;
|
|
1710
|
+
await client.cheatcodes.streamAccount(options.pubkey, config);
|
|
1711
|
+
logger.success(`Account streaming initiated!`);
|
|
1712
|
+
logger.log(` Account: ${options.pubkey}`);
|
|
1713
|
+
if (options.includeOwned) {
|
|
1714
|
+
logger.log(` Include owned accounts: true`);
|
|
1715
|
+
}
|
|
1716
|
+
} catch (error) {
|
|
1717
|
+
logger.error(`Failed to stream account: ${error.message}`);
|
|
1718
|
+
process.exit(1);
|
|
1719
|
+
}
|
|
1720
|
+
});
|
|
1721
|
+
return command;
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1724
|
+
// src/commands/cheatcodes/get-streamed-accounts.ts
|
|
1725
|
+
var import_commander52 = require("commander");
|
|
1726
|
+
var import_sdk52 = require("@surfman/sdk");
|
|
1727
|
+
function createGetStreamedAccountsCommand() {
|
|
1728
|
+
const command = new import_commander52.Command("get-streamed-accounts").description("Get all streamed accounts").option("--rpc <url>", "RPC URL", "http://localhost:8899").action(async (options) => {
|
|
1729
|
+
try {
|
|
1730
|
+
const client = new import_sdk52.Surfman(options.rpc);
|
|
1731
|
+
const result = await client.cheatcodes.getStreamedAccounts();
|
|
1732
|
+
if (!result.accounts || result.accounts.length === 0) {
|
|
1733
|
+
logger.log("No streamed accounts found.");
|
|
1734
|
+
return;
|
|
1735
|
+
}
|
|
1736
|
+
logger.success(`Found ${result.accounts.length} streamed account(s):
|
|
1737
|
+
`);
|
|
1738
|
+
result.accounts.forEach((account, index) => {
|
|
1739
|
+
logger.log(`${index + 1}. ${account}`);
|
|
1740
|
+
});
|
|
1741
|
+
} catch (error) {
|
|
1742
|
+
logger.error(`Failed to get streamed accounts: ${error.message}`);
|
|
1743
|
+
process.exit(1);
|
|
1744
|
+
}
|
|
1745
|
+
});
|
|
1746
|
+
return command;
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
// src/commands/cheatcodes/get-surfnet-info.ts
|
|
1750
|
+
var import_commander53 = require("commander");
|
|
1751
|
+
var import_sdk53 = require("@surfman/sdk");
|
|
1752
|
+
function createGetSurfnetInfoCommand() {
|
|
1753
|
+
const command = new import_commander53.Command("get-surfnet-info").description("Get Surfnet network information").option("--rpc <url>", "RPC URL", "http://localhost:8899").action(async (options) => {
|
|
1754
|
+
try {
|
|
1755
|
+
const client = new import_sdk53.Surfman(options.rpc);
|
|
1756
|
+
const info = await client.cheatcodes.getSurfnetInfo();
|
|
1757
|
+
logger.success("Surfnet Info:\n");
|
|
1758
|
+
logger.log("Runbook Executions:");
|
|
1759
|
+
if (info.runbookExecutions.length === 0) {
|
|
1760
|
+
logger.log(" No runbook executions found.");
|
|
1761
|
+
} else {
|
|
1762
|
+
info.runbookExecutions.forEach((execution, index) => {
|
|
1763
|
+
logger.log(`
|
|
1764
|
+
${index + 1}. Runbook: ${execution.runbookId}`);
|
|
1765
|
+
logger.log(` Started At: ${new Date(execution.startedAt * 1e3).toISOString()}`);
|
|
1766
|
+
if (execution.completedAt) {
|
|
1767
|
+
logger.log(` Completed At: ${new Date(execution.completedAt * 1e3).toISOString()}`);
|
|
1768
|
+
} else {
|
|
1769
|
+
logger.log(` Status: Running`);
|
|
1770
|
+
}
|
|
1771
|
+
});
|
|
1772
|
+
}
|
|
1773
|
+
} catch (error) {
|
|
1774
|
+
logger.error(`Failed to get Surfnet info: ${error.message}`);
|
|
1775
|
+
process.exit(1);
|
|
1776
|
+
}
|
|
1777
|
+
});
|
|
1778
|
+
return command;
|
|
1779
|
+
}
|
|
1780
|
+
|
|
1781
|
+
// src/commands/cheatcodes/write-program.ts
|
|
1782
|
+
var import_commander54 = require("commander");
|
|
1783
|
+
var import_sdk54 = require("@surfman/sdk");
|
|
1784
|
+
var import_fs3 = require("fs");
|
|
1785
|
+
function createWriteProgramCommand() {
|
|
1786
|
+
const command = new import_commander54.Command("write-program").description("Write program data at a specified offset").requiredOption("--program-id <address>", "Program ID").option("--data <hex>", "Hex-encoded program data").option("--data-file <path>", "Path to binary file containing program data").option("--offset <offset>", "Byte offset at which to write data", "0").option("--authority <address>", "Program authority").option("--rpc <url>", "RPC URL", "http://localhost:8899").action(async (options) => {
|
|
1787
|
+
try {
|
|
1788
|
+
const client = new import_sdk54.Surfman(options.rpc);
|
|
1789
|
+
let dataHex;
|
|
1790
|
+
if (options.data) {
|
|
1791
|
+
dataHex = options.data;
|
|
1792
|
+
} else if (options.dataFile) {
|
|
1793
|
+
const buffer = (0, import_fs3.readFileSync)(options.dataFile);
|
|
1794
|
+
dataHex = buffer.toString("hex");
|
|
1795
|
+
} else {
|
|
1796
|
+
logger.error("Either --data or --data-file must be specified");
|
|
1797
|
+
process.exit(1);
|
|
1798
|
+
}
|
|
1799
|
+
const offset = parseInt(options.offset);
|
|
1800
|
+
const authority = options.authority || void 0;
|
|
1801
|
+
await client.cheatcodes.writeProgram(
|
|
1802
|
+
options.programId,
|
|
1803
|
+
dataHex,
|
|
1804
|
+
offset,
|
|
1805
|
+
authority
|
|
1806
|
+
);
|
|
1807
|
+
logger.success("Program data written successfully!");
|
|
1808
|
+
logger.log(` Program ID: ${options.programId}`);
|
|
1809
|
+
logger.log(` Offset: ${offset}`);
|
|
1810
|
+
logger.log(` Data length: ${dataHex.length / 2} bytes`);
|
|
1811
|
+
if (authority) {
|
|
1812
|
+
logger.log(` Authority: ${authority}`);
|
|
1813
|
+
}
|
|
1814
|
+
} catch (error) {
|
|
1815
|
+
logger.error(`Failed to write program: ${error.message}`);
|
|
1816
|
+
process.exit(1);
|
|
1817
|
+
}
|
|
1818
|
+
});
|
|
1819
|
+
return command;
|
|
1820
|
+
}
|
|
1821
|
+
|
|
1822
|
+
// src/commands/cheatcodes/register-scenario.ts
|
|
1823
|
+
var import_commander55 = require("commander");
|
|
1824
|
+
var import_sdk55 = require("@surfman/sdk");
|
|
1825
|
+
var import_fs4 = require("fs");
|
|
1826
|
+
function createRegisterScenarioCommand() {
|
|
1827
|
+
const command = new import_commander55.Command("register-scenario").description("Register a scenario with account overrides").requiredOption("--scenario-file <path>", "Path to scenario JSON file").option("--slot <slot>", "Base slot for relative slot offsets").option("--rpc <url>", "RPC URL", "http://localhost:8899").action(async (options) => {
|
|
1828
|
+
try {
|
|
1829
|
+
const client = new import_sdk55.Surfman(options.rpc);
|
|
1830
|
+
const scenarioContent = (0, import_fs4.readFileSync)(options.scenarioFile, "utf-8");
|
|
1831
|
+
const scenario = JSON.parse(scenarioContent);
|
|
1832
|
+
const slot = options.slot ? parseInt(options.slot) : void 0;
|
|
1833
|
+
await client.cheatcodes.registerScenario(scenario, slot);
|
|
1834
|
+
logger.success("Scenario registered successfully!");
|
|
1835
|
+
logger.log(` ID: ${scenario.id}`);
|
|
1836
|
+
logger.log(` Name: ${scenario.name}`);
|
|
1837
|
+
logger.log(` Overrides: ${scenario.overrides.length}`);
|
|
1838
|
+
if (scenario.tags && scenario.tags.length > 0) {
|
|
1839
|
+
logger.log(` Tags: ${scenario.tags.join(", ")}`);
|
|
1840
|
+
}
|
|
1841
|
+
if (slot) {
|
|
1842
|
+
logger.log(` Base Slot: ${slot}`);
|
|
1843
|
+
}
|
|
1844
|
+
} catch (error) {
|
|
1845
|
+
logger.error(`Failed to register scenario: ${error.message}`);
|
|
1846
|
+
process.exit(1);
|
|
1847
|
+
}
|
|
1848
|
+
});
|
|
1849
|
+
return command;
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1852
|
+
// src/commands/ui.ts
|
|
1853
|
+
var import_commander56 = require("commander");
|
|
1854
|
+
var import_chalk6 = __toESM(require("chalk"));
|
|
1855
|
+
|
|
1856
|
+
// src/server/index.ts
|
|
1857
|
+
var import_express = __toESM(require("express"));
|
|
1858
|
+
var import_cors = __toESM(require("cors"));
|
|
1859
|
+
var import_path = __toESM(require("path"));
|
|
1860
|
+
var import_ws = require("ws");
|
|
1861
|
+
var import_http = require("http");
|
|
1862
|
+
var import_sdk56 = require("@surfman/sdk");
|
|
1863
|
+
async function startWebServer(options) {
|
|
1864
|
+
const app = (0, import_express.default)();
|
|
1865
|
+
const server = (0, import_http.createServer)(app);
|
|
1866
|
+
const wss = new import_ws.WebSocketServer({ server });
|
|
1867
|
+
app.use((0, import_cors.default)());
|
|
1868
|
+
app.use(import_express.default.json());
|
|
1869
|
+
const client = new import_sdk56.Surfman(options.rpcUrl);
|
|
1870
|
+
app.post("/api/rpc", async (req, res) => {
|
|
1871
|
+
try {
|
|
1872
|
+
const { method, params } = req.body;
|
|
1873
|
+
const result = await client.request(method, params);
|
|
1874
|
+
res.json({ result });
|
|
1875
|
+
} catch (error) {
|
|
1876
|
+
res.status(500).json({ error: error.message });
|
|
1877
|
+
}
|
|
1878
|
+
});
|
|
1879
|
+
app.get("/api/health", (req, res) => {
|
|
1880
|
+
res.json({ status: "ok", rpcUrl: options.rpcUrl });
|
|
1881
|
+
});
|
|
1882
|
+
const staticPath = import_path.default.join(__dirname, "../../static");
|
|
1883
|
+
app.use(import_express.default.static(staticPath));
|
|
1884
|
+
app.get("*", (req, res) => {
|
|
1885
|
+
res.sendFile(import_path.default.join(staticPath, "index.html"));
|
|
1886
|
+
});
|
|
1887
|
+
wss.on("connection", (ws) => {
|
|
1888
|
+
console.log("WebSocket client connected");
|
|
1889
|
+
ws.on("message", async (message) => {
|
|
1890
|
+
try {
|
|
1891
|
+
const request = JSON.parse(message.toString());
|
|
1892
|
+
const result = await client.request(request.method, request.params);
|
|
1893
|
+
ws.send(JSON.stringify({ id: request.id, result }));
|
|
1894
|
+
} catch (error) {
|
|
1895
|
+
ws.send(JSON.stringify({ error: error.message }));
|
|
1896
|
+
}
|
|
1897
|
+
});
|
|
1898
|
+
ws.on("close", () => {
|
|
1899
|
+
console.log("WebSocket client disconnected");
|
|
1900
|
+
});
|
|
1901
|
+
});
|
|
1902
|
+
return new Promise((resolve) => {
|
|
1903
|
+
server.listen(options.port, () => {
|
|
1904
|
+
resolve();
|
|
1905
|
+
});
|
|
1906
|
+
});
|
|
1907
|
+
}
|
|
1908
|
+
|
|
1909
|
+
// src/commands/ui.ts
|
|
1910
|
+
var import_child_process = require("child_process");
|
|
1911
|
+
function createUiCommand() {
|
|
1912
|
+
const command = new import_commander56.Command("ui").description("Start Surfman Web UI").option("-p, --port <port>", "Port to run the web server on", "3000").option("--rpc <url>", "RPC endpoint URL", "http://localhost:8899").option("--no-open", "Do not automatically open browser").action(async (options) => {
|
|
1913
|
+
const port = parseInt(options.port);
|
|
1914
|
+
const rpcUrl = options.rpc;
|
|
1915
|
+
const shouldOpen = options.open !== false;
|
|
1916
|
+
console.log(import_chalk6.default.cyan("\n\u{1F30A} Starting Surfman Web UI...\n"));
|
|
1917
|
+
console.log(import_chalk6.default.gray(` Port: ${import_chalk6.default.white(port)}`));
|
|
1918
|
+
console.log(import_chalk6.default.gray(` RPC: ${import_chalk6.default.white(rpcUrl)}`));
|
|
1919
|
+
console.log();
|
|
1920
|
+
try {
|
|
1921
|
+
await startWebServer({
|
|
1922
|
+
port,
|
|
1923
|
+
rpcUrl,
|
|
1924
|
+
openBrowser: shouldOpen
|
|
1925
|
+
});
|
|
1926
|
+
const url = `http://localhost:${port}`;
|
|
1927
|
+
console.log(import_chalk6.default.green("\u2713 Web UI started successfully!\n"));
|
|
1928
|
+
console.log(import_chalk6.default.bold(" Local: ") + import_chalk6.default.cyan(url));
|
|
1929
|
+
console.log();
|
|
1930
|
+
console.log(import_chalk6.default.gray(" Press Ctrl+C to stop\n"));
|
|
1931
|
+
if (shouldOpen) {
|
|
1932
|
+
const command2 = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
|
|
1933
|
+
(0, import_child_process.exec)(`${command2} ${url}`);
|
|
1934
|
+
}
|
|
1935
|
+
process.on("SIGINT", () => {
|
|
1936
|
+
console.log(import_chalk6.default.yellow("\n\n\u{1F44B} Shutting down Surfman Web UI...\n"));
|
|
1937
|
+
process.exit(0);
|
|
1938
|
+
});
|
|
1939
|
+
} catch (error) {
|
|
1940
|
+
console.error(import_chalk6.default.red("Error:"), error.message);
|
|
1941
|
+
process.exit(1);
|
|
1942
|
+
}
|
|
1943
|
+
});
|
|
1944
|
+
return command;
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1318
1947
|
// src/index.ts
|
|
1319
|
-
var program = new
|
|
1948
|
+
var program = new import_commander57.Command();
|
|
1320
1949
|
var isFullHelp = process.argv.includes("--help");
|
|
1321
1950
|
var isShortHelp = process.argv.includes("-h");
|
|
1322
1951
|
if (isFullHelp) {
|
|
1323
|
-
console.log(
|
|
1324
|
-
console.log(
|
|
1325
|
-
console.log(` ${
|
|
1326
|
-
console.log(` ${
|
|
1327
|
-
console.log(` ${
|
|
1328
|
-
console.log(` ${
|
|
1329
|
-
console.log(` ${
|
|
1952
|
+
console.log(import_chalk7.default.bold.cyan("\n\u{1F30A} Surfman CLI - Complete Command List\n"));
|
|
1953
|
+
console.log(import_chalk7.default.bold.yellow("\u{1F4E6} Account Queries (5 commands):\n"));
|
|
1954
|
+
console.log(` ${import_chalk7.default.yellow("get-account-info")} Get detailed account information`);
|
|
1955
|
+
console.log(` ${import_chalk7.default.yellow("get-multiple-accounts")} Batch query multiple accounts`);
|
|
1956
|
+
console.log(` ${import_chalk7.default.yellow("get-token-account-balance")} Get token account balance`);
|
|
1957
|
+
console.log(` ${import_chalk7.default.yellow("get-token-supply")} Get total token supply`);
|
|
1958
|
+
console.log(` ${import_chalk7.default.yellow("get-block-commitment")} Get block commitment data
|
|
1959
|
+
`);
|
|
1960
|
+
console.log(import_chalk7.default.bold.blue("\u{1F310} Network Operations (22 commands):\n"));
|
|
1961
|
+
console.log(import_chalk7.default.dim(" Block Queries:"));
|
|
1962
|
+
console.log(` ${import_chalk7.default.blue("get-latest-blockhash")} Get the latest blockhash`);
|
|
1963
|
+
console.log(` ${import_chalk7.default.blue("get-block")} Get block information by slot`);
|
|
1964
|
+
console.log(` ${import_chalk7.default.blue("get-block-time")} Get block production time`);
|
|
1965
|
+
console.log(` ${import_chalk7.default.blue("get-blocks")} Get list of confirmed blocks`);
|
|
1966
|
+
console.log(` ${import_chalk7.default.blue("get-blocks-with-limit")} Get blocks with limit`);
|
|
1967
|
+
console.log(` ${import_chalk7.default.blue("get-first-available-block")} Get first available block`);
|
|
1968
|
+
console.log(` ${import_chalk7.default.blue("minimum-ledger-slot")} Get minimum ledger slot`);
|
|
1969
|
+
console.log(` ${import_chalk7.default.blue("get-max-retransmit-slot")} Get max retransmit slot`);
|
|
1970
|
+
console.log(` ${import_chalk7.default.blue("get-max-shred-insert-slot")} Get max shred insert slot
|
|
1971
|
+
`);
|
|
1972
|
+
console.log(import_chalk7.default.dim(" Transaction Operations:"));
|
|
1973
|
+
console.log(` ${import_chalk7.default.blue("get-transaction")} Get transaction details`);
|
|
1974
|
+
console.log(` ${import_chalk7.default.blue("get-signature-statuses")} Get signature statuses`);
|
|
1975
|
+
console.log(` ${import_chalk7.default.blue("get-signatures-for-address")} Get address transaction history`);
|
|
1976
|
+
console.log(` ${import_chalk7.default.blue("send-transaction")} Send a signed transaction`);
|
|
1977
|
+
console.log(` ${import_chalk7.default.blue("simulate-transaction")} Simulate transaction execution
|
|
1978
|
+
`);
|
|
1979
|
+
console.log(import_chalk7.default.dim(" Network Info & Fees:"));
|
|
1980
|
+
console.log(` ${import_chalk7.default.blue("is-blockhash-valid")} Check if blockhash is valid`);
|
|
1981
|
+
console.log(` ${import_chalk7.default.blue("get-fee-for-message")} Get fee for a message`);
|
|
1982
|
+
console.log(` ${import_chalk7.default.blue("get-recent-prioritization-fees")} Get recent priority fees`);
|
|
1983
|
+
console.log(` ${import_chalk7.default.blue("get-cluster-nodes")} Get cluster node information`);
|
|
1984
|
+
console.log(` ${import_chalk7.default.blue("get-recent-performance-samples")} Get performance samples`);
|
|
1985
|
+
console.log(` ${import_chalk7.default.blue("request-airdrop")} Request lamports airdrop`);
|
|
1986
|
+
console.log(` ${import_chalk7.default.blue("get-inflation-reward")} Get inflation rewards`);
|
|
1987
|
+
console.log(` ${import_chalk7.default.blue("get-stake-minimum-delegation")} Get min stake delegation
|
|
1988
|
+
`);
|
|
1989
|
+
console.log(import_chalk7.default.bold.magenta("\u{1F527} Testing & Development (22 commands):\n"));
|
|
1990
|
+
console.log(import_chalk7.default.dim(" Time Control:"));
|
|
1991
|
+
console.log(` ${import_chalk7.default.magenta("time-travel")} Time travel to epoch/slot/timestamp`);
|
|
1992
|
+
console.log(` ${import_chalk7.default.magenta("pause-clock")} Pause the network clock`);
|
|
1993
|
+
console.log(` ${import_chalk7.default.magenta("resume-clock")} Resume the network clock
|
|
1330
1994
|
`);
|
|
1331
|
-
console.log(
|
|
1332
|
-
console.log(
|
|
1333
|
-
console.log(` ${import_chalk2.default.blue("get-latest-blockhash")} Get the latest blockhash`);
|
|
1334
|
-
console.log(` ${import_chalk2.default.blue("get-block")} Get block information by slot`);
|
|
1335
|
-
console.log(` ${import_chalk2.default.blue("get-block-time")} Get block production time`);
|
|
1336
|
-
console.log(` ${import_chalk2.default.blue("get-blocks")} Get list of confirmed blocks`);
|
|
1337
|
-
console.log(` ${import_chalk2.default.blue("get-blocks-with-limit")} Get blocks with limit`);
|
|
1338
|
-
console.log(` ${import_chalk2.default.blue("get-first-available-block")} Get first available block`);
|
|
1339
|
-
console.log(` ${import_chalk2.default.blue("minimum-ledger-slot")} Get minimum ledger slot
|
|
1995
|
+
console.log(import_chalk7.default.bold.cyan("\u{1F4BB} Web Interface (1 command):\n"));
|
|
1996
|
+
console.log(` ${import_chalk7.default.cyan("ui")} Start Windows 95-style Web UI
|
|
1340
1997
|
`);
|
|
1341
|
-
console.log(
|
|
1342
|
-
console.log(` ${
|
|
1343
|
-
console.log(` ${
|
|
1344
|
-
console.log(` ${
|
|
1345
|
-
console.log(` ${
|
|
1346
|
-
console.log(` ${
|
|
1998
|
+
console.log(import_chalk7.default.dim(" Account Manipulation:"));
|
|
1999
|
+
console.log(` ${import_chalk7.default.magenta("set-account")} Modify account data/lamports/owner`);
|
|
2000
|
+
console.log(` ${import_chalk7.default.magenta("set-token-account")} Update token account properties`);
|
|
2001
|
+
console.log(` ${import_chalk7.default.magenta("reset-account")} Reset account to initial state`);
|
|
2002
|
+
console.log(` ${import_chalk7.default.magenta("stream-account")} Stream account from data source`);
|
|
2003
|
+
console.log(` ${import_chalk7.default.magenta("get-streamed-accounts")} Get all streamed accounts
|
|
1347
2004
|
`);
|
|
1348
|
-
console.log(
|
|
1349
|
-
console.log(` ${
|
|
1350
|
-
console.log(` ${
|
|
1351
|
-
console.log(` ${
|
|
1352
|
-
console.log(` ${import_chalk2.default.blue("get-cluster-nodes")} Get cluster node information`);
|
|
1353
|
-
console.log(` ${import_chalk2.default.blue("get-recent-performance-samples")} Get performance samples`);
|
|
1354
|
-
console.log(` ${import_chalk2.default.blue("request-airdrop")} Request lamports airdrop
|
|
2005
|
+
console.log(import_chalk7.default.dim(" Program Management:"));
|
|
2006
|
+
console.log(` ${import_chalk7.default.magenta("clone-program-account")} Clone program to another address`);
|
|
2007
|
+
console.log(` ${import_chalk7.default.magenta("set-program-authority")} Set/remove program authority`);
|
|
2008
|
+
console.log(` ${import_chalk7.default.magenta("write-program")} Write program data in chunks
|
|
1355
2009
|
`);
|
|
1356
|
-
console.log(
|
|
1357
|
-
console.log(
|
|
1358
|
-
console.log(` ${
|
|
1359
|
-
console.log(` ${
|
|
1360
|
-
console.log(` ${import_chalk2.default.magenta("resume-clock")} Resume the network clock
|
|
2010
|
+
console.log(import_chalk7.default.dim(" Transaction Profiling:"));
|
|
2011
|
+
console.log(` ${import_chalk7.default.magenta("profile-transaction")} Profile transaction compute units`);
|
|
2012
|
+
console.log(` ${import_chalk7.default.magenta("get-transaction-profile")} Get profile by signature/UUID`);
|
|
2013
|
+
console.log(` ${import_chalk7.default.magenta("get-profile-results-by-tag")} Get all profiles for a tag
|
|
1361
2014
|
`);
|
|
1362
|
-
console.log(
|
|
1363
|
-
console.log(` ${
|
|
1364
|
-
console.log(` ${
|
|
1365
|
-
console.log(` ${import_chalk2.default.magenta("reset-account")} Reset account to initial state
|
|
2015
|
+
console.log(import_chalk7.default.dim(" IDL Management:"));
|
|
2016
|
+
console.log(` ${import_chalk7.default.magenta("register-idl")} Register program IDL`);
|
|
2017
|
+
console.log(` ${import_chalk7.default.magenta("get-idl")} Get registered program IDL
|
|
1366
2018
|
`);
|
|
1367
|
-
console.log(
|
|
1368
|
-
console.log(` ${
|
|
1369
|
-
console.log(` ${
|
|
1370
|
-
console.log(` ${import_chalk2.default.magenta("set-program-authority")} Set/remove program authority
|
|
2019
|
+
console.log(import_chalk7.default.dim(" Snapshots & Scenarios:"));
|
|
2020
|
+
console.log(` ${import_chalk7.default.magenta("export-snapshot")} Export account snapshots`);
|
|
2021
|
+
console.log(` ${import_chalk7.default.magenta("register-scenario")} Register test scenarios
|
|
1371
2022
|
`);
|
|
1372
|
-
console.log(
|
|
1373
|
-
console.log(
|
|
1374
|
-
console.log(` ${
|
|
1375
|
-
console.log(` ${
|
|
1376
|
-
console.log(` ${
|
|
2023
|
+
console.log(import_chalk7.default.dim(" Network Management:"));
|
|
2024
|
+
console.log(` ${import_chalk7.default.magenta("reset-network")} Reset entire network state`);
|
|
2025
|
+
console.log(` ${import_chalk7.default.magenta("get-local-signatures")} Get recent local signatures`);
|
|
2026
|
+
console.log(` ${import_chalk7.default.magenta("set-supply")} Set network supply info`);
|
|
2027
|
+
console.log(` ${import_chalk7.default.magenta("get-surfnet-info")} Get Surfnet network info
|
|
1377
2028
|
`);
|
|
1378
|
-
console.log(
|
|
1379
|
-
console.log(
|
|
1380
|
-
console.log(` ${
|
|
1381
|
-
console.log(` ${
|
|
2029
|
+
console.log(import_chalk7.default.bold.green("\u{1F4CA} Scan & Analytics (6 commands):\n"));
|
|
2030
|
+
console.log(import_chalk7.default.dim(" Batch Queries:"));
|
|
2031
|
+
console.log(` ${import_chalk7.default.green("get-program-accounts")} Get all accounts owned by a program`);
|
|
2032
|
+
console.log(` ${import_chalk7.default.green("get-largest-accounts")} Get top 20 accounts by balance`);
|
|
2033
|
+
console.log(` ${import_chalk7.default.green("get-supply")} Get network supply information
|
|
1382
2034
|
`);
|
|
1383
|
-
console.log(
|
|
1384
|
-
console.log(`
|
|
1385
|
-
console.log(`
|
|
1386
|
-
console.log(`
|
|
1387
|
-
console.log(` Testing & Development: ${import_chalk2.default.magenta("9")}`);
|
|
1388
|
-
console.log(` Scan & Analytics: ${import_chalk2.default.green("6")}
|
|
2035
|
+
console.log(import_chalk7.default.dim(" Token Distribution:"));
|
|
2036
|
+
console.log(` ${import_chalk7.default.green("get-token-largest-accounts")} Get largest token holders`);
|
|
2037
|
+
console.log(` ${import_chalk7.default.green("get-token-accounts-by-owner")} Get token accounts by owner`);
|
|
2038
|
+
console.log(` ${import_chalk7.default.green("get-token-accounts-by-delegate")} Get delegated token accounts
|
|
1389
2039
|
`);
|
|
1390
|
-
console.log(
|
|
2040
|
+
console.log(import_chalk7.default.bold.cyan("\u{1F4CA} Summary:\n"));
|
|
2041
|
+
console.log(` Total Commands: ${import_chalk7.default.bold("56")}`);
|
|
2042
|
+
console.log(` Account Queries: ${import_chalk7.default.yellow("5")}`);
|
|
2043
|
+
console.log(` Network Operations: ${import_chalk7.default.blue("22")}`);
|
|
2044
|
+
console.log(` Testing & Development: ${import_chalk7.default.magenta("22")}`);
|
|
2045
|
+
console.log(` Scan & Analytics: ${import_chalk7.default.green("6")}`);
|
|
2046
|
+
console.log(` Web Interface: ${import_chalk7.default.cyan("1")}
|
|
2047
|
+
`);
|
|
2048
|
+
console.log(import_chalk7.default.gray("\u{1F4A1} Use ") + import_chalk7.default.cyan("surfman <command> --help") + import_chalk7.default.gray(" for detailed options\n"));
|
|
1391
2049
|
process.exit(0);
|
|
1392
2050
|
}
|
|
1393
2051
|
program.name("surfman").description("CLI tool for SurfPool RPC API interaction").version("0.1.0");
|
|
@@ -1396,100 +2054,117 @@ program.configureHelp({
|
|
|
1396
2054
|
const termWidth = helper.padWidth(cmd, helper);
|
|
1397
2055
|
const helpWidth = helper.helpWidth || 80;
|
|
1398
2056
|
let output = "";
|
|
1399
|
-
output +=
|
|
1400
|
-
output +=
|
|
1401
|
-
output +=
|
|
1402
|
-
output += ` $ surfman ${
|
|
2057
|
+
output += import_chalk7.default.bold.cyan("\n\u{1F30A} Surfman CLI\n\n");
|
|
2058
|
+
output += import_chalk7.default.gray("CLI tool for SurfPool RPC API interaction\n\n");
|
|
2059
|
+
output += import_chalk7.default.bold("Usage:\n");
|
|
2060
|
+
output += ` $ surfman ${import_chalk7.default.yellow("<command>")} ${import_chalk7.default.gray("[options]")}
|
|
1403
2061
|
|
|
1404
2062
|
`;
|
|
1405
|
-
output +=
|
|
1406
|
-
output += ` -V, --version ${
|
|
2063
|
+
output += import_chalk7.default.bold("Options:\n");
|
|
2064
|
+
output += ` -V, --version ${import_chalk7.default.gray("Output the version number")}
|
|
1407
2065
|
`;
|
|
1408
|
-
output += ` -h ${
|
|
2066
|
+
output += ` -h ${import_chalk7.default.gray("Display frequently used commands (quick view)")}
|
|
1409
2067
|
`;
|
|
1410
|
-
output += ` --help ${
|
|
2068
|
+
output += ` --help ${import_chalk7.default.gray("Display all commands grouped by module")}
|
|
1411
2069
|
|
|
1412
2070
|
`;
|
|
1413
|
-
output +=
|
|
1414
|
-
output += ` ${
|
|
2071
|
+
output += import_chalk7.default.bold.green("\u2B50 Frequently Used:\n");
|
|
2072
|
+
output += ` ${import_chalk7.default.cyan("get-account-info")} ${import_chalk7.default.gray("Get account information")}
|
|
1415
2073
|
`;
|
|
1416
|
-
output += ` ${
|
|
2074
|
+
output += ` ${import_chalk7.default.cyan("get-latest-blockhash")} ${import_chalk7.default.gray("Get latest blockhash")}
|
|
1417
2075
|
`;
|
|
1418
|
-
output += ` ${
|
|
2076
|
+
output += ` ${import_chalk7.default.cyan("send-transaction")} ${import_chalk7.default.gray("Send a transaction")}
|
|
1419
2077
|
`;
|
|
1420
|
-
output += ` ${
|
|
2078
|
+
output += ` ${import_chalk7.default.cyan("request-airdrop")} ${import_chalk7.default.gray("Request SOL airdrop")}
|
|
1421
2079
|
`;
|
|
1422
|
-
output += ` ${
|
|
2080
|
+
output += ` ${import_chalk7.default.cyan("time-travel")} ${import_chalk7.default.gray("Time travel for testing")}
|
|
1423
2081
|
|
|
1424
2082
|
`;
|
|
1425
|
-
output +=
|
|
1426
|
-
output += ` ${
|
|
2083
|
+
output += import_chalk7.default.bold.yellow("\u{1F4E6} Account Queries:\n");
|
|
2084
|
+
output += ` ${import_chalk7.default.yellow("get-account-info")} Get detailed account information
|
|
1427
2085
|
`;
|
|
1428
|
-
output += ` ${
|
|
2086
|
+
output += ` ${import_chalk7.default.yellow("get-multiple-accounts")} Batch query multiple accounts
|
|
1429
2087
|
`;
|
|
1430
|
-
output += ` ${
|
|
2088
|
+
output += ` ${import_chalk7.default.yellow("get-token-account-balance")} Get token account balance
|
|
1431
2089
|
`;
|
|
1432
|
-
output += ` ${
|
|
2090
|
+
output += ` ${import_chalk7.default.yellow("get-token-supply")} Get total token supply
|
|
1433
2091
|
`;
|
|
1434
|
-
output += ` ${
|
|
2092
|
+
output += ` ${import_chalk7.default.yellow("get-block-commitment")} Get block commitment data
|
|
1435
2093
|
|
|
1436
2094
|
`;
|
|
1437
|
-
output +=
|
|
1438
|
-
output += ` ${
|
|
2095
|
+
output += import_chalk7.default.bold.blue("\u{1F310} Network Operations:\n");
|
|
2096
|
+
output += ` ${import_chalk7.default.blue("get-latest-blockhash")} Get the latest blockhash
|
|
1439
2097
|
`;
|
|
1440
|
-
output += ` ${
|
|
2098
|
+
output += ` ${import_chalk7.default.blue("get-block")} Get block by slot
|
|
1441
2099
|
`;
|
|
1442
|
-
output += ` ${
|
|
2100
|
+
output += ` ${import_chalk7.default.blue("get-transaction")} Get transaction details
|
|
1443
2101
|
`;
|
|
1444
|
-
output += ` ${
|
|
2102
|
+
output += ` ${import_chalk7.default.blue("send-transaction")} Send a signed transaction
|
|
1445
2103
|
`;
|
|
1446
|
-
output += ` ${
|
|
2104
|
+
output += ` ${import_chalk7.default.blue("simulate-transaction")} Simulate transaction execution
|
|
1447
2105
|
`;
|
|
1448
|
-
output += ` ${
|
|
2106
|
+
output += ` ${import_chalk7.default.blue("get-signatures-for-address")} Get address transaction history
|
|
1449
2107
|
`;
|
|
1450
|
-
output += ` ${
|
|
2108
|
+
output += ` ${import_chalk7.default.blue("request-airdrop")} Request lamports airdrop
|
|
1451
2109
|
`;
|
|
1452
|
-
output += ` ${
|
|
2110
|
+
output += ` ${import_chalk7.default.blue("get-cluster-nodes")} Get cluster node info
|
|
1453
2111
|
|
|
1454
2112
|
`;
|
|
1455
|
-
output +=
|
|
1456
|
-
output += ` ${
|
|
2113
|
+
output += import_chalk7.default.bold.magenta("\u{1F527} Testing & Development(Cheatcodes):\n");
|
|
2114
|
+
output += ` ${import_chalk7.default.magenta("time-travel")} Time travel to epoch/slot
|
|
2115
|
+
`;
|
|
2116
|
+
output += ` ${import_chalk7.default.magenta("pause-clock")} Pause network clock
|
|
1457
2117
|
`;
|
|
1458
|
-
output += ` ${
|
|
2118
|
+
output += ` ${import_chalk7.default.magenta("resume-clock")} Resume network clock
|
|
1459
2119
|
`;
|
|
1460
|
-
output += ` ${
|
|
2120
|
+
output += ` ${import_chalk7.default.magenta("set-account")} Modify account data
|
|
1461
2121
|
`;
|
|
1462
|
-
output += ` ${
|
|
2122
|
+
output += ` ${import_chalk7.default.magenta("set-token-account")} Update token account
|
|
1463
2123
|
`;
|
|
1464
|
-
output += ` ${
|
|
2124
|
+
output += ` ${import_chalk7.default.magenta("reset-account")} Reset account state
|
|
1465
2125
|
`;
|
|
1466
|
-
output += ` ${
|
|
2126
|
+
output += ` ${import_chalk7.default.magenta("reset-network")} Reset entire network
|
|
1467
2127
|
`;
|
|
1468
|
-
output += ` ${
|
|
2128
|
+
output += ` ${import_chalk7.default.magenta("set-program-authority")} Set program authority
|
|
2129
|
+
|
|
1469
2130
|
`;
|
|
1470
|
-
output +=
|
|
2131
|
+
output += import_chalk7.default.bold.cyan("\u{1F4BB} Web Interface:\n");
|
|
2132
|
+
output += ` ${import_chalk7.default.cyan("ui")} Start Windows 95-style Web UI
|
|
1471
2133
|
|
|
1472
2134
|
`;
|
|
1473
|
-
output +=
|
|
1474
|
-
output +=
|
|
1475
|
-
output +=
|
|
1476
|
-
output +=
|
|
1477
|
-
output +=
|
|
1478
|
-
output +=
|
|
1479
|
-
output +=
|
|
1480
|
-
output +=
|
|
2135
|
+
output += import_chalk7.default.bold.gray("\u{1F4CB} Additional Commands:\n");
|
|
2136
|
+
output += import_chalk7.default.gray(" get-blocks, get-block-time, is-blockhash-valid,\n");
|
|
2137
|
+
output += import_chalk7.default.gray(" get-fee-for-message, get-signature-statuses,\n");
|
|
2138
|
+
output += import_chalk7.default.gray(" get-recent-prioritization-fees, and more...\n\n");
|
|
2139
|
+
output += import_chalk7.default.gray("\u{1F4A1} Tips:\n");
|
|
2140
|
+
output += import_chalk7.default.gray(" Use ") + import_chalk7.default.cyan("surfman --help") + import_chalk7.default.gray(" to see all 56 commands grouped by module\n");
|
|
2141
|
+
output += import_chalk7.default.gray(" Use ") + import_chalk7.default.cyan("surfman <command> --help") + import_chalk7.default.gray(" for detailed command options\n");
|
|
2142
|
+
output += import_chalk7.default.gray("\u{1F4D6} Documentation: ") + import_chalk7.default.cyan("https://github.com/ennea8/surfman\n");
|
|
1481
2143
|
return output;
|
|
1482
2144
|
}
|
|
1483
2145
|
});
|
|
1484
2146
|
program.addCommand(createTimeTravelCommand());
|
|
1485
|
-
program.addCommand(createSetAccountCommand());
|
|
1486
|
-
program.addCommand(createSetProgramAuthorityCommand());
|
|
1487
2147
|
program.addCommand(createPauseClockCommand());
|
|
1488
2148
|
program.addCommand(createResumeClockCommand());
|
|
1489
|
-
program.addCommand(
|
|
2149
|
+
program.addCommand(createSetAccountCommand());
|
|
1490
2150
|
program.addCommand(createSetTokenAccountCommand());
|
|
1491
2151
|
program.addCommand(createResetAccountCommand());
|
|
2152
|
+
program.addCommand(createStreamAccountCommand());
|
|
2153
|
+
program.addCommand(createGetStreamedAccountsCommand());
|
|
2154
|
+
program.addCommand(createCloneProgramAccountCommand());
|
|
2155
|
+
program.addCommand(createSetProgramAuthorityCommand());
|
|
2156
|
+
program.addCommand(createWriteProgramCommand());
|
|
2157
|
+
program.addCommand(createProfileTransactionCommand());
|
|
2158
|
+
program.addCommand(createGetTransactionProfileCommand());
|
|
2159
|
+
program.addCommand(createGetProfileResultsByTagCommand());
|
|
2160
|
+
program.addCommand(createRegisterIdlCommand());
|
|
2161
|
+
program.addCommand(createGetIdlCommand());
|
|
2162
|
+
program.addCommand(createExportSnapshotCommand());
|
|
2163
|
+
program.addCommand(createRegisterScenarioCommand());
|
|
1492
2164
|
program.addCommand(createResetNetworkCommand());
|
|
2165
|
+
program.addCommand(createGetLocalSignaturesCommand());
|
|
2166
|
+
program.addCommand(createSetSupplyCommand());
|
|
2167
|
+
program.addCommand(createGetSurfnetInfoCommand());
|
|
1493
2168
|
program.addCommand(createGetLatestBlockhashCommand());
|
|
1494
2169
|
program.addCommand(createGetBlockCommand());
|
|
1495
2170
|
program.addCommand(createGetTransactionCommand());
|
|
@@ -1508,6 +2183,10 @@ program.addCommand(createMinimumLedgerSlotCommand());
|
|
|
1508
2183
|
program.addCommand(createGetSignatureStatusesCommand());
|
|
1509
2184
|
program.addCommand(createSimulateTransactionCommand());
|
|
1510
2185
|
program.addCommand(createGetRecentPerformanceSamplesCommand());
|
|
2186
|
+
program.addCommand(createGetInflationRewardCommand());
|
|
2187
|
+
program.addCommand(createGetMaxRetransmitSlotCommand());
|
|
2188
|
+
program.addCommand(createGetMaxShredInsertSlotCommand());
|
|
2189
|
+
program.addCommand(createGetStakeMinimumDelegationCommand());
|
|
1511
2190
|
program.addCommand(createGetAccountInfoCommand());
|
|
1512
2191
|
program.addCommand(createGetMultipleAccountsCommand());
|
|
1513
2192
|
program.addCommand(createGetBlockCommitmentCommand());
|
|
@@ -1519,5 +2198,6 @@ program.addCommand(createGetSupplyCommand());
|
|
|
1519
2198
|
program.addCommand(createGetTokenLargestAccountsCommand());
|
|
1520
2199
|
program.addCommand(createGetTokenAccountsByOwnerCommand());
|
|
1521
2200
|
program.addCommand(createGetTokenAccountsByDelegateCommand());
|
|
2201
|
+
program.addCommand(createUiCommand());
|
|
1522
2202
|
program.parse();
|
|
1523
2203
|
//# sourceMappingURL=index.js.map
|