Skip to content

Commit

Permalink
Pass account with teller params
Browse files Browse the repository at this point in the history
  • Loading branch information
9inpachi committed Oct 2, 2024
1 parent fa998ad commit 16c6caa
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions lib/contracts/handlers/nucleus-teller-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { NUCLEUS_TELLER_ABIS } from '../abis/nucleus-teller-abis';
import { Token, TOKENS_ADDRESSES } from '../tokens';

export type DepositWithPermitParams = {
account: Address;
depositAsset: Address;
depositAmount: bigint;
minimumMint: bigint;
Expand Down Expand Up @@ -147,8 +148,8 @@ export class NucleusTellerHandler {
/**
* Deposit an asset/token for staking with a permit.
*
* @param walletAddress Address of the caller of the transaction.
* @param params Permit parameters.
* @param params.account Address of the caller of the transaction.
* @param params.depositAsset Address of the asset/token to deposit.
* @param params.depositAmount Amount of the asset/token to deposit.
* @param params.minimumMint Minimum amount of shares to mint.
Expand All @@ -162,26 +163,31 @@ export class NucleusTellerHandler {
* `estimate: () => Promise<bigint>` - Gas estimate of the
* transaction.
*/
public depositWithPermit(
walletAddress: Address,
params: DepositWithPermitParams,
) {
const { depositAsset, depositAmount, minimumMint, deadline, v, r, s } =
params;
public depositWithPermit(params: DepositWithPermitParams) {
const {
account,
depositAsset,
depositAmount,
minimumMint,
deadline,
v,
r,
s,
} = params;

const transact = () =>
this.getContract().write.depositWithPermit(
[depositAsset, depositAmount, minimumMint, deadline, v, r, s],
{
account: walletAddress,
account,
chain: this.viemChain,
},
);
const estimate = () =>
this.getContract().estimateGas.depositWithPermit(
[depositAsset, depositAmount, minimumMint, deadline, v, r, s],
{
account: walletAddress,
account,
},
);

Expand Down

0 comments on commit 16c6caa

Please sign in to comment.