@vetro-protocol/gateway 1.3.0 → 1.3.1
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/_esm/actions/index.js +49 -21
- package/_esm/actions/index.js.map +7 -1
- package/_esm/chunk-ZE4YZMXK.js +1326 -0
- package/_esm/chunk-ZE4YZMXK.js.map +7 -0
- package/_esm/index.js +57 -31
- package/_esm/index.js.map +7 -1
- package/_types/actions/index.d.ts +18 -18
- package/_types/actions/public/getGateway.d.ts.map +1 -1
- package/_types/actions/public/getMaxMint.d.ts.map +1 -1
- package/_types/actions/public/getMaxWithdraw.d.ts.map +1 -1
- package/_types/actions/public/getMintFee.d.ts.map +1 -1
- package/_types/actions/public/getPeggedToken.d.ts.map +1 -1
- package/_types/actions/public/getRedeemFee.d.ts.map +1 -1
- package/_types/actions/public/getRedeemRequest.d.ts.map +1 -1
- package/_types/actions/public/getTreasury.d.ts.map +1 -1
- package/_types/actions/public/getWithdrawalDelay.d.ts.map +1 -1
- package/_types/actions/public/getWithdrawalDelayEnabled.d.ts.map +1 -1
- package/_types/actions/public/index.d.ts +14 -14
- package/_types/actions/public/isInstantRedeemWhitelisted.d.ts.map +1 -1
- package/_types/actions/public/previewDeposit.d.ts.map +1 -1
- package/_types/actions/public/previewRedeem.d.ts.map +1 -1
- package/_types/actions/public/previewWithdraw.d.ts.map +1 -1
- package/_types/actions/wallet/cancelRedeemRequest.d.ts +1 -1
- package/_types/actions/wallet/deposit.d.ts +1 -1
- package/_types/actions/wallet/redeem.d.ts +1 -1
- package/_types/actions/wallet/requestRedeem.d.ts +1 -1
- package/_types/gatewayAddresses.d.ts.map +1 -1
- package/_types/index.d.ts +12 -12
- package/package.json +7 -5
- package/src/actions/index.ts +18 -18
- package/src/actions/public/getGateway.ts +2 -2
- package/src/actions/public/getMaxMint.ts +2 -2
- package/src/actions/public/getMaxWithdraw.ts +2 -2
- package/src/actions/public/getMintFee.ts +2 -2
- package/src/actions/public/getPeggedToken.ts +2 -2
- package/src/actions/public/getRedeemFee.ts +2 -2
- package/src/actions/public/getRedeemRequest.ts +2 -2
- package/src/actions/public/getTreasury.ts +2 -2
- package/src/actions/public/getWithdrawalDelay.ts +2 -2
- package/src/actions/public/getWithdrawalDelayEnabled.ts +2 -2
- package/src/actions/public/index.ts +14 -14
- package/src/actions/public/isInstantRedeemWhitelisted.ts +2 -2
- package/src/actions/public/previewDeposit.ts +2 -2
- package/src/actions/public/previewRedeem.ts +2 -2
- package/src/actions/public/previewWithdraw.ts +2 -2
- package/src/actions/wallet/cancelRedeemRequest.ts +2 -2
- package/src/actions/wallet/deposit.ts +2 -2
- package/src/actions/wallet/redeem.ts +6 -6
- package/src/actions/wallet/requestRedeem.ts +3 -3
- package/src/gatewayAddresses.ts +6 -17
- package/src/index.ts +8 -8
- package/_esm/abi/gatewayAbi.js +0 -223
- package/_esm/abi/gatewayAbi.js.map +0 -1
- package/_esm/abi/peggedTokenAbi.js +0 -10
- package/_esm/abi/peggedTokenAbi.js.map +0 -1
- package/_esm/actions/public/getGateway.js +0 -30
- package/_esm/actions/public/getGateway.js.map +0 -1
- package/_esm/actions/public/getMaxMint.js +0 -23
- package/_esm/actions/public/getMaxMint.js.map +0 -1
- package/_esm/actions/public/getMaxWithdraw.js +0 -28
- package/_esm/actions/public/getMaxWithdraw.js.map +0 -1
- package/_esm/actions/public/getMintFee.js +0 -28
- package/_esm/actions/public/getMintFee.js.map +0 -1
- package/_esm/actions/public/getPeggedToken.js +0 -23
- package/_esm/actions/public/getPeggedToken.js.map +0 -1
- package/_esm/actions/public/getRedeemFee.js +0 -28
- package/_esm/actions/public/getRedeemFee.js.map +0 -1
- package/_esm/actions/public/getRedeemRequest.js +0 -28
- package/_esm/actions/public/getRedeemRequest.js.map +0 -1
- package/_esm/actions/public/getTreasury.js +0 -23
- package/_esm/actions/public/getTreasury.js.map +0 -1
- package/_esm/actions/public/getWithdrawalDelay.js +0 -23
- package/_esm/actions/public/getWithdrawalDelay.js.map +0 -1
- package/_esm/actions/public/getWithdrawalDelayEnabled.js +0 -23
- package/_esm/actions/public/getWithdrawalDelayEnabled.js.map +0 -1
- package/_esm/actions/public/index.js +0 -15
- package/_esm/actions/public/index.js.map +0 -1
- package/_esm/actions/public/isInstantRedeemWhitelisted.js +0 -28
- package/_esm/actions/public/isInstantRedeemWhitelisted.js.map +0 -1
- package/_esm/actions/public/previewDeposit.js +0 -35
- package/_esm/actions/public/previewDeposit.js.map +0 -1
- package/_esm/actions/public/previewRedeem.js +0 -35
- package/_esm/actions/public/previewRedeem.js.map +0 -1
- package/_esm/actions/public/previewWithdraw.js +0 -35
- package/_esm/actions/public/previewWithdraw.js.map +0 -1
- package/_esm/actions/wallet/cancelRedeemRequest.js +0 -89
- package/_esm/actions/wallet/cancelRedeemRequest.js.map +0 -1
- package/_esm/actions/wallet/deposit.js +0 -193
- package/_esm/actions/wallet/deposit.js.map +0 -1
- package/_esm/actions/wallet/redeem.js +0 -226
- package/_esm/actions/wallet/redeem.js.map +0 -1
- package/_esm/actions/wallet/requestRedeem.js +0 -153
- package/_esm/actions/wallet/requestRedeem.js.map +0 -1
- package/_esm/gatewayAddresses.js +0 -18
- package/_esm/gatewayAddresses.js.map +0 -1
- package/_esm/types.js +0 -2
- package/_esm/types.js.map +0 -1
- package/_esm/utils/isAddressValid.js +0 -3
- package/_esm/utils/isAddressValid.js.map +0 -1
- package/_types/utils/isAddressValid.d.ts +0 -3
- package/_types/utils/isAddressValid.d.ts.map +0 -1
- package/src/utils/isAddressValid.ts +0 -4
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../core/src/stakingVaultAddresses.ts", "../../core/src/protocolGraph.ts", "../../core/src/utils/isAddressValid.ts", "../src/actions/public/getGateway.ts", "../src/abi/peggedTokenAbi.ts", "../src/abi/gatewayAbi.ts", "../src/actions/public/getMaxMint.ts", "../src/actions/public/getMaxWithdraw.ts", "../src/actions/public/getMintFee.ts", "../src/actions/public/getPeggedToken.ts", "../src/actions/public/getRedeemFee.ts", "../src/actions/public/getRedeemRequest.ts", "../src/actions/public/getTreasury.ts", "../src/actions/public/getWithdrawalDelay.ts", "../src/actions/public/getWithdrawalDelayEnabled.ts", "../src/actions/public/isInstantRedeemWhitelisted.ts", "../src/actions/public/previewDeposit.ts", "../src/actions/public/previewRedeem.ts", "../src/actions/public/previewWithdraw.ts", "../src/actions/wallet/cancelRedeemRequest.ts", "../src/actions/wallet/deposit.ts", "../src/actions/wallet/redeem.ts", "../src/actions/wallet/requestRedeem.ts"],
|
|
4
|
+
"sourcesContent": ["import type { Address } from \"viem\";\n\nexport const sVusdAddress: Address =\n \"0x476310E34D2810f7d79C43A74E4D79405bd7a925\";\n\nexport const sVetBtcAddress: Address =\n \"0x0cB9D84d4bcEc8d3D5B2d99a6F07f4605325987e\";\n\nexport const stakingVaultAddresses: Address[] = [sVusdAddress, sVetBtcAddress];\n", "import type { Address } from \"viem\";\n\nimport { sVetBtcAddress, sVusdAddress } from \"./stakingVaultAddresses.ts\";\nimport type { Gateway } from \"./types.ts\";\n\n// A hand-maintained copy of the protocol graph on Ethereum mainnet, for\n// faster rendering times skipping initial reading for on-chain values.\nexport const gateways: Gateway[] = [\n {\n // VUSD gateway\n address: \"0xDaD503f8B9d42bb7af3AfC588358D30163e4416F\",\n pegBaseSymbol: \"USD\",\n // VUSD\n peggedToken: \"0xCa83DDE9c22254f58e771bE5E157773212AcBAc3\",\n stakingVault: sVusdAddress,\n treasury: \"0xC8317A10385BE07901A4c9ee3d06E1D83AE378c9\",\n whitelistedTokens: [\n // USDT\n \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n // USDC\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n // frxUSD\n \"0xCAcd6fd266aF91b8AeD52aCCc382b4e165586E29\",\n ],\n },\n {\n // vetBTC gateway\n address: \"0xCBA2Ffa0AC52d7871a4221a871793Eb788013faB\",\n pegBaseSymbol: \"BTC\",\n // vetBTC\n peggedToken: \"0xf196C68233464A16CFDa319a47c21f4cECa62001\",\n stakingVault: sVetBtcAddress,\n treasury: \"0xd25a7b0b817fD816d0995eC67fb70e75EE65Bd7F\",\n whitelistedTokens: [\n // WBTC\n \"0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599\",\n // cbBTC\n \"0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf\",\n // hemiBTC\n \"0x06ea695B91700071B161A434fED42D1DcbAD9f00\",\n ],\n },\n];\n\nexport const gatewayAddresses: Address[] = gateways.map(\n (gateway) => gateway.address,\n);\n", "import { type Address, isAddress, isAddressEqual, zeroAddress } from \"viem\";\n\n/**\n * Narrows to `Address`, rejecting the zero address along with the missing and\n * malformed ones: contracts return `0x0\u20260` for an unset address, so a\n * well-formed result is not necessarily a usable one.\n */\nexport const isAddressValid = (\n address: Address | undefined,\n): address is Address =>\n !!address && isAddress(address) && !isAddressEqual(address, zeroAddress);\n", "import { isAddressValid } from \"@vetro-protocol/core\";\nimport { type Address, type Client } from \"viem\";\nimport { readContract } from \"viem/actions\";\n\nimport { peggedTokenAbi } from \"../../abi/peggedTokenAbi.ts\";\n\n/**\n * Reads the gateway address for a given pegged token.\n * @param client - The viem client used to read the contract.\n * @param parameters - The parameters object.\n * @param parameters.address - The pegged token address to read the gateway from.\n * @returns The gateway address configured on the pegged token.\n */\nexport async function getGateway(\n client: Client,\n parameters: {\n address: Address;\n },\n) {\n // Validate client\n if (!client) {\n throw new Error(\"Client is not defined\");\n }\n\n // Validate parameters exist\n if (!parameters) {\n throw new Error(\"Parameters are required\");\n }\n\n // Validate pegged token address\n if (!isAddressValid(parameters.address)) {\n throw new Error(\"Pegged token is invalid\");\n }\n\n return readContract(client, {\n abi: peggedTokenAbi,\n address: parameters.address,\n functionName: \"gateway\",\n });\n}\n", "export const peggedTokenAbi = [\n {\n inputs: [],\n name: \"gateway\",\n outputs: [{ type: \"address\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n] as const;\n", "export const gatewayAbi = [\n {\n inputs: [],\n name: \"PEGGED_TOKEN\",\n outputs: [{ type: \"address\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ name: \"token_\", type: \"address\" }],\n name: \"mintFee\",\n outputs: [{ type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"mintLimit\",\n outputs: [{ type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"owner\",\n outputs: [{ type: \"address\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ name: \"token_\", type: \"address\" }],\n name: \"redeemFee\",\n outputs: [{ type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"treasury\",\n outputs: [{ type: \"address\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"withdrawalDelayEnabled\",\n outputs: [{ type: \"bool\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"withdrawalDelay\",\n outputs: [{ type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ name: \"user_\", type: \"address\" }],\n name: \"getRedeemRequest\",\n outputs: [\n { name: \"amountLocked\", type: \"uint256\" },\n { name: \"claimableAt\", type: \"uint256\" },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ name: \"account_\", type: \"address\" }],\n name: \"isInstantRedeemWhitelisted\",\n outputs: [{ type: \"bool\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"maxMint\",\n outputs: [{ type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ name: \"tokenOut_\", type: \"address\" }],\n name: \"maxWithdraw\",\n outputs: [{ type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ name: \"account_\", type: \"address\" }],\n name: \"addToInstantRedeemWhitelist\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [{ name: \"account_\", type: \"address\" }],\n name: \"removeFromInstantRedeemWhitelist\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { name: \"tokenIn_\", type: \"address\" },\n { name: \"amountIn_\", type: \"uint256\" },\n ],\n name: \"previewDeposit\",\n outputs: [{ type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { name: \"tokenOut_\", type: \"address\" },\n { name: \"peggedTokenIn_\", type: \"uint256\" },\n ],\n name: \"previewRedeem\",\n outputs: [{ type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { name: \"tokenOut_\", type: \"address\" },\n { name: \"amountOut_\", type: \"uint256\" },\n ],\n name: \"previewWithdraw\",\n outputs: [{ type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"cancelRedeemRequest\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { name: \"tokenIn_\", type: \"address\" },\n { name: \"amountIn_\", type: \"uint256\" },\n { name: \"minPeggedTokenOut_\", type: \"uint256\" },\n { name: \"receiver_\", type: \"address\" },\n ],\n name: \"deposit\",\n outputs: [{ type: \"uint256\" }],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { name: \"tokenOut_\", type: \"address\" },\n { name: \"peggedTokenIn_\", type: \"uint256\" },\n { name: \"minAmountOut_\", type: \"uint256\" },\n { name: \"receiver_\", type: \"address\" },\n ],\n name: \"redeem\",\n outputs: [{ type: \"uint256\" }],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [{ name: \"peggedTokenAmount_\", type: \"uint256\" }],\n name: \"requestRedeem\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [{ name: \"enabled_\", type: \"bool\" }],\n name: \"setWithdrawalDelayEnabled\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { name: \"token_\", type: \"address\" },\n { name: \"newMintFee_\", type: \"uint256\" },\n ],\n name: \"updateMintFee\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [{ name: \"newMintLimit_\", type: \"uint256\" }],\n name: \"updateMintLimit\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { name: \"token_\", type: \"address\" },\n { name: \"newRedeemFee_\", type: \"uint256\" },\n ],\n name: \"updateRedeemFee\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [{ name: \"newDelay_\", type: \"uint256\" }],\n name: \"updateWithdrawalDelay\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n anonymous: false,\n inputs: [\n { indexed: true, name: \"user\", type: \"address\" },\n { indexed: false, name: \"amount\", type: \"uint256\" },\n { indexed: false, name: \"claimableAt\", type: \"uint256\" },\n ],\n name: \"RedeemRequested\",\n type: \"event\",\n },\n] as const;\n", "import { isAddressValid } from \"@vetro-protocol/core\";\nimport { type Address, type Client } from \"viem\";\nimport { readContract } from \"viem/actions\";\n\nimport { gatewayAbi } from \"../../abi/gatewayAbi.ts\";\n\nexport async function getMaxMint(\n client: Client,\n parameters: {\n address: Address;\n },\n) {\n // Validate client\n if (!client) {\n throw new Error(\"Client is not defined\");\n }\n\n // Validate parameters exist\n if (!parameters) {\n throw new Error(\"Parameters are required\");\n }\n\n // Validate gateway address\n if (!isAddressValid(parameters.address)) {\n throw new Error(\"Gateway is invalid\");\n }\n\n return readContract(client, {\n abi: gatewayAbi,\n address: parameters.address,\n functionName: \"maxMint\",\n });\n}\n", "import { isAddressValid } from \"@vetro-protocol/core\";\nimport { type Address, type Client } from \"viem\";\nimport { readContract } from \"viem/actions\";\n\nimport { gatewayAbi } from \"../../abi/gatewayAbi.ts\";\n\nexport async function getMaxWithdraw(\n client: Client,\n parameters: {\n address: Address;\n tokenOut: Address;\n },\n) {\n // Validate client\n if (!client) {\n throw new Error(\"Client is not defined\");\n }\n\n // Validate parameters exist\n if (!parameters) {\n throw new Error(\"Parameters are required\");\n }\n\n // Validate gateway address\n if (!isAddressValid(parameters.address)) {\n throw new Error(\"Gateway is invalid\");\n }\n\n // Validate tokenOut address\n if (!isAddressValid(parameters.tokenOut)) {\n throw new Error(\"Token is invalid\");\n }\n\n return readContract(client, {\n abi: gatewayAbi,\n address: parameters.address,\n args: [parameters.tokenOut],\n functionName: \"maxWithdraw\",\n });\n}\n", "import { isAddressValid } from \"@vetro-protocol/core\";\nimport { type Address, type Client } from \"viem\";\nimport { readContract } from \"viem/actions\";\n\nimport { gatewayAbi } from \"../../abi/gatewayAbi.ts\";\n\nexport async function getMintFee(\n client: Client,\n parameters: {\n address: Address;\n token: Address;\n },\n) {\n // Validate client\n if (!client) {\n throw new Error(\"Client is not defined\");\n }\n\n // Validate parameters exist\n if (!parameters) {\n throw new Error(\"Parameters are required\");\n }\n\n // Validate gateway address\n if (!isAddressValid(parameters.address)) {\n throw new Error(\"Gateway is invalid\");\n }\n\n // Validate token address\n if (!isAddressValid(parameters.token)) {\n throw new Error(\"Token is invalid\");\n }\n\n return readContract(client, {\n abi: gatewayAbi,\n address: parameters.address,\n args: [parameters.token],\n functionName: \"mintFee\",\n });\n}\n", "import { isAddressValid } from \"@vetro-protocol/core\";\nimport { type Address, type Client } from \"viem\";\nimport { readContract } from \"viem/actions\";\n\nimport { gatewayAbi } from \"../../abi/gatewayAbi.ts\";\n\nexport async function getPeggedToken(\n client: Client,\n parameters: {\n address: Address;\n },\n) {\n // Validate client\n if (!client) {\n throw new Error(\"Client is not defined\");\n }\n\n // Validate parameters exist\n if (!parameters) {\n throw new Error(\"Parameters are required\");\n }\n\n // Validate gateway address\n if (!isAddressValid(parameters.address)) {\n throw new Error(\"Gateway is invalid\");\n }\n\n return readContract(client, {\n abi: gatewayAbi,\n address: parameters.address,\n functionName: \"PEGGED_TOKEN\",\n });\n}\n", "import { isAddressValid } from \"@vetro-protocol/core\";\nimport { type Address, type Client } from \"viem\";\nimport { readContract } from \"viem/actions\";\n\nimport { gatewayAbi } from \"../../abi/gatewayAbi.ts\";\n\nexport async function getRedeemFee(\n client: Client,\n parameters: {\n address: Address;\n token: Address;\n },\n) {\n // Validate client\n if (!client) {\n throw new Error(\"Client is not defined\");\n }\n\n // Validate parameters exist\n if (!parameters) {\n throw new Error(\"Parameters are required\");\n }\n\n // Validate gateway address\n if (!isAddressValid(parameters.address)) {\n throw new Error(\"Gateway is invalid\");\n }\n\n // Validate token address\n if (!isAddressValid(parameters.token)) {\n throw new Error(\"Token is invalid\");\n }\n\n return readContract(client, {\n abi: gatewayAbi,\n address: parameters.address,\n args: [parameters.token],\n functionName: \"redeemFee\",\n });\n}\n", "import { isAddressValid } from \"@vetro-protocol/core\";\nimport { type Address, type Client } from \"viem\";\nimport { readContract } from \"viem/actions\";\n\nimport { gatewayAbi } from \"../../abi/gatewayAbi.ts\";\n\nexport async function getRedeemRequest(\n client: Client,\n parameters: {\n address: Address;\n user: Address;\n },\n) {\n // Validate client\n if (!client) {\n throw new Error(\"Client is not defined\");\n }\n\n // Validate parameters exist\n if (!parameters) {\n throw new Error(\"Parameters are required\");\n }\n\n // Validate gateway address\n if (!isAddressValid(parameters.address)) {\n throw new Error(\"Gateway is invalid\");\n }\n\n // Validate user address\n if (!isAddressValid(parameters.user)) {\n throw new Error(\"User is invalid\");\n }\n\n return readContract(client, {\n abi: gatewayAbi,\n address: parameters.address,\n args: [parameters.user],\n functionName: \"getRedeemRequest\",\n });\n}\n", "import { isAddressValid } from \"@vetro-protocol/core\";\nimport { type Address, type Client } from \"viem\";\nimport { readContract } from \"viem/actions\";\n\nimport { gatewayAbi } from \"../../abi/gatewayAbi.ts\";\n\nexport async function getTreasury(\n client: Client,\n parameters: {\n address: Address;\n },\n) {\n // Validate client\n if (!client) {\n throw new Error(\"Client is not defined\");\n }\n\n // Validate parameters exist\n if (!parameters) {\n throw new Error(\"Parameters are required\");\n }\n\n // Validate gateway address\n if (!isAddressValid(parameters.address)) {\n throw new Error(\"Gateway is invalid\");\n }\n\n return readContract(client, {\n abi: gatewayAbi,\n address: parameters.address,\n functionName: \"treasury\",\n });\n}\n", "import { isAddressValid } from \"@vetro-protocol/core\";\nimport { type Address, type Client } from \"viem\";\nimport { readContract } from \"viem/actions\";\n\nimport { gatewayAbi } from \"../../abi/gatewayAbi.ts\";\n\nexport async function getWithdrawalDelay(\n client: Client,\n parameters: {\n address: Address;\n },\n) {\n // Validate client\n if (!client) {\n throw new Error(\"Client is not defined\");\n }\n\n // Validate parameters exist\n if (!parameters) {\n throw new Error(\"Parameters are required\");\n }\n\n // Validate gateway address\n if (!isAddressValid(parameters.address)) {\n throw new Error(\"Gateway is invalid\");\n }\n\n return readContract(client, {\n abi: gatewayAbi,\n address: parameters.address,\n functionName: \"withdrawalDelay\",\n });\n}\n", "import { isAddressValid } from \"@vetro-protocol/core\";\nimport { type Address, type Client } from \"viem\";\nimport { readContract } from \"viem/actions\";\n\nimport { gatewayAbi } from \"../../abi/gatewayAbi.ts\";\n\nexport async function getWithdrawalDelayEnabled(\n client: Client,\n parameters: {\n address: Address;\n },\n) {\n // Validate client\n if (!client) {\n throw new Error(\"Client is not defined\");\n }\n\n // Validate parameters exist\n if (!parameters) {\n throw new Error(\"Parameters are required\");\n }\n\n // Validate gateway address\n if (!isAddressValid(parameters.address)) {\n throw new Error(\"Gateway is invalid\");\n }\n\n return readContract(client, {\n abi: gatewayAbi,\n address: parameters.address,\n functionName: \"withdrawalDelayEnabled\",\n });\n}\n", "import { isAddressValid } from \"@vetro-protocol/core\";\nimport { type Address, type Client } from \"viem\";\nimport { readContract } from \"viem/actions\";\n\nimport { gatewayAbi } from \"../../abi/gatewayAbi.ts\";\n\nexport async function isInstantRedeemWhitelisted(\n client: Client,\n parameters: {\n address: Address;\n account: Address;\n },\n) {\n // Validate client\n if (!client) {\n throw new Error(\"Client is not defined\");\n }\n\n // Validate parameters exist\n if (!parameters) {\n throw new Error(\"Parameters are required\");\n }\n\n // Validate gateway address\n if (!isAddressValid(parameters.address)) {\n throw new Error(\"Gateway is invalid\");\n }\n\n // Validate account address\n if (!isAddressValid(parameters.account)) {\n throw new Error(\"Account is invalid\");\n }\n\n return readContract(client, {\n abi: gatewayAbi,\n address: parameters.address,\n args: [parameters.account],\n functionName: \"isInstantRedeemWhitelisted\",\n });\n}\n", "import { isAddressValid } from \"@vetro-protocol/core\";\nimport { type Address, type Client } from \"viem\";\nimport { readContract } from \"viem/actions\";\n\nimport { gatewayAbi } from \"../../abi/gatewayAbi.ts\";\n\nexport async function previewDeposit(\n client: Client,\n parameters: {\n address: Address;\n tokenIn: Address;\n amountIn: bigint;\n },\n) {\n // Validate client\n if (!client) {\n throw new Error(\"Client is not defined\");\n }\n\n // Validate parameters exist\n if (!parameters) {\n throw new Error(\"Parameters are required\");\n }\n\n // Validate gateway address\n if (!isAddressValid(parameters.address)) {\n throw new Error(\"Gateway is invalid\");\n }\n\n // Validate tokenIn address\n if (!isAddressValid(parameters.tokenIn)) {\n throw new Error(\"Token is invalid\");\n }\n\n // Validate amountIn\n if (typeof parameters.amountIn !== \"bigint\") {\n throw new Error(\"Amount must be a bigint\");\n }\n if (parameters.amountIn <= 0n) {\n throw new Error(\"Amount must be greater than 0\");\n }\n\n return readContract(client, {\n abi: gatewayAbi,\n address: parameters.address,\n args: [parameters.tokenIn, parameters.amountIn],\n functionName: \"previewDeposit\",\n });\n}\n", "import { isAddressValid } from \"@vetro-protocol/core\";\nimport { type Address, type Client } from \"viem\";\nimport { readContract } from \"viem/actions\";\n\nimport { gatewayAbi } from \"../../abi/gatewayAbi.ts\";\n\nexport async function previewRedeem(\n client: Client,\n parameters: {\n address: Address;\n tokenOut: Address;\n peggedTokenIn: bigint;\n },\n) {\n // Validate client\n if (!client) {\n throw new Error(\"Client is not defined\");\n }\n\n // Validate parameters exist\n if (!parameters) {\n throw new Error(\"Parameters are required\");\n }\n\n // Validate gateway address\n if (!isAddressValid(parameters.address)) {\n throw new Error(\"Gateway is invalid\");\n }\n\n // Validate tokenOut address\n if (!isAddressValid(parameters.tokenOut)) {\n throw new Error(\"Token is invalid\");\n }\n\n // Validate peggedTokenIn\n if (typeof parameters.peggedTokenIn !== \"bigint\") {\n throw new Error(\"Amount must be a bigint\");\n }\n if (parameters.peggedTokenIn <= 0n) {\n throw new Error(\"Amount must be greater than 0\");\n }\n\n return readContract(client, {\n abi: gatewayAbi,\n address: parameters.address,\n args: [parameters.tokenOut, parameters.peggedTokenIn],\n functionName: \"previewRedeem\",\n });\n}\n", "import { isAddressValid } from \"@vetro-protocol/core\";\nimport { type Address, type Client } from \"viem\";\nimport { readContract } from \"viem/actions\";\n\nimport { gatewayAbi } from \"../../abi/gatewayAbi.ts\";\n\nexport async function previewWithdraw(\n client: Client,\n parameters: {\n address: Address;\n tokenOut: Address;\n amountOut: bigint;\n },\n) {\n // Validate client\n if (!client) {\n throw new Error(\"Client is not defined\");\n }\n\n // Validate parameters exist\n if (!parameters) {\n throw new Error(\"Parameters are required\");\n }\n\n // Validate gateway address\n if (!isAddressValid(parameters.address)) {\n throw new Error(\"Gateway is invalid\");\n }\n\n // Validate tokenOut address\n if (!isAddressValid(parameters.tokenOut)) {\n throw new Error(\"Token is invalid\");\n }\n\n // Validate amountOut\n if (typeof parameters.amountOut !== \"bigint\") {\n throw new Error(\"Amount must be a bigint\");\n }\n if (parameters.amountOut <= 0n) {\n throw new Error(\"Amount must be greater than 0\");\n }\n\n return readContract(client, {\n abi: gatewayAbi,\n address: parameters.address,\n args: [parameters.tokenOut, parameters.amountOut],\n functionName: \"previewWithdraw\",\n });\n}\n", "import { EventEmitter } from \"events\";\nimport { toPromiseEvent } from \"to-promise-event\";\nimport {\n type Address,\n type TransactionReceipt,\n type WalletClient,\n encodeFunctionData,\n isAddress,\n isAddressEqual,\n zeroAddress,\n} from \"viem\";\nimport { waitForTransactionReceipt, writeContract } from \"viem/actions\";\n\nimport { gatewayAbi } from \"../../abi/gatewayAbi.ts\";\nimport type { CancelRedeemRequestEvents } from \"../../types.ts\";\n\nexport type CancelRedeemRequestParams = {\n gatewayAddress: Address;\n};\n\nconst canCancelRedeemRequest = function ({\n client,\n gatewayAddress,\n}: {\n client: WalletClient;\n gatewayAddress: Address;\n}): {\n canCancelRedeemRequest: boolean;\n reason?: string;\n} {\n if (!client) {\n return {\n canCancelRedeemRequest: false,\n reason: \"Client is not defined\",\n };\n }\n if (!client.chain) {\n return {\n canCancelRedeemRequest: false,\n reason: \"Chain is not defined on wallet client\",\n };\n }\n if (!client.account) {\n return {\n canCancelRedeemRequest: false,\n reason: \"Client must have an account\",\n };\n }\n // Validate gateway address\n if (!gatewayAddress || !isAddress(gatewayAddress)) {\n return {\n canCancelRedeemRequest: false,\n reason: \"Invalid gateway address\",\n };\n }\n if (isAddressEqual(gatewayAddress, zeroAddress)) {\n return {\n canCancelRedeemRequest: false,\n reason: \"Gateway address cannot be zero address\",\n };\n }\n\n return { canCancelRedeemRequest: true };\n};\n\nconst runCancelRedeemRequest = (\n walletClient: WalletClient,\n { gatewayAddress }: CancelRedeemRequestParams,\n) =>\n async function (emitter: EventEmitter<CancelRedeemRequestEvents>) {\n try {\n const { canCancelRedeemRequest: canCancelRedeemRequestFlag, reason } =\n canCancelRedeemRequest({\n client: walletClient,\n gatewayAddress,\n });\n\n if (!canCancelRedeemRequestFlag) {\n emitter.emit(\"cancel-redeem-request-failed-validation\", reason!);\n return;\n }\n\n emitter.emit(\"pre-cancel-redeem-request\");\n\n const cancelHash = await writeContract(walletClient, {\n abi: gatewayAbi,\n account: walletClient.account!,\n address: gatewayAddress,\n chain: walletClient.chain,\n functionName: \"cancelRedeemRequest\",\n }).catch(function (error: Error) {\n emitter.emit(\"user-signing-cancel-redeem-request-error\", error);\n });\n\n if (!cancelHash) {\n return;\n }\n\n emitter.emit(\"user-signed-cancel-redeem-request\", cancelHash);\n\n const cancelReceipt = await waitForTransactionReceipt(walletClient, {\n hash: cancelHash,\n }).catch(function (error: Error) {\n emitter.emit(\"cancel-redeem-request-failed\", error);\n });\n\n if (!cancelReceipt) {\n return;\n }\n\n const cancelEventMap: Record<\n TransactionReceipt[\"status\"],\n keyof CancelRedeemRequestEvents\n > = {\n reverted: \"cancel-redeem-request-transaction-reverted\",\n success: \"cancel-redeem-request-transaction-succeeded\",\n };\n\n emitter.emit(cancelEventMap[cancelReceipt.status], cancelReceipt);\n } catch (error) {\n emitter.emit(\"unexpected-error\", error as Error);\n } finally {\n emitter.emit(\"cancel-redeem-request-settled\");\n }\n };\n\nexport const cancelRedeemRequest = (\n ...args: Parameters<typeof runCancelRedeemRequest>\n) => toPromiseEvent<CancelRedeemRequestEvents>(runCancelRedeemRequest(...args));\n\nexport const encodeCancelRedeemRequest = () =>\n encodeFunctionData({\n abi: gatewayAbi,\n functionName: \"cancelRedeemRequest\",\n });\n", "import { EventEmitter } from \"events\";\nimport { toPromiseEvent } from \"to-promise-event\";\nimport {\n type Address,\n type TransactionReceipt,\n type WalletClient,\n encodeFunctionData,\n isAddress,\n isAddressEqual,\n zeroAddress,\n} from \"viem\";\nimport { waitForTransactionReceipt, writeContract } from \"viem/actions\";\nimport { allowance, approve } from \"viem-erc20/actions\";\n\nimport { gatewayAbi } from \"../../abi/gatewayAbi.ts\";\nimport type { DepositEvents } from \"../../types.ts\";\n\nexport type DepositParams = {\n amountIn: bigint;\n approveAmount?: bigint;\n gatewayAddress: Address;\n minPeggedTokenOut: bigint;\n receiver: Address;\n tokenIn: Address;\n};\n\nconst canDeposit = function ({\n amountIn,\n approveAmount,\n client,\n gatewayAddress,\n minPeggedTokenOut,\n receiver,\n tokenIn,\n}: {\n amountIn: bigint;\n approveAmount: bigint;\n client: WalletClient;\n gatewayAddress: Address;\n minPeggedTokenOut: bigint;\n receiver: Address;\n tokenIn: Address;\n}): {\n canDeposit: boolean;\n reason?: string;\n} {\n // Validate client\n if (!client) {\n return {\n canDeposit: false,\n reason: \"Client is not defined\",\n };\n }\n if (!client.chain) {\n return {\n canDeposit: false,\n reason: \"Chain is not defined on wallet client\",\n };\n }\n // Validate client has required properties\n if (!client.account) {\n return {\n canDeposit: false,\n reason: \"Client must have an account\",\n };\n }\n // Validate gateway address\n if (!gatewayAddress || !isAddress(gatewayAddress)) {\n return {\n canDeposit: false,\n reason: \"Invalid gateway address\",\n };\n }\n if (isAddressEqual(gatewayAddress, zeroAddress)) {\n return {\n canDeposit: false,\n reason: \"Gateway address cannot be zero address\",\n };\n }\n // Validate tokenIn address\n if (!tokenIn || !isAddress(tokenIn)) {\n return {\n canDeposit: false,\n reason: \"Invalid token address\",\n };\n }\n if (isAddressEqual(tokenIn, zeroAddress)) {\n return {\n canDeposit: false,\n reason: \"Token address cannot be zero address\",\n };\n }\n\n // Validate receiver address\n if (!receiver || !isAddress(receiver)) {\n return {\n canDeposit: false,\n reason: \"Invalid receiver address\",\n };\n }\n if (isAddressEqual(receiver, zeroAddress)) {\n return {\n canDeposit: false,\n reason: \"Receiver address cannot be zero address\",\n };\n }\n\n // Validate amountIn\n if (typeof amountIn !== \"bigint\") {\n return {\n canDeposit: false,\n reason: \"Amount must be a bigint\",\n };\n }\n if (amountIn <= 0n) {\n return {\n canDeposit: false,\n reason: \"Amount must be greater than 0\",\n };\n }\n\n // Validate minPeggedTokenOut\n if (typeof minPeggedTokenOut !== \"bigint\") {\n return {\n canDeposit: false,\n reason: \"Minimum output must be a bigint\",\n };\n }\n if (minPeggedTokenOut < 0n) {\n return {\n canDeposit: false,\n reason: \"Minimum output cannot be negative\",\n };\n }\n\n // Validate approveAmount\n if (approveAmount < amountIn) {\n return {\n canDeposit: false,\n reason: \"Approve amount must be greater than or equal to amount\",\n };\n }\n\n return { canDeposit: true };\n};\n\nconst runDeposit = (\n walletClient: WalletClient,\n {\n amountIn,\n approveAmount = amountIn,\n gatewayAddress,\n minPeggedTokenOut,\n receiver,\n tokenIn,\n }: DepositParams,\n) =>\n async function (emitter: EventEmitter<DepositEvents>) {\n try {\n const { canDeposit: canDepositFlag, reason } = canDeposit({\n amountIn,\n approveAmount,\n client: walletClient,\n gatewayAddress,\n minPeggedTokenOut,\n receiver,\n tokenIn,\n });\n\n if (!canDepositFlag) {\n emitter.emit(\"deposit-failed-validation\", reason!);\n return;\n }\n\n // Check current allowance\n const currentAllowance = await allowance(walletClient, {\n address: tokenIn,\n // account is already validated\n owner: walletClient.account!.address,\n spender: gatewayAddress,\n });\n\n // If allowance is insufficient, approve first\n if (currentAllowance < amountIn) {\n emitter.emit(\"pre-approve\");\n\n const approvalHash = await approve(walletClient, {\n address: tokenIn,\n amount: approveAmount,\n spender: gatewayAddress,\n }).catch(function (error: Error) {\n emitter.emit(\"user-signing-approval-error\", error);\n });\n\n if (!approvalHash) {\n return;\n }\n\n emitter.emit(\"user-signed-approval\", approvalHash);\n\n const approvalReceipt = await waitForTransactionReceipt(walletClient, {\n hash: approvalHash,\n }).catch(function (error: Error) {\n emitter.emit(\"deposit-failed\", error);\n });\n\n if (!approvalReceipt) {\n return;\n }\n\n if (approvalReceipt.status === \"reverted\") {\n emitter.emit(\"approve-transaction-reverted\", approvalReceipt);\n return;\n }\n\n emitter.emit(\"approve-transaction-succeeded\", approvalReceipt);\n }\n\n emitter.emit(\"pre-deposit\");\n\n const depositHash = await writeContract(walletClient, {\n abi: gatewayAbi,\n account: walletClient.account!,\n address: gatewayAddress,\n args: [tokenIn, amountIn, minPeggedTokenOut, receiver],\n chain: walletClient.chain,\n functionName: \"deposit\",\n }).catch(function (error: Error) {\n emitter.emit(\"user-signing-deposit-error\", error);\n });\n\n if (!depositHash) {\n return;\n }\n\n emitter.emit(\"user-signed-deposit\", depositHash);\n\n const depositReceipt = await waitForTransactionReceipt(walletClient, {\n hash: depositHash,\n }).catch(function (error: Error) {\n emitter.emit(\"deposit-failed\", error);\n });\n\n if (!depositReceipt) {\n return;\n }\n\n const depositEventMap: Record<\n TransactionReceipt[\"status\"],\n keyof DepositEvents\n > = {\n reverted: \"deposit-transaction-reverted\",\n success: \"deposit-transaction-succeeded\",\n };\n\n emitter.emit(depositEventMap[depositReceipt.status], depositReceipt);\n } catch (error) {\n emitter.emit(\"unexpected-error\", error as Error);\n } finally {\n emitter.emit(\"deposit-settled\");\n }\n };\n\nexport const deposit = (...args: Parameters<typeof runDeposit>) =>\n toPromiseEvent<DepositEvents>(runDeposit(...args));\n\nexport const encodeDeposit = ({\n amountIn,\n minPeggedTokenOut,\n receiver,\n tokenIn,\n}: Omit<DepositParams, \"gatewayAddress\">) =>\n encodeFunctionData({\n abi: gatewayAbi,\n args: [tokenIn, amountIn, minPeggedTokenOut, receiver],\n functionName: \"deposit\",\n });\n", "import { EventEmitter } from \"events\";\nimport { toPromiseEvent } from \"to-promise-event\";\nimport {\n type Address,\n type TransactionReceipt,\n type WalletClient,\n encodeFunctionData,\n isAddress,\n isAddressEqual,\n zeroAddress,\n} from \"viem\";\nimport { waitForTransactionReceipt, writeContract } from \"viem/actions\";\nimport { allowance, approve } from \"viem-erc20/actions\";\n\nimport { gatewayAbi } from \"../../abi/gatewayAbi.ts\";\nimport type { RedeemEvents } from \"../../types.ts\";\nimport { getMaxWithdraw } from \"../public/getMaxWithdraw.ts\";\nimport { getPeggedToken } from \"../public/getPeggedToken.ts\";\nimport { getWithdrawalDelayEnabled } from \"../public/getWithdrawalDelayEnabled.ts\";\nimport { isInstantRedeemWhitelisted } from \"../public/isInstantRedeemWhitelisted.ts\";\n\nexport type RedeemParams = {\n approveAmount?: bigint;\n gatewayAddress: Address;\n minAmountOut: bigint;\n peggedTokenIn: bigint;\n receiver: Address;\n tokenOut: Address;\n};\n\nconst canRedeem = async function ({\n approveAmount,\n client,\n gatewayAddress,\n minAmountOut,\n peggedTokenIn,\n receiver,\n tokenOut,\n}: {\n approveAmount: bigint;\n client: WalletClient;\n gatewayAddress: Address;\n minAmountOut: bigint;\n peggedTokenIn: bigint;\n receiver: Address;\n tokenOut: Address;\n}): Promise<{\n canRedeem: boolean;\n reason?: string;\n}> {\n // Validate client\n if (!client) {\n return {\n canRedeem: false,\n reason: \"Client is not defined\",\n };\n }\n if (!client.chain) {\n return {\n canRedeem: false,\n reason: \"Chain is not defined on wallet client\",\n };\n }\n // Validate client has required properties\n if (!client.account) {\n return {\n canRedeem: false,\n reason: \"Client must have an account\",\n };\n }\n // Validate gateway address\n if (!gatewayAddress || !isAddress(gatewayAddress)) {\n return {\n canRedeem: false,\n reason: \"Invalid gateway address\",\n };\n }\n if (isAddressEqual(gatewayAddress, zeroAddress)) {\n return {\n canRedeem: false,\n reason: \"Gateway address cannot be zero address\",\n };\n }\n // Validate tokenOut address\n if (!tokenOut || !isAddress(tokenOut)) {\n return {\n canRedeem: false,\n reason: \"Invalid token address\",\n };\n }\n if (isAddressEqual(tokenOut, zeroAddress)) {\n return {\n canRedeem: false,\n reason: \"Token address cannot be zero address\",\n };\n }\n\n // Validate receiver address\n if (!receiver || !isAddress(receiver)) {\n return {\n canRedeem: false,\n reason: \"Invalid receiver address\",\n };\n }\n if (isAddressEqual(receiver, zeroAddress)) {\n return {\n canRedeem: false,\n reason: \"Receiver address cannot be zero address\",\n };\n }\n\n // Validate peggedTokenIn\n if (typeof peggedTokenIn !== \"bigint\") {\n return {\n canRedeem: false,\n reason: \"Amount must be a bigint\",\n };\n }\n if (peggedTokenIn <= 0n) {\n return {\n canRedeem: false,\n reason: \"Amount must be greater than 0\",\n };\n }\n\n // Validate minAmountOut\n if (typeof minAmountOut !== \"bigint\") {\n return {\n canRedeem: false,\n reason: \"Minimum output must be a bigint\",\n };\n }\n if (minAmountOut < 0n) {\n return {\n canRedeem: false,\n reason: \"Minimum output cannot be negative\",\n };\n }\n // Validate approveAmount\n if (approveAmount < peggedTokenIn) {\n return {\n canRedeem: false,\n reason: \"Approve amount must be greater than or equal to amount\",\n };\n }\n\n // Check treasury has enough balance for the requested token\n const maxWithdrawable = await getMaxWithdraw(client, {\n address: gatewayAddress,\n tokenOut,\n });\n\n if (minAmountOut > maxWithdrawable) {\n return {\n canRedeem: false,\n reason: \"Not enough balance in treasury\",\n };\n }\n\n return { canRedeem: true };\n};\n\nconst runRedeem = (\n walletClient: WalletClient,\n {\n approveAmount,\n gatewayAddress,\n minAmountOut,\n peggedTokenIn,\n receiver,\n tokenOut,\n }: RedeemParams,\n) =>\n async function (emitter: EventEmitter<RedeemEvents>) {\n const resolvedApproveAmount = approveAmount ?? peggedTokenIn;\n try {\n const { canRedeem: canRedeemFlag, reason } = await canRedeem({\n approveAmount: resolvedApproveAmount,\n client: walletClient,\n gatewayAddress,\n minAmountOut,\n peggedTokenIn,\n receiver,\n tokenOut,\n });\n\n if (!canRedeemFlag) {\n emitter.emit(\"redeem-failed-validation\", reason!);\n return;\n }\n\n // Check if user is whitelisted for instant redeem\n const [isWhitelisted, delayEnabled] = await Promise.all([\n isInstantRedeemWhitelisted(walletClient, {\n account: walletClient.account!.address,\n address: gatewayAddress,\n }),\n getWithdrawalDelayEnabled(walletClient, {\n address: gatewayAddress,\n }),\n ]);\n\n // Approval is needed when the user is whitelisted (instant redeem burns pegged tokens)\n // or when delay is disabled (redeem completes immediately)\n if (isWhitelisted || !delayEnabled) {\n // Get the pegged token address\n const peggedTokenAddress = await getPeggedToken(walletClient, {\n address: gatewayAddress,\n });\n\n // Check current allowance for pegged token\n const currentAllowance = await allowance(walletClient, {\n address: peggedTokenAddress,\n owner: walletClient.account!.address,\n spender: gatewayAddress,\n });\n\n // If allowance is insufficient, approve first\n if (currentAllowance < peggedTokenIn) {\n emitter.emit(\"pre-approve\");\n\n const approvalHash = await approve(walletClient, {\n address: peggedTokenAddress,\n amount: resolvedApproveAmount,\n spender: gatewayAddress,\n }).catch(function (error: Error) {\n emitter.emit(\"user-signing-approval-error\", error);\n });\n\n if (!approvalHash) {\n return;\n }\n\n emitter.emit(\"user-signed-approval\", approvalHash);\n\n const approvalReceipt = await waitForTransactionReceipt(\n walletClient,\n {\n hash: approvalHash,\n },\n ).catch(function (error: Error) {\n emitter.emit(\"redeem-failed\", error);\n });\n\n if (!approvalReceipt) {\n return;\n }\n\n if (approvalReceipt.status === \"reverted\") {\n emitter.emit(\"approve-transaction-reverted\", approvalReceipt);\n return;\n }\n\n emitter.emit(\"approve-transaction-succeeded\", approvalReceipt);\n }\n }\n\n emitter.emit(\"pre-redeem\");\n\n const redeemHash = await writeContract(walletClient, {\n abi: gatewayAbi,\n account: walletClient.account!,\n address: gatewayAddress,\n args: [tokenOut, peggedTokenIn, minAmountOut, receiver],\n chain: walletClient.chain,\n functionName: \"redeem\",\n }).catch(function (error: Error) {\n emitter.emit(\"user-signing-redeem-error\", error);\n });\n\n if (!redeemHash) {\n return;\n }\n\n emitter.emit(\"user-signed-redeem\", redeemHash);\n\n const redeemReceipt = await waitForTransactionReceipt(walletClient, {\n hash: redeemHash,\n }).catch(function (error: Error) {\n emitter.emit(\"redeem-failed\", error);\n });\n\n if (!redeemReceipt) {\n return;\n }\n\n const redeemEventMap: Record<\n TransactionReceipt[\"status\"],\n keyof RedeemEvents\n > = {\n reverted: \"redeem-transaction-reverted\",\n success: \"redeem-transaction-succeeded\",\n };\n\n emitter.emit(redeemEventMap[redeemReceipt.status], redeemReceipt);\n } catch (error) {\n emitter.emit(\"unexpected-error\", error as Error);\n } finally {\n emitter.emit(\"redeem-settled\");\n }\n };\n\nexport const redeem = (...args: Parameters<typeof runRedeem>) =>\n toPromiseEvent<RedeemEvents>(runRedeem(...args));\n\nexport const encodeRedeem = ({\n minAmountOut,\n peggedTokenIn,\n receiver,\n tokenOut,\n}: {\n minAmountOut: bigint;\n peggedTokenIn: bigint;\n receiver: Address;\n tokenOut: Address;\n}) =>\n encodeFunctionData({\n abi: gatewayAbi,\n args: [tokenOut, peggedTokenIn, minAmountOut, receiver],\n functionName: \"redeem\",\n });\n", "import { EventEmitter } from \"events\";\nimport { toPromiseEvent } from \"to-promise-event\";\nimport {\n type Address,\n type TransactionReceipt,\n type WalletClient,\n encodeFunctionData,\n isAddress,\n isAddressEqual,\n zeroAddress,\n} from \"viem\";\nimport { waitForTransactionReceipt, writeContract } from \"viem/actions\";\nimport { allowance, approve } from \"viem-erc20/actions\";\n\nimport { gatewayAbi } from \"../../abi/gatewayAbi.ts\";\nimport type { RequestRedeemEvents } from \"../../types.ts\";\nimport { getPeggedToken } from \"../public/getPeggedToken.ts\";\n\nexport type RequestRedeemParams = {\n approveAmount?: bigint;\n gatewayAddress: Address;\n peggedTokenAmount: bigint;\n};\n\nconst canRequestRedeem = function ({\n approveAmount,\n client,\n gatewayAddress,\n peggedTokenAmount,\n}: {\n approveAmount: bigint;\n client: WalletClient;\n gatewayAddress: Address;\n peggedTokenAmount: bigint;\n}): {\n canRequestRedeem: boolean;\n reason?: string;\n} {\n if (!client) {\n return {\n canRequestRedeem: false,\n reason: \"Client is not defined\",\n };\n }\n if (!client.chain) {\n return {\n canRequestRedeem: false,\n reason: \"Chain is not defined on wallet client\",\n };\n }\n if (!client.account) {\n return {\n canRequestRedeem: false,\n reason: \"Client must have an account\",\n };\n }\n // Validate gateway address\n if (!gatewayAddress || !isAddress(gatewayAddress)) {\n return {\n canRequestRedeem: false,\n reason: \"Invalid gateway address\",\n };\n }\n if (isAddressEqual(gatewayAddress, zeroAddress)) {\n return {\n canRequestRedeem: false,\n reason: \"Gateway address cannot be zero address\",\n };\n }\n\n if (typeof peggedTokenAmount !== \"bigint\") {\n return {\n canRequestRedeem: false,\n reason: \"Amount must be a bigint\",\n };\n }\n if (peggedTokenAmount <= 0n) {\n return {\n canRequestRedeem: false,\n reason: \"Amount must be greater than 0\",\n };\n }\n\n // Validate approveAmount\n if (approveAmount < peggedTokenAmount) {\n return {\n canRequestRedeem: false,\n reason: \"Approve amount must be greater than or equal to amount\",\n };\n }\n\n return { canRequestRedeem: true };\n};\n\nconst runRequestRedeem = (\n walletClient: WalletClient,\n { approveAmount, gatewayAddress, peggedTokenAmount }: RequestRedeemParams,\n) =>\n async function (emitter: EventEmitter<RequestRedeemEvents>) {\n const resolvedApproveAmount = approveAmount ?? peggedTokenAmount;\n try {\n const { canRequestRedeem: canRequestRedeemFlag, reason } =\n canRequestRedeem({\n approveAmount: resolvedApproveAmount,\n client: walletClient,\n gatewayAddress,\n peggedTokenAmount,\n });\n\n if (!canRequestRedeemFlag) {\n emitter.emit(\"request-redeem-failed-validation\", reason!);\n return;\n }\n\n // Get the pegged token address\n const peggedTokenAddress = await getPeggedToken(walletClient, {\n address: gatewayAddress,\n });\n\n // Check current allowance for pegged token\n const currentAllowance = await allowance(walletClient, {\n address: peggedTokenAddress,\n owner: walletClient.account!.address,\n spender: gatewayAddress,\n });\n\n // If allowance is insufficient, approve first\n if (currentAllowance < peggedTokenAmount) {\n emitter.emit(\"pre-approve\");\n\n const approvalHash = await approve(walletClient, {\n address: peggedTokenAddress,\n amount: resolvedApproveAmount,\n spender: gatewayAddress,\n }).catch(function (error: Error) {\n emitter.emit(\"user-signing-approval-error\", error);\n });\n\n if (!approvalHash) {\n return;\n }\n\n emitter.emit(\"user-signed-approval\", approvalHash);\n\n const approvalReceipt = await waitForTransactionReceipt(walletClient, {\n hash: approvalHash,\n }).catch(function (error: Error) {\n emitter.emit(\"request-redeem-failed\", error);\n });\n\n if (!approvalReceipt) {\n return;\n }\n\n if (approvalReceipt.status === \"reverted\") {\n emitter.emit(\"approve-transaction-reverted\", approvalReceipt);\n return;\n }\n\n emitter.emit(\"approve-transaction-succeeded\", approvalReceipt);\n }\n\n emitter.emit(\"pre-request-redeem\");\n\n const requestRedeemHash = await writeContract(walletClient, {\n abi: gatewayAbi,\n account: walletClient.account!,\n address: gatewayAddress,\n args: [peggedTokenAmount],\n chain: walletClient.chain,\n functionName: \"requestRedeem\",\n }).catch(function (error: Error) {\n emitter.emit(\"user-signing-request-redeem-error\", error);\n });\n\n if (!requestRedeemHash) {\n return;\n }\n\n emitter.emit(\"user-signed-request-redeem\", requestRedeemHash);\n\n const requestRedeemReceipt = await waitForTransactionReceipt(\n walletClient,\n {\n hash: requestRedeemHash,\n },\n ).catch(function (error: Error) {\n emitter.emit(\"request-redeem-failed\", error);\n });\n\n if (!requestRedeemReceipt) {\n return;\n }\n\n const requestRedeemEventMap: Record<\n TransactionReceipt[\"status\"],\n keyof RequestRedeemEvents\n > = {\n reverted: \"request-redeem-transaction-reverted\",\n success: \"request-redeem-transaction-succeeded\",\n };\n\n emitter.emit(\n requestRedeemEventMap[requestRedeemReceipt.status],\n requestRedeemReceipt,\n );\n } catch (error) {\n emitter.emit(\"unexpected-error\", error as Error);\n } finally {\n emitter.emit(\"request-redeem-settled\");\n }\n };\n\nexport const requestRedeem = (...args: Parameters<typeof runRequestRedeem>) =>\n toPromiseEvent<RequestRedeemEvents>(runRequestRedeem(...args));\n\nexport const encodeRequestRedeem = ({\n peggedTokenAmount,\n}: {\n peggedTokenAmount: bigint;\n}) =>\n encodeFunctionData({\n abi: gatewayAbi,\n args: [peggedTokenAmount],\n functionName: \"requestRedeem\",\n });\n"],
|
|
5
|
+
"mappings": ";AAEO,IAAM,eACX;AAEK,IAAM,iBACX;;;ACCK,IAAM,WAAsB;AAAA,EACjC;AAAA;AAAA,IAEE,SAAS;AAAA,IACT,eAAe;AAAA;AAAA,IAEf,aAAa;AAAA,IACb,cAAc;AAAA,IACd,UAAU;AAAA,IACV,mBAAmB;AAAA;AAAA,MAEjB;AAAA;AAAA,MAEA;AAAA;AAAA,MAEA;AAAA,IACF;AAAA,EACF;AAAA,EACA;AAAA;AAAA,IAEE,SAAS;AAAA,IACT,eAAe;AAAA;AAAA,IAEf,aAAa;AAAA,IACb,cAAc;AAAA,IACd,UAAU;AAAA,IACV,mBAAmB;AAAA;AAAA,MAEjB;AAAA;AAAA,MAEA;AAAA;AAAA,MAEA;AAAA,IACF;AAAA,EACF;AACF;AAEO,IAAM,mBAA8B,SAAS;AAAA,EAClD,CAAC,YAAY,QAAQ;AACvB;;;AC9CA,SAAuB,WAAW,gBAAgB,mBAAmB;AAO9D,IAAM,iBAAiB,C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;AAAA,IACF,EAAE,MAAM,SAAU,OAAc;AAC9B,cAAQ,KAAK,yBAAyB,KAAK;AAAA,IAC7C,CAAC;AAED,QAAI,CAAC,sBAAsB;AACzB;AAAA,IACF;AAEA,UAAM,wBAGF;AAAA,MACF,UAAU;AAAA,MACV,SAAS;AAAA,IACX;AAEA,YAAQ;AAAA,MACN,sBAAsB,qBAAqB,MAAM;AAAA,MACjD;AAAA,IACF;AAAA,EACF,SAAS,OAAO;AACd,YAAQ,KAAK,oBAAoB,KAAc;AAAA,EACjD,UAAE;AACA,YAAQ,KAAK,wBAAwB;AAAA,EACvC;AACF;AAEK,IAAM,gBAAgB,IAAI,SAC/BE,gBAAoC,iBAAiB,GAAG,IAAI,CAAC;AAExD,IAAM,sBAAsB,CAAC;AAAA,EAClC;AACF,MAGEC,oBAAmB;AAAA,EACjB,KAAK;AAAA,EACL,MAAM,CAAC,iBAAiB;AAAA,EACxB,cAAc;AAChB,CAAC;",
|
|
6
|
+
"names": ["readContract", "readContract", "readContract", "readContract", "readContract", "readContract", "readContract", "readContract", "readContract", "readContract", "readContract", "readContract", "readContract", "readContract", "readContract", "readContract", "readContract", "readContract", "readContract", "readContract", "readContract", "readContract", "readContract", "readContract", "readContract", "readContract", "isAddress", "isAddressEqual", "zeroAddress", "isAddress", "isAddressEqual", "zeroAddress", "toPromiseEvent", "encodeFunctionData", "isAddress", "isAddressEqual", "zeroAddress", "waitForTransactionReceipt", "writeContract", "isAddress", "isAddressEqual", "zeroAddress", "waitForTransactionReceipt", "writeContract", "toPromiseEvent", "encodeFunctionData", "toPromiseEvent", "encodeFunctionData", "isAddress", "isAddressEqual", "zeroAddress", "waitForTransactionReceipt", "writeContract", "allowance", "approve", "isAddress", "isAddressEqual", "zeroAddress", "allowance", "approve", "waitForTransactionReceipt", "writeContract", "toPromiseEvent", "encodeFunctionData", "toPromiseEvent", "encodeFunctionData", "isAddress", "isAddressEqual", "zeroAddress", "waitForTransactionReceipt", "writeContract", "allowance", "approve", "isAddress", "isAddressEqual", "zeroAddress", "allowance", "approve", "waitForTransactionReceipt", "writeContract", "toPromiseEvent", "encodeFunctionData"]
|
|
7
|
+
}
|
package/_esm/index.js
CHANGED
|
@@ -1,33 +1,59 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
import {
|
|
2
|
+
cancelRedeemRequest,
|
|
3
|
+
deposit,
|
|
4
|
+
gatewayAbi,
|
|
5
|
+
gatewayAddresses,
|
|
6
|
+
gateways,
|
|
7
|
+
getGateway,
|
|
8
|
+
getMaxMint,
|
|
9
|
+
getMaxWithdraw,
|
|
10
|
+
getMintFee,
|
|
11
|
+
getPeggedToken,
|
|
12
|
+
getRedeemFee,
|
|
13
|
+
getRedeemRequest,
|
|
14
|
+
getTreasury,
|
|
15
|
+
getWithdrawalDelay,
|
|
16
|
+
getWithdrawalDelayEnabled,
|
|
17
|
+
isInstantRedeemWhitelisted,
|
|
18
|
+
previewDeposit,
|
|
19
|
+
previewRedeem,
|
|
20
|
+
previewWithdraw,
|
|
21
|
+
redeem,
|
|
22
|
+
requestRedeem
|
|
23
|
+
} from "./chunk-ZE4YZMXK.js";
|
|
24
|
+
|
|
25
|
+
// src/gatewayAddresses.ts
|
|
26
|
+
var gateways2 = gateways;
|
|
27
|
+
var gatewayAddresses2 = gatewayAddresses;
|
|
28
|
+
|
|
29
|
+
// src/index.ts
|
|
30
|
+
var gatewayPublicActions = () => (client) => ({
|
|
31
|
+
getGateway: (params) => getGateway(client, params),
|
|
32
|
+
getMaxMint: (params) => getMaxMint(client, params),
|
|
33
|
+
getMaxWithdraw: (params) => getMaxWithdraw(client, params),
|
|
34
|
+
getMintFee: (params) => getMintFee(client, params),
|
|
35
|
+
getPeggedToken: (params) => getPeggedToken(client, params),
|
|
36
|
+
getRedeemFee: (params) => getRedeemFee(client, params),
|
|
37
|
+
getRedeemRequest: (params) => getRedeemRequest(client, params),
|
|
38
|
+
getTreasury: (params) => getTreasury(client, params),
|
|
39
|
+
getWithdrawalDelay: (params) => getWithdrawalDelay(client, params),
|
|
40
|
+
getWithdrawalDelayEnabled: (params) => getWithdrawalDelayEnabled(client, params),
|
|
41
|
+
isInstantRedeemWhitelisted: (params) => isInstantRedeemWhitelisted(client, params),
|
|
42
|
+
previewDeposit: (params) => previewDeposit(client, params),
|
|
43
|
+
previewRedeem: (params) => previewRedeem(client, params),
|
|
44
|
+
previewWithdraw: (params) => previewWithdraw(client, params)
|
|
26
45
|
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
46
|
+
var gatewayWalletActions = () => (client) => ({
|
|
47
|
+
cancelRedeemRequest: (params) => cancelRedeemRequest(client, params),
|
|
48
|
+
deposit: (params) => deposit(client, params),
|
|
49
|
+
redeem: (params) => redeem(client, params),
|
|
50
|
+
requestRedeem: (params) => requestRedeem(client, params)
|
|
32
51
|
});
|
|
33
|
-
|
|
52
|
+
export {
|
|
53
|
+
gatewayAbi,
|
|
54
|
+
gatewayAddresses2 as gatewayAddresses,
|
|
55
|
+
gatewayPublicActions,
|
|
56
|
+
gatewayWalletActions,
|
|
57
|
+
gateways2 as gateways
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=index.js.map
|
package/_esm/index.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/gatewayAddresses.ts", "../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n gatewayAddresses as coreGatewayAddresses,\n gateways as coreGateways,\n} from \"@vetro-protocol/core\";\nimport type { Address } from \"viem\";\n\nexport type Gateway = {\n address: Address;\n // Portal-API symbol used to convert this gateway's peg unit into USD.\n // \"USD\" is treated as identity (no conversion needed).\n pegBaseSymbol: string;\n};\n\nexport const gateways: Gateway[] = coreGateways;\n\nexport const gatewayAddresses: Address[] = coreGatewayAddresses;\n", "import type { Client, WalletClient } from \"viem\";\n\nimport {\n getGateway,\n getMaxMint,\n getMaxWithdraw,\n getMintFee,\n getPeggedToken,\n getRedeemFee,\n getRedeemRequest,\n getTreasury,\n getWithdrawalDelay,\n getWithdrawalDelayEnabled,\n isInstantRedeemWhitelisted,\n previewDeposit,\n previewRedeem,\n previewWithdraw,\n} from \"./actions/public/index.ts\";\nimport {\n type CancelRedeemRequestParams,\n cancelRedeemRequest,\n} from \"./actions/wallet/cancelRedeemRequest.ts\";\nimport { type DepositParams, deposit } from \"./actions/wallet/deposit.ts\";\nimport { type RedeemParams, redeem } from \"./actions/wallet/redeem.ts\";\nimport {\n type RequestRedeemParams,\n requestRedeem,\n} from \"./actions/wallet/requestRedeem.ts\";\n\n// Export ABI\nexport { gatewayAbi } from \"./abi/gatewayAbi.ts\";\n// Export gateway addresses and per-gateway peg-base metadata\nexport {\n type Gateway,\n gatewayAddresses,\n gateways,\n} from \"./gatewayAddresses.ts\";\n\nexport type { CancelRedeemRequestParams };\n\nexport {\n type CancelRedeemRequestEvents,\n type DepositEvents,\n type RedeemEvents,\n type RequestRedeemEvents,\n} from \"./types.ts\";\n\n// Export factory functions for .extend() pattern\nexport const gatewayPublicActions = () => (client: Client) => ({\n getGateway: (params: Parameters<typeof getGateway>[1]) =>\n getGateway(client, params),\n getMaxMint: (params: Parameters<typeof getMaxMint>[1]) =>\n getMaxMint(client, params),\n getMaxWithdraw: (params: Parameters<typeof getMaxWithdraw>[1]) =>\n getMaxWithdraw(client, params),\n getMintFee: (params: Parameters<typeof getMintFee>[1]) =>\n getMintFee(client, params),\n getPeggedToken: (params: Parameters<typeof getPeggedToken>[1]) =>\n getPeggedToken(client, params),\n getRedeemFee: (params: Parameters<typeof getRedeemFee>[1]) =>\n getRedeemFee(client, params),\n getRedeemRequest: (params: Parameters<typeof getRedeemRequest>[1]) =>\n getRedeemRequest(client, params),\n getTreasury: (params: Parameters<typeof getTreasury>[1]) =>\n getTreasury(client, params),\n getWithdrawalDelay: (params: Parameters<typeof getWithdrawalDelay>[1]) =>\n getWithdrawalDelay(client, params),\n getWithdrawalDelayEnabled: (\n params: Parameters<typeof getWithdrawalDelayEnabled>[1],\n ) => getWithdrawalDelayEnabled(client, params),\n isInstantRedeemWhitelisted: (\n params: Parameters<typeof isInstantRedeemWhitelisted>[1],\n ) => isInstantRedeemWhitelisted(client, params),\n previewDeposit: (params: Parameters<typeof previewDeposit>[1]) =>\n previewDeposit(client, params),\n previewRedeem: (params: Parameters<typeof previewRedeem>[1]) =>\n previewRedeem(client, params),\n previewWithdraw: (params: Parameters<typeof previewWithdraw>[1]) =>\n previewWithdraw(client, params),\n});\n\nexport const gatewayWalletActions = () => (client: WalletClient) => ({\n cancelRedeemRequest: (params: CancelRedeemRequestParams) =>\n cancelRedeemRequest(client, params),\n deposit: (params: DepositParams) => deposit(client, params),\n redeem: (params: RedeemParams) => redeem(client, params),\n requestRedeem: (params: RequestRedeemParams) => requestRedeem(client, params),\n});\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAaO,IAAMA,YAAsB;AAE5B,IAAMC,oBAA8B;;;ACiCpC,IAAM,uBAAuB,MAAM,CAAC,YAAoB;AAAA,EAC7D,YAAY,CAAC,WACX,WAAW,QAAQ,MAAM;AAAA,EAC3B,YAAY,CAAC,WACX,WAAW,QAAQ,MAAM;AAAA,EAC3B,gBAAgB,CAAC,WACf,eAAe,QAAQ,MAAM;AAAA,EAC/B,YAAY,CAAC,WACX,WAAW,QAAQ,MAAM;AAAA,EAC3B,gBAAgB,CAAC,WACf,eAAe,QAAQ,MAAM;AAAA,EAC/B,cAAc,CAAC,WACb,aAAa,QAAQ,MAAM;AAAA,EAC7B,kBAAkB,CAAC,WACjB,iBAAiB,QAAQ,MAAM;AAAA,EACjC,aAAa,CAAC,WACZ,YAAY,QAAQ,MAAM;AAAA,EAC5B,oBAAoB,CAAC,WACnB,mBAAmB,QAAQ,MAAM;AAAA,EACnC,2BAA2B,CACzB,WACG,0BAA0B,QAAQ,MAAM;AAAA,EAC7C,4BAA4B,CAC1B,WACG,2BAA2B,QAAQ,MAAM;AAAA,EAC9C,gBAAgB,CAAC,WACf,eAAe,QAAQ,MAAM;AAAA,EAC/B,eAAe,CAAC,WACd,cAAc,QAAQ,MAAM;AAAA,EAC9B,iBAAiB,CAAC,WAChB,gBAAgB,QAAQ,MAAM;AAClC;AAEO,IAAM,uBAAuB,MAAM,CAAC,YAA0B;AAAA,EACnE,qBAAqB,CAAC,WACpB,oBAAoB,QAAQ,MAAM;AAAA,EACpC,SAAS,CAAC,WAA0B,QAAQ,QAAQ,MAAM;AAAA,EAC1D,QAAQ,CAAC,WAAyB,OAAO,QAAQ,MAAM;AAAA,EACvD,eAAe,CAAC,WAAgC,cAAc,QAAQ,MAAM;AAC9E;",
|
|
6
|
+
"names": ["gateways", "gatewayAddresses"]
|
|
7
|
+
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
export * from "./public/getGateway.
|
|
2
|
-
export * from "./public/getMaxMint.
|
|
3
|
-
export * from "./public/getMaxWithdraw.
|
|
4
|
-
export * from "./public/getPeggedToken.
|
|
5
|
-
export * from "./public/getMintFee.
|
|
6
|
-
export * from "./public/getRedeemFee.
|
|
7
|
-
export * from "./public/getRedeemRequest.
|
|
8
|
-
export * from "./public/getTreasury.
|
|
9
|
-
export * from "./public/getWithdrawalDelayEnabled.
|
|
10
|
-
export * from "./public/getWithdrawalDelay.
|
|
11
|
-
export * from "./public/isInstantRedeemWhitelisted.
|
|
12
|
-
export * from "./public/previewDeposit.
|
|
13
|
-
export * from "./public/previewRedeem.
|
|
14
|
-
export * from "./public/previewWithdraw.
|
|
15
|
-
export * from "./wallet/cancelRedeemRequest.
|
|
16
|
-
export * from "./wallet/deposit.
|
|
17
|
-
export * from "./wallet/redeem.
|
|
18
|
-
export * from "./wallet/requestRedeem.
|
|
1
|
+
export * from "./public/getGateway.ts";
|
|
2
|
+
export * from "./public/getMaxMint.ts";
|
|
3
|
+
export * from "./public/getMaxWithdraw.ts";
|
|
4
|
+
export * from "./public/getPeggedToken.ts";
|
|
5
|
+
export * from "./public/getMintFee.ts";
|
|
6
|
+
export * from "./public/getRedeemFee.ts";
|
|
7
|
+
export * from "./public/getRedeemRequest.ts";
|
|
8
|
+
export * from "./public/getTreasury.ts";
|
|
9
|
+
export * from "./public/getWithdrawalDelayEnabled.ts";
|
|
10
|
+
export * from "./public/getWithdrawalDelay.ts";
|
|
11
|
+
export * from "./public/isInstantRedeemWhitelisted.ts";
|
|
12
|
+
export * from "./public/previewDeposit.ts";
|
|
13
|
+
export * from "./public/previewRedeem.ts";
|
|
14
|
+
export * from "./public/previewWithdraw.ts";
|
|
15
|
+
export * from "./wallet/cancelRedeemRequest.ts";
|
|
16
|
+
export * from "./wallet/deposit.ts";
|
|
17
|
+
export * from "./wallet/redeem.ts";
|
|
18
|
+
export * from "./wallet/requestRedeem.ts";
|
|
19
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getGateway.d.ts","sourceRoot":"","sources":["../../../src/actions/public/getGateway.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getGateway.d.ts","sourceRoot":"","sources":["../../../src/actions/public/getGateway.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AAKjD;;;;;;GAMG;AACH,wBAAsB,UAAU,CAC9B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE;IACV,OAAO,EAAE,OAAO,CAAC;CAClB,0BAsBF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getMaxMint.d.ts","sourceRoot":"","sources":["../../../src/actions/public/getMaxMint.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getMaxMint.d.ts","sourceRoot":"","sources":["../../../src/actions/public/getMaxMint.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AAKjD,wBAAsB,UAAU,CAC9B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE;IACV,OAAO,EAAE,OAAO,CAAC;CAClB,mBAsBF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getMaxWithdraw.d.ts","sourceRoot":"","sources":["../../../src/actions/public/getMaxWithdraw.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getMaxWithdraw.d.ts","sourceRoot":"","sources":["../../../src/actions/public/getMaxWithdraw.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AAKjD,wBAAsB,cAAc,CAClC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE;IACV,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB,mBA4BF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getMintFee.d.ts","sourceRoot":"","sources":["../../../src/actions/public/getMintFee.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getMintFee.d.ts","sourceRoot":"","sources":["../../../src/actions/public/getMintFee.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AAKjD,wBAAsB,UAAU,CAC9B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE;IACV,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;CAChB,mBA4BF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPeggedToken.d.ts","sourceRoot":"","sources":["../../../src/actions/public/getPeggedToken.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getPeggedToken.d.ts","sourceRoot":"","sources":["../../../src/actions/public/getPeggedToken.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AAKjD,wBAAsB,cAAc,CAClC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE;IACV,OAAO,EAAE,OAAO,CAAC;CAClB,0BAsBF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRedeemFee.d.ts","sourceRoot":"","sources":["../../../src/actions/public/getRedeemFee.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getRedeemFee.d.ts","sourceRoot":"","sources":["../../../src/actions/public/getRedeemFee.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AAKjD,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE;IACV,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;CAChB,mBA4BF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRedeemRequest.d.ts","sourceRoot":"","sources":["../../../src/actions/public/getRedeemRequest.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getRedeemRequest.d.ts","sourceRoot":"","sources":["../../../src/actions/public/getRedeemRequest.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AAKjD,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE;IACV,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;CACf,sCA4BF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTreasury.d.ts","sourceRoot":"","sources":["../../../src/actions/public/getTreasury.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getTreasury.d.ts","sourceRoot":"","sources":["../../../src/actions/public/getTreasury.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AAKjD,wBAAsB,WAAW,CAC/B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE;IACV,OAAO,EAAE,OAAO,CAAC;CAClB,0BAsBF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getWithdrawalDelay.d.ts","sourceRoot":"","sources":["../../../src/actions/public/getWithdrawalDelay.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getWithdrawalDelay.d.ts","sourceRoot":"","sources":["../../../src/actions/public/getWithdrawalDelay.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AAKjD,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE;IACV,OAAO,EAAE,OAAO,CAAC;CAClB,mBAsBF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getWithdrawalDelayEnabled.d.ts","sourceRoot":"","sources":["../../../src/actions/public/getWithdrawalDelayEnabled.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getWithdrawalDelayEnabled.d.ts","sourceRoot":"","sources":["../../../src/actions/public/getWithdrawalDelayEnabled.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AAKjD,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,MAAM,EACd,UAAU,EAAE;IACV,OAAO,EAAE,OAAO,CAAC;CAClB,oBAsBF"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export * from "./getGateway.
|
|
2
|
-
export * from "./getMaxMint.
|
|
3
|
-
export * from "./getMaxWithdraw.
|
|
4
|
-
export * from "./getMintFee.
|
|
5
|
-
export * from "./getPeggedToken.
|
|
6
|
-
export * from "./getRedeemFee.
|
|
7
|
-
export * from "./getRedeemRequest.
|
|
8
|
-
export * from "./getTreasury.
|
|
9
|
-
export * from "./getWithdrawalDelay.
|
|
10
|
-
export * from "./getWithdrawalDelayEnabled.
|
|
11
|
-
export * from "./isInstantRedeemWhitelisted.
|
|
12
|
-
export * from "./previewDeposit.
|
|
13
|
-
export * from "./previewRedeem.
|
|
14
|
-
export * from "./previewWithdraw.
|
|
1
|
+
export * from "./getGateway.ts";
|
|
2
|
+
export * from "./getMaxMint.ts";
|
|
3
|
+
export * from "./getMaxWithdraw.ts";
|
|
4
|
+
export * from "./getMintFee.ts";
|
|
5
|
+
export * from "./getPeggedToken.ts";
|
|
6
|
+
export * from "./getRedeemFee.ts";
|
|
7
|
+
export * from "./getRedeemRequest.ts";
|
|
8
|
+
export * from "./getTreasury.ts";
|
|
9
|
+
export * from "./getWithdrawalDelay.ts";
|
|
10
|
+
export * from "./getWithdrawalDelayEnabled.ts";
|
|
11
|
+
export * from "./isInstantRedeemWhitelisted.ts";
|
|
12
|
+
export * from "./previewDeposit.ts";
|
|
13
|
+
export * from "./previewRedeem.ts";
|
|
14
|
+
export * from "./previewWithdraw.ts";
|
|
15
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isInstantRedeemWhitelisted.d.ts","sourceRoot":"","sources":["../../../src/actions/public/isInstantRedeemWhitelisted.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"isInstantRedeemWhitelisted.d.ts","sourceRoot":"","sources":["../../../src/actions/public/isInstantRedeemWhitelisted.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AAKjD,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,MAAM,EACd,UAAU,EAAE;IACV,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;CAClB,oBA4BF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"previewDeposit.d.ts","sourceRoot":"","sources":["../../../src/actions/public/previewDeposit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"previewDeposit.d.ts","sourceRoot":"","sources":["../../../src/actions/public/previewDeposit.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AAKjD,wBAAsB,cAAc,CAClC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE;IACV,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,mBAoCF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"previewRedeem.d.ts","sourceRoot":"","sources":["../../../src/actions/public/previewRedeem.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"previewRedeem.d.ts","sourceRoot":"","sources":["../../../src/actions/public/previewRedeem.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AAKjD,wBAAsB,aAAa,CACjC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE;IACV,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACvB,mBAoCF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"previewWithdraw.d.ts","sourceRoot":"","sources":["../../../src/actions/public/previewWithdraw.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"previewWithdraw.d.ts","sourceRoot":"","sources":["../../../src/actions/public/previewWithdraw.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AAKjD,wBAAsB,eAAe,CACnC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE;IACV,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB,mBAoCF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from "events";
|
|
2
2
|
import { type Address, type WalletClient } from "viem";
|
|
3
|
-
import type { CancelRedeemRequestEvents } from "../../types.
|
|
3
|
+
import type { CancelRedeemRequestEvents } from "../../types.ts";
|
|
4
4
|
export type CancelRedeemRequestParams = {
|
|
5
5
|
gatewayAddress: Address;
|
|
6
6
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from "events";
|
|
2
2
|
import { type Address, type WalletClient } from "viem";
|
|
3
|
-
import type { DepositEvents } from "../../types.
|
|
3
|
+
import type { DepositEvents } from "../../types.ts";
|
|
4
4
|
export type DepositParams = {
|
|
5
5
|
amountIn: bigint;
|
|
6
6
|
approveAmount?: bigint;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from "events";
|
|
2
2
|
import { type Address, type WalletClient } from "viem";
|
|
3
|
-
import type { RedeemEvents } from "../../types.
|
|
3
|
+
import type { RedeemEvents } from "../../types.ts";
|
|
4
4
|
export type RedeemParams = {
|
|
5
5
|
approveAmount?: bigint;
|
|
6
6
|
gatewayAddress: Address;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from "events";
|
|
2
2
|
import { type Address, type WalletClient } from "viem";
|
|
3
|
-
import type { RequestRedeemEvents } from "../../types.
|
|
3
|
+
import type { RequestRedeemEvents } from "../../types.ts";
|
|
4
4
|
export type RequestRedeemParams = {
|
|
5
5
|
approveAmount?: bigint;
|
|
6
6
|
gatewayAddress: Address;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gatewayAddresses.d.ts","sourceRoot":"","sources":["../src/gatewayAddresses.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gatewayAddresses.d.ts","sourceRoot":"","sources":["../src/gatewayAddresses.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,MAAM,MAAM,OAAO,GAAG;IACpB,OAAO,EAAE,OAAO,CAAC;IAGjB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,OAAO,EAAiB,CAAC;AAEhD,eAAO,MAAM,gBAAgB,EAAE,OAAO,EAAyB,CAAC"}
|
package/_types/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { Client, WalletClient } from "viem";
|
|
2
|
-
import { getGateway, getMaxMint, getMaxWithdraw, getMintFee, getPeggedToken, getRedeemFee, getRedeemRequest, getTreasury, getWithdrawalDelay, getWithdrawalDelayEnabled, isInstantRedeemWhitelisted, previewDeposit, previewRedeem, previewWithdraw } from "./actions/public/index.
|
|
3
|
-
import { type CancelRedeemRequestParams } from "./actions/wallet/cancelRedeemRequest.
|
|
4
|
-
import { type DepositParams } from "./actions/wallet/deposit.
|
|
5
|
-
import { type RedeemParams } from "./actions/wallet/redeem.
|
|
6
|
-
import { type RequestRedeemParams } from "./actions/wallet/requestRedeem.
|
|
7
|
-
export { gatewayAbi } from "./abi/gatewayAbi.
|
|
8
|
-
export { type Gateway, gatewayAddresses, gateways, } from "./gatewayAddresses.
|
|
2
|
+
import { getGateway, getMaxMint, getMaxWithdraw, getMintFee, getPeggedToken, getRedeemFee, getRedeemRequest, getTreasury, getWithdrawalDelay, getWithdrawalDelayEnabled, isInstantRedeemWhitelisted, previewDeposit, previewRedeem, previewWithdraw } from "./actions/public/index.ts";
|
|
3
|
+
import { type CancelRedeemRequestParams } from "./actions/wallet/cancelRedeemRequest.ts";
|
|
4
|
+
import { type DepositParams } from "./actions/wallet/deposit.ts";
|
|
5
|
+
import { type RedeemParams } from "./actions/wallet/redeem.ts";
|
|
6
|
+
import { type RequestRedeemParams } from "./actions/wallet/requestRedeem.ts";
|
|
7
|
+
export { gatewayAbi } from "./abi/gatewayAbi.ts";
|
|
8
|
+
export { type Gateway, gatewayAddresses, gateways, } from "./gatewayAddresses.ts";
|
|
9
9
|
export type { CancelRedeemRequestParams };
|
|
10
|
-
export { type CancelRedeemRequestEvents, type DepositEvents, type RedeemEvents, type RequestRedeemEvents, } from "./types.
|
|
10
|
+
export { type CancelRedeemRequestEvents, type DepositEvents, type RedeemEvents, type RequestRedeemEvents, } from "./types.ts";
|
|
11
11
|
export declare const gatewayPublicActions: () => (client: Client) => {
|
|
12
12
|
getGateway: (params: Parameters<typeof getGateway>[1]) => Promise<`0x${string}`>;
|
|
13
13
|
getMaxMint: (params: Parameters<typeof getMaxMint>[1]) => Promise<bigint>;
|
|
@@ -26,19 +26,19 @@ export declare const gatewayPublicActions: () => (client: Client) => {
|
|
|
26
26
|
};
|
|
27
27
|
export declare const gatewayWalletActions: () => (client: WalletClient) => {
|
|
28
28
|
cancelRedeemRequest: (params: CancelRedeemRequestParams) => {
|
|
29
|
-
emitter: import("events")<import("./types.
|
|
29
|
+
emitter: import("events")<import("./types.ts").CancelRedeemRequestEvents>;
|
|
30
30
|
promise: Promise<void>;
|
|
31
31
|
};
|
|
32
32
|
deposit: (params: DepositParams) => {
|
|
33
|
-
emitter: import("events")<import("./types.
|
|
33
|
+
emitter: import("events")<import("./types.ts").DepositEvents>;
|
|
34
34
|
promise: Promise<void>;
|
|
35
35
|
};
|
|
36
36
|
redeem: (params: RedeemParams) => {
|
|
37
|
-
emitter: import("events")<import("./types.
|
|
37
|
+
emitter: import("events")<import("./types.ts").RedeemEvents>;
|
|
38
38
|
promise: Promise<void>;
|
|
39
39
|
};
|
|
40
40
|
requestRedeem: (params: RequestRedeemParams) => {
|
|
41
|
-
emitter: import("events")<import("./types.
|
|
41
|
+
emitter: import("events")<import("./types.ts").RequestRedeemEvents>;
|
|
42
42
|
promise: Promise<void>;
|
|
43
43
|
};
|
|
44
44
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vetro-protocol/gateway",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Vetro Protocol gateway actions for viem.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -17,15 +17,16 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"to-promise-event": "1.0.0",
|
|
20
|
-
"viem-erc20": "2.2.
|
|
20
|
+
"viem-erc20": "2.2.1"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@tsconfig/node24": "24.0.4",
|
|
24
24
|
"@types/node": "24.1.0",
|
|
25
|
-
"@vitest/coverage-v8": "
|
|
25
|
+
"@vitest/coverage-v8": "5.0.1",
|
|
26
26
|
"typescript": "5.9.3",
|
|
27
27
|
"viem": "2.44.4",
|
|
28
|
-
"vitest": "
|
|
28
|
+
"vitest": "5.0.1",
|
|
29
|
+
"@vetro-protocol/core": "1.0.0"
|
|
29
30
|
},
|
|
30
31
|
"peerDependencies": {
|
|
31
32
|
"viem": "^2.x"
|
|
@@ -53,8 +54,9 @@
|
|
|
53
54
|
"sideEffects": false,
|
|
54
55
|
"scripts": {
|
|
55
56
|
"build": "tsc --noEmit",
|
|
56
|
-
"
|
|
57
|
+
"postbuild": "pnpm bundle && pnpm build:types",
|
|
57
58
|
"build:types": "tsc -p tsconfig.build.json --declarationDir ./_types --emitDeclarationOnly --declaration --declarationMap",
|
|
59
|
+
"bundle": "node ../../scripts/bundle-package.js",
|
|
58
60
|
"clean": "rm -rf ./_esm ./_types",
|
|
59
61
|
"test": "vitest run",
|
|
60
62
|
"test:coverage": "vitest run --coverage"
|