fixed mainnet url check

This commit is contained in:
Conner Gallagher 2022-06-07 23:37:40 -05:00
parent 34bfc030c8
commit ca973c15b1
4 changed files with 2873 additions and 22 deletions

File diff suppressed because it is too large Load Diff

View File

@ -10,6 +10,7 @@ import {
} from "@solana/web3.js";
import { BigUtils } from "@switchboard-xyz/sbv2-utils";
import {
AnchorWallet,
getSwitchboardPid,
programWallet,
} from "@switchboard-xyz/switchboard-v2";
@ -107,6 +108,7 @@ abstract class BaseCommand extends Command {
(flags as any).rpcUrl ??
this.getRpcUrl(this.cluster) ??
clusterApiUrl(this.cluster);
try {
this.connection = new Connection(url, {
commitment: "finalized",
@ -132,7 +134,7 @@ abstract class BaseCommand extends Command {
? new anchor.web3.PublicKey((flags as any).programId)
: getSwitchboardPid(this.cluster as "mainnet-beta" | "devnet");
const wallet = new anchor.Wallet(this.payerKeypair);
const wallet = new AnchorWallet(this.payerKeypair);
const provider = new anchor.AnchorProvider(this.connection, wallet, {
commitment: "finalized",
// preflightCommitment: "finalized",
@ -268,11 +270,11 @@ abstract class BaseCommand extends Command {
switch (cluster) {
case "devnet":
return (
this.cliConfig.devnet.rpcUrl || clusterApiUrl(toCluster("devnet"))
this.cliConfig.devnet.rpcUrl ?? clusterApiUrl(toCluster("devnet"))
);
case "mainnet-beta":
return (
this.cliConfig.devnet.rpcUrl ||
this.cliConfig.mainnet.rpcUrl ??
clusterApiUrl(toCluster("mainnet-beta"))
);
default:

View File

@ -5,6 +5,8 @@ import BaseCommand from "../../BaseCommand";
export default class ConfigPrint extends BaseCommand {
static description = "print cli config";
static alias = ["config get"];
static flags = {
...BaseCommand.flags,
};

View File

@ -34,7 +34,7 @@
"registry": "https://npm.pkg.github.com"
},
"version": {
"message": "chore(release): publish %s",
"message": "chore(release): publish",
"allowBranch": "main"
}
}