Create toBech32 and fromBech32 in @cosmjs/encoding (#1058)

* Create toBech32 and fromBech32

* Add changes to CHANGELOG.md

* Fix linting

* Update packages/encoding/src/bech32.ts

Co-authored-by: Simon Warta <2603011+webmaster128@users.noreply.github.com>

* Update CHANGELOG.md

Co-authored-by: Simon Warta <2603011+webmaster128@users.noreply.github.com>

* Update packages/encoding/src/bech32.ts

Co-authored-by: Simon Warta <2603011+webmaster128@users.noreply.github.com>

* Update bech32.ts

Co-authored-by: Simon Warta <2603011+webmaster128@users.noreply.github.com>
This commit is contained in:
Milan Steiner
2022-02-22 14:05:34 +01:00
committed by GitHub
co-authored by Simon Warta
parent 9b80dff493
commit 4c8b278c1d
20 changed files with 84 additions and 61 deletions
+2 -2
View File
@@ -3,7 +3,7 @@
/* eslint-disable @typescript-eslint/naming-convention */
const { coins } = require("@cosmjs/amino");
const { Random } = require("@cosmjs/crypto");
const { Bech32 } = require("@cosmjs/encoding");
const { toBech32 } = require("@cosmjs/encoding");
const { DirectSecp256k1HdWallet } = require("@cosmjs/proto-signing");
const {
assertIsDeliverTxSuccess,
@@ -23,7 +23,7 @@ const faucet = {
async function main() {
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic, { prefix: prefix });
const client = await SigningStargateClient.connectWithSigner(rpcUrl, wallet, { prefix: prefix });
const recipient = Bech32.encode(prefix, Random.getBytes(20));
const recipient = toBech32(prefix, Random.getBytes(20));
const amount = coins(226644, "ucosm");
const fee = calculateFee(100_000, "0.025ucosm");
const memo = "Ensure chain has my pubkey";