clarinet
clarinet copied to clipboard
Unify signature of expect NFT and FT events
expectFungibleTokenTransferEvent and expectNonFungibleTokenTransferEvent have confusing signatures:
expectFungibleTokenTransferEvent(
amount: Number|bigint,
sender: String,
recipient: String,
assetId: String,
): Object;
and
expectNonFungibleTokenTransferEvent(
tokenId: String,
sender: String,
recipient: String,
assetAddress: String,
assetId: String
): Object;
For the first, assetId includes the native asset while for the second the asset id is split into assetAddress and assetName (named as assetId)
The signature should use the same assetId for all expect-NFT-and-FT-event functions. And expecting assetContractAddress, assetContractName and assetName in one string.
@friedger what do you think about changing also signatures of these functions to match the signatures of clarity functions (make assetId first argument)?
@friedger what do you think about changing also signatures of these functions to match the signatures of clarity functions (make
assetIdfirst argument)?
tokenId and amount are already the first argument, like in the transfer functions.
I was thinking about something like this:
// (ft-transfer? token-name amount sender recipient)
expectFungibleTokenTransferEvent(assetId: String, amount: Number|bigint, sender: String, recipient: String)
// (ft-mint? token-name amount recipient)
expectFungibleTokenMintEvent(assetId: String, amount: Number|bigint, recipient: String, )
// (ft-burn? token-name amount sender)
expectFungibleTokenBurnEvent(assetId: String, amount: Number|bigint, sender: String)
// (nft-transfer? asset-class asset-identifier sender recipient)
expectNonFungibleTokenTransferEvent(assetId: String, tokenId: String, sender: String, recipient: String)
// (nft-mint? asset-class asset-identifier recipient)
expectNonFungibleTokenMintEvent(assetId: String, tokenId: String, recipient: String)
// (nft-burn? asset-class asset-identifier recipient)
expectNonFungibleTokenBurnEvent(assetId: String, tokenId: String, sender: String)
To be improved as part of clarinet-sdk https://github.com/hirosystems/clarinet/issues/1065
Closing this issue now that the SDK is out. But we should keep this in mind for #1128