Skip to content

Commit

Permalink
Merge pull request #225 from rabbitholegg/art/fix/rome-format
Browse files Browse the repository at this point in the history
Fix(rome): noExtraSemicolon
  • Loading branch information
Quazia authored Feb 21, 2024
2 parents 3b098d6 + d265b3e commit 738c0ec
Show file tree
Hide file tree
Showing 281 changed files with 11,145 additions and 11,161 deletions.
2 changes: 1 addition & 1 deletion .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@
"@rabbitholegg/questdk-plugin-boost": "1.0.0-alpha.0",
"@rabbitholegg/questdk-plugin-llama": "1.0.0-alpha.8",
"@rabbitholegg/create-plugin": "1.0.0",
"@rabbitholegg/questdk": "1.0.0"
"@rabbitholegg/questdk": "1.0.0",
"@rabbitholegg/questdk-plugin-kote": "1.0.0-alpha.0"
}
}
46 changes: 23 additions & 23 deletions apps/questdk/scripts/prepublishOnly.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { outputFileSync, readJsonSync, writeJsonSync } from "fs-extra";
import path from "path";
import { outputFileSync, readJsonSync, writeJsonSync } from 'fs-extra'
import path from 'path'

type Exports = {
[key: string]: string | { types?: string; import: string; default: string };
};
[key: string]: string | { types?: string; import: string; default: string }
}

generatePackageJson();
generatePackageJson()

// Generates a package.json to be published to NPM with only the necessary fields.
function generatePackageJson() {
const packageJsonPath = path.join(__dirname, "../package.json");
const tmpPackageJson = readJsonSync(packageJsonPath);
const packageJsonPath = path.join(__dirname, '../package.json')
const tmpPackageJson = readJsonSync(packageJsonPath)

writeJsonSync(`${packageJsonPath}.tmp`, tmpPackageJson, { spaces: 2 });
writeJsonSync(`${packageJsonPath}.tmp`, tmpPackageJson, { spaces: 2 })

const {
name,
Expand All @@ -35,33 +35,33 @@ function generatePackageJson() {
license,
repository,
files,
} = tmpPackageJson;
} = tmpPackageJson

// Generate proxy packages for each export.
const files_ = [...files];
const files_ = [...files]
for (const [key, value] of Object.entries(exports_ as Exports)) {
if (typeof value === "string") continue;
if (key === ".") continue;
if (typeof value === 'string') continue
if (key === '.') continue
if (!value.default || !value.import)
throw new Error("`default` and `import` are required.");
throw new Error('`default` and `import` are required.')

outputFileSync(
`${key}/package.json`,
`{
${Object.entries(value)
.map(([k, v]) => {
const key = (() => {
if (k === "import") return "module";
if (k === "default") return "main";
if (k === "types") return "types";
throw new Error("Invalid key");
})();
return `"${key}": "${v.replace("./", "../")}"`;
if (k === 'import') return 'module'
if (k === 'default') return 'main'
if (k === 'types') return 'types'
throw new Error('Invalid key')
})()
return `"${key}": "${v.replace('./', '../')}"`
})
.join(",\n ")}
.join(',\n ')}
}`,
);
files_.push(key.replace("./", ""));
)
files_.push(key.replace('./', ''))
}

writeJsonSync(
Expand All @@ -88,5 +88,5 @@ function generatePackageJson() {
keywords,
},
{ spaces: 2 },
);
)
}
12 changes: 6 additions & 6 deletions apps/questdk/scripts/updateVersion.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { readJsonSync, writeFileSync } from "fs-extra";
import path from "path";
import { readJsonSync, writeFileSync } from 'fs-extra'
import path from 'path'

// Writes the current package.json version to `./src/errors/version.ts`.
const versionFilePath = path.join(__dirname, "../src/errors/version.ts");
const packageJsonPath = path.join(__dirname, "../package.json");
const packageVersion = readJsonSync(packageJsonPath).version;
const versionFilePath = path.join(__dirname, '../src/errors/version.ts')
const packageJsonPath = path.join(__dirname, '../package.json')
const packageVersion = readJsonSync(packageJsonPath).version

writeFileSync(versionFilePath, `export const version = '${packageVersion}'\n`);
writeFileSync(versionFilePath, `export const version = '${packageVersion}'\n`)
4 changes: 2 additions & 2 deletions apps/questdk/src/actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ export type {
VoteActionParams,
ActionParams,
IActionPlugin,
} from "./types.js";
} from './types.js'

export { ActionType, OrderType } from "./types.js";
export { ActionType, OrderType } from './types.js'
176 changes: 88 additions & 88 deletions apps/questdk/src/actions/types.ts
Original file line number Diff line number Diff line change
@@ -1,84 +1,84 @@
import type {
FilterOperator,
TransactionFilter,
} from "@rabbitholegg/questdk-plugin-utils";
import type { PluginActionNotImplementedError } from "../index.js";
import { type Address } from "viem";
} from '@rabbitholegg/questdk-plugin-utils'
import type { PluginActionNotImplementedError } from '../index.js'
import { type Address } from 'viem'

export type SwapActionParams = {
chainId: number;
contractAddress?: Address;
tokenIn?: Address;
tokenOut?: Address;
amountIn?: bigint | FilterOperator;
amountOut?: bigint | FilterOperator;
recipient?: Address;
deadline?: bigint | FilterOperator;
};
chainId: number
contractAddress?: Address
tokenIn?: Address
tokenOut?: Address
amountIn?: bigint | FilterOperator
amountOut?: bigint | FilterOperator
recipient?: Address
deadline?: bigint | FilterOperator
}

export type OptionsActionParams = {
chainId: number;
contractAddress?: Address;
token?: Address;
amount?: bigint | FilterOperator;
recipient?: Address;
orderType?: OrderType;
};
chainId: number
contractAddress?: Address
token?: Address
amount?: bigint | FilterOperator
recipient?: Address
orderType?: OrderType
}

export type StakeActionParams = {
chainId: number;
contractAddress?: Address;
tokenOne?: Address;
amountOne?: bigint | FilterOperator;
tokenTwo?: Address;
amountTwo?: bigint | FilterOperator;
duration?: bigint | FilterOperator;
};
chainId: number
contractAddress?: Address
tokenOne?: Address
amountOne?: bigint | FilterOperator
tokenTwo?: Address
amountTwo?: bigint | FilterOperator
duration?: bigint | FilterOperator
}

export type BridgeActionParams = {
sourceChainId: number;
destinationChainId: number;
contractAddress?: Address;
tokenAddress?: Address;
amount?: bigint | FilterOperator;
recipient?: Address;
};
sourceChainId: number
destinationChainId: number
contractAddress?: Address
tokenAddress?: Address
amount?: bigint | FilterOperator
recipient?: Address
}

export type MintActionParams = {
chainId: number;
contractAddress: Address;
tokenId?: number;
amount?: number | FilterOperator;
recipient?: Address;
};
chainId: number
contractAddress: Address
tokenId?: number
amount?: number | FilterOperator
recipient?: Address
}

export type BurnActionParams = MintActionParams;
export type BurnActionParams = MintActionParams

export type QuestActionParams = {
chainId: number;
rewardToken?: Address;
rewardAmount?: bigint | FilterOperator;
startTime?: bigint | FilterOperator;
endTime?: bigint | FilterOperator;
totalParticipants?: bigint | FilterOperator;
actionSpec?: string;
};
chainId: number
rewardToken?: Address
rewardAmount?: bigint | FilterOperator
startTime?: bigint | FilterOperator
endTime?: bigint | FilterOperator
totalParticipants?: bigint | FilterOperator
actionSpec?: string
}

export type DelegateActionParams = {
chainId: number;
delegate?: Address;
project: Address | string;
contractAddress?: Address;
amount?: bigint | FilterOperator;
delegator?: Address;
};
chainId: number
delegate?: Address
project: Address | string
contractAddress?: Address
amount?: bigint | FilterOperator
delegator?: Address
}

export type VoteActionParams = {
chainId: number;
project: Address | string;
support?: bigint | boolean | FilterOperator;
proposalId?: bigint | FilterOperator;
};
chainId: number
project: Address | string
support?: bigint | boolean | FilterOperator
proposalId?: bigint | FilterOperator
}

export type ActionParams =
| SwapActionParams
Expand All @@ -88,59 +88,59 @@ export type ActionParams =
| DelegateActionParams
| QuestActionParams
| OptionsActionParams
| VoteActionParams;
| VoteActionParams
export interface IActionPlugin {
pluginId: string;
getSupportedChainIds: (task?: ActionType) => Promise<number[]>;
pluginId: string
getSupportedChainIds: (task?: ActionType) => Promise<number[]>
getSupportedTokenAddresses: (
chainId: number,
task?: ActionType,
) => Promise<Address[]>;
) => Promise<Address[]>
bridge?: (
params: BridgeActionParams,
) => Promise<TransactionFilter> | Promise<PluginActionNotImplementedError>;
) => Promise<TransactionFilter> | Promise<PluginActionNotImplementedError>
swap?: (
params: SwapActionParams,
) => Promise<TransactionFilter> | Promise<PluginActionNotImplementedError>;
) => Promise<TransactionFilter> | Promise<PluginActionNotImplementedError>
mint?: (
params: MintActionParams,
) => Promise<TransactionFilter> | Promise<PluginActionNotImplementedError>;
) => Promise<TransactionFilter> | Promise<PluginActionNotImplementedError>
stake?: (
params: StakeActionParams,
) => Promise<TransactionFilter> | Promise<PluginActionNotImplementedError>;
) => Promise<TransactionFilter> | Promise<PluginActionNotImplementedError>
delegate?: (
params: DelegateActionParams,
) => Promise<TransactionFilter> | Promise<PluginActionNotImplementedError>;
) => Promise<TransactionFilter> | Promise<PluginActionNotImplementedError>
burn?: (
params: BurnActionParams,
) => Promise<TransactionFilter> | Promise<PluginActionNotImplementedError>;
) => Promise<TransactionFilter> | Promise<PluginActionNotImplementedError>
quest?: (
params: QuestActionParams,
) => Promise<TransactionFilter> | Promise<PluginActionNotImplementedError>;
) => Promise<TransactionFilter> | Promise<PluginActionNotImplementedError>
options?: (
params: OptionsActionParams,
) => Promise<TransactionFilter> | Promise<PluginActionNotImplementedError>;
) => Promise<TransactionFilter> | Promise<PluginActionNotImplementedError>
vote?: (
params: VoteActionParams,
) => Promise<TransactionFilter> | Promise<PluginActionNotImplementedError>;
) => Promise<TransactionFilter> | Promise<PluginActionNotImplementedError>
}

export enum ActionType {
Bridge = "bridge",
Stake = "stake",
Swap = "swap",
Mint = "mint",
Burn = "burn",
Quest = "quest",
Deposit = "deposit",
Delegate = "delegate",
Lend = "lend",
Other = "other",
Options = "options",
Vote = "vote",
Bridge = 'bridge',
Stake = 'stake',
Swap = 'swap',
Mint = 'mint',
Burn = 'burn',
Quest = 'quest',
Deposit = 'deposit',
Delegate = 'delegate',
Lend = 'lend',
Other = 'other',
Options = 'options',
Vote = 'vote',
}

export enum OrderType {
Limit = "limit",
Market = "market",
Limit = 'limit',
Market = 'market',
}
12 changes: 6 additions & 6 deletions apps/questdk/src/client/ethereumClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import {
fetchERC721Media,
fetchERC721Metadata,
fetchERC721MetadataByUUID,
} from "../tokens/erc721.js";
} from '../tokens/erc721.js'
import {
fetchERC1155Media,
fetchERC1155Metadata,
fetchERC1155MetadataByUUID,
} from "../tokens/erc1155.js";
import { type PublicClient, createClient, http } from "viem";
} from '../tokens/erc1155.js'
import { type PublicClient, createClient, http } from 'viem'
/**
* Initializes an Ethereum client with the specified RPC URL and provides methods for ERC721 and ERC1155 token interactions.
* @param {string} rpcUrl - The RPC URL for connecting to the Ethereum network.
Expand All @@ -17,7 +17,7 @@ import { type PublicClient, createClient, http } from "viem";
function createEthereumClient(rpcUrl: string) {
const client = createClient({
transport: http(rpcUrl),
}) as PublicClient;
}) as PublicClient

return {
fetchERC721Metadata: (contractAddress: string, tokenId: number) =>
Expand All @@ -32,7 +32,7 @@ function createEthereumClient(rpcUrl: string) {
fetchERC721MetadataByUUID(client, uuid),
fetchERC1155MetadataByUUID: (uuid: string) =>
fetchERC1155MetadataByUUID(client, uuid),
};
}
}

export default createEthereumClient;
export default createEthereumClient
Loading

0 comments on commit 738c0ec

Please sign in to comment.