xpi-ts 0.2.17 → 0.2.19
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 +1 -4
- package/dist/cjs/lib/rank/script.js +1 -4
- package/dist/esm/lib/bitcore/crypto/bn.js +1 -1
- package/dist/esm/lib/bitcore/crypto/point.js +2 -2
- 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/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;
|
|
@@ -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');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ec } from 'elliptic';
|
|
2
2
|
import { BN } from './bn';
|
|
3
3
|
import { BufferUtil } from '../util';
|
|
4
|
-
const ecInstance = new
|
|
4
|
+
const ecInstance = new ec('secp256k1');
|
|
5
5
|
const ecPoint = ecInstance.curve.point.bind(ecInstance.curve);
|
|
6
6
|
const ecPointFromX = ecInstance.curve.pointFromX.bind(ecInstance.curve);
|
|
7
7
|
export const PREFIX_Y_ODD = 0x03;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import BN from 'bn.js';
|
|
1
|
+
import { BN } from 'bn.js';
|
|
2
2
|
import type { Buffer } from 'buffer/';
|
|
3
3
|
export interface BNWrapperOptions {
|
|
4
4
|
endian?: 'little' | 'big';
|
|
5
5
|
size?: number;
|
|
6
6
|
}
|
|
7
|
+
type BN = InstanceType<typeof BN>;
|
|
7
8
|
declare class BNWrapper {
|
|
8
9
|
static readonly Zero: BNWrapper;
|
|
9
10
|
static readonly One: BNWrapper;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bn.d.ts","sourceRoot":"","sources":["../../../../../lib/bitcore/crypto/bn.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"bn.d.ts","sourceRoot":"","sources":["../../../../../lib/bitcore/crypto/bn.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAE1B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAErC,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAA;IACzB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAMD,KAAK,EAAE,GAAG,YAAY,CAAC,OAAO,EAAE,CAAC,CAAA;AAqCjC,cAAM,SAAS;IAEb,MAAM,CAAC,QAAQ,CAAC,IAAI,YAAmB;IAEvC,MAAM,CAAC,QAAQ,CAAC,GAAG,YAAmB;IAEtC,MAAM,CAAC,QAAQ,CAAC,MAAM,YAAoB;IAE1C,OAAO,CAAC,GAAG,CAAI;gBAqBb,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,EAAE,GAAG,MAAM,EAChC,IAAI,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,IAAI;IAqBrC,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS;IAOhE,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,gBAAgB,GAAG,SAAS;IAiBlE,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,gBAAgB,GAAG,SAAS;IAiC9D,MAAM,CAAC,mBAAmB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AS,GAAG,OAAO;IAS7B,EAAE,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO;IAS7B,GAAG,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO;IAS9B,GAAG,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO;IAQ9B,MAAM,IAAI,OAAO;IAQjB,KAAK,IAAI,OAAO;IAQhB,KAAK,IAAI,OAAO;IAQhB,MAAM,IAAI,OAAO;IAOjB,aAAa,IAAI,MAAM;IAyBvB,IAAI,CAAC,IAAI,CAAC,EAAE,gBAAgB,GAAG,MAAM;IAarC,iBAAiB,IAAI,MAAM;IAO3B,GAAG,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM;IAO7B,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS;IAQjC,KAAK,IAAI,SAAS;CAGnB;AAGD,OAAO,EAAE,SAAS,IAAI,EAAE,EAAE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"point.d.ts","sourceRoot":"","sources":["../../../../../lib/bitcore/crypto/point.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAA;AAEzB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAOrC,eAAO,MAAM,YAAY,IAAO,CAAA;AAEhC,eAAO,MAAM,aAAa,IAAO,CAAA;AAEjC,qBAAa,KAAK;IAChB,OAAO,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"point.d.ts","sourceRoot":"","sources":["../../../../../lib/bitcore/crypto/point.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAA;AAEzB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAOrC,eAAO,MAAM,YAAY,IAAO,CAAA;AAEhC,eAAO,MAAM,aAAa,IAAO,CAAA;AAEjC,qBAAa,KAAK;IAChB,OAAO,CAAC,MAAM,CAAsB;IAGpC,MAAM,CAAC,Q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