xpi-ts 0.2.18 → 0.2.20
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/dist/cjs/index.js +2 -24
- package/dist/cjs/lib/bitcore/crypto/bn.js +7 -10
- package/dist/cjs/lib/bitcore/crypto/point.js +2 -5
- package/dist/cjs/lib/bitcore/encoding/base58.js +1 -4
- package/dist/cjs/lib/bitcore/encoding/base58check.js +1 -4
- package/dist/cjs/lib/bitcore/mnemonic/index.js +1 -4
- package/dist/cjs/lib/rank/index.js +37 -20
- package/dist/cjs/lib/rank/script.js +1 -4
- package/dist/esm/index.js +7 -46
- package/dist/esm/jest.config.js +1 -3
- package/dist/esm/lib/bitcore/address.js +72 -76
- package/dist/esm/lib/bitcore/block/block.js +44 -48
- package/dist/esm/lib/bitcore/block/blockheader.js +55 -59
- package/dist/esm/lib/bitcore/block/index.js +3 -9
- package/dist/esm/lib/bitcore/block/merkleblock.js +49 -55
- package/dist/esm/lib/bitcore/crypto/bn.js +20 -26
- package/dist/esm/lib/bitcore/crypto/ecdsa.js +45 -49
- package/dist/esm/lib/bitcore/crypto/hash.js +23 -27
- package/dist/esm/lib/bitcore/crypto/index.js +8 -22
- package/dist/esm/lib/bitcore/crypto/musig2.js +66 -76
- package/dist/esm/lib/bitcore/crypto/point.js +31 -38
- package/dist/esm/lib/bitcore/crypto/random.js +5 -9
- package/dist/esm/lib/bitcore/crypto/schnorr.js +37 -41
- package/dist/esm/lib/bitcore/crypto/signature.js +31 -35
- package/dist/esm/lib/bitcore/crypto/sigtype.js +4 -10
- package/dist/esm/lib/bitcore/encoding/base58.js +8 -15
- package/dist/esm/lib/bitcore/encoding/base58check.js +10 -17
- package/dist/esm/lib/bitcore/encoding/bufferreader.js +18 -22
- package/dist/esm/lib/bitcore/encoding/bufferwriter.js +23 -27
- package/dist/esm/lib/bitcore/encoding/varint.js +13 -17
- package/dist/esm/lib/bitcore/errors.js +1 -5
- package/dist/esm/lib/bitcore/hdprivatekey.js +63 -67
- package/dist/esm/lib/bitcore/hdpublickey.js +68 -72
- package/dist/esm/lib/bitcore/index.js +42 -167
- package/dist/esm/lib/bitcore/message.js +36 -40
- package/dist/esm/lib/bitcore/mnemonic/errors.js +2 -5
- package/dist/esm/lib/bitcore/mnemonic/index.js +4 -15
- package/dist/esm/lib/bitcore/mnemonic/mnemonic.js +24 -28
- package/dist/esm/lib/bitcore/mnemonic/pbkdf2.js +8 -11
- package/dist/esm/lib/bitcore/mnemonic/words/english.js +1 -4
- package/dist/esm/lib/bitcore/mnemonic/words/french.js +1 -4
- package/dist/esm/lib/bitcore/mnemonic/words/index.js +5 -8
- package/dist/esm/lib/bitcore/musig2/index.js +2 -9
- package/dist/esm/lib/bitcore/musig2/session.js +28 -32
- package/dist/esm/lib/bitcore/musig2/signer.js +38 -43
- package/dist/esm/lib/bitcore/networks.js +44 -51
- package/dist/esm/lib/bitcore/opcode.js +8 -12
- package/dist/esm/lib/bitcore/privatekey.js +39 -43
- package/dist/esm/lib/bitcore/publickey.js +46 -50
- package/dist/esm/lib/bitcore/script/chunk.js +1 -5
- package/dist/esm/lib/bitcore/script/interpreter/condition-stack.js +1 -5
- package/dist/esm/lib/bitcore/script/interpreter/index.js +4 -25
- package/dist/esm/lib/bitcore/script/interpreter/interpreter.js +379 -385
- package/dist/esm/lib/bitcore/script/interpreter/script-num.js +10 -15
- package/dist/esm/lib/bitcore/script/interpreter/types.js +14 -17
- package/dist/esm/lib/bitcore/script/taproot.js +107 -130
- package/dist/esm/lib/bitcore/script.js +201 -205
- package/dist/esm/lib/bitcore/taproot/musig2.js +40 -48
- package/dist/esm/lib/bitcore/transaction/index.js +6 -23
- package/dist/esm/lib/bitcore/transaction/input/multisig.js +2 -6
- package/dist/esm/lib/bitcore/transaction/input/multisigscripthash.js +2 -6
- package/dist/esm/lib/bitcore/transaction/input/publickey.js +2 -6
- package/dist/esm/lib/bitcore/transaction/input/publickeyhash.js +2 -6
- package/dist/esm/lib/bitcore/transaction/input/taproot.js +2 -6
- package/dist/esm/lib/bitcore/transaction/input.js +129 -139
- package/dist/esm/lib/bitcore/transaction/outpoint.js +13 -17
- package/dist/esm/lib/bitcore/transaction/output.js +31 -35
- package/dist/esm/lib/bitcore/transaction/sighash.js +99 -104
- package/dist/esm/lib/bitcore/transaction/signature.js +38 -42
- package/dist/esm/lib/bitcore/transaction/transaction.js +111 -115
- package/dist/esm/lib/bitcore/transaction/unspentoutput.js +23 -27
- package/dist/esm/lib/bitcore/unit.js +3 -7
- package/dist/esm/lib/bitcore/uri.js +4 -8
- package/dist/esm/lib/bitcore/util/base32.js +6 -10
- package/dist/esm/lib/bitcore/util/bits.js +4 -10
- package/dist/esm/lib/bitcore/util/buffer.js +18 -22
- package/dist/esm/lib/bitcore/util/convertBits.js +4 -7
- package/dist/esm/lib/bitcore/util/js.js +1 -5
- package/dist/esm/lib/bitcore/util/merkle.js +9 -15
- package/dist/esm/lib/bitcore/util/preconditions.js +9 -13
- package/dist/esm/lib/bitcore/util.js +12 -19
- package/dist/esm/lib/bitcore/xaddress.js +46 -50
- package/dist/esm/lib/nft.js +55 -60
- package/dist/esm/lib/rank/api.js +1 -4
- package/dist/esm/lib/rank/index.js +150 -147
- package/dist/esm/lib/rank/opcode.js +1 -3
- package/dist/esm/lib/rank/script.js +5 -11
- package/dist/esm/lib/rank/transaction.js +6 -9
- package/dist/esm/lib/rpc.js +3 -7
- package/dist/esm/utils/constants.js +10 -13
- package/dist/esm/utils/env.js +2 -6
- package/dist/esm/utils/string.js +16 -28
- package/dist/esm/utils/wallet.js +8 -11
- package/dist/types/lib/bitcore/crypto/bn.d.ts +2 -1
- package/dist/types/lib/bitcore/crypto/bn.d.ts.map +1 -1
- package/dist/types/lib/bitcore/crypto/point.d.ts.map +1 -1
- package/dist/types/lib/rank/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -10,36 +10,14 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
11
|
o[k2] = m[k];
|
|
12
12
|
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
15
|
};
|
|
21
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
-
var ownKeys = function(o) {
|
|
23
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
-
var ar = [];
|
|
25
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
-
return ar;
|
|
27
|
-
};
|
|
28
|
-
return ownKeys(o);
|
|
29
|
-
};
|
|
30
|
-
return function (mod) {
|
|
31
|
-
if (mod && mod.__esModule) return mod;
|
|
32
|
-
var result = {};
|
|
33
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
-
__setModuleDefault(result, mod);
|
|
35
|
-
return result;
|
|
36
|
-
};
|
|
37
|
-
})();
|
|
38
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
17
|
exports.RANK = exports.Bitcore = void 0;
|
|
40
18
|
__exportStar(require("./lib/rpc.js"), exports);
|
|
41
|
-
exports.Bitcore =
|
|
42
|
-
exports.RANK =
|
|
19
|
+
exports.Bitcore = require("./lib/bitcore/index.js");
|
|
20
|
+
exports.RANK = require("./lib/rank/index.js");
|
|
43
21
|
__exportStar(require("./utils/constants.js"), exports);
|
|
44
22
|
__exportStar(require("./utils/env.js"), exports);
|
|
45
23
|
__exportStar(require("./utils/string.js"), exports);
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.BN = void 0;
|
|
7
|
-
const bn_js_1 =
|
|
4
|
+
const bn_js_1 = require("bn.js");
|
|
8
5
|
const util_1 = require("../util");
|
|
9
6
|
class BNWrapper {
|
|
10
7
|
static Zero = new BNWrapper(0);
|
|
@@ -12,20 +9,20 @@ class BNWrapper {
|
|
|
12
9
|
static Minus1 = new BNWrapper(-1);
|
|
13
10
|
_bn;
|
|
14
11
|
constructor(n, base) {
|
|
15
|
-
if (n instanceof bn_js_1.
|
|
12
|
+
if (n instanceof bn_js_1.BN) {
|
|
16
13
|
this._bn = n.clone();
|
|
17
14
|
}
|
|
18
15
|
else if (util_1.BufferUtil.isBuffer(n)) {
|
|
19
16
|
if (base === 'le' || base === 'be') {
|
|
20
|
-
this._bn = new bn_js_1.
|
|
17
|
+
this._bn = new bn_js_1.BN(n, undefined, base);
|
|
21
18
|
}
|
|
22
19
|
else {
|
|
23
|
-
this._bn = new bn_js_1.
|
|
20
|
+
this._bn = new bn_js_1.BN(n, base || 'hex');
|
|
24
21
|
}
|
|
25
22
|
}
|
|
26
23
|
else {
|
|
27
24
|
const validBase = base === 'hex' || typeof base === 'number' ? base : undefined;
|
|
28
|
-
this._bn = new bn_js_1.
|
|
25
|
+
this._bn = new bn_js_1.BN(n, validBase);
|
|
29
26
|
}
|
|
30
27
|
}
|
|
31
28
|
static fromString(str, base) {
|
|
@@ -151,13 +148,13 @@ class BNWrapper {
|
|
|
151
148
|
return new BNWrapper(this._bn.div(r._bn));
|
|
152
149
|
}
|
|
153
150
|
modPow(exponent, modulus) {
|
|
154
|
-
const red = bn_js_1.
|
|
151
|
+
const red = bn_js_1.BN.red(modulus._bn);
|
|
155
152
|
const base = this._bn.toRed(red);
|
|
156
153
|
const result = base.redPow(exponent._bn);
|
|
157
154
|
return new BNWrapper(result.fromRed());
|
|
158
155
|
}
|
|
159
156
|
and(other) {
|
|
160
|
-
const otherBN = other instanceof BNWrapper ? other._bn : new bn_js_1.
|
|
157
|
+
const otherBN = other instanceof BNWrapper ? other._bn : new bn_js_1.BN(other);
|
|
161
158
|
return new BNWrapper(this._bn.and(otherBN));
|
|
162
159
|
}
|
|
163
160
|
neg() {
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.Point = exports.PREFIX_Y_EVEN = exports.PREFIX_Y_ODD = void 0;
|
|
7
|
-
const elliptic_1 =
|
|
4
|
+
const elliptic_1 = require("elliptic");
|
|
8
5
|
const bn_1 = require("./bn");
|
|
9
6
|
const util_1 = require("../util");
|
|
10
|
-
const ecInstance = new elliptic_1.
|
|
7
|
+
const ecInstance = new elliptic_1.ec('secp256k1');
|
|
11
8
|
const ecPoint = ecInstance.curve.point.bind(ecInstance.curve);
|
|
12
9
|
const ecPointFromX = ecInstance.curve.pointFromX.bind(ecInstance.curve);
|
|
13
10
|
exports.PREFIX_Y_ODD = 0x03;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.Base58 = void 0;
|
|
7
|
-
const bs58_1 =
|
|
4
|
+
const bs58_1 = require("bs58");
|
|
8
5
|
const util_1 = require("../util");
|
|
9
6
|
const ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'.split('');
|
|
10
7
|
class Base58 {
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.Base58Check = void 0;
|
|
7
4
|
const sha2_1 = require("@noble/hashes/sha2");
|
|
8
|
-
const bs58_1 =
|
|
5
|
+
const bs58_1 = require("bs58");
|
|
9
6
|
const util_1 = require("../util");
|
|
10
7
|
class Base58Check {
|
|
11
8
|
static encode(buf) {
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.Words = exports.pbkdf2 = exports.MnemonicError = exports.default = exports.Mnemonic = void 0;
|
|
7
4
|
var mnemonic_js_1 = require("./mnemonic.js");
|
|
8
5
|
Object.defineProperty(exports, "Mnemonic", { enumerable: true, get: function () { return mnemonic_js_1.Mnemonic; } });
|
|
9
|
-
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return
|
|
6
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return mnemonic_js_1.default; } });
|
|
10
7
|
var errors_js_1 = require("./errors.js");
|
|
11
8
|
Object.defineProperty(exports, "MnemonicError", { enumerable: true, get: function () { return errors_js_1.MnemonicError; } });
|
|
12
9
|
var pbkdf2_js_1 = require("./pbkdf2.js");
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.ScriptProcessor = exports.PlatformConfiguration = exports.ScriptChunksOptionalRANKMap = exports.ScriptChunksRANKMap = exports.RANK_SCRIPT_REQUIRED_LENGTH = exports.ScriptChunksRNKCMap = exports.SCRIPT_CHUNK_PLATFORM = exports.RANK_SENTIMENT_OP_CODES = exports.SCRIPT_CHUNK_SENTIMENT = exports.RANK_SENTIMENT_NEGATIVE = exports.RANK_SENTIMENT_POSITIVE = exports.RANK_SENTIMENT_NEUTRAL = exports.SCRIPT_CHUNK_LOKAD = exports.LOKAD_PREFIX_RNKC = exports.LOKAD_PREFIX_RANK = void 0;
|
|
7
4
|
exports.toProfileIdBuf = toProfileIdBuf;
|
|
@@ -17,7 +14,7 @@ exports.toScriptRNKC = toScriptRNKC;
|
|
|
17
14
|
const buffer_1 = require("buffer/");
|
|
18
15
|
const constants_js_1 = require("../../utils/constants.js");
|
|
19
16
|
const string_js_1 = require("../../utils/string.js");
|
|
20
|
-
const opcode_js_1 =
|
|
17
|
+
const opcode_js_1 = require("./opcode.js");
|
|
21
18
|
const script_js_1 = require("./script.js");
|
|
22
19
|
exports.LOKAD_PREFIX_RANK = 0x52414e4b;
|
|
23
20
|
exports.LOKAD_PREFIX_RNKC = 0x524e4b43;
|
|
@@ -88,8 +85,8 @@ exports.ScriptChunksOptionalRANKMap.set('instanceId', {
|
|
|
88
85
|
exports.PlatformConfiguration = new Map();
|
|
89
86
|
exports.PlatformConfiguration.set('lotusia', {
|
|
90
87
|
profileId: {
|
|
91
|
-
len:
|
|
92
|
-
regex: /^[0-9a-fA-F]{40}$/,
|
|
88
|
+
len: 33,
|
|
89
|
+
regex: /^[0-9a-fA-F]{40,66}$/,
|
|
93
90
|
},
|
|
94
91
|
postId: {
|
|
95
92
|
len: 32,
|
|
@@ -120,20 +117,25 @@ function toProfileIdBuf(platform, profileId) {
|
|
|
120
117
|
if (profileIdSpec.regex && !profileIdSpec.regex.test(profileId)) {
|
|
121
118
|
return null;
|
|
122
119
|
}
|
|
123
|
-
const profileBuf = buffer_1.Buffer.alloc(profileIdSpec.len);
|
|
124
120
|
switch (platform) {
|
|
125
121
|
case 'lotusia': {
|
|
126
122
|
const profileIdHex = buffer_1.Buffer.from(profileId, 'hex');
|
|
127
|
-
|
|
128
|
-
|
|
123
|
+
const actualLen = profileIdHex.length;
|
|
124
|
+
if (actualLen !== 20 && actualLen !== 33) {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
const profileBuf = buffer_1.Buffer.alloc(actualLen);
|
|
128
|
+
profileIdHex.copy(profileBuf, 0);
|
|
129
|
+
return profileBuf;
|
|
129
130
|
}
|
|
130
|
-
case 'twitter':
|
|
131
|
+
case 'twitter': {
|
|
132
|
+
const profileBuf = buffer_1.Buffer.alloc(profileIdSpec.len);
|
|
131
133
|
buffer_1.Buffer.from(profileId, 'utf8').copy(profileBuf, profileIdSpec.len - profileId.length);
|
|
132
|
-
|
|
134
|
+
return profileBuf;
|
|
135
|
+
}
|
|
133
136
|
default:
|
|
134
137
|
return null;
|
|
135
138
|
}
|
|
136
|
-
return profileBuf;
|
|
137
139
|
}
|
|
138
140
|
function toProfileIdUTF8(profileIdBuf) {
|
|
139
141
|
return new TextDecoder('utf-8').decode(profileIdBuf.filter(byte => byte != 0x00));
|
|
@@ -190,8 +192,9 @@ function toScriptRANK(sentiment, platform, profileId, postId) {
|
|
|
190
192
|
break;
|
|
191
193
|
}
|
|
192
194
|
script += (0, string_js_1.toHex)(1) + (0, string_js_1.toHex)(toPlatformBuf(platform));
|
|
193
|
-
|
|
194
|
-
script += (0, string_js_1.toHex)(
|
|
195
|
+
const profileIdBuf = toProfileIdBuf(platform, profileId);
|
|
196
|
+
script += (0, string_js_1.toHex)(profileIdBuf.length);
|
|
197
|
+
script += (0, string_js_1.toHex)(profileIdBuf);
|
|
195
198
|
if (postId) {
|
|
196
199
|
if (!platformSpec.postId) {
|
|
197
200
|
throw new Error('Post ID provided, but no platform post specification defined');
|
|
@@ -225,8 +228,9 @@ function toScriptRNKC({ platform, profileId, postId, comment, }) {
|
|
|
225
228
|
const LOKAD_PREFIX = (0, string_js_1.toHex)(exports.LOKAD_PREFIX_RNKC);
|
|
226
229
|
let scriptRNKC = OP_RETURN + (0, string_js_1.toHex)(4) + LOKAD_PREFIX;
|
|
227
230
|
scriptRNKC += (0, string_js_1.toHex)(1) + (0, string_js_1.toHex)(toPlatformBuf(platform));
|
|
228
|
-
|
|
229
|
-
scriptRNKC += (0, string_js_1.toHex)(
|
|
231
|
+
const profileIdBuf = toProfileIdBuf(platform, profileId);
|
|
232
|
+
scriptRNKC += (0, string_js_1.toHex)(profileIdBuf.length);
|
|
233
|
+
scriptRNKC += (0, string_js_1.toHex)(profileIdBuf);
|
|
230
234
|
if (postId) {
|
|
231
235
|
scriptRNKC += (0, string_js_1.toHex)(platformSpec.postId.len);
|
|
232
236
|
scriptRNKC += (0, string_js_1.toHex)(toPostIdBuf(platform, postId));
|
|
@@ -311,9 +315,16 @@ class ScriptProcessor {
|
|
|
311
315
|
if (!platformSpec || !platformSpec.profileId) {
|
|
312
316
|
return undefined;
|
|
313
317
|
}
|
|
314
|
-
const
|
|
315
|
-
|
|
316
|
-
|
|
318
|
+
const pushOpOffset = chunk.offset - 1;
|
|
319
|
+
if (pushOpOffset < 0 || pushOpOffset >= this.script.length) {
|
|
320
|
+
return undefined;
|
|
321
|
+
}
|
|
322
|
+
const actualLen = this.script.readUInt8(pushOpOffset);
|
|
323
|
+
if (platform === 'lotusia' && actualLen !== 20 && actualLen !== 33) {
|
|
324
|
+
return undefined;
|
|
325
|
+
}
|
|
326
|
+
const profileIdBuf = this.script.slice(chunk.offset, chunk.offset + actualLen);
|
|
327
|
+
if (profileIdBuf.length !== actualLen) {
|
|
317
328
|
return undefined;
|
|
318
329
|
}
|
|
319
330
|
switch (platform) {
|
|
@@ -337,8 +348,14 @@ class ScriptProcessor {
|
|
|
337
348
|
if (!profileIdChunk?.offset) {
|
|
338
349
|
return undefined;
|
|
339
350
|
}
|
|
351
|
+
const profileIdPushOpOffset = profileIdChunk.offset - 1;
|
|
352
|
+
if (profileIdPushOpOffset < 0 ||
|
|
353
|
+
profileIdPushOpOffset >= this.script.length) {
|
|
354
|
+
return undefined;
|
|
355
|
+
}
|
|
356
|
+
const actualProfileIdLen = this.script.readUInt8(profileIdPushOpOffset);
|
|
340
357
|
const postIdSpec = platformSpec.postId;
|
|
341
|
-
const postIdOffset = profileIdChunk.offset +
|
|
358
|
+
const postIdOffset = profileIdChunk.offset + actualProfileIdLen + 1;
|
|
342
359
|
const postIdBuf = this.script.slice(postIdOffset, postIdOffset + postIdSpec.len);
|
|
343
360
|
try {
|
|
344
361
|
switch (platform) {
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.isOpReturn = isOpReturn;
|
|
7
4
|
const buffer_1 = require("buffer/");
|
|
8
|
-
const opcode_js_1 =
|
|
5
|
+
const opcode_js_1 = require("./opcode.js");
|
|
9
6
|
function isOpReturn(script) {
|
|
10
7
|
if (typeof script === 'string') {
|
|
11
8
|
script = buffer_1.Buffer.from(script, 'hex');
|
package/dist/esm/index.js
CHANGED
|
@@ -1,46 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
|
-
};
|
|
21
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
-
var ownKeys = function(o) {
|
|
23
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
-
var ar = [];
|
|
25
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
-
return ar;
|
|
27
|
-
};
|
|
28
|
-
return ownKeys(o);
|
|
29
|
-
};
|
|
30
|
-
return function (mod) {
|
|
31
|
-
if (mod && mod.__esModule) return mod;
|
|
32
|
-
var result = {};
|
|
33
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
-
__setModuleDefault(result, mod);
|
|
35
|
-
return result;
|
|
36
|
-
};
|
|
37
|
-
})();
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.RANK = exports.Bitcore = void 0;
|
|
40
|
-
__exportStar(require("./lib/rpc.js"), exports);
|
|
41
|
-
exports.Bitcore = __importStar(require("./lib/bitcore/index.js"));
|
|
42
|
-
exports.RANK = __importStar(require("./lib/rank/index.js"));
|
|
43
|
-
__exportStar(require("./utils/constants.js"), exports);
|
|
44
|
-
__exportStar(require("./utils/env.js"), exports);
|
|
45
|
-
__exportStar(require("./utils/string.js"), exports);
|
|
46
|
-
__exportStar(require("./utils/wallet.js"), exports);
|
|
1
|
+
export * from './lib/rpc.js';
|
|
2
|
+
export * as Bitcore from './lib/bitcore/index.js';
|
|
3
|
+
export * as RANK from './lib/rank/index.js';
|
|
4
|
+
export * from './utils/constants.js';
|
|
5
|
+
export * from './utils/env.js';
|
|
6
|
+
export * from './utils/string.js';
|
|
7
|
+
export * from './utils/wallet.js';
|