dappathy v1.0.0
dappathy
Easy, uniform dev framework for communication with any number of blockchains and blockchain wallets.
v0.0.1 (pre-alpha). Not yet added to the NPM registry.
DISCLAIMER: updates are being pushed from our private repo during the first 2 weeks of January 2020 as they clear the testing process. However, this code is still under active development and comes with no warranty of any kind, express or implied. Usage in a project will require extensive customization until testing is complete and may cause unexpected behavior.
Basic usage
- Initialize an account.
let account = new EOSAccount();Account options currently supported include IOSTAccount, TronAccount, EOSAccount, and EthereumAccount. While EOSvAccount is included, it is not yet fully supported until deployment scripts for DAPP Service Providers can be implemented. To get started allowing your dApp to use virtual accounts before the necessary scripts are finished, see the LiquidAccounts docs.
Virtual accounts for IOST are in progress but not yet supported.
In progress: BTCAccount with Ledger support, TezosAccount, CardanoAccount.
Basic EOSIO sister chain support is in progress. Kylin testnet is currently supported with EOSAccount("Kylin"). Ropsten testnet can currently be used by changing the network in the Metamask interface.
- Use
setAddress()to connect to wallets.
At this time:
EOSAccount(Kylin and mainnet) supports Scatter. MainnetEOSAccountsupports TokenPocket and other Scatter-compatible mobile wallets.IOSTAccountsupports the iWallet Chrome extension and TokenPocket. Easy account creation in progress.EthereumAccountsupports Metamask and compatible mobile wallets (TokenPocket, Cipher, etc.). Direct Ledger connection in progress.TronAccountsupports the TronLink extension and TokenPocket.BTCAccount(to be released soon) supports direct Ledger connection.
setAddress() takes the following parameters...
setAddress([index],[stateSetter],[callback],[appname],[username],[key])...where appname is optional for Scatter connection (EOSAccount) and username and key are for EOSvAccount. Simplication of these parameters is in progress. Sample stateSetter / callback code for various development frameworks will be available soon.
- Use universal methods to communicate with the blockchain.
Available methods include:
act(contractAddress, [ABI], action, payload)- post a contract action.EthereumAccountis the only chain to requireABI. In the future, verified ABIs will be automatically downloaded from etherscan.io, removing this necessity. CurrentlyEthereumAccount.actis quite limited.storeHash(ipfsHash, storer, contractAddress)– store an IPFS hash to a contract under the user's account name.retrieveHash(username, contractAddress, callback)– retrieve the IPFS hash associated with the user's account name.
Early reference implementations:
send(token, recipient, amount, [memo])- sendtokentorecipientsign(message)- sign a message with user's private key
Scheduled to be pushed soon:
getBalance([token], [account])- get token balance (default is chain's native asset) for connected account, or foraccountgetStorage(contract, account, key, [field])- get a value from contract storage
Sample contracts for storing IPFS hashes to Ethereum, IOST, EOS, and Tron are available in /contracts.
6 years ago