@abcwalletio/xrp
v1.0.0
Published
ABC WaaS XRP Ledger adapter — MPC-based public key and signing primitives for xrpl.js (secp256k1)
Downloads
24
Readme
@abcwalletio/xrp
ABC WaaS SDK의 XRP Ledger 어댑터입니다. XRP 생태계는 단일 월렛 표준이 없어
독자 인터페이스로 xrpl 라이브러리에서 서명에 사용할 수 있는 공개키와 서명
함수만 노출합니다.
Installation
pnpm add @abcwalletio/xrp @abcwalletio/core xrplPeer Dependencies
@abcwalletio/corexrpl>=3.0.0
Quick Start
import { createWaasSDK, LocalStorageAdapter } from '@abcwalletio/core';
import { AbcXrpAdapter } from '@abcwalletio/xrp';
import { Client, deriveAddress } from 'xrpl';
const sdk = await createWaasSDK({
storage: new LocalStorageAdapter(),
auth: { v2: { clientId: '...', clientSecret: '...' } },
});
// XRP는 secp256k1 키 사용
await sdk.mpc.generateKeyShare('secp256k1', 'password');
// XRP adapter는 비동기 factory로 생성 (connect 과정에서 공개키 조회)
const adapter = await AbcXrpAdapter.create({
sdk,
requestPassword: async () => prompt('MPC 비밀번호?') ?? '',
});
// xrpl 라이브러리로 XRP 주소 도출
const address = deriveAddress(adapter.getPublicKey()); // "r..."API
AbcXrpAdapter.create(config)
interface AbcXrpAdapterConfig {
sdk: WaasSDK;
requestPassword: () => Promise<string>;
keyId?: string; // 생략 시 sdk.mpc.getDefaultKeyId('secp256k1') 자동 조회
}메서드
| 메서드 | 설명 |
|--------|------|
| getPublicKey() | 33바이트 compressed secp256k1 공개키 (hex, uppercase) — deriveAddress에 사용 |
| signMessage(hashHex) | 메시지 해시 서명 (65바이트 raw: r + s + v) |
| signTransaction(txHashHex) | 트랜잭션 해시 서명 — signMessage와 동일 |
공개키 계약:
@abcwalletio/core는 secp256k1 공개키를 항상 33바이트 compressed 형식으로 반환합니다. XRP는 이 형식을 그대로 사용합니다. 만약 길이가 다르면 어댑터는 즉시 throw하여 잘못된 주소 생성을 방지합니다.
License
MIT — Copyright (c) 2026 Ahnlab Blockchain Company
