Hot answers tagged

9

This is a very subjective thing. Personally I would recommend to learn React with Redux. Here is a little Tutorial The main advantage is that you can use React for the visual representation und decapsule it from the application logic which is build with Redux. Other stuff to look at would be Angular 4 (visual Framework) Vue (visual Framework) and maybe ...


7

You have several ways to retrieve data from eos chain as i know. They differs a lot, so you should find a better one for you case. #1. Get from table As you noted there is getTableRows method in eosjs lib, and by default it returns packed response. You can pass option json: true to instruct library to unpack response for you. eos.getTableRows({ code:'...


6

That's the eosjs object that you have in the browser as Scatter requires it to be present to be able to sign EOS transactions. See here: https://github.com/EOSIO/eosjs Eos = require('eosjs') The Scatter documentations are pretty new and are really terse. This should be expanded in the documentation of scatter.


6

I think the best examples lives in Scatter-Demo repository: https://github.com/EOSEssentials/Scatter-Demos I have also built MonsterEOS where you can check another interaction with EOSJS and Scatter: https://github.com/leordev/monstereos


6

The eosjs library has a format module that will transform account name strings into the appropriate table keys... const Eos = require("eosjs") const BigNumber = require("bignumber.js") const accountName = 'myaccount' const encodedName = new BigNumber(Eos.modules.format.encodeName(accountName, false)) ** Notes: Be sure to pass false to format.encodeName, ...


6

Basically, pull the existing permission, change only what you need to change, then pass everything back to updateauth .. async function getNewPermissions(accountName) { const account = await eos.getAccount(accountName) const perms = JSON.parse(JSON.stringify(account.permissions)) return perms } const perms = await getNewPermissions(accountName) ...


5

I heavily use eosjs with Vue.js+Vuex, it is much more developer friendly and easier to learn than React when you want to scale. The first EOS browser extension, Scatter, also uses Vue for the frontend very effectively, so does Bloks.io(best EOS block explorer with wallet), BetDice(biggest probably fair EOS gambling site) and many more.


5

There is an article in the documentation detailing how you can setup and run a network with multiple producers, voting, and resource consumption. Excerpt: In this tutorial, we will start a number of nodeos nodes, point them to each other, and eventually vote on a set of producers. All of the nodeos nodes will run on the same server. In the following ...


4

There is a system contract for voting. It can be found here: https://github.com/EOSIO/eos/blob/master/contracts/eosio.system/voting.cpp ABI can be found here: https://github.com/EOSIO/eos/blob/master/contracts/eosio.system/eosio.system.abi You can run a cleos action command for the system contract: cleos push action eosio voteproducer '["voter", "proxy",...


4

In a smart contract, you could do this by emplacing multiple actions into a single transaction, as follows: transaction transfer; transfer.actions.emplace_back(eosio::permission_level {_self, N(active) }, N(eosio.token), N(transfer), std::make_tuple(from_account, to_account_1, quantity_to_send, std::string("memo"))); transfer.actions.emplace_back(eosio::...


4

const sortedBPs = producers.sort(); await eos.voteproducer(userAccountName, proxy, sortedBPs ); ...Adding a sort and moving it outside the await fixed the issue.


4

eosjs does require chainId, but if it isn't provided directly it will be retrieved from the host endpoint. Api accepts chainId as an argument but if chainId isn't passed as an argument when the api is constructed, Api will fetch it from the host endpoint via JsonRpc. transact() checks to see if chainId is set. If not, it calls rpc.get_info() which returns ...


4

Yes there is IDE for eosio you can try to this IDE https://www.eosstudio.io/


3

TL;DR: Single threaded performance: up to 8,000 TPS Multi-threaded performance: unlimited TPS Here's what Dan Larimer said at the launch of Dawn 3.0 https://medium.com/eosio/eosio-dawn-3-0-now-available-49a3b99242d7 Performance Real-world performance is something our team has been monitoring closely, and we are very happy with the results at this time. We ...


3

Call voteproducer.. > eos.voteproducer() CONTRACT eosio FUNCTION voteproducer PARAMETERS { "voter": "account_name", "proxy": "account_name", "producers": "account_name[]" } EXAMPLE { "voter": "", "proxy": "", "producers": [ "" ] } Lookup your account name using your EOS Claim Key. This is one tool for the job: ...


3

Of course, eosjs provides method getActions. Here's an example: const Eos = require('eosjs'); const api = new Eos({ httpEndpoint: 'https://eos.greymass.com', chainId: 'aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906', }); api.getActions('wangruixiwww').then(console.log); You can send direct request to some API like this https://...


3

You can simply request a node to give you the action history of an account. Using cleos: cleos --url https://api1.eosdublin.io get actions <EOS account name> Using eosjs: const eosjs = require("eosjs") const eos = eosjs({ httpEndpoint: 'https://api1.eosdublin.io', chainId: 'aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906' }) ...


3

A good way would be to use the demux-js library. It listens for specified actions and allows updating logic for whatever kind of database you like. This is a RAM free option which essentially allows you to achieve CRUD functionality by creating a mirror image of what the blockchain would show if you played through all of your actions. Mind the mess, but ...


3

In eosjs v20.x, getCurrencyBalance has been renamed to get_currency_balance, and moved within the Rpc object. You can use it like this... const fetch = require('node-fetch'); const { JsonRpc } = require('eosjs'); // Instantiate a new JsonRpc object, with the Network Api Uri, and a request object const rpc = new JsonRpc('https://api.kylin.alohaeos.com', { ...


3

After searching the official doc and trying different approches I finally got it to work. I've used eos.transaction instead of eos.transfer and the following example is working for those interested: var res = await eos.transaction({ actions: [ { account: "eosjackscoin", //has to be the smart contract name of the token you want to transfer - ...


3

If you have the cheddar, you could go for a web-socket connection. https://www.dfuse.io/en - EOS Canada https://eospark.com/openapi If not, demux is likely your best bet. For best results, you would want to host your own node or use an API endpoint that shares your need for consistent up time. Demux isn't too difficult to implement and there are many ...


3

0x is a flag for compilers to know that it's a hex value. This isn't required for hexToUint8Array();


2

Exactly, it provides private keys used to sign transactions. Here the definition from the eosjs github page: keyProvider [array|string|function]: Provides private keys used to sign transactions. If multiple private keys are found, the API get_required_keys is called to discover which signing keys to use. If a function is provided, this function is ...


2

Yes you need a private key. If you are doing a front-end where you need to use EOSjs and need user's private key, ask them to enable Scatter wallet instead and you simply get an eosjs object from Scatter instead.


2

You could use an approach similar to the dice contract sample: Each user submits sha256(move), where move contains the user's actions plus a random number After the turn, each user submits move. The contract can verify the move matches the hash.


2

Use eosjs get_key_accounts. See https://github.com/EOSIO/eosjs-api/commit/21675aec294d6f65f3cbace049839751a087676f


2

Yes there is. You can get this data from nodes that are running with the history_plugin plugin. You could use the HTTP API directly as in /v1/history/get_transaction, or you could use cleos: cleos --url https://api1.eosdublin.io get transaction <Transaction ID> You could also use eosjs: const eosjs = require("eosjs") const eos = eosjs({ ...


2

Short answer: You can't. From the mainnet governance repository: {{buyer}} acknowledges that RAM is non-transferable. What you can do to transfer RAM to someone is simply buying more RAM and assigning the other account as the receiver of the RAM purchase. This is one of the parameters of the buyram action, and depending on what tool/wallet you use to ...


2

I guess the problem lies in the this.test allocation, because the result of your eos call is this.test, which is likely to be a promise. If you have Babel installed or ES6 support you can use an arrow function: eos[camelCase](action) .then(response => { console.log(response) }) .catch(error => console.log(error)) Otherwise you can try ...


2

If I understand your question correctly, you can send a deferred transaction like you usually would but defining the delay as a function parameter: void send(account_name account, std::string message, uint64_t delay) { eosio::transaction t{}; t.actions.emplace_back( eosio::permission_level(account, N(active)), N(othercontract), ...


Only top voted, non community-wiki answers of a minimum length are eligible