Skip to content

Commit

Permalink
Update references to asset names in strings and documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanknowles committed Dec 6, 2023
1 parent e59119f commit 42b80d9
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import GHC.Generics
( Generic
)

-- | A combination of a token policy identifier and a token name that can be
-- | A combination of a token policy identifier and an asset name that can be
-- used as a compound identifier.
--
data AssetId = AssetId
Expand Down
8 changes: 4 additions & 4 deletions lib/primitive/lib/Cardano/Wallet/Primitive/Types/AssetName.hs
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ import Quiet
import qualified Data.ByteString as BS
import qualified Data.Text.Encoding as T

-- | Token names, defined by the monetary policy script.
-- | Asset names, defined by the monetary policy script.
newtype AssetName =
-- | Construct a 'AssetName' without any validation.
-- | Construct an 'AssetName' without any validation.
UnsafeAssetName { unAssetName :: ByteString }
deriving stock (Eq, Ord, Generic)
deriving (Read, Show) via (Quiet AssetName)
deriving anyclass Hashable

-- | Construct a 'AssetName', validating that the length does not exceed
-- | Construct an 'AssetName', validating that the length does not exceed
-- 'maxLength'.
--
fromByteString :: ByteString -> Either String AssetName
Expand All @@ -81,7 +81,7 @@ fromByteString bs
empty :: AssetName
empty = UnsafeAssetName ""

-- | The maximum length of a valid token name.
-- | The maximum length of a valid asset name.
--
maxLength :: Int
maxLength = 32
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as B8

--------------------------------------------------------------------------------
-- Token names chosen from a range that depends on the size parameter
-- Asset names chosen from a range that depends on the size parameter
--------------------------------------------------------------------------------

genAssetName :: Gen AssetName
Expand All @@ -43,7 +43,7 @@ shrinkAssetName i
simplest = head testAssetNames

--------------------------------------------------------------------------------
-- Token names chosen from a large range (to minimize the risk of collisions)
-- Asset names chosen from a large range (to minimize the risk of collisions)
--------------------------------------------------------------------------------

genAssetNameLargeRange :: Gen AssetName
Expand All @@ -57,4 +57,4 @@ testAssetNames :: [AssetName]
testAssetNames = mkAssetName <$> ['A' .. 'Z']

mkAssetName :: Char -> AssetName
mkAssetName = UnsafeAssetName . B8.snoc "Token"
mkAssetName = UnsafeAssetName . B8.snoc "Asset"
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ empty = mempty

-- | Creates a token bundle from a coin and a flat list of token quantities.
--
-- If a token name appears more than once in the list under the same policy,
-- If an asset name appears more than once in the list under the same policy,
-- its associated quantities will be added together in the resultant bundle.
--
fromFlatList
Expand All @@ -288,7 +288,7 @@ fromFlatList c = TokenBundle c . TokenMap.fromFlatList

-- | Creates a token bundle from a coin and a nested list of token quantities.
--
-- If a token name appears more than once in the list under the same policy,
-- If an asset name appears more than once in the list under the same policy,
-- its associated quantities will be added together in the resultant bundle.
--
fromNestedList
Expand Down
4 changes: 2 additions & 2 deletions lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenMap.hs
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ singleton = setQuantity empty

-- | Creates a token map from a flat list.
--
-- If a token name appears more than once in the list under the same policy,
-- If an asset name appears more than once in the list under the same policy,
-- its associated quantities will be added together in the resultant map.
--
fromFlatList :: [(AssetId, TokenQuantity)] -> TokenMap
Expand All @@ -507,7 +507,7 @@ fromFlatList = F.foldl' acc empty

-- | Creates a token map from a nested list.
--
-- If a token name appears more than once in the list under the same policy,
-- If an asset name appears more than once in the list under the same policy,
-- its associated quantities will be added together in the resultant map.
--
fromNestedList
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ testZeroValuedTokenQuantityFlat =
Left message
where
policy = dummyTokenPolicyId 'A'
token = dummyAssetName "DUMMY-TOKEN"
token = dummyAssetName "DUMMY-ASSET"
json =
[aesonQQ|
[ { "policy_id": #{policy}
Expand All @@ -742,7 +742,7 @@ testZeroValuedTokenQuantityNested =
Left message
where
policy = dummyTokenPolicyId 'A'
token = dummyAssetName "DUMMY-TOKEN"
token = dummyAssetName "DUMMY-ASSET"
json =
[aesonQQ|
[ { "policy_id": #{policy}
Expand Down Expand Up @@ -851,7 +851,7 @@ dummyAssetName :: ByteString -> AssetName
dummyAssetName t = fromRight reportError $ AssetName.fromByteString t
where
reportError = error $
"Unable to construct dummy token name from bytes: " <> show t
"Unable to construct dummy asset name from bytes: " <> show t

-- The input must be a character in the range [0-9] or [A-Z].
--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3985,7 +3985,7 @@ spec = describe "NEW_SHELLEY_TRANSACTIONS" $ do

burnAssetsCheck ctx wa assetName' payloadBurn scriptUsed

it "TRANS_NEW_CREATE_10g - Burning assets without timelock and token name" $
it "TRANS_NEW_CREATE_10g - Burning assets without timelock and asset name" $
\ctx -> runResourceT $ do

wa <- fixtureWallet ctx
Expand Down

0 comments on commit 42b80d9

Please sign in to comment.