1.2.0 • Published 5 years ago

cosmos-crypto-lib v1.2.0

Weekly downloads
2
License
MIT
Repository
github
Last release
5 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

5 years ago

1.1.14

5 years ago

1.1.13

5 years ago

1.1.12

5 years ago

1.1.11

5 years ago

1.1.10

5 years ago

1.1.9

5 years ago

1.1.8

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.23

5 years ago

1.0.22

5 years ago

1.0.21

5 years ago

1.0.20

5 years ago

1.0.19

5 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago