Closed lumoverix closed 11 months ago
waxjs is an interface between the dapp and user, there is no username and password here cause they user will login to their account using the waxjs interface in the browser. when the user logs in the waxjs library will get the user accounts and public keys, after which you can execute transactions on behalf of the user, if you need to use private keys and so on you will need to use the eosjs and waxjs is not necessary.
const { Api, JsonRpc, RpcError, Serialize } = require('eosjs');
const { JsSignatureProvider } = require('eosjs/dist/eosjs-jssig'); // EOSJS v2
const fetch = require('node-fetch'); // or any other HTTP request library
const { TextEncoder, TextDecoder } = require('util');
const rpc = new JsonRpc('https://your-eos-rpc-endpoint.com', { fetch });
const signatureProvider = new JsSignatureProvider(['YOUR_PRIVATE_KEY']);
const api = new Api({ rpc, signatureProvider, textEncoder: new TextEncoder(), textDecoder: new TextDecoder() });
Thanks for that reply, very much.
Does that interface with a fully synced https://github.com/worldwide-asset-exchange/wax-node ?
yes it does and remember that wax-node is server node for waxjs if you plan to setup your own node. waxjs is just like an oauth layer for dapps and eosjs is the blockchain interface that lets you interface with the wax block chain. generally frontend apps will use waxjs to authenticate the user and execute smart contract actions on behalf on the user. eosjs is a layer below that, in this context most of the time eosjs is usually used on the server side. eg : you want to sign a transaction with your private key for your smart contract.
No where in any examples do I see usage of the password or private key, how does login supposed to work if there is never passed the password or private key?