Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: load TON chain configuration from yaml store #2185

Merged
merged 3 commits into from
Dec 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions contract_manager/scripts/generate_upgrade_ton_contract_proposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import path from "path";
const parser = yargs(hideBin(process.argv))
.usage(
"Upgrades the Pyth contract on TON and creates a governance proposal for it.\n" +
"Usage: $0 --network <mainnet|testnet> --contract-address <address> --ops-key-path <ops_key_path>"
"Usage: $0 --network <mainnet|testnet> --contract-address <address> --ops-key-path <ops_key_path>\n" +
"Required environment variables:\n" +
" - ENV_TON_MAINNET_API_KEY: API key for TON mainnet\n" +
" - ENV_TON_TESTNET_API_KEY: API key for TON testnet"
)
.options({
network: {
Expand Down Expand Up @@ -38,16 +41,11 @@ async function main() {
const chainId = isMainnet ? CHAINS.ton_mainnet : CHAINS.ton_testnet;
const wormholeChainName = toChainName(chainId);

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

const vault =
DefaultStore.vaults[
Expand Down
Loading