Skip to content

Commit 0530014

Browse files
committed
feat: Add support for --depositor-account in deployment creation
1 parent bc0e592 commit 0530014

File tree

4 files changed

+38
-21
lines changed

4 files changed

+38
-21
lines changed

akash/client/cli/cli.go

+4
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ func (c AkashCommand) SetNote(note string) AkashCommand {
192192
return c.append(fmt.Sprintf("--note=\"%s\"", note))
193193
}
194194

195+
func (c AkashCommand) SetDepositorAccount(account string) AkashCommand {
196+
return c.append("--depositor-account").append(account)
197+
}
198+
195199
func (c AkashCommand) SetSignMode(mode string) AkashCommand {
196200
if !envExists("AKASH_SIGN_MODE") {
197201
supportedModes := map[string]bool{

akash/client/client.go

+11-10
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,17 @@ type AkashClient struct {
1717
}
1818

1919
type AkashProviderConfiguration struct {
20-
KeyName string
21-
KeyringBackend string
22-
AccountAddress string
23-
Net string
24-
Version string
25-
ChainId string
26-
Node string
27-
Home string
28-
Path string
29-
ProvidersApi string
20+
KeyName string
21+
KeyringBackend string
22+
AccountAddress string
23+
Net string
24+
Version string
25+
ChainId string
26+
Node string
27+
Home string
28+
Path string
29+
ProvidersApi string
30+
DepositorAccount string
3031
}
3132

3233
func (ak *AkashClient) GetContext() context.Context {

akash/client/deployment.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,13 @@ func transactionCreateDeployment(ak *AkashClient, manifestLocation string) (type
5858
SetKeyringBackend(ak.Config.KeyringBackend).
5959
SetChainId(ak.Config.ChainId).
6060
SetNode(ak.Config.Node).
61-
SetNote(ak.transactionNote).OutputJson()
61+
SetNote(ak.transactionNote)
62+
63+
if ak.Config.DepositorAccount != "" {
64+
cmd = cmd.SetDepositorAccount(ak.Config.DepositorAccount)
65+
}
66+
67+
cmd = cmd.OutputJson()
6268

6369
var transaction types.Transaction
6470

akash/provider.go

+16-10
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ func Provider() *schema.Provider {
7878
Optional: true,
7979
DefaultFunc: schema.EnvDefaultFunc("PROVIDERS_API", "http://providers-api.quasarch.cloud"),
8080
},
81+
"depositor_account": {
82+
Type: schema.TypeString,
83+
Optional: true,
84+
DefaultFunc: schema.EnvDefaultFunc("AKASH_DEPOSITOR_ACCOUNT", ""),
85+
},
8186
},
8287
ResourcesMap: map[string]*schema.Resource{
8388
"akash_deployment": resourceDeployment(),
@@ -114,16 +119,17 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData) (interface{}
114119
}
115120

116121
configuration := client.AkashProviderConfiguration{
117-
KeyName: config[KeyName],
118-
KeyringBackend: config[KeyringBackend],
119-
AccountAddress: config[AccountAddress],
120-
Net: config[Net],
121-
Version: config[ChainVersion],
122-
ChainId: config[ChainId],
123-
Node: config[Node],
124-
Home: config[Home],
125-
Path: config[Path],
126-
ProvidersApi: config[ProvidersApi],
122+
KeyName: config[KeyName],
123+
KeyringBackend: config[KeyringBackend],
124+
AccountAddress: config[AccountAddress],
125+
Net: config[Net],
126+
Version: config[ChainVersion],
127+
ChainId: config[ChainId],
128+
Node: config[Node],
129+
Home: config[Home],
130+
Path: config[Path],
131+
ProvidersApi: config[ProvidersApi],
132+
DepositorAccount: d.Get("depositor_account").(string),
127133
}
128134

129135
tflog.Debug(ctx, fmt.Sprintf("Starting provider with %+v", configuration))

0 commit comments

Comments
 (0)