-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Affected product
SDK (JS/TS)
Version / Commit / Build
@shelby-protocol/sdk/node latest
Platform / Environment
Node
Steps to Reproduce
- Setup a Node.js project using TypeScript and
@shelby-protocol/sdk. - Enable
strict: truein tsconfig.json. - Try to configure a client using
ShelbyNetworkas a value:
const client = new ShelbyClient({ network: ShelbyNetwork.Devnet }); - Try to upload a blob directly using
ShelbyRPCClient.putBlobwithout first registering the commitments on-chain via the coordination client.
Expected Behavior
ShelbyNetworkshould be usable as a configuration value without throwing a TypeScript error.ShelbyRPCClient.putBlobshould return a clear developer-friendly error (e.g., 400 Bad Request or a descriptive message) if on-chain commitments haven't been made, explaining what step the developer missed.
Actual Behavior & Errors
- TypeScript strict mode throws an error when trying to use
ShelbyNetworkas a value:'ShelbyNetwork' only refers to a type, but is being used as a value here. This forces developers to cast it as string/any (network: "shelbynet" as any). - Calling
ShelbyRPCClient.putBlobdirectly without prior on-chain commitments results in a confusing generic HTTP 404 error from the RPC Node, which might make developers think the RPC endpoint is down or incorrect:
{"message":"not found","error_code":"web_framework_error","vm_error_code":null}
Logs / Screenshots
// test.ts (Snippet demonstrating the issues)
import { Aptos, AptosConfig, Network, Account } from "@aptos-labs/ts-sdk";
import { ShelbyClient, ShelbyNetwork } from "@shelby-protocol/sdk/node";
async function runTests() {
// 🐛 DX Issue 1: ShelbyNetwork type forcing "as any" or "as ShelbyNetwork"
// Using ShelbyNetwork.Devnet directly throws:
// TS2693: 'ShelbyNetwork' only refers to a type, but is being used as a value here.
const shelby = new ShelbyClient({
network: "shelbynet" as any,
rpc: { baseUrl: "https://api.shelbynet.shelby.xyz" }
});
const dummyBuffer = new Uint8Array(Buffer.from("Test Data", "utf-8"));
const account = Account.generate();
// 🐛 DX Issue 2: putBlob returns confusing 404 if no prior blockchain commitments exist
try {
// Assuming a developer tries to use ShelbyRPCClient standalone:
// await shelbyRPC.putBlob({ ... });
// Expected Error: "Blob commitments not found on Aptos chain"
// Actual Error Received:
// Error: Failed to start multipart upload! status: 404, body: {"message":"not found","error_code":"web_framework_error","vm_error_code":null}
} catch(e) {
console.error(e);
}
}Contact (Optional)
Pre-Checks
- I've searched existing issues
- This is not a security vulnerability (see SECURITY.md)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels