Skip to content

Commit

Permalink
docs(Reference): Give object parameters a name if they will be includ…
Browse files Browse the repository at this point in the history
…ed in the docs.

With dgeni typescript parsing, function parameters display awkwardly if they are unnamed objects.
Giving them a name like "options" fixes the issue and displays them properly.

neo-one-suite#702
  • Loading branch information
afragapane committed Dec 17, 2018
1 parent 71f6128 commit 497041a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 17 deletions.
13 changes: 5 additions & 8 deletions packages/neo-one-client-common/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,12 @@ export function isNEP2(encryptedKey: string): boolean {
* @param privateKey hex-encoded private key
* @returns NEP-2 format encrypted key
*/
export async function encryptNEP2({
password,
privateKey,
}: {
export async function encryptNEP2(options: {
readonly password: string;
readonly privateKey: PrivateKeyString;
}): Promise<string> {
const { password, privateKey } = options;

return crypto.encryptNEP2({
addressVersion: common.NEO_ADDRESS_VERSION,
privateKey: common.stringToPrivateKey(privateKey),
Expand All @@ -144,13 +143,11 @@ export async function encryptNEP2({
* @param encryptedKey NEP-2 format encrypted key
* @returns hex-encoded private key
*/
export async function decryptNEP2({
password,
encryptedKey,
}: {
export async function decryptNEP2(options: {
readonly password: string;
readonly encryptedKey: string;
}): Promise<PrivateKeyString> {
const { password, encryptedKey } = options;
const privateKey = await crypto.decryptNEP2({
addressVersion: common.NEO_ADDRESS_VERSION,
encryptedKey,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,8 @@ export class NEOONEOneDataProvider implements DeveloperProvider {
private readonly iterBlocksFetchTimeoutMS: number | undefined;
private readonly iterBlocksBatchSize: number | undefined;

public constructor({
network,
projectID,
port,
iterBlocksFetchTimeoutMS,
iterBlocksBatchSize,
}: NEOONEOneDataProviderOptions) {
public constructor(options: NEOONEOneDataProviderOptions) {
const { network, projectID, port, iterBlocksFetchTimeoutMS, iterBlocksBatchSize } = options;
this.network = network;
this.projectID = projectID;
this.port = port;
Expand Down
3 changes: 2 additions & 1 deletion packages/neo-one-client-core/src/provider/NEOONEProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ export class NEOONEProvider implements Provider {
return this.networksInternal$.getValue();
}

public addNetwork({ network, rpcURL }: { readonly network: NetworkType; readonly rpcURL: string }): void {
public addNetwork(options: { readonly network: NetworkType; readonly rpcURL: string }): void {
const { network, rpcURL } = options;
this.mutableProviders[network] = new NEOONEDataProvider({ network, rpcURL });
const networks = this.networksInternal$.value.filter((net) => network !== net).concat([network]);
this.networksInternal$.next(networks);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ export class LocalUserAccountProvider<TKeyStore extends KeyStore, TProvider exte
protected readonly mutableUsedOutputs: Set<string>;
protected mutableBlockCount: number;

public constructor({ keystore, provider }: { readonly keystore: TKeyStore; readonly provider: TProvider }) {
public constructor(constructorOptions: { readonly keystore: TKeyStore; readonly provider: TProvider }) {
const { keystore, provider } = constructorOptions;
this.keystore = keystore;
this.provider = provider;

Expand Down

0 comments on commit 497041a

Please sign in to comment.