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

chain-sdk library #118

Open
baktun14 opened this issue Jan 30, 2025 · 0 comments
Open

chain-sdk library #118

baktun14 opened this issue Jan 30, 2025 · 0 comments
Assignees

Comments

@baktun14
Copy link
Contributor

baktun14 commented Jan 30, 2025

Library Overview

Usage

api/grpc

import { ChainSDK } from "@akashnetwork/chain-sdk/chain-sdk"

// Using the sdk instance
const chainSdk = new ChainSDK({
  rest: "https://api.akashnet.net",
  rpc: "https://rpc.akashnet.net"
});

// Querying data from api or grpc with typed parameters
// https://api.akashnet.net/akash/deployment/v1beta3/deployments/info?id.owner=akash1234&id.dseq=1234;
const response = await axios.get(chainSdk.rest.deployments.info({ owner: "akash1234", dseq: "1234" }));
const deployment = response.data.deployment; // Typed response

// Potential grpc usage
const response = await chainSdk.grpc.deployments.info({ owner: "akash1234", dseq: "1234" });

protobuf

// Importing the protobuf types
import { MsgCreateBid } from "@akashnetwork/chain-sdk/akash/market/v1beta4";

certificates

// Certificate utils
import { certificateManager } from "@akashnetwork/chain-sdk/certificate";

const { cert: crtpem, publicKey: pubpem, privateKey: encryptedKey } = certificateManager.generatePEM(address);

sdl

import { SDL, v2Sdl, NetworkId } from "@akashnetwork/chain-sdk/sdl";

export function getSdl(yamlJson: string | v2Sdl, networkType: NetworkType, networkId: NetworkId) {
  return isValidString(yamlJson) ? SDL.fromString(yamlJson, networkType, networkId) : new SDL(yamlJson, networkType, networkId);
}
@github-project-automation github-project-automation bot moved this to Backlog (not prioritized) in Client Product and Engineering Roadmap Jan 30, 2025
@baktun14 baktun14 moved this from Backlog (not prioritized) to Up Next (prioritized) in Client Product and Engineering Roadmap Jan 30, 2025
@baktun14 baktun14 added this to the Package Rework milestone Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Up Next (prioritized)
Development

No branches or pull requests

2 participants