From 04e57f8179a3d9627426adbe5066faea18c37317 Mon Sep 17 00:00:00 2001 From: Louis Singer <41042567+louisinger@users.noreply.github.com> Date: Thu, 31 Oct 2024 18:01:19 +0100 Subject: [PATCH] [CLI] Add --rest optional flag to init command (#363) --- client/main.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/client/main.go b/client/main.go index fdc2eb19..eb152f45 100644 --- a/client/main.go +++ b/client/main.go @@ -127,6 +127,12 @@ var ( Name: "force", Usage: "force redemption without collaboration", } + restFlag = &cli.BoolFlag{ + Name: "rest", + Usage: "use REST client instead of gRPC", + Value: false, + DefaultText: "false", + } ) var ( @@ -136,7 +142,7 @@ var ( Action: func(ctx *cli.Context) error { return initArkSdk(ctx) }, - Flags: []cli.Flag{networkFlag, passwordFlag, privateKeyFlag, urlFlag, explorerFlag}, + Flags: []cli.Flag{networkFlag, passwordFlag, privateKeyFlag, urlFlag, explorerFlag, restFlag}, } configCommand = cli.Command{ Name: "config", @@ -200,9 +206,14 @@ func initArkSdk(ctx *cli.Context) error { return err } + clientType := arksdk.GrpcClient + if ctx.Bool(restFlag.Name) { + clientType = arksdk.RestClient + } + return arkSdkClient.Init( ctx.Context, arksdk.InitArgs{ - ClientType: arksdk.GrpcClient, + ClientType: clientType, WalletType: arksdk.SingleKeyWallet, AspUrl: ctx.String(urlFlag.Name), Seed: ctx.String(privateKeyFlag.Name),