You need to run a local Bottos node to use this library.
The SDK supports below features:
- wallet creation
- smart contract calling
- smart contract deplyment
- Transaction, stake
- connection management to chain (to do)
npm install bottos-sdk-js --save
yarn add bottos-sdk-js
var BottosWalletSDK = require('bottos-sdk-js');
<script src="path/to/bottos-sdk-js.min.js"></script>
<!-- or a CDN -->
<script src="unpkg.com/bottos-sdk-js"></script>
You can find the bottos-sdk-js.min.js file on release page
const sdk = new BottosWalletSDK({
baseUrl: "http://localhost:8689/v1"
});
const Wallet = sdk.Wallet
There you go, now you can use it:
const Keypairs = Wallet.createKeys()
console.log('Keypairs', Keypairs)
Send a transaction:
const params = {
from: 'testaccount1',
to: 'testaccount2',
value: 100,
}
let privateKey = 'b4e0391643ff9be326a6ddfa543df0e0c2e37b7e11ed2f45590c62a5d5f09d9f'
Wallet.sendTransaction(params, privateKey)
.then(res => {
console.log('sendTransaction res:', res)
})
You can find more examples in the example
directory.