Binance TypeScript SDK example: rest-private-ed25519.ts

Binance TypeScript SDK Auth example for Binance/Auth/rest-private-ed25519.ts. Source code reference for exchange REST, WebSocket, and API integration patterns with links to matching Siebly SDK documentation.

Example Path

Binance/Auth/rest-private-ed25519.ts

Source Link

Repository source: https://github.com/sieblyio/crypto-api-examples/blob/master/examples/Binance/Auth/rest-private-ed25519.ts

Related SDK Docs

Example Source

import { MainClient } from 'binance';

// Received after creating a new API key with a self-generated RSA public key on binance

// The self-generated RSA private key, this is never directly given to binance, but used to generate a signature
// Note: this MUST include the "BEGIN PRIVATE KEY" header so the SDK understands this is RSA auth
const ed25519PrivateKey = `
-----BEGIN PRIVATE KEY-----
lkmlkm123lkms1s12s+lkmlkm123lkms1s12s
-----END PRIVATE KEY-----
`;

const ed25519APIKey = 'lkmlkm123lkms1s12slkmlkm123lkms1s12slkmlkm123lkms1s12s';

const client = new MainClient({
  api_key: ed25519APIKey,
  api_secret: ed25519PrivateKey,
  beautifyResponses: true,
});

(async () => {
  try {
    console.log('private api call result: ', await client.getAccountInfo());
  } catch (e) {
    console.error('request failed: ', e);
  }
})();