UNPKG

@compendiumfi/pendax

Version:

connector for centralized cryptocurrency exchanges

1 lines 6.77 kB
const a7_0x4a84c3=a7_0x2081;(function(_0x21f827,_0x233a1e){const _0x282aee=a7_0x2081,_0x1e0f46=_0x21f827();while(!![]){try{const _0x1d41c4=parseInt(_0x282aee(0xd9))/0x1*(parseInt(_0x282aee(0xea))/0x2)+parseInt(_0x282aee(0xff))/0x3*(parseInt(_0x282aee(0xe0))/0x4)+-parseInt(_0x282aee(0xef))/0x5*(-parseInt(_0x282aee(0xd7))/0x6)+-parseInt(_0x282aee(0x100))/0x7*(parseInt(_0x282aee(0x107))/0x8)+parseInt(_0x282aee(0xf3))/0x9+-parseInt(_0x282aee(0xf0))/0xa+parseInt(_0x282aee(0xee))/0xb*(parseInt(_0x282aee(0x117))/0xc);if(_0x1d41c4===_0x233a1e)break;else _0x1e0f46['push'](_0x1e0f46['shift']());}catch(_0x3e1baa){_0x1e0f46['push'](_0x1e0f46['shift']());}}}(a7_0x333d,0x5c107));function a7_0x333d(){const _0x38c241=['subaccount','forEach','push','Signature=','digest','getServerTime','label','14028kQeshb','sort','huobi','wYQQG','1148898XhPySB','CxScC','96AsOfst','getSignature','DnvRp','exchangename','dec','wtEni','toString','4CqxncX','publicApis','key','executeGetRequest','AES','hex','/v1/order/orders','sha256','stringify','api.huobi.pro','2616QCwSoc','secret','Utf8','substring','4653DnEjcm','5xwsHrI','7120420mhMhPt','GET','parse','5528493HpKNqA','update','url','/v1/account/accounts','BYmVo','apiSecret','thACG','HmacSHA256','length','https://api.hbdm.com','Base64','name','496065LrFXKb','49RxlSOR','createHmac','object','apiKey','exchange','main','data','573752yELFRv','UTC:yyyy-mm-dd\x27T\x27HH:MM:ss','keys','enc','getAccountInfo','assembleRequest','authenticate','https://api.huobi.pro','post'];a7_0x333d=function(){return _0x38c241;};return a7_0x333d();}import a7_0x47d973 from'axios';import a7_0x546f6e from'dateformat';import a7_0xb9e9c from'crypto-js';function a7_0x2081(_0x51be3f,_0x2ece9d){const _0x333dd8=a7_0x333d();return a7_0x2081=function(_0x208175,_0x3ae1c4){_0x208175=_0x208175-0xd7;let _0x305ff4=_0x333dd8[_0x208175];return _0x305ff4;},a7_0x2081(_0x51be3f,_0x2ece9d);}export class Huobi{['publicApis']=new Array();constructor(_0x3f772c){const _0x234ffc=a7_0x2081;this[_0x234ffc(0xf5)]=_0x234ffc(0x10e),this[_0x234ffc(0x10d)]=_0x3f772c[_0x234ffc(0x10d)]==undefined?!![]:_0x3f772c['authenticate'],this['baseUrl']=_0x234ffc(0xe9),this[_0x234ffc(0xfe)]=_0x3f772c[_0x234ffc(0x104)][_0x234ffc(0xdc)]==undefined?_0x234ffc(0x119):_0x3f772c[_0x234ffc(0x104)]['exchangename'],this['exchangeid']=_0x3f772c[_0x234ffc(0x104)]['id'],this[_0x234ffc(0x103)]=_0x3f772c[_0x234ffc(0xe2)]==undefined?'':_0x3f772c[_0x234ffc(0xe2)],this[_0x234ffc(0xf8)]=_0x3f772c[_0x234ffc(0xeb)]==undefined?'':_0x3f772c[_0x234ffc(0xeb)],this[_0x234ffc(0x110)]=_0x3f772c['subaccount']==undefined?_0x234ffc(0x105):_0x3f772c[_0x234ffc(0x110)],this['label']=_0x3f772c[_0x234ffc(0x116)],this[_0x234ffc(0xe1)][_0x234ffc(0x112)]('getServerTime');}[a7_0x4a84c3(0xdd)]=_0x551293=>{const _0x352462=a7_0x4a84c3;if(_0x551293==null){if(_0x352462(0xf9)==='dNFrs'){if(_0x4c1b76==null)return _0x24c409;const _0x484de9=_0x3b0414[_0x352462(0x10a)][_0x352462(0xfd)][_0x352462(0xf2)](_0x3dd89f['ky']),_0x48bfbf=_0x26bab3[_0x352462(0x10a)][_0x352462(0xfd)]['parse'](_0x3a49ad['i']);return _0x2af4cc[_0x352462(0xe4)]['decrypt'](_0x4befe9,_0x484de9,{'iv':_0x48bfbf})[_0x352462(0xdf)](_0x2a616a[_0x352462(0x10a)]['Utf8']);}else return undefined;}const _0xccfb65=a7_0xb9e9c[_0x352462(0x10a)]['Base64'][_0x352462(0xf2)](envkeys['ky']),_0x4aaeee=a7_0xb9e9c[_0x352462(0x10a)][_0x352462(0xfd)][_0x352462(0xf2)](envkeys['i']);return a7_0xb9e9c['AES']['decrypt'](_0x551293,_0xccfb65,{'iv':_0x4aaeee})['toString'](a7_0xb9e9c[_0x352462(0x10a)][_0x352462(0xec)]);};async['executeOrder'](_0x4cf9f0,_0x151f6f,_0x4d474e){const _0x4bc852=a7_0x4a84c3;let _0xe20c1e=this['url']+_0x4d474e;const _0x4ee11c=await a7_0x47d973[_0x4bc852(0x10f)](_0xe20c1e,_0x151f6f,{'headers':_0x4cf9f0});return _0x4ee11c;}async[a7_0x4a84c3(0xe3)](_0x2b3467){const _0x6e5a06=a7_0x4a84c3;let _0x3760eb={'baseURL':this['url'],'url':_0x2b3467,'method':_0x6e5a06(0xf1)};const _0x3f5077=await a7_0x47d973(_0x3760eb);return _0x3f5077;}async[a7_0x4a84c3(0x10c)](_0x1cc5af,_0x320277,_0x3b1c5b){const _0x54235d=a7_0x4a84c3;let _0x2cdbbd=await this['getServerTime'](),_0x299814=encodeURIComponent(a7_0x546f6e(new Date(_0x2cdbbd[_0x54235d(0x106)]['ts']),_0x54235d(0x108))),_0x269b3a={'AccessKeyId':this[_0x54235d(0x103)],'SignatureMethod':_0x54235d(0xfa),'SignatureVersion':'2','Timestamp':_0x299814};_0x3b1c5b&&typeof _0x3b1c5b===_0x54235d(0x102)&&Object[_0x54235d(0x109)](_0x3b1c5b)[_0x54235d(0x111)](function(_0x5e2c22){_0x269b3a[_0x5e2c22]=_0x3b1c5b[_0x5e2c22];});let _0x3f0ad4=Object[_0x54235d(0x109)](_0x269b3a)[_0x54235d(0x118)](),_0x4ee7aa='\x0a',_0x13affa=_0x320277+_0x4ee7aa+this['baseUrl']+_0x4ee7aa+_0x1cc5af+_0x4ee7aa;_0x3f0ad4[_0x54235d(0x111)](_0x124b20=>{const _0x26cb8b=_0x54235d;_0x26cb8b(0xdb)===_0x26cb8b(0xd8)?_0x53b4f4=_0x4aca17+(_0x4fa4ef[_0xeb37a5['length']-0x1]==_0x458ef5?'':'&')+_0x468696+'='+_0x34e635[_0x542103]:_0x13affa=_0x13affa+(_0x13affa[_0x13affa[_0x26cb8b(0xfb)]-0x1]==_0x4ee7aa?'':'&')+_0x124b20+'='+_0x269b3a[_0x124b20];});const _0x55347b=a7_0xb9e9c['HmacSHA256'](_0x13affa,this['apiSecret']),_0x3eb80a=a7_0xb9e9c['enc'][_0x54235d(0xfd)][_0x54235d(0xe8)](_0x55347b);let _0x483e6a=_0x1cc5af,_0x5bf6e1='?';return _0x3f0ad4['forEach'](_0x153c38=>{const _0x3c0f32=_0x54235d;if(_0x3c0f32(0x11a)==='tYrao')return _0x4ea161;else _0x5bf6e1=_0x5bf6e1+(_0x5bf6e1[_0x5bf6e1[_0x3c0f32(0xfb)]-0x1]=='?'?'':'&')+_0x153c38+'='+_0x269b3a[_0x153c38];}),_0x5bf6e1=_0x5bf6e1+'&'+_0x54235d(0x113)+encodeURIComponent(_0x3eb80a),_0x483e6a=_0x483e6a+_0x5bf6e1,_0x483e6a;}async[a7_0x4a84c3(0x10b)](){const _0x3ece3f=a7_0x4a84c3;let _0x1c7436=_0x3ece3f(0xf6),_0x2c1d7e=_0x3ece3f(0xf1),_0x220497=await this[_0x3ece3f(0x10c)](_0x1c7436,_0x2c1d7e,undefined),_0x8ab0f7=await this[_0x3ece3f(0xe3)](_0x220497);return _0x8ab0f7;}async['getWalletBalance'](_0x11fc22){const _0x4169ad=a7_0x4a84c3;let _0xb5fb5b=_0x4169ad(0xe6),_0x6fe7ed=_0x4169ad(0xf1),_0x54fc9c=this[_0x4169ad(0x10c)](_0xb5fb5b,_0x6fe7ed,_0x11fc22);return _0x54fc9c;}[a7_0x4a84c3(0xda)](_0x5c03a7,_0x18f6bd){const _0x12489f=a7_0x4a84c3;var _0xf0ea94='';return Object[_0x12489f(0x109)](_0x5c03a7)[_0x12489f(0x118)]()[_0x12489f(0x111)](function(_0x46a6f0){const _0x2de728=_0x12489f;_0x2de728(0xde)===_0x2de728(0xf7)?_0x43baa0=_0x75fead+(_0x547256[_0x445fe1[_0x2de728(0xfb)]-0x1]=='?'?'':'&')+_0x4313f6+'='+_0xfa3d37[_0x587f06]:_0xf0ea94+=_0x46a6f0+'='+_0x5c03a7[_0x46a6f0]+'&';}),_0xf0ea94=_0xf0ea94[_0x12489f(0xed)](0x0,_0xf0ea94['length']-0x1),crypto[_0x12489f(0x101)](_0x12489f(0xe7),_0x18f6bd)[_0x12489f(0xf4)](_0xf0ea94)[_0x12489f(0x114)](_0x12489f(0xe5));}async[a7_0x4a84c3(0x115)](){const _0x58cd14=a7_0x4a84c3;let _0x15bd87='/api/v1/timestamp',_0x36b959={'baseURL':_0x58cd14(0xfc),'url':_0x15bd87,'method':'GET'};const _0x1ad366=await a7_0x47d973(_0x36b959);return _0x1ad366;}}