Skip to content

Commit

Permalink
fix: custom node not connecting
Browse files Browse the repository at this point in the history
  • Loading branch information
N3TC4T committed Mar 22, 2024
1 parent 0a92cab commit a5bafd3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/common/libs/ledger/types/methods/accountTx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export interface AccountTxTransaction {
* If binary is True, then this is a hex string of the transaction metadata.
* Otherwise, the transaction metadata is included in JSON format.
*/
meta: string | TransactionMetadata;
meta: TransactionMetadata;
/** JSON object defining the transaction. */
tx?: TransactionJson & ResponseOnlyTxInfo;
/** Unique hashed String representing the transaction. */
Expand Down
11 changes: 11 additions & 0 deletions src/services/NetworkService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,17 @@ class NetworkService extends EventEmitter {

// if endpoint is not in the white listed network list then use custom proxy for it
if (!find(NetworkConfig.networks, (network) => network.nodes.includes(node.endpoint))) {
// check if we need to add ws/ to the endpoint
const isUnsecureEndpoint = normalizedEndpoint.startsWith('ws://');

// remove ws:// or wss:// from the endpoint
normalizedEndpoint = normalizedEndpoint.replace('ws://', '').replace('wss://', '');

// by default custom node proxy uses wss but if the endpoint is unsecure then we need to add ws
if (isUnsecureEndpoint) {
normalizedEndpoint = `ws/${normalizedEndpoint}`;
}

normalizedEndpoint = `${NetworkConfig.customNodeProxy}/${normalizedEndpoint}`;
}

Expand Down

0 comments on commit a5bafd3

Please sign in to comment.