# indra-js

> Selendra javascript SDK for intergration with selendra.

Latest version **1.0.8** (published 2021-05-29) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install indra-js
pnpm add indra-js
yarn add indra-js
bun add indra-js
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.8 |
| Published | 2021-05-29 |
| First published | 2021-02-06 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 11.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | combo |
| Maintainers | iamcombo |

## Links

- npm: https://www.npmjs.com/package/indra-js
- Repository: https://github.com/selendra/indra-js
- Homepage: https://github.com/selendra/indra-js#readme
- Issues: https://github.com/selendra/indra-js/issues
- npm.io page: https://npm.io/package/indra-js

## Dependencies (6)

- [bignumber.js](https://npm.io/package/bignumber.js.md) ^9.0.1
- [@polkadot/api](https://npm.io/package/@polkadot/api.md) ^4.11.2
- [@polkadot/util](https://npm.io/package/@polkadot/util.md) ^6.5.1
- [@polkadot/keyring](https://npm.io/package/@polkadot/keyring.md) ^6.5.1
- [@polkadot/util-crypto](https://npm.io/package/@polkadot/util-crypto.md) ^6.5.1
- [@polkadot/api-contract](https://npm.io/package/@polkadot/api-contract.md) ^4.11.2

## Recent versions

- 1.0.8 (latest) — 2021-05-29
- 1.0.7 — 2021-05-25
- 1.0.6 — 2021-03-05
- 1.0.5 — 2021-02-19
- 1.0.4 — 2021-02-09
- 1.0.3 — 2021-02-08
- 1.0.2 — 2021-02-08
- 1.0.1 — 2021-02-06

## README

# Indra JS

![logo](https://user-images.githubusercontent.com/38589050/108470717-f6810200-72bc-11eb-99dc-47b00e008f32.png)

Selendra javascript SDK for intergration with selendra.

## Getting Started
## Table of Contents
* [Installation](#installation)
* [Feature](#feature)
* [Usage](#usage)
* [User Guide](#user-guide)
* [License](#license)

<a name="installation"></a>
## Installation
* with Npm
```sh
npm install indra-js
```
* with Yarn
```sh
yarn add indra-js
```

<a name='feature'></a>

## Feature
1. Create Account
2. Import Account
3. Get Balance
4. Transfer Balance
5. Transfer Batch ( Transfer balance to many account at the same time )
6. Transaction with ERC-20
 * Approve
 * Transfer
 * TransferFrom
 * Allowance
 * BalanceOf
 * Total Supply  

<a name='usage'></a>
## Usage
* Import 
```js
const { CreateAccount, ImportAccount, TransferBalance } = require('indra-js');
```
* Create Account
```js
CreateAccount({
   type
}).then((res) => {
   console.log(res.mnemonic, res.pair);
})
```
* Import Account
```js
ImportAccount({
   type
}).then((res) => {
   console.log(res.pair);
})
```
* Get Balance
```js
GetBalance({
   address
}).then((res) => {
   console.log(res.balances)
})
```
* TransferBalance
```js
TransferBalance({
   seed,
   receiverAddress, 
   amount
}).then((res) => {
   console.log(res.hash);
})
```
* TransferBatch
```js
TransferBatch({
   seed,
   data: [
      { receiverAddress: '', amount: '' }
   ]
}).then((res) => {
   console.log(res.hash);
})
```
### Contract ERC-20
* Approve
```js
const { Approve } = require('indra-js')
Approve({
   abi,
   address, 
   call_from,
   spender,
   value
}).then((res) => {
   console.log(res.hash);
})
```
* Transfer
```js
const { Transfer } = require('indra-js')
Transfer({
   abi,
   address, 
   call_from,
   to,
   value
}).then((res) => {
   console.log(res.hash);
})
```
* TransferFrom
```js
const { TransferFrom } = require('indra-js')
TransferFrom({
   abi,
   address, 
   call_from,
   from,
   to,
   value
}).then((res) => {
   console.log(res.hash);
})
```
* Allowance
```js
const { Allowance } = require('indra-js')
Allowance({
   abi,
   address, 
   call_from,
   owner,
   spender
}).then((res) => {
   console.log(res.allowance);
})
```
* BalanceOf
```js
const { BalanceOf } = require('indra-js')
BalanceOf({
   abi,
   address, 
   call_from,
   owner
}).then((res) => {
   console.log(res.balanceOf);
})
```
* Total Supply
```js
const { TotalSupply } = require('indra-js')
TotalSupply({
   abi,
   address, 
   call_from
}).then((res) => {
   console.log(res.hash);
})
```

<a name='user-guide'></a>
## User Guide
Props

| Prop Name | Description  | Default Value | Example |
| ------------- | --------------  | --------------- | ----------- |
| type | Account keys are keys that are meant to control funds. They can be either: 'sr25519' or 'ed25519'  | sr25519 | type: 'sr25519' |
| seed | The seed is your key to the account. Knowing the seed allows you, or anyone else who knows the seed, to re-generate and control this account.  | null | seed: '//Alice' |
| receiverAddress | The wallet address of the receiver. | null | receiverAddress: 'Bob ' |
| amount | Amount to send.  | null | amount: '10' |
| Contract ERC-20 |
| abi | The ABI for the WASM code. The ABI is required and stored for future operations such as sending messages.  | null | .json file |
| address | Address of the Contract.  | null | address: 'Bob' |
| call_from | Specify the user account to use for the contract call and fees will be deducted from this account.(Approve, Transfer, TransferFrom:  'call_from' must be a rawSeed)  | null | call_from: 'Bob' |

<a name='license'></a>
## License
Apache License 2.0

---
_Source: https://npm.io/package/indra-js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
