@pufferfinance/puffer-sdk 1.25.3 → 1.26.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.
- package/dist/api/puffer-client.cjs +1 -1
- package/dist/api/puffer-client.cjs.map +1 -1
- package/dist/api/puffer-client.d.ts +3 -0
- package/dist/api/puffer-client.js +28 -21
- package/dist/api/puffer-client.js.map +1 -1
- package/dist/contracts/abis/mainnet/vlPUFFER.cjs +2 -0
- package/dist/contracts/abis/mainnet/vlPUFFER.cjs.map +1 -0
- package/dist/contracts/abis/mainnet/vlPUFFER.d.ts +437 -0
- package/dist/contracts/abis/mainnet/vlPUFFER.js +269 -0
- package/dist/contracts/abis/mainnet/vlPUFFER.js.map +1 -0
- package/dist/contracts/common/lib/types.cjs +2 -0
- package/dist/contracts/common/lib/types.cjs.map +1 -0
- package/dist/contracts/common/lib/types.d.ts +8 -0
- package/dist/contracts/common/lib/types.js +2 -0
- package/dist/contracts/common/lib/types.js.map +1 -0
- package/dist/contracts/handlers/erc20-permit-handler.cjs +1 -1
- package/dist/contracts/handlers/erc20-permit-handler.cjs.map +1 -1
- package/dist/contracts/handlers/erc20-permit-handler.d.ts +10 -0
- package/dist/contracts/handlers/erc20-permit-handler.js +56 -40
- package/dist/contracts/handlers/erc20-permit-handler.js.map +1 -1
- package/dist/contracts/handlers/lagoon-vault-handler.cjs +1 -1
- package/dist/contracts/handlers/lagoon-vault-handler.cjs.map +1 -1
- package/dist/contracts/handlers/lagoon-vault-handler.d.ts +51 -0
- package/dist/contracts/handlers/lagoon-vault-handler.js +87 -6
- package/dist/contracts/handlers/lagoon-vault-handler.js.map +1 -1
- package/dist/contracts/handlers/nucleus-boring-vault-handler.cjs +1 -1
- package/dist/contracts/handlers/nucleus-boring-vault-handler.cjs.map +1 -1
- package/dist/contracts/handlers/nucleus-boring-vault-handler.d.ts +2 -6
- package/dist/contracts/handlers/nucleus-boring-vault-handler.js +17 -17
- package/dist/contracts/handlers/nucleus-boring-vault-handler.js.map +1 -1
- package/dist/contracts/handlers/nucleus-teller-handler.cjs +1 -1
- package/dist/contracts/handlers/nucleus-teller-handler.cjs.map +1 -1
- package/dist/contracts/handlers/nucleus-teller-handler.d.ts +2 -6
- package/dist/contracts/handlers/nucleus-teller-handler.js +11 -20
- package/dist/contracts/handlers/nucleus-teller-handler.js.map +1 -1
- package/dist/contracts/handlers/puf-locker-handler.cjs +1 -1
- package/dist/contracts/handlers/puf-locker-handler.cjs.map +1 -1
- package/dist/contracts/handlers/puf-locker-handler.js +31 -40
- package/dist/contracts/handlers/puf-locker-handler.js.map +1 -1
- package/dist/contracts/handlers/puffer-depositor-handler.cjs +1 -1
- package/dist/contracts/handlers/puffer-depositor-handler.cjs.map +1 -1
- package/dist/contracts/handlers/puffer-depositor-handler.js +26 -38
- package/dist/contracts/handlers/puffer-depositor-handler.js.map +1 -1
- package/dist/contracts/handlers/puffer-l2-depositor-handler.cjs +1 -1
- package/dist/contracts/handlers/puffer-l2-depositor-handler.cjs.map +1 -1
- package/dist/contracts/handlers/puffer-l2-depositor-handler.js +28 -37
- package/dist/contracts/handlers/puffer-l2-depositor-handler.js.map +1 -1
- package/dist/contracts/handlers/puffer-protocol-handler.cjs.map +1 -1
- package/dist/contracts/handlers/puffer-protocol-handler.d.ts +49 -55
- package/dist/contracts/handlers/puffer-protocol-handler.js.map +1 -1
- package/dist/contracts/handlers/puffer-withdrawal-manager-handler.cjs +1 -1
- package/dist/contracts/handlers/puffer-withdrawal-manager-handler.cjs.map +1 -1
- package/dist/contracts/handlers/puffer-withdrawal-manager-handler.js +21 -27
- package/dist/contracts/handlers/puffer-withdrawal-manager-handler.js.map +1 -1
- package/dist/contracts/handlers/validator-ticket-handler.cjs.map +1 -1
- package/dist/contracts/handlers/validator-ticket-handler.d.ts +1 -7
- package/dist/contracts/handlers/validator-ticket-handler.js.map +1 -1
- package/dist/contracts/handlers/vl-puffer-handler.cjs +2 -0
- package/dist/contracts/handlers/vl-puffer-handler.cjs.map +1 -0
- package/dist/contracts/handlers/vl-puffer-handler.d.ts +14802 -0
- package/dist/contracts/handlers/vl-puffer-handler.js +357 -0
- package/dist/contracts/handlers/vl-puffer-handler.js.map +1 -0
- package/dist/contracts/tokens.cjs +1 -1
- package/dist/contracts/tokens.cjs.map +1 -1
- package/dist/contracts/tokens.d.ts +2 -1
- package/dist/contracts/tokens.js +8 -3
- package/dist/contracts/tokens.js.map +1 -1
- package/dist/utils/version.cjs +1 -1
- package/dist/utils/version.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vlPUFFER.js","sources":["../../../../lib/contracts/abis/mainnet/vlPUFFER.ts"],"sourcesContent":["export const vlPUFFER = <const>[\n {\n type: 'function',\n name: 'PUFFER',\n stateMutability: 'view',\n inputs: [],\n outputs: [{ type: 'address', name: '', simpleType: 'address' }],\n },\n {\n type: 'function',\n name: 'decimals',\n stateMutability: 'view',\n inputs: [],\n outputs: [{ type: 'uint8', name: '', simpleType: 'uint' }],\n },\n {\n type: 'function',\n name: 'delegates',\n stateMutability: 'view',\n inputs: [{ type: 'address', name: 'account', simpleType: 'address' }],\n outputs: [{ type: 'address', name: '', simpleType: 'address' }],\n },\n {\n type: 'function',\n name: 'owner',\n stateMutability: 'view',\n inputs: [],\n outputs: [{ type: 'address', name: '', simpleType: 'address' }],\n },\n {\n type: 'function',\n name: 'allowance',\n stateMutability: 'view',\n inputs: [\n { type: 'address', name: 'owner', simpleType: 'address' },\n { type: 'address', name: 'spender', simpleType: 'address' },\n ],\n outputs: [{ type: 'uint256', name: '', simpleType: 'uint' }],\n },\n {\n type: 'function',\n name: 'transferFrom',\n stateMutability: 'nonpayable',\n inputs: [\n { type: 'address', name: 'from', simpleType: 'address' },\n { type: 'address', name: 'to', simpleType: 'address' },\n { type: 'uint256', name: 'value', simpleType: 'uint' },\n ],\n outputs: [{ type: 'bool', name: '', simpleType: 'bool' }],\n },\n {\n type: 'function',\n name: 'totalSupply',\n stateMutability: 'view',\n inputs: [],\n outputs: [{ type: 'uint256', name: '', simpleType: 'uint' }],\n },\n {\n type: 'function',\n name: 'createLock',\n stateMutability: 'nonpayable',\n inputs: [\n { type: 'uint256', name: 'amount', simpleType: 'uint' },\n { type: 'uint256', name: 'multiplier', simpleType: 'uint' },\n ],\n outputs: [],\n },\n {\n type: 'function',\n name: 'symbol',\n stateMutability: 'view',\n inputs: [],\n outputs: [{ type: 'string', name: '', simpleType: 'string' }],\n },\n {\n type: 'function',\n name: 'paused',\n stateMutability: 'view',\n inputs: [],\n outputs: [{ type: 'bool', name: '', simpleType: 'bool' }],\n },\n {\n type: 'function',\n name: 'lockInfos',\n stateMutability: 'view',\n inputs: [{ type: 'address', name: 'user', simpleType: 'address' }],\n outputs: [\n { type: 'uint256', name: 'pufferAmount', simpleType: 'uint' },\n { type: 'uint256', name: 'unlockTime', simpleType: 'uint' },\n ],\n },\n {\n type: 'function',\n name: 'getPastTotalSupply',\n stateMutability: 'view',\n inputs: [{ type: 'uint256', name: 'timepoint', simpleType: 'uint' }],\n outputs: [{ type: 'uint256', name: '', simpleType: 'uint' }],\n },\n {\n type: 'function',\n name: 'balanceOf',\n stateMutability: 'view',\n inputs: [{ type: 'address', name: 'account', simpleType: 'address' }],\n outputs: [{ type: 'uint256', name: '', simpleType: 'uint' }],\n },\n {\n type: 'function',\n name: 'nonces',\n stateMutability: 'view',\n inputs: [{ type: 'address', name: 'owner', simpleType: 'address' }],\n outputs: [{ type: 'uint256', name: '', simpleType: 'uint' }],\n },\n {\n type: 'function',\n name: 'getVotes',\n stateMutability: 'view',\n inputs: [{ type: 'address', name: 'account', simpleType: 'address' }],\n outputs: [{ type: 'uint256', name: '', simpleType: 'uint' }],\n },\n {\n type: 'function',\n name: 'delegateBySig',\n stateMutability: 'nonpayable',\n inputs: [\n { type: 'address', name: 'delegatee', simpleType: 'address' },\n { type: 'uint256', name: 'nonce', simpleType: 'uint' },\n { type: 'uint256', name: 'expiry', simpleType: 'uint' },\n { type: 'uint8', name: 'v', simpleType: 'uint' },\n { type: 'bytes32', name: 'r', simpleType: 'bytes' },\n { type: 'bytes32', name: 's', simpleType: 'bytes' },\n ],\n outputs: [],\n },\n {\n type: 'function',\n name: 'pause',\n stateMutability: 'nonpayable',\n inputs: [],\n outputs: [],\n },\n {\n type: 'function',\n name: 'transfer',\n stateMutability: 'nonpayable',\n inputs: [\n { type: 'address', name: 'to', simpleType: 'address' },\n { type: 'uint256', name: 'value', simpleType: 'uint' },\n ],\n outputs: [{ type: 'bool', name: '', simpleType: 'bool' }],\n },\n {\n type: 'function',\n name: 'CLOCK_MODE',\n stateMutability: 'pure',\n inputs: [],\n outputs: [{ type: 'string', name: '', simpleType: 'string' }],\n },\n {\n type: 'function',\n name: 'numCheckpoints',\n stateMutability: 'view',\n inputs: [{ type: 'address', name: 'account', simpleType: 'address' }],\n outputs: [{ type: 'uint32', name: '', simpleType: 'uint' }],\n },\n {\n type: 'function',\n name: 'approve',\n stateMutability: 'nonpayable',\n inputs: [\n { type: 'address', name: 'spender', simpleType: 'address' },\n { type: 'uint256', name: 'value', simpleType: 'uint' },\n ],\n outputs: [{ type: 'bool', name: '', simpleType: 'bool' }],\n },\n {\n type: 'function',\n name: 'reLock',\n stateMutability: 'nonpayable',\n inputs: [\n { type: 'uint256', name: 'amount', simpleType: 'uint' },\n { type: 'uint256', name: 'multiplier', simpleType: 'uint' },\n ],\n outputs: [],\n },\n {\n type: 'function',\n name: 'getPastVotes',\n stateMutability: 'view',\n inputs: [\n { type: 'address', name: 'account', simpleType: 'address' },\n { type: 'uint256', name: 'timepoint', simpleType: 'uint' },\n ],\n outputs: [{ type: 'uint256', name: '', simpleType: 'uint' }],\n },\n {\n type: 'function',\n name: 'checkpoints',\n stateMutability: 'view',\n inputs: [\n { type: 'address', name: 'account', simpleType: 'address' },\n { type: 'uint32', name: 'pos', simpleType: 'uint' },\n ],\n outputs: [\n {\n type: 'tuple',\n name: '',\n simpleType: 'tuple',\n components: [\n { type: 'uint48', name: '_key', simpleType: 'uint' },\n { type: 'uint208', name: '_value', simpleType: 'uint' },\n ],\n },\n ],\n },\n {\n type: 'function',\n name: 'name',\n stateMutability: 'view',\n inputs: [],\n outputs: [{ type: 'string', name: '', simpleType: 'string' }],\n },\n {\n type: 'function',\n name: 'createLockWithPermit',\n stateMutability: 'nonpayable',\n inputs: [\n { type: 'uint256', name: 'value', simpleType: 'uint' },\n { type: 'uint256', name: 'multiplier', simpleType: 'uint' },\n {\n type: 'tuple',\n name: 'permitData',\n simpleType: 'tuple',\n components: [\n { type: 'uint256', name: 'deadline', simpleType: 'uint' },\n { type: 'uint256', name: 'amount', simpleType: 'uint' },\n { type: 'uint8', name: 'v', simpleType: 'uint' },\n { type: 'bytes32', name: 'r', simpleType: 'bytes' },\n { type: 'bytes32', name: 's', simpleType: 'bytes' },\n ],\n },\n ],\n outputs: [],\n },\n {\n type: 'function',\n name: 'clock',\n stateMutability: 'view',\n inputs: [],\n outputs: [{ type: 'uint48', name: '', simpleType: 'uint' }],\n },\n {\n type: 'function',\n name: 'withdraw',\n stateMutability: 'nonpayable',\n inputs: [{ type: 'address', name: 'recipient', simpleType: 'address' }],\n outputs: [],\n },\n {\n type: 'function',\n name: 'delegate',\n stateMutability: 'nonpayable',\n inputs: [{ type: 'address', name: 'delegatee', simpleType: 'address' }],\n outputs: [],\n },\n];\n"],"names":["vlPUFFER"],"mappings":"AAAO,MAAMA,IAAkB;AAAA,EAC7B;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,iBAAiB;AAAA,IACjB,QAAQ,CAAC;AAAA,IACT,SAAS,CAAC,EAAE,MAAM,WAAW,MAAM,IAAI,YAAY,UAAW,CAAA;AAAA,EAChE;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,iBAAiB;AAAA,IACjB,QAAQ,CAAC;AAAA,IACT,SAAS,CAAC,EAAE,MAAM,SAAS,MAAM,IAAI,YAAY,OAAQ,CAAA;AAAA,EA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AM,WAAW,MAAM,KAAK,YAAY,QAAQ;AAAA,QAAA;AAAA,MACpD;AAAA,IAEJ;AAAA,IACA,SAAS,CAAA;AAAA,EACX;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,iBAAiB;AAAA,IACjB,QAAQ,CAAC;AAAA,IACT,SAAS,CAAC,EAAE,MAAM,UAAU,MAAM,IAAI,YAAY,OAAQ,CAAA;AAAA,EAC5D;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,iBAAiB;AAAA,IACjB,QAAQ,CAAC,EAAE,MAAM,WAAW,MAAM,aAAa,YAAY,WAAW;AAAA,IACtE,SAAS,CAAA;AAAA,EACX;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,iBAAiB;AAAA,IACjB,QAAQ,CAAC,EAAE,MAAM,WAAW,MAAM,aAAa,YAAY,WAAW;AAAA,IACtE,SAAS,CAAA;AAAA,EAAC;AAEd;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var d=Object.defineProperty;var g=(i,t,n)=>t in i?d(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n;var m=(i,t,n)=>g(i,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../constants-CxSgz27h.cjs"),a=require("../tokens.cjs"),y=require("../../utils/time.cjs"),S=require("../abis/mainnet/ERC20Permit.cjs"),C=require("../../getContract-DUA3M2pm.cjs"),P=require("../../secp256k1-YUzyTLhP.cjs");function E(i){const{r:t,s:n}=P.secp256k1.Signature.fromCompact(i.slice(2,130)),e=+`0x${i.slice(130)}`,[r,s]=(()=>{if(e===0||e===1)return[void 0,e];if(e===27)return[BigInt(e),0];if(e===28)return[BigInt(e),1];throw new Error("Invalid yParityOrV value")})();return typeof r<"u"?{r:o.numberToHex(t,{size:32}),s:o.numberToHex(n,{size:32}),v:r,yParity:s}:{r:o.numberToHex(t,{size:32}),s:o.numberToHex(n,{size:32}),yParity:s}}class T{constructor(t,n,e){m(this,"viemChain");m(this,"token");this.chain=t,this.walletClient=n,this.publicClient=e,this.viemChain=o.VIEM_CHAINS[t],this.token=a.Token.WETH}withToken(t){return this.token=t,this}getContract(){const t=a.TOKENS_ADDRESSES[this.token][this.chain],n=S.ERC20Permit,e={public:this.publicClient,wallet:this.walletClient};return C.getContract({address:t,abi:n,client:e})}async getPermitSignature(t,n,e){const r=this.getContract(),s=await r.read.nonces([t]),c={name:await r.read.name(),version:this.getPermitVersion(this.token),chainId:this.chain,verifyingContract:a.TOKENS_ADDRESSES[this.token][this.chain],salt:this.getPermitSalt(this.token)},u={Permit:[{name:"owner",type:"address"},{name:"spender",type:"address"},{name:"value",type:"uint256"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"}]},l=BigInt(y.getTimestampInSeconds()+60*60*2),p=await this.walletClient.signTypedData({account:t,domain:c,types:u,primaryType:"Permit",message:{owner:t,spender:n,value:e,nonce:s,deadline:l}});return{...E(p),deadline:l}}async getPermitData(t,n,e){const{r,s,v:h,yParity:c,deadline:u}=await this.getPermitSignature(t,n,e);return{r,s,v:Number(h??c),deadline:u,amount:e}}approve(t,n,e){return this.getContract().write.approve([n,e],{account:t,chain:this.viemChain})}getPermitVersion(t){return a.TOKENS_PERMIT_VERSION[t]}getPermitSalt(t){var n,e;return(e=(n=a.TOKENS_SALT)==null?void 0:n[t])==null?void 0:e[this.chain]}}exports.ERC20PermitHandler=T;
|
|
2
2
|
//# sourceMappingURL=erc20-permit-handler.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"erc20-permit-handler.cjs","sources":["../../../node_modules/.pnpm/viem@2.33.1_typescript@5.8.2_zod@3.24.2/node_modules/viem/_esm/utils/signature/parseSignature.js","../../../lib/contracts/handlers/erc20-permit-handler.ts"],"sourcesContent":["import { secp256k1 } from '@noble/curves/secp256k1';\nimport { numberToHex, } from '../../utils/encoding/toHex.js';\n/**\n * @description Parses a hex formatted signature into a structured signature.\n *\n * @param signatureHex Signature in hex format.\n * @returns The structured signature.\n *\n * @example\n * parseSignature('0x6e100a352ec6ad1b70802290e18aeed190704973570f3b8ed42cb9808e2ea6bf4a90a229a244495b41890987806fcbd2d5d23fc0dbe5f5256c2613c039d76db81c')\n * // { r: '0x...', s: '0x...', v: 28n }\n */\nexport function parseSignature(signatureHex) {\n const { r, s } = secp256k1.Signature.fromCompact(signatureHex.slice(2, 130));\n const yParityOrV = Number(`0x${signatureHex.slice(130)}`);\n const [v, yParity] = (() => {\n if (yParityOrV === 0 || yParityOrV === 1)\n return [undefined, yParityOrV];\n if (yParityOrV === 27)\n return [BigInt(yParityOrV), 0];\n if (yParityOrV === 28)\n return [BigInt(yParityOrV), 1];\n throw new Error('Invalid yParityOrV value');\n })();\n if (typeof v !== 'undefined')\n return {\n r: numberToHex(r, { size: 32 }),\n s: numberToHex(s, { size: 32 }),\n v,\n yParity,\n };\n return {\n r: numberToHex(r, { size: 32 }),\n s: numberToHex(s, { size: 32 }),\n yParity,\n };\n}\n//# sourceMappingURL=parseSignature.js.map","import {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n parseSignature,\n GetContractReturnType,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport {\n AnyToken,\n TOKENS_ADDRESSES,\n TOKENS_SALT,\n TOKENS_PERMIT_VERSION,\n Token,\n} from '../tokens';\nimport { getTimestampInSeconds } from '../../utils/time';\nimport { ERC20Permit } from '../abis/mainnet/ERC20Permit';\n\n/**\n * Handler for performing operations for and with ERC20Permit tokens.\n */\nexport class ERC20PermitHandler {\n private viemChain: ViemChain;\n private token: AnyToken;\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.token = Token.WETH;\n }\n\n /**\n * Set the token to use for executing transactions on the contract.\n *\n * @param token Token to use for the handler.\n * @returns The handler.\n */\n public withToken(token: AnyToken) {\n this.token = token;\n return this;\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 = TOKENS_ADDRESSES[this.token][this.chain];\n const abi = ERC20Permit;\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 * Process and get permit signature for the given token to perform\n * transactions without calling `approve()`.\n *\n * @param ownerAddress Address of the token owner.\n * @param spenderAddress Address of the spender who needs the permit.\n * @param value Value of the transaction.\n * @returns Permit signature in the form `{ r, s, v?, yParity }`.\n */\n public async getPermitSignature(\n ownerAddress: Address,\n spenderAddress: Address,\n value: bigint,\n ) {\n const contract = this.getContract();\n\n const permitNonces = await contract.read.nonces([ownerAddress]);\n const name = await contract.read.name();\n const domain = <const>{\n name,\n version: this.getPermitVersion(this.token),\n chainId: this.chain,\n verifyingContract: TOKENS_ADDRESSES[this.token][this.chain],\n salt: this.getPermitSalt(this.token),\n };\n const types = <const>{\n Permit: [\n { name: 'owner', type: 'address' },\n { name: 'spender', type: 'address' },\n { name: 'value', type: 'uint256' },\n { name: 'nonce', type: 'uint256' },\n { name: 'deadline', type: 'uint256' },\n ],\n };\n // Valid for 2 hours.\n const deadline = BigInt(getTimestampInSeconds() + 60 * 60 * 2);\n\n const signature = await this.walletClient.signTypedData({\n account: ownerAddress,\n domain,\n types,\n primaryType: 'Permit',\n message: {\n owner: ownerAddress,\n spender: spenderAddress,\n value,\n nonce: permitNonces,\n deadline,\n },\n });\n\n return { ...parseSignature(signature), deadline };\n }\n\n /**\n * Approve transaction for the spender to spend the owner's tokens.\n *\n * @param ownerAddress Address of the caller of the transaction.\n * @param spenderAddress Address of the spender.\n * @param value Value to approve for the spender.\n * @returns Hash of the transaction.\n */\n public approve(\n ownerAddress: Address,\n spenderAddress: Address,\n value: bigint,\n ) {\n return this.getContract().write.approve([spenderAddress, value], {\n account: ownerAddress,\n chain: this.viemChain,\n });\n }\n\n private getPermitVersion(token: AnyToken): string {\n return TOKENS_PERMIT_VERSION[token];\n }\n\n private getPermitSalt(token: AnyToken) {\n return TOKENS_SALT?.[token]?.[this.chain];\n }\n}\n"],"names":["parseSignature","signatureHex","r","s","secp256k1","yParityOrV","v","yParity","numberToHex","ERC20PermitHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","Token","token","address","TOKENS_ADDRESSES","abi","ERC20Permit","client","getContract","ownerAddress","spenderAddress","value","contract","permitNonces","domain","types","deadline","getTimestampInSeconds","signature","TOKENS_PERMIT_VERSION","TOKENS_SALT"],"mappings":"oeAYO,SAASA,EAAeC,EAAc,CACzC,KAAM,CAAE,EAAAC,EAAG,EAAAC,CAAG,EAAGC,YAAU,UAAU,YAAYH,EAAa,MAAM,EAAG,GAAG,CAAC,EACrEI,EAAa,CAAO,KAAKJ,EAAa,MAAM,GAAG,CAAC,GAChD,CAACK,EAAGC,CAAO,GAAK,IAAM,CACxB,GAAIF,IAAe,GAAKA,IAAe,EACnC,MAAO,CAAC,OAAWA,CAAU,EACjC,GAAIA,IAAe,GACf,MAAO,CAAC,OAAOA,CAAU,EAAG,CAAC,EACjC,GAAIA,IAAe,GACf,MAAO,CAAC,OAAOA,CAAU,EAAG,CAAC,EACjC,MAAM,IAAI,MAAM,0BAA0B,CAClD,GAAQ,EACJ,OAAI,OAAOC,EAAM,IACN,CACH,EAAGE,EAAAA,YAAYN,EAAG,CAAE,KAAM,EAAE,CAAE,EAC9B,EAAGM,EAAAA,YAAYL,EAAG,CAAE,KAAM,EAAE,CAAE,EAC9B,EAAAG,EACA,QAAAC,CACH,EACE,CACH,EAAGC,EAAAA,YAAYN,EAAG,CAAE,KAAM,EAAE,CAAE,EAC9B,EAAGM,EAAAA,YAAYL,EAAG,CAAE,KAAM,EAAE,CAAE,EAC9B,QAAAI,CACH,CACL,
|
|
1
|
+
{"version":3,"file":"erc20-permit-handler.cjs","sources":["../../../node_modules/.pnpm/viem@2.33.1_typescript@5.8.2_zod@3.24.2/node_modules/viem/_esm/utils/signature/parseSignature.js","../../../lib/contracts/handlers/erc20-permit-handler.ts"],"sourcesContent":["import { secp256k1 } from '@noble/curves/secp256k1';\nimport { numberToHex, } from '../../utils/encoding/toHex.js';\n/**\n * @description Parses a hex formatted signature into a structured signature.\n *\n * @param signatureHex Signature in hex format.\n * @returns The structured signature.\n *\n * @example\n * parseSignature('0x6e100a352ec6ad1b70802290e18aeed190704973570f3b8ed42cb9808e2ea6bf4a90a229a244495b41890987806fcbd2d5d23fc0dbe5f5256c2613c039d76db81c')\n * // { r: '0x...', s: '0x...', v: 28n }\n */\nexport function parseSignature(signatureHex) {\n const { r, s } = secp256k1.Signature.fromCompact(signatureHex.slice(2, 130));\n const yParityOrV = Number(`0x${signatureHex.slice(130)}`);\n const [v, yParity] = (() => {\n if (yParityOrV === 0 || yParityOrV === 1)\n return [undefined, yParityOrV];\n if (yParityOrV === 27)\n return [BigInt(yParityOrV), 0];\n if (yParityOrV === 28)\n return [BigInt(yParityOrV), 1];\n throw new Error('Invalid yParityOrV value');\n })();\n if (typeof v !== 'undefined')\n return {\n r: numberToHex(r, { size: 32 }),\n s: numberToHex(s, { size: 32 }),\n v,\n yParity,\n };\n return {\n r: numberToHex(r, { size: 32 }),\n s: numberToHex(s, { size: 32 }),\n yParity,\n };\n}\n//# sourceMappingURL=parseSignature.js.map","import {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n parseSignature,\n GetContractReturnType,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport {\n AnyToken,\n TOKENS_ADDRESSES,\n TOKENS_SALT,\n TOKENS_PERMIT_VERSION,\n Token,\n} from '../tokens';\nimport { getTimestampInSeconds } from '../../utils/time';\nimport { ERC20Permit } from '../abis/mainnet/ERC20Permit';\nimport { PermitData } from '../common/lib/types';\n\n/**\n * Handler for performing operations for and with ERC20Permit tokens.\n */\nexport class ERC20PermitHandler {\n private viemChain: ViemChain;\n private token: AnyToken;\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.token = Token.WETH;\n }\n\n /**\n * Set the token to use for executing transactions on the contract.\n *\n * @param token Token to use for the handler.\n * @returns The handler.\n */\n public withToken(token: AnyToken) {\n this.token = token;\n return this;\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 = TOKENS_ADDRESSES[this.token][this.chain];\n const abi = ERC20Permit;\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 * Process and get permit signature for the given token to perform\n * transactions without calling `approve()`.\n *\n * @param ownerAddress Address of the token owner.\n * @param spenderAddress Address of the spender who needs the permit.\n * @param value Value of the transaction.\n * @returns Permit signature in the form `{ r, s, v?, yParity }`.\n */\n public async getPermitSignature(\n ownerAddress: Address,\n spenderAddress: Address,\n value: bigint,\n ) {\n const contract = this.getContract();\n\n const permitNonces = await contract.read.nonces([ownerAddress]);\n const name = await contract.read.name();\n const domain = <const>{\n name,\n version: this.getPermitVersion(this.token),\n chainId: this.chain,\n verifyingContract: TOKENS_ADDRESSES[this.token][this.chain],\n salt: this.getPermitSalt(this.token),\n };\n const types = <const>{\n Permit: [\n { name: 'owner', type: 'address' },\n { name: 'spender', type: 'address' },\n { name: 'value', type: 'uint256' },\n { name: 'nonce', type: 'uint256' },\n { name: 'deadline', type: 'uint256' },\n ],\n };\n // Valid for 2 hours.\n const deadline = BigInt(getTimestampInSeconds() + 60 * 60 * 2);\n\n const signature = await this.walletClient.signTypedData({\n account: ownerAddress,\n domain,\n types,\n primaryType: 'Permit',\n message: {\n owner: ownerAddress,\n spender: spenderAddress,\n value,\n nonce: permitNonces,\n deadline,\n },\n });\n\n return { ...parseSignature(signature), deadline };\n }\n\n /**\n * Get the permit data for the given owner, spender and value.\n *\n * @param ownerAddress Address of the token owner.\n * @param spenderAddress Address of the spender who needs the permit.\n * @param value Value/amount to be permitted.\n * @returns Permit data in the form `{ r, s, v, deadline, amount }`.\n */\n public async getPermitData(\n ownerAddress: Address,\n spenderAddress: Address,\n value: bigint,\n ): Promise<PermitData> {\n const { r, s, v, yParity, deadline } = await this.getPermitSignature(\n ownerAddress,\n spenderAddress,\n value,\n );\n\n /* istanbul ignore next */\n return { r, s, v: Number(v ?? yParity), deadline, amount: value };\n }\n\n /**\n * Approve transaction for the spender to spend the owner's tokens.\n *\n * @param ownerAddress Address of the caller of the transaction.\n * @param spenderAddress Address of the spender.\n * @param value Value to approve for the spender.\n * @returns Hash of the transaction.\n */\n public approve(\n ownerAddress: Address,\n spenderAddress: Address,\n value: bigint,\n ) {\n return this.getContract().write.approve([spenderAddress, value], {\n account: ownerAddress,\n chain: this.viemChain,\n });\n }\n\n private getPermitVersion(token: AnyToken): string {\n return TOKENS_PERMIT_VERSION[token];\n }\n\n private getPermitSalt(token: AnyToken) {\n return TOKENS_SALT?.[token]?.[this.chain];\n }\n}\n"],"names":["parseSignature","signatureHex","r","s","secp256k1","yParityOrV","v","yParity","numberToHex","ERC20PermitHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","Token","token","address","TOKENS_ADDRESSES","abi","ERC20Permit","client","getContract","ownerAddress","spenderAddress","value","contract","permitNonces","domain","types","deadline","getTimestampInSeconds","signature","TOKENS_PERMIT_VERSION","TOKENS_SALT"],"mappings":"oeAYO,SAASA,EAAeC,EAAc,CACzC,KAAM,CAAE,EAAAC,EAAG,EAAAC,CAAG,EAAGC,YAAU,UAAU,YAAYH,EAAa,MAAM,EAAG,GAAG,CAAC,EACrEI,EAAa,CAAO,KAAKJ,EAAa,MAAM,GAAG,CAAC,GAChD,CAACK,EAAGC,CAAO,GAAK,IAAM,CACxB,GAAIF,IAAe,GAAKA,IAAe,EACnC,MAAO,CAAC,OAAWA,CAAU,EACjC,GAAIA,IAAe,GACf,MAAO,CAAC,OAAOA,CAAU,EAAG,CAAC,EACjC,GAAIA,IAAe,GACf,MAAO,CAAC,OAAOA,CAAU,EAAG,CAAC,EACjC,MAAM,IAAI,MAAM,0BAA0B,CAClD,GAAQ,EACJ,OAAI,OAAOC,EAAM,IACN,CACH,EAAGE,EAAAA,YAAYN,EAAG,CAAE,KAAM,EAAE,CAAE,EAC9B,EAAGM,EAAAA,YAAYL,EAAG,CAAE,KAAM,EAAE,CAAE,EAC9B,EAAAG,EACA,QAAAC,CACH,EACE,CACH,EAAGC,EAAAA,YAAYN,EAAG,CAAE,KAAM,EAAE,CAAE,EAC9B,EAAGM,EAAAA,YAAYL,EAAG,CAAE,KAAM,EAAE,CAAE,EAC9B,QAAAI,CACH,CACL,CCbO,MAAME,CAAmB,CAa9B,YACUC,EACAC,EACAC,EACR,CAhBMC,EAAA,kBACAA,EAAA,cAYE,KAAA,MAAAH,EACA,KAAA,aAAAC,EACA,KAAA,aAAAC,EAEH,KAAA,UAAYE,cAAYJ,CAAK,EAClC,KAAK,MAAQK,EAAAA,MAAM,IAAA,CASd,UAAUC,EAAiB,CAChC,YAAK,MAAQA,EACN,IAAA,CASF,aAAc,CACnB,MAAMC,EAAUC,EAAAA,iBAAiB,KAAK,K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AAO,EAAG,SAAAuB,EAAU,OAAQL,CAAM,CAAA,CAW3D,QACLF,EACAC,EACAC,EACA,CACO,OAAA,KAAK,cAAc,MAAM,QAAQ,CAACD,EAAgBC,CAAK,EAAG,CAC/D,QAASF,EACT,MAAO,KAAK,SAAA,CACb,CAAA,CAGK,iBAAiBP,EAAyB,CAChD,OAAOiB,EAAAA,sBAAsBjB,CAAK,CAAA,CAG5B,cAAcA,EAAiB,SACrC,OAAOkB,GAAAA,EAAAA,gBAAAA,YAAAA,EAAclB,KAAdkB,YAAAA,EAAuB,KAAK,MAAK,CAE5C","x_google_ignoreList":[0]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { WalletClient, PublicClient, Address, GetContractReturnType } from 'viem';
|
|
2
2
|
import { Chain, ViemChain } from '../../chains/constants';
|
|
3
3
|
import { AnyToken } from '../tokens';
|
|
4
|
+
import { PermitData } from '../common/lib/types';
|
|
4
5
|
/**
|
|
5
6
|
* Handler for performing operations for and with ERC20Permit tokens.
|
|
6
7
|
*/
|
|
@@ -15003,6 +15004,15 @@ export declare class ERC20PermitHandler {
|
|
|
15003
15004
|
yParity: number;
|
|
15004
15005
|
v?: never;
|
|
15005
15006
|
}>;
|
|
15007
|
+
/**
|
|
15008
|
+
* Get the permit data for the given owner, spender and value.
|
|
15009
|
+
*
|
|
15010
|
+
* @param ownerAddress Address of the token owner.
|
|
15011
|
+
* @param spenderAddress Address of the spender who needs the permit.
|
|
15012
|
+
* @param value Value/amount to be permitted.
|
|
15013
|
+
* @returns Permit data in the form `{ r, s, v, deadline, amount }`.
|
|
15014
|
+
*/
|
|
15015
|
+
getPermitData(ownerAddress: Address, spenderAddress: Address, value: bigint): Promise<PermitData>;
|
|
15006
15016
|
/**
|
|
15007
15017
|
* Approve transaction for the spender to spend the owner's tokens.
|
|
15008
15018
|
*
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
var
|
|
2
|
-
var d = (i, t,
|
|
3
|
-
var
|
|
4
|
-
import { n as s, V as
|
|
5
|
-
import { Token as
|
|
1
|
+
var g = Object.defineProperty;
|
|
2
|
+
var d = (i, t, n) => t in i ? g(i, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[t] = n;
|
|
3
|
+
var m = (i, t, n) => d(i, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { n as s, V as y } from "../../constants-C9YZ6Ewc.js";
|
|
5
|
+
import { Token as C, TOKENS_ADDRESSES as p, TOKENS_PERMIT_VERSION as f, TOKENS_SALT as P } from "../tokens.js";
|
|
6
6
|
import { getTimestampInSeconds as S } from "../../utils/time.js";
|
|
7
|
-
import { ERC20Permit as
|
|
8
|
-
import { g as
|
|
9
|
-
import { secp256k1 as
|
|
10
|
-
function
|
|
11
|
-
const { r: t, s:
|
|
12
|
-
if (
|
|
13
|
-
return [void 0,
|
|
14
|
-
if (
|
|
15
|
-
return [BigInt(
|
|
16
|
-
if (
|
|
17
|
-
return [BigInt(
|
|
7
|
+
import { ERC20Permit as v } from "../abis/mainnet/ERC20Permit.js";
|
|
8
|
+
import { g as w } from "../../getContract-DEPNMZxg.js";
|
|
9
|
+
import { secp256k1 as E } from "../../secp256k1-ClOw2ksU.js";
|
|
10
|
+
function T(i) {
|
|
11
|
+
const { r: t, s: n } = E.Signature.fromCompact(i.slice(2, 130)), e = +`0x${i.slice(130)}`, [r, a] = (() => {
|
|
12
|
+
if (e === 0 || e === 1)
|
|
13
|
+
return [void 0, e];
|
|
14
|
+
if (e === 27)
|
|
15
|
+
return [BigInt(e), 0];
|
|
16
|
+
if (e === 28)
|
|
17
|
+
return [BigInt(e), 1];
|
|
18
18
|
throw new Error("Invalid yParityOrV value");
|
|
19
19
|
})();
|
|
20
20
|
return typeof r < "u" ? {
|
|
21
21
|
r: s(t, { size: 32 }),
|
|
22
|
-
s: s(
|
|
22
|
+
s: s(n, { size: 32 }),
|
|
23
23
|
v: r,
|
|
24
24
|
yParity: a
|
|
25
25
|
} : {
|
|
26
26
|
r: s(t, { size: 32 }),
|
|
27
|
-
s: s(
|
|
27
|
+
s: s(n, { size: 32 }),
|
|
28
28
|
yParity: a
|
|
29
29
|
};
|
|
30
30
|
}
|
|
@@ -38,10 +38,10 @@ class _ {
|
|
|
38
38
|
* @param publicClient The public client to use for public
|
|
39
39
|
* interactions.
|
|
40
40
|
*/
|
|
41
|
-
constructor(t,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
this.chain = t, this.walletClient =
|
|
41
|
+
constructor(t, n, e) {
|
|
42
|
+
m(this, "viemChain");
|
|
43
|
+
m(this, "token");
|
|
44
|
+
this.chain = t, this.walletClient = n, this.publicClient = e, this.viemChain = y[t], this.token = C.WETH;
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
47
|
* Set the token to use for executing transactions on the contract.
|
|
@@ -59,8 +59,8 @@ class _ {
|
|
|
59
59
|
* @returns The viem contract.
|
|
60
60
|
*/
|
|
61
61
|
getContract() {
|
|
62
|
-
const t =
|
|
63
|
-
return
|
|
62
|
+
const t = p[this.token][this.chain], n = v, e = { public: this.publicClient, wallet: this.walletClient };
|
|
63
|
+
return w({ address: t, abi: n, client: e });
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
66
|
* Process and get permit signature for the given token to perform
|
|
@@ -71,14 +71,14 @@ class _ {
|
|
|
71
71
|
* @param value Value of the transaction.
|
|
72
72
|
* @returns Permit signature in the form `{ r, s, v?, yParity }`.
|
|
73
73
|
*/
|
|
74
|
-
async getPermitSignature(t,
|
|
75
|
-
const r = this.getContract(), a = await r.read.nonces([t]),
|
|
74
|
+
async getPermitSignature(t, n, e) {
|
|
75
|
+
const r = this.getContract(), a = await r.read.nonces([t]), o = {
|
|
76
76
|
name: await r.read.name(),
|
|
77
77
|
version: this.getPermitVersion(this.token),
|
|
78
78
|
chainId: this.chain,
|
|
79
|
-
verifyingContract:
|
|
79
|
+
verifyingContract: p[this.token][this.chain],
|
|
80
80
|
salt: this.getPermitSalt(this.token)
|
|
81
|
-
},
|
|
81
|
+
}, c = {
|
|
82
82
|
Permit: [
|
|
83
83
|
{ name: "owner", type: "address" },
|
|
84
84
|
{ name: "spender", type: "address" },
|
|
@@ -86,20 +86,36 @@ class _ {
|
|
|
86
86
|
{ name: "nonce", type: "uint256" },
|
|
87
87
|
{ name: "deadline", type: "uint256" }
|
|
88
88
|
]
|
|
89
|
-
},
|
|
89
|
+
}, u = BigInt(S() + 60 * 60 * 2), l = await this.walletClient.signTypedData({
|
|
90
90
|
account: t,
|
|
91
|
-
domain:
|
|
92
|
-
types:
|
|
91
|
+
domain: o,
|
|
92
|
+
types: c,
|
|
93
93
|
primaryType: "Permit",
|
|
94
94
|
message: {
|
|
95
95
|
owner: t,
|
|
96
|
-
spender:
|
|
97
|
-
value:
|
|
96
|
+
spender: n,
|
|
97
|
+
value: e,
|
|
98
98
|
nonce: a,
|
|
99
|
-
deadline:
|
|
99
|
+
deadline: u
|
|
100
100
|
}
|
|
101
101
|
});
|
|
102
|
-
return { ...
|
|
102
|
+
return { ...T(l), deadline: u };
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Get the permit data for the given owner, spender and value.
|
|
106
|
+
*
|
|
107
|
+
* @param ownerAddress Address of the token owner.
|
|
108
|
+
* @param spenderAddress Address of the spender who needs the permit.
|
|
109
|
+
* @param value Value/amount to be permitted.
|
|
110
|
+
* @returns Permit data in the form `{ r, s, v, deadline, amount }`.
|
|
111
|
+
*/
|
|
112
|
+
async getPermitData(t, n, e) {
|
|
113
|
+
const { r, s: a, v: h, yParity: o, deadline: c } = await this.getPermitSignature(
|
|
114
|
+
t,
|
|
115
|
+
n,
|
|
116
|
+
e
|
|
117
|
+
);
|
|
118
|
+
return { r, s: a, v: Number(h ?? o), deadline: c, amount: e };
|
|
103
119
|
}
|
|
104
120
|
/**
|
|
105
121
|
* Approve transaction for the spender to spend the owner's tokens.
|
|
@@ -109,18 +125,18 @@ class _ {
|
|
|
109
125
|
* @param value Value to approve for the spender.
|
|
110
126
|
* @returns Hash of the transaction.
|
|
111
127
|
*/
|
|
112
|
-
approve(t,
|
|
113
|
-
return this.getContract().write.approve([
|
|
128
|
+
approve(t, n, e) {
|
|
129
|
+
return this.getContract().write.approve([n, e], {
|
|
114
130
|
account: t,
|
|
115
131
|
chain: this.viemChain
|
|
116
132
|
});
|
|
117
133
|
}
|
|
118
134
|
getPermitVersion(t) {
|
|
119
|
-
return
|
|
135
|
+
return f[t];
|
|
120
136
|
}
|
|
121
137
|
getPermitSalt(t) {
|
|
122
|
-
var
|
|
123
|
-
return (
|
|
138
|
+
var n, e;
|
|
139
|
+
return (e = (n = P) == null ? void 0 : n[t]) == null ? void 0 : e[this.chain];
|
|
124
140
|
}
|
|
125
141
|
}
|
|
126
142
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"erc20-permit-handler.js","sources":["../../../node_modules/.pnpm/viem@2.33.1_typescript@5.8.2_zod@3.24.2/node_modules/viem/_esm/utils/signature/parseSignature.js","../../../lib/contracts/handlers/erc20-permit-handler.ts"],"sourcesContent":["import { secp256k1 } from '@noble/curves/secp256k1';\nimport { numberToHex, } from '../../utils/encoding/toHex.js';\n/**\n * @description Parses a hex formatted signature into a structured signature.\n *\n * @param signatureHex Signature in hex format.\n * @returns The structured signature.\n *\n * @example\n * parseSignature('0x6e100a352ec6ad1b70802290e18aeed190704973570f3b8ed42cb9808e2ea6bf4a90a229a244495b41890987806fcbd2d5d23fc0dbe5f5256c2613c039d76db81c')\n * // { r: '0x...', s: '0x...', v: 28n }\n */\nexport function parseSignature(signatureHex) {\n const { r, s } = secp256k1.Signature.fromCompact(signatureHex.slice(2, 130));\n const yParityOrV = Number(`0x${signatureHex.slice(130)}`);\n const [v, yParity] = (() => {\n if (yParityOrV === 0 || yParityOrV === 1)\n return [undefined, yParityOrV];\n if (yParityOrV === 27)\n return [BigInt(yParityOrV), 0];\n if (yParityOrV === 28)\n return [BigInt(yParityOrV), 1];\n throw new Error('Invalid yParityOrV value');\n })();\n if (typeof v !== 'undefined')\n return {\n r: numberToHex(r, { size: 32 }),\n s: numberToHex(s, { size: 32 }),\n v,\n yParity,\n };\n return {\n r: numberToHex(r, { size: 32 }),\n s: numberToHex(s, { size: 32 }),\n yParity,\n };\n}\n//# sourceMappingURL=parseSignature.js.map","import {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n parseSignature,\n GetContractReturnType,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport {\n AnyToken,\n TOKENS_ADDRESSES,\n TOKENS_SALT,\n TOKENS_PERMIT_VERSION,\n Token,\n} from '../tokens';\nimport { getTimestampInSeconds } from '../../utils/time';\nimport { ERC20Permit } from '../abis/mainnet/ERC20Permit';\n\n/**\n * Handler for performing operations for and with ERC20Permit tokens.\n */\nexport class ERC20PermitHandler {\n private viemChain: ViemChain;\n private token: AnyToken;\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.token = Token.WETH;\n }\n\n /**\n * Set the token to use for executing transactions on the contract.\n *\n * @param token Token to use for the handler.\n * @returns The handler.\n */\n public withToken(token: AnyToken) {\n this.token = token;\n return this;\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 = TOKENS_ADDRESSES[this.token][this.chain];\n const abi = ERC20Permit;\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 * Process and get permit signature for the given token to perform\n * transactions without calling `approve()`.\n *\n * @param ownerAddress Address of the token owner.\n * @param spenderAddress Address of the spender who needs the permit.\n * @param value Value of the transaction.\n * @returns Permit signature in the form `{ r, s, v?, yParity }`.\n */\n public async getPermitSignature(\n ownerAddress: Address,\n spenderAddress: Address,\n value: bigint,\n ) {\n const contract = this.getContract();\n\n const permitNonces = await contract.read.nonces([ownerAddress]);\n const name = await contract.read.name();\n const domain = <const>{\n name,\n version: this.getPermitVersion(this.token),\n chainId: this.chain,\n verifyingContract: TOKENS_ADDRESSES[this.token][this.chain],\n salt: this.getPermitSalt(this.token),\n };\n const types = <const>{\n Permit: [\n { name: 'owner', type: 'address' },\n { name: 'spender', type: 'address' },\n { name: 'value', type: 'uint256' },\n { name: 'nonce', type: 'uint256' },\n { name: 'deadline', type: 'uint256' },\n ],\n };\n // Valid for 2 hours.\n const deadline = BigInt(getTimestampInSeconds() + 60 * 60 * 2);\n\n const signature = await this.walletClient.signTypedData({\n account: ownerAddress,\n domain,\n types,\n primaryType: 'Permit',\n message: {\n owner: ownerAddress,\n spender: spenderAddress,\n value,\n nonce: permitNonces,\n deadline,\n },\n });\n\n return { ...parseSignature(signature), deadline };\n }\n\n /**\n * Approve transaction for the spender to spend the owner's tokens.\n *\n * @param ownerAddress Address of the caller of the transaction.\n * @param spenderAddress Address of the spender.\n * @param value Value to approve for the spender.\n * @returns Hash of the transaction.\n */\n public approve(\n ownerAddress: Address,\n spenderAddress: Address,\n value: bigint,\n ) {\n return this.getContract().write.approve([spenderAddress, value], {\n account: ownerAddress,\n chain: this.viemChain,\n });\n }\n\n private getPermitVersion(token: AnyToken): string {\n return TOKENS_PERMIT_VERSION[token];\n }\n\n private getPermitSalt(token: AnyToken) {\n return TOKENS_SALT?.[token]?.[this.chain];\n }\n}\n"],"names":["parseSignature","signatureHex","r","s","secp256k1","yParityOrV","v","yParity","numberToHex","ERC20PermitHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","Token","token","address","TOKENS_ADDRESSES","abi","ERC20Permit","client","getContract","ownerAddress","spenderAddress","value","contract","permitNonces","domain","types","deadline","getTimestampInSeconds","signature","TOKENS_PERMIT_VERSION","_b","_a","TOKENS_SALT"],"mappings":";;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S,GAAG,UAAAF,EAAS;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAW3C,QACLP,GACAC,GACAC,GACA;AACO,WAAA,KAAK,cAAc,MAAM,QAAQ,CAACD,GAAgBC,CAAK,GAAG;AAAA,MAC/D,SAASF;AAAA,MACT,OAAO,KAAK;AAAA,IAAA,CACb;AAAA,EAAA;AAAA,EAGK,iBAAiBP,GAAyB;AAChD,WAAOiB,EAAsBjB,CAAK;AAAA,EAAA;AAAA,EAG5B,cAAcA,GAAiB;;AACrC,YAAOkB,KAAAC,IAAAC,MAAA,gBAAAD,EAAcnB,OAAd,gBAAAkB,EAAuB,KAAK;AAAA,EAAK;AAE5C;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"erc20-permit-handler.js","sources":["../../../node_modules/.pnpm/viem@2.33.1_typescript@5.8.2_zod@3.24.2/node_modules/viem/_esm/utils/signature/parseSignature.js","../../../lib/contracts/handlers/erc20-permit-handler.ts"],"sourcesContent":["import { secp256k1 } from '@noble/curves/secp256k1';\nimport { numberToHex, } from '../../utils/encoding/toHex.js';\n/**\n * @description Parses a hex formatted signature into a structured signature.\n *\n * @param signatureHex Signature in hex format.\n * @returns The structured signature.\n *\n * @example\n * parseSignature('0x6e100a352ec6ad1b70802290e18aeed190704973570f3b8ed42cb9808e2ea6bf4a90a229a244495b41890987806fcbd2d5d23fc0dbe5f5256c2613c039d76db81c')\n * // { r: '0x...', s: '0x...', v: 28n }\n */\nexport function parseSignature(signatureHex) {\n const { r, s } = secp256k1.Signature.fromCompact(signatureHex.slice(2, 130));\n const yParityOrV = Number(`0x${signatureHex.slice(130)}`);\n const [v, yParity] = (() => {\n if (yParityOrV === 0 || yParityOrV === 1)\n return [undefined, yParityOrV];\n if (yParityOrV === 27)\n return [BigInt(yParityOrV), 0];\n if (yParityOrV === 28)\n return [BigInt(yParityOrV), 1];\n throw new Error('Invalid yParityOrV value');\n })();\n if (typeof v !== 'undefined')\n return {\n r: numberToHex(r, { size: 32 }),\n s: numberToHex(s, { size: 32 }),\n v,\n yParity,\n };\n return {\n r: numberToHex(r, { size: 32 }),\n s: numberToHex(s, { size: 32 }),\n yParity,\n };\n}\n//# sourceMappingURL=parseSignature.js.map","import {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n parseSignature,\n GetContractReturnType,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport {\n AnyToken,\n TOKENS_ADDRESSES,\n TOKENS_SALT,\n TOKENS_PERMIT_VERSION,\n Token,\n} from '../tokens';\nimport { getTimestampInSeconds } from '../../utils/time';\nimport { ERC20Permit } from '../abis/mainnet/ERC20Permit';\nimport { PermitData } from '../common/lib/types';\n\n/**\n * Handler for performing operations for and with ERC20Permit tokens.\n */\nexport class ERC20PermitHandler {\n private viemChain: ViemChain;\n private token: AnyToken;\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.token = Token.WETH;\n }\n\n /**\n * Set the token to use for executing transactions on the contract.\n *\n * @param token Token to use for the handler.\n * @returns The handler.\n */\n public withToken(token: AnyToken) {\n this.token = token;\n return this;\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 = TOKENS_ADDRESSES[this.token][this.chain];\n const abi = ERC20Permit;\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 * Process and get permit signature for the given token to perform\n * transactions without calling `approve()`.\n *\n * @param ownerAddress Address of the token owner.\n * @param spenderAddress Address of the spender who needs the permit.\n * @param value Value of the transaction.\n * @returns Permit signature in the form `{ r, s, v?, yParity }`.\n */\n public async getPermitSignature(\n ownerAddress: Address,\n spenderAddress: Address,\n value: bigint,\n ) {\n const contract = this.getContract();\n\n const permitNonces = await contract.read.nonces([ownerAddress]);\n const name = await contract.read.name();\n const domain = <const>{\n name,\n version: this.getPermitVersion(this.token),\n chainId: this.chain,\n verifyingContract: TOKENS_ADDRESSES[this.token][this.chain],\n salt: this.getPermitSalt(this.token),\n };\n const types = <const>{\n Permit: [\n { name: 'owner', type: 'address' },\n { name: 'spender', type: 'address' },\n { name: 'value', type: 'uint256' },\n { name: 'nonce', type: 'uint256' },\n { name: 'deadline', type: 'uint256' },\n ],\n };\n // Valid for 2 hours.\n const deadline = BigInt(getTimestampInSeconds() + 60 * 60 * 2);\n\n const signature = await this.walletClient.signTypedData({\n account: ownerAddress,\n domain,\n types,\n primaryType: 'Permit',\n message: {\n owner: ownerAddress,\n spender: spenderAddress,\n value,\n nonce: permitNonces,\n deadline,\n },\n });\n\n return { ...parseSignature(signature), deadline };\n }\n\n /**\n * Get the permit data for the given owner, spender and value.\n *\n * @param ownerAddress Address of the token owner.\n * @param spenderAddress Address of the spender who needs the permit.\n * @param value Value/amount to be permitted.\n * @returns Permit data in the form `{ r, s, v, deadline, amount }`.\n */\n public async getPermitData(\n ownerAddress: Address,\n spenderAddress: Address,\n value: bigint,\n ): Promise<PermitData> {\n const { r, s, v, yParity, deadline } = await this.getPermitSignature(\n ownerAddress,\n spenderAddress,\n value,\n );\n\n /* istanbul ignore next */\n return { r, s, v: Number(v ?? yParity), deadline, amount: value };\n }\n\n /**\n * Approve transaction for the spender to spend the owner's tokens.\n *\n * @param ownerAddress Address of the caller of the transaction.\n * @param spenderAddress Address of the spender.\n * @param value Value to approve for the spender.\n * @returns Hash of the transaction.\n */\n public approve(\n ownerAddress: Address,\n spenderAddress: Address,\n value: bigint,\n ) {\n return this.getContract().write.approve([spenderAddress, value], {\n account: ownerAddress,\n chain: this.viemChain,\n });\n }\n\n private getPermitVersion(token: AnyToken): string {\n return TOKENS_PERMIT_VERSION[token];\n }\n\n private getPermitSalt(token: AnyToken) {\n return TOKENS_SALT?.[token]?.[this.chain];\n }\n}\n"],"names":["parseSignature","signatureHex","r","s","secp256k1","yParityOrV","v","yParity","numberToHex","ERC20PermitHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","Token","token","address","TOKENS_ADDRESSES","abi","ERC20Permit","client","getContract","ownerAddress","spenderAddress","value","contract","permitNonces","domain","types","deadline","getTimestampInSeconds","signature","TOKENS_PERMIT_VERSION","_b","_a","TOKENS_SALT"],"mappings":";;;;;;;;;AAYO,SAASA,EAAeC,GAAc;AACzC,QAAM,EAAE,GAAAC,GAAG,GAAAC,EAAG,IAAGC,EAAU,UAAU,YAAYH,EAAa,MAAM,GAAG,GAAG,CAAC,GACrEI,IAAa,CAAO,KAAKJ,EAAa,MAAM,GAAG,CAAC,IAChD,CAACK,GAAGC,CAAO,KAAK,MAAM;AACxB,QAAIF,MAAe,KAAKA,MAAe;AACnC,aAAO,CAAC,QAAWA,CAAU;AACjC,QAAIA,MAAe;AACf,aAAO,CAAC,OAAOA,CAAU,GAAG,CAAC;AACjC,QAAIA,MAAe;AACf,aAAO,CAAC,OAAOA,CAAU,GAAG,CAAC;AACjC,UAAM,IAAI,MAAM,0BAA0B;AAAA,EAClD,GAAQ;AACJ,SAAI,OAAOC,IAAM,MACN;AAAA,IACH,GAAGE,EAAYN,GAAG,EAAE,MAAM,GAAE,CAAE;AAAA,IAC9B,GAAGM,EAAYL,GAAG,EAAE,MAAM,GAAE,CAAE;AAAA,IAC9B,GAAAG;AAAA,IACA,SAAAC;AAAA,EACH,IACE;AAAA,IACH,GAAGC,EAAYN,GAAG,EAAE,MAAM,GAAE,CAAE;AAAA,IAC9B,GAAGM,EAAYL,GAAG,EAAE,MAAM,GAAE,CAAE;AAAA,IAC9B,SAAAI;AAAA,EACH;AACL;ACbO,MAAME,EAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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.defineProperty;var s=(
|
|
1
|
+
"use strict";var r=Object.defineProperty;var s=(a,t,e)=>t in a?r(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e;var i=(a,t,e)=>s(a,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../constants-CxSgz27h.cjs"),o=require("../abis/mainnet/LagoonVault.cjs"),h=require("../tokens.cjs"),l=require("../vaults-addresses.cjs"),u=require("../../getContract-DUA3M2pm.cjs");class C{constructor(t,e,n){i(this,"viemChain");this.chain=t,this.walletClient=e,this.publicClient=n,this.viemChain=c.VIEM_CHAINS[t]}getContract(){const t=l.VAULTS_ADDRESSES[h.Token.tacpufETH][this.chain].LagoonVault,e=o.LagoonVault,n={public:this.publicClient,wallet:this.walletClient};return u.getContract({address:t,abi:e,client:n})}approve(t,e){return this.getContract().write.approve([t,e],{account:this.walletClient.account,chain:this.viemChain})}getAllowance(t,e){return this.getContract().read.allowance([t,e])}getBalance(t){return this.getContract().read.balanceOf([t])}getTotalSupply(){return this.getContract().read.totalSupply()}isTotalAssetsValid(){return this.getContract().read.isTotalAssetsValid()}symbol(){return this.getContract().read.symbol()}deposit(t,e,n){return n?this.getContract().write.deposit([t,e,n],{account:this.walletClient.account,chain:this.viemChain}):this.getContract().write.deposit([t,e],{account:this.walletClient.account,chain:this.viemChain})}syncDeposit(t,e,n=e){return this.getContract().write.syncDeposit([t,e,n],{account:this.walletClient.account,chain:this.viemChain})}requestDeposit(t,e,n=e){return this.getContract().write.requestDeposit([t,e,n],{account:this.walletClient.account,chain:this.viemChain,value:t})}pendingDepositRequest(t=0n,e){return this.getContract().read.pendingDepositRequest([t,e])}withdraw(t,e,n=e){return this.getContract().write.withdraw([t,e,n],{account:this.walletClient.account,chain:this.viemChain})}redeem(t,e,n=e){return this.getContract().write.redeem([t,e,n],{account:this.walletClient.account,chain:this.viemChain})}requestRedeem(t,e,n=e){return this.getContract().write.requestRedeem([t,e,n],{account:this.walletClient.account,chain:this.viemChain})}pendingRedeemRequest(t=0n,e){return this.getContract().read.pendingRedeemRequest([t,e])}previewDeposit(t){return this.getContract().read.previewDeposit([t])}previewWithdraw(t){return this.getContract().read.previewWithdraw([t])}previewRedeem(t){return this.getContract().read.previewRedeem([t])}convertToAssets(t,e){return e?this.getContract().read.convertToAssets([t,e]):this.getContract().read.convertToAssets([t])}convertToShares(t,e){return e?this.getContract().read.convertToShares([t,e]):this.getContract().read.convertToShares([t])}claimableDepositRequest(t=0n,e){return this.getContract().read.claimableDepositRequest([t,e])}claimableRedeemRequest(t=0n,e){return this.getContract().read.claimableRedeemRequest([t,e])}claimSharesAndRequestRedeem(t){return this.getContract().write.claimSharesAndRequestRedeem([t],{account:this.walletClient.account,chain:this.viemChain})}claimSharesOnBehalf(t){return this.getContract().write.claimSharesOnBehalf([t],{account:this.walletClient.account,chain:this.viemChain})}}exports.LagoonVaultHandler=C;
|
|
2
2
|
//# sourceMappingURL=lagoon-vault-handler.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lagoon-vault-handler.cjs","sources":["../../../lib/contracts/handlers/lagoon-vault-handler.ts"],"sourcesContent":["import {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n Account,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { LagoonVault } from '../abis/mainnet/LagoonVault';\nimport { Token } from '../tokens';\nimport { VAULTS_ADDRESSES } from '../vaults-addresses';\n\n/**\n * Handler for the `LagoonVault` contract exposing methods to interact\n * with the contract.\n */\nexport class LagoonVaultHandler {\n private viemChain: ViemChain;\n\n /**\n * Create the handler for processing Lagoon vault.\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.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = VAULTS_ADDRESSES[Token.tacpufETH][this.chain]\n .LagoonVault as Address;\n const abi = LagoonVault;\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 * Approve a spender to spend the token.\n *\n * @param spender The spender of the token.\n * @param amount The amount to approve.\n * @returns The transaction.\n */\n public approve(spender: Address, amount: bigint) {\n return this.getContract().write.approve([spender, amount], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Get the allowance of the owner for the spender.\n *\n * @param owner The owner of the allowance.\n * @param spender The spender of the allowance.\n * @returns The allowance.\n */\n public getAllowance(owner: Address, spender: Address) {\n return this.getContract().read.allowance([owner, spender]);\n }\n\n /**\n * Get the balance for the address.\n *\n * @param address The address to get the balance of.\n * @returns The balance.\n */\n public getBalance(address: Address) {\n return this.getContract().read.balanceOf([address]);\n }\n\n /**\n * Get the total supply of the token.\n *\n * @returns The total supply.\n */\n public getTotalSupply() {\n return this.getContract().read.totalSupply();\n }\n\n /**\n * Check if the total assets are valid. Used for checking if\n * synchronous deposit is possible.\n *\n * @returns True if the total assets are valid, false otherwise.\n */\n public isTotalAssetsValid() {\n return this.getContract().read.isTotalAssetsValid();\n }\n\n /**\n * Get the symbol of the token. (tacpufETH)\n *\n * @returns The symbol.\n */\n public symbol() {\n return this.getContract().read.symbol();\n }\n\n /**\n * Deposit an amount of the assets (pufETH) to the vault to get shares\n * (tacpufETH).\n *\n * @param amount The amount to deposit.\n * @param receiver The receiver of the tacpufETH.\n * @param controller The optional controller of the deposit. Set to\n * the receiver if not sure.\n * @returns The transaction.\n */\n public deposit(amount: bigint, receiver: Address, controller?: Address) {\n if (controller) {\n return this.getContract().write.deposit([amount, receiver, controller], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n return this.getContract().write.deposit([amount, receiver], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Synchronously deposit an amount of the assets (pufETH) to the vault\n * to get shares (tacpufETH). This is only possible if `isTotalAssetsValid`\n * is true.\n *\n * @param amount The amount to deposit.\n * @param receiver The receiver of the tacpufETH.\n * @param referral The referral of the deposit. Falls back to the\n * receiver if not provided.\n * @returns The transaction.\n */\n public syncDeposit(\n amount: bigint,\n receiver: Address,\n referral: Address = receiver,\n ) {\n return this.getContract().write.syncDeposit([amount, receiver, referral], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Request an asynchronous deposit of an amount of the assets (pufETH)\n * to the vault to get shares (tacpufETH). This should be used if\n * `isTotalAssetsValid` is false.\n *\n * @param amount The amount to deposit.\n * @param receiver The receiver of the tacpufETH.\n * @param controller The optional controller of the deposit. Falls back\n * to the receiver if not provided.\n * @returns The transaction.\n */\n public requestDeposit(\n amount: bigint,\n receiver: Address,\n controller: Address = receiver,\n ) {\n return this.getContract().write.requestDeposit(\n [amount, receiver, controller],\n {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n value: amount,\n },\n );\n }\n\n /**\n * Withdraw an amount of the shares (pufETH) so the receiver\n * gets the assets (pufETH).\n *\n * @param assets The amount of assets (pufETH) to withdraw.\n * @param receiver The receiver of the assets.\n * @param controller The controller of the withdrawal. Falls back to\n * the receiver if not provided.\n * @returns The transaction.\n */\n public withdraw(\n assets: bigint,\n receiver: Address,\n controller: Address = receiver,\n ) {\n return this.getContract().write.withdraw([assets, receiver, controller], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Redeem an amount of the shares (tacpufETH) so the receiver\n * gets the assets (pufETH).\n *\n * @param shares The amount of shares (tacpufETH) to redeem.\n * @param receiver The receiver of the assets.\n * @param controller The controller of the withdrawal. Falls back to\n * the receiver if not provided.\n * @returns The transaction.\n */\n public redeem(\n shares: bigint,\n receiver: Address,\n controller: Address = receiver,\n ) {\n return this.getContract().write.redeem([shares, receiver, controller], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Request an asynchronous redeem of an amount of the shares (tacpufETH)\n * so the receiver gets the assets (pufETH).\n *\n * @param shares The amount of shares (tacpufETH) to redeem.\n * @param receiver The receiver of the assets.\n * @param controller The controller of the redemption. Falls back to\n * the receiver if not provided.\n * @returns The transaction.\n */\n public requestRedeem(\n shares: bigint,\n receiver: Address,\n controller: Address = receiver,\n ) {\n return this.getContract().write.requestRedeem(\n [shares, receiver, controller],\n {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n },\n );\n }\n\n /**\n * Provides a preview of the number of shares that would be minted for\n * a given deposit amount, after fees.\n *\n * @param amount The amount to deposit.\n * @returns The preview.\n */\n public previewDeposit(amount: bigint) {\n return this.getContract().read.previewDeposit([amount]);\n }\n\n /**\n * Provides a preview of the number of shares (tacpufETH) that would be\n * burned for the given amount of assets (pufETH).\n *\n * @param assets The amount of assets (pufETH) to withdraw.\n * @returns The preview.\n */\n public previewWithdraw(assets: bigint) {\n return this.getContract().read.previewWithdraw([assets]);\n }\n\n /**\n * Provides a preview of the amount of assets (pufETH) that would be redeemed\n * for the given shares (tacpufETH), after withdrawal fees. Subtracts\n * the withdrawal fee from the share amount to determine the net\n * shares for asset conversion.\n *\n * @param shares The amount of shares (tacpufETH) to redeem.\n * @returns The preview.\n */\n public previewRedeem(shares: bigint) {\n return this.getContract().read.previewRedeem([shares]);\n }\n\n /**\n * Convert an amount of the shares (tacpufETH) to the assets (pufETH).\n *\n * @param shares The amount of shares (tacpufETH) to convert.\n * @param requestId An optional request id for the conversion.\n * @returns The amount of assets (pufETH).\n */\n public convertToAssets(shares: bigint, requestId?: bigint) {\n if (requestId) {\n return this.getContract().read.convertToAssets([shares, requestId]);\n }\n\n return this.getContract().read.convertToAssets([shares]);\n }\n\n /**\n * Convert an amount of the assets (pufETH) to the shares (tacpufETH).\n *\n * @param assets The amount of assets (pufETH) to convert.\n * @param requestId An optional request id for the conversion.\n * @returns The amount of shares (tacpufETH).\n */\n public convertToShares(assets: bigint, requestId?: bigint) {\n if (requestId) {\n return this.getContract().read.convertToShares([assets, requestId]);\n }\n\n return this.getContract().read.convertToShares([assets]);\n }\n}\n"],"names":["LagoonVaultHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","address","VAULTS_ADDRESSES","Token","abi","LagoonVault","client","getContract","spender","amount","owner","receiver","controller","referral","assets","shares","requestId"],"mappings":"6bAiBO,MAAMA,CAAmB,CAY9B,YACUC,EACAC,EACAC,EACR,CAfMC,EAAA,kBAYE,KAAA,MAAAH,EACA,KAAA,aAAAC,EACA,KAAA,aAAAC,EAEH,KAAA,UAAYE,cAAYJ,CAAK,CAAA,CAQ7B,aAAc,CACnB,MAAMK,EAAUC,EAAAA,iBAAiBC,EAAA,MAAM,SAAS,EAAE,KAAK,KAAK,EACzD,YACGC,EAAMC,EAAA,YACNC,EAAS,CAAE,OAAQ,KAAK,aAAc,OAAQ,KAAK,YAAa,EAEtE,OAAOC,EAAY,YAAA,CAAE,QAAAN,EAAS,IAAAG,EAAK,OAAAE,EAAQ,CAAA,CActC,QAAQE,EAAkBC,EAAgB,CACxC,OAAA,KAAK,cAAc,MAAM,QAAQ,CAACD,EAASC,CAAM,EAAG,CACzD,QAAS,KAAK,aAAa,QAC3B,MAAO,KAAK,SAAA,CACb,CAAA,CAUI,aAAaC,EAAgBF,EAAkB,CAC7C,OAAA,KAAK,cAAc,KAAK,UAAU,CAACE,EAAOF,CAAO,CAAC,CAAA,CASpD,WAAWP,EAAkB,CAClC,OAAO,KAAK,YAAY,EAAE,KAAK,UAAU,CAACA,CAAO,CAAC,CAAA,CAQ7C,gBAAiB,CACtB,OAAO,KAAK,cAAc,KAAK,YAAY,CAAA,CAStC,oBAAqB,CAC1B,OAAO,KAAK,cAAc,KAAK,mBAAmB,CAAA,CAQ7C,QAAS,CACd,OAAO,KAAK,cAAc,KAAK,OAAO,CAAA,CAajC,QAAQQ,EAAgBE,EAA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C,OAAO,KAAK,YAAY,EAAE,KAAK,gBAAgB,CAACA,CAAM,CAAC,CAAA,CAYlD,cAAcC,EAAgB,CACnC,OAAO,KAAK,YAAY,EAAE,KAAK,cAAc,CAACA,CAAM,CAAC,CAAA,CAUhD,gBAAgBA,EAAgBC,EAAoB,CACzD,OAAIA,EACK,KAAK,cAAc,KAAK,gBAAgB,CAACD,EAAQC,CAAS,CAAC,EAG7D,KAAK,YAAY,EAAE,KAAK,gBAAgB,CAACD,CAAM,CAAC,CAAA,CAUlD,gBAAgBD,EAAgBE,EAAoB,CACzD,OAAIA,EACK,KAAK,cAAc,KAAK,gBAAgB,CAACF,EAAQE,CAAS,CAAC,EAG7D,KAAK,YAAY,EAAE,KAAK,gBAAgB,CAACF,CAAM,CAAC,CAAA,CAE3D"}
|
|
1
|
+
{"version":3,"file":"lagoon-vault-handler.cjs","sources":["../../../lib/contracts/handlers/lagoon-vault-handler.ts"],"sourcesContent":["import {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n Account,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { LagoonVault } from '../abis/mainnet/LagoonVault';\nimport { Token } from '../tokens';\nimport { VAULTS_ADDRESSES } from '../vaults-addresses';\n\n/**\n * Handler for the `LagoonVault` contract exposing methods to interact\n * with the contract.\n */\nexport class LagoonVaultHandler {\n private viemChain: ViemChain;\n\n /**\n * Create the handler for processing Lagoon vault.\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.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = VAULTS_ADDRESSES[Token.tacpufETH][this.chain]\n .LagoonVault as Address;\n const abi = LagoonVault;\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 * Approve a spender to spend the token.\n *\n * @param spender The spender of the token.\n * @param amount The amount to approve.\n * @returns The transaction.\n */\n public approve(spender: Address, amount: bigint) {\n return this.getContract().write.approve([spender, amount], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Get the allowance of the owner for the spender.\n *\n * @param owner The owner of the allowance.\n * @param spender The spender of the allowance.\n * @returns The allowance.\n */\n public getAllowance(owner: Address, spender: Address) {\n return this.getContract().read.allowance([owner, spender]);\n }\n\n /**\n * Get the balance for the address.\n *\n * @param address The address to get the balance of.\n * @returns The balance.\n */\n public getBalance(address: Address) {\n return this.getContract().read.balanceOf([address]);\n }\n\n /**\n * Get the total supply of the token.\n *\n * @returns The total supply.\n */\n public getTotalSupply() {\n return this.getContract().read.totalSupply();\n }\n\n /**\n * Check if the total assets are valid. Used for checking if\n * synchronous deposit is possible.\n *\n * @returns True if the total assets are valid, false otherwise.\n */\n public isTotalAssetsValid() {\n return this.getContract().read.isTotalAssetsValid();\n }\n\n /**\n * Get the symbol of the token. (tacpufETH)\n *\n * @returns The symbol.\n */\n public symbol() {\n return this.getContract().read.symbol();\n }\n\n /**\n * Deposit an amount of the assets (pufETH) to the vault to get shares\n * (tacpufETH).\n *\n * @param amount The amount to deposit.\n * @param receiver The receiver of the tacpufETH.\n * @param controller The optional controller of the deposit. Set to\n * the receiver if not sure.\n * @returns The transaction.\n */\n public deposit(amount: bigint, receiver: Address, controller?: Address) {\n if (controller) {\n return this.getContract().write.deposit([amount, receiver, controller], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n return this.getContract().write.deposit([amount, receiver], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Synchronously deposit an amount of the assets (pufETH) to the vault\n * to get shares (tacpufETH). This is only possible if `isTotalAssetsValid`\n * is true.\n *\n * @param amount The amount to deposit.\n * @param receiver The receiver of the tacpufETH.\n * @param referral The referral of the deposit. Falls back to the\n * receiver if not provided.\n * @returns The transaction.\n */\n public syncDeposit(\n amount: bigint,\n receiver: Address,\n referral: Address = receiver,\n ) {\n return this.getContract().write.syncDeposit([amount, receiver, referral], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Request an asynchronous deposit of an amount of the assets (pufETH)\n * to the vault to get shares (tacpufETH). This should be used if\n * `isTotalAssetsValid` is false.\n *\n * @param amount The amount to deposit.\n * @param receiver The receiver of the tacpufETH.\n * @param controller The optional controller of the deposit. Falls back\n * to the receiver if not provided.\n * @returns The transaction.\n */\n public requestDeposit(\n amount: bigint,\n receiver: Address,\n controller: Address = receiver,\n ) {\n return this.getContract().write.requestDeposit(\n [amount, receiver, controller],\n {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n value: amount,\n },\n );\n }\n\n /**\n * Get the pending deposit request for the request id and controller.\n *\n * @param requestId The request id. Use `0` as wild card.\n * @param controller The controller. Usually the depositor or user who\n * initiated the deposit.\n * @returns The pending deposit request.\n */\n public pendingDepositRequest(requestId: bigint = 0n, controller: Address) {\n return this.getContract().read.pendingDepositRequest([\n requestId,\n controller,\n ]);\n }\n\n /**\n * Withdraw an amount of the shares (pufETH) so the receiver\n * gets the assets (pufETH).\n *\n * @param assets The amount of assets (pufETH) to withdraw.\n * @param receiver The receiver of the assets.\n * @param controller The controller of the withdrawal. Falls back to\n * the receiver if not provided.\n * @returns The transaction.\n */\n public withdraw(\n assets: bigint,\n receiver: Address,\n controller: Address = receiver,\n ) {\n return this.getContract().write.withdraw([assets, receiver, controller], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Redeem an amount of the shares (tacpufETH) so the receiver\n * gets the assets (pufETH).\n *\n * @param shares The amount of shares (tacpufETH) to redeem.\n * @param receiver The receiver of the assets.\n * @param controller The controller of the withdrawal. Falls back to\n * the receiver if not provided.\n * @returns The transaction.\n */\n public redeem(\n shares: bigint,\n receiver: Address,\n controller: Address = receiver,\n ) {\n return this.getContract().write.redeem([shares, receiver, controller], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Request an asynchronous redeem of an amount of the shares (tacpufETH)\n * so the receiver gets the assets (pufETH).\n *\n * @param shares The amount of shares (tacpufETH) to redeem.\n * @param receiver The receiver of the assets.\n * @param controller The controller of the redemption. Falls back to\n * the receiver if not provided.\n * @returns The transaction.\n */\n public requestRedeem(\n shares: bigint,\n receiver: Address,\n controller: Address = receiver,\n ) {\n return this.getContract().write.requestRedeem(\n [shares, receiver, controller],\n {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n },\n );\n }\n\n /**\n * Get the pending redeem request for the request id and controller.\n *\n * @param requestId The request id. Use `0` as wild card.\n * @param controller The controller. Usually the redeemer or user who\n * initiated the redeem.\n * @returns The pending redeem request.\n */\n public pendingRedeemRequest(requestId: bigint = 0n, controller: Address) {\n return this.getContract().read.pendingRedeemRequest([\n requestId,\n controller,\n ]);\n }\n\n /**\n * Provides a preview of the number of shares that would be minted for\n * a given deposit amount, after fees.\n *\n * @param amount The amount to deposit.\n * @returns The preview.\n */\n public previewDeposit(amount: bigint) {\n return this.getContract().read.previewDeposit([amount]);\n }\n\n /**\n * Provides a preview of the number of shares (tacpufETH) that would be\n * burned for the given amount of assets (pufETH).\n *\n * @param assets The amount of assets (pufETH) to withdraw.\n * @returns The preview.\n */\n public previewWithdraw(assets: bigint) {\n return this.getContract().read.previewWithdraw([assets]);\n }\n\n /**\n * Provides a preview of the amount of assets (pufETH) that would be redeemed\n * for the given shares (tacpufETH), after withdrawal fees. Subtracts\n * the withdrawal fee from the share amount to determine the net\n * shares for asset conversion.\n *\n * @param shares The amount of shares (tacpufETH) to redeem.\n * @returns The preview.\n */\n public previewRedeem(shares: bigint) {\n return this.getContract().read.previewRedeem([shares]);\n }\n\n /**\n * Convert an amount of the shares (tacpufETH) to the assets (pufETH).\n *\n * @param shares The amount of shares (tacpufETH) to convert.\n * @param requestId An optional request id for the conversion.\n * @returns The amount of assets (pufETH).\n */\n public convertToAssets(shares: bigint, requestId?: bigint) {\n if (requestId) {\n return this.getContract().read.convertToAssets([shares, requestId]);\n }\n\n return this.getContract().read.convertToAssets([shares]);\n }\n\n /**\n * Convert an amount of the assets (pufETH) to the shares (tacpufETH).\n *\n * @param assets The amount of assets (pufETH) to convert.\n * @param requestId An optional request id for the conversion.\n * @returns The amount of shares (tacpufETH).\n */\n public convertToShares(assets: bigint, requestId?: bigint) {\n if (requestId) {\n return this.getContract().read.convertToShares([assets, requestId]);\n }\n\n return this.getContract().read.convertToShares([assets]);\n }\n\n /**\n * Get the claimable deposit request for the request id and controller.\n *\n * @param requestId The request id. Use `0` as wild card.\n * @param controller The controller. Usually the depositor or user who\n * initiated the deposit.\n * @returns The claimable deposit request.\n */\n public claimableDepositRequest(requestId: bigint = 0n, controller: Address) {\n return this.getContract().read.claimableDepositRequest([\n requestId,\n controller,\n ]);\n }\n\n /**\n * Get the claimable redeem request for the request id and controller.\n *\n * @param requestId The request id. Use `0` as wild card.\n * @param controller The controller. Usually the redeemer or user who\n * initiated the redeem.\n * @returns The claimable redeem request.\n */\n public claimableRedeemRequest(requestId: bigint = 0n, controller: Address) {\n return this.getContract().read.claimableRedeemRequest([\n requestId,\n controller,\n ]);\n }\n\n /**\n * Claim shares and request a redeem of an amount of the shares (tacpufETH)\n * so the receiver gets the assets (pufETH).\n *\n * @param shares The amount of shares (tacpufETH) to claim.\n * @returns The transaction.\n */\n public claimSharesAndRequestRedeem(shares: bigint) {\n return this.getContract().write.claimSharesAndRequestRedeem([shares], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Claim shares on behalf of multiple controllers.\n *\n * @param controllers The controllers to claim shares on behalf of.\n * @returns The transaction.\n */\n public claimSharesOnBehalf(controllers: Address[]) {\n return this.getContract().write.claimSharesOnBehalf([controllers], {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n });\n }\n}\n"],"names":["LagoonVaultHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","address","VAULTS_ADDRESSES","Token","abi","LagoonVault","client","getContract","spender","amount","owner","receiver","controller","referral","requestId","assets","shares","controllers"],"mappings":"6bAiBO,MAAMA,CAAmB,CAY9B,YACUC,EACAC,EACAC,EACR,CAfMC,EAAA,kBAYE,KAAA,MAAAH,EACA,KAAA,aAAAC,EACA,KAAA,aAAAC,EAEH,KAAA,UAAYE,cAAYJ,CAAK,CAAA,CAQ7B,aAAc,CACnB,MAAMK,EAAUC,EAAAA,iBAAiBC,EAAA,MAAM,SAAS,EAAE,KAAK,KAAK,EACzD,YACGC,EAAMC,EAAA,YACNC,EAAS,CAAE,OAAQ,KAAK,aAAc,OAAQ,KAAK,YAAa,EAEtE,OAAOC,EAAY,YAAA,CAAE,QAAAN,EAAS,IAAAG,EAAK,OAAAE,EAAQ,CAAA,CActC,QAAQE,EAAkBC,EAAgB,CACxC,OAAA,KAAK,cAAc,MAAM,QAAQ,CAACD,EAASC,CAAM,EAAG,CACzD,QAAS,KAAK,aAAa,QAC3B,MAAO,KAAK,SAAA,CACb,CAAA,CAUI,aAAaC,EAAgBF,EAAkB,CAC7C,OAAA,KAAK,cAAc,KAAK,UAAU,CAACE,EAAOF,CAAO,CAAC,CAAA,CASpD,WAAWP,EAAkB,CAClC,OAAO,KAAK,YAAY,EAAE,KAAK,UAAU,CAACA,CAAO,CAAC,CAAA,CAQ7C,gBAAiB,CACtB,OAAO,KAAK,cAAc,KAAK,YAAY,CAAA,CAStC,oBAAqB,CAC1B,OAAO,KAAK,cAAc,KAAK,mBAAmB,CAAA,CAQ7C,QAAS,CACd,OAAO,KAAK,cAAc,KAAK,OAAO,CAAA,CAajC,QAAQQ,EAAgBE,EAAmBC,EAAsB,CACtE,OAAIA,EACK,KAAK,cAAc,MAAM,QAAQ,CAACH,EAAQE,EAAUC,CAAU,EAAG,CACtE,QAAS,KAAK,aAAa,QAC3B,MAA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AAO,KAAK,YAAY,EAAE,KAAK,eAAe,CAACA,CAAM,CAAC,CAAA,CAUjD,gBAAgBM,EAAgB,CACrC,OAAO,KAAK,YAAY,EAAE,KAAK,gBAAgB,CAACA,CAAM,CAAC,CAAA,CAYlD,cAAcC,EAAgB,CACnC,OAAO,KAAK,YAAY,EAAE,KAAK,cAAc,CAACA,CAAM,CAAC,CAAA,CAUhD,gBAAgBA,EAAgBF,EAAoB,CACzD,OAAIA,EACK,KAAK,cAAc,KAAK,gBAAgB,CAACE,EAAQF,CAAS,CAAC,EAG7D,KAAK,YAAY,EAAE,KAAK,gBAAgB,CAACE,CAAM,CAAC,CAAA,CAUlD,gBAAgBD,EAAgBD,EAAoB,CACzD,OAAIA,EACK,KAAK,cAAc,KAAK,gBAAgB,CAACC,EAAQD,CAAS,CAAC,EAG7D,KAAK,YAAY,EAAE,KAAK,gBAAgB,CAACC,CAAM,CAAC,CAAA,CAWlD,wBAAwBD,EAAoB,GAAIF,EAAqB,CAC1E,OAAO,KAAK,cAAc,KAAK,wBAAwB,CACrDE,EACAF,CAAA,CACD,CAAA,CAWI,uBAAuBE,EAAoB,GAAIF,EAAqB,CACzE,OAAO,KAAK,cAAc,KAAK,uBAAuB,CACpDE,EACAF,CAAA,CACD,CAAA,CAUI,4BAA4BI,EAAgB,CACjD,OAAO,KAAK,YAAY,EAAE,MAAM,4BAA4B,CAACA,CAAM,EAAG,CACpE,QAAS,KAAK,aAAa,QAC3B,MAAO,KAAK,SAAA,CACb,CAAA,CASI,oBAAoBC,EAAwB,CACjD,OAAO,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAACA,CAAW,EAAG,CACjE,QAAS,KAAK,aAAa,QAC3B,MAAO,KAAK,SAAA,CACb,CAAA,CAEL"}
|
|
@@ -15384,6 +15384,15 @@ export declare class LagoonVaultHandler {
|
|
|
15384
15384
|
* @returns The transaction.
|
|
15385
15385
|
*/
|
|
15386
15386
|
requestDeposit(amount: bigint, receiver: Address, controller?: Address): Promise<`0x${string}`>;
|
|
15387
|
+
/**
|
|
15388
|
+
* Get the pending deposit request for the request id and controller.
|
|
15389
|
+
*
|
|
15390
|
+
* @param requestId The request id. Use `0` as wild card.
|
|
15391
|
+
* @param controller The controller. Usually the depositor or user who
|
|
15392
|
+
* initiated the deposit.
|
|
15393
|
+
* @returns The pending deposit request.
|
|
15394
|
+
*/
|
|
15395
|
+
pendingDepositRequest(requestId: bigint | undefined, controller: Address): Promise<bigint>;
|
|
15387
15396
|
/**
|
|
15388
15397
|
* Withdraw an amount of the shares (pufETH) so the receiver
|
|
15389
15398
|
* gets the assets (pufETH).
|
|
@@ -15417,6 +15426,15 @@ export declare class LagoonVaultHandler {
|
|
|
15417
15426
|
* @returns The transaction.
|
|
15418
15427
|
*/
|
|
15419
15428
|
requestRedeem(shares: bigint, receiver: Address, controller?: Address): Promise<`0x${string}`>;
|
|
15429
|
+
/**
|
|
15430
|
+
* Get the pending redeem request for the request id and controller.
|
|
15431
|
+
*
|
|
15432
|
+
* @param requestId The request id. Use `0` as wild card.
|
|
15433
|
+
* @param controller The controller. Usually the redeemer or user who
|
|
15434
|
+
* initiated the redeem.
|
|
15435
|
+
* @returns The pending redeem request.
|
|
15436
|
+
*/
|
|
15437
|
+
pendingRedeemRequest(requestId: bigint | undefined, controller: Address): Promise<bigint>;
|
|
15420
15438
|
/**
|
|
15421
15439
|
* Provides a preview of the number of shares that would be minted for
|
|
15422
15440
|
* a given deposit amount, after fees.
|
|
@@ -15459,4 +15477,37 @@ export declare class LagoonVaultHandler {
|
|
|
15459
15477
|
* @returns The amount of shares (tacpufETH).
|
|
15460
15478
|
*/
|
|
15461
15479
|
convertToShares(assets: bigint, requestId?: bigint): Promise<never>;
|
|
15480
|
+
/**
|
|
15481
|
+
* Get the claimable deposit request for the request id and controller.
|
|
15482
|
+
*
|
|
15483
|
+
* @param requestId The request id. Use `0` as wild card.
|
|
15484
|
+
* @param controller The controller. Usually the depositor or user who
|
|
15485
|
+
* initiated the deposit.
|
|
15486
|
+
* @returns The claimable deposit request.
|
|
15487
|
+
*/
|
|
15488
|
+
claimableDepositRequest(requestId: bigint | undefined, controller: Address): Promise<bigint>;
|
|
15489
|
+
/**
|
|
15490
|
+
* Get the claimable redeem request for the request id and controller.
|
|
15491
|
+
*
|
|
15492
|
+
* @param requestId The request id. Use `0` as wild card.
|
|
15493
|
+
* @param controller The controller. Usually the redeemer or user who
|
|
15494
|
+
* initiated the redeem.
|
|
15495
|
+
* @returns The claimable redeem request.
|
|
15496
|
+
*/
|
|
15497
|
+
claimableRedeemRequest(requestId: bigint | undefined, controller: Address): Promise<bigint>;
|
|
15498
|
+
/**
|
|
15499
|
+
* Claim shares and request a redeem of an amount of the shares (tacpufETH)
|
|
15500
|
+
* so the receiver gets the assets (pufETH).
|
|
15501
|
+
*
|
|
15502
|
+
* @param shares The amount of shares (tacpufETH) to claim.
|
|
15503
|
+
* @returns The transaction.
|
|
15504
|
+
*/
|
|
15505
|
+
claimSharesAndRequestRedeem(shares: bigint): Promise<`0x${string}`>;
|
|
15506
|
+
/**
|
|
15507
|
+
* Claim shares on behalf of multiple controllers.
|
|
15508
|
+
*
|
|
15509
|
+
* @param controllers The controllers to claim shares on behalf of.
|
|
15510
|
+
* @returns The transaction.
|
|
15511
|
+
*/
|
|
15512
|
+
claimSharesOnBehalf(controllers: Address[]): Promise<`0x${string}`>;
|
|
15462
15513
|
}
|