diff --git a/dist/ledgers.js b/dist/ledgers.js index 4fd4a35..d04bd51 100644 --- a/dist/ledgers.js +++ b/dist/ledgers.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("web3")):"function"==typeof define&&define.amd?define("__oh$__",["web3"],t):"object"==typeof exports?exports.__oh$__=t(require("web3")):e.__oh$__=t(e.Web3)}(window,function(e){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=8)}([function(e,t,r){"use strict";function n(e,t,r,n,a,i,o){try{var u=e[i](o),s=u.value}catch(e){return void r(e)}u.done?t(s):Promise.resolve(s).then(n,a)}function a(e){return function(){var t=this,r=arguments;return new Promise(function(a,i){var o=e.apply(t,r);function u(e){n(o,a,i,u,s,"next",e)}function s(e){n(o,a,i,u,s,"throw",e)}u(void 0)})}}function i(e,t){for(var r=0;r0?r[0]:null,t.next=7,window.web3.eth.net.getNetworkType();case 7:a=t.sent,t.next=12;break;case 10:t.prev=10,t.t0=t.catch(0);case 12:a!==e.network&&(e.network=a,e.networkChangeDelegates.forEach(function(t){return t(e.network)})),n!==e.walletAddress&&(n?(e.addTag(i.a.tag),e.addTag(o.a.tag)):(e.removeTag(i.a.tag),e.removeTag(o.a.tag)),e.walletAddress=n,e.fire("onWalletChange",{imparterTag:i.a.tag,isPresent:!!n}),e.fire("onWalletChange",{imparterTag:o.a.tag,isPresent:!!n}),n&&(e.fire("onCredentialsUpdate",{imparterTag:i.a.tag,address:n}),e.fire("onCredentialsUpdate",{imparterTag:o.a.tag,address:n})));case 14:case"end":return t.stop()}},t,null,[[0,10]])}));return function(){return t.apply(this,arguments)}}()}}}])&&c(t.prototype,r),n&&c(t,n),e}();t.a=f},function(e,t,r){"use strict";function n(e,t,r,n,a,i,o){try{var u=e[i](o),s=u.value}catch(e){return void r(e)}u.done?t(s):Promise.resolve(s).then(n,a)}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function i(e){for(var t=1;t\n X\n \n \n ';var r=document.createElement("style");r.innerHTML='\n #oh-popup-container {\n position: fixed;\n font-family: arial, "lucida console", sans-serif;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n background: rgba(0, 0, 0, 0.8);\n z-index: 999;\n opacity:1;\n pointer-events: auto;\n }\n #oh-popup-container > div {\n width: 80vw;\n height: 75vh;\n position: relative;\n top: 15vh;\n margin: auto auto;\n padding: 5px 5px 5px 5px;\n background: white;\n }\n #oh-popup-close {\n background: grey;\n color: white;\n line-height: 25px;\n position: absolute;\n right: 2px;\n text-align: center;\n top: 2px;\n width: 24px;\n text-decoration: none;\n font-weight: bold;\n }\n #oh-popup-close:hover {\n background: black;\n }\n\n #oh-ledger-gratis-iframe {\n display: none;\n border: 0;\n overflow: hidden;\n width: 100%;\n height: 100%;\n }\n ';!function n(){document.body?(document.body.appendChild(t),document.body.appendChild(r),e.loadOhLedgerTransactFns()):setTimeout(n,100)}()}},{key:"loadJS",value:function(e,t,r){var n=document.createElement("script");n.src=e,n.onload=t,n.onreadystatechange=t,r.appendChild(n)}},{key:"loadOhLedgerTransactFns",value:function(){var e=this;this.loadJS("".concat(this.remuneration_uri.prod,"/transact.js"),function(){e.oh_ledger_transact_fn.prod=function(){return oh_ledger_transact.apply(void 0,arguments),e.setupNewPromise()}},document.body),this.loadJS("".concat(this.remuneration_uri.test,"/transact.js"),function(){e.oh_ledger_transact_fn.test=function(){return oh_ledger_transact.apply(void 0,arguments),e.setupNewPromise()}},document.body)}}])&&o(t.prototype,r),a&&o(t,a),e}();t.a=s},function(e,t,r){"use strict";r.r(t),function(e){var n=r(1),a=r(2),i=r(4),o=r(6),u=r(7);function s(e,t,r,n,a,i,o){try{var u=e[i](o),s=u.value}catch(e){return void r(e)}u.done?t(s):Promise.resolve(s).then(n,a)}function c(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var i=e.apply(t,r);function o(e){s(i,n,a,o,u,"next",e)}function u(e){s(i,n,a,o,u,"throw",e)}o(void 0)})}}function l(e){var t=p();return function(){var r,n=v(e);if(t){var a=v(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===m(t)||"function"==typeof t))return t;return f(e)}(this,r)}}function f(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e){var t="function"==typeof Map?new Map:void 0;return(h=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return d(e,arguments,v(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),w(n,e)})(e)}function d(e,t,r){return(d=p()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var a=new(Function.bind.apply(e,n));return r&&w(a,r.prototype),a}).apply(null,arguments)}function p(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function w(e,t){return(w=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function v(e){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function g(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function m(e){return(m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var y=function(){var t="object"==("undefined"==typeof self?"undefined":m(self))&&self.self===self&&self||"object"==(void 0===e?"undefined":m(e))&&e.global===e&&e||this||{};t.oh$=new(function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&w(e,t)}(r,h(EventTarget));var t=l(r);function r(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r);for(var n=arguments.length,a=new Array(n),i=0;i-1&&v.splice(t,1)}(e)},function(e,t){return b(e,t)}),x=new u.a,_={};function T(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{fetcher:fetch}).fetcher;d=e,p=t,r(!0)}function E(){return v}function R(e){if(!e in _)throw new Error("invalid imparterTag");return _[e].canSetCredentials()}function P(e){if(!e in _)throw new Error("invalid imparterTag");return _[e].canGenerateCredentials()}function O(e){if(!e in _)throw new Error("invalid imparterTag");return _[e].canChangeNetwork()}function C(e,t){return j.apply(this,arguments)}function j(){return(j=c(regeneratorRuntime.mark(function e(t,r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(!t in _)){e.next=2;break}throw new Error("invalid imparterTag");case 2:return e.abrupt("return",_[t].setCredentials(r));case 3:case"end":return e.stop()}},e)}))).apply(this,arguments)}function A(e){if(!e in _)throw new Error("invalid imparterTag");return _[e].getCredentials()}function S(e,t){return N.apply(this,arguments)}function N(){return(N=c(regeneratorRuntime.mark(function e(t,r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(!t in _)){e.next=2;break}throw new Error("invalid imparterTag");case 2:return e.abrupt("return",_[t].generateCredentials(r));case 3:case"end":return e.stop()}},e)}))).apply(this,arguments)}function D(e,t){return I.apply(this,arguments)}function I(){return(I=c(regeneratorRuntime.mark(function e(t,r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(!t in _)){e.next=2;break}throw new Error("invalid imparterTag");case 2:return e.abrupt("return",_[t].setNetwork(r));case 3:case"end":return e.stop()}},e)}))).apply(this,arguments)}function U(e){if(!e in _)throw new Error("invalid imparterTag");return _[e].getNetwork()}function L(e){if(!e in _)throw new Error("invalid imparterTag");return _[e].getOverhideRemunerationAPIUri()}function F(e,t){return $.apply(this,arguments)}function $(){return($=c(regeneratorRuntime.mark(function e(t,r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(!t in _)){e.next=2;break}throw new Error("invalid imparterTag");case 2:return e.next=4,s;case 4:if(e.t0=e.sent,!e.t0){e.next=7;break}e.t0=!p;case 7:if(!e.t0){e.next=9;break}throw new Error("did you forget to `oh$.enable(..)`?");case 9:return e.next=11,_[t].getFromDollars(r);case 11:return e.abrupt("return",e.sent);case 12:case"end":return e.stop()}},e)}))).apply(this,arguments)}function B(e,t,r){return H.apply(this,arguments)}function H(){return(H=c(regeneratorRuntime.mark(function e(t,r,n){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(!t in _)){e.next=2;break}throw new Error("invalid imparterTag");case 2:return e.next=4,s;case 4:if(e.t0=e.sent,!e.t0){e.next=7;break}e.t0=!p;case 7:if(!e.t0){e.next=9;break}throw new Error("did you forget to `oh$.enable(..)`?");case 9:return e.next=11,_[t].getTallyDollars(r,n);case 11:return e.abrupt("return",e.sent);case 12:case"end":return e.stop()}},e)}))).apply(this,arguments)}function W(e,t,r){return M.apply(this,arguments)}function M(){return(M=c(regeneratorRuntime.mark(function e(t,r,n){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,J(t,r,n,!0);case 2:return e.abrupt("return",e.sent.tally);case 3:case"end":return e.stop()}},e)}))).apply(this,arguments)}function G(e,t,r){return q.apply(this,arguments)}function q(){return(q=c(regeneratorRuntime.mark(function e(t,r,n){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,J(t,r,n,!1);case 2:return e.abrupt("return",e.sent.transactions);case 3:case"end":return e.stop()}},e)}))).apply(this,arguments)}function J(e,t,r,n){return V.apply(this,arguments)}function V(){return(V=c(regeneratorRuntime.mark(function e(t,r,n,a){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(!t in _)){e.next=2;break}throw new Error("invalid imparterTag");case 2:return e.next=4,s;case 4:if(e.t0=e.sent,!e.t0){e.next=7;break}e.t0=!p;case 7:if(!e.t0){e.next=9;break}throw new Error("did you forget to `oh$.enable(..)`?");case 9:return e.next=11,_[t].getTxs(r,n,a);case 11:return e.abrupt("return",e.sent);case 12:case"end":return e.stop()}},e)}))).apply(this,arguments)}function z(e){return K.apply(this,arguments)}function K(){return(K=c(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(!t in _)){e.next=2;break}throw new Error("invalid imparterTag");case 2:return e.next=4,s;case 4:if(e.t0=e.sent,!e.t0){e.next=7;break}e.t0=!p;case 7:if(!e.t0){e.next=9;break}throw new Error("did you forget to `oh$.enable(..)`?");case 9:return e.next=11,_[t].isOnLedger();case 11:return e.abrupt("return",e.sent);case 12:case"end":return e.stop()}},e)}))).apply(this,arguments)}function X(e,t){return Q.apply(this,arguments)}function Q(){return(Q=c(regeneratorRuntime.mark(function e(t,r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(!t in _)){e.next=2;break}throw new Error("invalid imparterTag");case 2:return e.next=4,s;case 4:if(e.t0=e.sent,!e.t0){e.next=7;break}e.t0=!p;case 7:if(!e.t0){e.next=9;break}throw new Error("did you forget to `oh$.enable(..)`?");case 9:return e.next=11,_[t].sign(r);case 11:return e.abrupt("return",e.sent);case 12:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Y(e,t,r,n){return Z.apply(this,arguments)}function Z(){return(Z=c(regeneratorRuntime.mark(function e(t,r,n,a){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(!t in _)){e.next=2;break}throw new Error("invalid imparterTag");case 2:return e.next=4,s;case 4:if(e.t0=e.sent,!e.t0){e.next=7;break}e.t0=!p;case 7:if(!e.t0){e.next=9;break}throw new Error("did you forget to `oh$.enable(..)`?");case 9:return e.next=11,_[t].createTransaction(r,n,a);case 11:return e.abrupt("return",e.sent);case 12:case"end":return e.stop()}},e)}))).apply(this,arguments)}return _[n.a.tag]=new n.a(k,function(){return d},function(){return p.apply(void 0,arguments)},function(e,t){return b(e,t)}),_[a.a.tag]=new a.a(x,k,function(){return d},function(){return p.apply(void 0,arguments)},function(e,t){return b(e,t)}),_[i.a.tag]=new i.a(x,k,function(){return d},function(){return p.apply(void 0,arguments)},function(e,t){return b(e,t)}),x.createPopup(),k.detectWeb3Wallet(),t.oh$}();t.default=y}.call(this,r(9))},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r}])}); +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("web3")):"function"==typeof define&&define.amd?define("__oh$__",["web3"],t):"object"==typeof exports?exports.__oh$__=t(require("web3")):e.__oh$__=t(e.Web3)}(window,function(e){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=8)}([function(e,t,r){"use strict";function n(e,t,r,n,a,i,o){try{var u=e[i](o),s=u.value}catch(e){return void r(e)}u.done?t(s):Promise.resolve(s).then(n,a)}function a(e){return function(){var t=this,r=arguments;return new Promise(function(a,i){var o=e.apply(t,r);function u(e){n(o,a,i,u,s,"next",e)}function s(e){n(o,a,i,u,s,"throw",e)}u(void 0)})}}function i(e,t){for(var r=0;r0?r[0]:null,t.next=7,window.web3.eth.net.getNetworkType();case 7:a=t.sent,t.next=12;break;case 10:t.prev=10,t.t0=t.catch(0);case 12:a!==e.network&&(e.network=a,e.networkChangeDelegates.forEach(function(t){return t(e.network)})),n!==e.walletAddress&&(n?(e.addTag(i.a.tag),e.addTag(o.a.tag)):(e.removeTag(i.a.tag),e.removeTag(o.a.tag)),e.walletAddress=n,e.fire("onWalletChange",{imparterTag:i.a.tag,isPresent:!!n}),e.fire("onWalletChange",{imparterTag:o.a.tag,isPresent:!!n}),n&&(e.fire("onCredentialsUpdate",{imparterTag:i.a.tag,address:n}),e.fire("onCredentialsUpdate",{imparterTag:o.a.tag,address:n})));case 14:case"end":return t.stop()}},t,null,[[0,10]])}));return function(){return t.apply(this,arguments)}}()}}}])&&c(t.prototype,r),n&&c(t,n),e}();t.a=f},function(e,t,r){"use strict";function n(e,t,r,n,a,i,o){try{var u=e[i](o),s=u.value}catch(e){return void r(e)}u.done?t(s):Promise.resolve(s).then(n,a)}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function i(e){for(var t=1;t\n X\n \n \n ';var r=document.createElement("style");r.innerHTML='\n #oh-popup-container {\n position: fixed;\n font-family: arial, "lucida console", sans-serif;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n background: rgba(0, 0, 0, 0.8);\n z-index: 999;\n opacity:1;\n pointer-events: auto;\n }\n #oh-popup-container > div {\n width: 80vw;\n height: 75vh;\n position: relative;\n top: 15vh;\n margin: auto auto;\n padding: 5px 5px 5px 5px;\n background: white;\n }\n #oh-popup-close {\n background: grey;\n color: white;\n line-height: 25px;\n position: absolute;\n right: 2px;\n text-align: center;\n top: 2px;\n width: 24px;\n text-decoration: none;\n font-weight: bold;\n }\n #oh-popup-close:hover {\n background: black;\n }\n\n #oh-ledger-gratis-iframe {\n display: none;\n border: 0;\n overflow: hidden;\n width: 100%;\n height: 100%;\n }\n ';!function n(){document.body?(document.body.appendChild(t),document.body.appendChild(r),e.loadOhLedgerTransactFns()):setTimeout(n,100)}()}},{key:"loadJS",value:function(e,t,r){var n=document.createElement("script");n.src=e,n.onload=t,n.onreadystatechange=t,r.appendChild(n)}},{key:"loadOhLedgerTransactFns",value:function(){var e=this;this.loadJS("".concat(this.remuneration_uri.prod,"/transact.js"),function(){var t=oh_ledger_transact;e.oh_ledger_transact_fn.prod=function(){return t.apply(void 0,arguments),e.setupNewPromise()}},document.body),this.loadJS("".concat(this.remuneration_uri.test,"/transact.js"),function(){var t=oh_ledger_transact;e.oh_ledger_transact_fn.test=function(){return t.apply(void 0,arguments),e.setupNewPromise()}},document.body)}}])&&o(t.prototype,r),a&&o(t,a),e}();t.a=s},function(e,t,r){"use strict";r.r(t),function(e){var n=r(1),a=r(2),i=r(4),o=r(6),u=r(7);function s(e,t,r,n,a,i,o){try{var u=e[i](o),s=u.value}catch(e){return void r(e)}u.done?t(s):Promise.resolve(s).then(n,a)}function c(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var i=e.apply(t,r);function o(e){s(i,n,a,o,u,"next",e)}function u(e){s(i,n,a,o,u,"throw",e)}o(void 0)})}}function l(e){var t=p();return function(){var r,n=v(e);if(t){var a=v(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===g(t)||"function"==typeof t))return t;return f(e)}(this,r)}}function f(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e){var t="function"==typeof Map?new Map:void 0;return(h=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return d(e,arguments,v(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),w(n,e)})(e)}function d(e,t,r){return(d=p()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var a=new(Function.bind.apply(e,n));return r&&w(a,r.prototype),a}).apply(null,arguments)}function p(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function w(e,t){return(w=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function v(e){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function m(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function g(e){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var y=function(){var t="object"==("undefined"==typeof self?"undefined":g(self))&&self.self===self&&self||"object"==(void 0===e?"undefined":g(e))&&e.global===e&&e||this||{};t.oh$=new(function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&w(e,t)}(r,h(EventTarget));var t=l(r);function r(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r);for(var n=arguments.length,a=new Array(n),i=0;i-1&&v.splice(t,1)}(e)},function(e,t){return b(e,t)}),x=new u.a,_={};function E(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{fetcher:fetch}).fetcher;d=e,p=t,r(!0)}function T(){return v}function P(e){if(!e in _)throw new Error("invalid imparterTag");return _[e].canSetCredentials()}function R(e){if(!e in _)throw new Error("invalid imparterTag");return _[e].canGenerateCredentials()}function O(e){if(!e in _)throw new Error("invalid imparterTag");return _[e].canChangeNetwork()}function C(e,t){return j.apply(this,arguments)}function j(){return(j=c(regeneratorRuntime.mark(function e(t,r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(!t in _)){e.next=2;break}throw new Error("invalid imparterTag");case 2:return e.abrupt("return",_[t].setCredentials(r));case 3:case"end":return e.stop()}},e)}))).apply(this,arguments)}function A(e){if(!e in _)throw new Error("invalid imparterTag");return _[e].getCredentials()}function S(e,t){return N.apply(this,arguments)}function N(){return(N=c(regeneratorRuntime.mark(function e(t,r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(!t in _)){e.next=2;break}throw new Error("invalid imparterTag");case 2:return e.abrupt("return",_[t].generateCredentials(r));case 3:case"end":return e.stop()}},e)}))).apply(this,arguments)}function U(e,t){return I.apply(this,arguments)}function I(){return(I=c(regeneratorRuntime.mark(function e(t,r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(!t in _)){e.next=2;break}throw new Error("invalid imparterTag");case 2:return e.abrupt("return",_[t].setNetwork(r));case 3:case"end":return e.stop()}},e)}))).apply(this,arguments)}function D(e){if(!e in _)throw new Error("invalid imparterTag");return _[e].getNetwork()}function L(e){if(!e in _)throw new Error("invalid imparterTag");return _[e].getOverhideRemunerationAPIUri()}function $(e,t){return F.apply(this,arguments)}function F(){return(F=c(regeneratorRuntime.mark(function e(t,r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(!t in _)){e.next=2;break}throw new Error("invalid imparterTag");case 2:return e.next=4,s;case 4:if(e.t0=e.sent,!e.t0){e.next=7;break}e.t0=!p;case 7:if(!e.t0){e.next=9;break}throw new Error("did you forget to `oh$.enable(..)`?");case 9:return e.next=11,_[t].getFromDollars(r);case 11:return e.abrupt("return",e.sent);case 12:case"end":return e.stop()}},e)}))).apply(this,arguments)}function W(e,t,r){return B.apply(this,arguments)}function B(){return(B=c(regeneratorRuntime.mark(function e(t,r,n){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,J(t,r,n,!0,!0);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e)}))).apply(this,arguments)}function H(e,t,r){return G.apply(this,arguments)}function G(){return(G=c(regeneratorRuntime.mark(function e(t,r,n){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,J(t,r,n,!0,!1);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e)}))).apply(this,arguments)}function M(e,t,r){return q.apply(this,arguments)}function q(){return(q=c(regeneratorRuntime.mark(function e(t,r,n){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,J(t,r,n,!1,!1);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e)}))).apply(this,arguments)}function J(e,t,r,n,a){return V.apply(this,arguments)}function V(){return(V=c(regeneratorRuntime.mark(function e(t,r,n,a,i){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(!t in _)){e.next=2;break}throw new Error("invalid imparterTag");case 2:return e.next=4,s;case 4:if(e.t0=e.sent,!e.t0){e.next=7;break}e.t0=!p;case 7:if(!e.t0){e.next=9;break}throw new Error("did you forget to `oh$.enable(..)`?");case 9:return e.next=11,_[t].getTxs(r,n,a,i);case 11:return e.abrupt("return",e.sent);case 12:case"end":return e.stop()}},e)}))).apply(this,arguments)}function z(e){return K.apply(this,arguments)}function K(){return(K=c(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(!t in _)){e.next=2;break}throw new Error("invalid imparterTag");case 2:return e.next=4,s;case 4:if(e.t0=e.sent,!e.t0){e.next=7;break}e.t0=!p;case 7:if(!e.t0){e.next=9;break}throw new Error("did you forget to `oh$.enable(..)`?");case 9:return e.next=11,_[t].isOnLedger();case 11:return e.abrupt("return",e.sent);case 12:case"end":return e.stop()}},e)}))).apply(this,arguments)}function X(e,t){return Q.apply(this,arguments)}function Q(){return(Q=c(regeneratorRuntime.mark(function e(t,r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(!t in _)){e.next=2;break}throw new Error("invalid imparterTag");case 2:return e.next=4,s;case 4:if(e.t0=e.sent,!e.t0){e.next=7;break}e.t0=!p;case 7:if(!e.t0){e.next=9;break}throw new Error("did you forget to `oh$.enable(..)`?");case 9:return e.next=11,_[t].sign(r);case 11:return e.abrupt("return",e.sent);case 12:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Y(e,t,r,n){return Z.apply(this,arguments)}function Z(){return(Z=c(regeneratorRuntime.mark(function e(t,r,n,a){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(!t in _)){e.next=2;break}throw new Error("invalid imparterTag");case 2:return e.next=4,s;case 4:if(e.t0=e.sent,!e.t0){e.next=7;break}e.t0=!p;case 7:if(!e.t0){e.next=9;break}throw new Error("did you forget to `oh$.enable(..)`?");case 9:return e.next=11,_[t].createTransaction(r,n,a);case 11:return e.abrupt("return",e.sent);case 12:case"end":return e.stop()}},e)}))).apply(this,arguments)}return _[n.a.tag]=new n.a(k,function(){return d},function(){return p.apply(void 0,arguments)},function(e,t){return b(e,t)}),_[a.a.tag]=new a.a(x,k,function(){return d},function(){return p.apply(void 0,arguments)},function(e,t){return b(e,t)}),_[i.a.tag]=new i.a(x,k,function(){return d},function(){return p.apply(void 0,arguments)},function(e,t){return b(e,t)}),x.createPopup(),k.detectWeb3Wallet(),t.oh$}();t.default=y}.call(this,r(9))},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r}])}); //# sourceMappingURL=ledgers.js.map \ No newline at end of file diff --git a/dist/ledgers.js.map b/dist/ledgers.js.map index b89b2d2..a491e12 100644 --- a/dist/ledgers.js.map +++ b/dist/ledgers.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://__oh$__/webpack/universalModuleDefinition","webpack://__oh$__/webpack/bootstrap","webpack://__oh$__/./src/fns/imparter_fns.js","webpack://__oh$__/./src/imparters/eth-web3.js","webpack://__oh$__/./src/imparters/ohledger-web3.js","webpack://__oh$__/./src/fns/ohledger_fns.js","webpack://__oh$__/./src/imparters/ohledger.js","webpack://__oh$__/external {\"commonjs\":\"web3\",\"commonjs2\":\"web3\",\"amd\":\"web3\",\"root\":\"Web3\"}","webpack://__oh$__/./src/wallets/web3_wallet.js","webpack://__oh$__/./src/wallets/overhide_wallet.js","webpack://__oh$__/./src/ledgers.js","webpack://__oh$__/(webpack)/buildin/global.js"],"names":["root","factory","exports","module","require","define","amd","window","__WEBPACK_EXTERNAL_MODULE__5__","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","imparter_fns","recipient","date","Date","Error","address","_callee","uri","from","to","tallyOnly","token","__fetch","since","regeneratorRuntime","wrap","_context","prev","next","concat","toISOString","headers","Headers","Authorization","then","res","json","e","String","abrupt","sent","stop","_callee2","signature","message","_context2","method","Content-Type","body","JSON","stringify","btoa","result","status","eth_web3","web3_wallet","getToken","fire","_this","this","_classCallCheck","_defineProperty","main","rinkeby","eth_accounts","networkChangeDelegates","push","network","onNetworkChange","imparterTag","tag","remuneration_uri","credentials","walletAddress","options","details","dollarAmount","hostPrefix","now","length","minrate","txs","values","tally","getTxs","transactions","map","join","text","Math","round","toFixed","_callee3","_context3","getTxs_check_details","getOverhideRemunerationAPIUri","getTxs_retrieve","_callee4","_context4","sign","isSignatureValid_call","_callee5","_context5","web3","eth","personal","_callee6","amount","_context6","Promise","resolve","reject","sendTransaction","on","confirmationNumber","receipt","error","ohledger_web3","overhide_wallet","ohledger_fns","setNetwork_check_details","currency","createTransaction","showOhLedgerGratisIframeUri","oh_ledger_transact_fn","toUpperCase","toLowerCase","signFn","showGratisFn","ohLedgerTransactFn","toLocaleString","ohledger","privateKeyToAccount","secret","recover","err","privateKey","addTag","removeTag","Web3","accounts","ethereum","_asyncToGenerator","mark","enable","t0","detectWalletCb","setInterval","_ref3","currentAccounts","currentAddress","currentNetwork","getAccounts","net","getNetworkType","forEach","isPresent","apply","arguments","prod","test","addEventListener","data","event","makePopupHidden","detail","document","triggerFor","parent","dispatchEvent","CustomEvent","click","_objectSpread","_this2","console","assert","rs","rj","getElementById","style","display","setupNewPromise","params","isError","popup","hideAllPopupContents","frame","setAttribute","makePopupVisible","_this3","createElement","innerHTML","attach","appendChild","loadOhLedgerTransactFns","setTimeout","url","implementationCode","location","scriptTag","src","onload","onreadystatechange","_this4","loadJS","oh_ledger_transact","oh$","self","_typeof","global","_EventTarget","_inherits","_class2","_wrapNativeSuper","EventTarget","_super","_createSuper","_len","args","Array","_key","_assertThisInitialized","getImparterTags","canSetCredentials","canGenerateCredentials","canChangeNetwork","generateCredentials","setCredentials","setNetwork","getCredentials","getNetwork","getFromDollars","getTallyDollars","getTally","getTransactions","isOnLedger","doEnable","isEnabled","imparterTags","which","createEvent","param","initEvent","web3Wallet","findIndex","v","imparterTagIndex","splice","overhideWallet","imparters","_token","fetcher","undefined","fetch","_x","_x2","_setCredentials","_x3","_x4","_generateCredentials","_x5","_x6","_setNetwork","_x7","_x8","_getFromDollars","_x9","_x10","_x11","_getTallyDollars","_x12","_x13","_x14","_getTally","_x15","_x16","_x17","_getTransactions","_callee7","_context7","_x18","_x19","_x20","_x21","_getTxs","_callee8","_context8","_x22","_isOnLedger","_callee9","_context9","_x23","_x24","_sign","_callee10","_context10","_x25","_x26","_x27","_x28","_createTransaction","_callee11","_context11","createPopup","detectWeb3Wallet","g","Function"],"mappings":"CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,EAAAG,QAAA,SACA,mBAAAC,eAAAC,IACAD,OAAA,mBAAAJ,GACA,iBAAAC,QACAA,QAAA,QAAAD,EAAAG,QAAA,SAEAJ,EAAA,QAAAC,EAAAD,EAAA,MARA,CASCO,OAAA,SAAAC,GACD,mBCTA,IAAAC,EAAA,GAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAT,QAGA,IAAAC,EAAAM,EAAAE,GAAA,CACAC,EAAAD,EACAE,GAAA,EACAX,QAAA,IAUA,OANAY,EAAAH,GAAAI,KAAAZ,EAAAD,QAAAC,IAAAD,QAAAQ,GAGAP,EAAAU,GAAA,EAGAV,EAAAD,QA0DA,OArDAQ,EAAAM,EAAAF,EAGAJ,EAAAO,EAAAR,EAGAC,EAAAQ,EAAA,SAA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AAgS,EAAAlR,KAAA,GAIe6N,EAAUpL,GAAaqD,kBAAkBf,EAAQxF,EAAIuD,GAJpE,eAAAoO,EAAAvQ,OAAA,SAAAuQ,EAAAtQ,MAAA,yBAAAsQ,EAAArQ,SAAAoQ,OA1mBsBhJ,MAAAlG,KAAAmG,WAinBtB,OAzIA2F,EAAUnM,IAASgB,KAAO,IAAIhB,IAC5B6L,EACA,kBAAM9N,GACN,kBAAaC,EAAOuI,WAAP,EAAAC,YACb,SAACiF,EAAOzD,GAAR,OAAmB7H,EAAKsL,EAAOzD,KACjCmE,EAAUpI,IAAc/C,KAAO,IAAI+C,IACjCmI,EACAL,EACA,kBAAM9N,GACN,kBAAaC,EAAOuI,WAAP,EAAAC,YACb,SAACiF,EAAOzD,GAAR,OAAmB7H,EAAKsL,EAAOzD,KAEjCmE,EAAUtH,IAAS7D,KAAO,IAAI6D,IAC5BqH,EACAL,EACA,kBAAM9N,GACN,kBAAaC,EAAOuI,WAAP,EAAAC,YACb,SAACiF,EAAOzD,GAAR,OAAmB7H,EAAKsL,EAAOzD,KAGjCkE,EAAeuD,cACf5D,EAAW6D,mBAoHJlV,EAAKgP,IAjnBD,GAonBEA,4CC9uBf,IAAAmG,EAGAA,EAAA,WACA,OAAAtP,KADA,GAIA,IAEAsP,KAAA,IAAAC,SAAA,iBACC,MAAA7Q,GAED,iBAAAhE,SAAA4U,EAAA5U,QAOAJ,EAAAD,QAAAiV","file":"ledgers.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"web3\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"__oh$__\", [\"web3\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"__oh$__\"] = factory(require(\"web3\"));\n\telse\n\t\troot[\"__oh$__\"] = factory(root[\"Web3\"]);\n})(window, function(__WEBPACK_EXTERNAL_MODULE__5__) {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 8);\n","class imparter_fns {\r\n static getTxs_check_details(recipient, date) {\r\n if (date && !(date instanceof Date)) throw new Error(\"'date' must be a Date is passed in\");\r\n if (!('address' in recipient) || !recipient.address) throw new Error(\"'address' required in recipient\"); }\r\n\r\n static async getTxs_retrieve(uri, from, to, tallyOnly, date, token, __fetch) {\r\n if (!uri) throw new Error('no uri for request, unsupported network selected in wallet?');\r\n let since = '';\r\n if (date) {\r\n since = `&since=${date.toISOString()}`;\r\n }\r\n return await __fetch(`${uri}/get-transactions/${from}/${to}?tally-only=${tallyOnly ? 'true' : 'false'}${since}&include-refunds=true`, {\r\n headers: new Headers({\r\n 'Authorization': `Bearer ${token}`\r\n })\r\n })\r\n .then(res => res.json())\r\n .catch(e => {\r\n throw String(e)\r\n }); \r\n }\r\n\r\n static async isSignatureValid_call(uri, signature, message, from, token, __fetch) {\r\n return await __fetch(`${uri}/is-signature-valid`, {\r\n method: \"POST\",\r\n headers: { \r\n 'Content-Type': 'application/json; charset=utf-8',\r\n 'Authorization': `Bearer ${token}`\r\n },\r\n body: JSON.stringify({\r\n signature: btoa(signature),\r\n message: btoa(message),\r\n address: from\r\n })\r\n })\r\n .then((result) => {\r\n if (result.status == 200) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n })\r\n .catch(e => {\r\n throw String(e)\r\n });\r\n }\r\n}\r\n\r\nexport default imparter_fns;","import imparter_fns from '../fns/imparter_fns.js';\r\n\r\nclass eth_web3 {\r\n static tag = 'eth-web3';\r\n\r\n remuneration_uri = {\r\n 'main':'https://ethereum.overhide.io',\r\n 'rinkeby':'https://rinkeby.ethereum.overhide.io'\r\n };\r\n\r\n constructor(web3_wallet, getToken, __fetch, fire) {\r\n this.web3_wallet = web3_wallet;\r\n this.eth_accounts = web3_wallet.eth_accounts;\r\n this.getToken = getToken;\r\n this.__fetch = __fetch;\r\n this.fire = fire;\r\n\r\n web3_wallet.networkChangeDelegates.push((network) => this.onNetworkChange(network));\r\n }\r\n\r\n onNetworkChange(network) {\r\n this.fire('onNetworkChange',{imparterTag: eth_web3.tag, name: network, uri: this.remuneration_uri[network]});\r\n }\r\n\r\n canSetCredentials() {\r\n return false;\r\n }\r\n\r\n canGenerateCredentials() {\r\n return false;\r\n } \r\n\r\n canChangeNetwork() {\r\n return false;\r\n } \r\n\r\n setCredentials(credentials) {\r\n return false;\r\n }\r\n\r\n getCredentials() {\r\n return {\"address\":this.web3_wallet.walletAddress};\r\n } \r\n\r\n generateCredentials(options) {\r\n return false;\r\n } \r\n\r\n setNetwork(details) {\r\n return false;\r\n }\r\n\r\n getNetwork() {\r\n return { \"name\": this.web3_wallet.network, \"uri\": this.remuneration_uri[this.web3_wallet.network]};\r\n } \r\n\r\n getOverhideRemunerationAPIUri() {\r\n return this.remuneration_uri[this.web3_wallet.network]; \r\n } \r\n\r\n async getFromDollars(dollarAmount) {\r\n const hostPrefix = this.web3_wallet.network === 'main' ? '' : 'test.';\r\n const now = (new Date()).toISOString();\r\n const result = await this.__fetch(`https://${hostPrefix}rates.overhide.io/rates/wei/${now}`, {\r\n headers: new Headers({\r\n 'Authorization': `Bearer ${this.getToken()}`\r\n })\r\n })\r\n .then(res => res.json())\r\n .catch(e => {\r\n throw String(e)\r\n });\r\n if (!result || result.length === 0 || ! 'minrate' in result[0] || result[0].minrate === 0) return 0;\r\n return dollarAmount / result[0].minrate;\r\n }\r\n\r\n async getTallyDollars(recipient, date) {\r\n const txs = (await this.getTxs(recipient, date, false)).transactions;\r\n if (!txs || txs.length == 0) return 0;\r\n const values = txs.map(t => `${t['transaction-value']}@${(new Date(t['transaction-date'])).toISOString()}`); \r\n const hostPrefix = this.web3_wallet.network === 'main' ? '' : 'test.';\r\n const now = (new Date()).toISOString();\r\n var tally = await this.__fetch(`https://${hostPrefix}rates.overhide.io/tallymax/wei/${values.join(',')}`, {\r\n headers: new Headers({\r\n 'Authorization': `Bearer ${this.getToken()}`\r\n })\r\n })\r\n .then(res => res.text())\r\n .catch(e => {\r\n throw String(e)\r\n });\r\n return (Math.round(tally * 100) / 100).toFixed(2);\r\n }\r\n\r\n async getTxs(recipient, date, tallyOnly) {\r\n imparter_fns.getTxs_check_details(recipient, date);\r\n\r\n const to = recipient.address;\r\n const uri = this.getOverhideRemunerationAPIUri();\r\n\r\n if (!this.web3_wallet.network) throw new Error(\"network must be set in wallet\");\r\n if (!this.web3_wallet.walletAddress) throw new Error(\"from 'walletAddress' not set: use wallet\");\r\n var from = this.web3_wallet.walletAddress;\r\n\r\n return await imparter_fns.getTxs_retrieve(uri, from, to, tallyOnly, date, this.getToken(), this.__fetch);\r\n } \r\n\r\n async isOnLedger() {\r\n const uri = this.getOverhideRemunerationAPIUri();\r\n if (!this.web3_wallet.network) throw new Error(\"no network for imparter tag\");\r\n if (!this.web3_wallet.walletAddress) throw new Error(\"from 'walletAddress' not set: use wallet\");\r\n const from = this.web3_wallet.walletAddress;\r\n if (!uri) throw new Error('no uri for request, unsupported network selected in wallet?');\r\n const message = 'verify ownership of address by signing';\r\n const signature = await this.sign(message);\r\n\r\n return await imparter_fns.isSignatureValid_call(uri, signature, message, from, this.getToken(), this.__fetch);\r\n }\r\n\r\n async sign(message) {\r\n if (!this.web3_wallet.walletAddress) throw new Error(`imparter ${eth_web3.tag} not active`);\r\n this.fire('onWalletPopup', {imparterTag: eth_web3.tag});\r\n return (await window.web3.eth.personal.sign(message, this.web3_wallet.walletAddress, ''));\r\n }\r\n\r\n async createTransaction(amount, to, options) {\r\n if (!this.web3_wallet.network) throw new Error(\"no network for imparter tag\");\r\n if (!this.web3_wallet.walletAddress) throw new Error(\"from 'walletAddress' not set: use wallet\");\r\n const from = this.web3_wallet.walletAddress;\r\n const uri = this.getOverhideRemunerationAPIUri();\r\n\r\n this.fire('onWalletPopup', {imparterTag: eth_web3.tag});\r\n await (new Promise((resolve, reject) => {\r\n window.web3.eth.sendTransaction({ from: from, to: to, value: amount })\r\n .on('confirmation', function (confirmationNumber, receipt) {\r\n resolve();\r\n })\r\n .on('error', (error) => {\r\n reject(error);\r\n }); \r\n }));\r\n\r\n return true;\r\n } \r\n}\r\n\r\nexport default eth_web3;","import ohledger_fns from '../fns/ohledger_fns.js';\r\nimport imparter_fns from '../fns/imparter_fns.js';\r\n\r\nclass ohledger_web3 {\r\n static tag = 'ohledger-web3';\r\n\r\n mode = 'test';\r\n\r\n constructor(overhide_wallet, web3_wallet, getToken, __fetch, fire) {\r\n this.web3_wallet = web3_wallet;\r\n this.overhide_wallet = overhide_wallet;\r\n this.__fetch = __fetch;\r\n this.getToken = getToken;\r\n this.fire = fire;\r\n }\r\n\r\n canSetCredentials() {\r\n return false;\r\n } \r\n\r\n canGenerateCredentials() {\r\n return false;\r\n } \r\n\r\n canChangeNetwork() {\r\n return true;\r\n } \r\n \r\n setCredentials(credentials) {\r\n return false;\r\n } \r\n\r\n getCredentials() {\r\n return {\"address\": this.web3_wallet.walletAddress};\r\n } \r\n\r\n generateCredentials(options) {\r\n return false;\r\n }\r\n\r\n setNetwork(details) {\r\n ohledger_fns.setNetwork_check_details(details);\r\n\r\n this.mode = details.mode;\r\n this.fire('onNetworkChange', { imparterTag: ohledger_web3.tag, currency: 'USD', mode: details.mode, uri: this.overhide_wallet.remuneration_uri[details.mode] });\r\n return true;\r\n }\r\n\r\n getNetwork() {\r\n return { \"currency\": \"USD\", \"mode\": this.mode, \"uri\": this.overhide_wallet.remuneration_uri[this.mode]};\r\n }\r\n\r\n getOverhideRemunerationAPIUri() {\r\n if (!this.mode) throw new Error(\"network 'mode' must be set, use setNetwork\");\r\n return this.overhide_wallet.remuneration_uri[this.mode];\r\n }\r\n\r\n async getFromDollars(dollarAmount) {\r\n return dollarAmount * 100;\r\n }\r\n\r\n async getTallyDollars(recipient, date) {\r\n var tally = (await this.getTxs(recipient, date, true)).tally;\r\n return (tally / 100).toFixed(2);\r\n }\r\n\r\n async getTxs(recipient, date, tallyOnly) {\r\n imparter_fns.getTxs_check_details(recipient, date);\r\n\r\n const to = recipient.address;\r\n const uri = this.getOverhideRemunerationAPIUri();\r\n\r\n if (!this.mode) throw new Error(\"network 'mode' must be set, use setNetwork\");\r\n if (!this.web3_wallet.walletAddress) throw new Error(\"from 'walletAddress' not set: use wallet\");\r\n var from = this.web3_wallet.walletAddress;\r\n\r\n return await imparter_fns.getTxs_retrieve(uri, from, to, tallyOnly, date, this.getToken(), this.__fetch);\r\n } \r\n\r\n async isOnLedger() {\r\n const uri = this.getOverhideRemunerationAPIUri();\r\n if (!this.mode) throw new Error(\"network 'mode' must be set, use setNetwork\");\r\n if (!this.web3_wallet.walletAddress) throw new Error(\"from 'walletAddress' not set: use wallet\");\r\n const from = this.web3_wallet.walletAddress;\r\n if (!uri) throw new Error('no uri for request, unsupported network selected in wallet?');\r\n const message = 'verify ownership of address by signing';\r\n const signature = await this.sign(message);\r\n\r\n return await imparter_fns.isSignatureValid_call(uri, signature, message, from, this.getToken(), this.__fetch);\r\n }\r\n\r\n async sign(message) {\r\n if (!this.web3_wallet.walletAddress) throw new Error(`imparter ${ohledger_web3.tag} not active`);\r\n this.fire('onWalletPopup', {imparterTag: ohledger_web3.tag});\r\n return (await window.web3.eth.personal.sign(message, this.web3_wallet.walletAddress, ''));\r\n }\r\n\r\n async createTransaction(amount, to, options) {\r\n if (!this.mode) throw new Error(\"network 'mode' must be set, use setNetwork\");\r\n if (!this.web3_wallet.walletAddress) throw new Error(\"from 'walletAddress' not set: use wallet\");\r\n const from = this.web3_wallet.walletAddress;\r\n const uri = this.getOverhideRemunerationAPIUri();\r\n\r\n await ohledger_fns.createTransaction(\r\n amount, \r\n from,\r\n to,\r\n (message) => this.sign(message),\r\n (from, signature, message) => this.overhide_wallet.showOhLedgerGratisIframeUri(uri, from, signature, message), \r\n this.overhide_wallet.oh_ledger_transact_fn[this.mode], \r\n options);\r\n\r\n return true;\r\n } \r\n}\r\n\r\nexport default ohledger_web3;","class ohledger_fns {\r\n static setNetwork_check_details(details) {\r\n if (!('currency' in details)) throw new Error(\"'currency' must be passed in\");\r\n if (!('mode' in details)) throw new Error(\"'mode' must be passed in\");\r\n details.currency = details.currency.toUpperCase();\r\n details.mode = details.mode.toLowerCase();\r\n if (details.currency !== 'USD') throw new Error(\"'currency' must be 'USD'\");\r\n if (details.mode !== 'prod' && details.mode !== 'test') throw new Error(\"'mode' must be 'prod' or 'test'\"); \r\n }\r\n\r\n static async createTransaction(amount, from, to, signFn, showGratisFn, ohLedgerTransactFn, options) {\r\n if (amount == 0) {\r\n if ('message' in options && options.message && 'signature' in options && options.signature) {\r\n var message = options.message;\r\n var signature = options.signature;\r\n } else {\r\n var message = `verify ownership of address by signing on ${new Date().toLocaleString()}`;\r\n var signature = await signFn(message);\r\n }\r\n await showGratisFn(from, signature, message);\r\n } else {\r\n await ohLedgerTransactFn(amount, from, to);\r\n }\r\n }\r\n}\r\n\r\nexport default ohledger_fns;","import ohledger_fns from '../fns/ohledger_fns.js';\r\nimport imparter_fns from '../fns/imparter_fns.js';\r\n\r\nclass ohledger {\r\n static tag = 'ohledger';\r\n\r\n address = null;\r\n secret = null;\r\n mode = 'test';\r\n\r\n constructor(overhide_wallet, web3_wallet, getToken, __fetch, fire) {\r\n this.overhide_wallet = overhide_wallet;\r\n this.eth_accounts = web3_wallet.eth_accounts;\r\n this.getToken = getToken;\r\n this.__fetch = __fetch;\r\n this.fire = fire;\r\n }\r\n\r\n canSetCredentials() {\r\n return true;\r\n } \r\n\r\n canGenerateCredentials() {\r\n return true;\r\n } \r\n\r\n canChangeNetwork() {\r\n return true;\r\n } \r\n\r\n setCredentials(credentials) {\r\n if (!('secret' in credentials)) throw new Error(\"'secret' must be passed in\");\r\n if ('address' in credentials && credentials.address) {\r\n this.address = credentials.address.toLowerCase();\r\n } else {\r\n this.address = this.eth_accounts.privateKeyToAccount(credentials.secret).address.toLowerCase();\r\n }\r\n this.secret = credentials.secret;\r\n try {\r\n if (!(this.eth_accounts.recover(this.eth_accounts.sign('test message', this.secret)).toLowerCase() == this.address)) {\r\n throw new Error(\"'secret' not valid for 'address\");\r\n }\r\n } catch (err) {\r\n throw new Error(\"'secret' not valid for 'address\");\r\n } \r\n this.fire('onCredentialsUpdate', { imparterTag: ohledger.tag, address: this.address, secret: this.secret});\r\n return true;\r\n } \r\n\r\n getCredentials() {\r\n return {\"address\":this.address, \"secret\":this.secret};\r\n }\r\n\r\n generateCredentials(options) {\r\n const res = this.eth_accounts.create();\r\n this.address = res.address.toLowerCase();\r\n this.secret = res.privateKey;\r\n this.fire('onCredentialsUpdate', { imparterTag: ohledger.tag, address: this.address, secret: this.secret});\r\n return true;\r\n }\r\n\r\n setNetwork(details) {\r\n ohledger_fns.setNetwork_check_details(details);\r\n\r\n this.mode = details.mode;\r\n this.fire('onNetworkChange', { imparterTag: ohledger.tag, currency: 'USD', mode: details.mode, uri: this.overhide_wallet.remuneration_uri[details.mode]});\r\n return true;\r\n } \r\n\r\n getNetwork() {\r\n return { \"currency\": \"USD\", \"mode\": this.mode, \"uri\": this.overhide_wallet.remuneration_uri[this.mode]};\r\n }\r\n\r\n getOverhideRemunerationAPIUri() {\r\n if (!this.mode) throw new Error(\"network 'mode' must be set, use setNetwork\");\r\n return this.overhide_wallet.remuneration_uri[this.mode];\r\n }\r\n\r\n async getFromDollars(dollarAmount) {\r\n return dollarAmount * 100;\r\n }\r\n\r\n async getTallyDollars(recipient, date) {\r\n var tally = (await this.getTxs(recipient, date, true)).tally;\r\n return (tally / 100).toFixed(2);\r\n }\r\n\r\n async getTxs(recipient, date, tallyOnly) {\r\n imparter_fns.getTxs_check_details(recipient, date);\r\n\r\n const to = recipient.address;\r\n const uri = this.getOverhideRemunerationAPIUri();\r\n\r\n if (!this.mode) throw new Error(\"network 'mode' must be set, use setNetwork\");\r\n if (!this.address) throw new Error(\"from 'address' not set: use setCredentials\");\r\n const from = this.address;\r\n\r\n return await imparter_fns.getTxs_retrieve(uri, from, to, tallyOnly, date, this.getToken(), this.__fetch);\r\n }\r\n\r\n async isOnLedger() {\r\n const uri = this.getOverhideRemunerationAPIUri();\r\n if (!this.mode) throw new Error(\"network 'mode' must be set, use setNetwork\");\r\n if (!this.address) throw new Error(\"from 'address' not set: use setCredentials\");\r\n const from = this.address;\r\n if (!uri) throw new Error('no uri for request, unsupported network selected in wallet?');\r\n const message = 'verify ownership of address by signing';\r\n const signature = await this.sign(message);\r\n\r\n return await imparter_fns.isSignatureValid_call(uri, signature, message, from, this.getToken(), this.__fetch);\r\n }\r\n\r\n async sign(message) {\r\n if (!this.secret) throw new Error(`credentials for imparter ${ohledger.tag} not set`);\r\n return this.eth_accounts.sign(message, this.secret).signature;\r\n }\r\n\r\n async createTransaction(amount, to, options) {\r\n if (!this.mode) throw new Error(\"network 'mode' must be set, use setNetwork\");\r\n if (!this.address) throw new Error(\"from 'address' not set: use setCredentials\");\r\n const from = this.address;\r\n const uri = this.getOverhideRemunerationAPIUri();\r\n\r\n await ohledger_fns.createTransaction(\r\n amount, \r\n from,\r\n to,\r\n (message) => this.sign(message),\r\n (from, signature, message) => this.overhide_wallet.showOhLedgerGratisIframeUri(uri, from, signature, message), \r\n this.overhide_wallet.oh_ledger_transact_fn[this.mode], \r\n options);\r\n\r\n return true;\r\n } \r\n}\r\n\r\nexport default ohledger;","module.exports = __WEBPACK_EXTERNAL_MODULE__5__;","import Web3 from 'web3';\r\nimport eth_web3 from '../imparters/eth-web3.js';\r\nimport ohledger_web3 from '../imparters/ohledger-web3.js';\r\n\r\nconst WALLET_CHECK_INTERVAL_MS = 500;\r\n\r\nclass web3_wallet {\r\n eth_accounts = (new Web3('http://localhost:8545')).eth.accounts;\r\n walletAddress = null;\r\n network = null;\r\n\r\n networkChangeDelegates = [];\r\n\r\n constructor(addTag, removeTag, fire) {\r\n this.addTag = addTag;\r\n this.removeTag = removeTag;\r\n this.fire = fire;\r\n }\r\n\r\n /**\r\n * Setup window.web3 to be the wallet's if available or offline if not (just for signing).\r\n * \r\n * Sets up a timer to check for wallet being logged in and address changes.\r\n * \r\n * @ignore\r\n */\r\n detectWeb3Wallet() { \r\n if (!window.ethereum) return;\r\n \r\n // Modern dapp browsers...\r\n (async () => {\r\n try {\r\n await window.ethereum.enable();\r\n window.web3 = new Web3(window.ethereum);\r\n } catch (e) {/*noop*/ }\r\n\r\n await detectWalletCb();\r\n\r\n setInterval(async function () {\r\n await detectWalletCb();\r\n }, WALLET_CHECK_INTERVAL_MS);\r\n })();\r\n\r\n var detectWalletCb = async () => {\r\n try {\r\n var currentAccounts = await window.web3.eth.getAccounts();\r\n var currentAddress = (currentAccounts && currentAccounts.length > 0) ? currentAccounts[0] : null;\r\n var currentNetwork = (await window.web3.eth.net.getNetworkType());\r\n } catch (e) {/*noop*/}\r\n if (currentNetwork !== this.network) {\r\n this.network = currentNetwork;\r\n this.networkChangeDelegates.forEach(d => d(this.network)); \r\n }\r\n if (currentAddress !== this.walletAddress) {\r\n if (currentAddress) { /* add imparters */\r\n this.addTag(eth_web3.tag);\r\n this.addTag(ohledger_web3.tag);\r\n } else { /* remove imparters */\r\n this.removeTag(eth_web3.tag);\r\n this.removeTag(ohledger_web3.tag);\r\n } \r\n this.walletAddress = currentAddress;\r\n this.fire('onWalletChange', { imparterTag: eth_web3.tag, isPresent: !!currentAddress });\r\n this.fire('onWalletChange', { imparterTag: ohledger_web3.tag, isPresent: !!currentAddress });\r\n if (currentAddress) {\r\n this.fire('onCredentialsUpdate', { imparterTag: eth_web3.tag, address: currentAddress });\r\n this.fire('onCredentialsUpdate', { imparterTag: ohledger_web3.tag, address: currentAddress });\r\n }\r\n }\r\n }\r\n } \r\n}\r\n\r\nexport default web3_wallet;","class overhide_wallet {\r\n resolve = null;\r\n reject = null;\r\n\r\n oh_ledger_transact_fn = {\r\n 'prod': null,\r\n 'test': null\r\n };\r\n\r\n remuneration_uri = {\r\n 'prod': 'https://ledger.overhide.io/v1',\r\n 'test': 'https://test.ledger.overhide.io/v1'\r\n }\r\n\r\n constructor() {\r\n window.addEventListener('message', (e) => {\r\n if (e.data && e.data.event === 'oh-ledger-ok') {\r\n this.makePopupHidden(e.data.detail);\r\n } else if (e.data && e.data.event === 'oh-ledger-error') {\r\n this.makePopupHidden(e.data.detail, true);\r\n }\r\n }, false);\r\n\r\n window.document.addEventListener('oh$-popup-close', (e) => {\r\n this.makePopupHidden('user close', true);\r\n }); \r\n }\r\n\r\n // raise oh$-event\r\n // @param {string} imparterTag\r\n // @param {string} triggerFor \r\n // @param {Object} data - to stringify and sent as event.details.\r\n raiseEventClick(imparterTag, triggerFor) {\r\n window.parent.document.dispatchEvent(new CustomEvent('oh$-event', {detail: JSON.stringify({\r\n imparterTag: imparterTag,\r\n triggerFor: triggerFor,\r\n click: true\r\n })}));\r\n }\r\n\r\n // raise oh$-event\r\n // @param {string} imparterTag\r\n // @param {string} triggerFor \r\n // @param {Object} data - to stringify and sent as event.details.\r\n raiseEvent(imparterTag, triggerFor, data) {\r\n window.parent.document.dispatchEvent(new CustomEvent('oh$-event', {detail: JSON.stringify({\r\n ...data,\r\n imparterTag: imparterTag,\r\n triggerFor: triggerFor\r\n })})); \r\n }\r\n\r\n // promise used for popups and resolutions via oh-ledger-* messages.\r\n setupNewPromise() {\r\n console.assert(!this.resolve, 'oh-popup promise being set but already set when calling setupNewPromise(..)');\r\n return new Promise((rs, rj) => {\r\n this.resolve = rs;\r\n this.reject = rj;\r\n }); \r\n }\r\n\r\n // make popup visible to be hidden with makePopupHidden\r\n makePopupVisible() {\r\n var popup = document.getElementById('oh-popup-container');\r\n popup.style.display='block';\r\n return this.setupNewPromise();\r\n }\r\n\r\n makePopupHidden(params, isError) {\r\n var popup = document.getElementById('oh-popup-container');\r\n this.hideAllPopupContents();\r\n popup.style.display='none';\r\n console.assert(this.resolve, 'oh-popup promise not set yet calling makePopupHidden(..)');\r\n if (isError) this.reject(params)\r\n else this.resolve(params);\r\n this.resolve = null;\r\n this.reject = null;\r\n }\r\n\r\n hideAllPopupContents() {\r\n document.getElementById('oh-ledger-gratis-iframe').style.display='none';\r\n }\r\n\r\n async showOhLedgerGratisIframeUri(uri, from, signature, message) {\r\n this.hideAllPopupContents();\r\n var frame = document.getElementById('oh-ledger-gratis-iframe');\r\n frame.setAttribute('src', `${uri}/gratis.html?address=${from}&signature=${signature}&message=${message}`);\r\n frame.style.display='block'; \r\n await this.makePopupVisible();\r\n }\r\n\r\n createPopup() {\r\n var popup = document.createElement('div');\r\n popup.setAttribute('id','oh-popup-container');\r\n popup.style.display='none';\r\n popup.innerHTML = `\r\n
\r\n X\r\n \r\n
\r\n `;\r\n var style = document.createElement('style');\r\n style.innerHTML =`\r\n #oh-popup-container {\r\n position: fixed;\r\n font-family: arial, \"lucida console\", sans-serif;\r\n top: 0;\r\n right: 0;\r\n bottom: 0;\r\n left: 0;\r\n background: rgba(0, 0, 0, 0.8);\r\n z-index: 999;\r\n opacity:1;\r\n pointer-events: auto;\r\n }\r\n #oh-popup-container > div {\r\n width: 80vw;\r\n height: 75vh;\r\n position: relative;\r\n top: 15vh;\r\n margin: auto auto;\r\n padding: 5px 5px 5px 5px;\r\n background: white;\r\n }\r\n #oh-popup-close {\r\n background: grey;\r\n color: white;\r\n line-height: 25px;\r\n position: absolute;\r\n right: 2px;\r\n text-align: center;\r\n top: 2px;\r\n width: 24px;\r\n text-decoration: none;\r\n font-weight: bold;\r\n }\r\n #oh-popup-close:hover {\r\n background: black;\r\n }\r\n\r\n #oh-ledger-gratis-iframe {\r\n display: none;\r\n border: 0;\r\n overflow: hidden;\r\n width: 100%;\r\n height: 100%;\r\n }\r\n `;\r\n var attach = () => {\r\n if (document.body) {\r\n document.body.appendChild(popup);\r\n document.body.appendChild(style);\r\n this.loadOhLedgerTransactFns();\r\n } else {\r\n setTimeout(attach, 100);\r\n };\r\n };\r\n attach();\r\n }\r\n\r\n // https://stackoverflow.com/a/31374433\r\n loadJS(url, implementationCode, location) {\r\n //url is URL of external file, implementationCode is the code\r\n //to be called from the file, location is the location to \r\n //insert the \r\n * \r\n * \r\n * ```\r\n * \r\n * #### IMPARTERS\r\n * \r\n * The library works with a concept of *imprater* tags. Wallets impart credentials, signatures, and transactions. For\r\n * *loose change*--where no wallet exists--the library can be interrogated as to which entities should be set by the \r\n * user (can* functions); causing the entities to be imparted back to the user in a common code flow. \r\n * \r\n * The imparter tags are a simple naming convention. For example if multiple Ethereum wallet APIs were imparting data \r\n * they would be individually tagged with a prefix \"eth\" and a dashed suffix. No suffix indicates a *loose change*\r\n * imparter:\r\n * \r\n * - eth-web3\r\n * - eth-?\r\n * \r\n * Similarly for *overhide-ledger*, the prefix is \"ohledger\", the suffix won't be attached on the *loose change* version \r\n * and will be suffixed on the *web3* walleted version:\r\n * \r\n * - ohledger\r\n * - ohledger-web3\r\n * \r\n * The following sections cover special notes on each imparter. The library adheres to these notes.\r\n * \r\n * ##### eth-web3\r\n * \r\n * Ethereum addresses are 20 bytes: 42 character 'hex' strings prefixed with '0x'.\r\n * \r\n * Ethereum secret keys for signing addresses are 32 bytes: 66 character 'hex' strings prefixed with '0x'.\r\n * \r\n * Ethereum networks names are:\r\n * \r\n * * main\r\n * * kovan\r\n * * rinkeyby\r\n * * ropsten\r\n * \r\n * The denomination for amounts is the Wei\r\n * \r\n * ##### ohledger, ohledger-web3\r\n * \r\n * Addresses and secret keys use Ethereum format.\r\n * \r\n * Addresses are 20 bytes: 42 character 'hex' strings prefixed with '0x'.\r\n * \r\n * Secret keys for signing addresses are 32 bytes: 66 character 'hex' strings prefixed with '0x'.\r\n * \r\n * Network tuples consist of a 'currency' as a three letter ISO fiat currency code and a 'mode'. The supported\r\n * 'currency' names are:\r\n * \r\n * * 'USD'\r\n * \r\n * The denominations are:\r\n * \r\n * | Currency | denomination |\r\n * | --- | --- |\r\n * | USD | cents |\r\n * \r\n * Note: at this point only USD are supported. If there is a need, and *overhide-ledger* instances in currencies\r\n * other than USD come online, we'll revisit this.\r\n *\r\n * An 'ohledger' mode is on of 'prod' or 'test'\r\n * \r\n */\r\nconst oh$ = (function() {\r\n\r\n var root = typeof self == 'object' && self.self === self && self ||\r\n typeof global == 'object' && global.global === global && global ||\r\n this ||\r\n {};\r\n\r\n root.oh$ = new class extends EventTarget {\r\n /**\r\n * @event onWalletChange\r\n * @param {Object} event object - the event object passed in will have additional attributes\r\n *\r\n * > The new event object will conform to the following:\r\n * >\r\n * > | imparter tag | event object attributes |\r\n * > | --- | --- |\r\n * > | * | `{imparterTag:..,isPresent:..}` |\r\n * >\r\n * > *imparterTag* - causing the event\r\n * >\r\n * > *isPresent* - if wallet is present for imparter\r\n *\r\n * @description\r\n * Event called when wallets' state changes.\r\n * \r\n * In user code:\r\n * \r\n * ```\r\n * oh$.addEventListener('onWalletChange', (e) => console.log(`wallet for ${e.imparterTag} is available:${e.isPresent}`));\r\n * ```\r\n */\r\n\r\n /**\r\n * @event onWalletPopup\r\n * @param {Object} event object - the event object passed in will have additional attributes\r\n *\r\n * > The new event object will conform to the following:\r\n * >\r\n * > | imparter tag | event object attributes |\r\n * > | --- | --- |\r\n * > | * | `{imparterTag:..}` |\r\n * >\r\n * > *imparterTag* - causing the pop-up\r\n *\r\n * @description\r\n * Event called when wallet is expected to popup. Useful in case user wants to react to popup in UI.\r\n * \r\n * In user code:\r\n * \r\n * ```\r\n * oh$.addEventListener('onWalletPopup', (e) => console.log(`wallet for ${e.imparterTag} popped`));\r\n * ```\r\n */\r\n\r\n /**\r\n * @event onCredentialsUpdate\r\n * @description\r\n * Event called when an credentials change for one of the tracked imparters.\r\n * \r\n * Only called when credentials are valid as per imparter: ready to be used for signing, transacting.\r\n *\r\n * In user code:\r\n *\r\n * ```\r\n * oh$.addEventListener('onCredentialsUpdate', (e) => {\r\n * if (e.imparterTag === 'eth-web3') console.log(`new address for ${e.imparterTag} is:${e.address}`);\r\n * return;\r\n * });\r\n * ```\r\n * @param {Object} event object - the event object passed in will have additional attributes\r\n * \r\n * > The new event object will conform to the following:\r\n * >\r\n * > | imparter tag | event object attributes |\r\n * > | --- | --- |\r\n * > | eth-web3 | `{imparterTag:..,address:..}` |\r\n * > | ohledger | `{imparterTag:..,address:..,secret:..}` |\r\n * > | ohledger-web3 | `{imparterTag:..,address:..}` |\r\n * >\r\n * > *imparterTag* - causing the event\r\n * >\r\n * > *address* - ledger public address of credential set for imparter\r\n * >\r\n * > *secret* - ledger PKI private secret for credential set for imparter\r\n *\r\n */\r\n\r\n /**\r\n * @event onNetworkChange\r\n * @description\r\n * Event called when the network changes for a particular imparter tag.\r\n * \r\n * For example for \"eth\" the network could changed from \"main\" to \"rinkeby\". \r\n * \r\n * In user code:\r\n *\r\n * ```\r\n * oh$.addEventListener('onNetworkChange', (e) => {\r\n * if (e.imparterTag === 'eth-web3') console.log(`new network selected for ${e.imparterTag} is:${e.name}`);\r\n * if (e.imparterTag === /ohledger/.test(e.imparterTag)) console.log(`working in currency: ${e.currency}`);\r\n * return;\r\n * });\r\n * ```\r\n * @param {Object} event object - the event object passed in will have additional attributes\r\n *\r\n * > The new credentials object will conform to the following:\r\n * >\r\n * > | imparter tag | event object attributes |\r\n * > | --- | --- |\r\n * > | eth-web3 | `{imparterTag:..,name:('main'|'rinkeby'|'kovan').., uri:..}` |\r\n * > | ohledger | `{imparterTag:..,currency:'USD',mode:('prod'|'test'), uri:..}` |\r\n * > | ohledger-web3 | `{imparterTag:..,currency:'USD',mode:('prod'|'test'), uri:..}` |\r\n * >\r\n * > *imparterTag* - causing the event\r\n * >\r\n * > *name* - of network\r\n * >\r\n * > *currency* - represented by network\r\n * >\r\n * > *mode* - production or test network\r\n * >\r\n * > *uri* - remuneration API URI for network\r\n *\r\n */\r\n\r\n /**\r\n * @namespace oh$\r\n * @function enable\r\n * @description\r\n * Enable `oh$` by instrumenting with token for ledger access.\r\n * \r\n * `oh$` calls may stall while waiting for this call to complete successfully.\r\n * \r\n * A token can be retrieved with a `GET /token` call (see https://token.overhide.io/swagger.html).\r\n * \r\n * To retrieve tokens please first register for your own API key at https://token.overhide.io/register.\r\n * @param {string} token\r\n */\r\n enable = enable;\r\n\r\n /**\r\n * @namespace oh$\r\n * @function getImparterTags\r\n * @description\r\n * Retrieves all imparter tags injected by wallets and statically available from the library.\r\n * @returns {Array} of strings: the imparter tags available\r\n */\r\n getImparterTags = getImparterTags;\r\n\r\n /**\r\n * @namespace oh$\r\n * @function canSetCredentials\r\n * @description\r\n * Interrogate whether the imparter tag can have credentials set by the user: or does the wallet control it\r\n * exclusively.\r\n * \r\n * Only the following imparter(s) will return 'true':\r\n * \r\n * - ohledger\r\n * \r\n * @param {string} imparterTag\r\n * @returns {boolean} 'true' if particular imparter tag can have credentials set.\r\n */\r\n canSetCredentials = canSetCredentials;\r\n\r\n /**\r\n * @namespace oh$\r\n * @function canGenerateCredentials\r\n * @description\r\n * Interrogate whether the imparter tag can have credentials generated by the user: or does the wallet control it\r\n * exclusively.\r\n *\r\n * Only the following imparter(s) will return 'true':\r\n *\r\n * - ohledger\r\n *\r\n * @param {string} imparterTag\r\n * @returns {boolean} 'true' if particular imparter tag can have credentials generated.\r\n */\r\n canGenerateCredentials = canGenerateCredentials;\r\n\r\n /**\r\n * @namespace oh$\r\n * @function canChangeNetwork\r\n * @description\r\n * Interrogate whether the imparter tag can have network changed by the user via oh$: or does the wallet control it\r\n * exclusively.\r\n *\r\n * Only the following imparter(s) will return 'true':\r\n *\r\n * - ohledger\r\n * - ohledger-web3\r\n *\r\n * @param {string} imparterTag\r\n * @returns {boolean} 'true' if particular imparter tag can have networks changed via oh$.\r\n */\r\n canChangeNetwork = canChangeNetwork;\r\n\r\n /**\r\n * @namespace oh$\r\n * @function generateCredentials\r\n * @description\r\n * For imparters that can have credentials generated, generates them. \r\n * \r\n * Fires [onCredentialsUpdate](#eventoncredentialsupdate) event against `oh$`\r\n * @param {string} imparterTag\r\n * @param {Object} options - imparter specific generation options, if any.\r\n * \r\n * > The options objects are as follows:\r\n * >\r\n * > | imparter tag | credentials object |\r\n * > | --- | --- |\r\n * > | eth-web3 | N/A |\r\n * > | ohledger | null |\r\n * > | ohledger-web3 | N/A |\r\n *\r\n * @returns {Promise} representing a 'true' if success else 'false'; also fires [onCredentialsUpdate](#eventoncredentialsupdate) event against `oh$`\r\n\r\n */\r\n generateCredentials = generateCredentials;\r\n\r\n /**\r\n * @namespace oh$\r\n * @function setCredentials\r\n * @description\r\n * For imparters that can have credentials set, sets them. \r\n * \r\n * Fires [onCredentialsUpdate](#eventoncredentialsupdate) event against `oh$`.\r\n * @param {string} imparterTag\r\n * @param {Object} credentials - credentials object of imparter specific parameters to set\r\n * \r\n * > The credentials objects are as follows:\r\n * >\r\n * > | imparter tag | credentials object | comments |\r\n * > | --- | --- | --- |\r\n * > | eth-web3 | N/A | |\r\n * > | ohledger | `{address:..,secret:..}` | `address` is optional, if not set will be extracted from `secret` |\r\n * > | ohledger-web3 | N/A | |\r\n *\r\n * @returns {Promise} representing a 'true' if success else 'false'; also fires [onCredentialsUpdate](#eventoncredentialsupdate) event against `oh$`\r\n */\r\n setCredentials = setCredentials;\r\n\r\n /**\r\n * @namespace oh$\r\n * @function setNetwork\r\n * @description\r\n * For imparters that can have networks changed via oh$, changes it. \r\n * \r\n * Fires [onNetworkChange](#eventonnetworkchange) event against `oh$`.\r\n * @param {string} imparterTag\r\n * @param {Object} details - network details object of imparter specific parameters to set.\r\n * \r\n * > The network details objects are as follows:\r\n * >\r\n * > | imparter tag | network details object |\r\n * > | --- | --- |\r\n * > | eth-web3 | N/A |\r\n * > | ohledger | `{currency:'USD', mode:'prod'|'test'}` |\r\n * > | ohledger-web3 | `{currency:'USD', mode:'prod'|'test'}` |\r\n *\r\n * @returns {Promise} representing a 'true' if success else 'false'; also fires [onNetworkChange](#eventonnetworkchange) event against `oh$`\r\n */\r\n setNetwork = setNetwork;\r\n\r\n /**\r\n * @namespace oh$\r\n * @function getOverhideRemunerationAPIUri\r\n * @description\r\n * Based on current network set returns the *overhide* remuneration API URI configured in the library.\r\n * @param {string} imparterTag\r\n * @returns {string} the URI.\r\n */\r\n getOverhideRemunerationAPIUri = getOverhideRemunerationAPIUri;\r\n\r\n /**\r\n * @namespace oh$\r\n * @function getCredentials\r\n * @description\r\n * Retrieves current credentials for an imparterTag.\r\n * @param {string} imparterTag\r\n * @returns {Object} details - an object describing current credentials, imparterTag dependant:\r\n * \r\n * > | imparter tag | credentials object |\r\n * > | --- | --- |\r\n * > | eth-web3 | `{address:..}` |\r\n * > | ohledger | `{address:..,secret:..}` |\r\n * > | ohledger-web3 | `{address:..}` |\r\n */\r\n getCredentials = getCredentials;\r\n\r\n /**\r\n * @namespace oh$\r\n * @function getNetwork\r\n * @description\r\n * Retrieves current network for an imparterTag.\r\n * @param {string} imparterTag\r\n * @returns {Object} details - an object describing current network, imparterTag dependant:\r\n * \r\n * > | imparter tag | network details object |\r\n * > | --- | --- |\r\n * > | eth-web3 | `{name:('main'|'rinkeby'|'kovan').., uri:..}` |\r\n * > | ohledger | `{currency:'USD',mode:('prod'|'test'), uri:..}` |\r\n * > | ohledger-web3 | `{currency:'USD',mode:('prod'|'test'), uri:..}` |\r\n */\r\n getNetwork = getNetwork;\r\n\r\n /**\r\n * @namespace oh$\r\n * @function getFromDollars\r\n * @description\r\n * Retrieve a converted amount in imparter specific denomination from a provided dollar amount.\r\n * @param {string} imparterTag\r\n * @param {number} dollarAmount - the dollar amount.\r\n * @returns {Promise} with the value in imparter specific currency at the present time (based on recent exchange rate).\r\n */\r\n getFromDollars = getFromDollars;\r\n\r\n /**\r\n * @namespace oh$\r\n * @function getTallyDollars\r\n * @description\r\n * Retrieve a tally of all transactions on the imparter's ledger--perhaps within a date range--converted to a US dollar amount.\r\n * @param {string} imparterTag\r\n * @param {Object} recepient - imparter specific object describing recipient of transactions to tally for.\r\n *\r\n * > Recipient objects are as per:\r\n * >\r\n * > | imparter tag | recipient object |\r\n * > | --- | --- |\r\n * > | eth-web3 | `{address:..}` |\r\n * > | ohledger | `{address:..}` |\r\n * > | ohledger-web3 | `{address:..}` |\r\n *\r\n * @param {Date} since - date to start tally since: date of oldest transaction to include. No restriction if 'null'.\r\n * @returns {Promise} with the tally value in US dollars: all transactions are exchanged to USD at an approximate exchange rate\r\n * close to the transactions' time.\r\n */\r\n getTallyDollars = getTallyDollars;\r\n\r\n /**\r\n * @namespace oh$\r\n * @function getTally\r\n * @description\r\n * Retrieve a tally of all transactions on the imparter's ledger--perhaps within a date range.\r\n * @param {string} imparterTag\r\n * @param {Object} recepient - imparter specific object describing recipient of transactions to tally for.\r\n *\r\n * > Recipient objects are as per:\r\n * >\r\n * > | imparter tag | recipient object |\r\n * > | --- | --- |\r\n * > | eth-web3 | `{address:..}` |\r\n * > | ohledger | `{address:..}` |\r\n * > | ohledger-web3 | `{address:..}` |\r\n *\r\n * @param {Date} since - date to start tally since: date of oldest transaction to include. No restriction if 'null'.\r\n * @returns {Promise} with the tally value in imparter specific currency\r\n */\r\n getTally = getTally;\r\n\r\n /**\r\n * @namespace oh$\r\n * @function getTransactions\r\n * @description\r\n * Retrieve transactions on the imparter's ledger, perhaps within a date range, from credentials set against \r\n * imparter to a recipient\r\n * @param {string} imparterTag\r\n * @param {Date} since - date to start tally since: date of oldest transaction to include. No restriction if 'null'.\r\n * @param {Object} recepient - imparter specific object describing recipient of transactions to tally for.\r\n *\r\n * > Recipient objects are as per:\r\n * >\r\n * > | imparter tag | recipient object |\r\n * > | --- | --- |\r\n * > | eth-web3 | `{address:..}` |\r\n * > | ohledger | `{address:..}` |\r\n * > | ohledger-web3 | `{address:..}` |\r\n *\r\n * @returns {Promise} with the transactions: `[{\"transaction-value\":..,\"transaction-date\":..},..]`\r\n */\r\n getTransactions = getTransactions;\r\n\r\n /**\r\n * @namespace oh$\r\n * @function isOnLedger\r\n * @description\r\n * Determine if current credentials have some transaction on the imparter's ledger: transaction can be to anyone.\r\n * \r\n * Intent is to validate beyond just a valid address. To validate the address has been used.\r\n * \r\n * May fire [onWalletPopup](#eventonwalletpopup) event against `oh$`.\r\n * @param {string} imparterTag\r\n * @returns {Promise} with 'true' or 'false'; may fire [onWalletPopup](#eventonwalletpopup) event against `oh$`\r\n */\r\n isOnLedger = isOnLedger;\r\n\r\n /**\r\n * @namespace oh$\r\n * @function sign\r\n * @description\r\n * Sign using the provided message using the credentials set against the specific imparter.\r\n * \r\n * Note: wallet might pop up a dialog upon this call, consider that in your UX flow.\r\n * \r\n * May fire [onWalletPopup](#eventonwalletpopup) event against `oh$`.\r\n * @param {string} imparterTag\r\n * @param {string} message - to sign\r\n * @returns {Promise} with the signature; may fire [onWalletPopup](#eventonwalletpopup) event against `oh$`\r\n */\r\n sign = sign;\r\n\r\n /**\r\n * @namespace oh$\r\n * @function createTransaction\r\n * @description\r\n * Create a transaction on the imparter's ledger.\r\n * \r\n * May fire [onWalletPopup](#eventonwalletpopup) event against `oh$`; wallet might pop up a dialog upon this call, consider that in your UX flow.\r\n * @param {string} imparterTag\r\n * @param {number} amount\r\n * @param {string} to - address of recipient\r\n * \r\n * > $0 (*amount*) transactions against *ohledger* or *ohledger-web* *imparters* use the current credential \r\n * > as the *to* address, not the specified *to* address.\r\n * \r\n * @param {Object} options - other options required for the specific imparter.\r\n * \r\n * > The options objects are as follows:\r\n * > \r\n * > | imparter tag | credentials object |\r\n * > | --- | --- |\r\n * > | eth-web3 | null |\r\n * > | ohledger | {message:.., signature:..} |\r\n * > | ohledger-web3 | {message:.., signature:..} |\r\n * > \r\n * > If *message* and *signature* are provided they are used instead of oh$ asking for wallet to resign message.\r\n *\r\n * @returns {Promise} of a 'true' for success or an Error; may fire [onWalletPopup](#eventonwalletpopup) event against `oh$`\r\n */\r\n createTransaction = createTransaction;\r\n }();\r\n\r\n var doEnable = null;\r\n const isEnabled = new Promise((resolve) => doEnable = resolve);\r\n var token = null;\r\n var __fetch = null;\r\n var imparterTags = [ohledger.tag];\r\n\r\n /**\r\n * Function to fire events.\r\n * \r\n * @param {string} which - event name to fire\r\n * @param {Object} params - to copy to event\r\n */\r\n function fire(which, params) {\r\n let event = document.createEvent(\"Event\");\r\n event.initEvent(which, true, true);\r\n for (var param in params) {\r\n event[param] = params[param];\r\n }\r\n oh$.dispatchEvent(event);\r\n }\r\n\r\n /**\r\n * @param {string} tag -- to add to `imparterTags` if not in `imparterTags`\r\n */\r\n function addTag(tag) {\r\n let imparterTagIndex = imparterTags.findIndex(v => v === tag);\r\n if (imparterTagIndex == -1) imparterTags.push(tag);\r\n }\r\n\r\n /**\r\n * @param {string} tag -- to remove from `imparterTags` if in `imparterTags`\r\n */\r\n function removeTag(tag) {\r\n let imparterTagIndex = imparterTags.findIndex(v => v === tag);\r\n if (imparterTagIndex > -1) imparterTags.splice(imparterTagIndex, 1);\r\n }\r\n\r\n const web3Wallet = new web3_wallet(\r\n (tag) => addTag(tag), \r\n (tag) => removeTag(tag),\r\n (which, params) => fire(which, params));\r\n\r\n const overhideWallet = new overhide_wallet();\r\n\r\n const imparters = {};\r\n imparters[eth_web3.tag] = new eth_web3(\r\n web3Wallet, \r\n () => token,\r\n (...args) => __fetch(...args),\r\n (which, params) => fire(which, params));\r\n imparters[ohledger_web3.tag] = new ohledger_web3(\r\n overhideWallet,\r\n web3Wallet,\r\n () => token,\r\n (...args) => __fetch(...args),\r\n (which, params) => fire(which, params)\r\n );\r\n imparters[ohledger.tag] = new ohledger(\r\n overhideWallet,\r\n web3Wallet,\r\n () => token,\r\n (...args) => __fetch(...args),\r\n (which, params) => fire(which, params)\r\n );\r\n\r\n overhideWallet.createPopup();\r\n web3Wallet.detectWeb3Wallet();\r\n\r\n function enable(_token, {fetcher} = {fetcher: fetch}) {\r\n token = _token;\r\n __fetch = fetcher;\r\n doEnable(true);\r\n }\r\n\r\n function getImparterTags() {\r\n return imparterTags;\r\n }\r\n\r\n function canSetCredentials(imparterTag) {\r\n if (!imparterTag in imparters) throw new Error(\"invalid imparterTag\");\r\n \r\n return imparters[imparterTag].canSetCredentials();\r\n }\r\n\r\n function canGenerateCredentials(imparterTag) {\r\n if (!imparterTag in imparters) throw new Error(\"invalid imparterTag\");\r\n \r\n return imparters[imparterTag].canGenerateCredentials();\r\n }\r\n\r\n function canChangeNetwork(imparterTag) {\r\n if (!imparterTag in imparters) throw new Error(\"invalid imparterTag\");\r\n \r\n return imparters[imparterTag].canChangeNetwork();\r\n }\r\n\r\n async function setCredentials(imparterTag, credentials) {\r\n if (!imparterTag in imparters) throw new Error(\"invalid imparterTag\");\r\n \r\n return imparters[imparterTag].setCredentials(credentials);\r\n }\r\n\r\n function getCredentials(imparterTag) {\r\n if (!imparterTag in imparters) throw new Error(\"invalid imparterTag\");\r\n\r\n return imparters[imparterTag].getCredentials();\r\n }\r\n\r\n async function generateCredentials(imparterTag, options) {\r\n if (!imparterTag in imparters) throw new Error(\"invalid imparterTag\");\r\n\r\n return imparters[imparterTag].generateCredentials(options);\r\n }\r\n\r\n async function setNetwork(imparterTag, details) {\r\n if (!imparterTag in imparters) throw new Error(\"invalid imparterTag\");\r\n\r\n return imparters[imparterTag].setNetwork(details);\r\n }\r\n\r\n function getNetwork(imparterTag) {\r\n if (!imparterTag in imparters) throw new Error(\"invalid imparterTag\");\r\n\r\n return imparters[imparterTag].getNetwork(); \r\n }\r\n\r\n function getOverhideRemunerationAPIUri(imparterTag) {\r\n if (!imparterTag in imparters) throw new Error(\"invalid imparterTag\");\r\n\r\n return imparters[imparterTag].getOverhideRemunerationAPIUri(); \r\n }\r\n\r\n async function getFromDollars(imparterTag, dollarAmount) {\r\n if (!imparterTag in imparters) throw new Error(\"invalid imparterTag\");\r\n if (await isEnabled && !__fetch) throw new Error('did you forget to `oh$.enable(..)`?');\r\n\r\n return await imparters[imparterTag].getFromDollars(dollarAmount);\r\n }\r\n\r\n async function getTallyDollars(imparterTag, recipient, date) {\r\n if (!imparterTag in imparters) throw new Error(\"invalid imparterTag\");\r\n if (await isEnabled && !__fetch) throw new Error('did you forget to `oh$.enable(..)`?');\r\n\r\n return await imparters[imparterTag].getTallyDollars(recipient, date);\r\n }\r\n\r\n async function getTally(imparterTag, recipient, date) {\r\n return (await getTxs(imparterTag, recipient, date, true)).tally;\r\n }\r\n\r\n async function getTransactions(imparterTag, recipient, date) {\r\n return (await getTxs(imparterTag, recipient, date, false)).transactions;\r\n }\r\n\r\n async function getTxs(imparterTag, recipient, date, tallyOnly) {\r\n if (!imparterTag in imparters) throw new Error(\"invalid imparterTag\");\r\n if (await isEnabled && !__fetch) throw new Error('did you forget to `oh$.enable(..)`?');\r\n\r\n return await imparters[imparterTag].getTxs(recipient, date, tallyOnly);\r\n }\r\n\r\n async function isOnLedger(imparterTag) {\r\n if (!imparterTag in imparters) throw new Error(\"invalid imparterTag\");\r\n if (await isEnabled && !__fetch) throw new Error('did you forget to `oh$.enable(..)`?');\r\n\r\n return await imparters[imparterTag].isOnLedger();\r\n }\r\n\r\n async function sign(imparterTag, message) {\r\n if (!imparterTag in imparters) throw new Error(\"invalid imparterTag\");\r\n if (await isEnabled && !__fetch) throw new Error('did you forget to `oh$.enable(..)`?');\r\n\r\n return await imparters[imparterTag].sign(message);\r\n }\r\n\r\n async function createTransaction(imparterTag, amount, to, options) {\r\n if (!imparterTag in imparters) throw new Error(\"invalid imparterTag\");\r\n if (await isEnabled && !__fetch) throw new Error('did you forget to `oh$.enable(..)`?');\r\n\r\n return await imparters[imparterTag].createTransaction(amount, to, options);\r\n }\r\n\r\n return root.oh$;\r\n})();\r\n\r\nexport default oh$;","var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://__oh$__/webpack/universalModuleDefinition","webpack://__oh$__/webpack/bootstrap","webpack://__oh$__/./src/fns/imparter_fns.js","webpack://__oh$__/./src/imparters/eth-web3.js","webpack://__oh$__/./src/imparters/ohledger-web3.js","webpack://__oh$__/./src/fns/ohledger_fns.js","webpack://__oh$__/./src/imparters/ohledger.js","webpack://__oh$__/external {\"commonjs\":\"web3\",\"commonjs2\":\"web3\",\"amd\":\"web3\",\"root\":\"Web3\"}","webpack://__oh$__/./src/wallets/web3_wallet.js","webpack://__oh$__/./src/wallets/overhide_wallet.js","webpack://__oh$__/./src/ledgers.js","webpack://__oh$__/(webpack)/buildin/global.js"],"names":["root","factory","exports","module","require","define","amd","window","__WEBPACK_EXTERNAL_MODULE__5__","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","imparter_fns","recipient","date","Date","Error","address","_callee","uri","from","to","tallyOnly","tallyDollars","token","__fetch","since","dollarsQuery","regeneratorRuntime","wrap","_context","prev","next","concat","toISOString","headers","Headers","Authorization","then","res","json","e","String","abrupt","sent","stop","_callee2","signature","message","_context2","method","Content-Type","body","JSON","stringify","btoa","result","status","eth_web3","web3_wallet","getToken","fire","_this","this","_classCallCheck","_defineProperty","main","rinkeby","eth_accounts","networkChangeDelegates","push","network","onNetworkChange","imparterTag","tag","remuneration_uri","credentials","walletAddress","options","details","dollarAmount","hostPrefix","now","length","minrate","getTxs_check_details","getOverhideRemunerationAPIUri","getTxs_retrieve","_callee3","_context3","sign","isSignatureValid_call","_callee4","_context4","web3","eth","personal","_callee5","amount","_context5","Promise","resolve","reject","sendTransaction","on","confirmationNumber","receipt","error","ohledger_web3","overhide_wallet","ohledger_fns","setNetwork_check_details","currency","createTransaction","showOhLedgerGratisIframeUri","oh_ledger_transact_fn","toUpperCase","toLowerCase","signFn","showGratisFn","ohLedgerTransactFn","toLocaleString","ohledger","privateKeyToAccount","secret","recover","err","privateKey","addTag","removeTag","Web3","accounts","ethereum","_asyncToGenerator","mark","enable","t0","detectWalletCb","setInterval","_ref3","currentAccounts","currentAddress","currentNetwork","getAccounts","net","getNetworkType","forEach","isPresent","apply","arguments","prod","test","addEventListener","data","event","makePopupHidden","detail","document","triggerFor","parent","dispatchEvent","CustomEvent","click","_objectSpread","_this2","console","assert","rs","rj","getElementById","style","display","setupNewPromise","params","isError","popup","hideAllPopupContents","frame","setAttribute","makePopupVisible","_this3","createElement","innerHTML","attach","appendChild","loadOhLedgerTransactFns","setTimeout","url","implementationCode","location","scriptTag","src","onload","onreadystatechange","_this4","loadJS","fn","oh_ledger_transact","oh$","self","_typeof","global","_EventTarget","_inherits","_class2","_wrapNativeSuper","EventTarget","_super","_createSuper","_len","args","Array","_key","_assertThisInitialized","getImparterTags","canSetCredentials","canGenerateCredentials","canChangeNetwork","generateCredentials","setCredentials","setNetwork","getCredentials","getNetwork","getFromDollars","getTallyDollars","getTally","getTransactions","isOnLedger","doEnable","isEnabled","imparterTags","which","createEvent","param","initEvent","web3Wallet","findIndex","v","imparterTagIndex","splice","overhideWallet","imparters","_token","fetcher","undefined","fetch","_x","_x2","_setCredentials","_x3","_x4","_generateCredentials","_x5","_x6","_setNetwork","_x7","_x8","_getFromDollars","_x9","_x10","_x11","_getTallyDollars","getTxs","_x12","_x13","_x14","_getTally","_callee6","_context6","_x15","_x16","_x17","_getTransactions","_callee7","_context7","_x18","_x19","_x20","_x21","_x22","_getTxs","_callee8","_context8","_x23","_isOnLedger","_callee9","_context9","_x24","_x25","_sign","_callee10","_context10","_x26","_x27","_x28","_x29","_createTransaction","_callee11","_context11","createPopup","detectWeb3Wallet","g","Function"],"mappings":"CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,EAAAG,QAAA,SACA,mBAAAC,eAAAC,IACAD,OAAA,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AEyC,IAAIhB,MAAM,uCAFnD,cAAA0R,EAAA1Q,KAAA,GAIeiN,EAAUxK,GAAawC,kBAAkBf,EAAQ7E,EAAIyD,GAJpE,eAAA4N,EAAA/P,OAAA,SAAA+P,EAAA9P,MAAA,yBAAA8P,EAAA7P,SAAA4P,OA1mBsBrJ,MAAArF,KAAAsF,WAinBtB,OAtIA4F,EAAUvL,IAASgB,KAAO,IAAIhB,IAC5BiL,EACA,kBAAMnN,GACN,kBAAaC,EAAO2H,WAAP,EAAAC,YACb,SAACkF,EAAO1D,GAAR,OAAmBhH,EAAK0K,EAAO1D,KACjCoE,EAAUrI,IAAclC,KAAO,IAAIkC,IACjCoI,EACAL,EACA,kBAAMnN,GACN,kBAAaC,EAAO2H,WAAP,EAAAC,YACb,SAACkF,EAAO1D,GAAR,OAAmBhH,EAAK0K,EAAO1D,KAEjCoE,EAAUvH,IAAShD,KAAO,IAAIgD,IAC5BsH,EACAL,EACA,kBAAMnN,GACN,kBAAaC,EAAO2H,WAAP,EAAAC,YACb,SAACkF,EAAO1D,GAAR,OAAmBhH,EAAK0K,EAAO1D,KAGjCmE,EAAe2D,cACfhE,EAAWiE,mBAiHJ5U,EAAKsO,IAjnBD,GAonBEA,4CC9uBf,IAAAuG,EAGAA,EAAA,WACA,OAAA9O,KADA,GAIA,IAEA8O,KAAA,IAAAC,SAAA,iBACC,MAAArQ,GAED,iBAAAlE,SAAAsU,EAAAtU,QAOAJ,EAAAD,QAAA2U","file":"ledgers.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"web3\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"__oh$__\", [\"web3\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"__oh$__\"] = factory(require(\"web3\"));\n\telse\n\t\troot[\"__oh$__\"] = factory(root[\"Web3\"]);\n})(window, function(__WEBPACK_EXTERNAL_MODULE__5__) {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 8);\n","class imparter_fns {\r\n static getTxs_check_details(recipient, date) {\r\n if (date && !(date instanceof Date)) throw new Error(\"'date' must be a Date is passed in\");\r\n if (!('address' in recipient) || !recipient.address) throw new Error(\"'address' required in recipient\"); }\r\n\r\n static async getTxs_retrieve(uri, from, to, tallyOnly, tallyDollars, date, token, __fetch) {\r\n if (!uri) throw new Error('no uri for request, unsupported network selected in wallet?');\r\n let since = '';\r\n if (date) {\r\n since = `&since=${date.toISOString()}`;\r\n }\r\n let dollarsQuery = '';\r\n if (tallyDollars) {\r\n dollarsQuery = `&tally-dollars=true`\r\n }\r\n return await __fetch(`${uri}/get-transactions/${from}/${to}?tally-only=${tallyOnly ? 'true' : 'false'}${dollarsQuery}${since}&include-refunds=true`, {\r\n headers: new Headers({\r\n 'Authorization': `Bearer ${token}`\r\n })\r\n })\r\n .then(res => res.json())\r\n .catch(e => {\r\n throw String(e)\r\n }); \r\n }\r\n\r\n static async isSignatureValid_call(uri, signature, message, from, token, __fetch) {\r\n return await __fetch(`${uri}/is-signature-valid`, {\r\n method: \"POST\",\r\n headers: { \r\n 'Content-Type': 'application/json; charset=utf-8',\r\n 'Authorization': `Bearer ${token}`\r\n },\r\n body: JSON.stringify({\r\n signature: btoa(signature),\r\n message: btoa(message),\r\n address: from\r\n })\r\n })\r\n .then((result) => {\r\n if (result.status == 200) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n })\r\n .catch(e => {\r\n throw String(e)\r\n });\r\n }\r\n}\r\n\r\nexport default imparter_fns;","import imparter_fns from '../fns/imparter_fns.js';\r\n\r\nclass eth_web3 {\r\n static tag = 'eth-web3';\r\n\r\n remuneration_uri = {\r\n 'main':'https://ethereum.overhide.io',\r\n 'rinkeby':'https://rinkeby.ethereum.overhide.io'\r\n };\r\n\r\n constructor(web3_wallet, getToken, __fetch, fire) {\r\n this.web3_wallet = web3_wallet;\r\n this.eth_accounts = web3_wallet.eth_accounts;\r\n this.getToken = getToken;\r\n this.__fetch = __fetch;\r\n this.fire = fire;\r\n\r\n web3_wallet.networkChangeDelegates.push((network) => this.onNetworkChange(network));\r\n }\r\n\r\n onNetworkChange(network) {\r\n this.fire('onNetworkChange',{imparterTag: eth_web3.tag, name: network, uri: this.remuneration_uri[network]});\r\n }\r\n\r\n canSetCredentials() {\r\n return false;\r\n }\r\n\r\n canGenerateCredentials() {\r\n return false;\r\n } \r\n\r\n canChangeNetwork() {\r\n return false;\r\n } \r\n\r\n setCredentials(credentials) {\r\n return false;\r\n }\r\n\r\n getCredentials() {\r\n return {\"address\":this.web3_wallet.walletAddress};\r\n } \r\n\r\n generateCredentials(options) {\r\n return false;\r\n } \r\n\r\n setNetwork(details) {\r\n return false;\r\n }\r\n\r\n getNetwork() {\r\n return { \"name\": this.web3_wallet.network, \"uri\": this.remuneration_uri[this.web3_wallet.network]};\r\n } \r\n\r\n getOverhideRemunerationAPIUri() {\r\n return this.remuneration_uri[this.web3_wallet.network]; \r\n } \r\n\r\n async getFromDollars(dollarAmount) {\r\n const hostPrefix = this.web3_wallet.network === 'main' ? '' : 'test.';\r\n const now = (new Date()).toISOString();\r\n const result = await this.__fetch(`https://${hostPrefix}rates.overhide.io/rates/wei/${now}`, {\r\n headers: new Headers({\r\n 'Authorization': `Bearer ${this.getToken()}`\r\n })\r\n })\r\n .then(res => res.json())\r\n .catch(e => {\r\n throw String(e)\r\n });\r\n if (!result || result.length === 0 || ! 'minrate' in result[0] || result[0].minrate === 0) return 0;\r\n return dollarAmount / result[0].minrate;\r\n }\r\n\r\n async getTxs(recipient, date, tallyOnly, tallyDollars) {\r\n imparter_fns.getTxs_check_details(recipient, date);\r\n\r\n const to = recipient.address;\r\n const uri = this.getOverhideRemunerationAPIUri();\r\n\r\n if (!this.web3_wallet.network) throw new Error(\"network must be set in wallet\");\r\n if (!this.web3_wallet.walletAddress) throw new Error(\"from 'walletAddress' not set: use wallet\");\r\n var from = this.web3_wallet.walletAddress;\r\n\r\n return await imparter_fns.getTxs_retrieve(uri, from, to, tallyOnly, tallyDollars, date, this.getToken(), this.__fetch);\r\n } \r\n\r\n async isOnLedger() {\r\n const uri = this.getOverhideRemunerationAPIUri();\r\n if (!this.web3_wallet.network) throw new Error(\"no network for imparter tag\");\r\n if (!this.web3_wallet.walletAddress) throw new Error(\"from 'walletAddress' not set: use wallet\");\r\n const from = this.web3_wallet.walletAddress;\r\n if (!uri) throw new Error('no uri for request, unsupported network selected in wallet?');\r\n const message = 'verify ownership of address by signing';\r\n const signature = await this.sign(message);\r\n\r\n return await imparter_fns.isSignatureValid_call(uri, signature, message, from, this.getToken(), this.__fetch);\r\n }\r\n\r\n async sign(message) {\r\n if (!this.web3_wallet.walletAddress) throw new Error(`imparter ${eth_web3.tag} not active`);\r\n this.fire('onWalletPopup', {imparterTag: eth_web3.tag});\r\n return (await window.web3.eth.personal.sign(message, this.web3_wallet.walletAddress, ''));\r\n }\r\n\r\n async createTransaction(amount, to, options) {\r\n if (!this.web3_wallet.network) throw new Error(\"no network for imparter tag\");\r\n if (!this.web3_wallet.walletAddress) throw new Error(\"from 'walletAddress' not set: use wallet\");\r\n const from = this.web3_wallet.walletAddress;\r\n const uri = this.getOverhideRemunerationAPIUri();\r\n\r\n this.fire('onWalletPopup', {imparterTag: eth_web3.tag});\r\n await (new Promise((resolve, reject) => {\r\n window.web3.eth.sendTransaction({ from: from, to: to, value: amount })\r\n .on('confirmation', function (confirmationNumber, receipt) {\r\n resolve();\r\n })\r\n .on('error', (error) => {\r\n reject(error);\r\n }); \r\n }));\r\n\r\n return true;\r\n } \r\n}\r\n\r\nexport default eth_web3;","import ohledger_fns from '../fns/ohledger_fns.js';\r\nimport imparter_fns from '../fns/imparter_fns.js';\r\n\r\nclass ohledger_web3 {\r\n static tag = 'ohledger-web3';\r\n\r\n mode = 'test';\r\n\r\n constructor(overhide_wallet, web3_wallet, getToken, __fetch, fire) {\r\n this.web3_wallet = web3_wallet;\r\n this.overhide_wallet = overhide_wallet;\r\n this.__fetch = __fetch;\r\n this.getToken = getToken;\r\n this.fire = fire;\r\n }\r\n\r\n canSetCredentials() {\r\n return false;\r\n } \r\n\r\n canGenerateCredentials() {\r\n return false;\r\n } \r\n\r\n canChangeNetwork() {\r\n return true;\r\n } \r\n \r\n setCredentials(credentials) {\r\n return false;\r\n } \r\n\r\n getCredentials() {\r\n return {\"address\": this.web3_wallet.walletAddress};\r\n } \r\n\r\n generateCredentials(options) {\r\n return false;\r\n }\r\n\r\n setNetwork(details) {\r\n ohledger_fns.setNetwork_check_details(details);\r\n\r\n this.mode = details.mode;\r\n this.fire('onNetworkChange', { imparterTag: ohledger_web3.tag, currency: 'USD', mode: details.mode, uri: this.overhide_wallet.remuneration_uri[details.mode] });\r\n return true;\r\n }\r\n\r\n getNetwork() {\r\n return { \"currency\": \"USD\", \"mode\": this.mode, \"uri\": this.overhide_wallet.remuneration_uri[this.mode]};\r\n }\r\n\r\n getOverhideRemunerationAPIUri() {\r\n if (!this.mode) throw new Error(\"network 'mode' must be set, use setNetwork\");\r\n return this.overhide_wallet.remuneration_uri[this.mode];\r\n }\r\n\r\n async getFromDollars(dollarAmount) {\r\n return dollarAmount * 100;\r\n }\r\n\r\n async getTxs(recipient, date, tallyOnly, tallyDollars) {\r\n imparter_fns.getTxs_check_details(recipient, date);\r\n\r\n const to = recipient.address;\r\n const uri = this.getOverhideRemunerationAPIUri();\r\n\r\n if (!this.mode) throw new Error(\"network 'mode' must be set, use setNetwork\");\r\n if (!this.web3_wallet.walletAddress) throw new Error(\"from 'walletAddress' not set: use wallet\");\r\n var from = this.web3_wallet.walletAddress;\r\n\r\n return await imparter_fns.getTxs_retrieve(uri, from, to, tallyOnly, tallyDollars, date, this.getToken(), this.__fetch);\r\n } \r\n\r\n async isOnLedger() {\r\n const uri = this.getOverhideRemunerationAPIUri();\r\n if (!this.mode) throw new Error(\"network 'mode' must be set, use setNetwork\");\r\n if (!this.web3_wallet.walletAddress) throw new Error(\"from 'walletAddress' not set: use wallet\");\r\n const from = this.web3_wallet.walletAddress;\r\n if (!uri) throw new Error('no uri for request, unsupported network selected in wallet?');\r\n const message = 'verify ownership of address by signing';\r\n const signature = await this.sign(message);\r\n\r\n return await imparter_fns.isSignatureValid_call(uri, signature, message, from, this.getToken(), this.__fetch);\r\n }\r\n\r\n async sign(message) {\r\n if (!this.web3_wallet.walletAddress) throw new Error(`imparter ${ohledger_web3.tag} not active`);\r\n this.fire('onWalletPopup', {imparterTag: ohledger_web3.tag});\r\n return (await window.web3.eth.personal.sign(message, this.web3_wallet.walletAddress, ''));\r\n }\r\n\r\n async createTransaction(amount, to, options) {\r\n if (!this.mode) throw new Error(\"network 'mode' must be set, use setNetwork\");\r\n if (!this.web3_wallet.walletAddress) throw new Error(\"from 'walletAddress' not set: use wallet\");\r\n const from = this.web3_wallet.walletAddress;\r\n const uri = this.getOverhideRemunerationAPIUri();\r\n\r\n await ohledger_fns.createTransaction(\r\n amount, \r\n from,\r\n to,\r\n (message) => this.sign(message),\r\n (from, signature, message) => this.overhide_wallet.showOhLedgerGratisIframeUri(uri, from, signature, message), \r\n this.overhide_wallet.oh_ledger_transact_fn[this.mode], \r\n options);\r\n\r\n return true;\r\n } \r\n}\r\n\r\nexport default ohledger_web3;","class ohledger_fns {\r\n static setNetwork_check_details(details) {\r\n if (!('currency' in details)) throw new Error(\"'currency' must be passed in\");\r\n if (!('mode' in details)) throw new Error(\"'mode' must be passed in\");\r\n details.currency = details.currency.toUpperCase();\r\n details.mode = details.mode.toLowerCase();\r\n if (details.currency !== 'USD') throw new Error(\"'currency' must be 'USD'\");\r\n if (details.mode !== 'prod' && details.mode !== 'test') throw new Error(\"'mode' must be 'prod' or 'test'\"); \r\n }\r\n\r\n static async createTransaction(amount, from, to, signFn, showGratisFn, ohLedgerTransactFn, options) {\r\n if (amount == 0) {\r\n if ('message' in options && options.message && 'signature' in options && options.signature) {\r\n var message = options.message;\r\n var signature = options.signature;\r\n } else {\r\n var message = `verify ownership of address by signing on ${new Date().toLocaleString()}`;\r\n var signature = await signFn(message);\r\n }\r\n await showGratisFn(from, signature, message);\r\n } else {\r\n await ohLedgerTransactFn(amount, from, to);\r\n }\r\n }\r\n}\r\n\r\nexport default ohledger_fns;","import ohledger_fns from '../fns/ohledger_fns.js';\r\nimport imparter_fns from '../fns/imparter_fns.js';\r\n\r\nclass ohledger {\r\n static tag = 'ohledger';\r\n\r\n address = null;\r\n secret = null;\r\n mode = 'test';\r\n\r\n constructor(overhide_wallet, web3_wallet, getToken, __fetch, fire) {\r\n this.overhide_wallet = overhide_wallet;\r\n this.eth_accounts = web3_wallet.eth_accounts;\r\n this.getToken = getToken;\r\n this.__fetch = __fetch;\r\n this.fire = fire;\r\n }\r\n\r\n canSetCredentials() {\r\n return true;\r\n } \r\n\r\n canGenerateCredentials() {\r\n return true;\r\n } \r\n\r\n canChangeNetwork() {\r\n return true;\r\n } \r\n\r\n setCredentials(credentials) {\r\n if (!('secret' in credentials)) throw new Error(\"'secret' must be passed in\");\r\n if ('address' in credentials && credentials.address) {\r\n this.address = credentials.address.toLowerCase();\r\n } else {\r\n this.address = this.eth_accounts.privateKeyToAccount(credentials.secret).address.toLowerCase();\r\n }\r\n this.secret = credentials.secret;\r\n try {\r\n if (!(this.eth_accounts.recover(this.eth_accounts.sign('test message', this.secret)).toLowerCase() == this.address)) {\r\n throw new Error(\"'secret' not valid for 'address\");\r\n }\r\n } catch (err) {\r\n throw new Error(\"'secret' not valid for 'address\");\r\n } \r\n this.fire('onCredentialsUpdate', { imparterTag: ohledger.tag, address: this.address, secret: this.secret});\r\n return true;\r\n } \r\n\r\n getCredentials() {\r\n return {\"address\":this.address, \"secret\":this.secret};\r\n }\r\n\r\n generateCredentials(options) {\r\n const res = this.eth_accounts.create();\r\n this.address = res.address.toLowerCase();\r\n this.secret = res.privateKey;\r\n this.fire('onCredentialsUpdate', { imparterTag: ohledger.tag, address: this.address, secret: this.secret});\r\n return true;\r\n }\r\n\r\n setNetwork(details) {\r\n ohledger_fns.setNetwork_check_details(details);\r\n\r\n this.mode = details.mode;\r\n this.fire('onNetworkChange', { imparterTag: ohledger.tag, currency: 'USD', mode: details.mode, uri: this.overhide_wallet.remuneration_uri[details.mode]});\r\n return true;\r\n } \r\n\r\n getNetwork() {\r\n return { \"currency\": \"USD\", \"mode\": this.mode, \"uri\": this.overhide_wallet.remuneration_uri[this.mode]};\r\n }\r\n\r\n getOverhideRemunerationAPIUri() {\r\n if (!this.mode) throw new Error(\"network 'mode' must be set, use setNetwork\");\r\n return this.overhide_wallet.remuneration_uri[this.mode];\r\n }\r\n\r\n async getFromDollars(dollarAmount) {\r\n return dollarAmount * 100;\r\n }\r\n\r\n async getTxs(recipient, date, tallyOnly, tallyDollars) {\r\n imparter_fns.getTxs_check_details(recipient, date);\r\n\r\n const to = recipient.address;\r\n const uri = this.getOverhideRemunerationAPIUri();\r\n\r\n if (!this.mode) throw new Error(\"network 'mode' must be set, use setNetwork\");\r\n if (!this.address) throw new Error(\"from 'address' not set: use setCredentials\");\r\n const from = this.address;\r\n\r\n return await imparter_fns.getTxs_retrieve(uri, from, to, tallyOnly, tallyDollars, date, this.getToken(), this.__fetch);\r\n }\r\n\r\n async isOnLedger() {\r\n const uri = this.getOverhideRemunerationAPIUri();\r\n if (!this.mode) throw new Error(\"network 'mode' must be set, use setNetwork\");\r\n if (!this.address) throw new Error(\"from 'address' not set: use setCredentials\");\r\n const from = this.address;\r\n if (!uri) throw new Error('no uri for request, unsupported network selected in wallet?');\r\n const message = 'verify ownership of address by signing';\r\n const signature = await this.sign(message);\r\n\r\n return await imparter_fns.isSignatureValid_call(uri, signature, message, from, this.getToken(), this.__fetch);\r\n }\r\n\r\n async sign(message) {\r\n if (!this.secret) throw new Error(`credentials for imparter ${ohledger.tag} not set`);\r\n return this.eth_accounts.sign(message, this.secret).signature;\r\n }\r\n\r\n async createTransaction(amount, to, options) {\r\n if (!this.mode) throw new Error(\"network 'mode' must be set, use setNetwork\");\r\n if (!this.address) throw new Error(\"from 'address' not set: use setCredentials\");\r\n const from = this.address;\r\n const uri = this.getOverhideRemunerationAPIUri();\r\n\r\n await ohledger_fns.createTransaction(\r\n amount, \r\n from,\r\n to,\r\n (message) => this.sign(message),\r\n (from, signature, message) => this.overhide_wallet.showOhLedgerGratisIframeUri(uri, from, signature, message), \r\n this.overhide_wallet.oh_ledger_transact_fn[this.mode], \r\n options);\r\n\r\n return true;\r\n } \r\n}\r\n\r\nexport default ohledger;","module.exports = __WEBPACK_EXTERNAL_MODULE__5__;","import Web3 from 'web3';\r\nimport eth_web3 from '../imparters/eth-web3.js';\r\nimport ohledger_web3 from '../imparters/ohledger-web3.js';\r\n\r\nconst WALLET_CHECK_INTERVAL_MS = 500;\r\n\r\nclass web3_wallet {\r\n eth_accounts = (new Web3('http://localhost:8545')).eth.accounts;\r\n walletAddress = null;\r\n network = null;\r\n\r\n networkChangeDelegates = [];\r\n\r\n constructor(addTag, removeTag, fire) {\r\n this.addTag = addTag;\r\n this.removeTag = removeTag;\r\n this.fire = fire;\r\n }\r\n\r\n /**\r\n * Setup window.web3 to be the wallet's if available or offline if not (just for signing).\r\n * \r\n * Sets up a timer to check for wallet being logged in and address changes.\r\n * \r\n * @ignore\r\n */\r\n detectWeb3Wallet() { \r\n if (!window.ethereum) return;\r\n \r\n // Modern dapp browsers...\r\n (async () => {\r\n try {\r\n await window.ethereum.enable();\r\n window.web3 = new Web3(window.ethereum);\r\n } catch (e) {/*noop*/ }\r\n\r\n await detectWalletCb();\r\n\r\n setInterval(async function () {\r\n await detectWalletCb();\r\n }, WALLET_CHECK_INTERVAL_MS);\r\n })();\r\n\r\n var detectWalletCb = async () => {\r\n try {\r\n var currentAccounts = await window.web3.eth.getAccounts();\r\n var currentAddress = (currentAccounts && currentAccounts.length > 0) ? currentAccounts[0] : null;\r\n var currentNetwork = (await window.web3.eth.net.getNetworkType());\r\n } catch (e) {/*noop*/}\r\n if (currentNetwork !== this.network) {\r\n this.network = currentNetwork;\r\n this.networkChangeDelegates.forEach(d => d(this.network)); \r\n }\r\n if (currentAddress !== this.walletAddress) {\r\n if (currentAddress) { /* add imparters */\r\n this.addTag(eth_web3.tag);\r\n this.addTag(ohledger_web3.tag);\r\n } else { /* remove imparters */\r\n this.removeTag(eth_web3.tag);\r\n this.removeTag(ohledger_web3.tag);\r\n } \r\n this.walletAddress = currentAddress;\r\n this.fire('onWalletChange', { imparterTag: eth_web3.tag, isPresent: !!currentAddress });\r\n this.fire('onWalletChange', { imparterTag: ohledger_web3.tag, isPresent: !!currentAddress });\r\n if (currentAddress) {\r\n this.fire('onCredentialsUpdate', { imparterTag: eth_web3.tag, address: currentAddress });\r\n this.fire('onCredentialsUpdate', { imparterTag: ohledger_web3.tag, address: currentAddress });\r\n }\r\n }\r\n }\r\n } \r\n}\r\n\r\nexport default web3_wallet;","class overhide_wallet {\r\n resolve = null;\r\n reject = null;\r\n\r\n oh_ledger_transact_fn = {\r\n 'prod': null,\r\n 'test': null\r\n };\r\n\r\n remuneration_uri = {\r\n 'prod': 'https://ledger.overhide.io/v1',\r\n 'test': 'https://test.ledger.overhide.io/v1'\r\n }\r\n\r\n constructor() {\r\n window.addEventListener('message', (e) => {\r\n if (e.data && e.data.event === 'oh-ledger-ok') {\r\n this.makePopupHidden(e.data.detail);\r\n } else if (e.data && e.data.event === 'oh-ledger-error') {\r\n this.makePopupHidden(e.data.detail, true);\r\n }\r\n }, false);\r\n\r\n window.document.addEventListener('oh$-popup-close', (e) => {\r\n this.makePopupHidden('user close', true);\r\n }); \r\n }\r\n\r\n // raise oh$-event\r\n // @param {string} imparterTag\r\n // @param {string} triggerFor \r\n // @param {Object} data - to stringify and sent as event.details.\r\n raiseEventClick(imparterTag, triggerFor) {\r\n window.parent.document.dispatchEvent(new CustomEvent('oh$-event', {detail: JSON.stringify({\r\n imparterTag: imparterTag,\r\n triggerFor: triggerFor,\r\n click: true\r\n })}));\r\n }\r\n\r\n // raise oh$-event\r\n // @param {string} imparterTag\r\n // @param {string} triggerFor \r\n // @param {Object} data - to stringify and sent as event.details.\r\n raiseEvent(imparterTag, triggerFor, data) {\r\n window.parent.document.dispatchEvent(new CustomEvent('oh$-event', {detail: JSON.stringify({\r\n ...data,\r\n imparterTag: imparterTag,\r\n triggerFor: triggerFor\r\n })})); \r\n }\r\n\r\n // promise used for popups and resolutions via oh-ledger-* messages.\r\n setupNewPromise() {\r\n console.assert(!this.resolve, 'oh-popup promise being set but already set when calling setupNewPromise(..)');\r\n return new Promise((rs, rj) => {\r\n this.resolve = rs;\r\n this.reject = rj;\r\n }); \r\n }\r\n\r\n // make popup visible to be hidden with makePopupHidden\r\n makePopupVisible() {\r\n var popup = document.getElementById('oh-popup-container');\r\n popup.style.display='block';\r\n return this.setupNewPromise();\r\n }\r\n\r\n makePopupHidden(params, isError) {\r\n var popup = document.getElementById('oh-popup-container');\r\n this.hideAllPopupContents();\r\n popup.style.display='none';\r\n console.assert(this.resolve, 'oh-popup promise not set yet calling makePopupHidden(..)');\r\n if (isError) this.reject(params)\r\n else this.resolve(params);\r\n this.resolve = null;\r\n this.reject = null;\r\n }\r\n\r\n hideAllPopupContents() {\r\n document.getElementById('oh-ledger-gratis-iframe').style.display='none';\r\n }\r\n\r\n async showOhLedgerGratisIframeUri(uri, from, signature, message) {\r\n this.hideAllPopupContents();\r\n var frame = document.getElementById('oh-ledger-gratis-iframe');\r\n frame.setAttribute('src', `${uri}/gratis.html?address=${from}&signature=${signature}&message=${message}`);\r\n frame.style.display='block'; \r\n await this.makePopupVisible();\r\n }\r\n\r\n createPopup() {\r\n var popup = document.createElement('div');\r\n popup.setAttribute('id','oh-popup-container');\r\n popup.style.display='none';\r\n popup.innerHTML = `\r\n
\r\n X\r\n \r\n
\r\n `;\r\n var style = document.createElement('style');\r\n style.innerHTML =`\r\n #oh-popup-container {\r\n position: fixed;\r\n font-family: arial, \"lucida console\", sans-serif;\r\n top: 0;\r\n right: 0;\r\n bottom: 0;\r\n left: 0;\r\n background: rgba(0, 0, 0, 0.8);\r\n z-index: 999;\r\n opacity:1;\r\n pointer-events: auto;\r\n }\r\n #oh-popup-container > div {\r\n width: 80vw;\r\n height: 75vh;\r\n position: relative;\r\n top: 15vh;\r\n margin: auto auto;\r\n padding: 5px 5px 5px 5px;\r\n background: white;\r\n }\r\n #oh-popup-close {\r\n background: grey;\r\n color: white;\r\n line-height: 25px;\r\n position: absolute;\r\n right: 2px;\r\n text-align: center;\r\n top: 2px;\r\n width: 24px;\r\n text-decoration: none;\r\n font-weight: bold;\r\n }\r\n #oh-popup-close:hover {\r\n background: black;\r\n }\r\n\r\n #oh-ledger-gratis-iframe {\r\n display: none;\r\n border: 0;\r\n overflow: hidden;\r\n width: 100%;\r\n height: 100%;\r\n }\r\n `;\r\n var attach = () => {\r\n if (document.body) {\r\n document.body.appendChild(popup);\r\n document.body.appendChild(style);\r\n this.loadOhLedgerTransactFns();\r\n } else {\r\n setTimeout(attach, 100);\r\n };\r\n };\r\n attach();\r\n }\r\n\r\n // https://stackoverflow.com/a/31374433\r\n loadJS(url, implementationCode, location) {\r\n //url is URL of external file, implementationCode is the code\r\n //to be called from the file, location is the location to \r\n //insert the \r\n * \r\n * \r\n * ```\r\n * \r\n * #### IMPARTERS\r\n * \r\n * The library works with a concept of *imprater* tags. Wallets impart credentials, signatures, and transactions. For\r\n * *loose change*--where no wallet exists--the library can be interrogated as to which entities should be set by the \r\n * user (can* functions); causing the entities to be imparted back to the user in a common code flow. \r\n * \r\n * The imparter tags are a simple naming convention. For example if multiple Ethereum wallet APIs were imparting data \r\n * they would be individually tagged with a prefix \"eth\" and a dashed suffix. No suffix indicates a *loose change*\r\n * imparter:\r\n * \r\n * - eth-web3\r\n * - eth-?\r\n * \r\n * Similarly for *overhide-ledger*, the prefix is \"ohledger\", the suffix won't be attached on the *loose change* version \r\n * and will be suffixed on the *web3* walleted version:\r\n * \r\n * - ohledger\r\n * - ohledger-web3\r\n * \r\n * The following sections cover special notes on each imparter. The library adheres to these notes.\r\n * \r\n * ##### eth-web3\r\n * \r\n * Ethereum addresses are 20 bytes: 42 character 'hex' strings prefixed with '0x'.\r\n * \r\n * Ethereum secret keys for signing addresses are 32 bytes: 66 character 'hex' strings prefixed with '0x'.\r\n * \r\n * Ethereum networks names are:\r\n * \r\n * * main\r\n * * kovan\r\n * * rinkeyby\r\n * * ropsten\r\n * \r\n * The denomination for amounts is the Wei\r\n * \r\n * ##### ohledger, ohledger-web3\r\n * \r\n * Addresses and secret keys use Ethereum format.\r\n * \r\n * Addresses are 20 bytes: 42 character 'hex' strings prefixed with '0x'.\r\n * \r\n * Secret keys for signing addresses are 32 bytes: 66 character 'hex' strings prefixed with '0x'.\r\n * \r\n * Network tuples consist of a 'currency' as a three letter ISO fiat currency code and a 'mode'. The supported\r\n * 'currency' names are:\r\n * \r\n * * 'USD'\r\n * \r\n * The denominations are:\r\n * \r\n * | Currency | denomination |\r\n * | --- | --- |\r\n * | USD | cents |\r\n * \r\n * Note: at this point only USD are supported. If there is a need, and *overhide-ledger* instances in currencies\r\n * other than USD come online, we'll revisit this.\r\n *\r\n * An 'ohledger' mode is on of 'prod' or 'test'\r\n * \r\n */\r\nconst oh$ = (function() {\r\n\r\n var root = typeof self == 'object' && self.self === self && self ||\r\n typeof global == 'object' && global.global === global && global ||\r\n this ||\r\n {};\r\n\r\n root.oh$ = new class extends EventTarget {\r\n /**\r\n * @event onWalletChange\r\n * @param {Object} event object - the event object passed in will have additional attributes\r\n *\r\n * > The new event object will conform to the following:\r\n * >\r\n * > | imparter tag | event object attributes |\r\n * > | --- | --- |\r\n * > | * | `{imparterTag:..,isPresent:..}` |\r\n * >\r\n * > *imparterTag* - causing the event\r\n * >\r\n * > *isPresent* - if wallet is present for imparter\r\n *\r\n * @description\r\n * Event called when wallets' state changes.\r\n * \r\n * In user code:\r\n * \r\n * ```\r\n * oh$.addEventListener('onWalletChange', (e) => console.log(`wallet for ${e.imparterTag} is available:${e.isPresent}`));\r\n * ```\r\n */\r\n\r\n /**\r\n * @event onWalletPopup\r\n * @param {Object} event object - the event object passed in will have additional attributes\r\n *\r\n * > The new event object will conform to the following:\r\n * >\r\n * > | imparter tag | event object attributes |\r\n * > | --- | --- |\r\n * > | * | `{imparterTag:..}` |\r\n * >\r\n * > *imparterTag* - causing the pop-up\r\n *\r\n * @description\r\n * Event called when wallet is expected to popup. Useful in case user wants to react to popup in UI.\r\n * \r\n * In user code:\r\n * \r\n * ```\r\n * oh$.addEventListener('onWalletPopup', (e) => console.log(`wallet for ${e.imparterTag} popped`));\r\n * ```\r\n */\r\n\r\n /**\r\n * @event onCredentialsUpdate\r\n * @description\r\n * Event called when an credentials change for one of the tracked imparters.\r\n * \r\n * Only called when credentials are valid as per imparter: ready to be used for signing, transacting.\r\n *\r\n * In user code:\r\n *\r\n * ```\r\n * oh$.addEventListener('onCredentialsUpdate', (e) => {\r\n * if (e.imparterTag === 'eth-web3') console.log(`new address for ${e.imparterTag} is:${e.address}`);\r\n * return;\r\n * });\r\n * ```\r\n * @param {Object} event object - the event object passed in will have additional attributes\r\n * \r\n * > The new event object will conform to the following:\r\n * >\r\n * > | imparter tag | event object attributes |\r\n * > | --- | --- |\r\n * > | eth-web3 | `{imparterTag:..,address:..}` |\r\n * > | ohledger | `{imparterTag:..,address:..,secret:..}` |\r\n * > | ohledger-web3 | `{imparterTag:..,address:..}` |\r\n * >\r\n * > *imparterTag* - causing the event\r\n * >\r\n * > *address* - ledger public address of credential set for imparter\r\n * >\r\n * > *secret* - ledger PKI private secret for credential set for imparter\r\n *\r\n */\r\n\r\n /**\r\n * @event onNetworkChange\r\n * @description\r\n * Event called when the network changes for a particular imparter tag.\r\n * \r\n * For example for \"eth\" the network could changed from \"main\" to \"rinkeby\". \r\n * \r\n * In user code:\r\n *\r\n * ```\r\n * oh$.addEventListener('onNetworkChange', (e) => {\r\n * if (e.imparterTag === 'eth-web3') console.log(`new network selected for ${e.imparterTag} is:${e.name}`);\r\n * if (e.imparterTag === /ohledger/.test(e.imparterTag)) console.log(`working in currency: ${e.currency}`);\r\n * return;\r\n * });\r\n * ```\r\n * @param {Object} event object - the event object passed in will have additional attributes\r\n *\r\n * > The new credentials object will conform to the following:\r\n * >\r\n * > | imparter tag | event object attributes |\r\n * > | --- | --- |\r\n * > | eth-web3 | `{imparterTag:..,name:('main'|'rinkeby'|'kovan').., uri:..}` |\r\n * > | ohledger | `{imparterTag:..,currency:'USD',mode:('prod'|'test'), uri:..}` |\r\n * > | ohledger-web3 | `{imparterTag:..,currency:'USD',mode:('prod'|'test'), uri:..}` |\r\n * >\r\n * > *imparterTag* - causing the event\r\n * >\r\n * > *name* - of network\r\n * >\r\n * > *currency* - represented by network\r\n * >\r\n * > *mode* - production or test network\r\n * >\r\n * > *uri* - remuneration API URI for network\r\n *\r\n */\r\n\r\n /**\r\n * @namespace oh$\r\n * @function enable\r\n * @description\r\n * Enable `oh$` by instrumenting with token for ledger access.\r\n * \r\n * `oh$` calls may stall while waiting for this call to complete successfully.\r\n * \r\n * A token can be retrieved with a `GET /token` call (see https://token.overhide.io/swagger.html).\r\n * \r\n * To retrieve tokens please first register for your own API key at https://token.overhide.io/register.\r\n * @param {string} token\r\n */\r\n enable = enable;\r\n\r\n /**\r\n * @namespace oh$\r\n * @function getImparterTags\r\n * @description\r\n * Retrieves all imparter tags injected by wallets and statically available from the library.\r\n * @returns {Array} of strings: the imparter tags available\r\n */\r\n getImparterTags = getImparterTags;\r\n\r\n /**\r\n * @namespace oh$\r\n * @function canSetCredentials\r\n * @description\r\n * Interrogate whether the imparter tag can have credentials set by the user: or does the wallet control it\r\n * exclusively.\r\n * \r\n * Only the following imparter(s) will return 'true':\r\n * \r\n * - ohledger\r\n * \r\n * @param {string} imparterTag\r\n * @returns {boolean} 'true' if particular imparter tag can have credentials set.\r\n */\r\n canSetCredentials = canSetCredentials;\r\n\r\n /**\r\n * @namespace oh$\r\n * @function canGenerateCredentials\r\n * @description\r\n * Interrogate whether the imparter tag can have credentials generated by the user: or does the wallet control it\r\n * exclusively.\r\n *\r\n * Only the following imparter(s) will return 'true':\r\n *\r\n * - ohledger\r\n *\r\n * @param {string} imparterTag\r\n * @returns {boolean} 'true' if particular imparter tag can have credentials generated.\r\n */\r\n canGenerateCredentials = canGenerateCredentials;\r\n\r\n /**\r\n * @namespace oh$\r\n * @function canChangeNetwork\r\n * @description\r\n * Interrogate whether the imparter tag can have network changed by the user via oh$: or does the wallet control it\r\n * exclusively.\r\n *\r\n * Only the following imparter(s) will return 'true':\r\n *\r\n * - ohledger\r\n * - ohledger-web3\r\n *\r\n * @param {string} imparterTag\r\n * @returns {boolean} 'true' if particular imparter tag can have networks changed via oh$.\r\n */\r\n canChangeNetwork = canChangeNetwork;\r\n\r\n /**\r\n * @namespace oh$\r\n * @function generateCredentials\r\n * @description\r\n * For imparters that can have credentials generated, generates them. \r\n * \r\n * Fires [onCredentialsUpdate](#eventoncredentialsupdate) event against `oh$`\r\n * @param {string} imparterTag\r\n * @param {Object} options - imparter specific generation options, if any.\r\n * \r\n * > The options objects are as follows:\r\n * >\r\n * > | imparter tag | credentials object |\r\n * > | --- | --- |\r\n * > | eth-web3 | N/A |\r\n * > | ohledger | null |\r\n * > | ohledger-web3 | N/A |\r\n *\r\n * @returns {Promise} representing a 'true' if success else 'false'; also fires [onCredentialsUpdate](#eventoncredentialsupdate) event against `oh$`\r\n\r\n */\r\n generateCredentials = generateCredentials;\r\n\r\n /**\r\n * @namespace oh$\r\n * @function setCredentials\r\n * @description\r\n * For imparters that can have credentials set, sets them. \r\n * \r\n * Fires [onCredentialsUpdate](#eventoncredentialsupdate) event against `oh$`.\r\n * @param {string} imparterTag\r\n * @param {Object} credentials - credentials object of imparter specific parameters to set\r\n * \r\n * > The credentials objects are as follows:\r\n * >\r\n * > | imparter tag | credentials object | comments |\r\n * > | --- | --- | --- |\r\n * > | eth-web3 | N/A | |\r\n * > | ohledger | `{address:..,secret:..}` | `address` is optional, if not set will be extracted from `secret` |\r\n * > | ohledger-web3 | N/A | |\r\n *\r\n * @returns {Promise} representing a 'true' if success else 'false'; also fires [onCredentialsUpdate](#eventoncredentialsupdate) event against `oh$`\r\n */\r\n setCredentials = setCredentials;\r\n\r\n /**\r\n * @namespace oh$\r\n * @function setNetwork\r\n * @description\r\n * For imparters that can have networks changed via oh$, changes it. \r\n * \r\n * Fires [onNetworkChange](#eventonnetworkchange) event against `oh$`.\r\n * @param {string} imparterTag\r\n * @param {Object} details - network details object of imparter specific parameters to set.\r\n * \r\n * > The network details objects are as follows:\r\n * >\r\n * > | imparter tag | network details object |\r\n * > | --- | --- |\r\n * > | eth-web3 | N/A |\r\n * > | ohledger | `{currency:'USD', mode:'prod'|'test'}` |\r\n * > | ohledger-web3 | `{currency:'USD', mode:'prod'|'test'}` |\r\n *\r\n * @returns {Promise} representing a 'true' if success else 'false'; also fires [onNetworkChange](#eventonnetworkchange) event against `oh$`\r\n */\r\n setNetwork = setNetwork;\r\n\r\n /**\r\n * @namespace oh$\r\n * @function getOverhideRemunerationAPIUri\r\n * @description\r\n * Based on current network set returns the *overhide* remuneration API URI configured in the library.\r\n * @param {string} imparterTag\r\n * @returns {string} the URI.\r\n */\r\n getOverhideRemunerationAPIUri = getOverhideRemunerationAPIUri;\r\n\r\n /**\r\n * @namespace oh$\r\n * @function getCredentials\r\n * @description\r\n * Retrieves current credentials for an imparterTag.\r\n * @param {string} imparterTag\r\n * @returns {Object} details - an object describing current credentials, imparterTag dependant:\r\n * \r\n * > | imparter tag | credentials object |\r\n * > | --- | --- |\r\n * > | eth-web3 | `{address:..}` |\r\n * > | ohledger | `{address:..,secret:..}` |\r\n * > | ohledger-web3 | `{address:..}` |\r\n */\r\n getCredentials = getCredentials;\r\n\r\n /**\r\n * @namespace oh$\r\n * @function getNetwork\r\n * @description\r\n * Retrieves current network for an imparterTag.\r\n * @param {string} imparterTag\r\n * @returns {Object} details - an object describing current network, imparterTag dependant:\r\n * \r\n * > | imparter tag | network details object |\r\n * > | --- | --- |\r\n * > | eth-web3 | `{name:('main'|'rinkeby'|'kovan').., uri:..}` |\r\n * > | ohledger | `{currency:'USD',mode:('prod'|'test'), uri:..}` |\r\n * > | ohledger-web3 | `{currency:'USD',mode:('prod'|'test'), uri:..}` |\r\n */\r\n getNetwork = getNetwork;\r\n\r\n /**\r\n * @namespace oh$\r\n * @function getFromDollars\r\n * @description\r\n * Retrieve a (highest) converted amount in imparter specific denomination from a provided dollar amount at a very recent exchange rate.\r\n * @param {string} imparterTag\r\n * @param {number} dollarAmount - the dollar amount.\r\n * @returns {Promise} with the value in imparter specific currency at the present time (based on recent exchange rate).\r\n */\r\n getFromDollars = getFromDollars;\r\n\r\n /**\r\n * @namespace oh$\r\n * @function getTallyDollars\r\n * @description\r\n * Retrieve a tally of all transactions on the imparter's ledger--perhaps within a date range--converted to a US dollar amount.\r\n * @param {string} imparterTag\r\n * @param {Object} recepient - imparter specific object describing recipient of transactions to tally for.\r\n *\r\n * > Recipient objects are as per:\r\n * >\r\n * > | imparter tag | recipient object |\r\n * > | --- | --- |\r\n * > | eth-web3 | `{address:..}` |\r\n * > | ohledger | `{address:..}` |\r\n * > | ohledger-web3 | `{address:..}` |\r\n *\r\n * @param {Date} since - date to start tally since: date of oldest transaction to include. No restriction if 'null'.\r\n * @returns {Promise} with the `{'tally':.., 'as-of':..}` object, whereby the 'tally' value is in US dollars: all transactions \r\n * are exchanged to USD at an approximate (highest) exchange rate close to the transactions' time. The 'as-of' timestamp \r\n * is that of the call (pass this to back-end to retrieve cached values at better API call rates).\r\n */\r\n getTallyDollars = getTallyDollars;\r\n\r\n /**\r\n * @namespace oh$\r\n * @function getTally\r\n * @description\r\n * Retrieve a tally of all transactions on the imparter's ledger--perhaps within a date range.\r\n * @param {string} imparterTag\r\n * @param {Object} recepient - imparter specific object describing recipient of transactions to tally for.\r\n *\r\n * > Recipient objects are as per:\r\n * >\r\n * > | imparter tag | recipient object |\r\n * > | --- | --- |\r\n * > | eth-web3 | `{address:..}` |\r\n * > | ohledger | `{address:..}` |\r\n * > | ohledger-web3 | `{address:..}` |\r\n *\r\n * @param {Date} since - date to start tally since: date of oldest transaction to include. No restriction if 'null'.\r\n * @returns {Promise} with the `{'tally':.., 'as-of':..}` object, whereby the tally value is in imparter specific currency.\r\n * The 'as-of' timestamp is that of the call (pass this to back-end to retrieve cached values at better API call rates).\r\n */\r\n getTally = getTally;\r\n\r\n /**\r\n * @namespace oh$\r\n * @function getTransactions\r\n * @description\r\n * Retrieve transactions on the imparter's ledger, perhaps within a date range, from credentials set against \r\n * imparter to a recipient\r\n * @param {string} imparterTag\r\n * @param {Date} since - date to start tally since: date of oldest transaction to include. No restriction if 'null'.\r\n * @param {Object} recepient - imparter specific object describing recipient of transactions to tally for.\r\n *\r\n * > Recipient objects are as per:\r\n * >\r\n * > | imparter tag | recipient object |\r\n * > | --- | --- |\r\n * > | eth-web3 | `{address:..}` |\r\n * > | ohledger | `{address:..}` |\r\n * > | ohledger-web3 | `{address:..}` |\r\n *\r\n * @returns {Promise} with the `{'transactions': [{\"transaction-value\":..,\"transaction-date\":..},..], 'as-of':..}` object, \r\n * whereby 'transactions' is the list of transactions and 'as-of' is the timestamp of the call.\r\n */\r\n getTransactions = getTransactions;\r\n\r\n /**\r\n * @namespace oh$\r\n * @function isOnLedger\r\n * @description\r\n * Determine if current credentials have some transaction on the imparter's ledger: transaction can be to anyone.\r\n * \r\n * Intent is to validate beyond just a valid address. To validate the address has been used.\r\n * \r\n * May fire [onWalletPopup](#eventonwalletpopup) event against `oh$`.\r\n * @param {string} imparterTag\r\n * @returns {Promise} with 'true' or 'false'; may fire [onWalletPopup](#eventonwalletpopup) event against `oh$`\r\n */\r\n isOnLedger = isOnLedger;\r\n\r\n /**\r\n * @namespace oh$\r\n * @function sign\r\n * @description\r\n * Sign using the provided message using the credentials set against the specific imparter.\r\n * \r\n * Note: wallet might pop up a dialog upon this call, consider that in your UX flow.\r\n * \r\n * May fire [onWalletPopup](#eventonwalletpopup) event against `oh$`.\r\n * @param {string} imparterTag\r\n * @param {string} message - to sign\r\n * @returns {Promise} with the signature; may fire [onWalletPopup](#eventonwalletpopup) event against `oh$`\r\n */\r\n sign = sign;\r\n\r\n /**\r\n * @namespace oh$\r\n * @function createTransaction\r\n * @description\r\n * Create a transaction on the imparter's ledger.\r\n * \r\n * May fire [onWalletPopup](#eventonwalletpopup) event against `oh$`; wallet might pop up a dialog upon this call, consider that in your UX flow.\r\n * @param {string} imparterTag\r\n * @param {number} amount\r\n * @param {string} to - address of recipient\r\n * \r\n * > $0 (*amount*) transactions against *ohledger* or *ohledger-web* *imparters* use the current credential \r\n * > as the *to* address, not the specified *to* address.\r\n * \r\n * @param {Object} options - other options required for the specific imparter.\r\n * \r\n * > The options objects are as follows:\r\n * > \r\n * > | imparter tag | credentials object |\r\n * > | --- | --- |\r\n * > | eth-web3 | null |\r\n * > | ohledger | {message:.., signature:..} |\r\n * > | ohledger-web3 | {message:.., signature:..} |\r\n * > \r\n * > If *message* and *signature* are provided they are used instead of oh$ asking for wallet to resign message.\r\n *\r\n * @returns {Promise} of a 'true' for success or an Error; may fire [onWalletPopup](#eventonwalletpopup) event against `oh$`\r\n */\r\n createTransaction = createTransaction;\r\n }();\r\n\r\n var doEnable = null;\r\n const isEnabled = new Promise((resolve) => doEnable = resolve);\r\n var token = null;\r\n var __fetch = null;\r\n var imparterTags = [ohledger.tag];\r\n\r\n /**\r\n * Function to fire events.\r\n * \r\n * @param {string} which - event name to fire\r\n * @param {Object} params - to copy to event\r\n */\r\n function fire(which, params) {\r\n let event = document.createEvent(\"Event\");\r\n event.initEvent(which, true, true);\r\n for (var param in params) {\r\n event[param] = params[param];\r\n }\r\n oh$.dispatchEvent(event);\r\n }\r\n\r\n /**\r\n * @param {string} tag -- to add to `imparterTags` if not in `imparterTags`\r\n */\r\n function addTag(tag) {\r\n let imparterTagIndex = imparterTags.findIndex(v => v === tag);\r\n if (imparterTagIndex == -1) imparterTags.push(tag);\r\n }\r\n\r\n /**\r\n * @param {string} tag -- to remove from `imparterTags` if in `imparterTags`\r\n */\r\n function removeTag(tag) {\r\n let imparterTagIndex = imparterTags.findIndex(v => v === tag);\r\n if (imparterTagIndex > -1) imparterTags.splice(imparterTagIndex, 1);\r\n }\r\n\r\n const web3Wallet = new web3_wallet(\r\n (tag) => addTag(tag), \r\n (tag) => removeTag(tag),\r\n (which, params) => fire(which, params));\r\n\r\n const overhideWallet = new overhide_wallet();\r\n\r\n const imparters = {};\r\n imparters[eth_web3.tag] = new eth_web3(\r\n web3Wallet, \r\n () => token,\r\n (...args) => __fetch(...args),\r\n (which, params) => fire(which, params));\r\n imparters[ohledger_web3.tag] = new ohledger_web3(\r\n overhideWallet,\r\n web3Wallet,\r\n () => token,\r\n (...args) => __fetch(...args),\r\n (which, params) => fire(which, params)\r\n );\r\n imparters[ohledger.tag] = new ohledger(\r\n overhideWallet,\r\n web3Wallet,\r\n () => token,\r\n (...args) => __fetch(...args),\r\n (which, params) => fire(which, params)\r\n );\r\n\r\n overhideWallet.createPopup();\r\n web3Wallet.detectWeb3Wallet();\r\n\r\n function enable(_token, {fetcher} = {fetcher: fetch}) {\r\n token = _token;\r\n __fetch = fetcher;\r\n doEnable(true);\r\n }\r\n\r\n function getImparterTags() {\r\n return imparterTags;\r\n }\r\n\r\n function canSetCredentials(imparterTag) {\r\n if (!imparterTag in imparters) throw new Error(\"invalid imparterTag\");\r\n \r\n return imparters[imparterTag].canSetCredentials();\r\n }\r\n\r\n function canGenerateCredentials(imparterTag) {\r\n if (!imparterTag in imparters) throw new Error(\"invalid imparterTag\");\r\n \r\n return imparters[imparterTag].canGenerateCredentials();\r\n }\r\n\r\n function canChangeNetwork(imparterTag) {\r\n if (!imparterTag in imparters) throw new Error(\"invalid imparterTag\");\r\n \r\n return imparters[imparterTag].canChangeNetwork();\r\n }\r\n\r\n async function setCredentials(imparterTag, credentials) {\r\n if (!imparterTag in imparters) throw new Error(\"invalid imparterTag\");\r\n \r\n return imparters[imparterTag].setCredentials(credentials);\r\n }\r\n\r\n function getCredentials(imparterTag) {\r\n if (!imparterTag in imparters) throw new Error(\"invalid imparterTag\");\r\n\r\n return imparters[imparterTag].getCredentials();\r\n }\r\n\r\n async function generateCredentials(imparterTag, options) {\r\n if (!imparterTag in imparters) throw new Error(\"invalid imparterTag\");\r\n\r\n return imparters[imparterTag].generateCredentials(options);\r\n }\r\n\r\n async function setNetwork(imparterTag, details) {\r\n if (!imparterTag in imparters) throw new Error(\"invalid imparterTag\");\r\n\r\n return imparters[imparterTag].setNetwork(details);\r\n }\r\n\r\n function getNetwork(imparterTag) {\r\n if (!imparterTag in imparters) throw new Error(\"invalid imparterTag\");\r\n\r\n return imparters[imparterTag].getNetwork(); \r\n }\r\n\r\n function getOverhideRemunerationAPIUri(imparterTag) {\r\n if (!imparterTag in imparters) throw new Error(\"invalid imparterTag\");\r\n\r\n return imparters[imparterTag].getOverhideRemunerationAPIUri(); \r\n }\r\n\r\n async function getFromDollars(imparterTag, dollarAmount) {\r\n if (!imparterTag in imparters) throw new Error(\"invalid imparterTag\");\r\n if (await isEnabled && !__fetch) throw new Error('did you forget to `oh$.enable(..)`?');\r\n\r\n return await imparters[imparterTag].getFromDollars(dollarAmount);\r\n }\r\n\r\n async function getTallyDollars(imparterTag, recipient, date) {\r\n return (await getTxs(imparterTag, recipient, date, true, true));\r\n }\r\n\r\n async function getTally(imparterTag, recipient, date) {\r\n return (await getTxs(imparterTag, recipient, date, true, false));\r\n }\r\n\r\n async function getTransactions(imparterTag, recipient, date) {\r\n return (await getTxs(imparterTag, recipient, date, false, false));\r\n }\r\n\r\n async function getTxs(imparterTag, recipient, date, tallyOnly, tallyDollars) {\r\n if (!imparterTag in imparters) throw new Error(\"invalid imparterTag\");\r\n if (await isEnabled && !__fetch) throw new Error('did you forget to `oh$.enable(..)`?');\r\n\r\n return await imparters[imparterTag].getTxs(recipient, date, tallyOnly, tallyDollars);\r\n }\r\n\r\n async function isOnLedger(imparterTag) {\r\n if (!imparterTag in imparters) throw new Error(\"invalid imparterTag\");\r\n if (await isEnabled && !__fetch) throw new Error('did you forget to `oh$.enable(..)`?');\r\n\r\n return await imparters[imparterTag].isOnLedger();\r\n }\r\n\r\n async function sign(imparterTag, message) {\r\n if (!imparterTag in imparters) throw new Error(\"invalid imparterTag\");\r\n if (await isEnabled && !__fetch) throw new Error('did you forget to `oh$.enable(..)`?');\r\n\r\n return await imparters[imparterTag].sign(message);\r\n }\r\n\r\n async function createTransaction(imparterTag, amount, to, options) {\r\n if (!imparterTag in imparters) throw new Error(\"invalid imparterTag\");\r\n if (await isEnabled && !__fetch) throw new Error('did you forget to `oh$.enable(..)`?');\r\n\r\n return await imparters[imparterTag].createTransaction(amount, to, options);\r\n }\r\n\r\n return root.oh$;\r\n})();\r\n\r\nexport default oh$;","var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n"],"sourceRoot":""} \ No newline at end of file diff --git a/docs/ledgers.js-rendered-docs/index.html b/docs/ledgers.js-rendered-docs/index.html index 37f6fa4..67a2972 100644 --- a/docs/ledgers.js-rendered-docs/index.html +++ b/docs/ledgers.js-rendered-docs/index.html @@ -1728,7 +1728,7 @@

-

Retrieve a converted amount in imparter specific denomination from a provided dollar amount.

+

Retrieve a (highest) converted amount in imparter specific denomination from a provided dollar amount at a very recent exchange rate.

getFromDollars(imparterTag: string, dollarAmount: number): Promise
@@ -1883,8 +1883,11 @@

Returns
Promise: - with the tally value in US dollars: all transactions are exchanged to USD at an approximate exchange rate -close to the transactions' time. + with the +{'tally':.., 'as-of':..} + object, whereby the 'tally' value is in US dollars: all transactions +are exchanged to USD at an approximate (highest) exchange rate close to the transactions' time. The 'as-of' timestamp +is that of the call (pass this to back-end to retrieve cached values at better API call rates). @@ -1996,7 +1999,10 @@

Returns
Promise: - with the tally value in imparter specific currency + with the +{'tally':.., 'as-of':..} + object, whereby the tally value is in imparter specific currency. +The 'as-of' timestamp is that of the call (pass this to back-end to retrieve cached values at better API call rates). @@ -2109,8 +2115,10 @@

Returns
Promise: - with the transactions: -[{"transaction-value":..,"transaction-date":..},..] + with the +{'transactions': [{"transaction-value":..,"transaction-date":..},..], 'as-of':..} + object, +whereby 'transactions' is the list of transactions and 'as-of' is the timestamp of the call. diff --git a/package.json b/package.json index c2543a6..6a0ea35 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ledgers.js", - "version": "4.1.0", + "version": "4.2.0", "description": "JavaScript library for ledger-based authorizations :: abstracting different ledgers to be used in an application's authentication and authorization workflows.", "engines": { "node": ">=10.13.0" diff --git a/src/fns/imparter_fns.js b/src/fns/imparter_fns.js index 430c360..9cdcd9e 100644 --- a/src/fns/imparter_fns.js +++ b/src/fns/imparter_fns.js @@ -3,13 +3,17 @@ class imparter_fns { if (date && !(date instanceof Date)) throw new Error("'date' must be a Date is passed in"); if (!('address' in recipient) || !recipient.address) throw new Error("'address' required in recipient"); } - static async getTxs_retrieve(uri, from, to, tallyOnly, date, token, __fetch) { + static async getTxs_retrieve(uri, from, to, tallyOnly, tallyDollars, date, token, __fetch) { if (!uri) throw new Error('no uri for request, unsupported network selected in wallet?'); let since = ''; if (date) { since = `&since=${date.toISOString()}`; } - return await __fetch(`${uri}/get-transactions/${from}/${to}?tally-only=${tallyOnly ? 'true' : 'false'}${since}&include-refunds=true`, { + let dollarsQuery = ''; + if (tallyDollars) { + dollarsQuery = `&tally-dollars=true` + } + return await __fetch(`${uri}/get-transactions/${from}/${to}?tally-only=${tallyOnly ? 'true' : 'false'}${dollarsQuery}${since}&include-refunds=true`, { headers: new Headers({ 'Authorization': `Bearer ${token}` }) diff --git a/src/imparters/eth-web3.js b/src/imparters/eth-web3.js index 591e102..0d3ae1d 100644 --- a/src/imparters/eth-web3.js +++ b/src/imparters/eth-web3.js @@ -74,25 +74,7 @@ class eth_web3 { return dollarAmount / result[0].minrate; } - async getTallyDollars(recipient, date) { - const txs = (await this.getTxs(recipient, date, false)).transactions; - if (!txs || txs.length == 0) return 0; - const values = txs.map(t => `${t['transaction-value']}@${(new Date(t['transaction-date'])).toISOString()}`); - const hostPrefix = this.web3_wallet.network === 'main' ? '' : 'test.'; - const now = (new Date()).toISOString(); - var tally = await this.__fetch(`https://${hostPrefix}rates.overhide.io/tallymax/wei/${values.join(',')}`, { - headers: new Headers({ - 'Authorization': `Bearer ${this.getToken()}` - }) - }) - .then(res => res.text()) - .catch(e => { - throw String(e) - }); - return (Math.round(tally * 100) / 100).toFixed(2); - } - - async getTxs(recipient, date, tallyOnly) { + async getTxs(recipient, date, tallyOnly, tallyDollars) { imparter_fns.getTxs_check_details(recipient, date); const to = recipient.address; @@ -102,7 +84,7 @@ class eth_web3 { if (!this.web3_wallet.walletAddress) throw new Error("from 'walletAddress' not set: use wallet"); var from = this.web3_wallet.walletAddress; - return await imparter_fns.getTxs_retrieve(uri, from, to, tallyOnly, date, this.getToken(), this.__fetch); + return await imparter_fns.getTxs_retrieve(uri, from, to, tallyOnly, tallyDollars, date, this.getToken(), this.__fetch); } async isOnLedger() { diff --git a/src/imparters/ohledger-web3.js b/src/imparters/ohledger-web3.js index 7b0b41c..b6904dc 100644 --- a/src/imparters/ohledger-web3.js +++ b/src/imparters/ohledger-web3.js @@ -59,12 +59,7 @@ class ohledger_web3 { return dollarAmount * 100; } - async getTallyDollars(recipient, date) { - var tally = (await this.getTxs(recipient, date, true)).tally; - return (tally / 100).toFixed(2); - } - - async getTxs(recipient, date, tallyOnly) { + async getTxs(recipient, date, tallyOnly, tallyDollars) { imparter_fns.getTxs_check_details(recipient, date); const to = recipient.address; @@ -74,7 +69,7 @@ class ohledger_web3 { if (!this.web3_wallet.walletAddress) throw new Error("from 'walletAddress' not set: use wallet"); var from = this.web3_wallet.walletAddress; - return await imparter_fns.getTxs_retrieve(uri, from, to, tallyOnly, date, this.getToken(), this.__fetch); + return await imparter_fns.getTxs_retrieve(uri, from, to, tallyOnly, tallyDollars, date, this.getToken(), this.__fetch); } async isOnLedger() { diff --git a/src/imparters/ohledger.js b/src/imparters/ohledger.js index dbd179e..4b9f35f 100644 --- a/src/imparters/ohledger.js +++ b/src/imparters/ohledger.js @@ -80,12 +80,7 @@ class ohledger { return dollarAmount * 100; } - async getTallyDollars(recipient, date) { - var tally = (await this.getTxs(recipient, date, true)).tally; - return (tally / 100).toFixed(2); - } - - async getTxs(recipient, date, tallyOnly) { + async getTxs(recipient, date, tallyOnly, tallyDollars) { imparter_fns.getTxs_check_details(recipient, date); const to = recipient.address; @@ -95,7 +90,7 @@ class ohledger { if (!this.address) throw new Error("from 'address' not set: use setCredentials"); const from = this.address; - return await imparter_fns.getTxs_retrieve(uri, from, to, tallyOnly, date, this.getToken(), this.__fetch); + return await imparter_fns.getTxs_retrieve(uri, from, to, tallyOnly, tallyDollars, date, this.getToken(), this.__fetch); } async isOnLedger() { diff --git a/src/ledgers.js b/src/ledgers.js index 3662f03..9a802f1 100644 --- a/src/ledgers.js +++ b/src/ledgers.js @@ -431,7 +431,7 @@ const oh$ = (function() { * @namespace oh$ * @function getFromDollars * @description - * Retrieve a converted amount in imparter specific denomination from a provided dollar amount. + * Retrieve a (highest) converted amount in imparter specific denomination from a provided dollar amount at a very recent exchange rate. * @param {string} imparterTag * @param {number} dollarAmount - the dollar amount. * @returns {Promise} with the value in imparter specific currency at the present time (based on recent exchange rate). @@ -455,8 +455,9 @@ const oh$ = (function() { * > | ohledger-web3 | `{address:..}` | * * @param {Date} since - date to start tally since: date of oldest transaction to include. No restriction if 'null'. - * @returns {Promise} with the tally value in US dollars: all transactions are exchanged to USD at an approximate exchange rate - * close to the transactions' time. + * @returns {Promise} with the `{'tally':.., 'as-of':..}` object, whereby the 'tally' value is in US dollars: all transactions + * are exchanged to USD at an approximate (highest) exchange rate close to the transactions' time. The 'as-of' timestamp + * is that of the call (pass this to back-end to retrieve cached values at better API call rates). */ getTallyDollars = getTallyDollars; @@ -477,7 +478,8 @@ const oh$ = (function() { * > | ohledger-web3 | `{address:..}` | * * @param {Date} since - date to start tally since: date of oldest transaction to include. No restriction if 'null'. - * @returns {Promise} with the tally value in imparter specific currency + * @returns {Promise} with the `{'tally':.., 'as-of':..}` object, whereby the tally value is in imparter specific currency. + * The 'as-of' timestamp is that of the call (pass this to back-end to retrieve cached values at better API call rates). */ getTally = getTally; @@ -499,7 +501,8 @@ const oh$ = (function() { * > | ohledger | `{address:..}` | * > | ohledger-web3 | `{address:..}` | * - * @returns {Promise} with the transactions: `[{"transaction-value":..,"transaction-date":..},..]` + * @returns {Promise} with the `{'transactions': [{"transaction-value":..,"transaction-date":..},..], 'as-of':..}` object, + * whereby 'transactions' is the list of transactions and 'as-of' is the timestamp of the call. */ getTransactions = getTransactions; @@ -703,25 +706,22 @@ const oh$ = (function() { } async function getTallyDollars(imparterTag, recipient, date) { - if (!imparterTag in imparters) throw new Error("invalid imparterTag"); - if (await isEnabled && !__fetch) throw new Error('did you forget to `oh$.enable(..)`?'); - - return await imparters[imparterTag].getTallyDollars(recipient, date); + return (await getTxs(imparterTag, recipient, date, true, true)); } async function getTally(imparterTag, recipient, date) { - return (await getTxs(imparterTag, recipient, date, true)).tally; + return (await getTxs(imparterTag, recipient, date, true, false)); } async function getTransactions(imparterTag, recipient, date) { - return (await getTxs(imparterTag, recipient, date, false)).transactions; + return (await getTxs(imparterTag, recipient, date, false, false)); } - async function getTxs(imparterTag, recipient, date, tallyOnly) { + async function getTxs(imparterTag, recipient, date, tallyOnly, tallyDollars) { if (!imparterTag in imparters) throw new Error("invalid imparterTag"); if (await isEnabled && !__fetch) throw new Error('did you forget to `oh$.enable(..)`?'); - return await imparters[imparterTag].getTxs(recipient, date, tallyOnly); + return await imparters[imparterTag].getTxs(recipient, date, tallyOnly, tallyDollars); } async function isOnLedger(imparterTag) { diff --git a/src/wallets/overhide_wallet.js b/src/wallets/overhide_wallet.js index 4313400..7594933 100644 --- a/src/wallets/overhide_wallet.js +++ b/src/wallets/overhide_wallet.js @@ -176,12 +176,14 @@ class overhide_wallet { loadOhLedgerTransactFns() { // load prod ohledger transact fn this.loadJS(`${this.remuneration_uri.prod}/transact.js`, () => { - this.oh_ledger_transact_fn.prod = (...args) => { oh_ledger_transact(...args); return this.setupNewPromise(); } + const fn = oh_ledger_transact; + this.oh_ledger_transact_fn.prod = (...args) => { fn(...args); return this.setupNewPromise(); } }, document.body); // load test ohledger transact fn this.loadJS(`${this.remuneration_uri.test}/transact.js`, () => { - this.oh_ledger_transact_fn.test = (...args) => { oh_ledger_transact(...args); return this.setupNewPromise(); } + const fn = oh_ledger_transact; + this.oh_ledger_transact_fn.test = (...args) => { fn(...args); return this.setupNewPromise(); } }, document.body); } }