hivesigner 3.2.9 → 3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -99,6 +99,21 @@ If it is successful, the result will be a JSON object with the following propert
99
99
  }
100
100
  ```
101
101
 
102
+ ### Decode memo
103
+ Decode encrypted memo, only works if encryption is done with hivesigner account's posting public key
104
+ ```
105
+ client.decode(function (err, res) {
106
+ console.log(err, res)
107
+ });
108
+ ```
109
+ If it is successful, the result will be a JSON object with the following properties:
110
+ ```
111
+ {
112
+ memoDecoded: "#ev.....",
113
+ username: "demo"
114
+ }
115
+ ```
116
+
102
117
  ### Logout
103
118
  The revokeToken() method will log the current user out of your application by revoking the access token provided to your app for that user:
104
119
  ```
package/lib/client.d.ts CHANGED
@@ -15,10 +15,12 @@ export declare class Client {
15
15
  setAccessToken(accessToken: string): this;
16
16
  removeAccessToken(): this;
17
17
  setScope(scope: string[]): this;
18
- getLoginURL(state: string, select_account?: string): string;
18
+ getLoginURL(state: string, account?: string): string;
19
19
  login(options: LoginOptions): void;
20
20
  me(): Promise<SendResponse>;
21
21
  me(cb: CallbackFunction): Promise<SendResponse>;
22
+ decode(): Promise<SendResponse>;
23
+ decode(cb: CallbackFunction): Promise<SendResponse>;
22
24
  vote(voter: string, author: string, permlink: string, weight: string | number): Promise<SendResponse>;
23
25
  vote(voter: string, author: string, permlink: string, weight: string | number, cb: CallbackFunction): Promise<SendResponse>;
24
26
  comment(parentAuthor: string, parentPermlink: string, author: string, permlink: string, title: string, body: any, jsonMetadata: any): Promise<SendResponse>;
@@ -7,4 +7,4 @@ var hivesigner=function(t){var e={};function r(n){if(e[n])return e[n].exports;va
7
7
  */
8
8
  var n=r(13),o=r(14),i=r(15);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(s()<e)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=u.prototype:(null===t&&(t=new u(e)),t.length=e),t}function u(t,e,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return f(this,t)}return h(this,t,e,r)}function h(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);u.TYPED_ARRAY_SUPPORT?(t=e).__proto__=u.prototype:t=l(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|d(e,r),o=(t=a(t,n)).write(e,r);o!==n&&(t=t.slice(0,o));return t}(t,e,r):function(t,e){if(u.isBuffer(e)){var r=0|p(e.length);return 0===(t=a(t,r)).length||e.copy(t,0,0,r),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?a(t,0):l(t,e);if("Buffer"===e.type&&i(e.data))return l(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function f(t,e){if(c(e),t=a(t,e<0?0:0|p(e)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function l(t,e){var r=e.length<0?0:0|p(e.length);t=a(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function p(t){if(t>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function d(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return N(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return q(t).length;default:if(n)return N(t).length;e=(""+e).toLowerCase(),n=!0}}function y(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return U(this,e,r);case"utf8":case"utf-8":return O(this,e,r);case"ascii":return T(this,e,r);case"latin1":case"binary":return P(this,e,r);case"base64":return R(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function v(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function g(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:m(t,e,r,n,o);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):m(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function m(t,e,r,n,o){var i,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function h(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(o){var c=-1;for(i=r;i<a;i++)if(h(t,i)===h(e,-1===c?0:i-c)){if(-1===c&&(c=i),i-c+1===u)return c*s}else-1!==c&&(i-=i-c),c=-1}else for(r+u>a&&(r=a-u),i=r;i>=0;i--){for(var f=!0,l=0;l<u;l++)if(h(t,i+l)!==h(e,l)){f=!1;break}if(f)return i}return-1}function b(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=e.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var s=0;s<n;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[r+s]=a}return s}function w(t,e,r,n){return F(N(e,t.length-r),t,r,n)}function _(t,e,r,n){return F(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function x(t,e,r,n){return _(t,e,r,n)}function A(t,e,r,n){return F(q(e),t,r,n)}function E(t,e,r,n){return F(function(t,e){for(var r,n,o,i=[],s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function R(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function O(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var i,s,a,u,h=t[o],c=null,f=h>239?4:h>223?3:h>191?2:1;if(o+f<=r)switch(f){case 1:h<128&&(c=h);break;case 2:128==(192&(i=t[o+1]))&&(u=(31&h)<<6|63&i)>127&&(c=u);break;case 3:i=t[o+1],s=t[o+2],128==(192&i)&&128==(192&s)&&(u=(15&h)<<12|(63&i)<<6|63&s)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:i=t[o+1],s=t[o+2],a=t[o+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&(u=(15&h)<<18|(63&i)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(c=u)}null===c?(c=65533,f=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),o+=f}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return r}(n)}e.Buffer=u,e.SlowBuffer=function(t){+t!=t&&(t=0);return u.alloc(+t)},e.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=s(),u.poolSize=8192,u._augment=function(t){return t.__proto__=u.prototype,t},u.from=function(t,e,r){return h(null,t,e,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(t,e,r){return function(t,e,r,n){return c(e),e<=0?a(t,e):void 0!==r?"string"==typeof n?a(t,e).fill(r,n):a(t,e).fill(r):a(t,e)}(null,t,e,r)},u.allocUnsafe=function(t){return f(null,t)},u.allocUnsafeSlow=function(t){return f(null,t)},u.isBuffer=function(t){return!(null==t||!t._isBuffer)},u.compare=function(t,e){if(!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,o=0,i=Math.min(r,n);o<i;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!i(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=u.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var s=t[r];if(!u.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,o),o+=s.length}return n},u.byteLength=d,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)v(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)v(this,e,e+3),v(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)v(this,e,e+7),v(this,e+1,e+6),v(this,e+2,e+5),v(this,e+3,e+4);return this},u.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?O(this,0,t):y.apply(this,arguments)},u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},u.prototype.compare=function(t,e,r,n,o){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0),a=Math.min(i,s),h=this.slice(n,o),c=t.slice(e,r),f=0;f<a;++f)if(h[f]!==c[f]){i=h[f],s=c[f];break}return i<s?-1:s<i?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return g(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return g(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return b(this,t,e,r);case"utf8":case"utf-8":return w(this,t,e,r);case"ascii":return _(this,t,e,r);case"latin1":case"binary":return x(this,t,e,r);case"base64":return A(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function T(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}function P(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function U(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=e;i<r;++i)o+=Y(t[i]);return o}function k(t,e,r){for(var n=t.slice(e,r),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function S(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function L(t,e,r,n,o,i){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function j(t,e,r,n){e<0&&(e=65535+e+1);for(var o=0,i=Math.min(t.length-r,2);o<i;++o)t[r+o]=(e&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function B(t,e,r,n){e<0&&(e=4294967295+e+1);for(var o=0,i=Math.min(t.length-r,4);o<i;++o)t[r+o]=e>>>8*(n?o:3-o)&255}function I(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function C(t,e,r,n,i){return i||I(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function M(t,e,r,n,i){return i||I(t,0,r,8),o.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),u.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=u.prototype;else{var o=e-t;r=new u(o,void 0);for(var i=0;i<o;++i)r[i]=this[i+t]}return r},u.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||S(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n},u.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||S(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},u.prototype.readUInt8=function(t,e){return e||S(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||S(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||S(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||S(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||S(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||S(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||S(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},u.prototype.readInt8=function(t,e){return e||S(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||S(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){e||S(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return e||S(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||S(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||S(t,4,this.length),o.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||S(t,4,this.length),o.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||S(t,8,this.length),o.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||S(t,8,this.length),o.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||L(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||L(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):j(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):j(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):B(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):B(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var o=Math.pow(2,8*r-1);L(this,t,e,r,o-1,-o)}var i=0,s=1,a=0;for(this[e]=255&t;++i<r&&(s*=256);)t<0&&0===a&&0!==this[e+i-1]&&(a=1),this[e+i]=(t/s>>0)-a&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var o=Math.pow(2,8*r-1);L(this,t,e,r,o-1,-o)}var i=r-1,s=1,a=0;for(this[e+i]=255&t;--i>=0&&(s*=256);)t<0&&0===a&&0!==this[e+i+1]&&(a=1),this[e+i]=(t/s>>0)-a&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):j(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):j(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):B(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):B(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,r){return C(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return C(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return M(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return M(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var o,i=n-r;if(this===t&&r<e&&e<n)for(o=i-1;o>=0;--o)t[o+e]=this[o+r];else if(i<1e3||!u.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+i),e);return i},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var o=t.charCodeAt(0);o<256&&(t=o)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{var s=u.isBuffer(t)?t:N(new u(t,n).toString()),a=s.length;for(i=0;i<r-e;++i)this[i+e]=s[i%a]}return this};var D=/[^+\/0-9A-Za-z-_]/g;function Y(t){return t<16?"0"+t.toString(16):t.toString(16)}function N(t,e){var r;e=e||1/0;for(var n=t.length,o=null,i=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function q(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(D,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function F(t,e,r,n){for(var o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}}).call(this,r(4))},function(t,e,r){"use strict";e.byteLength=function(t){var e=h(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,n=h(t),s=n[0],a=n[1],u=new i(function(t,e,r){return 3*(e+r)/4-r}(0,s,a)),c=0,f=a>0?s-4:s;for(r=0;r<f;r+=4)e=o[t.charCodeAt(r)]<<18|o[t.charCodeAt(r+1)]<<12|o[t.charCodeAt(r+2)]<<6|o[t.charCodeAt(r+3)],u[c++]=e>>16&255,u[c++]=e>>8&255,u[c++]=255&e;2===a&&(e=o[t.charCodeAt(r)]<<2|o[t.charCodeAt(r+1)]>>4,u[c++]=255&e);1===a&&(e=o[t.charCodeAt(r)]<<10|o[t.charCodeAt(r+1)]<<4|o[t.charCodeAt(r+2)]>>2,u[c++]=e>>8&255,u[c++]=255&e);return u},e.fromByteArray=function(t){for(var e,r=t.length,o=r%3,i=[],s=0,a=r-o;s<a;s+=16383)i.push(c(t,s,s+16383>a?a:s+16383));1===o?(e=t[r-1],i.push(n[e>>2]+n[e<<4&63]+"==")):2===o&&(e=(t[r-2]<<8)+t[r-1],i.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return i.join("")};for(var n=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a<u;++a)n[a]=s[a],o[s.charCodeAt(a)]=a;function h(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function c(t,e,r){for(var o,i,s=[],a=e;a<r;a+=3)o=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(n[(i=o)>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return s.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(t,e){
9
9
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
10
- e.read=function(t,e,r,n,o){var i,s,a=8*o-n-1,u=(1<<a)-1,h=u>>1,c=-7,f=r?o-1:0,l=r?-1:1,p=t[e+f];for(f+=l,i=p&(1<<-c)-1,p>>=-c,c+=a;c>0;i=256*i+t[e+f],f+=l,c-=8);for(s=i&(1<<-c)-1,i>>=-c,c+=n;c>0;s=256*s+t[e+f],f+=l,c-=8);if(0===i)i=1-h;else{if(i===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),i-=h}return(p?-1:1)*s*Math.pow(2,i-n)},e.write=function(t,e,r,n,o,i){var s,a,u,h=8*i-o-1,c=(1<<h)-1,f=c>>1,l=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,d=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+f>=1?l/u:l*Math.pow(2,1-f))*u>=2&&(s++,u/=2),s+f>=c?(a=0,s=c):s+f>=1?(a=(e*u-1)*Math.pow(2,o),s+=f):(a=e*Math.pow(2,f-1)*Math.pow(2,o),s=0));o>=8;t[r+p]=255&a,p+=d,a/=256,o-=8);for(s=s<<o|a,h+=o;h>0;t[r+p]=255&s,p+=d,s/=256,h-=8);t[r+p-d]|=128*y}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){(function(t,n){var o;/*! https://mths.be/punycode v1.4.1 by @mathias */!function(i){e&&e.nodeType,t&&t.nodeType;var s="object"==typeof n&&n;s.global!==s&&s.window!==s&&s.self;var a,u=2147483647,h=/^xn--/,c=/[^\x20-\x7E]/,f=/[\x2E\u3002\uFF0E\uFF61]/g,l={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},p=Math.floor,d=String.fromCharCode;function y(t){throw new RangeError(l[t])}function v(t,e){for(var r=t.length,n=[];r--;)n[r]=e(t[r]);return n}function g(t,e){var r=t.split("@"),n="";return r.length>1&&(n=r[0]+"@",t=r[1]),n+v((t=t.replace(f,".")).split("."),e).join(".")}function m(t){for(var e,r,n=[],o=0,i=t.length;o<i;)(e=t.charCodeAt(o++))>=55296&&e<=56319&&o<i?56320==(64512&(r=t.charCodeAt(o++)))?n.push(((1023&e)<<10)+(1023&r)+65536):(n.push(e),o--):n.push(e);return n}function b(t){return v(t,(function(t){var e="";return t>65535&&(e+=d((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=d(t)})).join("")}function w(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function _(t,e,r){var n=0;for(t=r?p(t/700):t>>1,t+=p(t/e);t>455;n+=36)t=p(t/35);return p(n+36*t/(t+38))}function x(t){var e,r,n,o,i,s,a,h,c,f,l,d=[],v=t.length,g=0,m=128,w=72;for((r=t.lastIndexOf("-"))<0&&(r=0),n=0;n<r;++n)t.charCodeAt(n)>=128&&y("not-basic"),d.push(t.charCodeAt(n));for(o=r>0?r+1:0;o<v;){for(i=g,s=1,a=36;o>=v&&y("invalid-input"),((h=(l=t.charCodeAt(o++))-48<10?l-22:l-65<26?l-65:l-97<26?l-97:36)>=36||h>p((u-g)/s))&&y("overflow"),g+=h*s,!(h<(c=a<=w?1:a>=w+26?26:a-w));a+=36)s>p(u/(f=36-c))&&y("overflow"),s*=f;w=_(g-i,e=d.length+1,0==i),p(g/e)>u-m&&y("overflow"),m+=p(g/e),g%=e,d.splice(g++,0,m)}return b(d)}function A(t){var e,r,n,o,i,s,a,h,c,f,l,v,g,b,x,A=[];for(v=(t=m(t)).length,e=128,r=0,i=72,s=0;s<v;++s)(l=t[s])<128&&A.push(d(l));for(n=o=A.length,o&&A.push("-");n<v;){for(a=u,s=0;s<v;++s)(l=t[s])>=e&&l<a&&(a=l);for(a-e>p((u-r)/(g=n+1))&&y("overflow"),r+=(a-e)*g,e=a,s=0;s<v;++s)if((l=t[s])<e&&++r>u&&y("overflow"),l==e){for(h=r,c=36;!(h<(f=c<=i?1:c>=i+26?26:c-i));c+=36)x=h-f,b=36-f,A.push(d(w(f+x%b,0))),h=p(x/b);A.push(d(w(h,0))),i=_(r,g,n==o),r=0,++n}++r,++e}return A.join("")}a={version:"1.4.1",ucs2:{decode:m,encode:b},decode:x,encode:A,toASCII:function(t){return g(t,(function(t){return c.test(t)?"xn--"+A(t):t}))},toUnicode:function(t){return g(t,(function(t){return h.test(t)?x(t.slice(4).toLowerCase()):t}))}},void 0===(o=function(){return a}.call(e,r,e,t))||(t.exports=o)}()}).call(this,r(17)(t),r(4))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,r){"use strict";t.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},function(t,e,r){"use strict";e.decode=e.parse=r(20),e.encode=e.stringify=r(21)},function(t,e,r){"use strict";function n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,e,r,i){e=e||"&",r=r||"=";var s={};if("string"!=typeof t||0===t.length)return s;var a=/\+/g;t=t.split(e);var u=1e3;i&&"number"==typeof i.maxKeys&&(u=i.maxKeys);var h=t.length;u>0&&h>u&&(h=u);for(var c=0;c<h;++c){var f,l,p,d,y=t[c].replace(a,"%20"),v=y.indexOf(r);v>=0?(f=y.substr(0,v),l=y.substr(v+1)):(f=y,l=""),p=decodeURIComponent(f),d=decodeURIComponent(l),n(s,p)?o(s[p])?s[p].push(d):s[p]=[s[p],d]:s[p]=d}return s};var o=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},function(t,e,r){"use strict";var n=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,e,r,a){return e=e||"&",r=r||"=",null===t&&(t=void 0),"object"==typeof t?i(s(t),(function(s){var a=encodeURIComponent(n(s))+r;return o(t[s])?i(t[s],(function(t){return a+encodeURIComponent(n(t))})).join(e):a+encodeURIComponent(n(t[s]))})).join(e):a?encodeURIComponent(n(a))+r+encodeURIComponent(n(t)):""};var o=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function i(t,e){if(t.map)return t.map(e);for(var r=[],n=0;n<t.length;n++)r.push(e(t[n],n));return r}var s=Object.keys||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r);return e}},function(t,e,r){"use strict";r.r(e),r.d(e,"Client",(function(){return g})),r.d(e,"sign",(function(){return w})),r.d(e,"sendOperation",(function(){return x})),r.d(e,"sendOperations",(function(){return A})),r.d(e,"sendTransaction",(function(){return E})),r.d(e,"Initialize",(function(){return R}));var n=r(3),o=r.n(n),i=r(6),s=r.n(i),a=r(7),u=r.n(a),h=r(0),c=r.n(h),f=r(1),l=r.n(f),p=r(8),d=r.n(p),y="https://hivesigner.com";function v(){return"undefined"!=typeof window&&!!window}var g=function(){function t(e){s()(this,t),c()(this,"apiURL",void 0),c()(this,"app",void 0),c()(this,"callbackURL",void 0),c()(this,"scope",void 0),c()(this,"responseType",void 0),c()(this,"accessToken",void 0),this.apiURL=e.apiURL||"https://hivesigner.com",this.app=e.app,this.callbackURL=e.callbackURL,this.accessToken=e.accessToken,this.scope=e.scope,this.responseType=e.responseType}var e,r,n;return u()(t,[{key:"setBaseURL",value:function(){return console.warn('The function "setBaseUrl" is deprecated, the base URL is always "https://hivesigner.com", you can only change the API URL with "setApiURL"'),this}},{key:"setApiURL",value:function(t){return this.apiURL=t,this}},{key:"setApp",value:function(t){return this.app=t,this}},{key:"setCallbackURL",value:function(t){return this.callbackURL=t,this}},{key:"setAccessToken",value:function(t){return this.accessToken=t,this}},{key:"removeAccessToken",value:function(){return delete this.accessToken,this}},{key:"setScope",value:function(t){return this.scope=t,this}},{key:"getLoginURL",value:function(t,e){var r=encodeURIComponent(this.callbackURL),n="".concat("https://hivesigner.com","/oauth2/authorize?client_id=").concat(this.app,"&redirect_uri=").concat(r);return"code"===this.responseType&&(n+="&response_type=".concat(this.responseType)),this.scope&&(n+="&scope=".concat(this.scope.join(","))),t&&(n+="&state=".concat(encodeURIComponent(t))),e&&(n+="&select_account=".concat(e)),n}},{key:"login",value:function(t){v()&&(window.location=this.getLoginURL(t.state))}},{key:"me",value:function(t){return this.send("me","POST",{},t)}},{key:"vote",value:function(t,e,r,n,o){var i={voter:t,author:e,permlink:r,weight:n};return this.broadcast([["vote",i]],o)}},{key:"comment",value:function(t,e,r,n,o,i,s,a){var u=s;"string"!=typeof s&&(u=JSON.stringify(s));var h={parent_author:t,parent_permlink:e,author:r,permlink:n,title:o,body:i,json_metadata:u};return this.broadcast([["comment",h]],a)}},{key:"deleteComment",value:function(t,e,r){var n={author:t,permlink:e};return this.broadcast([["delete_comment",n]],r)}},{key:"customJson",value:function(t,e,r,n,o){var i={required_auths:t,required_posting_auths:e,id:r,json:n};return this.broadcast([["custom_json",i]],o)}},{key:"reblog",value:function(t,e,r,n){var o=["reblog",{account:t,author:e,permlink:r}];return this.customJson([],[t],"follow",JSON.stringify(o),n)}},{key:"follow",value:function(t,e,r){var n=["follow",{follower:t,following:e,what:["blog"]}];return this.customJson([],[t],"follow",JSON.stringify(n),r)}},{key:"unfollow",value:function(t,e,r){var n=["follow",{follower:t,following:e,what:[]}];return this.customJson([],[t],"follow",JSON.stringify(n),r)}},{key:"ignore",value:function(t,e,r){var n=["follow",{follower:t,following:e,what:["ignore"]}];return this.customJson([],[t],"follow",JSON.stringify(n),r)}},{key:"claimRewardBalance",value:function(t,e,r,n,o){var i={account:t,reward_hive:e,reward_hbd:r,reward_vests:n};return this.broadcast([["claim_reward_balance",i]],o)}},{key:"revokeToken",value:(n=o()(l.a.mark((function t(e){return l.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.send("oauth2/token/revoke","POST",{token:this.accessToken},e);case 2:return t.abrupt("return",this.removeAccessToken());case 3:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})},{key:"updateUserMetadata",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;return console.warn('The function "updateUserMetadata" is deprecated.'),this.send("me","PUT",{user_metadata:t},e)}},{key:"send",value:(r=o()(l.a.mark((function t(e,r,n,o){var i,s;return l.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i="".concat(this.apiURL,"/api/").concat(e),o){t.next=3;break}return t.abrupt("return",this.makeRequest(i,r,n));case 3:return t.prev=3,t.next=6,this.makeRequest(i,r,n);case 6:return s=t.sent,t.abrupt("return",o(null,s));case 10:return t.prev=10,t.t0=t.catch(3),t.abrupt("return",o(t.t0,null));case 13:case"end":return t.stop()}}),t,this,[[3,10]])}))),function(t,e,n,o){return r.apply(this,arguments)})},{key:"broadcast",value:function(t,e){return this.send("broadcast","POST",{operations:t},e)}},{key:"makeRequest",value:(e=o()(l.a.mark((function t(e,r,n){var o,i;return l.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,d()(e,{method:r,headers:{Accept:"application/json, text/plain, */*","Content-Type":"application/json",Authorization:this.accessToken},body:JSON.stringify(n)});case 2:return o=t.sent,t.next=5,o.json();case 5:if(i=t.sent,200===o.status&&!i.error){t.next=8;break}throw i;case 8:return t.abrupt("return",i);case 9:case"end":return t.stop()}}),t,this)}))),function(t,r,n){return e.apply(this,arguments)})}]),t}(),m=r(9),b=r.n(m);function w(t,e,r){if(console.warn('The function "sign" is deprecated.'),"string"!=typeof t||"object"!==b()(e)||null===e)return{error:"invalid_request",error_description:"Request has an invalid format"};var n="".concat("https://hivesigner.com","/sign/").concat(t,"?");return n+=Object.keys(e).map((function(t){return"".concat(t,"=").concat(encodeURIComponent(e[t]))})).join("&"),n+=r?"&redirect_uri=".concat(encodeURIComponent(r)):""}var _=r(2);function x(t,e,r){var n=Object(_.encodeOp)(t,e).replace("hive://","".concat(y,"/"));return r&&v()?window.open(n,"_blank").focus():n}function A(t,e,r){var n=Object(_.encodeOps)(t,e).replace("hive://","".concat(y,"/"));return r&&v()?window.open(n,"_blank").focus():n}function E(t,e,r){var n=Object(_.encodeTx)(t,e).replace("hive://","".concat(y,"/"));return r&&v()?window.open(n,"_blank").focus():n}function R(t){return console.warn('The function "Initialize" is deprecated, please use the class "Client" instead.'),new g(t)}e.default={Client:g,Initialize:R,sendTransaction:E,sendOperations:A,sendOperation:x,sign:w}}]);
10
+ e.read=function(t,e,r,n,o){var i,s,a=8*o-n-1,u=(1<<a)-1,h=u>>1,c=-7,f=r?o-1:0,l=r?-1:1,p=t[e+f];for(f+=l,i=p&(1<<-c)-1,p>>=-c,c+=a;c>0;i=256*i+t[e+f],f+=l,c-=8);for(s=i&(1<<-c)-1,i>>=-c,c+=n;c>0;s=256*s+t[e+f],f+=l,c-=8);if(0===i)i=1-h;else{if(i===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),i-=h}return(p?-1:1)*s*Math.pow(2,i-n)},e.write=function(t,e,r,n,o,i){var s,a,u,h=8*i-o-1,c=(1<<h)-1,f=c>>1,l=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,d=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+f>=1?l/u:l*Math.pow(2,1-f))*u>=2&&(s++,u/=2),s+f>=c?(a=0,s=c):s+f>=1?(a=(e*u-1)*Math.pow(2,o),s+=f):(a=e*Math.pow(2,f-1)*Math.pow(2,o),s=0));o>=8;t[r+p]=255&a,p+=d,a/=256,o-=8);for(s=s<<o|a,h+=o;h>0;t[r+p]=255&s,p+=d,s/=256,h-=8);t[r+p-d]|=128*y}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){(function(t,n){var o;/*! https://mths.be/punycode v1.4.1 by @mathias */!function(i){e&&e.nodeType,t&&t.nodeType;var s="object"==typeof n&&n;s.global!==s&&s.window!==s&&s.self;var a,u=2147483647,h=/^xn--/,c=/[^\x20-\x7E]/,f=/[\x2E\u3002\uFF0E\uFF61]/g,l={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},p=Math.floor,d=String.fromCharCode;function y(t){throw new RangeError(l[t])}function v(t,e){for(var r=t.length,n=[];r--;)n[r]=e(t[r]);return n}function g(t,e){var r=t.split("@"),n="";return r.length>1&&(n=r[0]+"@",t=r[1]),n+v((t=t.replace(f,".")).split("."),e).join(".")}function m(t){for(var e,r,n=[],o=0,i=t.length;o<i;)(e=t.charCodeAt(o++))>=55296&&e<=56319&&o<i?56320==(64512&(r=t.charCodeAt(o++)))?n.push(((1023&e)<<10)+(1023&r)+65536):(n.push(e),o--):n.push(e);return n}function b(t){return v(t,(function(t){var e="";return t>65535&&(e+=d((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=d(t)})).join("")}function w(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function _(t,e,r){var n=0;for(t=r?p(t/700):t>>1,t+=p(t/e);t>455;n+=36)t=p(t/35);return p(n+36*t/(t+38))}function x(t){var e,r,n,o,i,s,a,h,c,f,l,d=[],v=t.length,g=0,m=128,w=72;for((r=t.lastIndexOf("-"))<0&&(r=0),n=0;n<r;++n)t.charCodeAt(n)>=128&&y("not-basic"),d.push(t.charCodeAt(n));for(o=r>0?r+1:0;o<v;){for(i=g,s=1,a=36;o>=v&&y("invalid-input"),((h=(l=t.charCodeAt(o++))-48<10?l-22:l-65<26?l-65:l-97<26?l-97:36)>=36||h>p((u-g)/s))&&y("overflow"),g+=h*s,!(h<(c=a<=w?1:a>=w+26?26:a-w));a+=36)s>p(u/(f=36-c))&&y("overflow"),s*=f;w=_(g-i,e=d.length+1,0==i),p(g/e)>u-m&&y("overflow"),m+=p(g/e),g%=e,d.splice(g++,0,m)}return b(d)}function A(t){var e,r,n,o,i,s,a,h,c,f,l,v,g,b,x,A=[];for(v=(t=m(t)).length,e=128,r=0,i=72,s=0;s<v;++s)(l=t[s])<128&&A.push(d(l));for(n=o=A.length,o&&A.push("-");n<v;){for(a=u,s=0;s<v;++s)(l=t[s])>=e&&l<a&&(a=l);for(a-e>p((u-r)/(g=n+1))&&y("overflow"),r+=(a-e)*g,e=a,s=0;s<v;++s)if((l=t[s])<e&&++r>u&&y("overflow"),l==e){for(h=r,c=36;!(h<(f=c<=i?1:c>=i+26?26:c-i));c+=36)x=h-f,b=36-f,A.push(d(w(f+x%b,0))),h=p(x/b);A.push(d(w(h,0))),i=_(r,g,n==o),r=0,++n}++r,++e}return A.join("")}a={version:"1.4.1",ucs2:{decode:m,encode:b},decode:x,encode:A,toASCII:function(t){return g(t,(function(t){return c.test(t)?"xn--"+A(t):t}))},toUnicode:function(t){return g(t,(function(t){return h.test(t)?x(t.slice(4).toLowerCase()):t}))}},void 0===(o=function(){return a}.call(e,r,e,t))||(t.exports=o)}()}).call(this,r(17)(t),r(4))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,r){"use strict";t.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},function(t,e,r){"use strict";e.decode=e.parse=r(20),e.encode=e.stringify=r(21)},function(t,e,r){"use strict";function n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,e,r,i){e=e||"&",r=r||"=";var s={};if("string"!=typeof t||0===t.length)return s;var a=/\+/g;t=t.split(e);var u=1e3;i&&"number"==typeof i.maxKeys&&(u=i.maxKeys);var h=t.length;u>0&&h>u&&(h=u);for(var c=0;c<h;++c){var f,l,p,d,y=t[c].replace(a,"%20"),v=y.indexOf(r);v>=0?(f=y.substr(0,v),l=y.substr(v+1)):(f=y,l=""),p=decodeURIComponent(f),d=decodeURIComponent(l),n(s,p)?o(s[p])?s[p].push(d):s[p]=[s[p],d]:s[p]=d}return s};var o=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},function(t,e,r){"use strict";var n=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,e,r,a){return e=e||"&",r=r||"=",null===t&&(t=void 0),"object"==typeof t?i(s(t),(function(s){var a=encodeURIComponent(n(s))+r;return o(t[s])?i(t[s],(function(t){return a+encodeURIComponent(n(t))})).join(e):a+encodeURIComponent(n(t[s]))})).join(e):a?encodeURIComponent(n(a))+r+encodeURIComponent(n(t)):""};var o=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function i(t,e){if(t.map)return t.map(e);for(var r=[],n=0;n<t.length;n++)r.push(e(t[n],n));return r}var s=Object.keys||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r);return e}},function(t,e,r){"use strict";r.r(e),r.d(e,"Client",(function(){return g})),r.d(e,"sign",(function(){return w})),r.d(e,"sendOperation",(function(){return x})),r.d(e,"sendOperations",(function(){return A})),r.d(e,"sendTransaction",(function(){return E})),r.d(e,"Initialize",(function(){return R}));var n=r(3),o=r.n(n),i=r(6),s=r.n(i),a=r(7),u=r.n(a),h=r(0),c=r.n(h),f=r(1),l=r.n(f),p=r(8),d=r.n(p),y="https://hivesigner.com";function v(){return"undefined"!=typeof window&&!!window}var g=function(){function t(e){s()(this,t),c()(this,"apiURL",void 0),c()(this,"app",void 0),c()(this,"callbackURL",void 0),c()(this,"scope",void 0),c()(this,"responseType",void 0),c()(this,"accessToken",void 0),this.apiURL=e.apiURL||"https://hivesigner.com",this.app=e.app,this.callbackURL=e.callbackURL,this.accessToken=e.accessToken,this.scope=e.scope,this.responseType=e.responseType}var e,r,n;return u()(t,[{key:"setBaseURL",value:function(){return console.warn('The function "setBaseUrl" is deprecated, the base URL is always "https://hivesigner.com", you can only change the API URL with "setApiURL"'),this}},{key:"setApiURL",value:function(t){return this.apiURL=t,this}},{key:"setApp",value:function(t){return this.app=t,this}},{key:"setCallbackURL",value:function(t){return this.callbackURL=t,this}},{key:"setAccessToken",value:function(t){return this.accessToken=t,this}},{key:"removeAccessToken",value:function(){return delete this.accessToken,this}},{key:"setScope",value:function(t){return this.scope=t,this}},{key:"getLoginURL",value:function(t,e){var r=encodeURIComponent(this.callbackURL),n="".concat("https://hivesigner.com","/oauth2/authorize?client_id=").concat(this.app,"&redirect_uri=").concat(r);return"code"===this.responseType&&(n+="&response_type=".concat(this.responseType)),this.scope&&(n+="&scope=".concat(this.scope.join(","))),t&&(n+="&state=".concat(encodeURIComponent(t))),e&&(n+="&account=".concat(encodeURIComponent(e))),n}},{key:"login",value:function(t){v()&&(window.location=this.getLoginURL(t.state))}},{key:"me",value:function(t){return this.send("me","POST",{},t)}},{key:"decode",value:function(t){return this.send("decode","POST",{},t)}},{key:"vote",value:function(t,e,r,n,o){var i={voter:t,author:e,permlink:r,weight:n};return this.broadcast([["vote",i]],o)}},{key:"comment",value:function(t,e,r,n,o,i,s,a){var u=s;"string"!=typeof s&&(u=JSON.stringify(s));var h={parent_author:t,parent_permlink:e,author:r,permlink:n,title:o,body:i,json_metadata:u};return this.broadcast([["comment",h]],a)}},{key:"deleteComment",value:function(t,e,r){var n={author:t,permlink:e};return this.broadcast([["delete_comment",n]],r)}},{key:"customJson",value:function(t,e,r,n,o){var i={required_auths:t,required_posting_auths:e,id:r,json:n};return this.broadcast([["custom_json",i]],o)}},{key:"reblog",value:function(t,e,r,n){var o=["reblog",{account:t,author:e,permlink:r}];return this.customJson([],[t],"follow",JSON.stringify(o),n)}},{key:"follow",value:function(t,e,r){var n=["follow",{follower:t,following:e,what:["blog"]}];return this.customJson([],[t],"follow",JSON.stringify(n),r)}},{key:"unfollow",value:function(t,e,r){var n=["follow",{follower:t,following:e,what:[]}];return this.customJson([],[t],"follow",JSON.stringify(n),r)}},{key:"ignore",value:function(t,e,r){var n=["follow",{follower:t,following:e,what:["ignore"]}];return this.customJson([],[t],"follow",JSON.stringify(n),r)}},{key:"claimRewardBalance",value:function(t,e,r,n,o){var i={account:t,reward_hive:e,reward_hbd:r,reward_vests:n};return this.broadcast([["claim_reward_balance",i]],o)}},{key:"revokeToken",value:(n=o()(l.a.mark((function t(e){return l.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.send("oauth2/token/revoke","POST",{token:this.accessToken},e);case 2:return t.abrupt("return",this.removeAccessToken());case 3:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})},{key:"updateUserMetadata",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;return console.warn('The function "updateUserMetadata" is deprecated.'),this.send("me","PUT",{user_metadata:t},e)}},{key:"send",value:(r=o()(l.a.mark((function t(e,r,n,o){var i,s;return l.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i="".concat(this.apiURL,"/api/").concat(e),o){t.next=3;break}return t.abrupt("return",this.makeRequest(i,r,n));case 3:return t.prev=3,t.next=6,this.makeRequest(i,r,n);case 6:return s=t.sent,t.abrupt("return",o(null,s));case 10:return t.prev=10,t.t0=t.catch(3),t.abrupt("return",o(t.t0,null));case 13:case"end":return t.stop()}}),t,this,[[3,10]])}))),function(t,e,n,o){return r.apply(this,arguments)})},{key:"broadcast",value:function(t,e){return this.send("broadcast","POST",{operations:t},e)}},{key:"makeRequest",value:(e=o()(l.a.mark((function t(e,r,n){var o,i;return l.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,d()(e,{method:r,headers:{Accept:"application/json, text/plain, */*","Content-Type":"application/json",Authorization:this.accessToken},body:JSON.stringify(n)});case 2:return o=t.sent,t.next=5,o.json();case 5:if(i=t.sent,200===o.status&&!i.error){t.next=8;break}throw i;case 8:return t.abrupt("return",i);case 9:case"end":return t.stop()}}),t,this)}))),function(t,r,n){return e.apply(this,arguments)})}]),t}(),m=r(9),b=r.n(m);function w(t,e,r){if(console.warn('The function "sign" is deprecated.'),"string"!=typeof t||"object"!==b()(e)||null===e)return{error:"invalid_request",error_description:"Request has an invalid format"};var n="".concat("https://hivesigner.com","/sign/").concat(t,"?");return n+=Object.keys(e).map((function(t){return"".concat(t,"=").concat(encodeURIComponent(e[t]))})).join("&"),n+=r?"&redirect_uri=".concat(encodeURIComponent(r)):""}var _=r(2);function x(t,e,r){var n=Object(_.encodeOp)(t,e).replace("hive://","".concat(y,"/"));return r&&v()?window.open(n,"_blank").focus():n}function A(t,e,r){var n=Object(_.encodeOps)(t,e).replace("hive://","".concat(y,"/"));return r&&v()?window.open(n,"_blank").focus():n}function E(t,e,r){var n=Object(_.encodeTx)(t,e).replace("hive://","".concat(y,"/"));return r&&v()?window.open(n,"_blank").focus():n}function R(t){return console.warn('The function "Initialize" is deprecated, please use the class "Client" instead.'),new g(t)}e.default={Client:g,Initialize:R,sendTransaction:E,sendOperations:A,sendOperation:x,sign:w}}]);
package/lib/index.js CHANGED
@@ -109,7 +109,7 @@ var Client = /** @class */ (function () {
109
109
  this.scope = scope;
110
110
  return this;
111
111
  };
112
- Client.prototype.getLoginURL = function (state, select_account) {
112
+ Client.prototype.getLoginURL = function (state, account) {
113
113
  var redirectUri = encodeURIComponent(this.callbackURL);
114
114
  var loginURL = BASE_URL + "/oauth2/authorize?client_id=" + this.app + "&redirect_uri=" + redirectUri;
115
115
  if (this.responseType === 'code') {
@@ -121,8 +121,8 @@ var Client = /** @class */ (function () {
121
121
  if (state) {
122
122
  loginURL += "&state=" + encodeURIComponent(state);
123
123
  }
124
- if (select_account) {
125
- loginURL += "&select_account=" + select_account;
124
+ if (account) {
125
+ loginURL += "&account=" + encodeURIComponent(account);
126
126
  }
127
127
  return loginURL;
128
128
  };
@@ -135,6 +135,9 @@ var Client = /** @class */ (function () {
135
135
  Client.prototype.me = function (cb) {
136
136
  return this.send('me', 'POST', {}, cb);
137
137
  };
138
+ Client.prototype.decode = function (cb) {
139
+ return this.send('decode', 'POST', {}, cb);
140
+ };
138
141
  Client.prototype.vote = function (voter, author, permlink, weight, cb) {
139
142
  var params = {
140
143
  voter: voter,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hivesigner",
3
- "version": "3.2.9",
3
+ "version": "3.3.1",
4
4
  "description": "Hivesigner SDK",
5
5
  "main": "./lib/index",
6
6
  "types": "./lib/index",
@@ -27,7 +27,7 @@
27
27
  "@babel/plugin-transform-runtime": "^7.13.9",
28
28
  "@babel/preset-env": "^7.13.9",
29
29
  "@babel/preset-typescript": "^7.13.0",
30
- "@hiveio/dhive": "^1.2.2",
30
+ "@hiveio/dhive": "^1.2.6",
31
31
  "@types/bytebuffer": "^5.0.42",
32
32
  "@types/jest": "^26.0.20",
33
33
  "@types/node": "^14.14.28",
@@ -83,6 +83,9 @@ describe('Client', function () {
83
83
 
84
84
  expect(instance.getLoginURL('state'))
85
85
  .toBe(`${BASE_URL}/oauth2/authorize?client_id=test-app&redirect_uri=${encodeURIComponent(instance.callbackURL)}&response_type=code&scope=test-scope,test-scope-1&state=state`)
86
+
87
+ expect(instance.getLoginURL('state', 'demo'))
88
+ .toBe(`${BASE_URL}/oauth2/authorize?client_id=test-app&redirect_uri=${encodeURIComponent(instance.callbackURL)}&response_type=code&scope=test-scope,test-scope-1&state=state&account=demo`)
86
89
  })
87
90
 
88
91
  it('should change window location on login if its browser', function () {
package/src/client.ts CHANGED
@@ -58,7 +58,7 @@ export class Client {
58
58
  return this
59
59
  }
60
60
 
61
- public getLoginURL(state: string, select_account?: string): string {
61
+ public getLoginURL(state: string, account?: string): string {
62
62
  const redirectUri = encodeURIComponent(this.callbackURL)
63
63
  let loginURL = `${BASE_URL}/oauth2/authorize?client_id=${this.app}&redirect_uri=${redirectUri}`
64
64
  if (this.responseType === 'code') {
@@ -70,8 +70,8 @@ export class Client {
70
70
  if (state) {
71
71
  loginURL += `&state=${encodeURIComponent(state)}`
72
72
  }
73
- if (select_account) {
74
- loginURL += `&select_account=${select_account}`
73
+ if (account) {
74
+ loginURL += `&account=${encodeURIComponent(account)}`
75
75
  }
76
76
  return loginURL
77
77
  }
@@ -89,6 +89,12 @@ export class Client {
89
89
  return this.send('me', 'POST', {}, cb)
90
90
  }
91
91
 
92
+ public decode(): Promise<SendResponse>
93
+ public decode(cb: CallbackFunction): Promise<SendResponse>
94
+ public decode(cb?: CallbackFunction): Promise<SendResponse> {
95
+ return this.send('decode', 'POST', {}, cb)
96
+ }
97
+
92
98
  public vote(voter: string, author: string, permlink: string, weight: string | number): Promise<SendResponse>
93
99
  public vote(
94
100
  voter: string,