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.2 to 0.1.5

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"),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/abis/Proton.json")),d=t(require("@charged-particles/protocol-subgraph/abis/AaveWalletManager.json")),f=t(require("@charged-particles/protocol-subgraph/abis/AaveWalletManagerB.json")),l=t(require("@charged-particles/protocol-subgraph/abis/GenericWalletManager.json")),g=t(require("@charged-particles/protocol-subgraph/abis/GenericWalletManagerB.json")),v=t(require("@charged-particles/protocol-subgraph/abis/GenericBasketManager.json")),w=t(require("@charged-particles/protocol-subgraph/abis/GenericBasketManagerB.json"));function k(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 x(t){return function(){var e=this,r=arguments;return new Promise((function(n,a){var i=t.apply(e,r);function s(t){k(i,n,a,s,o,"next",t)}function o(t){k(i,n,a,s,o,"throw",t)}s(void 0)}))}}function b(){return(b=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 y(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 m,A=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)"}],N=(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(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,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 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,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: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,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=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 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: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)}}(m={exports:{}}),m.exports),P=o,S=c,I=u,B=h,j=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"}},E=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:function(t,e){var r=function(t){switch(t){case 1:return P;case 42:return S;case 137:return I;case 80001:return B;default:throw"network id: "+t+" is not a valid network in getImportedContractLocations"}}(t)[e];if(void 0!==r.address)return r.address;throw e+" is not valid in getAddress"}(r,t);if(!this.contractInstances[n][h])if("read"===n){var p=new e.ethers.Contract(h,j(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?c.connect(u):o.external.getSigner(),f=new e.ethers.Contract(h,j(t),d);this.contractInstances[n][h]=f}return this.contractInstances[n][h]},r.fetchAllNetworks=function(){var t=x(N.mark((function t(e,r,n,a){var i,s,o,c,u;return N.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:void 0===n&&(n=[]),s=[],o=[],t.t0=N.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=x(N.mark((function t(e,r,n,a,i){var s,o;return N.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=x(N.mark((function t(e,r,n,a,i){var s,o,c;return N.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=x(N.mark((function t(){var e;return N.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=x(N.mark((function t(e){var r,n,a,i;return N.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=24;break}if(!(a>1&&e)){t.next=8;break}return t.abrupt("return",e);case 8:if(1!=a){t.next=21;break}if("external"!=(i=n[0])){t.next=17;break}return t.next=13,r.external.getNetwork();case 13:return t.abrupt("return",t.sent.chainId);case 17:return t.abrupt("return",Number(i));case 18:t.next=22;break;case 21:throw new Error("Please specify the targeted network");case 22:t.next=25;break;case 24:throw new Error("Could not fetch network: from supplied providers");case 25:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),t}(),F=function(t){function e(e){return t.call(this,e)||this}y(e,t);var r=e.prototype;return r.getStateAddress=function(){var t=x(N.mark((function t(){return N.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=x(N.mark((function t(){return N.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=x(N.mark((function t(){return N.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=x(N.mark((function t(){return N.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}(E),T=function(t){function e(e,r,n){var a;return(a=t.call(this,e)||this).contractAddress=r,a.tokenId=n,a}y(e,t);var r=e.prototype;return r.getChainIdsForBridgedNFTs=function(){var t=x(N.mark((function t(){var e,r,n,a;return N.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=this.state.providers,r=[],t.prev=2,t.t0=N.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=x(N.mark((function t(e){var r,n;return N.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=x(N.mark((function t(e,r){var n;return N.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===r&&(r="generic.B"),n=[this.contractAddress,this.tokenId,r,e],t.next=4,this.fetchAllNetworks("chargedParticles","baseParticleMass",n);case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.getCharge=function(){var t=x(N.mark((function t(e,r){var n;return N.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===r&&(r="generic.B"),n=[this.contractAddress,this.tokenId,r,e],t.next=4,this.fetchAllNetworks("chargedParticles","currentParticleCharge",n);case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.getKinectics=function(){var t=x(N.mark((function t(e,r){var n;return N.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===r&&(r="generic.B"),n=[this.contractAddress,this.tokenId,r,e],t.next=4,this.fetchAllNetworks("chargedParticles","currentParticleKinetics",n);case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.getBonds=function(){var t=x(N.mark((function t(e){var r;return N.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===e&&(e="generic.B"),r=[this.contractAddress,this.tokenId,e],t.next=4,this.fetchAllNetworks("chargedParticles","currentParticleCovalentBonds",r);case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getCreatorAnnuities=function(){var t=x(N.mark((function t(){var e;return N.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=x(N.mark((function t(){var e;return N.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=x(N.mark((function t(){return N.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=x(N.mark((function t(e){var r;return N.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=x(N.mark((function t(e){var r;return N.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=x(N.mark((function t(e){var r;return N.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=x(N.mark((function t(e,r,n,a,i){var s,o;return N.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===n&&(n="generic.B"),t.next=3,this.getSignerConnectedNetwork(a);case 3:return s=t.sent,t.next=6,this.bridgeNFTCheck(s);case 6:return o=[this.contractAddress,this.tokenId,n,e,r,null!=i?i:"0x0000000000000000000000000000000000000000"],t.next=9,this.writeContract("chargedParticles","energizeParticle",s,o);case 9:return t.abrupt("return",t.sent);case 10:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a,i){return t.apply(this,arguments)}}(),r.discharge=function(){var t=x(N.mark((function t(e,r,n,a){var i,s;return N.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===n&&(n="generic.B"),t.next=3,this.getSignerConnectedNetwork(a);case 3:return i=t.sent,t.next=6,this.bridgeNFTCheck(i);case 6:return s=[e,this.contractAddress,this.tokenId,n,r],t.next=9,this.writeContract("chargedParticles","dischargeParticle",i,s);case 9:return t.abrupt("return",t.sent);case 10:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a){return t.apply(this,arguments)}}(),r.dischargeAmount=function(){var t=x(N.mark((function t(e,r,n,a,i){var s,o;return N.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===a&&(a="generic.B"),t.next=3,this.getSignerConnectedNetwork(i);case 3:return s=t.sent,t.next=6,this.bridgeNFTCheck(s);case 6:return o=[e,this.contractAddress,this.tokenId,a,r,n],t.next=9,this.writeContract("chargedParticles","dischargeParticleAmount",s,o);case 9:return t.abrupt("return",t.sent);case 10:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a,i){return t.apply(this,arguments)}}(),r.dischargeForCreator=function(){var t=x(N.mark((function t(e,r,n,a,i){var s,o;return N.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===a&&(a="generic.B"),t.next=3,this.getSignerConnectedNetwork(i);case 3:return s=t.sent,t.next=6,this.bridgeNFTCheck(s);case 6:return o=[e,this.contractAddress,this.tokenId,a,r,n],t.next=9,this.writeContract("chargedParticles","dischargeParticleForCreator",s,o);case 9:return t.abrupt("return",t.sent);case 10:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a,i){return t.apply(this,arguments)}}(),r.release=function(){var t=x(N.mark((function t(e,r,n,a){var i,s;return N.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===n&&(n="generic.B"),t.next=3,this.getSignerConnectedNetwork(a);case 3:return i=t.sent,t.next=6,this.bridgeNFTCheck(i);case 6:return s=[e,this.contractAddress,this.tokenId,n,r],t.next=9,this.writeContract("chargedParticles","releaseParticle",i,s);case 9:return t.abrupt("return",t.sent);case 10:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a){return t.apply(this,arguments)}}(),r.releaseAmount=function(){var t=x(N.mark((function t(e,r,n,a,i){var s,o;return N.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===a&&(a="generic.B"),t.next=3,this.getSignerConnectedNetwork(i);case 3:return s=t.sent,t.next=6,this.bridgeNFTCheck(s);case 6:return o=[e,this.contractAddress,this.tokenId,a,r,n],t.next=9,this.writeContract("chargedParticles","releaseParticleAmount",s,o);case 9:return t.abrupt("return",t.sent);case 10:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a,i){return t.apply(this,arguments)}}(),r.bond=function(){var t=x(N.mark((function t(e,r,n,a,i){var s,o;return N.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===a&&(a="generic.B"),t.next=3,this.getSignerConnectedNetwork(i);case 3:return s=t.sent,t.next=6,this.bridgeNFTCheck(s);case 6:return o=[this.contractAddress,this.tokenId,a,e,r,n],t.next=9,this.writeContract("chargedParticles","covalentBond",s,o);case 9:return t.abrupt("return",t.sent);case 10:case"end":return t.stop()}}),t,this)})));return function(e,r,n,a,i){return t.apply(this,arguments)}}(),r.breakBond=function(){var t=x(N.mark((function t(e,r,n,a,i,s){var o,c;return N.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===i&&(i="generic.B"),t.next=3,this.getSignerConnectedNetwork(s);case 3:return o=t.sent,t.next=6,this.bridgeNFTCheck(o);case 6:return c=[e,this.contractAddress,this.tokenId,i,r,n,a],t.next=9,this.writeContract("chargedParticles","breakCovalentBond",o,c);case 9:return t.abrupt("return",t.sent);case 10: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=x(N.mark((function t(e,r){var n,a;return N.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=x(N.mark((function t(e,r){var n,a;return N.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=x(N.mark((function t(e,r){var n,a;return N.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=x(N.mark((function t(e,r,n){var a,i;return N.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=x(N.mark((function t(e,r){var n,a;return N.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}(E),L=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=A(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:A(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 own keys: https://docs.ethers.io/v5/api-keys/")),this.state={signer:a,providers:s,configuration:b({},{sdk:{NftBridgeCheck:!1},transactionOverride:{}},i)},this.utils=new F(this.state)}var r=t.prototype;return r.NFT=function(t,e){return new T(this.state,t,e)},r.getState=function(){return this.state},r.setSigner=function(t){this.state=b({},this.state,{signer: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.protonAbi=p,exports.aaveWalletManagerAbi=d,exports.aaveWalletManagerBAbi=f,exports.genericWalletManagerAbi=l,exports.genericWalletManagerBAbi=g,exports.genericBasketManagerAbi=v,exports.genericBasketManagerBAbi=w,exports.default=L;
"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"),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,C=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"}},N=[{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(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,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 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,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: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,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=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 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: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)}}(A={exports:{}}),A.exports),S=o,I=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(){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:function(t,e){var r=function(t){switch(t){case 1:return S;case 5:return E;case 42:return I;case 137:return B;case 80001:return j;default:throw"network id: "+t+" is not a valid network in getImportedContractLocations"}}(t)[e];if(void 0!==r.address)return r.address;throw e+" is not valid in getAddress"}(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?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}(),L=function(t){function e(e){return t.call(this,e)||this}m(e,t);var r=e.prototype;return 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}(T),O=function(t){if(!["aave","aave.B","generic","generic.B"].includes(t))throw new Error("Provided a not supported wallet manager id.")},_=function(t){if(!["generic","generic.B"].includes(t))throw new Error("Provided a not supported basket manager id.")},M=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"),O(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"),O(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"),O(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"),_(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"),O(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"),O(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"),O(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"),O(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"),O(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"),O(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"),_(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"),_(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}(T),q=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=C(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:C(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):(N.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 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 L(this.state)}var r=t.prototype;return r.NFT=function(t,e){return new M(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.protonAbi=d,exports.aaveWalletManagerAbi=f,exports.aaveWalletManagerBAbi=l,exports.genericWalletManagerAbi=g,exports.genericWalletManagerBAbi=v,exports.genericBasketManagerAbi=w,exports.genericBasketManagerBAbi=k,exports.default=q;
//# sourceMappingURL=charged-js-sdk.cjs.production.min.js.map

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

import { providers, Signer } from "ethers";
import { ethers, providers, Signer } from "ethers";
import { NetworkProvider, ChargedState, ConfigurationParameters } from "../types";

@@ -23,3 +23,3 @@ import UtilsService from "./services/UtilsService";

* @constructs ChargedConstructor
* @param {ChargedConstructor} params - Charged parameter object.
* @param {ChargedConstructor} params - Charged constructor object.
* @example

@@ -45,4 +45,5 @@ * const charged = new Charged({providers: window.ethereum});

setSigner(signer: Signer): void;
setExternalProvider(provider: ethers.providers.Provider): void;
private getValidatedParams;
}
export {};
import { BigNumberish, ContractTransaction } from 'ethers';
import BaseService from './baseService';
import { ChargedState, ManagerId } from '../../types';
import BaseService from './baseService';
/**

@@ -31,3 +31,3 @@ * @name NFT

/**
* Gets the amount of asset tokens that have been deposited into the Particle.
* Gets the amount of an asset tokens deposited into the Particle.
*

@@ -47,3 +47,3 @@ * @memberof NFT

/**
* Gets the amount of interest that the particle has generated.
* Gets the amount of interest generated by an asset.
*

@@ -64,3 +64,3 @@ * @memberof NFT

/**
* Gets the amount of LP Tokens that the Particle has generated.
* Gets the amount of LP Tokens that the Particle has generated for a particular asset.
*

@@ -81,3 +81,3 @@ * @memberof NFT

/**
* Gets the total amount of ERC721 tokens that the Particle holds.
* Gets the ERC721 balance that the Particle holds.
*

@@ -88,2 +88,3 @@ * @memberof NFT

* @param {string} [basketManagerId] - The ID of the BasketManager to check.
* @return {BigNumber} - The NFT balance held by the Particle.
*

@@ -98,3 +99,3 @@ */

/**
* Gets the amount of creator annuities reserved for the creator for the specified NFT.
* Gets the 'creator annuities' for the specified NFT.
*

@@ -114,8 +115,8 @@ * @memberof NFT

/**
* Get the address that receives creator annuities for a given Particle/ Defaults to creator address if it has not been redirected.
* Get the 'creators annuities' receiving address for a given Particle.
* Defaults to creator address if not modified.
*
* @memberof NFT
*
* @return {address} - The address of the creator.
* @return {number} - The percentage amount of annuities reserved for the creator.
* @return {address} - Receiving 'creator annuities' address.
*

@@ -130,3 +131,3 @@ */

/**
* Gets the tokenUri using the tokenId and contractAddress of the Particle.
* Get the token URI.
*

@@ -145,8 +146,8 @@ * @memberof NFT

/**
* Gets the Discharge timelock state of the Particle.
* Get the discharge timelock state of the Particle.
*
* @memberof NFT
*
* @param {string} sender - The address approved for Discharging assets from the Particle.
* @return {[boolean, boolean, BigNumber, BigNumber]} - [allowFromAll, isApproved, timelock, empLockExpiry]
* @param {string} sender - The address approved for discharging assets from the Particle.
* @return {[boolean, boolean, BigNumber, BigNumber]} - [allowFromAll, isApproved, timelock, tempLockExpiry]
*/

@@ -160,8 +161,8 @@ getDischargeState(sender: string): Promise<{

/**
* Gets the Discharge timelock state of the Particle.
* Gets the release timelock state of the Particle.
*
* @memberof NFT
*
* @param {string} sender - The address approved for Releasing assets from the Particle.
* @return {[boolean, boolean, BigNumber, BigNumber]} - [allowFromAll, isApproved, timelock, empLockExpiry]
* @param {string} sender - The address approved for releasing assets from the Particle.
* @return {[boolean, boolean, BigNumber, BigNumber]} - [allowFromAll, isApproved, timelock, tempLockExpiry]
*

@@ -176,11 +177,8 @@ */

/**
* Gets the Bonds Timelock state of the Particle.
* Gets the bonds(ERC721) timelock state of the Particle.
*
* @memberof NFT
*
* @param {string} sender - The address approved for removing Bond assets from the Particle.
* @return {boolean} allowFromAll
* @return {boolean} isApproved
* @return {BigNumber} timelock
* @return {BigNumber} empLockExpiry
* @param {string} sender - The address approved for removing bond timelock from the Particle.
* @return {[boolean, boolean, BigNumber, BigNumber]} - [allowFromAll, isApproved, timelock, tempLockExpiry]
*

@@ -198,22 +196,22 @@ */

/**
* Fund particle with asset token
* Must be called by the account providing the asset. Account must also approve THIS contract as operator as asset.
* Deposit an ERC20 asset into the Particle.
* Must be called by the account providing the asset.
*
* If you are getting gas limit errors this may be because you forgot to approve the contract as operator of asset
* Asset owner must approve the Charged Particle contract as operator of the asset.
* If you are getting gas limit errors this may be because you forgot to approve the contract as operator of asset.
*
* @memberof NFT
*
* @param {string} assetToken - The Address of the Asset Token being used
* @param {BigNumberish} assetAmount - The Amount of Asset Token to Energize the Token with
* @param {WalletManagerId} [walletManagerId] - The Asset-Pair to Energize the Token with
* @param {number} [chainId] - Optional parameter that allows for the user to specify which network to write to
* @param {string} assetToken - Address of the asset token being used.
* @param {BigNumberish} assetAmount - Amount of asset token to energize the token with.
* @param {WalletManagerId} [walletManagerId] - The Asset-Pair to Energize the Token with.
* @param {number} [chainId] - Optional parameter that allows for the user to specify which network to write to.
* @param {string} [referrer]
* @return {Promise<ContractTransaction>} A contract receipt from the transaction.
* @return {Promise<ContractTransaction>}
*
* {@link https://github.com/Charged-Particles/charged-particles-universe/blob/a2c54a8b125e416ff600b731d2d13576223bfac7/contracts/ChargedParticles.sol#L267 Solidity Contract Method}
* @example
* // Asset amount expects a big numberish type. If you do not supply a
* // big number object, ethers will assume you are working in wei.
* // Asset amount expects a big numberish type. If you do not supply a big number object, ethers will assume you are working in wei.
*
* // Deposits 20 USDC tokens into our particle that will accrue interest.
*
* const USDCoinAddress = '0xUSDC';

@@ -225,7 +223,4 @@ * const result = await nft.energize(

* );
* // Or, deposit assets that will not accrue interest
* // or assets that are not supported by our yield generating protocols (e.g. aave)
*
* // For example, we will energize our particle with 20 monkey coins
* // This will not generate interest.
* // Deposit assets that will not accrue interest.
* const monkeyCoinAddress = '0xMONKEY';

@@ -240,4 +235,4 @@ * const result = await nft.energize(

/**
* Allows the owner or operator of the token to collect or transfer the interest generated from the token
* without removing the underlying asset that is held within the token.
* Allows the owner or operator of the token to collect or transfer the interest generated from an Aave compatible token.
* The underlying asset amount will not be moved.
*

@@ -249,4 +244,4 @@ * @memberof NFT

* @param {WalletManagerId} [walletManagerId] - The wallet manager of that assets to discharge from the token.
* @param {number} [chainId] - Optional parameter that allows for the user to specify which network to write to.j
* @return {Promise<ContractTransaction>} A receipt from the contract transaction.
* @param {number} [chainId] - Optional parameter that allows for the user to specify which network to write to.
* @return {Promise<ContractTransaction>}
*

@@ -276,3 +271,3 @@ * {@link https://github.com/Charged-Particles/charged-particles-universe/blob/a2c54a8b125e416ff600b731d2d13576223bfac7/contracts/ChargedParticles.sol#L310 Solidity Contract Method}

/**
* Allows the owner or operator of the Token to collect or transfer a specific amount of the interest
* Allows the owner or operator of the token to collect or transfer a specific amount of the interest
* generated from the token without removing the underlying Asset that is held within the token.

@@ -287,3 +282,3 @@ *

* @param {number} [chainId] - Optional parameter that allows for the user to specify which network to write to.
* @return {Promise<ContractTransaction>} Details from the transaction.
* @return {Promise<ContractTransaction>}
*

@@ -294,3 +289,3 @@ * {@link https://github.com/Charged-Particles/charged-particles-universe/blob/a2c54a8b125e416ff600b731d2d13576223bfac7/contracts/ChargedParticles.sol#L351 Solidity Contract Method}

/**
* Allows the Creator of the Token to collect or transfer a their portion of the interest (if any)
* Allows the creator of the token to collect or transfer a portion of the interest (if any)
* generated from the token without removing the underlying Asset that is held within the token.

@@ -300,8 +295,8 @@ *

*
* @param {string} receiver - The address to receive the discharged asset tokens
* @param {string} assetToken - The address of the asset token being discharged
* @param {BigNumberish} assetAmount - The specific amount of asset token to discharge from the particle
* @param {WalletManagerId} [walletManagerId] - The wallet manager of the assets to discharge from the token
* @param {number} [chainId] - Optional parameter that allows for the user to specify which network to write to
* @return {Promise<ContractTransaction>} A receipt from the transaction
* @param {string} receiver - The address to receive the discharged asset tokens.
* @param {string} assetToken - The address of the asset token being discharged.
* @param {BigNumberish} assetAmount - The specific amount of asset token to discharge from the particle.
* @param {WalletManagerId=} [walletManagerId] - The wallet manager of the assets to discharge from the token.
* @param {number} [chainId] - Optional parameter that allows for the user to specify which network to write to.
* @return {Promise<ContractTransaction>}
*

@@ -321,3 +316,3 @@ * {@link https://github.com/Charged-Particles/charged-particles-universe/blob/a2c54a8b125e416ff600b731d2d13576223bfac7/contracts/ChargedParticles.sol#L393 Solidity Contract Method}

* @param {number} [chainId] - Optional parameter that allows for the user to specify which network to write to.
* @return {Promise<ContractTransaction>} Details from the transaction.
* @return {Promise<ContractTransaction>}
*

@@ -342,8 +337,8 @@ * {@link https://github.com/Charged-Particles/charged-particles-universe/blob/a2c54a8b125e416ff600b731d2d13576223bfac7/contracts/ChargedParticles.sol#L440 Solidity Contract Method}

*
* @param {string} receiver - The address to receive the released asset tokens
* @param {string} assetToken - The address of the asset token being released
* @param {BigNumberish} assetAmount - The specific amount of asset token to release from the particle
* @param {WalletManagerId} [walletManagerId] - The wallet manager of the assets to release from the token
* @param {number} [chainId] - Optional parameter that allows for the user to specify which network to write to
* @return {Promise<ContractTransaction>} A receipt from the transaction
* @param {string} receiver - The address to receive the released asset tokens.
* @param {string} assetToken - The address of the asset token being released.
* @param {BigNumberish} assetAmount - The specific amount of asset token to release from the particle.
* @param {WalletManagerId} [walletManagerId] - The wallet manager of the assets to release from the token.
* @param {number} [chainId] - Optional parameter that allows for the user to specify which network to write to.
* @return {Promise<ContractTransaction>}
*

@@ -354,4 +349,4 @@ * {@link https://github.com/Charged-Particles/charged-particles-universe/blob/a2c54a8b125e416ff600b731d2d13576223bfac7/contracts/ChargedParticles.sol#L483 Solidity Contract Method}

/**
* Deposit other NFT assets into the particle.
* Must be called by the account providing the asset. Account must approve THIS contract as operator of asset.
* Deposit an NFT assets into the particle.
* Must be called by the account providing the asset. The account must approve the Charged Particle contract as operator of asset.
*

@@ -362,3 +357,3 @@ * @memberof NFT

* @param {string} nftTokenId - The ID of the NFT token being deposited.
* @param {BigNumberish} nftTokenAmount - The amount of tokens to deposit (ERC1155-specific).
* @param {BigNumberish} nftTokenAmount - The amount of tokens to deposit, set to 1 for ERC271.
* @param {BasketManagerId} [basketManagerId] - The basket to deposit the NFT into.

@@ -399,6 +394,6 @@ * @param {number} [chainId] - Optional parameter that allows for the user to specify which network to write to.

* @param {string} nftTokenId - The ID of the NFT token being released.
* @param {BigNumberish} nftTokenAmount - The amount of tokens to deposit (ERC1155-specific).
* @param {BigNumberish} nftTokenAmount - The amount of tokens to deposit, set to 1 for erc721.
* @param {BasketManagerId} [basketManagerId] - The basket to release the NFT from.
* @param {number} [chainId] - Optional parameter that allows for the user to specify which network to write to.
* @return {Promise<ContractTransaction>} Details from the transaction.
* @return {Promise<ContractTransaction>}
*

@@ -424,3 +419,3 @@ * {@link https://github.com/Charged-Particles/charged-particles-universe/blob/a2c54a8b125e416ff600b731d2d13576223bfac7/contracts/ChargedParticles.sol#L570 Solidity Contract Method}

/**
* Sets a timelock on the ability to release the assets of a particle.
* Sets a timelock on the ability to release assets of a particle.
*

@@ -461,4 +456,4 @@ * @memberof NFT

/**
* Sets the custom configuration for creators of proton-based NFTs
* Must be called by account that created and owns the particle
* Sets the custom configuration for creators of proton-based NFTs.
* Must be called by account that created and owns the particle.
*

@@ -476,4 +471,4 @@ * @memberof NFT

/**
* Sets a custom receiver address for the creator annuities
* Must be called by account that created and owns the particle
* Sets a custom receiver address for the creator annuities.
* Must be called by account that created and owns the particle.
*

@@ -480,0 +475,0 @@ * @memberof NFT

@@ -48,3 +48,3 @@ import { ethers, providers, Signer } from 'ethers';

/**
* A string enum that identifies which wallet manager to use. Used in functions like `release` and `discharge`
* A string enum that identifies which wallet manager to use.
* @typedef {WalletManagerId}

@@ -55,3 +55,3 @@ * @property {string} ManagerId - possible values: `aave`, `aave.B`, `generic`, `generic.B`

/**
* A string enum that identifies which wallet manager to use. Used in functions like `release` and `discharge`
* A string enum that identifies which wallet manager to use.
* @typedef {BasketManagerId}

@@ -83,8 +83,8 @@ * @property {string} ManagerId - possible values: `generic`, `generic.B`

* @typedef {Object} TransactionOverride
* @property {boolean} [from]
* @property {boolean} [value]
* @property {boolean} [gasPrice]
* @property {boolean} [gasLimit]
* @property {boolean} [blockTag]
* @property {boolean} [nonce]
* @property {string} [from]
* @property {number} [value]
* @property {number} [gasPrice]
* @property {number} [gasLimit]
* @property {number} [blockTag]
* @property {number} [nonce]
*/

@@ -99,1 +99,3 @@ export declare type TransactionOverride = {

};
export declare const walletManagerCheck: (managerId: ManagerId) => void;
export declare const basketManagerCheck: (managerId: ManagerId) => void;

@@ -7,4 +7,5 @@ import 'dotenv/config';

export declare const alchemyMainnetKey: string;
export declare const alchemyGoerliKey: string;
export declare const alchemyMumbaiKey: string;
export declare const alchemyPolygonKey: string;
export declare const alchemyKovanKey: string;

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

"author": "Firma Lux, Inc.",
"version": "0.1.2",
"version": "0.1.5",
"license": "ISC",

@@ -44,10 +44,17 @@ "main": "dist/index.js",

"lint": "tsdx lint",
"prepare": "tsdx build"
"prepare": "tsdx build",
"pub:beta": "yarn publish --tag beta --access public",
"pub:latest": "yarn publish --tag latest --access public"
},
"peerDependencies": {},
"devDependencies": {
"@nomiclabs/hardhat-ethers": "^2.1.0",
"@types/lodash": "^4.14.182",
"@uniswap/sdk-core": "^3.0.1",
"dotenv": "^16.0.1",
"ganache-cli": "^6.12.2",
"hardhat": "^2.10.1",
"husky": "^8.0.1",
"jest-environment-hardhat": "^1.1.8",
"process": "^0.11.10",
"rollup-plugin-analyzer": "^4.0.0",

@@ -60,4 +67,4 @@ "tsdx": "^0.14.1",

"dependencies": {
"@charged-particles/protocol-subgraph": "^1.3.19",
"ethers": "^5.6.6",
"@charged-particles/protocol-subgraph": "1.3.20",
"ethers": "^5.6.9",
"lodash": "^4.17.21",

@@ -64,0 +71,0 @@ "lodash-es": "^4.17.21"

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

* @constructs ChargedConstructor
* @param {ChargedConstructor} params - Charged parameter object.
* @param {ChargedConstructor} params - Charged constructor object.
* @example

@@ -56,3 +56,2 @@ * const charged = new Charged({providers: window.ethereum});

if (providers) {
if (Array.isArray(providers)) {

@@ -108,2 +107,6 @@ providers?.forEach(({ network, service }) => {

public setExternalProvider(provider: ethers.providers.Provider) {
this.state.providers['external'] = provider;
}
private getValidatedParams(params: ChargedConstructor) {

@@ -110,0 +113,0 @@ const validParameters = ['providers', 'signer', 'config'];

@@ -144,3 +144,2 @@ import { Contract, ethers } from 'ethers';

const { providers } = this.state;
const chainIds = Object.keys(providers);

@@ -150,15 +149,10 @@ const chainIdsLength = chainIds.length;

if (chainIdsLength) {
if (chainIdsLength > 1 && network) {
if (chainIds.includes('external')) {
const externalProviderNetwork = await providers['external'].getNetwork()
return externalProviderNetwork.chainId;
} else if (chainIdsLength > 1 && network) {
return network; // specify network intent when more than one provider.
} else if (chainIdsLength == 1) {
const chainIdFromSingleProvider = chainIds[0]; // return the network of the single provider
if (chainIdFromSingleProvider == 'external') {
const externalProviderNetwork = await providers['external'].getNetwork()
return externalProviderNetwork.chainId;
}
else { return Number(chainIdFromSingleProvider) };
return Number(chainIdFromSingleProvider);
} else {

@@ -168,5 +162,6 @@ throw new Error('Please specify the targeted network');

} else {
throw new Error(`Could not fetch network: from supplied providers`);
throw new Error(`Could not fetch network from supplied providers`);
}
}
}
}
import { BigNumberish, ContractTransaction } from 'ethers';
import { ChargedState, ManagerId, defaultManagerId } from '../../types';
import BaseService from './baseService';
import {
ChargedState,
ManagerId,
defaultManagerId,
walletManagerCheck,
basketManagerCheck
} from '../../types';

@@ -91,3 +97,3 @@ /**

/**
* Gets the amount of asset tokens that have been deposited into the Particle.
* Gets the amount of an asset tokens deposited into the Particle.
*

@@ -101,2 +107,3 @@ * @memberof NFT

public async getMass(assetToken: string, walletManagerId: ManagerId = defaultManagerId) {
walletManagerCheck(walletManagerId);
const parameters = [

@@ -112,3 +119,3 @@ this.contractAddress,

/**
* Gets the amount of interest that the particle has generated.
* Gets the amount of interest generated by an asset.
*

@@ -123,2 +130,3 @@ * @memberof NFT

public async getCharge( assetToken: string, walletManagerId: ManagerId = defaultManagerId) {
walletManagerCheck(walletManagerId);
const parameters = [

@@ -134,3 +142,3 @@ this.contractAddress,

/**
* Gets the amount of LP Tokens that the Particle has generated.
* Gets the amount of LP Tokens that the Particle has generated for a particular asset.
*

@@ -145,2 +153,3 @@ * @memberof NFT

public async getKinectics( assetToken: string, walletManagerId: ManagerId = defaultManagerId) {
walletManagerCheck(walletManagerId);
const parameters = [

@@ -156,3 +165,3 @@ this.contractAddress,

/**
* Gets the total amount of ERC721 tokens that the Particle holds.
* Gets the ERC721 balance that the Particle holds.
*

@@ -163,5 +172,7 @@ * @memberof NFT

* @param {string} [basketManagerId] - The ID of the BasketManager to check.
* @return {BigNumber} - The NFT balance held by the Particle.
*
*/
public async getBonds(basketManagerId: ManagerId = defaultManagerId) {
basketManagerCheck(basketManagerId);
const parameters = [this.contractAddress, this.tokenId, basketManagerId];

@@ -172,3 +183,3 @@ return await this.fetchAllNetworks('chargedParticles', 'currentParticleCovalentBonds', parameters);

/**
* Gets the amount of creator annuities reserved for the creator for the specified NFT.
* Gets the 'creator annuities' for the specified NFT.
*

@@ -187,8 +198,8 @@ * @memberof NFT

/**
* Get the address that receives creator annuities for a given Particle/ Defaults to creator address if it has not been redirected.
* Get the 'creators annuities' receiving address for a given Particle.
* Defaults to creator address if not modified.
*
* @memberof NFT
*
* @return {address} - The address of the creator.
* @return {number} - The percentage amount of annuities reserved for the creator.
* @return {address} - Receiving 'creator annuities' address.
*

@@ -202,3 +213,3 @@ */

/**
* Gets the tokenUri using the tokenId and contractAddress of the Particle.
* Get the token URI.
*

@@ -220,8 +231,8 @@ * @memberof NFT

/**
* Gets the Discharge timelock state of the Particle.
* Get the discharge timelock state of the Particle.
*
* @memberof NFT
*
* @param {string} sender - The address approved for Discharging assets from the Particle.
* @return {[boolean, boolean, BigNumber, BigNumber]} - [allowFromAll, isApproved, timelock, empLockExpiry]
* @param {string} sender - The address approved for discharging assets from the Particle.
* @return {[boolean, boolean, BigNumber, BigNumber]} - [allowFromAll, isApproved, timelock, tempLockExpiry]
*/

@@ -238,8 +249,8 @@ public async getDischargeState(sender: string) {

/**
* Gets the Discharge timelock state of the Particle.
* Gets the release timelock state of the Particle.
*
* @memberof NFT
*
* @param {string} sender - The address approved for Releasing assets from the Particle.
* @return {[boolean, boolean, BigNumber, BigNumber]} - [allowFromAll, isApproved, timelock, empLockExpiry]
* @param {string} sender - The address approved for releasing assets from the Particle.
* @return {[boolean, boolean, BigNumber, BigNumber]} - [allowFromAll, isApproved, timelock, tempLockExpiry]
*

@@ -257,11 +268,8 @@ */

/**
* Gets the Bonds Timelock state of the Particle.
* Gets the bonds(ERC721) timelock state of the Particle.
*
* @memberof NFT
*
* @param {string} sender - The address approved for removing Bond assets from the Particle.
* @return {boolean} allowFromAll
* @return {boolean} isApproved
* @return {BigNumber} timelock
* @return {BigNumber} empLockExpiry
* @param {string} sender - The address approved for removing bond timelock from the Particle.
* @return {[boolean, boolean, BigNumber, BigNumber]} - [allowFromAll, isApproved, timelock, tempLockExpiry]
*

@@ -283,22 +291,22 @@ */

/**
* Fund particle with asset token
* Must be called by the account providing the asset. Account must also approve THIS contract as operator as asset.
* Deposit an ERC20 asset into the Particle.
* Must be called by the account providing the asset.
*
* If you are getting gas limit errors this may be because you forgot to approve the contract as operator of asset
* Asset owner must approve the Charged Particle contract as operator of the asset.
* If you are getting gas limit errors this may be because you forgot to approve the contract as operator of asset.
*
* @memberof NFT
*
* @param {string} assetToken - The Address of the Asset Token being used
* @param {BigNumberish} assetAmount - The Amount of Asset Token to Energize the Token with
* @param {WalletManagerId} [walletManagerId] - The Asset-Pair to Energize the Token with
* @param {number} [chainId] - Optional parameter that allows for the user to specify which network to write to
* @param {string} assetToken - Address of the asset token being used.
* @param {BigNumberish} assetAmount - Amount of asset token to energize the token with.
* @param {WalletManagerId} [walletManagerId] - The Asset-Pair to Energize the Token with.
* @param {number} [chainId] - Optional parameter that allows for the user to specify which network to write to.
* @param {string} [referrer]
* @return {Promise<ContractTransaction>} A contract receipt from the transaction.
* @return {Promise<ContractTransaction>}
*
* {@link https://github.com/Charged-Particles/charged-particles-universe/blob/a2c54a8b125e416ff600b731d2d13576223bfac7/contracts/ChargedParticles.sol#L267 Solidity Contract Method}
* @example
* // Asset amount expects a big numberish type. If you do not supply a
* // big number object, ethers will assume you are working in wei.
* // Asset amount expects a big numberish type. If you do not supply a big number object, ethers will assume you are working in wei.
*
* // Deposits 20 USDC tokens into our particle that will accrue interest.
*
* const USDCoinAddress = '0xUSDC';

@@ -310,7 +318,4 @@ * const result = await nft.energize(

* );
* // Or, deposit assets that will not accrue interest
* // or assets that are not supported by our yield generating protocols (e.g. aave)
*
* // For example, we will energize our particle with 20 monkey coins
* // This will not generate interest.
* // Deposit assets that will not accrue interest.
* const monkeyCoinAddress = '0xMONKEY';

@@ -330,2 +335,4 @@ * const result = await nft.energize(

): Promise<ContractTransaction> {
walletManagerCheck(walletManagerId);
const signerNetwork = await this.getSignerConnectedNetwork(chainId);

@@ -351,4 +358,4 @@ await this.bridgeNFTCheck(signerNetwork);

/**
* Allows the owner or operator of the token to collect or transfer the interest generated from the token
* without removing the underlying asset that is held within the token.
* Allows the owner or operator of the token to collect or transfer the interest generated from an Aave compatible token.
* The underlying asset amount will not be moved.
*

@@ -360,4 +367,4 @@ * @memberof NFT

* @param {WalletManagerId} [walletManagerId] - The wallet manager of that assets to discharge from the token.
* @param {number} [chainId] - Optional parameter that allows for the user to specify which network to write to.j
* @return {Promise<ContractTransaction>} A receipt from the contract transaction.
* @param {number} [chainId] - Optional parameter that allows for the user to specify which network to write to.
* @return {Promise<ContractTransaction>}
*

@@ -391,5 +398,5 @@ * {@link https://github.com/Charged-Particles/charged-particles-universe/blob/a2c54a8b125e416ff600b731d2d13576223bfac7/contracts/ChargedParticles.sol#L310 Solidity Contract Method}

): Promise<ContractTransaction> {
walletManagerCheck(walletManagerId);
const signerNetwork = await this.getSignerConnectedNetwork(chainId);
await this.bridgeNFTCheck(signerNetwork);

@@ -413,3 +420,3 @@

/**
* Allows the owner or operator of the Token to collect or transfer a specific amount of the interest
* Allows the owner or operator of the token to collect or transfer a specific amount of the interest
* generated from the token without removing the underlying Asset that is held within the token.

@@ -424,3 +431,3 @@ *

* @param {number} [chainId] - Optional parameter that allows for the user to specify which network to write to.
* @return {Promise<ContractTransaction>} Details from the transaction.
* @return {Promise<ContractTransaction>}
*

@@ -436,5 +443,4 @@ * {@link https://github.com/Charged-Particles/charged-particles-universe/blob/a2c54a8b125e416ff600b731d2d13576223bfac7/contracts/ChargedParticles.sol#L351 Solidity Contract Method}

): Promise<ContractTransaction> {
walletManagerCheck(walletManagerId);
const signerNetwork = await this.getSignerConnectedNetwork(chainId);
await this.bridgeNFTCheck(signerNetwork);

@@ -459,3 +465,3 @@

/**
* Allows the Creator of the Token to collect or transfer a their portion of the interest (if any)
* Allows the creator of the token to collect or transfer a portion of the interest (if any)
* generated from the token without removing the underlying Asset that is held within the token.

@@ -465,8 +471,8 @@ *

*
* @param {string} receiver - The address to receive the discharged asset tokens
* @param {string} assetToken - The address of the asset token being discharged
* @param {BigNumberish} assetAmount - The specific amount of asset token to discharge from the particle
* @param {WalletManagerId} [walletManagerId] - The wallet manager of the assets to discharge from the token
* @param {number} [chainId] - Optional parameter that allows for the user to specify which network to write to
* @return {Promise<ContractTransaction>} A receipt from the transaction
* @param {string} receiver - The address to receive the discharged asset tokens.
* @param {string} assetToken - The address of the asset token being discharged.
* @param {BigNumberish} assetAmount - The specific amount of asset token to discharge from the particle.
* @param {WalletManagerId=} [walletManagerId] - The wallet manager of the assets to discharge from the token.
* @param {number} [chainId] - Optional parameter that allows for the user to specify which network to write to.
* @return {Promise<ContractTransaction>}
*

@@ -482,2 +488,3 @@ * {@link https://github.com/Charged-Particles/charged-particles-universe/blob/a2c54a8b125e416ff600b731d2d13576223bfac7/contracts/ChargedParticles.sol#L393 Solidity Contract Method}

): Promise<ContractTransaction> {
walletManagerCheck(walletManagerId);
const signerNetwork = await this.getSignerConnectedNetwork(chainId);

@@ -512,3 +519,3 @@ await this.bridgeNFTCheck(signerNetwork);

* @param {number} [chainId] - Optional parameter that allows for the user to specify which network to write to.
* @return {Promise<ContractTransaction>} Details from the transaction.
* @return {Promise<ContractTransaction>}
*

@@ -533,2 +540,3 @@ * {@link https://github.com/Charged-Particles/charged-particles-universe/blob/a2c54a8b125e416ff600b731d2d13576223bfac7/contracts/ChargedParticles.sol#L440 Solidity Contract Method}

): Promise<ContractTransaction> {
walletManagerCheck(walletManagerId);
const signerNetwork = await this.getSignerConnectedNetwork(chainId);

@@ -557,8 +565,8 @@ await this.bridgeNFTCheck(signerNetwork);

*
* @param {string} receiver - The address to receive the released asset tokens
* @param {string} assetToken - The address of the asset token being released
* @param {BigNumberish} assetAmount - The specific amount of asset token to release from the particle
* @param {WalletManagerId} [walletManagerId] - The wallet manager of the assets to release from the token
* @param {number} [chainId] - Optional parameter that allows for the user to specify which network to write to
* @return {Promise<ContractTransaction>} A receipt from the transaction
* @param {string} receiver - The address to receive the released asset tokens.
* @param {string} assetToken - The address of the asset token being released.
* @param {BigNumberish} assetAmount - The specific amount of asset token to release from the particle.
* @param {WalletManagerId} [walletManagerId] - The wallet manager of the assets to release from the token.
* @param {number} [chainId] - Optional parameter that allows for the user to specify which network to write to.
* @return {Promise<ContractTransaction>}
*

@@ -574,2 +582,3 @@ * {@link https://github.com/Charged-Particles/charged-particles-universe/blob/a2c54a8b125e416ff600b731d2d13576223bfac7/contracts/ChargedParticles.sol#L483 Solidity Contract Method}

): Promise<ContractTransaction> {
walletManagerCheck(walletManagerId);
const signerNetwork = await this.getSignerConnectedNetwork(chainId);

@@ -595,4 +604,4 @@ await this.bridgeNFTCheck(signerNetwork);

/**
* Deposit other NFT assets into the particle.
* Must be called by the account providing the asset. Account must approve THIS contract as operator of asset.
* Deposit an NFT assets into the particle.
* Must be called by the account providing the asset. The account must approve the Charged Particle contract as operator of asset.
*

@@ -603,3 +612,3 @@ * @memberof NFT

* @param {string} nftTokenId - The ID of the NFT token being deposited.
* @param {BigNumberish} nftTokenAmount - The amount of tokens to deposit (ERC1155-specific).
* @param {BigNumberish} nftTokenAmount - The amount of tokens to deposit, set to 1 for ERC271.
* @param {BasketManagerId} [basketManagerId] - The basket to deposit the NFT into.

@@ -638,2 +647,3 @@ * @param {number} [chainId] - Optional parameter that allows for the user to specify which network to write to.

): Promise<ContractTransaction> {
basketManagerCheck(basketManagerId);
const signerNetwork = await this.getSignerConnectedNetwork(chainId);

@@ -667,6 +677,6 @@ await this.bridgeNFTCheck(signerNetwork);

* @param {string} nftTokenId - The ID of the NFT token being released.
* @param {BigNumberish} nftTokenAmount - The amount of tokens to deposit (ERC1155-specific).
* @param {BigNumberish} nftTokenAmount - The amount of tokens to deposit, set to 1 for erc721.
* @param {BasketManagerId} [basketManagerId] - The basket to release the NFT from.
* @param {number} [chainId] - Optional parameter that allows for the user to specify which network to write to.
* @return {Promise<ContractTransaction>} Details from the transaction.
* @return {Promise<ContractTransaction>}
*

@@ -698,2 +708,3 @@ * {@link https://github.com/Charged-Particles/charged-particles-universe/blob/a2c54a8b125e416ff600b731d2d13576223bfac7/contracts/ChargedParticles.sol#L570 Solidity Contract Method}

): Promise<ContractTransaction> {
basketManagerCheck(basketManagerId);
const signerNetwork = await this.getSignerConnectedNetwork(chainId);

@@ -722,3 +733,3 @@ await this.bridgeNFTCheck(signerNetwork);

/**
* Sets a timelock on the ability to release the assets of a particle.
* Sets a timelock on the ability to release assets of a particle.
*

@@ -752,3 +763,2 @@ * @memberof NFT

);
}

@@ -819,8 +829,7 @@

);
}
/**
* Sets the custom configuration for creators of proton-based NFTs
* Must be called by account that created and owns the particle
* Sets the custom configuration for creators of proton-based NFTs.
* Must be called by account that created and owns the particle.
*

@@ -852,9 +861,8 @@ * @memberof NFT

parameters
)
);
}
/**
* Sets a custom receiver address for the creator annuities
* Must be called by account that created and owns the particle
* Sets a custom receiver address for the creator annuities.
* Must be called by account that created and owns the particle.
*

@@ -884,5 +892,4 @@ * @memberof NFT

parameters
)
);
}
}

@@ -52,3 +52,3 @@ import { ethers, providers, Signer } from 'ethers';

/**
* A string enum that identifies which wallet manager to use. Used in functions like `release` and `discharge`
* A string enum that identifies which wallet manager to use.
* @typedef {WalletManagerId}

@@ -60,3 +60,3 @@ * @property {string} ManagerId - possible values: `aave`, `aave.B`, `generic`, `generic.B`

/**
* A string enum that identifies which wallet manager to use. Used in functions like `release` and `discharge`
* A string enum that identifies which wallet manager to use.
* @typedef {BasketManagerId}

@@ -67,3 +67,3 @@ * @property {string} ManagerId - possible values: `generic`, `generic.B`

export const defaultManagerId: ManagerId = 'generic.B';
export const defaultManagerId: ManagerId = 'generic.B';

@@ -93,8 +93,8 @@ /**

* @typedef {Object} TransactionOverride
* @property {boolean} [from]
* @property {boolean} [value]
* @property {boolean} [gasPrice]
* @property {boolean} [gasLimit]
* @property {boolean} [blockTag]
* @property {boolean} [nonce]
* @property {string} [from]
* @property {number} [value]
* @property {number} [gasPrice]
* @property {number} [gasLimit]
* @property {number} [blockTag]
* @property {number} [nonce]
*/

@@ -108,2 +108,12 @@ export type TransactionOverride = {

nonce?: any
}
}
export const walletManagerCheck = (managerId: ManagerId) => {
const validWalletManagers = ['aave', 'aave.B', 'generic', 'generic.B'];
if (!validWalletManagers.includes(managerId)) {throw new Error('Provided a not supported wallet manager id.')};
};
export const basketManagerCheck = (managerId: ManagerId) => {
const validWalletManagers = ['generic', 'generic.B'];
if (!validWalletManagers.includes(managerId)) {throw new Error('Provided a not supported basket manager id.')};
};

@@ -24,2 +24,4 @@ import 'dotenv/config';

export const alchemyGoerliKey = getParamOrExit('ALCHEMY_GOERLI_KEY');
export const alchemyMumbaiKey = getParamOrExit('ALCHEMY_MUMBAI_KEY');

@@ -26,0 +28,0 @@

@@ -16,2 +16,3 @@ // ABIs

import mumbaiAddressesImport from '@charged-particles/protocol-subgraph/networks/mumbai.json';
import goerliAddressImport from '@charged-particles/protocol-subgraph/networks/goerli.json';

@@ -22,2 +23,3 @@ const mainnetAddresses:NetworkContractLocations = mainnetAddressesImport;

const mumbaiAddresses:NetworkContractLocations = mumbaiAddressesImport;
const goerliAddress:NetworkContractLocations = goerliAddressImport;

@@ -54,2 +56,3 @@ // Return correct ABI

case 1: return mainnetAddresses;
case 5: return goerliAddress;
case 42: return kovanAddresses;

@@ -56,0 +59,0 @@ case 137: return polygonAddresses;

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