diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c9f1b81548..155b9d835d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -401,4 +401,4 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 16 - - run: npx prettier --check ./clients/js/src ./sdk/js/src + - run: npx prettier@2.3.2 --check ./clients/js/src ./sdk/js/src diff --git a/clients/js/.prettierrc.json b/clients/js/.prettierrc.json index fe24418037..28ec018a9c 100644 --- a/clients/js/.prettierrc.json +++ b/clients/js/.prettierrc.json @@ -8,6 +8,5 @@ "jsxSingleQuote": false, "trailingComma": "es5", "bracketSpacing": true, - "bracketSameLine": false, "arrowParens": "always" } diff --git a/clients/js/src/chains/sui/utils.ts b/clients/js/src/chains/sui/utils.ts index ec4d84a02e..bd4a9ca52e 100644 --- a/clients/js/src/chains/sui/utils.ts +++ b/clients/js/src/chains/sui/utils.ts @@ -311,14 +311,14 @@ export const isSameType = (a: string, b: string) => { export const isSuiCreateEvent = < T extends NonNullable[number], - K extends Extract, + K extends Extract >( event: T ): event is K => event?.type === "created"; export const isSuiPublishEvent = < T extends NonNullable[number], - K extends Extract, + K extends Extract >( event: T ): event is K => event?.type === "published"; diff --git a/clients/js/src/cmds/sui/setup.ts b/clients/js/src/cmds/sui/setup.ts index 4ad9c19bce..380b99af9f 100644 --- a/clients/js/src/cmds/sui/setup.ts +++ b/clients/js/src/cmds/sui/setup.ts @@ -123,8 +123,9 @@ export const addSetupCommands: YargsAddCommandsFn = (y: typeof yargs) => // Get token bridge state object ID const tokenBridgeStateObjectId = getCreatedObjects( tokenBridgeInitRes - ).find((e) => isSameType(e.type, `${tokenBridgePackageId}::state::State`)) - ?.objectId; + ).find((e) => + isSameType(e.type, `${tokenBridgePackageId}::state::State`) + )?.objectId; if (!tokenBridgeStateObjectId) { throw new Error("Couldn't find token bridge state object ID."); } diff --git a/clients/js/src/vaa.ts b/clients/js/src/vaa.ts index 08a4e61398..1da3622f51 100644 --- a/clients/js/src/vaa.ts +++ b/clients/js/src/vaa.ts @@ -431,7 +431,7 @@ function serialiseCoreContractUpgrade(payload: CoreContractUpgrade): string { } export interface PortalContractUpgrade< - Module extends "NFTBridge" | "TokenBridge" | "WormholeRelayer", + Module extends "NFTBridge" | "TokenBridge" | "WormholeRelayer" > { module: Module; type: "ContractUpgrade"; @@ -441,7 +441,7 @@ export interface PortalContractUpgrade< // Parse a portal contract upgrade payload function portalContractUpgradeParser< - Module extends "NFTBridge" | "TokenBridge" | "WormholeRelayer", + Module extends "NFTBridge" | "TokenBridge" | "WormholeRelayer" >(module: Module): P> { return new P( new Parser() @@ -470,7 +470,7 @@ function portalContractUpgradeParser< } function serialisePortalContractUpgrade< - Module extends "NFTBridge" | "TokenBridge" | "WormholeRelayer", + Module extends "NFTBridge" | "TokenBridge" | "WormholeRelayer" >(payload: PortalContractUpgrade): string { const body = [ encode("bytes32", encodeString(payload.module)), @@ -485,7 +485,7 @@ function serialisePortalContractUpgrade< // Registrations export interface PortalRegisterChain< - Module extends "NFTBridge" | "TokenBridge" | "WormholeRelayer", + Module extends "NFTBridge" | "TokenBridge" | "WormholeRelayer" > { module: Module; type: "RegisterChain"; @@ -496,7 +496,7 @@ export interface PortalRegisterChain< // Parse a portal chain registration payload function portalRegisterChainParser< - Module extends "NFTBridge" | "TokenBridge" | "WormholeRelayer", + Module extends "NFTBridge" | "TokenBridge" | "WormholeRelayer" >(module: Module): P> { return new P( new Parser() @@ -526,7 +526,7 @@ function portalRegisterChainParser< } function serialisePortalRegisterChain< - Module extends "NFTBridge" | "TokenBridge" | "WormholeRelayer", + Module extends "NFTBridge" | "TokenBridge" | "WormholeRelayer" >(payload: PortalRegisterChain): string { const body = [ encode("bytes32", encodeString(payload.module)), @@ -589,7 +589,7 @@ function serialiseCoreContractRecoverChainId( } export interface PortalContractRecoverChainId< - Module extends "NFTBridge" | "TokenBridge" | "WormholeRelayer", + Module extends "NFTBridge" | "TokenBridge" | "WormholeRelayer" > { module: Module; type: "RecoverChainId"; @@ -599,7 +599,7 @@ export interface PortalContractRecoverChainId< // Parse a portal contract recoverChainId payload function portalContractRecoverChainId< - Module extends "NFTBridge" | "TokenBridge" | "WormholeRelayer", + Module extends "NFTBridge" | "TokenBridge" | "WormholeRelayer" >(module: Module): P> { return new P( new Parser() @@ -628,7 +628,7 @@ function portalContractRecoverChainId< } function serialisePortalContractRecoverChainId< - Module extends "NFTBridge" | "TokenBridge" | "WormholeRelayer", + Module extends "NFTBridge" | "TokenBridge" | "WormholeRelayer" >(payload: PortalContractRecoverChainId): string { const body = [ encode("bytes32", encodeString(payload.module)), diff --git a/sdk/js/.prettierrc.json b/sdk/js/.prettierrc.json index fe24418037..28ec018a9c 100644 --- a/sdk/js/.prettierrc.json +++ b/sdk/js/.prettierrc.json @@ -8,6 +8,5 @@ "jsxSingleQuote": false, "trailingComma": "es5", "bracketSpacing": true, - "bracketSameLine": false, "arrowParens": "always" } diff --git a/sdk/js/src/relayer/relayer/send.ts b/sdk/js/src/relayer/relayer/send.ts index 214fa32e94..9b3e1c14a5 100644 --- a/sdk/js/src/relayer/relayer/send.ts +++ b/sdk/js/src/relayer/relayer/send.ts @@ -19,7 +19,7 @@ export type SendOptionalParams = { chainId?: ChainId; emitterAddress: string; sequenceNumber: ethers.BigNumberish; - }, + } ]; deliveryProviderAddress?: string; wormholeRelayerAddress?: string; diff --git a/sdk/js/src/utils/consts.ts b/sdk/js/src/utils/consts.ts index b7d5e8c80e..2b11de6d63 100644 --- a/sdk/js/src/utils/consts.ts +++ b/sdk/js/src/utils/consts.ts @@ -35,7 +35,7 @@ export const CHAINS = { } as const; export type ChainName = keyof typeof CHAINS; -export type ChainId = (typeof CHAINS)[ChainName]; +export type ChainId = typeof CHAINS[ChainName]; /** * @@ -61,7 +61,7 @@ export const EVMChainNames: ReadonlyArray = [ "base", "sepolia", ] as const; -export type EVMChainName = (typeof EVMChainNames)[number]; +export type EVMChainName = typeof EVMChainNames[number]; /* * @@ -71,7 +71,7 @@ export const SolanaChainNames: ReadonlyArray = [ "solana", "pythnet", ] as const; -export type SolanaChainName = (typeof SolanaChainNames)[number]; +export type SolanaChainName = typeof SolanaChainNames[number]; export const CosmWasmChainNames: ReadonlyArray = [ "terra", @@ -80,14 +80,14 @@ export const CosmWasmChainNames: ReadonlyArray = [ "xpla", "sei", ] as const; -export type CosmWasmChainName = (typeof CosmWasmChainNames)[number]; +export type CosmWasmChainName = typeof CosmWasmChainNames[number]; // TODO: why? these are dupe of entries in CosmWasm export const TerraChainNames: ReadonlyArray = [ "terra", "terra2", ] as const; -export type TerraChainName = (typeof TerraChainNames)[number]; +export type TerraChainName = typeof TerraChainNames[number]; export type Contracts = { core: string | undefined; @@ -695,7 +695,7 @@ export const CHAIN_ID_SEPOLIA = CHAINS["sepolia"]; // This inverts the [[CHAINS]] object so that we can look up a chain by id export type ChainIdToName = { - -readonly [key in keyof typeof CHAINS as (typeof CHAINS)[key]]: key; + -readonly [key in keyof typeof CHAINS as typeof CHAINS[key]]: key; }; export const CHAIN_ID_TO_NAME: ChainIdToName = Object.entries(CHAINS).reduce( (obj, [name, id]) => { @@ -709,21 +709,21 @@ export const CHAIN_ID_TO_NAME: ChainIdToName = Object.entries(CHAINS).reduce( * * All the EVM-based chain ids that Wormhole supports */ -export type EVMChainId = (typeof CHAINS)[EVMChainName]; +export type EVMChainId = typeof CHAINS[EVMChainName]; /** * * All the Solana-based chain ids that Wormhole supports */ -export type SolanaChainId = (typeof CHAINS)[SolanaChainName]; +export type SolanaChainId = typeof CHAINS[SolanaChainName]; /** * * All the CosmWasm-based chain ids that Wormhole supports */ -export type CosmWasmChainId = (typeof CHAINS)[CosmWasmChainName]; +export type CosmWasmChainId = typeof CHAINS[CosmWasmChainName]; -export type TerraChainId = (typeof CHAINS)[TerraChainName]; +export type TerraChainId = typeof CHAINS[TerraChainName]; /** * * Returns true when called with a valid chain, and narrows the type in the diff --git a/sdk/js/src/vaa/generic.ts b/sdk/js/src/vaa/generic.ts index 7dbabf3a3e..0430fe60c7 100644 --- a/sdk/js/src/vaa/generic.ts +++ b/sdk/js/src/vaa/generic.ts @@ -384,7 +384,7 @@ function serialiseCoreContractUpgrade(payload: CoreContractUpgrade): string { } export interface PortalContractUpgrade< - Module extends "NFTBridge" | "TokenBridge", + Module extends "NFTBridge" | "TokenBridge" > { module: Module; type: "ContractUpgrade"; @@ -394,7 +394,7 @@ export interface PortalContractUpgrade< // Parse a portal contract upgrade payload function portalContractUpgradeParser< - Module extends "NFTBridge" | "TokenBridge", + Module extends "NFTBridge" | "TokenBridge" >(module: Module): P> { return new P( new Parser() @@ -423,7 +423,7 @@ function portalContractUpgradeParser< } function serialisePortalContractUpgrade< - Module extends "NFTBridge" | "TokenBridge", + Module extends "NFTBridge" | "TokenBridge" >(payload: PortalContractUpgrade): string { const body = [ encode("bytes32", encodeString(payload.module)), @@ -438,7 +438,7 @@ function serialisePortalContractUpgrade< // Registrations export interface PortalRegisterChain< - Module extends "NFTBridge" | "TokenBridge", + Module extends "NFTBridge" | "TokenBridge" > { module: Module; type: "RegisterChain"; @@ -479,7 +479,7 @@ function portalRegisterChainParser( } function serialisePortalRegisterChain< - Module extends "NFTBridge" | "TokenBridge", + Module extends "NFTBridge" | "TokenBridge" >(payload: PortalRegisterChain): string { const body = [ encode("bytes32", encodeString(payload.module)),