0.16.6 • Published 1 year ago

@ltonetwork/lto v0.16.6

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

LTO github readme

LTO API npm version

Client for LTO Network. Integration for both public blockchain and private event-chain.

Installation

npm install @ltonetwork/lto

or

yarn add @ltonetwork/lto

Alternatively you can download the library as bundle.

Usage

The chain id is 'L' for the mainnet and 'T' testnet.

import LTO, {Binary} from '@ltonetwork/lto';

const lto = new LTO('T');

const account = lto.account();

const seed = 'satisfy sustain shiver skill betray mother appear pupil coconut weasel firm top puzzle monkey seek';
const accountFromSeed = lto.account({ seed });

lto.transfer(account, recipient, 100_00000000);
lto.massTransfer(account, [{recipient: recipient1, amount: 100_00000000}, {recipient: recipient2, amount: 50_00000000}]);
lto.anchor(account, new Binary('some value').hash(), new Binary('other value').hash());
lto.associate(account, 0x3400, recipient);
lto.revokeAssociation(account, 0x3400, recipient);
lto.lease(account, recipient, 10000_00000000);
lto.cancelLease(account, leaseId);
lto.sponsor(account, otherAccount);
lto.cancelSponsorship(account, otherAccount);

lto.getBalance(account);
lto.setData(account, {foo: 'bar'});
lto.getData(account);

Amounts are in LTO * 10^8. Eg: 12.46 LTO is 12_46000000.

Documentation

For more advanced use cases, please read the documentation.

Download bundle

The library is also available as a bundle. This bundle includes the library and all its dependencies. This bundle is useful if you want to use the library in a browser environment.

You can download the bundle from the GitHub releases page.

The library is bundles as a UMD module. This means you can use it in the browser as global variable LTO, or you can import it as a module in your JavaScript code.

Browser

<script src="lto.js"></script>
<script>
    const lto = LTO.connect('T');
    const account = lto.account();
    console.log(account.address);
    
    lto.anchor(account, new LTO.Binary('test').hash())
      .then(tx => console.log(tx.id));
</script>

Troubleshooting

Global variable LTO is an object with all exported classes and functions. If you try to do new LTO() you will get the error:

TypeError: LTO is not a constructor

Use LTO.connect() instead.

0.16.6

1 year ago

0.15.16

1 year ago

0.14.10

2 years ago

0.15.4

2 years ago

0.13.6

2 years ago

0.15.5

2 years ago

0.13.7

2 years ago

0.15.6

2 years ago

0.15.7

2 years ago

0.15.8

2 years ago

0.15.9

2 years ago

0.15.0

2 years ago

0.15.1

2 years ago

0.15.2

2 years ago

0.15.3

2 years ago

0.14.5

2 years ago

0.16.4

2 years ago

0.14.6

2 years ago

0.14.7

2 years ago

0.14.8

2 years ago

0.14.9

2 years ago

0.14.0

2 years ago

0.14.1

2 years ago

0.16.0

2 years ago

0.14.2

2 years ago

0.16.1

2 years ago

0.14.3

2 years ago

0.14.4

2 years ago

0.15.10

2 years ago

0.15.13

2 years ago

0.15.14

2 years ago

0.15.11

2 years ago

0.15.12

2 years ago

0.15.15

2 years ago

0.13.5

2 years ago

0.13.0

2 years ago

0.13.1

2 years ago

0.13.2

2 years ago

0.13.3

2 years ago

0.13.4

2 years ago

0.12.2

2 years ago

0.12.3

2 years ago

0.12.4

2 years ago

0.12.5

2 years ago

0.11.0

2 years ago

0.11.1

2 years ago

0.11.2

2 years ago

0.11.3

2 years ago

0.11.4

2 years ago

0.10.10

2 years ago

0.11.5

2 years ago

0.10.11

2 years ago

0.10.12

2 years ago

0.10.13

2 years ago

0.10.9

2 years ago

0.10.3

2 years ago

0.10.4

2 years ago

0.10.5

2 years ago

0.10.6

2 years ago

0.10.7

2 years ago

0.10.8

2 years ago

0.10.2

2 years ago

0.10.1

3 years ago

0.10.0

3 years ago

0.9.4

3 years ago

0.9.3

3 years ago

0.9.0

3 years ago

0.9.2

3 years ago

0.9.1

3 years ago

0.8.9

3 years ago

0.8.7

3 years ago

0.8.6

3 years ago

0.8.5

3 years ago

0.6.7

3 years ago

0.8.4

3 years ago

0.6.6

3 years ago

0.6.9

3 years ago

0.6.8

3 years ago

0.8.1

3 years ago

0.7.2

3 years ago

0.7.1

3 years ago

0.8.3

3 years ago

0.6.5

3 years ago

0.8.2

3 years ago

0.7.0

3 years ago

0.6.3

3 years ago

0.6.2

3 years ago

0.6.4

3 years ago

0.6.1

3 years ago

0.0.0

3 years ago

0.1.0

3 years ago