Fix sats output

This commit is contained in:
2026-01-30 02:52:09 +00:00
parent adf3996dc4
commit 03a86ca056
2 changed files with 17 additions and 9 deletions

View File

@@ -294,13 +294,19 @@ export function ActionWizardScreen(): React.ReactElement {
// Add variables if any
if (variables.length > 0) {
const variableData = variables.map(v => ({
variableIdentifier: v.id,
roleIdentifier: roleIdentifier,
value: v.type === 'number' || v.type === 'satoshis'
? BigInt(v.value || '0')
: v.value,
}));
const variableData = variables.map(v => {
// Determine if this is a numeric type that should be BigInt
// Template types include: 'integer', 'number', 'satoshis'
// Hints include: 'satoshis', 'amount'
const isNumeric = ['integer', 'number', 'satoshis'].includes(v.type) ||
(v.hint && ['satoshis', 'amount'].includes(v.hint));
return {
variableIdentifier: v.id,
roleIdentifier: roleIdentifier,
value: isNumeric ? BigInt(v.value || '0') : v.value,
};
});
const updated = await invitationController.addVariables(invId, variableData);
inv = updated.invitation;
}
@@ -313,11 +319,13 @@ export function ActionWizardScreen(): React.ReactElement {
if (transaction?.outputs && transaction.outputs.length > 0) {
setStatus('Adding required outputs...');
// Add each required output with its identifier
// Add each required output with just its identifier
// IMPORTANT: Do NOT pass roleIdentifier here - if roleIdentifier is set,
// the engine skips generating the lockingBytecode (see engine.ts appendInvitation)
// The engine will automatically generate the locking bytecode based on the template
const outputsToAdd = transaction.outputs.map((outputId: string) => ({
outputIdentifier: outputId,
roleIdentifier: roleIdentifier,
// Note: roleIdentifier intentionally omitted to trigger lockingBytecode generation
}));
const updated = await invitationController.addOutputs(invId, outputsToAdd);