-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(accounts): make x/accounts more depinject friendly (#21928)
- Loading branch information
1 parent
7c6e038
commit 7ce403f
Showing
21 changed files
with
251 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package basedepinject | ||
|
||
import ( | ||
"cosmossdk.io/depinject" | ||
"cosmossdk.io/x/accounts/accountstd" | ||
"cosmossdk.io/x/accounts/defaults/base" | ||
"cosmossdk.io/x/tx/signing" | ||
) | ||
|
||
type Inputs struct { | ||
depinject.In | ||
|
||
SignHandlersMap *signing.HandlerMap | ||
Options []base.Option | ||
} | ||
|
||
func ProvideAccount(in Inputs) accountstd.DepinjectAccount { | ||
return accountstd.DepinjectAccount{MakeAccount: base.NewAccount("base", in.SignHandlersMap, in.Options...)} | ||
} | ||
|
||
func ProvideSecp256K1PubKey() base.Option { | ||
return base.WithSecp256K1PubKey() | ||
} | ||
|
||
func ProvideCustomPubkey[T any, PT base.PubKeyG[T]]() base.Option { | ||
return base.WithPubKey[T, PT]() | ||
} | ||
|
||
func ProvideCustomPubKeyAndValidationFunc[T any, PT base.PubKeyG[T]](validateFn func(PT) error) base.Option { | ||
return base.WithPubKeyWithValidationFunc(validateFn) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package lockupdepinject | ||
|
||
import ( | ||
"cosmossdk.io/x/accounts/accountstd" | ||
"cosmossdk.io/x/accounts/defaults/lockup" | ||
) | ||
|
||
func ProvideAllLockupAccounts() []accountstd.DepinjectAccount { | ||
return []accountstd.DepinjectAccount{ | ||
ProvidePeriodicLockingAccount(), | ||
ProvideContinuousLockingAccount(), | ||
ProvidePermanentLockingAccount(), | ||
ProvideDelayedLockingAccount(), | ||
} | ||
} | ||
|
||
func ProvideContinuousLockingAccount() accountstd.DepinjectAccount { | ||
return accountstd.DIAccount(lockup.CONTINUOUS_LOCKING_ACCOUNT, lockup.NewContinuousLockingAccount) | ||
} | ||
|
||
func ProvidePeriodicLockingAccount() accountstd.DepinjectAccount { | ||
return accountstd.DIAccount(lockup.PERIODIC_LOCKING_ACCOUNT, lockup.NewPeriodicLockingAccount) | ||
} | ||
|
||
func ProvideDelayedLockingAccount() accountstd.DepinjectAccount { | ||
return accountstd.DIAccount(lockup.DELAYED_LOCKING_ACCOUNT, lockup.NewDelayedLockingAccount) | ||
} | ||
|
||
func ProvidePermanentLockingAccount() accountstd.DepinjectAccount { | ||
return accountstd.DIAccount(lockup.PERMANENT_LOCKING_ACCOUNT, lockup.NewPermanentLockingAccount) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.