ts: Remove console logs from Node package (#1031)
This commit is contained in:
parent
ab3e1294d9
commit
e7e8f4da9b
|
@ -50,13 +50,6 @@ export type Context<A extends Accounts = Accounts> = {
|
|||
* Commitment parameters to use for a transaction.
|
||||
*/
|
||||
options?: ConfirmOptions;
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*
|
||||
* Private namespace for development.
|
||||
*/
|
||||
__private?: { logAccounts: boolean };
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,6 +18,7 @@ import {
|
|||
Address,
|
||||
} from "../common";
|
||||
import { Accounts, splitArgsAndCtx } from "../context";
|
||||
import * as features from "../../utils/features";
|
||||
import {
|
||||
AllInstructions,
|
||||
AllInstructionsMap,
|
||||
|
@ -49,9 +50,10 @@ export default class InstructionNamespaceFactory {
|
|||
keys.push(...ctx.remainingAccounts);
|
||||
}
|
||||
|
||||
if (ctx.__private && ctx.__private.logAccounts) {
|
||||
if (features.isSet("debug-logs")) {
|
||||
console.log("Outgoing account metas:", keys);
|
||||
}
|
||||
|
||||
return new TransactionInstruction({
|
||||
keys,
|
||||
programId,
|
||||
|
|
|
@ -4,6 +4,7 @@ import { Idl } from "../../idl";
|
|||
import { splitArgsAndCtx } from "../context";
|
||||
import { TransactionFn } from "./transaction";
|
||||
import { ProgramError } from "../../error";
|
||||
import * as features from "../../utils/features";
|
||||
import {
|
||||
AllInstructions,
|
||||
InstructionContextFn,
|
||||
|
@ -24,7 +25,10 @@ export default class RpcFactory {
|
|||
const txSig = await provider.send(tx, ctx.signers, ctx.options);
|
||||
return txSig;
|
||||
} catch (err) {
|
||||
console.log("Translating error", err);
|
||||
if (features.isSet("debug-logs")) {
|
||||
console.log("Translating error:", err);
|
||||
}
|
||||
|
||||
let translatedErr = ProgramError.parse(err, idlErrors);
|
||||
if (translatedErr === null) {
|
||||
throw err;
|
||||
|
|
|
@ -10,6 +10,7 @@ import { EventParser, Event } from "../event";
|
|||
import Coder from "../../coder";
|
||||
import { Idl, IdlEvent } from "../../idl";
|
||||
import { ProgramError } from "../../error";
|
||||
import * as features from "../../utils/features";
|
||||
import {
|
||||
AllInstructions,
|
||||
IdlTypes,
|
||||
|
@ -36,7 +37,10 @@ export default class SimulateFactory {
|
|||
try {
|
||||
resp = await provider!.simulate(tx, ctx.signers, ctx.options);
|
||||
} catch (err) {
|
||||
console.log("Translating error", err);
|
||||
if (features.isSet("debug-logs")) {
|
||||
console.log("Translating error:", err);
|
||||
}
|
||||
|
||||
let translatedErr = ProgramError.parse(err, idlErrors);
|
||||
if (translatedErr === null) {
|
||||
throw err;
|
||||
|
|
|
@ -17,8 +17,7 @@ let _populatedWorkspace = false;
|
|||
const workspace = new Proxy({} as any, {
|
||||
get(workspaceCache: { [key: string]: Program }, programName: string) {
|
||||
if (isBrowser) {
|
||||
console.log("Workspaces aren't available in the browser");
|
||||
return undefined;
|
||||
throw new Error("Workspaces aren't available in the browser");
|
||||
}
|
||||
|
||||
const fs = require("fs");
|
||||
|
|
Loading…
Reference in New Issue