12345678910111213141516171819202122232425262728 |
- let EosHelper = {
- transfer: function (from, to, amount, memo, authority) {
- let action = 'transfer'
- let identity = { authorization: [`${from}@${authority}`] }
- if (self !== top) {
- return meeAction(action, [from, to, amount, memo, identity])
- } else {
- return window.EOS[action](from, to, amount, memo, identity)
- }
- },
- getCurrencyBalance: function (code, account, symbol = 'EOS') {
- let action = 'getCurrencyBalance'
- if (self !== top) {
- return meeAction(action, [code, account, symbol])
- } else {
- return window.EOS.getCurrencyBalance(code, account, symbol)
- }
- }
- }
- function meeAction (action, param, code) {
- return window.postMessager.send({
- action: 'meechat:eosAction',
- data: { code, action, param }
- })
- }
- export default EosHelper
|