Skip to content

Commit d97a2f0

Browse files
devin-ai-integration[bot]Jayant Krishnamurthy
and
Jayant Krishnamurthy
authored
refactor: load TON chain configuration from yaml store (#2185)
* refactor: load TON chain configuration from yaml store Co-Authored-By: Jayant Krishnamurthy <jayant@dourolabs.xyz> * docs: add build command to README Co-Authored-By: Jayant Krishnamurthy <jayant@dourolabs.xyz> * docs: remove build command from README Co-Authored-By: Jayant Krishnamurthy <jayant@dourolabs.xyz> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Jayant Krishnamurthy <jayant@dourolabs.xyz>
1 parent a65d6da commit d97a2f0

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

contract_manager/scripts/generate_upgrade_ton_contract_proposal.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import path from "path";
99
const parser = yargs(hideBin(process.argv))
1010
.usage(
1111
"Upgrades the Pyth contract on TON and creates a governance proposal for it.\n" +
12-
"Usage: $0 --network <mainnet|testnet> --contract-address <address> --ops-key-path <ops_key_path>"
12+
"Usage: $0 --network <mainnet|testnet> --contract-address <address> --ops-key-path <ops_key_path>\n" +
13+
"Required environment variables:\n" +
14+
" - ENV_TON_MAINNET_API_KEY: API key for TON mainnet\n" +
15+
" - ENV_TON_TESTNET_API_KEY: API key for TON testnet"
1316
)
1417
.options({
1518
network: {
@@ -38,16 +41,11 @@ async function main() {
3841
const chainId = isMainnet ? CHAINS.ton_mainnet : CHAINS.ton_testnet;
3942
const wormholeChainName = toChainName(chainId);
4043

41-
// Get the TON chain instance with appropriate RPC URL based on network
42-
const chain = new TonChain(
43-
chainId.toString(),
44-
isMainnet,
45-
wormholeChainName,
46-
undefined,
47-
isMainnet
48-
? "https://toncenter.com/api/v2/jsonRPC"
49-
: "https://testnet.toncenter.com/api/v2/jsonRPC"
50-
);
44+
// Get the TON chain instance from DefaultStore based on network
45+
const chain = DefaultStore.chains[isMainnet ? "ton_mainnet" : "ton_testnet"];
46+
if (!chain || !(chain instanceof TonChain)) {
47+
throw new Error(`Chain configuration not found for TON ${argv.network}`);
48+
}
5149

5250
const vault =
5351
DefaultStore.vaults[

0 commit comments

Comments
 (0)