Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates ft and nft dependencies and basic transactions #451

Merged
merged 2 commits into from
Oct 3, 2024

Conversation

joshuahannan
Copy link
Member

  • Updates the FT and NFT dependencies to include the latest transactions and contracts with improved error messages
  • Updates the flow token transactions and basic account transactions to have better error messages

Comment on lines +7 to +20
signatureAlgorithm >= 1 && signatureAlgorithm <= 3:
"Cannot add Key: Must provide a signature algorithm raw value that corresponds to "
.concat("one of the available signature algorithms for Flow keys.")
.concat("You provided ").concat(signatureAlgorithm.toString())
.concat(" but the options are either 1 (ECDSA_P256), 2 (ECDSA_secp256k1), or 3 (BLS_BLS12_381).")
hashAlgorithm >= 1 && hashAlgorithm <= 6:
"Cannot add Key: Must provide a hash algorithm raw value that corresponds to "
.concat("one of of the available hash algorithms for Flow keys.")
.concat("You provided ").concat(hashAlgorithm.toString())
.concat(" but the options are 1 (SHA2_256), 2 (SHA2_384), 3 (SHA3_256), ")
.concat("4 (SHA3_384), 5 (KMAC128_BLS_BLS12_381), or 6 (KECCAK_256).")
weight <= 1000.0:
"Cannot add Key: The key weight must be between 0 and 1000."
.concat(" You provided ").concat(weight.toString()).concat(" which is invalid.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These updated error messages are really helpful, but I'm starting to wonder if there's a way we can standardize some of them as they're getting pretty long. Maybe something like FlowCoreErrors and in this instance invalidSigAlgo(_ provided: UInt8): String and invalidHashAlgo(_ provided: UInt8): String. Modifiers would be nice, but that's a whole new language feature.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a little awkward right now, but once we have better string formatting in Cadence, then I think it won't be as bad. I think having a separate contract for it is a little unnecessary.

transactions/accounts/revoke_key.cdc Outdated Show resolved Hide resolved
@joshuahannan joshuahannan merged commit f286010 into master Oct 3, 2024
2 checks passed
@joshuahannan joshuahannan deleted the update-token-deps branch October 3, 2024 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants