Fix sats output
This commit is contained in:
Binary file not shown.
@@ -294,13 +294,19 @@ export function ActionWizardScreen(): React.ReactElement {
|
|||||||
|
|
||||||
// Add variables if any
|
// Add variables if any
|
||||||
if (variables.length > 0) {
|
if (variables.length > 0) {
|
||||||
const variableData = variables.map(v => ({
|
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,
|
variableIdentifier: v.id,
|
||||||
roleIdentifier: roleIdentifier,
|
roleIdentifier: roleIdentifier,
|
||||||
value: v.type === 'number' || v.type === 'satoshis'
|
value: isNumeric ? BigInt(v.value || '0') : v.value,
|
||||||
? BigInt(v.value || '0')
|
};
|
||||||
: v.value,
|
});
|
||||||
}));
|
|
||||||
const updated = await invitationController.addVariables(invId, variableData);
|
const updated = await invitationController.addVariables(invId, variableData);
|
||||||
inv = updated.invitation;
|
inv = updated.invitation;
|
||||||
}
|
}
|
||||||
@@ -313,11 +319,13 @@ export function ActionWizardScreen(): React.ReactElement {
|
|||||||
if (transaction?.outputs && transaction.outputs.length > 0) {
|
if (transaction?.outputs && transaction.outputs.length > 0) {
|
||||||
setStatus('Adding required outputs...');
|
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
|
// The engine will automatically generate the locking bytecode based on the template
|
||||||
const outputsToAdd = transaction.outputs.map((outputId: string) => ({
|
const outputsToAdd = transaction.outputs.map((outputId: string) => ({
|
||||||
outputIdentifier: outputId,
|
outputIdentifier: outputId,
|
||||||
roleIdentifier: roleIdentifier,
|
// Note: roleIdentifier intentionally omitted to trigger lockingBytecode generation
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const updated = await invitationController.addOutputs(invId, outputsToAdd);
|
const updated = await invitationController.addOutputs(invId, outputsToAdd);
|
||||||
|
|||||||
Reference in New Issue
Block a user