-
Notifications
You must be signed in to change notification settings - Fork 17
Simplify transaction assembly after new base features #120
Conversation
src/transaction.ts
Outdated
}); | ||
|
||
switch (raw.operations[0].type) { | ||
case "invokeHostFunction": | ||
// @ts-ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not looking through an IDE atm, what was the warning to ignore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh, I was hoping this would fly under the radar 🛸 the warning is that builder.operations
is not defined in the TypeScript (because it's a private property), but this is the best/only way to remove operations from a TransactionBuilder
. The correct approach, I think, would be to do something like { ignoreOperations: true }
as an option to cloneFrom
, but that would be a "feature request", so this is an acceptable workaround imo, especially given how much better this is than the existing solution anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it. another option for consideration in future, rather than having operation aspects just specific to cloning, i've seen a few other builder patterns with a method to clear the builder state also, like builder.clearOperations()
which then can setup for using builder.addOperation()
again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a comment to clarify!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, that may be a cleaner approach! A reset button of sorts.
This releases v0.10.1.
The changelog is just this PR:
Fixed
stellar-base
dependency has been upgraded to fix a TypeScript bug (#665).assembleTransaction
to use new abstractions fromstellar-base
(#120).