Skip to content

Commit 50cfb19

Browse files
feat: add changeset ty type
1 parent 08b827c commit 50cfb19

File tree

16 files changed

+131
-17
lines changed

16 files changed

+131
-17
lines changed

cmd/account/link_key/link_key.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func New(runtimeContext *runtime.Context) *cobra.Command {
8484
return h.Execute(inputs)
8585
},
8686
}
87-
settings.AddRawTxFlag(cmd)
87+
settings.AddTxnTypeFlags(cmd)
8888
settings.AddSkipConfirmation(cmd)
8989
cmd.Flags().StringP("owner-label", "l", "", "Label for the workflow owner")
9090

@@ -327,6 +327,11 @@ func (h *handler) linkOwner(resp initiateLinkingResponse) error {
327327
fmt.Println("")
328328
fmt.Printf(" %x\n", txOut.RawTx.Data)
329329
fmt.Println("")
330+
331+
case client.Changeset:
332+
// TODO: implement changeset handling
333+
fmt.Println("Changeset output type is not yet implemented")
334+
330335
default:
331336
h.log.Warn().Msgf("Unsupported transaction type: %s", txOut.Type)
332337
}

cmd/account/unlink_key/unlink_key.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func New(runtimeContext *runtime.Context) *cobra.Command {
8383
return h.Execute(in)
8484
},
8585
}
86-
settings.AddRawTxFlag(cmd)
86+
settings.AddTxnTypeFlags(cmd)
8787
settings.AddSkipConfirmation(cmd)
8888
return cmd
8989
}
@@ -285,6 +285,11 @@ func (h *handler) unlinkOwner(owner string, resp initiateUnlinkingResponse) erro
285285
fmt.Println("")
286286
fmt.Printf(" %s\n", resp.TransactionData)
287287
fmt.Println("")
288+
289+
case client.Changeset:
290+
// TODO: implement changeset handling
291+
fmt.Println("Changeset output type is not yet implemented")
292+
288293
default:
289294
h.log.Warn().Msgf("Unsupported transaction type: %s", txOut.Type)
290295
}

cmd/client/client_factory.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ func (f *factoryImpl) GetTxType() TxType {
8888
return Raw
8989
} else if f.viper.GetBool(settings.Flags.Ledger.Name) {
9090
return Ledger
91+
} else if f.viper.GetBool(settings.Flags.Changeset.Name) {
92+
return Changeset
9193
}
9294
return Regular
9395
}

cmd/client/tx.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const (
3131
Regular TxType = iota
3232
Raw
3333
Ledger
34+
Changeset
3435
)
3536

3637
type TxClientConfig struct {
@@ -223,6 +224,20 @@ func (c *TxClient) executeTransactionByTxType(txFn func(opts *bind.TransactOpts)
223224
Args: cmdCommon.ToStringSlice(args),
224225
},
225226
}, nil
227+
case Changeset:
228+
tx, err := txFn(cmdCommon.SimTransactOpts())
229+
if err != nil {
230+
return TxOutput{Type: Changeset}, err
231+
}
232+
return TxOutput{
233+
Type: Changeset,
234+
RawTx: RawTx{
235+
To: tx.To().Hex(),
236+
Data: []byte{},
237+
Function: funName,
238+
Args: cmdCommon.ToStringSlice(args),
239+
},
240+
}, nil
226241
//case Ledger:
227242
// txOpts, err := c.ledgerOpts(c.ledgerConfig)
228243
// if err != nil {

cmd/secrets/common/handler.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ func (h *Handler) ValidateInputs(inputs UpsertSecretsInputs) error {
173173
}
174174

175175
// TODO: use TxType interface
176+
// TODO: implement changeset handling
176177
func (h *Handler) PackAllowlistRequestTxData(reqDigest [32]byte, duration time.Duration) (string, error) {
177178
contractABI, err := abi.JSON(strings.NewReader(workflow_registry_wrapper_v2.WorkflowRegistryMetaData.ABI))
178179
if err != nil {

cmd/secrets/create/create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,6 @@ func New(ctx *runtime.Context) *cobra.Command {
5858
},
5959
}
6060

61-
settings.AddRawTxFlag(cmd)
61+
settings.AddTxnTypeFlags(cmd)
6262
return cmd
6363
}

cmd/secrets/delete/delete.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func New(ctx *runtime.Context) *cobra.Command {
8888
},
8989
}
9090

91-
settings.AddRawTxFlag(cmd)
91+
settings.AddTxnTypeFlags(cmd)
9292
return cmd
9393
}
9494

cmd/secrets/execute/execute.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func New(ctx *runtime.Context) *cobra.Command {
8989
},
9090
}
9191

92-
settings.AddRawTxFlag(cmd)
92+
settings.AddTxnTypeFlags(cmd)
9393

9494
return cmd
9595
}

cmd/secrets/list/list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func New(ctx *runtime.Context) *cobra.Command {
6464
}
6565

6666
cmd.Flags().StringVar(&namespace, "namespace", "main", "Namespace to list (default: main)")
67-
settings.AddRawTxFlag(cmd)
67+
settings.AddTxnTypeFlags(cmd)
6868

6969
return cmd
7070
}

cmd/secrets/update/update.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func New(ctx *runtime.Context) *cobra.Command {
6464
},
6565
}
6666

67-
settings.AddRawTxFlag(cmd)
67+
settings.AddTxnTypeFlags(cmd)
6868

6969
return cmd
7070
}

0 commit comments

Comments
 (0)