Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@automata-network/conveyor-sdk

Package Overview
Dependencies
Maintainers
3
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@automata-network/conveyor-sdk - npm Package Compare versions

Comparing version 0.2.3 to 0.2.4

2

CHANGELOG.txt

@@ -1,1 +0,1 @@

This change includes the automation workflow to publish build to the NPM registry.
Hotfix changes on ChainID hex conversion. Hex string of odd length should not he zero padded.

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("ethers"),t=require("bignumber.js"),n=require("@ethersproject/bignumber");function r(e,t,n,r,a,i,s){try{var o=e[i](s),u=o.value}catch(e){return void n(e)}o.done?t(u):Promise.resolve(u).then(r,a)}function a(e){return function(){var t=this,n=arguments;return new Promise((function(a,i){var s=e.apply(t,n);function o(e){r(s,a,i,o,u,"next",e)}function u(e){r(s,a,i,o,u,"throw",e)}o(void 0)}))}}function i(){return(i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function o(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return s(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u,p,c,d,y,l,f,m=(function(e){var t=function(e){var t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},a=r.iterator||"@@iterator",i=r.asyncIterator||"@@asyncIterator",s=r.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 u(e,t,n,r){var a=Object.create((t&&t.prototype instanceof d?t:d).prototype),i=new E(r||[]);return a._invoke=function(e,t,n){var r="suspendedStart";return function(a,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===a)throw i;return{value:void 0,done:!0}}for(n.method=a,n.arg=i;;){var s=n.delegate;if(s){var o=x(s,n);if(o){if(o===c)continue;return o}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=p(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===c)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(e,n,i),a}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var c={};function d(){}function y(){}function l(){}var f={};o(f,a,(function(){return this}));var m=Object.getPrototypeOf,h=m&&m(m(N([])));h&&h!==t&&n.call(h,a)&&(f=h);var T=l.prototype=d.prototype=Object.create(f);function b(e){["next","throw","return"].forEach((function(t){o(e,t,(function(e){return this._invoke(t,e)}))}))}function v(e,t){var r;this._invoke=function(a,i){function s(){return new t((function(r,s){!function r(a,i,s,o){var u=p(e[a],e,i);if("throw"!==u.type){var c=u.arg,d=c.value;return d&&"object"==typeof d&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){r("next",e,s,o)}),(function(e){r("throw",e,s,o)})):t.resolve(d).then((function(e){c.value=e,s(c)}),(function(e){return r("throw",e,s,o)}))}o(u.arg)}(a,i,r,s)}))}return r=r?r.then(s,s):s()}}function x(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,x(e,t),"throw"===t.method))return c;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var r=p(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,c;var a=r.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,c):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,c)}function g(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 w(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function E(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(g,this),this.reset(!0)}function N(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:C}}function C(){return{value:void 0,done:!0}}return y.prototype=l,o(T,"constructor",l),o(l,"constructor",y),y.displayName=o(l,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,l):(e.__proto__=l,o(e,s,"GeneratorFunction")),e.prototype=Object.create(T),e},e.awrap=function(e){return{__await:e}},b(v.prototype),o(v.prototype,i,(function(){return this})),e.AsyncIterator=v,e.async=function(t,n,r,a,i){void 0===i&&(i=Promise);var s=new v(u(t,n,r,a),i);return e.isGeneratorFunction(n)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},b(T),o(T,s,"Generator"),o(T,a,(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 r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=N,E.prototype={constructor:E,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(w),!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 r(n,r){return s.type="throw",s.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],s=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var o=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(o&&u){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(o){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var i=a;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,c):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),c},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),w(n),c}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;w(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:N(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),c}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}(f={exports:{}}),f.exports);(u=exports.ChainId||(exports.ChainId={}))[u.MAINNET=1]="MAINNET",u[u.ROPSTEN=3]="ROPSTEN",u[u.RINKEBY=4]="RINKEBY",u[u["GÖRLI"]=5]="GÖRLI",u[u.KOVAN=42]="KOVAN",u[u.MATIC=137]="MATIC",u[u.MATIC_TESTNET=80001]="MATIC_TESTNET",u[u.FANTOM=250]="FANTOM",u[u.FANTOM_TESTNET=4002]="FANTOM_TESTNET",u[u.XDAI=100]="XDAI",u[u.BSC=56]="BSC",u[u.BSC_TESTNET=97]="BSC_TESTNET",u[u.ARBITRUM=42161]="ARBITRUM",u[u.ARBITRUM_TESTNET=79377087078960]="ARBITRUM_TESTNET",u[u.MOONBEAM_TESTNET=1287]="MOONBEAM_TESTNET",u[u.AVALANCHE=43114]="AVALANCHE",u[u.AVALANCHE_TESTNET=43113]="AVALANCHE_TESTNET",u[u.HECO=128]="HECO",u[u.HECO_TESTNET=256]="HECO_TESTNET",u[u.HARMONY=16666e5]="HARMONY",u[u.HARMONY_TESTNET=16667e5]="HARMONY_TESTNET",u[u.OKEX=66]="OKEX",u[u.OKEX_TESTNET=65]="OKEX_TESTNET",u[u.CELO=42220]="CELO",u[u.PALM=11297108109]="PALM",u[u.PALM_TESTNET=11297108099]="PALM_TESTNET",u[u.MOONRIVER=1285]="MOONRIVER",(p=exports.ENVIRONMENT||(exports.ENVIRONMENT={}))[p.TEST=0]="TEST",p[p.PRODUCTION=1]="PRODUCTION";var h,T=((c={})[exports.ENVIRONMENT.TEST]=["https://conveyor-geode-staging.ata.network"],c[exports.ENVIRONMENT.PRODUCTION]=[],c),b=function(e){return(t=T[e])[Math.floor(Math.random()*t.length)];var t},v=((d={})[exports.ChainId.MAINNET]="0x84194C00E190dE7A10180853f6a28502Ad1A1029",d),x=((y={})[exports.ChainId.MAINNET]="0x6B175474E89094C44Da98b954EedeAC495271d0F",y[exports.ChainId.MATIC]="0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063",y),g=((l={})[exports.ChainId.MAINNET]="0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",l[exports.ChainId.BSC]="0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",l[exports.ChainId.MATIC]="0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",l),w=((h={})[exports.ChainId.BSC]="https://api.coingecko.com/api/v3/simple/token_price/binance-smart-chain?",h[exports.ChainId.MATIC]="https://api.coingecko.com/api/v3/simple/token_price/polygon-pos?",h[exports.ChainId.MAINNET]="https://api.coingecko.com/api/v3/simple/token_price/ethereum?",h[exports.ChainId.ARBITRUM]="https://api.coingecko.com/api/v3/simple/token_price/arbitrum-one?",h[exports.ChainId.MOONRIVER]="https://api.coingecko.com/api/v3/simple/token_price/moonriver?",h),E=[exports.ChainId.RINKEBY,exports.ChainId.ROPSTEN,exports.ChainId.GÖRLI,exports.ChainId.KOVAN,exports.ChainId.ARBITRUM_TESTNET,exports.ChainId.AVALANCHE_TESTNET,exports.ChainId.HARMONY_TESTNET,exports.ChainId.OKEX_TESTNET,exports.ChainId.BSC_TESTNET,exports.ChainId.PALM_TESTNET,exports.ChainId.MOONBEAM_TESTNET,exports.ChainId.FANTOM_TESTNET,exports.ChainId.MATIC_TESTNET,exports.ChainId.HECO_TESTNET],N=function(e){return E.includes(e)};function C(e,t,n,r,a,i){return M.apply(this,arguments)}function M(){return(M=a(m.mark((function n(r,a,i,s,o,u){var p,c,d,y,l,f,h,T;return m.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(void 0===u&&(u=18),!N(r)){n.next=3;break}return n.abrupt("return",e.BigNumber.from(0));case 3:if(p=w[r]){n.next=6;break}throw new Error("Error: API support for the provided chainId "+r+" is not supported");case 6:return n.next=8,fetch(p+"contract_addresses="+a+"&vs_currencies="+o);case 8:if(c=n.sent.json().then((function(e){if(0===Object.keys(e).length)throw new Error("Error: Unsupported fee token.");return Object.values(e)[0]})),"eth"!==o){n.next=18;break}return n.next=13,c;case 13:d=n.sent.eth,n.next=27;break;case 18:if("bnb"!==o){n.next=26;break}return n.next=21,c;case 21:d=n.sent.bnb,n.next=27;break;case 26:throw new Error("Error: Unsupported native token. Use the calculateFeeOnMatic() method for calculating fees on the Matic network.");case 27:return y=new t.BigNumber(10).pow(u).div(new t.BigNumber(10).pow(i.toString())),l=new t.BigNumber(d).multipliedBy(y),f=new t.BigNumber(s.toString()).div(l),h=f.toFixed(0,2),T=parseInt(h)<1?"1":h,n.abrupt("return",e.BigNumber.from(T));case 33:case"end":return n.stop()}}),n)})))).apply(this,arguments)}function A(e,t,n,r){return O.apply(this,arguments)}function O(){return(O=a(m.mark((function n(r,a,i,s){var o,u,p,c,d,y,l,f,h,T;return m.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:n.t0=r,n.next=n.t0===exports.ChainId.MATIC?3:n.t0===exports.ChainId.MOONRIVER?6:9;break;case 3:return o=w[exports.ChainId.MATIC],u="matic-network",n.abrupt("break",10);case 6:return o=w[exports.ChainId.MOONRIVER],u="moonriver",n.abrupt("break",10);case 9:throw new Error("Error: API support for the provided chainId "+r+" is not supported");case 10:return n.next=12,fetch(o+"contract_addresses="+a+"&vs_currencies=bnb");case 12:return p=n.sent.json().then((function(e){if(0===Object.keys(e).length)throw new Error("Error: Unsupported fee token.");return Object.values(e)[0]})),n.next=16,p;case 16:return c=new t.BigNumber(n.sent.bnb).multipliedBy(new t.BigNumber(10).pow(18)).div(new t.BigNumber(10).pow(i.toString())),d="https://api.coingecko.com/api/v3/simple/price?ids="+u+"&vs_currencies=bnb",n.next=22,fetch(d);case 22:return y=n.sent,n.next=25,y.json();case 25:return l=new t.BigNumber(n.sent[u].bnb),f=new t.BigNumber(s.toString()).div(c.div(l)),h=f.toFixed(0,2),T=parseInt(h)<1?"1":h,n.abrupt("return",e.BigNumber.from(T));case 33:case"end":return n.stop()}}),n)})))).apply(this,arguments)}function I(e,t,n,r,a,i){return S.apply(this,arguments)}function S(){return(S=a(m.mark((function e(t,n,r,a,i,s){return m.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:void 0===s&&(s=18),e.t0=t,e.next=e.t0===exports.ChainId.MATIC?4:e.t0===exports.ChainId.MAINNET?5:e.t0===exports.ChainId.BSC?6:e.t0===exports.ChainId.ARBITRUM?7:e.t0===exports.ChainId.MOONRIVER?8:9;break;case 4:return e.abrupt("return",A(t,n,r,a));case 5:return e.abrupt("return",C(t,n,r,a,"eth",s));case 6:return e.abrupt("return",C(t,n,r,a,"bnb",s));case 7:return e.abrupt("return",C(t,n,r,a,"eth",s));case 8:return e.abrupt("return",A(t,n,r,a));case 9:return e.abrupt("return",C(t,n,r,a,i,s));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var k=[{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],_=[{name:"from",type:"address"},{name:"to",type:"address"},{name:"feeToken",type:"address"},{name:"useOraclePriceFeed",type:"bool"},{name:"maxTokenAmount",type:"uint256"},{name:"deadline",type:"uint256"},{name:"nonce",type:"uint256"},{name:"data",type:"bytes"},{name:"extendCategories",type:"uint256[]"}];function R(e,t,r){return{name:r,version:"1",chainId:n.BigNumber.from(t).toHexString(),verifyingContract:e}}var B=e.utils.Interface;function L(e,t){return P.apply(this,arguments)}function P(){return(P=a(m.mark((function e(t,n){var r,a,s,u,p,c,d,y,l;return m.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=null;case 1:if(null!==r){e.next=7;break}return e.next=4,t.getTransactionReceipt(n.result.txnHash);case 4:r=e.sent,e.next=1;break;case 7:s=o(r.logs);case 9:if((u=s()).done){e.next=21;break}if("0xf624f223d0e1427abaf1ac2d9cf7c8487cad3018f0a93b5dafa867aed96165a3"!==(p=u.value).topics[0]){e.next=19;break}if(c=new B(["event MetaStatus(address sender, bool success, string error)"]),d=c.parseLog(p),l=(y=d.args).error,!1!==y.success){e.next=19;break}return a=i({},n,{result:{txnHash:n.result.txnHash,success:!1,errorMessage:l}}),e.abrupt("return",a);case 19:e.next=9;break;case 21:return e.abrupt("return",n);case 22:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function F(e,t,n){return H.apply(this,arguments)}function H(){return(H=a(m.mark((function t(n,r,a){var i,s,u,p,c,d,y,l,f,h,T,b;return m.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:i=null;case 1:if(null!==i){t.next=7;break}return t.next=4,n.getTransactionReceipt(r);case 4:i=t.sent,t.next=1;break;case 7:for(s=i.logs,u=e.BigNumber.from(0),p=e.BigNumber.from(0),c=o(s);!(d=c()).done;)"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"===(y=d.value).topics[0]&&(l="0x"+y.topics[1].slice(26),f="0x"+y.topics[2].slice(26),l!==f&&(h=new B(["event Transfer(address indexed from, address indexed to, uint256 value)"]),T=h.parseLog(y),b=T.args.value,f===a?u=u.add(b):l===a&&(p=p.add(b))));return t.abrupt("return",u.sub(p));case 12:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var j=[{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:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"holder",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:[{internalType:"address",name:"holder",type:"address"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"expiry",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:"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"}],D=[{inputs:[{internalType:"address",name:"_forwarder",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{inputs:[],name:"conveyorIsEnabled",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"disableConveyorProtection",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"enableConveyorProtection",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"forwarder",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_forwarder",type:"address"}],name:"isTrustedForwarder",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_forwarder",type:"address"}],name:"setForwarder",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"}],V=[{anonymous:!1,inputs:[{indexed:!1,internalType:"bool[]",name:"successArr",type:"bool[]"}],name:"BatchedMetaStatus",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"sender",type:"address"},{indexed:!1,internalType:"bool",name:"success",type:"bool"},{indexed:!1,internalType:"string",name:"error",type:"string"}],name:"MetaStatus",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{inputs:[],name:"DOMAIN_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"FORWARDER_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"aggregator",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"constantFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{components:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"address",name:"feeToken",type:"address"},{internalType:"bool",name:"useOraclePriceFeed",type:"bool"},{internalType:"uint256",name:"maxTokenAmount",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"},{internalType:"uint256[]",name:"extendCategories",type:"uint256[]"}],internalType:"struct ConveyorTypes.MetaTransaction",name:"metatx",type:"tuple"},{internalType:"string",name:"domainName",type:"string"},{internalType:"bool",name:"relayerChargeEnabled",type:"bool"},{internalType:"uint256",name:"tokenPricePerNativeToken",type:"uint256"},{internalType:"enum SignatureValidator.SignatureSignerType",name:"signerType",type:"uint8"},{internalType:"bytes",name:"sig",type:"bytes"},{internalType:"bytes",name:"extendParamData",type:"bytes"}],internalType:"struct ConveyorForwarder.ConveyorTransaction[]",name:"conveyorTransactions",type:"tuple[]"}],name:"executeBatchedMetaTx",outputs:[{internalType:"bool[]",name:"",type:"bool[]"},{internalType:"bytes[]",name:"",type:"bytes[]"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"address",name:"feeToken",type:"address"},{internalType:"bool",name:"useOraclePriceFeed",type:"bool"},{internalType:"uint256",name:"maxTokenAmount",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"},{internalType:"uint256[]",name:"extendCategories",type:"uint256[]"}],internalType:"struct ConveyorTypes.MetaTransaction",name:"metatx",type:"tuple"},{internalType:"string",name:"domainName",type:"string"},{internalType:"bool",name:"relayerChargeEnabled",type:"bool"},{internalType:"uint256",name:"tokenPricePerNativeToken",type:"uint256"},{internalType:"enum SignatureValidator.SignatureSignerType",name:"signerType",type:"uint8"},{internalType:"bytes",name:"sig",type:"bytes"},{internalType:"bytes",name:"extendParamData",type:"bytes"}],name:"executeMetaTxV2",outputs:[{internalType:"bool",name:"success",type:"bool"},{internalType:"bytes",name:"data",type:"bytes"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"relayers",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_aggregator",type:"address"}],name:"setAggregator",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_newConstantFee",type:"uint256"}],name:"setConstantFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_relayer",type:"address"},{internalType:"bool",name:"_trusted",type:"bool"}],name:"setRelayer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_newTransferFee",type:"uint256"}],name:"setTransferFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"transferFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"address",name:"feeReceiver",type:"address"}],name:"withdrawFeeTokens",outputs:[],stateMutability:"nonpayable",type:"function"}],U=e.utils.splitSignature,Y=e.utils.verifyTypedData,G=e.constants.AddressZero;function K(e,t){return X.apply(this,arguments)}function X(){return(X=a(m.mark((function e(t,n){return m.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getCode(n);case 2:return e.abrupt("return",e.sent.length>2);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function q(e,t,n,r,a,i){return J.apply(this,arguments)}function J(){return(J=a(m.mark((function e(t,n,r,a,i,s){var o,u,p,c;return m.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,R(r,n,a);case 2:return u={types:{EIP712Domain:k,Forwarder:_},domain:o=e.sent,primaryType:"Forwarder",message:i},p=JSON.stringify(u),e.next=7,t.send("eth_signTypedData_v4",[s,p]);case 7:return c=e.sent,i.from===s&&Z(o,i,c,s),e.abrupt("return",{sig:c,msg:u});case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function W(e,t){return{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",method:e,id:1,params:t})}}function Z(e,t,n,r){var a=Y(e,{Forwarder:_},t,n);if(a!==r||a===G)throw new Error("Signature verification failed")}exports.Conveyor=function(){function t(e,t){this.provider=e,this.forwarderAddress=(null==t?void 0:t.forwarder)||v[e.network.chainId],this.relayerConfig=(null==t?void 0:t.relayerConfig)||b(exports.ENVIRONMENT.PRODUCTION||(null==t?void 0:t.env))}var n=t.prototype;return n.fetchConveyorStatus=function(){var t=a(m.mark((function t(n){var r;return m.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=new e.Contract(n,D,this.provider),t.next=3,r.conveyorIsEnabled();case 3:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),n.toggleConveyorProtection=function(){var t=a(m.mark((function t(n,r){var a,i,s,o;return m.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=new e.Contract(n,D,this.provider),t.next=3,this.provider.getSigner();case 3:if(i=t.sent,!r){t.next=10;break}return t.next=7,a.connect(i).enableConveyorProtection();case 7:s=t.sent,t.next=13;break;case 10:return t.next=12,a.connect(i).disableConveyorProtection();case 12:s=t.sent;case 13:return t.next=15,s.wait();case 15:return t.abrupt("return",{id:1,jsonrpc:"2.0",result:{success:1===(o=t.sent).status,errorMessage:1===o.status?"":"Transaction Reverted",txnHash:o.transactionHash}});case 17:case"end":return t.stop()}}),t,this)})));return function(e,n){return t.apply(this,arguments)}}(),n.erc20ApproveForwarder=function(){var t=a(m.mark((function t(n,r){var a,i,s,o;return m.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=new e.Contract(r,j,this.provider),t.next=3,this.provider.getSigner();case 3:return i=t.sent,t.next=6,a.connect(i).approve(this.forwarderAddress,n);case 6:return s=t.sent,t.next=9,s.wait();case 9:return t.abrupt("return",{id:1,jsonrpc:"2.0",result:{success:1===(o=t.sent).status,errorMessage:1===o.status?"":"Transaction Reverted",txnHash:o.transactionHash}});case 11:case"end":return t.stop()}}),t,this)})));return function(e,n){return t.apply(this,arguments)}}(),n.getFeeFromTxn=function(){var e=a(m.mark((function e(t){return m.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F(this.provider,t,this.forwarderAddress);case 2:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n.submitConveyorTransaction=function(){var t=a(m.mark((function t(n,r,a,i,s,o,u,p,c,d,y){var l,f,h,T,b,v,x,g,w,E,N,C,M,A,O,S,k,_,R,B,P,F,H;return m.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===y&&(y=[]),t.next=3,this.fetchConveyorStatus(p);case 3:if(t.sent){t.next=6;break}return t.abrupt("return",this.submitTransaction(p,c,d,y));case 6:return l=new e.Contract(p,c,this.provider),f=new e.Contract(this.forwarderAddress,V,this.provider),h=l.interface.encodeFunctionData(d,y),t.next=11,this.provider.network.chainId;case 11:return T=t.sent,t.next=14,this.provider.getSigner();case 14:return b=t.sent,t.next=17,b.getAddress();case 17:if(v=t.sent,x=e.BigNumber.from(r).mul(e.BigNumber.from(a)),!(g=n!==G?new e.Contract(n,j,this.provider):void 0)){t.next=26;break}return t.next=23,g.decimals();case 23:t.t0=t.sent,t.next=27;break;case 26:t.t0=void 0;case 27:if(w=t.t0,n===G||null==w){t.next=34;break}return t.next=31,I(T,n,w,x);case 31:t.t1=t.sent,t.next=35;break;case 34:t.t1=e.BigNumber.from(0);case 35:return E=t.t1,t.next=38,f.nonces(v);case 38:return N=t.sent,C=Math.floor(Date.now()/1e3),M=e.BigNumber.from(C).add(e.BigNumber.from(i)),A=u.map((function(t){return e.BigNumber.from(t).toHexString()})),O={from:v,to:p,feeToken:n,useOraclePriceFeed:o,maxTokenAmount:E.toHexString(),deadline:M.toHexString(),nonce:N.toHexString(),data:h,extendCategories:A},t.next=45,q(this.provider,T,this.forwarderAddress,s,O,v);case 45:return k=(S=t.sent).msg,_=U(S.sig),R=[k,_.v.toString(),_.r,_.s],B=W("/v3/metaTx/execute",R),console.log("sending request..."),console.log(B),t.next=55,fetch(this.relayerConfig,B);case 55:return P=t.sent,t.next=58,P.json();case 58:if(H=F=t.sent,!F.result.success){t.next=65;break}return t.next=64,L(this.provider,F);case 64:H=t.sent;case 65:return console.log("response received..."),console.log(H),t.abrupt("return",H);case 68:case"end":return t.stop()}}),t,this)})));return function(e,n,r,a,i,s,o,u,p,c,d){return t.apply(this,arguments)}}(),n.submitMetaTransaction=function(){var t=a(m.mark((function t(n,r,a,i,s,o,u,p,c,d,y,l){var f,h,T,b,v,x,g,w,E,N,C,M,A,O,S,k,_,R,B,P,F,H;return m.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===l&&(l=[]),t.next=3,this.fetchConveyorStatus(c);case 3:if(t.sent){t.next=6;break}return t.abrupt("return",this.submitTransaction(c,d,y,l));case 6:return f=new e.Contract(c,d,this.provider),h=new e.Contract(this.forwarderAddress,V,this.provider),T=f.interface.encodeFunctionData(y,l),t.next=11,this.provider.network.chainId;case 11:return b=t.sent,t.next=14,this.provider.getSigner();case 14:return v=t.sent,t.next=17,v.getAddress();case 17:if(x=t.sent,g=e.BigNumber.from(r).mul(e.BigNumber.from(a)),!(w=n!==G?new e.Contract(n,j,this.provider):void 0)){t.next=26;break}return t.next=23,w.decimals();case 23:t.t0=t.sent,t.next=27;break;case 26:t.t0=void 0;case 27:if(E=t.t0,n===G||null==E){t.next=34;break}return t.next=31,I(b,n,E,g);case 31:t.t1=t.sent,t.next=35;break;case 34:t.t1=e.BigNumber.from(0);case 35:return N=t.t1,t.next=38,h.nonces(x);case 38:return C=t.sent,M=Math.floor(Date.now()/1e3),A=e.BigNumber.from(M).add(e.BigNumber.from(i)),O=u.map((function(t){return e.BigNumber.from(t).toHexString()})),S={from:p,to:c,feeToken:n,useOraclePriceFeed:o,maxTokenAmount:N.toHexString(),deadline:A.toHexString(),nonce:C.toHexString(),data:T,extendCategories:O},t.next=45,q(this.provider,b,this.forwarderAddress,s,S,x);case 45:return _=(k=t.sent).sig,R=k.msg,t.next=50,K(this.provider,p);case 50:return B=W("/v3/metaTx/executeV2",{signerType:t.sent?"CONTRACT":"EOA",msg:R,sig:_}),console.log("sending request..."),console.log(B),t.next=58,fetch(this.relayerConfig,B);case 58:return P=t.sent,t.next=61,P.json();case 61:if(H=F=t.sent,!F.result.success){t.next=68;break}return t.next=67,L(this.provider,F);case 67:H=t.sent;case 68:return console.log("response received..."),console.log(H),t.abrupt("return",H);case 71:case"end":return t.stop()}}),t,this)})));return function(e,n,r,a,i,s,o,u,p,c,d,y){return t.apply(this,arguments)}}(),n.submitTransaction=function(){var t=a(m.mark((function t(n,r,a,i){var s,o,u,p,c;return m.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===i&&(i=[]),s=new e.Contract(n,r,this.provider),o=s.interface.encodeFunctionData(a,i),t.next=5,this.provider.getSigner();case 5:return u=t.sent,t.next=8,u.sendTransaction({to:n,data:o});case 8:return p=t.sent,t.next=11,p.wait();case 11:return t.abrupt("return",{id:1,jsonrpc:"2.0",result:{success:1===(c=t.sent).status,errorMessage:1===c.status?"":"Transaction Reverted",txnHash:c.transactionHash}});case 13:case"end":return t.stop()}}),t,this)})));return function(e,n,r,a){return t.apply(this,arguments)}}(),t}(),exports.DAI_ADDRESS=x,exports.FORWARDER_ADDRESS=v,exports.RELAYER_ENDPOINT_URL=b,exports.USDC_ADDRESS=g,exports.getFeePrice=I,exports.verifyFee=F,exports.verifyMetaTxnResponse=L;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("ethers"),t=require("bignumber.js");function n(e,t,n,r,a,i,s){try{var o=e[i](s),u=o.value}catch(e){return void n(e)}o.done?t(u):Promise.resolve(u).then(r,a)}function r(e){return function(){var t=this,r=arguments;return new Promise((function(a,i){var s=e.apply(t,r);function o(e){n(s,a,i,o,u,"next",e)}function u(e){n(s,a,i,o,u,"throw",e)}o(void 0)}))}}function a(){return(a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return i(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u,p,c,d,y,l,f=(function(e){var t=function(e){var t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},a=r.iterator||"@@iterator",i=r.asyncIterator||"@@asyncIterator",s=r.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 u(e,t,n,r){var a=Object.create((t&&t.prototype instanceof d?t:d).prototype),i=new E(r||[]);return a._invoke=function(e,t,n){var r="suspendedStart";return function(a,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===a)throw i;return{value:void 0,done:!0}}for(n.method=a,n.arg=i;;){var s=n.delegate;if(s){var o=x(s,n);if(o){if(o===c)continue;return o}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=p(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===c)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(e,n,i),a}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var c={};function d(){}function y(){}function l(){}var f={};o(f,a,(function(){return this}));var m=Object.getPrototypeOf,h=m&&m(m(N([])));h&&h!==t&&n.call(h,a)&&(f=h);var T=l.prototype=d.prototype=Object.create(f);function b(e){["next","throw","return"].forEach((function(t){o(e,t,(function(e){return this._invoke(t,e)}))}))}function v(e,t){var r;this._invoke=function(a,i){function s(){return new t((function(r,s){!function r(a,i,s,o){var u=p(e[a],e,i);if("throw"!==u.type){var c=u.arg,d=c.value;return d&&"object"==typeof d&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){r("next",e,s,o)}),(function(e){r("throw",e,s,o)})):t.resolve(d).then((function(e){c.value=e,s(c)}),(function(e){return r("throw",e,s,o)}))}o(u.arg)}(a,i,r,s)}))}return r=r?r.then(s,s):s()}}function x(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,x(e,t),"throw"===t.method))return c;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var r=p(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,c;var a=r.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,c):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,c)}function g(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 w(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function E(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(g,this),this.reset(!0)}function N(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:C}}function C(){return{value:void 0,done:!0}}return y.prototype=l,o(T,"constructor",l),o(l,"constructor",y),y.displayName=o(l,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,l):(e.__proto__=l,o(e,s,"GeneratorFunction")),e.prototype=Object.create(T),e},e.awrap=function(e){return{__await:e}},b(v.prototype),o(v.prototype,i,(function(){return this})),e.AsyncIterator=v,e.async=function(t,n,r,a,i){void 0===i&&(i=Promise);var s=new v(u(t,n,r,a),i);return e.isGeneratorFunction(n)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},b(T),o(T,s,"Generator"),o(T,a,(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 r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=N,E.prototype={constructor:E,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(w),!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 r(n,r){return s.type="throw",s.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],s=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var o=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(o&&u){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(o){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var i=a;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,c):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),c},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),w(n),c}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;w(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:N(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),c}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}(l={exports:{}}),l.exports);(o=exports.ChainId||(exports.ChainId={}))[o.MAINNET=1]="MAINNET",o[o.ROPSTEN=3]="ROPSTEN",o[o.RINKEBY=4]="RINKEBY",o[o["GÖRLI"]=5]="GÖRLI",o[o.KOVAN=42]="KOVAN",o[o.MATIC=137]="MATIC",o[o.MATIC_TESTNET=80001]="MATIC_TESTNET",o[o.FANTOM=250]="FANTOM",o[o.FANTOM_TESTNET=4002]="FANTOM_TESTNET",o[o.XDAI=100]="XDAI",o[o.BSC=56]="BSC",o[o.BSC_TESTNET=97]="BSC_TESTNET",o[o.ARBITRUM=42161]="ARBITRUM",o[o.ARBITRUM_TESTNET=79377087078960]="ARBITRUM_TESTNET",o[o.MOONBEAM_TESTNET=1287]="MOONBEAM_TESTNET",o[o.AVALANCHE=43114]="AVALANCHE",o[o.AVALANCHE_TESTNET=43113]="AVALANCHE_TESTNET",o[o.HECO=128]="HECO",o[o.HECO_TESTNET=256]="HECO_TESTNET",o[o.HARMONY=16666e5]="HARMONY",o[o.HARMONY_TESTNET=16667e5]="HARMONY_TESTNET",o[o.OKEX=66]="OKEX",o[o.OKEX_TESTNET=65]="OKEX_TESTNET",o[o.CELO=42220]="CELO",o[o.PALM=11297108109]="PALM",o[o.PALM_TESTNET=11297108099]="PALM_TESTNET",o[o.MOONRIVER=1285]="MOONRIVER",(u=exports.ENVIRONMENT||(exports.ENVIRONMENT={}))[u.TEST=0]="TEST",u[u.PRODUCTION=1]="PRODUCTION";var m,h=((p={})[exports.ENVIRONMENT.TEST]=["https://conveyor-geode-staging.ata.network"],p[exports.ENVIRONMENT.PRODUCTION]=[],p),T=function(e){return(t=h[e])[Math.floor(Math.random()*t.length)];var t},b=((c={})[exports.ChainId.MAINNET]="0x84194C00E190dE7A10180853f6a28502Ad1A1029",c),v=((d={})[exports.ChainId.MAINNET]="0x6B175474E89094C44Da98b954EedeAC495271d0F",d[exports.ChainId.MATIC]="0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063",d),x=((y={})[exports.ChainId.MAINNET]="0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",y[exports.ChainId.BSC]="0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",y[exports.ChainId.MATIC]="0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",y),g=((m={})[exports.ChainId.BSC]="https://api.coingecko.com/api/v3/simple/token_price/binance-smart-chain?",m[exports.ChainId.MATIC]="https://api.coingecko.com/api/v3/simple/token_price/polygon-pos?",m[exports.ChainId.MAINNET]="https://api.coingecko.com/api/v3/simple/token_price/ethereum?",m[exports.ChainId.ARBITRUM]="https://api.coingecko.com/api/v3/simple/token_price/arbitrum-one?",m[exports.ChainId.MOONRIVER]="https://api.coingecko.com/api/v3/simple/token_price/moonriver?",m),w=[exports.ChainId.RINKEBY,exports.ChainId.ROPSTEN,exports.ChainId.GÖRLI,exports.ChainId.KOVAN,exports.ChainId.ARBITRUM_TESTNET,exports.ChainId.AVALANCHE_TESTNET,exports.ChainId.HARMONY_TESTNET,exports.ChainId.OKEX_TESTNET,exports.ChainId.BSC_TESTNET,exports.ChainId.PALM_TESTNET,exports.ChainId.MOONBEAM_TESTNET,exports.ChainId.FANTOM_TESTNET,exports.ChainId.MATIC_TESTNET,exports.ChainId.HECO_TESTNET],E=function(e){return w.includes(e)};function N(e,t,n,r,a,i){return C.apply(this,arguments)}function C(){return(C=r(f.mark((function n(r,a,i,s,o,u){var p,c,d,y,l,m,h,T;return f.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(void 0===u&&(u=18),!E(r)){n.next=3;break}return n.abrupt("return",e.BigNumber.from(0));case 3:if(p=g[r]){n.next=6;break}throw new Error("Error: API support for the provided chainId "+r+" is not supported");case 6:return n.next=8,fetch(p+"contract_addresses="+a+"&vs_currencies="+o);case 8:if(c=n.sent.json().then((function(e){if(0===Object.keys(e).length)throw new Error("Error: Unsupported fee token.");return Object.values(e)[0]})),"eth"!==o){n.next=18;break}return n.next=13,c;case 13:d=n.sent.eth,n.next=27;break;case 18:if("bnb"!==o){n.next=26;break}return n.next=21,c;case 21:d=n.sent.bnb,n.next=27;break;case 26:throw new Error("Error: Unsupported native token. Use the calculateFeeOnMatic() method for calculating fees on the Matic network.");case 27:return y=new t.BigNumber(10).pow(u).div(new t.BigNumber(10).pow(i.toString())),l=new t.BigNumber(d).multipliedBy(y),m=new t.BigNumber(s.toString()).div(l),h=m.toFixed(0,2),T=parseInt(h)<1?"1":h,n.abrupt("return",e.BigNumber.from(T));case 33:case"end":return n.stop()}}),n)})))).apply(this,arguments)}function M(e,t,n,r){return A.apply(this,arguments)}function A(){return(A=r(f.mark((function n(r,a,i,s){var o,u,p,c,d,y,l,m,h,T;return f.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:n.t0=r,n.next=n.t0===exports.ChainId.MATIC?3:n.t0===exports.ChainId.MOONRIVER?6:9;break;case 3:return o=g[exports.ChainId.MATIC],u="matic-network",n.abrupt("break",10);case 6:return o=g[exports.ChainId.MOONRIVER],u="moonriver",n.abrupt("break",10);case 9:throw new Error("Error: API support for the provided chainId "+r+" is not supported");case 10:return n.next=12,fetch(o+"contract_addresses="+a+"&vs_currencies=bnb");case 12:return p=n.sent.json().then((function(e){if(0===Object.keys(e).length)throw new Error("Error: Unsupported fee token.");return Object.values(e)[0]})),n.next=16,p;case 16:return c=new t.BigNumber(n.sent.bnb).multipliedBy(new t.BigNumber(10).pow(18)).div(new t.BigNumber(10).pow(i.toString())),d="https://api.coingecko.com/api/v3/simple/price?ids="+u+"&vs_currencies=bnb",n.next=22,fetch(d);case 22:return y=n.sent,n.next=25,y.json();case 25:return l=new t.BigNumber(n.sent[u].bnb),m=new t.BigNumber(s.toString()).div(c.div(l)),h=m.toFixed(0,2),T=parseInt(h)<1?"1":h,n.abrupt("return",e.BigNumber.from(T));case 33:case"end":return n.stop()}}),n)})))).apply(this,arguments)}function O(e,t,n,r,a,i){return I.apply(this,arguments)}function I(){return(I=r(f.mark((function e(t,n,r,a,i,s){return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:void 0===s&&(s=18),e.t0=t,e.next=e.t0===exports.ChainId.MATIC?4:e.t0===exports.ChainId.MAINNET?5:e.t0===exports.ChainId.BSC?6:e.t0===exports.ChainId.ARBITRUM?7:e.t0===exports.ChainId.MOONRIVER?8:9;break;case 4:return e.abrupt("return",M(t,n,r,a));case 5:return e.abrupt("return",N(t,n,r,a,"eth",s));case 6:return e.abrupt("return",N(t,n,r,a,"bnb",s));case 7:return e.abrupt("return",N(t,n,r,a,"eth",s));case 8:return e.abrupt("return",M(t,n,r,a));case 9:return e.abrupt("return",N(t,n,r,a,i,s));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var S=[{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],k=[{name:"from",type:"address"},{name:"to",type:"address"},{name:"feeToken",type:"address"},{name:"useOraclePriceFeed",type:"bool"},{name:"maxTokenAmount",type:"uint256"},{name:"deadline",type:"uint256"},{name:"nonce",type:"uint256"},{name:"data",type:"bytes"},{name:"extendCategories",type:"uint256[]"}];function _(e,t,n){return{name:n,version:"1",chainId:"0x"+t.toString(16),verifyingContract:e}}var R=e.utils.Interface;function B(e,t){return L.apply(this,arguments)}function L(){return(L=r(f.mark((function e(t,n){var r,i,o,u,p,c,d,y,l;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=null;case 1:if(null!==r){e.next=7;break}return e.next=4,t.getTransactionReceipt(n.result.txnHash);case 4:r=e.sent,e.next=1;break;case 7:o=s(r.logs);case 9:if((u=o()).done){e.next=21;break}if("0xf624f223d0e1427abaf1ac2d9cf7c8487cad3018f0a93b5dafa867aed96165a3"!==(p=u.value).topics[0]){e.next=19;break}if(c=new R(["event MetaStatus(address sender, bool success, string error)"]),d=c.parseLog(p),l=(y=d.args).error,!1!==y.success){e.next=19;break}return i=a({},n,{result:{txnHash:n.result.txnHash,success:!1,errorMessage:l}}),e.abrupt("return",i);case 19:e.next=9;break;case 21:return e.abrupt("return",n);case 22:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function P(e,t,n){return F.apply(this,arguments)}function F(){return(F=r(f.mark((function t(n,r,a){var i,o,u,p,c,d,y,l,m,h,T,b;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:i=null;case 1:if(null!==i){t.next=7;break}return t.next=4,n.getTransactionReceipt(r);case 4:i=t.sent,t.next=1;break;case 7:for(o=i.logs,u=e.BigNumber.from(0),p=e.BigNumber.from(0),c=s(o);!(d=c()).done;)"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"===(y=d.value).topics[0]&&(l="0x"+y.topics[1].slice(26),m="0x"+y.topics[2].slice(26),l!==m&&(h=new R(["event Transfer(address indexed from, address indexed to, uint256 value)"]),T=h.parseLog(y),b=T.args.value,m===a?u=u.add(b):l===a&&(p=p.add(b))));return t.abrupt("return",u.sub(p));case 12:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var H=[{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:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"holder",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:[{internalType:"address",name:"holder",type:"address"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"expiry",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:"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"}],D=[{inputs:[{internalType:"address",name:"_forwarder",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{inputs:[],name:"conveyorIsEnabled",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"disableConveyorProtection",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"enableConveyorProtection",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"forwarder",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_forwarder",type:"address"}],name:"isTrustedForwarder",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_forwarder",type:"address"}],name:"setForwarder",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"}],j=[{anonymous:!1,inputs:[{indexed:!1,internalType:"bool[]",name:"successArr",type:"bool[]"}],name:"BatchedMetaStatus",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"sender",type:"address"},{indexed:!1,internalType:"bool",name:"success",type:"bool"},{indexed:!1,internalType:"string",name:"error",type:"string"}],name:"MetaStatus",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{inputs:[],name:"DOMAIN_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"FORWARDER_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"aggregator",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"constantFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{components:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"address",name:"feeToken",type:"address"},{internalType:"bool",name:"useOraclePriceFeed",type:"bool"},{internalType:"uint256",name:"maxTokenAmount",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"},{internalType:"uint256[]",name:"extendCategories",type:"uint256[]"}],internalType:"struct ConveyorTypes.MetaTransaction",name:"metatx",type:"tuple"},{internalType:"string",name:"domainName",type:"string"},{internalType:"bool",name:"relayerChargeEnabled",type:"bool"},{internalType:"uint256",name:"tokenPricePerNativeToken",type:"uint256"},{internalType:"enum SignatureValidator.SignatureSignerType",name:"signerType",type:"uint8"},{internalType:"bytes",name:"sig",type:"bytes"},{internalType:"bytes",name:"extendParamData",type:"bytes"}],internalType:"struct ConveyorForwarder.ConveyorTransaction[]",name:"conveyorTransactions",type:"tuple[]"}],name:"executeBatchedMetaTx",outputs:[{internalType:"bool[]",name:"",type:"bool[]"},{internalType:"bytes[]",name:"",type:"bytes[]"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"address",name:"feeToken",type:"address"},{internalType:"bool",name:"useOraclePriceFeed",type:"bool"},{internalType:"uint256",name:"maxTokenAmount",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"},{internalType:"uint256[]",name:"extendCategories",type:"uint256[]"}],internalType:"struct ConveyorTypes.MetaTransaction",name:"metatx",type:"tuple"},{internalType:"string",name:"domainName",type:"string"},{internalType:"bool",name:"relayerChargeEnabled",type:"bool"},{internalType:"uint256",name:"tokenPricePerNativeToken",type:"uint256"},{internalType:"enum SignatureValidator.SignatureSignerType",name:"signerType",type:"uint8"},{internalType:"bytes",name:"sig",type:"bytes"},{internalType:"bytes",name:"extendParamData",type:"bytes"}],name:"executeMetaTxV2",outputs:[{internalType:"bool",name:"success",type:"bool"},{internalType:"bytes",name:"data",type:"bytes"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"relayers",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_aggregator",type:"address"}],name:"setAggregator",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_newConstantFee",type:"uint256"}],name:"setConstantFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_relayer",type:"address"},{internalType:"bool",name:"_trusted",type:"bool"}],name:"setRelayer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_newTransferFee",type:"uint256"}],name:"setTransferFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"transferFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"address",name:"feeReceiver",type:"address"}],name:"withdrawFeeTokens",outputs:[],stateMutability:"nonpayable",type:"function"}],V=e.utils.splitSignature,U=e.utils.verifyTypedData,Y=e.constants.AddressZero;function G(e,t){return K.apply(this,arguments)}function K(){return(K=r(f.mark((function e(t,n){return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getCode(n);case 2:return e.abrupt("return",e.sent.length>2);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function X(e,t,n,r,a,i){return q.apply(this,arguments)}function q(){return(q=r(f.mark((function e(t,n,r,a,i,s){var o,u,p,c;return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_(r,n,a);case 2:return u={types:{EIP712Domain:S,Forwarder:k},domain:o=e.sent,primaryType:"Forwarder",message:i},p=JSON.stringify(u),e.next=7,t.send("eth_signTypedData_v4",[s,p]);case 7:return c=e.sent,i.from===s&&W(o,i,c,s),e.abrupt("return",{sig:c,msg:u});case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function J(e,t){return{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",method:e,id:1,params:t})}}function W(e,t,n,r){var a=U(e,{Forwarder:k},t,n);if(a!==r||a===Y)throw new Error("Signature verification failed")}exports.Conveyor=function(){function t(e,t){this.provider=e,this.forwarderAddress=(null==t?void 0:t.forwarder)||b[e.network.chainId],this.relayerConfig=(null==t?void 0:t.relayerConfig)||T(exports.ENVIRONMENT.PRODUCTION||(null==t?void 0:t.env))}var n=t.prototype;return n.fetchConveyorStatus=function(){var t=r(f.mark((function t(n){var r;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=new e.Contract(n,D,this.provider),t.next=3,r.conveyorIsEnabled();case 3:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),n.toggleConveyorProtection=function(){var t=r(f.mark((function t(n,r){var a,i,s,o;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=new e.Contract(n,D,this.provider),t.next=3,this.provider.getSigner();case 3:if(i=t.sent,!r){t.next=10;break}return t.next=7,a.connect(i).enableConveyorProtection();case 7:s=t.sent,t.next=13;break;case 10:return t.next=12,a.connect(i).disableConveyorProtection();case 12:s=t.sent;case 13:return t.next=15,s.wait();case 15:return t.abrupt("return",{id:1,jsonrpc:"2.0",result:{success:1===(o=t.sent).status,errorMessage:1===o.status?"":"Transaction Reverted",txnHash:o.transactionHash}});case 17:case"end":return t.stop()}}),t,this)})));return function(e,n){return t.apply(this,arguments)}}(),n.erc20ApproveForwarder=function(){var t=r(f.mark((function t(n,r){var a,i,s,o;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=new e.Contract(r,H,this.provider),t.next=3,this.provider.getSigner();case 3:return i=t.sent,t.next=6,a.connect(i).approve(this.forwarderAddress,n);case 6:return s=t.sent,t.next=9,s.wait();case 9:return t.abrupt("return",{id:1,jsonrpc:"2.0",result:{success:1===(o=t.sent).status,errorMessage:1===o.status?"":"Transaction Reverted",txnHash:o.transactionHash}});case 11:case"end":return t.stop()}}),t,this)})));return function(e,n){return t.apply(this,arguments)}}(),n.getFeeFromTxn=function(){var e=r(f.mark((function e(t){return f.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,P(this.provider,t,this.forwarderAddress);case 2:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n.submitConveyorTransaction=function(){var t=r(f.mark((function t(n,r,a,i,s,o,u,p,c,d,y){var l,m,h,T,b,v,x,g,w,E,N,C,M,A,I,S,k,_,R,L,P,F,D;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===y&&(y=[]),t.next=3,this.fetchConveyorStatus(p);case 3:if(t.sent){t.next=6;break}return t.abrupt("return",this.submitTransaction(p,c,d,y));case 6:return l=new e.Contract(p,c,this.provider),m=new e.Contract(this.forwarderAddress,j,this.provider),h=l.interface.encodeFunctionData(d,y),t.next=11,this.provider.network.chainId;case 11:return T=t.sent,t.next=14,this.provider.getSigner();case 14:return b=t.sent,t.next=17,b.getAddress();case 17:if(v=t.sent,x=e.BigNumber.from(r).mul(e.BigNumber.from(a)),!(g=n!==Y?new e.Contract(n,H,this.provider):void 0)){t.next=26;break}return t.next=23,g.decimals();case 23:t.t0=t.sent,t.next=27;break;case 26:t.t0=void 0;case 27:if(w=t.t0,n===Y||null==w){t.next=34;break}return t.next=31,O(T,n,w,x);case 31:t.t1=t.sent,t.next=35;break;case 34:t.t1=e.BigNumber.from(0);case 35:return E=t.t1,t.next=38,m.nonces(v);case 38:return N=t.sent,C=Math.floor(Date.now()/1e3),M=e.BigNumber.from(C).add(e.BigNumber.from(i)),A=u.map((function(t){return e.BigNumber.from(t).toHexString()})),I={from:v,to:p,feeToken:n,useOraclePriceFeed:o,maxTokenAmount:E.toHexString(),deadline:M.toHexString(),nonce:N.toHexString(),data:h,extendCategories:A},t.next=45,X(this.provider,T,this.forwarderAddress,s,I,v);case 45:return k=(S=t.sent).msg,_=V(S.sig),R=[k,_.v.toString(),_.r,_.s],L=J("/v3/metaTx/execute",R),console.log("sending request..."),console.log(L),t.next=55,fetch(this.relayerConfig,L);case 55:return P=t.sent,t.next=58,P.json();case 58:if(D=F=t.sent,!F.result.success){t.next=65;break}return t.next=64,B(this.provider,F);case 64:D=t.sent;case 65:return console.log("response received..."),console.log(D),t.abrupt("return",D);case 68:case"end":return t.stop()}}),t,this)})));return function(e,n,r,a,i,s,o,u,p,c,d){return t.apply(this,arguments)}}(),n.submitMetaTransaction=function(){var t=r(f.mark((function t(n,r,a,i,s,o,u,p,c,d,y,l){var m,h,T,b,v,x,g,w,E,N,C,M,A,I,S,k,_,R,L,P,F,D;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===l&&(l=[]),t.next=3,this.fetchConveyorStatus(c);case 3:if(t.sent){t.next=6;break}return t.abrupt("return",this.submitTransaction(c,d,y,l));case 6:return m=new e.Contract(c,d,this.provider),h=new e.Contract(this.forwarderAddress,j,this.provider),T=m.interface.encodeFunctionData(y,l),t.next=11,this.provider.network.chainId;case 11:return b=t.sent,t.next=14,this.provider.getSigner();case 14:return v=t.sent,t.next=17,v.getAddress();case 17:if(x=t.sent,g=e.BigNumber.from(r).mul(e.BigNumber.from(a)),!(w=n!==Y?new e.Contract(n,H,this.provider):void 0)){t.next=26;break}return t.next=23,w.decimals();case 23:t.t0=t.sent,t.next=27;break;case 26:t.t0=void 0;case 27:if(E=t.t0,n===Y||null==E){t.next=34;break}return t.next=31,O(b,n,E,g);case 31:t.t1=t.sent,t.next=35;break;case 34:t.t1=e.BigNumber.from(0);case 35:return N=t.t1,t.next=38,h.nonces(x);case 38:return C=t.sent,M=Math.floor(Date.now()/1e3),A=e.BigNumber.from(M).add(e.BigNumber.from(i)),I=u.map((function(t){return e.BigNumber.from(t).toHexString()})),S={from:p,to:c,feeToken:n,useOraclePriceFeed:o,maxTokenAmount:N.toHexString(),deadline:A.toHexString(),nonce:C.toHexString(),data:T,extendCategories:I},t.next=45,X(this.provider,b,this.forwarderAddress,s,S,x);case 45:return _=(k=t.sent).sig,R=k.msg,t.next=50,G(this.provider,p);case 50:return L=J("/v3/metaTx/executeV2",{signerType:t.sent?"CONTRACT":"EOA",msg:R,sig:_}),console.log("sending request..."),console.log(L),t.next=58,fetch(this.relayerConfig,L);case 58:return P=t.sent,t.next=61,P.json();case 61:if(D=F=t.sent,!F.result.success){t.next=68;break}return t.next=67,B(this.provider,F);case 67:D=t.sent;case 68:return console.log("response received..."),console.log(D),t.abrupt("return",D);case 71:case"end":return t.stop()}}),t,this)})));return function(e,n,r,a,i,s,o,u,p,c,d,y){return t.apply(this,arguments)}}(),n.submitTransaction=function(){var t=r(f.mark((function t(n,r,a,i){var s,o,u,p,c;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===i&&(i=[]),s=new e.Contract(n,r,this.provider),o=s.interface.encodeFunctionData(a,i),t.next=5,this.provider.getSigner();case 5:return u=t.sent,t.next=8,u.sendTransaction({to:n,data:o});case 8:return p=t.sent,t.next=11,p.wait();case 11:return t.abrupt("return",{id:1,jsonrpc:"2.0",result:{success:1===(c=t.sent).status,errorMessage:1===c.status?"":"Transaction Reverted",txnHash:c.transactionHash}});case 13:case"end":return t.stop()}}),t,this)})));return function(e,n,r,a){return t.apply(this,arguments)}}(),t}(),exports.DAI_ADDRESS=v,exports.FORWARDER_ADDRESS=b,exports.RELAYER_ENDPOINT_URL=T,exports.USDC_ADDRESS=x,exports.getFeePrice=O,exports.verifyFee=P,exports.verifyMetaTxnResponse=B;
//# sourceMappingURL=conveyor-sdk.cjs.production.min.js.map
{
"version": "0.2.3",
"version": "0.2.4",
"license": "MIT",

@@ -4,0 +4,0 @@ "main": "dist/index.js",

@@ -28,4 +28,4 @@ # Introduction

- `ConveyorBase`: https://github.com/automata-network/generic-conveyor/blob/unit-testing/contracts/ConveyorBase.sol
- Example Contract: https://github.com/automata-network/generic-conveyor/blob/unit-testing/contracts/test/Greeter.sol
- `ConveyorBase`: https://github.com/automata-network/generic-conveyor/blob/main/contracts/ConveyorBase.sol
- Example Contract: https://github.com/automata-network/generic-conveyor/blob/main/contracts/test/Greeter.sol

@@ -42,6 +42,2 @@ ## SDK

### Source Code
https://github.com/automata-network/conveyor-sdk
---

@@ -126,5 +122,5 @@

| Category | Description |
| -------- | -------------------------------------------------------------------------- |
| 0 | No extension |
| 1 | [VRF Generated Random Number](https://docs.chain.link/docs/chainlink-vrf/) |
| Category | Description |
| -------- | --------------------------- |
| 0 | No extension |
| 1 | VRF Generated Random Number |

@@ -1,2 +0,1 @@

import { BigNumber } from '@ethersproject/bignumber';
import { Domain } from './types';

@@ -31,5 +30,5 @@

version: '1',
chainId: BigNumber.from(chain_id).toHexString(),
chainId: '0x' + chain_id.toString(16),
verifyingContract: contractAddress,
};
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc