Closed tequdev closed 7 months ago
Thank you!
I don't think this should be executed by default, always. This is a decision:
sign and submit
means exactly this: Sign and Submit what has been passed. By adding auto network & account property filling to the method, the method doesn't do what it the name suggests, it does more.
Another problem is that this is a breaking change (this lib is all over the place).
The way I feel this should be implemented is a separate (new) method, that wraps around signAndSubmit
, adding the network values first so the developer passed colliding properties prevail.
E.g.:
prefilledSignAndSubmit(...)
Where this would basically do this (pseudocode):
const prefilledSignAndSubmit = async (
transaction: Object,
client: XrplClient | string,
account: Account | Account[]
) => {
rerturn signAndSubmit({
// First the vals, so these are always defined
...(await utils.txNetworkAndAccountValues(client, transaction?.Account)).txValues,
// Then the passed tx, so duplicate props overrule as tx comes last
...transaction,
})
}
I created this PR because Fee was eligible for autofill.
Of course I respect your decision.
I'll create another PR for prefilledSignAndSubmit
👍
Fixed to do autofill in the
signAndSubmit
method as in xrpl.js.