1.2.0 • Published 4 years ago

cosmos-crypto-lib v1.2.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

cosmos-crypto-lib

npm version

Cosmos Crypto Library.

Quick Start

Install

yarn add cosmos-crypto-lib

Usage

1. import cosmos-crypto-lib

    const cosmosCrypto = require('cosmos-crypto-lib');

    const Crypto = cosmosCrypto.getCrypto();
    const crypto = new Crypto();

2. create a cosmos wallet

    const cosmosWallet = crypto.create(cosmosCrypto.config.language.en);
    assert.exists(cosmosWallet.address);

3. import a cosmos wallet by the private key

    const cosmosWallet = crypto.import("YOUR_PRIVATE_KEY");

4. import a cosmos wallet by mnemonic code

    const cosmosWallet = crypto.recover("YOUR_MNEMONIC_CODE", cosmosCrypto.config.language.en)

Because of network traffic, some operations like transfer, delegate, undelegate... may cause failures.

You have to retry for some more times.

Best way to solve this problem is to run your own node.

5. transfer

    const host = "https://stargate.cosmos.network";
    crypto.transfer(privateKey, "cosmoshub-2", host, "YOUR_FROM_ADDRESS", toAddress, "TRANSFER_AMOUNT");

6. delegate

    const host = "https://stargate.cosmos.network";
    crypto.delegate(privateKey, "cosmoshub-2", host, "YOUR_FROM_ADDRESS", "YOUR_VALIDATION_ADDR", "DELEGATE_UATOM_AMOUNT");

7. undelegate

    const host = "https://stargate.cosmos.network";
    crypto.undelegate(privateKey, "cosmoshub-2", host, "YOUR_FROM_ADDRESS", "YOUR_VALIDATION_ADDR", "DELEGATE_UATOM_AMOUNT");

ATOM to the moon!

1.2.0

4 years ago

1.1.14

4 years ago

1.1.13

4 years ago

1.1.12

4 years ago

1.1.11

4 years ago

1.1.10

4 years ago

1.1.9

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.23

4 years ago

1.0.22

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.19

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago