Skip to content

Commit fe209f0

Browse files
committed
fix(docs): update type imports and enhance type definitions in Upshift examples
1 parent e9ac467 commit fe209f0

File tree

5 files changed

+31
-25
lines changed

5 files changed

+31
-25
lines changed

examples/developer-hub-javascript/upshift-claim.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
import { web3 } from "hardhat";
1010
import { formatUnits } from "ethers";
1111

12-
import { ITokenizedVaultInstance } from "../../typechain-types/contracts/upshift/ITokenizedVault";
13-
import { IERC20Instance } from "../../typechain-types/@openzeppelin/contracts/token/ERC20/IERC20";
12+
import type { ITokenizedVaultInstance } from "../../typechain-types/contracts/upshift/ITokenizedVault";
13+
import type { IERC20Instance } from "../../typechain-types/@openzeppelin/contracts/token/ERC20/IERC20";
1414

1515
const VAULT_ADDRESS = "0x24c1a47cD5e8473b64EAB2a94515a196E10C7C81";
1616
const RECEIVER_ADDRESS = ""; // Leave empty to use sender's address
@@ -68,7 +68,7 @@ async function getLPTokenInfo(vault: ITokenizedVaultInstance) {
6868

6969
async function previewRedemption(
7070
vault: ITokenizedVaultInstance,
71-
shares: any,
71+
shares: { toString(): string },
7272
refDecimals: number,
7373
refSymbol: string,
7474
) {
@@ -156,8 +156,8 @@ async function executeClaim(
156156
async function verifyClaim(
157157
refToken: IERC20Instance,
158158
receiverAddr: string,
159-
balanceBefore: any,
160-
assetsAfterFee: any,
159+
balanceBefore: { toString(): string },
160+
assetsAfterFee: { toString(): string },
161161
refDecimals: number,
162162
refSymbol: string,
163163
) {

examples/developer-hub-javascript/upshift-deposit.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
import { web3 } from "hardhat";
99
import { parseUnits, formatUnits } from "ethers";
1010

11-
import { ITokenizedVaultInstance } from "../../typechain-types/contracts/upshift/ITokenizedVault";
12-
import { IERC20Instance } from "../../typechain-types/@openzeppelin/contracts/token/ERC20/IERC20";
11+
import type { ITokenizedVaultInstance } from "../../typechain-types/contracts/upshift/ITokenizedVault";
12+
import type { IERC20Instance } from "../../typechain-types/@openzeppelin/contracts/token/ERC20/IERC20";
1313

1414
const VAULT_ADDRESS = "0x24c1a47cD5e8473b64EAB2a94515a196E10C7C81";
1515
const DEPOSIT_AMOUNT = "1";
@@ -30,7 +30,7 @@ async function getReferenceAssetInfo(vault: ITokenizedVaultInstance) {
3030
}
3131

3232
async function checkBalance(
33-
refAsset: any,
33+
refAsset: IERC20Instance,
3434
userAddress: string,
3535
depositAmount: bigint,
3636
decimals: number,
@@ -49,7 +49,7 @@ async function checkBalance(
4949
}
5050

5151
async function checkAndApproveAllowance(
52-
refAsset: any,
52+
refAsset: IERC20Instance,
5353
userAddress: string,
5454
depositAmount: bigint,
5555
decimals: number,
@@ -134,7 +134,7 @@ async function executeDeposit(
134134
async function verifyDeposit(
135135
lpToken: IERC20Instance,
136136
userAddress: string,
137-
lpBalanceBefore: any,
137+
lpBalanceBefore: { toString(): string },
138138
decimals: number,
139139
) {
140140
console.log("\nVerifying deposit...");

examples/developer-hub-javascript/upshift-instant-redeem.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
import { web3 } from "hardhat";
99
import { parseUnits, formatUnits } from "ethers";
1010

11-
import { ITokenizedVaultInstance } from "../../typechain-types/contracts/upshift/ITokenizedVault";
12-
import { IERC20Instance } from "../../typechain-types/@openzeppelin/contracts/token/ERC20/IERC20";
11+
import type { ITokenizedVaultInstance } from "../../typechain-types/contracts/upshift/ITokenizedVault";
12+
import type { IERC20Instance } from "../../typechain-types/@openzeppelin/contracts/token/ERC20/IERC20";
1313

1414
const VAULT_ADDRESS = "0x24c1a47cD5e8473b64EAB2a94515a196E10C7C81";
1515
const SHARES_TO_REDEEM = "1";
@@ -43,7 +43,10 @@ async function getLPTokenInfo(
4343
return { lpToken, lpBalance };
4444
}
4545

46-
function checkLPBalance(lpBalance: any, sharesToRedeem: bigint) {
46+
function checkLPBalance(
47+
lpBalance: { toString(): string },
48+
sharesToRedeem: bigint,
49+
) {
4750
if (BigInt(lpBalance.toString()) < sharesToRedeem) {
4851
console.log("Insufficient LP balance!");
4952
return false;
@@ -78,7 +81,7 @@ async function previewRedemption(
7881
}
7982

8083
async function getAssetBalanceBefore(
81-
refAsset: any,
84+
refAsset: IERC20Instance,
8285
userAddress: string,
8386
decimals: number,
8487
symbol: string,
@@ -111,10 +114,10 @@ async function executeInstantRedeem(
111114

112115
async function verifyRedemption(
113116
lpToken: IERC20Instance,
114-
refAsset: any,
117+
refAsset: IERC20Instance,
115118
userAddress: string,
116-
lpBalanceBefore: any,
117-
assetBalanceBefore: any,
119+
lpBalanceBefore: { toString(): string },
120+
assetBalanceBefore: { toString(): string },
118121
decimals: number,
119122
symbol: string,
120123
) {

examples/developer-hub-javascript/upshift-request-redeem.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
import { web3 } from "hardhat";
1010
import { parseUnits, formatUnits } from "ethers";
1111

12-
import { ITokenizedVaultInstance } from "../../typechain-types/contracts/upshift/ITokenizedVault";
13-
import { IERC20Instance } from "../../typechain-types/@openzeppelin/contracts/token/ERC20/IERC20";
12+
import type { ITokenizedVaultInstance } from "../../typechain-types/contracts/upshift/ITokenizedVault";
13+
import type { IERC20Instance } from "../../typechain-types/@openzeppelin/contracts/token/ERC20/IERC20";
1414

1515
const VAULT_ADDRESS = "0x24c1a47cD5e8473b64EAB2a94515a196E10C7C81";
1616
const SHARES_TO_REDEEM = "1";
@@ -44,7 +44,10 @@ async function getLPTokenInfo(
4444
return { lpToken, lpBalance };
4545
}
4646

47-
function checkLPBalance(lpBalance: any, sharesToRedeem: bigint) {
47+
function checkLPBalance(
48+
lpBalance: { toString(): string },
49+
sharesToRedeem: bigint,
50+
) {
4851
if (BigInt(lpBalance.toString()) < sharesToRedeem) {
4952
console.log("Insufficient LP balance!");
5053
return false;
@@ -158,7 +161,7 @@ async function verifyRequest(
158161
vault: ITokenizedVaultInstance,
159162
lpToken: IERC20Instance,
160163
userAddress: string,
161-
lpBalanceBefore: any,
164+
lpBalanceBefore: { toString(): string },
162165
decimals: number,
163166
) {
164167
const lpBalanceAfter = await lpToken.balanceOf(userAddress);

examples/developer-hub-javascript/upshift-status.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
import { web3 } from "hardhat";
99
import { formatUnits } from "ethers";
1010

11-
import { ITokenizedVaultInstance } from "../../typechain-types/contracts/upshift/ITokenizedVault";
12-
import { IERC20Instance } from "../../typechain-types/@openzeppelin/contracts/token/ERC20/IERC20";
11+
import type { ITokenizedVaultInstance } from "../../typechain-types/contracts/upshift/ITokenizedVault";
12+
import type { IERC20Instance } from "../../typechain-types/@openzeppelin/contracts/token/ERC20/IERC20";
1313

1414
const VAULT_ADDRESS = "0x24c1a47cD5e8473b64EAB2a94515a196E10C7C81";
1515

@@ -77,7 +77,7 @@ async function printWithdrawalEpoch(vault: ITokenizedVaultInstance) {
7777

7878
async function printUserBalances(
7979
userAddress: string,
80-
refAsset: any,
80+
refAsset: IERC20Instance,
8181
lpToken: IERC20Instance,
8282
decimals: number,
8383
symbol: string,
@@ -97,7 +97,7 @@ async function printUserBalances(
9797

9898
async function printAllowances(
9999
userAddress: string,
100-
refAsset: any,
100+
refAsset: IERC20Instance,
101101
lpToken: IERC20Instance,
102102
decimals: number,
103103
symbol: string,

0 commit comments

Comments
 (0)