Skip to content

Commit

Permalink
feat: add logic GetDAAccData for WeaveVM (#1315)
Browse files Browse the repository at this point in the history
  • Loading branch information
anhductn2001 authored Mar 10, 2025
1 parent 4a614bc commit 189f133
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 2 additions & 0 deletions cmd/consts/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,13 @@ var Denoms = struct {
HubIbcOnRollapp string
Celestia string
Avail string
WeaveVM string
}{
Hub: "adym",
HubIbcOnRollapp: "ibc/FECACB927EB3102CCCB240FFB3B6FCCEEB8D944C6FEA8DFF079650FEFF59781D",
Celestia: "utia",
Avail: "aAVL",
WeaveVM: "tWVM",
}

const (
Expand Down
25 changes: 24 additions & 1 deletion data_layer/weavevm/weavevm.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (
"os/exec"
"strconv"

cosmossdkmath "cosmossdk.io/math"
cosmossdktypes "github.com/cosmos/cosmos-sdk/types"
"github.com/dymensionxyz/roller/cmd/consts"
"github.com/dymensionxyz/roller/utils/errorhandling"
"github.com/dymensionxyz/roller/utils/keys"
Expand Down Expand Up @@ -139,7 +141,28 @@ func (w *WeaveVM) GetStartDACmd() *exec.Cmd {
}

func (w *WeaveVM) GetDAAccData(cfg roller.RollappConfig) ([]keys.AccountData, error) {
return nil, nil
balance, err := GetBalance(cfg.DA.ApiUrl, w.PrivateKey)
if err != nil {
return nil, err
}
address, _, err := getAddressFromPrivateKey(w.PrivateKey)
if err != nil {
return nil, err
}

balanceInt, ok := cosmossdkmath.NewIntFromString(balance)
if !ok {
return nil, fmt.Errorf("Can not convert from String to Int")
}
return []keys.AccountData{
{
Address: address.String(),
Balance: cosmossdktypes.Coin{
Denom: consts.Denoms.WeaveVM,
Amount: balanceInt,
},
},
}, nil
}

func (w *WeaveVM) GetSequencerDAConfig(_ string) string {
Expand Down

0 comments on commit 189f133

Please sign in to comment.