Add better error for trying to encode invalid transactions (#2001)

This commit is contained in:
Jackson Mills
2022-05-24 15:57:08 -07:00
committed by GitHub
parent 10469a2710
commit c994ac7b65
3 changed files with 23 additions and 0 deletions

View File

@@ -127,6 +127,15 @@ class STObject extends SerializedType {
const associatedValue = field.associatedType.from(
xAddressDecoded[field.name],
)
if (associatedValue == undefined) {
throw new TypeError(
`Unable to interpret "${field.name}: ${
xAddressDecoded[field.name]
}".`,
)
}
if ((associatedValue as unknown as Bytes).name === 'UNLModify') {
// triggered when the TransactionType field has a value of 'UNLModify'
isUnlModify = true