@cardano-sdk/core 0.7.0-nightly.6 → 0.7.0-nightly.7
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/Cardano/types/Address.d.ts.map +1 -1
- package/dist/cjs/Cardano/types/Address.js +25 -2
- package/dist/cjs/Cardano/types/Address.js.map +1 -1
- package/dist/cjs/Provider/StakePoolProvider/util.d.ts +1 -1
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/Cardano/types/Address.d.ts.map +1 -1
- package/dist/esm/Cardano/types/Address.js +26 -3
- package/dist/esm/Cardano/types/Address.js.map +1 -1
- package/dist/esm/Provider/StakePoolProvider/util.d.ts +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Address.d.ts","sourceRoot":"","sources":["../../../../src/Cardano/types/Address.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Address.d.ts","sourceRoot":"","sources":["../../../../src/Cardano/types/Address.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAA+C,MAAM,oBAAoB,CAAC;AAM/F,oBAAY,OAAO,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;AAwB9C,eAAO,MAAM,OAAO,UAAW,MAAM,YAyBpC,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Address = void 0;
|
|
4
|
+
const util_1 = require("@cardano-sdk/util");
|
|
5
|
+
const CML_1 = require("../../CML");
|
|
4
6
|
const errors_1 = require("../../errors");
|
|
5
7
|
const primitives_1 = require("../util/primitives");
|
|
6
8
|
const address_1 = require("../util/address");
|
|
@@ -14,10 +16,31 @@ const isRewardAccount = (address) => {
|
|
|
14
16
|
}
|
|
15
17
|
};
|
|
16
18
|
const Address = (value) => {
|
|
17
|
-
if ((0, address_1.isAddress)(value)
|
|
19
|
+
if ((0, address_1.isAddress)(value)) {
|
|
20
|
+
if (isRewardAccount(value)) {
|
|
21
|
+
throw new errors_1.InvalidStringError(value, 'Address type can only be used for payment addresses');
|
|
22
|
+
}
|
|
18
23
|
return value;
|
|
19
24
|
}
|
|
20
|
-
|
|
25
|
+
try {
|
|
26
|
+
(0, primitives_1.assertIsHexString)(value);
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
throw new errors_1.InvalidStringError(value, 'Expected payment address as bech32, base58 or hex-encoded bytes');
|
|
30
|
+
}
|
|
31
|
+
return (0, util_1.usingAutoFree)((scope) => {
|
|
32
|
+
try {
|
|
33
|
+
return (0, exports.Address)(scope.manage(CML_1.CML.ByronAddress.from_bytes(Buffer.from(value, 'hex'))).to_base58());
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
try {
|
|
37
|
+
return (0, exports.Address)(scope.manage(CML_1.CML.Address.from_bytes(Buffer.from(value, 'hex'))).to_bech32());
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
throw new errors_1.InvalidStringError(value, 'Invalid payment address');
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
21
44
|
};
|
|
22
45
|
exports.Address = Address;
|
|
23
46
|
//# sourceMappingURL=Address.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Address.js","sourceRoot":"","sources":["../../../../src/Cardano/types/Address.ts"],"names":[],"mappings":";;;AAAA,yCAAkD;AAClD,
|
|
1
|
+
{"version":3,"file":"Address.js","sourceRoot":"","sources":["../../../../src/Cardano/types/Address.ts"],"names":[],"mappings":";;;AAAA,4CAAkD;AAElD,mCAAgC;AAChC,yCAAkD;AAClD,mDAA+F;AAC/F,6CAA4C;AAY5C,MAAM,eAAe,GAAG,CAAC,OAAe,EAAE,EAAE;IAC1C,IAAI;QACF,IAAA,qCAAwB,EAAC,OAAO,EAAE,CAAC,OA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
5
|
export declare const isPoolMetricsSortField: (value: string) => boolean;
|
|
6
6
|
export declare const isPoolAPYSortField: (value: string) => boolean;
|
|
7
|
-
export declare const SortFields: ("
|
|
7
|
+
export declare const SortFields: ("cost" | "name" | "saturation" | "apy")[];
|
|
8
8
|
//# sourceMappingURL=util.d.ts.map
|