-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use new multiformats CID interface and exports
- Loading branch information
Showing
18 changed files
with
124 additions
and
89 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,43 @@ | ||
import { TransactionInCoinbasePorcelain, TransactionInPorcelain } from 'bitcoin-block/classes/TransactionIn'; | ||
import { BlockHeaderPorcelain, TransactionPorcelain } from 'bitcoin-block/interface' | ||
import { CID } from 'multiformats'; | ||
import { CID } from 'multiformats/interface'; | ||
|
||
export type HASH_ALG_CODE = 0x56 | ||
export type CODEC_BLOCK_CODE = 0xb0 | ||
export type CODEC_TX_CODE = 0xb1 | ||
export type CODEC_WITNESS_COMMITMENT_CODE = 0xb2 | ||
|
||
export type IPLDLoader = (cid:CID)=>Promise<Uint8Array> | ||
|
||
export interface BitcoinBlockCID extends CID<CODEC_BLOCK_CODE, HASH_ALG_CODE, 1>{} | ||
export interface BitcoinTxCID extends CID<CODEC_TX_CODE, HASH_ALG_CODE, 1>{} | ||
export interface BitcoinWitnessCommitmentCID extends CID<CODEC_WITNESS_COMMITMENT_CODE, HASH_ALG_CODE, 1>{} | ||
|
||
export interface BitcoinHeader extends BlockHeaderPorcelain { | ||
parent: CID|null | ||
tx: CID | ||
parent: BitcoinBlockCID|null | ||
tx: BitcoinTxCID | ||
} | ||
|
||
export interface BitcoinTransactionMerkleNode { | ||
0: CID|null | ||
1: CID | ||
0: BitcoinTxCID|null | ||
1: BitcoinTxCID | ||
} | ||
|
||
|
||
export interface BitcoinTransactionInCoinbase extends TransactionInCoinbasePorcelain { | ||
tx: CID | ||
tx: BitcoinTxCID | ||
txinwitness: [string] | ||
} | ||
|
||
export interface BitcoinTransactionIn extends TransactionInPorcelain { | ||
tx: CID | ||
tx: BitcoinTxCID | ||
} | ||
|
||
export interface BitcoinTransaction extends TransactionPorcelain { | ||
witnessCommitment?: CID | ||
witnessCommitment?: BitcoinWitnessCommitmentCID | ||
vin: (BitcoinTransactionInCoinbase | BitcoinTransactionIn)[] | ||
} | ||
|
||
export interface BitcoinWitnessCommitment { | ||
witnessMerkleRoot: CID|null | ||
witnessMerkleRoot: BitcoinTxCID|null | ||
nonce: Uint8Array | ||
} |
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
Oops, something went wrong.