UNPKG

@btc-vision/transaction

Version:

OPNet transaction library allows you to create and sign transactions for the OPNet network.

48 lines 1.88 kB
import { networks } from '@btc-vision/bitcoin'; function networkKey(network) { return `${network.messagePrefix}|${network.bech32}`; } const CHAIN_IDS = new Map([ [ networkKey(networks.bitcoin), new Uint8Array([ 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0xd6, 0x68, 0x9c, 0x08, 0x5a, 0xe1, 0x65, 0x83, 0x1e, 0x93, 0x4f, 0xf7, 0x63, 0xae, 0x46, 0xa2, 0xa6, 0xc1, 0x72, 0xb3, 0xf1, 0xb6, 0x0a, 0x8c, 0xe2, 0x6f, ]), ], [ networkKey(networks.testnet), new Uint8Array([ 0x00, 0x00, 0x00, 0x00, 0x09, 0x33, 0xea, 0x01, 0xad, 0x0e, 0xe9, 0x84, 0x20, 0x97, 0x79, 0xba, 0xae, 0xc3, 0xce, 0xd9, 0x0f, 0xa3, 0xf4, 0x08, 0x71, 0x95, 0x26, 0xf8, 0xd7, 0x7f, 0x49, 0x43, ]), ], [ networkKey(networks.opnetTestnet), new Uint8Array([ 0, 0, 1, 127, 133, 16, 107, 31, 238, 175, 47, 112, 241, 226, 184, 5, 152, 91, 181, 117, 248, 143, 155, 11, 165, 117, 61, 47, 60, 241, 50, 115, ]), ], [ networkKey(networks.regtest), new Uint8Array([ 0x0f, 0x91, 0x88, 0xf1, 0x3c, 0xb7, 0xb2, 0xc7, 0x1f, 0x2a, 0x33, 0x5e, 0x3a, 0x4f, 0xc3, 0x28, 0xbf, 0x5b, 0xeb, 0x43, 0x60, 0x12, 0xaf, 0xca, 0x59, 0x0b, 0x1a, 0x11, 0x46, 0x6e, 0x22, 0x06, ]), ], ]); export function getChainId(network) { const chainId = CHAIN_IDS.get(networkKey(network)); if (!chainId) throw new Error('Unsupported network for chain ID retrieval'); return chainId.slice(); } export const BITCOIN_PROTOCOL_ID = new Uint8Array([ 0xe7, 0x84, 0x99, 0x5a, 0x41, 0x2d, 0x77, 0x39, 0x88, 0xc4, 0xb8, 0xe3, 0x33, 0xd7, 0xb3, 0x9d, 0xfb, 0x3c, 0xab, 0xf1, 0x18, 0xd0, 0xd6, 0x45, 0x41, 0x1a, 0x91, 0x6c, 0xa2, 0x40, 0x79, 0x39, ]); //# sourceMappingURL=ChainData.js.map