@pufferfinance/puffer-sdk 1.7.1 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";var u=Object.defineProperty;var d=(i,t,e)=>t in i?u(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var l=(i,t,e)=>d(i,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("../../constants-BvU-JhfL.cjs"),m=require("../addresses.cjs"),g=require("../abis/nucleus-teller-abis.cjs"),p=require("../tokens.cjs"),S=require("../../getContract-MrPLx6gp.cjs");class T{constructor(t,e,s){l(this,"viemChain");this.chain=t,this.walletClient=e,this.publicClient=s,this.viemChain=C.VIEM_CHAINS[t]}getContract(){const t=m.CONTRACT_ADDRESSES[this.chain].NucleusTeller,e=g.NUCLEUS_TELLER_ABIS[this.chain].Teller,s={public:this.publicClient,wallet:this.walletClient};return S.getContract({address:t,abi:e,client:s})}accountant(){return this.getContract().read.accountant()}vault(){return this.getContract().read.vault()}shareLockPeriod(){return this.getContract().read.shareLockPeriod()}shareUnlockTime(t){return this.getContract().read.shareUnlockTime([t])}isPaused(){return this.getContract().read.isPaused()}deposit(t,e,s,r){const n=p.TOKENS_ADDRESSES[e][this.chain];return{transact:()=>this.getContract().write.deposit([n,s,r],{account:t,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.deposit([n,s,r],{account:t})}}depositWithPermit(t){const{account:e,depositAsset:s,depositAmount:r,minimumMint:n,deadline:a,v:c,r:o,s:h}=t;return{transact:()=>this.getContract().write.depositWithPermit([s,r,n,a,c,o,h],{account:e,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.depositWithPermit([s,r,n,a,c,o,h],{account:e})}}}exports.NucleusTellerHandler=T;
1
+ "use strict";var P=Object.defineProperty;var S=(n,t,e)=>t in n?P(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var u=(n,t,e)=>S(n,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("../../constants-BvU-JhfL.cjs"),T=require("../addresses.cjs"),E=require("../abis/nucleus-teller-abis.cjs"),C=require("../tokens.cjs"),_=require("./erc20-permit-handler.cjs"),v=require("../../getContract-MrPLx6gp.cjs");class A{constructor(t,e,i){u(this,"viemChain");u(this,"erc20PermitHandler");this.chain=t,this.walletClient=e,this.publicClient=i,this.viemChain=p.VIEM_CHAINS[t],this.erc20PermitHandler=new _.ERC20PermitHandler(t,e,i)}getContract(){const t=T.CONTRACT_ADDRESSES[this.chain].NucleusTeller,e=E.NUCLEUS_TELLER_ABIS[this.chain].Teller,i={public:this.publicClient,wallet:this.walletClient};return v.getContract({address:t,abi:e,client:i})}accountant(){return this.getContract().read.accountant()}vault(){return this.getContract().read.vault()}shareLockPeriod(){return this.getContract().read.shareLockPeriod()}shareUnlockTime(t){return this.getContract().read.shareUnlockTime([t])}isPaused(){return this.getContract().read.isPaused()}async deposit(t){const{token:e,unifiToken:i,account:s,amount:r,minimumMint:a,isPreapproved:o=!1}=t,c=C.TOKENS_ADDRESSES[e][this.chain];if(o)return{transact:()=>this.getContract().write.deposit([c,r,a],{account:s,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.deposit([c,r,a],{account:s})};const{r:h,s:l,v:d,deadline:g}=await this.erc20PermitHandler.withToken(e).getPermitSignature(s,C.TOKENS_ADDRESSES[i][this.chain],r),m=[c,r,a,g,Number(d),h,l];return{transact:()=>this.getContract().write.depositWithPermit(m,{account:s,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.depositWithPermit(m,{account:s})}}depositWithPermit(t){const{account:e,depositAsset:i,depositAmount:s,minimumMint:r,deadline:a,v:o,r:c,s:h}=t;return{transact:()=>this.getContract().write.depositWithPermit([i,s,r,a,o,c,h],{account:e,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.depositWithPermit([i,s,r,a,o,c,h],{account:e})}}}exports.NucleusTellerHandler=A;
2
2
  //# sourceMappingURL=nucleus-teller-handler.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"nucleus-teller-handler.cjs","sources":["../../../lib/contracts/handlers/nucleus-teller-handler.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { CONTRACT_ADDRESSES } from '../addresses';\nimport { NUCLEUS_TELLER_ABIS } from '../abis/nucleus-teller-abis';\nimport { Token, TOKENS_ADDRESSES } from '../tokens';\n\nexport type DepositWithPermitParams = {\n account: Address;\n depositAsset: Address;\n depositAmount: bigint;\n minimumMint: bigint;\n deadline: bigint;\n v: number;\n r: Address;\n s: Address;\n};\n\n/**\n * Handler for the `Teller` contract from nucleus.\n */\nexport class NucleusTellerHandler {\n private viemChain: ViemChain;\n\n /**\n * Create the handler for processing tokens.\n *\n * @param chain Chain to use for the client.\n * @param walletClient The wallet client to use for wallet\n * interactions.\n * @param publicClient The public client to use for public\n * interactions.\n */\n constructor(\n private chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.viemChain = VIEM_CHAINS[chain];\n }\n\n /**\n * Get the contract. This is a method because the typings are complex\n * and lost when trying to make it a member.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = CONTRACT_ADDRESSES[this.chain].NucleusTeller as Address;\n const abi = NUCLEUS_TELLER_ABIS[this.chain].Teller;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Get the address of the `Accountant` contract.\n *\n * @returns The address of the `Accountant` contract.\n */\n public accountant() {\n return this.getContract().read.accountant();\n }\n\n /**\n * Get the address of the `BoringVault` contract.\n *\n * @returns The address of the `BoringVault` contract.\n */\n public vault() {\n return this.getContract().read.vault();\n }\n\n /**\n * Get the share lock period.\n *\n * @returns The share lock period.\n */\n public shareLockPeriod() {\n return this.getContract().read.shareLockPeriod();\n }\n\n /**\n * Get the share unlock time for the given wallet address.\n *\n * @param walletAddress Address of the wallet.\n * @returns The share unlock time.\n */\n public shareUnlockTime(walletAddress: Address) {\n return this.getContract().read.shareUnlockTime([walletAddress]);\n }\n\n /**\n * Get the paused state of the contract.\n *\n * @returns The paused state of the contract.\n */\n public isPaused() {\n return this.getContract().read.isPaused();\n }\n\n /**\n * Deposit the given token for staking.\n *\n * @param walletAddress Address of the caller of the transaction.\n * @param token Token to deposit.\n * @param amount Amount of the token to deposit.\n * @param minimumMint Minimum amount of shares to mint.\n * @returns `transact: () => Promise<Address>` - Used to make the\n * transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public deposit(\n walletAddress: Address,\n token: Token,\n amount: bigint,\n minimumMint: bigint,\n ) {\n const tokenAddress = TOKENS_ADDRESSES[token][this.chain];\n\n const transact = () =>\n this.getContract().write.deposit([tokenAddress, amount, minimumMint], {\n account: walletAddress,\n chain: this.viemChain,\n });\n const estimate = () =>\n this.getContract().estimateGas.deposit(\n [tokenAddress, amount, minimumMint],\n {\n account: walletAddress,\n },\n );\n\n return { transact, estimate };\n }\n\n /**\n * Deposit an asset/token for staking with a permit.\n *\n * @param params Permit parameters.\n * @param params.account Address of the caller of the transaction.\n * @param params.depositAsset Address of the asset/token to deposit.\n * @param params.depositAmount Amount of the asset/token to deposit.\n * @param params.minimumMint Minimum amount of shares to mint.\n * @param params.deadline Deadline for the permit.\n * @param params.v v value of the permit.\n * @param params.r r value of the permit.\n * @param params.s s value of the permit.\n * @returns `transact: () => Promise<Address>` - Used to make the\n * transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public depositWithPermit(params: DepositWithPermitParams) {\n const {\n account,\n depositAsset,\n depositAmount,\n minimumMint,\n deadline,\n v,\n r,\n s,\n } = params;\n\n const transact = () =>\n this.getContract().write.depositWithPermit(\n [depositAsset, depositAmount, minimumMint, deadline, v, r, s],\n {\n account,\n chain: this.viemChain,\n },\n );\n const estimate = () =>\n this.getContract().estimateGas.depositWithPermit(\n [depositAsset, depositAmount, minimumMint, deadline, v, r, s],\n {\n account,\n },\n );\n\n return { transact, estimate };\n }\n}\n"],"names":["NucleusTellerHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","address","CONTRACT_ADDRESSES","abi","NUCLEUS_TELLER_ABIS","client","getContract","walletAddress","token","amount","minimumMint","tokenAddress","TOKENS_ADDRESSES","params","account","depositAsset","depositAmount","deadline","v","r","s"],"mappings":"sbA4BO,MAAMA,CAAqB,CAYhC,YACUC,EACAC,EACAC,EACR,CAfMC,EAAA,kBAYE,KAAA,MAAAH,EACA,KAAA,aAAAC,EACA,KAAA,aAAAC,EAEH,KAAA,UAAYE,cAAYJ,CAAK,CACpC,CAQO,aAAc,CACnB,MAAMK,EAAUC,EAAA,mBAAmB,KAAK,KAAK,EAAE,cACzCC,EAAMC,EAAA,oBAAoB,KAAK,KAAK,EAAE,OACtCC,EAAS,CAAE,OAAQ,KAAK,aAAc,OAAQ,KAAK,cAEzD,OAAOC,EAAY,YAAA,CAAE,QAAAL,EAAS,IAAAE,EAAK,OAAAE,CAAQ,CAAA,CAK7C,CAOO,YAAa,CAClB,OAAO,KAAK,YAAA,EAAc,KAAK,WAAW,CAC5C,CAOO,OAAQ,CACb,OAAO,KAAK,YAAA,EAAc,KAAK,MAAM,CACvC,CAOO,iBAAkB,CACvB,OAAO,KAAK,YAAA,EAAc,KAAK,gBAAgB,CACjD,CAQO,gBAAgBE,EAAwB,CAC7C,OAAO,KAAK,cAAc,KAAK,gBAAgB,CAACA,CAAa,CAAC,CAChE,CAOO,UAAW,CAChB,OAAO,KAAK,YAAA,EAAc,KAAK,SAAS,CAC1C,CAeO,QACLA,EACAC,EACAC,EACAC,EACA,CACA,MAAMC,EAAeC,EAAAA,iBAAiBJ,CAAK,EAAE,KAAK,KAAK,EAehD,MAAA,CAAE,SAbQ,IACf,KAAK,cAAc,MAAM,QAAQ,CAACG,EAAcF,EAAQC,CAAW,EAAG,CACpE,QAASH,EACT,MAAO,KAAK,SAAA,CACb,EASgB,SARF,IACf,KAAK,cAAc,YAAY,QAC7B,CAACI,EAAcF,EAAQC,CAAW,EAClC,CACE,QAASH,CACX,CAAA,EAIN,CAoBO,kBAAkBM,EAAiC,CAClD,KAAA,CACJ,QAAAC,EACA,aAAAC,EACA,cAAAC,EACA,YAAAN,EACA,SAAAO,EACA,EAAAC,EACA,EAAAC,EACA,EAAAC,CACE,EAAAP,EAkBG,MAAA,CAAE,SAhBQ,IACf,KAAK,cAAc,MAAM,kBACvB,CAACE,EAAcC,EAAeN,EAAaO,EAAUC,EAAGC,EAAGC,CAAC,EAC5D,CACE,QAAAN,EACA,MAAO,KAAK,SACd,CAAA,EAUe,SARF,IACf,KAAK,cAAc,YAAY,kBAC7B,CAACC,EAAcC,EAAeN,EAAaO,EAAUC,EAAGC,EAAGC,CAAC,EAC5D,CACE,QAAAN,CACF,CAAA,EAIN,CACF"}
1
+ {"version":3,"file":"nucleus-teller-handler.cjs","sources":["../../../lib/contracts/handlers/nucleus-teller-handler.ts"],"sourcesContent":["import {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { CONTRACT_ADDRESSES } from '../addresses';\nimport { NUCLEUS_TELLER_ABIS } from '../abis/nucleus-teller-abis';\nimport { Token, TOKENS_ADDRESSES, UnifiToken } from '../tokens';\nimport { ERC20PermitHandler } from './erc20-permit-handler';\n\nexport type DepositParams = {\n account: Address;\n token: Token;\n unifiToken: UnifiToken;\n amount: bigint;\n minimumMint: bigint;\n isPreapproved?: boolean;\n};\n\nexport type DepositWithPermitParams = {\n account: Address;\n depositAsset: Address;\n depositAmount: bigint;\n minimumMint: bigint;\n deadline: bigint;\n v: number;\n r: Address;\n s: Address;\n};\n\n/**\n * Handler for the `Teller` contract from nucleus.\n */\nexport class NucleusTellerHandler {\n private viemChain: ViemChain;\n private erc20PermitHandler: ERC20PermitHandler;\n\n /**\n * Create the handler for processing tokens.\n *\n * @param chain Chain to use for the client.\n * @param walletClient The wallet client to use for wallet\n * interactions.\n * @param publicClient The public client to use for public\n * interactions.\n */\n constructor(\n private chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.viemChain = VIEM_CHAINS[chain];\n this.erc20PermitHandler = new ERC20PermitHandler(\n chain,\n walletClient,\n publicClient,\n );\n }\n\n /**\n * Get the contract. This is a method because the typings are complex\n * and lost when trying to make it a member.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = CONTRACT_ADDRESSES[this.chain].NucleusTeller as Address;\n const abi = NUCLEUS_TELLER_ABIS[this.chain].Teller;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Get the address of the `Accountant` contract.\n *\n * @returns The address of the `Accountant` contract.\n */\n public accountant() {\n return this.getContract().read.accountant();\n }\n\n /**\n * Get the address of the `BoringVault` contract.\n *\n * @returns The address of the `BoringVault` contract.\n */\n public vault() {\n return this.getContract().read.vault();\n }\n\n /**\n * Get the share lock period.\n *\n * @returns The share lock period.\n */\n public shareLockPeriod() {\n return this.getContract().read.shareLockPeriod();\n }\n\n /**\n * Get the share unlock time for the given wallet address.\n *\n * @param walletAddress Address of the wallet.\n * @returns The share unlock time.\n */\n public shareUnlockTime(walletAddress: Address) {\n return this.getContract().read.shareUnlockTime([walletAddress]);\n }\n\n /**\n * Get the paused state of the contract.\n *\n * @returns The paused state of the contract.\n */\n public isPaused() {\n return this.getContract().read.isPaused();\n }\n\n /**\n * Deposit the given token for staking. This doesn't make the\n * transaction but returns two methods namely `transact` and\n * `estimate`.\n *\n * @param params Deposit parameters.\n * @param params.account Address of the caller of the transaction.\n * @param params.token Token to deposit.\n * @param params.unifiToken UniFi token to get in return of the deposit.\n * @param params.amount Amount of the token to deposit.\n * @param params.minimumMint Minimum amount of shares to mint.\n * @param params.isPreapproved Whether the token is preapproved.\n * @returns `transact: () => Promise<Address>` - Used to make the\n * transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public async deposit(params: DepositParams) {\n const {\n token,\n unifiToken,\n account,\n amount,\n minimumMint,\n isPreapproved = false,\n } = params;\n const tokenAddress = TOKENS_ADDRESSES[token][this.chain];\n\n if (isPreapproved) {\n return {\n transact: () =>\n this.getContract().write.deposit(\n [tokenAddress, amount, minimumMint],\n {\n account,\n chain: this.viemChain,\n },\n ),\n estimate: () =>\n this.getContract().estimateGas.deposit(\n [tokenAddress, amount, minimumMint],\n { account },\n ),\n };\n }\n\n const { r, s, v, deadline } = await this.erc20PermitHandler\n .withToken(token)\n .getPermitSignature(\n account,\n // The UniFi token contract is the spender.\n TOKENS_ADDRESSES[unifiToken][this.chain],\n amount,\n );\n\n const depositArgs = <const>[\n tokenAddress,\n amount,\n minimumMint,\n deadline,\n Number(v),\n r,\n s,\n ];\n\n const transact = () =>\n this.getContract().write.depositWithPermit(depositArgs, {\n account,\n chain: this.viemChain,\n });\n const estimate = () =>\n this.getContract().estimateGas.depositWithPermit(depositArgs, {\n account,\n });\n\n return { transact, estimate };\n }\n\n /**\n * Deposit an asset/token for staking with a permit.\n *\n * @param params Permit parameters.\n * @param params.account Address of the caller of the transaction.\n * @param params.depositAsset Address of the asset/token to deposit.\n * @param params.depositAmount Amount of the asset/token to deposit.\n * @param params.minimumMint Minimum amount of shares to mint.\n * @param params.deadline Deadline for the permit.\n * @param params.v v value of the permit.\n * @param params.r r value of the permit.\n * @param params.s s value of the permit.\n * @returns `transact: () => Promise<Address>` - Used to make the\n * transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public depositWithPermit(params: DepositWithPermitParams) {\n const {\n account,\n depositAsset,\n depositAmount,\n minimumMint,\n deadline,\n v,\n r,\n s,\n } = params;\n\n const transact = () =>\n this.getContract().write.depositWithPermit(\n [depositAsset, depositAmount, minimumMint, deadline, v, r, s],\n {\n account,\n chain: this.viemChain,\n },\n );\n const estimate = () =>\n this.getContract().estimateGas.depositWithPermit(\n [depositAsset, depositAmount, minimumMint, deadline, v, r, s],\n {\n account,\n },\n );\n\n return { transact, estimate };\n }\n}\n"],"names":["NucleusTellerHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","ERC20PermitHandler","address","CONTRACT_ADDRESSES","abi","NUCLEUS_TELLER_ABIS","client","getContract","walletAddress","params","token","unifiToken","account","amount","minimumMint","isPreapproved","tokenAddress","TOKENS_ADDRESSES","r","s","v","deadline","depositArgs","depositAsset","depositAmount"],"mappings":"8dAoCO,MAAMA,CAAqB,CAahC,YACUC,EACAC,EACAC,EACR,CAhBMC,EAAA,kBACAA,EAAA,2BAYE,KAAA,MAAAH,EACA,KAAA,aAAAC,EACA,KAAA,aAAAC,EAEH,KAAA,UAAYE,cAAYJ,CAAK,EAClC,KAAK,mBAAqB,IAAIK,EAAA,mBAC5BL,EACAC,EACAC,CAAA,CAEJ,CAQO,aAAc,CACnB,MAAMI,EAAUC,EAAA,mBAAmB,KAAK,KAAK,EAAE,cACzCC,EAAMC,EAAA,oBAAoB,KAAK,KAAK,EAAE,OACtCC,EAAS,CAAE,OAAQ,KAAK,aAAc,OAAQ,KAAK,cAEzD,OAAOC,EAAY,YAAA,CAAE,QAAAL,EAAS,IAAAE,EAAK,OAAAE,CAAQ,CAAA,CAK7C,CAOO,YAAa,CAClB,OAAO,KAAK,YAAA,EAAc,KAAK,WAAW,CAC5C,CAOO,OAAQ,CACb,OAAO,KAAK,YAAA,EAAc,KAAK,MAAM,CACvC,CAOO,iBAAkB,CACvB,OAAO,KAAK,YAAA,EAAc,KAAK,gBAAgB,CACjD,CAQO,gBAAgBE,EAAwB,CAC7C,O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EAAUD,EAAGF,EAAGC,CAAC,EAC5D,CACE,QAAAP,EACA,MAAO,KAAK,SACd,CAAA,EAUe,SARF,IACf,KAAK,cAAc,YAAY,kBAC7B,CAACW,EAAcC,EAAeV,EAAaO,EAAUD,EAAGF,EAAGC,CAAC,EAC5D,CACE,QAAAP,CACF,CAAA,EAIN,CACF"}
@@ -1,6 +1,14 @@
1
1
  import { WalletClient, PublicClient, Address, GetContractReturnType } from 'viem';
2
2
  import { Chain, ViemChain } from '../../chains/constants';
3
- import { Token } from '../tokens';
3
+ import { Token, UnifiToken } from '../tokens';
4
+ export type DepositParams = {
5
+ account: Address;
6
+ token: Token;
7
+ unifiToken: UnifiToken;
8
+ amount: bigint;
9
+ minimumMint: bigint;
10
+ isPreapproved?: boolean;
11
+ };
4
12
  export type DepositWithPermitParams = {
5
13
  account: Address;
6
14
  depositAsset: Address;
@@ -19,6 +27,7 @@ export declare class NucleusTellerHandler {
19
27
  private walletClient;
20
28
  private publicClient;
21
29
  private viemChain;
30
+ private erc20PermitHandler;
22
31
  /**
23
32
  * Create the handler for processing tokens.
24
33
  *
@@ -6723,22 +6732,27 @@ export declare class NucleusTellerHandler {
6723
6732
  */
6724
6733
  isPaused(): Promise<boolean>;
6725
6734
  /**
6726
- * Deposit the given token for staking.
6735
+ * Deposit the given token for staking. This doesn't make the
6736
+ * transaction but returns two methods namely `transact` and
6737
+ * `estimate`.
6727
6738
  *
6728
- * @param walletAddress Address of the caller of the transaction.
6729
- * @param token Token to deposit.
6730
- * @param amount Amount of the token to deposit.
6731
- * @param minimumMint Minimum amount of shares to mint.
6739
+ * @param params Deposit parameters.
6740
+ * @param params.account Address of the caller of the transaction.
6741
+ * @param params.token Token to deposit.
6742
+ * @param params.unifiToken UniFi token to get in return of the deposit.
6743
+ * @param params.amount Amount of the token to deposit.
6744
+ * @param params.minimumMint Minimum amount of shares to mint.
6745
+ * @param params.isPreapproved Whether the token is preapproved.
6732
6746
  * @returns `transact: () => Promise<Address>` - Used to make the
6733
6747
  * transaction with the given value.
6734
6748
  *
6735
6749
  * `estimate: () => Promise<bigint>` - Gas estimate of the
6736
6750
  * transaction.
6737
6751
  */
6738
- deposit(walletAddress: Address, token: Token, amount: bigint, minimumMint: bigint): {
6752
+ deposit(params: DepositParams): Promise<{
6739
6753
  transact: () => Promise<`0x${string}`>;
6740
6754
  estimate: () => Promise<bigint>;
6741
- };
6755
+ }>;
6742
6756
  /**
6743
6757
  * Deposit an asset/token for staking with a permit.
6744
6758
  *
@@ -1,12 +1,13 @@
1
- var m = Object.defineProperty;
2
- var u = (s, t, e) => t in s ? m(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
- var l = (s, t, e) => u(s, typeof t != "symbol" ? t + "" : t, e);
4
- import { V as C } from "../../constants-rWWWhxR_.js";
5
- import { CONTRACT_ADDRESSES as d } from "../addresses.js";
6
- import { NUCLEUS_TELLER_ABIS as p } from "../abis/nucleus-teller-abis.js";
7
- import { TOKENS_ADDRESSES as g } from "../tokens.js";
8
- import { g as S } from "../../getContract-B3Spz0SO.js";
9
- class L {
1
+ var g = Object.defineProperty;
2
+ var P = (a, t, e) => t in a ? g(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
3
+ var m = (a, t, e) => P(a, typeof t != "symbol" ? t + "" : t, e);
4
+ import { V as S } from "../../constants-rWWWhxR_.js";
5
+ import { CONTRACT_ADDRESSES as T } from "../addresses.js";
6
+ import { NUCLEUS_TELLER_ABIS as v } from "../abis/nucleus-teller-abis.js";
7
+ import { TOKENS_ADDRESSES as C } from "../tokens.js";
8
+ import { ERC20PermitHandler as E } from "./erc20-permit-handler.js";
9
+ import { g as f } from "../../getContract-B3Spz0SO.js";
10
+ class b {
10
11
  /**
11
12
  * Create the handler for processing tokens.
12
13
  *
@@ -17,8 +18,13 @@ class L {
17
18
  * interactions.
18
19
  */
19
20
  constructor(t, e, i) {
20
- l(this, "viemChain");
21
- this.chain = t, this.walletClient = e, this.publicClient = i, this.viemChain = C[t];
21
+ m(this, "viemChain");
22
+ m(this, "erc20PermitHandler");
23
+ this.chain = t, this.walletClient = e, this.publicClient = i, this.viemChain = S[t], this.erc20PermitHandler = new E(
24
+ t,
25
+ e,
26
+ i
27
+ );
22
28
  }
23
29
  /**
24
30
  * Get the contract. This is a method because the typings are complex
@@ -27,8 +33,8 @@ class L {
27
33
  * @returns The viem contract.
28
34
  */
29
35
  getContract() {
30
- const t = d[this.chain].NucleusTeller, e = p[this.chain].Teller, i = { public: this.publicClient, wallet: this.walletClient };
31
- return S({ address: t, abi: e, client: i });
36
+ const t = T[this.chain].NucleusTeller, e = v[this.chain].Teller, i = { public: this.publicClient, wallet: this.walletClient };
37
+ return f({ address: t, abi: e, client: i });
32
38
  }
33
39
  /**
34
40
  * Get the address of the `Accountant` contract.
@@ -72,29 +78,66 @@ class L {
72
78
  return this.getContract().read.isPaused();
73
79
  }
74
80
  /**
75
- * Deposit the given token for staking.
81
+ * Deposit the given token for staking. This doesn't make the
82
+ * transaction but returns two methods namely `transact` and
83
+ * `estimate`.
76
84
  *
77
- * @param walletAddress Address of the caller of the transaction.
78
- * @param token Token to deposit.
79
- * @param amount Amount of the token to deposit.
80
- * @param minimumMint Minimum amount of shares to mint.
85
+ * @param params Deposit parameters.
86
+ * @param params.account Address of the caller of the transaction.
87
+ * @param params.token Token to deposit.
88
+ * @param params.unifiToken UniFi token to get in return of the deposit.
89
+ * @param params.amount Amount of the token to deposit.
90
+ * @param params.minimumMint Minimum amount of shares to mint.
91
+ * @param params.isPreapproved Whether the token is preapproved.
81
92
  * @returns `transact: () => Promise<Address>` - Used to make the
82
93
  * transaction with the given value.
83
94
  *
84
95
  * `estimate: () => Promise<bigint>` - Gas estimate of the
85
96
  * transaction.
86
97
  */
87
- deposit(t, e, i, r) {
88
- const a = g[e][this.chain];
89
- return { transact: () => this.getContract().write.deposit([a, i, r], {
90
- account: t,
98
+ async deposit(t) {
99
+ const {
100
+ token: e,
101
+ unifiToken: i,
102
+ account: r,
103
+ amount: s,
104
+ minimumMint: n,
105
+ isPreapproved: c = !1
106
+ } = t, o = C[e][this.chain];
107
+ if (c)
108
+ return {
109
+ transact: () => this.getContract().write.deposit(
110
+ [o, s, n],
111
+ {
112
+ account: r,
113
+ chain: this.viemChain
114
+ }
115
+ ),
116
+ estimate: () => this.getContract().estimateGas.deposit(
117
+ [o, s, n],
118
+ { account: r }
119
+ )
120
+ };
121
+ const { r: h, s: d, v: u, deadline: p } = await this.erc20PermitHandler.withToken(e).getPermitSignature(
122
+ r,
123
+ // The UniFi token contract is the spender.
124
+ C[i][this.chain],
125
+ s
126
+ ), l = [
127
+ o,
128
+ s,
129
+ n,
130
+ p,
131
+ Number(u),
132
+ h,
133
+ d
134
+ ];
135
+ return { transact: () => this.getContract().write.depositWithPermit(l, {
136
+ account: r,
91
137
  chain: this.viemChain
92
- }), estimate: () => this.getContract().estimateGas.deposit(
93
- [a, i, r],
94
- {
95
- account: t
96
- }
97
- ) };
138
+ }), estimate: () => this.getContract().estimateGas.depositWithPermit(l, {
139
+ account: r
140
+ }) };
98
141
  }
99
142
  /**
100
143
  * Deposit an asset/token for staking with a permit.
@@ -119,20 +162,20 @@ class L {
119
162
  account: e,
120
163
  depositAsset: i,
121
164
  depositAmount: r,
122
- minimumMint: a,
165
+ minimumMint: s,
123
166
  deadline: n,
124
- v: o,
125
- r: c,
167
+ v: c,
168
+ r: o,
126
169
  s: h
127
170
  } = t;
128
171
  return { transact: () => this.getContract().write.depositWithPermit(
129
- [i, r, a, n, o, c, h],
172
+ [i, r, s, n, c, o, h],
130
173
  {
131
174
  account: e,
132
175
  chain: this.viemChain
133
176
  }
134
177
  ), estimate: () => this.getContract().estimateGas.depositWithPermit(
135
- [i, r, a, n, o, c, h],
178
+ [i, r, s, n, c, o, h],
136
179
  {
137
180
  account: e
138
181
  }
@@ -140,6 +183,6 @@ class L {
140
183
  }
141
184
  }
142
185
  export {
143
- L as NucleusTellerHandler
186
+ b as NucleusTellerHandler
144
187
  };
145
188
  //# sourceMappingURL=nucleus-teller-handler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nucleus-teller-handler.js","sources":["../../../lib/contracts/handlers/nucleus-teller-handler.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { CONTRACT_ADDRESSES } from '../addresses';\nimport { NUCLEUS_TELLER_ABIS } from '../abis/nucleus-teller-abis';\nimport { Token, TOKENS_ADDRESSES } from '../tokens';\n\nexport type DepositWithPermitParams = {\n account: Address;\n depositAsset: Address;\n depositAmount: bigint;\n minimumMint: bigint;\n deadline: bigint;\n v: number;\n r: Address;\n s: Address;\n};\n\n/**\n * Handler for the `Teller` contract from nucleus.\n */\nexport class NucleusTellerHandler {\n private viemChain: ViemChain;\n\n /**\n * Create the handler for processing tokens.\n *\n * @param chain Chain to use for the client.\n * @param walletClient The wallet client to use for wallet\n * interactions.\n * @param publicClient The public client to use for public\n * interactions.\n */\n constructor(\n private chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.viemChain = VIEM_CHAINS[chain];\n }\n\n /**\n * Get the contract. This is a method because the typings are complex\n * and lost when trying to make it a member.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = CONTRACT_ADDRESSES[this.chain].NucleusTeller as Address;\n const abi = NUCLEUS_TELLER_ABIS[this.chain].Teller;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Get the address of the `Accountant` contract.\n *\n * @returns The address of the `Accountant` contract.\n */\n public accountant() {\n return this.getContract().read.accountant();\n }\n\n /**\n * Get the address of the `BoringVault` contract.\n *\n * @returns The address of the `BoringVault` contract.\n */\n public vault() {\n return this.getContract().read.vault();\n }\n\n /**\n * Get the share lock period.\n *\n * @returns The share lock period.\n */\n public shareLockPeriod() {\n return this.getContract().read.shareLockPeriod();\n }\n\n /**\n * Get the share unlock time for the given wallet address.\n *\n * @param walletAddress Address of the wallet.\n * @returns The share unlock time.\n */\n public shareUnlockTime(walletAddress: Address) {\n return this.getContract().read.shareUnlockTime([walletAddress]);\n }\n\n /**\n * Get the paused state of the contract.\n *\n * @returns The paused state of the contract.\n */\n public isPaused() {\n return this.getContract().read.isPaused();\n }\n\n /**\n * Deposit the given token for staking.\n *\n * @param walletAddress Address of the caller of the transaction.\n * @param token Token to deposit.\n * @param amount Amount of the token to deposit.\n * @param minimumMint Minimum amount of shares to mint.\n * @returns `transact: () => Promise<Address>` - Used to make the\n * transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public deposit(\n walletAddress: Address,\n token: Token,\n amount: bigint,\n minimumMint: bigint,\n ) {\n const tokenAddress = TOKENS_ADDRESSES[token][this.chain];\n\n const transact = () =>\n this.getContract().write.deposit([tokenAddress, amount, minimumMint], {\n account: walletAddress,\n chain: this.viemChain,\n });\n const estimate = () =>\n this.getContract().estimateGas.deposit(\n [tokenAddress, amount, minimumMint],\n {\n account: walletAddress,\n },\n );\n\n return { transact, estimate };\n }\n\n /**\n * Deposit an asset/token for staking with a permit.\n *\n * @param params Permit parameters.\n * @param params.account Address of the caller of the transaction.\n * @param params.depositAsset Address of the asset/token to deposit.\n * @param params.depositAmount Amount of the asset/token to deposit.\n * @param params.minimumMint Minimum amount of shares to mint.\n * @param params.deadline Deadline for the permit.\n * @param params.v v value of the permit.\n * @param params.r r value of the permit.\n * @param params.s s value of the permit.\n * @returns `transact: () => Promise<Address>` - Used to make the\n * transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public depositWithPermit(params: DepositWithPermitParams) {\n const {\n account,\n depositAsset,\n depositAmount,\n minimumMint,\n deadline,\n v,\n r,\n s,\n } = params;\n\n const transact = () =>\n this.getContract().write.depositWithPermit(\n [depositAsset, depositAmount, minimumMint, deadline, v, r, s],\n {\n account,\n chain: this.viemChain,\n },\n );\n const estimate = () =>\n this.getContract().estimateGas.depositWithPermit(\n [depositAsset, depositAmount, minimumMint, deadline, v, r, s],\n {\n account,\n },\n );\n\n return { transact, estimate };\n }\n}\n"],"names":["NucleusTellerHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","address","CONTRACT_ADDRESSES","abi","NUCLEUS_TELLER_ABIS","client","getContract","walletAddress","token","amount","minimumMint","tokenAddress","TOKENS_ADDRESSES","params","account","depositAsset","depositAmount","deadline","v","r","s"],"mappings":";;;;;;;;AA4BO,MAAMA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYhC,YACUC,GACAC,GACAC,GACR;AAfM,IAAAC,EAAA;AAYE,SAAA,QAAAH,GACA,KAAA,eAAAC,GACA,KAAA,eAAAC,GAEH,KAAA,YAAYE,EAAYJ,CAAK;AAAA,EACpC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQO,cAAc;AACnB,UAAMK,IAAUC,EAAmB,KAAK,KAAK,EAAE,eACzCC,IAAMC,EAAoB,KAAK,KAAK,EAAE,QACtCC,IAAS,EAAE,QAAQ,KAAK,cAAc,QAAQ,KAAK;AAEzD,WAAOC,EAAY,EAAE,SAAAL,GAAS,KAAAE,GAAK,QAAAE,EAAQ,CAAA;AAAA,EAK7C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,aAAa;AAClB,WAAO,KAAK,YAAA,EAAc,KAAK,WAAW;AAAA,EAC5C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,QAAQ;AACb,WAAO,KAAK,YAAA,EAAc,KAAK,MAAM;AAAA,EACvC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,kBAAkB;AACvB,WAAO,KAAK,YAAA,EAAc,KAAK,gBAAgB;AAAA,EACjD;AAAA;AAAA;AAAA;AAA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C,GAAeN,GAAaO,GAAUC,GAAGC,GAAGC,CAAC;AAAA,MAC5D;AAAA,QACE,SAAAN;AAAA,MACF;AAAA,IAAA;EAIN;AACF;"}
1
+ {"version":3,"file":"nucleus-teller-handler.js","sources":["../../../lib/contracts/handlers/nucleus-teller-handler.ts"],"sourcesContent":["import {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { CONTRACT_ADDRESSES } from '../addresses';\nimport { NUCLEUS_TELLER_ABIS } from '../abis/nucleus-teller-abis';\nimport { Token, TOKENS_ADDRESSES, UnifiToken } from '../tokens';\nimport { ERC20PermitHandler } from './erc20-permit-handler';\n\nexport type DepositParams = {\n account: Address;\n token: Token;\n unifiToken: UnifiToken;\n amount: bigint;\n minimumMint: bigint;\n isPreapproved?: boolean;\n};\n\nexport type DepositWithPermitParams = {\n account: Address;\n depositAsset: Address;\n depositAmount: bigint;\n minimumMint: bigint;\n deadline: bigint;\n v: number;\n r: Address;\n s: Address;\n};\n\n/**\n * Handler for the `Teller` contract from nucleus.\n */\nexport class NucleusTellerHandler {\n private viemChain: ViemChain;\n private erc20PermitHandler: ERC20PermitHandler;\n\n /**\n * Create the handler for processing tokens.\n *\n * @param chain Chain to use for the client.\n * @param walletClient The wallet client to use for wallet\n * interactions.\n * @param publicClient The public client to use for public\n * interactions.\n */\n constructor(\n private chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.viemChain = VIEM_CHAINS[chain];\n this.erc20PermitHandler = new ERC20PermitHandler(\n chain,\n walletClient,\n publicClient,\n );\n }\n\n /**\n * Get the contract. This is a method because the typings are complex\n * and lost when trying to make it a member.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = CONTRACT_ADDRESSES[this.chain].NucleusTeller as Address;\n const abi = NUCLEUS_TELLER_ABIS[this.chain].Teller;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Get the address of the `Accountant` contract.\n *\n * @returns The address of the `Accountant` contract.\n */\n public accountant() {\n return this.getContract().read.accountant();\n }\n\n /**\n * Get the address of the `BoringVault` contract.\n *\n * @returns The address of the `BoringVault` contract.\n */\n public vault() {\n return this.getContract().read.vault();\n }\n\n /**\n * Get the share lock period.\n *\n * @returns The share lock period.\n */\n public shareLockPeriod() {\n return this.getContract().read.shareLockPeriod();\n }\n\n /**\n * Get the share unlock time for the given wallet address.\n *\n * @param walletAddress Address of the wallet.\n * @returns The share unlock time.\n */\n public shareUnlockTime(walletAddress: Address) {\n return this.getContract().read.shareUnlockTime([walletAddress]);\n }\n\n /**\n * Get the paused state of the contract.\n *\n * @returns The paused state of the contract.\n */\n public isPaused() {\n return this.getContract().read.isPaused();\n }\n\n /**\n * Deposit the given token for staking. This doesn't make the\n * transaction but returns two methods namely `transact` and\n * `estimate`.\n *\n * @param params Deposit parameters.\n * @param params.account Address of the caller of the transaction.\n * @param params.token Token to deposit.\n * @param params.unifiToken UniFi token to get in return of the deposit.\n * @param params.amount Amount of the token to deposit.\n * @param params.minimumMint Minimum amount of shares to mint.\n * @param params.isPreapproved Whether the token is preapproved.\n * @returns `transact: () => Promise<Address>` - Used to make the\n * transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public async deposit(params: DepositParams) {\n const {\n token,\n unifiToken,\n account,\n amount,\n minimumMint,\n isPreapproved = false,\n } = params;\n const tokenAddress = TOKENS_ADDRESSES[token][this.chain];\n\n if (isPreapproved) {\n return {\n transact: () =>\n this.getContract().write.deposit(\n [tokenAddress, amount, minimumMint],\n {\n account,\n chain: this.viemChain,\n },\n ),\n estimate: () =>\n this.getContract().estimateGas.deposit(\n [tokenAddress, amount, minimumMint],\n { account },\n ),\n };\n }\n\n const { r, s, v, deadline } = await this.erc20PermitHandler\n .withToken(token)\n .getPermitSignature(\n account,\n // The UniFi token contract is the spender.\n TOKENS_ADDRESSES[unifiToken][this.chain],\n amount,\n );\n\n const depositArgs = <const>[\n tokenAddress,\n amount,\n minimumMint,\n deadline,\n Number(v),\n r,\n s,\n ];\n\n const transact = () =>\n this.getContract().write.depositWithPermit(depositArgs, {\n account,\n chain: this.viemChain,\n });\n const estimate = () =>\n this.getContract().estimateGas.depositWithPermit(depositArgs, {\n account,\n });\n\n return { transact, estimate };\n }\n\n /**\n * Deposit an asset/token for staking with a permit.\n *\n * @param params Permit parameters.\n * @param params.account Address of the caller of the transaction.\n * @param params.depositAsset Address of the asset/token to deposit.\n * @param params.depositAmount Amount of the asset/token to deposit.\n * @param params.minimumMint Minimum amount of shares to mint.\n * @param params.deadline Deadline for the permit.\n * @param params.v v value of the permit.\n * @param params.r r value of the permit.\n * @param params.s s value of the permit.\n * @returns `transact: () => Promise<Address>` - Used to make the\n * transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public depositWithPermit(params: DepositWithPermitParams) {\n const {\n account,\n depositAsset,\n depositAmount,\n minimumMint,\n deadline,\n v,\n r,\n s,\n } = params;\n\n const transact = () =>\n this.getContract().write.depositWithPermit(\n [depositAsset, depositAmount, minimumMint, deadline, v, r, s],\n {\n account,\n chain: this.viemChain,\n },\n );\n const estimate = () =>\n this.getContract().estimateGas.depositWithPermit(\n [depositAsset, depositAmount, minimumMint, deadline, v, r, s],\n {\n account,\n },\n );\n\n return { transact, estimate };\n }\n}\n"],"names":["NucleusTellerHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","ERC20PermitHandler","address","CONTRACT_ADDRESSES","abi","NUCLEUS_TELLER_ABIS","client","getContract","walletAddress","params","token","unifiToken","account","amount","minimumMint","isPreapproved","tokenAddress","TOKENS_ADDRESSES","r","s","v","deadline","depositArgs","depositAsset","depositAmount"],"mappings":";;;;;;;;;AAoCO,MAAMA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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,SAAAG;AAAA,MACA,cAAAW;AAAA,MACA,eAAAC;AAAA,MACA,aAAAV;AAAA,MACA,UAAAO;AAAA,MACA,GAAAD;AAAA,MACA,GAAAF;AAAA,MACA,GAAAC;AAAA,IACE,IAAAV;AAkBG,WAAA,EAAE,UAhBQ,MACf,KAAK,cAAc,MAAM;AAAA,MACvB,CAACc,GAAcC,GAAeV,GAAaO,GAAUD,GAAGF,GAAGC,CAAC;AAAA,MAC5D;AAAA,QACE,SAAAP;AAAA,QACA,OAAO,KAAK;AAAA,MACd;AAAA,IAAA,GAUe,UARF,MACf,KAAK,cAAc,YAAY;AAAA,MAC7B,CAACW,GAAcC,GAAeV,GAAaO,GAAUD,GAAGF,GAAGC,CAAC;AAAA,MAC5D;AAAA,QACE,SAAAP;AAAA,MACF;AAAA,IAAA;EAIN;AACF;"}
@@ -1,2 +1,2 @@
1
- "use strict";var r=Object.defineProperty;var o=(i,t,a)=>t in i?r(i,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[t]=a;var c=(i,t,a)=>o(i,typeof t!="symbol"?t+"":t,a);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("../../constants-BvU-JhfL.cjs"),u=require("../addresses.cjs"),m=require("../abis/puffer-vault-abis.cjs"),C=require("../../getContract-MrPLx6gp.cjs");class g{constructor(t,a,e){c(this,"viemChain");this.chain=t,this.walletClient=a,this.publicClient=e,this.viemChain=h.VIEM_CHAINS[t]}getContract(){const t=u.CONTRACT_ADDRESSES[this.chain].PufferVault,a=m.PUFFER_VAULT_ABIS[this.chain].PufferVaultV2,e={public:this.publicClient,wallet:this.walletClient};return C.getContract({address:t,abi:a,client:e})}depositETH(t){return{transact:async n=>await this.getContract().write.depositETH([t],{account:t,chain:this.viemChain,value:n}),estimate:async()=>await this.getContract().estimateGas.depositETH([t],{account:t})}}async balanceOf(t){return await this.getContract().read.balanceOf([t])}async getPufETHRate(){const t=BigInt(1e18);return await this.getContract().read.previewDeposit([t])}async getAllowance(t,a){return await this.getContract().read.allowance([t,a])}withdraw(t,a,e){return{transact:async()=>await this.getContract().write.withdraw([e,a,t],{account:a,chain:this.viemChain}),estimate:async()=>await this.getContract().estimateGas.withdraw([e,a,t],{account:a})}}previewRedeem(t){return this.getContract().read.previewRedeem([t])}maxRedeem(t){return this.getContract().read.maxRedeem([t])}getExitFeeBasisPoints(){return this.getContract().read.getExitFeeBasisPoints()}getRemainingAssetsDailyWithdrawalLimit(){return this.getContract().read.getRemainingAssetsDailyWithdrawalLimit()}redeem(t,a,e){return{transact:async()=>await this.getContract().write.redeem([e,a,t],{account:t,chain:this.viemChain}),estimate:async()=>await this.getContract().estimateGas.redeem([e,a,t],{account:t})}}}exports.PufferVaultHandler=g;
1
+ "use strict";var r=Object.defineProperty;var o=(i,t,a)=>t in i?r(i,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[t]=a;var c=(i,t,a)=>o(i,typeof t!="symbol"?t+"":t,a);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("../../constants-BvU-JhfL.cjs"),u=require("../addresses.cjs"),C=require("../abis/puffer-vault-abis.cjs"),g=require("../../getContract-MrPLx6gp.cjs");class m{constructor(t,a,e){c(this,"viemChain");this.chain=t,this.walletClient=a,this.publicClient=e,this.viemChain=h.VIEM_CHAINS[t]}getContract(){const t=u.CONTRACT_ADDRESSES[this.chain].PufferVault,a=C.PUFFER_VAULT_ABIS[this.chain].PufferVaultV2,e={public:this.publicClient,wallet:this.walletClient};return g.getContract({address:t,abi:a,client:e})}depositETH(t){return{transact:async n=>await this.getContract().write.depositETH([t],{account:t,chain:this.viemChain,value:n}),estimate:async()=>await this.getContract().estimateGas.depositETH([t],{account:t})}}async balanceOf(t){return await this.getContract().read.balanceOf([t])}async getPufETHRate(){const t=BigInt(1e18);return await this.getContract().read.previewDeposit([t])}async getAllowance(t,a){return await this.getContract().read.allowance([t,a])}withdraw(t,a,e){return{transact:async()=>await this.getContract().write.withdraw([e,a,t],{account:a,chain:this.viemChain}),estimate:async()=>await this.getContract().estimateGas.withdraw([e,a,t],{account:a})}}previewRedeem(t){return this.getContract().read.previewRedeem([t])}maxRedeem(t){return this.getContract().read.maxRedeem([t])}getExitFeeBasisPoints(){return this.getContract().read.getExitFeeBasisPoints()}getRemainingAssetsDailyWithdrawalLimit(){return this.getContract().read.getRemainingAssetsDailyWithdrawalLimit()}redeem(t,a,e){return{transact:async()=>await this.getContract().write.redeem([e,a,t],{account:t,chain:this.viemChain}),estimate:async()=>await this.getContract().estimateGas.redeem([e,a,t],{account:t})}}convertToAssets(t){return this.getContract().read.convertToAssets([t])}}exports.PufferVaultHandler=m;
2
2
  //# sourceMappingURL=puffer-vault-handler.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"puffer-vault-handler.cjs","sources":["../../../lib/contracts/handlers/puffer-vault-handler.ts"],"sourcesContent":["import {\n Address,\n GetContractReturnType,\n PublicClient,\n WalletClient,\n getContract,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { CONTRACT_ADDRESSES } from '../addresses';\nimport { PUFFER_VAULT_ABIS } from '../abis/puffer-vault-abis';\n\n/**\n * Handler for the `PufferVaultV2` contract exposing methods to interact\n * with the contract.\n */\nexport class PufferVaultHandler {\n private viemChain: ViemChain;\n\n /**\n * Create the handler for the `PufferVaultV2` contract exposing\n * methods to interact with the contract.\n *\n * @param chain Chain to use for the client.\n * @param walletClient The wallet client to use for wallet\n * interactions.\n * @param publicClient The public client to use for public\n * interactions.\n */\n constructor(\n private chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.viemChain = VIEM_CHAINS[chain];\n }\n\n /**\n * Get the contract. This is a method because the typings are complex\n * and lost when trying to make it a member.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = CONTRACT_ADDRESSES[this.chain].PufferVault as Address;\n const abi = PUFFER_VAULT_ABIS[this.chain].PufferVaultV2;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Deposit ETH in exchange for pufETH. This doesn't make the\n * transaction but returns two methods namely `transact` and\n * `estimate`.\n *\n * @param walletAddress Wallet address to get the ETH from.\n * @returns `transact: (value: bigint) => Promise<Address>` - Used to\n * make the transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public depositETH(walletAddress: Address) {\n const transact = async (value: bigint) =>\n await this.getContract().write.depositETH([walletAddress], {\n account: walletAddress,\n chain: this.viemChain,\n value,\n });\n\n const estimate = async () =>\n await this.getContract().estimateGas.depositETH([walletAddress], {\n account: walletAddress,\n });\n\n return { transact, estimate };\n }\n\n /**\n * Check the pufETH balance of the wallet.\n *\n * @param walletAddress Wallet address to check the balance of.\n * @returns pufETH balance in wei.\n */\n public async balanceOf(walletAddress: Address) {\n return await this.getContract().read.balanceOf([walletAddress]);\n }\n\n /**\n * Get the rate of pufETH compared to ETH.\n *\n * @returns Rate of pufETH compared to 1 ETH.\n */\n public async getPufETHRate() {\n const oneWei = BigInt(1e18);\n return await this.getContract().read.previewDeposit([oneWei]);\n }\n\n /**\n * Get the allowance for the given owner and spender.\n *\n * @param ownerAddress Address of the owner.\n * @param spenderAddress Address of the spender.\n * @returns Allowance for the given owner and spender.\n */\n public async getAllowance(ownerAddress: Address, spenderAddress: Address) {\n return await this.getContract().read.allowance([\n ownerAddress,\n spenderAddress,\n ]);\n }\n\n /**\n * Withdraw pufETH to the given wallet address. This doesn't make the\n * transaction but returns two methods namely `transact` and\n * `estimate`.\n *\n * @param ownerAddress Address of the owner.\n * @param walletAddress Address of the receiver.\n * @param value Value of pufETH to withdraw.\n * @returns `transact: (value: bigint) => Promise<Address>` - Used to\n * make the transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public withdraw(\n ownerAddress: Address,\n walletAddress: Address,\n value: bigint,\n ) {\n const transact = async () =>\n await this.getContract().write.withdraw(\n [value, walletAddress, ownerAddress],\n {\n account: walletAddress,\n chain: this.viemChain,\n },\n );\n\n const estimate = async () =>\n await this.getContract().estimateGas.withdraw(\n [value, walletAddress, ownerAddress],\n {\n account: walletAddress,\n },\n );\n\n return { transact, estimate };\n }\n\n /**\n * Preview the amount of WETH that can be redeemed for the given\n * amount of pufETH using the `.redeem()` method.\n *\n * @param value Value of pufETH to redeem.\n * @returns Preview of the amount of WETH that can be redeemed.\n */\n public previewRedeem(value: bigint) {\n return this.getContract().read.previewRedeem([value]);\n }\n\n /**\n * Calculates the maximum amount of pufETH shares that can be redeemed\n * by the owner.\n *\n * @param ownerAddress Address of the owner's wallet.\n * @returns Maximum amount of pufETH shares that can be redeemed.\n */\n public maxRedeem(ownerAddress: Address) {\n return this.getContract().read.maxRedeem([ownerAddress]);\n }\n\n /**\n * Returns how many basis points of a fee there are when exiting. For\n * example, a 1% fee would mean 1% of the user's requested pufETH is\n * burned (which increases the value for all pufETH holders) before\n * the ETH is redeemed. i.e., you get 1% less ETH back.\n *\n * @returns Basis points of the exit fee.\n */\n public getExitFeeBasisPoints() {\n return this.getContract().read.getExitFeeBasisPoints();\n }\n\n /**\n * Returns how much WETH can still be withdrawn today.\n *\n * @returns Remaining WETH daily withdrawal limit.\n */\n public getRemainingAssetsDailyWithdrawalLimit() {\n return this.getContract().read.getRemainingAssetsDailyWithdrawalLimit();\n }\n\n /**\n * Redeems pufETH shares in exchange for WETH assets from the vault.\n * In the process, the pufETH shares of the owner are burned. This\n * doesn't make the transaction but returns two methods namely\n * `transact` and `estimate`.\n *\n * @param ownerAddress Address of the owner of pufETH.\n * @param receiverAddress Address of the receiver of WETH.\n * @param shares Amount of pufETH shares to redeem.\n * @returns `transact: (value: bigint) => Promise<Address>` - Used to\n * make the transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public redeem(\n ownerAddress: Address,\n receiverAddress: Address,\n shares: bigint,\n ) {\n const transact = async () =>\n await this.getContract().write.redeem(\n [shares, receiverAddress, ownerAddress],\n {\n account: ownerAddress,\n chain: this.viemChain,\n },\n );\n\n const estimate = async () =>\n await this.getContract().estimateGas.redeem(\n [shares, receiverAddress, ownerAddress],\n {\n account: ownerAddress,\n },\n );\n\n return { transact, estimate };\n }\n}\n"],"names":["PufferVaultHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","address","CONTRACT_ADDRESSES","abi","PUFFER_VAULT_ABIS","client","getContract","walletAddress","value","oneWei","ownerAddress","spenderAddress","receiverAddress","shares"],"mappings":"yZAeO,MAAMA,CAAmB,CAa9B,YACUC,EACAC,EACAC,EACR,CAhBMC,EAAA,kBAaE,KAAA,MAAAH,EACA,KAAA,aAAAC,EACA,KAAA,aAAAC,EAEH,KAAA,UAAYE,cAAYJ,CAAK,CACpC,CAQO,aAAc,CACnB,MAAMK,EAAUC,EAAA,mBAAmB,KAAK,KAAK,EAAE,YACzCC,EAAMC,EAAA,kBAAkB,KAAK,KAAK,EAAE,cACpCC,EAAS,CAAE,OAAQ,KAAK,aAAc,OAAQ,KAAK,cAEzD,OAAOC,EAAY,YAAA,CAAE,QAAAL,EAAS,IAAAE,EAAK,OAAAE,CAAQ,CAAA,CAK7C,CAcO,WAAWE,EAAwB,CAajC,MAAA,CAAE,SAZQ,MAAOC,GACtB,MAAM,KAAK,YAAY,EAAE,MAAM,WAAW,CAACD,CAAa,EAAG,CACzD,QAASA,EACT,MAAO,KAAK,UACZ,MAAAC,CAAA,CACD,EAOgB,SALF,SACf,MAAM,KAAK,cAAc,YAAY,WAAW,CAACD,CAAa,EAAG,CAC/D,QAASA,CAAA,CACV,EAGL,CAQA,MAAa,UAAUA,EAAwB,CACtC,OAAA,MAAM,KAAK,YAAY,EAAE,KAAK,UAAU,CAACA,CAAa,CAAC,CAChE,CAOA,MAAa,eAAgB,CACrB,MAAAE,EAAS,OAAO,IAAI,EACnB,OAAA,MAAM,KAAK,YAAY,EAAE,KAAK,eAAe,CAACA,CAAM,CAAC,CAC9D,CASA,MAAa,aAAaC,EAAuBC,EAAyB,CACxE,OAAO,MAAM,KAAK,cAAc,KAAK,UAAU,CAC7CD,EACAC,CAAA,CACD,CACH,CAgBO,SACLD,EACAH,EACAC,EACA,CAkBO,MAAA,CAAE,SAjBQ,SACf,MAAM,KAAK,cAAc,MAAM,SAC7B,CAACA,EAAOD,EAAeG,CAAY,EACnC,CACE,QAASH,EACT,MAAO,KAAK,SACd,CAAA,EAWe,SARF,SACf,MAAM,KAAK,cAAc,YAAY,SACnC,CAACC,EAAOD,EAAeG,CAAY,EACnC,CACE,QAASH,CACX,CAAA,EAIN,CASO,cAAcC,EAAe,CAClC,OAAO,KAAK,cAAc,KAAK,cAAc,CAACA,CAAK,CAAC,CACtD,CASO,UAAUE,EAAuB,CACtC,OAAO,KAAK,cAAc,KAAK,UAAU,CAACA,CAAY,CAAC,CACzD,CAUO,uBAAwB,CAC7B,OAAO,KAAK,YAAA,EAAc,KAAK,sBAAsB,CACvD,CAOO,wCAAyC,CAC9C,OAAO,KAAK,YAAA,EAAc,KAAK,uCAAuC,CACxE,CAiBO,OACLA,EACAE,EACAC,EACA,CAkBO,MAAA,CAAE,SAjBQ,SACf,MAAM,KAAK,cAAc,MAAM,OAC7B,CAACA,EAAQD,EAAiBF,CAAY,EACtC,CACE,QAASA,EACT,MAAO,KAAK,SACd,CAAA,EAWe,SARF,SACf,MAAM,KAAK,cAAc,YAAY,OACnC,CAACG,EAAQD,EAAiBF,CAAY,EACtC,CACE,QAASA,CACX,CAAA,EAIN,CACF"}
1
+ {"version":3,"file":"puffer-vault-handler.cjs","sources":["../../../lib/contracts/handlers/puffer-vault-handler.ts"],"sourcesContent":["import {\n Address,\n GetContractReturnType,\n PublicClient,\n WalletClient,\n getContract,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { CONTRACT_ADDRESSES } from '../addresses';\nimport { PUFFER_VAULT_ABIS } from '../abis/puffer-vault-abis';\n\n/**\n * Handler for the `PufferVaultV2` contract exposing methods to interact\n * with the contract.\n */\nexport class PufferVaultHandler {\n private viemChain: ViemChain;\n\n /**\n * Create the handler for the `PufferVaultV2` contract exposing\n * methods to interact with the contract.\n *\n * @param chain Chain to use for the client.\n * @param walletClient The wallet client to use for wallet\n * interactions.\n * @param publicClient The public client to use for public\n * interactions.\n */\n constructor(\n private chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.viemChain = VIEM_CHAINS[chain];\n }\n\n /**\n * Get the contract. This is a method because the typings are complex\n * and lost when trying to make it a member.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = CONTRACT_ADDRESSES[this.chain].PufferVault as Address;\n const abi = PUFFER_VAULT_ABIS[this.chain].PufferVaultV2;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Deposit ETH in exchange for pufETH. This doesn't make the\n * transaction but returns two methods namely `transact` and\n * `estimate`.\n *\n * @param walletAddress Wallet address to get the ETH from.\n * @returns `transact: (value: bigint) => Promise<Address>` - Used to\n * make the transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public depositETH(walletAddress: Address) {\n const transact = async (value: bigint) =>\n await this.getContract().write.depositETH([walletAddress], {\n account: walletAddress,\n chain: this.viemChain,\n value,\n });\n\n const estimate = async () =>\n await this.getContract().estimateGas.depositETH([walletAddress], {\n account: walletAddress,\n });\n\n return { transact, estimate };\n }\n\n /**\n * Check the pufETH balance of the wallet.\n *\n * @param walletAddress Wallet address to check the balance of.\n * @returns pufETH balance in wei.\n */\n public async balanceOf(walletAddress: Address) {\n return await this.getContract().read.balanceOf([walletAddress]);\n }\n\n /**\n * Get the rate of pufETH compared to ETH.\n *\n * @returns Rate of pufETH compared to 1 ETH.\n */\n public async getPufETHRate() {\n const oneWei = BigInt(1e18);\n return await this.getContract().read.previewDeposit([oneWei]);\n }\n\n /**\n * Get the allowance for the given owner and spender.\n *\n * @param ownerAddress Address of the owner.\n * @param spenderAddress Address of the spender.\n * @returns Allowance for the given owner and spender.\n */\n public async getAllowance(ownerAddress: Address, spenderAddress: Address) {\n return await this.getContract().read.allowance([\n ownerAddress,\n spenderAddress,\n ]);\n }\n\n /**\n * Withdraw pufETH to the given wallet address. This doesn't make the\n * transaction but returns two methods namely `transact` and\n * `estimate`.\n *\n * @param ownerAddress Address of the owner.\n * @param walletAddress Address of the receiver.\n * @param value Value of pufETH to withdraw.\n * @returns `transact: (value: bigint) => Promise<Address>` - Used to\n * make the transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public withdraw(\n ownerAddress: Address,\n walletAddress: Address,\n value: bigint,\n ) {\n const transact = async () =>\n await this.getContract().write.withdraw(\n [value, walletAddress, ownerAddress],\n {\n account: walletAddress,\n chain: this.viemChain,\n },\n );\n\n const estimate = async () =>\n await this.getContract().estimateGas.withdraw(\n [value, walletAddress, ownerAddress],\n {\n account: walletAddress,\n },\n );\n\n return { transact, estimate };\n }\n\n /**\n * Preview the amount of WETH that can be redeemed for the given\n * amount of pufETH using the `.redeem()` method.\n *\n * @param value Value of pufETH to redeem.\n * @returns Preview of the amount of WETH that can be redeemed.\n */\n public previewRedeem(value: bigint) {\n return this.getContract().read.previewRedeem([value]);\n }\n\n /**\n * Calculates the maximum amount of pufETH shares that can be redeemed\n * by the owner.\n *\n * @param ownerAddress Address of the owner's wallet.\n * @returns Maximum amount of pufETH shares that can be redeemed.\n */\n public maxRedeem(ownerAddress: Address) {\n return this.getContract().read.maxRedeem([ownerAddress]);\n }\n\n /**\n * Returns how many basis points of a fee there are when exiting. For\n * example, a 1% fee would mean 1% of the user's requested pufETH is\n * burned (which increases the value for all pufETH holders) before\n * the ETH is redeemed. i.e., you get 1% less ETH back.\n *\n * @returns Basis points of the exit fee.\n */\n public getExitFeeBasisPoints() {\n return this.getContract().read.getExitFeeBasisPoints();\n }\n\n /**\n * Returns how much WETH can still be withdrawn today.\n *\n * @returns Remaining WETH daily withdrawal limit.\n */\n public getRemainingAssetsDailyWithdrawalLimit() {\n return this.getContract().read.getRemainingAssetsDailyWithdrawalLimit();\n }\n\n /**\n * Redeems pufETH shares in exchange for WETH assets from the vault.\n * In the process, the pufETH shares of the owner are burned. This\n * doesn't make the transaction but returns two methods namely\n * `transact` and `estimate`.\n *\n * @param ownerAddress Address of the owner of pufETH.\n * @param receiverAddress Address of the receiver of WETH.\n * @param shares Amount of pufETH shares to redeem.\n * @returns `transact: (value: bigint) => Promise<Address>` - Used to\n * make the transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public redeem(\n ownerAddress: Address,\n receiverAddress: Address,\n shares: bigint,\n ) {\n const transact = async () =>\n await this.getContract().write.redeem(\n [shares, receiverAddress, ownerAddress],\n {\n account: ownerAddress,\n chain: this.viemChain,\n },\n );\n\n const estimate = async () =>\n await this.getContract().estimateGas.redeem(\n [shares, receiverAddress, ownerAddress],\n {\n account: ownerAddress,\n },\n );\n\n return { transact, estimate };\n }\n\n /**\n * Gives exchange rate of pufETH relative to WETH.\n * This does not include any fees, as compared to previewRedeem method.\n *\n * @param amount Amount of pufETH to convert.\n * @returns Amount of equivalent WETH.\n */\n public convertToAssets(amount: bigint) {\n return this.getContract().read.convertToAssets([amount]);\n }\n}\n"],"names":["PufferVaultHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","address","CONTRACT_ADDRESSES","abi","PUFFER_VAULT_ABIS","client","getContract","walletAddress","value","oneWei","ownerAddress","spenderAddress","receiverAddress","shares","amount"],"mappings":"yZAeO,MAAMA,CAAmB,CAa9B,YACUC,EACAC,EACAC,EACR,CAhBMC,EAAA,kBAaE,KAAA,MAAAH,EACA,KAAA,aAAAC,EACA,KAAA,aAAAC,EAEH,KAAA,UAAYE,cAAYJ,CAAK,CACpC,CAQO,aAAc,CACnB,MAAMK,EAAUC,EAAA,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UO,uBAAwB,CAC7B,OAAO,KAAK,YAAA,EAAc,KAAK,sBAAsB,CACvD,CAOO,wCAAyC,CAC9C,OAAO,KAAK,YAAA,EAAc,KAAK,uCAAuC,CACxE,CAiBO,OACLA,EACAE,EACAC,EACA,CAkBO,MAAA,CAAE,SAjBQ,SACf,MAAM,KAAK,cAAc,MAAM,OAC7B,CAACA,EAAQD,EAAiBF,CAAY,EACtC,CACE,QAASA,EACT,MAAO,KAAK,SACd,CAAA,EAWe,SARF,SACf,MAAM,KAAK,cAAc,YAAY,OACnC,CAACG,EAAQD,EAAiBF,CAAY,EACtC,CACE,QAASA,CACX,CAAA,EAIN,CASO,gBAAgBI,EAAgB,CACrC,OAAO,KAAK,cAAc,KAAK,gBAAgB,CAACA,CAAM,CAAC,CACzD,CACF"}
@@ -9027,4 +9027,12 @@ export declare class PufferVaultHandler {
9027
9027
  transact: () => Promise<`0x${string}`>;
9028
9028
  estimate: () => Promise<bigint>;
9029
9029
  };
9030
+ /**
9031
+ * Gives exchange rate of pufETH relative to WETH.
9032
+ * This does not include any fees, as compared to previewRedeem method.
9033
+ *
9034
+ * @param amount Amount of pufETH to convert.
9035
+ * @returns Amount of equivalent WETH.
9036
+ */
9037
+ convertToAssets(amount: bigint): Promise<bigint>;
9030
9038
  }
@@ -1,6 +1,6 @@
1
1
  var s = Object.defineProperty;
2
- var o = (e, t, a) => t in e ? s(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a;
3
- var c = (e, t, a) => o(e, typeof t != "symbol" ? t + "" : t, a);
2
+ var o = (i, t, a) => t in i ? s(i, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : i[t] = a;
3
+ var c = (i, t, a) => o(i, typeof t != "symbol" ? t + "" : t, a);
4
4
  import { V as h } from "../../constants-rWWWhxR_.js";
5
5
  import { CONTRACT_ADDRESSES as m } from "../addresses.js";
6
6
  import { PUFFER_VAULT_ABIS as u } from "../abis/puffer-vault-abis.js";
@@ -16,9 +16,9 @@ class y {
16
16
  * @param publicClient The public client to use for public
17
17
  * interactions.
18
18
  */
19
- constructor(t, a, i) {
19
+ constructor(t, a, e) {
20
20
  c(this, "viemChain");
21
- this.chain = t, this.walletClient = a, this.publicClient = i, this.viemChain = h[t];
21
+ this.chain = t, this.walletClient = a, this.publicClient = e, this.viemChain = h[t];
22
22
  }
23
23
  /**
24
24
  * Get the contract. This is a method because the typings are complex
@@ -27,8 +27,8 @@ class y {
27
27
  * @returns The viem contract.
28
28
  */
29
29
  getContract() {
30
- const t = m[this.chain].PufferVault, a = u[this.chain].PufferVaultV2, i = { public: this.publicClient, wallet: this.walletClient };
31
- return C({ address: t, abi: a, client: i });
30
+ const t = m[this.chain].PufferVault, a = u[this.chain].PufferVaultV2, e = { public: this.publicClient, wallet: this.walletClient };
31
+ return C({ address: t, abi: a, client: e });
32
32
  }
33
33
  /**
34
34
  * Deposit ETH in exchange for pufETH. This doesn't make the
@@ -96,15 +96,15 @@ class y {
96
96
  * `estimate: () => Promise<bigint>` - Gas estimate of the
97
97
  * transaction.
98
98
  */
99
- withdraw(t, a, i) {
99
+ withdraw(t, a, e) {
100
100
  return { transact: async () => await this.getContract().write.withdraw(
101
- [i, a, t],
101
+ [e, a, t],
102
102
  {
103
103
  account: a,
104
104
  chain: this.viemChain
105
105
  }
106
106
  ), estimate: async () => await this.getContract().estimateGas.withdraw(
107
- [i, a, t],
107
+ [e, a, t],
108
108
  {
109
109
  account: a
110
110
  }
@@ -164,20 +164,30 @@ class y {
164
164
  * `estimate: () => Promise<bigint>` - Gas estimate of the
165
165
  * transaction.
166
166
  */
167
- redeem(t, a, i) {
167
+ redeem(t, a, e) {
168
168
  return { transact: async () => await this.getContract().write.redeem(
169
- [i, a, t],
169
+ [e, a, t],
170
170
  {
171
171
  account: t,
172
172
  chain: this.viemChain
173
173
  }
174
174
  ), estimate: async () => await this.getContract().estimateGas.redeem(
175
- [i, a, t],
175
+ [e, a, t],
176
176
  {
177
177
  account: t
178
178
  }
179
179
  ) };
180
180
  }
181
+ /**
182
+ * Gives exchange rate of pufETH relative to WETH.
183
+ * This does not include any fees, as compared to previewRedeem method.
184
+ *
185
+ * @param amount Amount of pufETH to convert.
186
+ * @returns Amount of equivalent WETH.
187
+ */
188
+ convertToAssets(t) {
189
+ return this.getContract().read.convertToAssets([t]);
190
+ }
181
191
  }
182
192
  export {
183
193
  y as PufferVaultHandler
@@ -1 +1 @@
1
- {"version":3,"file":"puffer-vault-handler.js","sources":["../../../lib/contracts/handlers/puffer-vault-handler.ts"],"sourcesContent":["import {\n Address,\n GetContractReturnType,\n PublicClient,\n WalletClient,\n getContract,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { CONTRACT_ADDRESSES } from '../addresses';\nimport { PUFFER_VAULT_ABIS } from '../abis/puffer-vault-abis';\n\n/**\n * Handler for the `PufferVaultV2` contract exposing methods to interact\n * with the contract.\n */\nexport class PufferVaultHandler {\n private viemChain: ViemChain;\n\n /**\n * Create the handler for the `PufferVaultV2` contract exposing\n * methods to interact with the contract.\n *\n * @param chain Chain to use for the client.\n * @param walletClient The wallet client to use for wallet\n * interactions.\n * @param publicClient The public client to use for public\n * interactions.\n */\n constructor(\n private chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.viemChain = VIEM_CHAINS[chain];\n }\n\n /**\n * Get the contract. This is a method because the typings are complex\n * and lost when trying to make it a member.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = CONTRACT_ADDRESSES[this.chain].PufferVault as Address;\n const abi = PUFFER_VAULT_ABIS[this.chain].PufferVaultV2;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Deposit ETH in exchange for pufETH. This doesn't make the\n * transaction but returns two methods namely `transact` and\n * `estimate`.\n *\n * @param walletAddress Wallet address to get the ETH from.\n * @returns `transact: (value: bigint) => Promise<Address>` - Used to\n * make the transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public depositETH(walletAddress: Address) {\n const transact = async (value: bigint) =>\n await this.getContract().write.depositETH([walletAddress], {\n account: walletAddress,\n chain: this.viemChain,\n value,\n });\n\n const estimate = async () =>\n await this.getContract().estimateGas.depositETH([walletAddress], {\n account: walletAddress,\n });\n\n return { transact, estimate };\n }\n\n /**\n * Check the pufETH balance of the wallet.\n *\n * @param walletAddress Wallet address to check the balance of.\n * @returns pufETH balance in wei.\n */\n public async balanceOf(walletAddress: Address) {\n return await this.getContract().read.balanceOf([walletAddress]);\n }\n\n /**\n * Get the rate of pufETH compared to ETH.\n *\n * @returns Rate of pufETH compared to 1 ETH.\n */\n public async getPufETHRate() {\n const oneWei = BigInt(1e18);\n return await this.getContract().read.previewDeposit([oneWei]);\n }\n\n /**\n * Get the allowance for the given owner and spender.\n *\n * @param ownerAddress Address of the owner.\n * @param spenderAddress Address of the spender.\n * @returns Allowance for the given owner and spender.\n */\n public async getAllowance(ownerAddress: Address, spenderAddress: Address) {\n return await this.getContract().read.allowance([\n ownerAddress,\n spenderAddress,\n ]);\n }\n\n /**\n * Withdraw pufETH to the given wallet address. This doesn't make the\n * transaction but returns two methods namely `transact` and\n * `estimate`.\n *\n * @param ownerAddress Address of the owner.\n * @param walletAddress Address of the receiver.\n * @param value Value of pufETH to withdraw.\n * @returns `transact: (value: bigint) => Promise<Address>` - Used to\n * make the transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public withdraw(\n ownerAddress: Address,\n walletAddress: Address,\n value: bigint,\n ) {\n const transact = async () =>\n await this.getContract().write.withdraw(\n [value, walletAddress, ownerAddress],\n {\n account: walletAddress,\n chain: this.viemChain,\n },\n );\n\n const estimate = async () =>\n await this.getContract().estimateGas.withdraw(\n [value, walletAddress, ownerAddress],\n {\n account: walletAddress,\n },\n );\n\n return { transact, estimate };\n }\n\n /**\n * Preview the amount of WETH that can be redeemed for the given\n * amount of pufETH using the `.redeem()` method.\n *\n * @param value Value of pufETH to redeem.\n * @returns Preview of the amount of WETH that can be redeemed.\n */\n public previewRedeem(value: bigint) {\n return this.getContract().read.previewRedeem([value]);\n }\n\n /**\n * Calculates the maximum amount of pufETH shares that can be redeemed\n * by the owner.\n *\n * @param ownerAddress Address of the owner's wallet.\n * @returns Maximum amount of pufETH shares that can be redeemed.\n */\n public maxRedeem(ownerAddress: Address) {\n return this.getContract().read.maxRedeem([ownerAddress]);\n }\n\n /**\n * Returns how many basis points of a fee there are when exiting. For\n * example, a 1% fee would mean 1% of the user's requested pufETH is\n * burned (which increases the value for all pufETH holders) before\n * the ETH is redeemed. i.e., you get 1% less ETH back.\n *\n * @returns Basis points of the exit fee.\n */\n public getExitFeeBasisPoints() {\n return this.getContract().read.getExitFeeBasisPoints();\n }\n\n /**\n * Returns how much WETH can still be withdrawn today.\n *\n * @returns Remaining WETH daily withdrawal limit.\n */\n public getRemainingAssetsDailyWithdrawalLimit() {\n return this.getContract().read.getRemainingAssetsDailyWithdrawalLimit();\n }\n\n /**\n * Redeems pufETH shares in exchange for WETH assets from the vault.\n * In the process, the pufETH shares of the owner are burned. This\n * doesn't make the transaction but returns two methods namely\n * `transact` and `estimate`.\n *\n * @param ownerAddress Address of the owner of pufETH.\n * @param receiverAddress Address of the receiver of WETH.\n * @param shares Amount of pufETH shares to redeem.\n * @returns `transact: (value: bigint) => Promise<Address>` - Used to\n * make the transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public redeem(\n ownerAddress: Address,\n receiverAddress: Address,\n shares: bigint,\n ) {\n const transact = async () =>\n await this.getContract().write.redeem(\n [shares, receiverAddress, ownerAddress],\n {\n account: ownerAddress,\n chain: this.viemChain,\n },\n );\n\n const estimate = async () =>\n await this.getContract().estimateGas.redeem(\n [shares, receiverAddress, ownerAddress],\n {\n account: ownerAddress,\n },\n );\n\n return { transact, estimate };\n }\n}\n"],"names":["PufferVaultHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","address","CONTRACT_ADDRESSES","abi","PUFFER_VAULT_ABIS","client","getContract","walletAddress","value","oneWei","ownerAddress","spenderAddress","receiverAddress","shares"],"mappings":";;;;;;;AAeO,MAAMA,EAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAa9B,YACUC,GACAC,GACAC,GACR;AAhBM,IAAAC,EAAA;AAaE,SAAA,QAAAH,GACA,KAAA,eAAAC,GACA,KAAA,eAAAC,GAEH,KAAA,YAAYE,EAAYJ,CAAK;AAAA,EACpC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQO,cAAc;AACnB,UAAMK,IAAUC,EAAmB,KAAK,KAAK,EAAE,aACzCC,IAAMC,EAAkB,KAAK,KAAK,EAAE,eACpCC,IAAS,EAAE,QAAQ,KAAK,cAAc,QAAQ,KAAK;AAEzD,WAAOC,EAAY,EAAE,SAAAL,GAAS,KAAAE,GAAK,QAAAE,EAAQ,CAAA;AAAA,EAK7C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcO,WAAWE,GAAwB;AAajC,WAAA,EAAE,UAZQ,OAAOC,MACtB,MAAM,KAAK,YAAY,EAAE,MAAM,WAAW,CAACD,CAAa,GAAG;AAAA,MACzD,SAASA;AAAA,MACT,OAAO,KAAK;AAAA,MACZ,OAAAC;AAAA,IAAA,CACD,GAOgB,UALF,YACf,MAAM,KAAK,cAAc,YAAY,WAAW,CAACD,CAAa,GAAG;AAAA,MAC/D,SAASA;AAAA,IAAA,CACV;EAGL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAa,UAAUA,GAAwB;AACtC,WAAA,MAAM,KAAK,YAAY,EAAE,KAAK,UAAU,CAACA,CAAa,CAAC;AAAA,EAChE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,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ACxE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBO,OACLA,GACAE,GACAC,GACA;AAkBO,WAAA,EAAE,UAjBQ,YACf,MAAM,KAAK,cAAc,MAAM;AAAA,MAC7B,CAACA,GAAQD,GAAiBF,CAAY;AAAA,MACtC;AAAA,QACE,SAASA;AAAA,QACT,OAAO,KAAK;AAAA,MACd;AAAA,IAAA,GAWe,UARF,YACf,MAAM,KAAK,cAAc,YAAY;AAAA,MACnC,CAACG,GAAQD,GAAiBF,CAAY;AAAA,MACtC;AAAA,QACE,SAASA;AAAA,MACX;AAAA,IAAA;EAIN;AACF;"}
1
+ {"version":3,"file":"puffer-vault-handler.js","sources":["../../../lib/contracts/handlers/puffer-vault-handler.ts"],"sourcesContent":["import {\n Address,\n GetContractReturnType,\n PublicClient,\n WalletClient,\n getContract,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { CONTRACT_ADDRESSES } from '../addresses';\nimport { PUFFER_VAULT_ABIS } from '../abis/puffer-vault-abis';\n\n/**\n * Handler for the `PufferVaultV2` contract exposing methods to interact\n * with the contract.\n */\nexport class PufferVaultHandler {\n private viemChain: ViemChain;\n\n /**\n * Create the handler for the `PufferVaultV2` contract exposing\n * methods to interact with the contract.\n *\n * @param chain Chain to use for the client.\n * @param walletClient The wallet client to use for wallet\n * interactions.\n * @param publicClient The public client to use for public\n * interactions.\n */\n constructor(\n private chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.viemChain = VIEM_CHAINS[chain];\n }\n\n /**\n * Get the contract. This is a method because the typings are complex\n * and lost when trying to make it a member.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = CONTRACT_ADDRESSES[this.chain].PufferVault as Address;\n const abi = PUFFER_VAULT_ABIS[this.chain].PufferVaultV2;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Deposit ETH in exchange for pufETH. This doesn't make the\n * transaction but returns two methods namely `transact` and\n * `estimate`.\n *\n * @param walletAddress Wallet address to get the ETH from.\n * @returns `transact: (value: bigint) => Promise<Address>` - Used to\n * make the transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public depositETH(walletAddress: Address) {\n const transact = async (value: bigint) =>\n await this.getContract().write.depositETH([walletAddress], {\n account: walletAddress,\n chain: this.viemChain,\n value,\n });\n\n const estimate = async () =>\n await this.getContract().estimateGas.depositETH([walletAddress], {\n account: walletAddress,\n });\n\n return { transact, estimate };\n }\n\n /**\n * Check the pufETH balance of the wallet.\n *\n * @param walletAddress Wallet address to check the balance of.\n * @returns pufETH balance in wei.\n */\n public async balanceOf(walletAddress: Address) {\n return await this.getContract().read.balanceOf([walletAddress]);\n }\n\n /**\n * Get the rate of pufETH compared to ETH.\n *\n * @returns Rate of pufETH compared to 1 ETH.\n */\n public async getPufETHRate() {\n const oneWei = BigInt(1e18);\n return await this.getContract().read.previewDeposit([oneWei]);\n }\n\n /**\n * Get the allowance for the given owner and spender.\n *\n * @param ownerAddress Address of the owner.\n * @param spenderAddress Address of the spender.\n * @returns Allowance for the given owner and spender.\n */\n public async getAllowance(ownerAddress: Address, spenderAddress: Address) {\n return await this.getContract().read.allowance([\n ownerAddress,\n spenderAddress,\n ]);\n }\n\n /**\n * Withdraw pufETH to the given wallet address. This doesn't make the\n * transaction but returns two methods namely `transact` and\n * `estimate`.\n *\n * @param ownerAddress Address of the owner.\n * @param walletAddress Address of the receiver.\n * @param value Value of pufETH to withdraw.\n * @returns `transact: (value: bigint) => Promise<Address>` - Used to\n * make the transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public withdraw(\n ownerAddress: Address,\n walletAddress: Address,\n value: bigint,\n ) {\n const transact = async () =>\n await this.getContract().write.withdraw(\n [value, walletAddress, ownerAddress],\n {\n account: walletAddress,\n chain: this.viemChain,\n },\n );\n\n const estimate = async () =>\n await this.getContract().estimateGas.withdraw(\n [value, walletAddress, ownerAddress],\n {\n account: walletAddress,\n },\n );\n\n return { transact, estimate };\n }\n\n /**\n * Preview the amount of WETH that can be redeemed for the given\n * amount of pufETH using the `.redeem()` method.\n *\n * @param value Value of pufETH to redeem.\n * @returns Preview of the amount of WETH that can be redeemed.\n */\n public previewRedeem(value: bigint) {\n return this.getContract().read.previewRedeem([value]);\n }\n\n /**\n * Calculates the maximum amount of pufETH shares that can be redeemed\n * by the owner.\n *\n * @param ownerAddress Address of the owner's wallet.\n * @returns Maximum amount of pufETH shares that can be redeemed.\n */\n public maxRedeem(ownerAddress: Address) {\n return this.getContract().read.maxRedeem([ownerAddress]);\n }\n\n /**\n * Returns how many basis points of a fee there are when exiting. For\n * example, a 1% fee would mean 1% of the user's requested pufETH is\n * burned (which increases the value for all pufETH holders) before\n * the ETH is redeemed. i.e., you get 1% less ETH back.\n *\n * @returns Basis points of the exit fee.\n */\n public getExitFeeBasisPoints() {\n return this.getContract().read.getExitFeeBasisPoints();\n }\n\n /**\n * Returns how much WETH can still be withdrawn today.\n *\n * @returns Remaining WETH daily withdrawal limit.\n */\n public getRemainingAssetsDailyWithdrawalLimit() {\n return this.getContract().read.getRemainingAssetsDailyWithdrawalLimit();\n }\n\n /**\n * Redeems pufETH shares in exchange for WETH assets from the vault.\n * In the process, the pufETH shares of the owner are burned. This\n * doesn't make the transaction but returns two methods namely\n * `transact` and `estimate`.\n *\n * @param ownerAddress Address of the owner of pufETH.\n * @param receiverAddress Address of the receiver of WETH.\n * @param shares Amount of pufETH shares to redeem.\n * @returns `transact: (value: bigint) => Promise<Address>` - Used to\n * make the transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public redeem(\n ownerAddress: Address,\n receiverAddress: Address,\n shares: bigint,\n ) {\n const transact = async () =>\n await this.getContract().write.redeem(\n [shares, receiverAddress, ownerAddress],\n {\n account: ownerAddress,\n chain: this.viemChain,\n },\n );\n\n const estimate = async () =>\n await this.getContract().estimateGas.redeem(\n [shares, receiverAddress, ownerAddress],\n {\n account: ownerAddress,\n },\n );\n\n return { transact, estimate };\n }\n\n /**\n * Gives exchange rate of pufETH relative to WETH.\n * This does not include any fees, as compared to previewRedeem method.\n *\n * @param amount Amount of pufETH to convert.\n * @returns Amount of equivalent WETH.\n */\n public convertToAssets(amount: bigint) {\n return this.getContract().read.convertToAssets([amount]);\n }\n}\n"],"names":["PufferVaultHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","address","CONTRACT_ADDRESSES","abi","PUFFER_VAULT_ABIS","client","getContract","walletAddress","value","oneWei","ownerAddress","spenderAddress","receiverAddress","shares","amount"],"mappings":";;;;;;;AAeO,MAAMA,EAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAa9B,YACUC,GACAC,GACAC,GACR;AAhBM,IAAAC,EAAA;AAaE,SAAA,QAAAH,GACA,KAAA,eAAAC,GACA,KAAA,eAAAC,GAEH,KAAA,YAAYE,EAAYJ,CAAK;AAAA,EACpC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQO,cAAc;AACnB,UAAMK,IAAUC,EAAmB,KAAK,KAAK,EAAE,aACzCC,IAAMC,EAAkB,KAAK,KAAK,EAAE,eACpCC,IAAS,EAAE,QAAQ,KAAK,cAAc,QAAQ,KAAK;AAEzD,WAAOC,EAAY,EAAE,SAAAL,GAAS,KAAAE,GAAK,QAAAE,EAAQ,CAAA;AAAA,EAK7C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcO,WAAWE,GAAwB;AAajC,WAAA,EAAE,UAZQ,OAAOC,MACtB,MAAM,KAAK,YAAY,EAAE,MAAM,WAAW,CAACD,CAAa,GAAG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ACtD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASO,UAAUE,GAAuB;AACtC,WAAO,KAAK,cAAc,KAAK,UAAU,CAACA,CAAY,CAAC;AAAA,EACzD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUO,wBAAwB;AAC7B,WAAO,KAAK,YAAA,EAAc,KAAK,sBAAsB;AAAA,EACvD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,yCAAyC;AAC9C,WAAO,KAAK,YAAA,EAAc,KAAK,uCAAuC;AAAA,EACxE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBO,OACLA,GACAE,GACAC,GACA;AAkBO,WAAA,EAAE,UAjBQ,YACf,MAAM,KAAK,cAAc,MAAM;AAAA,MAC7B,CAACA,GAAQD,GAAiBF,CAAY;AAAA,MACtC;AAAA,QACE,SAASA;AAAA,QACT,OAAO,KAAK;AAAA,MACd;AAAA,IAAA,GAWe,UARF,YACf,MAAM,KAAK,cAAc,YAAY;AAAA,MACnC,CAACG,GAAQD,GAAiBF,CAAY;AAAA,MACtC;AAAA,QACE,SAASA;AAAA,MACX;AAAA,IAAA;EAIN;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASO,gBAAgBI,GAAgB;AACrC,WAAO,KAAK,cAAc,KAAK,gBAAgB,CAACA,CAAM,CAAC;AAAA,EACzD;AACF;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../constants-BvU-JhfL.cjs");var c=(e=>(e.USDT="USDT",e.USDC="USDC",e.DAI="DAI",e.WETH="WETH",e.stETH="stETH",e.wstETH="wstETH",e.ALT="ALT",e.eETH="eETH",e.pufETHwstE="pufETHwstE",e.pufETH="pufETH",e))(c||{}),n=(e=>(e.unifiETH="unifiETH",e))(n||{});const E={USDT:{[a.Chain.Mainnet]:"0xdac17f958d2ee523a2206206994597c13d831ec7",[a.Chain.Holesky]:"0xd5bef2c64f418fd460319521d37862327122e3bc"},USDC:{[a.Chain.Mainnet]:"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",[a.Chain.Holesky]:"0x64Cc0de0429bcb87e875905a0c313ec88f6d1d3E"},DAI:{[a.Chain.Mainnet]:"0x6b175474e89094c44da98b954eedeac495271d0f",[a.Chain.Holesky]:"0x4478905505ddfb7eA1c8A9f46eAEC3695cE542ac"},WETH:{[a.Chain.Mainnet]:"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",[a.Chain.Holesky]:"0x1d181cBd1825e9eBC6AD966878D555A7215FF4F0"},stETH:{[a.Chain.Mainnet]:"0xae7ab96520de3a18e5e111b5eaab095312d7fe84",[a.Chain.Holesky]:"0x3F1c547b21f65e10480dE3ad8E19fAAC46C95034"},wstETH:{[a.Chain.Mainnet]:"0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",[a.Chain.Holesky]:"0x8d09a4502Cc8Cf1547aD300E066060D043f6982D"},ALT:{[a.Chain.Mainnet]:"0x8457ca5040ad67fdebbcc8edce889a335bc0fbfb",[a.Chain.Holesky]:"0xaf5588a571b42c7e50bd440d80f9bf94a4db94ee"},eETH:{[a.Chain.Mainnet]:"0x35fa164735182de50811e8e2e824cfb9b6118ac2",[a.Chain.Holesky]:"0x7ba2ee123b5977e3da040e1eacb3a61c82c17876"},pufETHwstE:{[a.Chain.Mainnet]:"0xeeda34a377dd0ca676b9511ee1324974fa8d980d",[a.Chain.Holesky]:"0x0000000000000000000000000000000000000000"},pufETH:{[a.Chain.Mainnet]:"0xd9a442856c234a39a81a089c06451ebaa4306a72",[a.Chain.Holesky]:"0x9196830bB4c05504E0A8475A0aD566AceEB6BeC9"},unifiETH:{[a.Chain.Mainnet]:"0x196ead472583bc1e9af7a05f860d9857e1bd3dcc",[a.Chain.Holesky]:"0x0000000000000000000000000000000000000000"}},i={USDT:"2",USDC:"",DAI:"",WETH:"",stETH:"2",wstETH:"1",ALT:"1",eETH:"1",pufETHwstE:"v7.0.0",pufETH:"1",unifiETH:""},d={pufETHwstE:{[a.Chain.Mainnet]:"0x0e986ed5610121905f03fd3850cebcc00f66166fc3ab760acb4e087d735d9457",[a.Chain.Holesky]:"0x0000000000000000000000000000000000000000000000000000000000000000"}};exports.TOKENS_ADDRESSES=E;exports.TOKENS_PERMIT_VERSION=i;exports.TOKENS_SALT=d;exports.Token=c;exports.UnifiToken=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../constants-BvU-JhfL.cjs");var c=(e=>(e.USDT="USDT",e.USDC="USDC",e.DAI="DAI",e.WETH="WETH",e.stETH="stETH",e.wstETH="wstETH",e.ALT="ALT",e.eETH="eETH",e.pufETHwstE="pufETHwstE",e.pufETH="pufETH",e))(c||{}),n=(e=>(e.unifiETH="unifiETH",e))(n||{});const E={USDT:{[a.Chain.Mainnet]:"0xdac17f958d2ee523a2206206994597c13d831ec7",[a.Chain.Holesky]:"0xd5bef2c64f418fd460319521d37862327122e3bc"},USDC:{[a.Chain.Mainnet]:"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",[a.Chain.Holesky]:"0x64Cc0de0429bcb87e875905a0c313ec88f6d1d3E"},DAI:{[a.Chain.Mainnet]:"0x6b175474e89094c44da98b954eedeac495271d0f",[a.Chain.Holesky]:"0x4478905505ddfb7eA1c8A9f46eAEC3695cE542ac"},WETH:{[a.Chain.Mainnet]:"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",[a.Chain.Holesky]:"0x1d181cBd1825e9eBC6AD966878D555A7215FF4F0"},stETH:{[a.Chain.Mainnet]:"0xae7ab96520de3a18e5e111b5eaab095312d7fe84",[a.Chain.Holesky]:"0x3F1c547b21f65e10480dE3ad8E19fAAC46C95034"},wstETH:{[a.Chain.Mainnet]:"0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",[a.Chain.Holesky]:"0x8d09a4502Cc8Cf1547aD300E066060D043f6982D"},ALT:{[a.Chain.Mainnet]:"0x8457ca5040ad67fdebbcc8edce889a335bc0fbfb",[a.Chain.Holesky]:"0xaf5588a571b42c7e50bd440d80f9bf94a4db94ee"},eETH:{[a.Chain.Mainnet]:"0x35fa164735182de50811e8e2e824cfb9b6118ac2",[a.Chain.Holesky]:"0x7ba2ee123b5977e3da040e1eacb3a61c82c17876"},pufETHwstE:{[a.Chain.Mainnet]:"0xeeda34a377dd0ca676b9511ee1324974fa8d980d",[a.Chain.Holesky]:"0x0000000000000000000000000000000000000000"},pufETH:{[a.Chain.Mainnet]:"0xd9a442856c234a39a81a089c06451ebaa4306a72",[a.Chain.Holesky]:"0x9196830bB4c05504E0A8475A0aD566AceEB6BeC9"},unifiETH:{[a.Chain.Mainnet]:"0x196ead472583bc1e9af7a05f860d9857e1bd3dcc",[a.Chain.Holesky]:"0x0000000000000000000000000000000000000000"}},i={USDT:"2",USDC:"",DAI:"",WETH:"",stETH:"2",wstETH:"1",ALT:"1",eETH:"1",pufETHwstE:"v7.0.0",pufETH:"1",unifiETH:"1"},d={pufETHwstE:{[a.Chain.Mainnet]:"0x0e986ed5610121905f03fd3850cebcc00f66166fc3ab760acb4e087d735d9457",[a.Chain.Holesky]:"0x0000000000000000000000000000000000000000000000000000000000000000"}};exports.TOKENS_ADDRESSES=E;exports.TOKENS_PERMIT_VERSION=i;exports.TOKENS_SALT=d;exports.Token=c;exports.UnifiToken=n;
2
2
  //# sourceMappingURL=tokens.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"tokens.cjs","sources":["../../lib/contracts/tokens.ts"],"sourcesContent":["import { Address } from 'viem';\nimport { Chain } from '../chains/constants';\n\nexport enum Token {\n USDT = 'USDT',\n USDC = 'USDC',\n DAI = 'DAI',\n WETH = 'WETH',\n stETH = 'stETH',\n wstETH = 'wstETH',\n ALT = 'ALT',\n eETH = 'eETH',\n pufETHwstE = 'pufETHwstE',\n pufETH = 'pufETH',\n}\n\nexport enum UnifiToken {\n unifiETH = 'unifiETH',\n}\n\nexport type AnyToken = Token | UnifiToken;\n\nexport const TOKENS_ADDRESSES: {\n [key in AnyToken]: { [chain in Chain]: Address };\n} = {\n [Token.USDT]: {\n [Chain.Mainnet]: '0xdac17f958d2ee523a2206206994597c13d831ec7',\n [Chain.Holesky]: '0xd5bef2c64f418fd460319521d37862327122e3bc',\n },\n [Token.USDC]: {\n [Chain.Mainnet]: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',\n [Chain.Holesky]: '0x64Cc0de0429bcb87e875905a0c313ec88f6d1d3E',\n },\n [Token.DAI]: {\n [Chain.Mainnet]: '0x6b175474e89094c44da98b954eedeac495271d0f',\n [Chain.Holesky]: '0x4478905505ddfb7eA1c8A9f46eAEC3695cE542ac',\n },\n [Token.WETH]: {\n [Chain.Mainnet]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',\n [Chain.Holesky]: '0x1d181cBd1825e9eBC6AD966878D555A7215FF4F0',\n },\n [Token.stETH]: {\n [Chain.Mainnet]: '0xae7ab96520de3a18e5e111b5eaab095312d7fe84',\n [Chain.Holesky]: '0x3F1c547b21f65e10480dE3ad8E19fAAC46C95034',\n },\n [Token.wstETH]: {\n [Chain.Mainnet]: '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0',\n [Chain.Holesky]: '0x8d09a4502Cc8Cf1547aD300E066060D043f6982D',\n },\n [Token.ALT]: {\n [Chain.Mainnet]: '0x8457ca5040ad67fdebbcc8edce889a335bc0fbfb',\n [Chain.Holesky]: '0xaf5588a571b42c7e50bd440d80f9bf94a4db94ee',\n },\n [Token.eETH]: {\n [Chain.Mainnet]: '0x35fa164735182de50811e8e2e824cfb9b6118ac2',\n [Chain.Holesky]: '0x7ba2ee123b5977e3da040e1eacb3a61c82c17876',\n },\n [Token.pufETHwstE]: {\n [Chain.Mainnet]: '0xeeda34a377dd0ca676b9511ee1324974fa8d980d',\n [Chain.Holesky]: '0x0000000000000000000000000000000000000000',\n },\n [Token.pufETH]: {\n [Chain.Mainnet]: '0xd9a442856c234a39a81a089c06451ebaa4306a72',\n [Chain.Holesky]: '0x9196830bB4c05504E0A8475A0aD566AceEB6BeC9',\n },\n\n // TODO: Update the addresses once the contracts are deployed on chain.\n // See https://dev.azure.com/pufferfi/Frontend/_workitems/edit/1797.\n\n // UniFi Tokens\n [UnifiToken.unifiETH]: {\n [Chain.Mainnet]: '0x196ead472583bc1e9af7a05f860d9857e1bd3dcc',\n [Chain.Holesky]: '0x0000000000000000000000000000000000000000',\n },\n};\n\nexport const TOKENS_PERMIT_VERSION: { [key in AnyToken]: string } = {\n [Token.USDT]: '2',\n // USDC does not support permit signatures (ERC20Permit).\n [Token.USDC]: '',\n // DAI does not support permit signatures (ERC20Permit).\n [Token.DAI]: '',\n // WETH does not support permit signatures (ERC20Permit).\n [Token.WETH]: '',\n [Token.stETH]: '2',\n // Puffer Quest v1 uses version 1 for wstETH.\n [Token.wstETH]: '1',\n [Token.ALT]: '1',\n // https://github.com/etherfi-protocol/smart-contracts/blob/7c66e571df4fe7ec502a3c325b623bc52349ef9d/src/EETH.sol#L55\n [Token.eETH]: '1',\n [Token.pufETHwstE]: 'v7.0.0',\n [Token.pufETH]: '1',\n\n // UniFi Tokens\n [UnifiToken.unifiETH]: '',\n};\n\nexport const TOKENS_SALT: Partial<{\n [key in AnyToken]: { [chain in Chain]: Address };\n}> = {\n [Token.pufETHwstE]: {\n // Taken from\n // https://etherscan.io/token/0xeeda34a377dd0ca676b9511ee1324974fa8d980d#readContract#F39.\n [Chain.Mainnet]:\n '0x0e986ed5610121905f03fd3850cebcc00f66166fc3ab760acb4e087d735d9457',\n [Chain.Holesky]:\n '0x0000000000000000000000000000000000000000000000000000000000000000',\n },\n};\n"],"names":["Token","UnifiToken","TOKENS_ADDRESSES","Chain","TOKENS_PERMIT_VERSION","TOKENS_SALT"],"mappings":"6HAGY,IAAAA,GAAAA,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C,SAAsB,CACrB,CAACA,EAAAA,MAAM,OAAO,EAAG,6CACjB,CAACA,EAAAA,MAAM,OAAO,EAAG,4CACnB,CACF,EAEaC,EAAuD,CACjE,KAAa,IAEb,KAAa,GAEb,IAAY,GAEZ,KAAa,GACb,MAAc,IAEd,OAAe,IACf,IAAY,IAEZ,KAAa,IACb,WAAmB,SACnB,OAAe,IAGf,SAAsB,EACzB,EAEaC,EAER,CACF,WAAmB,CAGlB,CAACF,EAAAA,MAAM,OAAO,EACZ,qEACF,CAACA,EAAAA,MAAM,OAAO,EACZ,oEACJ,CACF"}
1
+ {"version":3,"file":"tokens.cjs","sources":["../../lib/contracts/tokens.ts"],"sourcesContent":["import { Address } from 'viem';\nimport { Chain } from '../chains/constants';\n\nexport enum Token {\n USDT = 'USDT',\n USDC = 'USDC',\n DAI = 'DAI',\n WETH = 'WETH',\n stETH = 'stETH',\n wstETH = 'wstETH',\n ALT = 'ALT',\n eETH = 'eETH',\n pufETHwstE = 'pufETHwstE',\n pufETH = 'pufETH',\n}\n\nexport enum UnifiToken {\n unifiETH = 'unifiETH',\n}\n\nexport type AnyToken = Token | UnifiToken;\n\nexport const TOKENS_ADDRESSES: {\n [key in AnyToken]: { [chain in Chain]: Address };\n} = {\n [Token.USDT]: {\n [Chain.Mainnet]: '0xdac17f958d2ee523a2206206994597c13d831ec7',\n [Chain.Holesky]: '0xd5bef2c64f418fd460319521d37862327122e3bc',\n },\n [Token.USDC]: {\n [Chain.Mainnet]: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',\n [Chain.Holesky]: '0x64Cc0de0429bcb87e875905a0c313ec88f6d1d3E',\n },\n [Token.DAI]: {\n [Chain.Mainnet]: '0x6b175474e89094c44da98b954eedeac495271d0f',\n [Chain.Holesky]: '0x4478905505ddfb7eA1c8A9f46eAEC3695cE542ac',\n },\n [Token.WETH]: {\n [Chain.Mainnet]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',\n [Chain.Holesky]: '0x1d181cBd1825e9eBC6AD966878D555A7215FF4F0',\n },\n [Token.stETH]: {\n [Chain.Mainnet]: '0xae7ab96520de3a18e5e111b5eaab095312d7fe84',\n [Chain.Holesky]: '0x3F1c547b21f65e10480dE3ad8E19fAAC46C95034',\n },\n [Token.wstETH]: {\n [Chain.Mainnet]: '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0',\n [Chain.Holesky]: '0x8d09a4502Cc8Cf1547aD300E066060D043f6982D',\n },\n [Token.ALT]: {\n [Chain.Mainnet]: '0x8457ca5040ad67fdebbcc8edce889a335bc0fbfb',\n [Chain.Holesky]: '0xaf5588a571b42c7e50bd440d80f9bf94a4db94ee',\n },\n [Token.eETH]: {\n [Chain.Mainnet]: '0x35fa164735182de50811e8e2e824cfb9b6118ac2',\n [Chain.Holesky]: '0x7ba2ee123b5977e3da040e1eacb3a61c82c17876',\n },\n [Token.pufETHwstE]: {\n [Chain.Mainnet]: '0xeeda34a377dd0ca676b9511ee1324974fa8d980d',\n [Chain.Holesky]: '0x0000000000000000000000000000000000000000',\n },\n [Token.pufETH]: {\n [Chain.Mainnet]: '0xd9a442856c234a39a81a089c06451ebaa4306a72',\n [Chain.Holesky]: '0x9196830bB4c05504E0A8475A0aD566AceEB6BeC9',\n },\n\n // TODO: Update the addresses once the contracts are deployed on chain.\n // See https://dev.azure.com/pufferfi/Frontend/_workitems/edit/1797.\n\n // UniFi Tokens\n [UnifiToken.unifiETH]: {\n [Chain.Mainnet]: '0x196ead472583bc1e9af7a05f860d9857e1bd3dcc',\n [Chain.Holesky]: '0x0000000000000000000000000000000000000000',\n },\n};\n\nexport const TOKENS_PERMIT_VERSION: { [key in AnyToken]: string } = {\n [Token.USDT]: '2',\n // USDC does not support permit signatures (ERC20Permit).\n [Token.USDC]: '',\n // DAI does not support permit signatures (ERC20Permit).\n [Token.DAI]: '',\n // WETH does not support permit signatures (ERC20Permit).\n [Token.WETH]: '',\n [Token.stETH]: '2',\n // Puffer Quest v1 uses version 1 for wstETH.\n [Token.wstETH]: '1',\n [Token.ALT]: '1',\n // https://github.com/etherfi-protocol/smart-contracts/blob/7c66e571df4fe7ec502a3c325b623bc52349ef9d/src/EETH.sol#L55\n [Token.eETH]: '1',\n [Token.pufETHwstE]: 'v7.0.0',\n [Token.pufETH]: '1',\n\n // UniFi Tokens\n // https://etherscan.io/address/0x196ead472583bc1e9af7a05f860d9857e1bd3dcc#code#F7#L172\n [UnifiToken.unifiETH]: '1',\n};\n\nexport const TOKENS_SALT: Partial<{\n [key in AnyToken]: { [chain in Chain]: Address };\n}> = {\n [Token.pufETHwstE]: {\n // Taken from\n // https://etherscan.io/token/0xeeda34a377dd0ca676b9511ee1324974fa8d980d#readContract#F39.\n [Chain.Mainnet]:\n '0x0e986ed5610121905f03fd3850cebcc00f66166fc3ab760acb4e087d735d9457',\n [Chain.Holesky]:\n '0x0000000000000000000000000000000000000000000000000000000000000000',\n },\n};\n"],"names":["Token","UnifiToken","TOKENS_ADDRESSES","Chain","TOKENS_PERMIT_VERSION","TOKENS_SALT"],"mappings":"6HAGY,IAAAA,GAAAA,IACVA,EAAA,KAAO,OACPA,EAAA,KAAO,OACPA,EAAA,IAAM,MACNA,EAAA,KAAO,OACPA,EAAA,MAAQ,QACRA,EAAA,OAAS,SACTA,EAAA,IAAM,MACNA,EAAA,KAAO,OACPA,EAAA,WAAa,aACbA,EAAA,OAAS,SAVCA,IAAAA,GAAA,CAAA,CAAA,EAaAC,GAAAA,IACVA,EAAA,SAAW,WADDA,IAAAA,GAAA,CAAA,CAAA,EAML,MAAMC,EAET,CACD,KAAa,CACZ,CAACC,EAAAA,MAAM,OAAO,EAAG,6CACjB,CAACA,EAAAA,MAAM,OAAO,EAAG,4CACnB,EACC,KAAa,CACZ,CAACA,EAAAA,MAAM,OAAO,EAAG,6CACjB,CAACA,EAAAA,MAAM,OAAO,EAAG,4CACnB,EACC,IAAY,CACX,CAACA,EAAAA,MAAM,OAAO,EAAG,6CACjB,CAACA,EAAAA,MAAM,OAAO,EAAG,4CACnB,EACC,KAAa,CACZ,CAACA,EAAAA,MAAM,OAAO,EAAG,6CACjB,CAACA,EAAAA,MAAM,OAAO,EAAG,4CACnB,EACC,MAAc,CACb,CAACA,EAAAA,MAAM,OAAO,EAAG,6CACjB,CAACA,EAAAA,MAAM,OAAO,EAAG,4CACnB,EACC,OAAe,CACd,CAACA,EAAAA,MAAM,OAAO,EAAG,6CACjB,CAACA,EAAAA,MAAM,OAAO,EAAG,4CACnB,EACC,IAAY,CACX,CAACA,EAAAA,MAAM,OAAO,EAAG,6CACjB,CAACA,EAAAA,MAAM,OAAO,EAAG,4CACnB,EACC,KAAa,CACZ,CAACA,EAAAA,MAAM,OAAO,EAAG,6CACjB,CAACA,EAAAA,MAAM,OAAO,EAAG,4CACnB,EACC,WAAmB,CAClB,CAACA,EAAAA,MAAM,OAAO,EAAG,6CACjB,CAACA,EAAAA,MAAM,OAAO,EAAG,4CACnB,EACC,OAAe,CACd,CAACA,EAAAA,MAAM,OAAO,EAAG,6CACjB,CAACA,EAAAA,MAAM,OAAO,EAAG,4CACnB,EAMC,SAAsB,CACrB,CAACA,EAAAA,MAAM,OAAO,EAAG,6CACjB,CAACA,EAAAA,MAAM,OAAO,EAAG,4CACnB,CACF,EAEaC,EAAuD,CACjE,KAAa,IAEb,KAAa,GAEb,IAAY,GAEZ,KAAa,GACb,MAAc,IAEd,OAAe,IACf,IAAY,IAEZ,KAAa,IACb,WAAmB,SACnB,OAAe,IAIf,SAAsB,GACzB,EAEaC,EAER,CACF,WAAmB,CAGlB,CAACF,EAAAA,MAAM,OAAO,EACZ,qEACF,CAACA,EAAAA,MAAM,OAAO,EACZ,oEACJ,CACF"}
@@ -65,7 +65,8 @@ const f = {
65
65
  pufETHwstE: "v7.0.0",
66
66
  pufETH: "1",
67
67
  // UniFi Tokens
68
- unifiETH: ""
68
+ // https://etherscan.io/address/0x196ead472583bc1e9af7a05f860d9857e1bd3dcc#code#F7#L172
69
+ unifiETH: "1"
69
70
  }, H = {
70
71
  pufETHwstE: {
71
72
  // Taken from
@@ -1 +1 @@
1
- {"version":3,"file":"tokens.js","sources":["../../lib/contracts/tokens.ts"],"sourcesContent":["import { Address } from 'viem';\nimport { Chain } from '../chains/constants';\n\nexport enum Token {\n USDT = 'USDT',\n USDC = 'USDC',\n DAI = 'DAI',\n WETH = 'WETH',\n stETH = 'stETH',\n wstETH = 'wstETH',\n ALT = 'ALT',\n eETH = 'eETH',\n pufETHwstE = 'pufETHwstE',\n pufETH = 'pufETH',\n}\n\nexport enum UnifiToken {\n unifiETH = 'unifiETH',\n}\n\nexport type AnyToken = Token | UnifiToken;\n\nexport const TOKENS_ADDRESSES: {\n [key in AnyToken]: { [chain in Chain]: Address };\n} = {\n [Token.USDT]: {\n [Chain.Mainnet]: '0xdac17f958d2ee523a2206206994597c13d831ec7',\n [Chain.Holesky]: '0xd5bef2c64f418fd460319521d37862327122e3bc',\n },\n [Token.USDC]: {\n [Chain.Mainnet]: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',\n [Chain.Holesky]: '0x64Cc0de0429bcb87e875905a0c313ec88f6d1d3E',\n },\n [Token.DAI]: {\n [Chain.Mainnet]: '0x6b175474e89094c44da98b954eedeac495271d0f',\n [Chain.Holesky]: '0x4478905505ddfb7eA1c8A9f46eAEC3695cE542ac',\n },\n [Token.WETH]: {\n [Chain.Mainnet]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',\n [Chain.Holesky]: '0x1d181cBd1825e9eBC6AD966878D555A7215FF4F0',\n },\n [Token.stETH]: {\n [Chain.Mainnet]: '0xae7ab96520de3a18e5e111b5eaab095312d7fe84',\n [Chain.Holesky]: '0x3F1c547b21f65e10480dE3ad8E19fAAC46C95034',\n },\n [Token.wstETH]: {\n [Chain.Mainnet]: '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0',\n [Chain.Holesky]: '0x8d09a4502Cc8Cf1547aD300E066060D043f6982D',\n },\n [Token.ALT]: {\n [Chain.Mainnet]: '0x8457ca5040ad67fdebbcc8edce889a335bc0fbfb',\n [Chain.Holesky]: '0xaf5588a571b42c7e50bd440d80f9bf94a4db94ee',\n },\n [Token.eETH]: {\n [Chain.Mainnet]: '0x35fa164735182de50811e8e2e824cfb9b6118ac2',\n [Chain.Holesky]: '0x7ba2ee123b5977e3da040e1eacb3a61c82c17876',\n },\n [Token.pufETHwstE]: {\n [Chain.Mainnet]: '0xeeda34a377dd0ca676b9511ee1324974fa8d980d',\n [Chain.Holesky]: '0x0000000000000000000000000000000000000000',\n },\n [Token.pufETH]: {\n [Chain.Mainnet]: '0xd9a442856c234a39a81a089c06451ebaa4306a72',\n [Chain.Holesky]: '0x9196830bB4c05504E0A8475A0aD566AceEB6BeC9',\n },\n\n // TODO: Update the addresses once the contracts are deployed on chain.\n // See https://dev.azure.com/pufferfi/Frontend/_workitems/edit/1797.\n\n // UniFi Tokens\n [UnifiToken.unifiETH]: {\n [Chain.Mainnet]: '0x196ead472583bc1e9af7a05f860d9857e1bd3dcc',\n [Chain.Holesky]: '0x0000000000000000000000000000000000000000',\n },\n};\n\nexport const TOKENS_PERMIT_VERSION: { [key in AnyToken]: string } = {\n [Token.USDT]: '2',\n // USDC does not support permit signatures (ERC20Permit).\n [Token.USDC]: '',\n // DAI does not support permit signatures (ERC20Permit).\n [Token.DAI]: '',\n // WETH does not support permit signatures (ERC20Permit).\n [Token.WETH]: '',\n [Token.stETH]: '2',\n // Puffer Quest v1 uses version 1 for wstETH.\n [Token.wstETH]: '1',\n [Token.ALT]: '1',\n // https://github.com/etherfi-protocol/smart-contracts/blob/7c66e571df4fe7ec502a3c325b623bc52349ef9d/src/EETH.sol#L55\n [Token.eETH]: '1',\n [Token.pufETHwstE]: 'v7.0.0',\n [Token.pufETH]: '1',\n\n // UniFi Tokens\n [UnifiToken.unifiETH]: '',\n};\n\nexport const TOKENS_SALT: Partial<{\n [key in AnyToken]: { [chain in Chain]: Address };\n}> = {\n [Token.pufETHwstE]: {\n // Taken from\n // https://etherscan.io/token/0xeeda34a377dd0ca676b9511ee1324974fa8d980d#readContract#F39.\n [Chain.Mainnet]:\n '0x0e986ed5610121905f03fd3850cebcc00f66166fc3ab760acb4e087d735d9457',\n [Chain.Holesky]:\n '0x0000000000000000000000000000000000000000000000000000000000000000',\n },\n};\n"],"names":["Token","UnifiToken","TOKENS_ADDRESSES","Chain","TOKENS_PERMIT_VERSION","TOKENS_SALT"],"mappings":";AAGY,IAAAA,sBAAAA,OACVA,EAAA,OAAO,QACPA,EAAA,OAAO,QACPA,EAAA,MAAM,OACNA,EAAA,OAAO,QACPA,EAAA,QAAQ,SACRA,EAAA,SAAS,UACTA,EAAA,MAAM,OACNA,EAAA,OAAO,QACPA,EAAA,aAAa,cACbA,EAAA,SAAS,UAVCA,IAAAA,KAAA,CAAA,CAAA,GAaAC,sBAAAA,OACVA,EAAA,WAAW,YADDA,IAAAA,KAAA,CAAA,CAAA;AAML,MAAMC,IAET;AAAA,EACD,MAAa;AAAA,IACZ,CAACC,EAAM,OAAO,GAAG;AAAA,IACjB,CAACA,EAAM,OAAO,GAAG;AAAA,EACnB;AAAA,EACC,MAAa;AAAA,IACZ,CAACA,EAAM,OAAO,GAAG;AAAA,IACjB,CAACA,EAAM,OAAO,GAAG;AAAA,EACnB;AAAA,EACC,KAAY;AAAA,IACX,CAACA,EAAM,OAAO,GAAG;AAAA,IACjB,CAACA,EAAM,OAAO,GAAG;AAAA,EACnB;AAAA,EACC,MAAa;AAAA,IACZ,CAACA,EAAM,OAAO,GAAG;AAAA,IACjB,CAACA,EAAM,OAAO,GAAG;AAAA,EACnB;AAAA,EACC,OAAc;AAAA,IACb,CAACA,EAAM,OAAO,GAAG;AAAA,IACjB,CAACA,EAAM,OAAO,GAAG;AAAA,EACnB;AAAA,EACC,QAAe;AAAA,IACd,CAACA,EAAM,OAAO,GAAG;AAAA,IACjB,CAACA,EAAM,OAAO,GAAG;AAAA,EACnB;AAAA,EACC,KAAY;AAAA,IACX,CAACA,EAAM,OAAO,GAAG;AAAA,IACjB,CAACA,EAAM,OAAO,GAAG;AAAA,EACnB;AAAA,EACC,MAAa;AAAA,IACZ,CAACA,EAAM,OAAO,GAAG;AAAA,IACjB,CAACA,EAAM,OAAO,GAAG;AAAA,EACnB;AAAA,EACC,YAAmB;AAAA,IAClB,CAACA,EAAM,OAAO,GAAG;AAAA,IACjB,CAACA,EAAM,OAAO,GAAG;AAAA,EACnB;AAAA,EACC,QAAe;AAAA,IACd,CAACA,EAAM,OAAO,GAAG;AAAA,IACjB,CAACA,EAAM,OAAO,GAAG;AAAA,EACnB;AAAA;AAAA;AAAA;AAAA,EAMC,UAAsB;AAAA,IACrB,CAACA,EAAM,OAAO,GAAG;AAAA,IACjB,CAACA,EAAM,OAAO,GAAG;AAAA,EACnB;AACF,GAEaC,IAAuD;AAAA,EACjE,MAAa;AAAA;AAAA,EAEb,MAAa;AAAA;AAAA,EAEb,KAAY;AAAA;AAAA,EAEZ,MAAa;AAAA,EACb,OAAc;AAAA;AAAA,EAEd,QAAe;AAAA,EACf,KAAY;AAAA;AAAA,EAEZ,MAAa;AAAA,EACb,YAAmB;AAAA,EACnB,QAAe;AAAA;AAAA,EAGf,UAAsB;AACzB,GAEaC,IAER;AAAA,EACF,YAAmB;AAAA;AAAA;AAAA,IAGlB,CAACF,EAAM,OAAO,GACZ;AAAA,IACF,CAACA,EAAM,OAAO,GACZ;AAAA,EACJ;AACF;"}
1
+ {"version":3,"file":"tokens.js","sources":["../../lib/contracts/tokens.ts"],"sourcesContent":["import { Address } from 'viem';\nimport { Chain } from '../chains/constants';\n\nexport enum Token {\n USDT = 'USDT',\n USDC = 'USDC',\n DAI = 'DAI',\n WETH = 'WETH',\n stETH = 'stETH',\n wstETH = 'wstETH',\n ALT = 'ALT',\n eETH = 'eETH',\n pufETHwstE = 'pufETHwstE',\n pufETH = 'pufETH',\n}\n\nexport enum UnifiToken {\n unifiETH = 'unifiETH',\n}\n\nexport type AnyToken = Token | UnifiToken;\n\nexport const TOKENS_ADDRESSES: {\n [key in AnyToken]: { [chain in Chain]: Address };\n} = {\n [Token.USDT]: {\n [Chain.Mainnet]: '0xdac17f958d2ee523a2206206994597c13d831ec7',\n [Chain.Holesky]: '0xd5bef2c64f418fd460319521d37862327122e3bc',\n },\n [Token.USDC]: {\n [Chain.Mainnet]: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',\n [Chain.Holesky]: '0x64Cc0de0429bcb87e875905a0c313ec88f6d1d3E',\n },\n [Token.DAI]: {\n [Chain.Mainnet]: '0x6b175474e89094c44da98b954eedeac495271d0f',\n [Chain.Holesky]: '0x4478905505ddfb7eA1c8A9f46eAEC3695cE542ac',\n },\n [Token.WETH]: {\n [Chain.Mainnet]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',\n [Chain.Holesky]: '0x1d181cBd1825e9eBC6AD966878D555A7215FF4F0',\n },\n [Token.stETH]: {\n [Chain.Mainnet]: '0xae7ab96520de3a18e5e111b5eaab095312d7fe84',\n [Chain.Holesky]: '0x3F1c547b21f65e10480dE3ad8E19fAAC46C95034',\n },\n [Token.wstETH]: {\n [Chain.Mainnet]: '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0',\n [Chain.Holesky]: '0x8d09a4502Cc8Cf1547aD300E066060D043f6982D',\n },\n [Token.ALT]: {\n [Chain.Mainnet]: '0x8457ca5040ad67fdebbcc8edce889a335bc0fbfb',\n [Chain.Holesky]: '0xaf5588a571b42c7e50bd440d80f9bf94a4db94ee',\n },\n [Token.eETH]: {\n [Chain.Mainnet]: '0x35fa164735182de50811e8e2e824cfb9b6118ac2',\n [Chain.Holesky]: '0x7ba2ee123b5977e3da040e1eacb3a61c82c17876',\n },\n [Token.pufETHwstE]: {\n [Chain.Mainnet]: '0xeeda34a377dd0ca676b9511ee1324974fa8d980d',\n [Chain.Holesky]: '0x0000000000000000000000000000000000000000',\n },\n [Token.pufETH]: {\n [Chain.Mainnet]: '0xd9a442856c234a39a81a089c06451ebaa4306a72',\n [Chain.Holesky]: '0x9196830bB4c05504E0A8475A0aD566AceEB6BeC9',\n },\n\n // TODO: Update the addresses once the contracts are deployed on chain.\n // See https://dev.azure.com/pufferfi/Frontend/_workitems/edit/1797.\n\n // UniFi Tokens\n [UnifiToken.unifiETH]: {\n [Chain.Mainnet]: '0x196ead472583bc1e9af7a05f860d9857e1bd3dcc',\n [Chain.Holesky]: '0x0000000000000000000000000000000000000000',\n },\n};\n\nexport const TOKENS_PERMIT_VERSION: { [key in AnyToken]: string } = {\n [Token.USDT]: '2',\n // USDC does not support permit signatures (ERC20Permit).\n [Token.USDC]: '',\n // DAI does not support permit signatures (ERC20Permit).\n [Token.DAI]: '',\n // WETH does not support permit signatures (ERC20Permit).\n [Token.WETH]: '',\n [Token.stETH]: '2',\n // Puffer Quest v1 uses version 1 for wstETH.\n [Token.wstETH]: '1',\n [Token.ALT]: '1',\n // https://github.com/etherfi-protocol/smart-contracts/blob/7c66e571df4fe7ec502a3c325b623bc52349ef9d/src/EETH.sol#L55\n [Token.eETH]: '1',\n [Token.pufETHwstE]: 'v7.0.0',\n [Token.pufETH]: '1',\n\n // UniFi Tokens\n // https://etherscan.io/address/0x196ead472583bc1e9af7a05f860d9857e1bd3dcc#code#F7#L172\n [UnifiToken.unifiETH]: '1',\n};\n\nexport const TOKENS_SALT: Partial<{\n [key in AnyToken]: { [chain in Chain]: Address };\n}> = {\n [Token.pufETHwstE]: {\n // Taken from\n // https://etherscan.io/token/0xeeda34a377dd0ca676b9511ee1324974fa8d980d#readContract#F39.\n [Chain.Mainnet]:\n '0x0e986ed5610121905f03fd3850cebcc00f66166fc3ab760acb4e087d735d9457',\n [Chain.Holesky]:\n '0x0000000000000000000000000000000000000000000000000000000000000000',\n },\n};\n"],"names":["Token","UnifiToken","TOKENS_ADDRESSES","Chain","TOKENS_PERMIT_VERSION","TOKENS_SALT"],"mappings":";AAGY,IAAAA,sBAAAA,OACVA,EAAA,OAAO,QACPA,EAAA,OAAO,QACPA,EAAA,MAAM,O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G;AAAA,EACnB;AAAA;AAAA;AAAA;AAAA,EAMC,UAAsB;AAAA,IACrB,CAACA,EAAM,OAAO,GAAG;AAAA,IACjB,CAACA,EAAM,OAAO,GAAG;AAAA,EACnB;AACF,GAEaC,IAAuD;AAAA,EACjE,MAAa;AAAA;AAAA,EAEb,MAAa;AAAA;AAAA,EAEb,KAAY;AAAA;AAAA,EAEZ,MAAa;AAAA,EACb,OAAc;AAAA;AAAA,EAEd,QAAe;AAAA,EACf,KAAY;AAAA;AAAA,EAEZ,MAAa;AAAA,EACb,YAAmB;AAAA,EACnB,QAAe;AAAA;AAAA;AAAA,EAIf,UAAsB;AACzB,GAEaC,IAER;AAAA,EACF,YAAmB;AAAA;AAAA;AAAA,IAGlB,CAACF,EAAM,OAAO,GACZ;AAAA,IACF,CAACA,EAAM,OAAO,GACZ;AAAA,EACJ;AACF;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="1.7.0",o=e;exports.version=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="1.7.2",o=e;exports.version=o;
2
2
  //# sourceMappingURL=version.cjs.map
@@ -1,4 +1,4 @@
1
- const o = "1.7.0", n = o;
1
+ const o = "1.7.2", n = o;
2
2
  export {
3
3
  n as version
4
4
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pufferfinance/puffer-sdk",
3
3
  "description": "SDK for interacting with the puffer smart contracts",
4
- "version": "1.7.1",
4
+ "version": "1.8.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/PufferFinance/puffer-sdk.git"