メインコンテンツへスキップ

概要

ウォレット登録は、LaserSell APIに対してSolanaウォレットの所有権を証明します。Exit Intelligence Streamにウォレットを接続する前に登録が必要です。ストリームはconfigureメッセージ内のすべてのウォレットがアカウントに登録されていることを検証します。 登録にはEd25519署名を使用するため、オンチェーントランザクションは不要です。

POST /v1/wallets/register

Ed25519署名で所有権を証明してウォレットを登録します。

リクエスト

{
  "wallet_pubkey": "YourWalletPubkey...",
  "signature": "base58-encoded-ed25519-signature",
  "message": "lasersell-register:YourWalletPubkey...:1706000000",
  "label": "My Trading Wallet"
}
フィールド必須説明
wallet_pubkeystringはい登録するSolanaウォレット公開鍵。
signaturestringはいメッセージのEd25519署名(base58エンコード)。
messagestringはい構造化メッセージ: lasersell-register:<pubkey>:<unix_timestamp>。タイムスタンプは5分以内である必要があります。
labelstringいいえウォレットのオプションの人間可読ラベル。

レスポンス

{
  "wallet_pubkey": "YourWalletPubkey...",
  "registered": true
}

認証

有効なAPIキーを含むx-api-keyヘッダーが必要です。

エラー

ステータスコード説明
400Bad Request無効なpubkeyフォーマット、不正なメッセージ、またはタイムスタンプ期限切れ(5分超)。
403ForbiddenAPIキーの欠落/無効、または署名検証失敗。

DELETE /v1/wallets

ウォレットの登録を解除します。

リクエスト

{
  "wallet_pubkey": "YourWalletPubkey..."
}

レスポンス

{
  "wallet_pubkey": "YourWalletPubkey...",
  "removed": true
}

SDKの使用方法

4つのSDKすべてにウォレット登録用のヘルパーメソッドが用意されています。

proveOwnership / prove_ownership

キーペアを使用してローカルでWalletProofを生成します。ネットワーク呼び出しのない純粋な暗号操作です。
import { proveOwnership } from "@lasersell/lasersell-sdk";

const proof = proveOwnership(keypair);
// proof = { walletPubkey, signature, message }

registerWallet / register_wallet

証明をAPIに送信してウォレットを登録します。
const client = ExitApiClient.withApiKey(apiKey);
await client.registerWallet(proof, "My Wallet");

connectWithWallets / connect_with_wallets

ウォレットの登録とストリーム接続を1ステップで行う便利メソッドです。
import { StreamClient, proveOwnership } from "@lasersell/lasersell-sdk";

const proof = proveOwnership(keypair);
const client = new StreamClient(apiKey);
const session = await client.connectWithWallets(
  [proof],
  { target_profit_pct: 50, stop_loss_pct: 10 },
  120, // deadline_timeout_sec
);