diff --git a/src/lib/message/transaction-types.ts b/src/lib/message/transaction-types.ts index af09ffce..3e2ebe4a 100644 --- a/src/lib/message/transaction-types.ts +++ b/src/lib/message/transaction-types.ts @@ -328,6 +328,13 @@ export interface CompilationDirectiveUnlocking< * Required for use in signing serializations. */ valueSatoshis: Output['valueSatoshis']; + + /** + * The CashToken contents of this input. This property is only defined if the + * input contains one or more tokens. For details, see + * `CHIP-2022-02-CashTokens`. + */ + token?: Output['token']; } export interface CompilationDirectiveUnlockingEstimate< diff --git a/src/lib/transaction/generate-transaction.ts b/src/lib/transaction/generate-transaction.ts index 29e1408f..6163aa3e 100644 --- a/src/lib/transaction/generate-transaction.ts +++ b/src/lib/transaction/generate-transaction.ts @@ -73,12 +73,14 @@ export const compileOutputTemplate = < ? { lockingBytecode: result.bytecode, valueSatoshis: outputTemplate.valueSatoshis, + token: outputTemplate.token, } : returnFailedCompilationDirective({ index, result, type: 'locking' }); } return { lockingBytecode: outputTemplate.lockingBytecode.slice(), valueSatoshis: outputTemplate.valueSatoshis, + token: outputTemplate.token, }; }; @@ -108,6 +110,7 @@ export const compileInputTemplate = < sourceOutputs[index] = { lockingBytecode: Uint8Array.of(), valueSatoshis: inputTemplate.unlockingBytecode.valueSatoshis, + token: inputTemplate.unlockingBytecode.token, }; const result = directive.compiler.generateBytecode({ data: {