Skip to content

Commit

Permalink
CI should run prettier@2.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
kev1n-peters committed Jul 25, 2023
1 parent 5c399cd commit a13e06c
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion clients/js/.prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@
"jsxSingleQuote": false,
"trailingComma": "es5",
"bracketSpacing": true,
"bracketSameLine": false,
"arrowParens": "always"
}
4 changes: 2 additions & 2 deletions clients/js/src/chains/sui/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,14 +311,14 @@ export const isSameType = (a: string, b: string) => {

export const isSuiCreateEvent = <
T extends NonNullable<SuiTransactionBlockResponse["objectChanges"]>[number],
K extends Extract<T, { type: "created" }>,
K extends Extract<T, { type: "created" }>
>(
event: T
): event is K => event?.type === "created";

export const isSuiPublishEvent = <
T extends NonNullable<SuiTransactionBlockResponse["objectChanges"]>[number],
K extends Extract<T, { type: "published" }>,
K extends Extract<T, { type: "published" }>
>(
event: T
): event is K => event?.type === "published";
Expand Down
5 changes: 3 additions & 2 deletions clients/js/src/cmds/sui/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
}
Expand Down
18 changes: 9 additions & 9 deletions clients/js/src/vaa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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<PortalContractUpgrade<Module>> {
return new P(
new Parser()
Expand Down Expand Up @@ -470,7 +470,7 @@ function portalContractUpgradeParser<
}

function serialisePortalContractUpgrade<
Module extends "NFTBridge" | "TokenBridge" | "WormholeRelayer",
Module extends "NFTBridge" | "TokenBridge" | "WormholeRelayer"
>(payload: PortalContractUpgrade<Module>): string {
const body = [
encode("bytes32", encodeString(payload.module)),
Expand All @@ -485,7 +485,7 @@ function serialisePortalContractUpgrade<
// Registrations

export interface PortalRegisterChain<
Module extends "NFTBridge" | "TokenBridge" | "WormholeRelayer",
Module extends "NFTBridge" | "TokenBridge" | "WormholeRelayer"
> {
module: Module;
type: "RegisterChain";
Expand All @@ -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<PortalRegisterChain<Module>> {
return new P(
new Parser()
Expand Down Expand Up @@ -526,7 +526,7 @@ function portalRegisterChainParser<
}

function serialisePortalRegisterChain<
Module extends "NFTBridge" | "TokenBridge" | "WormholeRelayer",
Module extends "NFTBridge" | "TokenBridge" | "WormholeRelayer"
>(payload: PortalRegisterChain<Module>): string {
const body = [
encode("bytes32", encodeString(payload.module)),
Expand Down Expand Up @@ -589,7 +589,7 @@ function serialiseCoreContractRecoverChainId(
}

export interface PortalContractRecoverChainId<
Module extends "NFTBridge" | "TokenBridge" | "WormholeRelayer",
Module extends "NFTBridge" | "TokenBridge" | "WormholeRelayer"
> {
module: Module;
type: "RecoverChainId";
Expand All @@ -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<PortalContractRecoverChainId<Module>> {
return new P(
new Parser()
Expand Down Expand Up @@ -628,7 +628,7 @@ function portalContractRecoverChainId<
}

function serialisePortalContractRecoverChainId<
Module extends "NFTBridge" | "TokenBridge" | "WormholeRelayer",
Module extends "NFTBridge" | "TokenBridge" | "WormholeRelayer"
>(payload: PortalContractRecoverChainId<Module>): string {
const body = [
encode("bytes32", encodeString(payload.module)),
Expand Down
1 change: 0 additions & 1 deletion sdk/js/.prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@
"jsxSingleQuote": false,
"trailingComma": "es5",
"bracketSpacing": true,
"bracketSameLine": false,
"arrowParens": "always"
}
2 changes: 1 addition & 1 deletion sdk/js/src/relayer/relayer/send.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export type SendOptionalParams = {
chainId?: ChainId;
emitterAddress: string;
sequenceNumber: ethers.BigNumberish;
},
}
];
deliveryProviderAddress?: string;
wormholeRelayerAddress?: string;
Expand Down
20 changes: 10 additions & 10 deletions sdk/js/src/utils/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];

/**
*
Expand All @@ -61,7 +61,7 @@ export const EVMChainNames: ReadonlyArray<ChainName> = [
"base",
"sepolia",
] as const;
export type EVMChainName = (typeof EVMChainNames)[number];
export type EVMChainName = typeof EVMChainNames[number];

/*
*
Expand All @@ -71,7 +71,7 @@ export const SolanaChainNames: ReadonlyArray<ChainName> = [
"solana",
"pythnet",
] as const;
export type SolanaChainName = (typeof SolanaChainNames)[number];
export type SolanaChainName = typeof SolanaChainNames[number];

export const CosmWasmChainNames: ReadonlyArray<ChainName> = [
"terra",
Expand All @@ -80,14 +80,14 @@ export const CosmWasmChainNames: ReadonlyArray<ChainName> = [
"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<ChainName> = [
"terra",
"terra2",
] as const;
export type TerraChainName = (typeof TerraChainNames)[number];
export type TerraChainName = typeof TerraChainNames[number];

export type Contracts = {
core: string | undefined;
Expand Down Expand Up @@ -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]) => {
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions sdk/js/src/vaa/generic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ function serialiseCoreContractUpgrade(payload: CoreContractUpgrade): string {
}

export interface PortalContractUpgrade<
Module extends "NFTBridge" | "TokenBridge",
Module extends "NFTBridge" | "TokenBridge"
> {
module: Module;
type: "ContractUpgrade";
Expand All @@ -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<PortalContractUpgrade<Module>> {
return new P(
new Parser()
Expand Down Expand Up @@ -423,7 +423,7 @@ function portalContractUpgradeParser<
}

function serialisePortalContractUpgrade<
Module extends "NFTBridge" | "TokenBridge",
Module extends "NFTBridge" | "TokenBridge"
>(payload: PortalContractUpgrade<Module>): string {
const body = [
encode("bytes32", encodeString(payload.module)),
Expand All @@ -438,7 +438,7 @@ function serialisePortalContractUpgrade<
// Registrations

export interface PortalRegisterChain<
Module extends "NFTBridge" | "TokenBridge",
Module extends "NFTBridge" | "TokenBridge"
> {
module: Module;
type: "RegisterChain";
Expand Down Expand Up @@ -479,7 +479,7 @@ function portalRegisterChainParser<Module extends "NFTBridge" | "TokenBridge">(
}

function serialisePortalRegisterChain<
Module extends "NFTBridge" | "TokenBridge",
Module extends "NFTBridge" | "TokenBridge"
>(payload: PortalRegisterChain<Module>): string {
const body = [
encode("bytes32", encodeString(payload.module)),
Expand Down

0 comments on commit a13e06c

Please sign in to comment.