@rainbow-me/swaps
Advanced tools
Comparing version 0.7.0 to 0.8.0
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@ethersproject/contracts"),t=require("@ethersproject/bignumber"),n=require("@ethersproject/bytes"),a=require("@metamask/eth-sig-util"),r=require("ethereumjs-util"),i=require("@ethersproject/keccak256"),s=require("@ethersproject/strings");function o(e,t,n,a,r,i,s){try{var o=e[i](s),p=o.value}catch(e){return void n(e)}o.done?t(p):Promise.resolve(p).then(a,r)}function p(e){return function(){var t=this,n=arguments;return new Promise((function(a,r){var i=e.apply(t,n);function s(e){o(i,a,r,s,p,"next",e)}function p(e){o(i,a,r,s,p,"throw",e)}s(void 0)}))}}function u(){return(u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(this,arguments)}var d,l,y,c,m,f,b=(function(e){var t=function(e){var t=Object.prototype,n=t.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},r=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function o(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{o({},"")}catch(e){o=function(e,t,n){return e[t]=n}}function p(e,t,n,a){var r=Object.create((t&&t.prototype instanceof l?t:l).prototype),i=new g(a||[]);return r._invoke=function(e,t,n){var a="suspendedStart";return function(r,i){if("executing"===a)throw new Error("Generator is already running");if("completed"===a){if("throw"===r)throw i;return{value:void 0,done:!0}}for(n.method=r,n.arg=i;;){var s=n.delegate;if(s){var o=w(s,n);if(o){if(o===d)continue;return o}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===a)throw a="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);a="executing";var p=u(e,t,n);if("normal"===p.type){if(a=n.done?"completed":"suspendedYield",p.arg===d)continue;return{value:p.arg,done:n.done}}"throw"===p.type&&(a="completed",n.method="throw",n.arg=p.arg)}}}(e,n,i),r}function u(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=p;var d={};function l(){}function y(){}function c(){}var m={};o(m,r,(function(){return this}));var f=Object.getPrototypeOf,b=f&&f(f(A([])));b&&b!==t&&n.call(b,r)&&(m=b);var T=c.prototype=l.prototype=Object.create(m);function h(e){["next","throw","return"].forEach((function(t){o(e,t,(function(e){return this._invoke(t,e)}))}))}function v(e,t){var a;this._invoke=function(r,i){function s(){return new t((function(a,s){!function a(r,i,s,o){var p=u(e[r],e,i);if("throw"!==p.type){var d=p.arg,l=d.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){a("next",e,s,o)}),(function(e){a("throw",e,s,o)})):t.resolve(l).then((function(e){d.value=e,s(d)}),(function(e){return a("throw",e,s,o)}))}o(p.arg)}(r,i,a,s)}))}return a=a?a.then(s,s):s()}}function w(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return d;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var a=u(n,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,d;var r=a.arg;return r?r.done?(t[e.resultName]=r.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):r:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function g(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function A(e){if(e){var t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var a=-1,i=function t(){for(;++a<e.length;)if(n.call(e,a))return t.value=e[a],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:E}}function E(){return{value:void 0,done:!0}}return y.prototype=c,o(T,"constructor",c),o(c,"constructor",y),y.displayName=o(c,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,o(e,s,"GeneratorFunction")),e.prototype=Object.create(T),e},e.awrap=function(e){return{__await:e}},h(v.prototype),o(v.prototype,i,(function(){return this})),e.AsyncIterator=v,e.async=function(t,n,a,r,i){void 0===i&&(i=Promise);var s=new v(p(t,n,a,r),i);return e.isGeneratorFunction(n)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},h(T),o(T,s,"Generator"),o(T,r,(function(){return this})),o(T,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var a=t.pop();if(a in e)return n.value=a,n.done=!1,n}return n.done=!0,n}},e.values=A,g.prototype={constructor:g,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function a(n,a){return s.type="throw",s.arg=e,t.next=n,a&&(t.method="next",t.arg=void 0),!!a}for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],s=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var o=n.call(i,"catchLoc"),p=n.call(i,"finallyLoc");if(o&&p){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(o){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!p)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var a=this.tryEntries.length-1;a>=0;--a){var r=this.tryEntries[a];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=e,s.arg=t,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),S(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var a=n.completion;if("throw"===a.type){var r=a.arg;S(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:A(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}(f={exports:{}}),f.exports),T=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"deposit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"}];(d=exports.ChainId||(exports.ChainId={}))[d.mainnet=1]="mainnet",d[d.ropsten=3]="ropsten",d[d.kovan=42]="kovan",d[d.goerli=5]="goerli",d[d.rinkeby=4]="rinkeby",d[d.optimism=10]="optimism",d[d.bsc=56]="bsc",d[d.polygon=137]="polygon",d[d.arbitrum=42161]="arbitrum",d[d.zora=7777777]="zora",d[d.base=8453]="base",(l=exports.Source||(exports.Source={})).Aggregator0x="0x",l.Aggregotor1inch="1inch",(y=exports.SwapType||(exports.SwapType={})).normal="normal",y.crossChain="cross-chain";var h="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",v="https://swap.p.rainbow.me",w=new Map([[exports.ChainId.mainnet,"0x3a23F943181408EAC424116Af7b7790c94Cb97a5"],[exports.ChainId.optimism,"0x3a23F943181408EAC424116Af7b7790c94Cb97a5"],[exports.ChainId.polygon,"0x3a23F943181408EAC424116Af7b7790c94Cb97a5"],[exports.ChainId.arbitrum,"0x3a23F943181408EAC424116Af7b7790c94Cb97a5"],[exports.ChainId.bsc,"0x3a23F943181408EAC424116Af7b7790c94Cb97a5"],[exports.ChainId.zora,"0x3a23F943181408EAC424116Af7b7790c94Cb97a5"],[exports.ChainId.base,"0x3a23F943181408EAC424116Af7b7790c94Cb97a5"]]),x=((c={})[""+exports.ChainId.mainnet]="0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",c[""+exports.ChainId.optimism]="0x4200000000000000000000000000000000000006",c[""+exports.ChainId.polygon]="0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270",c[""+exports.ChainId.arbitrum]="0x82af49447d8a07e3bd95bd0d56f35241523fbab1",c[""+exports.ChainId.bsc]="0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",c[""+exports.ChainId.zora]="0x4200000000000000000000000000000000000006",c[""+exports.ChainId.base]="0x4200000000000000000000000000000000000006",c),S=((m={})[""+exports.ChainId.mainnet]="0x6b175474e89094c44da98b954eedeac495271d0f",m),g="0x77777feddddffc19ff86db637967013e6c6a116c",A="0x0d438f3b5175bebc262bf23753c1e53d03432bde",E="0x1b40183efb4dd766f11bda7a7c3ad8982e998421",C=t.BigNumber.from("2").pow("256").sub("1").toString(),_=function(){var t=p(b.mark((function t(n,a,r,i){var s;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===r&&(r=exports.ChainId.mainnet),void 0===i&&(i={}),s=new e.Contract(x[r],JSON.stringify(T),a),t.abrupt("return",s.deposit(u({},i,{value:n})));case 4:case"end":return t.stop()}}),t)})));return function(e,n,a,r){return t.apply(this,arguments)}}(),P=function(){var t=p(b.mark((function t(n,a,r,i){var s;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===r&&(r=exports.ChainId.mainnet),void 0===i&&(i={}),s=new e.Contract(x[r],JSON.stringify(T),a),t.abrupt("return",s.withdraw(n,i));case 4:case"end":return t.stop()}}),t)})));return function(e,n,a,r){return t.apply(this,arguments)}}(),M=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"target",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"EthWithdrawn",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newOwner",type:"address"},{indexed:!0,internalType:"address",name:"oldOwner",type:"address"}],name:"OwnerChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"target",type:"address"}],name:"SwapTargetAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"target",type:"address"}],name:"SwapTargetRemoved",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"token",type:"address"},{indexed:!0,internalType:"address",name:"target",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"TokenWithdrawn",type:"event"},{inputs:[{internalType:"address",name:"buyTokenAddress",type:"address"},{internalType:"address payable",name:"target",type:"address"},{internalType:"bytes",name:"swapCallData",type:"bytes"},{internalType:"uint256",name:"feeAmount",type:"uint256"}],name:"fillQuoteEthToToken",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"sellTokenAddress",type:"address"},{internalType:"address payable",name:"target",type:"address"},{internalType:"bytes",name:"swapCallData",type:"bytes"},{internalType:"uint256",name:"sellAmount",type:"uint256"},{internalType:"uint256",name:"feePercentageBasisPoints",type:"uint256"}],name:"fillQuoteTokenToEth",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"sellTokenAddress",type:"address"},{internalType:"address payable",name:"target",type:"address"},{internalType:"bytes",name:"swapCallData",type:"bytes"},{internalType:"uint256",name:"sellAmount",type:"uint256"},{internalType:"uint256",name:"feePercentageBasisPoints",type:"uint256"},{components:[{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"bool",name:"isDaiStylePermit",type:"bool"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],internalType:"struct PermitHelper.Permit",name:"permitData",type:"tuple"}],name:"fillQuoteTokenToEthWithPermit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"sellTokenAddress",type:"address"},{internalType:"address",name:"buyTokenAddress",type:"address"},{internalType:"address payable",name:"target",type:"address"},{internalType:"bytes",name:"swapCallData",type:"bytes"},{internalType:"uint256",name:"sellAmount",type:"uint256"},{internalType:"uint256",name:"feeAmount",type:"uint256"}],name:"fillQuoteTokenToToken",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"sellTokenAddress",type:"address"},{internalType:"address",name:"buyTokenAddress",type:"address"},{internalType:"address payable",name:"target",type:"address"},{internalType:"bytes",name:"swapCallData",type:"bytes"},{internalType:"uint256",name:"sellAmount",type:"uint256"},{internalType:"uint256",name:"feeAmount",type:"uint256"},{components:[{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"bool",name:"isDaiStylePermit",type:"bool"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],internalType:"struct PermitHelper.Permit",name:"permitData",type:"tuple"}],name:"fillQuoteTokenToTokenWithPermit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"swapTargets",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"target",type:"address"},{internalType:"bool",name:"add",type:"bool"}],name:"updateSwapTargets",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"withdrawEth",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"withdrawToken",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],k=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[],name:"DOMAIN_SEPARATOR",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"PERMIT_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"holder",type:"address"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"expiry",type:"uint256"},{internalType:"bool",name:"allowed",type:"bool"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"permit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"version",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"}],I=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[],name:"DOMAIN_SEPARATOR",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"_nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"permit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"version",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"}],L=[{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],R=function(){var e=p(b.mark((function e(t,n,r,i){return b.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return","0x"+a.TypedDataUtils.hashStruct("EIP712Domain",{chainId:r,name:t,verifyingContract:i,version:n},{EIP712Domain:L},a.SignTypedDataVersion.V4).toString("hex"));case 1:case"end":return e.stop()}}),e)})));return function(t,n,a,r){return e.apply(this,arguments)}}(),N=function(){var e=p(b.mark((function e(t,n,a,r){var i,s;return b.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.version();case 3:return e.abrupt("return",e.sent);case 7:return e.prev=7,e.t0=e.catch(0),i="1",e.prev=10,e.next=13,t.DOMAIN_SEPARATOR();case 13:return s=e.sent,e.next=16,R(n,i,a,r);case 16:if(s!==e.sent){e.next=19;break}return e.abrupt("return",i);case 19:e.next=26;break;case 21:if(e.prev=21,e.t1=e.catch(10),1!==a||-1===[g,A,E].map((function(e){return e.toLowerCase()})).indexOf(t.address.toLowerCase())){e.next=25;break}return e.abrupt("return","1");case 25:case 26:return e.abrupt("return",null);case 27:case"end":return e.stop()}}),e,null,[[0,7],[10,21]])})));return function(t,n,a,r){return e.apply(this,arguments)}}(),D=function(){var e=p(b.mark((function e(t,n){return b.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.nonces(n);case 3:return e.abrupt("return",e.sent);case 7:return e.prev=7,e.t0=e.catch(0),e.prev=9,e.next=12,t._nonces(n);case 12:return e.abrupt("return",e.sent);case 16:return e.prev=16,e.t1=e.catch(9),e.abrupt("return",0);case 19:case"end":return e.stop()}}),e,null,[[0,7],[9,16]])})));return function(t,n){return e.apply(this,arguments)}}(),O=[{name:"name",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],V=[{name:"owner",type:"address"},{name:"spender",type:"address"},{name:"value",type:"uint256"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"}],U=[{name:"holder",type:"address"},{name:"spender",type:"address"},{name:"nonce",type:"uint256"},{name:"expiry",type:"uint256"},{name:"allowed",type:"bool"}];function B(e,t,n,a,r,i,s){return F.apply(this,arguments)}function F(){return(F=p(b.mark((function i(s,o,p,u,d,l,y){var c,m,f,T,h,v,w,x,g,A,E,C,_;return b.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return m=o.toLowerCase()===(null==(c=S[y])?void 0:c.toLowerCase()),f=new e.Contract(o,m?k:I,s),i.next=4,f.name();case 4:return T=i.sent,i.next=7,Promise.all([D(f,p),N(f,T,y,f.address)]);case 7:return v=(h=i.sent)[0],w=h[1],x={nonce:Number(v.toString()),spender:u},m?(x.holder=p,x.allowed=!0,x.expiry=Number(l.toString())):(x.value=t.BigNumber.from(d).toHexString(),x.deadline=Number(l.toString()),x.owner=p),g={chainId:y,name:T,verifyingContract:f.address},null!==w&&(g.version=w),A={domain:g,message:x,primaryType:"Permit",types:{EIP712Domain:null!==w?L:O,Permit:m?U:V}},E=r.toBuffer(r.addHexPrefix(s.privateKey)),C=a.signTypedData({data:A,privateKey:E,version:a.SignTypedDataVersion.V4}),_=n.splitSignature(C),i.abrupt("return",{deadline:l,isDaiStylePermit:m,nonce:v,r:_.r,s:_.s,v:_.v,value:x.value||t.BigNumber.from("0").toHexString()});case 20:case"end":return i.stop()}}),i)})))).apply(this,arguments)}function W(e){return i.keccak256(s.toUtf8Bytes(e)).substring(2,10)}var H=function(e){var t=e.sellTokenAddress,n=e.buyTokenAddress,a=e.buyAmount,r=e.sellAmount,i=e.fromAddress,s=e.source,o=e.feePercentageBasisPoints,p=e.slippage,d=new URLSearchParams(u({buyToken:n,chainId:String(e.chainId),fromAddress:i,sellToken:t,slippage:String(p),swapType:exports.SwapType.normal},s?{source:s}:{},r?{sellAmount:String(r)}:{buyAmount:String(a)},n===h?{destReceiver:"0x00000000009726632680fb29d3f7a9734e3010e2"}:{},void 0!==o?{feePercentageBasisPoints:String(o)}:{}));return v+"/v1/quote?"+d.toString()},Q=function(e){var t=e.toChainId,n=e.sellTokenAddress,a=e.sellAmount,r=e.fromAddress,i=e.slippage,s=e.refuel,o=new URLSearchParams({buyToken:e.buyTokenAddress,chainId:String(e.chainId),fromAddress:r,refuel:String(s),sellAmount:String(a),sellToken:n,slippage:String(i),swapType:exports.SwapType.crossChain,toChainId:String(t)});return v+"/v1/quote?bridgeVersion=2&"+o.toString()},j=function(){var e=p(b.mark((function e(n){var a,r,i,s,o;return b.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=n.chainId,r=n.toChainId,e.next=4,fetch("https://swap.p.rainbow.me/v1/chains");case 4:return i=e.sent,e.next=7,i.json();case 7:if(s=e.sent.result.find((function(e){return e.chainId===a}))){e.next=11;break}return e.abrupt("return",null);case 11:if(o=s.limits.find((function(e){return e.chainId===r}))){e.next=14;break}return e.abrupt("return",null);case 14:return e.abrupt("return",t.BigNumber.from(o.minAmount).mul(2).toString());case 15:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),X=function(){var e=p(b.mark((function e(t){var n,a,r,i,s,o,p,u,d,l,y,c,m,f,T,v,w,S,g,A;return b.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=t.source,i=void 0===(r=t.chainId)?exports.ChainId.mainnet:r,s=t.fromAddress,p=t.buyTokenAddress,u=t.sellAmount,d=t.buyAmount,l=t.slippage,y=t.feePercentageBasisPoints,c=(o=t.sellTokenAddress).toLowerCase(),m=p.toLowerCase(),f=h.toLowerCase(),T=null==(n=x[i])?void 0:n.toLowerCase(),w=c===T&&m===f,!(v=c===f&&m===T)&&!w){e.next=9;break}return e.abrupt("return",{buyAmount:u||d,buyTokenAddress:p,defaultGasLimit:v?"30000":"40000",fee:0,feePercentageBasisPoints:0,from:s,inputTokenDecimals:18,outputTokenDecimals:18,sellAmount:u||d,sellAmountMinusFees:u||d,sellTokenAddress:o});case 9:if(!isNaN(Number(u))||!isNaN(Number(d))){e.next=11;break}return e.abrupt("return",null);case 11:return S=H({buyAmount:d,buyTokenAddress:p,chainId:i,feePercentageBasisPoints:y,fromAddress:s,sellAmount:u,sellTokenAddress:o,slippage:l,source:a}),e.next=14,fetch(S);case 14:return g=e.sent,e.next=17,g.json();case 17:if(!(A=e.sent).error){e.next=20;break}return e.abrupt("return",A);case 20:return e.abrupt("return",A);case 21:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),G=function(){var e=p(b.mark((function e(t){var n,a,r,i,s,o,p,u,d,l,y,c,m,f;return b.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=void 0===(n=t.chainId)?exports.ChainId.mainnet:n,r=t.toChainId,i=t.fromAddress,s=t.sellTokenAddress,o=t.buyTokenAddress,u=t.slippage,l=void 0!==(d=t.refuel)&&d,(p=t.sellAmount)&&r){e.next=3;break}return e.abrupt("return",null);case 3:return y=Q({buyTokenAddress:o,chainId:a,fromAddress:i,refuel:l,sellAmount:p,sellTokenAddress:s,slippage:u,toChainId:r}),e.next=6,fetch(y);case 6:return c=e.sent,e.next=9,c.json();case 9:if(!(m=e.sent).error){e.next=12;break}return e.abrupt("return",m);case 12:return(f=m).allowanceTarget=w.get(a),e.abrupt("return",f);case 15:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),K=function(){var e=p(b.mark((function e(t){return b.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.provider.getBlock("latest");case 2:return e.abrupt("return",e.sent.timestamp+3600);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),q=function(){var t=p(b.mark((function t(n,a,r,i,s,o){var p,d,l,y,c,m,f,T,v,w,x,S,g,A,E;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(p=new e.Contract("0x00000000009726632680fb29d3f7a9734e3010e2",M,r),l=n.sellTokenAddress,y=n.buyTokenAddress,c=n.to,m=n.data,f=n.fee,T=n.value,v=n.sellAmount,w=n.feePercentageBasisPoints,x=h.toLowerCase(),(null==l?void 0:l.toLowerCase())!==x){t.next=9;break}return t.next=6,p.populateTransaction.fillQuoteEthToToken(y,c,m,f,u({},a,{value:T}));case 6:d=t.sent,t.next=42;break;case 9:if((null==y?void 0:y.toLowerCase())!==x){t.next=27;break}if(!i){t.next=22;break}return t.next=13,K(r);case 13:return S=t.sent,t.next=16,B(r,l,n.from,p.address,C,S,s);case 16:return g=t.sent,t.next=19,p.populateTransaction.fillQuoteTokenToEthWithPermit(l,c,m,v,w,g,u({},a,{value:T}));case 19:d=t.sent,t.next=25;break;case 22:return t.next=24,p.populateTransaction.fillQuoteTokenToEth(l,c,m,v,w,u({},a,{value:T}));case 24:d=t.sent;case 25:t.next=42;break;case 27:if(!i){t.next=39;break}return t.next=30,K(r);case 30:return A=t.sent,t.next=33,B(r,l,n.from,p.address,C,A,s);case 33:return E=t.sent,t.next=36,p.populateTransaction.fillQuoteTokenToTokenWithPermit(l,y,c,m,v,f,E,u({},a,{value:T}));case 36:d=t.sent,t.next=42;break;case 39:return t.next=41,p.populateTransaction.fillQuoteTokenToToken(l,y,c,m,v,f,u({},a,{value:T}));case 41:d=t.sent;case 42:return o&&(d.data=""+d.data+W(o)),t.next=45,r.sendTransaction(u({data:d.data,from:d.from,to:d.to},u({},a,{value:T})));case 45:return t.abrupt("return",t.sent);case 47:case"end":return t.stop()}}),t)})));return function(e,n,a,r,i,s){return t.apply(this,arguments)}}(),Y=function(){var e=p(b.mark((function e(t,n,a,r){var i,s,o,p,d;return b.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.data,s=t.from,o=t.value,p=w.get(t.fromChainId),d=i,r&&(d=""+d+W(r)),e.next=6,a.sendTransaction(u({data:d,from:s,to:p},u({},n,{value:o})));case 6:return e.abrupt("return",e.sent);case 8:case"end":return e.stop()}}),e)})));return function(t,n,a,r){return e.apply(this,arguments)}}();exports.ALLOWS_PERMIT={"0x0d438f3b5175bebc262bf23753c1e53d03432bde":!0,"0x111111111117dc0aa78b770fa6a738034120c302":!0,"0x1b40183efb4dd766f11bda7a7c3ad8982e998421":!0,"0x1f9840a85d5af5bf1d1762f925bdaddc4201f984":!0,"0x31c8eacbffdd875c74b94b077895bd78cf1e64a3":!0,"0x6b175474e89094c44da98b954eedeac495271d0f":!0,"0x6dea81c8171d0ba574754ef6f8b412f2ed88c54d":!0,"0x77777feddddffc19ff86db637967013e6c6a116c":!0,"0x888888435fde8e7d4c54cab67f206e4199454c60":!0,"0x888888888889c00c67689029d7856aac1065ec11":!0,"0x88acdd2a6425c3faae4bc9650fd7e27e0bebb7ab":!0,"0x956f47f50a910163d8bf957cf5846d573e7f87ca":!0,"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48":!0,"0xba100000625a3754423978a60c9317c58a424e3d":!0,"0xc7283b66eb1eb5fb86327f08e1b5816b0720212b":!0},exports.API_BASE_URL=v,exports.DAI=S,exports.ETH_ADDRESS=h,exports.MAX_INT=C,exports.PERMIT_EXPIRATION_TS=3600,exports.RAINBOW_ROUTER_CONTRACT_ADDRESS="0x00000000009726632680fb29d3f7a9734e3010e2",exports.SOCKET_REGISTRY_CONTRACT_ADDRESSESS=w,exports.TORN_ADDRESS=g,exports.USDC_ADDRESS="0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",exports.VSP_ADDRESS=E,exports.WNXM_ADDRESS=A,exports.WRAPPED_ASSET=x,exports.fillCrosschainQuote=Y,exports.fillQuote=q,exports.getCrosschainQuote=G,exports.getCrosschainQuoteExecutionDetails=function(e,t,n){var a=e.from,r=e.data,i=e.value,s=w.get(e.fromChainId);return{method:n.estimateGas({data:r,from:a,to:s,value:i}),params:u({},t,{value:i})}},exports.getMinRefuelAmount=j,exports.getQuote=X,exports.getQuoteExecutionDetails=function(t,n,a){var r=new e.Contract("0x00000000009726632680fb29d3f7a9734e3010e2",M,a),i=t.sellTokenAddress,s=t.buyTokenAddress,o=t.to,p=t.data,d=t.fee,l=t.value,y=t.sellAmount,c=t.feePercentageBasisPoints,m=h.toLowerCase();return(null==i?void 0:i.toLowerCase())===m?{method:r.estimateGas.fillQuoteEthToToken,methodArgs:[s,o,p,d],methodName:"fillQuoteEthToToken",params:u({},n,{value:l}),router:r}:(null==s?void 0:s.toLowerCase())===m?{method:r.estimateGas.fillQuoteTokenToEth,methodArgs:[i,o,p,y,c],methodName:"fillQuoteTokenToEth",params:u({},n,{value:l}),router:r}:{method:r.estimateGas.fillQuoteTokenToToken,methodArgs:[i,s,o,p,y,d],methodName:"fillQuoteTokenToToken",params:u({},n,{value:l}),router:r}},exports.getWrappedAssetMethod=function(t,n,a){return void 0===a&&(a=exports.ChainId.mainnet),new e.Contract(x[a],JSON.stringify(T),n).estimateGas[t]},exports.signPermit=B,exports.sources={AAVE:"Aave",AAVE_LIQUIDATOR:"Aave Liquidator",AAVE_V2:"Aave V2",BALANCER:"Balancer",BALANCER_V2:"Balancer V2",BANCOR:"Bancor",BLACKHOLESWAP:"Blackholeswap",CHAI:"Chai",CLIPPER:"Clipper",COFIX:"CoFix",COMPOUND:"Compound",CONVERGENCE_X:"Convergence X",CREAM_LENDING:"Creamswap Lending",CREAMSWAP:"Creamswap",CURVE:"Curve",CURVE_V2:"Curve V2",CURVE_V2_ETH_CRV:"CURVE V2 ETH CRV",CURVE_V2_ETH_CVX:"CURVE V2 ETH CVX",CURVE_V2_EURS_2_ASSET:"Curve V2 EURS",CURVE_V2_EURT_2_ASSET:"CURVE V2 EURT",CURVE_V2_SPELL_2_ASSET:"Curve Spell",CURVE_V2_THRESHOLDNETWORK_2_ASSET:"Curve Threshold",CURVE_V2_XAUT_2_ASSET:"CURVE V2 XAUt",CURVE_V2_YFI_2_ASSET:"Curve Yfi",DEFI_PLAZA:"DeFi Plaza",DEFISWAP:"DeFi Swap",DFX_FINANCE:"Dfx Finance",DODO:"DODO",DODO_V2:"DODO v2",DXSWAP:"Swapr",FIXED_FEE_SWAP:"Fixed Fee Swap",FIXED_FEE_SWAP_V3:"Fixed Rate Swap",IEARN:"yEarn",INDEXED_FINANCE:"Indexed Finance",KYBER:"Kyber",KYBER_DMM:"Kyber DMM",LINKSWAP:"Link Swap",LUASWAP:"Lua Swap",MINISWAP:"Mini Swap",MOONISWAP:"Mooniswap",MSTABLE:"mStable",OASIS:"Oasis",ONE_INCH_LIMIT_ORDER:"1inch Limit Order Protocol",ONE_INCH_LIMIT_ORDER_V2:"1inch Limit Order Protocol V2",ONE_INCH_LP:"1inch LP v1.0",ONE_INCH_LP_1_1:"1inch LP v1.1",ONE_INCH_LP_MIGRATOR:"Mooniswap Migrator",ONE_INCH_LP_MIGRATOR_V1_1:"1inch LP v1.0 Migrator",PMM1:"PMM1",PMM2:"PMM2",PMM3:"PMM3",PMM4:"PMM4",PMMX:"LiqPool X",POWERINDEX:"POWERINDEX",PSM:"PSM",S_FINANCE:"sFinance",SADDLE:"Saddle Finance",SAKESWAP:"Sake Swap",SETH_WRAPPER:"sETH Wrapper",SHELL:"Shell",SHIBASWAP:"Shiba Swap",SMOOTHY_FINANCE:"Smoothy Finance",ST_ETH:"stETH",SUSHI:"Sushiswap",SUSHISWAP_MIGRATOR:"SushiSwap Migrator",SWERVE:"Swerve",SYNAPSE:"Synapse",SYNTHETIX:"Synthetix",SYNTHETIX_WRAPPER:"Synthetix Wrapper",UNIFI:"Unifi",UNISWAP_V1:"Uniswap V1",UNISWAP_V2:"Uniswap V2",UNISWAP_V2_MIGRATOR:"Uniswap Migrator",UNISWAP_V3:"UNISWAP V3",VALUELIQUID:"Value Liquid",WETH:"WETH",WSTETH:"wstETH",XSIGMA:"xSigma",ZRX:"0x",Native:"Native",Uniswap:"Uniswap",UniswapV2:"Uniswap_V2",Eth2Dai:"Eth2Dai",Kyber:"Kyber",Curve:"Curve",LiquidityProvider:"LiquidityProvider",MultiBridge:"MultiBridge",Balancer:"Balancer",BalancerV2:"Balancer_V2",Cream:"CREAM",Bancor:"Bancor",MakerPsm:"MakerPsm",MStable:"mStable",Mooniswap:"Mooniswap",MultiHop:"MultiHop",Shell:"Shell",Swerve:"Swerve",SnowSwap:"SnowSwap",SushiSwap:"SushiSwap",Dodo:"DODO",DodoV2:"DODO_V2",CryptoCom:"CryptoCom",Linkswap:"Linkswap",KyberDmm:"KyberDMM",Smoothy:"Smoothy",Component:"Component",Saddle:"Saddle",XSigma:"xSigma",UniswapV3:"Uniswap_V3",CurveV2:"Curve_V2",Lido:"Lido",ShibaSwap:"ShibaSwap",Clipper:"Clipper",PancakeSwap:"PancakeSwap",PancakeSwapV2:"PancakeSwap_V2",BakerySwap:"BakerySwap",Nerve:"Nerve",Belt:"Belt",Ellipsis:"Ellipsis",ApeSwap:"ApeSwap",CafeSwap:"CafeSwap",CheeseSwap:"CheeseSwap",JulSwap:"JulSwap",ACryptos:"ACryptoS",QuickSwap:"QuickSwap",ComethSwap:"ComethSwap",Dfyn:"Dfyn",WaultSwap:"WaultSwap",Polydex:"Polydex",FirebirdOneSwap:"FirebirdOneSwap",JetSwap:"JetSwap",IronSwap:"IronSwap"},exports.unwrapNativeAsset=P,exports.wrapNativeAsset=_; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@ethersproject/contracts"),t=require("@ethersproject/bignumber"),n=require("@ethereumjs/util"),a=require("@ethersproject/bytes"),r=require("@metamask/eth-sig-util"),i=require("@ethersproject/keccak256"),s=require("@ethersproject/strings");function o(e,t,n,a,r,i,s){try{var o=e[i](s),p=o.value}catch(e){return void n(e)}o.done?t(p):Promise.resolve(p).then(a,r)}function p(e){return function(){var t=this,n=arguments;return new Promise((function(a,r){var i=e.apply(t,n);function s(e){o(i,a,r,s,p,"next",e)}function p(e){o(i,a,r,s,p,"throw",e)}s(void 0)}))}}function u(){return(u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(this,arguments)}var d,l,y,c,m,f,b=(function(e){var t=function(e){var t=Object.prototype,n=t.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},r=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function o(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{o({},"")}catch(e){o=function(e,t,n){return e[t]=n}}function p(e,t,n,a){var r=Object.create((t&&t.prototype instanceof l?t:l).prototype),i=new g(a||[]);return r._invoke=function(e,t,n){var a="suspendedStart";return function(r,i){if("executing"===a)throw new Error("Generator is already running");if("completed"===a){if("throw"===r)throw i;return{value:void 0,done:!0}}for(n.method=r,n.arg=i;;){var s=n.delegate;if(s){var o=w(s,n);if(o){if(o===d)continue;return o}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===a)throw a="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);a="executing";var p=u(e,t,n);if("normal"===p.type){if(a=n.done?"completed":"suspendedYield",p.arg===d)continue;return{value:p.arg,done:n.done}}"throw"===p.type&&(a="completed",n.method="throw",n.arg=p.arg)}}}(e,n,i),r}function u(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=p;var d={};function l(){}function y(){}function c(){}var m={};o(m,r,(function(){return this}));var f=Object.getPrototypeOf,b=f&&f(f(A([])));b&&b!==t&&n.call(b,r)&&(m=b);var T=c.prototype=l.prototype=Object.create(m);function h(e){["next","throw","return"].forEach((function(t){o(e,t,(function(e){return this._invoke(t,e)}))}))}function v(e,t){var a;this._invoke=function(r,i){function s(){return new t((function(a,s){!function a(r,i,s,o){var p=u(e[r],e,i);if("throw"!==p.type){var d=p.arg,l=d.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){a("next",e,s,o)}),(function(e){a("throw",e,s,o)})):t.resolve(l).then((function(e){d.value=e,s(d)}),(function(e){return a("throw",e,s,o)}))}o(p.arg)}(r,i,a,s)}))}return a=a?a.then(s,s):s()}}function w(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return d;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var a=u(n,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,d;var r=a.arg;return r?r.done?(t[e.resultName]=r.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):r:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function g(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function A(e){if(e){var t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var a=-1,i=function t(){for(;++a<e.length;)if(n.call(e,a))return t.value=e[a],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:E}}function E(){return{value:void 0,done:!0}}return y.prototype=c,o(T,"constructor",c),o(c,"constructor",y),y.displayName=o(c,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,o(e,s,"GeneratorFunction")),e.prototype=Object.create(T),e},e.awrap=function(e){return{__await:e}},h(v.prototype),o(v.prototype,i,(function(){return this})),e.AsyncIterator=v,e.async=function(t,n,a,r,i){void 0===i&&(i=Promise);var s=new v(p(t,n,a,r),i);return e.isGeneratorFunction(n)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},h(T),o(T,s,"Generator"),o(T,r,(function(){return this})),o(T,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var a=t.pop();if(a in e)return n.value=a,n.done=!1,n}return n.done=!0,n}},e.values=A,g.prototype={constructor:g,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function a(n,a){return s.type="throw",s.arg=e,t.next=n,a&&(t.method="next",t.arg=void 0),!!a}for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],s=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var o=n.call(i,"catchLoc"),p=n.call(i,"finallyLoc");if(o&&p){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(o){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!p)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var a=this.tryEntries.length-1;a>=0;--a){var r=this.tryEntries[a];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=e,s.arg=t,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),S(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var a=n.completion;if("throw"===a.type){var r=a.arg;S(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:A(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}(f={exports:{}}),f.exports),T=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"deposit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"}];(d=exports.ChainId||(exports.ChainId={}))[d.mainnet=1]="mainnet",d[d.ropsten=3]="ropsten",d[d.kovan=42]="kovan",d[d.goerli=5]="goerli",d[d.rinkeby=4]="rinkeby",d[d.optimism=10]="optimism",d[d.bsc=56]="bsc",d[d.polygon=137]="polygon",d[d.arbitrum=42161]="arbitrum",d[d.zora=7777777]="zora",d[d.base=8453]="base",(l=exports.Source||(exports.Source={})).Aggregator0x="0x",l.Aggregotor1inch="1inch",(y=exports.SwapType||(exports.SwapType={})).normal="normal",y.crossChain="cross-chain";var h="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",v="https://swap.p.rainbow.me",w=new Map([[exports.ChainId.mainnet,"0x3a23F943181408EAC424116Af7b7790c94Cb97a5"],[exports.ChainId.optimism,"0x3a23F943181408EAC424116Af7b7790c94Cb97a5"],[exports.ChainId.polygon,"0x3a23F943181408EAC424116Af7b7790c94Cb97a5"],[exports.ChainId.arbitrum,"0x3a23F943181408EAC424116Af7b7790c94Cb97a5"],[exports.ChainId.bsc,"0x3a23F943181408EAC424116Af7b7790c94Cb97a5"],[exports.ChainId.zora,"0x3a23F943181408EAC424116Af7b7790c94Cb97a5"],[exports.ChainId.base,"0x3a23F943181408EAC424116Af7b7790c94Cb97a5"]]),x=((c={})[""+exports.ChainId.mainnet]="0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",c[""+exports.ChainId.optimism]="0x4200000000000000000000000000000000000006",c[""+exports.ChainId.polygon]="0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270",c[""+exports.ChainId.arbitrum]="0x82af49447d8a07e3bd95bd0d56f35241523fbab1",c[""+exports.ChainId.bsc]="0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",c[""+exports.ChainId.zora]="0x4200000000000000000000000000000000000006",c[""+exports.ChainId.base]="0x4200000000000000000000000000000000000006",c),S=((m={})[""+exports.ChainId.mainnet]="0x6b175474e89094c44da98b954eedeac495271d0f",m),g="0x77777feddddffc19ff86db637967013e6c6a116c",A="0x0d438f3b5175bebc262bf23753c1e53d03432bde",E="0x1b40183efb4dd766f11bda7a7c3ad8982e998421",C=t.BigNumber.from("2").pow("256").sub("1").toString(),_=function(){var t=p(b.mark((function t(n,a,r,i){var s;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===r&&(r=exports.ChainId.mainnet),void 0===i&&(i={}),s=new e.Contract(x[r],JSON.stringify(T),a),t.abrupt("return",s.deposit(u({},i,{value:n})));case 4:case"end":return t.stop()}}),t)})));return function(e,n,a,r){return t.apply(this,arguments)}}(),P=function(){var t=p(b.mark((function t(n,a,r,i){var s;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===r&&(r=exports.ChainId.mainnet),void 0===i&&(i={}),s=new e.Contract(x[r],JSON.stringify(T),a),t.abrupt("return",s.withdraw(n,i));case 4:case"end":return t.stop()}}),t)})));return function(e,n,a,r){return t.apply(this,arguments)}}(),M=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"target",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"EthWithdrawn",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newOwner",type:"address"},{indexed:!0,internalType:"address",name:"oldOwner",type:"address"}],name:"OwnerChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"target",type:"address"}],name:"SwapTargetAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"target",type:"address"}],name:"SwapTargetRemoved",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"token",type:"address"},{indexed:!0,internalType:"address",name:"target",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"TokenWithdrawn",type:"event"},{inputs:[{internalType:"address",name:"buyTokenAddress",type:"address"},{internalType:"address payable",name:"target",type:"address"},{internalType:"bytes",name:"swapCallData",type:"bytes"},{internalType:"uint256",name:"feeAmount",type:"uint256"}],name:"fillQuoteEthToToken",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"sellTokenAddress",type:"address"},{internalType:"address payable",name:"target",type:"address"},{internalType:"bytes",name:"swapCallData",type:"bytes"},{internalType:"uint256",name:"sellAmount",type:"uint256"},{internalType:"uint256",name:"feePercentageBasisPoints",type:"uint256"}],name:"fillQuoteTokenToEth",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"sellTokenAddress",type:"address"},{internalType:"address payable",name:"target",type:"address"},{internalType:"bytes",name:"swapCallData",type:"bytes"},{internalType:"uint256",name:"sellAmount",type:"uint256"},{internalType:"uint256",name:"feePercentageBasisPoints",type:"uint256"},{components:[{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"bool",name:"isDaiStylePermit",type:"bool"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],internalType:"struct PermitHelper.Permit",name:"permitData",type:"tuple"}],name:"fillQuoteTokenToEthWithPermit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"sellTokenAddress",type:"address"},{internalType:"address",name:"buyTokenAddress",type:"address"},{internalType:"address payable",name:"target",type:"address"},{internalType:"bytes",name:"swapCallData",type:"bytes"},{internalType:"uint256",name:"sellAmount",type:"uint256"},{internalType:"uint256",name:"feeAmount",type:"uint256"}],name:"fillQuoteTokenToToken",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"sellTokenAddress",type:"address"},{internalType:"address",name:"buyTokenAddress",type:"address"},{internalType:"address payable",name:"target",type:"address"},{internalType:"bytes",name:"swapCallData",type:"bytes"},{internalType:"uint256",name:"sellAmount",type:"uint256"},{internalType:"uint256",name:"feeAmount",type:"uint256"},{components:[{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"bool",name:"isDaiStylePermit",type:"bool"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],internalType:"struct PermitHelper.Permit",name:"permitData",type:"tuple"}],name:"fillQuoteTokenToTokenWithPermit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"swapTargets",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"target",type:"address"},{internalType:"bool",name:"add",type:"bool"}],name:"updateSwapTargets",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"withdrawEth",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"withdrawToken",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],k=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[],name:"DOMAIN_SEPARATOR",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"PERMIT_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"holder",type:"address"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"expiry",type:"uint256"},{internalType:"bool",name:"allowed",type:"bool"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"permit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"version",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"}],I=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[],name:"DOMAIN_SEPARATOR",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"_nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"permit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"version",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"}],L=[{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],R=function(){var e=p(b.mark((function e(t,n,a,i){return b.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return","0x"+r.TypedDataUtils.hashStruct("EIP712Domain",{chainId:a,name:t,verifyingContract:i,version:n},{EIP712Domain:L},r.SignTypedDataVersion.V4).toString("hex"));case 1:case"end":return e.stop()}}),e)})));return function(t,n,a,r){return e.apply(this,arguments)}}(),N=function(){var e=p(b.mark((function e(t,n,a,r){var i,s;return b.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.version();case 3:return e.abrupt("return",e.sent);case 7:return e.prev=7,e.t0=e.catch(0),i="1",e.prev=10,e.next=13,t.DOMAIN_SEPARATOR();case 13:return s=e.sent,e.next=16,R(n,i,a,r);case 16:if(s!==e.sent){e.next=19;break}return e.abrupt("return",i);case 19:e.next=26;break;case 21:if(e.prev=21,e.t1=e.catch(10),1!==a||-1===[g,A,E].map((function(e){return e.toLowerCase()})).indexOf(t.address.toLowerCase())){e.next=25;break}return e.abrupt("return","1");case 25:case 26:return e.abrupt("return",null);case 27:case"end":return e.stop()}}),e,null,[[0,7],[10,21]])})));return function(t,n,a,r){return e.apply(this,arguments)}}(),D=function(){var e=p(b.mark((function e(t,n){return b.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.nonces(n);case 3:return e.abrupt("return",e.sent);case 7:return e.prev=7,e.t0=e.catch(0),e.prev=9,e.next=12,t._nonces(n);case 12:return e.abrupt("return",e.sent);case 16:return e.prev=16,e.t1=e.catch(9),e.abrupt("return",0);case 19:case"end":return e.stop()}}),e,null,[[0,7],[9,16]])})));return function(t,n){return e.apply(this,arguments)}}(),O=[{name:"name",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],V=[{name:"owner",type:"address"},{name:"spender",type:"address"},{name:"value",type:"uint256"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"}],U=[{name:"holder",type:"address"},{name:"spender",type:"address"},{name:"nonce",type:"uint256"},{name:"expiry",type:"uint256"},{name:"allowed",type:"bool"}];function B(e,t,n,a,r,i,s){return F.apply(this,arguments)}function F(){return(F=p(b.mark((function i(s,o,p,u,d,l,y){var c,m,f,T,h,v,w,x,g,A,E,C,_;return b.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return m=o.toLowerCase()===(null==(c=S[y])?void 0:c.toLowerCase()),f=new e.Contract(o,m?k:I,s),i.next=4,f.name();case 4:return T=i.sent,i.next=7,Promise.all([D(f,p),N(f,T,y,f.address)]);case 7:return v=(h=i.sent)[0],w=h[1],x={nonce:Number(v.toString()),spender:u},m?(x.holder=p,x.allowed=!0,x.expiry=Number(l.toString())):(x.value=t.BigNumber.from(d).toHexString(),x.deadline=Number(l.toString()),x.owner=p),g={chainId:y,name:T,verifyingContract:f.address},null!==w&&(g.version=w),A={domain:g,message:x,primaryType:"Permit",types:{EIP712Domain:null!==w?L:O,Permit:m?U:V}},E=Buffer.from(n.addHexPrefix(s.privateKey).substring(2),"hex"),C=r.signTypedData({data:A,privateKey:E,version:r.SignTypedDataVersion.V4}),_=a.splitSignature(C),i.abrupt("return",{deadline:l,isDaiStylePermit:m,nonce:v,r:_.r,s:_.s,v:_.v,value:x.value||t.BigNumber.from("0").toHexString()});case 20:case"end":return i.stop()}}),i)})))).apply(this,arguments)}function W(e){return i.keccak256(s.toUtf8Bytes(e)).substring(2,10)}var H=function(e){var t=e.sellTokenAddress,n=e.buyTokenAddress,a=e.buyAmount,r=e.sellAmount,i=e.fromAddress,s=e.source,o=e.feePercentageBasisPoints,p=e.slippage,d=new URLSearchParams(u({buyToken:n,chainId:String(e.chainId),fromAddress:i,sellToken:t,slippage:String(p),swapType:exports.SwapType.normal},s?{source:s}:{},r?{sellAmount:String(r)}:{buyAmount:String(a)},n===h?{destReceiver:"0x00000000009726632680fb29d3f7a9734e3010e2"}:{},void 0!==o?{feePercentageBasisPoints:String(o)}:{}));return v+"/v1/quote?"+d.toString()},Q=function(e){var t=e.toChainId,n=e.sellTokenAddress,a=e.sellAmount,r=e.fromAddress,i=e.slippage,s=e.refuel,o=new URLSearchParams({buyToken:e.buyTokenAddress,chainId:String(e.chainId),fromAddress:r,refuel:String(s),sellAmount:String(a),sellToken:n,slippage:String(i),swapType:exports.SwapType.crossChain,toChainId:String(t)});return v+"/v1/quote?bridgeVersion=2&"+o.toString()},j=function(){var e=p(b.mark((function e(n){var a,r,i,s,o;return b.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=n.chainId,r=n.toChainId,e.next=4,fetch("https://swap.p.rainbow.me/v1/chains");case 4:return i=e.sent,e.next=7,i.json();case 7:if(s=e.sent.result.find((function(e){return e.chainId===a}))){e.next=11;break}return e.abrupt("return",null);case 11:if(o=s.limits.find((function(e){return e.chainId===r}))){e.next=14;break}return e.abrupt("return",null);case 14:return e.abrupt("return",t.BigNumber.from(o.minAmount).mul(2).toString());case 15:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),X=function(){var e=p(b.mark((function e(t){var n,a,r,i,s,o,p,u,d,l,y,c,m,f,T,v,w,S,g,A;return b.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=t.source,i=void 0===(r=t.chainId)?exports.ChainId.mainnet:r,s=t.fromAddress,p=t.buyTokenAddress,u=t.sellAmount,d=t.buyAmount,l=t.slippage,y=t.feePercentageBasisPoints,c=(o=t.sellTokenAddress).toLowerCase(),m=p.toLowerCase(),f=h.toLowerCase(),T=null==(n=x[i])?void 0:n.toLowerCase(),w=c===T&&m===f,!(v=c===f&&m===T)&&!w){e.next=9;break}return e.abrupt("return",{buyAmount:u||d,buyTokenAddress:p,defaultGasLimit:v?"30000":"40000",fee:0,feePercentageBasisPoints:0,from:s,inputTokenDecimals:18,outputTokenDecimals:18,sellAmount:u||d,sellAmountMinusFees:u||d,sellTokenAddress:o});case 9:if(!isNaN(Number(u))||!isNaN(Number(d))){e.next=11;break}return e.abrupt("return",null);case 11:return S=H({buyAmount:d,buyTokenAddress:p,chainId:i,feePercentageBasisPoints:y,fromAddress:s,sellAmount:u,sellTokenAddress:o,slippage:l,source:a}),e.next=14,fetch(S);case 14:return g=e.sent,e.next=17,g.json();case 17:if(!(A=e.sent).error){e.next=20;break}return e.abrupt("return",A);case 20:return e.abrupt("return",A);case 21:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),G=function(){var e=p(b.mark((function e(t){var n,a,r,i,s,o,p,u,d,l,y,c,m,f;return b.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=void 0===(n=t.chainId)?exports.ChainId.mainnet:n,r=t.toChainId,i=t.fromAddress,s=t.sellTokenAddress,o=t.buyTokenAddress,u=t.slippage,l=void 0!==(d=t.refuel)&&d,(p=t.sellAmount)&&r){e.next=3;break}return e.abrupt("return",null);case 3:return y=Q({buyTokenAddress:o,chainId:a,fromAddress:i,refuel:l,sellAmount:p,sellTokenAddress:s,slippage:u,toChainId:r}),e.next=6,fetch(y);case 6:return c=e.sent,e.next=9,c.json();case 9:if(!(m=e.sent).error){e.next=12;break}return e.abrupt("return",m);case 12:return(f=m).allowanceTarget=w.get(a),e.abrupt("return",f);case 15:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),K=function(){var e=p(b.mark((function e(t){return b.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.provider.getBlock("latest");case 2:return e.abrupt("return",e.sent.timestamp+3600);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),q=function(){var t=p(b.mark((function t(n,a,r,i,s,o){var p,d,l,y,c,m,f,T,v,w,x,S,g,A,E;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(p=new e.Contract("0x00000000009726632680fb29d3f7a9734e3010e2",M,r),l=n.sellTokenAddress,y=n.buyTokenAddress,c=n.to,m=n.data,f=n.fee,T=n.value,v=n.sellAmount,w=n.feePercentageBasisPoints,x=h.toLowerCase(),(null==l?void 0:l.toLowerCase())!==x){t.next=9;break}return t.next=6,p.populateTransaction.fillQuoteEthToToken(y,c,m,f,u({},a,{value:T}));case 6:d=t.sent,t.next=42;break;case 9:if((null==y?void 0:y.toLowerCase())!==x){t.next=27;break}if(!i){t.next=22;break}return t.next=13,K(r);case 13:return S=t.sent,t.next=16,B(r,l,n.from,p.address,C,S,s);case 16:return g=t.sent,t.next=19,p.populateTransaction.fillQuoteTokenToEthWithPermit(l,c,m,v,w,g,u({},a,{value:T}));case 19:d=t.sent,t.next=25;break;case 22:return t.next=24,p.populateTransaction.fillQuoteTokenToEth(l,c,m,v,w,u({},a,{value:T}));case 24:d=t.sent;case 25:t.next=42;break;case 27:if(!i){t.next=39;break}return t.next=30,K(r);case 30:return A=t.sent,t.next=33,B(r,l,n.from,p.address,C,A,s);case 33:return E=t.sent,t.next=36,p.populateTransaction.fillQuoteTokenToTokenWithPermit(l,y,c,m,v,f,E,u({},a,{value:T}));case 36:d=t.sent,t.next=42;break;case 39:return t.next=41,p.populateTransaction.fillQuoteTokenToToken(l,y,c,m,v,f,u({},a,{value:T}));case 41:d=t.sent;case 42:return o&&(d.data=""+d.data+W(o)),t.next=45,r.sendTransaction(u({data:d.data,from:d.from,to:d.to},u({},a,{value:T})));case 45:return t.abrupt("return",t.sent);case 47:case"end":return t.stop()}}),t)})));return function(e,n,a,r,i,s){return t.apply(this,arguments)}}(),Y=function(){var e=p(b.mark((function e(t,n,a,r){var i,s,o,p,d;return b.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.data,s=t.from,o=t.value,p=w.get(t.fromChainId),d=i,r&&(d=""+d+W(r)),e.next=6,a.sendTransaction(u({data:d,from:s,to:p},u({},n,{value:o})));case 6:return e.abrupt("return",e.sent);case 8:case"end":return e.stop()}}),e)})));return function(t,n,a,r){return e.apply(this,arguments)}}();exports.ALLOWS_PERMIT={"0x0d438f3b5175bebc262bf23753c1e53d03432bde":!0,"0x111111111117dc0aa78b770fa6a738034120c302":!0,"0x1b40183efb4dd766f11bda7a7c3ad8982e998421":!0,"0x1f9840a85d5af5bf1d1762f925bdaddc4201f984":!0,"0x31c8eacbffdd875c74b94b077895bd78cf1e64a3":!0,"0x6b175474e89094c44da98b954eedeac495271d0f":!0,"0x6dea81c8171d0ba574754ef6f8b412f2ed88c54d":!0,"0x77777feddddffc19ff86db637967013e6c6a116c":!0,"0x888888435fde8e7d4c54cab67f206e4199454c60":!0,"0x888888888889c00c67689029d7856aac1065ec11":!0,"0x88acdd2a6425c3faae4bc9650fd7e27e0bebb7ab":!0,"0x956f47f50a910163d8bf957cf5846d573e7f87ca":!0,"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48":!0,"0xba100000625a3754423978a60c9317c58a424e3d":!0,"0xc7283b66eb1eb5fb86327f08e1b5816b0720212b":!0},exports.API_BASE_URL=v,exports.DAI=S,exports.ETH_ADDRESS=h,exports.MAX_INT=C,exports.PERMIT_EXPIRATION_TS=3600,exports.RAINBOW_ROUTER_CONTRACT_ADDRESS="0x00000000009726632680fb29d3f7a9734e3010e2",exports.SOCKET_REGISTRY_CONTRACT_ADDRESSESS=w,exports.TORN_ADDRESS=g,exports.USDC_ADDRESS="0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",exports.VSP_ADDRESS=E,exports.WNXM_ADDRESS=A,exports.WRAPPED_ASSET=x,exports.fillCrosschainQuote=Y,exports.fillQuote=q,exports.getCrosschainQuote=G,exports.getCrosschainQuoteExecutionDetails=function(e,t,n){var a=e.from,r=e.data,i=e.value,s=w.get(e.fromChainId);return{method:n.estimateGas({data:r,from:a,to:s,value:i}),params:u({},t,{value:i})}},exports.getMinRefuelAmount=j,exports.getQuote=X,exports.getQuoteExecutionDetails=function(t,n,a){var r=new e.Contract("0x00000000009726632680fb29d3f7a9734e3010e2",M,a),i=t.sellTokenAddress,s=t.buyTokenAddress,o=t.to,p=t.data,d=t.fee,l=t.value,y=t.sellAmount,c=t.feePercentageBasisPoints,m=h.toLowerCase();return(null==i?void 0:i.toLowerCase())===m?{method:r.estimateGas.fillQuoteEthToToken,methodArgs:[s,o,p,d],methodName:"fillQuoteEthToToken",params:u({},n,{value:l}),router:r}:(null==s?void 0:s.toLowerCase())===m?{method:r.estimateGas.fillQuoteTokenToEth,methodArgs:[i,o,p,y,c],methodName:"fillQuoteTokenToEth",params:u({},n,{value:l}),router:r}:{method:r.estimateGas.fillQuoteTokenToToken,methodArgs:[i,s,o,p,y,d],methodName:"fillQuoteTokenToToken",params:u({},n,{value:l}),router:r}},exports.getWrappedAssetMethod=function(t,n,a){return void 0===a&&(a=exports.ChainId.mainnet),new e.Contract(x[a],JSON.stringify(T),n).estimateGas[t]},exports.signPermit=B,exports.sources={AAVE:"Aave",AAVE_LIQUIDATOR:"Aave Liquidator",AAVE_V2:"Aave V2",BALANCER:"Balancer",BALANCER_V2:"Balancer V2",BANCOR:"Bancor",BLACKHOLESWAP:"Blackholeswap",CHAI:"Chai",CLIPPER:"Clipper",COFIX:"CoFix",COMPOUND:"Compound",CONVERGENCE_X:"Convergence X",CREAM_LENDING:"Creamswap Lending",CREAMSWAP:"Creamswap",CURVE:"Curve",CURVE_V2:"Curve V2",CURVE_V2_ETH_CRV:"CURVE V2 ETH CRV",CURVE_V2_ETH_CVX:"CURVE V2 ETH CVX",CURVE_V2_EURS_2_ASSET:"Curve V2 EURS",CURVE_V2_EURT_2_ASSET:"CURVE V2 EURT",CURVE_V2_SPELL_2_ASSET:"Curve Spell",CURVE_V2_THRESHOLDNETWORK_2_ASSET:"Curve Threshold",CURVE_V2_XAUT_2_ASSET:"CURVE V2 XAUt",CURVE_V2_YFI_2_ASSET:"Curve Yfi",DEFI_PLAZA:"DeFi Plaza",DEFISWAP:"DeFi Swap",DFX_FINANCE:"Dfx Finance",DODO:"DODO",DODO_V2:"DODO v2",DXSWAP:"Swapr",FIXED_FEE_SWAP:"Fixed Fee Swap",FIXED_FEE_SWAP_V3:"Fixed Rate Swap",IEARN:"yEarn",INDEXED_FINANCE:"Indexed Finance",KYBER:"Kyber",KYBER_DMM:"Kyber DMM",LINKSWAP:"Link Swap",LUASWAP:"Lua Swap",MINISWAP:"Mini Swap",MOONISWAP:"Mooniswap",MSTABLE:"mStable",OASIS:"Oasis",ONE_INCH_LIMIT_ORDER:"1inch Limit Order Protocol",ONE_INCH_LIMIT_ORDER_V2:"1inch Limit Order Protocol V2",ONE_INCH_LP:"1inch LP v1.0",ONE_INCH_LP_1_1:"1inch LP v1.1",ONE_INCH_LP_MIGRATOR:"Mooniswap Migrator",ONE_INCH_LP_MIGRATOR_V1_1:"1inch LP v1.0 Migrator",PMM1:"PMM1",PMM2:"PMM2",PMM3:"PMM3",PMM4:"PMM4",PMMX:"LiqPool X",POWERINDEX:"POWERINDEX",PSM:"PSM",S_FINANCE:"sFinance",SADDLE:"Saddle Finance",SAKESWAP:"Sake Swap",SETH_WRAPPER:"sETH Wrapper",SHELL:"Shell",SHIBASWAP:"Shiba Swap",SMOOTHY_FINANCE:"Smoothy Finance",ST_ETH:"stETH",SUSHI:"Sushiswap",SUSHISWAP_MIGRATOR:"SushiSwap Migrator",SWERVE:"Swerve",SYNAPSE:"Synapse",SYNTHETIX:"Synthetix",SYNTHETIX_WRAPPER:"Synthetix Wrapper",UNIFI:"Unifi",UNISWAP_V1:"Uniswap V1",UNISWAP_V2:"Uniswap V2",UNISWAP_V2_MIGRATOR:"Uniswap Migrator",UNISWAP_V3:"UNISWAP V3",VALUELIQUID:"Value Liquid",WETH:"WETH",WSTETH:"wstETH",XSIGMA:"xSigma",ZRX:"0x",Native:"Native",Uniswap:"Uniswap",UniswapV2:"Uniswap_V2",Eth2Dai:"Eth2Dai",Kyber:"Kyber",Curve:"Curve",LiquidityProvider:"LiquidityProvider",MultiBridge:"MultiBridge",Balancer:"Balancer",BalancerV2:"Balancer_V2",Cream:"CREAM",Bancor:"Bancor",MakerPsm:"MakerPsm",MStable:"mStable",Mooniswap:"Mooniswap",MultiHop:"MultiHop",Shell:"Shell",Swerve:"Swerve",SnowSwap:"SnowSwap",SushiSwap:"SushiSwap",Dodo:"DODO",DodoV2:"DODO_V2",CryptoCom:"CryptoCom",Linkswap:"Linkswap",KyberDmm:"KyberDMM",Smoothy:"Smoothy",Component:"Component",Saddle:"Saddle",XSigma:"xSigma",UniswapV3:"Uniswap_V3",CurveV2:"Curve_V2",Lido:"Lido",ShibaSwap:"ShibaSwap",Clipper:"Clipper",PancakeSwap:"PancakeSwap",PancakeSwapV2:"PancakeSwap_V2",BakerySwap:"BakerySwap",Nerve:"Nerve",Belt:"Belt",Ellipsis:"Ellipsis",ApeSwap:"ApeSwap",CafeSwap:"CafeSwap",CheeseSwap:"CheeseSwap",JulSwap:"JulSwap",ACryptos:"ACryptoS",QuickSwap:"QuickSwap",ComethSwap:"ComethSwap",Dfyn:"Dfyn",WaultSwap:"WaultSwap",Polydex:"Polydex",FirebirdOneSwap:"FirebirdOneSwap",JetSwap:"JetSwap",IronSwap:"IronSwap"},exports.unwrapNativeAsset=P,exports.wrapNativeAsset=_; | ||
//# sourceMappingURL=swaps.cjs.production.min.js.map |
{ | ||
"version": "0.7.0", | ||
"version": "0.8.0", | ||
"name": "@rainbow-me/swaps", | ||
@@ -61,2 +61,3 @@ "license": "GPL-3.0", | ||
"dependencies": { | ||
"@ethereumjs/util": "9.0.0", | ||
"@ethersproject/abi": "5.7.0", | ||
@@ -73,4 +74,3 @@ "@ethersproject/abstract-signer": "5.7.0", | ||
"@ethersproject/wallet": "5.7.0", | ||
"@metamask/eth-sig-util": "5.0.1", | ||
"ethereumjs-util": "6.2.1" | ||
"@metamask/eth-sig-util": "7.0.0" | ||
}, | ||
@@ -77,0 +77,0 @@ "resolutions": { |
@@ -0,1 +1,2 @@ | ||
import { addHexPrefix } from '@ethereumjs/util'; | ||
import { BigNumber, BigNumberish } from '@ethersproject/bignumber'; | ||
@@ -10,3 +11,2 @@ import { splitSignature } from '@ethersproject/bytes'; | ||
} from '@metamask/eth-sig-util'; | ||
import { addHexPrefix, toBuffer } from 'ethereumjs-util'; | ||
import { DAI, TORN_ADDRESS, VSP_ADDRESS, WNXM_ADDRESS } from '..'; | ||
@@ -194,3 +194,6 @@ import DAIAbi from '../abi/DAI.json'; | ||
const privateKeyBuffer = toBuffer(addHexPrefix(wallet.privateKey)); | ||
const privateKeyBuffer = Buffer.from( | ||
addHexPrefix(wallet.privateKey).substring(2), | ||
'hex' | ||
); | ||
@@ -197,0 +200,0 @@ const signature = signTypedData({ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
651107
10055
+ Added@ethereumjs/util@9.0.0
+ Added@ethereumjs/common@3.2.0(transitive)
+ Added@ethereumjs/rlp@5.0.2(transitive)
+ Added@ethereumjs/tx@4.2.0(transitive)
+ Added@ethereumjs/util@9.0.0(transitive)
+ Added@metamask/abi-utils@2.0.4(transitive)
+ Added@metamask/eth-sig-util@7.0.0(transitive)
+ Added@metamask/superstruct@3.1.0(transitive)
+ Added@metamask/utils@8.5.09.3.0(transitive)
+ Added@noble/hashes@1.5.0(transitive)
+ Added@types/debug@4.1.12(transitive)
+ Added@types/ms@0.7.34(transitive)
+ Addedcrc-32@1.2.2(transitive)
+ Addeddebug@4.3.7(transitive)
+ Addedms@2.1.3(transitive)
+ Addedpony-cause@2.1.11(transitive)
+ Addedsemver@7.6.3(transitive)
+ Addeduuid@9.0.1(transitive)
- Removedethereumjs-util@6.2.1
- Removed@metamask/eth-sig-util@5.0.1(transitive)
- Removed@noble/hashes@1.2.0(transitive)
- Removed@noble/secp256k1@1.7.1(transitive)
- Removed@scure/bip32@1.1.5(transitive)
- Removed@scure/bip39@1.1.1(transitive)
- Removed@types/bn.js@4.11.6(transitive)
- Removed@types/node@22.9.0(transitive)
- Removed@types/pbkdf2@3.1.2(transitive)
- Removed@types/secp256k1@4.0.6(transitive)
- Removedbase-x@3.0.10(transitive)
- Removedblakejs@1.2.1(transitive)
- Removedbn.js@4.11.8(transitive)
- Removedbrowserify-aes@1.2.0(transitive)
- Removedbs58@4.0.1(transitive)
- Removedbs58check@2.1.2(transitive)
- Removedbuffer-xor@1.0.3(transitive)
- Removedcipher-base@1.0.4(transitive)
- Removedcreate-hash@1.2.0(transitive)
- Removedcreate-hmac@1.1.7(transitive)
- Removedelliptic@6.6.0(transitive)
- Removedethereum-cryptography@0.1.31.2.0(transitive)
- Removedethereumjs-util@6.2.1(transitive)
- Removedevp_bytestokey@1.0.3(transitive)
- Removedhash-base@3.1.0(transitive)
- Removedkeccak@3.0.4(transitive)
- Removedmd5.js@1.3.5(transitive)
- Removednode-addon-api@2.0.25.1.0(transitive)
- Removednode-gyp-build@4.8.2(transitive)
- Removedpbkdf2@3.1.2(transitive)
- Removedrandombytes@2.1.0(transitive)
- Removedreadable-stream@3.6.2(transitive)
- Removedripemd160@2.0.2(transitive)
- Removedrlp@2.2.7(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsecp256k1@4.0.4(transitive)
- Removedsetimmediate@1.0.5(transitive)
- Removedsha.js@2.4.11(transitive)
- Removedstring_decoder@1.3.0(transitive)
- Removedundici-types@6.19.8(transitive)
- Removedutil-deprecate@1.0.2(transitive)
Updated@metamask/eth-sig-util@7.0.0