1- import { Bech32 , fromBase64 , fromHex } from "@cosmjs/encoding" ;
1+ import { fromBase64 , fromBech32 , fromHex } from "@cosmjs/encoding" ;
22
33import {
44 decodeAminoPubkey ,
@@ -39,7 +39,7 @@ describe("encoding", () => {
3939
4040 describe ( "decodeAminoPubkey" , ( ) => {
4141 it ( "works for secp256k1" , ( ) => {
42- const amino = Bech32 . decode (
42+ const amino = fromBech32 (
4343 "cosmospub1addwnpepqd8sgxq7aw348ydctp3n5ajufgxp395hksxjzc6565yfp56scupfqhlgyg5" ,
4444 ) . data ;
4545 expect ( decodeAminoPubkey ( amino ) ) . toEqual ( {
@@ -51,7 +51,7 @@ describe("encoding", () => {
5151 it ( "works for ed25519" , ( ) => {
5252 // Encoded from `corald tendermint show-validator`
5353 // Decoded from http://localhost:26657/validators
54- const amino = Bech32 . decode (
54+ const amino = fromBech32 (
5555 "coralvalconspub1zcjduepqvxg72ccnl9r65fv0wn3amlk4sfzqfe2k36l073kjx2qyaf6sk23qw7j8wq" ,
5656 ) . data ;
5757 expect ( decodeAminoPubkey ( amino ) ) . toEqual ( {
@@ -65,7 +65,7 @@ describe("encoding", () => {
6565 } ) ;
6666
6767 it ( "works for multisig" , ( ) => {
68- const pubkeyData = Bech32 . decode (
68+ const pubkeyData = fromBech32 (
6969 "cosmospub1addwnpepqd8sgxq7aw348ydctp3n5ajufgxp395hksxjzc6565yfp56scupfqhlgyg5" ,
7070 ) . data ;
7171 const pubkey = {
@@ -156,7 +156,7 @@ describe("encoding", () => {
156156 type : "tendermint/PubKeySecp256k1" ,
157157 value : "A08EGB7ro1ORuFhjOnZcSgwYlpe0DSFjVNUIkNNQxwKQ" ,
158158 } ;
159- const expected = Bech32 . decode (
159+ const expected = fromBech32 (
160160 "cosmospub1addwnpepqd8sgxq7aw348ydctp3n5ajufgxp395hksxjzc6565yfp56scupfqhlgyg5" ,
161161 ) . data ;
162162 expect ( encodeAminoPubkey ( pubkey ) ) . toEqual ( expected ) ;
@@ -169,7 +169,7 @@ describe("encoding", () => {
169169 type : "tendermint/PubKeyEd25519" ,
170170 value : "YZHlYxP5R6olj3Tj3f7VgkQE5VaOvv9G0jKATqdQsqI=" ,
171171 } ;
172- const expected = Bech32 . decode (
172+ const expected = fromBech32 (
173173 "coralvalconspub1zcjduepqvxg72ccnl9r65fv0wn3amlk4sfzqfe2k36l073kjx2qyaf6sk23qw7j8wq" ,
174174 ) . data ;
175175 expect ( encodeAminoPubkey ( pubkey ) ) . toEqual ( expected ) ;
@@ -200,16 +200,16 @@ describe("encoding", () => {
200200 } ) ;
201201
202202 it ( "works for multisig" , ( ) => {
203- const expected1 = Bech32 . decode ( testgroup1PubkeyBech32 ) . data ;
203+ const expected1 = fromBech32 ( testgroup1PubkeyBech32 ) . data ;
204204 expect ( encodeAminoPubkey ( testgroup1 ) ) . toEqual ( expected1 ) ;
205205
206- const expected2 = Bech32 . decode ( testgroup2PubkeyBech32 ) . data ;
206+ const expected2 = fromBech32 ( testgroup2PubkeyBech32 ) . data ;
207207 expect ( encodeAminoPubkey ( testgroup2 ) ) . toEqual ( expected2 ) ;
208208
209- const expected3 = Bech32 . decode ( testgroup3PubkeyBech32 ) . data ;
209+ const expected3 = fromBech32 ( testgroup3PubkeyBech32 ) . data ;
210210 expect ( encodeAminoPubkey ( testgroup3 ) ) . toEqual ( expected3 ) ;
211211
212- const expected4 = Bech32 . decode ( testgroup4PubkeyBech32 ) . data ;
212+ const expected4 = fromBech32 ( testgroup4PubkeyBech32 ) . data ;
213213 expect ( encodeAminoPubkey ( testgroup4 ) ) . toEqual ( expected4 ) ;
214214 } ) ;
215215 } ) ;
0 commit comments