-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
75ff1da
commit 3eb3d32
Showing
4 changed files
with
66 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"encoding/json" | ||
"fmt" | ||
"os" | ||
"strings" | ||
|
||
"github.com/MixinNetwork/bot-api-go-client/v3" | ||
"github.com/urfave/cli/v2" | ||
) | ||
|
||
var requestDepositEntryCmdCli = &cli.Command{ | ||
Name: "requestdepositentry", | ||
Action: requestDepositEntry, | ||
Flags: []cli.Flag{ | ||
&cli.StringFlag{ | ||
Name: "keystore,k", | ||
Usage: "keystore download from https://developers.mixin.one/dashboard", | ||
}, | ||
&cli.StringFlag{ | ||
Name: "chain", | ||
Usage: "the chain id", | ||
}, | ||
&cli.StringFlag{ | ||
Name: "members", | ||
Usage: "comma separated UUIDs", | ||
}, | ||
&cli.Int64Flag{ | ||
Name: "threshold", | ||
Usage: "the members threshold", | ||
}, | ||
}, | ||
} | ||
|
||
func requestDepositEntry(c *cli.Context) error { | ||
ctx := context.Background() | ||
|
||
dat, err := os.ReadFile(c.String("keystore")) | ||
if err != nil { | ||
panic(err) | ||
} | ||
var su bot.SafeUser | ||
err = json.Unmarshal([]byte(dat), &su) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
members := strings.Split(c.String("members"), ",") | ||
entries, err := bot.CreateDepositEntry(ctx, c.String("chain"), members, c.Int64("threshold"), &su) | ||
if err != nil { | ||
return err | ||
} | ||
fmt.Println(entries[0]) | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters