Skip to content

Commit

Permalink
cleanup: drop certs
Browse files Browse the repository at this point in the history
They are not useful in the current impl.
  • Loading branch information
ChALkeR committed Dec 15, 2021
1 parent b03926b commit c1fe66d
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 532 deletions.
15 changes: 4 additions & 11 deletions src/ManagedNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import ManagedNodeAddress from "./ManagedNodeAddress.js";
* @template {Channel} ChannelT
* @typedef {object} NewNode
* @property {string | ManagedNodeAddress} address
* @property {(address: string, cert?: string) => ChannelT} channelInitFunction
* @property {(address: string) => ChannelT} channelInitFunction
*/

/**
Expand All @@ -37,13 +37,10 @@ export default class ManagedNode {
? ManagedNodeAddress.fromString(props.newNode.address)
: props.newNode.address;

/** @type {string=} */
this._cert = undefined;

/** @type {ChannelT | null} */
this._channel = null;

/** @type {(address: string, cert?: string) => ChannelT} */
/** @type {(address: string) => ChannelT} */
this._channelInitFunction = props.newNode.channelInitFunction;

this._currentBackoff = 250;
Expand All @@ -57,13 +54,10 @@ export default class ManagedNode {
/** @type {ManagedNodeAddress} */
this._address = props.cloneNode.address;

/** @type {string=} */
this._cert = props.cloneNode.node._cert;

/** @type {ChannelT | null} */
this._channel = props.cloneNode.node._channel;

/** @type {(address: string, cert?: string) => ChannelT} */
/** @type {(address: string) => ChannelT} */
this._channelInitFunction =
props.cloneNode.node._channelInitFunction;

Expand Down Expand Up @@ -193,8 +187,7 @@ export default class ManagedNode {
}

this._channel = this._channelInitFunction(
this.address.toString(),
this._cert
this.address.toString()
);
return this._channel;
}
Expand Down
25 changes: 1 addition & 24 deletions src/Node.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import ManagedNode from "./ManagedNode.js";
import { _ledgerIdToNetworkName } from "./NetworkName.js";
import { PREVIEWNET_CERTS, TESTNET_CERTS, MAINNET_CERTS } from "./NodeCerts.js";

/**
* @typedef {import("./account/AccountId.js").default} AccountId
Expand All @@ -13,7 +12,7 @@ import { PREVIEWNET_CERTS, TESTNET_CERTS, MAINNET_CERTS } from "./NodeCerts.js";
* @typedef {object} NewNode
* @property {AccountId} accountId
* @property {string} address
* @property {(address: string, cert?: string) => Channel} channelInitFunction
* @property {(address: string) => Channel} channelInitFunction
*/

/**
Expand Down Expand Up @@ -80,28 +79,6 @@ export default class Node extends ManagedNode {
);
}

/**
* @param {string} ledgerId
* @returns {this}
*/
setCert(ledgerId) {
const networkName = _ledgerIdToNetworkName(ledgerId);

switch (networkName) {
case "previewnet":
this._cert = PREVIEWNET_CERTS[this._accountId.toString()];
break;
case "testnet":
this._cert = TESTNET_CERTS[this._accountId.toString()];
break;
case "mainnet":
this._cert = MAINNET_CERTS[this._accountId.toString()];
break;
}

return this;
}

/**
* @returns {AccountId}
*/
Expand Down
Loading

0 comments on commit c1fe66d

Please sign in to comment.