@firmachain/firma-js 0.3.3 → 0.3.4
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/sdk/FirmaUtil.js
CHANGED
|
@@ -550,7 +550,7 @@ var FirmaUtil = /** @class */ (function () {
|
|
|
550
550
|
if (!commissionRate || trimmed === "") {
|
|
551
551
|
throw new Error("Invalid commission rate format: " + commissionRate);
|
|
552
552
|
}
|
|
553
|
-
if (
|
|
553
|
+
if (!/^-?\d+\.?\d*$/.test(trimmed)) {
|
|
554
554
|
throw new Error("Invalid commission rate format: " + commissionRate);
|
|
555
555
|
}
|
|
556
556
|
// Validates input and creates BigNumber instance
|
|
@@ -142,7 +142,7 @@ var LedgerSigningStargateClient = /** @class */ (function (_super) {
|
|
|
142
142
|
});
|
|
143
143
|
path = "/abci_query";
|
|
144
144
|
params = {
|
|
145
|
-
path: "/store/
|
|
145
|
+
path: "/store/acc/key",
|
|
146
146
|
data: hexAccAddress,
|
|
147
147
|
};
|
|
148
148
|
return [4 /*yield*/, axios.get(path, { params: params })];
|
|
@@ -289,23 +289,23 @@ describe('[18. util Test]', function () {
|
|
|
289
289
|
}); });
|
|
290
290
|
it('processCommissionRateAsDecimal test - failure cases', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
291
291
|
return __generator(this, function (_a) {
|
|
292
|
-
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("."); }).to.throw("Invalid commission rate format");
|
|
292
|
+
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("."); }).to.throw("Invalid commission rate format: .");
|
|
293
293
|
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal(""); }).to.throw("Invalid commission rate format: ");
|
|
294
294
|
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal(" "); }).to.throw("Invalid commission rate format: ");
|
|
295
295
|
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("null"); }).to.throw("Invalid commission rate format: null");
|
|
296
296
|
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("0.1abc"); }).to.throw("Invalid commission rate format: 0.1abc");
|
|
297
|
-
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("0.1.2"); }).to.throw("Invalid commission rate format");
|
|
298
|
-
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("--0.5"); }).to.throw("Invalid commission rate format");
|
|
297
|
+
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("0.1.2"); }).to.throw("Invalid commission rate format: 0.1.2");
|
|
298
|
+
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("--0.5"); }).to.throw("Invalid commission rate format: --0.5");
|
|
299
299
|
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("1.01"); }).to.throw("Invalid commission rate range. Must be between 0 and 1 inclusive.");
|
|
300
300
|
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("2"); }).to.throw("Invalid commission rate range. Must be between 0 and 1 inclusive.");
|
|
301
301
|
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("1.1"); }).to.throw("Invalid commission rate range. Must be between 0 and 1 inclusive.");
|
|
302
|
-
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("-0.1"); }).to.throw("Invalid commission rate
|
|
303
|
-
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("-1"); }).to.throw("Invalid commission rate
|
|
304
|
-
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("-0.01"); }).to.throw("Invalid commission rate
|
|
305
|
-
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("-0.000000000000000001"); }).to.throw("Invalid commission rate
|
|
302
|
+
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("-0.1"); }).to.throw("Invalid commission rate range. Must be between 0 and 1 inclusive.");
|
|
303
|
+
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("-1"); }).to.throw("Invalid commission rate range. Must be between 0 and 1 inclusive.");
|
|
304
|
+
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("-0.01"); }).to.throw("Invalid commission rate range. Must be between 0 and 1 inclusive.");
|
|
305
|
+
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("-0.000000000000000001"); }).to.throw("Invalid commission rate range. Must be between 0 and 1 inclusive.");
|
|
306
306
|
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("1.00000000000000000001"); }).to.throw("Invalid commission rate range. Must be between 0 and 1 inclusive.");
|
|
307
|
-
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("0.5%"); }).to.throw("Invalid commission rate format");
|
|
308
|
-
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal(" 0.5 extra"); }).to.throw("Invalid commission rate format");
|
|
307
|
+
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("0.5%"); }).to.throw("Invalid commission rate format: 0.5%");
|
|
308
|
+
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal(" 0.5 extra"); }).to.throw("Invalid commission rate format: 0.5 extra");
|
|
309
309
|
return [2 /*return*/];
|
|
310
310
|
});
|
|
311
311
|
}); });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FirmaConfig } from '../sdk/FirmaConfig';
|
|
2
2
|
export declare let TestChainConfig: FirmaConfig;
|
|
3
3
|
export declare const validatorMnemonic = "angry water bunker where iron absurd cruise deliver clutch unique creek pyramid arch express flush pill lens concert absent enemy boring mom nuclear rose";
|
|
4
|
-
export declare const aliceMnemonic = "
|
|
4
|
+
export declare const aliceMnemonic = "immune flavor record sphere foam planet faint grid disorder flag minute eternal beef sea camp surge extra scorpion pistol plastic happy siren juice found";
|
|
5
5
|
export declare const bobMnemonic = "innocent enforce visit tilt job kitten actual glory flash feed wonder license rubber outer drum sun fuel relax roof universe enrich pulse fine grid";
|
|
6
6
|
export declare const feeMnemonic = "long shallow crumble clown truth book oval render seed canal buffalo assist sadness elbow afraid catalog brother trade food subject must luggage bread neither";
|
|
7
7
|
export declare const firmaFeeMnemonic = "arrest dynamic typical lunch original glare truth narrow stairs clip canyon space alley chat drive sudden music bubble time mesh color office minor draft";
|
package/dist/test/config_test.js
CHANGED
|
@@ -18,7 +18,7 @@ exports.TestChainConfig = {
|
|
|
18
18
|
};
|
|
19
19
|
exports.validatorMnemonic = "angry water bunker where iron absurd cruise deliver clutch unique creek pyramid arch express flush pill lens concert absent enemy boring mom nuclear rose";
|
|
20
20
|
// DEVNET
|
|
21
|
-
|
|
21
|
+
exports.aliceMnemonic = "immune flavor record sphere foam planet faint grid disorder flag minute eternal beef sea camp surge extra scorpion pistol plastic happy siren juice found";
|
|
22
22
|
// TESTNET
|
|
23
23
|
// export const aliceMnemonic = "harvest galaxy sniff include record undo width oven tired sad month text museum curious firm mountain flash assault oval sand ribbon blouse consider lens";
|
|
24
24
|
// VALIDATOR
|
|
@@ -28,7 +28,7 @@ exports.validatorMnemonic = "angry water bunker where iron absurd cruise deliver
|
|
|
28
28
|
// voting test
|
|
29
29
|
// export const aliceMnemonic = "long shallow crumble clown truth book oval render seed canal buffalo assist sadness elbow afraid catalog brother trade food subject must luggage bread neither";
|
|
30
30
|
// export const aliceMnemonic = "clump erupt type lucky mask pig soup runway wrestle suspect element involve stamp civil auction resource blame same journey start unaware crush ten draw";
|
|
31
|
-
|
|
31
|
+
// export const aliceMnemonic = "angry water bunker where iron absurd cruise deliver clutch unique creek pyramid arch express flush pill lens concert absent enemy boring mom nuclear rose";
|
|
32
32
|
// export const aliceMnemonic = "stadium lonely midnight okay meat rib awesome wealth phone leisure turn prosper notable label fruit define little also father silver half drill bargain antique";
|
|
33
33
|
// export const aliceMnemonic = "uncle banana theme relax oak prosper volcano glad industry bicycle tower thrive jelly curious luggage frame that defy reason jewel figure begin nice moon";
|
|
34
34
|
// export const aliceMnemonic = "rebel engine situate catalog blood strong satisfy aerobic cupboard again vivid twice flag work taxi heart fruit island ribbon hungry cheap ordinary horse foam";
|