Skip to content

Commit

Permalink
Bump helixconf and disable fill rpc for configure
Browse files Browse the repository at this point in the history
  • Loading branch information
fewensa committed Aug 7, 2024
1 parent 74c695f commit bea7f6e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"license": "ISC",
"type": "module",
"dependencies": {
"@helixbridge/helixconf": "^1.1.7",
"@helixbridge/helixconf": "^1.1.10",
"@safe-global/api-kit": "^2.4.3",
"@safe-global/protocol-kit": "^4.0.3",
"ethers": "^6.13.2"
Expand Down
56 changes: 28 additions & 28 deletions src/generator/generate_configure.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async function generateWithGroup(options, group) {
};

await _fillEncryptedPrivateKey(fillOptions);
await _fillRpcnodes(fillOptions);
// await _fillRpcnodes(fillOptions);

const outputJson = JSON.stringify(configure, null, 2);
await fs.writeFile(storeFile, outputJson);
Expand Down Expand Up @@ -152,30 +152,30 @@ async function _fillEncryptedPrivateKey(options) {
}
}

async function _fillRpcnodes(options) {
const {configure, definition} = options;
const customRpcNodes = configure.rpcnodes ?? [];
const bridges = configure.bridges;
for (const bridge of bridges) {
const [sourceChainName, targetChainName] = bridge.direction.split('->');
const [sourceChain, targetChain] = [
HelixChain.get(sourceChainName),
HelixChain.get(targetChainName),
];
__updateRpcnodesRpc(customRpcNodes, {name: sourceChainName, rpc: sourceChain.rpc});
__updateRpcnodesRpc(customRpcNodes, {name: targetChainName, rpc: targetChain.rpc});
}
configure.rpcnodes = customRpcNodes;
}

function __updateRpcnodesRpc(rpcnodes, detected = {name, rpc}) {
for (const rpcnode of rpcnodes) {
if (rpcnode.name !== detected.name) {
continue;
}
if (rpcnode.rpc) return;
rpcnode.rpc = detected.rpc;
return;
}
rpcnodes.push(detected);
}
// async function _fillRpcnodes(options) {
// const {configure, definition} = options;
// const customRpcNodes = configure.rpcnodes ?? [];
// const bridges = configure.bridges;
// for (const bridge of bridges) {
// const [sourceChainName, targetChainName] = bridge.direction.split('->');
// const [sourceChain, targetChain] = [
// HelixChain.get(sourceChainName),
// HelixChain.get(targetChainName),
// ];
// __updateRpcnodesRpc(customRpcNodes, {name: sourceChainName, rpc: sourceChain.rpc});
// __updateRpcnodesRpc(customRpcNodes, {name: targetChainName, rpc: targetChain.rpc});
// }
// configure.rpcnodes = customRpcNodes;
// }
//
// function __updateRpcnodesRpc(rpcnodes, detected = {name, rpc}) {
// for (const rpcnode of rpcnodes) {
// if (rpcnode.name !== detected.name) {
// continue;
// }
// if (rpcnode.rpc) return;
// rpcnode.rpc = detected.rpc;
// return;
// }
// rpcnodes.push(detected);
// }
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@
"@ethersproject/rlp" "^5.7.0"
"@ethersproject/signing-key" "^5.7.0"

"@helixbridge/helixconf@^1.1.7":
version "1.1.7"
resolved "https://registry.yarnpkg.com/@helixbridge/helixconf/-/helixconf-1.1.7.tgz#a2d33b0a8aa03c704aa2c0e49c558bc57572e28d"
integrity sha512-1FIxGAzK4uvfz9sxmMOIvF9+e/CurUoxFgqHxSi5zIORfcp8iIZGCPIZCwgXAxxtAAz5GcrDU8STsRqcCGmzOw==
"@helixbridge/helixconf@^1.1.10":
version "1.1.10"
resolved "https://registry.yarnpkg.com/@helixbridge/helixconf/-/helixconf-1.1.10.tgz#9c1a2781a19cbb47272a799dcd9865c4b31f5145"
integrity sha512-wDRCsWKo0dmiMPCufD9qI+z/7fwZAEDYDNVmn6ttnBokNK0bVH5xSBKOVuhc5colHiiYuUlllWXYt1Yabi6cnQ==

"@noble/curves@1.2.0":
version "1.2.0"
Expand Down

0 comments on commit bea7f6e

Please sign in to comment.