@pufferfinance/puffer-sdk 1.7.1 → 1.7.2
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.
- package/dist/contracts/handlers/puffer-vault-handler.cjs +1 -1
- package/dist/contracts/handlers/puffer-vault-handler.cjs.map +1 -1
- package/dist/contracts/handlers/puffer-vault-handler.d.ts +8 -0
- package/dist/contracts/handlers/puffer-vault-handler.js +22 -12
- package/dist/contracts/handlers/puffer-vault-handler.js.map +1 -1
- package/dist/utils/version.cjs +1 -1
- package/dist/utils/version.js +1 -1
- package/package.json +1 -1
|
@@ -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"),
|
|
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","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C,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,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 = (
|
|
3
|
-
var c = (
|
|
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,
|
|
19
|
+
constructor(t, a, e) {
|
|
20
20
|
c(this, "viemChain");
|
|
21
|
-
this.chain = t, this.walletClient = a, this.publicClient =
|
|
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,
|
|
31
|
-
return C({ address: t, abi: a, client:
|
|
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,
|
|
99
|
+
withdraw(t, a, e) {
|
|
100
100
|
return { transact: async () => await this.getContract().write.withdraw(
|
|
101
|
-
[
|
|
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
|
-
[
|
|
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,
|
|
167
|
+
redeem(t, a, e) {
|
|
168
168
|
return { transact: async () => await this.getContract().write.redeem(
|
|
169
|
-
[
|
|
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
|
-
[
|
|
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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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"],"mapp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AE,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;"}
|
package/dist/utils/version.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="1.7.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="1.7.1",o=e;exports.version=o;
|
|
2
2
|
//# sourceMappingURL=version.cjs.map
|
package/dist/utils/version.js
CHANGED
package/package.json
CHANGED