MCPcopy Create free account
hub / github.com/cutupdev/Solana-Volume-Bot / editJson

Function editJson

utils/utils.ts:110–123  ·  view source on GitHub ↗
(newData: Partial<Data>, filename: string = "data.json")

Source from the content-addressed store, hash-verified

108
109// Function to edit JSON file content
110export function editJson(newData: Partial<Data>, filename: string = "data.json"): void {
111 if(!newData.pubkey) {
112 console.log("Pubkey is not prvided as an argument")
113 return
114 }
115 const wallets = readJson(filename);
116 const index = wallets.findIndex(wallet => wallet.pubkey === newData.pubkey);
117 if (index !== -1) {
118 wallets[index] = { ...wallets[index], ...newData };
119 writeJson(wallets, filename);
120 } else {
121 console.error(`Pubkey ${newData.pubkey} does not exist.`);
122 }
123}
124

Callers 4

buyFunction · 0.90
sellFunction · 0.90
buyFunction · 0.90
sellFunction · 0.90

Calls 2

readJsonFunction · 0.85
writeJsonFunction · 0.85

Tested by

no test coverage detected