Solana Kit

Shelby Client

The main client for Solana-Shelby integration

The Shelby class is the main entry point for interacting with the Shelby Protocol from a Solana application. It extends the core ShelbyClient with Solana-specific functionality.

Constructor

import { Shelby, Network } from "@shelby-protocol/solana-kit/node";
import { Connection } from "@solana/web3.js";

const shelbyClient = new Shelby({
  network: Network.SHELBYNET,
  connection: new Connection("https://api.devnet.solana.com"),
  apiKey: "AG-***",
});

Parameters

ParameterTypeRequiredDescription
networkShelbyNetworkYesThe Shelby network to connect with (e.g., Network.SHELBYNET)
connectionConnectionYesThe Solana network connection
apiKeystringYesYour Shelby API key

Methods

createStorageAccount

Creates a Shelby storage account derived from a Solana keypair.

const storageAccount = shelbyClient.createStorageAccount(solanaKeypair, domain);

Parameters

ParameterTypeDescription
solanaKeypairKeypairThe Solana keypair that will control the storage account
domainstringThe dApp domain for account isolation

Returns

Returns a ShelbyStorageAccount instance that can be used as a signer for transactions.

Inherited Methods

The Shelby class extends ShelbyClient and inherits all its methods:

upload

Upload blobs to the Shelby network.

await shelbyClient.upload({
  blobData: new Uint8Array([1, 2, 3]),
  signer: storageAccount,
  blobName: "example.txt",
  expirationMicros: Date.now() * 1000 + 86400000000,
});

fundAccountWithShelbyUSD

Fund an account with ShelbyUSD tokens for upload fees.

await shelbyClient.fundAccountWithShelbyUSD({
  address: storageAccount.accountAddress,
  amount: 1_000_000,
});

fundAccountWithAPT

Fund an account with APT tokens for transaction fees.

await shelbyClient.fundAccountWithAPT({
  address: storageAccount.accountAddress,
  amount: 1_000_000,
});

For a complete list of inherited methods, see the Shelby SDK documentation.