Skip to content

Commit 5014334

Browse files
committed
get snapshot cli
1 parent a694333 commit 5014334

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

cli/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ func main() {
2323
botMigrateTIPCmdCli,
2424
registerSafeCMDCli,
2525
safeSnapshotsCmdCli,
26+
safeSnapshotCmdCli,
2627
safeOutputsCmdCli,
2728
safeOutputCmdCli,
2829
safeMultisigRequestCmdCli,

cli/snapshot.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,38 @@ func safeSnapshotsCmd(c *cli.Context) error {
3939
}
4040
return nil
4141
}
42+
43+
var safeSnapshotCmdCli = &cli.Command{
44+
Name: "safe_snapshot",
45+
Action: safeSnapshotCmd,
46+
Flags: []cli.Flag{
47+
&cli.StringFlag{
48+
Name: "keystore,k",
49+
Usage: "keystore download from https://developers.mixin.one/dashboard",
50+
},
51+
&cli.StringFlag{
52+
Name: "spend,s",
53+
Usage: "spend",
54+
},
55+
&cli.StringFlag{
56+
Name: "id",
57+
Usage: "id",
58+
},
59+
},
60+
}
61+
62+
func safeSnapshotCmd(c *cli.Context) error {
63+
keystore := c.String("keystore")
64+
spend := c.String("spend")
65+
id := c.String("id")
66+
67+
su := loadKeystore(keystore)
68+
su.SpendPrivateKey = spend
69+
70+
snapshot, err := bot.SafeSnapshotById(context.Background(), id, su)
71+
if err != nil {
72+
panic(err)
73+
}
74+
log.Printf("snapshot %#v", snapshot)
75+
return nil
76+
}

0 commit comments

Comments
 (0)