Skip to content

Commit c8ec759

Browse files
committed
fix(typescript): resolve type errors in gasless deposit tests
Add type assertions to test cases that intentionally use invalid chain names for error handling validation. This fixes TypeScript compilation errors while preserving the runtime validation tests. Changes: - test/services/deposits.test.ts: Add 'as GaslessDestination' type assertions to 5 test cases that verify rejection of invalid chain names (Optimism, arbitrum, InvalidChain, empty string) - api-reference/classes/DepositsService.md: Update parameter type documentation from 'string' to 'GaslessDestination' The type assertions allow TypeScript to compile while the tests still properly validate runtime error handling for unsupported chain names.
1 parent 182add9 commit c8ec759

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

typescript/api-reference/classes/DepositsService.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ proper extraData encoding for the destination chain.
466466
| :------ | :------ | :------ |
467467
| `bitcoinRecoveryAddress` | `string` | P2PKH or P2WPKH Bitcoin address for emergency recovery |
468468
| `depositOwner` | `string` | Ethereum address that will receive the minted tBTC. For L1 deposits, this is the user's Ethereum address. For L2 deposits, this is typically the signer's address (obtained from the destination chain BitcoinDepositor). |
469-
| `destinationChainName` | `string` | Target chain name for the deposit. Must be one of the supported chains (case-sensitive): - "L1" - Direct L1 deposits via NativeBTCDepositor - "Arbitrum" - Arbitrum L2 deposits - "Base" - Base L2 deposits - "Sui" - Sui L2 deposits - "StarkNet" - StarkNet L2 deposits (note: capital 'N') Note: "Solana" is not currently supported for gasless deposits |
469+
| `destinationChainName` | [`GaslessDestination`](../README.md#gaslessdestination) | Target chain name for the deposit. Must be one of the supported chains (case-sensitive): - "L1" - Direct L1 deposits via NativeBTCDepositor - "Arbitrum" - Arbitrum L2 deposits - "Base" - Base L2 deposits - "Sui" - Sui L2 deposits - "StarkNet" - StarkNet L2 deposits (note: capital 'N') Note: "Solana" is not currently supported for gasless deposits |
470470

471471
#### Returns
472472

typescript/test/services/deposits.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3263,7 +3263,7 @@ describe("Deposits", () => {
32633263
depositService.initiateGaslessDeposit(
32643264
"mjc2zGWypwpNyDi4ZxGbBNnUA84bfgiwYc",
32653265
"0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb1",
3266-
"Optimism"
3266+
"Optimism" as GaslessDestination
32673267
)
32683268
).to.be.rejectedWith(/Gasless deposits are not supported for chain/)
32693269
})
@@ -3273,7 +3273,7 @@ describe("Deposits", () => {
32733273
depositService.initiateGaslessDeposit(
32743274
"mjc2zGWypwpNyDi4ZxGbBNnUA84bfgiwYc",
32753275
"0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb1",
3276-
"arbitrum"
3276+
"arbitrum" as GaslessDestination
32773277
)
32783278
).to.be.rejectedWith(/Gasless deposits are not supported for chain/)
32793279
})
@@ -3283,7 +3283,7 @@ describe("Deposits", () => {
32833283
await depositService.initiateGaslessDeposit(
32843284
"mjc2zGWypwpNyDi4ZxGbBNnUA84bfgiwYc",
32853285
"0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb1",
3286-
"InvalidChain"
3286+
"InvalidChain" as GaslessDestination
32873287
)
32883288
expect.fail("Should have thrown an error")
32893289
} catch (error: any) {
@@ -3748,7 +3748,7 @@ describe("Deposits", () => {
37483748
depositService.initiateGaslessDeposit(
37493749
"mjc2zGWypwpNyDi4ZxGbBNnUA84bfgiwYc",
37503750
"0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb1",
3751-
"InvalidChain"
3751+
"InvalidChain" as GaslessDestination
37523752
)
37533753
).to.be.rejectedWith(/Gasless deposits are not supported for chain/)
37543754
})
@@ -3758,7 +3758,7 @@ describe("Deposits", () => {
37583758
depositService.initiateGaslessDeposit(
37593759
"mjc2zGWypwpNyDi4ZxGbBNnUA84bfgiwYc",
37603760
"0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb1",
3761-
""
3761+
"" as GaslessDestination
37623762
)
37633763
).to.be.rejectedWith(/Gasless deposits are not supported for chain/)
37643764
})

0 commit comments

Comments
 (0)