@pod-protocol/cli
Version:
Command-line interface for PoD Protocol (Prompt or Die) AI Agent Communication Protocol
31 lines (30 loc) • 925 B
JavaScript
import { PodComClient } from "@pod-protocol/sdk";
import { getNetworkEndpoint, loadKeypair } from "./config.js";
export async function createClient(network, wallet) {
const client = new PodComClient({
endpoint: getNetworkEndpoint(network),
commitment: "confirmed",
});
await client.initialize(wallet);
return client;
}
export function getWallet(keypairPath) {
const keypair = loadKeypair(keypairPath);
// Return wallet-like interface that Anchor expects
return {
publicKey: keypair.publicKey,
signTransaction: async (tx) => {
tx.partialSign(keypair);
return tx;
},
signAllTransactions: async (txs) => {
return txs.map((tx) => {
tx.partialSign(keypair);
return tx;
});
},
};
}
export function getKeypair(keypairPath) {
return loadKeypair(keypairPath);
}