@cityofzion/blockchain-service 3.1.16 → 3.1.18
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.
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import BigNumber from 'bignumber.js';
|
|
2
2
|
export declare class BSBigNumber extends BigNumber {
|
|
3
3
|
constructor(value: BigNumber.Value, base?: number);
|
|
4
|
+
static _isValueString(value: BigNumber.Value): value is string;
|
|
5
|
+
static _isBaseNumber(base?: number): base is number;
|
|
4
6
|
static ensureNumber(value: number | string | bigint | undefined): number;
|
|
5
7
|
toBigInt(): bigint;
|
|
6
8
|
protected _wrap(value: BigNumber): this;
|
|
7
|
-
plus(
|
|
8
|
-
minus(
|
|
9
|
-
multipliedBy(
|
|
10
|
-
dividedBy(
|
|
9
|
+
plus(value: BigNumber.Value, base?: number): this;
|
|
10
|
+
minus(value: BigNumber.Value, base?: number): this;
|
|
11
|
+
multipliedBy(value: BigNumber.Value, base?: number): this;
|
|
12
|
+
dividedBy(value: BigNumber.Value, base?: number): this;
|
|
11
13
|
integerValue(roundingMode?: BigNumber.RoundingMode): this;
|
|
12
14
|
}
|
|
13
15
|
export declare class BSBigHumanAmount extends BSBigNumber {
|
|
@@ -8,13 +8,29 @@ const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
|
8
8
|
const error_1 = require("../error");
|
|
9
9
|
class BSBigNumber extends bignumber_js_1.default {
|
|
10
10
|
constructor(value, base) {
|
|
11
|
-
|
|
11
|
+
if (BSBigNumber._isValueString(value) && BSBigNumber._isBaseNumber(base)) {
|
|
12
|
+
super(value, base);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
super(value);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
static _isValueString(value) {
|
|
19
|
+
return typeof value === 'string';
|
|
20
|
+
}
|
|
21
|
+
static _isBaseNumber(base) {
|
|
22
|
+
return typeof base === 'number';
|
|
12
23
|
}
|
|
13
24
|
static ensureNumber(value) {
|
|
14
|
-
|
|
15
|
-
|
|
25
|
+
let bn;
|
|
26
|
+
try {
|
|
27
|
+
bn = new bignumber_js_1.default(value || 0);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
16
30
|
return 0;
|
|
17
31
|
}
|
|
32
|
+
if (bn.isNaN())
|
|
33
|
+
return 0;
|
|
18
34
|
return bn.toNumber();
|
|
19
35
|
}
|
|
20
36
|
toBigInt() {
|
|
@@ -23,17 +39,23 @@ class BSBigNumber extends bignumber_js_1.default {
|
|
|
23
39
|
_wrap(value) {
|
|
24
40
|
return new this.constructor(value);
|
|
25
41
|
}
|
|
26
|
-
plus(
|
|
27
|
-
return this._wrap(super.plus(
|
|
42
|
+
plus(value, base) {
|
|
43
|
+
return this._wrap(BSBigNumber._isValueString(value) && BSBigNumber._isBaseNumber(base) ? super.plus(value, base) : super.plus(value));
|
|
28
44
|
}
|
|
29
|
-
minus(
|
|
30
|
-
return this._wrap(
|
|
45
|
+
minus(value, base) {
|
|
46
|
+
return this._wrap(BSBigNumber._isValueString(value) && BSBigNumber._isBaseNumber(base)
|
|
47
|
+
? super.minus(value, base)
|
|
48
|
+
: super.minus(value));
|
|
31
49
|
}
|
|
32
|
-
multipliedBy(
|
|
33
|
-
return this._wrap(
|
|
50
|
+
multipliedBy(value, base) {
|
|
51
|
+
return this._wrap(BSBigNumber._isValueString(value) && BSBigNumber._isBaseNumber(base)
|
|
52
|
+
? super.multipliedBy(value, base)
|
|
53
|
+
: super.multipliedBy(value));
|
|
34
54
|
}
|
|
35
|
-
dividedBy(
|
|
36
|
-
return this._wrap(
|
|
55
|
+
dividedBy(value, base) {
|
|
56
|
+
return this._wrap(BSBigNumber._isValueString(value) && BSBigNumber._isBaseNumber(base)
|
|
57
|
+
? super.dividedBy(value, base)
|
|
58
|
+
: super.dividedBy(value));
|
|
37
59
|
}
|
|
38
60
|
integerValue(roundingMode) {
|
|
39
61
|
return this._wrap(super.integerValue(roundingMode));
|
|
@@ -47,7 +69,12 @@ class BSBigHumanAmount extends BSBigNumber {
|
|
|
47
69
|
return b + c.replace(/\./g, '');
|
|
48
70
|
});
|
|
49
71
|
}
|
|
50
|
-
|
|
72
|
+
try {
|
|
73
|
+
if (!value || new bignumber_js_1.default(value).isNaN()) {
|
|
74
|
+
value = 0;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
51
78
|
value = 0;
|
|
52
79
|
}
|
|
53
80
|
super(value);
|
|
@@ -70,7 +97,12 @@ class BSBigHumanAmount extends BSBigNumber {
|
|
|
70
97
|
exports.BSBigHumanAmount = BSBigHumanAmount;
|
|
71
98
|
class BSBigUnitAmount extends BSBigNumber {
|
|
72
99
|
constructor(value, decimals) {
|
|
73
|
-
|
|
100
|
+
try {
|
|
101
|
+
if (!value || new bignumber_js_1.default(value).isNaN()) {
|
|
102
|
+
value = 0;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
74
106
|
value = 0;
|
|
75
107
|
}
|
|
76
108
|
super(value);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare class BSKeychainHelper {
|
|
2
2
|
#private;
|
|
3
3
|
static generateNeoPrivateKeyFromMnemonic(mnemonic: string, path: string): string;
|
|
4
|
-
static generateEd25519KeyFromMnemonic(mnemonic: string, path: string): Buffer<
|
|
4
|
+
static generateEd25519KeyFromMnemonic(mnemonic: string, path: string): Buffer<ArrayBuffer>;
|
|
5
5
|
static generateMnemonic(): string;
|
|
6
6
|
static isValidMnemonic(word: string | string[]): boolean;
|
|
7
7
|
static isMnemonic(word: string | string[]): boolean;
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -359,9 +359,10 @@ export interface ISwapOrchestrator<N extends string> {
|
|
|
359
359
|
calculateFee(): Promise<string>;
|
|
360
360
|
}
|
|
361
361
|
export type TBSBridgeName = 'neo3' | 'neox';
|
|
362
|
+
export type TBridgeTokenMultichainId = 'neo' | 'gas' | 'ndmeme';
|
|
362
363
|
export type TBridgeToken<N extends TBSBridgeName> = TBSToken & {
|
|
363
364
|
blockchain: N;
|
|
364
|
-
multichainId:
|
|
365
|
+
multichainId: TBridgeTokenMultichainId;
|
|
365
366
|
};
|
|
366
367
|
export type TBridgeValue<T> = {
|
|
367
368
|
value: T | null;
|
|
@@ -429,6 +430,8 @@ export type TNeo3NeoXBridgeTransactionData<N extends TBSBridgeName> = {
|
|
|
429
430
|
export interface INeo3NeoXBridgeService<N extends TBSBridgeName> {
|
|
430
431
|
readonly gasToken: TBridgeToken<N>;
|
|
431
432
|
readonly neoToken: TBridgeToken<N>;
|
|
433
|
+
readonly ndmemeToken: TBridgeToken<N>;
|
|
434
|
+
readonly tokens: TBridgeToken<N>[];
|
|
432
435
|
getApprovalFee(params: TNeo3NeoXBridgeServiceGetApprovalParam<N>): Promise<string>;
|
|
433
436
|
getBridgeConstants(token: TBridgeToken<N>): Promise<TNeo3NeoXBridgeServiceConstants>;
|
|
434
437
|
bridge(params: TNeo3NeoXBridgeServiceBridgeParam<N>): Promise<string>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cityofzion/blockchain-service",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.18",
|
|
4
4
|
"repository": "https://github.com/CityOfZion/blockchain-services",
|
|
5
5
|
"license": "GPL-3.0-only",
|
|
6
6
|
"author": "Coz",
|
|
@@ -10,24 +10,24 @@
|
|
|
10
10
|
"/dist"
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"axios": "
|
|
14
|
-
"bignumber.js": "~
|
|
13
|
+
"axios": "1.16.0",
|
|
14
|
+
"bignumber.js": "~11.1.1",
|
|
15
15
|
"bip39": "~3.1.0",
|
|
16
16
|
"date-fns": "~4.1.0",
|
|
17
17
|
"elliptic": "6.6.1",
|
|
18
18
|
"lodash.isequal": "~4.5.0",
|
|
19
|
-
"query-string": "
|
|
19
|
+
"query-string": "9.3.1"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@ledgerhq/hw-transport": "
|
|
22
|
+
"@ledgerhq/hw-transport": "6.35.1",
|
|
23
23
|
"@types/elliptic": "~6.4.18",
|
|
24
24
|
"@types/lodash.isequal": "~4.5.8",
|
|
25
|
-
"@types/node": "~
|
|
26
|
-
"dotenv": "~17.
|
|
27
|
-
"eslint": "~
|
|
25
|
+
"@types/node": "~25.6.0",
|
|
26
|
+
"dotenv": "~17.4.2",
|
|
27
|
+
"eslint": "~10.3.0",
|
|
28
28
|
"typed-emitter": "~2.1.0",
|
|
29
|
-
"typescript": "
|
|
30
|
-
"vitest": "~4.
|
|
29
|
+
"typescript": "6.0.3",
|
|
30
|
+
"vitest": "~4.1.5"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
33
|
"build": "rm -rf ./dist && rm -f *.tgz && npm run typecheck && tsc --project tsconfig.build.json",
|