New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@charged-particles/charged-js-sdk

Package Overview
Dependencies
Maintainers
3
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@charged-particles/charged-js-sdk - npm Package Compare versions

Comparing version 0.1.7 to 0.1.8

dist/charged/services/Erc20Service.d.ts

2

dist/charged-js-sdk.cjs.production.min.js

@@ -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")),i=t(require("@charged-particles/protocol-subgraph/abis/ChargedState.json")),s=t(require("@charged-particles/protocol-subgraph/abis/ProtonB.json")),o=t(require("@charged-particles/protocol-subgraph/networks/mainnet.json")),c=t(require("@charged-particles/protocol-subgraph/networks/kovan.json")),u=t(require("@charged-particles/protocol-subgraph/networks/polygon.json")),h=t(require("@charged-particles/protocol-subgraph/networks/mumbai.json")),p=t(require("@charged-particles/protocol-subgraph/networks/goerli.json")),d=t(require("@charged-particles/protocol-subgraph/abis/Proton.json")),f=t(require("@charged-particles/protocol-subgraph/abis/AaveWalletManager.json")),l=t(require("@charged-particles/protocol-subgraph/abis/AaveWalletManagerB.json")),g=t(require("@charged-particles/protocol-subgraph/abis/GenericWalletManager.json")),v=t(require("@charged-particles/protocol-subgraph/abis/GenericWalletManagerB.json")),w=t(require("@charged-particles/protocol-subgraph/abis/GenericBasketManager.json")),k=t(require("@charged-particles/protocol-subgraph/abis/GenericBasketManagerB.json"));function x(t,e,r,n,a,i,s){try{var o=t[i](s),c=o.value}catch(t){return void r(t)}o.done?e(c):Promise.resolve(c).then(n,a)}function b(t){return function(){var e=this,r=arguments;return new Promise((function(n,a){var i=t.apply(e,r);function s(t){x(i,n,a,s,o,"next",t)}function o(t){x(i,n,a,s,o,"throw",t)}s(void 0)}))}}function y(){return(y=Object.assign||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 m(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,(Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var A,N=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"}},C=[{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)"}],P=(function(t){var e=function(t){var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},a=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",s=n.toStringTag||"@@toStringTag";function o(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var a=Object.create((e&&e.prototype instanceof p?e:p).prototype),i=new A(n||[]);return a._invoke=function(t,e,r){var n="suspendedStart";return function(a,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===a)throw i;return{value:void 0,done:!0}}for(r.method=a,r.arg=i;;){var s=r.delegate;if(s){var o=b(s,r);if(o){if(o===h)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=u(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===h)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,i),a}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var h={};function p(){}function d(){}function f(){}var l={};o(l,a,(function(){return this}));var g=Object.getPrototypeOf,v=g&&g(g(N([])));v&&v!==e&&r.call(v,a)&&(l=v);var w=f.prototype=p.prototype=Object.create(l);function k(t){["next","throw","return"].forEach((function(e){o(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){var n;this._invoke=function(a,i){function s(){return new e((function(n,s){!function n(a,i,s,o){var c=u(t[a],t,i);if("throw"!==c.type){var h=c.arg,p=h.value;return p&&"object"==typeof p&&r.call(p,"__await")?e.resolve(p.__await).then((function(t){n("next",t,s,o)}),(function(t){n("throw",t,s,o)})):e.resolve(p).then((function(t){h.value=t,s(h)}),(function(t){return n("throw",t,s,o)}))}o(c.arg)}(a,i,n,s)}))}return n=n?n.then(s,s):s()}}function b(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=u(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,h;var a=n.arg;return a?a.done?(e[t.resultName]=a.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function y(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 m(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(y,this),this.reset(!0)}function N(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=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 i.next=i}}return{next:C}}function C(){return{value:void 0,done:!0}}return d.prototype=f,o(w,"constructor",f),o(f,"constructor",d),d.displayName=o(f,s,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,o(t,s,"GeneratorFunction")),t.prototype=Object.create(w),t},t.awrap=function(t){return{__await:t}},k(x.prototype),o(x.prototype,i,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,a,i){void 0===i&&(i=Promise);var s=new x(c(e,r,n,a),i);return t.isGeneratorFunction(r)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},k(w),o(w,s,"Generator"),o(w,a,(function(){return this})),o(w,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=N,A.prototype={constructor:A,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(m),!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 s.type="throw",s.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 i=this.tryEntries[a],s=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var o=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(o&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(o){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.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 i=a;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=t,s.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(s)},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),h},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),m(r),h}},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;m(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:N(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}}(A={exports:{}}),A.exports),I=o,S=c,B=u,j=h,E=p,F=function(t){switch(t){case"chargedParticles":return r;case"chargedState":return i;case"chargedSettings":return n;case"chargedManagers":return a;case"erc721":return s;default:throw t+" is not valid in getAbi"}},T=function(t,e){var r=O(t)[e];if(L(r))return r.address;throw e+" on chain ID "+t+" is not valid in getAddress"},L=function(t){return void 0!==t.address},O=function(t){switch(t){case 1:return I;case 5:return E;case 42:return S;case 137:return B;case 80001:return j;default:throw"network id: "+t+" is not a valid network in getImportedContractLocations"}},_=function(){function t(t){this.state=t,this.contractInstances={read:{},write:{}}}var r=t.prototype;return r.getContractInstance=function(t,r,n,a){var i,s=this.state,o=s.providers,c=s.signer,u=null!=(i=o[r])?i:o.external,h=null!=a?a:T(r,t);if(!this.contractInstances[n][h])if("read"===n){var p=new e.ethers.Contract(h,F(t),u);this.contractInstances[n][h]=p}else if("write"===n){if(!c&&!o.external)throw new Error("Trying to write with no signer");var d=c?null!=c&&c.provider?c:c.connect(u):o.external.getSigner(),f=new e.ethers.Contract(h,F(t),d);this.contractInstances[n][h]=f}return this.contractInstances[n][h]},r.fetchAllNetworks=function(){var t=b(P.mark((function t(e,r,n,a){var i,s,o,c,u;return P.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:void 0===n&&(n=[]),s=[],o=[],t.t0=P.keys(i=this.state.providers);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,i[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,i.external.getNetwork();case 17:c=t.sent.chainId;case 20:o.push(Number(c)),s.push(this.readContract(e,r,Number(c),n,a)),t.next=5;break;case 24:return t.next=26,Promise.allSettled(s);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=b(P.mark((function t(e,r,n,a,i){var s,o;return P.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===a&&(a=[]),s=this.state.configuration.transactionOverride,o=this.getContractInstance(e,n,"write",i),t.abrupt("return",o[r].apply(o,a.concat([s])));case 5:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a,i){return t.apply(this,arguments)}}(),r.readContract=function(){var t=b(P.mark((function t(e,r,n,a,i){var s,o,c;return P.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",i),t.abrupt("return",(s=c.callStatic)[r].apply(s,a.concat([o])));case 5:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a,i){return t.apply(this,arguments)}}(),r.getSignerAddress=function(){var t=b(P.mark((function t(){var e;return P.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=b(P.mark((function t(e){var r,n,a;return P.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}(),M=function(t){function e(e){return t.call(this,e)||this}m(e,t);var r=e.prototype;return r.getContractAddress=function(){var t=b(P.mark((function t(e,r){var n,a,i,s,o;return P.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=P.keys(n);case 5:if((t.t1=t.t0()).done){t.next=16;break}if("external"!==(i=t.t1.value)){t.next=13;break}return t.next=10,n.external.getNetwork();case 10:i=t.sent.chainId;case 13:a.push(Number(i)),t.next=5;break;case 16:for(s={},o=0;o<a.length;o++)s[a[o]]=T(Number(a[o]),e);return t.abrupt("return",s);case 19:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.getStateAddress=function(){var t=b(P.mark((function t(){return P.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=b(P.mark((function t(){return P.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=b(P.mark((function t(){return P.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=b(P.mark((function t(){return P.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}(_),q=function(t){if(!["aave","aave.B","generic","generic.B"].includes(t))throw new Error("Provided a not supported wallet manager id.")},G=function(t){if(!["generic","generic.B"].includes(t))throw new Error("Provided a not supported basket manager id.")},R=function(t){function e(e,r,n){var a;return(a=t.call(this,e)||this).contractAddress=r,a.tokenId=n,a}m(e,t);var r=e.prototype;return r.getChainIdsForBridgedNFTs=function(){var t=b(P.mark((function t(){var e,r,n,a;return P.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=this.state.providers,r=[],t.prev=2,t.t0=P.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=b(P.mark((function t(e){var r,n;return P.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=b(P.mark((function t(e,r){var n;return P.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===r&&(r="generic.B"),q(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=b(P.mark((function t(e,r){var n;return P.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===r&&(r="generic.B"),q(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=b(P.mark((function t(e,r){var n;return P.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===r&&(r="generic.B"),q(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=b(P.mark((function t(e){var r;return P.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===e&&(e="generic.B"),G(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=b(P.mark((function t(){var e;return P.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=b(P.mark((function t(){var e;return P.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=b(P.mark((function t(){return P.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=b(P.mark((function t(e){var r;return P.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=b(P.mark((function t(e){var r;return P.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=b(P.mark((function t(e){var r;return P.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=b(P.mark((function t(e,r,n,a,i){var s,o;return P.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===n&&(n="generic.B"),q(n),t.next=4,this.getSignerConnectedNetwork(a);case 4:return s=t.sent,t.next=7,this.bridgeNFTCheck(s);case 7:return o=[this.contractAddress,this.tokenId,n,e,r,null!=i?i:"0x0000000000000000000000000000000000000000"],t.next=10,this.writeContract("chargedParticles","energizeParticle",s,o);case 10:return t.abrupt("return",t.sent);case 11:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a,i){return t.apply(this,arguments)}}(),r.discharge=function(){var t=b(P.mark((function t(e,r,n,a){var i,s;return P.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===n&&(n="generic.B"),q(n),t.next=4,this.getSignerConnectedNetwork(a);case 4:return i=t.sent,t.next=7,this.bridgeNFTCheck(i);case 7:return s=[e,this.contractAddress,this.tokenId,n,r],t.next=10,this.writeContract("chargedParticles","dischargeParticle",i,s);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=b(P.mark((function t(e,r,n,a,i){var s,o;return P.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===a&&(a="generic.B"),q(a),t.next=4,this.getSignerConnectedNetwork(i);case 4:return s=t.sent,t.next=7,this.bridgeNFTCheck(s);case 7:return o=[e,this.contractAddress,this.tokenId,a,r,n],t.next=10,this.writeContract("chargedParticles","dischargeParticleAmount",s,o);case 10:return t.abrupt("return",t.sent);case 11:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a,i){return t.apply(this,arguments)}}(),r.dischargeForCreator=function(){var t=b(P.mark((function t(e,r,n,a,i){var s,o;return P.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===a&&(a="generic.B"),q(a),t.next=4,this.getSignerConnectedNetwork(i);case 4:return s=t.sent,t.next=7,this.bridgeNFTCheck(s);case 7:return o=[e,this.contractAddress,this.tokenId,a,r,n],t.next=10,this.writeContract("chargedParticles","dischargeParticleForCreator",s,o);case 10:return t.abrupt("return",t.sent);case 11:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a,i){return t.apply(this,arguments)}}(),r.release=function(){var t=b(P.mark((function t(e,r,n,a){var i,s;return P.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===n&&(n="generic.B"),q(n),t.next=4,this.getSignerConnectedNetwork(a);case 4:return i=t.sent,t.next=7,this.bridgeNFTCheck(i);case 7:return s=[e,this.contractAddress,this.tokenId,n,r],t.next=10,this.writeContract("chargedParticles","releaseParticle",i,s);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=b(P.mark((function t(e,r,n,a,i){var s,o;return P.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===a&&(a="generic.B"),q(a),t.next=4,this.getSignerConnectedNetwork(i);case 4:return s=t.sent,t.next=7,this.bridgeNFTCheck(s);case 7:return o=[e,this.contractAddress,this.tokenId,a,r,n],t.next=10,this.writeContract("chargedParticles","releaseParticleAmount",s,o);case 10:return t.abrupt("return",t.sent);case 11:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a,i){return t.apply(this,arguments)}}(),r.bond=function(){var t=b(P.mark((function t(e,r,n,a,i){var s,o;return P.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(i);case 4:return s=t.sent,t.next=7,this.bridgeNFTCheck(s);case 7:return o=[this.contractAddress,this.tokenId,a,e,r,n],t.next=10,this.writeContract("chargedParticles","covalentBond",s,o);case 10:return t.abrupt("return",t.sent);case 11:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a,i){return t.apply(this,arguments)}}(),r.breakBond=function(){var t=b(P.mark((function t(e,r,n,a,i,s){var o,c;return P.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===i&&(i="generic.B"),G(i),t.next=4,this.getSignerConnectedNetwork(s);case 4:return o=t.sent,t.next=7,this.bridgeNFTCheck(o);case 7:return c=[e,this.contractAddress,this.tokenId,i,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,i,s){return t.apply(this,arguments)}}(),r.releaseTimelock=function(){var t=b(P.mark((function t(e,r){var n,a;return P.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=b(P.mark((function t(e,r){var n,a;return P.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=b(P.mark((function t(e,r){var n,a;return P.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=b(P.mark((function t(e,r,n){var a,i;return P.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 i=[this.contractAddress,this.tokenId,e,r],t.next=8,this.writeContract("chargedSettings","setCreatorAnnuities",a,i);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=b(P.mark((function t(e,r){var n,a;return P.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)}}(),e}(_),W=function(){function t(t){void 0===t&&(t={});var r=this.getValidatedParams(t),n=r.providers,a=r.signer,i=r.config,s={};n?Array.isArray(n)?null==n||n.forEach((function(t){var r=t.network;s[r]=function(t,r){var n=function(t,e){var r="",n="",a=Object.keys(e)[0],i=137==t||80001==t,s=N(t);switch("polygon"==s&&(s="mainnet"),a){case"alchemy":n=i?"https://polygon-{chainName}.g.alchemy.com/v2/{apiKey}":"https://eth-{chainName}.alchemyapi.io/v2/{apiKey}",r=e.alchemy;break;case"infura":n=i?"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}",s).replace("{apiKey}",r)}(t,r);return e.ethers.getDefaultProvider(function(t,e){return{name:N(t),chainId:t,_defaultProvider:function(t){return new t.JsonRpcProvider(e)}}}(t,n))}(r,t.service)})):s.external=n instanceof e.ethers.providers.Provider?n:new e.ethers.providers.Web3Provider(n):(C.forEach((function(t){var r=t.chainId,n=e.ethers.providers.getNetwork(r);Boolean(n._defaultProvider)&&(s[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:s,configuration:y({},{sdk:{NftBridgeCheck:!1},transactionOverride:{}},i)},this.utils=new M(this.state)}var r=t.prototype;return r.NFT=function(t,e){return new R(this.state,t,e)},r.getState=function(){return this.state},r.setSigner=function(t){this.state=y({},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=i,exports.protonBAbi=s,exports.mainnetAddresses=o,exports.kovanAddresses=c,exports.polygonAddresses=u,exports.mumbaiAddresses=h,exports.goerliAddresses=p,exports.protonAbi=d,exports.aaveWalletManagerAbi=f,exports.aaveWalletManagerBAbi=l,exports.genericWalletManagerAbi=g,exports.genericWalletManagerBAbi=v,exports.genericBasketManagerAbi=w,exports.genericBasketManagerBAbi=k,exports.default=W;
"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"));function y(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 m(t){return function(){var e=this,r=arguments;return new Promise((function(n,a){var s=t.apply(e,r);function i(t){y(s,n,a,i,o,"next",t)}function o(t){y(s,n,a,i,o,"throw",t)}i(void 0)}))}}function A(){return(A=Object.assign||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 C(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,(Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var N,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"}},P=[{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)"}],I=(function(t){var e=function(t){var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},a=n.iterator||"@@iterator",s=n.asyncIterator||"@@asyncIterator",i=n.toStringTag||"@@toStringTag";function o(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var a=Object.create((e&&e.prototype instanceof p?e:p).prototype),s=new A(n||[]);return a._invoke=function(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=b(i,r);if(o){if(o===h)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=u(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===h)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,s),a}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var h={};function p(){}function d(){}function f(){}var l={};o(l,a,(function(){return this}));var g=Object.getPrototypeOf,v=g&&g(g(C([])));v&&v!==e&&r.call(v,a)&&(l=v);var w=f.prototype=p.prototype=Object.create(l);function k(t){["next","throw","return"].forEach((function(e){o(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){var n;this._invoke=function(a,s){function i(){return new e((function(n,i){!function n(a,s,i,o){var c=u(t[a],t,s);if("throw"!==c.type){var h=c.arg,p=h.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){h.value=t,i(h)}),(function(t){return n("throw",t,i,o)}))}o(c.arg)}(a,s,n,i)}))}return n=n?n.then(i,i):i()}}function b(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=u(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,h;var a=n.arg;return a?a.done?(e[t.resultName]=a.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function y(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 m(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(y,this),this.reset(!0)}function C(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,s=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 s.next=s}}return{next:N}}function N(){return{value:void 0,done:!0}}return d.prototype=f,o(w,"constructor",f),o(f,"constructor",d),d.displayName=o(f,i,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,o(t,i,"GeneratorFunction")),t.prototype=Object.create(w),t},t.awrap=function(t){return{__await:t}},k(x.prototype),o(x.prototype,s,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,a,s){void 0===s&&(s=Promise);var i=new x(c(e,r,n,a),s);return t.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},k(w),o(w,i,"Generator"),o(w,a,(function(){return this})),o(w,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=C,A.prototype={constructor:A,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(m),!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,h):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),h},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),m(r),h}},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;m(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:C(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}}(N={exports:{}}),N.exports),E=u,F=h,B=p,j=d,T=f,L=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"}},O=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 E;case 5:return T;case 42:return F;case 137:return B;case 80001:return j;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:O(r,t),p=h.concat(String(r));if(!this.contractInstances[n][p])if("read"===n){var d=new e.ethers.Contract(h,L(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,L(t),f);this.contractInstances[n][p]=l}return this.contractInstances[n][p]},r.fetchAllNetworks=function(){var t=m(I.mark((function t(e,r,n,a){var s,i,o,c,u;return I.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:void 0===n&&(n=[]),t.prev=1,i=[],o=[],t.t0=I.keys(s=this.state.providers);case 6:if((t.t1=t.t0()).done){t.next=25;break}if(c=t.t1.value,!a){t.next=15;break}return t.next=11,s[c].getCode(a);case 11:if("0x"!==t.sent){t.next=14;break}return t.abrupt("continue",6);case 14:case 15:if("external"!==c){t.next=21;break}return t.next=18,s.external.getNetwork();case 18:c=t.sent.chainId;case 21:o.push(Number(c)),i.push(this.readContract(e,r,Number(c),n,a)),t.next=6;break;case 25:return t.next=27,Promise.allSettled(i);case 27: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 33:return t.prev=33,t.t2=t.catch(1),console.log(t.t2),t.abrupt("return",{});case 37:case"end":return t.stop()}}),t,this,[[1,33]])})));return function(e,r,n,a){return t.apply(this,arguments)}}(),r.writeContract=function(){var t=m(I.mark((function t(e,r,n,a,s){var i,o;return I.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=m(I.mark((function t(e,r,n,a,s){var i,o,c;return I.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=m(I.mark((function t(){var e;return I.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=m(I.mark((function t(e){var r,n,a;return I.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}C(e,t);var r=e.prototype;return r.getContractAddress=function(){var t=m(I.mark((function t(e,r){var n,a,s,i,o;return I.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=I.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]]=O(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=m(I.mark((function t(){return I.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=m(I.mark((function t(){return I.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=m(I.mark((function t(){return I.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=m(I.mark((function t(){return I.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}C(e,t);var r=e.prototype;return r.getChainIdsForBridgedNFTs=function(){var t=m(I.mark((function t(){var e,r,n,a;return I.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=this.state.providers,r=[],t.prev=2,t.t0=I.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=m(I.mark((function t(e){var r,n;return I.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=m(I.mark((function t(e,r){var n;return I.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=m(I.mark((function t(e,r){var n;return I.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=m(I.mark((function t(e,r){var n;return I.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=m(I.mark((function t(e){var r;return I.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=m(I.mark((function t(){var e;return I.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=m(I.mark((function t(){var e;return I.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=m(I.mark((function t(){return I.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=m(I.mark((function t(e){var r;return I.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=m(I.mark((function t(e){var r;return I.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=m(I.mark((function t(e){var r;return I.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=m(I.mark((function t(e,r,n,a,s){var i,o;return I.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=m(I.mark((function t(e,r,n,a){var s,i;return I.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=m(I.mark((function t(e,r,n,a,s){var i,o;return I.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=m(I.mark((function t(e,r,n,a,s){var i,o;return I.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=m(I.mark((function t(e,r,n,a){var s,i;return I.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=m(I.mark((function t(e,r,n,a,s){var i,o;return I.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=m(I.mark((function t(e,r,n,a,s){var i,o;return I.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=m(I.mark((function t(e,r,n,a,s,i){var o,c;return I.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=m(I.mark((function t(e,r){var n,a;return I.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=m(I.mark((function t(e,r){var n,a;return I.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=m(I.mark((function t(e,r){var n,a;return I.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=m(I.mark((function t(e,r,n){var a,s;return I.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=m(I.mark((function t(e,r){var n,a;return I.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=m(I.mark((function t(e,r,n){var a,s;return I.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=m(I.mark((function t(e,r){var n,a;return I.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=m(I.mark((function t(){var e;return I.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=m(I.mark((function t(){var e;return I.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=m(I.mark((function t(e,r,n){var a,s;return I.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=m(I.mark((function t(e,r,n,a){var s,i;return I.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=m(I.mark((function t(e,r){var n;return I.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}C(e,t);var r=e.prototype;return r.balanceOf=function(){var t=m(I.mark((function t(e){var r;return I.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=m(I.mark((function t(e,r){var n;return I.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=m(I.mark((function t(e,r,n){var a,s;return I.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):(P.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:A({},{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=A({},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,exports.default=z;
//# sourceMappingURL=charged-js-sdk.cjs.production.min.js.map

@@ -5,2 +5,3 @@ import { ethers, providers, Signer } from "ethers";

import NftService from "./services/NftService";
import Erc20service from "./services/Erc20Service";
/**

@@ -43,2 +44,3 @@ * Charged class constructor object parameter.

NFT(contractAddress: string, tokenId: number): NftService;
erc20(contractAddress: string): Erc20service;
getState(): ChargedState;

@@ -45,0 +47,0 @@ setSigner(signer: Signer): void;

@@ -457,2 +457,86 @@ import { BigNumberish, ContractTransaction } from 'ethers';

setCreatorAnnuitiesRedirect(receiver: string, chainId?: number): Promise<ContractTransaction>;
/**
* Wrapper for transfer from ERC721 method
*
* @memberof NFT
*
* @param {string} addressFrom - NFT owner.
* @param {string} addressTo - Receivers account.
* @param {number} [chainId] - Optional parameter that allows for the user to specify which network to write to.
* @return {Promise<ContractTransaction>} - Details from the transaction.
*
*/
transferFrom(addressFrom: string, addressTo: string, chainId?: number): Promise<ContractTransaction>;
/**
* Approve an address for its usage.
* ERC721 method.
*
* @memberof NFT
*
* @param {string} addressTo - Approved account.
* @param {number} [chainId] - Optional parameter that allows for the user to specify which network to write to.
* @return {Promise<ContractTransaction>} - Details from the transaction.
*
*/
approve(addressTo: string, chainId?: number): Promise<ContractTransaction>;
/**
* Gets current owner of the NFT.
*
* @memberof NFT
*
* @return {string} - Address
*
*/
ownerOf(): Promise<{
[number: number]: {
value: any;
status: string;
};
}>;
/**
* Gets current approved address from NFT.
*
* @memberof NFT
*
* @return {string} - Address
*
*/
getApproved(): Promise<{
[number: number]: {
value: any;
status: string;
};
}>;
/**
* Sets erc1155 approval for all
*
* @memberof NFT
*
* @return {string} - Address
*
*/
setApprovalForAll(operator: string, approved: boolean, chainId?: number): Promise<ContractTransaction>;
/**
* Sets erc1155 approval for all
*
* @memberof NFT
*
* @return {string} - Address
*
*/
erc1155SafeTransfer(addressFrom: string, addressTo: string, amount: number, chainId?: number): Promise<ContractTransaction>;
/**
* GEts erc1155 approved
*
* @memberof NFT
*
* @return {string} - Address
*
*/
isApprovedForAll(account: string, operator: string): Promise<{
[number: number]: {
value: any;
status: string;
};
}>;
}
export declare const getAbi: (contractName: string) => ({
inputs: never[];
inputs: {
internalType: string;
name: string;
type: string;
}[];
stateMutability: string;

@@ -4,0 +8,0 @@ type: string;

@@ -5,3 +5,3 @@ {

"author": "Firma Lux, Inc.",
"version": "0.1.7",
"version": "0.1.8",
"license": "ISC",

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

# @charged-aprticles/charged-js-sdk
Charged Particles Javascript SDK
Charged Particles Javascript SDK v0.1.7 (beta)

@@ -95,4 +95,4 @@ ### Table of Contents

const polygonProvider = [
{
network: 137,
{
network: 137,
service: {alchemy: process.env.ALCHEMY_POLYGON_KEY}

@@ -114,3 +114,3 @@ }

* `signer` **Signer?** Needed to send signed transactions to the Ethereum Network to execute state changing operations.
* `config` **ConfigurationParameters**
* `config` **ConfigurationParameters**

@@ -121,4 +121,4 @@ ## NFT

* `contractAddress` **[string][77]**
* `tokenId` **[number][76]**
* `contractAddress` **[string][77]**
* `tokenId` **[number][76]**

@@ -251,3 +251,3 @@ ### Examples

* `chainId` **[number][76]?** Optional parameter that allows for the user to specify which network to write to
* `referrer` **[string][77]?**
* `referrer` **[string][77]?**

@@ -526,3 +526,3 @@ #### Examples

Returns **UtilsService**
Returns **UtilsService**

@@ -620,8 +620,8 @@ ### getStateAddress

* `from` **[boolean][78]?**
* `value` **[boolean][78]?**
* `gasPrice` **[boolean][78]?**
* `gasLimit` **[boolean][78]?**
* `blockTag` **[boolean][78]?**
* `nonce` **[boolean][78]?**
* `from` **[boolean][78]?**
* `value` **[boolean][78]?**
* `gasPrice` **[boolean][78]?**
* `gasLimit` **[boolean][78]?**
* `blockTag` **[boolean][78]?**
* `nonce` **[boolean][78]?**

@@ -628,0 +628,0 @@

@@ -7,2 +7,3 @@ import { ethers, providers, Signer } from "ethers";

import NftService from "./services/NftService";
import Erc20service from "./services/Erc20Service";

@@ -98,2 +99,6 @@ /**

public erc20(contractAddress: string) {
return new Erc20service(this.state, contractAddress);
}
public getState() {

@@ -100,0 +105,0 @@ return this.state;

@@ -28,4 +28,6 @@ import { Contract, ethers } from 'ethers';

if (!this.contractInstances[action][address]) {
const contractUuid = address.concat(String(network));
if (!this.contractInstances[action][contractUuid]) {
if (action === 'read') {

@@ -38,3 +40,3 @@ const requestedContract = new ethers.Contract(

this.contractInstances[action][address] = requestedContract;
this.contractInstances[action][contractUuid] = requestedContract;

@@ -53,7 +55,7 @@ } else if (action === 'write') {

this.contractInstances[action][address] = requestedContract;
this.contractInstances[action][contractUuid] = requestedContract;
}
}
return this.contractInstances[action][address];
return this.contractInstances[action][contractUuid];
}

@@ -67,43 +69,49 @@

) {
const { providers } = this.state;
let transactions = [];
let networks: (number)[] = [];
for (let network in providers) {
// Only query contracts that exist on network
if (contractAddress) {
const contractExistsOnNetwork = await providers[network].getCode(contractAddress);
if (contractExistsOnNetwork === '0x') { continue };
try {
const { providers } = this.state;
let transactions = [];
let networks: (number)[] = [];
for (let network in providers) {
// Only query contracts that exist on network
if (contractAddress) {
const contractExistsOnNetwork = await providers[network].getCode(contractAddress);
if (contractExistsOnNetwork === '0x') { continue };
}
if (network === 'external') {
const { chainId } = await providers['external'].getNetwork()
network = chainId;
}
networks.push(Number(network));
transactions.push(
this.readContract(
contractName,
methodName,
Number(network),
params,
contractAddress
)
);
}
const responses = await Promise.allSettled(transactions);
const formattedResponse: { [number: number]: { value: any, status: string } } = {};
responses.forEach((response, index) => {
if (response.status === "fulfilled") {
formattedResponse[networks[index]] = { value: response.value, status: 'fulfilled' };
} else {
formattedResponse[networks[index]] = { value: response.reason, status: 'rejected' };
}
});
return formattedResponse;
if (network === 'external') {
const { chainId } = await providers['external'].getNetwork()
network = chainId;
}
networks.push(Number(network));
transactions.push(
this.readContract(
contractName,
methodName,
Number(network),
params,
contractAddress
)
);
} catch (e) {
console.log(e);
return {};
}
const responses = await Promise.allSettled(transactions);
const formattedResponse: { [number: number]: { value: any, status: string } } = {};
responses.forEach((response, index) => {
if (response.status === "fulfilled") {
formattedResponse[networks[index]] = { value: response.value, status: 'fulfilled' };
} else {
formattedResponse[networks[index]] = { value: response.reason, status: 'rejected' };
}
});
return formattedResponse;
}

@@ -110,0 +118,0 @@

import { BigNumberish, ContractTransaction } from 'ethers';
import BaseService from './baseService';
import {
import {
ChargedState,

@@ -126,3 +126,3 @@ ManagerId,

*/
public async getCharge( assetToken: string, walletManagerId: ManagerId = defaultManagerId) {
public async getCharge(assetToken: string, walletManagerId: ManagerId = defaultManagerId) {
walletManagerCheck(walletManagerId);

@@ -148,3 +148,3 @@ const parameters = [

*/
public async getKinectics( assetToken: string, walletManagerId: ManagerId = defaultManagerId) {
public async getKinectics(assetToken: string, walletManagerId: ManagerId = defaultManagerId) {
walletManagerCheck(walletManagerId);

@@ -857,2 +857,197 @@ const parameters = [

}
/**
* Wrapper for transfer from ERC721 method
*
* @memberof NFT
*
* @param {string} addressFrom - NFT owner.
* @param {string} addressTo - Receivers account.
* @param {number} [chainId] - Optional parameter that allows for the user to specify which network to write to.
* @return {Promise<ContractTransaction>} - Details from the transaction.
*
*/
public async transferFrom(
addressFrom: string,
addressTo: string,
chainId?: number
): Promise<ContractTransaction> {
const signerNetwork = await this.getSignerConnectedNetwork(chainId);
await this.bridgeNFTCheck(signerNetwork);
const parameters = [
addressFrom,
addressTo,
this.tokenId,
];
return await this.writeContract(
'erc721',
'transferFrom',
signerNetwork,
parameters,
this.contractAddress,
);
}
/**
* Approve an address for its usage.
* ERC721 method.
*
* @memberof NFT
*
* @param {string} addressTo - Approved account.
* @param {number} [chainId] - Optional parameter that allows for the user to specify which network to write to.
* @return {Promise<ContractTransaction>} - Details from the transaction.
*
*/
public async approve(
addressTo: string,
chainId?: number
): Promise<ContractTransaction> {
const signerNetwork = await this.getSignerConnectedNetwork(chainId);
await this.bridgeNFTCheck(signerNetwork);
const parameters = [
addressTo,
this.tokenId,
];
return await this.writeContract(
'erc721',
'approve',
signerNetwork,
parameters,
this.contractAddress,
);
}
/**
* Gets current owner of the NFT.
*
* @memberof NFT
*
* @return {string} - Address
*
*/
public async ownerOf() {
const parameters = [
this.tokenId,
];
return await this.fetchAllNetworks(
'erc721',
'ownerOf',
parameters,
this.contractAddress,
);
}
/**
* Gets current approved address from NFT.
*
* @memberof NFT
*
* @return {string} - Address
*
*/
public async getApproved() {
const parameters = [
this.tokenId,
];
return await this.fetchAllNetworks(
'erc721',
'getApproved',
parameters,
this.contractAddress,
);
}
/**
* Sets erc1155 approval for all
*
* @memberof NFT
*
* @return {string} - Address
*
*/
public async setApprovalForAll(
operator: string,
approved: boolean,
chainId?: number
): Promise<ContractTransaction> {
const signerNetwork = await this.getSignerConnectedNetwork(chainId);
await this.bridgeNFTCheck(signerNetwork);
const parameters = [
operator,
approved,
];
return await this.writeContract(
'fungibleERC1155',
'setApprovalForAll',
signerNetwork,
parameters,
this.contractAddress,
);
}
/**
* Sets erc1155 approval for all
*
* @memberof NFT
*
* @return {string} - Address
*
*/
public async erc1155SafeTransfer(
addressFrom: string,
addressTo: string,
amount: number,
chainId?: number,
): Promise<ContractTransaction> {
const signerNetwork = await this.getSignerConnectedNetwork(chainId);
await this.bridgeNFTCheck(signerNetwork);
const parameters = [
addressFrom,
addressTo,
this.tokenId,
amount,
'0x'
];
return await this.writeContract(
'fungibleERC1155',
'safeTransferFrom',
signerNetwork,
parameters,
this.contractAddress,
);
}
/**
* GEts erc1155 approved
*
* @memberof NFT
*
* @return {string} - Address
*
*/
public async isApprovedForAll(account: string, operator: string) {
const parameters = [
account,
operator,
];
return await this.fetchAllNetworks(
'fungibleERC1155',
'isApprovedForAll',
parameters,
this.contractAddress,
);
}
}

@@ -7,2 +7,4 @@ // ABIs

import ProtonB from '@charged-particles/protocol-subgraph/abis/ProtonB.json';
import fungibleERC1155 from '@charged-particles/protocol-subgraph/abis/ERC1155.json';
import ERC20 from '@charged-particles/protocol-subgraph/abis/ERC20.json';

@@ -32,3 +34,5 @@ // Types

case 'chargedManagers': return ChargedManagers;
case 'fungibleERC1155': return fungibleERC1155;
case 'erc721': return ProtonB;
case 'ionx': return ERC20;
default: throw `${contractName} is not valid in getAbi`;

@@ -35,0 +39,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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc