This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 682
feat: add --flavor
feature (ganache chain plugins)
#4362
Merged
Merged
Changes from 6 commits
Commits
Show all changes
67 commits
Select commit
Hold shift + click to select a range
3f2d655
delete tezos and refactor plugins
davidmurdoch c9bdc9a
oops
davidmurdoch 28eed02
oops2
davidmurdoch e3fe9af
oops3
davidmurdoch 328abc9
import type
davidmurdoch 82f0330
revert
davidmurdoch d40f30a
Update src/chains/filecoin/filecoin/src/connector.ts
davidmurdoch 9912275
Null
davidmurdoch 19765e7
You
davidmurdoch a9a4e68
Sigh
davidmurdoch 9edce5a
quick ci test
davidmurdoch db54103
Merge branch 'flavor2' of github.com:trufflesuite/ganache into flavor2
davidmurdoch 6ba2798
oops_
davidmurdoch 986a281
sfsfdsdf
davidmurdoch b74032a
lazy
davidmurdoch 40b8f4c
make example work
davidmurdoch b4875b3
more examples and things
davidmurdoch 79a371d
typo fixes
davidmurdoch 9d235e6
ReturnType<Api[KnownKeys<Api>]> resolved to unknown anyway
davidmurdoch 3d7fbd0
more flavor tweaks and examples
davidmurdoch 160f13b
Merge branch 'develop' into flavor2
davidmurdoch 1fadb7c
polish
davidmurdoch 05da030
d
davidmurdoch fc3ff3a
polish
davidmurdoch 71e9790
add default options and note
davidmurdoch 249e43e
back compat, maybe
davidmurdoch 4e9c01b
.
davidmurdoch 2514d70
things
davidmurdoch 39e973e
revert change
davidmurdoch 078cc0b
revert
davidmurdoch 504de6a
types
davidmurdoch 879f26b
add chalk
davidmurdoch ae66e80
more filecoin removal
davidmurdoch d96d35e
remove change
davidmurdoch 5ff2e05
clean up dependencies
davidmurdoch 5b6d3e9
maybe this time
davidmurdoch 225491f
why you no install on node 14?
davidmurdoch fea1248
fix out of date dep
davidmurdoch 9a1163d
deps
davidmurdoch 2388cb6
types
davidmurdoch 6e0449c
this doesn't need to be exported
davidmurdoch b8b9d31
we don't allow old flavors anymore, so only support `ready`
davidmurdoch 2728355
ready note
davidmurdoch 0d119e0
change interface
davidmurdoch 9943157
some things
davidmurdoch cc62012
remove change
davidmurdoch e0d4337
get lazier
davidmurdoch 861d6bb
i said lazy!
davidmurdoch 7b04571
lazy
davidmurdoch 565706d
comment
davidmurdoch ea81e2c
remove some changes
davidmurdoch 928e984
better comment
davidmurdoch ed8d2e9
add example test
davidmurdoch 694496e
update comment
davidmurdoch b1fdaf3
naming
davidmurdoch 899dca4
better?
davidmurdoch 2d6deab
refactor
davidmurdoch 12122c9
i don't know why
davidmurdoch e351cae
preload
davidmurdoch 60192de
:-(
davidmurdoch 78bbafc
typessss
davidmurdoch 195a914
Merge branch 'develop' into flavor2
davidmurdoch 82dbb01
fix deps and lock files
davidmurdoch 3097f8e
Import from '../index' rather than '..' to resolve tsc issues
jeffsmale90 b42258c
Merge ganache configuration with flavor configuration to avoid duplic…
jeffsmale90 809891c
Fix issues with yargs configuration. Remove duplicate 'instances' com…
jeffsmale90 7cf6285
remove port/host hack
davidmurdoch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
import Emittery from "emittery"; | ||
import EthereumApi from "./api"; | ||
import { | ||
Connector as IConnector, | ||
Executor, | ||
makeError, | ||
makeResponse, | ||
|
@@ -12,20 +10,19 @@ import { | |
} from "@ganache/utils"; | ||
export type { EthereumProvider } from "./provider"; | ||
import { EthereumProvider } from "./provider"; | ||
import { | ||
import type { | ||
RecognizedString, | ||
WebSocket, | ||
HttpRequest | ||
} from "@trufflesuite/uws-js-unofficial"; | ||
HttpRequest, | ||
Connector as IConnector | ||
} from "@ganache/flavor"; | ||
import { CodedError } from "@ganache/ethereum-utils"; | ||
import { | ||
EthereumProviderOptions, | ||
EthereumLegacyProviderOptions | ||
} from "@ganache/ethereum-options"; | ||
import { bufferify } from "./helpers/bufferify"; | ||
|
||
type ProviderOptions = EthereumProviderOptions | EthereumLegacyProviderOptions; | ||
|
||
function isHttp( | ||
connection: HttpRequest | WebSocket | ||
): connection is HttpRequest { | ||
|
@@ -36,35 +33,28 @@ function isHttp( | |
} | ||
|
||
export class Connector< | ||
R extends JsonRpcRequest< | ||
EthereumApi, | ||
KnownKeys<EthereumApi> | ||
> = JsonRpcRequest<EthereumApi, KnownKeys<EthereumApi>> | ||
> | ||
extends Emittery<{ ready: undefined; close: undefined }> | ||
implements IConnector<EthereumApi, R | R[], JsonRpcResponse> | ||
R extends JsonRpcRequest< | ||
EthereumApi, | ||
KnownKeys<EthereumApi> | ||
> = JsonRpcRequest<EthereumApi, KnownKeys<EthereumApi>> | ||
> implements IConnector<EthereumProvider, R | R[], JsonRpcResponse> | ||
{ | ||
#provider: EthereumProvider; | ||
|
||
static BUFFERIFY_THRESHOLD: number = 100000; | ||
|
||
get provider() { | ||
get provider(): EthereumProvider { | ||
return this.#provider; | ||
} | ||
Comment on lines
-51
to
48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not just change |
||
|
||
constructor(providerOptions: ProviderOptions = null, executor: Executor) { | ||
super(); | ||
|
||
constructor(providerOptions: EthereumProviderOptions | EthereumLegacyProviderOptions = null, executor: Executor) { | ||
this.#provider = new EthereumProvider(providerOptions, executor); | ||
} | ||
|
||
public BUFFERIFY_THRESHOLD = Connector.BUFFERIFY_THRESHOLD; | ||
|
||
async connect() { | ||
await this.#provider.initialize(); | ||
// no need to wait for #provider.once("connect") as the initialize() | ||
// promise has already accounted for that after the promise is resolved | ||
await this.emit("ready"); | ||
} | ||
|
||
parse(message: Buffer) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ import { | |
Executor, | ||
hasOwn, | ||
KnownKeys, | ||
Provider, | ||
JsonRpcRequest, | ||
JsonRpcResponse, | ||
JsonRpcError, | ||
|
@@ -124,20 +123,17 @@ type RequestParams<Method extends RequestMethods> = { | |
readonly method: Method; | ||
readonly params: OverloadedParameters<EthereumApi[Method]> | undefined; | ||
}; | ||
export class EthereumProvider | ||
extends Emittery<{ | ||
message: MessageEvent; | ||
data: DataEvent; | ||
error: Error; | ||
"ganache:vm:tx:step": VmStepEvent; | ||
"ganache:vm:tx:before": VmBeforeTransactionEvent; | ||
"ganache:vm:tx:after": VmAfterTransactionEvent; | ||
"ganache:vm:tx:console.log": VmConsoleLogEvent; | ||
connect: undefined; | ||
disconnect: undefined; | ||
}> | ||
implements Provider<EthereumApi> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
{ | ||
export class EthereumProvider extends Emittery<{ | ||
message: MessageEvent; | ||
data: DataEvent; | ||
error: Error; | ||
"ganache:vm:tx:step": VmStepEvent; | ||
"ganache:vm:tx:before": VmBeforeTransactionEvent; | ||
"ganache:vm:tx:after": VmAfterTransactionEvent; | ||
"ganache:vm:tx:console.log": VmConsoleLogEvent; | ||
connect: undefined; | ||
disconnect: undefined; | ||
}> { | ||
#options: EthereumInternalOptions; | ||
#api: EthereumApi; | ||
#wallet: Wallet; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not related to this line, but:
--port
shorthand doesn't work--host
shorthand doesn't workinstances list
showsundefined
for the host (nohost
property is persisted to the instance file) when no host is explicitly provided