UNPKG

ontology-ts-sdk

Version:

Comprehensive TypeScript library for the Ontology blockchain.

1 lines 205 kB
module.exports=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=42)}([function(e,t){e.exports=require("babel-runtime/helpers/classCallCheck")},function(e,t){e.exports=require("babel-runtime/helpers/createClass")},function(e,t){e.exports=require("babel-runtime/core-js/json/stringify")},function(e,t){e.exports=require("babel-runtime/regenerator")},function(e,t){e.exports=require("babel-runtime/core-js/get-iterator")},function(e,t){e.exports=require("babel-runtime/helpers/asyncToGenerator")},function(e,t){e.exports=require("axios")},function(e,t){e.exports=require("crypto-js")},function(e,t){e.exports=require("bignumber.js")},function(e,t){e.exports=require("babel-runtime/core-js/object/get-prototype-of")},function(e,t){e.exports=require("babel-runtime/helpers/possibleConstructorReturn")},function(e,t){e.exports=require("babel-runtime/helpers/inherits")},function(e,t){e.exports=require("base64-url")},function(e,t){e.exports=require("babel-runtime/core-js/map")},function(e,t){e.exports=require("elliptic")},function(e,t){e.exports=require("bip39")},function(e,t){e.exports=require("@ont-dev/sm.js")},function(e,t){e.exports=require("crypto")},function(e,t){e.exports=require("babel-runtime/helpers/extends")},function(e,t){e.exports=require("babel-runtime/helpers/get")},function(e,t){e.exports=require("base-58")},function(e,t){e.exports=require("babel-runtime/core-js/promise")},function(e,t){e.exports=require("js-sha3")},function(e,t){e.exports=require("secure-random")},function(e,t){e.exports=require("babel-runtime/core-js/object/keys")},function(e,t){e.exports=require("babel-runtime/core-js/object/assign")},function(e,t){e.exports=require("babel-runtime/helpers/toConsumableArray")},function(e,t){e.exports=require("@vespaiach/axios-fetch-adapter")},function(e,t){e.exports=require("babel-runtime/helpers/typeof")},function(e,t){e.exports=require("babel-runtime/helpers/defineProperty")},function(e,t){e.exports=require("@ont-dev/hdkey-secp256r1")},function(e,t){e.exports=require("number-to-bn")},function(e,t){e.exports=require("wif")},function(e,t){e.exports=require("pkcs7")},function(e,t){e.exports=require("babel-runtime/core-js/number/is-safe-integer")},function(e,t){e.exports=require("bn.js")},function(e,t){e.exports=require("scrypt-async")},function(e,t){e.exports=require("milagro-crypto-js")},function(e,t){e.exports=require("@ont-community/html5-websocket")},function(e,t){e.exports=require("websocket-as-promised")},function(e,t){e.exports=require("babel-runtime/helpers/objectWithoutProperties")},function(e,t){e.exports=require("uuid")},function(e,t,r){"use strict";r.r(t),r.d(t,"Account",(function(){return vu})),r.d(t,"Identity",(function(){return No})),r.d(t,"Claim",(function(){return yo})),r.d(t,"DDO",(function(){return uo})),r.d(t,"DDOAttribute",(function(){return io})),r.d(t,"Transaction",(function(){return vn})),r.d(t,"Transfer",(function(){return yn})),r.d(t,"TxSignature",(function(){return dn})),r.d(t,"Parameter",(function(){return br})),r.d(t,"ParameterType",(function(){return tr})),r.d(t,"AbiFunction",(function(){return Ar})),r.d(t,"AbiInfo",(function(){return Gu})),r.d(t,"TransactionBuilder",(function(){return l})),r.d(t,"OntAssetTxBuilder",(function(){return s})),r.d(t,"GovernanceTxBuilder",(function(){return p})),r.d(t,"utils",(function(){return a})),r.d(t,"scrypt",(function(){return i})),r.d(t,"CONST",(function(){return n})),r.d(t,"Wallet",(function(){return ls})),r.d(t,"SDK",(function(){return Ps})),r.d(t,"SimpleMessage",(function(){return so})),r.d(t,"Token",(function(){return g})),r.d(t,"OntidContract",(function(){return c})),r.d(t,"RestClient",(function(){return ca})),r.d(t,"RpcClient",(function(){return Wo})),r.d(t,"WebsocketClient",(function(){return Vu})),r.d(t,"Crypto",(function(){return u})),r.d(t,"Struct",(function(){return zr})),r.d(t,"ScriptBuilder",(function(){return o})),r.d(t,"NeoCore",(function(){return d})),r.d(t,"Oep4",(function(){return y})),r.d(t,"Oep8",(function(){return v})),r.d(t,"Oep5",(function(){return m})),r.d(t,"Merkle",(function(){return h})),r.d(t,"Credentials",(function(){return f}));var n={};r.r(n),r.d(n,"ADDR_VERSION",(function(){return B})),r.d(n,"DEFAULT_SCRYPT",(function(){return N})),r.d(n,"OEP_HEADER",(function(){return C})),r.d(n,"OEP_FLAG",(function(){return O})),r.d(n,"WEBVIEW_SCHEME",(function(){return D})),r.d(n,"DEFAULT_ALGORITHM",(function(){return H})),r.d(n,"DEFAULT_SM2_ID",(function(){return _})),r.d(n,"TEST_NODE",(function(){return z})),r.d(n,"TEST_NODE_1",(function(){return U})),r.d(n,"TEST_NODE_2",(function(){return L})),r.d(n,"MAIN_NODE",(function(){return M})),r.d(n,"HTTPS_REST_PORT",(function(){return K})),r.d(n,"HTTPS_WS_PORT",(function(){return V})),r.d(n,"HTTPS_JSON_PORT",(function(){return G})),r.d(n,"REST_API",(function(){return J})),r.d(n,"ONT_NETWORK",(function(){return W})),r.d(n,"TEST_ONT_URL_1",(function(){return F})),r.d(n,"TEST_ONT_URL_2",(function(){return q})),r.d(n,"TEST_ONT_URL",(function(){return j})),r.d(n,"MAIN_ONT_URL",(function(){return Y})),r.d(n,"TOKEN_TYPE",(function(){return Q})),r.d(n,"DEFAULT_GAS_LIMIT",(function(){return X})),r.d(n,"NATIVE_INVOKE_NAME",(function(){return Z})),r.d(n,"TX_MAX_SIG_SIZE",(function(){return $})),r.d(n,"ONT_BIP44_PATH",(function(){return ee})),r.d(n,"UNBOUND_GENERATION_AMOUNT",(function(){return te})),r.d(n,"UNBOUND_TIME_INTERVAL",(function(){return re})),r.d(n,"ONT_TOTAL_SUPPLY",(function(){return ne})),r.d(n,"GENESIS_BLOCK_TIMESTAMP",(function(){return ae}));var a={};r.r(a),r.d(a,"hexstring2ab",(function(){return ke})),r.d(a,"ab2hexstring",(function(){return Se})),r.d(a,"ab2str",(function(){return Ae})),r.d(a,"str2ab",(function(){return xe})),r.d(a,"str2hexstr",(function(){return be})),r.d(a,"hexstr2str",(function(){return Re})),r.d(a,"hex2VarBytes",(function(){return Te})),r.d(a,"str2VarBytes",(function(){return Ee})),r.d(a,"bool2VarByte",(function(){return Pe})),r.d(a,"hexXor",(function(){return Ie})),r.d(a,"num2hexstring",(function(){return Be})),r.d(a,"num2VarInt",(function(){return Ne})),r.d(a,"reverseHex",(function(){return Ce})),r.d(a,"bigIntFromBytes",(function(){return Oe})),r.d(a,"bigIntToBytes",(function(){return De})),r.d(a,"StringReader",(function(){return He})),r.d(a,"EventEmitter",(function(){return _e})),r.d(a,"sendBackResult2Native",(function(){return ze})),r.d(a,"axiosPost",(function(){return Ue})),r.d(a,"now",(function(){return Le})),r.d(a,"sha256",(function(){return Me})),r.d(a,"ripemd160",(function(){return Ke})),r.d(a,"hash160",(function(){return Ve})),r.d(a,"generateRandomArray",(function(){return Ge})),r.d(a,"randomBytes",(function(){return Je})),r.d(a,"generateMnemonic",(function(){return We})),r.d(a,"parseMnemonic",(function(){return Fe})),r.d(a,"varifyPositiveInt",(function(){return qe})),r.d(a,"isBase64",(function(){return je})),r.d(a,"isHexString",(function(){return Ye})),r.d(a,"unboundDeadline",(function(){return Qe})),r.d(a,"calcUnboundOng",(function(){return Xe})),r.d(a,"needUseFetch",(function(){return Ze}));var i={};r.r(i),r.d(i,"encryptWithCtr",(function(){return Ut})),r.d(i,"decryptWithCtr",(function(){return Lt})),r.d(i,"checkCtrDecrypted",(function(){return Mt})),r.d(i,"encryptWithEcb",(function(){return Kt})),r.d(i,"decryptWithEcb",(function(){return Vt})),r.d(i,"checkEcbDecrypted",(function(){return Gt})),r.d(i,"encryptWithGcm",(function(){return Jt})),r.d(i,"decryptWithGcm",(function(){return Wt}));var u={};r.r(u),r.d(u,"Address",(function(){return Et})),r.d(u,"KeyType",(function(){return tt})),r.d(u,"CurveLabel",(function(){return st})),r.d(u,"SignatureScheme",(function(){return et})),r.d(u,"KeyParameters",(function(){return lt})),r.d(u,"PrivateKey",(function(){return Yt})),r.d(u,"registerKeyDeserializer",(function(){return $t})),r.d(u,"PublicKey",(function(){return ht})),r.d(u,"PublicKeyStatus",(function(){return dt})),r.d(u,"Signature",(function(){return qt})),r.d(u,"Issuer",(function(){return ar})),r.d(u,"User",(function(){return ir})),r.d(u,"Ecies",(function(){return hr}));var o={};r.r(o),r.d(o,"pushBool",(function(){return Ur})),r.d(o,"pushInt",(function(){return Lr})),r.d(o,"pushBigNum",(function(){return Mr})),r.d(o,"getStructBytes",(function(){return Kr})),r.d(o,"getMapBytes",(function(){return Vr})),r.d(o,"pushMap",(function(){return Gr})),r.d(o,"pushParam",(function(){return Jr})),r.d(o,"serializeAbiFunction",(function(){return Wr})),r.d(o,"convertArray",(function(){return Fr})),r.d(o,"convertMap",(function(){return qr})),r.d(o,"deserializeItem",(function(){return jr})),r.d(o,"createCodeParamsScript",(function(){return Qr})),r.d(o,"buildSmartContractParam",(function(){return Xr})),r.d(o,"buildWasmContractParam",(function(){return Zr})),r.d(o,"writeUint16",(function(){return $r})),r.d(o,"writeUint32",(function(){return en})),r.d(o,"writeUint64",(function(){return tn})),r.d(o,"writeVarBytes",(function(){return rn})),r.d(o,"writeString",(function(){return nn})),r.d(o,"writeAddress",(function(){return an})),r.d(o,"writeH256",(function(){return un})),r.d(o,"writeI128",(function(){return on})),r.d(o,"writeBool",(function(){return sn})),r.d(o,"writeVarUint",(function(){return cn}));var s={};r.r(s),r.d(s,"ONT_CONTRACT",(function(){return wn})),r.d(s,"ONG_CONTRACT",(function(){return kn})),r.d(s,"getTokenContract",(function(){return Sn})),r.d(s,"verifyAmount",(function(){return An})),r.d(s,"makeTransferTx",(function(){return xn})),r.d(s,"makeTransferTxV2",(function(){return bn})),r.d(s,"makeTransferStateTx",(function(){return Rn})),r.d(s,"makeTransferStateTxV2",(function(){return Tn})),r.d(s,"makeTransferToMany",(function(){return En})),r.d(s,"makeTransferToManyV2",(function(){return Pn})),r.d(s,"makeWithdrawOngTx",(function(){return In})),r.d(s,"makeWithdrawOngTxV2",(function(){return Bn})),r.d(s,"makeApproveTx",(function(){return Nn})),r.d(s,"makeQueryAllowanceTx",(function(){return Cn})),r.d(s,"makeQueryAllowanceTxV2",(function(){return On})),r.d(s,"makeQueryBalanceTx",(function(){return Dn})),r.d(s,"makeQueryBalanceTxV2",(function(){return Hn})),r.d(s,"deserializeTransferTx",(function(){return _n})),r.d(s,"deserializeTransferTxV2",(function(){return zn}));var c={};r.r(c),r.d(c,"ONTID_CONTRACT",(function(){return fa})),r.d(c,"buildRegIDWithPublicKeyTx",(function(){return $a})),r.d(c,"buildRegisterOntidTx",(function(){return ei})),r.d(c,"buildRegIdWithMultiControllerTx",(function(){return ti})),r.d(c,"buildMakeRevokeIdTx",(function(){return ri})),r.d(c,"buildRevokeIdByMultiController",(function(){return ni})),r.d(c,"buildRemoveControllerTx",(function(){return ai})),r.d(c,"buildRegIdWithAttributesTx",(function(){return ii})),r.d(c,"buildAddAttributeTx",(function(){return ui})),r.d(c,"buildRemoveAttributeTx",(function(){return oi})),r.d(c,"buildGetAttributesTx",(function(){return si})),r.d(c,"buildAddAttributesByMultiControllerTx",(function(){return ci})),r.d(c,"buildAddAttributesByIndexTx",(function(){return li})),r.d(c,"buildRemoveAttributeByMultiControllerTx",(function(){return fi})),r.d(c,"buildRemoveAttributeByIndexTx",(function(){return hi})),r.d(c,"buildGetDDOTx",(function(){return di})),r.d(c,"buildAddPubKeyTx",(function(){return vi})),r.d(c,"buildAddKeyByMultiControllerTx",(function(){return yi})),r.d(c,"buildAddKeyByIndexTx",(function(){return pi})),r.d(c,"buildRemoveKeyByIndexTx",(function(){return gi})),r.d(c,"buildSetRecoveryTx",(function(){return mi})),r.d(c,"buildUpdateRecoveryTx",(function(){return wi})),r.d(c,"buildAddKeyByRecoveryTx",(function(){return ki})),r.d(c,"buildRemoveKeyByRecoveryTx",(function(){return Si})),r.d(c,"buildRemoveKeyByMultiControllerTx",(function(){return Ai})),r.d(c,"buildRemovePubKeyTx",(function(){return xi})),r.d(c,"buildGetPublicKeysTx",(function(){return bi})),r.d(c,"buildGetPublicKeyStateTx",(function(){return Ri})),r.d(c,"buildAddNewAuthKeyTx",(function(){return Ti})),r.d(c,"buildRemoveAuthKeyTx",(function(){return Ei})),r.d(c,"buildAddNewAuthKeyByRecoveryTx",(function(){return Pi})),r.d(c,"buildRemoveAuthKeyByRecoveryTx",(function(){return Ii})),r.d(c,"buildAddNewAuthKeyByControllerTx",(function(){return Bi})),r.d(c,"buildRemoveAuthKeyByControllerTx",(function(){return Ni})),r.d(c,"buildAddServiceTx",(function(){return Ci})),r.d(c,"buildUpdateServiceTx",(function(){return Oi})),r.d(c,"buildRemoveServiceTx",(function(){return Di})),r.d(c,"buildAddContextTx",(function(){return Hi})),r.d(c,"buildRemoveContextTx",(function(){return _i})),r.d(c,"buildVerifySignatureTx",(function(){return zi})),r.d(c,"buildVerifyMultiControllerTx",(function(){return Ui})),r.d(c,"buildGetServiceTx",(function(){return Li})),r.d(c,"buildGetControllerTx",(function(){return Mi})),r.d(c,"buildGetDocumentTx",(function(){return Ki})),r.d(c,"getDocumentJson",(function(){return Gi}));var l={};r.r(l),r.d(l,"Default_params",(function(){return Ji})),r.d(l,"signTransaction",(function(){return Wi})),r.d(l,"signTransactionAsync",(function(){return Fi})),r.d(l,"addSign",(function(){return qi})),r.d(l,"signTx",(function(){return Yi})),r.d(l,"makeInvokeTransaction",(function(){return Qi})),r.d(l,"buildWasmVmInvokeCode",(function(){return Xi})),r.d(l,"makeWasmVmInvokeTransaction",(function(){return Zi})),r.d(l,"makeDeployCodeTransaction",(function(){return $i})),r.d(l,"buildTxParam",(function(){return eu})),r.d(l,"buildRpcParam",(function(){return tu})),r.d(l,"buildRestfulParam",(function(){return ru})),r.d(l,"sendRawTxRestfulUrl",(function(){return nu})),r.d(l,"transferStringParameter",(function(){return au})),r.d(l,"transformMapParameter",(function(){return iu})),r.d(l,"transformArrayParameter",(function(){return uu})),r.d(l,"transformParameter",(function(){return ou})),r.d(l,"buildParamsByJson",(function(){return su})),r.d(l,"makeTransactionsByJson",(function(){return cu})),r.d(l,"makeTransactionsByJsonV2",(function(){return lu})),r.d(l,"buildNativeTxFromJson",(function(){return fu})),r.d(l,"buildNativeTxFromJsonV2",(function(){return hu}));var f={};r.r(f),r.d(f,"JwtHeader",(function(){return mo})),r.d(f,"JwtMessage",(function(){return Eo})),r.d(f,"JwtPayload",(function(){return Ao})),r.d(f,"VcPayload",(function(){return bo})),r.d(f,"VpPayload",(function(){return To})),r.d(f,"VerifiableCredentialAttribute",(function(){return xo})),r.d(f,"VerifiablePresentationAttribute",(function(){return Ro})),r.d(f,"retrievePublicKey",(function(){return wo})),r.d(f,"retrievePublicKeyState",(function(){return ko})),r.d(f,"extractOntId",(function(){return So}));var h={};r.r(h),r.d(h,"verifyLeafHashInclusion",(function(){return Co})),r.d(h,"calculateRootHashFromAuditPath",(function(){return Oo})),r.d(h,"hashChildren",(function(){return Do})),r.d(h,"getProofNodes",(function(){return Ho})),r.d(h,"constructMerkleProof",(function(){return _o})),r.d(h,"verifyClaimProof",(function(){return zo}));var d={};r.r(d),r.d(d,"InvocationTransaction",(function(){return Lo})),r.d(d,"NeoRpc",(function(){return Mo})),r.d(d,"Program",(function(){return Ko})),r.d(d,"SmartContract",(function(){return Vo})),r.d(d,"TransactionInput",(function(){return Go})),r.d(d,"TransactionOutput",(function(){return Jo})),r.d(d,"TransactionNeo",(function(){return Uo}));var v={};r.r(v),r.d(v,"Oep8State",(function(){return Fo})),r.d(v,"TransferFrom",(function(){return qo})),r.d(v,"Oep8TxBuilder",(function(){return cs}));var y={};r.r(y),r.d(y,"formatBigNumParameter",(function(){return As})),r.d(y,"Oep4State",(function(){return xs})),r.d(y,"Oep4TxBuilder",(function(){return bs}));var p={};r.r(p),r.d(p,"makeRegisterCandidateTx",(function(){return Bs})),r.d(p,"makeUnregisterCandidateTx",(function(){return Ns})),r.d(p,"makeApproveCandidateTx",(function(){return Cs})),r.d(p,"makeRejectCandidateTx",(function(){return Os})),r.d(p,"makeVoteForPeerTx",(function(){return Ds})),r.d(p,"makeUnvoteForPeerTx",(function(){return Hs})),r.d(p,"makeWithdrawTx",(function(){return _s})),r.d(p,"makeQuitNodeTx",(function(){return zs})),r.d(p,"makeChangeAuthorizationTx",(function(){return Us})),r.d(p,"makeSetPeerCostTx",(function(){return Ls})),r.d(p,"makeSetFeePercentageTx",(function(){return Ms})),r.d(p,"makeWithdrawFeeTx",(function(){return Ks})),r.d(p,"makeAuthorizeForPeerTx",(function(){return Vs})),r.d(p,"makeUnauthorizeForPeerTx",(function(){return Gs})),r.d(p,"makeAddInitPosTx",(function(){return Js})),r.d(p,"makeReduceInitPosTx",(function(){return Ws})),r.d(p,"makeWithdrawPeerUnboundOngTx",(function(){return Fs})),r.d(p,"getAttributes",(function(){return Zs})),r.d(p,"getSplitFeeAddress",(function(){return $s})),r.d(p,"getAuthorizeInfo",(function(){return ec})),r.d(p,"getGovernanceView",(function(){return tc})),r.d(p,"getPeerPoolMap",(function(){return rc})),r.d(p,"getGlobalParam",(function(){return nc})),r.d(p,"getTotalStake",(function(){return ac})),r.d(p,"getPeerUnboundOng",(function(){return ic})),r.d(p,"getConfiguration",(function(){return uc})),r.d(p,"GovernanceView",(function(){return oc})),r.d(p,"PeerPoolItem",(function(){return sc})),r.d(p,"PeerAttributes",(function(){return cc})),r.d(p,"SplitFeeAddress",(function(){return lc})),r.d(p,"AuthorizeInfo",(function(){return fc})),r.d(p,"GlobalParam",(function(){return hc})),r.d(p,"TotalStake",(function(){return dc})),r.d(p,"Configuration",(function(){return vc}));var g={};r.r(g),r.d(g,"Transfers",(function(){return yc})),r.d(g,"TokenTransfer",(function(){return pc})),r.d(g,"State",(function(){return gc})),r.d(g,"Contract",(function(){return mc})),r.d(g,"TransferFrom",(function(){return wc}));var m={};r.r(m),r.d(m,"Oep5Param",(function(){return kc})),r.d(m,"Oep5TxBuilder",(function(){return Dc}));var w,k,S=r(0),A=r.n(S),x=r(1),b=r.n(x),R=r(18),T=r.n(R),E=r(2),P=r.n(E),I=r(15),B="17",N={cost:4096,blockSize:8,parallel:8,size:64},C="0142",O="e0",D="Ont",H={algorithm:"ECDSA",parameters:{curve:"P-256"}},_="1234567812345678",z="polaris1.ont.io",U="polaris1.ont.io",L="polaris2.ont.io",M="dappnode1.ont.io",K="10334",V="10335",G="10336",J={getBalance:"/api/v1/balance",getBalanceV2:"/api/v1/balancev2",sendRawTx:"/api/v1/transaction",getMerkleProof:"/api/v1/merkleproof"},W={MAIN:"MainNet",TEST:"TestNet"},F={SOCKET_URL:"wss://"+U+":"+V,RPC_URL:"https://"+U+":"+G,REST_URL:"https://"+U+":"+K,sendRawTxByRestful:"https://"+U+":"+K+J.sendRawTx},q={SOCKET_URL:"wss://"+L+":"+V,RPC_URL:"https://"+L+":"+G,REST_URL:"https://"+L+":"+K,sendRawTxByRestful:"https://"+L+":"+K+J.sendRawTx},j={SOCKET_URL:"wss://"+z+":"+V,RPC_URL:"https://"+z+":"+G,REST_URL:"https://"+z+":"+K,sendRawTxByRestful:"https://"+z+":"+K+J.sendRawTx},Y={SOCKET_URL:"wss://"+M+":"+V,RPC_URL:"https://"+M+":"+G+"/",REST_URL:"https://"+M+":"+K+"/",sendRawTxByRestful:"https://"+z+":"+K+J.sendRawTx},Q={ONT:"ONT",ONG:"ONG"},X=3e4,Z="Ontology.Native.Invoke",$=16,ee="m/44'/1024'/0'/0/0",te=[5,4,3,3,2,2,2,1,1,1,1,1,1,1,1,1,1,1],re=31536e3,ne=1e9,ae=1530316800,ie=r(4),ue=r.n(ie),oe=r(20),se=r(7);!function(e){e[e.SUCCESS=0]="SUCCESS",e[e.SESSION_EXPIRED=41001]="SESSION_EXPIRED",e[e.SERVICE_CEILING=41002]="SERVICE_CEILING",e[e.ILLEGAL_DATAFORMAT=41003]="ILLEGAL_DATAFORMAT",e[e.INVALID_VERSION=41004]="INVALID_VERSION",e[e.INVALID_METHOD=42001]="INVALID_METHOD",e[e.INVALID_PARAMS=42002]="INVALID_PARAMS",e[e.INVALID_TRANSACTION=43001]="INVALID_TRANSACTION",e[e.INVALID_ASSET=43002]="INVALID_ASSET",e[e.INVALID_BLOCK=43003]="INVALID_BLOCK",e[e.UNKNOWN_TRANSACTION=44001]="UNKNOWN_TRANSACTION",e[e.UNKNOWN_ASSET=44002]="UNKNOWN_ASSET",e[e.UNKNOWN_BLOCK=44003]="UNKNOWN_BLOCK",e[e.UNKNWN_CONTRACT=44004]="UNKNWN_CONTRACT",e[e.INTERNAL_ERROR=45001]="INTERNAL_ERROR",e[e.SMARTCODE_ERROR=47001]="SMARTCODE_ERROR",e[e.UNKNOWN_ONTID=51e3]="UNKNOWN_ONTID",e[e.NETWORK_ERROR=52e3]="NETWORK_ERROR",e[e.Decrypto_ERROR=53e3]="Decrypto_ERROR",e[e.INVALID_ADDR=53001]="INVALID_ADDR",e[e.PreExec_ERROR=54e3]="PreExec_ERROR"}(w||(w={})),function(e){e[e.PUSH0=0]="PUSH0",e[e.PUSHF=0]="PUSHF",e[e.PUSHBYTES1=1]="PUSHBYTES1",e[e.PUSHBYTES75=75]="PUSHBYTES75",e[e.PUSHDATA1=76]="PUSHDATA1",e[e.PUSHDATA2=77]="PUSHDATA2",e[e.PUSHDATA4=78]="PUSHDATA4",e[e.PUSHM1=79]="PUSHM1",e[e.PUSH1=81]="PUSH1",e[e.PUSHT=81]="PUSHT",e[e.PUSH2=82]="PUSH2",e[e.PUSH3=83]="PUSH3",e[e.PUSH4=84]="PUSH4",e[e.PUSH5=85]="PUSH5",e[e.PUSH6=86]="PUSH6",e[e.PUSH7=87]="PUSH7",e[e.PUSH8=88]="PUSH8",e[e.PUSH9=89]="PUSH9",e[e.PUSH10=90]="PUSH10",e[e.PUSH11=91]="PUSH11",e[e.PUSH12=92]="PUSH12",e[e.PUSH13=93]="PUSH13",e[e.PUSH14=94]="PUSH14",e[e.PUSH15=95]="PUSH15",e[e.PUSH16=96]="PUSH16",e[e.NOP=97]="NOP",e[e.JMP=98]="JMP",e[e.JMPIF=99]="JMPIF",e[e.JMPIFNOT=100]="JMPIFNOT",e[e.CALL=101]="CALL",e[e.RET=102]="RET",e[e.APPCALL=103]="APPCALL",e[e.SYSCALL=104]="SYSCALL",e[e.TAILCALL=105]="TAILCALL",e[e.DUPFROMALTSTACK=106]="DUPFROMALTSTACK",e[e.TOALTSTACK=107]="TOALTSTACK",e[e.FROMALTSTACK=108]="FROMALTSTACK",e[e.XDROP=109]="XDROP",e[e.XSWAP=114]="XSWAP",e[e.XTUCK=115]="XTUCK",e[e.DEPTH=116]="DEPTH",e[e.DROP=117]="DROP",e[e.DUP=118]="DUP",e[e.NIP=119]="NIP",e[e.OVER=120]="OVER",e[e.PICK=121]="PICK",e[e.ROLL=122]="ROLL",e[e.ROT=123]="ROT",e[e.SWAP=124]="SWAP",e[e.TUCK=125]="TUCK",e[e.CAT=126]="CAT",e[e.SUBSTR=127]="SUBSTR",e[e.LEFT=128]="LEFT",e[e.RIGHT=129]="RIGHT",e[e.SIZE=130]="SIZE",e[e.INVERT=131]="INVERT",e[e.AND=132]="AND",e[e.OR=133]="OR",e[e.XOR=134]="XOR",e[e.EQUAL=135]="EQUAL",e[e.INC=139]="INC",e[e.DEC=140]="DEC",e[e.NEGATE=143]="NEGATE",e[e.ABS=144]="ABS",e[e.NOT=145]="NOT",e[e.NZ=146]="NZ",e[e.ADD=147]="ADD",e[e.SUB=148]="SUB",e[e.MUL=149]="MUL",e[e.DIV=150]="DIV",e[e.MOD=151]="MOD",e[e.SHL=152]="SHL",e[e.SHR=153]="SHR",e[e.BOOLAND=154]="BOOLAND",e[e.BOOLOR=155]="BOOLOR",e[e.NUMEQUAL=156]="NUMEQUAL",e[e.NUMNOTEQUAL=158]="NUMNOTEQUAL",e[e.LT=159]="LT",e[e.GT=160]="GT",e[e.LTE=161]="LTE",e[e.GTE=162]="GTE",e[e.MIN=163]="MIN",e[e.MAX=164]="MAX",e[e.WITHIN=165]="WITHIN",e[e.SHA1=167]="SHA1",e[e.SHA256=168]="SHA256",e[e.HASH160=169]="HASH160",e[e.HASH256=170]="HASH256",e[e.CHECKSIG=172]="CHECKSIG",e[e.CHECKMULTISIG=174]="CHECKMULTISIG",e[e.ARRAYSIZE=192]="ARRAYSIZE",e[e.PACK=193]="PACK",e[e.UNPACK=194]="UNPACK",e[e.PICKITEM=195]="PICKITEM",e[e.SETITEM=196]="SETITEM",e[e.NEWARRAY=197]="NEWARRAY",e[e.NEWSTRUCT=198]="NEWSTRUCT",e[e.NEWMAP=199]="NEWMAP",e[e.APPEND=200]="APPEND",e[e.REVERSE=201]="REVERSE",e[e.REMOVE=202]="REMOVE",e[e.HASKEY=203]="HASKEY",e[e.KEYS=204]="KEYS",e[e.VALUES=205]="VALUES",e[e.THROW=240]="THROW",e[e.THROWIFNOT=241]="THROWIFNOT"}(k||(k={}));var ce=k,le=r(16),fe=r(14),he=r(8),de=r(34),ve=r.n(de),ye=r(6),pe=r.n(ye),ge=r(35),me=r(31),we=r(23);function ke(e){for(var t=[];e.length>=2;)t.push(parseInt(e.substring(0,2),16)),e=e.substring(2,e.length);return t}function Se(e){for(var t="",r=new Uint8Array(e),n=0;n<r.byteLength;n++){var a=r[n].toString(16);t+=a=0===a.length?"00":1===a.length?"0"+a:a}return t}function Ae(e){var t,r=void 0,n=void 0,a=void 0,i=void 0,u=void 0;r="";var o=new Uint8Array(e);for(t=o.length,n=0;n<t;)switch((a=o[n++])>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:r+=String.fromCharCode(a);break;case 12:case 13:i=o[n++],r+=String.fromCharCode((31&a)<<6|63&i);break;case 14:i=o[n++],u=o[n++],r+=String.fromCharCode((15&a)<<12|(63&i)<<6|(63&u)<<0)}return r}function xe(e){for(var t=[],r=0;r<e.length;r++){var n=e.charCodeAt(r);n<128?t.push(n):n<2048?t.push(192|n>>6,128|63&n):n<55296||n>=57344?t.push(224|n>>12,128|n>>6&63,128|63&n):(r++,n=65536+((1023&n)<<10|1023&e.charCodeAt(r)),t.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|63&n))}return Uint8Array.from(t)}function be(e){return Se(xe(e))}function Re(e){return Ae(ke(e))}function Te(e){var t="";return t+=Ne(e.length/2),t+=e}function Ee(e){var t="",r=be(e);return t+=Ne(r.length/2),t+=r}function Pe(e){return e?"01":"00"}function Ie(e,t){if(e.length!==t.length)throw new Error("strings are disparate lengths");if(e.length%2!=0)throw new Error("strings must be hex");for(var r=new ArrayBuffer(e.length/2),n=new Uint8Array(r),a=0;a<e.length;a+=2)n[a/2]=parseInt(e.substr(a,2),16)^parseInt(t.substr(a,2),16);return Se(r)}var Be=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e<0)throw new RangeError("num must be >=0");if(t%1!=0)throw new Error("size must be a whole integer");if(!ve()(e))throw new RangeError("num ("+e+") must be a safe integer");t*=2;var n=e.toString(16);return n=n.length%t==0?n:("0".repeat(t)+n).substring(n.length),r&&(n=Ce(n)),n},Ne=function(e){return e<253?Be(e):e<=65535?"fd"+Be(e,2,!0):e<=4294967295?"fe"+Be(e,4,!0):"ff"+Be(e,8,!0)},Ce=function(e){if(e.length%2!=0)throw new Error("Incorrect Length: "+e);for(var t="",r=e.length-2;r>=0;r-=2)t+=e.substr(r,2);return t};function Oe(e){var t=Buffer.from(e,"hex").reverse();return 0===t.length?"0":new ge(t).fromTwos(8*t.length).toString()}function De(e){var t=e instanceof he.BigNumber?me(e):me(new he.BigNumber(e));if(t.isZero())return"";var r=t.toTwos(8*t.byteLength()).toArray();return t.isNeg()?r[0]<128&&r.unshift(255):r[0]>=128&&r.unshift(0),Buffer.from(r.reverse()).toString("hex")}var He=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";if(A()(this,e),t.length%2!=0)throw new Error("Param's length is not even.");this.str=t,this.pos=0,this.size=this.str.length/2}return b()(e,[{key:"isEmpty",value:function(){return this.pos>=this.str.length}},{key:"read",value:function(e){if(this.isEmpty())throw new Error("StringReader reached the end.");var t=this.str.substr(this.pos,2*e);return this.pos+=2*e,t}},{key:"unreadBytes",value:function(e){if(this.pos-2*e<0)throw new Error("Can not unread too many bytes.");this.pos-=2*e}},{key:"readNullTerminated",value:function(){var e=this.str.indexOf("00",this.pos);if(-1===e)throw new Error("No ending NULL found");var t=this.str.substring(this.pos,e);return this.pos=e+2,t}},{key:"readNextByte",value:function(){return this.read(1)}},{key:"readNextBytes",value:function(){var e=this.readNextLen();return 0===e?"":this.read(e)}},{key:"readNextLen",value:function(){var e=parseInt(this.read(1),16);return 253===e?e=parseInt(Ce(this.read(2)),16):254===e?e=parseInt(Ce(this.read(4)),16):255===e&&(e=parseInt(Ce(this.read(8)),16)),e}},{key:"readVarUint",value:function(){return this.readNextLen()}},{key:"readUint8",value:function(){return parseInt(Ce(this.read(1)),16)}},{key:"readUint16",value:function(){return parseInt(Ce(this.read(2)),16)}},{key:"readUint32",value:function(){return parseInt(Ce(this.read(4)),16)}},{key:"readUint64",value:function(){return parseInt(Ce(this.read(8)),16)}},{key:"readUint128",value:function(){return parseInt(Ce(this.read(16)),16)}},{key:"readInt",value:function(){return parseInt(Ce(this.read(4)),16)}},{key:"readLong",value:function(){return parseInt(Ce(this.read(8)),16)}},{key:"readBoolean",value:function(){return 0!==parseInt(this.read(1),16)}},{key:"readH256",value:function(){return this.read(32)}}]),e}(),_e=function(){function e(){A()(this,e),this.handlers={}}return b()(e,[{key:"on",value:function(e,t){void 0===this.handlers[e]&&(this.handlers[e]=[]),this.handlers[e].push(t)}},{key:"trigger",value:function(e,t){if(this.handlers[e]instanceof Array)for(var r=this.handlers[e],n=0,a=r.length;n<a;n++)r[n](t)}},{key:"off",value:function(e){delete this.handlers[e]}}]),e}(),ze=function(e,t){window&&window.prompt&&window.prompt(D+"://"+t+"?params="+e)},Ue=function(e,t){return pe.a.post(e,t).then((function(e){return console.log("axios res:"+e),e})).catch((function(e){return console.log("axios res:"+P()(e)),e}))};function Le(){return Math.floor(Date.now()/1e3)}function Me(e){var t=se.enc.Hex.parse(e);return se.SHA256(t).toString()}function Ke(e){var t=se.enc.Hex.parse(e);return se.RIPEMD160(t).toString()}function Ve(e){return Ke(Me(e))}function Ge(e){try{return we(e)}catch(r){var t=new Uint8Array(e);return crypto.getRandomValues(t),[].slice.call(t)}}function Je(e){return Se(Ge(e))}function We(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:16,t=Se(Ge(e));return I.entropyToMnemonic(t)}function Fe(e){return I.mnemonicToEntropy(e)}function qe(e){if(!/^[1-9]\d*$/.test(e.toString()))throw w.INVALID_PARAMS}function je(e){return Buffer.from(e,"base64").toString("base64")===e}function Ye(e){return/^[0-9a-fA-F]+$/.test(e)&&e.length%2==0}function Qe(){var e=Math.floor(Date.UTC(2018,5,30,0,0,0)/1e3);return Math.floor(Date.UTC(2020,6,7,0,0,0)/1e3)-e}function Xe(e,t,r){var n=0;if(t>=r)return 0;var a=Qe();if(t<a){var i=Math.floor(t/re),u=t%re;r>=a&&(r=a);for(var o=Math.floor(r/re),s=r%re;i<o;)n+=(re-u)*te[i],i++,u=0;n+=(s-u)*te[i]}return n*e}function Ze(){var e=!1;try{new XMLHttpRequest}catch(t){try{fetch;e=!0}catch(e){}}return e}var $e=function(){function e(t){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];A()(this,e);var n=new he.BigNumber(t);if(!n.isInteger())throw new Error(String(w.INVALID_PARAMS));this.value=t,this.ledgerCompatible=r}return b()(e,[{key:"toHexstr",value:function(){var e=De(this.value);return this.ledgerCompatible&&(e.length%2!=0||e.length<16)&&(e+="0".repeat(16-e.length)),e}}],[{key:"fromHexstr",value:function(t){return new e(Oe(t))}}]),e}(),et=function(){function e(t,r,n){A()(this,e),this.label=t,this.hex=r,this.labelJWS=n,e.values.push(this)}return b()(e,null,[{key:"fromHex",value:function(t){var r=e.values.find((function(e){return e.hex===t}));if(void 0===r)throw new Error("Enum value not found");return r}},{key:"fromLabel",value:function(t){var r=e.values.find((function(e){return e.label===t}));if(void 0===r)throw new Error("Enum value not found");return r}},{key:"fromLabelJWS",value:function(t){var r=e.values.find((function(e){return e.labelJWS===t||t.indexOf(e.labelJWS)>-1}));if(void 0===r)throw new Error("Enum value not found");return r}}]),e}();et.values=[],et.ECDSAwithSHA224=new et("SHA224withECDSA",0,"ES224"),et.ECDSAwithSHA256=new et("SHA256withECDSA",1,"ES256"),et.ECDSAwithSHA384=new et("SHA384withECDSA",2,"ES384"),et.ECDSAwithSHA512=new et("SHA512withECDSA",3,"ES512"),et.ECDSAwithSHA3_224=new et("SHA3-224withECDSA",4,"ES3-224"),et.ECDSAwithSHA3_256=new et("SHA3-256withECDSA",5,"ES3-256"),et.ECDSAwithSHA3_384=new et("SHA3-384withECDSA",6,"ES3-384"),et.ECDSAwithSHA3_512=new et("SHA3-512withECDSA",7,"ES3-512"),et.ECDSAwithRIPEMD160=new et("RIPEMD160withECDSA",8,"ER160"),et.SM2withSM3=new et("SM3withSM2",9,"SM"),et.EDDSAwithSHA512=new et("SHA512withEdDSA",10,"EDS512");var tt=function(){function e(t,r,n){A()(this,e),this.label=t,this.hex=r,this.defaultSchema=n,e.values.push(this)}return b()(e,null,[{key:"fromHex",value:function(t){var r=e.values.find((function(e){return e.hex===t}));if(void 0===r)throw new Error("Enum value not found");return r}},{key:"fromLabel",value:function(t){var r=e.values.find((function(e){return e.label===t}));if(void 0===r)throw new Error("Enum value not found");return r}}]),e}();tt.values=[],tt.ECDSA=new tt("ECDSA",18,et.ECDSAwithSHA256),tt.SM2=new tt("SM2",19,et.SM2withSM3),tt.EDDSA=new tt("EDDSA",20,et.EDDSAwithSHA512);var rt=r(9),nt=r.n(rt),at=r(10),it=r.n(at),ut=r(11),ot=r.n(ut),st=function(){function e(t,r,n){A()(this,e),this.label=t,this.hex=r,this.preset=n,e.values.push(this)}return b()(e,null,[{key:"fromHex",value:function(t){var r=e.values.find((function(e){return e.hex===t}));if(void 0===r)throw new Error("Enum value not found");return r}},{key:"fromLabel",value:function(t){var r=e.values.find((function(e){return e.label===t}));if(void 0===r)throw new Error("Enum value not found");return r}}]),e}();st.values=[],st.SECP224R1=new st("P-224",1,"p224"),st.SECP256R1=new st("P-256",2,"p256"),st.SECP384R1=new st("P-384",3,"p384"),st.SECP521R1=new st("P-521",4,"p521"),st.SM2P256V1=new st("sm2p256v1",20,"sm2p256v1"),st.ED25519=new st("ed25519",25,"ed25519");var ct=r(22),lt=function(){function e(t){A()(this,e),this.curve=t}return b()(e,[{key:"serializeJson",value:function(){return{curve:this.curve.label}}}],[{key:"deserializeJson",value:function(t){return new e(st.fromLabel(t.curve))}}]),e}(),ft=function(){function e(t,r,n){A()(this,e),this.key=t,void 0===r&&(r=tt.fromLabel(H.algorithm)),void 0===n&&(n=lt.deserializeJson(H.parameters)),this.algorithm=r,this.parameters=n}return b()(e,[{key:"computeHash",value:function(e,t){switch(t){case et.ECDSAwithSHA224:return se.SHA224(se.enc.Hex.parse(e)).toString();case et.ECDSAwithSHA256:return se.SHA256(se.enc.Hex.parse(e)).toString();case et.ECDSAwithSHA384:return se.SHA384(se.enc.Hex.parse(e)).toString();case et.ECDSAwithSHA512:case et.EDDSAwithSHA512:return se.SHA512(se.enc.Hex.parse(e)).toString();case et.ECDSAwithSHA3_224:return Object(ct.sha3_224)(ke(e));case et.ECDSAwithSHA3_256:return Object(ct.sha3_256)(ke(e));case et.ECDSAwithSHA3_384:return Object(ct.sha3_384)(ke(e));case et.ECDSAwithSHA3_512:return Object(ct.sha3_512)(ke(e));case et.ECDSAwithRIPEMD160:return se.RIPEMD160(se.enc.Hex.parse(e)).toString();case et.SM2withSM3:return(new le.sm3).sum(ke(e),"hex");default:throw new Error("Unsupported hash algorithm.")}}},{key:"isSchemaSupported",value:function(e){switch(e){case et.ECDSAwithSHA224:case et.ECDSAwithSHA256:case et.ECDSAwithSHA384:case et.ECDSAwithSHA512:case et.ECDSAwithSHA3_224:case et.ECDSAwithSHA3_256:case et.ECDSAwithSHA3_384:case et.ECDSAwithSHA3_512:case et.ECDSAwithRIPEMD160:return this.algorithm===tt.ECDSA;case et.EDDSAwithSHA512:return this.algorithm===tt.EDDSA;case et.SM2withSM3:return this.algorithm===tt.SM2;default:throw new Error("Unsupported signature schema.")}}},{key:"serializeJson",value:function(){return{algorithm:this.algorithm.label,parameters:this.parameters.serializeJson(),key:this.key}}}]),e}(),ht=function(e){function t(){return A()(this,t),it()(this,(t.__proto__||nt()(t)).apply(this,arguments))}return ot()(t,e),b()(t,[{key:"verify",value:function(e,t){if(!this.isSchemaSupported(t.algorithm))throw new Error("Signature schema does not match key type.");"string"!=typeof e&&(e=e.getSignContent());var r=void 0;return r=t.algorithm===et.SM2withSM3?e:this.computeHash(e,t.algorithm),this.verifySignature(r,t.value,t.algorithm)}},{key:"serializeHex",value:function(){var e="";switch(this.algorithm){case tt.ECDSA:e+=this.key;break;case tt.EDDSA:case tt.SM2:e+=Be(this.algorithm.hex),e+=Be(this.parameters.curve.hex),e+=Buffer.from(this.key,"hex").toString("hex")}return e}},{key:"verifySignature",value:function(e,t,r){switch(r){case et.ECDSAwithSHA224:case et.ECDSAwithSHA256:case et.ECDSAwithSHA384:case et.ECDSAwithSHA512:case et.ECDSAwithSHA3_224:case et.ECDSAwithSHA3_256:case et.ECDSAwithSHA3_384:case et.ECDSAwithSHA3_512:case et.ECDSAwithRIPEMD160:return this.verifyEcDSASignature(e,t);case et.EDDSAwithSHA512:return this.verifyEdDSASignature(e,t);case et.SM2withSM3:return this.verifySM2Signature(e,t);default:throw new Error("Unsupported signature schema.")}}},{key:"verifyEcDSASignature",value:function(e,t){var r=t.substr(0,64),n=t.substr(64,64);return new fe.ec(this.parameters.curve.preset).verify(e,{r:r,s:n},this.key,"hex")}},{key:"verifyEdDSASignature",value:function(e,t){var r=t.substr(0,64),n=t.substr(64,64);return new fe.eddsa(this.parameters.curve.preset).verify(e,{r:r,s:n},this.key,"hex")}},{key:"verifySM2Signature",value:function(e,t){var r=new He(t),n=Re(r.readNullTerminated());if(n!==_&&""!==n)throw new Error("Unsupported SM2 id used.");var a=r.read(32),i=r.read(32);return le.sm2.SM2KeyPair(this.key).verify(ke(e),a,i)}}],[{key:"deserializeHex",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:33;if(33===r){var n=tt.ECDSA,a=st.SECP256R1,i=e.read(33);return new t(i,n,new lt(a))}var u=parseInt(e.read(1),16),o=parseInt(e.read(1),16),s=e.read(r-2);return new t(s,tt.fromHex(u),new lt(st.fromHex(o)))}}]),t}(ft),dt=function(){function e(t){A()(this,e),this.label=t,e.values.push(this)}return b()(e,null,[{key:"fromHexLabel",value:function(t){var r=Re(t),n=e.values.find((function(e){return e.label===r}));if(void 0===n)throw new Error("Enum value not found");return n}}]),e}();function vt(e,t){if(e.algorithm!==t.algorithm)return e.algorithm.hex-t.algorithm.hex;switch(e.algorithm){case tt.ECDSA:var r=new fe.ec(e.parameters.curve.preset),n=r.keyFromPublic(e.key,"hex",!0),a=r.keyFromPublic(t.key,"hex",!0),i=n.getPublic(),u=a.getPublic();return i.getX()!==u.getX()?i.getX()-u.getX():i.getY()-u.getY();case tt.SM2:var o=new le.sm2.SM2KeyPair,s=new le.sm2.SM2KeyPair;return o._pubFromString(e.key),s._pubFromString(t.key),o.getX().toString()!==s.getX().toString()?Number(o.getX().toString())-Number(s.getX().toString()):Number(o.getY().toString())-Number(s.getY().toString());case tt.EDDSA:return Number(e.key)-Number(t.key);default:return 0}}function yt(e){return Be(e)}function pt(e){return-1===e?Be(ce.PUSHM1):0===e?Be(ce.PUSH0):e>0&&e<=16?Be(ce.PUSH1-1+e):Be(e,8,!0)}function gt(e){return 0===e?yt(ce.PUSH0):e<=16?Be(e-1+ce.PUSH1):mt(new $e(e.toString()).toHexstr())}function mt(e){var t="";if(0===e.length)throw new Error("pushBytes error, hexstr is empty.");var r=e.length/2;if(r<=ce.PUSHBYTES75+1-ce.PUSHBYTES1)t+=Be(r+ce.PUSHBYTES1-1);else if(r<256)t+=Be(ce.PUSHDATA1),t+=Be(r);else if(r<65536)t+=Be(ce.PUSHDATA2),t+=Be(r,2,!0);else{if(!(r<4294967296))throw w.INVALID_PARAMS;t+=Be(ce.PUSHDATA4),t+=Be(r,4,!0)}return t+=e}function wt(e){var t="";return t+=function(e){return mt(e.serializeHex())}(e),t+=yt(ce.CHECKSIG)}function kt(e,t){var r=e.length;if(!(1<=t&&t<=r&&r<=1024))throw new Error("Wrong multi-sig param");e.sort(vt);var n="";n+=gt(t);var a=!0,i=!1,u=void 0;try{for(var o,s=ue()(e);!(a=(o=s.next()).done);a=!0){n+=mt(o.value.serializeHex())}}catch(e){i=!0,u=e}finally{try{!a&&s.return&&s.return()}finally{if(i)throw u}}return n+=gt(r),n+=yt(ce.CHECKMULTISIG)}function St(e){var t="";e.sort();var r=!0,n=!1,a=void 0;try{for(var i,u=ue()(e);!(r=(i=u.next()).done);r=!0){t+=mt(i.value)}}catch(e){n=!0,a=e}finally{try{!r&&u.return&&u.return()}finally{if(n)throw a}}return t}function At(e){return parseInt(e.read(1),16)}function xt(e){var t=At(e),r=void 0;if(t===ce.PUSHDATA4)r=e.readUint32();else if(t===ce.PUSHDATA2)r=e.readUint16();else if(t===ce.PUSHDATA1)r=e.readUint8();else{if(!(t<=ce.PUSHBYTES75&&t>=ce.PUSHBYTES1))throw new Error("unexpected opcode: "+t);r=t-ce.PUSHBYTES1+1}return e.read(r)}function bt(e){var t=e.readNextBytes();return ht.deserializeHex(new He(t))}dt.values=[],dt.IN_USE=new dt("in use"),dt.REVOKED=new dt("revoked");var Rt=function e(){A()(this,e)};var Tt=function(e){var t="",r=e.length/2;return r<=ce.PUSHBYTES75?t+=Be(r):r<256?(t+=Be(ce.PUSHDATA1),t+=Be(r)):r<65536?(t+=Be(ce.PUSHDATA2),t+=Be(r,2,!0)):(t+=Be(ce.PUSHDATA4),t+=Be(r,4,!0)),t+=e},Et=function(){function e(t){if(A()(this,e),40!==t.length&&34!==t.length)throw w.INVALID_PARAMS;this.value=t}return b()(e,[{key:"toBase58",value:function(){return 34===this.value.length?this.value:Pt(this.value)}},{key:"toHexString",value:function(){var e=void 0;return e=40===this.value.length?this.value:It(this.value),Ce(e)}},{key:"serialize",value:function(){return 40===this.value.length?this.value:It(this.value)}},{key:"getB58Checksum",value:function(){var e=this.toBase58();return Me(se.SHA256(e).toString()).slice(0,8)}}],[{key:"deserialize",value:function(t){return new e(t.read(20))}},{key:"fromPubKey",value:function(t){return new e(Ve(wt(t)))}},{key:"fromOntid",value:function(t){return new e(t.substr(8))}},{key:"fromVmCode",value:function(t){return new e(Ve(t))}},{key:"fromMultiPubKeys",value:function(t,r){var n=r.length;if(t<=0||t>n||n>24)throw w.INVALID_PARAMS;r.sort(vt);var a="";a+=pt(t);var i=!0,u=!1,o=void 0;try{for(var s,c=ue()(r);!(i=(s=c.next()).done);i=!0){var l=s.value;a+=Tt(l.serializeHex())}}catch(e){u=!0,o=e}finally{try{!i&&c.return&&c.return()}finally{if(u)throw o}}return a+=pt(n),new e(Ve(a+=Be(ce.CHECKMULTISIG)))}},{key:"generateOntid",value:function(t){return"did:ont:"+e.fromPubKey(t).toBase58()}}]),e}();function Pt(e){var t=B+e,r=Me(t),n=t+Me(r).slice(0,8);return oe.encode(new Buffer(n,"hex"))}function It(e){var t=Se(oe.decode(e)).substr(2,40);if(e!==Pt(t))throw new Error("[addressToU160] decode encoded verify failed");return t}var Bt=r(3),Nt=r.n(Bt),Ct=r(5),Ot=r.n(Ct),Dt=r(32),Ht=r(17),_t=r(36);function zt(e,t,r){var n=[];return _t(e.normalize("NFC"),ke(t),{N:r.cost,r:r.blockSize,p:r.parallel,dkLen:r.size},(function(e){n=e})),new Buffer(n)}function Ut(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:N,a=ht.deserializeHex(new He(t)),i=Et.fromPubKey(a),u=i.getB58Checksum(),o=zt(r,u,n).toString("hex"),s=o.slice(0,32),c=o.slice(64),l=se.enc.Hex.parse(s),f=se.AES.encrypt(se.enc.Hex.parse(e),se.enc.Hex.parse(c),{mode:se.mode.CTR,padding:se.pad.NoPadding,iv:l}),h=f.ciphertext.toString();return new Buffer(h,"hex").toString("base64")}function Lt(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:N,a=Buffer.from(e,"base64").toString("hex"),i="";if("string"==typeof r&&8===r.length)i=r;else{if(!(r instanceof Et))throw w.INVALID_PARAMS;i=r.getB58Checksum()}var u=zt(t,i,n).toString("hex"),o=u.slice(0,32),s=u.slice(64),c=se.enc.Hex.parse(o),l={ciphertext:se.enc.Hex.parse(a),salt:"",iv:""},f=se.AES.decrypt(l,se.enc.Hex.parse(s),{mode:se.mode.CTR,padding:se.pad.NoPadding,iv:c}),h=f.toString();return h}function Mt(e,t){var r="";if("string"==typeof e&&8===e.length)r=e;else{if(!(e instanceof Et))throw w.INVALID_PARAMS;r=e.getB58Checksum()}var n=ht.deserializeHex(new He(t));if(Et.fromPubKey(n).getB58Checksum()!==r)throw console.log("keyphrase error."),w.Decrypto_ERROR}function Kt(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:N,a=ht.deserializeHex(new He(t)),i=Et.fromPubKey(a),u=i.getB58Checksum(),o=zt(r,u,n).toString("hex"),s=o.slice(0,64),c=o.slice(64),l=Ie(e,s),f=se.AES.encrypt(se.enc.Hex.parse(l),se.enc.Hex.parse(c),{mode:se.mode.ECB,padding:se.pad.NoPadding}),h=C+O+u+f.ciphertext.toString();return oe.encode(Buffer.from(h,"hex"))}function Vt(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:N,n=Se(oe.decode(e)),a=n.substr(6,8),i=n.substr(-64),u=zt(t,a,r).toString("hex"),o=u.slice(0,64),s=u.slice(64),c={ciphertext:se.enc.Hex.parse(i),salt:"",iv:""},l=se.AES.decrypt(c,se.enc.Hex.parse(s),{mode:se.mode.ECB,padding:se.pad.NoPadding}),f=Ie(l.toString(),o);return f}function Gt(e,t,r){var n=Se(oe.decode(e)).substr(6,8),a=ht.deserializeHex(new He(r));if(Et.fromPubKey(a).getB58Checksum()!==n)throw console.log("keyphrase error."),w.Decrypto_ERROR}function Jt(e,t,r,n){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:N;if(!Ye(e))throw new Error(w.INVALID_PARAMS+", Invalid private key");var i=zt(n,r,a),u=i.slice(0,12),o=i.slice(32),s=o,c=u,l=new Buffer(t.toBase58()),f=Object(Ht.createCipheriv)("aes-256-gcm",s,c);f.setAAD(l);var h=Buffer.from(e,"hex"),d=f.update(h),v=f.final(),y=f.getAuthTag();d=Buffer.concat([d,v]);var p=Buffer.concat([d,y]);return p.toString("base64")}function Wt(e,t,r,n){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:N;if(32!==r.length)throw w.INVALID_PARAMS;var i=Buffer.from(e,"base64"),u=i.slice(0,i.length-16),o=i.slice(i.length-16),s=zt(n,r,a),c=s.slice(0,12),l=s.slice(32),f=l,h=c,d=new Buffer(t.toBase58()),v=Object(Ht.createDecipheriv)("aes-256-gcm",f,h);v.setAAD(d),v.setAuthTag(o);var y=v.update(u).toString("hex");try{y+=v.final().toString("hex")}catch(e){throw w.Decrypto_ERROR}return y}var Ft=r(12),qt=function(){function e(t,r,n){A()(this,e),this.algorithm=t,this.value=r,this.publicKeyId=n}return b()(e,[{key:"serializeHex",value:function(){var e="";return e+=Be(this.algorithm.hex),e+=this.value}},{key:"serializePgp",value:function(e){return{PublicKeyId:e,Format:"pgp",Value:new Buffer(this.serializeHex(),"hex").toString("base64"),Algorithm:this.algorithm.label}}},{key:"serializeJWT",value:function(){return new Buffer(this.serializeHex(),"hex").toString("base64")}}],[{key:"deserializeJWT",value:function(t,r,n){var a=Ft.decode(t,"hex");return a.startsWith("01")&&(a=a.substring(2)),new e(r,a,n)}},{key:"deserializePgp",value:function(t){var r=new Buffer(t.Value,"base64").toString("hex"),n=e.deserializeHex(r).value;return new e(et.fromLabel(t.Algorithm),n)}},{key:"deserializeHex",value:function(t){if(t.length<4)throw new Error("Invalid params.");if(130!==t.length){if(128!==t.length)throw new Error("Signature error, invalid signature data length");return new e(et.fromHex(1),t.substr(2))}try{var r=new He(t),n=parseInt(r.read(1),16);return new e(et.fromHex(n),t.substr(2))}catch(e){throw new Error("Signature error, incorrect format")}}}]),e}(),jt=r(30).HDKey,Yt=function(e){function t(){return A()(this,t),it()(this,(t.__proto__||nt()(t)).apply(this,arguments))}var r;return ot()(t,e),b()(t,[{key:"sign",value:function(e,t,r){if(void 0===t&&(t=this.algorithm.defaultSchema),!this.isSchemaSupported(t))throw new Error("Signature schema does not match key type.");"string"!=typeof e&&(e=e.getSignContent());var n=void 0;n=t===et.SM2withSM3?e:this.computeHash(e,t);var a=this.computeSignature(n,t);return new qt(t,a,r)}},{key:"signAsync",value:(r=Ot()(Nt.a.mark((function e(t,r,n){return Nt.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.sign(t,r,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return r.apply(this,arguments)})},{key:"getPublicKey",value:function(){switch(this.algorithm){case tt.ECDSA:return this.getEcDSAPublicKey();case tt.EDDSA:return this.getEdDSAPublicKey();case tt.SM2:return this.getSM2PublicKey();default:throw new Error("Unsupported signature schema.")}}},{key:"decrypt",value:function(e,r,n,a){24===n.length&&je(n)&&(n=Buffer.from(n,"base64").toString("hex"));var i=new t(Wt(this.key,r,n,e,a),this.algorithm,this.parameters),u=i.getPublicKey();if(Et.fromPubKey(u).toBase58()!==r.toBase58())throw w.Decrypto_ERROR;return i}},{key:"encrypt",value:function(e,r,n,a){var i=this.getPublicKey();if(Et.fromPubKey(i).toBase58()!==r.toBase58())throw w.INVALID_ADDR;return new t(Jt(this.key,r,n,e,a),this.algorithm,this.parameters)}},{key:"getEcDSAPublicKey",value:function(){var e=new fe.ec(this.parameters.curve.preset).keyFromPrivate(this.key,"hex").getPublic(!0,"hex");return new ht(e,this.algorithm,this.parameters)}},{key:"getEdDSAPublicKey",value:function(){var e=new fe.eddsa(this.parameters.curve.preset).keyFromSecret(this.key,"hex").getPublic(!0,"hex");return new ht(e,this.algorithm,this.parameters)}},{key:"getSM2PublicKey",value:function(){var e=le.sm2.SM2KeyPair(null,this.key).pubToString("compress");return new ht(e,this.algorithm,this.parameters)}},{key:"computeSignature",value:function(e,t){switch(t){case et.ECDSAwithSHA224:case et.ECDSAwithSHA256:case et.ECDSAwithSHA384:case et.ECDSAwithSHA512:case et.ECDSAwithSHA3_224:case et.ECDSAwithSHA3_256:case et.ECDSAwithSHA3_384:case et.ECDSAwithSHA3_512:case et.ECDSAwithRIPEMD160:return this.computeEcDSASignature(e);case et.EDDSAwithSHA512:return this.computeEdDSASignature(e);case et.SM2withSM3:return this.computeSM2Signature(e);default:throw new Error("Unsupported signature schema.")}}},{key:"computeEcDSASignature",value:function(e){var t=new fe.ec(this.parameters.curve.preset).sign(e,this.key,{canonical:!0});return Buffer.concat([t.r.toArrayLike(Buffer,"be",32),t.s.toArrayLike(Buffer,"be",32)]).toString("hex")}},{key:"computeEdDSASignature",value:function(e){return new fe.eddsa(this.parameters.curve.preset).sign(e,this.key).toHex().toLowerCase()}},{key:"computeSM2Signature",value:function(e){var t=le.sm2.SM2KeyPair(null,this.key).sign(ke(e));return be(_+"\0")+t.r+t.s}},{key:"serializeWIF",value:function(){return Dt.encode(128,Buffer.from(this.key,"hex"),!0)}}],[{key:"random",value:function(e,r){return void 0===e&&(e=tt.fromLabel(H.algorithm)),void 0===r&&(r=lt.deserializeJson(H.parameters)),new t(Se(we(32)),e,r)}},{key:"deserializeWIF",value:function(e){return new t(Se(Dt.decode(e,128).privateKey))}},{key:"generateFromMnemonic",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ee;if(e.split(" ").length<12)throw w.INVALID_PARAMS;var n=I.mnemonicToSeedHex(e),a=jt.fromMasterSeed(Buffer.from(n,"hex")),i=a.derive(r),u=Buffer.from(i.privateKey).toString("hex"),o=new t(u);return o}}]),t}(ft),Qt=function(){function e(){A()(this,e)}return b()(e,[{key:"getType",value:function(){return""}},{key:"deserialize",value:function(e){if(null!=e.key)return new Yt(e.key,tt.fromLabel(e.algorithm),lt.deserializeJson(e.parameters));throw new Error("Unsupported Key type.")}}]),e}(),Xt=[],Zt=new Qt;function $t(e){Xt.push(e)}function er(e){if(null==e.external)return Zt.deserialize(e);var t=!0,r=!1,n=void 0;try{for(var a,i=ue()(Xt);!(t=(a=i.next()).done);t=!0){var u=a.value;if(u.getType()===e.external.type)return u.deserialize(e)}}catch(e){r=!0,n=e}finally{try{!t&&i.return&&i.return()}finally{if(r)throw n}}throw new Error("Unsupported Key type.")}var tr,rr,nr=r(37),ar=function(){function e(t){A()(this,e),this.param=new ur(t),this.sk=new sr(this.param)}return b()(e,[{key:"GenerateSk",value:function(){return this.sk.Rand(),this.sk}},{key:"GenerateKeyPair",value:function(){this.sk=sr.GenerateSk(this.param),this.pk=this.sk.GenerateIssuerPublicKey()}},{key:"SetAttributeSet",value:function(e){this.AttributeName=e,this.pk.GenerateAttr(e)}},{key:"Sign",value:function(e,t){var r=this.param.getRandBN(),n=this.param.getRandBN(),a=new this.param.ECP;a.copy(this.param.g1),a.add(this.param.PAIR.G1mul(this.pk.h0,n)),a.add(e);for(var i=0;i<this.pk.attr.length;i++)a.add(this.param.PAIR.G1mul(this.pk.h[i],t[i]));var u=new this.param.ECP,o=new this.param.BIG;o.copy(r),o.add(this.sk.v