Skip to content

Commit

Permalink
Merge pull request #145 from irisnet/develop
Browse files Browse the repository at this point in the history
Release v1.0.0-rc2
  • Loading branch information
zhangyelong authored Feb 24, 2021
2 parents 6c520c9 + 2db3093 commit e7ab670
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 17 deletions.
2 changes: 1 addition & 1 deletion dist/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"uuid": "^3.3.2",
"is_js": "^0.9.0",
"isomorphic-ws": "^4.0.1",
"mathjs": "^6.6.1",
"mathjs": "7.5.1",
"ndjson": "^1.5.0",
"pumpify": "^2.0.1",
"secp256k1": "^3.7.1",
Expand Down
3 changes: 2 additions & 1 deletion dist/src/utils/crypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,8 @@ var Crypto = /*#__PURE__*/function () {

switch (publicKey.type) {
case types.PubkeyType.ed25519:
throw new _errors.SdkError("not implement", _errors.CODES.Panic);
hash = _utils.Utils.sha256(publicKey.value).substr(0, 40);
break;

case types.PubkeyType.sm2:
hash = _utils.Utils.sha256(publicKey.value).substr(0, 40);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"uuid": "^3.3.2",
"is_js": "^0.9.0",
"isomorphic-ws": "^4.0.1",
"mathjs": "^6.6.1",
"mathjs": "7.5.1",
"ndjson": "^1.5.0",
"pumpify": "^2.0.1",
"secp256k1": "^3.7.1",
Expand Down
3 changes: 2 additions & 1 deletion src/utils/crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ export class Crypto {
let hash:string = '';
switch(publicKey.type){
case types.PubkeyType.ed25519:
throw new SdkError("not implement",CODES.Panic);
hash = Utils.sha256(publicKey.value).substr(0,40);
break;
case types.PubkeyType.sm2:
hash = Utils.sha256(publicKey.value).substr(0,40);
break;
Expand Down
11 changes: 10 additions & 1 deletion test/crypto.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,17 @@ test('Crypto', async () => {
test('Marshal PubKey', async ()=>{
let pk = Crypto.aminoMarshalPubKey({
type:types.PubkeyType.ed25519,
value:'F205xccFhKHMnNEHFwtHLzDVjPaGGBuSnO0wR8OmEvo='
value:'FT782NmKqtZYi6UyNzprh44u7defkzD18IePql6Uj3c=='
});
let pk_bech32 = Crypto.encodeAddress(pk,'icp');
console.log('pk_bech32:',pk_bech32);
});

test('get Address From PublicKey', async ()=>{
let pk = Crypto.getAddressFromPublicKey({
type:types.PubkeyType.ed25519,
value:Buffer.from('FT782NmKqtZYi6UyNzprh44u7defkzD18IePql6Uj3c==','base64').toString('hex')
},'ica');
console.log('pk_bech32:',pk);
});

2 changes: 1 addition & 1 deletion test/slashing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('Slashing Tests', () => {
describe('Query Signing Info', () => {
test('query signing info', async () => {
await BaseTest.getClient()
.slashing.querySigningInfo('fca1f46x0s36d5ajjqjurt3znhqfdulyf7zlazpj8n')
.slashing.querySigningInfo('ica12x4wemz4qtwr5rql4awp0r6rx0pxws35t4wkdp')
.then(res => {
console.log(JSON.stringify(res));
})
Expand Down
22 changes: 11 additions & 11 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2271,7 +2271,7 @@ decamelize@^1.1.0, decamelize@^1.2.0:
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=

decimal.js@^10.0.0, decimal.js@^10.2.0:
decimal.js@^10.0.0, decimal.js@^10.2.1:
version "10.2.1"
resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.2.1.tgz#238ae7b0f0c793d3e3cea410108b35a2c01426a3"
integrity sha512-KaL7+6Fw6i5A2XSnsbhm/6B+NuEA7TZ4vqxnd5tXz9sbKtrN9Srj8ab4vKVdK8YAqZO9P1kg45Y6YLoduPf+kw==
Expand Down Expand Up @@ -4360,19 +4360,19 @@ marked@^0.8.0:
resolved "https://registry.yarnpkg.com/marked/-/marked-0.8.2.tgz#4faad28d26ede351a7a1aaa5fec67915c869e355"
integrity sha512-EGwzEeCcLniFX51DhTpmTom+dSA/MG/OBUDjnWtHbEnjAH180VzUeAw+oE4+Zv+CoYBWyRlYOTR0N8SO9R1PVw==

mathjs@^6.6.1:
version "6.6.5"
resolved "https://registry.yarnpkg.com/mathjs/-/mathjs-6.6.5.tgz#6bbad1fa3ac09e8f7106ef64af8d3908f877b8e8"
integrity sha512-jvRqk7eoEHBcx/lskmy05m+8M7xDHAJcJzRJoqIsqExtlTHPDQO0Zv85g5F0rasDAXF+DLog/70hcqCJijSzPQ==
mathjs@7.5.1:
version "7.5.1"
resolved "https://registry.yarnpkg.com/mathjs/-/mathjs-7.5.1.tgz#eb125295310a99ddcaf6145c47b09aab36e48274"
integrity sha512-H2q/Dq0qxBLMw+G84SSXmGqo/znihuxviGgAQwAcyeFLwK2HksvSGNx4f3dllZF51bWOnu2op60VZxH2Sb51Pw==
dependencies:
complex.js "^2.0.11"
decimal.js "^10.2.0"
decimal.js "^10.2.1"
escape-latex "^1.2.0"
fraction.js "^4.0.12"
javascript-natural-sort "^0.7.1"
seed-random "^2.2.0"
tiny-emitter "^2.1.0"
typed-function "^1.1.1"
typed-function "^2.0.0"

md5.js@^1.3.4:
version "1.3.5"
Expand Down Expand Up @@ -6185,10 +6185,10 @@ type-fest@^0.8.1:
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d"
integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==

typed-function@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/typed-function/-/typed-function-1.1.1.tgz#a1316187ec3628c9e219b91ca96918660a10138e"
integrity sha512-RbN7MaTQBZLJYzDENHPA0nUmWT0Ex80KHItprrgbTPufYhIlTePvCXZxyQK7wgn19FW5bnuaBIKcBb5mRWjB1Q==
typed-function@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/typed-function/-/typed-function-2.0.0.tgz#15ab3825845138a8b1113bd89e60cd6a435739e8"
integrity sha512-Hhy1Iwo/e4AtLZNK10ewVVcP2UEs408DS35ubP825w/YgSBK1KVLwALvvIG4yX75QJrxjCpcWkzkVRB0BwwYlA==

typedarray-to-buffer@^3.1.5:
version "3.1.5"
Expand Down

0 comments on commit e7ab670

Please sign in to comment.