@xrpname/sdk 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +131 -2
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +185 -0
- package/dist/index.d.ts +185 -0
- package/dist/index.js +1 -0
- package/package.json +53 -4
package/README.md
CHANGED
|
@@ -1,3 +1,132 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @xrpname/sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Official SDK for **XRPName** — the XRP Ledger Name Service (XNS). Resolve `.xrp`
|
|
4
|
+
names, check availability, list names, read order/pending state, and pull
|
|
5
|
+
explorer data.
|
|
6
|
+
|
|
7
|
+
- **Zero dependencies** — talks to the public `xrplnftv3` API over `fetch`.
|
|
8
|
+
- **Node 18+ and browsers** — one codebase.
|
|
9
|
+
- **Typed** — ships `.d.ts`.
|
|
10
|
+
|
|
11
|
+
> Supersedes the old `xrplidjs` package. The 1.x `SDK({ rpcUrl, Issuer })` call and
|
|
12
|
+
> the `getAddress` / `getName` / `getAllNames` methods still work (see Migration).
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @xrpname/sdk
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Quick start
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { XrplId } from '@xrpname/sdk';
|
|
24
|
+
|
|
25
|
+
const xns = new XrplId();
|
|
26
|
+
|
|
27
|
+
// Resolution
|
|
28
|
+
await xns.resolve('xrpdomains.xrp'); // "rLhi87…" | null (name → owner)
|
|
29
|
+
await xns.reverse('rLhi87…'); // "hello.xrp" | null (address → primary name)
|
|
30
|
+
await xns.isOwner('rLhi87…'); // true | false
|
|
31
|
+
await xns.resolveFull('xrpdomains.xrp');// { owner, nftokenId, metadataUrl, metadata, raw } | null
|
|
32
|
+
|
|
33
|
+
// Availability
|
|
34
|
+
await xns.available('my-new-name'); // true | false (bare name → my-new-name.xrp)
|
|
35
|
+
await xns.checkMany(['a.xrp', 'b.xrp']);// [{ domain, owner, nftokenId, status, issuer }]
|
|
36
|
+
|
|
37
|
+
// Owned names (sorted + paginated)
|
|
38
|
+
await xns.names('rLhi87…', { page: 1, limit: 50, sort: 'newest', keyword: 'xr' });
|
|
39
|
+
// → { items, total, page, limit, totalPages, owner }
|
|
40
|
+
|
|
41
|
+
// Orders & assets
|
|
42
|
+
await xns.order('hello.xrp'); // order record | null (poll after registration)
|
|
43
|
+
await xns.pending('rLhi87…'); // { mint, incoming, outgoing }
|
|
44
|
+
await xns.nft('000800…'); // NFT detail | null
|
|
45
|
+
|
|
46
|
+
// Explorer / analytics
|
|
47
|
+
await xns.explorer.recent(12);
|
|
48
|
+
await xns.explorer.sales(12);
|
|
49
|
+
await xns.explorer.listings(600);
|
|
50
|
+
await xns.explorer.market();
|
|
51
|
+
await xns.explorer.pulse('30d');
|
|
52
|
+
await xns.explorer.minters('7d', 10);
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
CommonJS: `const { XrplId } = require('@xrpname/sdk');`
|
|
56
|
+
|
|
57
|
+
## Configuration
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
new XrplId({
|
|
61
|
+
baseUrl: 'https://app.xrpdomains.xyz/api/xrplnftv3', // default (v3)
|
|
62
|
+
issuer: 'raAyaz…', // default mainnet issuer
|
|
63
|
+
defaultTld:'xrp', // bare name → name.xrp
|
|
64
|
+
timeoutMs: 10000,
|
|
65
|
+
retries: 2, // network / 5xx only, never 4xx
|
|
66
|
+
headers: {},
|
|
67
|
+
fetch, // inject for Node < 18 / tests
|
|
68
|
+
});
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Methods
|
|
72
|
+
|
|
73
|
+
| Method | Returns |
|
|
74
|
+
| --- | --- |
|
|
75
|
+
| `resolve(name)` | `string \| null` — owner address |
|
|
76
|
+
| `resolveFull(name)` | `NameRecord \| null` |
|
|
77
|
+
| `reverse(address)` | `string \| null` — primary name |
|
|
78
|
+
| `isOwner(address)` | `boolean` |
|
|
79
|
+
| `names(address, { page, limit, sort, keyword })` | `NamesPage` |
|
|
80
|
+
| `available(name)` | `boolean` |
|
|
81
|
+
| `checkMany(names[])` | `DomainStatus[]` |
|
|
82
|
+
| `order(domain)` | order record `\| null` |
|
|
83
|
+
| `pending(owner)` | `{ mint, incoming, outgoing }` |
|
|
84
|
+
| `nft(nftokenId)` | record `\| null` |
|
|
85
|
+
| `addresses(name)` | `CoinAddress[]` — multicoin records |
|
|
86
|
+
| `addressOf(name, symbol)` | `string \| null` — e.g. BTC/ETH address |
|
|
87
|
+
| `avatar(name)` | `string \| null` — image URL |
|
|
88
|
+
| `record(name, key)` | `string \| null` — text/profile record |
|
|
89
|
+
| `reverseMany(addresses[])` | `[{ address, name }]` — batch reverse |
|
|
90
|
+
| `explorer.{recent,sales,listings,market,pulse,minters,holders,collections,categories}` | parsed data |
|
|
91
|
+
|
|
92
|
+
Helpers: `isValidAddress(value)`, `normalizeName(name, tld?)`.
|
|
93
|
+
Errors throw `XrplIdError` (`.code`: `bad_request` · `http_error` · `network` · `timeout` ·
|
|
94
|
+
`invalid_response`; `.httpStatus` for HTTP). Unregistered lookups return `null` / `[]`,
|
|
95
|
+
they don't throw.
|
|
96
|
+
|
|
97
|
+
## Underlying API (`xrplnftv3`)
|
|
98
|
+
|
|
99
|
+
All endpoints live under `baseUrl` and return `{ status, code, msg, data }`.
|
|
100
|
+
|
|
101
|
+
| Endpoint | Query | SDK method |
|
|
102
|
+
| --- | --- | --- |
|
|
103
|
+
| `GET getAddress` | `domain` | `resolve`, `resolveFull` |
|
|
104
|
+
| `GET getName` | `address` | `reverse` |
|
|
105
|
+
| `GET isOwner` | `address` | `isOwner` |
|
|
106
|
+
| `GET getAllNames` | `address,page,limit,sort,keyword` | `names` |
|
|
107
|
+
| `GET checkDomains` | `domain` (CSV) | `available`, `checkMany` |
|
|
108
|
+
| `GET getOrderbyDomain` | `domain` | `order` |
|
|
109
|
+
| `GET getPendingDomains` | `owner` | `pending` |
|
|
110
|
+
| `GET getNftByTokenId` | `nftoken_id` | `nft` |
|
|
111
|
+
| `GET recent/sales/listings/market/pulse/minters/holders/collections/categories` | varies | `explorer.*` |
|
|
112
|
+
|
|
113
|
+
## Migration from `xrplidjs`
|
|
114
|
+
|
|
115
|
+
```js
|
|
116
|
+
const { SDK } = require('@xrpname/sdk');
|
|
117
|
+
const sdk = SDK({ Issuer: 'raAyaz…' }); // rpcUrl no longer needed (resolves via REST v3)
|
|
118
|
+
await sdk.getAddress('xrpdomains.xrp'); // still works → alias of resolve()
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
`getAddress` → `resolve`, `getName` → `reverse`, `getAllNames` → first-page domain strings.
|
|
122
|
+
|
|
123
|
+
## Develop
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
npm install
|
|
127
|
+
npm run build # dist/ (esm + cjs + d.ts) via tsup
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Support
|
|
131
|
+
|
|
132
|
+
info@xrpdomains.xyz · https://xrpdomains.xyz
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var y=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var A=(i,t)=>{for(var e in t)y(i,e,{get:t[e],enumerable:!0})},J=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of x(t))!k.call(i,s)&&s!==e&&y(i,s,{get:()=>t[s],enumerable:!(r=_(t,s))||r.enumerable});return i};var T=i=>J(y({},"__esModule",{value:!0}),i);var E={};A(E,{DEFAULT_BASE_URL:()=>v,DEFAULT_ISSUER:()=>P,DEFAULT_TLD:()=>L,SDK:()=>R,XrplId:()=>p,XrplIdError:()=>o,XrplIdExplorer:()=>w,default:()=>D,isValidAddress:()=>c,normalizeName:()=>h});module.exports=T(E);var v="https://app.xrpdomains.xyz/api/xrplnftv3",P="raAyazbgEkwzLByXipQuPLWFfnsPS1v1q9",L="xrp",o=class extends Error{constructor(t,e,r){super(t),this.name="XrplIdError",this.code=e,this.httpStatus=r}},S=/^r[1-9A-HJ-NP-Za-km-z]{24,34}$/;function c(i){return typeof i=="string"&&S.test(i)}function h(i,t="xrp"){if(typeof i!="string")throw new o("name must be a string","bad_request");let e=i.trim().toLowerCase();if(!e)throw new o("name must not be empty","bad_request");return e.includes(".")||(e=`${e}.${t.replace(/^\./,"")}`),e}var b=i=>new Promise(t=>setTimeout(t,i)),f=(i,t=0)=>typeof i=="number"&&isFinite(i)?i:t,w=class{constructor(t){this.client=t}recent(t=12){return this.client._explorer("recent",{limit:t})}sales(t=12){return this.client._explorer("sales",{limit:t})}listings(t=600){return this.client._explorer("listings",{limit:t})}market(){return this.client._explorer("market",{})}pulse(t="30d"){return this.client._explorer("pulse",{range:t})}minters(t="7d",e=10){return this.client._explorer("minters",{range:t,limit:e})}holders(t={}){return this.client._explorer("holders",t)}collections(){return this.client._explorer("collections",{})}categories(){return this.client._explorer("categories",{})}},p=class{constructor(t={}){this.baseUrl=(t.baseUrl??v).replace(/\/+$/,""),this.issuer=t.issuer??P,this.defaultTld=(t.defaultTld??"xrp").replace(/^\./,""),this.timeoutMs=t.timeoutMs??1e4,this.retries=Math.max(0,t.retries??2),this.headers={Accept:"application/json",...t.headers};let e=t.fetch??globalThis.fetch;if(typeof e!="function")throw new o("global fetch unavailable; pass config.fetch (Node < 18 needs a polyfill)","bad_request");this._fetch=e.bind(globalThis),this.explorer=new w(this)}async send(t,e){let r=new URL(`${this.baseUrl}/${t}`);for(let[a,d]of Object.entries(e.query??{}))r.searchParams.set(a,String(d));let{query:s,...n}=e,u;for(let a=0;a<=this.retries;a++){let d=new AbortController,m=setTimeout(()=>d.abort(),this.timeoutMs);try{let l=await this._fetch(r.toString(),{...n,headers:{...this.headers,...n.headers},signal:d.signal});if(!l.ok){if(l.status>=500&&a<this.retries){u=new o(`HTTP ${l.status}`,"http_error",l.status),await b(200*(a+1));continue}throw new o(`resolver returned HTTP ${l.status}`,"http_error",l.status)}let g;try{g=await l.json()}catch{throw new o("resolver returned invalid JSON","invalid_response",l.status)}if(!g||typeof g!="object")throw new o("unexpected resolver response","invalid_response",l.status);return g}catch(l){if(l instanceof o){if(l.code==="http_error"&&(l.httpStatus??0)>=500&&a<this.retries){u=l,await b(200*(a+1));continue}throw l}let g=l?.name==="AbortError";if(u=new o(g?`request timed out after ${this.timeoutMs}ms`:`network error: ${String(l)}`,g?"timeout":"network"),a<this.retries){await b(200*(a+1));continue}throw u}finally{clearTimeout(m)}}throw u??new o("request failed","network")}get(t,e={}){return this.send(t,{method:"GET",query:e})}async _explorer(t,e){let r=await this.get(t,e);return r.data??r}async resolve(t){return(await this.resolveFull(t))?.owner??null}async resolveFull(t){let e=h(t,this.defaultTld),r=await this.get("getAddress",{domain:e}),s=r.data??{},n=s.owner;return!r.status||!c(n)?null:{owner:n,nftokenId:typeof s.nftoken_id=="string"?s.nftoken_id:"",metadataUrl:typeof s.metadata_url=="string"?s.metadata_url:"",metadata:s.metadata&&typeof s.metadata=="object"?s.metadata:{},raw:s}}async reverse(t){if(!c(t))throw new o("invalid XRPL address","bad_request");let e=await this.get("getName",{address:t}),r=typeof e.data=="string"?e.data.trim():"";return e.status&&r?r.toLowerCase():null}async isOwner(t){if(!c(t))throw new o("invalid XRPL address","bad_request");let e=await this.get("isOwner",{address:t});return e.status===!0&&e.data===!0}async names(t,e={}){if(!c(t))throw new o("invalid XRPL address","bad_request");let r={address:t};e.page&&(r.page=e.page),e.limit&&(r.limit=e.limit),e.sort&&(r.sort=e.sort),e.keyword&&(r.keyword=e.keyword);let s=await this.get("getAllNames",r),n=Array.isArray(s.data)?s.data:[];return{items:n,total:f(s.total,n.length),page:f(s.page,e.page??1),limit:f(s.limit,e.limit??50),totalPages:f(s.total_pages,1),owner:typeof s.owner=="string"?s.owner:t}}async available(t){let[e]=await this.checkMany([t]);return e?.status==="available"}async checkMany(t){let e=t.map(n=>h(n,this.defaultTld));if(!e.length)return[];let r=await this.get("checkDomains",{domain:e.join(",")});return(Array.isArray(r.data)?r.data:[]).map(n=>({domain:String(n.domain??""),owner:typeof n.owner=="string"?n.owner:"",nftokenId:typeof n.nftoken_id=="string"?n.nftoken_id:"",status:n.status==="available"?"available":"registered",issuer:typeof n.issuer=="string"?n.issuer:this.issuer}))}async order(t){let e=await this.get("getOrderbyDomain",{domain:h(t,this.defaultTld)});return e.status&&e.data&&typeof e.data=="object"?e.data:null}async pending(t){if(!c(t))throw new o("invalid XRPL address","bad_request");let e=await this.get("getPendingDomains",{owner:t}),r=s=>Array.isArray(e[s])?e[s]:[];return{mint:r("mint"),incoming:r("incoming"),outgoing:r("outgoing")}}async nft(t){if(!t)throw new o("nftokenId required","bad_request");let e=await this.get("getNftByTokenId",{nftoken_id:t});return e.status&&e.data&&typeof e.data=="object"?e.data:null}async addresses(t){let e=await this.resolveFull(t);return(e&&Array.isArray(e.raw.addresses)?e.raw.addresses:[]).map(s=>({type:String(s.type??""),symbol:String(s.symbol??""),name:String(s.name??""),address:String(s.address??""),verified:s.verified===!0,visible:s.visible!==!1}))}async addressOf(t,e){let r=e.trim().toLowerCase();return(await this.addresses(t)).find(n=>n.symbol.toLowerCase()===r||n.type.toLowerCase()===r)?.address||null}async avatar(t){let e=await this.resolveFull(t);if(!e)return null;let r=e.metadata.image??e.raw.profile_image;return typeof r=="string"&&r?r:null}async record(t,e){let r=await this.resolveFull(t);if(!r)return null;let s=e.trim().toLowerCase(),n=[r.metadata,r.raw.profile_info,r.raw];for(let a of n)if(a&&typeof a=="object"){for(let[d,m]of Object.entries(a))if(d.toLowerCase()===s&&(typeof m=="string"||typeof m=="number"))return String(m)}let u=r.metadata.attributes??r.raw.attributes;if(Array.isArray(u)){for(let a of u)if(String(a.trait_type??a.key??a.name??"").toLowerCase()===s&&a.value!=null)return String(a.value)}return null}async reverseMany(t,e=5){let r=new Array(t.length),s=0,n=async()=>{for(;;){let u=s++;if(u>=t.length)break;let a=t[u],d=null;try{d=await this.reverse(a)}catch{d=null}r[u]={address:a,name:d}}};return await Promise.all(Array.from({length:Math.max(1,e)},n)),r}getAddress(t){return this.resolve(t)}getName(t){return this.reverse(t)}async getAllNames(t){return(await this.names(t,{limit:100})).items.map(r=>String(r.domain??"")).filter(Boolean)}};function R(i={}){let{Issuer:t,rpcUrl:e,...r}=i;return new p({...r,issuer:r.issuer??t})}var D=p;0&&(module.exports={DEFAULT_BASE_URL,DEFAULT_ISSUER,DEFAULT_TLD,SDK,XrplId,XrplIdError,XrplIdExplorer,isValidAddress,normalizeName});
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @xrpname/sdk — XRPL Name Service (XRPName / XNS) SDK.
|
|
3
|
+
*
|
|
4
|
+
* Resolve `.xrp` names on the XRP Ledger, check availability, list names,
|
|
5
|
+
* read order/pending state, and pull explorer data. Zero runtime dependencies;
|
|
6
|
+
* talks to the public `xrplnftv3` API over `fetch`, so it runs in Node 18+ and
|
|
7
|
+
* modern browsers.
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { XrplId } from '@xrpname/sdk';
|
|
11
|
+
* const xns = new XrplId();
|
|
12
|
+
* await xns.resolve('xrpdomains.xrp'); // -> "raAyaz..." | null
|
|
13
|
+
* await xns.available('free-name.xrp'); // -> true | false
|
|
14
|
+
* await xns.reverse('raAyaz...'); // -> "hello.xrp" | null
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
/** Public resolver API base (XRPName mainnet, v3 controller). */
|
|
18
|
+
declare const DEFAULT_BASE_URL = "https://app.xrpdomains.xyz/api/xrplnftv3";
|
|
19
|
+
/** Default XRPName issuer account on XRPL mainnet. */
|
|
20
|
+
declare const DEFAULT_ISSUER = "raAyazbgEkwzLByXipQuPLWFfnsPS1v1q9";
|
|
21
|
+
/** TLD appended to a bare name with no dot. */
|
|
22
|
+
declare const DEFAULT_TLD = "xrp";
|
|
23
|
+
/** Configuration for an {@link XrplId} client. All fields optional. */
|
|
24
|
+
interface XrplIdConfig {
|
|
25
|
+
baseUrl?: string;
|
|
26
|
+
issuer?: string;
|
|
27
|
+
defaultTld?: string;
|
|
28
|
+
timeoutMs?: number;
|
|
29
|
+
retries?: number;
|
|
30
|
+
headers?: Record<string, string>;
|
|
31
|
+
fetch?: typeof fetch;
|
|
32
|
+
}
|
|
33
|
+
/** Standard v3 response envelope. Some endpoints add sibling fields next to `data`. */
|
|
34
|
+
interface Envelope<T = unknown> {
|
|
35
|
+
status: boolean;
|
|
36
|
+
code?: number;
|
|
37
|
+
msg?: string;
|
|
38
|
+
message?: string;
|
|
39
|
+
data: T;
|
|
40
|
+
[extra: string]: unknown;
|
|
41
|
+
}
|
|
42
|
+
type Json = Record<string, unknown>;
|
|
43
|
+
/** Full record for a resolved name. */
|
|
44
|
+
interface NameRecord {
|
|
45
|
+
owner: string;
|
|
46
|
+
nftokenId: string;
|
|
47
|
+
metadataUrl: string;
|
|
48
|
+
metadata: Json;
|
|
49
|
+
raw: Json;
|
|
50
|
+
}
|
|
51
|
+
/** One entry from {@link XrplId.checkMany} / availability checks. */
|
|
52
|
+
interface DomainStatus {
|
|
53
|
+
domain: string;
|
|
54
|
+
owner: string;
|
|
55
|
+
nftokenId: string;
|
|
56
|
+
status: 'available' | 'registered';
|
|
57
|
+
issuer: string;
|
|
58
|
+
}
|
|
59
|
+
/** A coin address recorded on a name (multicoin record). */
|
|
60
|
+
interface CoinAddress {
|
|
61
|
+
type: string;
|
|
62
|
+
symbol: string;
|
|
63
|
+
name: string;
|
|
64
|
+
address: string;
|
|
65
|
+
verified: boolean;
|
|
66
|
+
visible: boolean;
|
|
67
|
+
}
|
|
68
|
+
/** Options for {@link XrplId.names}. */
|
|
69
|
+
interface NamesQuery {
|
|
70
|
+
page?: number;
|
|
71
|
+
limit?: number;
|
|
72
|
+
sort?: string;
|
|
73
|
+
keyword?: string;
|
|
74
|
+
}
|
|
75
|
+
/** A page of owned names. */
|
|
76
|
+
interface NamesPage {
|
|
77
|
+
items: Json[];
|
|
78
|
+
total: number;
|
|
79
|
+
page: number;
|
|
80
|
+
limit: number;
|
|
81
|
+
totalPages: number;
|
|
82
|
+
owner: string;
|
|
83
|
+
}
|
|
84
|
+
/** Pending order buckets for an owner. */
|
|
85
|
+
interface PendingDomains {
|
|
86
|
+
mint: Json[];
|
|
87
|
+
incoming: Json[];
|
|
88
|
+
outgoing: Json[];
|
|
89
|
+
}
|
|
90
|
+
/** Error for HTTP, network, validation, or resolver-level failures. */
|
|
91
|
+
declare class XrplIdError extends Error {
|
|
92
|
+
readonly code: string;
|
|
93
|
+
readonly httpStatus?: number;
|
|
94
|
+
constructor(message: string, code: string, httpStatus?: number);
|
|
95
|
+
}
|
|
96
|
+
/** True if `value` is a syntactically valid XRPL classic address. */
|
|
97
|
+
declare function isValidAddress(value: unknown): value is string;
|
|
98
|
+
/** Trim, lowercase, and append the default TLD when the name has no dot. */
|
|
99
|
+
declare function normalizeName(name: string, defaultTld?: string): string;
|
|
100
|
+
/**
|
|
101
|
+
* Explorer / analytics endpoints (read-only, beta). Shapes follow the public
|
|
102
|
+
* API and may evolve; methods return the parsed `data`.
|
|
103
|
+
*/
|
|
104
|
+
declare class XrplIdExplorer {
|
|
105
|
+
private readonly client;
|
|
106
|
+
constructor(client: XrplId);
|
|
107
|
+
recent(limit?: number): Promise<Json[]>;
|
|
108
|
+
sales(limit?: number): Promise<Json[]>;
|
|
109
|
+
listings(limit?: number): Promise<Json[]>;
|
|
110
|
+
market(): Promise<Json>;
|
|
111
|
+
pulse(range?: string): Promise<Json>;
|
|
112
|
+
minters(range?: string, limit?: number): Promise<Json[]>;
|
|
113
|
+
holders(opts?: {
|
|
114
|
+
issuer?: string;
|
|
115
|
+
taxon?: number;
|
|
116
|
+
slug?: string;
|
|
117
|
+
limit?: number;
|
|
118
|
+
offset?: number;
|
|
119
|
+
sampleLimit?: number;
|
|
120
|
+
}): Promise<Json>;
|
|
121
|
+
collections(): Promise<Json[]>;
|
|
122
|
+
categories(): Promise<Json[]>;
|
|
123
|
+
}
|
|
124
|
+
/** XRPL Name Service client. Create one and reuse it. */
|
|
125
|
+
declare class XrplId {
|
|
126
|
+
readonly baseUrl: string;
|
|
127
|
+
readonly issuer: string;
|
|
128
|
+
readonly defaultTld: string;
|
|
129
|
+
readonly explorer: XrplIdExplorer;
|
|
130
|
+
private readonly timeoutMs;
|
|
131
|
+
private readonly retries;
|
|
132
|
+
private readonly headers;
|
|
133
|
+
private readonly _fetch;
|
|
134
|
+
constructor(config?: XrplIdConfig);
|
|
135
|
+
private send;
|
|
136
|
+
private get;
|
|
137
|
+
/** @internal */
|
|
138
|
+
_explorer<T = Json>(path: string, query: Record<string, string | number>): Promise<T>;
|
|
139
|
+
/** Resolve a name to its owner's address (`null` if unregistered). */
|
|
140
|
+
resolve(name: string): Promise<string | null>;
|
|
141
|
+
/** Resolve a name to its full record (`null` if unregistered). */
|
|
142
|
+
resolveFull(name: string): Promise<NameRecord | null>;
|
|
143
|
+
/** Reverse-resolve an address to its primary name (`null` if none). */
|
|
144
|
+
reverse(address: string): Promise<string | null>;
|
|
145
|
+
/** True if the address owns at least one XRPName. */
|
|
146
|
+
isOwner(address: string): Promise<boolean>;
|
|
147
|
+
/** A page of names owned by an address, with sort/filter/pagination. */
|
|
148
|
+
names(address: string, query?: NamesQuery): Promise<NamesPage>;
|
|
149
|
+
/** True if a name is available to register. */
|
|
150
|
+
available(name: string): Promise<boolean>;
|
|
151
|
+
/** Batch availability / status check for one or more names. */
|
|
152
|
+
checkMany(names: string[]): Promise<DomainStatus[]>;
|
|
153
|
+
/** Order record for a domain (`null` if none). Useful for polling after registration. */
|
|
154
|
+
order(domain: string): Promise<Json | null>;
|
|
155
|
+
/** Pending order buckets (mint / incoming / outgoing) for an owner. */
|
|
156
|
+
pending(owner: string): Promise<PendingDomains>;
|
|
157
|
+
/** NFT detail by token id (`null` if not found). */
|
|
158
|
+
nft(nftokenId: string): Promise<Json | null>;
|
|
159
|
+
/** All coin addresses recorded for a name (multicoin records). */
|
|
160
|
+
addresses(name: string): Promise<CoinAddress[]>;
|
|
161
|
+
/** The address a name points to for a coin symbol/type (e.g. "XRP", "BTC"). `null` if unset. */
|
|
162
|
+
addressOf(name: string, symbol: string): Promise<string | null>;
|
|
163
|
+
/** Avatar / image URL for a name (`null` if none). */
|
|
164
|
+
avatar(name: string): Promise<string | null>;
|
|
165
|
+
/** A text/profile record for a name by key (searches metadata, profile, attributes). `null` if unset. */
|
|
166
|
+
record(name: string, key: string): Promise<string | null>;
|
|
167
|
+
/** Reverse-resolve many addresses (client-side batch, bounded concurrency). Preserves input order. */
|
|
168
|
+
reverseMany(addresses: string[], concurrency?: number): Promise<Array<{
|
|
169
|
+
address: string;
|
|
170
|
+
name: string | null;
|
|
171
|
+
}>>;
|
|
172
|
+
/** @deprecated Use {@link resolve}. */
|
|
173
|
+
getAddress(domain: string): Promise<string | null>;
|
|
174
|
+
/** @deprecated Use {@link reverse}. */
|
|
175
|
+
getName(address: string): Promise<string | null>;
|
|
176
|
+
/** @deprecated Use {@link names}. Returns the domain strings of the first page. */
|
|
177
|
+
getAllNames(address: string): Promise<string[]>;
|
|
178
|
+
}
|
|
179
|
+
/** Backward-compatible factory matching the old `xrplidjs.SDK(config)` call. */
|
|
180
|
+
declare function SDK(config?: XrplIdConfig & {
|
|
181
|
+
rpcUrl?: string;
|
|
182
|
+
Issuer?: string;
|
|
183
|
+
}): XrplId;
|
|
184
|
+
|
|
185
|
+
export { type CoinAddress, DEFAULT_BASE_URL, DEFAULT_ISSUER, DEFAULT_TLD, type DomainStatus, type Envelope, type NameRecord, type NamesPage, type NamesQuery, type PendingDomains, SDK, XrplId, type XrplIdConfig, XrplIdError, XrplIdExplorer, XrplId as default, isValidAddress, normalizeName };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @xrpname/sdk — XRPL Name Service (XRPName / XNS) SDK.
|
|
3
|
+
*
|
|
4
|
+
* Resolve `.xrp` names on the XRP Ledger, check availability, list names,
|
|
5
|
+
* read order/pending state, and pull explorer data. Zero runtime dependencies;
|
|
6
|
+
* talks to the public `xrplnftv3` API over `fetch`, so it runs in Node 18+ and
|
|
7
|
+
* modern browsers.
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { XrplId } from '@xrpname/sdk';
|
|
11
|
+
* const xns = new XrplId();
|
|
12
|
+
* await xns.resolve('xrpdomains.xrp'); // -> "raAyaz..." | null
|
|
13
|
+
* await xns.available('free-name.xrp'); // -> true | false
|
|
14
|
+
* await xns.reverse('raAyaz...'); // -> "hello.xrp" | null
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
/** Public resolver API base (XRPName mainnet, v3 controller). */
|
|
18
|
+
declare const DEFAULT_BASE_URL = "https://app.xrpdomains.xyz/api/xrplnftv3";
|
|
19
|
+
/** Default XRPName issuer account on XRPL mainnet. */
|
|
20
|
+
declare const DEFAULT_ISSUER = "raAyazbgEkwzLByXipQuPLWFfnsPS1v1q9";
|
|
21
|
+
/** TLD appended to a bare name with no dot. */
|
|
22
|
+
declare const DEFAULT_TLD = "xrp";
|
|
23
|
+
/** Configuration for an {@link XrplId} client. All fields optional. */
|
|
24
|
+
interface XrplIdConfig {
|
|
25
|
+
baseUrl?: string;
|
|
26
|
+
issuer?: string;
|
|
27
|
+
defaultTld?: string;
|
|
28
|
+
timeoutMs?: number;
|
|
29
|
+
retries?: number;
|
|
30
|
+
headers?: Record<string, string>;
|
|
31
|
+
fetch?: typeof fetch;
|
|
32
|
+
}
|
|
33
|
+
/** Standard v3 response envelope. Some endpoints add sibling fields next to `data`. */
|
|
34
|
+
interface Envelope<T = unknown> {
|
|
35
|
+
status: boolean;
|
|
36
|
+
code?: number;
|
|
37
|
+
msg?: string;
|
|
38
|
+
message?: string;
|
|
39
|
+
data: T;
|
|
40
|
+
[extra: string]: unknown;
|
|
41
|
+
}
|
|
42
|
+
type Json = Record<string, unknown>;
|
|
43
|
+
/** Full record for a resolved name. */
|
|
44
|
+
interface NameRecord {
|
|
45
|
+
owner: string;
|
|
46
|
+
nftokenId: string;
|
|
47
|
+
metadataUrl: string;
|
|
48
|
+
metadata: Json;
|
|
49
|
+
raw: Json;
|
|
50
|
+
}
|
|
51
|
+
/** One entry from {@link XrplId.checkMany} / availability checks. */
|
|
52
|
+
interface DomainStatus {
|
|
53
|
+
domain: string;
|
|
54
|
+
owner: string;
|
|
55
|
+
nftokenId: string;
|
|
56
|
+
status: 'available' | 'registered';
|
|
57
|
+
issuer: string;
|
|
58
|
+
}
|
|
59
|
+
/** A coin address recorded on a name (multicoin record). */
|
|
60
|
+
interface CoinAddress {
|
|
61
|
+
type: string;
|
|
62
|
+
symbol: string;
|
|
63
|
+
name: string;
|
|
64
|
+
address: string;
|
|
65
|
+
verified: boolean;
|
|
66
|
+
visible: boolean;
|
|
67
|
+
}
|
|
68
|
+
/** Options for {@link XrplId.names}. */
|
|
69
|
+
interface NamesQuery {
|
|
70
|
+
page?: number;
|
|
71
|
+
limit?: number;
|
|
72
|
+
sort?: string;
|
|
73
|
+
keyword?: string;
|
|
74
|
+
}
|
|
75
|
+
/** A page of owned names. */
|
|
76
|
+
interface NamesPage {
|
|
77
|
+
items: Json[];
|
|
78
|
+
total: number;
|
|
79
|
+
page: number;
|
|
80
|
+
limit: number;
|
|
81
|
+
totalPages: number;
|
|
82
|
+
owner: string;
|
|
83
|
+
}
|
|
84
|
+
/** Pending order buckets for an owner. */
|
|
85
|
+
interface PendingDomains {
|
|
86
|
+
mint: Json[];
|
|
87
|
+
incoming: Json[];
|
|
88
|
+
outgoing: Json[];
|
|
89
|
+
}
|
|
90
|
+
/** Error for HTTP, network, validation, or resolver-level failures. */
|
|
91
|
+
declare class XrplIdError extends Error {
|
|
92
|
+
readonly code: string;
|
|
93
|
+
readonly httpStatus?: number;
|
|
94
|
+
constructor(message: string, code: string, httpStatus?: number);
|
|
95
|
+
}
|
|
96
|
+
/** True if `value` is a syntactically valid XRPL classic address. */
|
|
97
|
+
declare function isValidAddress(value: unknown): value is string;
|
|
98
|
+
/** Trim, lowercase, and append the default TLD when the name has no dot. */
|
|
99
|
+
declare function normalizeName(name: string, defaultTld?: string): string;
|
|
100
|
+
/**
|
|
101
|
+
* Explorer / analytics endpoints (read-only, beta). Shapes follow the public
|
|
102
|
+
* API and may evolve; methods return the parsed `data`.
|
|
103
|
+
*/
|
|
104
|
+
declare class XrplIdExplorer {
|
|
105
|
+
private readonly client;
|
|
106
|
+
constructor(client: XrplId);
|
|
107
|
+
recent(limit?: number): Promise<Json[]>;
|
|
108
|
+
sales(limit?: number): Promise<Json[]>;
|
|
109
|
+
listings(limit?: number): Promise<Json[]>;
|
|
110
|
+
market(): Promise<Json>;
|
|
111
|
+
pulse(range?: string): Promise<Json>;
|
|
112
|
+
minters(range?: string, limit?: number): Promise<Json[]>;
|
|
113
|
+
holders(opts?: {
|
|
114
|
+
issuer?: string;
|
|
115
|
+
taxon?: number;
|
|
116
|
+
slug?: string;
|
|
117
|
+
limit?: number;
|
|
118
|
+
offset?: number;
|
|
119
|
+
sampleLimit?: number;
|
|
120
|
+
}): Promise<Json>;
|
|
121
|
+
collections(): Promise<Json[]>;
|
|
122
|
+
categories(): Promise<Json[]>;
|
|
123
|
+
}
|
|
124
|
+
/** XRPL Name Service client. Create one and reuse it. */
|
|
125
|
+
declare class XrplId {
|
|
126
|
+
readonly baseUrl: string;
|
|
127
|
+
readonly issuer: string;
|
|
128
|
+
readonly defaultTld: string;
|
|
129
|
+
readonly explorer: XrplIdExplorer;
|
|
130
|
+
private readonly timeoutMs;
|
|
131
|
+
private readonly retries;
|
|
132
|
+
private readonly headers;
|
|
133
|
+
private readonly _fetch;
|
|
134
|
+
constructor(config?: XrplIdConfig);
|
|
135
|
+
private send;
|
|
136
|
+
private get;
|
|
137
|
+
/** @internal */
|
|
138
|
+
_explorer<T = Json>(path: string, query: Record<string, string | number>): Promise<T>;
|
|
139
|
+
/** Resolve a name to its owner's address (`null` if unregistered). */
|
|
140
|
+
resolve(name: string): Promise<string | null>;
|
|
141
|
+
/** Resolve a name to its full record (`null` if unregistered). */
|
|
142
|
+
resolveFull(name: string): Promise<NameRecord | null>;
|
|
143
|
+
/** Reverse-resolve an address to its primary name (`null` if none). */
|
|
144
|
+
reverse(address: string): Promise<string | null>;
|
|
145
|
+
/** True if the address owns at least one XRPName. */
|
|
146
|
+
isOwner(address: string): Promise<boolean>;
|
|
147
|
+
/** A page of names owned by an address, with sort/filter/pagination. */
|
|
148
|
+
names(address: string, query?: NamesQuery): Promise<NamesPage>;
|
|
149
|
+
/** True if a name is available to register. */
|
|
150
|
+
available(name: string): Promise<boolean>;
|
|
151
|
+
/** Batch availability / status check for one or more names. */
|
|
152
|
+
checkMany(names: string[]): Promise<DomainStatus[]>;
|
|
153
|
+
/** Order record for a domain (`null` if none). Useful for polling after registration. */
|
|
154
|
+
order(domain: string): Promise<Json | null>;
|
|
155
|
+
/** Pending order buckets (mint / incoming / outgoing) for an owner. */
|
|
156
|
+
pending(owner: string): Promise<PendingDomains>;
|
|
157
|
+
/** NFT detail by token id (`null` if not found). */
|
|
158
|
+
nft(nftokenId: string): Promise<Json | null>;
|
|
159
|
+
/** All coin addresses recorded for a name (multicoin records). */
|
|
160
|
+
addresses(name: string): Promise<CoinAddress[]>;
|
|
161
|
+
/** The address a name points to for a coin symbol/type (e.g. "XRP", "BTC"). `null` if unset. */
|
|
162
|
+
addressOf(name: string, symbol: string): Promise<string | null>;
|
|
163
|
+
/** Avatar / image URL for a name (`null` if none). */
|
|
164
|
+
avatar(name: string): Promise<string | null>;
|
|
165
|
+
/** A text/profile record for a name by key (searches metadata, profile, attributes). `null` if unset. */
|
|
166
|
+
record(name: string, key: string): Promise<string | null>;
|
|
167
|
+
/** Reverse-resolve many addresses (client-side batch, bounded concurrency). Preserves input order. */
|
|
168
|
+
reverseMany(addresses: string[], concurrency?: number): Promise<Array<{
|
|
169
|
+
address: string;
|
|
170
|
+
name: string | null;
|
|
171
|
+
}>>;
|
|
172
|
+
/** @deprecated Use {@link resolve}. */
|
|
173
|
+
getAddress(domain: string): Promise<string | null>;
|
|
174
|
+
/** @deprecated Use {@link reverse}. */
|
|
175
|
+
getName(address: string): Promise<string | null>;
|
|
176
|
+
/** @deprecated Use {@link names}. Returns the domain strings of the first page. */
|
|
177
|
+
getAllNames(address: string): Promise<string[]>;
|
|
178
|
+
}
|
|
179
|
+
/** Backward-compatible factory matching the old `xrplidjs.SDK(config)` call. */
|
|
180
|
+
declare function SDK(config?: XrplIdConfig & {
|
|
181
|
+
rpcUrl?: string;
|
|
182
|
+
Issuer?: string;
|
|
183
|
+
}): XrplId;
|
|
184
|
+
|
|
185
|
+
export { type CoinAddress, DEFAULT_BASE_URL, DEFAULT_ISSUER, DEFAULT_TLD, type DomainStatus, type Envelope, type NameRecord, type NamesPage, type NamesQuery, type PendingDomains, SDK, XrplId, type XrplIdConfig, XrplIdError, XrplIdExplorer, XrplId as default, isValidAddress, normalizeName };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var b="https://app.xrpdomains.xyz/api/xrplnftv3",v="raAyazbgEkwzLByXipQuPLWFfnsPS1v1q9",_="xrp",o=class extends Error{constructor(t,e,r){super(t),this.name="XrplIdError",this.code=e,this.httpStatus=r}},P=/^r[1-9A-HJ-NP-Za-km-z]{24,34}$/;function m(l){return typeof l=="string"&&P.test(l)}function h(l,t="xrp"){if(typeof l!="string")throw new o("name must be a string","bad_request");let e=l.trim().toLowerCase();if(!e)throw new o("name must not be empty","bad_request");return e.includes(".")||(e=`${e}.${t.replace(/^\./,"")}`),e}var w=l=>new Promise(t=>setTimeout(t,l)),p=(l,t=0)=>typeof l=="number"&&isFinite(l)?l:t,y=class{constructor(t){this.client=t}recent(t=12){return this.client._explorer("recent",{limit:t})}sales(t=12){return this.client._explorer("sales",{limit:t})}listings(t=600){return this.client._explorer("listings",{limit:t})}market(){return this.client._explorer("market",{})}pulse(t="30d"){return this.client._explorer("pulse",{range:t})}minters(t="7d",e=10){return this.client._explorer("minters",{range:t,limit:e})}holders(t={}){return this.client._explorer("holders",t)}collections(){return this.client._explorer("collections",{})}categories(){return this.client._explorer("categories",{})}},f=class{constructor(t={}){this.baseUrl=(t.baseUrl??b).replace(/\/+$/,""),this.issuer=t.issuer??v,this.defaultTld=(t.defaultTld??"xrp").replace(/^\./,""),this.timeoutMs=t.timeoutMs??1e4,this.retries=Math.max(0,t.retries??2),this.headers={Accept:"application/json",...t.headers};let e=t.fetch??globalThis.fetch;if(typeof e!="function")throw new o("global fetch unavailable; pass config.fetch (Node < 18 needs a polyfill)","bad_request");this._fetch=e.bind(globalThis),this.explorer=new y(this)}async send(t,e){let r=new URL(`${this.baseUrl}/${t}`);for(let[i,d]of Object.entries(e.query??{}))r.searchParams.set(i,String(d));let{query:s,...n}=e,u;for(let i=0;i<=this.retries;i++){let d=new AbortController,c=setTimeout(()=>d.abort(),this.timeoutMs);try{let a=await this._fetch(r.toString(),{...n,headers:{...this.headers,...n.headers},signal:d.signal});if(!a.ok){if(a.status>=500&&i<this.retries){u=new o(`HTTP ${a.status}`,"http_error",a.status),await w(200*(i+1));continue}throw new o(`resolver returned HTTP ${a.status}`,"http_error",a.status)}let g;try{g=await a.json()}catch{throw new o("resolver returned invalid JSON","invalid_response",a.status)}if(!g||typeof g!="object")throw new o("unexpected resolver response","invalid_response",a.status);return g}catch(a){if(a instanceof o){if(a.code==="http_error"&&(a.httpStatus??0)>=500&&i<this.retries){u=a,await w(200*(i+1));continue}throw a}let g=a?.name==="AbortError";if(u=new o(g?`request timed out after ${this.timeoutMs}ms`:`network error: ${String(a)}`,g?"timeout":"network"),i<this.retries){await w(200*(i+1));continue}throw u}finally{clearTimeout(c)}}throw u??new o("request failed","network")}get(t,e={}){return this.send(t,{method:"GET",query:e})}async _explorer(t,e){let r=await this.get(t,e);return r.data??r}async resolve(t){return(await this.resolveFull(t))?.owner??null}async resolveFull(t){let e=h(t,this.defaultTld),r=await this.get("getAddress",{domain:e}),s=r.data??{},n=s.owner;return!r.status||!m(n)?null:{owner:n,nftokenId:typeof s.nftoken_id=="string"?s.nftoken_id:"",metadataUrl:typeof s.metadata_url=="string"?s.metadata_url:"",metadata:s.metadata&&typeof s.metadata=="object"?s.metadata:{},raw:s}}async reverse(t){if(!m(t))throw new o("invalid XRPL address","bad_request");let e=await this.get("getName",{address:t}),r=typeof e.data=="string"?e.data.trim():"";return e.status&&r?r.toLowerCase():null}async isOwner(t){if(!m(t))throw new o("invalid XRPL address","bad_request");let e=await this.get("isOwner",{address:t});return e.status===!0&&e.data===!0}async names(t,e={}){if(!m(t))throw new o("invalid XRPL address","bad_request");let r={address:t};e.page&&(r.page=e.page),e.limit&&(r.limit=e.limit),e.sort&&(r.sort=e.sort),e.keyword&&(r.keyword=e.keyword);let s=await this.get("getAllNames",r),n=Array.isArray(s.data)?s.data:[];return{items:n,total:p(s.total,n.length),page:p(s.page,e.page??1),limit:p(s.limit,e.limit??50),totalPages:p(s.total_pages,1),owner:typeof s.owner=="string"?s.owner:t}}async available(t){let[e]=await this.checkMany([t]);return e?.status==="available"}async checkMany(t){let e=t.map(n=>h(n,this.defaultTld));if(!e.length)return[];let r=await this.get("checkDomains",{domain:e.join(",")});return(Array.isArray(r.data)?r.data:[]).map(n=>({domain:String(n.domain??""),owner:typeof n.owner=="string"?n.owner:"",nftokenId:typeof n.nftoken_id=="string"?n.nftoken_id:"",status:n.status==="available"?"available":"registered",issuer:typeof n.issuer=="string"?n.issuer:this.issuer}))}async order(t){let e=await this.get("getOrderbyDomain",{domain:h(t,this.defaultTld)});return e.status&&e.data&&typeof e.data=="object"?e.data:null}async pending(t){if(!m(t))throw new o("invalid XRPL address","bad_request");let e=await this.get("getPendingDomains",{owner:t}),r=s=>Array.isArray(e[s])?e[s]:[];return{mint:r("mint"),incoming:r("incoming"),outgoing:r("outgoing")}}async nft(t){if(!t)throw new o("nftokenId required","bad_request");let e=await this.get("getNftByTokenId",{nftoken_id:t});return e.status&&e.data&&typeof e.data=="object"?e.data:null}async addresses(t){let e=await this.resolveFull(t);return(e&&Array.isArray(e.raw.addresses)?e.raw.addresses:[]).map(s=>({type:String(s.type??""),symbol:String(s.symbol??""),name:String(s.name??""),address:String(s.address??""),verified:s.verified===!0,visible:s.visible!==!1}))}async addressOf(t,e){let r=e.trim().toLowerCase();return(await this.addresses(t)).find(n=>n.symbol.toLowerCase()===r||n.type.toLowerCase()===r)?.address||null}async avatar(t){let e=await this.resolveFull(t);if(!e)return null;let r=e.metadata.image??e.raw.profile_image;return typeof r=="string"&&r?r:null}async record(t,e){let r=await this.resolveFull(t);if(!r)return null;let s=e.trim().toLowerCase(),n=[r.metadata,r.raw.profile_info,r.raw];for(let i of n)if(i&&typeof i=="object"){for(let[d,c]of Object.entries(i))if(d.toLowerCase()===s&&(typeof c=="string"||typeof c=="number"))return String(c)}let u=r.metadata.attributes??r.raw.attributes;if(Array.isArray(u)){for(let i of u)if(String(i.trait_type??i.key??i.name??"").toLowerCase()===s&&i.value!=null)return String(i.value)}return null}async reverseMany(t,e=5){let r=new Array(t.length),s=0,n=async()=>{for(;;){let u=s++;if(u>=t.length)break;let i=t[u],d=null;try{d=await this.reverse(i)}catch{d=null}r[u]={address:i,name:d}}};return await Promise.all(Array.from({length:Math.max(1,e)},n)),r}getAddress(t){return this.resolve(t)}getName(t){return this.reverse(t)}async getAllNames(t){return(await this.names(t,{limit:100})).items.map(r=>String(r.domain??"")).filter(Boolean)}};function x(l={}){let{Issuer:t,rpcUrl:e,...r}=l;return new f({...r,issuer:r.issuer??t})}var k=f;export{b as DEFAULT_BASE_URL,v as DEFAULT_ISSUER,_ as DEFAULT_TLD,x as SDK,f as XrplId,o as XrplIdError,y as XrplIdExplorer,k as default,m as isValidAddress,h as normalizeName};
|
package/package.json
CHANGED
|
@@ -1,6 +1,55 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xrpname/sdk",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Official SDK for XRPName \u2014 resolve .xrp names on the XRP Ledger (XRPL Name Service / XNS). Zero-dependency, Node + browser.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"xrpl",
|
|
7
|
+
"xrp",
|
|
8
|
+
"name service",
|
|
9
|
+
"xrpname",
|
|
10
|
+
"xns",
|
|
11
|
+
"resolver",
|
|
12
|
+
".xrp",
|
|
13
|
+
"web3",
|
|
14
|
+
"domains"
|
|
15
|
+
],
|
|
16
|
+
"homepage": "https://xrpdomains.xyz",
|
|
17
|
+
"bugs": {
|
|
18
|
+
"email": "info@xrpdomains.xyz"
|
|
19
|
+
},
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"type": "module",
|
|
22
|
+
"main": "./dist/index.cjs",
|
|
23
|
+
"module": "./dist/index.js",
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"import": "./dist/index.js",
|
|
29
|
+
"require": "./dist/index.cjs"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"dist",
|
|
34
|
+
"README.md"
|
|
35
|
+
],
|
|
36
|
+
"sideEffects": false,
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "tsup src/index.ts --format esm,cjs --dts --clean --minify",
|
|
39
|
+
"prepublishOnly": "npm run build"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"tsup": "^8.0.0",
|
|
43
|
+
"typescript": "^5.4.0"
|
|
44
|
+
},
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=18"
|
|
47
|
+
},
|
|
48
|
+
"publishConfig": {
|
|
49
|
+
"access": "public"
|
|
50
|
+
},
|
|
51
|
+
"repository": {
|
|
52
|
+
"type": "git",
|
|
53
|
+
"url": "https://github.com/XRPDomains"
|
|
54
|
+
}
|
|
55
|
+
}
|