MCPcopy Create free account
hub / github.com/Sifchain/sifnode / GetForceCloseCmd

Function GetForceCloseCmd

x/margin/client/cli/tx.go:145–185  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

143}
144
145func GetForceCloseCmd() *cobra.Command {
146 cmd := &cobra.Command{
147 Use: "force-close",
148 Short: "Force close margin position",
149 RunE: func(cmd *cobra.Command, args []string) error {
150 clientCtx, err := client.GetClientTxContext(cmd)
151 if err != nil {
152 return err
153 }
154
155 signer := clientCtx.GetFromAddress()
156 if signer == nil {
157 return errors.New("signer address is missing")
158 }
159
160 MtpAddress, err := cmd.Flags().GetString("mtp_address")
161 if err != nil {
162 return err
163 }
164
165 id, err := cmd.Flags().GetUint64("id")
166 if err != nil {
167 return err
168 }
169
170 msg := types.MsgForceClose{
171 Signer: signer.String(),
172 MtpAddress: MtpAddress,
173 Id: id,
174 }
175
176 return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg)
177 },
178 }
179 cmd.Flags().String("mtp_address", "", "mtp address")
180 cmd.Flags().Uint64("id", 0, "id of the position")
181 _ = cmd.MarkFlagRequired("mtp_address")
182 _ = cmd.MarkFlagRequired("id")
183 flags.AddTxFlagsToCmd(cmd)
184 return cmd
185}
186
187func GetUpdateParamsCmd() *cobra.Command {
188 cmd := &cobra.Command{

Callers 1

GetTxCmdFunction · 0.85

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected