Skip to content

Commit

Permalink
fix class builder (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
harish551 authored Nov 20, 2023
1 parent 4d0d08e commit c1592b7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions x/ics721nft/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type Keeper struct {
cdc codec.Codec
ak AccountKeeper
cb onfttypes.ClassBuilder
tb onfttypes.NFTBuilder
nb onfttypes.NFTBuilder
}

// NewKeeper creates a new ics721 Keeper instance
Expand All @@ -31,7 +31,7 @@ func NewKeeper(cdc codec.Codec,
cdc: cdc,
ak: ak,
cb: onfttypes.NewClassBuilder(cdc, ak.GetModuleAddress),
tb: onfttypes.NewNFTBuilder(cdc),
nb: onfttypes.NewNFTBuilder(cdc),
}
}

Expand Down Expand Up @@ -83,7 +83,7 @@ func (k Keeper) Mint(ctx sdk.Context,
tokenData string,
receiver sdk.AccAddress,
) error {
token, err := k.tb.Build(classID, tokenID, tokenURI, tokenData)
token, err := k.nb.Build(classID, tokenID, tokenURI, tokenData)
if err != nil {
k.Logger(ctx).Error("unable to build token from packet data", "error:", err.Error())
return err
Expand All @@ -106,7 +106,7 @@ func (k Keeper) Transfer(
return nil
}
_nft, _ := k.nk.GetNFT(ctx, classID, tokenID)
token, err := k.tb.Build(classID, tokenID, _nft.GetUri(), tokenData)
token, err := k.nb.Build(classID, tokenID, _nft.GetUri(), tokenData)
if err != nil {
k.Logger(ctx).Error("unable to build token on transfer from packet data", "error:", err.Error())
return err
Expand Down Expand Up @@ -140,7 +140,7 @@ func (k Keeper) GetNFT(ctx sdk.Context, classID, tokenID string) (nfttransfer.NF
if !has {
return nil, false
}
metadata, err := k.tb.BuildMetadata(_nft)
metadata, err := k.nb.BuildMetadata(_nft)
if err != nil {
k.Logger(ctx).Error("encode nft data failed")
return nil, false
Expand Down
2 changes: 1 addition & 1 deletion x/onft/types/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func (cb ClassBuilder) Build(classID, classURI, classData string) (nft.Class, er
if v, ok := dataMap[ClassKeyPreviewURI]; ok {
if vMap, ok := v.(map[string]interface{}); ok {
if vStr, ok := vMap[KeyMediaFieldValue].(string); ok {
schema = vStr
previewURI = vStr
delete(dataMap, ClassKeyPreviewURI)
}
}
Expand Down

0 comments on commit c1592b7

Please sign in to comment.