@charged-particles/charged-js-sdk
Advanced tools
Comparing version 0.1.10 to 0.1.11
@@ -1,2 +0,2 @@ | ||
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var e=require("ethers");require("dotenv/config");var r=t(require("@charged-particles/protocol-subgraph/abis/ChargedParticles.json")),n=t(require("@charged-particles/protocol-subgraph/abis/ChargedSettings.json")),a=t(require("@charged-particles/protocol-subgraph/abis/ChargedManagers.json")),s=t(require("@charged-particles/protocol-subgraph/abis/ChargedState.json")),i=t(require("@charged-particles/protocol-subgraph/abis/ProtonB.json")),o=t(require("@charged-particles/protocol-subgraph/abis/ERC1155.json")),c=t(require("@charged-particles/protocol-subgraph/abis/ERC20.json")),u=t(require("@charged-particles/protocol-subgraph/networks/mainnet.json")),h=t(require("@charged-particles/protocol-subgraph/networks/kovan.json")),p=t(require("@charged-particles/protocol-subgraph/networks/polygon.json")),d=t(require("@charged-particles/protocol-subgraph/networks/mumbai.json")),f=t(require("@charged-particles/protocol-subgraph/networks/goerli.json")),l=t(require("@charged-particles/protocol-subgraph/abis/Proton.json")),g=t(require("@charged-particles/protocol-subgraph/abis/AaveWalletManager.json")),v=t(require("@charged-particles/protocol-subgraph/abis/AaveWalletManagerB.json")),w=t(require("@charged-particles/protocol-subgraph/abis/GenericWalletManager.json")),k=t(require("@charged-particles/protocol-subgraph/abis/GenericWalletManagerB.json")),x=t(require("@charged-particles/protocol-subgraph/abis/GenericBasketManager.json")),b=t(require("@charged-particles/protocol-subgraph/abis/GenericBasketManagerB.json")),y=require("@charged-particles/contract-allowlist/src/allowlist");function m(){m=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",o=a.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function u(t,e,r,a){var s=Object.create((e&&e.prototype instanceof d?e:d).prototype),i=new P(a||[]);return n(s,"_invoke",{value:y(t,r,i)}),s}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var p={};function d(){}function f(){}function l(){}var g={};c(g,s,(function(){return this}));var v=Object.getPrototypeOf,w=v&&v(v(S([])));w&&w!==e&&r.call(w,s)&&(g=w);var k=l.prototype=d.prototype=Object.create(g);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){var a;n(this,"_invoke",{value:function(n,s){function i(){return new e((function(a,i){!function n(a,s,i,o){var c=h(t[a],t,s);if("throw"!==c.type){var u=c.arg,p=u.value;return p&&"object"==typeof p&&r.call(p,"__await")?e.resolve(p.__await).then((function(t){n("next",t,i,o)}),(function(t){n("throw",t,i,o)})):e.resolve(p).then((function(t){u.value=t,i(u)}),(function(t){return n("throw",t,i,o)}))}o(c.arg)}(n,s,a,i)}))}return a=a?a.then(i,i):i()}})}function y(t,e,r){var n="suspendedStart";return function(a,s){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===a)throw s;return{value:void 0,done:!0}}for(r.method=a,r.arg=s;;){var i=r.delegate;if(i){var o=A(i,r);if(o){if(o===p)continue;return o}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=h(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===p)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function A(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,A(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),p;var a=h(n,t.iterator,e.arg);if("throw"===a.type)return e.method="throw",e.arg=a.arg,e.delegate=null,p;var s=a.arg;return s?s.done?(e[t.resultName]=s.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,p):s:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,p)}function C(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function N(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(C,this),this.reset(!0)}function S(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,a=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return a.next=a}}return{next:I}}function I(){return{value:void 0,done:!0}}return f.prototype=l,n(k,"constructor",{value:l,configurable:!0}),n(l,"constructor",{value:f,configurable:!0}),f.displayName=c(l,o,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,c(t,o,"GeneratorFunction")),t.prototype=Object.create(k),t},t.awrap=function(t){return{__await:t}},x(b.prototype),c(b.prototype,i,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,a,s){void 0===s&&(s=Promise);var i=new b(u(e,r,n,a),s);return t.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},x(k),c(k,o,"Generator"),c(k,s,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=S,P.prototype={constructor:P,reset:function(t){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(N),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return i.type="throw",i.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var a=this.tryEntries.length-1;a>=0;--a){var s=this.tryEntries[a],i=s.completion;if("root"===s.tryLoc)return n("end");if(s.tryLoc<=this.prev){var o=r.call(s,"catchLoc"),c=r.call(s,"finallyLoc");if(o&&c){if(this.prev<s.catchLoc)return n(s.catchLoc,!0);if(this.prev<s.finallyLoc)return n(s.finallyLoc)}else if(o){if(this.prev<s.catchLoc)return n(s.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return n(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var s=a;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=e&&e<=s.finallyLoc&&(s=null);var i=s?s.completion:{};return i.type=t,i.arg=e,s?(this.method="next",this.next=s.finallyLoc,p):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),p},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),N(r),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var a=n.arg;N(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},t}function A(t,e,r,n,a,s,i){try{var o=t[s](i),c=o.value}catch(t){return void r(t)}o.done?e(c):Promise.resolve(c).then(n,a)}function C(t){return function(){var e=this,r=arguments;return new Promise((function(n,a){var s=t.apply(e,r);function i(t){A(s,n,a,i,o,"next",t)}function o(t){A(s,n,a,i,o,"throw",t)}i(void 0)}))}}function N(){return(N=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function P(t,e){var r,n;t.prototype=Object.create(e.prototype),t.prototype.constructor=t,r=t,n=e,(Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(r,n)}var S=function(t){if(!t)return"mainnet";switch(t){case 1:return"mainnet";case 5:return"goerli";case 42:return"kovan";case 137:return"polygon";case 80001:return"mumbai";default:throw"network id: "+t+" is not valid in getAddressFromNetwork"}},I=[{chainId:1,chainName:"eth",name:"Ethereum"},{chainId:5,chainName:"goerli",name:"Goerli"},{chainId:42,chainName:"kovan",name:"Ethereum (Kovan)"},{chainId:137,chainName:"polygon",name:"Polygon"},{chainId:80001,chainName:"mumbai",name:"Polygon (Mumbai)"}],j=u,E=h,B=p,F=d,T=f,O=function(t){switch(t){case"chargedParticles":return r;case"chargedState":return s;case"chargedSettings":return n;case"chargedManagers":return a;case"fungibleERC1155":return o;case"erc721":return i;case"ionx":return c;default:throw t+" is not valid in getAbi"}},L=function(t,e){var r=q(t)[e];if(_(r))return r.address;throw e+" on chain ID "+t+" is not valid in getAddress"},_=function(t){return void 0!==t.address},q=function(t){switch(t){case 1:return j;case 5:return T;case 42:return E;case 137:return B;case 80001:return F;default:throw"network id: "+t+" is not a valid network in getImportedContractLocations"}},M=function(){function t(t){this.state=t,this.contractInstances={read:{},write:{}}}var r=t.prototype;return r.getContractInstance=function(t,r,n,a){var s,i=this.state,o=i.providers,c=i.signer,u=null!=(s=o[r])?s:o.external,h=null!=a?a:L(r,t),p=h.concat(String(r));if(!this.contractInstances[n][p])if("read"===n){var d=new e.ethers.Contract(h,O(t),u);this.contractInstances[n][p]=d}else if("write"===n){if(!c&&!o.external)throw new Error("Trying to write with no signer");var f=c?null!=c&&c.provider?c:c.connect(u):o.external.getSigner(),l=new e.ethers.Contract(h,O(t),f);this.contractInstances[n][p]=l}return this.contractInstances[n][p]},r.fetchAllNetworks=function(){var t=C(m().mark((function t(e,r,n,a){var s,i,o,c,u;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:void 0===n&&(n=[]),s=this.state.providers,i=[],o=[],t.t0=m().keys(s);case 5:if((t.t1=t.t0()).done){t.next=24;break}if(c=t.t1.value,!a){t.next=14;break}return t.next=10,s[c].getCode(a);case 10:if("0x"!==t.sent){t.next=13;break}return t.abrupt("continue",5);case 13:case 14:if("external"!==c){t.next=20;break}return t.next=17,s.external.getNetwork();case 17:c=t.sent.chainId;case 20:o.push(Number(c)),i.push(this.readContract(e,r,Number(c),n,a)),t.next=5;break;case 24:return t.next=26,Promise.allSettled(i);case 26:return u={},t.sent.forEach((function(t,e){u[o[e]]="fulfilled"===t.status?{value:t.value,status:"fulfilled"}:{value:t.reason,status:"rejected"}})),t.abrupt("return",u);case 30:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a){return t.apply(this,arguments)}}(),r.writeContract=function(){var t=C(m().mark((function t(e,r,n,a,s){var i,o;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===a&&(a=[]),i=this.state.configuration.transactionOverride,o=this.getContractInstance(e,n,"write",s),t.abrupt("return",o[r].apply(o,a.concat([i])));case 5:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a,s){return t.apply(this,arguments)}}(),r.readContract=function(){var t=C(m().mark((function t(e,r,n,a,s){var i,o,c;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===a&&(a=[]),o=this.state.configuration.transactionOverride,c=this.getContractInstance(e,n,"read",s),t.abrupt("return",(i=c.callStatic)[r].apply(i,a.concat([o])));case 5:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a,s){return t.apply(this,arguments)}}(),r.getSignerAddress=function(){var t=C(m().mark((function t(){var e;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(e=this.state.signer)){t.next=3;break}return t.abrupt("return",null==e?void 0:e.getAddress());case 3:throw new Error("No signer provided");case 5:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getSignerConnectedNetwork=function(){var t=C(m().mark((function t(e){var r,n,a;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=this.state.providers,n=Object.keys(r),!(a=n.length)){t.next=23;break}if(!n.includes("external")){t.next=11;break}return t.next=7,r.external.getNetwork();case 7:return t.abrupt("return",t.sent.chainId);case 11:if(!(a>1&&e)){t.next=15;break}return t.abrupt("return",e);case 15:if(1!=a){t.next=20;break}return t.abrupt("return",Number(n[0]));case 20:throw new Error("Please specify the targeted network");case 21:t.next=24;break;case 23:throw new Error("Could not fetch network from supplied providers");case 24:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),t}(),R=function(t){function e(e){return t.call(this,e)||this}P(e,t);var r=e.prototype;return r.getContractAddress=function(){var t=C(m().mark((function t(e,r){var n,a,s,i,o;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0===r&&(r=[]),n=this.state.providers,0!==(a=r).length){t.next=16;break}t.t0=m().keys(n);case 5:if((t.t1=t.t0()).done){t.next=16;break}if("external"!==(s=t.t1.value)){t.next=13;break}return t.next=10,n.external.getNetwork();case 10:s=t.sent.chainId;case 13:a.push(Number(s)),t.next=5;break;case 16:for(i={},o=0;o<a.length;o++)i[a[o]]=L(Number(a[o]),e);return t.abrupt("return",i);case 19:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.getStateAddress=function(){var t=C(m().mark((function t(){return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.fetchAllNetworks("chargedParticles","getStateAddress");case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getSettingsAddress=function(){var t=C(m().mark((function t(){return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.fetchAllNetworks("chargedParticles","getSettingsAddress");case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getManagersAddress=function(){var t=C(m().mark((function t(){return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.fetchAllNetworks("chargedParticles","getManagersAddress");case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getFeesForDeposit=function(){var t=C(m().mark((function t(){return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.fetchAllNetworks("chargedParticles","getFeesForDeposit");case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),e}(M),G=function(t){if(!["aave","aave.B","generic","generic.B"].includes(t))throw new Error("Provided a not supported wallet manager id.")},W=function(t){if(!["generic","generic.B"].includes(t))throw new Error("Provided a not supported basket manager id.")},D=function(t){function e(e,r,n){var a;return(a=t.call(this,e)||this).contractAddress=r,a.tokenId=n,a}P(e,t);var r=e.prototype;return r.getChainIdsForBridgedNFTs=function(){var t=C(m().mark((function t(){var e,r,n,a;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=this.state.providers,r=[],t.prev=2,t.t0=m().keys(e);case 4:if((t.t1=t.t0()).done){t.next=25;break}if(void 0!==(a=e[n=t.t1.value])){t.next=9;break}return t.abrupt("continue",4);case 9:return t.next=12,a.getCode(this.contractAddress);case 12:if("0x"===t.sent){t.next=23;break}if("external"!=n){t.next=22;break}return t.next=17,a.getNetwork();case 17:r.push(t.sent.chainId),t.next=23;break;case 22:r.push(Number(n));case 23:t.next=4;break;case 25:t.next=30;break;case 27:throw t.prev=27,t.t2=t.catch(2),t.t2;case 30:return t.abrupt("return",r);case 31:case"end":return t.stop()}}),t,this,[[2,27]])})));return function(){return t.apply(this,arguments)}}(),r.bridgeNFTCheck=function(){var t=C(m().mark((function t(e){var r,n;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null!=(r=this.state.configuration.sdk)&&r.NftBridgeCheck){t.next=3;break}return t.abrupt("return");case 3:return t.next=6,this.getChainIdsForBridgedNFTs();case 6:if(n=t.sent,void 0!==e){t.next=9;break}throw new Error("Could not retrieve signers network.");case 9:if(!n.includes(e)){t.next=12;break}return t.abrupt("return",!0);case 12:throw new Error("Signer network: "+e+", does not match provider chain.");case 14:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getMass=function(){var t=C(m().mark((function t(e,r){var n;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===r&&(r="generic.B"),G(r),n=[this.contractAddress,this.tokenId,r,e],t.next=5,this.fetchAllNetworks("chargedParticles","baseParticleMass",n);case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.getCharge=function(){var t=C(m().mark((function t(e,r){var n;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===r&&(r="generic.B"),G(r),n=[this.contractAddress,this.tokenId,r,e],t.next=5,this.fetchAllNetworks("chargedParticles","currentParticleCharge",n);case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.getKinectics=function(){var t=C(m().mark((function t(e,r){var n;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===r&&(r="generic.B"),G(r),n=[this.contractAddress,this.tokenId,r,e],t.next=5,this.fetchAllNetworks("chargedParticles","currentParticleKinetics",n);case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.getBonds=function(){var t=C(m().mark((function t(e){var r;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===e&&(e="generic.B"),W(e),r=[this.contractAddress,this.tokenId,e],t.next=5,this.fetchAllNetworks("chargedParticles","currentParticleCovalentBonds",r);case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getCreatorAnnuities=function(){var t=C(m().mark((function t(){var e;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=[this.contractAddress,this.tokenId],t.next=3,this.fetchAllNetworks("chargedSettings","getCreatorAnnuities",e);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getCreatorAnnuitiesRedirect=function(){var t=C(m().mark((function t(){var e;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=[this.contractAddress,this.tokenId],t.next=3,this.fetchAllNetworks("chargedSettings","getCreatorAnnuitiesRedirect",e);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.tokenURI=function(){var t=C(m().mark((function t(){return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.fetchAllNetworks("erc721","tokenURI",[this.tokenId],this.contractAddress);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getDischargeState=function(){var t=C(m().mark((function t(e){var r;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=[this.contractAddress,this.tokenId,e],t.next=3,this.fetchAllNetworks("chargedState","getDischargeState",r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getReleaseState=function(){var t=C(m().mark((function t(e){var r;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=[this.contractAddress,this.tokenId,e],t.next=3,this.fetchAllNetworks("chargedState","getReleaseState",r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getBondsState=function(){var t=C(m().mark((function t(e){var r;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=[this.contractAddress,this.tokenId,e],t.next=3,this.fetchAllNetworks("chargedState","getBreakBondState",r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.energize=function(){var t=C(m().mark((function t(e,r,n,a,s){var i,o;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===n&&(n="generic.B"),G(n),t.next=4,this.getSignerConnectedNetwork(a);case 4:return i=t.sent,t.next=7,this.bridgeNFTCheck(i);case 7:return o=[this.contractAddress,this.tokenId,n,e,r,null!=s?s:"0x0000000000000000000000000000000000000000"],t.next=10,this.writeContract("chargedParticles","energizeParticle",i,o);case 10:return t.abrupt("return",t.sent);case 11:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a,s){return t.apply(this,arguments)}}(),r.discharge=function(){var t=C(m().mark((function t(e,r,n,a){var s,i;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===n&&(n="generic.B"),G(n),t.next=4,this.getSignerConnectedNetwork(a);case 4:return s=t.sent,t.next=7,this.bridgeNFTCheck(s);case 7:return i=[e,this.contractAddress,this.tokenId,n,r],t.next=10,this.writeContract("chargedParticles","dischargeParticle",s,i);case 10:return t.abrupt("return",t.sent);case 11:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a){return t.apply(this,arguments)}}(),r.dischargeAmount=function(){var t=C(m().mark((function t(e,r,n,a,s){var i,o;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===a&&(a="generic.B"),G(a),t.next=4,this.getSignerConnectedNetwork(s);case 4:return i=t.sent,t.next=7,this.bridgeNFTCheck(i);case 7:return o=[e,this.contractAddress,this.tokenId,a,r,n],t.next=10,this.writeContract("chargedParticles","dischargeParticleAmount",i,o);case 10:return t.abrupt("return",t.sent);case 11:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a,s){return t.apply(this,arguments)}}(),r.dischargeForCreator=function(){var t=C(m().mark((function t(e,r,n,a,s){var i,o;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===a&&(a="generic.B"),G(a),t.next=4,this.getSignerConnectedNetwork(s);case 4:return i=t.sent,t.next=7,this.bridgeNFTCheck(i);case 7:return o=[e,this.contractAddress,this.tokenId,a,r,n],t.next=10,this.writeContract("chargedParticles","dischargeParticleForCreator",i,o);case 10:return t.abrupt("return",t.sent);case 11:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a,s){return t.apply(this,arguments)}}(),r.release=function(){var t=C(m().mark((function t(e,r,n,a){var s,i;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===n&&(n="generic.B"),G(n),t.next=4,this.getSignerConnectedNetwork(a);case 4:return s=t.sent,t.next=7,this.bridgeNFTCheck(s);case 7:return i=[e,this.contractAddress,this.tokenId,n,r],t.next=10,this.writeContract("chargedParticles","releaseParticle",s,i);case 10:return t.abrupt("return",t.sent);case 11:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a){return t.apply(this,arguments)}}(),r.releaseAmount=function(){var t=C(m().mark((function t(e,r,n,a,s){var i,o;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===a&&(a="generic.B"),G(a),t.next=4,this.getSignerConnectedNetwork(s);case 4:return i=t.sent,t.next=7,this.bridgeNFTCheck(i);case 7:return o=[e,this.contractAddress,this.tokenId,a,r,n],t.next=10,this.writeContract("chargedParticles","releaseParticleAmount",i,o);case 10:return t.abrupt("return",t.sent);case 11:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a,s){return t.apply(this,arguments)}}(),r.bond=function(){var t=C(m().mark((function t(e,r,n,a,s){var i,o;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===a&&(a="generic.B"),W(a),t.next=4,this.getSignerConnectedNetwork(s);case 4:return i=t.sent,t.next=7,this.bridgeNFTCheck(i);case 7:return o=[this.contractAddress,this.tokenId,a,e,r,n],t.next=10,this.writeContract("chargedParticles","covalentBond",i,o);case 10:return t.abrupt("return",t.sent);case 11:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a,s){return t.apply(this,arguments)}}(),r.breakBond=function(){var t=C(m().mark((function t(e,r,n,a,s,i){var o,c;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===s&&(s="generic.B"),W(s),t.next=4,this.getSignerConnectedNetwork(i);case 4:return o=t.sent,t.next=7,this.bridgeNFTCheck(o);case 7:return c=[e,this.contractAddress,this.tokenId,s,r,n,a],t.next=10,this.writeContract("chargedParticles","breakCovalentBond",o,c);case 10:return t.abrupt("return",t.sent);case 11:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a,s,i){return t.apply(this,arguments)}}(),r.releaseTimelock=function(){var t=C(m().mark((function t(e,r){var n,a;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getSignerConnectedNetwork(r);case 2:return n=t.sent,t.next=5,this.bridgeNFTCheck(n);case 5:return a=[this.contractAddress,this.tokenId,e],t.next=8,this.writeContract("chargedState","setReleaseTimelock",n,a);case 8:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.dischargeTimelock=function(){var t=C(m().mark((function t(e,r){var n,a;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getSignerConnectedNetwork(r);case 2:return n=t.sent,t.next=5,this.bridgeNFTCheck(n);case 5:return a=[this.contractAddress,this.tokenId,e],t.next=8,this.writeContract("chargedState","setDischargeTimelock",n,a);case 8:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.bondsTimelock=function(){var t=C(m().mark((function t(e,r){var n,a;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getSignerConnectedNetwork(r);case 2:return n=t.sent,t.next=5,this.bridgeNFTCheck(n);case 5:return a=[this.contractAddress,this.tokenId,e],t.next=8,this.writeContract("chargedState","setBreakBondTimelock",n,a);case 8:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.setCreatorAnnuities=function(){var t=C(m().mark((function t(e,r,n){var a,s;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getSignerConnectedNetwork(n);case 2:return a=t.sent,t.next=5,this.bridgeNFTCheck(a);case 5:return s=[this.contractAddress,this.tokenId,e,r],t.next=8,this.writeContract("chargedSettings","setCreatorAnnuities",a,s);case 8:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),r.setCreatorAnnuitiesRedirect=function(){var t=C(m().mark((function t(e,r){var n,a;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getSignerConnectedNetwork(r);case 2:return n=t.sent,t.next=5,this.bridgeNFTCheck(n);case 5:return a=[this.contractAddress,this.tokenId,e],t.next=8,this.writeContract("chargedSettings","setCreatorAnnuitiesRedirect",n,a);case 8:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.transferFrom=function(){var t=C(m().mark((function t(e,r,n){var a,s;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getSignerConnectedNetwork(n);case 2:return a=t.sent,t.next=5,this.bridgeNFTCheck(a);case 5:return s=[e,r,this.tokenId],t.next=8,this.writeContract("erc721","transferFrom",a,s,this.contractAddress);case 8:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),r.approve=function(){var t=C(m().mark((function t(e,r){var n,a;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getSignerConnectedNetwork(r);case 2:return n=t.sent,t.next=5,this.bridgeNFTCheck(n);case 5:return a=[e,this.tokenId],t.next=8,this.writeContract("erc721","approve",n,a,this.contractAddress);case 8:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.ownerOf=function(){var t=C(m().mark((function t(){var e;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=[this.tokenId],t.next=3,this.fetchAllNetworks("erc721","ownerOf",e,this.contractAddress);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getApproved=function(){var t=C(m().mark((function t(){var e;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=[this.tokenId],t.next=3,this.fetchAllNetworks("erc721","getApproved",e,this.contractAddress);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.setApprovalForAll=function(){var t=C(m().mark((function t(e,r,n){var a,s;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getSignerConnectedNetwork(n);case 2:return a=t.sent,t.next=5,this.bridgeNFTCheck(a);case 5:return s=[e,r],t.next=8,this.writeContract("fungibleERC1155","setApprovalForAll",a,s,this.contractAddress);case 8:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),r.erc1155SafeTransfer=function(){var t=C(m().mark((function t(e,r,n,a){var s,i;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getSignerConnectedNetwork(a);case 2:return s=t.sent,t.next=5,this.bridgeNFTCheck(s);case 5:return i=[e,r,this.tokenId,n,"0x"],t.next=8,this.writeContract("fungibleERC1155","safeTransferFrom",s,i,this.contractAddress);case 8:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a){return t.apply(this,arguments)}}(),r.isApprovedForAll=function(){var t=C(m().mark((function t(e,r){var n;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=[e,r],t.next=3,this.fetchAllNetworks("fungibleERC1155","isApprovedForAll",n,this.contractAddress);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),e}(M),K=function(t){function e(e,r){var n;return(n=t.call(this,e)||this).contractAddress=r,n}P(e,t);var r=e.prototype;return r.balanceOf=function(){var t=C(m().mark((function t(e){var r;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=[e],t.next=3,this.fetchAllNetworks("ionx","balanceOf",r,this.contractAddress);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.allowance=function(){var t=C(m().mark((function t(e,r){var n;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=[e,r],t.next=3,this.fetchAllNetworks("ionx","allowance",n,this.contractAddress);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.approve=function(){var t=C(m().mark((function t(e,r,n){var a,s;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getSignerConnectedNetwork(n);case 2:return a=t.sent,s=[e,r],t.next=6,this.writeContract("ionx","approve",a,s,this.contractAddress);case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),e}(M),z=function(){function t(t){void 0===t&&(t={});var r=this.getValidatedParams(t),n=r.providers,a=r.signer,s=r.config,i={};n?Array.isArray(n)?null==n||n.forEach((function(t){var r=t.network;i[r]=function(t,r){var n=function(t,e){var r="",n="",a=Object.keys(e)[0],s=137==t||80001==t,i=S(t);switch("polygon"==i&&(i="mainnet"),a){case"alchemy":n=s?"https://polygon-{chainName}.g.alchemy.com/v2/{apiKey}":"https://eth-{chainName}.alchemyapi.io/v2/{apiKey}",r=e.alchemy;break;case"infura":n=s?"https://polygon-{chainName}.infura.io/v3/{apiKey}":"https://{chainName}.infura.io/v3/{apiKey}",r=e.infura;break;case"etherscan":n="",r=e.etherscan;break;case"rpc":return e.rpc}return n.replace("{chainName}",i).replace("{apiKey}",r)}(t,r);return e.ethers.getDefaultProvider(function(t,e){return{name:S(t),chainId:t,_defaultProvider:function(t){return new t.JsonRpcProvider(e)}}}(t,n))}(r,t.service)})):i.external=n instanceof e.ethers.providers.Provider?n:new e.ethers.providers.Web3Provider(n):(I.forEach((function(t){var r=t.chainId,n=e.ethers.providers.getNetwork(r);Boolean(n._defaultProvider)&&(i[r]=e.ethers.getDefaultProvider(n))})),console.info("Charged Particles: These API keys are a provided as a community resource by the backend services for low-traffic projects and for early prototyping.\n It is highly recommended to use your own keys: https://docs.ethers.io/v5/api-keys/")),this.state={signer:a,providers:i,configuration:N({},{sdk:{NftBridgeCheck:!1},transactionOverride:{}},s)},this.utils=new R(this.state)}var r=t.prototype;return r.NFT=function(t,e){return new D(this.state,t,e)},r.erc20=function(t){return new K(this.state,t)},r.getState=function(){return this.state},r.setSigner=function(t){this.state=N({},this.state,{signer:t})},r.setExternalProvider=function(t){this.state.providers.external=t},r.getValidatedParams=function(t){var e=["providers","signer","config"];for(var r in t)if(!e.includes(r))throw Error(r+" is not a valid parameter");return t},t}();exports.chargedParticlesAbi=r,exports.chargedSettingsAbi=n,exports.chargedManagersAbi=a,exports.chargedStateAbi=s,exports.protonBAbi=i,exports.mainnetAddresses=u,exports.kovanAddresses=h,exports.polygonAddresses=p,exports.mumbaiAddresses=d,exports.goerliAddresses=f,exports.protonAbi=l,exports.aaveWalletManagerAbi=g,exports.aaveWalletManagerBAbi=v,exports.genericWalletManagerAbi=w,exports.genericWalletManagerBAbi=k,exports.genericBasketManagerAbi=x,exports.genericBasketManagerBAbi=b,Object.defineProperty(exports,"allowlist",{enumerable:!0,get:function(){return y.allowlist}}),exports.default=z; | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("ethers");require("dotenv/config");var r=e(require("@charged-particles/protocol-subgraph/abis/ChargedParticles.json")),n=e(require("@charged-particles/protocol-subgraph/abis/ChargedSettings.json")),a=e(require("@charged-particles/protocol-subgraph/abis/ChargedManagers.json")),s=e(require("@charged-particles/protocol-subgraph/abis/ChargedState.json")),i=e(require("@charged-particles/protocol-subgraph/abis/ProtonC.json")),o=e(require("@charged-particles/protocol-subgraph/abis/ERC1155.json")),c=e(require("@charged-particles/protocol-subgraph/abis/ERC20.json")),u=e(require("@charged-particles/protocol-subgraph/networks/mainnet.json")),p=e(require("@charged-particles/protocol-subgraph/networks/kovan.json")),d=e(require("@charged-particles/protocol-subgraph/networks/polygon.json")),h=e(require("@charged-particles/protocol-subgraph/networks/mumbai.json")),l=e(require("@charged-particles/protocol-subgraph/networks/goerli.json")),f=e(require("@charged-particles/protocol-subgraph/abis/Proton.json")),y=e(require("@charged-particles/protocol-subgraph/abis/ProtonB.json")),g=e(require("@charged-particles/protocol-subgraph/abis/AaveWalletManager.json")),v=e(require("@charged-particles/protocol-subgraph/abis/AaveWalletManagerB.json")),m=e(require("@charged-particles/protocol-subgraph/abis/GenericWalletManager.json")),w=e(require("@charged-particles/protocol-subgraph/abis/GenericWalletManagerB.json")),b=e(require("@charged-particles/protocol-subgraph/abis/GenericBasketManager.json")),k=e(require("@charged-particles/protocol-subgraph/abis/GenericBasketManagerB.json")),x=require("@charged-particles/contract-allowlist");function T(){T=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",o=a.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function u(e,t,r,a){var s=Object.create((t&&t.prototype instanceof h?t:h).prototype),i=new N(a||[]);return n(s,"_invoke",{value:k(e,r,i)}),s}function p(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var d={};function h(){}function l(){}function f(){}var y={};c(y,s,(function(){return this}));var g=Object.getPrototypeOf,v=g&&g(g(P([])));v&&v!==t&&r.call(v,s)&&(y=v);var m=f.prototype=h.prototype=Object.create(y);function w(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){var a;n(this,"_invoke",{value:function(n,s){function i(){return new t((function(a,i){!function n(a,s,i,o){var c=p(e[a],e,s);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==typeof d&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,i,o)}),(function(e){n("throw",e,i,o)})):t.resolve(d).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,o)}))}o(c.arg)}(n,s,a,i)}))}return a=a?a.then(i,i):i()}})}function k(e,t,r){var n="suspendedStart";return function(a,s){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===a)throw s;return{value:void 0,done:!0}}for(r.method=a,r.arg=s;;){var i=r.delegate;if(i){var o=x(i,r);if(o){if(o===d)continue;return o}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=p(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===d)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function x(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,x(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var a=p(n,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,d;var s=a.arg;return s?s.done?(t[e.resultName]=s.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):s:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function A(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 C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function P(e){if(e){var t=e[s];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,a=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:I}}function I(){return{value:void 0,done:!0}}return l.prototype=f,n(m,"constructor",{value:f,configurable:!0}),n(f,"constructor",{value:l,configurable:!0}),l.displayName=c(f,o,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===l||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,c(e,o,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},w(b.prototype),c(b.prototype,i,(function(){return this})),e.AsyncIterator=b,e.async=function(t,r,n,a,s){void 0===s&&(s=Promise);var i=new b(u(t,r,n,a),s);return e.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},w(m),c(m,o,"Generator"),c(m,s,(function(){return this})),c(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=P,N.prototype={constructor:N,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(C),!e)for(var t in this)"t"===t.charAt(0)&&r.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 n(r,n){return i.type="throw",i.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var a=this.tryEntries.length-1;a>=0;--a){var s=this.tryEntries[a],i=s.completion;if("root"===s.tryLoc)return n("end");if(s.tryLoc<=this.prev){var o=r.call(s,"catchLoc"),c=r.call(s,"finallyLoc");if(o&&c){if(this.prev<s.catchLoc)return n(s.catchLoc,!0);if(this.prev<s.finallyLoc)return n(s.finallyLoc)}else if(o){if(this.prev<s.catchLoc)return n(s.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return n(s.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var s=a;break}}s&&("break"===e||"continue"===e)&&s.tryLoc<=t&&t<=s.finallyLoc&&(s=null);var i=s?s.completion:{};return i.type=e,i.arg=t,s?(this.method="next",this.next=s.finallyLoc,d):this.complete(i)},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 r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(r),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;C(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:P(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},e}function A(e,t,r,n,a,s,i){try{var o=e[s](i),c=o.value}catch(e){return void r(e)}o.done?t(c):Promise.resolve(c).then(n,a)}function C(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var s=e.apply(t,r);function i(e){A(s,n,a,i,o,"next",e)}function o(e){A(s,n,a,i,o,"throw",e)}i(void 0)}))}}function N(){return(N=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function P(e,t){var r,n;e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r=e,n=t,(Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(r,n)}var I=function(e){if(!e)return"mainnet";switch(e){case 1:return"mainnet";case 5:return"goerli";case 42:return"kovan";case 137:return"polygon";case 80001:return"mumbai";default:throw"network id: "+e+" is not valid in getAddressFromNetwork"}},S=[{chainId:1,chainName:"eth",name:"Ethereum"},{chainId:5,chainName:"goerli",name:"Goerli"},{chainId:42,chainName:"kovan",name:"Ethereum (Kovan)"},{chainId:137,chainName:"polygon",name:"Polygon"},{chainId:80001,chainName:"mumbai",name:"Polygon (Mumbai)"}],E=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"FundingFailed",type:"error"},{inputs:[],name:"NullReceiver",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"chargedParticles",type:"address"}],name:"ChargedParticlesSet",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"chargedState",type:"address"}],name:"ChargedStateSet",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"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"receiver",type:"address"}],name:"PackBundled",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"receiver",type:"address"}],name:"PackUnbundled",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Paused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"proton",type:"address"}],name:"ProtonSet",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"router",type:"address"}],name:"UniswapRouterSet",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"receiver",type:"address"},{indexed:!0,internalType:"address",name:"tokenAddress",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"WithdrawStuckERC1155",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"receiver",type:"address"},{indexed:!0,internalType:"address",name:"tokenAddress",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"WithdrawStuckERC20",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"receiver",type:"address"},{indexed:!0,internalType:"address",name:"tokenAddress",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"WithdrawStuckERC721",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"receiver",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"WithdrawStuckEther",type:"event"},{inputs:[{internalType:"address",name:"contractAddress",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"string",name:"tokenMetadataUri",type:"string"},{internalType:"string",name:"basketManagerId",type:"string"},{internalType:"address",name:"nftTokenAddress",type:"address"}],name:"bond",outputs:[{internalType:"uint256",name:"mintedTokenId",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address payable",name:"receiver",type:"address"},{internalType:"string",name:"tokenMetaUri",type:"string"},{components:[{internalType:"address",name:"inputTokenAddress",type:"address"},{internalType:"address",name:"outputTokenAddress",type:"address"},{internalType:"uint256",name:"inputTokenAmount",type:"uint256"},{internalType:"uint24",name:"uniSwapPoolFee",type:"uint24"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint256",name:"amountOutMinimum",type:"uint256"},{internalType:"uint160",name:"sqrtPriceLimitX96",type:"uint160"}],internalType:"struct IWeb3Packs.ERC20SwapOrder[]",name:"erc20SwapOrders",type:"tuple[]"},{components:[{internalType:"address",name:"erc721TokenAddress",type:"address"},{internalType:"string",name:"basketManagerId",type:"string"},{internalType:"string",name:"tokenMetadataUri",type:"string"}],internalType:"struct IWeb3Packs.ERC721MintOrders[]",name:"erc721MintOrders",type:"tuple[]"},{internalType:"uint256",name:"fundingAmount",type:"uint256"}],name:"bundle",outputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"bytes",name:"",type:"bytes"}],name:"onERC721Received",outputs:[{internalType:"bytes4",name:"",type:"bytes4"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"pause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"paused",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"chargedParticles",type:"address"}],name:"setChargedParticles",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"stateController",type:"address"}],name:"setChargedState",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"proton",type:"address"}],name:"setProton",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"router",type:"address"}],name:"setUniswapRouter",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"inputTokenAddress",type:"address"},{internalType:"address",name:"outputTokenAddress",type:"address"},{internalType:"uint256",name:"inputTokenAmount",type:"uint256"},{internalType:"uint24",name:"uniSwapPoolFee",type:"uint24"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint256",name:"amountOutMinimum",type:"uint256"},{internalType:"uint160",name:"sqrtPriceLimitX96",type:"uint160"}],internalType:"struct IWeb3Packs.ERC20SwapOrder[]",name:"erc20SwapOrders",type:"tuple[]"}],name:"swap",outputs:[{internalType:"uint256[]",name:"",type:"uint256[]"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"receiver",type:"address"},{internalType:"address",name:"tokenAddress",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{components:[{internalType:"address[]",name:"erc20TokenAddresses",type:"address[]"},{components:[{internalType:"address",name:"tokenAddress",type:"address"},{internalType:"uint256",name:"id",type:"uint256"}],internalType:"struct IWeb3Packs.NFT[]",name:"nfts",type:"tuple[]"}],internalType:"struct IWeb3Packs.Web3PackOrder",name:"web3PackOrder",type:"tuple"}],name:"unbundle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"receiver",type:"address"},{internalType:"address",name:"tokenAddress",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"string",name:"walletManager",type:"string"},{components:[{internalType:"address[]",name:"erc20TokenAddresses",type:"address[]"},{components:[{internalType:"address",name:"tokenAddress",type:"address"},{internalType:"uint256",name:"id",type:"uint256"}],internalType:"struct IWeb3Packs.NFT[]",name:"nfts",type:"tuple[]"}],internalType:"struct IWeb3Packs.Web3PackOrder",name:"web3PackOrder",type:"tuple"}],name:"unbundleFromManager",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"unpause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address payable",name:"receiver",type:"address"},{internalType:"address",name:"tokenAddress",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"withdrawERC1155",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address payable",name:"receiver",type:"address"},{internalType:"address",name:"tokenAddress",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"withdrawERC721",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address payable",name:"receiver",type:"address"},{internalType:"address",name:"tokenAddress",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"withdrawErc20",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address payable",name:"receiver",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"withdrawEther",outputs:[],stateMutability:"nonpayable",type:"function"}],F=u,M=p,O=d,j=h,B=l,R=function(e){switch(e){case"chargedParticles":return r;case"chargedState":return s;case"chargedSettings":return n;case"chargedManagers":return a;case"fungibleERC1155":return o;case"erc721":return i;case"ionx":return c;case"web3pack":return E;default:throw e+" is not valid in getAbi"}},L=function(e,t){var r=_(e)[t];if(q(r))return r.address;throw t+" on chain ID "+e+" is not valid in getAddress"},q=function(e){return void 0!==e.address},_=function(e){switch(e){case 1:return F;case 5:return B;case 42:return M;case 137:return O;case 80001:return j;default:throw"network id: "+e+" is not a valid network in getImportedContractLocations"}},W=function(){function e(e){this.state=e,this.contractInstances={read:{},write:{}}}var r=e.prototype;return r.getContractInstance=function(e,r,n,a){var s,i=this.state,o=i.providers,c=i.signer,u=null!=(s=o[r])?s:o.external,p=null!=a?a:L(r,e),d=p.concat(String(r));if(!this.contractInstances[n][d])if("read"===n){var h=new t.ethers.Contract(p,R(e),u);this.contractInstances[n][d]=h}else if("write"===n){if(!c&&!o.external)throw new Error("Trying to write with no signer");var l=c?null!=c&&c.provider?c:c.connect(u):o.external.getSigner(),f=new t.ethers.Contract(p,R(e),l);this.contractInstances[n][d]=f}return this.contractInstances[n][d]},r.fetchAllNetworks=function(){var e=C(T().mark((function e(t,r,n,a){var s,i,o,c,u;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:void 0===n&&(n=[]),s=this.state.providers,i=[],o=[],e.t0=T().keys(s);case 5:if((e.t1=e.t0()).done){e.next=24;break}if(c=e.t1.value,!a){e.next=14;break}return e.next=10,s[c].getCode(a);case 10:if("0x"!==e.sent){e.next=13;break}return e.abrupt("continue",5);case 13:case 14:if("external"!==c){e.next=20;break}return e.next=17,s.external.getNetwork();case 17:c=e.sent.chainId;case 20:o.push(Number(c)),i.push(this.readContract(t,r,Number(c),n,a)),e.next=5;break;case 24:return e.next=26,Promise.allSettled(i);case 26:return u={},e.sent.forEach((function(e,t){u[o[t]]="fulfilled"===e.status?{value:e.value,status:"fulfilled"}:{value:e.reason,status:"rejected"}})),e.abrupt("return",u);case 30:case"end":return e.stop()}}),e,this)})));return function(t,r,n,a){return e.apply(this,arguments)}}(),r.writeContract=function(){var e=C(T().mark((function e(t,r,n,a,s){var i,o;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===a&&(a=[]),i=this.state.configuration.transactionOverride,o=this.getContractInstance(t,n,"write",s),e.abrupt("return",o[r].apply(o,a.concat([i])));case 5:case"end":return e.stop()}}),e,this)})));return function(t,r,n,a,s){return e.apply(this,arguments)}}(),r.readContract=function(){var e=C(T().mark((function e(t,r,n,a,s){var i,o,c;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===a&&(a=[]),o=this.state.configuration.transactionOverride,c=this.getContractInstance(t,n,"read",s),e.abrupt("return",(i=c.callStatic)[r].apply(i,a.concat([o])));case 5:case"end":return e.stop()}}),e,this)})));return function(t,r,n,a,s){return e.apply(this,arguments)}}(),r.getSignerAddress=function(){var e=C(T().mark((function e(){var t;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t=this.state.signer)){e.next=3;break}return e.abrupt("return",null==t?void 0:t.getAddress());case 3:throw new Error("No signer provided");case 5:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),r.getSignerConnectedNetwork=function(){var e=C(T().mark((function e(t){var r,n,a;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this.state.providers,n=Object.keys(r),!(a=n.length)){e.next=23;break}if(!n.includes("external")){e.next=11;break}return e.next=7,r.external.getNetwork();case 7:return e.abrupt("return",e.sent.chainId);case 11:if(!(a>1&&t)){e.next=15;break}return e.abrupt("return",t);case 15:if(1!=a){e.next=20;break}return e.abrupt("return",Number(n[0]));case 20:throw new Error("Please specify the targeted network");case 21:e.next=24;break;case 23:throw new Error("Could not fetch network from supplied providers");case 24:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),e}(),G=function(e){function t(t){return e.call(this,t)||this}P(t,e);var r=t.prototype;return r.getContractAddress=function(){var e=C(T().mark((function e(t,r){var n,a,s,i,o;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0===r&&(r=[]),n=this.state.providers,0!==(a=r).length){e.next=16;break}e.t0=T().keys(n);case 5:if((e.t1=e.t0()).done){e.next=16;break}if("external"!==(s=e.t1.value)){e.next=13;break}return e.next=10,n.external.getNetwork();case 10:s=e.sent.chainId;case 13:a.push(Number(s)),e.next=5;break;case 16:for(i={},o=0;o<a.length;o++)i[a[o]]=L(Number(a[o]),t);return e.abrupt("return",i);case 19:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),r.getStateAddress=function(){var e=C(T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.fetchAllNetworks("chargedParticles","getStateAddress");case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),r.getSettingsAddress=function(){var e=C(T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.fetchAllNetworks("chargedParticles","getSettingsAddress");case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),r.getManagersAddress=function(){var e=C(T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.fetchAllNetworks("chargedParticles","getManagersAddress");case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),r.getFeesForDeposit=function(){var e=C(T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.fetchAllNetworks("chargedParticles","getFeesForDeposit");case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t}(W),U=function(e){if(!["aave","aave.B","generic","generic.B"].includes(e))throw new Error("Provided a not supported wallet manager id.")},D=function(e){if(!["generic","generic.B"].includes(e))throw new Error("Provided a not supported basket manager id.")},K=function(e){function t(t,r,n){var a;return(a=e.call(this,t)||this).contractAddress=r,a.tokenId=n,a}P(t,e);var r=t.prototype;return r.getChainIdsForBridgedNFTs=function(){var e=C(T().mark((function e(){var t,r,n,a;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=this.state.providers,r=[],e.prev=2,e.t0=T().keys(t);case 4:if((e.t1=e.t0()).done){e.next=25;break}if(void 0!==(a=t[n=e.t1.value])){e.next=9;break}return e.abrupt("continue",4);case 9:return e.next=12,a.getCode(this.contractAddress);case 12:if("0x"===e.sent){e.next=23;break}if("external"!=n){e.next=22;break}return e.next=17,a.getNetwork();case 17:r.push(e.sent.chainId),e.next=23;break;case 22:r.push(Number(n));case 23:e.next=4;break;case 25:e.next=30;break;case 27:throw e.prev=27,e.t2=e.catch(2),e.t2;case 30:return e.abrupt("return",r);case 31:case"end":return e.stop()}}),e,this,[[2,27]])})));return function(){return e.apply(this,arguments)}}(),r.bridgeNFTCheck=function(){var e=C(T().mark((function e(t){var r,n;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=(r=this.state.configuration.sdk)&&r.NftBridgeCheck){e.next=3;break}return e.abrupt("return");case 3:return e.next=6,this.getChainIdsForBridgedNFTs();case 6:if(n=e.sent,void 0!==t){e.next=9;break}throw new Error("Could not retrieve signers network.");case 9:if(!n.includes(t)){e.next=12;break}return e.abrupt("return",!0);case 12:throw new Error("Signer network: "+t+", does not match provider chain.");case 14:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),r.getMass=function(){var e=C(T().mark((function e(t,r){var n;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===r&&(r="generic.B"),U(r),n=[this.contractAddress,this.tokenId,r,t],e.next=5,this.fetchAllNetworks("chargedParticles","baseParticleMass",n);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),r.getCharge=function(){var e=C(T().mark((function e(t,r){var n;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===r&&(r="generic.B"),U(r),n=[this.contractAddress,this.tokenId,r,t],e.next=5,this.fetchAllNetworks("chargedParticles","currentParticleCharge",n);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),r.getKinectics=function(){var e=C(T().mark((function e(t,r){var n;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===r&&(r="generic.B"),U(r),n=[this.contractAddress,this.tokenId,r,t],e.next=5,this.fetchAllNetworks("chargedParticles","currentParticleKinetics",n);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),r.getBonds=function(){var e=C(T().mark((function e(t){var r;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===t&&(t="generic.B"),D(t),r=[this.contractAddress,this.tokenId,t],e.next=5,this.fetchAllNetworks("chargedParticles","currentParticleCovalentBonds",r);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),r.getCreatorAnnuities=function(){var e=C(T().mark((function e(){var t;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[this.contractAddress,this.tokenId],e.next=3,this.fetchAllNetworks("chargedSettings","getCreatorAnnuities",t);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),r.getCreatorAnnuitiesRedirect=function(){var e=C(T().mark((function e(){var t;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[this.contractAddress,this.tokenId],e.next=3,this.fetchAllNetworks("chargedSettings","getCreatorAnnuitiesRedirect",t);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),r.tokenURI=function(){var e=C(T().mark((function e(){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.fetchAllNetworks("erc721","tokenURI",[this.tokenId],this.contractAddress);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),r.getDischargeState=function(){var e=C(T().mark((function e(t){var r;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=[this.contractAddress,this.tokenId,t],e.next=3,this.fetchAllNetworks("chargedState","getDischargeState",r);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),r.getReleaseState=function(){var e=C(T().mark((function e(t){var r;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=[this.contractAddress,this.tokenId,t],e.next=3,this.fetchAllNetworks("chargedState","getReleaseState",r);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),r.getBondsState=function(){var e=C(T().mark((function e(t){var r;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=[this.contractAddress,this.tokenId,t],e.next=3,this.fetchAllNetworks("chargedState","getBreakBondState",r);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),r.getReleaseApproval=function(){var e=C(T().mark((function e(t){var r;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=[this.contractAddress,this.tokenId,t],e.next=3,this.fetchAllNetworks("chargedState","isApprovedForRelease",r);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),r.energize=function(){var e=C(T().mark((function e(t,r,n,a,s){var i,o;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===n&&(n="generic.B"),U(n),e.next=4,this.getSignerConnectedNetwork(a);case 4:return i=e.sent,e.next=7,this.bridgeNFTCheck(i);case 7:return o=[this.contractAddress,this.tokenId,n,t,r,null!=s?s:"0x0000000000000000000000000000000000000000"],e.next=10,this.writeContract("chargedParticles","energizeParticle",i,o);case 10:return e.abrupt("return",e.sent);case 11:case"end":return e.stop()}}),e,this)})));return function(t,r,n,a,s){return e.apply(this,arguments)}}(),r.discharge=function(){var e=C(T().mark((function e(t,r,n,a){var s,i;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===n&&(n="generic.B"),U(n),e.next=4,this.getSignerConnectedNetwork(a);case 4:return s=e.sent,e.next=7,this.bridgeNFTCheck(s);case 7:return i=[t,this.contractAddress,this.tokenId,n,r],e.next=10,this.writeContract("chargedParticles","dischargeParticle",s,i);case 10:return e.abrupt("return",e.sent);case 11:case"end":return e.stop()}}),e,this)})));return function(t,r,n,a){return e.apply(this,arguments)}}(),r.dischargeAmount=function(){var e=C(T().mark((function e(t,r,n,a,s){var i,o;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===a&&(a="generic.B"),U(a),e.next=4,this.getSignerConnectedNetwork(s);case 4:return i=e.sent,e.next=7,this.bridgeNFTCheck(i);case 7:return o=[t,this.contractAddress,this.tokenId,a,r,n],e.next=10,this.writeContract("chargedParticles","dischargeParticleAmount",i,o);case 10:return e.abrupt("return",e.sent);case 11:case"end":return e.stop()}}),e,this)})));return function(t,r,n,a,s){return e.apply(this,arguments)}}(),r.dischargeForCreator=function(){var e=C(T().mark((function e(t,r,n,a,s){var i,o;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===a&&(a="generic.B"),U(a),e.next=4,this.getSignerConnectedNetwork(s);case 4:return i=e.sent,e.next=7,this.bridgeNFTCheck(i);case 7:return o=[t,this.contractAddress,this.tokenId,a,r,n],e.next=10,this.writeContract("chargedParticles","dischargeParticleForCreator",i,o);case 10:return e.abrupt("return",e.sent);case 11:case"end":return e.stop()}}),e,this)})));return function(t,r,n,a,s){return e.apply(this,arguments)}}(),r.release=function(){var e=C(T().mark((function e(t,r,n,a){var s,i;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===n&&(n="generic.B"),U(n),e.next=4,this.getSignerConnectedNetwork(a);case 4:return s=e.sent,e.next=7,this.bridgeNFTCheck(s);case 7:return i=[t,this.contractAddress,this.tokenId,n,r],e.next=10,this.writeContract("chargedParticles","releaseParticle",s,i);case 10:return e.abrupt("return",e.sent);case 11:case"end":return e.stop()}}),e,this)})));return function(t,r,n,a){return e.apply(this,arguments)}}(),r.releaseAmount=function(){var e=C(T().mark((function e(t,r,n,a,s){var i,o;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===a&&(a="generic.B"),U(a),e.next=4,this.getSignerConnectedNetwork(s);case 4:return i=e.sent,e.next=7,this.bridgeNFTCheck(i);case 7:return o=[t,this.contractAddress,this.tokenId,a,r,n],e.next=10,this.writeContract("chargedParticles","releaseParticleAmount",i,o);case 10:return e.abrupt("return",e.sent);case 11:case"end":return e.stop()}}),e,this)})));return function(t,r,n,a,s){return e.apply(this,arguments)}}(),r.multiRelease=function(){var e=C(T().mark((function e(t,r,n,a){var s,i;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return U(r),e.next=3,this.getSignerConnectedNetwork(a);case 3:return s=e.sent,e.next=6,this.bridgeNFTCheck(s);case 6:return i=[t,this.contractAddress,this.tokenId,n],e.next=9,this.writeContract("web3pack","unbundle",s,i);case 9:return e.abrupt("return",e.sent);case 10:case"end":return e.stop()}}),e,this)})));return function(t,r,n,a){return e.apply(this,arguments)}}(),r.setReleaseApproval=function(){var e=C(T().mark((function e(t,r){var n,a;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getSignerConnectedNetwork(r);case 2:return n=e.sent,a=[this.contractAddress,this.tokenId,t],e.next=6,this.writeContract("chargedState","setApprovalForAll",n,a);case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),r.bond=function(){var e=C(T().mark((function e(t,r,n,a,s){var i,o;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===a&&(a="generic.B"),D(a),e.next=4,this.getSignerConnectedNetwork(s);case 4:return i=e.sent,e.next=7,this.bridgeNFTCheck(i);case 7:return o=[this.contractAddress,this.tokenId,a,t,r,n],e.next=10,this.writeContract("chargedParticles","covalentBond",i,o);case 10:return e.abrupt("return",e.sent);case 11:case"end":return e.stop()}}),e,this)})));return function(t,r,n,a,s){return e.apply(this,arguments)}}(),r.breakBond=function(){var e=C(T().mark((function e(t,r,n,a,s,i){var o,c;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===s&&(s="generic.B"),D(s),e.next=4,this.getSignerConnectedNetwork(i);case 4:return o=e.sent,e.next=7,this.bridgeNFTCheck(o);case 7:return c=[t,this.contractAddress,this.tokenId,s,r,n,a],e.next=10,this.writeContract("chargedParticles","breakCovalentBond",o,c);case 10:return e.abrupt("return",e.sent);case 11:case"end":return e.stop()}}),e,this)})));return function(t,r,n,a,s,i){return e.apply(this,arguments)}}(),r.releaseTimelock=function(){var e=C(T().mark((function e(t,r){var n,a;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getSignerConnectedNetwork(r);case 2:return n=e.sent,e.next=5,this.bridgeNFTCheck(n);case 5:return a=[this.contractAddress,this.tokenId,t],e.next=8,this.writeContract("chargedState","setReleaseTimelock",n,a);case 8:return e.abrupt("return",e.sent);case 9:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),r.dischargeTimelock=function(){var e=C(T().mark((function e(t,r){var n,a;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getSignerConnectedNetwork(r);case 2:return n=e.sent,e.next=5,this.bridgeNFTCheck(n);case 5:return a=[this.contractAddress,this.tokenId,t],e.next=8,this.writeContract("chargedState","setDischargeTimelock",n,a);case 8:return e.abrupt("return",e.sent);case 9:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),r.bondsTimelock=function(){var e=C(T().mark((function e(t,r){var n,a;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getSignerConnectedNetwork(r);case 2:return n=e.sent,e.next=5,this.bridgeNFTCheck(n);case 5:return a=[this.contractAddress,this.tokenId,t],e.next=8,this.writeContract("chargedState","setBreakBondTimelock",n,a);case 8:return e.abrupt("return",e.sent);case 9:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),r.setCreatorAnnuities=function(){var e=C(T().mark((function e(t,r,n){var a,s;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getSignerConnectedNetwork(n);case 2:return a=e.sent,e.next=5,this.bridgeNFTCheck(a);case 5:return s=[this.contractAddress,this.tokenId,t,r],e.next=8,this.writeContract("chargedSettings","setCreatorAnnuities",a,s);case 8:return e.abrupt("return",e.sent);case 9:case"end":return e.stop()}}),e,this)})));return function(t,r,n){return e.apply(this,arguments)}}(),r.setCreatorAnnuitiesRedirect=function(){var e=C(T().mark((function e(t,r){var n,a;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getSignerConnectedNetwork(r);case 2:return n=e.sent,e.next=5,this.bridgeNFTCheck(n);case 5:return a=[this.contractAddress,this.tokenId,t],e.next=8,this.writeContract("chargedSettings","setCreatorAnnuitiesRedirect",n,a);case 8:return e.abrupt("return",e.sent);case 9:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),r.transferFrom=function(){var e=C(T().mark((function e(t,r,n){var a,s;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getSignerConnectedNetwork(n);case 2:return a=e.sent,e.next=5,this.bridgeNFTCheck(a);case 5:return s=[t,r,this.tokenId],e.next=8,this.writeContract("erc721","transferFrom",a,s,this.contractAddress);case 8:return e.abrupt("return",e.sent);case 9:case"end":return e.stop()}}),e,this)})));return function(t,r,n){return e.apply(this,arguments)}}(),r.approve=function(){var e=C(T().mark((function e(t,r){var n,a;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getSignerConnectedNetwork(r);case 2:return n=e.sent,e.next=5,this.bridgeNFTCheck(n);case 5:return a=[t,this.tokenId],e.next=8,this.writeContract("erc721","approve",n,a,this.contractAddress);case 8:return e.abrupt("return",e.sent);case 9:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),r.ownerOf=function(){var e=C(T().mark((function e(){var t;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[this.tokenId],e.next=3,this.fetchAllNetworks("erc721","ownerOf",t,this.contractAddress);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),r.getApproved=function(){var e=C(T().mark((function e(){var t;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[this.tokenId],e.next=3,this.fetchAllNetworks("erc721","getApproved",t,this.contractAddress);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),r.setApprovalForAll=function(){var e=C(T().mark((function e(t,r,n){var a,s;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getSignerConnectedNetwork(n);case 2:return a=e.sent,e.next=5,this.bridgeNFTCheck(a);case 5:return s=[t,r],e.next=8,this.writeContract("fungibleERC1155","setApprovalForAll",a,s,this.contractAddress);case 8:return e.abrupt("return",e.sent);case 9:case"end":return e.stop()}}),e,this)})));return function(t,r,n){return e.apply(this,arguments)}}(),r.erc1155SafeTransfer=function(){var e=C(T().mark((function e(t,r,n,a){var s,i;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getSignerConnectedNetwork(a);case 2:return s=e.sent,e.next=5,this.bridgeNFTCheck(s);case 5:return i=[t,r,this.tokenId,n,"0x"],e.next=8,this.writeContract("fungibleERC1155","safeTransferFrom",s,i,this.contractAddress);case 8:return e.abrupt("return",e.sent);case 9:case"end":return e.stop()}}),e,this)})));return function(t,r,n,a){return e.apply(this,arguments)}}(),r.isApprovedForAll=function(){var e=C(T().mark((function e(t,r){var n;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=[t,r],e.next=3,this.fetchAllNetworks("fungibleERC1155","isApprovedForAll",n,this.contractAddress);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),r.burn=function(){var e=C(T().mark((function e(t){var r,n;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getSignerConnectedNetwork(t);case 2:return r=e.sent,e.next=5,this.bridgeNFTCheck(r);case 5:return n=[this.tokenId],e.next=8,this.writeContract("erc721","burn",r,n,this.contractAddress);case 8:return e.abrupt("return",e.sent);case 9:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t}(W),z=function(e){function t(t,r){var n;return(n=e.call(this,t)||this).contractAddress=r,n}P(t,e);var r=t.prototype;return r.balanceOf=function(){var e=C(T().mark((function e(t){var r;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=[t],e.next=3,this.fetchAllNetworks("ionx","balanceOf",r,this.contractAddress);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),r.allowance=function(){var e=C(T().mark((function e(t,r){var n;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=[t,r],e.next=3,this.fetchAllNetworks("ionx","allowance",n,this.contractAddress);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),r.approve=function(){var e=C(T().mark((function e(t,r,n){var a,s;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getSignerConnectedNetwork(n);case 2:return a=e.sent,s=[t,r],e.next=6,this.writeContract("ionx","approve",a,s,this.contractAddress);case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e,this)})));return function(t,r,n){return e.apply(this,arguments)}}(),t}(W),V=function(){function e(e){void 0===e&&(e={});var r=this.getValidatedParams(e),n=r.providers,a=r.signer,s=r.config,i={};n?Array.isArray(n)?null==n||n.forEach((function(e){var r=e.network;i[r]=function(e,r){var n=function(e,t){var r="",n="",a=Object.keys(t)[0],s=137==e||80001==e,i=I(e);switch("polygon"==i&&(i="mainnet"),a){case"alchemy":n=s?"https://polygon-{chainName}.g.alchemy.com/v2/{apiKey}":"https://eth-{chainName}.alchemyapi.io/v2/{apiKey}",r=t.alchemy;break;case"infura":n=s?"https://polygon-{chainName}.infura.io/v3/{apiKey}":"https://{chainName}.infura.io/v3/{apiKey}",r=t.infura;break;case"etherscan":n="",r=t.etherscan;break;case"rpc":return t.rpc}return n.replace("{chainName}",i).replace("{apiKey}",r)}(e,r);return t.ethers.getDefaultProvider(function(e,t){return{name:I(e),chainId:e,_defaultProvider:function(e){return new e.JsonRpcProvider(t)}}}(e,n))}(r,e.service)})):i.external=n instanceof t.ethers.providers.Provider?n:new t.ethers.providers.Web3Provider(n):(S.forEach((function(e){var r=e.chainId,n=t.ethers.providers.getNetwork(r);Boolean(n._defaultProvider)&&(i[r]=t.ethers.getDefaultProvider(n))})),console.info("Charged Particles: These API keys are a provided as a community resource by the backend services for low-traffic projects and for early prototyping.\n It is highly recommended to use your own keys: https://docs.ethers.io/v5/api-keys/")),this.state={signer:a,providers:i,configuration:N({},{sdk:{NftBridgeCheck:!1},transactionOverride:{}},s)},this.utils=new G(this.state)}var r=e.prototype;return r.NFT=function(e,t){return new K(this.state,e,t)},r.erc20=function(e){return new z(this.state,e)},r.getState=function(){return this.state},r.setSigner=function(e){this.state=N({},this.state,{signer:e})},r.setExternalProvider=function(e){this.state.providers.external=e},r.getValidatedParams=function(e){var t=["providers","signer","config"];for(var r in e)if(!t.includes(r))throw Error(r+" is not a valid parameter");return e},e}();exports.chargedParticlesAbi=r,exports.chargedSettingsAbi=n,exports.chargedManagersAbi=a,exports.chargedStateAbi=s,exports.mainnetAddresses=u,exports.kovanAddresses=p,exports.polygonAddresses=d,exports.mumbaiAddresses=h,exports.goerliAddresses=l,exports.protonAbi=f,exports.protonBAbi=y,exports.aaveWalletManagerAbi=g,exports.aaveWalletManagerBAbi=v,exports.genericWalletManagerAbi=m,exports.genericWalletManagerBAbi=w,exports.genericBasketManagerAbi=b,exports.genericBasketManagerBAbi=k,Object.defineProperty(exports,"allowlist",{enumerable:!0,get:function(){return x.allowlist}}),exports.default=V; | ||
//# sourceMappingURL=charged-js-sdk.cjs.production.min.js.map |
@@ -180,5 +180,20 @@ import { BigNumberish, ContractTransaction } from 'ethers'; | ||
}>; | ||
/** | ||
* Gets the release approval state of the Particle. | ||
* | ||
* @memberof NFT | ||
* | ||
* @param {string} externalContract - The address approved for releasing assets from the Particle. | ||
* @return {[boolean]} - [ ApprovalStatus ] | ||
* | ||
*/ | ||
getReleaseApproval(externalContract: string): Promise<{ | ||
[number: number]: { | ||
value: any; | ||
status: string; | ||
}; | ||
}>; | ||
/***********************************| | ||
| Write Functions | | ||
|__________________________________*/ | ||
| Write Functions | | ||
|__________________________________*/ | ||
/** | ||
@@ -328,2 +343,19 @@ * Deposit an ERC20 asset into the Particle. | ||
/** | ||
* Release all specificed erc20s | ||
* | ||
* @param receiver | ||
* @param walletManagerId | ||
* @param addressList | ||
* @param chainId | ||
* @returns | ||
*/ | ||
multiRelease(receiver: string, walletManagerId: ManagerId, addressList: any, chainId?: number): Promise<ContractTransaction>; | ||
/** | ||
* | ||
* @param externalContract | ||
* @param chainId | ||
* @returns | ||
*/ | ||
setReleaseApproval(externalContract: string, chainId?: number): Promise<ContractTransaction>; | ||
/** | ||
* Deposit an NFT assets into the particle. | ||
@@ -550,2 +582,13 @@ * Must be called by the account providing the asset. The account must approve the Charged Particle contract as operator of asset. | ||
}>; | ||
/** | ||
* Burn. | ||
* ERC721 method. | ||
* | ||
* @memberof NFT | ||
* | ||
* @param {number} tokenId - Token to burn. | ||
* @return {Promise<ContractTransaction>} - Details from the transaction. | ||
* | ||
*/ | ||
burn(chainId?: number): Promise<ContractTransaction>; | ||
} |
@@ -14,3 +14,3 @@ import Charged from './charged'; | ||
import genericBasketManagerBAbi from '@charged-particles/protocol-subgraph/abis/GenericBasketManagerB.json'; | ||
import { allowlist } from '@charged-particles/contract-allowlist/src/allowlist'; | ||
import { allowlist } from '@charged-particles/contract-allowlist'; | ||
import mainnetAddresses from '@charged-particles/protocol-subgraph/networks/mainnet.json'; | ||
@@ -17,0 +17,0 @@ import kovanAddresses from '@charged-particles/protocol-subgraph/networks/kovan.json'; |
export declare const getAbi: (contractName: string) => ({ | ||
inputs: never[]; | ||
stateMutability: string; | ||
type: string; | ||
anonymous?: undefined; | ||
name?: undefined; | ||
outputs?: undefined; | ||
} | { | ||
anonymous: boolean; | ||
inputs: { | ||
indexed: boolean; | ||
internalType: string; | ||
@@ -7,7 +16,39 @@ name: string; | ||
}[]; | ||
name: string; | ||
type: string; | ||
stateMutability?: undefined; | ||
outputs?: undefined; | ||
} | { | ||
inputs: { | ||
internalType: string; | ||
name: string; | ||
type: string; | ||
}[]; | ||
name: string; | ||
outputs: { | ||
internalType: string; | ||
name: string; | ||
type: string; | ||
}[]; | ||
stateMutability: string; | ||
type: string; | ||
anonymous?: undefined; | ||
} | { | ||
stateMutability: string; | ||
type: string; | ||
inputs?: undefined; | ||
anonymous?: undefined; | ||
name?: undefined; | ||
outputs?: undefined; | ||
})[] | ({ | ||
inputs: { | ||
internalType: string; | ||
name: string; | ||
type: string; | ||
}[]; | ||
stateMutability: string; | ||
type: string; | ||
anonymous?: undefined; | ||
name?: undefined; | ||
outputs?: undefined; | ||
} | { | ||
@@ -40,3 +81,85 @@ anonymous: boolean; | ||
anonymous?: undefined; | ||
})[] | ({ | ||
inputs: never[]; | ||
stateMutability: string; | ||
type: string; | ||
name?: undefined; | ||
anonymous?: undefined; | ||
outputs?: undefined; | ||
} | { | ||
inputs: never[]; | ||
name: string; | ||
type: string; | ||
stateMutability?: undefined; | ||
anonymous?: undefined; | ||
outputs?: undefined; | ||
} | { | ||
anonymous: boolean; | ||
inputs: { | ||
indexed: boolean; | ||
internalType: string; | ||
name: string; | ||
type: string; | ||
}[]; | ||
name: string; | ||
type: string; | ||
stateMutability?: undefined; | ||
outputs?: undefined; | ||
} | { | ||
inputs: ({ | ||
internalType: string; | ||
name: string; | ||
type: string; | ||
components?: undefined; | ||
} | { | ||
components: { | ||
internalType: string; | ||
name: string; | ||
type: string; | ||
}[]; | ||
internalType: string; | ||
name: string; | ||
type: string; | ||
})[]; | ||
name: string; | ||
outputs: { | ||
internalType: string; | ||
name: string; | ||
type: string; | ||
}[]; | ||
stateMutability: string; | ||
type: string; | ||
anonymous?: undefined; | ||
} | { | ||
inputs: ({ | ||
internalType: string; | ||
name: string; | ||
type: string; | ||
components?: undefined; | ||
} | { | ||
components: ({ | ||
internalType: string; | ||
name: string; | ||
type: string; | ||
components?: undefined; | ||
} | { | ||
components: { | ||
internalType: string; | ||
name: string; | ||
type: string; | ||
}[]; | ||
internalType: string; | ||
name: string; | ||
type: string; | ||
})[]; | ||
internalType: string; | ||
name: string; | ||
type: string; | ||
})[]; | ||
name: string; | ||
outputs: never[]; | ||
stateMutability: string; | ||
type: string; | ||
anonymous?: undefined; | ||
})[]; | ||
export declare const getAddress: (network: number, contractName: string) => string; |
@@ -5,3 +5,3 @@ { | ||
"author": "Firma Lux, Inc.", | ||
"version": "0.1.10", | ||
"version": "0.1.11", | ||
"license": "ISC", | ||
@@ -50,4 +50,2 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@charged-particles/contract-allowlist": "^1.0.6", | ||
"@charged-particles/protocol-subgraph": "^1.3.21", | ||
"@nomiclabs/hardhat-ethers": "^2.1.0", | ||
@@ -65,9 +63,11 @@ "@types/lodash": "^4.14.182", | ||
"tslib": "^2.4.0", | ||
"typescript": "^4.6.4", | ||
"web3-providers-http": "^1.7.3" | ||
}, | ||
"dependencies": { | ||
"@charged-particles/contract-allowlist": "1.0.9", | ||
"@charged-particles/protocol-subgraph": "https://github.com/Charged-Particles/charged-particles-subgraph.git", | ||
"ethers": "^5.6.9", | ||
"lodash": "^4.17.21", | ||
"lodash-es": "^4.17.21" | ||
"lodash-es": "^4.17.21", | ||
"typescript": "^4.6.4" | ||
}, | ||
@@ -74,0 +74,0 @@ "jest": { |
import { Contract, ethers } from 'ethers'; | ||
import { ChargedState } from '../../types'; | ||
import { getAbi, getAddress } from '../../utils/contractUtilities'; | ||
export default class BaseService { | ||
@@ -5,0 +6,0 @@ readonly contractInstances: { [action: string]: { [address: string]: Contract } }; |
@@ -271,3 +271,25 @@ import { BigNumberish, ContractTransaction } from 'ethers'; | ||
/***********************************| | ||
/** | ||
* Gets the release approval state of the Particle. | ||
* | ||
* @memberof NFT | ||
* | ||
* @param {string} externalContract - The address approved for releasing assets from the Particle. | ||
* @return {[boolean]} - [ ApprovalStatus ] | ||
* | ||
*/ | ||
public async getReleaseApproval(externalContract: string) { | ||
const parameters = [ | ||
this.contractAddress, | ||
this.tokenId, | ||
externalContract, | ||
]; | ||
return await this.fetchAllNetworks( | ||
'chargedState', | ||
'isApprovedForRelease', | ||
parameters | ||
); | ||
} | ||
/***********************************| | ||
| Write Functions | | ||
@@ -574,2 +596,61 @@ |__________________________________*/ | ||
/** | ||
* Release all specificed erc20s | ||
* | ||
* @param receiver | ||
* @param walletManagerId | ||
* @param addressList | ||
* @param chainId | ||
* @returns | ||
*/ | ||
public async multiRelease( | ||
receiver: string, | ||
walletManagerId: ManagerId, | ||
addressList: any, | ||
chainId?: number, | ||
): Promise<ContractTransaction> { | ||
walletManagerCheck(walletManagerId); | ||
const signerNetwork = await this.getSignerConnectedNetwork(chainId); | ||
await this.bridgeNFTCheck(signerNetwork); | ||
const parameters = [ | ||
receiver, | ||
this.contractAddress, | ||
this.tokenId, | ||
addressList, | ||
]; | ||
return await this.writeContract( | ||
'web3pack', | ||
'unbundle', | ||
signerNetwork, | ||
parameters, | ||
); | ||
}; | ||
/** | ||
* | ||
* @param externalContract | ||
* @param chainId | ||
* @returns | ||
*/ | ||
public async setReleaseApproval( | ||
externalContract: string, | ||
chainId?: number, | ||
): Promise<ContractTransaction> { | ||
const signerNetwork = await this.getSignerConnectedNetwork(chainId); | ||
const parameters = [ | ||
this.contractAddress, | ||
this.tokenId, | ||
externalContract, | ||
]; | ||
return await this.writeContract( | ||
'chargedState', | ||
'setApprovalForAll', | ||
signerNetwork, | ||
parameters, | ||
); | ||
} | ||
/** | ||
* Deposit an NFT assets into the particle. | ||
@@ -1058,2 +1139,32 @@ * Must be called by the account providing the asset. The account must approve the Charged Particle contract as operator of asset. | ||
} | ||
/** | ||
* Burn. | ||
* ERC721 method. | ||
* | ||
* @memberof NFT | ||
* | ||
* @param {number} tokenId - Token to burn. | ||
* @return {Promise<ContractTransaction>} - Details from the transaction. | ||
* | ||
*/ | ||
public async burn( | ||
chainId?: number | ||
): Promise<ContractTransaction> { | ||
const signerNetwork = await this.getSignerConnectedNetwork(chainId); | ||
await this.bridgeNFTCheck(signerNetwork); | ||
const parameters = [ | ||
this.tokenId, | ||
]; | ||
return await this.writeContract( | ||
'erc721', | ||
'burn', | ||
signerNetwork, | ||
parameters, | ||
this.contractAddress, | ||
); | ||
} | ||
} |
@@ -18,3 +18,3 @@ import Charged from './charged'; | ||
// contract-allowlist | ||
import { allowlist } from '@charged-particles/contract-allowlist/src/allowlist'; | ||
import { allowlist } from '@charged-particles/contract-allowlist'; | ||
@@ -21,0 +21,0 @@ // networks |
@@ -6,5 +6,6 @@ // ABIs | ||
import ChargedState from '@charged-particles/protocol-subgraph/abis/ChargedState.json'; | ||
import ProtonB from '@charged-particles/protocol-subgraph/abis/ProtonB.json'; | ||
import ProtonC from '@charged-particles/protocol-subgraph/abis/ProtonC.json'; | ||
import fungibleERC1155 from '@charged-particles/protocol-subgraph/abis/ERC1155.json'; | ||
import ERC20 from '@charged-particles/protocol-subgraph/abis/ERC20.json'; | ||
import Web3Pack from '../abi/Web3Pack.json'; | ||
@@ -35,4 +36,5 @@ // Types | ||
case 'fungibleERC1155': return fungibleERC1155; | ||
case 'erc721': return ProtonB; | ||
case 'erc721': return ProtonC; | ||
case 'ionx': return ERC20; | ||
case 'web3pack': return Web3Pack; | ||
default: throw `${contractName} is not valid in getAbi`; | ||
@@ -39,0 +41,0 @@ } |
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
HTTP dependency
Supply chain riskContains a dependency which resolves to a remote HTTP URL which could be used to inject untrusted code and reduce overall package reliability.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
716020
13
35
11269
6
1
1
+ Addedtypescript@^4.6.4
+ Added@charged-particles/contract-allowlist@1.0.9(transitive)
+ Addedtypescript@4.9.5(transitive)