Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
move filecoin options to @ganache/filecoin-options
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeseese committed Jan 6, 2021
1 parent 86f4e4d commit 9732a4f
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 73 deletions.
69 changes: 0 additions & 69 deletions src/chains/filecoin/filecoin/src/options/index.ts

This file was deleted.

14 changes: 13 additions & 1 deletion src/chains/filecoin/options/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion src/chains/filecoin/options/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,9 @@
"web3",
"tooling",
"truffle"
]
],
"dependencies": {
"@ganache/options": "0.1.0",
"seedrandom": "3.0.5"
}
}
76 changes: 74 additions & 2 deletions src/chains/filecoin/options/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,75 @@
export default {
// TODO
import { ChainConfig, ChainOptions } from "./chain-options";
import { LoggingConfig, LoggingOptions } from "./logging-options";
import { MinerConfig, MinerOptions } from "./miner-options";
import { WalletConfig, WalletOptions } from "./wallet-options";

import {
Base,
Defaults,
Definitions,
ExternalConfig,
InternalConfig,
Legacy,
LegacyOptions,
OptionName,
OptionRawType,
Options,
OptionsConfig
} from "@ganache/options";

export type FilecoinOptions = {
chain: ChainConfig;
logging: LoggingConfig;
miner: MinerConfig;
wallet: WalletConfig;
};

type MakeLegacyOptions<C extends Base.Config> = UnionToIntersection<
{
[K in OptionName<C>]: K extends LegacyOptions<C>
? Legacy<C, K>
: Record<K, OptionRawType<C, K>>;
}[keyof Options<C>]
>;

type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (
k: infer I
) => void
? I
: never;

export type FilecoinLegacyOptions = Partial<
MakeLegacyOptions<ChainConfig> &
MakeLegacyOptions<LoggingConfig> &
MakeLegacyOptions<MinerConfig> &
MakeLegacyOptions<WalletConfig>
>;

export type FilecoinProviderOptions = Partial<
{
[K in keyof FilecoinOptions]: ExternalConfig<FilecoinOptions[K]>;
}
>;

export type FilecoinInternalOptions = {
[K in keyof FilecoinOptions]: InternalConfig<FilecoinOptions[K]>;
};

export type FilecoinDefaults = {
[K in keyof FilecoinOptions]: Definitions<FilecoinOptions[K]>;
};

export const filecoinDefaults: Defaults<FilecoinOptions> = {
chain: ChainOptions,
logging: LoggingOptions,
miner: MinerOptions,
wallet: WalletOptions
};

export const FilecoinOptionsConfig = new OptionsConfig(filecoinDefaults);

export * from "./chain-options";
export * from "./helpers";
export * from "./logging-options";
export * from "./miner-options";
export * from "./wallet-options";

0 comments on commit 9732a4f

Please sign in to comment.