@primitivefi/rmm-ethers
Advanced tools
Comparing version 0.0.11-beta.1 to 0.0.12-beta.1
@@ -9,6 +9,8 @@ import { LogDescription } from '@ethersproject/abi'; | ||
import { EthersProvider, EthersSigner } from './types'; | ||
import { BigNumber } from 'ethers'; | ||
import { BigNumber } from '@ethersproject/bignumber'; | ||
/** @internal */ | ||
export interface _TypedLogDescription<T> extends Omit<LogDescription, 'args'> { | ||
args: T; | ||
} | ||
/** @beta */ | ||
export declare class _RmmContract { | ||
@@ -19,4 +21,6 @@ readonly contract: Contract; | ||
} | ||
/** @internal */ | ||
export declare type _TypedRmmContract<T = unknown, U = unknown> = TypedContract<_RmmContract, T, U>; | ||
declare type BucketOfFunctions = Record<string, (...args: unknown[]) => never>; | ||
/** @internal */ | ||
export declare type _TypeSafeContract<T> = Pick<T, { | ||
@@ -27,3 +31,3 @@ [P in keyof T]: BucketOfFunctions extends T[P] ? never : P; | ||
} ? U : never>; | ||
declare type TypedContract<T, U, V> = _TypeSafeContract<T> & U & {}; | ||
declare type TypedContract<T, U, V> = _TypeSafeContract<T> & U & unknown; | ||
interface ManagerContract extends _TypedRmmContract<PrimitiveManager> { | ||
@@ -56,6 +60,4 @@ extractEvents(logs: Log[], name: 'Allocate'): _TypedLogDescription<{ | ||
} | ||
interface PositionRendererContract extends _TypedRmmContract<PositionRenderer> { | ||
} | ||
interface PositionDescriptorContract extends _TypedRmmContract<PositionDescriptor> { | ||
} | ||
declare type PositionRendererContract = _TypedRmmContract<PositionRenderer>; | ||
declare type PositionDescriptorContract = _TypedRmmContract<PositionDescriptor>; | ||
/** @internal */ | ||
@@ -62,0 +64,0 @@ export interface _RmmContracts { |
@@ -35,2 +35,3 @@ import { _RmmContractAddresses, _RmmContracts, _RmmDeploymentJSON } from './contracts'; | ||
declare type EthersRmmStoreOption = 'default'; | ||
/** @beta */ | ||
export interface EthersRmmConnectionOptional { | ||
@@ -44,2 +45,3 @@ /** | ||
} | ||
/** @internal */ | ||
export declare function _connectToNetwork(provider: EthersProvider, signer: EthersSigner | undefined, chainId: number): EthersRmmConnection; | ||
@@ -46,0 +48,0 @@ /** @internal */ |
@@ -38,3 +38,7 @@ import { EthersTransactionOverrides, EthersTransactionRequest } from '.'; | ||
} | ||
/** A ready to send transaction with generic types. */ | ||
/** | ||
* A ready to send transaction with generic types. | ||
* | ||
* @beta | ||
*/ | ||
export interface PopulatedRmmTransaction<P = unknown, T extends SentRmmTransaction = SentRmmTransaction> { | ||
@@ -41,0 +45,0 @@ /** Implementable populated transaction object. */ |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require("@ethersproject/contracts"),r=require("@primitivefi/rmm-sdk"),n=require("ethers/lib/utils"),i=require("@ethersproject/abstract-signer"),o=require("@ethersproject/logger"),a=require("web3-units"),c=(t=require("assert"))&&"object"==typeof t&&"default"in t?t.default:t,u=function(){function t(t,r,n){this.contract=new e.Contract(t,r,n)}return t.prototype.extractEvents=function(t,e){var r=this;return t.filter((function(t){return t.address===r.contract.address})).map((function(t){return r.contract.interface.parseLog(t)})).filter((function(t){return t.name===e}))},t}(),s={primitiveFactory:r.FactoryManager.ABI,primitiveManager:r.PeripheryManager.ABI,positionRenderer:r.PositionRendererManager.ABI,positionDescriptor:r.PositionDescriptorManager.ABI,primitiveEngine:r.Engine.ABI},f=function(t,e){return function(t,e){return Object.fromEntries(Object.entries(t).map((function(t){var r=t[0];return[r,e(t[1],r)]})))}(e.addresses,(function(e,r){return new u(e,s[r],t)}))};function p(t,e,r,n,i,o,a){try{var c=t[o](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,i)}function l(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var o=t.apply(e,r);function a(t){p(o,n,i,a,c,"next",t)}function c(t){p(o,n,i,a,c,"throw",t)}a(void 0)}))}}function h(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function d(t,e,r){return e&&h(t.prototype,e),r&&h(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function v(){return(v=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,g(t,e)}function m(t){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function g(t,e){return(g=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function w(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function _(t,e,r){return(_=w()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var i=new(Function.bind.apply(t,n));return r&&g(i,r.prototype),i}).apply(null,arguments)}function b(t){var e="function"==typeof Map?new Map:void 0;return(b=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return _(t,arguments,m(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),g(r,t)})(t)}var x,E,R=(function(t){var e=function(t){var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var i=Object.create((e&&e.prototype instanceof p?e:p).prototype),o=new E(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return{value:void 0,done:!0}}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var c=_(a,r);if(c){if(c===f)continue;return c}}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 u=s(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,o),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var f={};function p(){}function l(){}function h(){}var d={};c(d,i,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(R([])));y&&y!==e&&r.call(y,i)&&(d=y);var m=h.prototype=p.prototype=Object.create(d);function g(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){var n;this._invoke=function(i,o){function a(){return new e((function(n,a){!function n(i,o,a,c){var u=s(t[i],t,o);if("throw"!==u.type){var f=u.arg,p=f.value;return p&&"object"==typeof p&&r.call(p,"__await")?e.resolve(p.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(p).then((function(t){f.value=t,a(f)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}(i,o,n,a)}))}return n=n?n.then(a,a):a()}}function _(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,_(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var i=n.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function b(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 x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function R(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=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 o.next=o}}return{next:P}}function P(){return{value:void 0,done:!0}}return l.prototype=h,c(m,"constructor",h),c(h,"constructor",l),l.displayName=c(h,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===l||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,c(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},g(w.prototype),c(w.prototype,o,(function(){return this})),t.AsyncIterator=w,t.async=function(e,r,n,i,o){void 0===o&&(o=Promise);var a=new w(u(e,r,n,i),o);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},g(m),c(m,a,"Generator"),c(m,i,(function(){return this})),c(m,"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=R,E.prototype={constructor:E,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(x),!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 a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var c=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(c&&u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(a)},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),f},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),x(r),f}},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 i=n.arg;x(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:R(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}}(E={exports:{}}),E.exports),P={chainId:4,version:"8f32bf1f18a8aa99f5cdadda762848859ac92562",deploymentDate:1641426815622,_isDev:!1,startBlock:9940950,addresses:{primitiveFactory:"0x9462c3CBA453223C865a559e417a9677Ddf4E663",positionRenderer:"0xA96b4BcEb743607196A7D13fC6006745340E594F",positionDescriptor:"0xC31bf91214Dd213718136640075B3C02b540f5E8",primitiveManager:"0x7B327A50bFcC42E04a7DE50573F12574AE9ce7fd"}},S={chainId:5,version:"8f32bf1f18a8aa99f5cdadda762848859ac92562",deploymentDate:1641431431884,_isDev:!1,startBlock:9941257,addresses:{primitiveFactory:"0xc28E69C140fE578f1E22dEd2b0728601aaaC7a18",positionRenderer:"0xC262a03AECd5704B3f2E92b90D66aE6ED17361ee",positionDescriptor:"0x47BF926c0F1cD81e2009fF255D4435b0B276216B",primitiveManager:"0x4A32cb4dC3bF7973c828D7dC5Eab87d11e77d62D"}},T={chainId:42,version:"8f32bf1f18a8aa99f5cdadda762848859ac92562",deploymentDate:1641431491145,_isDev:!1,startBlock:29121097,addresses:{primitiveFactory:"0xD3fE1455Cc6c8A4706433e598174eC29bD6DeB94",positionRenderer:"0x8a7F79fC8eedF41bd65430C0E75291c6eBd91AeA",positionDescriptor:"0xc82E6e0475d95a589f165Ab53bad754a2cb73A1B",primitiveManager:"0x6F10fc808D191341B8eb52879BD41eCa5Cf08024"}},k=["deploymentDate"],L=((x={})[P.chainId]=P,x[S.chainId]=S,x[T.chainId]=T,x),O=function(t,e,r,n){var i=n.deploymentDate,o=function(t,e){if(null==t)return{};var r,n,i={},o=Object.keys(t);for(n=0;n<o.length;n++)e.indexOf(r=o[n])>=0||(i[r]=t[r]);return i}(n,k);return v({provider:t,signer:e,deploymentDate:new Date(i),_contracts:r},o)},C=function(t){return t._contracts},A=function(t){if(i.Signer.isSigner(t)){if(null==t||!t.provider)throw new Error("No provider");return[t.provider,t]}return[t,void 0]};function F(t,e,r){var n=L[r];if(!n)throw new Error("No deployment found for chainId: "+r);var i=n;return O(t,e,f(null!=e?e:t,i),i)}var D,I=function(){var t=l(R.mark((function t(e){var r,n,i;return R.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=A(e),n=r[0],i=r[1],t.next=3,n.getNetwork();case 3:return t.abrupt("return",F(n,i,t.sent.chainId));case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),B=function(){function t(t,e){void 0===e&&(e=a.parseWei(0)),this.pool=t,this.liquidity=e}var e=t.prototype;return e.valueOf=function(t){switch(t){case r.PoolSides.RISKY:return this.value.values[0];case r.PoolSides.STABLE:return this.value.values[1];case r.PoolSides.RMM_LP:return this.totalValue}},e.equals=function(t){return this.liquidity.eq(t.liquidity)},e.add=function(e){return new t(this.pool,this.liquidity.add(e.liquidity))},e.sub=function(e){var r=e.liquidity;return new t(this.pool,this.liquidity.gt(r)?this.liquidity.sub(r):a.parseWei(0))},d(t,[{key:"isEmpty",get:function(){return this.liquidity.raw.isZero()}},{key:"balance0",get:function(){return this.pool.liquidityQuote(this.liquidity,r.PoolSides.RMM_LP).delRisky}},{key:"balance1",get:function(){return this.pool.liquidityQuote(this.liquidity,r.PoolSides.RMM_LP).delStable}},{key:"value",get:function(){var t,e,r,n;return this.pool.getCurrentLiquidityValue(null!=(t=null!=(e=null==(r=this.pool.referencePriceOfRisky)?void 0:r.float)?e:null==(n=this.pool.reportedPriceOfRisky)?void 0:n.float)?t:0)}},{key:"totalValue",get:function(){return this.value.valuePerLiquidity.mul(this.liquidity).div(a.parseWei(1))}}]),t}(),j={status:"pending"},q=function(t){return{status:"failed",rawReceipt:t}},M=function(t,e,r){return v({status:"succeeded",rawReceipt:t,details:e},r?{toString:r}:{})},N=function(t){return t.send()},G=function(){function t(t){this._populate=t}var e=t.prototype;return e.allocate=function(){var t=l(R.mark((function t(e,r){return R.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this._populate.allocate(e,r).then(N));case 1:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),e.remove=function(){var t=l(R.mark((function t(e,r){return R.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this._populate.remove(e,r).then(N));case 1:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),e.safeTransfer=function(){var t=l(R.mark((function t(e,r){return R.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this._populate.safeTransfer(e,r).then(N));case 1:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),e.safeBatchTransfer=function(){var t=l(R.mark((function t(e,r){return R.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this._populate.safeBatchTransfer(e,r).then(N));case 1:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),e.createEngine=function(){var t=l(R.mark((function t(e,r){return R.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this._populate.createEngine(e,r).then(N));case 1:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),t}();(D=exports._RawErrorReason||(exports._RawErrorReason={})).TRANSACTION_FAILED="transaction failed",D.TRANSACTION_CANCELLED="cancelled",D.TRANSACTION_REPLACED="replaced",D.TRANSACTION_REPRICED="repriced";var U=function(t,e){return e in t},W=function(){function t(t,e,r){this.rawSentTransaction=t,this._connection=e,this._parse=r}var e=t.prototype;return e._receiptFrom=function(t){return t?t.status?M(t,this._parse(t),void 0):q(t):j},e._waitForRawReceipt=function(){var t=l(R.mark((function t(e){return R.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.rawSentTransaction.wait(e);case 3:return t.abrupt("return",t.sent);case 6:if(t.prev=6,t.t0=t.catch(0),!(t.t0 instanceof Error)){t.next=11;break}if(!U(r=t.t0,"code")||r.code!==o.ErrorCode.CALL_EXCEPTION||!U(r,"reason")||r.reason!==exports._RawErrorReason.TRANSACTION_FAILED){t.next=11;break}return t.abrupt("return",t.t0.receipt);case 11:throw t.t0;case 12:case"end":return t.stop()}var r}),t,this,[[0,6]])})));return function(e){return t.apply(this,arguments)}}(),e.getReceipt=function(){var t=l(R.mark((function t(){return R.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,this._waitForRawReceipt(0);case 3:return t.t1=t.sent,t.abrupt("return",t.t0._receiptFrom.call(t.t0,t.t1));case 5:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),e.waitForReceipt=function(){var t=l(R.mark((function t(){var e;return R.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,this._waitForRawReceipt();case 3:if(t.t1=t.sent,"pending"!==(e=t.t0._receiptFrom.call(t.t0,t.t1)).status){t.next=7;break}throw new Error("Still pending");case 7:return t.abrupt("return",e);case 8:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),t}(),V=function(){function t(t,e,r){this.rawPopulatedTransaction=t,this._connection=e,this._parse=r}return t.prototype.send=function(){var t=l(R.mark((function t(){return R.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=W,t.next=3,this._connection.signer.sendTransaction(this.rawPopulatedTransaction);case 3:return t.t1=t.sent,t.t2=this._connection,t.t3=this._parse,t.abrupt("return",new t.t0(t.t1,t.t2,t.t3));case 7:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),t}(),Y=function(){function t(t){this._readable=t}var e=t.prototype;return e._wrap=function(t){return new V(t,this._readable.connection,(function(){}))},e._wrapPositionChange=function(t,e){var n=C(this._readable.connection).primitiveManager;return new V(e,this._readable.connection,(function(e){var i=e.logs,o=!1;try{o=n.extractEvents(i,"Create").map((function(e){return e.args.poolId===t.pool.poolId}))[0]}catch(t){}var a=(o?[new B(t.pool)]:n.extractEvents(i,"Allocate").map((function(e){return new B(t.pool,r.weiToWei(e.args.delLiquidity.toString()))})))[0];return a||(a=n.extractEvents(i,"Remove").map((function(e){return new B(t.pool,r.weiToWei(e.args.delLiquidity.toString()))}))[0]),{params:t,newPosition:a}}))},e._applyGasLimit=function(){var t=l(R.mark((function t(e,r,n){var i,o,a,c;return R.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null!=(o=(i=function(){return v({to:e.address,data:r.calldata,value:r.value},n)})())&&o.gasLimit){t.next=8;break}return t.next=5,e.signer.estimateGas(o);case 5:a=t.sent.mul(150).div(100),n=v({},n,{gasLimit:a});case 8:return c=i(),t.next=11,e.signer.populateTransaction(c);case 11:return t.abrupt("return",t.sent);case 13:case"end":return t.stop()}}),t)})));return function(e,r,n){return t.apply(this,arguments)}}(),e.allocate=function(){var t=l(R.mark((function t(e,n){var i,o;return R.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=C(this._readable.connection),o=i.primitiveManager,t.next=3,this._applyGasLimit(o.contract,r.PeripheryManager.allocateCallParameters(e.pool,e.options),n);case 3:return t.abrupt("return",this._wrapPositionChange(e,t.sent));case 5:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),e.remove=function(){var t=l(R.mark((function t(e,n){var i,o;return R.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=C(this._readable.connection),o=i.primitiveManager,t.next=3,this._applyGasLimit(o.contract,r.PeripheryManager.removeCallParameters(e.pool,e.options),n);case 3:return t.abrupt("return",this._wrapPositionChange(e,t.sent));case 5:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),e.createEngine=function(){var t=l(R.mark((function t(e,n){var i,o;return R.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=C(this._readable.connection),o=i.primitiveFactory,t.next=3,this._applyGasLimit(o.contract,{calldata:r.FactoryManager.encodeDeploy(e.risky,e.stable),value:a.toBN(0)._hex},n);case 3:return t.abrupt("return",new V(t.sent,this._readable.connection,(function(t){return{params:e,engine:""}})));case 5:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),e.safeTransfer=function(){var t=l(R.mark((function t(e,n){var i,o;return R.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=C(this._readable.connection),o=i.primitiveManager,t.next=3,this._applyGasLimit(o.contract,r.PeripheryManager.safeTransferFromParameters(e.options),n);case 3:return t.abrupt("return",this._wrap(t.sent));case 5:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),e.safeBatchTransfer=function(){var t=l(R.mark((function t(e,n){var i,o;return R.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=C(this._readable.connection),o=i.primitiveManager,t.next=3,this._applyGasLimit(o.contract,r.PeripheryManager.batchTransferFromParameters(e.options),n);case 3:return t.abrupt("return",this._wrap(t.sent));case 5:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),t}(),Q=function(){function t(){this.logging=!1,this._loaded=!1,this._listeners=new Set}var e=t.prototype;return e.start=function(){var t=this,e=this._doStart();return function(){e(),t._cancelUpdateIfScheduled()}},e._cancelUpdateIfScheduled=function(){void 0!==this._updateTimeoutId&&clearTimeout(this._updateTimeoutId)},e._scheduleUpdate=function(){var t=this;this._cancelUpdateIfScheduled(),this._updateTimeoutId=setTimeout((function(){t._updateTimeoutId=void 0,t._update()}),35e3)},e._logUpdate=function(t,e,r){return this.logging&&console.log(t+" updated to "+(r?r(e):e)),e},e._updateIfChanged=function(t,e,r,n,i){return void 0===n||t(r,n)?r:this._logUpdate(e,n,i)},e._reduce=function(t,e){return{}},e._derive=function(t){return function(t){if(null==t)throw new TypeError("Cannot destructure undefined")}(t),{}},e._reduceDerived=function(t,e){return{}},e._notify=function(t){var e=this;[].concat(this._listeners).forEach((function(r){e._listeners.has(r)&&r(t)}))},e.subscribe=function(t){var e,r=this,n=(e=t,function(){return e.apply(void 0,arguments)});return this._listeners.add(n),function(){r._listeners.delete(n)}},e._load=function(){},e._update=function(t,e){c(this._baseState&&this._derivedState);var r,n,i=this.state;t&&(this._baseState=this._reduce(this._baseState,t)),this._derivedState=this._reduceDerived(this._derivedState,this._derive(this._baseState)),e&&(c(this._extraState),this._extraState=this._reduceExtra(this._extraState,e)),this._scheduleUpdate(),this._notify({newState:this.state,oldState:i,stateChange:(r=this.state,n=i,Object.fromEntries(Object.entries(r).filter((function(t){return t[1]!==n[t[0]]}))))})},d(t,[{key:"state",get:function(){return Object.assign({},this._baseState,this._derivedState,this._extraState)}}]),t}(),J=function(t){function e(e,r,n){var i;return(i=t.call(this,r)||this).name=e,i.failedReceipt=n,i}return y(e,t),e}(b(Error));function K(t){var e=Buffer.from(t.substring(29),"base64").toString();return JSON.parse(e)}function X(t){var e=K(t).properties,n=e.invariant,i={address:e.stableAddress,name:e.stableName,symbol:e.stableSymbol,decimals:e.stableDecimals},o={strike:e.strike,sigma:e.sigma,maturity:e.maturity,lastTimestamp:e.lastTimestamp,gamma:e.gamma},a={reserveRisky:e.reserveRisky,reserveStable:e.reserveStable,liquidity:e.liquidity};return new r.Pool(e.chainId,e.factory,v({},{address:e.riskyAddress,name:e.riskyName,symbol:e.riskySymbol,decimals:e.riskyDecimals}),v({},i),v({},o),v({},a),n,void 0)}var Z=function(){function t(t){this.connection=t}t._from=function(e){return new t(e)},t.connect=function(){var e=l(R.mark((function e(r){return R.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=t,e.next=3,I(r);case 3:return e.t1=e.sent,e.abrupt("return",e.t0._from.call(e.t0,e.t1));case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();var e=t.prototype;return e.getPool=function(t,e){return C(this.connection).primitiveManager.contract.uri(t).then(X)},e.getLiquidityBalance=function(t,e,n){return C(this.connection).primitiveManager.contract.balanceOf(e,t).then((function(t){return r.weiToWei(t.toString())}))},e.getPosition=function(t,e,r){return this.getLiquidityBalance(t.poolId,e,r).then((function(e){return new B(t,e)}))},e.getEngine=function(t,e,r){return C(this.connection).primitiveFactory.contract.getEngine(n.getAddress(t),n.getAddress(e)).then((function(t){return t}))},t}(),z=function(t){function e(e,r){return t.call(this,"EthersTransactionFailedError",e,r)||this}return y(e,t),e}(J),H=function(){var t=l(R.mark((function t(e){var r;return R.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.waitForReceipt();case 2:if("succeeded"===(r=t.sent).status){t.next=5;break}throw new z("Transaction failed",r);case 5:return t.abrupt("return",r.details);case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();exports.EthersRmm=function(){function t(t){this._readable=t,this.connection=t.connection,this.populate=new Y(t),this.send=new G(this.populate)}t._from=function(e){return new t(Z._from(e))},t.connect=function(){var e=l(R.mark((function e(r){return R.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,I(r);case 2:return e.abrupt("return",t._from(e.sent));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();var e=t.prototype;return e.allocate=function(t,e){return this.send.allocate(t,e).then(H)},e.createPool=function(t,e){if(!t.options.createPool)throw new Error("Attempting to create pool without flagging createPool.");return this.send.allocate(t,e).then(H)},e.remove=function(t,e){return this.send.remove(t,e).then(H)},e.safeTransfer=function(t,e){return this.send.safeTransfer(t,e).then(H)},e.safeBatchTransfer=function(t,e){return this.send.safeBatchTransfer(t,e).then(H)},e.createEngine=function(t,e){return this.send.createEngine(t,e).then(H)},e.getPool=function(t,e){return this._readable.getPool(t,e)},e.getLiquidityBalance=function(t,e,r){return this._readable.getLiquidityBalance(t,e,r)},e.getPosition=function(t,e,r){return this._readable.getPosition(t,e,r)},e.getEngine=function(t,e,r){return this._readable.getEngine(t,e,r)},t}(),exports.EthersTransactionFailedError=z,exports.PopulatableEthersRmm=Y,exports.PopulatedEthersSignerTransaction=V,exports.Position=B,exports.ReadableEthersRmm=Z,exports.RmmStore=Q,exports.SendableEthersRmm=G,exports.SentEthersRmmTransaction=W,exports.TransactionFailedError=J,exports._RmmContract=u,exports._RmmContractAbis=s,exports._connect=I,exports._connectToContracts=f,exports._connectToDeployment=function(t,e){var r=A(e);return O(r[0],r[1],f(e,t),t)},exports._connectToNetwork=F,exports._failedReceipt=q,exports._getContracts=C,exports._pendingReceipt=j,exports._successfulReceipt=M,exports.connectionFrom=O,exports.parseTokenURI=K,exports.poolify=X; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require("@ethersproject/contracts"),r=require("@primitivefi/rmm-sdk"),n=require("ethers/lib/utils"),i=require("@ethersproject/abstract-signer"),o=require("@ethersproject/logger"),a=require("web3-units"),c=(t=require("assert"))&&"object"==typeof t&&"default"in t?t.default:t,u=function(){function t(t,r,n){this.contract=new e.Contract(t,r,n)}return t.prototype.extractEvents=function(t,e){var r=this;return t.filter((function(t){return t.address===r.contract.address})).map((function(t){return r.contract.interface.parseLog(t)})).filter((function(t){return t.name===e}))},t}(),s={primitiveFactory:r.FactoryManager.ABI,primitiveManager:r.PeripheryManager.ABI,positionRenderer:r.PositionRendererManager.ABI,positionDescriptor:r.PositionDescriptorManager.ABI,primitiveEngine:r.Engine.ABI},p=function(t,e){return function(t,e){return Object.fromEntries(Object.entries(t).map((function(t){var r=t[0];return[r,e(t[1],r)]})))}(e.addresses,(function(e,r){return new u(e,s[r],t)}))};function f(t,e,r,n,i,o,a){try{var c=t[o](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,i)}function l(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var o=t.apply(e,r);function a(t){f(o,n,i,a,c,"next",t)}function c(t){f(o,n,i,a,c,"throw",t)}a(void 0)}))}}function h(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function d(t,e,r){return e&&h(t.prototype,e),r&&h(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function v(){return(v=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,g(t,e)}function m(t){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function g(t,e){return(g=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function w(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function b(t,e,r){return(b=w()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var i=new(Function.bind.apply(t,n));return r&&g(i,r.prototype),i}).apply(null,arguments)}function _(t){var e="function"==typeof Map?new Map:void 0;return(_=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return b(t,arguments,m(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),g(r,t)})(t)}var x,E,R,P=(function(t){var e=function(t){var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var i=Object.create((e&&e.prototype instanceof f?e:f).prototype),o=new E(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return{value:void 0,done:!0}}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var c=b(a,r);if(c){if(c===p)continue;return c}}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 u=s(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===p)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,o),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var p={};function f(){}function l(){}function h(){}var d={};c(d,i,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(R([])));y&&y!==e&&r.call(y,i)&&(d=y);var m=h.prototype=f.prototype=Object.create(d);function g(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){var n;this._invoke=function(i,o){function a(){return new e((function(n,a){!function n(i,o,a,c){var u=s(t[i],t,o);if("throw"!==u.type){var p=u.arg,f=p.value;return f&&"object"==typeof f&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(f).then((function(t){p.value=t,a(p)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}(i,o,n,a)}))}return n=n?n.then(a,a):a()}}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 p;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,p;var i=n.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,p):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,p)}function _(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 x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function R(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=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 o.next=o}}return{next:P}}function P(){return{value:void 0,done:!0}}return l.prototype=h,c(m,"constructor",h),c(h,"constructor",l),l.displayName=c(h,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===l||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,c(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},g(w.prototype),c(w.prototype,o,(function(){return this})),t.AsyncIterator=w,t.async=function(e,r,n,i,o){void 0===o&&(o=Promise);var a=new w(u(e,r,n,i),o);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},g(m),c(m,a,"Generator"),c(m,i,(function(){return this})),c(m,"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=R,E.prototype={constructor:E,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(x),!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 a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var c=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(c&&u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,p):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),p},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),x(r),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;x(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:R(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}}(R={exports:{}}),R.exports),S={chainId:4,version:"642932c0e792512ccb255368ed617e8f2025fdbd",deploymentDate:1641777931437,_isDev:!1,startBlock:9964347,addresses:{primitiveFactory:"0xbE68437BB129b10633A7d9e0628727281de40C49",positionRenderer:"0x5C46888831454682C84e2e53FD8930496a7b3784",positionDescriptor:"0xeb7bb4762Fa44388881681137b89aAbb3049d25d",primitiveManager:"0x24f2a98B9B92c5D00C746bc07cFcc4BA26956F8b"}},k={chainId:5,version:"642932c0e792512ccb255368ed617e8f2025fdbd",deploymentDate:1641778055003,_isDev:!1,startBlock:6173423,addresses:{primitiveFactory:"0x0D4F091e3E0BD3426E941818410fB714B81a7932",positionRenderer:"0x0DC83Eb92fe1340570aE1aaDAac65eFA6cee1735",positionDescriptor:"0x24D8885AE2463C939551Ff69baef31Cab8391b62",primitiveManager:"0x06944AEf33c98a470bCA172dEc7dC0Ef341B4142"}},T={chainId:42,version:"642932c0e792512ccb255368ed617e8f2025fdbd",deploymentDate:1641777992035,_isDev:!1,startBlock:29183306,addresses:{primitiveFactory:"0xbf3275EA6E742D36e56b3AE65E1D032f60273Cf9",positionRenderer:"0x648a5436AE54f8649915EE265946534Bb6d0F081",positionDescriptor:"0x9eAa6c6e47E7F6aDa74e4c99817Ac954fF1BEae8",primitiveManager:"0xc3838B27b1dC67B4D2dd5beCE81d9214B2D9E657"}},L=["deploymentDate"],D={chainId:1337,version:"eae29cf6f43668459086b54893a4b8f1afadd069",deploymentDate:1641766852073,_isDev:!0,startBlock:13,addresses:{primitiveFactory:"0x7a7f6E5cDdF3E013D9351370777Ca95Dea552Dd4",positionRenderer:"0xD272f24427e98335c97cfDed7B9A7910FBD58D7C",positionDescriptor:"0x98F2F596537dd30AC0478590ec3cfB13b1471FfC",primitiveManager:"0xEe9E4aC3Bf1BC7203F0e1DD8a2578D1D25240969"}},F=v(((x={})[S.chainId]=S,x[k.chainId]=k,x[T.chainId]=T,x),null!==D?((E={})[D.chainId]=D,E):{}),O=function(t,e,r,n){var i=n.deploymentDate,o=function(t,e){if(null==t)return{};var r,n,i={},o=Object.keys(t);for(n=0;n<o.length;n++)e.indexOf(r=o[n])>=0||(i[r]=t[r]);return i}(n,L);return v({provider:t,signer:e,deploymentDate:new Date(i),_contracts:r},o)},A=function(t){return t._contracts},C=function(t){if(i.Signer.isSigner(t)){if(null==t||!t.provider)throw new Error("No provider");return[t.provider,t]}return[t,void 0]};function B(t,e,r){var n=F[r];if(!n)throw new Error("No deployment found for chainId: "+r);var i=n;return O(t,e,p(null!=e?e:t,i),i)}var I,j=function(){var t=l(P.mark((function t(e){var r,n,i;return P.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=C(e),n=r[0],i=r[1],t.next=3,n.getNetwork();case 3:return t.abrupt("return",B(n,i,t.sent.chainId));case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),q=function(){function t(t,e){void 0===e&&(e=a.parseWei(0)),this.pool=t,this.liquidity=e}var e=t.prototype;return e.valueOf=function(t){switch(t){case r.PoolSides.RISKY:return this.value.values[0];case r.PoolSides.STABLE:return this.value.values[1];case r.PoolSides.RMM_LP:return this.totalValue}},e.equals=function(t){return this.liquidity.eq(t.liquidity)},e.add=function(e){return new t(this.pool,this.liquidity.add(e.liquidity))},e.sub=function(e){var r=e.liquidity;return new t(this.pool,this.liquidity.gt(r)?this.liquidity.sub(r):a.parseWei(0))},d(t,[{key:"isEmpty",get:function(){return this.liquidity.raw.isZero()}},{key:"balance0",get:function(){return this.pool.liquidityQuote(this.liquidity,r.PoolSides.RMM_LP).delRisky}},{key:"balance1",get:function(){return this.pool.liquidityQuote(this.liquidity,r.PoolSides.RMM_LP).delStable}},{key:"value",get:function(){var t,e,r,n;return this.pool.getCurrentLiquidityValue(null!=(t=null!=(e=null==(r=this.pool.referencePriceOfRisky)?void 0:r.float)?e:null==(n=this.pool.reportedPriceOfRisky)?void 0:n.float)?t:0)}},{key:"totalValue",get:function(){return this.value.valuePerLiquidity.mul(this.liquidity).div(a.parseWei(1))}}]),t}(),M={status:"pending"},N=function(t){return{status:"failed",rawReceipt:t}},G=function(t,e,r){return v({status:"succeeded",rawReceipt:t,details:e},r?{toString:r}:{})},U=function(t){return t.send()},W=function(){function t(t){this._populate=t}var e=t.prototype;return e.allocate=function(){var t=l(P.mark((function t(e,r){return P.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this._populate.allocate(e,r).then(U));case 1:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),e.remove=function(){var t=l(P.mark((function t(e,r){return P.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this._populate.remove(e,r).then(U));case 1:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),e.safeTransfer=function(){var t=l(P.mark((function t(e,r){return P.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this._populate.safeTransfer(e,r).then(U));case 1:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),e.safeBatchTransfer=function(){var t=l(P.mark((function t(e,r){return P.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this._populate.safeBatchTransfer(e,r).then(U));case 1:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),e.createEngine=function(){var t=l(P.mark((function t(e,r){return P.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this._populate.createEngine(e,r).then(U));case 1:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),t}();(I=exports._RawErrorReason||(exports._RawErrorReason={})).TRANSACTION_FAILED="transaction failed",I.TRANSACTION_CANCELLED="cancelled",I.TRANSACTION_REPLACED="replaced",I.TRANSACTION_REPRICED="repriced";var V=function(t,e){return e in t},Y=function(){function t(t,e,r){this.rawSentTransaction=t,this._connection=e,this._parse=r}var e=t.prototype;return e._receiptFrom=function(t){return t?t.status?G(t,this._parse(t),void 0):N(t):M},e._waitForRawReceipt=function(){var t=l(P.mark((function t(e){return P.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.rawSentTransaction.wait(e);case 3:return t.abrupt("return",t.sent);case 6:if(t.prev=6,t.t0=t.catch(0),!(t.t0 instanceof Error)){t.next=11;break}if(!V(r=t.t0,"code")||r.code!==o.ErrorCode.CALL_EXCEPTION||!V(r,"reason")||r.reason!==exports._RawErrorReason.TRANSACTION_FAILED){t.next=11;break}return t.abrupt("return",t.t0.receipt);case 11:throw t.t0;case 12:case"end":return t.stop()}var r}),t,this,[[0,6]])})));return function(e){return t.apply(this,arguments)}}(),e.getReceipt=function(){var t=l(P.mark((function t(){return P.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,this._waitForRawReceipt(0);case 3:return t.t1=t.sent,t.abrupt("return",t.t0._receiptFrom.call(t.t0,t.t1));case 5:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),e.waitForReceipt=function(){var t=l(P.mark((function t(){var e;return P.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=this,t.next=3,this._waitForRawReceipt();case 3:if(t.t1=t.sent,"pending"!==(e=t.t0._receiptFrom.call(t.t0,t.t1)).status){t.next=7;break}throw new Error("Still pending");case 7:return t.abrupt("return",e);case 8:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),t}(),Q=function(){function t(t,e,r){this.rawPopulatedTransaction=t,this._connection=e,this._parse=r}return t.prototype.send=function(){var t=l(P.mark((function t(){return P.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=Y,t.next=3,this._connection.signer.sendTransaction(this.rawPopulatedTransaction);case 3:return t.t1=t.sent,t.t2=this._connection,t.t3=this._parse,t.abrupt("return",new t.t0(t.t1,t.t2,t.t3));case 7:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),t}(),J=function(){function t(t){this._readable=t}var e=t.prototype;return e._wrap=function(t){return new Q(t,this._readable.connection,(function(){}))},e._wrapPositionChange=function(t,e){var n=A(this._readable.connection).primitiveManager;return new Q(e,this._readable.connection,(function(e){var i=e.logs,o=(n.extractEvents(i,"Create").map((function(e){return e.args.poolId===t.pool.poolId}))[0]?[new q(t.pool)]:n.extractEvents(i,"Allocate").map((function(e){return new q(t.pool,r.weiToWei(e.args.delLiquidity.toString()))})))[0];return o||(o=n.extractEvents(i,"Remove").map((function(e){return new q(t.pool,r.weiToWei(e.args.delLiquidity.toString()))}))[0]),{params:t,newPosition:o}}))},e._applyGasLimit=function(){var t=l(P.mark((function t(e,r,n){var i,o,a,c;return P.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null!=(o=(i=function(){return v({to:e.address,data:r.calldata,value:r.value},n)})())&&o.gasLimit){t.next=8;break}return t.next=5,e.signer.estimateGas(o);case 5:a=t.sent.mul(150).div(100),n=v({},n,{gasLimit:a});case 8:return c=i(),t.next=11,e.signer.populateTransaction(c);case 11:return t.abrupt("return",t.sent);case 13:case"end":return t.stop()}}),t)})));return function(e,r,n){return t.apply(this,arguments)}}(),e.allocate=function(){var t=l(P.mark((function t(e,n){var i,o;return P.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=A(this._readable.connection),o=i.primitiveManager,t.next=3,this._applyGasLimit(o.contract,r.PeripheryManager.allocateCallParameters(e.pool,e.options),n);case 3:return t.abrupt("return",this._wrapPositionChange(e,t.sent));case 5:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),e.remove=function(){var t=l(P.mark((function t(e,n){var i,o;return P.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=A(this._readable.connection),o=i.primitiveManager,t.next=3,this._applyGasLimit(o.contract,r.PeripheryManager.removeCallParameters(e.pool,e.options),n);case 3:return t.abrupt("return",this._wrapPositionChange(e,t.sent));case 5:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),e.createEngine=function(){var t=l(P.mark((function t(e,n){var i,o;return P.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=A(this._readable.connection),o=i.primitiveFactory,t.next=3,this._applyGasLimit(o.contract,{calldata:r.FactoryManager.encodeDeploy(e.risky,e.stable),value:a.toBN(0)._hex},n);case 3:return t.abrupt("return",new Q(t.sent,this._readable.connection,(function(t){return{params:e,engine:""}})));case 5:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),e.safeTransfer=function(){var t=l(P.mark((function t(e,n){var i,o;return P.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=A(this._readable.connection),o=i.primitiveManager,t.next=3,this._applyGasLimit(o.contract,r.PeripheryManager.safeTransferFromParameters(e.options),n);case 3:return t.abrupt("return",this._wrap(t.sent));case 5:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),e.safeBatchTransfer=function(){var t=l(P.mark((function t(e,n){var i,o;return P.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=A(this._readable.connection),o=i.primitiveManager,t.next=3,this._applyGasLimit(o.contract,r.PeripheryManager.batchTransferFromParameters(e.options),n);case 3:return t.abrupt("return",this._wrap(t.sent));case 5:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),t}(),K=function(){function t(){this.logging=!1,this._loaded=!1,this._listeners=new Set}var e=t.prototype;return e.start=function(){var t=this,e=this._doStart();return function(){e(),t._cancelUpdateIfScheduled()}},e._cancelUpdateIfScheduled=function(){void 0!==this._updateTimeoutId&&clearTimeout(this._updateTimeoutId)},e._scheduleUpdate=function(){var t=this;this._cancelUpdateIfScheduled(),this._updateTimeoutId=setTimeout((function(){t._updateTimeoutId=void 0,t._update()}),35e3)},e._logUpdate=function(t,e,r){return this.logging&&console.log(t+" updated to "+(r?r(e):e)),e},e._updateIfChanged=function(t,e,r,n,i){return void 0===n||t(r,n)?r:this._logUpdate(e,n,i)},e._reduce=function(t,e){return{placeholder:""}},e._derive=function(t){return{placeholder:t.placeholder}},e._reduceDerived=function(t,e){return{placeholder:""}},e._notify=function(t){var e=this;[].concat(this._listeners).forEach((function(r){e._listeners.has(r)&&r(t)}))},e.subscribe=function(t){var e,r=this,n=(e=t,function(){return e.apply(void 0,arguments)});return this._listeners.add(n),function(){r._listeners.delete(n)}},e._load=function(){console.log("placeholder")},e._update=function(t,e){c(this._baseState&&this._derivedState);var r,n,i=this.state;t&&(this._baseState=this._reduce(this._baseState,t)),this._derivedState=this._reduceDerived(this._derivedState,this._derive(this._baseState)),e&&(c(this._extraState),this._extraState=this._reduceExtra(this._extraState,e)),this._scheduleUpdate(),this._notify({newState:this.state,oldState:i,stateChange:(r=this.state,n=i,Object.fromEntries(Object.entries(r).filter((function(t){return t[1]!==n[t[0]]}))))})},d(t,[{key:"state",get:function(){return Object.assign({},this._baseState,this._derivedState,this._extraState)}}]),t}(),X=function(t){function e(e,r,n){var i;return(i=t.call(this,r)||this).name=e,i.failedReceipt=n,i}return y(e,t),e}(_(Error));function Z(t){var e=Buffer.from(t.substring(29),"base64").toString();return JSON.parse(e)}function z(t){var e=Z(t).properties,n=e.invariant,i={address:e.stableAddress,name:e.stableName,symbol:e.stableSymbol,decimals:e.stableDecimals},o={strike:e.strike,sigma:e.sigma,maturity:e.maturity,lastTimestamp:e.lastTimestamp,gamma:e.gamma},a={reserveRisky:e.reserveRisky,reserveStable:e.reserveStable,liquidity:e.liquidity};return new r.Pool(e.chainId,e.factory,v({},{address:e.riskyAddress,name:e.riskyName,symbol:e.riskySymbol,decimals:e.riskyDecimals}),v({},i),v({},o),v({},a),n,void 0)}var H=function(){function t(t){this.connection=t}t._from=function(e){return new t(e)},t.connect=function(){var e=l(P.mark((function e(r){return P.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=t,e.next=3,j(r);case 3:return e.t1=e.sent,e.abrupt("return",e.t0._from.call(e.t0,e.t1));case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();var e=t.prototype;return e.getPool=function(t,e){return A(this.connection).primitiveManager.contract.uri(t).then(z)},e.getLiquidityBalance=function(t,e,n){return A(this.connection).primitiveManager.contract.balanceOf(e,t).then((function(t){return r.weiToWei(t.toString())}))},e.getPosition=function(t,e,r){return this.getLiquidityBalance(t.poolId,e,r).then((function(e){return new q(t,e)}))},e.getEngine=function(t,e,r){return A(this.connection).primitiveFactory.contract.getEngine(n.getAddress(t),n.getAddress(e)).then((function(t){return t}))},t}(),$=function(t){function e(e,r){return t.call(this,"EthersTransactionFailedError",e,r)||this}return y(e,t),e}(X),tt=function(){var t=l(P.mark((function t(e){var r;return P.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.waitForReceipt();case 2:if("succeeded"===(r=t.sent).status){t.next=5;break}throw new $("Transaction failed",r);case 5:return t.abrupt("return",r.details);case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();exports.EthersRmm=function(){function t(t){this._readable=t,this.connection=t.connection,this.populate=new J(t),this.send=new W(this.populate)}t._from=function(e){return new t(H._from(e))},t.connect=function(){var e=l(P.mark((function e(r){return P.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,j(r);case 2:return e.abrupt("return",t._from(e.sent));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();var e=t.prototype;return e.allocate=function(t,e){return this.send.allocate(t,e).then(tt)},e.createPool=function(t,e){if(!t.options.createPool)throw new Error("Attempting to create pool without flagging createPool.");return this.send.allocate(t,e).then(tt)},e.remove=function(t,e){return this.send.remove(t,e).then(tt)},e.safeTransfer=function(t,e){return this.send.safeTransfer(t,e).then(tt)},e.safeBatchTransfer=function(t,e){return this.send.safeBatchTransfer(t,e).then(tt)},e.createEngine=function(t,e){return this.send.createEngine(t,e).then(tt)},e.getPool=function(t,e){return this._readable.getPool(t,e)},e.getLiquidityBalance=function(t,e,r){return this._readable.getLiquidityBalance(t,e,r)},e.getPosition=function(t,e,r){return this._readable.getPosition(t,e,r)},e.getEngine=function(t,e,r){return this._readable.getEngine(t,e,r)},t}(),exports.EthersTransactionFailedError=$,exports.PopulatableEthersRmm=J,exports.PopulatedEthersSignerTransaction=Q,exports.Position=q,exports.ReadableEthersRmm=H,exports.RmmStore=K,exports.SendableEthersRmm=W,exports.SentEthersRmmTransaction=Y,exports.TransactionFailedError=X,exports._RmmContract=u,exports._RmmContractAbis=s,exports._connect=j,exports._connectToContracts=p,exports._connectToDeployment=function(t,e){var r=C(e);return O(r[0],r[1],p(e,t),t)},exports._connectToNetwork=B,exports._failedReceipt=N,exports._getContracts=A,exports._pendingReceipt=M,exports._successfulReceipt=G,exports.connectionFrom=O,exports.parseTokenURI=Z,exports.poolify=z; | ||
//# sourceMappingURL=rmm-ethers.cjs.production.min.js.map |
import { AllocateOptions } from '@primitivefi/rmm-sdk'; | ||
import { BatchTransferOptions } from '@primitivefi/rmm-sdk'; | ||
import { BigNumber } from 'ethers'; | ||
import { BigNumber as BigNumber_2 } from '@ethersproject/bignumber'; | ||
import { BigNumber } from '@ethersproject/bignumber'; | ||
import { BlockTag } from '@ethersproject/abstract-provider'; | ||
@@ -42,8 +41,9 @@ import { Contract } from '@ethersproject/contracts'; | ||
/** @internal */ | ||
export declare function _connectToNetwork(provider: EthersProvider, signer: EthersSigner | undefined, chainId: number): EthersRmmConnection; | ||
/** Aliased string to for Engine addresses. */ | ||
/** Aliased string to for Engine addresses. @beta*/ | ||
export declare type EngineAddress = string; | ||
/** Receipt details returned from deploying an Engine. */ | ||
/** Receipt details returned from deploying an Engine. @beta*/ | ||
export declare interface EngineCreationDetails { | ||
@@ -56,3 +56,3 @@ /** Engine creation parameters. */ | ||
/** Parameters of deploy engine transaction. */ | ||
/** Parameters of deploy engine transaction. @beta */ | ||
export declare type EngineCreationParams = { | ||
@@ -153,2 +153,3 @@ risky: string; | ||
/** @beta */ | ||
export declare interface EthersRmmConnectionOptional { | ||
@@ -190,4 +191,4 @@ /** | ||
nonce?: number; | ||
gasLimit?: BigNumber_2; | ||
gasPrice?: BigNumber_2; | ||
gasLimit?: BigNumber; | ||
gasPrice?: BigNumber; | ||
} | ||
@@ -292,5 +293,7 @@ | ||
* | ||
* @param uri JSON string with a `base64` encoding | ||
* @param uri - JSON string with a `base64` encoding | ||
* | ||
* @returns Parsed JSON of `uri`. | ||
* | ||
* @beta | ||
*/ | ||
@@ -321,3 +324,3 @@ export declare function parseTokenURI(uri: string): any; | ||
* | ||
* @param raw URI string returned by PrimitiveManager `uri` function. | ||
* @param raw - URI string returned by PrimitiveManager `uri` function. | ||
* @returns Pool entity. | ||
@@ -413,3 +416,7 @@ * | ||
/** A ready to send transaction with generic types. */ | ||
/** | ||
* A ready to send transaction with generic types. | ||
* | ||
* @beta | ||
*/ | ||
export declare interface PopulatedRmmTransaction<P = unknown, T extends SentRmmTransaction = SentRmmTransaction> { | ||
@@ -463,3 +470,3 @@ /** Implementable populated transaction object. */ | ||
/** Receipt details returned from a transaction adjusting a Position. */ | ||
/** Receipt details returned from a transaction adjusting a Position. @beta. */ | ||
export declare interface PositionAdjustmentDetails { | ||
@@ -474,3 +481,3 @@ /** Parameters of allocate tx. */ | ||
/** Parameters of an allocate transaction. */ | ||
/** Parameters of an allocate transaction. @beta */ | ||
export declare type PositionAllocateParams<T = unknown> = _PoolAction & { | ||
@@ -480,3 +487,3 @@ options: AllocateOptions; | ||
/** Parameters of transferring a batch ERC-1155 liquidity tokens. */ | ||
/** Parameters of transferring a batch ERC-1155 liquidity tokens. @beta */ | ||
export declare type PositionBatchTransferParams = { | ||
@@ -492,6 +499,5 @@ options: BatchTransferOptions; | ||
declare interface PositionDescriptorContract extends _TypedRmmContract<PositionDescriptor> { | ||
} | ||
declare type PositionDescriptorContract = _TypedRmmContract<PositionDescriptor>; | ||
/** Parameters of removing liquidity transaction. */ | ||
/** Parameters of removing liquidity transaction. @beta */ | ||
export declare type PositionRemoveParams = _PoolAction & { | ||
@@ -501,6 +507,5 @@ options: RemoveOptions; | ||
declare interface PositionRendererContract extends _TypedRmmContract<PositionRenderer> { | ||
} | ||
declare type PositionRendererContract = _TypedRmmContract<PositionRenderer>; | ||
/** Parameters of transferring ERC-1155 liquidity tokens. */ | ||
/** Parameters of transferring ERC-1155 liquidity tokens. @beta */ | ||
export declare type PositionTransferParams = { | ||
@@ -566,4 +571,6 @@ options: SafeTransferOptions; | ||
declare interface RmmBaseStoreState { | ||
placeholder?: string; | ||
} | ||
/** @beta */ | ||
export declare class _RmmContract { | ||
@@ -608,2 +615,3 @@ readonly contract: Contract; | ||
declare interface RmmDerivedStoreState { | ||
placeholder?: string; | ||
} | ||
@@ -709,2 +717,7 @@ | ||
export declare interface SendableRmm<R = unknown, S = unknown> { | ||
allocate(params: PositionAllocateParams, overrides?: EthersTransactionOverrides): Promise<SentEthersRmmTransaction<PositionAdjustmentDetails>>; | ||
remove(params: PositionRemoveParams, overrides?: EthersTransactionOverrides): Promise<SentEthersRmmTransaction<PositionAdjustmentDetails>>; | ||
safeTransfer(params: PositionTransferParams, overrides?: EthersTransactionOverrides): Promise<SentEthersRmmTransaction<void>>; | ||
safeBatchTransfer(params: PositionBatchTransferParams, overrides?: EthersTransactionOverrides): Promise<SentEthersRmmTransaction<void>>; | ||
createEngine(params: EngineCreationParams, overrides?: EthersTransactionOverrides): Promise<SentEthersRmmTransaction<EngineCreationDetails>>; | ||
} | ||
@@ -777,3 +790,3 @@ | ||
/** Parameters of a swap transaction. */ | ||
/** Parameters of a swap transaction. @beta */ | ||
export declare type SwapParams = _PoolAction & { | ||
@@ -794,4 +807,5 @@ options: SwapOptions; | ||
declare type TypedContract<T, U, V> = _TypeSafeContract<T> & U & {}; | ||
declare type TypedContract<T, U, V> = _TypeSafeContract<T> & U & unknown; | ||
/** @internal */ | ||
export declare interface _TypedLogDescription<T> extends Omit<LogDescription, 'args'> { | ||
@@ -801,4 +815,6 @@ args: T; | ||
/** @internal */ | ||
export declare type _TypedRmmContract<T = unknown, U = unknown> = TypedContract<_RmmContract, T, U>; | ||
/** @internal */ | ||
export declare type _TypeSafeContract<T> = Pick<T, { | ||
@@ -805,0 +821,0 @@ [P in keyof T]: BucketOfFunctions extends T[P] ? never : P; |
interface RmmBaseStoreState { | ||
placeholder?: string; | ||
} | ||
interface RmmDerivedStoreState { | ||
placeholder?: string; | ||
} | ||
@@ -5,0 +7,0 @@ export declare type RmmStoreState<T = unknown> = RmmBaseStoreState & RmmDerivedStoreState & T; |
@@ -87,2 +87,7 @@ import { EthersTransactionOverrides, EthersTransactionReceipt, EthersTransactionResponse, PopulatableEthersRmm, SentEthersRmmTransaction } from '.'; | ||
export interface SendableRmm<R = unknown, S = unknown> { | ||
allocate(params: PositionAllocateParams, overrides?: EthersTransactionOverrides): Promise<SentEthersRmmTransaction<PositionAdjustmentDetails>>; | ||
remove(params: PositionRemoveParams, overrides?: EthersTransactionOverrides): Promise<SentEthersRmmTransaction<PositionAdjustmentDetails>>; | ||
safeTransfer(params: PositionTransferParams, overrides?: EthersTransactionOverrides): Promise<SentEthersRmmTransaction<void>>; | ||
safeBatchTransfer(params: PositionBatchTransferParams, overrides?: EthersTransactionOverrides): Promise<SentEthersRmmTransaction<void>>; | ||
createEngine(params: EngineCreationParams, overrides?: EthersTransactionOverrides): Promise<SentEthersRmmTransaction<EngineCreationDetails>>; | ||
} | ||
@@ -89,0 +94,0 @@ /** |
@@ -17,23 +17,23 @@ import { AllocateOptions, BatchTransferOptions, Pool, RemoveOptions, SafeTransferOptions, SwapOptions } from '@primitivefi/rmm-sdk'; | ||
}; | ||
/** Parameters of an allocate transaction. */ | ||
/** Parameters of an allocate transaction. @beta */ | ||
export declare type PositionAllocateParams<T = unknown> = _PoolAction & { | ||
options: AllocateOptions; | ||
}; | ||
/** Parameters of removing liquidity transaction. */ | ||
/** Parameters of removing liquidity transaction. @beta */ | ||
export declare type PositionRemoveParams = _PoolAction & { | ||
options: RemoveOptions; | ||
}; | ||
/** Parameters of transferring ERC-1155 liquidity tokens. */ | ||
/** Parameters of transferring ERC-1155 liquidity tokens. @beta */ | ||
export declare type PositionTransferParams = { | ||
options: SafeTransferOptions; | ||
}; | ||
/** Parameters of transferring a batch ERC-1155 liquidity tokens. */ | ||
/** Parameters of transferring a batch ERC-1155 liquidity tokens. @beta */ | ||
export declare type PositionBatchTransferParams = { | ||
options: BatchTransferOptions; | ||
}; | ||
/** Parameters of a swap transaction. */ | ||
/** Parameters of a swap transaction. @beta */ | ||
export declare type SwapParams = _PoolAction & { | ||
options: SwapOptions; | ||
}; | ||
/** Parameters of deploy engine transaction. */ | ||
/** Parameters of deploy engine transaction. @beta */ | ||
export declare type EngineCreationParams = { | ||
@@ -43,3 +43,3 @@ risky: string; | ||
}; | ||
/** Receipt details returned from a transaction adjusting a Position. */ | ||
/** Receipt details returned from a transaction adjusting a Position. @beta. */ | ||
export interface PositionAdjustmentDetails { | ||
@@ -53,5 +53,5 @@ /** Parameters of allocate tx. */ | ||
} | ||
/** Aliased string to for Engine addresses. */ | ||
/** Aliased string to for Engine addresses. @beta*/ | ||
export declare type EngineAddress = string; | ||
/** Receipt details returned from deploying an Engine. */ | ||
/** Receipt details returned from deploying an Engine. @beta*/ | ||
export interface EngineCreationDetails { | ||
@@ -58,0 +58,0 @@ /** Engine creation parameters. */ |
@@ -7,2 +7,4 @@ import { BaseContract, BigNumber, BigNumberish, BytesLike, CallOverrides, ContractTransaction, Overrides, PopulatedTransaction, Signer, utils } from "ethers"; | ||
functions: { | ||
"DOMAIN_SEPARATOR()": FunctionFragment; | ||
"PERMIT_TYPEHASH()": FunctionFragment; | ||
"allowance(address,address)": FunctionFragment; | ||
@@ -12,5 +14,6 @@ "approve(address,uint256)": FunctionFragment; | ||
"decimals()": FunctionFragment; | ||
"decreaseAllowance(address,uint256)": FunctionFragment; | ||
"increaseAllowance(address,uint256)": FunctionFragment; | ||
"mint(address,uint256)": FunctionFragment; | ||
"name()": FunctionFragment; | ||
"nonces(address)": FunctionFragment; | ||
"permit(address,address,uint256,uint256,uint8,bytes32,bytes32)": FunctionFragment; | ||
"symbol()": FunctionFragment; | ||
@@ -21,2 +24,4 @@ "totalSupply()": FunctionFragment; | ||
}; | ||
encodeFunctionData(functionFragment: "DOMAIN_SEPARATOR", values?: undefined): string; | ||
encodeFunctionData(functionFragment: "PERMIT_TYPEHASH", values?: undefined): string; | ||
encodeFunctionData(functionFragment: "allowance", values: [string, string]): string; | ||
@@ -26,5 +31,6 @@ encodeFunctionData(functionFragment: "approve", values: [string, BigNumberish]): string; | ||
encodeFunctionData(functionFragment: "decimals", values?: undefined): string; | ||
encodeFunctionData(functionFragment: "decreaseAllowance", values: [string, BigNumberish]): string; | ||
encodeFunctionData(functionFragment: "increaseAllowance", values: [string, BigNumberish]): string; | ||
encodeFunctionData(functionFragment: "mint", values: [string, BigNumberish]): string; | ||
encodeFunctionData(functionFragment: "name", values?: undefined): string; | ||
encodeFunctionData(functionFragment: "nonces", values: [string]): string; | ||
encodeFunctionData(functionFragment: "permit", values: [string, string, BigNumberish, BigNumberish, BigNumberish, BytesLike, BytesLike]): string; | ||
encodeFunctionData(functionFragment: "symbol", values?: undefined): string; | ||
@@ -34,2 +40,4 @@ encodeFunctionData(functionFragment: "totalSupply", values?: undefined): string; | ||
encodeFunctionData(functionFragment: "transferFrom", values: [string, string, BigNumberish]): string; | ||
decodeFunctionResult(functionFragment: "DOMAIN_SEPARATOR", data: BytesLike): Result; | ||
decodeFunctionResult(functionFragment: "PERMIT_TYPEHASH", data: BytesLike): Result; | ||
decodeFunctionResult(functionFragment: "allowance", data: BytesLike): Result; | ||
@@ -39,5 +47,6 @@ decodeFunctionResult(functionFragment: "approve", data: BytesLike): Result; | ||
decodeFunctionResult(functionFragment: "decimals", data: BytesLike): Result; | ||
decodeFunctionResult(functionFragment: "decreaseAllowance", data: BytesLike): Result; | ||
decodeFunctionResult(functionFragment: "increaseAllowance", data: BytesLike): Result; | ||
decodeFunctionResult(functionFragment: "mint", data: BytesLike): Result; | ||
decodeFunctionResult(functionFragment: "name", data: BytesLike): Result; | ||
decodeFunctionResult(functionFragment: "nonces", data: BytesLike): Result; | ||
decodeFunctionResult(functionFragment: "permit", data: BytesLike): Result; | ||
decodeFunctionResult(functionFragment: "symbol", data: BytesLike): Result; | ||
@@ -81,57 +90,66 @@ decodeFunctionResult(functionFragment: "totalSupply", data: BytesLike): Result; | ||
functions: { | ||
allowance(owner: string, spender: string, overrides?: CallOverrides): Promise<[BigNumber]>; | ||
approve(spender: string, amount: BigNumberish, overrides?: Overrides & { | ||
DOMAIN_SEPARATOR(overrides?: CallOverrides): Promise<[string]>; | ||
PERMIT_TYPEHASH(overrides?: CallOverrides): Promise<[string]>; | ||
allowance(arg0: string, arg1: string, overrides?: CallOverrides): Promise<[BigNumber]>; | ||
approve(spender: string, value: BigNumberish, overrides?: Overrides & { | ||
from?: string | Promise<string>; | ||
}): Promise<ContractTransaction>; | ||
balanceOf(account: string, overrides?: CallOverrides): Promise<[BigNumber]>; | ||
balanceOf(arg0: string, overrides?: CallOverrides): Promise<[BigNumber]>; | ||
decimals(overrides?: CallOverrides): Promise<[number]>; | ||
decreaseAllowance(spender: string, subtractedValue: BigNumberish, overrides?: Overrides & { | ||
mint(to: string, value: BigNumberish, overrides?: Overrides & { | ||
from?: string | Promise<string>; | ||
}): Promise<ContractTransaction>; | ||
increaseAllowance(spender: string, addedValue: BigNumberish, overrides?: Overrides & { | ||
name(overrides?: CallOverrides): Promise<[string]>; | ||
nonces(arg0: string, overrides?: CallOverrides): Promise<[BigNumber]>; | ||
permit(owner: string, spender: string, value: BigNumberish, deadline: BigNumberish, v: BigNumberish, r: BytesLike, s: BytesLike, overrides?: Overrides & { | ||
from?: string | Promise<string>; | ||
}): Promise<ContractTransaction>; | ||
name(overrides?: CallOverrides): Promise<[string]>; | ||
symbol(overrides?: CallOverrides): Promise<[string]>; | ||
totalSupply(overrides?: CallOverrides): Promise<[BigNumber]>; | ||
transfer(recipient: string, amount: BigNumberish, overrides?: Overrides & { | ||
transfer(to: string, value: BigNumberish, overrides?: Overrides & { | ||
from?: string | Promise<string>; | ||
}): Promise<ContractTransaction>; | ||
transferFrom(sender: string, recipient: string, amount: BigNumberish, overrides?: Overrides & { | ||
transferFrom(from: string, to: string, value: BigNumberish, overrides?: Overrides & { | ||
from?: string | Promise<string>; | ||
}): Promise<ContractTransaction>; | ||
}; | ||
allowance(owner: string, spender: string, overrides?: CallOverrides): Promise<BigNumber>; | ||
approve(spender: string, amount: BigNumberish, overrides?: Overrides & { | ||
DOMAIN_SEPARATOR(overrides?: CallOverrides): Promise<string>; | ||
PERMIT_TYPEHASH(overrides?: CallOverrides): Promise<string>; | ||
allowance(arg0: string, arg1: string, overrides?: CallOverrides): Promise<BigNumber>; | ||
approve(spender: string, value: BigNumberish, overrides?: Overrides & { | ||
from?: string | Promise<string>; | ||
}): Promise<ContractTransaction>; | ||
balanceOf(account: string, overrides?: CallOverrides): Promise<BigNumber>; | ||
balanceOf(arg0: string, overrides?: CallOverrides): Promise<BigNumber>; | ||
decimals(overrides?: CallOverrides): Promise<number>; | ||
decreaseAllowance(spender: string, subtractedValue: BigNumberish, overrides?: Overrides & { | ||
mint(to: string, value: BigNumberish, overrides?: Overrides & { | ||
from?: string | Promise<string>; | ||
}): Promise<ContractTransaction>; | ||
increaseAllowance(spender: string, addedValue: BigNumberish, overrides?: Overrides & { | ||
name(overrides?: CallOverrides): Promise<string>; | ||
nonces(arg0: string, overrides?: CallOverrides): Promise<BigNumber>; | ||
permit(owner: string, spender: string, value: BigNumberish, deadline: BigNumberish, v: BigNumberish, r: BytesLike, s: BytesLike, overrides?: Overrides & { | ||
from?: string | Promise<string>; | ||
}): Promise<ContractTransaction>; | ||
name(overrides?: CallOverrides): Promise<string>; | ||
symbol(overrides?: CallOverrides): Promise<string>; | ||
totalSupply(overrides?: CallOverrides): Promise<BigNumber>; | ||
transfer(recipient: string, amount: BigNumberish, overrides?: Overrides & { | ||
transfer(to: string, value: BigNumberish, overrides?: Overrides & { | ||
from?: string | Promise<string>; | ||
}): Promise<ContractTransaction>; | ||
transferFrom(sender: string, recipient: string, amount: BigNumberish, overrides?: Overrides & { | ||
transferFrom(from: string, to: string, value: BigNumberish, overrides?: Overrides & { | ||
from?: string | Promise<string>; | ||
}): Promise<ContractTransaction>; | ||
callStatic: { | ||
allowance(owner: string, spender: string, overrides?: CallOverrides): Promise<BigNumber>; | ||
approve(spender: string, amount: BigNumberish, overrides?: CallOverrides): Promise<boolean>; | ||
balanceOf(account: string, overrides?: CallOverrides): Promise<BigNumber>; | ||
DOMAIN_SEPARATOR(overrides?: CallOverrides): Promise<string>; | ||
PERMIT_TYPEHASH(overrides?: CallOverrides): Promise<string>; | ||
allowance(arg0: string, arg1: string, overrides?: CallOverrides): Promise<BigNumber>; | ||
approve(spender: string, value: BigNumberish, overrides?: CallOverrides): Promise<boolean>; | ||
balanceOf(arg0: string, overrides?: CallOverrides): Promise<BigNumber>; | ||
decimals(overrides?: CallOverrides): Promise<number>; | ||
decreaseAllowance(spender: string, subtractedValue: BigNumberish, overrides?: CallOverrides): Promise<boolean>; | ||
increaseAllowance(spender: string, addedValue: BigNumberish, overrides?: CallOverrides): Promise<boolean>; | ||
mint(to: string, value: BigNumberish, overrides?: CallOverrides): Promise<boolean>; | ||
name(overrides?: CallOverrides): Promise<string>; | ||
nonces(arg0: string, overrides?: CallOverrides): Promise<BigNumber>; | ||
permit(owner: string, spender: string, value: BigNumberish, deadline: BigNumberish, v: BigNumberish, r: BytesLike, s: BytesLike, overrides?: CallOverrides): Promise<void>; | ||
symbol(overrides?: CallOverrides): Promise<string>; | ||
totalSupply(overrides?: CallOverrides): Promise<BigNumber>; | ||
transfer(recipient: string, amount: BigNumberish, overrides?: CallOverrides): Promise<boolean>; | ||
transferFrom(sender: string, recipient: string, amount: BigNumberish, overrides?: CallOverrides): Promise<boolean>; | ||
transfer(to: string, value: BigNumberish, overrides?: CallOverrides): Promise<boolean>; | ||
transferFrom(from: string, to: string, value: BigNumberish, overrides?: CallOverrides): Promise<boolean>; | ||
}; | ||
@@ -145,21 +163,24 @@ filters: { | ||
estimateGas: { | ||
allowance(owner: string, spender: string, overrides?: CallOverrides): Promise<BigNumber>; | ||
approve(spender: string, amount: BigNumberish, overrides?: Overrides & { | ||
DOMAIN_SEPARATOR(overrides?: CallOverrides): Promise<BigNumber>; | ||
PERMIT_TYPEHASH(overrides?: CallOverrides): Promise<BigNumber>; | ||
allowance(arg0: string, arg1: string, overrides?: CallOverrides): Promise<BigNumber>; | ||
approve(spender: string, value: BigNumberish, overrides?: Overrides & { | ||
from?: string | Promise<string>; | ||
}): Promise<BigNumber>; | ||
balanceOf(account: string, overrides?: CallOverrides): Promise<BigNumber>; | ||
balanceOf(arg0: string, overrides?: CallOverrides): Promise<BigNumber>; | ||
decimals(overrides?: CallOverrides): Promise<BigNumber>; | ||
decreaseAllowance(spender: string, subtractedValue: BigNumberish, overrides?: Overrides & { | ||
mint(to: string, value: BigNumberish, overrides?: Overrides & { | ||
from?: string | Promise<string>; | ||
}): Promise<BigNumber>; | ||
increaseAllowance(spender: string, addedValue: BigNumberish, overrides?: Overrides & { | ||
name(overrides?: CallOverrides): Promise<BigNumber>; | ||
nonces(arg0: string, overrides?: CallOverrides): Promise<BigNumber>; | ||
permit(owner: string, spender: string, value: BigNumberish, deadline: BigNumberish, v: BigNumberish, r: BytesLike, s: BytesLike, overrides?: Overrides & { | ||
from?: string | Promise<string>; | ||
}): Promise<BigNumber>; | ||
name(overrides?: CallOverrides): Promise<BigNumber>; | ||
symbol(overrides?: CallOverrides): Promise<BigNumber>; | ||
totalSupply(overrides?: CallOverrides): Promise<BigNumber>; | ||
transfer(recipient: string, amount: BigNumberish, overrides?: Overrides & { | ||
transfer(to: string, value: BigNumberish, overrides?: Overrides & { | ||
from?: string | Promise<string>; | ||
}): Promise<BigNumber>; | ||
transferFrom(sender: string, recipient: string, amount: BigNumberish, overrides?: Overrides & { | ||
transferFrom(from: string, to: string, value: BigNumberish, overrides?: Overrides & { | ||
from?: string | Promise<string>; | ||
@@ -169,21 +190,24 @@ }): Promise<BigNumber>; | ||
populateTransaction: { | ||
allowance(owner: string, spender: string, overrides?: CallOverrides): Promise<PopulatedTransaction>; | ||
approve(spender: string, amount: BigNumberish, overrides?: Overrides & { | ||
DOMAIN_SEPARATOR(overrides?: CallOverrides): Promise<PopulatedTransaction>; | ||
PERMIT_TYPEHASH(overrides?: CallOverrides): Promise<PopulatedTransaction>; | ||
allowance(arg0: string, arg1: string, overrides?: CallOverrides): Promise<PopulatedTransaction>; | ||
approve(spender: string, value: BigNumberish, overrides?: Overrides & { | ||
from?: string | Promise<string>; | ||
}): Promise<PopulatedTransaction>; | ||
balanceOf(account: string, overrides?: CallOverrides): Promise<PopulatedTransaction>; | ||
balanceOf(arg0: string, overrides?: CallOverrides): Promise<PopulatedTransaction>; | ||
decimals(overrides?: CallOverrides): Promise<PopulatedTransaction>; | ||
decreaseAllowance(spender: string, subtractedValue: BigNumberish, overrides?: Overrides & { | ||
mint(to: string, value: BigNumberish, overrides?: Overrides & { | ||
from?: string | Promise<string>; | ||
}): Promise<PopulatedTransaction>; | ||
increaseAllowance(spender: string, addedValue: BigNumberish, overrides?: Overrides & { | ||
name(overrides?: CallOverrides): Promise<PopulatedTransaction>; | ||
nonces(arg0: string, overrides?: CallOverrides): Promise<PopulatedTransaction>; | ||
permit(owner: string, spender: string, value: BigNumberish, deadline: BigNumberish, v: BigNumberish, r: BytesLike, s: BytesLike, overrides?: Overrides & { | ||
from?: string | Promise<string>; | ||
}): Promise<PopulatedTransaction>; | ||
name(overrides?: CallOverrides): Promise<PopulatedTransaction>; | ||
symbol(overrides?: CallOverrides): Promise<PopulatedTransaction>; | ||
totalSupply(overrides?: CallOverrides): Promise<PopulatedTransaction>; | ||
transfer(recipient: string, amount: BigNumberish, overrides?: Overrides & { | ||
transfer(to: string, value: BigNumberish, overrides?: Overrides & { | ||
from?: string | Promise<string>; | ||
}): Promise<PopulatedTransaction>; | ||
transferFrom(sender: string, recipient: string, amount: BigNumberish, overrides?: Overrides & { | ||
transferFrom(from: string, to: string, value: BigNumberish, overrides?: Overrides & { | ||
from?: string | Promise<string>; | ||
@@ -190,0 +214,0 @@ }): Promise<PopulatedTransaction>; |
@@ -10,2 +10,3 @@ import { BaseContract, BigNumber, BigNumberish, BytesLike, CallOverrides, ContractTransaction, Overrides, PopulatedTransaction, Signer, utils } from "ethers"; | ||
"balanceOf(address)": FunctionFragment; | ||
"decimals()": FunctionFragment; | ||
"totalSupply()": FunctionFragment; | ||
@@ -18,2 +19,3 @@ "transfer(address,uint256)": FunctionFragment; | ||
encodeFunctionData(functionFragment: "balanceOf", values: [string]): string; | ||
encodeFunctionData(functionFragment: "decimals", values?: undefined): string; | ||
encodeFunctionData(functionFragment: "totalSupply", values?: undefined): string; | ||
@@ -25,2 +27,3 @@ encodeFunctionData(functionFragment: "transfer", values: [string, BigNumberish]): string; | ||
decodeFunctionResult(functionFragment: "balanceOf", data: BytesLike): Result; | ||
decodeFunctionResult(functionFragment: "decimals", data: BytesLike): Result; | ||
decodeFunctionResult(functionFragment: "totalSupply", data: BytesLike): Result; | ||
@@ -68,2 +71,3 @@ decodeFunctionResult(functionFragment: "transfer", data: BytesLike): Result; | ||
balanceOf(account: string, overrides?: CallOverrides): Promise<[BigNumber]>; | ||
decimals(overrides?: CallOverrides): Promise<[number]>; | ||
totalSupply(overrides?: CallOverrides): Promise<[BigNumber]>; | ||
@@ -82,2 +86,3 @@ transfer(recipient: string, amount: BigNumberish, overrides?: Overrides & { | ||
balanceOf(account: string, overrides?: CallOverrides): Promise<BigNumber>; | ||
decimals(overrides?: CallOverrides): Promise<number>; | ||
totalSupply(overrides?: CallOverrides): Promise<BigNumber>; | ||
@@ -94,2 +99,3 @@ transfer(recipient: string, amount: BigNumberish, overrides?: Overrides & { | ||
balanceOf(account: string, overrides?: CallOverrides): Promise<BigNumber>; | ||
decimals(overrides?: CallOverrides): Promise<number>; | ||
totalSupply(overrides?: CallOverrides): Promise<BigNumber>; | ||
@@ -111,2 +117,3 @@ transfer(recipient: string, amount: BigNumberish, overrides?: CallOverrides): Promise<boolean>; | ||
balanceOf(account: string, overrides?: CallOverrides): Promise<BigNumber>; | ||
decimals(overrides?: CallOverrides): Promise<BigNumber>; | ||
totalSupply(overrides?: CallOverrides): Promise<BigNumber>; | ||
@@ -126,2 +133,3 @@ transfer(recipient: string, amount: BigNumberish, overrides?: Overrides & { | ||
balanceOf(account: string, overrides?: CallOverrides): Promise<PopulatedTransaction>; | ||
decimals(overrides?: CallOverrides): Promise<PopulatedTransaction>; | ||
totalSupply(overrides?: CallOverrides): Promise<PopulatedTransaction>; | ||
@@ -128,0 +136,0 @@ transfer(recipient: string, amount: BigNumberish, overrides?: Overrides & { |
@@ -1,24 +0,98 @@ | ||
export type { AccessControl } from "./AccessControl"; | ||
export type { ERC20 } from "./ERC20"; | ||
export type { IERC1155MetadataURI } from "./IERC1155MetadataURI"; | ||
export type { IERC1155 } from "./IERC1155"; | ||
export type { IERC1155Receiver } from "./IERC1155Receiver"; | ||
export type { IERC20Permit } from "./IERC20Permit"; | ||
export type { ERC165 } from "./ERC165"; | ||
export type { IERC165 } from "./IERC165"; | ||
export type { IPrimitiveCreateCallback } from "./IPrimitiveCreateCallback"; | ||
export type { IPrimitiveDepositCallback } from "./IPrimitiveDepositCallback"; | ||
export type { IPrimitiveLiquidityCallback } from "./IPrimitiveLiquidityCallback"; | ||
export type { IPrimitiveSwapCallback } from "./IPrimitiveSwapCallback"; | ||
export type { IPrimitiveEngineActions } from "./IPrimitiveEngineActions"; | ||
export type { IPrimitiveEngineErrors } from "./IPrimitiveEngineErrors"; | ||
export type { IPrimitiveEngineEvents } from "./IPrimitiveEngineEvents"; | ||
export type { IPrimitiveEngineView } from "./IPrimitiveEngineView"; | ||
export type { IERC20 } from "./IERC20"; | ||
export type { IERC20Permit } from "./IERC20Permit"; | ||
export type { TestERC20 } from "./TestERC20"; | ||
export type { TestToken } from "./TestToken"; | ||
export type { USDC } from "./USDC"; | ||
export type { IPrimitiveEngine } from "./IPrimitiveEngine"; | ||
export type { IPrimitiveFactory } from "./IPrimitiveFactory"; | ||
export type { CumulativeNormalDistribution } from "./CumulativeNormalDistribution"; | ||
export type { PrimitiveEngine } from "./PrimitiveEngine"; | ||
export type { PrimitiveFactory } from "./PrimitiveFactory"; | ||
export type { CashManager } from "./CashManager"; | ||
export type { ERC1155 } from "./ERC1155"; | ||
export type { ERC1155Permit } from "./ERC1155Permit"; | ||
export type { ManagerBase } from "./ManagerBase"; | ||
export type { MarginManager } from "./MarginManager"; | ||
export type { Multicall } from "./Multicall"; | ||
export type { PositionManager } from "./PositionManager"; | ||
export type { Reentrancy } from "./Reentrancy"; | ||
export type { SelfPermit } from "./SelfPermit"; | ||
export type { SwapManager } from "./SwapManager"; | ||
export type { IERC20PermitAllowed } from "./IERC20PermitAllowed"; | ||
export type { IERC20WithMetadata } from "./IERC20WithMetadata"; | ||
export type { IWETH9 } from "./IWETH9"; | ||
export type { ICashManager } from "./ICashManager"; | ||
export type { IERC1155Permit } from "./IERC1155Permit"; | ||
export type { IManagerBase } from "./IManagerBase"; | ||
export type { IMarginManager } from "./IMarginManager"; | ||
export type { IMulticall } from "./IMulticall"; | ||
export type { IPositionDescriptor } from "./IPositionDescriptor"; | ||
export type { IPositionRenderer } from "./IPositionRenderer"; | ||
export type { IPrimitiveManager } from "./IPrimitiveManager"; | ||
export type { ISelfPermit } from "./ISelfPermit"; | ||
export type { ISwapManager } from "./ISwapManager"; | ||
export type { EngineAddress } from "./EngineAddress"; | ||
export type { TransferHelper } from "./TransferHelper"; | ||
export type { PositionDescriptor } from "./PositionDescriptor"; | ||
export type { PositionRenderer } from "./PositionRenderer"; | ||
export type { PrimitiveManager } from "./PrimitiveManager"; | ||
export type { PrimitiveEngine } from "./PrimitiveEngine"; | ||
export type { PrimitiveFactory } from "./PrimitiveFactory"; | ||
export { AccessControl__factory } from "./factories/AccessControl__factory"; | ||
export { ERC20__factory } from "./factories/ERC20__factory"; | ||
export type { ERC20 } from "./ERC20"; | ||
export { IERC1155MetadataURI__factory } from "./factories/IERC1155MetadataURI__factory"; | ||
export { IERC1155__factory } from "./factories/IERC1155__factory"; | ||
export { IERC1155Receiver__factory } from "./factories/IERC1155Receiver__factory"; | ||
export { IERC20Permit__factory } from "./factories/IERC20Permit__factory"; | ||
export { ERC165__factory } from "./factories/ERC165__factory"; | ||
export { IERC165__factory } from "./factories/IERC165__factory"; | ||
export { IPrimitiveCreateCallback__factory } from "./factories/IPrimitiveCreateCallback__factory"; | ||
export { IPrimitiveDepositCallback__factory } from "./factories/IPrimitiveDepositCallback__factory"; | ||
export { IPrimitiveLiquidityCallback__factory } from "./factories/IPrimitiveLiquidityCallback__factory"; | ||
export { IPrimitiveSwapCallback__factory } from "./factories/IPrimitiveSwapCallback__factory"; | ||
export { IPrimitiveEngineActions__factory } from "./factories/IPrimitiveEngineActions__factory"; | ||
export { IPrimitiveEngineErrors__factory } from "./factories/IPrimitiveEngineErrors__factory"; | ||
export { IPrimitiveEngineEvents__factory } from "./factories/IPrimitiveEngineEvents__factory"; | ||
export { IPrimitiveEngineView__factory } from "./factories/IPrimitiveEngineView__factory"; | ||
export { IERC20__factory } from "./factories/IERC20__factory"; | ||
export { IERC20Permit__factory } from "./factories/IERC20Permit__factory"; | ||
export { TestERC20__factory } from "./factories/TestERC20__factory"; | ||
export { TestToken__factory } from "./factories/TestToken__factory"; | ||
export { USDC__factory } from "./factories/USDC__factory"; | ||
export { IPrimitiveEngine__factory } from "./factories/IPrimitiveEngine__factory"; | ||
export { IPrimitiveFactory__factory } from "./factories/IPrimitiveFactory__factory"; | ||
export { CumulativeNormalDistribution__factory } from "./factories/CumulativeNormalDistribution__factory"; | ||
export { PrimitiveEngine__factory } from "./factories/PrimitiveEngine__factory"; | ||
export { PrimitiveFactory__factory } from "./factories/PrimitiveFactory__factory"; | ||
export { CashManager__factory } from "./factories/CashManager__factory"; | ||
export { ERC1155__factory } from "./factories/ERC1155__factory"; | ||
export { ERC1155Permit__factory } from "./factories/ERC1155Permit__factory"; | ||
export { ManagerBase__factory } from "./factories/ManagerBase__factory"; | ||
export { MarginManager__factory } from "./factories/MarginManager__factory"; | ||
export { Multicall__factory } from "./factories/Multicall__factory"; | ||
export { PositionManager__factory } from "./factories/PositionManager__factory"; | ||
export { Reentrancy__factory } from "./factories/Reentrancy__factory"; | ||
export { SelfPermit__factory } from "./factories/SelfPermit__factory"; | ||
export { SwapManager__factory } from "./factories/SwapManager__factory"; | ||
export { IERC20PermitAllowed__factory } from "./factories/IERC20PermitAllowed__factory"; | ||
export { IERC20WithMetadata__factory } from "./factories/IERC20WithMetadata__factory"; | ||
export { IWETH9__factory } from "./factories/IWETH9__factory"; | ||
export { ICashManager__factory } from "./factories/ICashManager__factory"; | ||
export { IERC1155Permit__factory } from "./factories/IERC1155Permit__factory"; | ||
export { IManagerBase__factory } from "./factories/IManagerBase__factory"; | ||
export { IMarginManager__factory } from "./factories/IMarginManager__factory"; | ||
export { IMulticall__factory } from "./factories/IMulticall__factory"; | ||
export { IPositionDescriptor__factory } from "./factories/IPositionDescriptor__factory"; | ||
export { IPositionRenderer__factory } from "./factories/IPositionRenderer__factory"; | ||
export { IPrimitiveManager__factory } from "./factories/IPrimitiveManager__factory"; | ||
export { ISelfPermit__factory } from "./factories/ISelfPermit__factory"; | ||
export { ISwapManager__factory } from "./factories/ISwapManager__factory"; | ||
export { EngineAddress__factory } from "./factories/EngineAddress__factory"; | ||
export { TransferHelper__factory } from "./factories/TransferHelper__factory"; | ||
export { PositionDescriptor__factory } from "./factories/PositionDescriptor__factory"; | ||
export { PositionRenderer__factory } from "./factories/PositionRenderer__factory"; | ||
export { PrimitiveManager__factory } from "./factories/PrimitiveManager__factory"; | ||
export { PrimitiveEngine__factory } from "./factories/PrimitiveEngine__factory"; | ||
export { PrimitiveFactory__factory } from "./factories/PrimitiveFactory__factory"; | ||
export { ERC20__factory } from "./factories/ERC20__factory"; |
@@ -5,5 +5,7 @@ import { Pool } from '@primitivefi/rmm-sdk'; | ||
* | ||
* @param uri JSON string with a `base64` encoding | ||
* @param uri - JSON string with a `base64` encoding | ||
* | ||
* @returns Parsed JSON of `uri`. | ||
* | ||
* @beta | ||
*/ | ||
@@ -14,3 +16,3 @@ export declare function parseTokenURI(uri: string): any; | ||
* | ||
* @param raw URI string returned by PrimitiveManager `uri` function. | ||
* @param raw - URI string returned by PrimitiveManager `uri` function. | ||
* @returns Pool entity. | ||
@@ -17,0 +19,0 @@ * |
{ | ||
"name": "@primitivefi/rmm-ethers", | ||
"version": "0.0.11-beta.1", | ||
"version": "0.0.12-beta.1", | ||
"description": "Primitive RMM Protocol ethers-based implementation.", | ||
@@ -29,5 +29,11 @@ "repository": { | ||
"deploy": "npx hardhat deploy", | ||
"deploy:devnet": "run-s \"prepare\" \"deploy --network dev\" \"prepare:deployments\" \"deploy:pools --network dev\"", | ||
"deploy:testnet": "run-s \"prepare\" \"deploy --network rinkeby --defender\" \"deploy --network kovan --defender\" \"deploy --network goerli --defender\"", | ||
"deploy:testnet:pools": "run-s \"prepare\" \"deploy:pools --network rinkeby\" \"deploy:pools --network kovan\" \"deploy:pools --network goerli\"", | ||
"deploy:pools": "npx hardhat run ./scripts/deploy-pools.ts", | ||
"prepare": "run-s prepare:*", | ||
"prepare:com": "hardhat compile", | ||
"prepare:typ": "hardhat typechain", | ||
"prepare:deployments": "ts-node scripts/copy-deployments.ts", | ||
"prepare:compile": "hardhat compile", | ||
"prepare:typechain": "hardhat typechain", | ||
"prepare:lint": "eslint src", | ||
"prepare:tsc": "tsdx build --tsconfig tsconfig.production.json", | ||
@@ -38,3 +44,4 @@ "prepare:api": "api-extractor run --local", | ||
"docs:collect-apis": "node scripts/collect-api.js", | ||
"docs:api-documenter": "api-documenter generate -i temp/sdk-api -o docs/sdk" | ||
"docs:api-documenter": "api-documenter generate -i temp/sdk-api -o docs/sdk", | ||
"delete-dev-deployments": "ts-node scripts/delete-dev-deployments.ts" | ||
}, | ||
@@ -49,3 +56,3 @@ "author": "Primitive", | ||
"@primitivefi/hardhat-dodoc": "^0.1.3", | ||
"@primitivefi/rmm-sdk": "^1.0.2-beta.5", | ||
"@primitivefi/rmm-sdk": "^1.0.3-beta.5", | ||
"@typechain/ethers-v5": "^8.0.5", | ||
@@ -56,6 +63,10 @@ "@typechain/hardhat": "^3.1.0", | ||
"@types/node": "^15.12.2", | ||
"@typescript-eslint/eslint-plugin": "^5.9.0", | ||
"@typescript-eslint/parser": "^5.9.0", | ||
"chai": "^4.3.4", | ||
"dotenv": "^10.0.0", | ||
"eslint": "^8.6.0", | ||
"ethers": "^5.3.1", | ||
"hardhat": "^2.3.3", | ||
"hardhat-dependency-compiler": "^1.1.2", | ||
"hardhat-gas-reporter": "^1.0.4", | ||
@@ -76,3 +87,3 @@ "npm-run-all": "^4.1.5", | ||
"dependencies": { | ||
"@openzeppelin/contracts": "^3.3.0", | ||
"@rari-capital/solmate": "^6.2.0", | ||
"defender-relay-client": "^1.12.1" | ||
@@ -79,0 +90,0 @@ }, |
@@ -42,1 +42,19 @@ # rmm-ethers | ||
``` | ||
## Deployments | ||
### RMM Protocol | ||
Deploy the protocol to a network: | ||
```sh | ||
$ yarn deploy --network nameOfNetwork | ||
``` | ||
### RMM Pools | ||
Deploy pools in the config of the `deploy-pools.ts` script: | ||
```sh | ||
$ yarn deploy:pools --network nameOfNetwork | ||
``` |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1046795
113
13430
60
32
+ Added@rari-capital/solmate@^6.2.0
+ Added@rari-capital/solmate@6.4.0(transitive)
- Removed@openzeppelin/contracts@^3.3.0
- Removed@openzeppelin/contracts@3.4.2(transitive)