diff --git a/lib/api/puffer-client.ts b/lib/api/puffer-client.ts index 1508e0a..2be5454 100644 --- a/lib/api/puffer-client.ts +++ b/lib/api/puffer-client.ts @@ -14,8 +14,7 @@ import { ERC20PermitHandler } from '../contracts/handlers/erc20-permit-handler'; import { PufLockerHandler } from '../contracts/handlers/puf-locker-handler'; import { L2RewardManagerHandler } from '../contracts/handlers/l2-reward-manager-handler'; import { L1RewardManagerHandler } from '../contracts/handlers/l1-reward-manager-handler'; -import { PufferWithdrawalHandler } from '../contracts/handlers/puffer-withdrawal-manager'; - +import { PufferWithdrawalManagerHandler } from '../contracts/handlers/puffer-withdrawal-manager-handler'; /** * The core class and the main entry point of the Puffer SDK. */ @@ -41,7 +40,7 @@ export class PufferClient { /** Handler for the `L1RewardManager` contract. */ public l1RewardManager: L1RewardManagerHandler; /** Handler for the `PufferWithdrawalManager` contract. */ - public pufferWithdrawalManager: PufferWithdrawalHandler; + public pufferWithdrawalManager: PufferWithdrawalManagerHandler; /** * Create the Puffer Client. @@ -113,7 +112,7 @@ export class PufferClient { this.walletClient, this.publicClient, ); - this.pufferWithdrawalManager = new PufferWithdrawalHandler( + this.pufferWithdrawalManager = new PufferWithdrawalManagerHandler( chain, this.walletClient, this.publicClient, diff --git a/lib/contracts/addresses.ts b/lib/contracts/addresses.ts index 8bf5609..cfe1b8b 100644 --- a/lib/contracts/addresses.ts +++ b/lib/contracts/addresses.ts @@ -8,6 +8,7 @@ export const CONTRACT_ADDRESSES = { PufferDepositor: '0x4aa799c5dfc01ee7d790e3bf1a7c2257ce1dceff', PufferL2Depositor: '0x3436E0B85cd929929F5802e792CFE282166E0259', PufLocker: '0x48e8dE138C246c14248C94d2D616a2F9eb4590D2', + PufferWithdrawalManager: '0x8a253974f1de9f64d79f1eaaf850faf406802fce', L2RewardManager: '0xb4dBcf934558d7b647A7FB21bbcd6b8370318A5c', L1RewardManager: '0x5A0B37ce6c5b90B634B2AD32E3d909B545De8BB7', }, @@ -16,6 +17,8 @@ export const CONTRACT_ADDRESSES = { PufferDepositor: '0x824AC05aeb86A0aD770b8acDe0906d2d4a6c4A8c', PufferL2Depositor: '0x0af6998e4828ad8ef8f79a9288d0a861890f791d', PufLocker: '0xa58983ad0899a452b7420bc57228e329d7ba92b6', + // These are deployed on a fork at the moment: + // https://rpc.tenderly.co/fork/f7fd7621-7280-47e5-8521-81b24142814f L1RewardManager: '0x10f970bcb84B82B82a65eBCbF45F26dD26D69F12', L2RewardManager: '0x58C046794f69A8830b0BE737022a45b4acd01dE5', // This is deployed on a fork at the moment: diff --git a/lib/contracts/handlers/puffer-withdrawal-manager.test.ts b/lib/contracts/handlers/puffer-withdrawal-manager-handler.test.ts similarity index 94% rename from lib/contracts/handlers/puffer-withdrawal-manager.test.ts rename to lib/contracts/handlers/puffer-withdrawal-manager-handler.test.ts index c9b3885..f0dc0b2 100644 --- a/lib/contracts/handlers/puffer-withdrawal-manager.test.ts +++ b/lib/contracts/handlers/puffer-withdrawal-manager-handler.test.ts @@ -1,5 +1,4 @@ -import { Address, getContract } from 'viem'; -import { PufferWithdrawalHandler } from './puffer-withdrawal-manager'; +import { PufferWithdrawalManagerHandler } from './puffer-withdrawal-manager-handler'; import { setupTestPublicClient, setupTestWalletClient, @@ -7,21 +6,22 @@ import { import { Chain } from '../../chains/constants'; import { PUFFER_WITHDRAWAL_MANAGER_ABIS } from '../abis/puffer-withdrawal-manager-abis'; import { CONTRACT_ADDRESSES } from '../addresses'; +import { Address, getContract } from 'viem'; jest.mock('viem', () => ({ ...jest.requireActual('viem'), getContract: jest.fn(), })); -describe('PufferWithdrawalHandler', () => { - let handler: PufferWithdrawalHandler; +describe('PufferWithdrawalMangerHandler', () => { + let handler: PufferWithdrawalManagerHandler; const mockChain = Chain.Holesky; const mockAddress = '0x123' as Address; const walletClient = setupTestWalletClient(); const publicClient = setupTestPublicClient(); beforeEach(() => { - handler = new PufferWithdrawalHandler( + handler = new PufferWithdrawalManagerHandler( mockChain, walletClient, publicClient, @@ -181,7 +181,7 @@ describe('PufferWithdrawalHandler', () => { }); const withdrawalIdx = BigInt(5); - const { transact } = await handler.completeQueueWithdrawal( + const { transact } = await handler.completeQueuedWithdrawal( mockAddress, withdrawalIdx, ); @@ -204,7 +204,7 @@ describe('PufferWithdrawalHandler', () => { }); const withdrawalIdx = BigInt(5); - const { estimate } = await handler.completeQueueWithdrawal( + const { estimate } = await handler.completeQueuedWithdrawal( mockAddress, withdrawalIdx, ); diff --git a/lib/contracts/handlers/puffer-withdrawal-manager.ts b/lib/contracts/handlers/puffer-withdrawal-manager-handler.ts similarity index 98% rename from lib/contracts/handlers/puffer-withdrawal-manager.ts rename to lib/contracts/handlers/puffer-withdrawal-manager-handler.ts index f17196d..7efcf76 100644 --- a/lib/contracts/handlers/puffer-withdrawal-manager.ts +++ b/lib/contracts/handlers/puffer-withdrawal-manager-handler.ts @@ -15,7 +15,7 @@ import { Token } from '../tokens'; * Handler for the `PufferWithdrawalsManager` contract exposing methods to * interact with the contract. */ -export class PufferWithdrawalHandler { +export class PufferWithdrawalManagerHandler { private viemChain: ViemChain; private erc20PermitHandler: ERC20PermitHandler; @@ -139,7 +139,7 @@ export class PufferWithdrawalHandler { * @param withdrawalIdx The index of the withdrawal to complete. * @returns The transaction hash of the withdrawal. */ - public async completeQueueWithdrawal( + public async completeQueuedWithdrawal( walletAddress: Address, withdrawalIdx: bigint, ) { diff --git a/lib/main.ts b/lib/main.ts index ef8f48b..225bef7 100644 --- a/lib/main.ts +++ b/lib/main.ts @@ -11,3 +11,4 @@ export * from './contracts/handlers/puf-token-handler'; export * from './contracts/handlers/puffer-depositor-handler'; export * from './contracts/handlers/puffer-l2-depositor-handler'; export * from './contracts/handlers/puffer-vault-handler'; +export * from './contracts/handlers/puffer-withdrawal-manager-handler';