Skip to content

Commit 0cde75d

Browse files
committed
fix await-thenable lint
1 parent 81131dc commit 0cde75d

File tree

13 files changed

+36
-35
lines changed

13 files changed

+36
-35
lines changed

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
},
2121
},
2222
"rules": {
23+
"@typescript-eslint/await-thenable": "error",
2324
"@typescript-eslint/explicit-module-boundary-types": "off",
2425
"@typescript-eslint/explicit-function-return-type": "off",
2526
"@typescript-eslint/no-use-before-define": "warn",

packages/xchain-cardano/__tests__/client.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,13 @@ describe('Cardano client', () => {
224224
// Test valid address
225225
const validAddress =
226226
'addr1qy8ac7qqy0vtulyl7wntmsxc6wex80gvcyjy33qffrhm7sh927ysx5sftuw0dlft05dz3c7revpf7jx0xnlcjz3g69mq4afdhv'
227-
const validResult = await client.validateAddress(validAddress)
227+
const validResult = client.validateAddress(validAddress)
228228
expect(validResult).toBeTruthy()
229229

230230
// Test invalid address
231231
const invalidAddress =
232232
'addr1qy8ac7qqy0vtulyl7wntmsxc6wex80gvcyjy33qffrhm7sh927ysx5sftuw0dlft05dz3c7revpf7jx0xnlcjz3g69mq4afdhf'
233-
const invalidResult = await client.validateAddress(invalidAddress)
233+
const invalidResult = client.validateAddress(invalidAddress)
234234
expect(invalidResult).toBeFalsy()
235235
})
236236
})

packages/xchain-evm/__tests__/client.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ describe('EVM client', () => {
165165
})
166166

167167
it('Should throw error with invalid phrase', async () => {
168-
await expect(() => {
168+
expect(() => {
169169
new Client({
170170
...avaxParams,
171171
signer: new KeystoreSigner({
@@ -186,7 +186,7 @@ describe('EVM client', () => {
186186

187187
it('Should not have a phrase after purging', async () => {
188188
avaxClient.purgeClient()
189-
await expect(() => avaxClient.getAddress()).toThrow()
189+
expect(() => avaxClient.getAddress()).toThrow()
190190
})
191191

192192
it('Should set new phrase', () => {
@@ -196,7 +196,7 @@ describe('EVM client', () => {
196196
})
197197

198198
it('should fail to set new phrase', async () => {
199-
await expect(() => avaxClient.setPhrase('bad bad phrase')).toThrow()
199+
expect(() => avaxClient.setPhrase('bad bad phrase')).toThrow()
200200
})
201201

202202
it('Should get network', () => {

packages/xchain-evm/src/signers/ledgerSigner.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export class LedgerSigner extends Signer {
6262
const unsignedTx = tx.unsignedSerialized.substring(2)
6363
const resolution = await ledgerService.resolveTransaction(unsignedTx, {}, { externalPlugins: true, erc20: true })
6464

65-
const ethApp = await this.getApp()
65+
const ethApp = this.getApp()
6666

6767
const signatureData = await ethApp.signTransaction(this.getFullDerivationPath(walletIndex), unsignedTx, resolution)
6868

@@ -89,7 +89,7 @@ export class LedgerSigner extends Signer {
8989

9090
const resolution = await ledgerService.resolveTransaction(unsignedTx, {}, { externalPlugins: true, erc20: true })
9191

92-
const ethApp = await this.getApp()
92+
const ethApp = this.getApp()
9393
const signatureData = await ethApp.signTransaction(this.getFullDerivationPath(walletIndex), unsignedTx, resolution)
9494

9595
tx.signature = {

packages/xchain-evm/src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export const estimateCall = async ({
121121
}): Promise<BigNumber> => {
122122
const contract = new Contract(contractAddress, abi, provider)
123123
const estiamtion = await contract.getFunction(funcName).estimateGas(...funcParams)
124-
return await new BigNumber(estiamtion.toString())
124+
return new BigNumber(estiamtion.toString())
125125
}
126126
/**
127127
* Calls a contract function.

packages/xchain-kujira/__tests__/kujira-client.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ describe('Kujira client Integration Tests', () => {
3434
expect(fees.average).toBe(DEFAULT_FEE)
3535
})
3636
it('get explorer address url', async () => {
37-
const url = await xchainClient.getExplorerAddressUrl('kujira1k688m5uq5gqwt2sltvvu0679vnh3ehlslvf9e2')
37+
const url = xchainClient.getExplorerAddressUrl('kujira1k688m5uq5gqwt2sltvvu0679vnh3ehlslvf9e2')
3838
expect(url).toBe('https://finder.kujira.network/harpoon-4/address/kujira1k688m5uq5gqwt2sltvvu0679vnh3ehlslvf9e2')
3939
})
4040
it('get explorer tx url', async () => {
41-
const url = await xchainClient.getExplorerTxUrl('F3131AE603FFDE602217330410DD3ADFB9E21C987DDAA5CCF54F99DB15A6714B')
41+
const url = xchainClient.getExplorerTxUrl('F3131AE603FFDE602217330410DD3ADFB9E21C987DDAA5CCF54F99DB15A6714B')
4242
expect(url).toBe(
4343
'https://finder.kujira.network/harpoon-4/tx/F3131AE603FFDE602217330410DD3ADFB9E21C987DDAA5CCF54F99DB15A6714B',
4444
)

packages/xchain-mayachain-query/__tests__/mayachain-query.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -148,29 +148,29 @@ describe('Mayachain-query tests', () => {
148148
})
149149

150150
it('Should return the number of decimals of Mayachain assets', async () => {
151-
await expect(await mayachainQuery.getAssetDecimals(assetFromStringEx('BTC.BTC') as Asset)).toBe(8)
152-
await expect(await mayachainQuery.getAssetDecimals(assetFromStringEx('BTC/BTC') as SynthAsset)).toBe(8)
153-
await expect(await mayachainQuery.getAssetDecimals(assetFromStringEx('ETH.ETH') as Asset)).toBe(18)
154-
await expect(await mayachainQuery.getAssetDecimals(assetFromStringEx('DASH.DASH') as Asset)).toBe(8)
155-
await expect(await mayachainQuery.getAssetDecimals(assetFromStringEx('KUJI.KUJI') as Asset)).toBe(6)
156-
await expect(await mayachainQuery.getAssetDecimals(assetFromStringEx('THOR.RUNE') as Asset)).toBe(8)
157-
await expect(await mayachainQuery.getAssetDecimals(assetFromStringEx('MAYA.CACAO') as Asset)).toBe(10)
158-
await expect(
151+
expect(await mayachainQuery.getAssetDecimals(assetFromStringEx('BTC.BTC') as Asset)).toBe(8)
152+
expect(await mayachainQuery.getAssetDecimals(assetFromStringEx('BTC/BTC') as SynthAsset)).toBe(8)
153+
expect(await mayachainQuery.getAssetDecimals(assetFromStringEx('ETH.ETH') as Asset)).toBe(18)
154+
expect(await mayachainQuery.getAssetDecimals(assetFromStringEx('DASH.DASH') as Asset)).toBe(8)
155+
expect(await mayachainQuery.getAssetDecimals(assetFromStringEx('KUJI.KUJI') as Asset)).toBe(6)
156+
expect(await mayachainQuery.getAssetDecimals(assetFromStringEx('THOR.RUNE') as Asset)).toBe(8)
157+
expect(await mayachainQuery.getAssetDecimals(assetFromStringEx('MAYA.CACAO') as Asset)).toBe(10)
158+
expect(
159159
await mayachainQuery.getAssetDecimals(
160160
assetFromStringEx('ETH.USDT-0xdAC17F958D2ee523a2206206994597C13D831ec7') as TokenAsset,
161161
),
162162
).toBe(6)
163-
await expect(
163+
expect(
164164
await mayachainQuery.getAssetDecimals(
165165
assetFromStringEx('ETH.USDC-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48') as TokenAsset,
166166
),
167167
).toBe(6)
168-
await expect(
168+
expect(
169169
await mayachainQuery.getAssetDecimals(
170170
assetFromStringEx('ETH.WSTETH-0X7F39C581F595B53C5CB19BD0B3F8DA6C935E2CA0') as TokenAsset,
171171
),
172172
).toBe(18)
173-
await expect(await mayachainQuery.getAssetDecimals(assetFromStringEx('KUJI.USK') as TokenAsset)).toBe(6)
173+
expect(await mayachainQuery.getAssetDecimals(assetFromStringEx('KUJI.USK') as TokenAsset)).toBe(6)
174174
await expect(
175175
mayachainQuery.getAssetDecimals(
176176
assetFromStringEx('ETH.BNB-0xB8c77482e45F1F44dE1745F52C74426C631bDD52') as TokenAsset,

packages/xchain-radix/__tests__/client.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ describe('RadixClient Test', () => {
6060
network: Network.Mainnet,
6161
phrase: phrase,
6262
}
63-
await expect(() => new Client(params)).toThrow(/Invalid phrase/)
63+
expect(() => new Client(params)).toThrow(/Invalid phrase/)
6464
})
6565

6666
it('client should be able to get address', async () => {
@@ -82,7 +82,7 @@ describe('RadixClient Test', () => {
8282

8383
it('client should throw an Error when using getAddress', async () => {
8484
const client = createClient()
85-
await expect(() => client.getAddress()).toThrow(
85+
expect(() => client.getAddress()).toThrow(
8686
/getAddress is synchronous and cannot retrieve addresses directly. Use getAddressAsync instead./,
8787
)
8888
})
@@ -305,7 +305,7 @@ describe('RadixClient Test', () => {
305305
limit: 200,
306306
asset: 'resource_rdx1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxradxrd',
307307
}
308-
const txs = await (await client.getTransactions(transactionsHistoryParams)).txs
308+
const txs = (await client.getTransactions(transactionsHistoryParams)).txs
309309
txs.forEach((tx) => {
310310
expect(tx.from).not.toBeUndefined()
311311
expect(tx.to).not.toBeUndefined()

packages/xchain-ripple/src/clientKeystore.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class ClientKeystore extends Client {
3838
* @throws {"Phrase must be provided"} Thrown if the phrase has not been set before.
3939
*/
4040
public async getAddressAsync(walletIndex = 0): Promise<string> {
41-
return await this.getAddress(walletIndex)
41+
return this.getAddress(walletIndex)
4242
}
4343

4444
/**
@@ -48,7 +48,7 @@ export class ClientKeystore extends Client {
4848
* @returns Transaction signed by phrase
4949
*/
5050
public async signTransaction(payment: Payment, walletIndex = 0): Promise<SignedTransaction> {
51-
const xrplAccount = await this.getXrplWallet(walletIndex)
51+
const xrplAccount = this.getXrplWallet(walletIndex)
5252
return xrplAccount.sign(payment)
5353
}
5454
}

packages/xchain-solana/__e2e__/client.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ describe('Solana client', () => {
6161
})
6262

6363
it('Should validate address', async () => {
64-
const res = await client.validateAddress('GHityuQumkHn8JPpHYt9oxR5xi9X8R2kWsprdH9nPvT7')
64+
const res = client.validateAddress('GHityuQumkHn8JPpHYt9oxR5xi9X8R2kWsprdH9nPvT7')
6565
console.log(res)
6666
})
6767

0 commit comments

Comments
 (0)