Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan James committed Aug 30, 2018
1 parent d6efc55 commit 0f18cb9
Show file tree
Hide file tree
Showing 35 changed files with 13,803 additions and 6,862 deletions.
4 changes: 3 additions & 1 deletion mock-sites/esm/index.html
Expand Up @@ -6,6 +6,8 @@
<script src="main.bundle.js"></script>
</head>
<body>

<button onclick="login()">Get Identity</button>
<button onclick="logout()">Forget Identity</button>
<button onclick="transfer()">Transfer</button>
</body>
</html>
27 changes: 26 additions & 1 deletion mock-sites/esm/main.bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion mock-sites/esm/main.bundle.js.map

Large diffs are not rendered by default.

45 changes: 38 additions & 7 deletions mock-sites/esm/main.js
@@ -1,11 +1,42 @@
import ScatterJS from 'scatterjs-core'
import Eos from 'eosjs'
import ScatterJS from '../../packages/core/dist/index';
import ScatterEosjs from '../../packages/plugin-eosjs/dist/index'

class Main {
const network = {
blockchain:'eos',
chainId:'038f4b0fc8ff18a4f0842a8f0564611f6e96e8535901dd45e43ac8691a1c4dca',
host:'dev.cryptolions.io',
port:18888,
protocol:'http'
};

constructor(){
console.log('hi', ScatterJS)
}

}
ScatterJS.plugins( new ScatterEosjs() );
let scatter = null;

module.exports = new Main();
ScatterJS.scatter.connect('LernaTest').then(connected => {
if(!connected) return false;
scatter = ScatterJS.scatter;
console.log('sc', scatter);
});

window.login = () => {
scatter.getIdentity({accounts:[network]}).then(id => {
console.log('id', id);
})
};

window.logout = () => {
scatter.forgetIdentity();
};

window.transfer = () => {
const eos = scatter.eos(network, Eos);
const account = scatter.identity.accounts.find(x => x.blockchain === 'eos');
const opts = { authorization:[`${account.name}@${account.authority}`] };
eos.transfer(account.name, 'test', '1.0000 EOS', '', opts).then(trx => {
console.log('trx', trx);
}).catch(err => {
console.error(err);
})
};

0 comments on commit 0f18cb9

Please sign in to comment.