Skip to main content

contracts/handlers/puf-locker-handler

Classes

PufLockerHandler

Defined in: lib/contracts/handlers/puf-locker-handler.ts:29

Handler for the PufLocker contract exposing methods to interact with the contract.

Constructors

Constructor

new PufLockerHandler(chain, walletClient, publicClient): PufLockerHandler

Defined in: lib/contracts/handlers/puf-locker-handler.ts:43

Create the handler for the PufLocker contract exposing methods to interact with the contract.

Parameters
ParameterTypeDescription
chainChainChain to use for the client.
walletClient{ }The wallet client to use for wallet interactions.
publicClient{ }The public client to use for public interactions.
Returns

PufLockerHandler

Methods

deposit()

deposit(depositParams): Promise<{ estimate: () => Promise<bigint>; transact: () => Promise<`0x${string}`>; }>

Defined in: lib/contracts/handlers/puf-locker-handler.ts:140

Deposit the given PufToken into the locker. This doesn't make the transaction but returns two methods namely transact and estimate.

Parameters
ParameterType
depositParamsLockerDepositParams
Returns

Promise<{ estimate: () => Promise<bigint>; transact: () => Promise<`0x${string}`>; }>

transact: () => Promise<Address> - Used to make the transaction.

estimate: () => Promise<bigint> - Gas estimate of the transaction.

getAllDeposits()

getAllDeposits(pufToken, walletAddress): Promise<readonly object[]>

Defined in: lib/contracts/handlers/puf-locker-handler.ts:81

Get all deposits of the given account address.

Parameters
ParameterTypeDescription
pufTokenAnyTokenThe PufToken to get the deposits for.
walletAddress`0x${string}`The wallet address to get the deposits for.
Returns

Promise<readonly object[]>

The amount and deposits of the given account address.

getContract()

getContract(): object

Defined in: lib/contracts/handlers/puf-locker-handler.ts:62

Get the contract. This is a method because the typings are complex and lost when trying to make it a member.

Returns

object

The viem contract.

getDeposits()

getDeposits(pufToken, userAddress, start, limit): Promise<readonly object[]>

Defined in: lib/contracts/handlers/puf-locker-handler.ts:97

Get the user's deposits for the given token and deposit index.

Parameters
ParameterTypeDescription
pufTokenAnyTokenPufToken to get the deposits of.
userAddress`0x${string}`User address to get the deposits for.
startbigintThe starting index of the deposits.
limitbigintThe maximum number of deposits to retrieve.
Returns

Promise<readonly object[]>

The amount and release time of the deposits.

getLockPeriods()

getLockPeriods(): Promise<readonly [bigint, bigint]>

Defined in: lib/contracts/handlers/puf-locker-handler.ts:117

Get the minimum and maximum lock periods allowed for deposits.

Returns

Promise<readonly [bigint, bigint]>

The minimum and maximum lock period in seconds. ([minLock, maxLock])

withdraw()

withdraw(pufToken, walletAddress, recipient, depositIndexes): object

Defined in: lib/contracts/handlers/puf-locker-handler.ts:200

Withdraw the deposits identified by the deposit indexes from the locker.

Parameters
ParameterTypeDescription
pufTokenAnyTokenPufToken to withdraw.
walletAddress`0x${string}`Address of the account making the transaction.
recipient`0x${string}`Recipient of the withdrawal.
depositIndexesbigint[]Deposit indexes to withdraw.
Returns

object

Hash of the withdrawal transaction.

estimate()

estimate: () => Promise<bigint>

Returns

Promise<bigint>

transact()

transact: () => Promise<`0x${string}`>

Returns

Promise<`0x${string}`>

Type Aliases

LockerDepositParams

LockerDepositParams = object

Defined in: lib/contracts/handlers/puf-locker-handler.ts:16

Properties

PropertyTypeDefined in
accountAddresslib/contracts/handlers/puf-locker-handler.ts:18
isPreapproved?booleanlib/contracts/handlers/puf-locker-handler.ts:22
lockPeriodbigintlib/contracts/handlers/puf-locker-handler.ts:21
recipientAddresslib/contracts/handlers/puf-locker-handler.ts:19
tokenAnyTokenlib/contracts/handlers/puf-locker-handler.ts:17
valuebigintlib/contracts/handlers/puf-locker-handler.ts:20