-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tx-builder)!: unpack
poi
field of channel CloseSolo Slash tx
BREAKING CHANGE: TxBuilder accepts and returns `poi` field unpacked as TreesPoi BREAKING CHANGE: `Channel.poi` returns unpacked TreesPoi Use just `await channel.poi(...)` instead of `unpackTx(await channel.poi(...))`.
- Loading branch information
Showing
6 changed files
with
46 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { decode, encode, Encoding } from '../../../utils/encoder'; | ||
import { Tag } from '../constants'; | ||
import type { unpackTx as unpackTxType, buildTx as buildTxType } from '../index'; | ||
|
||
export default function genEntryField<T extends Tag>(tag: T): { | ||
serialize: ( | ||
value: Parameters<typeof buildTxType<T>>[0], options: { buildTx: typeof buildTxType }, | ||
) => Buffer; | ||
deserialize: ( | ||
value: Buffer, options: { unpackTx: typeof unpackTxType }, | ||
) => ReturnType<typeof unpackTxType<T>>; | ||
} { | ||
return { | ||
serialize(txParams, { buildTx }) { | ||
return decode(buildTx({ ...txParams, tag })); | ||
}, | ||
|
||
deserialize(buf, { unpackTx }) { | ||
return unpackTx(encode(buf, Encoding.Transaction), tag); | ||
}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters