Skip to content

Commit

Permalink
eslint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-gray committed Sep 6, 2023
1 parent dc2f35c commit 30b4d1d
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 47 deletions.
13 changes: 12 additions & 1 deletion sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,24 @@
"typescript": "^4.9.4"
},
"scripts": {
"lint": "npm run prettier && eslint --fix",
"lint": "npm run prettier && eslint --fix ./src",
"lint:ci": "prettier -c ./src && eslint --max-warnings=0 ./src",
"prettier": "prettier --write ./src",
"build": "tsc --build",
"check": "tsc --noEmit",
"doc": "typedoc src/index.ts --out ../docs"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
],
"rules": {
"eqeqeq": "off",
"no-empty-pattern": "off",
"@typescript-eslint/no-useless-constructor": "off"
}
},
"repository": {
"type": "git",
"url": "git+https://github.com/wormhole-foundation/wormhole-connect.git"
Expand Down
32 changes: 16 additions & 16 deletions sdk/src/contexts/solana/utils/wormhole/coder/instruction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,22 @@ import { IdlField, IdlStateMethod } from '../../anchor';
import * as borsh from '@coral-xyz/borsh';
import { IdlCoder } from './idl';

/** Solitaire enum of existing the Core Bridge's instructions.
*
* https://github.com/certusone/wormhole/blob/main/solana/bridge/program/src/lib.rs#L92
*/
export enum WormholeInstruction {
Initialize,
PostMessage,
PostVaa,
SetFees,
TransferFees,
UpgradeContract,
UpgradeGuardianSet,
VerifySignatures,
PostMessageUnreliable, // sounds useful
}

// Inspired by coral-xyz/anchor
//
// https://github.com/coral-xyz/anchor/blob/master/ts/packages/anchor/src/coder/borsh/instruction.ts
Expand Down Expand Up @@ -85,22 +101,6 @@ export class WormholeInstructionCoder implements InstructionCoder {
}
}

/** Solitaire enum of existing the Core Bridge's instructions.
*
* https://github.com/certusone/wormhole/blob/main/solana/bridge/program/src/lib.rs#L92
*/
export enum WormholeInstruction {
Initialize,
PostMessage,
PostVaa,
SetFees,
TransferFees,
UpgradeContract,
UpgradeGuardianSet,
VerifySignatures,
PostMessageUnreliable, // sounds useful
}

function encodeWormholeInstructionData(
discriminator: number,
data?: Buffer,
Expand Down
30 changes: 15 additions & 15 deletions wormhole-connect/src/utils/routes/cctpManual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,25 +224,25 @@ export class CCTPManualRoute extends BaseRoute {
): Promise<boolean> {
return false;

const sourceTokenConfig = TOKENS[sourceToken];
const destTokenConfig = TOKENS[destToken];
// const sourceTokenConfig = TOKENS[sourceToken];
// const destTokenConfig = TOKENS[destToken];

if (!sourceChain || !destChain || !sourceTokenConfig || !destTokenConfig)
return false;
// if (!sourceChain || !destChain || !sourceTokenConfig || !destTokenConfig)
// return false;

const sourceChainName = wh.toChainName(sourceChain);
const destChainName = wh.toChainName(destChain);
// const sourceChainName = wh.toChainName(sourceChain);
// const destChainName = wh.toChainName(destChain);

if (sourceChainName === destChainName) return false;
if (sourceTokenConfig.symbol !== CCTPTokenSymbol) return false;
if (destTokenConfig.symbol !== CCTPTokenSymbol) return false;
if (sourceTokenConfig.nativeNetwork !== sourceChainName) return false;
if (destTokenConfig.nativeNetwork !== destChainName) return false;
// if (sourceChainName === destChainName) return false;
// if (sourceTokenConfig.symbol !== CCTPTokenSymbol) return false;
// if (destTokenConfig.symbol !== CCTPTokenSymbol) return false;
// if (sourceTokenConfig.nativeNetwork !== sourceChainName) return false;
// if (destTokenConfig.nativeNetwork !== destChainName) return false;

return (
CCTPManual_CHAINS.includes(sourceChainName) &&
CCTPManual_CHAINS.includes(destChainName)
);
// return (
// CCTPManual_CHAINS.includes(sourceChainName) &&
// CCTPManual_CHAINS.includes(destChainName)
// );
}

async computeReceiveAmount(
Expand Down
30 changes: 15 additions & 15 deletions wormhole-connect/src/utils/routes/cctpRelay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,26 +156,26 @@ export class CCTPRelayRoute extends CCTPManualRoute {
): Promise<boolean> {
return false;

const sourceTokenConfig = TOKENS[sourceToken];
const destTokenConfig = TOKENS[destToken];
// const sourceTokenConfig = TOKENS[sourceToken];
// const destTokenConfig = TOKENS[destToken];

if (!sourceChain || !destChain || !sourceTokenConfig || !destTokenConfig)
return false;
// if (!sourceChain || !destChain || !sourceTokenConfig || !destTokenConfig)
// return false;

const sourceChainName = wh.toChainName(sourceChain);
const destChainName = wh.toChainName(destChain);
// const sourceChainName = wh.toChainName(sourceChain);
// const destChainName = wh.toChainName(destChain);

if (sourceChainName === destChainName) return false;
// if (sourceChainName === destChainName) return false;

if (sourceTokenConfig.symbol !== CCTPTokenSymbol) return false;
if (destTokenConfig.symbol !== CCTPTokenSymbol) return false;
if (sourceTokenConfig.nativeNetwork !== sourceChainName) return false;
if (destTokenConfig.nativeNetwork !== destChainName) return false;
// if (sourceTokenConfig.symbol !== CCTPTokenSymbol) return false;
// if (destTokenConfig.symbol !== CCTPTokenSymbol) return false;
// if (sourceTokenConfig.nativeNetwork !== sourceChainName) return false;
// if (destTokenConfig.nativeNetwork !== destChainName) return false;

return (
CCTPRelay_CHAINS.includes(sourceChainName) &&
CCTPRelay_CHAINS.includes(destChainName)
);
// return (
// CCTPRelay_CHAINS.includes(sourceChainName) &&
// CCTPRelay_CHAINS.includes(destChainName)
// );
}

async computeReceiveAmount(
Expand Down

0 comments on commit 30b4d1d

Please sign in to comment.