Socket
Socket
Sign inDemoInstall

@starport/vuex

Package Overview
Dependencies
11
Maintainers
2
Versions
163
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.47 to 0.1.48-beta.0

19

.eslintrc.js
module.exports = {
root: true,
env: {
node: true
node: true,
browser: true,
es6: true
},
plugins: ['prettier'],
extends: [
'plugin:vue/vue3-essential',
'eslint:recommended',
'plugin:prettier/recommended',
'@vue/prettier'
"plugin:prettier/recommended",
],
parserOptions: {
parser: 'babel-eslint'
},
plugins: ['prettier'],
parser: 'babel-eslint',
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'vue/component-name-in-template-casing': ['error', 'PascalCase']
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
}
}

@@ -18,8 +18,2 @@ "use strict";

});
Object.defineProperty(exports, "starport", {
enumerable: true,
get: function get() {
return _starport["default"];
}
});
Object.defineProperty(exports, "transfers", {

@@ -66,4 +60,2 @@ enumerable: true,

var _starport = _interopRequireDefault(require("./modules/common/starport"));
var _transfers = _interopRequireDefault(require("./modules/common/transfers"));

@@ -70,0 +62,0 @@

@@ -48,3 +48,3 @@ "use strict";

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }

@@ -51,0 +51,0 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

@@ -14,2 +14,14 @@ "use strict";

function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

@@ -105,3 +117,3 @@

return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
var commit, rootGetters, _ref7$subscribe, subscribe, _ref7$all, all, key, params, value;
var commit, rootGetters, _ref7$subscribe, subscribe, _ref7$all, all, key, value, next_values, _i, _Object$keys, prop;

@@ -115,23 +127,35 @@ return regeneratorRuntime.wrap(function _callee2$(_context2) {

_context2.prev = 2;
params = Object.values(key);
_context2.next = 6;
_context2.next = 5;
return _axios["default"].get(rootGetters['common/env/apiCosmos'] + '/cosmos/tx/v1beta1/txs?events=' + key.event);
case 6:
case 5:
value = _context2.sent.data;
/*
while (all && value.pagination && value.pagination.next_key!=null) {
let next_values=(await (await initQueryClient(rootGetters)).queryPostAll.apply(null,[...params, {'pagination.key':value.pagination.next_key}] )).data;
for (let prop of Object.keys(next_values)) {
if (Array.isArray(next_values[prop])) {
value[prop]=[...value[prop], ...next_values[prop]]
}else{
value[prop]=next_values[prop]
}
}
console.log(value)
case 6:
if (!(all && value.pagination && value.pagination.next_key != null)) {
_context2.next = 14;
break;
}
*/
_context2.next = 9;
return _axios["default"].get(rootGetters['common/env/apiCosmos'] + '/cosmos/tx/v1beta1/txs?events=' + key.event + '&pagination.key=' + value.pagination.next_key).data;
case 9:
next_values = _context2.sent;
for (_i = 0, _Object$keys = Object.keys(next_values); _i < _Object$keys.length; _i++) {
prop = _Object$keys[_i];
if (Array.isArray(next_values[prop])) {
value[prop] = [].concat(_toConsumableArray(value[prop]), _toConsumableArray(next_values[prop]));
} else {
value[prop] = next_values[prop];
}
}
console.log(value);
_context2.next = 6;
break;
case 14:
commit('QUERY', {

@@ -146,11 +170,11 @@ query: 'GetTxsEvent',

});
_context2.next = 14;
_context2.next = 21;
break;
case 11:
_context2.prev = 11;
case 18:
_context2.prev = 18;
_context2.t0 = _context2["catch"](2);
console.error(new _SpVuexError["default"]('QueryClient:ServiceGetTxsEvent', 'API Node Unavailable. Could not perform query.'));
case 14:
case 21:
case "end":

@@ -160,3 +184,3 @@ return _context2.stop();

}
}, _callee2, null, [[2, 11]]);
}, _callee2, null, [[2, 18]]);
}))();

@@ -163,0 +187,0 @@ }

@@ -36,35 +36,13 @@ "use strict";

/* START TODO: Integrate closure below for additional security */
/* START TODO: Integrate closure below for additional security
function getDecryptor(password) {
var secret = password;
return /*#__PURE__*/function () {
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(encryptedMnemonic, HDpath) {
var mnemonic;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
mnemonic = _cryptoJs["default"].AES.decrypt(encryptedMnemonic, secret).toString(_cryptoJs["default"].enc.Utf8);
_context.next = 3;
return _protoSigning.DirectSecp256k1HdWallet.fromMnemonic(mnemonic, HDpath);
case 3:
return _context.abrupt("return", _context.sent);
case 4:
case "end":
return _context.stop();
}
}
}, _callee);
}));
return function (_x, _x2) {
return _ref.apply(this, arguments);
};
}();
let secret = password
return async function (encryptedMnemonic, HDpath) {
const mnemonic = CryptoJS.AES.decrypt(encryptedMnemonic, secret).toString(
CryptoJS.enc.Utf8
)
return await DirectSecp256k1HdWallet.fromMnemonic(mnemonic, HDpath)
}
}
/* END TODO */
END TODO */
var _default = {

@@ -203,5 +181,5 @@ namespaced: true,

},
ADD_MESSAGE_TYPE: function ADD_MESSAGE_TYPE(state, _ref2) {
var typeUrl = _ref2.typeUrl,
type = _ref2.type;
ADD_MESSAGE_TYPE: function ADD_MESSAGE_TYPE(state, _ref) {
var typeUrl = _ref.typeUrl,
type = _ref.type;
state.activeClient.registry.register(typeUrl, type);

@@ -217,16 +195,16 @@ },

actions: {
signOut: function signOut(_ref3) {
var commit = _ref3.commit;
signOut: function signOut(_ref2) {
var commit = _ref2.commit;
commit('SIGN_OUT');
},
connectWithKeplr: function connectWithKeplr(_ref4, accountSigner) {
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
connectWithKeplr: function connectWithKeplr(_ref3, accountSigner) {
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
var commit, dispatch, rootGetters, wallet, _yield$accountSigner$, _yield$accountSigner$2, account, client;
return regeneratorRuntime.wrap(function _callee2$(_context2) {
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context2.prev = _context2.next) {
switch (_context.prev = _context.next) {
case 0:
commit = _ref4.commit, dispatch = _ref4.dispatch, rootGetters = _ref4.rootGetters;
_context2.next = 3;
commit = _ref3.commit, dispatch = _ref3.dispatch, rootGetters = _ref3.rootGetters;
_context.next = 3;
return dispatch('common/env/signIn', accountSigner, {

@@ -246,7 +224,7 @@ root: true

};
_context2.next = 6;
_context.next = 6;
return accountSigner.getAccounts();
case 6:
_yield$accountSigner$ = _context2.sent;
_yield$accountSigner$ = _context.sent;
_yield$accountSigner$2 = _slicedToArray(_yield$accountSigner$, 1);

@@ -259,4 +237,4 @@ account = _yield$accountSigner$2[0];

commit('ADD_WALLET', wallet);
_context2.prev = 11;
_context2.next = 14;
_context.prev = 11;
_context.next = 14;
return dispatch('common/env/signIn', accountSigner, {

@@ -270,9 +248,9 @@ root: true

commit('SET_SELECTED_ADDRESS', account.address);
_context2.next = 22;
_context.next = 22;
break;
case 19:
_context2.prev = 19;
_context2.t0 = _context2["catch"](11);
console.log(_context2.t0);
_context.prev = 19;
_context.t0 = _context["catch"](11);
console.log(_context.t0);

@@ -284,18 +262,18 @@ case 22:

case "end":
return _context2.stop();
return _context.stop();
}
}
}, _callee2, null, [[11, 19]]);
}, _callee, null, [[11, 19]]);
}))();
},
unlockWallet: function unlockWallet(_ref5, _ref6) {
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
unlockWallet: function unlockWallet(_ref4, _ref5) {
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
var commit, state, dispatch, rootGetters, name, password, encryptedWallet, wallet, accountSigner, client, _yield$accountSigner$3, _yield$accountSigner$4, account;
return regeneratorRuntime.wrap(function _callee3$(_context3) {
return regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context3.prev = _context3.next) {
switch (_context2.prev = _context2.next) {
case 0:
commit = _ref5.commit, state = _ref5.state, dispatch = _ref5.dispatch, rootGetters = _ref5.rootGetters;
name = _ref6.name, password = _ref6.password;
commit = _ref4.commit, state = _ref4.state, dispatch = _ref4.dispatch, rootGetters = _ref4.rootGetters;
name = _ref5.name, password = _ref5.password;
encryptedWallet = state.wallets[state.wallets.findIndex(function (x) {

@@ -314,3 +292,3 @@ return x.name === name;

if (!(wallet.accounts.length > 0)) {
_context3.next = 29;
_context2.next = 29;
break;

@@ -320,3 +298,3 @@ }

if (!(wallet.name == 'Keplr Integration')) {
_context3.next = 10;
_context2.next = 10;
break;

@@ -326,15 +304,15 @@ }

accountSigner = window.getOfflineSigner(rootGetters['common/env/chainId']);
_context3.next = 13;
_context2.next = 13;
break;
case 10:
_context3.next = 12;
_context2.next = 12;
return _protoSigning.DirectSecp256k1HdWallet.fromMnemonic(wallet.mnemonic, (0, _crypto.stringToPath)(wallet.HDpath + wallet.accounts[0].pathIncrement), wallet.prefix);
case 12:
accountSigner = _context3.sent;
accountSigner = _context2.sent;
case 13:
_context3.prev = 13;
_context3.next = 16;
_context2.prev = 13;
_context2.next = 16;
return dispatch('common/env/signIn', accountSigner, {

@@ -347,34 +325,34 @@ root: true

commit('SET_ACTIVE_CLIENT', client);
_context3.next = 20;
_context2.next = 20;
return accountSigner.getAccounts();
case 20:
_yield$accountSigner$3 = _context3.sent;
_yield$accountSigner$3 = _context2.sent;
_yield$accountSigner$4 = _slicedToArray(_yield$accountSigner$3, 1);
account = _yield$accountSigner$4[0];
commit('SET_SELECTED_ADDRESS', account.address);
_context3.next = 29;
_context2.next = 29;
break;
case 26:
_context3.prev = 26;
_context3.t0 = _context3["catch"](13);
console.log(_context3.t0);
_context2.prev = 26;
_context2.t0 = _context2["catch"](13);
console.log(_context2.t0);
case 29:
case "end":
return _context3.stop();
return _context2.stop();
}
}
}, _callee3, null, [[13, 26]]);
}, _callee2, null, [[13, 26]]);
}))();
},
updateRelayers: function updateRelayers(_ref7, relayers) {
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
updateRelayers: function updateRelayers(_ref6, relayers) {
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
var commit, dispatch;
return regeneratorRuntime.wrap(function _callee4$(_context4) {
return regeneratorRuntime.wrap(function _callee3$(_context3) {
while (1) {
switch (_context4.prev = _context4.next) {
switch (_context3.prev = _context3.next) {
case 0:
commit = _ref7.commit, dispatch = _ref7.dispatch;
commit = _ref6.commit, dispatch = _ref6.dispatch;
commit('SET_RELAYERS', relayers);

@@ -385,27 +363,27 @@ dispatch('storeWallets');

case "end":
return _context4.stop();
return _context3.stop();
}
}
}, _callee4);
}, _callee3);
}))();
},
switchAccount: function switchAccount(_ref8, address) {
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
switchAccount: function switchAccount(_ref7, address) {
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
var commit, state, rootGetters, dispatch, accountIndex, accountSigner, client, _yield$accountSigner$5, _yield$accountSigner$6, account;
return regeneratorRuntime.wrap(function _callee5$(_context5) {
return regeneratorRuntime.wrap(function _callee4$(_context4) {
while (1) {
switch (_context5.prev = _context5.next) {
switch (_context4.prev = _context4.next) {
case 0:
commit = _ref8.commit, state = _ref8.state, rootGetters = _ref8.rootGetters, dispatch = _ref8.dispatch;
commit = _ref7.commit, state = _ref7.state, rootGetters = _ref7.rootGetters, dispatch = _ref7.dispatch;
accountIndex = state.activeWallet.accounts.findIndex(function (acc) {
return acc.address == address;
});
_context5.next = 4;
_context4.next = 4;
return _protoSigning.DirectSecp256k1HdWallet.fromMnemonic(state.activeWallet.mnemonic, (0, _crypto.stringToPath)(state.activeWallet.HDpath + state.activeWallet.accounts[accountIndex].pathIncrement), state.activeWallet.prefix);
case 4:
accountSigner = _context5.sent;
_context5.prev = 5;
_context5.next = 8;
accountSigner = _context4.sent;
_context4.prev = 5;
_context4.next = 8;
return dispatch('common/env/signIn', accountSigner, {

@@ -418,35 +396,35 @@ root: true

commit('SET_ACTIVE_CLIENT', client);
_context5.next = 12;
_context4.next = 12;
return accountSigner.getAccounts();
case 12:
_yield$accountSigner$5 = _context5.sent;
_yield$accountSigner$5 = _context4.sent;
_yield$accountSigner$6 = _slicedToArray(_yield$accountSigner$5, 1);
account = _yield$accountSigner$6[0];
commit('SET_SELECTED_ADDRESS', account.address);
_context5.next = 21;
_context4.next = 21;
break;
case 18:
_context5.prev = 18;
_context5.t0 = _context5["catch"](5);
console.log(_context5.t0);
_context4.prev = 18;
_context4.t0 = _context4["catch"](5);
console.log(_context4.t0);
case 21:
case "end":
return _context5.stop();
return _context4.stop();
}
}
}, _callee5, null, [[5, 18]]);
}, _callee4, null, [[5, 18]]);
}))();
},
addAccount: function addAccount(_ref9, pathIncrement) {
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() {
addAccount: function addAccount(_ref8, pathIncrement) {
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
var commit, state, dispatch, accountSigner, _yield$accountSigner$7, _yield$accountSigner$8, acc, account;
return regeneratorRuntime.wrap(function _callee6$(_context6) {
return regeneratorRuntime.wrap(function _callee5$(_context5) {
while (1) {
switch (_context6.prev = _context6.next) {
switch (_context5.prev = _context5.next) {
case 0:
commit = _ref9.commit, state = _ref9.state, dispatch = _ref9.dispatch;
commit = _ref8.commit, state = _ref8.state, dispatch = _ref8.dispatch;

@@ -458,12 +436,12 @@ if (!pathIncrement) {

_context6.next = 4;
_context5.next = 4;
return _protoSigning.DirectSecp256k1HdWallet.fromMnemonic(state.activeWallet.mnemonic, (0, _crypto.stringToPath)(state.activeWallet.HDpath + pathIncrement), state.activeWallet.prefix);
case 4:
accountSigner = _context6.sent;
_context6.next = 7;
accountSigner = _context5.sent;
_context5.next = 7;
return accountSigner.getAccounts();
case 7:
_yield$accountSigner$7 = _context6.sent;
_yield$accountSigner$7 = _context5.sent;
_yield$accountSigner$8 = _slicedToArray(_yield$accountSigner$7, 1);

@@ -479,3 +457,3 @@ acc = _yield$accountSigner$8[0];

}) == -1)) {
_context6.next = 16;
_context5.next = 16;
break;

@@ -486,3 +464,3 @@ }

dispatch('storeWallets');
_context6.next = 17;
_context5.next = 17;
break;

@@ -495,39 +473,39 @@

case "end":
return _context6.stop();
return _context5.stop();
}
}
}, _callee6);
}, _callee5);
}))();
},
storeWallets: function storeWallets(_ref10) {
var commit = _ref10.commit,
state = _ref10.state;
storeWallets: function storeWallets(_ref9) {
var commit = _ref9.commit,
state = _ref9.state;
window.localStorage.setItem('wallets', JSON.stringify(state.wallets));
commit('SET_BACKUP_STATE', false);
},
signInWithPrivateKey: function signInWithPrivateKey(_ref11, _ref12) {
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7() {
var commit, rootGetters, dispatch, _ref12$prefix, prefix, privKey, pKey, accountSigner, _yield$accountSigner$9, _yield$accountSigner$10, firstAccount, client;
signInWithPrivateKey: function signInWithPrivateKey(_ref10, _ref11) {
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() {
var commit, rootGetters, dispatch, _ref11$prefix, prefix, privKey, pKey, accountSigner, _yield$accountSigner$9, _yield$accountSigner$10, firstAccount, client;
return regeneratorRuntime.wrap(function _callee7$(_context7) {
return regeneratorRuntime.wrap(function _callee6$(_context6) {
while (1) {
switch (_context7.prev = _context7.next) {
switch (_context6.prev = _context6.next) {
case 0:
commit = _ref11.commit, rootGetters = _ref11.rootGetters, dispatch = _ref11.dispatch;
_ref12$prefix = _ref12.prefix, prefix = _ref12$prefix === void 0 ? 'cosmos' : _ref12$prefix, privKey = _ref12.privKey;
commit = _ref10.commit, rootGetters = _ref10.rootGetters, dispatch = _ref10.dispatch;
_ref11$prefix = _ref11.prefix, prefix = _ref11$prefix === void 0 ? 'cosmos' : _ref11$prefix, privKey = _ref11.privKey;
pKey = (0, _keys.keyFromWif)(privKey.trim());
_context7.next = 5;
_context6.next = 5;
return _protoSigning.DirectSecp256k1Wallet.fromKey(pKey, prefix);
case 5:
accountSigner = _context7.sent;
_context7.next = 8;
accountSigner = _context6.sent;
_context6.next = 8;
return accountSigner.getAccounts();
case 8:
_yield$accountSigner$9 = _context7.sent;
_yield$accountSigner$9 = _context6.sent;
_yield$accountSigner$10 = _slicedToArray(_yield$accountSigner$9, 1);
firstAccount = _yield$accountSigner$10[0];
_context7.prev = 11;
_context7.next = 14;
_context6.prev = 11;
_context6.next = 14;
return dispatch('common/env/signIn', accountSigner, {

@@ -541,28 +519,28 @@ root: true

commit('SET_SELECTED_ADDRESS', firstAccount.address);
_context7.next = 22;
_context6.next = 22;
break;
case 19:
_context7.prev = 19;
_context7.t0 = _context7["catch"](11);
console.log(_context7.t0);
_context6.prev = 19;
_context6.t0 = _context6["catch"](11);
console.log(_context6.t0);
case 22:
case "end":
return _context7.stop();
return _context6.stop();
}
}
}, _callee7, null, [[11, 19]]);
}, _callee6, null, [[11, 19]]);
}))();
},
restoreWallet: function restoreWallet(_ref13, _ref14) {
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8() {
restoreWallet: function restoreWallet(_ref12, _ref13) {
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7() {
var commit, dispatch, rootGetters, state, encrypted, password, wallet, newName, incr, accountSigner, _yield$accountSigner$11, _yield$accountSigner$12, firstAccount, client;
return regeneratorRuntime.wrap(function _callee8$(_context8) {
return regeneratorRuntime.wrap(function _callee7$(_context7) {
while (1) {
switch (_context8.prev = _context8.next) {
switch (_context7.prev = _context7.next) {
case 0:
commit = _ref13.commit, dispatch = _ref13.dispatch, rootGetters = _ref13.rootGetters, state = _ref13.state;
encrypted = _ref14.encrypted, password = _ref14.password;
commit = _ref12.commit, dispatch = _ref12.dispatch, rootGetters = _ref12.rootGetters, state = _ref12.state;
encrypted = _ref13.encrypted, password = _ref13.password;
wallet = JSON.parse(_cryptoJs["default"].AES.decrypt(encrypted, password).toString(_cryptoJs["default"].enc.Utf8));

@@ -580,17 +558,17 @@ newName = wallet.name;

wallet.name = newName;
_context8.next = 9;
_context7.next = 9;
return _protoSigning.DirectSecp256k1HdWallet.fromMnemonic(wallet.mnemonic, (0, _crypto.stringToPath)(wallet.HDpath + '0'), wallet.prefix);
case 9:
accountSigner = _context8.sent;
_context8.next = 12;
accountSigner = _context7.sent;
_context7.next = 12;
return accountSigner.getAccounts();
case 12:
_yield$accountSigner$11 = _context8.sent;
_yield$accountSigner$11 = _context7.sent;
_yield$accountSigner$12 = _slicedToArray(_yield$accountSigner$11, 1);
firstAccount = _yield$accountSigner$12[0];
commit('ADD_WALLET', wallet);
_context8.prev = 16;
_context8.next = 19;
_context7.prev = 16;
_context7.next = 19;
return dispatch('common/env/signIn', accountSigner, {

@@ -604,9 +582,9 @@ root: true

commit('SET_SELECTED_ADDRESS', firstAccount.address);
_context8.next = 27;
_context7.next = 27;
break;
case 24:
_context8.prev = 24;
_context8.t0 = _context8["catch"](16);
console.log(_context8.t0);
_context7.prev = 24;
_context7.t0 = _context7["catch"](16);
console.log(_context7.t0);

@@ -618,18 +596,18 @@ case 27:

case "end":
return _context8.stop();
return _context7.stop();
}
}
}, _callee8, null, [[16, 24]]);
}, _callee7, null, [[16, 24]]);
}))();
},
createWalletWithMnemonic: function createWalletWithMnemonic(_ref15, _ref16) {
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9() {
var commit, dispatch, rootGetters, _ref16$name, name, mnemonic, _ref16$HDpath, HDpath, _ref16$prefix, prefix, _ref16$password, password, wallet, accountSigner, _yield$accountSigner$13, _yield$accountSigner$14, firstAccount, account, client;
createWalletWithMnemonic: function createWalletWithMnemonic(_ref14, _ref15) {
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8() {
var commit, dispatch, rootGetters, _ref15$name, name, mnemonic, _ref15$HDpath, HDpath, _ref15$prefix, prefix, _ref15$password, password, wallet, accountSigner, _yield$accountSigner$13, _yield$accountSigner$14, firstAccount, account, client;
return regeneratorRuntime.wrap(function _callee9$(_context9) {
return regeneratorRuntime.wrap(function _callee8$(_context8) {
while (1) {
switch (_context9.prev = _context9.next) {
switch (_context8.prev = _context8.next) {
case 0:
commit = _ref15.commit, dispatch = _ref15.dispatch, rootGetters = _ref15.rootGetters;
_ref16$name = _ref16.name, name = _ref16$name === void 0 ? null : _ref16$name, mnemonic = _ref16.mnemonic, _ref16$HDpath = _ref16.HDpath, HDpath = _ref16$HDpath === void 0 ? "m/44'/118'/0'/0/" : _ref16$HDpath, _ref16$prefix = _ref16.prefix, prefix = _ref16$prefix === void 0 ? 'cosmos' : _ref16$prefix, _ref16$password = _ref16.password, password = _ref16$password === void 0 ? null : _ref16$password;
commit = _ref14.commit, dispatch = _ref14.dispatch, rootGetters = _ref14.rootGetters;
_ref15$name = _ref15.name, name = _ref15$name === void 0 ? null : _ref15$name, mnemonic = _ref15.mnemonic, _ref15$HDpath = _ref15.HDpath, HDpath = _ref15$HDpath === void 0 ? "m/44'/118'/0'/0/" : _ref15$HDpath, _ref15$prefix = _ref15.prefix, prefix = _ref15$prefix === void 0 ? 'cosmos' : _ref15$prefix, _ref15$password = _ref15.password, password = _ref15$password === void 0 ? null : _ref15$password;
wallet = {

@@ -644,12 +622,12 @@ name: name,

};
_context9.next = 5;
_context8.next = 5;
return _protoSigning.DirectSecp256k1HdWallet.fromMnemonic(mnemonic, (0, _crypto.stringToPath)(HDpath + '0'), prefix);
case 5:
accountSigner = _context9.sent;
_context9.next = 8;
accountSigner = _context8.sent;
_context8.next = 8;
return accountSigner.getAccounts();
case 8:
_yield$accountSigner$13 = _context9.sent;
_yield$accountSigner$13 = _context8.sent;
_yield$accountSigner$14 = _slicedToArray(_yield$accountSigner$13, 1);

@@ -663,4 +641,4 @@ firstAccount = _yield$accountSigner$14[0];

commit('ADD_WALLET', wallet);
_context9.prev = 14;
_context9.next = 17;
_context8.prev = 14;
_context8.next = 17;
return dispatch('common/env/signIn', accountSigner, {

@@ -674,9 +652,9 @@ root: true

commit('SET_SELECTED_ADDRESS', firstAccount.address);
_context9.next = 25;
_context8.next = 25;
break;
case 22:
_context9.prev = 22;
_context9.t0 = _context9["catch"](14);
console.log(_context9.t0);
_context8.prev = 22;
_context8.t0 = _context8["catch"](14);
console.log(_context8.t0);

@@ -688,17 +666,17 @@ case 25:

case "end":
return _context9.stop();
return _context8.stop();
}
}
}, _callee9, null, [[14, 22]]);
}, _callee8, null, [[14, 22]]);
}))();
},
sendTransaction: function sendTransaction(_ref17, _ref18) {
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10() {
sendTransaction: function sendTransaction(_ref16, _ref17) {
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9() {
var state, message, memo, denom, fee, result;
return regeneratorRuntime.wrap(function _callee10$(_context10) {
return regeneratorRuntime.wrap(function _callee9$(_context9) {
while (1) {
switch (_context10.prev = _context10.next) {
switch (_context9.prev = _context9.next) {
case 0:
state = _ref17.state;
message = _ref18.message, memo = _ref18.memo, denom = _ref18.denom;
state = _ref16.state;
message = _ref17.message, memo = _ref17.memo, denom = _ref17.denom;
fee = {

@@ -711,3 +689,3 @@ amount: [{

};
_context10.prev = 3;
_context9.prev = 3;
console.log({

@@ -719,23 +697,23 @@ add: state.selectedAddress,

});
_context10.next = 7;
_context9.next = 7;
return state.activeClient.signAndBroadcast(state.selectedAddress, [message], fee, memo);
case 7:
result = _context10.sent;
result = _context9.sent;
(0, _stargate.assertIsBroadcastTxSuccess)(result);
_context10.next = 15;
_context9.next = 15;
break;
case 11:
_context10.prev = 11;
_context10.t0 = _context10["catch"](3);
console.log(_context10.t0);
throw 'Failed to broadcast transaction.' + _context10.t0;
_context9.prev = 11;
_context9.t0 = _context9["catch"](3);
console.log(_context9.t0);
throw 'Failed to broadcast transaction.' + _context9.t0;
case 15:
case "end":
return _context10.stop();
return _context9.stop();
}
}
}, _callee10, null, [[3, 11]]);
}, _callee9, null, [[3, 11]]);
}))();

@@ -742,0 +720,0 @@ }

{
"name": "@starport/vuex",
"version": "0.1.47",
"version": "0.1.48-beta.0+842aa9f",
"description": "A library of Vuex 4 (for Vue 3) standard store modules for state management of cosmos-sdk chains' frontends",

@@ -20,23 +20,30 @@ "author": "Tendermint, Inc <hello@tendermint.com>",

"build": "babel src --out-dir lib --source-maps",
"lint": "eslint 'src/**/*.js'",
"test": "echo \"Error: run tests from root\" && exit 1"
},
"dependencies": {
"@confio/relayer": "0.1.2",
"@cosmjs/crypto": "0.25.0-alpha.2",
"@cosmjs/launchpad": "0.25.0-alpha.2",
"@cosmjs/proto-signing": "0.25.0-alpha.2",
"@cosmjs/stargate": "0.25.0-alpha.2",
"@cosmjs/tendermint-rpc": "0.25.0-alpha.2",
"@cosmjs/utils": "0.25.0-alpha.2",
"@starport/client-js": "^0.1.47",
"axios": "0.21.1",
"bs58": "4.0.1",
"crypto-js": "4.0.0"
"@confio/relayer": "^0.1.3",
"@cosmjs/amino": "^0.25.0-alpha.3",
"@cosmjs/crypto": "^0.25.0-alpha.3",
"@cosmjs/launchpad": "^0.25.0-alpha.3",
"@cosmjs/proto-signing": "^0.25.0-alpha.3",
"@cosmjs/stargate": "^0.25.0-alpha.3",
"@cosmjs/tendermint-rpc": "^0.25.0-alpha.3",
"@cosmjs/utils": "^0.25.0-alpha.3",
"@starport/client-js": "^0.1.48-beta.0+842aa9f",
"axios": "^0.21.1",
"bs58": "^4.0.1",
"crypto-js": "^4.0.0"
},
"devDependencies": {
"@babel/cli": "7.13.10",
"@babel/core": "7.13.10",
"@babel/preset-env": "7.13.10"
"@babel/cli": "^7.13.16",
"@babel/core": "^7.14.0",
"@babel/preset-env": "^7.14.1",
"babel-eslint": "^10.1.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-prettier": "^3.4.0",
"prettier": "^2.2.1"
},
"gitHead": "ca731429d0417bd03755e707f6d103d2c8866d75"
"gitHead": "842aa9f3a6f55ba68783f7bc84697304f7adf659"
}

@@ -11,6 +11,3 @@ import { encode, decode } from 'bs58'

const words = CryptoJS.lib.WordArray.create(versionedkey)
const checksum = Buffer.from(
CryptoJS.SHA256(CryptoJS.SHA256(words)).toString().substr(0, 8),
'hex'
)
const checksum = Buffer.from(CryptoJS.SHA256(CryptoJS.SHA256(words)).toString().substr(0, 8), 'hex')
const wif = new Uint8Array(37)

@@ -17,0 +14,0 @@ wif.set(versionedkey, 0)

import blocks from './modules/common/blocks'
import env from './modules/common/env'
import starport from './modules/common/starport'
import transfers from './modules/common/transfers'

@@ -9,3 +8,2 @@ import wallet from './modules/common/wallet'

import { keyFromWif, keyToWif } from './helpers/keys'
export { blocks,env,starport,wallet, keyFromWif, transfers, keyToWif, relayers, SpVuexError}
export { blocks, env, wallet, keyFromWif, transfers, keyToWif, relayers, SpVuexError }

@@ -16,3 +16,3 @@ import axios from 'axios'

code = 0,
log = null
log = null,
}) {

@@ -23,7 +23,7 @@ return {

messages,
memo
memo,
},
auth_info: {
signer_infos,
fee
fee,
},

@@ -35,4 +35,4 @@ meta: {

code,
log
}
log,
},
}

@@ -44,8 +44,4 @@ }

try {
const rpcRes = await axios.get(
apiTendermint + '/tx?hash=0x' + toHex(txHash)
)
const apiRes = await axios.get(
apiCosmos + '/cosmos/tx/v1beta1/txs/' + toHex(txHash)
)
const rpcRes = await axios.get(apiTendermint + '/tx?hash=0x' + toHex(txHash))
const apiRes = await axios.get(apiCosmos + '/cosmos/tx/v1beta1/txs/' + toHex(txHash))
return { rpcRes, apiRes, txHash: toHex(txHash).toUpperCase() }

@@ -74,3 +70,3 @@ } catch (e) {

code,
log
log,
})

@@ -84,3 +80,3 @@ }

blocks: [],
size: 20
size: 20,
}

@@ -90,9 +86,7 @@ },

getBlocks: (state) => (howmany) => {
return [...state.blocks]
.sort((a, b) => b.height - a.height)
.slice(0, howmany)
return [...state.blocks].sort((a, b) => b.height - a.height).slice(0, howmany)
},
getBlockByHeight: (state) => (height) => {
return state.blocks.find((x) => x.height == height) || {}
}
},
},

@@ -111,3 +105,3 @@ mutations: {

state.size = size
}
},
},

@@ -125,16 +119,8 @@ actions: {

const blockDetails = await axios.get(
rootGetters['common/env/apiTendermint'] +
'/block?height=' +
blockData.data.value.block.header.height
rootGetters['common/env/apiTendermint'] + '/block?height=' + blockData.data.value.block.header.height,
)
const txDecoded = blockData.data.value.block.data.txs.map(
async (tx) => {
const dec = await decodeTx(
rootGetters['common/env/apiCosmos'],
rootGetters['common/env/apiTendermint'],
tx
)
return dec
}
)
const txDecoded = blockData.data.value.block.data.txs.map(async (tx) => {
const dec = await decodeTx(rootGetters['common/env/apiCosmos'], rootGetters['common/env/apiTendermint'], tx)
return dec
})
const txs = await Promise.all(txDecoded)

@@ -147,3 +133,3 @@

details: blockData.data.value.block,
txDecoded: txs
txDecoded: txs,
}

@@ -153,6 +139,3 @@

} catch (e) {
throw new SpVuexError(
'Blocks:AddBlock',
'Could not add block. RPC node unavailable'
)
throw new SpVuexError('Blocks:AddBlock', 'Could not add block. RPC node unavailable')
}

@@ -162,4 +145,4 @@ },

commit('RESET_STATE')
}
}
},
},
}

@@ -8,3 +8,3 @@ import blocks from './blocks.js'

store.registerModule(['common', 'blocks'], blocks)
store.subscribe(mutation => {
store.subscribe((mutation) => {
if (mutation.type == 'common/env/INITIALIZE_WS_COMPLETE') {

@@ -11,0 +11,0 @@ store.dispatch('common/blocks/init', null, { root: true })

@@ -5,12 +5,9 @@ import Client from '@starport/client-js'

const apiNode =
(process.env.VUE_APP_API_COSMOS &&
process.env.VUE_APP_API_COSMOS.replace('0.0.0.0', 'localhost')) ||
(process.env.VUE_APP_API_COSMOS && process.env.VUE_APP_API_COSMOS.replace('0.0.0.0', 'localhost')) ||
'http://localhost:1317'
const rpcNode =
(process.env.VUE_APP_API_TENDERMINT &&
process.env.VUE_APP_API_TENDERMINT.replace('0.0.0.0', 'localhost')) ||
(process.env.VUE_APP_API_TENDERMINT && process.env.VUE_APP_API_TENDERMINT.replace('0.0.0.0', 'localhost')) ||
'http://localhost:26657'
const wsNode =
(process.env.VUE_APP_WS_TENDERMINT &&
process.env.VUE_APP_WS_TENDERMINT.replace('0.0.0.0', 'localhost')) ||
(process.env.VUE_APP_WS_TENDERMINT && process.env.VUE_APP_WS_TENDERMINT.replace('0.0.0.0', 'localhost')) ||
'ws://localhost:26657/websocket'

@@ -35,3 +32,3 @@ const addrPrefix = process.env.VUE_APP_ADDRESS_PREFIX || 'cosmos'

getTXApi: '',
initialized: false
initialized: false,
}

@@ -51,3 +48,3 @@ },

rpcConnected: (state) => state.rpcConnected,
wsConnected: (state) => state.wsConnected
wsConnected: (state) => state.wsConnected,
},

@@ -99,3 +96,3 @@ mutations: {

state.getTXApi = txapi
}
},
},

@@ -114,4 +111,4 @@ actions: {

sdkVersion: 'Stargate',
getTXApi: rpcNode + '/tx?hash=0x'
}
getTXApi: rpcNode + '/tx?hash=0x',
},
) {

@@ -145,6 +142,3 @@ try {

} catch (e) {
throw new SpVuexError(
'Env:Client:Wallet',
'Could not create signing client with signer: ' + signer
)
throw new SpVuexError('Env:Client:Wallet', 'Could not create signing client with signer: ' + signer)
}

@@ -162,4 +156,4 @@ },

sdkVersion: 'Stargate',
getTXApi: 'http://localhost:26657/tx?hash=0x'
}
getTXApi: 'http://localhost:26657/tx?hash=0x',
},
) {

@@ -172,3 +166,3 @@ try {

rpcAddr: config.rpcNode,
wsAddr: config.wsNode
wsAddr: config.wsNode,
})

@@ -186,11 +180,5 @@ client.setMaxListeners(0)

})
client.on('ws-status', (status) =>
dispatch('setConnectivity', { connection: 'ws', status: status })
)
client.on('api-status', (status) =>
dispatch('setConnectivity', { connection: 'api', status: status })
)
client.on('rpc-status', (status) =>
dispatch('setConnectivity', { connection: 'rpc', status: status })
)
client.on('ws-status', (status) => dispatch('setConnectivity', { connection: 'ws', status: status }))
client.on('api-status', (status) => dispatch('setConnectivity', { connection: 'api', status: status }))
client.on('rpc-status', (status) => dispatch('setConnectivity', { connection: 'rpc', status: status }))
commit('SET_CONFIG', config)

@@ -202,5 +190,5 @@ await dispatch(

params: {},
query: null
query: null,
},
{ root: true }
{ root: true },
)

@@ -212,5 +200,5 @@ await dispatch(

params: {},
query: null
query: null,
},
{ root: true }
{ root: true },
)

@@ -239,6 +227,3 @@ commit('CONNECT', { client })

} catch (e) {
throw new SpVuexError(
'Env:Client:Websocket',
'Could not switch to websocket node:' + config.wsNode
)
throw new SpVuexError('Env:Client:Websocket', 'Could not switch to websocket node:' + config.wsNode)
}

@@ -255,3 +240,3 @@ }

'Env:Client:TendermintRPC',
'Could not switch to Tendermint RPC node:' + config.rpcNode
'Could not switch to Tendermint RPC node:' + config.rpcNode,
)

@@ -264,4 +249,4 @@ }

}
}
}
},
},
}

@@ -5,5 +5,5 @@ import env from './env.js'

if (!store.hasModule(['common'])) {
store.registerModule([ 'common'], { namespaced: true })
store.registerModule(['common'], { namespaced: true })
}
store.registerModule([ 'common', 'env'], env)
store.registerModule(['common', 'env'], env)
}

@@ -8,3 +8,3 @@ import relayers from './relayers.js'

store.registerModule(['common', 'relayers'], relayers)
store.subscribe(mutation => {
store.subscribe((mutation) => {
if (mutation.type == 'common/wallet/SET_SELECTED_ADDRESS') {

@@ -11,0 +11,0 @@ store.dispatch('common/relayers/init', null, { root: true })

@@ -19,6 +19,3 @@ import { SigningStargateClient } from '@cosmjs/stargate'

let error = JSON.parse(e.message)
if (
error.code == -32603 &&
error.data == 'timed out waiting for tx to be included in a block'
) {
if (error.code == -32603 && error.data == 'timed out waiting for tx to be included in a block') {
let txHash = sha256(tx)

@@ -30,3 +27,3 @@ let i = 0

hash: txHash,
prove: true
prove: true,
})

@@ -36,3 +33,3 @@ return {

code: res.result.code,
rawLog: res.result.log
rawLog: res.result.log,
}

@@ -39,0 +36,0 @@ } catch (e) {

@@ -18,13 +18,10 @@ import StarportSigningClient from './libs/starportSigningClient'

MsgRecvPacket,
MsgTimeout
MsgTimeout,
} from '@confio/relayer/build/codec/ibc/core/channel/v1/tx'
import { MsgCreateClient, MsgUpdateClient } from '@confio/relayer/build/codec/ibc/core/client/v1/tx'
import {
MsgCreateClient,
MsgUpdateClient
} from '@confio/relayer/build/codec/ibc/core/client/v1/tx'
import {
MsgConnectionOpenAck,
MsgConnectionOpenConfirm,
MsgConnectionOpenInit,
MsgConnectionOpenTry
MsgConnectionOpenTry,
} from '@confio/relayer/build/codec/ibc/core/connection/v1/tx'

@@ -40,6 +37,3 @@

['/ibc.core.connection.v1.MsgConnectionOpenAck', MsgConnectionOpenAck],
[
'/ibc.core.connection.v1.MsgConnectionOpenConfirm',
MsgConnectionOpenConfirm
],
['/ibc.core.connection.v1.MsgConnectionOpenConfirm', MsgConnectionOpenConfirm],
['/ibc.core.channel.v1.MsgChannelOpenInit', MsgChannelOpenInit],

@@ -52,3 +46,3 @@ ['/ibc.core.channel.v1.MsgChannelOpenTry', MsgChannelOpenTry],

['/ibc.core.channel.v1.MsgTimeout', MsgTimeout],
['/ibc.applications.transfer.v1.MsgTransfer', MsgTransfer]
['/ibc.applications.transfer.v1.MsgTransfer', MsgTransfer],
])

@@ -60,5 +54,5 @@ }

transientLog: {
msg: ''
msg: '',
},
relayerLinks: {}
relayerLinks: {},
}

@@ -80,16 +74,8 @@ }

chainFromChannel: (state) => (channel) => {
return (
state.relayers.find(
(x) => x.status == 'connected' && x.src.channelId == channel
)?.chainIdB ?? channel
)
return state.relayers.find((x) => x.status == 'connected' && x.src.channelId == channel)?.chainIdB ?? channel
},
chainToChannel: (state) => (channel) => {
return (
state.relayers.find(
(x) => x.status == 'connected' && x.dest.channelId == channel
)?.chainIdB ?? channel
)
return state.relayers.find((x) => x.status == 'connected' && x.dest.channelId == channel)?.chainIdB ?? channel
},
log: (state) => state.transientLog.msg
log: (state) => state.transientLog.msg,
},

@@ -112,3 +98,3 @@ mutations: {

...linkDetails,
status: 'connected'
status: 'connected',
}

@@ -119,3 +105,3 @@ } else {

...linkDetails,
status: 'linked'
status: 'linked',
}

@@ -130,3 +116,3 @@ }

...channelDetails,
status: 'connected'
status: 'connected',
}

@@ -145,3 +131,3 @@ },

state.relayers.find((x) => x.name == name).heights = heights
}
},
},

@@ -161,3 +147,3 @@ actions: {

{ commit, rootGetters, getters, dispatch },
{ name, prefix, endpoint, gasPrice, chainId, channelId, external }
{ name, prefix, endpoint, gasPrice, chainId, channelId, external },
) {

@@ -174,3 +160,3 @@ let relayer

heights: {},
running: false
running: false,
}

@@ -184,4 +170,4 @@ } else {

src: {
channelId: channelId
}
channelId: channelId,
},
}

@@ -193,3 +179,3 @@ }

stringToPath(rootGetters['common/wallet/getPath']),
rootGetters['common/env/addrPrefix']
rootGetters['common/env/addrPrefix'],
)

@@ -199,4 +185,4 @@ const signerB = await DirectSecp256k1HdWallet.fromMnemonic(

stringToPath(rootGetters['common/wallet/getPath']),
relayer.prefix
)
relayer.prefix,
)
const [accountB] = await signerB.getAccounts()

@@ -206,12 +192,6 @@ const optionsA = {

gasPrice: GasPrice.fromString(rootGetters['common/wallet/gasPrice']),
registry: ibcRegistry()
registry: ibcRegistry(),
}
const tmClientA = await Tendermint34Client.connect(
rootGetters['common/env/apiTendermint']
)
const signingClientA = new StarportSigningClient(
tmClientA,
signerA,
optionsA
)
const tmClientA = await Tendermint34Client.connect(rootGetters['common/env/apiTendermint'])
const signingClientA = new StarportSigningClient(tmClientA, signerA, optionsA)
relayer.chainIdA = await signingClientA.getChainId()

@@ -221,10 +201,6 @@ const optionsB = {

gasPrice: GasPrice.fromString(relayer.gasPrice),
registry: ibcRegistry()
registry: ibcRegistry(),
}
const tmClientB = await Tendermint34Client.connect(relayer.endpoint)
const signingClientB = new StarportSigningClient(
tmClientB,
signerB,
optionsB
)
const signingClientB = new StarportSigningClient(tmClientB, signerB, optionsB)
relayer.chainIdB = await signingClientB.getChainId()

@@ -235,3 +211,3 @@ relayer.targetAddress = accountB.address

dispatch('common/wallet/updateRelayers', getters['getRelayers'], {
root: true
root: true,
})

@@ -242,6 +218,3 @@ },

if (relayer.status !== 'linked' && relayer.status !== 'connected') {
throw new SpVuexError(
'relayers:connectRelayer',
'Relayer already connected.'
)
throw new SpVuexError('relayers:connectRelayer', 'Relayer already connected.')
}

@@ -252,3 +225,3 @@ try {

stringToPath(rootGetters['common/wallet/getPath']),
rootGetters['common/env/addrPrefix']
rootGetters['common/env/addrPrefix'],
)

@@ -258,3 +231,3 @@ const signerB = await DirectSecp256k1HdWallet.fromMnemonic(

stringToPath(rootGetters['common/wallet/getPath']),
relayer.prefix
relayer.prefix,
)

@@ -281,3 +254,3 @@ const [accountA] = await signerA.getAccounts()

//commit('SET_LOG_MSG',msg)
}
},
}

@@ -288,12 +261,6 @@ const optionsA = {

gasPrice: GasPrice.fromString(rootGetters['common/wallet/gasPrice']),
registry: ibcRegistry()
registry: ibcRegistry(),
}
const tmClientA = await Tendermint34Client.connect(
rootGetters['common/env/apiTendermint']
)
const signingClientA = new StarportSigningClient(
tmClientA,
signerA,
optionsA
)
const tmClientA = await Tendermint34Client.connect(rootGetters['common/env/apiTendermint'])
const signingClientA = new StarportSigningClient(tmClientA, signerA, optionsA)
const chainIdA = await signingClientA.getChainId()

@@ -304,26 +271,10 @@ const optionsB = {

gasPrice: GasPrice.fromString(relayer.gasPrice),
registry: ibcRegistry()
registry: ibcRegistry(),
}
const tmClientB = await Tendermint34Client.connect(relayer.endpoint)
const signingClientB = new StarportSigningClient(
tmClientB,
signerB,
optionsB
)
const signingClientB = new StarportSigningClient(tmClientB, signerB, optionsB)
const chainIdB = await signingClientB.getChainId()
let clientA = new IbcClient(
signingClientA,
tmClientA,
accountA.address,
chainIdA,
optionsA
)
let clientB = new IbcClient(
signingClientB,
tmClientB,
accountB.address,
chainIdB,
optionsB
)
let clientA = new IbcClient(signingClientA, tmClientA, accountA.address, chainIdA, optionsA)
let clientB = new IbcClient(signingClientB, tmClientB, accountB.address, chainIdB, optionsB)
const link = await Link.createWithExistingConnections(

@@ -333,3 +284,3 @@ clientA,

relayer.endA.connectionID,
relayer.endB.connectionID
relayer.endB.connectionID,
)

@@ -343,12 +294,12 @@ const linkData = {

clientID: link.endA.clientID,
connectionID: link.endA.connectionID
connectionID: link.endA.connectionID,
},
endB: {
clientID: link.endB.clientID,
connectionID: link.endB.connectionID
}
connectionID: link.endB.connectionID,
},
}
commit('LINK_RELAYER', linkData)
dispatch('common/wallet/updateRelayers', getters['getRelayers'], {
root: true
root: true,
})

@@ -369,6 +320,3 @@ if (relayer.status != 'connected') {

if (relayer.status !== 'created') {
throw new SpVuexError(
'relayers:connectRelayer',
'Relayer already connected.'
)
throw new SpVuexError('relayers:connectRelayer', 'Relayer already connected.')
}

@@ -379,3 +327,3 @@ try {

stringToPath(rootGetters['common/wallet/getPath']),
rootGetters['common/env/addrPrefix']
rootGetters['common/env/addrPrefix'],
)

@@ -385,3 +333,3 @@ const signerB = await DirectSecp256k1HdWallet.fromMnemonic(

stringToPath(rootGetters['common/wallet/getPath']),
relayer.prefix
relayer.prefix,
)

@@ -408,3 +356,3 @@ const [accountA] = await signerA.getAccounts()

//commit('SET_LOG_MSG',msg)
}
},
}

@@ -415,12 +363,6 @@ const optionsA = {

gasPrice: GasPrice.fromString(rootGetters['common/wallet/gasPrice']),
registry: ibcRegistry()
registry: ibcRegistry(),
}
const tmClientA = await Tendermint34Client.connect(
rootGetters['common/env/apiTendermint']
)
const signingClientA = new StarportSigningClient(
tmClientA,
signerA,
optionsA
)
const tmClientA = await Tendermint34Client.connect(rootGetters['common/env/apiTendermint'])
const signingClientA = new StarportSigningClient(tmClientA, signerA, optionsA)
const chainIdA = await signingClientA.getChainId()

@@ -431,26 +373,10 @@ const optionsB = {

gasPrice: GasPrice.fromString(relayer.gasPrice),
registry: ibcRegistry()
registry: ibcRegistry(),
}
const tmClientB = await Tendermint34Client.connect(relayer.endpoint)
const signingClientB = new StarportSigningClient(
tmClientB,
signerB,
optionsB
)
const signingClientB = new StarportSigningClient(tmClientB, signerB, optionsB)
const chainIdB = await signingClientB.getChainId()
let clientA = new IbcClient(
signingClientA,
tmClientA,
accountA.address,
chainIdA,
optionsA
)
let clientB = new IbcClient(
signingClientB,
tmClientB,
accountB.address,
chainIdB,
optionsB
)
let clientA = new IbcClient(signingClientA, tmClientA, accountA.address, chainIdA, optionsA)
let clientB = new IbcClient(signingClientB, tmClientB, accountB.address, chainIdB, optionsB)
const link = await Link.createWithNewConnections(clientA, clientB)

@@ -464,12 +390,12 @@ const linkData = {

clientID: link.endA.clientID,
connectionID: link.endA.connectionID
connectionID: link.endA.connectionID,
},
endB: {
clientID: link.endB.clientID,
connectionID: link.endB.connectionID
}
connectionID: link.endB.connectionID,
},
}
commit('LINK_RELAYER', linkData)
dispatch('common/wallet/updateRelayers', getters['getRelayers'], {
root: true
root: true,
})

@@ -483,16 +409,10 @@ await dispatch('connectRelayer', name)

const relayerLink = getters['getRelayerLink'](name)
const channels = await relayerLink.createChannel(
'A',
'transfer',
'transfer',
1,
'ics20-1'
)
const channels = await relayerLink.createChannel('A', 'transfer', 'transfer', 1, 'ics20-1')
const channelData = {
name,
...channels
...channels,
}
commit('CONNECT_RELAYER', channelData)
dispatch('common/wallet/updateRelayers', getters['getRelayers'], {
root: true
root: true,
})

@@ -505,3 +425,3 @@ dispatch('runRelayer', name)

dispatch('common/wallet/updateRelayers', getters['getRelayers'], {
root: true
root: true,
})

@@ -511,3 +431,3 @@ dispatch('relayerLoop', {

link: relayerLink,
options: { poll: 1, maxAgeDest: 86400, maxAgeSrc: 86400 }
options: { poll: 1, maxAgeDest: 86400, maxAgeSrc: 86400 },
})

@@ -527,3 +447,3 @@ },

dispatch('common/wallet/updateRelayers', getters['getRelayers'], {
root: true
root: true,
})

@@ -537,4 +457,4 @@ await link.updateClientIfStale('A', options.maxAgeDest)

}
}
}
},
},
}

@@ -8,3 +8,3 @@ import transfers from './transfers.js'

store.registerModule(['common', 'transfers'], transfers)
store.subscribe(mutation => {
store.subscribe((mutation) => {
if (mutation.type == 'common/env/INITIALIZE_WS_COMPLETE') {

@@ -11,0 +11,0 @@ store.dispatch('common/transfers/init', null, { root: true })

import axios from 'axios'
import SpVuexError from '../../../errors/SpVuexError';
import SpVuexError from '../../../errors/SpVuexError'
const getDefaultState = () => {
return {
GetTxsEvent: {},
_Subscriptions: new Set(),
};
};
return {
GetTxsEvent: {},
_Subscriptions: new Set(),
}
}
// initial state
const state = getDefaultState();
const state = getDefaultState()
export default {
namespaced: true,
state,
mutations: {
RESET_STATE(state) {
Object.assign(state, getDefaultState());
},
QUERY(state, { query, key, value }) {
state[query][JSON.stringify(key)] = value;
},
SUBSCRIBE(state, subscription) {
state._Subscriptions.add(subscription);
},
UNSUBSCRIBE(state, subscription) {
state._Subscriptions.delete(subscription);
}
},
getters: {
getGetTxsEvent: (state) => (params = {}) => {
return state.GetTxsEvent[JSON.stringify(params)] ?? {}
}
},
actions: {
init({ dispatch, rootGetters }) {
console.log('Vuex nodule: common.transfers initialized!')
if (rootGetters['common/env/client']) {
rootGetters['common/env/client'].on('newblock', () => {
dispatch('StoreUpdate');
});
}
},
resetState({ commit }) {
commit('RESET_STATE');
},
unsubscribe({ commit }, subscription) {
commit('UNSUBSCRIBE', subscription);
},
async StoreUpdate({ state, dispatch }) {
state._Subscriptions.forEach((subscription) => {
dispatch(subscription.action, subscription.payload);
});
},
async ServiceGetTxsEvent({ commit, rootGetters }, { subscribe = false, all=true, ...key }) {
try {
let params=Object.values(key)
let value = (await axios.get(rootGetters['common/env/apiCosmos'] + '/cosmos/tx/v1beta1/txs?events='+key.event)).data;
/*
while (all && value.pagination && value.pagination.next_key!=null) {
let next_values=(await (await initQueryClient(rootGetters)).queryPostAll.apply(null,[...params, {'pagination.key':value.pagination.next_key}] )).data;
for (let prop of Object.keys(next_values)) {
if (Array.isArray(next_values[prop])) {
value[prop]=[...value[prop], ...next_values[prop]]
}else{
value[prop]=next_values[prop]
}
}
console.log(value)
}
*/
commit('QUERY', { query: 'GetTxsEvent', key, value });
if (subscribe)
commit('SUBSCRIBE', { action: 'ServiceGetTxsEvent', payload: key });
}
catch (e) {
console.error(new SpVuexError('QueryClient:ServiceGetTxsEvent', 'API Node Unavailable. Could not perform query.'));
}
},
}
};
namespaced: true,
state,
mutations: {
RESET_STATE(state) {
Object.assign(state, getDefaultState())
},
QUERY(state, { query, key, value }) {
state[query][JSON.stringify(key)] = value
},
SUBSCRIBE(state, subscription) {
state._Subscriptions.add(subscription)
},
UNSUBSCRIBE(state, subscription) {
state._Subscriptions.delete(subscription)
},
},
getters: {
getGetTxsEvent: (state) => (params = {}) => {
return state.GetTxsEvent[JSON.stringify(params)] ?? {}
},
},
actions: {
init({ dispatch, rootGetters }) {
console.log('Vuex nodule: common.transfers initialized!')
if (rootGetters['common/env/client']) {
rootGetters['common/env/client'].on('newblock', () => {
dispatch('StoreUpdate')
})
}
},
resetState({ commit }) {
commit('RESET_STATE')
},
unsubscribe({ commit }, subscription) {
commit('UNSUBSCRIBE', subscription)
},
async StoreUpdate({ state, dispatch }) {
state._Subscriptions.forEach((subscription) => {
dispatch(subscription.action, subscription.payload)
})
},
async ServiceGetTxsEvent({ commit, rootGetters }, { subscribe = false, all = true, ...key }) {
try {
let value = (
await axios.get(rootGetters['common/env/apiCosmos'] + '/cosmos/tx/v1beta1/txs?events=' + key.event)
).data
while (all && value.pagination && value.pagination.next_key != null) {
let next_values = await axios.get(
rootGetters['common/env/apiCosmos'] +
'/cosmos/tx/v1beta1/txs?events=' +
key.event +
'&pagination.key=' +
value.pagination.next_key,
).data
for (let prop of Object.keys(next_values)) {
if (Array.isArray(next_values[prop])) {
value[prop] = [...value[prop], ...next_values[prop]]
} else {
value[prop] = next_values[prop]
}
}
console.log(value)
}
commit('QUERY', { query: 'GetTxsEvent', key, value })
if (subscribe) commit('SUBSCRIBE', { action: 'ServiceGetTxsEvent', payload: key })
} catch (e) {
console.error(
new SpVuexError('QueryClient:ServiceGetTxsEvent', 'API Node Unavailable. Could not perform query.'),
)
}
},
},
}

@@ -1,5 +0,2 @@

import {
DirectSecp256k1HdWallet,
DirectSecp256k1Wallet
} from '@cosmjs/proto-signing'
import { DirectSecp256k1HdWallet, DirectSecp256k1Wallet } from '@cosmjs/proto-signing'

@@ -11,3 +8,3 @@ import { assertIsBroadcastTxSuccess } from '@cosmjs/stargate'

/* START TODO: Integrate closure below for additional security */
/* START TODO: Integrate closure below for additional security
function getDecryptor(password) {

@@ -22,3 +19,3 @@ let secret = password

}
/* END TODO */
END TODO */
export default {

@@ -33,3 +30,3 @@ namespaced: true,

authorized: false,
gasPrice: '0.0000025token'
gasPrice: '0.0000025token',
}

@@ -45,11 +42,5 @@ },

state.activeWallet?.HDpath +
state.activeWallet?.accounts.find(
(x) => x.address == state.selectedAddress
).pathIncrement,
state.activeWallet?.accounts.find((x) => x.address == state.selectedAddress).pathIncrement,
relayers: (state) => {
return (
state.activeWallet?.accounts.find(
(x) => x.address == state.selectedAddress
).relayers ?? []
)
return state.activeWallet?.accounts.find((x) => x.address == state.selectedAddress).relayers ?? []
},

@@ -74,4 +65,3 @@ nameAvailable: (state) => (name) => {

},
walletName: (state) =>
state.activeWallet ? state.activeWallet.name : null,
walletName: (state) => (state.activeWallet ? state.activeWallet.name : null),
privKey: (state) => {

@@ -83,3 +73,3 @@ if (state.activeClient) {

}
}
},
},

@@ -101,15 +91,9 @@ mutations: {

name: state.activeWallet.name,
wallet: CryptoJS.AES.encrypt(
JSON.stringify(state.activeWallet),
state.activeWallet.password
).toString()
wallet: CryptoJS.AES.encrypt(JSON.stringify(state.activeWallet), state.activeWallet.password).toString(),
})
}
if (
state.activeWallet.name == 'Keplr Integration' &&
!state.activeWallet.password
) {
if (state.activeWallet.name == 'Keplr Integration' && !state.activeWallet.password) {
state.wallets.push({
name: state.activeWallet.name,
wallet: JSON.stringify(state.activeWallet)
wallet: JSON.stringify(state.activeWallet),
})

@@ -124,7 +108,5 @@ }

if (state.activeWallet.name && state.activeWallet.password) {
state.wallets[
state.wallets.findIndex((x) => x.name === state.activeWallet.name)
].wallet = CryptoJS.AES.encrypt(
state.wallets[state.wallets.findIndex((x) => x.name === state.activeWallet.name)].wallet = CryptoJS.AES.encrypt(
JSON.stringify(state.activeWallet),
state.activeWallet.password
state.activeWallet.password,
).toString()

@@ -134,11 +116,7 @@ }

SET_RELAYERS(state, relayers) {
state.activeWallet.accounts.find(
(x) => x.address == state.selectedAddress
).relayers = relayers
state.activeWallet.accounts.find((x) => x.address == state.selectedAddress).relayers = relayers
if (state.activeWallet.name && state.activeWallet.password) {
state.wallets[
state.wallets.findIndex((x) => x.name === state.activeWallet.name)
].wallet = CryptoJS.AES.encrypt(
state.wallets[state.wallets.findIndex((x) => x.name === state.activeWallet.name)].wallet = CryptoJS.AES.encrypt(
JSON.stringify(state.activeWallet),
state.activeWallet.password
state.activeWallet.password,
).toString()

@@ -161,3 +139,3 @@ }

state.authorized = false
}
},
},

@@ -170,3 +148,3 @@ actions: {

await dispatch('common/env/signIn', accountSigner, {
root: true
root: true,
})

@@ -181,3 +159,3 @@

pathIncrement: null,
accounts: []
accounts: [],
}

@@ -199,8 +177,4 @@ const [account] = await accountSigner.getAccounts()

},
async unlockWallet(
{ commit, state, dispatch, rootGetters },
{ name, password }
) {
const encryptedWallet =
state.wallets[state.wallets.findIndex((x) => x.name === name)].wallet
async unlockWallet({ commit, state, dispatch, rootGetters }, { name, password }) {
const encryptedWallet = state.wallets[state.wallets.findIndex((x) => x.name === name)].wallet
let wallet

@@ -210,7 +184,3 @@ if (name == 'Keplr Integration') {

} else {
wallet = JSON.parse(
CryptoJS.AES.decrypt(encryptedWallet, password).toString(
CryptoJS.enc.Utf8
)
)
wallet = JSON.parse(CryptoJS.AES.decrypt(encryptedWallet, password).toString(CryptoJS.enc.Utf8))
}

@@ -221,5 +191,3 @@ commit('SET_ACTIVE_WALLET', wallet)

if (wallet.name == 'Keplr Integration') {
accountSigner = window.getOfflineSigner(
rootGetters['common/env/chainId']
)
accountSigner = window.getOfflineSigner(rootGetters['common/env/chainId'])
} else {

@@ -229,3 +197,3 @@ accountSigner = await DirectSecp256k1HdWallet.fromMnemonic(

stringToPath(wallet.HDpath + wallet.accounts[0].pathIncrement),
wallet.prefix
wallet.prefix,
)

@@ -235,3 +203,3 @@ }

await dispatch('common/env/signIn', accountSigner, {
root: true
root: true,
})

@@ -252,12 +220,7 @@ let client = rootGetters['common/env/signingClient']

async switchAccount({ commit, state, rootGetters, dispatch }, address) {
const accountIndex = state.activeWallet.accounts.findIndex(
(acc) => acc.address == address
)
const accountIndex = state.activeWallet.accounts.findIndex((acc) => acc.address == address)
const accountSigner = await DirectSecp256k1HdWallet.fromMnemonic(
state.activeWallet.mnemonic,
stringToPath(
state.activeWallet.HDpath +
state.activeWallet.accounts[accountIndex].pathIncrement
),
state.activeWallet.prefix
stringToPath(state.activeWallet.HDpath + state.activeWallet.accounts[accountIndex].pathIncrement),
state.activeWallet.prefix,
)

@@ -283,3 +246,3 @@

stringToPath(state.activeWallet.HDpath + pathIncrement),
state.activeWallet.prefix
state.activeWallet.prefix,
)

@@ -289,9 +252,5 @@ const [acc] = await accountSigner.getAccounts()

address: acc.address,
pathIncrement: parseInt(pathIncrement)
pathIncrement: parseInt(pathIncrement),
}
if (
state.activeWallet.accounts.findIndex(
(acc) => acc.address == account.address
) == -1
) {
if (state.activeWallet.accounts.findIndex((acc) => acc.address == account.address) == -1) {
commit('ADD_ACCOUNT', account)

@@ -307,6 +266,3 @@ dispatch('storeWallets')

},
async signInWithPrivateKey(
{ commit, rootGetters, dispatch },
{ prefix = 'cosmos', privKey }
) {
async signInWithPrivateKey({ commit, rootGetters, dispatch }, { prefix = 'cosmos', privKey }) {
const pKey = keyFromWif(privKey.trim())

@@ -325,9 +281,4 @@ const accountSigner = await DirectSecp256k1Wallet.fromKey(pKey, prefix)

},
async restoreWallet(
{ commit, dispatch, rootGetters, state },
{ encrypted, password }
) {
const wallet = JSON.parse(
CryptoJS.AES.decrypt(encrypted, password).toString(CryptoJS.enc.Utf8)
)
async restoreWallet({ commit, dispatch, rootGetters, state }, { encrypted, password }) {
const wallet = JSON.parse(CryptoJS.AES.decrypt(encrypted, password).toString(CryptoJS.enc.Utf8))
let newName = wallet.name

@@ -343,3 +294,3 @@ let incr = 1

stringToPath(wallet.HDpath + '0'),
wallet.prefix
wallet.prefix,
)

@@ -363,9 +314,3 @@ const [firstAccount] = await accountSigner.getAccounts()

{ commit, dispatch, rootGetters },
{
name = null,
mnemonic,
HDpath = "m/44'/118'/0'/0/",
prefix = 'cosmos',
password = null
}
{ name = null, mnemonic, HDpath = "m/44'/118'/0'/0/", prefix = 'cosmos', password = null },
) {

@@ -379,9 +324,5 @@ const wallet = {

pathIncrement: 0,
accounts: []
accounts: [],
}
const accountSigner = await DirectSecp256k1HdWallet.fromMnemonic(
mnemonic,
stringToPath(HDpath + '0'),
prefix
)
const accountSigner = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic, stringToPath(HDpath + '0'), prefix)
const [firstAccount] = await accountSigner.getAccounts()

@@ -406,3 +347,3 @@ const account = { address: firstAccount.address, pathIncrement: 0 }

amount: [{ amount: '0', denom }],
gas: '200000'
gas: '200000',
}

@@ -414,10 +355,5 @@ try {

fee,
memo
memo,
})
const result = await state.activeClient.signAndBroadcast(
state.selectedAddress,
[message],
fee,
memo
)
const result = await state.activeClient.signAndBroadcast(state.selectedAddress, [message], fee, memo)
assertIsBroadcastTxSuccess(result)

@@ -428,4 +364,4 @@ } catch (e) {

}
}
}
},
},
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc