 Here comes the new version of the `btsdex` package. At first I planned to release the package by increasing the last number (patch), but due to the loss of compatibility, I had to increase the minor number. I hope you will like the changes. ## Loss of compatibility In all previous versions, before using the `BitShares` class, it was necessary to initialize it: ```js BitShares.init(<node>, <autoconnect>, <autoreconnect>) ``` Now this method is not. But the `connect` method has been enriched with parameters: ```js BitShares.connect(<node>, <autoreconnect>) ``` If you use an event system to connection, and you want to specify connection parameters, use `BitShares.node` and` BitShares.autoreconnect` to do this. ```js const BitShares = require("btsdex"); BitShares.node = "wss://api.bts.blckchnd.com"; BitShares.autoreconnect = false;// default true BitShares.subscribe("connected", start); async function start() { // code here } ``` This is the only incompatibility with other versions. ## Transaction builder Each transaction is considered accepted after inclusion in the block. Blocks are created every 3 seconds. If you need to perform several operations, their sequential execution can take considerable time. Fortunately, several operations can be included in a single transaction. To do this, use the transaction builder. To create a new transaction: ```js let tx = BitShares.newTx([<activePrivateKey>, ...]) ``` or if you already have an instance of the `BitShares` class: ```js let acc = await BitShares.login(<accountName>, <password>); let tx = acc.newTx() ``` Each operation available out of the box has a method (`<name>Operation`) that forms the operation object, but does not send it to the blockchain. To obtain the objects of operations: ```js let operation1 = await acc.transferOperation("scientistnik", "BTS", 10) let operation2 = await acc.assetIssueOperation("scientistnik", "ABC", 10) ... ``` Adding operations to a transaction: ```js tx.add(operation1) tx.add(operation2) ... ``` You can get the cost of the transaction: ```js let cost = await tx.cost() console.log(cost) // {BTS: 1.234} ``` After that, the transaction can be sent: ```js await tx.broadcast() ``` or ```js await acc.broadcast(tx) ``` The operations available to the account in the BitShares network are much more than the available object of the class `BitShares`. If you know which fields are necessary for an operation, you can use the transaction builder to submit this operation. Example of creating a new account: ```js let BitShares = require("btsdex") BitShares.subscribe("connected", start) async function start () { let acc = await BitShares.login(<accountName>, <password>) let params = { fee: {amount: 0, asset_id: "1.3.0"}, name: "trade-bot3", registrar: "1.2.21058", referrer: "1.2.21058", referrer_percent: 5000, owner: { weight_threshold: 1, account_auths: [], key_auths: [[<ownerPublicKey>, 1]], address_auths: [] }, active: { weight_threshold: 1, account_auths: [], key_auths: [[<activePublicKey>, 1]], address_auths: [] }, options: { memo_key: <memoPublicKey>, voting_account: "1.2.5", num_witness: 0, num_committee: 0, votes: [] }, extensions: [] }; let tx = acc.newTx() tx.account_create(params) // 'account_create' is the name of the operation await tx.broadcast() } ``` ## One-time request in REPL mode If you only need to make one request, you can use `--account`,` --asset`, `--block`,` --object`, `--history`,` --node` or `--transfer` command line keys: ```js $ btsdex --account <'name' or 'id' or 'last number in id'> { "id": "1.2.5992", "membership_expiration_date": "1970-01-01T00: 00: 00", "registrar": "1.2.37", "referrer": "1.2.21", ... } $ btsdex --asset <'symbol' or 'id' or 'last number in id'> { "id": "1.3.0", "symbol": "BTS", "precision": 5, ... } $ btsdex --block [<number>] block_num: 4636380 { "previous": "0046bedba1317d146dd6afbccff94412d76bf094", "timestamp": "2018-10-01T13: 09: 40", "witness": "1.6.41", ... } $ btsdex --object 1.2.3 { "id": "1.2.3", "membership_expiration_date": "1969-12-31T23: 59: 59", "registrar": "1.2.3", "referrer": "1.2.3", ... } $ btsdex --history <account> [<limit>] [<start>] [<stop>] [ { "id": "1.11.98179", "op": [ 0, ... }] $ btsdex --node wss: //api.bts.blckchnd.com Connected to API node: wss: //api.bts.blckchnd.com $ btsdex --transfer <from> <to> <amount> <asset> [--key] Transfered <amount> <asset> from '<from>' to '<to>' with memo '<memo>' ``` ## Documentation Update Updated [documentation](https://scientistnik.github.io/btsdex/#/), added its [Russian version](https://scientistnik.github.io/btsdex/#/ru/). <hr> If you have any wishes for further development of the package, or perhaps there is no very useful function, write on GitHub, or if you want to talk in person, use Telegram-channel [btsdex](https://t.me/btsdex). I have it all. Great weekend to everyone!
author | scientistnik |
---|---|
permlink | btsdex-v0-6-0 |
category | utopian-io |
json_metadata | {"tags":["utopian-io","bitshares","blockchain"],"image":["https://cdn.steemitimages.com/DQmWRd3fqRBT4ixj4RKE6gE1qLo1fbnrLFHuPLk2JZYKZxn/BTSDEX.png"],"links":["https://scientistnik.github.io/btsdex/#/","https://scientistnik.github.io/btsdex/#/ru/","https://t.me/btsdex"],"app":"steemit/0.1","format":"markdown"} |
created | 2018-10-28 14:58:27 |
last_update | 2018-10-28 14:58:27 |
depth | 0 |
children | 1 |
last_payout | 2018-11-04 14:58:27 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 1.834 HBD |
curator_payout_value | 0.521 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 5,171 |
author_reputation | 748,919,157,653 |
root_title | "BTSDEX v0.6.0" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 74,216,777 |
net_rshares | 2,046,110,060,117 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
cm-steem | 0 | 513,505,604,134 | 100% | ||
vortac | 0 | 1,266,790,098,671 | 33% | ||
eforucom | 0 | 2,540,892,990 | 1% | ||
bubke | 0 | 171,929,173,890 | 100% | ||
scientistnik | 0 | 1,105,241,741 | 100% | ||
leir | 0 | 1,950,840,984 | 50% | ||
scorer | 0 | 40,791,211,570 | 100% | ||
funt33 | 0 | 791,371,479 | 100% | ||
statsexpert | 0 | 1,286,763,284 | 20% | ||
dementei | 0 | 540,803,897 | 100% | ||
gnom532 | 0 | 540,836,175 | 100% | ||
ivan.gotovin | 0 | 542,337,331 | 100% | ||
hronys | 0 | 543,257,440 | 100% | ||
grabowskig | 0 | 542,038,465 | 100% | ||
naskaipr12 | 0 | 542,641,963 | 100% | ||
araxachatryan | 0 | 540,330,044 | 100% | ||
viktorpetro | 0 | 540,559,586 | 100% | ||
trovimov | 0 | 540,309,666 | 100% | ||
pavlovdinar | 0 | 540,289,832 | 100% | ||
danilkramov | 0 | 545,090,555 | 100% | ||
rdavis81 | 0 | 539,570,065 | 100% | ||
publicchord | 0 | 539,778,427 | 100% | ||
cupswavy | 0 | 540,151,811 | 100% | ||
luffnoisy | 0 | 539,599,109 | 100% | ||
thusmow | 0 | 541,445,191 | 100% | ||
fleshtestify | 0 | 540,206,219 | 100% | ||
hoovesreport | 0 | 541,021,479 | 100% | ||
nikolastelma | 0 | 542,814,083 | 100% | ||
lukemccoy92 | 0 | 545,415,646 | 100% | ||
mvetrov88 | 0 | 540,281,717 | 100% | ||
skuzmin88 | 0 | 542,002,037 | 100% | ||
tensilegangway | 0 | 545,460,181 | 100% | ||
towheelocate | 0 | 541,159,078 | 100% | ||
cyandyewilson | 0 | 543,428,786 | 100% | ||
ragssunny | 0 | 542,241,463 | 100% | ||
dunbirdderision | 0 | 545,092,491 | 100% | ||
skimmingfind | 0 | 540,926,472 | 100% | ||
weakshare | 0 | 543,512,395 | 100% | ||
meatgooey | 0 | 543,519,011 | 100% | ||
varvenickel | 0 | 541,970,685 | 100% | ||
muddygrey | 0 | 541,458,486 | 100% | ||
unequaledpelite | 0 | 541,061,529 | 100% | ||
fimschell | 0 | 545,765,980 | 100% | ||
englishbracket | 0 | 544,231,789 | 100% | ||
eggyrothwell | 0 | 541,306,755 | 100% | ||
studiedcovalent | 0 | 542,449,305 | 100% | ||
roadlifted | 0 | 546,360,736 | 100% | ||
anaerobepicket | 0 | 542,828,661 | 100% | ||
poluotts | 0 | 542,723,395 | 100% | ||
niksem1983 | 0 | 545,354,088 | 100% | ||
atihonov1990 | 0 | 542,258,101 | 100% | ||
devidhodz | 0 | 542,608,740 | 100% | ||
hdikkerson | 0 | 545,497,909 | 100% | ||
sergeyrevutskiy | 0 | 543,793,291 | 100% | ||
yulya.zaharova | 0 | 543,160,787 | 100% | ||
nikponom1989 | 0 | 542,354,486 | 100% | ||
nikbelin1983 | 0 | 543,095,538 | 100% | ||
sashokbad | 0 | 543,108,840 | 100% | ||
annagalic | 0 | 546,847,597 | 100% | ||
niksemch | 0 | 547,422,175 | 100% | ||
teamcr | 0 | 783,309,552 | 100% | ||
observedkey | 0 | 548,690,048 | 100% | ||
screechingchothy | 0 | 548,444,365 | 100% | ||
sessionscells | 0 | 548,693,296 | 100% | ||
conditionsglope | 0 | 545,002,794 | 100% | ||
dramaticsphene | 0 | 545,705,244 | 100% | ||
alpineraging | 0 | 549,331,672 | 100% | ||
cheddarsfloss | 0 | 544,784,479 | 100% | ||
signaloutlook | 0 | 548,737,680 | 100% | ||
obtainmelody | 0 | 548,610,216 | 100% | ||
tyresgoose | 0 | 545,857,297 | 100% | ||
limitstousled | 0 | 548,728,887 | 100% | ||
boshben | 0 | 548,667,175 | 100% | ||
genius.mbish | 0 | 545,032,602 | 100% | ||
artemka222 | 0 | 548,637,206 | 100% | ||
lico.ryka | 0 | 548,691,970 | 100% | ||
postporreof | 0 | 545,912,835 | 100% | ||
cogmacdui | 0 | 545,853,346 | 100% | ||
beefhunter | 0 | 549,272,037 | 100% | ||
teamruffs | 0 | 547,262,809 | 100% | ||
coyotefizzle | 0 | 547,284,993 | 100% | ||
windsurferstatic | 0 | 548,519,697 | 100% | ||
appliedhandbag | 0 | 544,233,644 | 100% | ||
haumearook | 0 | 545,626,587 | 100% | ||
breadscurvy | 0 | 548,643,441 | 100% | ||
splashdrown | 0 | 547,232,220 | 100% | ||
furiouslife | 0 | 547,218,447 | 100% | ||
mutatorfounded | 0 | 545,729,706 | 100% | ||
sensorintestine | 0 | 545,669,229 | 100% | ||
safetyseed | 0 | 547,272,956 | 100% | ||
radicalpacific | 0 | 547,263,857 | 100% | ||
trouvwabeavit | 0 | 547,161,599 | 100% |
Congratulations @scientistnik! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) : <table><tr><td>https://steemitimages.com/60x70/http://steemitboard.com/@scientistnik/voted.png?201810282336</td><td>You received more than 250 upvotes. Your next target is to reach 500 upvotes.</td></tr> </table> <sub>_[Click here to view your Board of Honor](https://steemitboard.com/@scientistnik)_</sub> <sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub> **Do not miss the last post from @steemitboard:** <table><tr><td><a href="https://steemit.com/halloween/@steemitboard/trick-or-treat-publish-your-scariest-halloweeen-story-and-win-a-new-badge"><img src="https://steemitimages.com/64x128/http://i.cubeupload.com/RUyB3u.png"></a></td><td><a href="https://steemit.com/halloween/@steemitboard/trick-or-treat-publish-your-scariest-halloweeen-story-and-win-a-new-badge">Trick or Treat - Publish your scariest halloween story and win a new badge</a></td></tr><tr><td><a href="https://steemit.com/steemitboard/@steemitboard/steemitboard-notifications-improved"><img src="https://steemitimages.com/64x128/http://i.cubeupload.com/NgygYH.png"></a></td><td><a href="https://steemit.com/steemitboard/@steemitboard/steemitboard-notifications-improved">SteemitBoard notifications improved</a></td></tr></table> > Support [SteemitBoard's project](https://steemit.com/@steemitboard)! **[Vote for its witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1)** and **get one more award**!
author | steemitboard |
---|---|
permlink | steemitboard-notify-scientistnik-20181029t001214000z |
category | utopian-io |
json_metadata | {"image":["https://steemitboard.com/img/notify.png"]} |
created | 2018-10-29 00:12:12 |
last_update | 2018-10-29 00:12:12 |
depth | 1 |
children | 0 |
last_payout | 2018-11-05 00:12:12 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 1,616 |
author_reputation | 38,975,615,169,260 |
root_title | "BTSDEX v0.6.0" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 74,241,510 |
net_rshares | 0 |