cosmos-client
Advanced tools
Comparing version 0.42.9 to 0.42.10
@@ -22,1 +22,6 @@ import { PubKey } from '../crypto'; | ||
} | ||
declare module './address' { | ||
interface Address { | ||
toAccAddress(): AccAddress; | ||
} | ||
} |
@@ -76,1 +76,4 @@ "use strict"; | ||
exports.AccAddress = AccAddress; | ||
address_1.Address.prototype.toAccAddress = function () { | ||
return new AccAddress(this.value()); | ||
}; |
@@ -12,2 +12,3 @@ import { PubKey } from '../crypto'; | ||
constructor(value: Uint8Array); | ||
value(): Uint8Array; | ||
/** | ||
@@ -14,0 +15,0 @@ * |
@@ -19,2 +19,5 @@ "use strict"; | ||
} | ||
Address.prototype.value = function () { | ||
return this._value; | ||
}; | ||
/** | ||
@@ -21,0 +24,0 @@ * |
@@ -102,2 +102,16 @@ "use strict"; | ||
}); }); | ||
it('convert', function () { return __awaiter(void 0, void 0, void 0, function () { | ||
var privKeyStr, privKey, accAddress, valAddress; | ||
return __generator(this, function (_a) { | ||
expect.hasAssertions(); | ||
privKeyStr = 'ef40ea14839c3ee5690336bb1f032870941dbb329fc0553132a4a109a022a391'; | ||
privKey = new __1.cosmosclient.secp256k1.PrivKey({ | ||
key: Buffer.from(privKeyStr, 'hex'), | ||
}); | ||
accAddress = __1.cosmosclient.AccAddress.fromPublicKey(privKey.pubKey()); | ||
valAddress = __1.cosmosclient.ValAddress.fromPublicKey(privKey.pubKey()); | ||
expect(accAddress.toValAddress().toString()).toStrictEqual(valAddress.toString()); | ||
return [2 /*return*/]; | ||
}); | ||
}); }); | ||
}); |
@@ -22,1 +22,6 @@ import { PubKey } from '../crypto'; | ||
} | ||
declare module './address' { | ||
interface Address { | ||
toConsAddress(): ConsAddress; | ||
} | ||
} |
@@ -76,1 +76,4 @@ "use strict"; | ||
exports.ConsAddress = ConsAddress; | ||
address_1.Address.prototype.toConsAddress = function () { | ||
return new ConsAddress(this.value()); | ||
}; |
@@ -22,1 +22,6 @@ import { PubKey } from '../crypto'; | ||
} | ||
declare module './address' { | ||
interface Address { | ||
toValAddress(): ValAddress; | ||
} | ||
} |
@@ -76,1 +76,4 @@ "use strict"; | ||
exports.ValAddress = ValAddress; | ||
address_1.Address.prototype.toValAddress = function () { | ||
return new ValAddress(this.value()); | ||
}; |
@@ -13,3 +13,6 @@ "use strict"; | ||
var typeURL = value && value['@type']; | ||
if (!typeURL || !config_1.config.codecMaps.fromObject[typeURL]) { | ||
if (!typeURL) { | ||
throw Error("The field '@type' is undefined"); | ||
} | ||
if (!config_1.config.codecMaps.fromObject[typeURL]) { | ||
throw Error('This type is not registered'); | ||
@@ -22,2 +25,5 @@ } | ||
var constructor = value === null || value === void 0 ? void 0 : value.constructor; | ||
if (!constructor) { | ||
throw Error("The field 'constructor' is undefined"); | ||
} | ||
var typeURL = constructor && config_1.config.codecMaps.inv.get(constructor); | ||
@@ -24,0 +30,0 @@ if (!typeURL) { |
@@ -22,1 +22,6 @@ import { PubKey } from '../crypto'; | ||
} | ||
declare module './address' { | ||
interface Address { | ||
toAccAddress(): AccAddress; | ||
} | ||
} |
@@ -33,1 +33,4 @@ import * as bech32 from 'bech32'; | ||
} | ||
Address.prototype.toAccAddress = function () { | ||
return new AccAddress(this.value()); | ||
}; |
@@ -12,2 +12,3 @@ import { PubKey } from '../crypto'; | ||
constructor(value: Uint8Array); | ||
value(): Uint8Array; | ||
/** | ||
@@ -14,0 +15,0 @@ * |
@@ -16,2 +16,5 @@ /** | ||
} | ||
value() { | ||
return this._value; | ||
} | ||
/** | ||
@@ -18,0 +21,0 @@ * |
@@ -41,2 +41,12 @@ import * as crypto from 'crypto'; | ||
}); | ||
it('convert', async () => { | ||
expect.hasAssertions(); | ||
const privKeyStr = 'ef40ea14839c3ee5690336bb1f032870941dbb329fc0553132a4a109a022a391'; | ||
const privKey = new cosmosclient.secp256k1.PrivKey({ | ||
key: Buffer.from(privKeyStr, 'hex'), | ||
}); | ||
const accAddress = cosmosclient.AccAddress.fromPublicKey(privKey.pubKey()); | ||
const valAddress = cosmosclient.ValAddress.fromPublicKey(privKey.pubKey()); | ||
expect(accAddress.toValAddress().toString()).toStrictEqual(valAddress.toString()); | ||
}); | ||
}); |
@@ -22,1 +22,6 @@ import { PubKey } from '../crypto'; | ||
} | ||
declare module './address' { | ||
interface Address { | ||
toConsAddress(): ConsAddress; | ||
} | ||
} |
@@ -33,1 +33,4 @@ import * as bech32 from 'bech32'; | ||
} | ||
Address.prototype.toConsAddress = function () { | ||
return new ConsAddress(this.value()); | ||
}; |
@@ -22,1 +22,6 @@ import { PubKey } from '../crypto'; | ||
} | ||
declare module './address' { | ||
interface Address { | ||
toValAddress(): ValAddress; | ||
} | ||
} |
@@ -33,1 +33,4 @@ import * as bech32 from 'bech32'; | ||
} | ||
Address.prototype.toValAddress = function () { | ||
return new ValAddress(this.value()); | ||
}; |
@@ -9,3 +9,6 @@ import { config } from '../../config'; | ||
const typeURL = value && value['@type']; | ||
if (!typeURL || !config.codecMaps.fromObject[typeURL]) { | ||
if (!typeURL) { | ||
throw Error("The field '@type' is undefined"); | ||
} | ||
if (!config.codecMaps.fromObject[typeURL]) { | ||
throw Error('This type is not registered'); | ||
@@ -17,2 +20,5 @@ } | ||
const constructor = value?.constructor; | ||
if (!constructor) { | ||
throw Error("The field 'constructor' is undefined"); | ||
} | ||
const typeURL = constructor && config.codecMaps.inv.get(constructor); | ||
@@ -19,0 +25,0 @@ if (!typeURL) { |
{ | ||
"name": "cosmos-client", | ||
"description": "REST API Client for Cosmos SDK Blockchain", | ||
"version": "0.42.9", | ||
"version": "0.42.10", | ||
"author": "LCNEM, Inc.", | ||
@@ -6,0 +6,0 @@ "bugs": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24955727
168715