This is super useful to prevent accidental mistakes, but occasionally people will accidentally use the payToAddressWithData method instead, which bypasses this check.
If we made this method private, and added payToNativeScriptWithData and payToWalletAddressWithData that, respectively, required you to pass the native address and required you to pass a non-script address, this could solve some accidental use of the library.
Makes sense but generally we're keeping the lucid apis for compatibility, with intent to move away entirely at some point. Later variations can have such considerations.
Given recent issues, I'd like to propose updating the surface API of translucent to prevent accidental mistakes.
Currently, payToContract prevents sending to a smart contract if no datum is attached.
This is super useful to prevent accidental mistakes, but occasionally people will accidentally use the payToAddressWithData method instead, which bypasses this check.
If we made this method private, and added
payToNativeScriptWithData
andpayToWalletAddressWithData
that, respectively, required you to pass the native address and required you to pass a non-script address, this could solve some accidental use of the library.