@agoric/cosmos 0.32.3-dev-5052aab.0 → 0.32.3-dev-463e8d4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/cosmos",
|
|
3
|
-
"version": "0.32.3-dev-
|
|
3
|
+
"version": "0.32.3-dev-463e8d4.0+463e8d4",
|
|
4
4
|
"description": "Connect JS to the Cosmos blockchain SDK",
|
|
5
5
|
"parsers": {
|
|
6
6
|
"js": "mjs"
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "463e8d4c475fa41fea9624b94050287130e27030"
|
|
51
51
|
}
|
package/x/vbank/keeper/keeper.go
CHANGED
|
@@ -80,7 +80,11 @@ func (k Keeper) GrabCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) e
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
func (k Keeper) GetModuleAccountAddress(ctx sdk.Context, name string) sdk.AccAddress {
|
|
83
|
-
|
|
83
|
+
acct := k.accountKeeper.GetModuleAccount(ctx, name)
|
|
84
|
+
if acct == nil {
|
|
85
|
+
return nil
|
|
86
|
+
}
|
|
87
|
+
return acct.GetAddress()
|
|
84
88
|
}
|
|
85
89
|
|
|
86
90
|
func (k Keeper) IsModuleAccount(ctx sdk.Context, addr sdk.AccAddress) bool {
|
|
@@ -17,6 +17,6 @@ type BankKeeper interface {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
type AccountKeeper interface {
|
|
20
|
-
|
|
20
|
+
GetModuleAccount(ctx sdk.Context, name string) authtypes.ModuleAccountI
|
|
21
21
|
GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI
|
|
22
22
|
}
|
package/x/vbank/vbank_test.go
CHANGED
|
@@ -517,9 +517,9 @@ func Test_EndBlock_Events(t *testing.T) {
|
|
|
517
517
|
}}
|
|
518
518
|
acct := &mockAuthKeeper{
|
|
519
519
|
accounts: map[string]authtypes.AccountI{
|
|
520
|
-
addr1: &authtypes.ModuleAccount{BaseAccount: &authtypes.BaseAccount{}},
|
|
521
|
-
addr2: &authtypes.ModuleAccount{BaseAccount: &authtypes.BaseAccount{}},
|
|
522
|
-
addr3: &authtypes.BaseAccount{},
|
|
520
|
+
addr1: &authtypes.ModuleAccount{BaseAccount: &authtypes.BaseAccount{ Address: addr1 }},
|
|
521
|
+
addr2: &authtypes.ModuleAccount{BaseAccount: &authtypes.BaseAccount{ Address: addr2 }},
|
|
522
|
+
addr3: &authtypes.BaseAccount{ Address: addr3 },
|
|
523
523
|
},
|
|
524
524
|
}
|
|
525
525
|
keeper, ctx := makeTestKit(acct, bank)
|
|
@@ -748,10 +748,19 @@ func Test_EndBlock_Rewards(t *testing.T) {
|
|
|
748
748
|
|
|
749
749
|
type mockAuthKeeper struct{
|
|
750
750
|
accounts map[string]authtypes.AccountI
|
|
751
|
+
modAddrs map[string]string
|
|
751
752
|
}
|
|
752
753
|
|
|
753
|
-
func (ma mockAuthKeeper)
|
|
754
|
-
|
|
754
|
+
func (ma mockAuthKeeper) GetModuleAccount(ctx sdk.Context, name string) authtypes.ModuleAccountI {
|
|
755
|
+
addr, ok := ma.modAddrs[name]
|
|
756
|
+
if !ok {
|
|
757
|
+
return nil
|
|
758
|
+
}
|
|
759
|
+
acct, ok := ma.accounts[addr]
|
|
760
|
+
if !ok {
|
|
761
|
+
panic("missing module account")
|
|
762
|
+
}
|
|
763
|
+
return acct.(authtypes.ModuleAccountI)
|
|
755
764
|
}
|
|
756
765
|
|
|
757
766
|
func (ma mockAuthKeeper) GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI {
|
|
@@ -760,7 +769,7 @@ func (ma mockAuthKeeper) GetAccount(ctx sdk.Context, addr sdk.AccAddress) authty
|
|
|
760
769
|
}
|
|
761
770
|
|
|
762
771
|
func Test_Module_Account(t *testing.T) {
|
|
763
|
-
moduleBech32 := "
|
|
772
|
+
moduleBech32 := "cosmos1ae0lmtzlgrcnla9xjkpaarq5d5dfez639v3rgf"
|
|
764
773
|
moduleJson, err := json.Marshal(moduleBech32)
|
|
765
774
|
if err != nil {
|
|
766
775
|
t.Fatalf("got error = %v", err)
|
|
@@ -768,11 +777,11 @@ func Test_Module_Account(t *testing.T) {
|
|
|
768
777
|
|
|
769
778
|
acct := &mockAuthKeeper{
|
|
770
779
|
accounts: map[string]authtypes.AccountI{
|
|
771
|
-
moduleBech32:
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
780
|
+
moduleBech32: authtypes.NewEmptyModuleAccount("vbank/reserve"),
|
|
781
|
+
addr1: authtypes.NewBaseAccountWithAddress(sdk.MustAccAddressFromBech32(addr1)),
|
|
782
|
+
},
|
|
783
|
+
modAddrs: map[string]string{
|
|
784
|
+
"vbank/reserve": moduleBech32,
|
|
776
785
|
},
|
|
777
786
|
}
|
|
778
787
|
keeper, ctx := makeTestKit(acct, nil)
|