xpi-ts 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +516 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/lib/bitcore/address.d.ts +66 -0
- package/dist/lib/bitcore/address.d.ts.map +1 -0
- package/dist/lib/bitcore/address.js +407 -0
- package/dist/lib/bitcore/block/block.d.ts +57 -0
- package/dist/lib/bitcore/block/block.d.ts.map +1 -0
- package/dist/lib/bitcore/block/block.js +233 -0
- package/dist/lib/bitcore/block/blockheader.d.ts +82 -0
- package/dist/lib/bitcore/block/blockheader.d.ts.map +1 -0
- package/dist/lib/bitcore/block/blockheader.js +323 -0
- package/dist/lib/bitcore/block/index.d.ts +5 -0
- package/dist/lib/bitcore/block/index.d.ts.map +1 -0
- package/dist/lib/bitcore/block/index.js +2 -0
- package/dist/lib/bitcore/chunk.d.ts +22 -0
- package/dist/lib/bitcore/chunk.d.ts.map +1 -0
- package/dist/lib/bitcore/chunk.js +46 -0
- package/dist/lib/bitcore/crypto/bn.d.ts +53 -0
- package/dist/lib/bitcore/crypto/bn.d.ts.map +1 -0
- package/dist/lib/bitcore/crypto/bn.js +238 -0
- package/dist/lib/bitcore/crypto/ecdsa.d.ts +46 -0
- package/dist/lib/bitcore/crypto/ecdsa.d.ts.map +1 -0
- package/dist/lib/bitcore/crypto/ecdsa.js +247 -0
- package/dist/lib/bitcore/crypto/hash.d.ts +16 -0
- package/dist/lib/bitcore/crypto/hash.d.ts.map +1 -0
- package/dist/lib/bitcore/crypto/hash.js +87 -0
- package/dist/lib/bitcore/crypto/index.d.ts +9 -0
- package/dist/lib/bitcore/crypto/index.d.ts.map +1 -0
- package/dist/lib/bitcore/crypto/index.js +8 -0
- package/dist/lib/bitcore/crypto/musig2.d.ts +40 -0
- package/dist/lib/bitcore/crypto/musig2.d.ts.map +1 -0
- package/dist/lib/bitcore/crypto/musig2.js +236 -0
- package/dist/lib/bitcore/crypto/point.d.ts +20 -0
- package/dist/lib/bitcore/crypto/point.d.ts.map +1 -0
- package/dist/lib/bitcore/crypto/point.js +133 -0
- package/dist/lib/bitcore/crypto/random.d.ts +7 -0
- package/dist/lib/bitcore/crypto/random.d.ts.map +1 -0
- package/dist/lib/bitcore/crypto/random.js +30 -0
- package/dist/lib/bitcore/crypto/schnorr.d.ts +40 -0
- package/dist/lib/bitcore/crypto/schnorr.d.ts.map +1 -0
- package/dist/lib/bitcore/crypto/schnorr.js +185 -0
- package/dist/lib/bitcore/crypto/signature.d.ts +53 -0
- package/dist/lib/bitcore/crypto/signature.d.ts.map +1 -0
- package/dist/lib/bitcore/crypto/signature.js +300 -0
- package/dist/lib/bitcore/crypto/sigtype.d.ts +5 -0
- package/dist/lib/bitcore/crypto/sigtype.d.ts.map +1 -0
- package/dist/lib/bitcore/crypto/sigtype.js +18 -0
- package/dist/lib/bitcore/encoding/base58.d.ts +16 -0
- package/dist/lib/bitcore/encoding/base58.d.ts.map +1 -0
- package/dist/lib/bitcore/encoding/base58.js +55 -0
- package/dist/lib/bitcore/encoding/base58check.d.ts +9 -0
- package/dist/lib/bitcore/encoding/base58check.d.ts.map +1 -0
- package/dist/lib/bitcore/encoding/base58check.js +82 -0
- package/dist/lib/bitcore/encoding/bufferreader.d.ts +34 -0
- package/dist/lib/bitcore/encoding/bufferreader.d.ts.map +1 -0
- package/dist/lib/bitcore/encoding/bufferreader.js +198 -0
- package/dist/lib/bitcore/encoding/bufferwriter.d.ts +36 -0
- package/dist/lib/bitcore/encoding/bufferwriter.d.ts.map +1 -0
- package/dist/lib/bitcore/encoding/bufferwriter.js +189 -0
- package/dist/lib/bitcore/encoding/varint.d.ts +20 -0
- package/dist/lib/bitcore/encoding/varint.d.ts.map +1 -0
- package/dist/lib/bitcore/encoding/varint.js +61 -0
- package/dist/lib/bitcore/errors.d.ts +28 -0
- package/dist/lib/bitcore/errors.d.ts.map +1 -0
- package/dist/lib/bitcore/errors.js +325 -0
- package/dist/lib/bitcore/hdprivatekey.d.ts +78 -0
- package/dist/lib/bitcore/hdprivatekey.d.ts.map +1 -0
- package/dist/lib/bitcore/hdprivatekey.js +381 -0
- package/dist/lib/bitcore/hdpublickey.d.ts +98 -0
- package/dist/lib/bitcore/hdpublickey.d.ts.map +1 -0
- package/dist/lib/bitcore/hdpublickey.js +416 -0
- package/dist/lib/bitcore/index.d.ts +60 -0
- package/dist/lib/bitcore/index.d.ts.map +1 -0
- package/dist/lib/bitcore/index.js +44 -0
- package/dist/lib/bitcore/message.d.ts +23 -0
- package/dist/lib/bitcore/message.d.ts.map +1 -0
- package/dist/lib/bitcore/message.js +112 -0
- package/dist/lib/bitcore/mnemonic/errors.d.ts +7 -0
- package/dist/lib/bitcore/mnemonic/errors.d.ts.map +1 -0
- package/dist/lib/bitcore/mnemonic/errors.js +20 -0
- package/dist/lib/bitcore/mnemonic/index.d.ts +5 -0
- package/dist/lib/bitcore/mnemonic/index.d.ts.map +1 -0
- package/dist/lib/bitcore/mnemonic/index.js +4 -0
- package/dist/lib/bitcore/mnemonic/mnemonic.d.ts +23 -0
- package/dist/lib/bitcore/mnemonic/mnemonic.d.ts.map +1 -0
- package/dist/lib/bitcore/mnemonic/mnemonic.js +164 -0
- package/dist/lib/bitcore/mnemonic/pbkdf2.d.ts +2 -0
- package/dist/lib/bitcore/mnemonic/pbkdf2.d.ts.map +1 -0
- package/dist/lib/bitcore/mnemonic/pbkdf2.js +25 -0
- package/dist/lib/bitcore/mnemonic/words/english.d.ts +2 -0
- package/dist/lib/bitcore/mnemonic/words/english.d.ts.map +1 -0
- package/dist/lib/bitcore/mnemonic/words/english.js +2050 -0
- package/dist/lib/bitcore/mnemonic/words/index.d.ts +4 -0
- package/dist/lib/bitcore/mnemonic/words/index.d.ts.map +1 -0
- package/dist/lib/bitcore/mnemonic/words/index.js +4 -0
- package/dist/lib/bitcore/musig2/index.d.ts +3 -0
- package/dist/lib/bitcore/musig2/index.d.ts.map +1 -0
- package/dist/lib/bitcore/musig2/index.js +2 -0
- package/dist/lib/bitcore/musig2/session.d.ts +79 -0
- package/dist/lib/bitcore/musig2/session.d.ts.map +1 -0
- package/dist/lib/bitcore/musig2/session.js +346 -0
- package/dist/lib/bitcore/musig2/signer.d.ts +61 -0
- package/dist/lib/bitcore/musig2/signer.d.ts.map +1 -0
- package/dist/lib/bitcore/musig2/signer.js +146 -0
- package/dist/lib/bitcore/networks.d.ts +53 -0
- package/dist/lib/bitcore/networks.d.ts.map +1 -0
- package/dist/lib/bitcore/networks.js +150 -0
- package/dist/lib/bitcore/opcode.d.ts +250 -0
- package/dist/lib/bitcore/opcode.d.ts.map +1 -0
- package/dist/lib/bitcore/opcode.js +270 -0
- package/dist/lib/bitcore/privatekey.d.ts +56 -0
- package/dist/lib/bitcore/privatekey.d.ts.map +1 -0
- package/dist/lib/bitcore/privatekey.js +237 -0
- package/dist/lib/bitcore/publickey.d.ts +59 -0
- package/dist/lib/bitcore/publickey.d.ts.map +1 -0
- package/dist/lib/bitcore/publickey.js +263 -0
- package/dist/lib/bitcore/script/interpreter.d.ts +98 -0
- package/dist/lib/bitcore/script/interpreter.d.ts.map +1 -0
- package/dist/lib/bitcore/script/interpreter.js +1704 -0
- package/dist/lib/bitcore/script.d.ts +111 -0
- package/dist/lib/bitcore/script.d.ts.map +1 -0
- package/dist/lib/bitcore/script.js +1112 -0
- package/dist/lib/bitcore/taproot/musig2.d.ts +29 -0
- package/dist/lib/bitcore/taproot/musig2.d.ts.map +1 -0
- package/dist/lib/bitcore/taproot/musig2.js +104 -0
- package/dist/lib/bitcore/taproot/nft.d.ts +164 -0
- package/dist/lib/bitcore/taproot/nft.d.ts.map +1 -0
- package/dist/lib/bitcore/taproot/nft.js +407 -0
- package/dist/lib/bitcore/taproot.d.ts +65 -0
- package/dist/lib/bitcore/taproot.d.ts.map +1 -0
- package/dist/lib/bitcore/taproot.js +288 -0
- package/dist/lib/bitcore/transaction/index.d.ts +12 -0
- package/dist/lib/bitcore/transaction/index.d.ts.map +1 -0
- package/dist/lib/bitcore/transaction/index.js +6 -0
- package/dist/lib/bitcore/transaction/input.d.ts +202 -0
- package/dist/lib/bitcore/transaction/input.d.ts.map +1 -0
- package/dist/lib/bitcore/transaction/input.js +911 -0
- package/dist/lib/bitcore/transaction/output.d.ts +48 -0
- package/dist/lib/bitcore/transaction/output.d.ts.map +1 -0
- package/dist/lib/bitcore/transaction/output.js +231 -0
- package/dist/lib/bitcore/transaction/sighash.d.ts +32 -0
- package/dist/lib/bitcore/transaction/sighash.d.ts.map +1 -0
- package/dist/lib/bitcore/transaction/sighash.js +335 -0
- package/dist/lib/bitcore/transaction/signature.d.ts +36 -0
- package/dist/lib/bitcore/transaction/signature.d.ts.map +1 -0
- package/dist/lib/bitcore/transaction/signature.js +130 -0
- package/dist/lib/bitcore/transaction/transaction.d.ts +164 -0
- package/dist/lib/bitcore/transaction/transaction.d.ts.map +1 -0
- package/dist/lib/bitcore/transaction/transaction.js +1016 -0
- package/dist/lib/bitcore/transaction/unspentoutput.d.ts +58 -0
- package/dist/lib/bitcore/transaction/unspentoutput.d.ts.map +1 -0
- package/dist/lib/bitcore/transaction/unspentoutput.js +167 -0
- package/dist/lib/bitcore/unit.d.ts +44 -0
- package/dist/lib/bitcore/unit.d.ts.map +1 -0
- package/dist/lib/bitcore/unit.js +106 -0
- package/dist/lib/bitcore/uri.d.ts +29 -0
- package/dist/lib/bitcore/uri.d.ts.map +1 -0
- package/dist/lib/bitcore/uri.js +163 -0
- package/dist/lib/bitcore/util/base32.d.ts +5 -0
- package/dist/lib/bitcore/util/base32.d.ts.map +1 -0
- package/dist/lib/bitcore/util/base32.js +58 -0
- package/dist/lib/bitcore/util/buffer.d.ts +18 -0
- package/dist/lib/bitcore/util/buffer.d.ts.map +1 -0
- package/dist/lib/bitcore/util/buffer.js +76 -0
- package/dist/lib/bitcore/util/convertBits.d.ts +2 -0
- package/dist/lib/bitcore/util/convertBits.d.ts.map +1 -0
- package/dist/lib/bitcore/util/convertBits.js +26 -0
- package/dist/lib/bitcore/util/js.d.ts +9 -0
- package/dist/lib/bitcore/util/js.d.ts.map +1 -0
- package/dist/lib/bitcore/util/js.js +45 -0
- package/dist/lib/bitcore/util/preconditions.d.ts +6 -0
- package/dist/lib/bitcore/util/preconditions.d.ts.map +1 -0
- package/dist/lib/bitcore/util/preconditions.js +31 -0
- package/dist/lib/bitcore/util.d.ts +14 -0
- package/dist/lib/bitcore/util.d.ts.map +1 -0
- package/dist/lib/bitcore/util.js +13 -0
- package/dist/lib/bitcore/xaddress.d.ts +45 -0
- package/dist/lib/bitcore/xaddress.d.ts.map +1 -0
- package/dist/lib/bitcore/xaddress.js +279 -0
- package/dist/lib/rank/api.d.ts +75 -0
- package/dist/lib/rank/api.d.ts.map +1 -0
- package/dist/lib/rank/api.js +4 -0
- package/dist/lib/rank/index.d.ts +127 -0
- package/dist/lib/rank/index.d.ts.map +1 -0
- package/dist/lib/rank/index.js +421 -0
- package/dist/lib/rank/opcode.d.ts +23 -0
- package/dist/lib/rank/opcode.d.ts.map +1 -0
- package/dist/lib/rank/opcode.js +23 -0
- package/dist/lib/rank/script.d.ts +2 -0
- package/dist/lib/rank/script.d.ts.map +1 -0
- package/dist/lib/rank/script.js +7 -0
- package/dist/lib/rank/transaction.d.ts +3 -0
- package/dist/lib/rank/transaction.d.ts.map +1 -0
- package/dist/lib/rank/transaction.js +12 -0
- package/dist/lib/rpc.d.ts +136 -0
- package/dist/lib/rpc.d.ts.map +1 -0
- package/dist/lib/rpc.js +62 -0
- package/dist/utils/constants.d.ts +18 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/constants.js +20 -0
- package/dist/utils/env.d.ts +3 -0
- package/dist/utils/env.d.ts.map +1 -0
- package/dist/utils/env.js +8 -0
- package/dist/utils/string.d.ts +11 -0
- package/dist/utils/string.d.ts.map +1 -0
- package/dist/utils/string.js +47 -0
- package/dist/utils/types.d.ts +2 -0
- package/dist/utils/types.d.ts.map +1 -0
- package/dist/utils/types.js +1 -0
- package/dist/utils/wallet.d.ts +12 -0
- package/dist/utils/wallet.d.ts.map +1 -0
- package/dist/utils/wallet.js +28 -0
- package/package.json +91 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { Signature } from '../crypto/signature.js';
|
|
2
|
+
import { Hash } from '../crypto/hash.js';
|
|
3
|
+
import { Random } from '../crypto/random.js';
|
|
4
|
+
import { musigKeyAgg, musigNonceGen, musigNonceAgg, musigPartialSign, musigPartialSigVerify, musigSigAgg, } from '../crypto/musig2.js';
|
|
5
|
+
import { MuSigSessionManager, } from './session.js';
|
|
6
|
+
import { buildMuSigTaprootKey, signTaprootKeyPathWithMuSig2, } from '../taproot/musig2.js';
|
|
7
|
+
import { sighash } from '../transaction/sighash.js';
|
|
8
|
+
import { BN } from '../crypto/bn.js';
|
|
9
|
+
export class MuSig2Signer {
|
|
10
|
+
config;
|
|
11
|
+
sessionManager;
|
|
12
|
+
constructor(config) {
|
|
13
|
+
if (!config.signers || config.signers.length === 0) {
|
|
14
|
+
throw new Error('MuSig2Signer: At least one signer required');
|
|
15
|
+
}
|
|
16
|
+
if (!config.myPrivateKey) {
|
|
17
|
+
throw new Error('MuSig2Signer: myPrivateKey is required');
|
|
18
|
+
}
|
|
19
|
+
const myPubKey = config.myPrivateKey.publicKey;
|
|
20
|
+
const myIndex = config.signers.findIndex(signer => signer.toString() === myPubKey.toString());
|
|
21
|
+
if (myIndex === -1) {
|
|
22
|
+
throw new Error('MuSig2Signer: myPrivateKey does not correspond to any signer');
|
|
23
|
+
}
|
|
24
|
+
this.config = config;
|
|
25
|
+
}
|
|
26
|
+
prepare(message, useSession = false) {
|
|
27
|
+
const normalizedMessage = this._normalizeMessage(message);
|
|
28
|
+
const keyAggContext = musigKeyAgg(this.config.signers);
|
|
29
|
+
const entropy = this.config.extraInput !== undefined
|
|
30
|
+
? this.config.extraInput
|
|
31
|
+
: Random.getRandomBuffer(32);
|
|
32
|
+
const nonce = musigNonceGen(this.config.myPrivateKey, keyAggContext.aggregatedPubKey, normalizedMessage, entropy);
|
|
33
|
+
const myIndex = keyAggContext.pubkeys.findIndex(s => s.toString() === this.config.myPrivateKey.publicKey.toString());
|
|
34
|
+
const result = {
|
|
35
|
+
keyAggContext,
|
|
36
|
+
myPublicNonces: nonce.publicNonces,
|
|
37
|
+
mySecretNonces: nonce.secretNonces,
|
|
38
|
+
myIndex,
|
|
39
|
+
};
|
|
40
|
+
if (useSession) {
|
|
41
|
+
if (!this.sessionManager) {
|
|
42
|
+
this.sessionManager = new MuSigSessionManager();
|
|
43
|
+
}
|
|
44
|
+
const session = this.sessionManager.createSession(this.config.signers, this.config.myPrivateKey, normalizedMessage);
|
|
45
|
+
this.sessionManager.generateNonces(session, this.config.myPrivateKey, this.config.extraInput);
|
|
46
|
+
result.sessionId = session.sessionId;
|
|
47
|
+
}
|
|
48
|
+
return result;
|
|
49
|
+
}
|
|
50
|
+
createPartialSignature(prepare, allPublicNonces, message) {
|
|
51
|
+
const normalizedMessage = this._normalizeMessage(message);
|
|
52
|
+
const aggregatedNonce = musigNonceAgg(allPublicNonces);
|
|
53
|
+
const secretNonce = {
|
|
54
|
+
secretNonces: prepare.mySecretNonces,
|
|
55
|
+
publicNonces: prepare.myPublicNonces,
|
|
56
|
+
};
|
|
57
|
+
return musigPartialSign(secretNonce, this.config.myPrivateKey, prepare.keyAggContext, prepare.myIndex, aggregatedNonce, normalizedMessage);
|
|
58
|
+
}
|
|
59
|
+
verifyPartialSignature(partialSig, publicNonce, publicKey, signerIndex, prepare, allPublicNonces, message) {
|
|
60
|
+
const normalizedMessage = this._normalizeMessage(message);
|
|
61
|
+
const aggregatedNonce = musigNonceAgg(allPublicNonces);
|
|
62
|
+
return musigPartialSigVerify(partialSig, publicNonce, publicKey, prepare.keyAggContext, signerIndex, aggregatedNonce, normalizedMessage);
|
|
63
|
+
}
|
|
64
|
+
sign(prepare, allPublicNonces, message, allPartialSigs) {
|
|
65
|
+
if (allPublicNonces.length !== this.config.signers.length) {
|
|
66
|
+
throw new Error(`Invalid number of public nonces: expected ${this.config.signers.length}, got ${allPublicNonces.length}`);
|
|
67
|
+
}
|
|
68
|
+
if (allPartialSigs.length !== this.config.signers.length) {
|
|
69
|
+
throw new Error(`Invalid number of partial signatures: expected ${this.config.signers.length}, got ${allPartialSigs.length}`);
|
|
70
|
+
}
|
|
71
|
+
const normalizedMessage = this._normalizeMessage(message);
|
|
72
|
+
const aggregatedNonce = musigNonceAgg(allPublicNonces);
|
|
73
|
+
const signature = musigSigAgg(allPartialSigs, aggregatedNonce, normalizedMessage, prepare.keyAggContext.aggregatedPubKey);
|
|
74
|
+
return {
|
|
75
|
+
signature,
|
|
76
|
+
aggregatedPubKey: prepare.keyAggContext.aggregatedPubKey,
|
|
77
|
+
isAggregator: true,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
prepareTaproot(state) {
|
|
81
|
+
const result = buildMuSigTaprootKey(this.config.signers, state);
|
|
82
|
+
const keyAggContext = musigKeyAgg(this.config.signers);
|
|
83
|
+
return {
|
|
84
|
+
...result,
|
|
85
|
+
keyAggContext,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
signTaprootInput(prepare, allPublicNonces, transaction, inputIndex, amount, sighashType) {
|
|
89
|
+
const sigType = sighashType || Signature.SIGHASH_ALL | Signature.SIGHASH_LOTUS;
|
|
90
|
+
const satoshisBN = new BN(amount);
|
|
91
|
+
const sighashBuffer = sighash(transaction, sigType, inputIndex, prepare.script, satoshisBN);
|
|
92
|
+
const normalizedSighash = this._normalizeMessage(sighashBuffer);
|
|
93
|
+
const aggregatedNonce = musigNonceAgg(allPublicNonces);
|
|
94
|
+
const entropy = this.config.extraInput !== undefined
|
|
95
|
+
? this.config.extraInput
|
|
96
|
+
: Random.getRandomBuffer(32);
|
|
97
|
+
const nonce = musigNonceGen(this.config.myPrivateKey, prepare.keyAggContext.aggregatedPubKey, normalizedSighash, entropy);
|
|
98
|
+
const myIndex = prepare.keyAggContext.pubkeys.findIndex(s => s.toString() === this.config.myPrivateKey.publicKey.toString());
|
|
99
|
+
return signTaprootKeyPathWithMuSig2(nonce, this.config.myPrivateKey, prepare.keyAggContext, myIndex, aggregatedNonce, normalizedSighash, prepare.tweak);
|
|
100
|
+
}
|
|
101
|
+
completeTaprootSigning(prepare, allPublicNonces, allPartialSigs, transaction, inputIndex, amount, sighashType) {
|
|
102
|
+
const sigType = sighashType || Signature.SIGHASH_ALL | Signature.SIGHASH_LOTUS;
|
|
103
|
+
const satoshisBN = new BN(amount);
|
|
104
|
+
const sighashBuffer = sighash(transaction, sigType, inputIndex, prepare.script, satoshisBN);
|
|
105
|
+
const normalizedSighash = this._normalizeMessage(sighashBuffer);
|
|
106
|
+
const aggregatedNonce = musigNonceAgg(allPublicNonces);
|
|
107
|
+
return musigSigAgg(allPartialSigs, aggregatedNonce, normalizedSighash, prepare.commitment);
|
|
108
|
+
}
|
|
109
|
+
createSession(message, metadata) {
|
|
110
|
+
if (!this.sessionManager) {
|
|
111
|
+
this.sessionManager = new MuSigSessionManager();
|
|
112
|
+
}
|
|
113
|
+
const normalizedMessage = this._normalizeMessage(message);
|
|
114
|
+
const session = this.sessionManager.createSession(this.config.signers, this.config.myPrivateKey, normalizedMessage, metadata);
|
|
115
|
+
return {
|
|
116
|
+
manager: this.sessionManager,
|
|
117
|
+
session,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
get myPublicKey() {
|
|
121
|
+
return this.config.myPrivateKey.publicKey;
|
|
122
|
+
}
|
|
123
|
+
get allSigners() {
|
|
124
|
+
return [...this.config.signers];
|
|
125
|
+
}
|
|
126
|
+
get myIndex() {
|
|
127
|
+
const sortedSigners = [...this.config.signers].sort((a, b) => {
|
|
128
|
+
const bufA = a.toBuffer();
|
|
129
|
+
const bufB = b.toBuffer();
|
|
130
|
+
return bufA.compare(bufB);
|
|
131
|
+
});
|
|
132
|
+
return sortedSigners.findIndex(s => s.toString() === this.config.myPrivateKey.publicKey.toString());
|
|
133
|
+
}
|
|
134
|
+
_normalizeMessage(message) {
|
|
135
|
+
if (typeof message === 'string') {
|
|
136
|
+
return Hash.sha256(Buffer.from(message, 'utf8'));
|
|
137
|
+
}
|
|
138
|
+
if (message.length === 32) {
|
|
139
|
+
return message;
|
|
140
|
+
}
|
|
141
|
+
return Hash.sha256(message);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
export function createMuSig2Signer(signers, myPrivateKey) {
|
|
145
|
+
return new MuSig2Signer({ signers, myPrivateKey });
|
|
146
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export interface NetworkConfig {
|
|
2
|
+
name: string;
|
|
3
|
+
alias: string;
|
|
4
|
+
pubkeyhash: number;
|
|
5
|
+
privatekey: number;
|
|
6
|
+
scripthash: number;
|
|
7
|
+
bech32prefix?: string;
|
|
8
|
+
xpubkey: number;
|
|
9
|
+
xprivkey: number;
|
|
10
|
+
networkMagic: Buffer;
|
|
11
|
+
port: number;
|
|
12
|
+
dnsSeeds: string[];
|
|
13
|
+
prefix?: string;
|
|
14
|
+
prefixArray?: number[];
|
|
15
|
+
networkbyte?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare class Network {
|
|
18
|
+
readonly name: string;
|
|
19
|
+
readonly alias: string;
|
|
20
|
+
readonly pubkeyhash: number;
|
|
21
|
+
readonly privatekey: number;
|
|
22
|
+
readonly scripthash: number;
|
|
23
|
+
readonly xpubkey: number;
|
|
24
|
+
readonly xprivkey: number;
|
|
25
|
+
readonly networkMagic: Buffer;
|
|
26
|
+
readonly port: number;
|
|
27
|
+
readonly dnsSeeds: string[];
|
|
28
|
+
readonly prefix?: string;
|
|
29
|
+
readonly prefixArray?: number[];
|
|
30
|
+
readonly networkbyte?: string;
|
|
31
|
+
constructor(config: NetworkConfig);
|
|
32
|
+
toString(): string;
|
|
33
|
+
}
|
|
34
|
+
export declare const livenet: Network;
|
|
35
|
+
export declare const testnet: Network;
|
|
36
|
+
export declare const regtest: Network;
|
|
37
|
+
export declare const networks: Network[];
|
|
38
|
+
export declare const networkMaps: Record<string, Network>;
|
|
39
|
+
export declare const defaultNetwork: Network;
|
|
40
|
+
export declare function get(arg: string | number | Network, keys?: string | string[]): Network | undefined;
|
|
41
|
+
export declare function add(data: NetworkConfig): Network;
|
|
42
|
+
export declare function remove(network: Network): void;
|
|
43
|
+
export declare const Networks: {
|
|
44
|
+
add: typeof add;
|
|
45
|
+
remove: typeof remove;
|
|
46
|
+
get: typeof get;
|
|
47
|
+
defaultNetwork: Network;
|
|
48
|
+
livenet: Network;
|
|
49
|
+
mainnet: Network;
|
|
50
|
+
testnet: Network;
|
|
51
|
+
regtest: Network;
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=networks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"networks.d.ts","sourceRoot":"","sources":["../../../lib/bitcore/networks.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,aAAa;IAE5B,IAAI,EAAE,MAAM,CAAA;IAEZ,KAAK,EAAE,MAAM,CAAA;IAEb,UAAU,EAAE,MAAM,CAAA;IAElB,UAAU,EAAE,MAAM,CAAA;IAElB,UAAU,EAAE,MAAM,CAAA;IAElB,YAAY,CAAC,EAAE,MAAM,CAAA;IAErB,OAAO,EAAE,MAAM,CAAA;IAEf,QAAQ,EAAE,MAAM,CAAA;IAEhB,YAAY,EAAE,MAAM,CAAA;IAEpB,IAAI,EAAE,MAAM,CAAA;IAEZ,QAAQ,EAAE,MAAM,EAAE,CAAA;IAElB,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IAEtB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,qBAAa,OAAO;IAClB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,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
|
4
|
+
result.push(prefix.charCodeAt(i) & 31);
|
|
5
|
+
}
|
|
6
|
+
return result;
|
|
7
|
+
}
|
|
8
|
+
export class Network {
|
|
9
|
+
name;
|
|
10
|
+
alias;
|
|
11
|
+
pubkeyhash;
|
|
12
|
+
privatekey;
|
|
13
|
+
scripthash;
|
|
14
|
+
xpubkey;
|
|
15
|
+
xprivkey;
|
|
16
|
+
networkMagic;
|
|
17
|
+
port;
|
|
18
|
+
dnsSeeds;
|
|
19
|
+
prefix;
|
|
20
|
+
prefixArray;
|
|
21
|
+
networkbyte;
|
|
22
|
+
constructor(config) {
|
|
23
|
+
this.name = config.name;
|
|
24
|
+
this.alias = config.alias;
|
|
25
|
+
this.pubkeyhash = config.pubkeyhash;
|
|
26
|
+
this.privatekey = config.privatekey;
|
|
27
|
+
this.scripthash = config.scripthash;
|
|
28
|
+
this.xpubkey = config.xpubkey;
|
|
29
|
+
this.xprivkey = config.xprivkey;
|
|
30
|
+
this.networkMagic = config.networkMagic;
|
|
31
|
+
this.port = config.port;
|
|
32
|
+
this.dnsSeeds = config.dnsSeeds;
|
|
33
|
+
this.prefix = config.prefix;
|
|
34
|
+
this.prefixArray = config.prefixArray;
|
|
35
|
+
this.networkbyte = config.networkbyte;
|
|
36
|
+
}
|
|
37
|
+
toString() {
|
|
38
|
+
return this.name;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export const livenet = new Network({
|
|
42
|
+
name: 'livenet',
|
|
43
|
+
alias: 'mainnet',
|
|
44
|
+
prefix: 'bitcoincash',
|
|
45
|
+
networkbyte: '_',
|
|
46
|
+
pubkeyhash: 0,
|
|
47
|
+
privatekey: 0x80,
|
|
48
|
+
scripthash: 5,
|
|
49
|
+
xpubkey: 0x0488b21e,
|
|
50
|
+
xprivkey: 0x0488ade4,
|
|
51
|
+
networkMagic: Buffer.from('ece7eff3', 'hex'),
|
|
52
|
+
port: 10605,
|
|
53
|
+
dnsSeeds: ['seed.lotusia.org'],
|
|
54
|
+
prefixArray: prefixToArray('bitcoincash'),
|
|
55
|
+
});
|
|
56
|
+
export const testnet = new Network({
|
|
57
|
+
name: 'testnet',
|
|
58
|
+
alias: 'test',
|
|
59
|
+
prefix: 'bchtest',
|
|
60
|
+
networkbyte: 'T',
|
|
61
|
+
pubkeyhash: 0x6f,
|
|
62
|
+
privatekey: 0xef,
|
|
63
|
+
scripthash: 0xc4,
|
|
64
|
+
xpubkey: 0x043587cf,
|
|
65
|
+
xprivkey: 0x04358394,
|
|
66
|
+
networkMagic: Buffer.from('ecf4f3f4', 'hex'),
|
|
67
|
+
port: 11605,
|
|
68
|
+
dnsSeeds: ['seed.lotusia.org'],
|
|
69
|
+
prefixArray: prefixToArray('bchtest'),
|
|
70
|
+
});
|
|
71
|
+
export const regtest = new Network({
|
|
72
|
+
name: 'regtest',
|
|
73
|
+
alias: 'reg',
|
|
74
|
+
prefix: 'bchreg',
|
|
75
|
+
networkbyte: 'R',
|
|
76
|
+
pubkeyhash: 0x6f,
|
|
77
|
+
privatekey: 0xef,
|
|
78
|
+
scripthash: 0xc4,
|
|
79
|
+
xpubkey: 0x043587cf,
|
|
80
|
+
xprivkey: 0x04358394,
|
|
81
|
+
networkMagic: Buffer.from('ecf2e5e7', 'hex'),
|
|
82
|
+
port: 12605,
|
|
83
|
+
dnsSeeds: [],
|
|
84
|
+
prefixArray: prefixToArray('bchreg'),
|
|
85
|
+
});
|
|
86
|
+
export const networks = [livenet, testnet, regtest];
|
|
87
|
+
export const networkMaps = {};
|
|
88
|
+
networks.forEach(network => {
|
|
89
|
+
networkMaps[network.name] = network;
|
|
90
|
+
networkMaps[network.alias] = network;
|
|
91
|
+
networkMaps[network.pubkeyhash] = network;
|
|
92
|
+
networkMaps[network.privatekey] = network;
|
|
93
|
+
networkMaps[network.scripthash] = network;
|
|
94
|
+
networkMaps[network.xpubkey] = network;
|
|
95
|
+
networkMaps[network.xprivkey] = network;
|
|
96
|
+
});
|
|
97
|
+
export const defaultNetwork = livenet;
|
|
98
|
+
export function get(arg, keys) {
|
|
99
|
+
if (networks.includes(arg)) {
|
|
100
|
+
return arg;
|
|
101
|
+
}
|
|
102
|
+
if (keys) {
|
|
103
|
+
const keyArray = Array.isArray(keys) ? keys : [keys];
|
|
104
|
+
for (const network of networks) {
|
|
105
|
+
const filteredNet = keyArray.reduce((acc, key) => {
|
|
106
|
+
acc[key] = network[key];
|
|
107
|
+
return acc;
|
|
108
|
+
}, {});
|
|
109
|
+
const netValues = Object.values(filteredNet);
|
|
110
|
+
if (netValues.includes(arg)) {
|
|
111
|
+
return network;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return undefined;
|
|
115
|
+
}
|
|
116
|
+
return networkMaps[arg];
|
|
117
|
+
}
|
|
118
|
+
export function add(data) {
|
|
119
|
+
const network = new Network(data);
|
|
120
|
+
networks.push(network);
|
|
121
|
+
networkMaps[network.name] = network;
|
|
122
|
+
networkMaps[network.alias] = network;
|
|
123
|
+
networkMaps[network.pubkeyhash] = network;
|
|
124
|
+
networkMaps[network.privatekey] = network;
|
|
125
|
+
networkMaps[network.scripthash] = network;
|
|
126
|
+
networkMaps[network.xpubkey] = network;
|
|
127
|
+
networkMaps[network.xprivkey] = network;
|
|
128
|
+
return network;
|
|
129
|
+
}
|
|
130
|
+
export function remove(network) {
|
|
131
|
+
const index = networks.indexOf(network);
|
|
132
|
+
if (index !== -1) {
|
|
133
|
+
networks.splice(index, 1);
|
|
134
|
+
Object.keys(networkMaps).forEach(key => {
|
|
135
|
+
if (networkMaps[key] === network) {
|
|
136
|
+
delete networkMaps[key];
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
export const Networks = {
|
|
142
|
+
add,
|
|
143
|
+
remove,
|
|
144
|
+
get,
|
|
145
|
+
defaultNetwork,
|
|
146
|
+
livenet,
|
|
147
|
+
mainnet: livenet,
|
|
148
|
+
testnet,
|
|
149
|
+
regtest,
|
|
150
|
+
};
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
export interface OpcodeData {
|
|
2
|
+
num: number;
|
|
3
|
+
}
|
|
4
|
+
export declare class Opcode {
|
|
5
|
+
readonly num: number;
|
|
6
|
+
constructor(num: number | string);
|
|
7
|
+
static fromBuffer(buf: Buffer): Opcode;
|
|
8
|
+
toBuffer(): Buffer;
|
|
9
|
+
toString(): string;
|
|
10
|
+
static readonly OP_0 = 0;
|
|
11
|
+
static readonly OP_FALSE = 0;
|
|
12
|
+
static readonly OP_PUSHDATA1 = 76;
|
|
13
|
+
static readonly OP_PUSHDATA2 = 77;
|
|
14
|
+
static readonly OP_PUSHDATA4 = 78;
|
|
15
|
+
static readonly OP_1NEGATE = 79;
|
|
16
|
+
static readonly OP_RESERVED = 80;
|
|
17
|
+
static readonly OP_1 = 81;
|
|
18
|
+
static readonly OP_TRUE = 81;
|
|
19
|
+
static readonly OP_2 = 82;
|
|
20
|
+
static readonly OP_3 = 83;
|
|
21
|
+
static readonly OP_4 = 84;
|
|
22
|
+
static readonly OP_5 = 85;
|
|
23
|
+
static readonly OP_6 = 86;
|
|
24
|
+
static readonly OP_7 = 87;
|
|
25
|
+
static readonly OP_8 = 88;
|
|
26
|
+
static readonly OP_9 = 89;
|
|
27
|
+
static readonly OP_10 = 90;
|
|
28
|
+
static readonly OP_11 = 91;
|
|
29
|
+
static readonly OP_12 = 92;
|
|
30
|
+
static readonly OP_13 = 93;
|
|
31
|
+
static readonly OP_14 = 94;
|
|
32
|
+
static readonly OP_15 = 95;
|
|
33
|
+
static readonly OP_16 = 96;
|
|
34
|
+
static readonly OP_NOP = 97;
|
|
35
|
+
static readonly OP_SCRIPTTYPE = 98;
|
|
36
|
+
static readonly OP_VER = 98;
|
|
37
|
+
static readonly OP_IF = 99;
|
|
38
|
+
static readonly OP_NOTIF = 100;
|
|
39
|
+
static readonly OP_VERIF = 101;
|
|
40
|
+
static readonly OP_VERNOTIF = 102;
|
|
41
|
+
static readonly OP_ELSE = 103;
|
|
42
|
+
static readonly OP_ENDIF = 104;
|
|
43
|
+
static readonly OP_VERIFY = 105;
|
|
44
|
+
static readonly OP_RETURN = 106;
|
|
45
|
+
static readonly OP_TOALTSTACK = 107;
|
|
46
|
+
static readonly OP_FROMALTSTACK = 108;
|
|
47
|
+
static readonly OP_2DROP = 109;
|
|
48
|
+
static readonly OP_2DUP = 110;
|
|
49
|
+
static readonly OP_3DUP = 111;
|
|
50
|
+
static readonly OP_2OVER = 112;
|
|
51
|
+
static readonly OP_2ROT = 113;
|
|
52
|
+
static readonly OP_2SWAP = 114;
|
|
53
|
+
static readonly OP_IFDUP = 115;
|
|
54
|
+
static readonly OP_DEPTH = 116;
|
|
55
|
+
static readonly OP_DROP = 117;
|
|
56
|
+
static readonly OP_DUP = 118;
|
|
57
|
+
static readonly OP_NIP = 119;
|
|
58
|
+
static readonly OP_OVER = 120;
|
|
59
|
+
static readonly OP_PICK = 121;
|
|
60
|
+
static readonly OP_ROLL = 122;
|
|
61
|
+
static readonly OP_ROT = 123;
|
|
62
|
+
static readonly OP_SWAP = 124;
|
|
63
|
+
static readonly OP_TUCK = 125;
|
|
64
|
+
static readonly OP_CAT = 126;
|
|
65
|
+
static readonly OP_SPLIT = 127;
|
|
66
|
+
static readonly OP_NUM2BIN = 128;
|
|
67
|
+
static readonly OP_BIN2NUM = 129;
|
|
68
|
+
static readonly OP_SIZE = 130;
|
|
69
|
+
static readonly OP_INVERT = 131;
|
|
70
|
+
static readonly OP_AND = 132;
|
|
71
|
+
static readonly OP_OR = 133;
|
|
72
|
+
static readonly OP_XOR = 134;
|
|
73
|
+
static readonly OP_EQUAL = 135;
|
|
74
|
+
static readonly OP_EQUALVERIFY = 136;
|
|
75
|
+
static readonly OP_RESERVED1 = 137;
|
|
76
|
+
static readonly OP_RESERVED2 = 138;
|
|
77
|
+
static readonly OP_1ADD = 139;
|
|
78
|
+
static readonly OP_1SUB = 140;
|
|
79
|
+
static readonly OP_2MUL = 141;
|
|
80
|
+
static readonly OP_2DIV = 142;
|
|
81
|
+
static readonly OP_NEGATE = 143;
|
|
82
|
+
static readonly OP_ABS = 144;
|
|
83
|
+
static readonly OP_NOT = 145;
|
|
84
|
+
static readonly OP_0NOTEQUAL = 146;
|
|
85
|
+
static readonly OP_ADD = 147;
|
|
86
|
+
static readonly OP_SUB = 148;
|
|
87
|
+
static readonly OP_MUL = 149;
|
|
88
|
+
static readonly OP_DIV = 150;
|
|
89
|
+
static readonly OP_MOD = 151;
|
|
90
|
+
static readonly OP_LSHIFT = 152;
|
|
91
|
+
static readonly OP_RSHIFT = 153;
|
|
92
|
+
static readonly OP_BOOLAND = 154;
|
|
93
|
+
static readonly OP_BOOLOR = 155;
|
|
94
|
+
static readonly OP_NUMEQUAL = 156;
|
|
95
|
+
static readonly OP_NUMEQUALVERIFY = 157;
|
|
96
|
+
static readonly OP_NUMNOTEQUAL = 158;
|
|
97
|
+
static readonly OP_LESSTHAN = 159;
|
|
98
|
+
static readonly OP_GREATERTHAN = 160;
|
|
99
|
+
static readonly OP_LESSTHANOREQUAL = 161;
|
|
100
|
+
static readonly OP_GREATERTHANOREQUAL = 162;
|
|
101
|
+
static readonly OP_MIN = 163;
|
|
102
|
+
static readonly OP_MAX = 164;
|
|
103
|
+
static readonly OP_WITHIN = 165;
|
|
104
|
+
static readonly OP_RIPEMD160 = 166;
|
|
105
|
+
static readonly OP_SHA1 = 167;
|
|
106
|
+
static readonly OP_SHA256 = 168;
|
|
107
|
+
static readonly OP_HASH160 = 169;
|
|
108
|
+
static readonly OP_HASH256 = 170;
|
|
109
|
+
static readonly OP_CODESEPARATOR = 171;
|
|
110
|
+
static readonly OP_CHECKSIG = 172;
|
|
111
|
+
static readonly OP_CHECKSIGVERIFY = 173;
|
|
112
|
+
static readonly OP_CHECKMULTISIG = 174;
|
|
113
|
+
static readonly OP_CHECKMULTISIGVERIFY = 175;
|
|
114
|
+
static readonly OP_NOP1 = 176;
|
|
115
|
+
static readonly OP_CHECKLOCKTIMEVERIFY = 177;
|
|
116
|
+
static readonly OP_NOP2 = 177;
|
|
117
|
+
static readonly OP_CHECKSEQUENCEVERIFY = 178;
|
|
118
|
+
static readonly OP_NOP3 = 178;
|
|
119
|
+
static readonly OP_NOP4 = 179;
|
|
120
|
+
static readonly OP_NOP5 = 180;
|
|
121
|
+
static readonly OP_NOP6 = 181;
|
|
122
|
+
static readonly OP_NOP7 = 182;
|
|
123
|
+
static readonly OP_NOP8 = 183;
|
|
124
|
+
static readonly OP_NOP9 = 184;
|
|
125
|
+
static readonly OP_NOP10 = 185;
|
|
126
|
+
static readonly OP_CHECKDATASIG = 186;
|
|
127
|
+
static readonly OP_CHECKDATASIGVERIFY = 187;
|
|
128
|
+
static readonly OP_REVERSEBYTES = 188;
|
|
129
|
+
static readonly map: {
|
|
130
|
+
readonly OP_0: 0;
|
|
131
|
+
readonly OP_FALSE: 0;
|
|
132
|
+
readonly OP_PUSHDATA1: 76;
|
|
133
|
+
readonly OP_PUSHDATA2: 77;
|
|
134
|
+
readonly OP_PUSHDATA4: 78;
|
|
135
|
+
readonly OP_1NEGATE: 79;
|
|
136
|
+
readonly OP_RESERVED: 80;
|
|
137
|
+
readonly OP_1: 81;
|
|
138
|
+
readonly OP_TRUE: 81;
|
|
139
|
+
readonly OP_2: 82;
|
|
140
|
+
readonly OP_3: 83;
|
|
141
|
+
readonly OP_4: 84;
|
|
142
|
+
readonly OP_5: 85;
|
|
143
|
+
readonly OP_6: 86;
|
|
144
|
+
readonly OP_7: 87;
|
|
145
|
+
readonly OP_8: 88;
|
|
146
|
+
readonly OP_9: 89;
|
|
147
|
+
readonly OP_10: 90;
|
|
148
|
+
readonly OP_11: 91;
|
|
149
|
+
readonly OP_12: 92;
|
|
150
|
+
readonly OP_13: 93;
|
|
151
|
+
readonly OP_14: 94;
|
|
152
|
+
readonly OP_15: 95;
|
|
153
|
+
readonly OP_16: 96;
|
|
154
|
+
readonly OP_NOP: 97;
|
|
155
|
+
readonly OP_SCRIPTTYPE: 98;
|
|
156
|
+
readonly OP_IF: 99;
|
|
157
|
+
readonly OP_NOTIF: 100;
|
|
158
|
+
readonly OP_VERIF: 101;
|
|
159
|
+
readonly OP_VERNOTIF: 102;
|
|
160
|
+
readonly OP_ELSE: 103;
|
|
161
|
+
readonly OP_ENDIF: 104;
|
|
162
|
+
readonly OP_VERIFY: 105;
|
|
163
|
+
readonly OP_RETURN: 106;
|
|
164
|
+
readonly OP_TOALTSTACK: 107;
|
|
165
|
+
readonly OP_FROMALTSTACK: 108;
|
|
166
|
+
readonly OP_2DROP: 109;
|
|
167
|
+
readonly OP_2DUP: 110;
|
|
168
|
+
readonly OP_3DUP: 111;
|
|
169
|
+
readonly OP_2OVER: 112;
|
|
170
|
+
readonly OP_2ROT: 113;
|
|
171
|
+
readonly OP_2SWAP: 114;
|
|
172
|
+
readonly OP_IFDUP: 115;
|
|
173
|
+
readonly OP_DEPTH: 116;
|
|
174
|
+
readonly OP_DROP: 117;
|
|
175
|
+
readonly OP_DUP: 118;
|
|
176
|
+
readonly OP_NIP: 119;
|
|
177
|
+
readonly OP_OVER: 120;
|
|
178
|
+
readonly OP_PICK: 121;
|
|
179
|
+
readonly OP_ROLL: 122;
|
|
180
|
+
readonly OP_ROT: 123;
|
|
181
|
+
readonly OP_SWAP: 124;
|
|
182
|
+
readonly OP_TUCK: 125;
|
|
183
|
+
readonly OP_CAT: 126;
|
|
184
|
+
readonly OP_SPLIT: 127;
|
|
185
|
+
readonly OP_NUM2BIN: 128;
|
|
186
|
+
readonly OP_BIN2NUM: 129;
|
|
187
|
+
readonly OP_SIZE: 130;
|
|
188
|
+
readonly OP_INVERT: 131;
|
|
189
|
+
readonly OP_AND: 132;
|
|
190
|
+
readonly OP_OR: 133;
|
|
191
|
+
readonly OP_XOR: 134;
|
|
192
|
+
readonly OP_EQUAL: 135;
|
|
193
|
+
readonly OP_EQUALVERIFY: 136;
|
|
194
|
+
readonly OP_RESERVED1: 137;
|
|
195
|
+
readonly OP_RESERVED2: 138;
|
|
196
|
+
readonly OP_1ADD: 139;
|
|
197
|
+
readonly OP_1SUB: 140;
|
|
198
|
+
readonly OP_2MUL: 141;
|
|
199
|
+
readonly OP_2DIV: 142;
|
|
200
|
+
readonly OP_NEGATE: 143;
|
|
201
|
+
readonly OP_ABS: 144;
|
|
202
|
+
readonly OP_NOT: 145;
|
|
203
|
+
readonly OP_0NOTEQUAL: 146;
|
|
204
|
+
readonly OP_ADD: 147;
|
|
205
|
+
readonly OP_SUB: 148;
|
|
206
|
+
readonly OP_MUL: 149;
|
|
207
|
+
readonly OP_DIV: 150;
|
|
208
|
+
readonly OP_MOD: 151;
|
|
209
|
+
readonly OP_LSHIFT: 152;
|
|
210
|
+
readonly OP_RSHIFT: 153;
|
|
211
|
+
readonly OP_BOOLAND: 154;
|
|
212
|
+
readonly OP_BOOLOR: 155;
|
|
213
|
+
readonly OP_NUMEQUAL: 156;
|
|
214
|
+
readonly OP_NUMEQUALVERIFY: 157;
|
|
215
|
+
readonly OP_NUMNOTEQUAL: 158;
|
|
216
|
+
readonly OP_LESSTHAN: 159;
|
|
217
|
+
readonly OP_GREATERTHAN: 160;
|
|
218
|
+
readonly OP_LESSTHANOREQUAL: 161;
|
|
219
|
+
readonly OP_GREATERTHANOREQUAL: 162;
|
|
220
|
+
readonly OP_MIN: 163;
|
|
221
|
+
readonly OP_MAX: 164;
|
|
222
|
+
readonly OP_WITHIN: 165;
|
|
223
|
+
readonly OP_RIPEMD160: 166;
|
|
224
|
+
readonly OP_SHA1: 167;
|
|
225
|
+
readonly OP_SHA256: 168;
|
|
226
|
+
readonly OP_HASH160: 169;
|
|
227
|
+
readonly OP_HASH256: 170;
|
|
228
|
+
readonly OP_CODESEPARATOR: 171;
|
|
229
|
+
readonly OP_CHECKSIG: 172;
|
|
230
|
+
readonly OP_CHECKSIGVERIFY: 173;
|
|
231
|
+
readonly OP_CHECKMULTISIG: 174;
|
|
232
|
+
readonly OP_CHECKMULTISIGVERIFY: 175;
|
|
233
|
+
readonly OP_NOP1: 176;
|
|
234
|
+
readonly OP_CHECKLOCKTIMEVERIFY: 177;
|
|
235
|
+
readonly OP_NOP2: 177;
|
|
236
|
+
readonly OP_CHECKSEQUENCEVERIFY: 178;
|
|
237
|
+
readonly OP_NOP3: 178;
|
|
238
|
+
readonly OP_NOP4: 179;
|
|
239
|
+
readonly OP_NOP5: 180;
|
|
240
|
+
readonly OP_NOP6: 181;
|
|
241
|
+
readonly OP_NOP7: 182;
|
|
242
|
+
readonly OP_NOP8: 183;
|
|
243
|
+
readonly OP_NOP9: 184;
|
|
244
|
+
readonly OP_NOP10: 185;
|
|
245
|
+
readonly OP_CHECKDATASIG: 186;
|
|
246
|
+
readonly OP_CHECKDATASIGVERIFY: 187;
|
|
247
|
+
readonly OP_REVERSEBYTES: 188;
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
//# sourceMappingURL=opcode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opcode.d.ts","sourceRoot":"","sources":["../../../lib/bitcore/opcode.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,qBAAa,MAAM;IACjB,QAAQ,CAAC,GAAG,EAAG,MAAM,CAAA;gBAET,GAAG,EAAE,MAAM,GAAG,MAAM;IAchC,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAMtC,QAAQ,IAAI,MAAM;IAIlB,QAAQ,IAAI,MAAM;IAOlB,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAI;IAExB,MAAM,CAAC,QAAQ,CAAC,QAAQ,KAAI;IAE5B,MAAM,CAAC,QAAQ,CAAC,YAAY,MAAK;IAEjC,MAAM,CAAC,QAAQ,CAAC,YAAY,MAAK;IAEjC,MAAM,CAAC,QAAQ,CAAC,YAAY,MAAK;IAEjC,MAAM,CAAC,QAAQ,CAAC,UAAU,MAAK;IAE/B,MAAM,CAAC,QAAQ,CAAC,WAAW,MAAK;IAEhC,MAAM,CA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