rename func

This commit is contained in:
0xmuralik 2023-03-10 16:50:47 +05:30
parent 8932d69f36
commit db2c3afef1
4 changed files with 6 additions and 6 deletions

View File

@ -33,7 +33,7 @@ func GenerateHash(json map[string]interface{}) (string, []byte, error) {
return "", nil, err
}
cidString, err := CIDFromJSONBytesUsingIpldPrime(content)
cidString, err := CIDFromJSONBytes(content)
if err != nil {
return "", nil, err
}
@ -54,10 +54,10 @@ func GetAttributeAsString(obj map[string]interface{}, attr string) (string, erro
return "", errors.New("attribute not found")
}
// CIDFromJSONBytesUsingIpldPrime returns CID (dagcbor) for json (as bytes).
// CIDFromJSONBytes returns CID (dagcbor) for json (as bytes).
// This is combination of samples for unmarshalling and linking
// see: https://pkg.go.dev/github.com/ipld/go-ipld-prime
func CIDFromJSONBytesUsingIpldPrime(content []byte) (string, error) {
func CIDFromJSONBytes(content []byte) (string, error) {
if len(content) == 0 {
return "", nil
}

View File

@ -26,7 +26,7 @@ func TestAndValidateCIDGeneration(t *testing.T) {
}
for _, tc := range testCases {
newImpl, err := CIDFromJSONBytesUsingIpldPrime([]byte(tc.content))
newImpl, err := CIDFromJSONBytes([]byte(tc.content))
require.NoError(t, err)
require.Equal(t, tc.expected, newImpl)
}

View File

@ -417,7 +417,7 @@ func (k Keeper) RevealBid(ctx sdk.Context, msg types.MsgRevealBid) (*types.Aucti
return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid reveal string.")
}
cid, err := wnsUtils.CIDFromJSONBytesUsingIpldPrime(revealBytes)
cid, err := wnsUtils.CIDFromJSONBytes(revealBytes)
if err != nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid reveal JSON.")
}

View File

@ -70,7 +70,7 @@ func UnMarshalMapFromJSONBytes(bytes []byte) map[string]interface{} {
// GetCid gets the content ID.
func GetCid(content []byte) (string, error) {
return wnsUtils.CIDFromJSONBytesUsingIpldPrime(content)
return wnsUtils.CIDFromJSONBytes(content)
}
// BytesToBase64 encodes a byte array as a base64 string.