@@ -30,11 +30,11 @@ func unwrapExchangeConfig(ctx context.Context) *oc.ExchangeConfig {
3030 return ctx .Value (exchangeConfigKey ).(* oc.ExchangeConfig )
3131}
3232
33- func unwrapAccountSecrets (ctx context.Context ) * oc.MultiSecret {
34- return ctx .Value (exchangeAccountSecretsKey ).(* oc.MultiSecret )
33+ func unwrapAccountSecrets (ctx context.Context ) * oc.Account {
34+ return ctx .Value (exchangeAccountSecretsKey ).(* oc.Account )
3535}
3636
37- func unwrapAccountConfig (ctx context.Context ) (* oc.ExchangeConfig , * oc.MultiSecret ) {
37+ func unwrapAccountConfig (ctx context.Context ) (* oc.ExchangeConfig , * oc.Account ) {
3838 exchangeConfig := unwrapExchangeConfig (ctx )
3939 secrets := unwrapAccountSecrets (ctx )
4040 return exchangeConfig , secrets
@@ -66,31 +66,31 @@ func NewExchangeCmd() *cobra.Command {
6666 }
6767 slog .Info ("Using exchange" , "exchange" , exchange )
6868 ctx = context .WithValue (ctx , exchangeConfigKey , exchangeConfig )
69- var secrets * oc.MultiSecret
69+ var account * oc.Account
7070
7171 if subaccountId != "" {
7272 for _ , subaccount := range exchangeConfig .SubAccounts {
7373 if string (subaccount .Id ) == subaccountId || subaccount .Alias == subaccountId {
74- secrets = & subaccount .MultiSecret
74+ account = subaccount .AsAccount ()
7575 }
7676 }
77- if secrets == nil {
77+ if account == nil {
7878 return fmt .Errorf ("subaccount %s not found in configuration for %s" , subaccountId , exchange )
7979 }
80- err = secrets .LoadSecrets ()
80+ err = account .LoadSecrets ()
8181 if err != nil {
8282 return fmt .Errorf ("could not load secrets for %s subaccount %s: %w" , exchange , subaccountId , err )
8383 }
8484 } else {
85- secrets = & exchangeConfig .MultiSecret
86- err = secrets .LoadSecrets ()
85+ account = exchangeConfig .AsAccount ()
86+ err = account .LoadSecrets ()
8787 if err != nil {
8888 return fmt .Errorf ("could not load secrets for %s: %w" , exchange , err )
8989 }
9090 }
9191
9292 ctx = context .WithValue (ctx , configContextKey , config )
93- ctx = context .WithValue (ctx , exchangeAccountSecretsKey , secrets )
93+ ctx = context .WithValue (ctx , exchangeAccountSecretsKey , account )
9494 preCmd .SetContext (ctx )
9595
9696 return nil
0 commit comments