@inversealtruism/cairn-sdk 0.1.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/LICENSE +21 -0
- package/README.md +108 -0
- package/dist/board.cjs +193 -0
- package/dist/board.d.cts +151 -0
- package/dist/board.d.ts +151 -0
- package/dist/board.js +7 -0
- package/dist/chain.cjs +144 -0
- package/dist/chain.d.cts +36 -0
- package/dist/chain.d.ts +36 -0
- package/dist/chain.js +86 -0
- package/dist/chunk-6VWLWF7R.js +121 -0
- package/dist/chunk-BZVJVL4Q.js +76 -0
- package/dist/chunk-ETZYBDFC.js +232 -0
- package/dist/chunk-G7FABIF4.js +60 -0
- package/dist/chunk-OGP2W7DL.js +163 -0
- package/dist/chunk-PHMU3CG5.js +63 -0
- package/dist/chunk-SMAPCKVG.js +118 -0
- package/dist/connect.cjs +177 -0
- package/dist/connect.d.cts +127 -0
- package/dist/connect.d.ts +127 -0
- package/dist/connect.js +15 -0
- package/dist/content.cjs +113 -0
- package/dist/content.d.cts +44 -0
- package/dist/content.d.ts +44 -0
- package/dist/content.js +7 -0
- package/dist/http-D2CzfOsm.d.cts +30 -0
- package/dist/http-D2CzfOsm.d.ts +30 -0
- package/dist/index.cjs +873 -0
- package/dist/index.d.cts +105 -0
- package/dist/index.d.ts +105 -0
- package/dist/index.js +181 -0
- package/dist/indexer.cjs +256 -0
- package/dist/indexer.d.cts +103 -0
- package/dist/indexer.d.ts +103 -0
- package/dist/indexer.js +6 -0
- package/dist/registry.cjs +77 -0
- package/dist/registry.d.cts +30 -0
- package/dist/registry.d.ts +30 -0
- package/dist/registry.js +26 -0
- package/package.json +97 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { H as Http, F as FetchLike } from './http-D2CzfOsm.cjs';
|
|
2
|
+
|
|
3
|
+
interface MerkleProof {
|
|
4
|
+
block_height: number;
|
|
5
|
+
pos: number;
|
|
6
|
+
merkle: string[];
|
|
7
|
+
merkle_root: string;
|
|
8
|
+
}
|
|
9
|
+
type TrustLevel = "verified-inclusion" | "proof-consistent" | "not-found";
|
|
10
|
+
interface InclusionResult {
|
|
11
|
+
included: boolean;
|
|
12
|
+
trustLevel: TrustLevel;
|
|
13
|
+
blockHeight?: number;
|
|
14
|
+
pos?: number;
|
|
15
|
+
merkleRoot?: string;
|
|
16
|
+
reason?: string;
|
|
17
|
+
}
|
|
18
|
+
/** A live index event ({ kind: "block" | "proposal" | "attestation" | "reorg", ... }). */
|
|
19
|
+
interface IndexEvent {
|
|
20
|
+
kind: "block" | "proposal" | "attestation" | "reorg";
|
|
21
|
+
[k: string]: unknown;
|
|
22
|
+
}
|
|
23
|
+
interface IndexerClientOptions {
|
|
24
|
+
fetch?: FetchLike;
|
|
25
|
+
/** A WebSocket implementation (defaults to globalThis.WebSocket). */
|
|
26
|
+
WebSocketImpl?: typeof WebSocket;
|
|
27
|
+
/**
|
|
28
|
+
* Optional: given a block height, return its on-chain header merkle root. Wire
|
|
29
|
+
* this from the chain/light client to upgrade verifyInclusion() from
|
|
30
|
+
* "proof-consistent" to fully trust-minimized "verified-inclusion".
|
|
31
|
+
*/
|
|
32
|
+
headerMerkleAt?: (height: number) => Promise<string>;
|
|
33
|
+
}
|
|
34
|
+
declare class IndexerClient {
|
|
35
|
+
private readonly http;
|
|
36
|
+
private readonly opts;
|
|
37
|
+
constructor(http: Http, opts?: IndexerClientOptions);
|
|
38
|
+
health(): Promise<unknown>;
|
|
39
|
+
tipHeight(): Promise<number>;
|
|
40
|
+
tipHash(): Promise<string>;
|
|
41
|
+
blockHashAtHeight(h: number): Promise<string>;
|
|
42
|
+
block(hash: string): Promise<unknown>;
|
|
43
|
+
blockTxids(hash: string): Promise<string[]>;
|
|
44
|
+
tx(id: string): Promise<unknown>;
|
|
45
|
+
txStatus(id: string): Promise<{
|
|
46
|
+
confirmed: boolean;
|
|
47
|
+
block_height: number;
|
|
48
|
+
confirmations: number;
|
|
49
|
+
final: boolean;
|
|
50
|
+
}>;
|
|
51
|
+
txMerkleProof(id: string): Promise<MerkleProof>;
|
|
52
|
+
address(a: string): Promise<unknown>;
|
|
53
|
+
addressTxs(a: string): Promise<unknown[]>;
|
|
54
|
+
addressUtxo(a: string): Promise<unknown[]>;
|
|
55
|
+
reputation(a: string): Promise<unknown>;
|
|
56
|
+
domains(): Promise<unknown[]>;
|
|
57
|
+
domainProposals(d: string): Promise<unknown[]>;
|
|
58
|
+
proposal(id: string): Promise<unknown>;
|
|
59
|
+
attestations(id: string): Promise<unknown[]>;
|
|
60
|
+
registryPeers(): Promise<unknown[]>;
|
|
61
|
+
registryGateways(): Promise<unknown[]>;
|
|
62
|
+
identity(handle: string): Promise<unknown>;
|
|
63
|
+
reverseIdentity(addr: string): Promise<unknown>;
|
|
64
|
+
/**
|
|
65
|
+
* Verify a tx is included in a block by folding its merkle branch to the root
|
|
66
|
+
* with csd-codec.verifyMerkleProof. If `headerMerkleAt` was provided, the
|
|
67
|
+
* proof's root is cross-checked against the ON-CHAIN header merkle at that
|
|
68
|
+
* height → trustLevel "verified-inclusion". Otherwise the proof is only
|
|
69
|
+
* internally consistent → "proof-consistent" (still useful, but the indexer is trusted).
|
|
70
|
+
*/
|
|
71
|
+
verifyInclusion(txid: string): Promise<InclusionResult>;
|
|
72
|
+
/** Stream all events (blocks, proposals, attestations, reorgs) via SSE. */
|
|
73
|
+
streamAll(handlers: StreamHandlers): StreamHandle;
|
|
74
|
+
/** Stream blocks + reorgs only. */
|
|
75
|
+
streamBlocks(handlers: StreamHandlers): StreamHandle;
|
|
76
|
+
/** Stream proposals (+ reorgs) for a domain. */
|
|
77
|
+
streamDomain(domain: string, handlers: StreamHandlers): StreamHandle;
|
|
78
|
+
/**
|
|
79
|
+
* Subscribe over WebSocket with selective tracking. Returns a handle with
|
|
80
|
+
* `.close()`. `onEvent` receives every matching IndexEvent (incl. reorgs).
|
|
81
|
+
*/
|
|
82
|
+
subscribe(sub: {
|
|
83
|
+
all?: boolean;
|
|
84
|
+
domains?: string[];
|
|
85
|
+
addresses?: string[];
|
|
86
|
+
proposals?: string[];
|
|
87
|
+
}, onEvent: (e: IndexEvent) => void, onError?: (err: unknown) => void): StreamHandle;
|
|
88
|
+
private sse;
|
|
89
|
+
}
|
|
90
|
+
interface StreamHandlers {
|
|
91
|
+
onEvent?: (e: IndexEvent) => void;
|
|
92
|
+
onBlock?: (e: IndexEvent) => void;
|
|
93
|
+
onProposal?: (e: IndexEvent) => void;
|
|
94
|
+
onAttestation?: (e: IndexEvent) => void;
|
|
95
|
+
onReorg?: (e: IndexEvent) => void;
|
|
96
|
+
onOpen?: () => void;
|
|
97
|
+
onError?: (err: unknown) => void;
|
|
98
|
+
}
|
|
99
|
+
interface StreamHandle {
|
|
100
|
+
close(): void;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export { type InclusionResult, type IndexEvent, IndexerClient, type IndexerClientOptions, type MerkleProof, type StreamHandle, type StreamHandlers, type TrustLevel };
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { H as Http, F as FetchLike } from './http-D2CzfOsm.js';
|
|
2
|
+
|
|
3
|
+
interface MerkleProof {
|
|
4
|
+
block_height: number;
|
|
5
|
+
pos: number;
|
|
6
|
+
merkle: string[];
|
|
7
|
+
merkle_root: string;
|
|
8
|
+
}
|
|
9
|
+
type TrustLevel = "verified-inclusion" | "proof-consistent" | "not-found";
|
|
10
|
+
interface InclusionResult {
|
|
11
|
+
included: boolean;
|
|
12
|
+
trustLevel: TrustLevel;
|
|
13
|
+
blockHeight?: number;
|
|
14
|
+
pos?: number;
|
|
15
|
+
merkleRoot?: string;
|
|
16
|
+
reason?: string;
|
|
17
|
+
}
|
|
18
|
+
/** A live index event ({ kind: "block" | "proposal" | "attestation" | "reorg", ... }). */
|
|
19
|
+
interface IndexEvent {
|
|
20
|
+
kind: "block" | "proposal" | "attestation" | "reorg";
|
|
21
|
+
[k: string]: unknown;
|
|
22
|
+
}
|
|
23
|
+
interface IndexerClientOptions {
|
|
24
|
+
fetch?: FetchLike;
|
|
25
|
+
/** A WebSocket implementation (defaults to globalThis.WebSocket). */
|
|
26
|
+
WebSocketImpl?: typeof WebSocket;
|
|
27
|
+
/**
|
|
28
|
+
* Optional: given a block height, return its on-chain header merkle root. Wire
|
|
29
|
+
* this from the chain/light client to upgrade verifyInclusion() from
|
|
30
|
+
* "proof-consistent" to fully trust-minimized "verified-inclusion".
|
|
31
|
+
*/
|
|
32
|
+
headerMerkleAt?: (height: number) => Promise<string>;
|
|
33
|
+
}
|
|
34
|
+
declare class IndexerClient {
|
|
35
|
+
private readonly http;
|
|
36
|
+
private readonly opts;
|
|
37
|
+
constructor(http: Http, opts?: IndexerClientOptions);
|
|
38
|
+
health(): Promise<unknown>;
|
|
39
|
+
tipHeight(): Promise<number>;
|
|
40
|
+
tipHash(): Promise<string>;
|
|
41
|
+
blockHashAtHeight(h: number): Promise<string>;
|
|
42
|
+
block(hash: string): Promise<unknown>;
|
|
43
|
+
blockTxids(hash: string): Promise<string[]>;
|
|
44
|
+
tx(id: string): Promise<unknown>;
|
|
45
|
+
txStatus(id: string): Promise<{
|
|
46
|
+
confirmed: boolean;
|
|
47
|
+
block_height: number;
|
|
48
|
+
confirmations: number;
|
|
49
|
+
final: boolean;
|
|
50
|
+
}>;
|
|
51
|
+
txMerkleProof(id: string): Promise<MerkleProof>;
|
|
52
|
+
address(a: string): Promise<unknown>;
|
|
53
|
+
addressTxs(a: string): Promise<unknown[]>;
|
|
54
|
+
addressUtxo(a: string): Promise<unknown[]>;
|
|
55
|
+
reputation(a: string): Promise<unknown>;
|
|
56
|
+
domains(): Promise<unknown[]>;
|
|
57
|
+
domainProposals(d: string): Promise<unknown[]>;
|
|
58
|
+
proposal(id: string): Promise<unknown>;
|
|
59
|
+
attestations(id: string): Promise<unknown[]>;
|
|
60
|
+
registryPeers(): Promise<unknown[]>;
|
|
61
|
+
registryGateways(): Promise<unknown[]>;
|
|
62
|
+
identity(handle: string): Promise<unknown>;
|
|
63
|
+
reverseIdentity(addr: string): Promise<unknown>;
|
|
64
|
+
/**
|
|
65
|
+
* Verify a tx is included in a block by folding its merkle branch to the root
|
|
66
|
+
* with csd-codec.verifyMerkleProof. If `headerMerkleAt` was provided, the
|
|
67
|
+
* proof's root is cross-checked against the ON-CHAIN header merkle at that
|
|
68
|
+
* height → trustLevel "verified-inclusion". Otherwise the proof is only
|
|
69
|
+
* internally consistent → "proof-consistent" (still useful, but the indexer is trusted).
|
|
70
|
+
*/
|
|
71
|
+
verifyInclusion(txid: string): Promise<InclusionResult>;
|
|
72
|
+
/** Stream all events (blocks, proposals, attestations, reorgs) via SSE. */
|
|
73
|
+
streamAll(handlers: StreamHandlers): StreamHandle;
|
|
74
|
+
/** Stream blocks + reorgs only. */
|
|
75
|
+
streamBlocks(handlers: StreamHandlers): StreamHandle;
|
|
76
|
+
/** Stream proposals (+ reorgs) for a domain. */
|
|
77
|
+
streamDomain(domain: string, handlers: StreamHandlers): StreamHandle;
|
|
78
|
+
/**
|
|
79
|
+
* Subscribe over WebSocket with selective tracking. Returns a handle with
|
|
80
|
+
* `.close()`. `onEvent` receives every matching IndexEvent (incl. reorgs).
|
|
81
|
+
*/
|
|
82
|
+
subscribe(sub: {
|
|
83
|
+
all?: boolean;
|
|
84
|
+
domains?: string[];
|
|
85
|
+
addresses?: string[];
|
|
86
|
+
proposals?: string[];
|
|
87
|
+
}, onEvent: (e: IndexEvent) => void, onError?: (err: unknown) => void): StreamHandle;
|
|
88
|
+
private sse;
|
|
89
|
+
}
|
|
90
|
+
interface StreamHandlers {
|
|
91
|
+
onEvent?: (e: IndexEvent) => void;
|
|
92
|
+
onBlock?: (e: IndexEvent) => void;
|
|
93
|
+
onProposal?: (e: IndexEvent) => void;
|
|
94
|
+
onAttestation?: (e: IndexEvent) => void;
|
|
95
|
+
onReorg?: (e: IndexEvent) => void;
|
|
96
|
+
onOpen?: () => void;
|
|
97
|
+
onError?: (err: unknown) => void;
|
|
98
|
+
}
|
|
99
|
+
interface StreamHandle {
|
|
100
|
+
close(): void;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export { type InclusionResult, type IndexEvent, IndexerClient, type IndexerClientOptions, type MerkleProof, type StreamHandle, type StreamHandlers, type TrustLevel };
|
package/dist/indexer.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/registry.ts
|
|
21
|
+
var registry_exports = {};
|
|
22
|
+
__export(registry_exports, {
|
|
23
|
+
DOMAINS: () => import_csd_registry2.DOMAINS,
|
|
24
|
+
RegistryClient: () => RegistryClient,
|
|
25
|
+
buildGatewayRecord: () => import_csd_registry2.buildGatewayRecord,
|
|
26
|
+
buildIdentityCommit: () => import_csd_registry2.buildIdentityCommit,
|
|
27
|
+
buildIdentityReveal: () => import_csd_registry2.buildIdentityReveal,
|
|
28
|
+
buildPeerRecord: () => import_csd_registry2.buildPeerRecord,
|
|
29
|
+
epochOf: () => import_csd_registry2.epochOf,
|
|
30
|
+
fromRecords: () => import_csd_registry2.fromRecords,
|
|
31
|
+
verifyGateway: () => import_csd_registry2.verifyGateway,
|
|
32
|
+
verifyIdentitySig: () => import_csd_registry2.verifyIdentitySig,
|
|
33
|
+
verifyPeer: () => import_csd_registry2.verifyPeer
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(registry_exports);
|
|
36
|
+
var import_csd_registry = require("@inversealtruism/csd-registry");
|
|
37
|
+
var import_csd_registry2 = require("@inversealtruism/csd-registry");
|
|
38
|
+
var RegistryClient = class {
|
|
39
|
+
src;
|
|
40
|
+
constructor(opts) {
|
|
41
|
+
this.src = { baseUrl: opts.baseUrl.replace(/\/+$/, ""), fetch: opts.fetch };
|
|
42
|
+
}
|
|
43
|
+
/** Discover ranked content/pin gateways (GET /registry/gateways). */
|
|
44
|
+
gateways() {
|
|
45
|
+
return (0, import_csd_registry.discoverGateways)(this.src);
|
|
46
|
+
}
|
|
47
|
+
/** Discover ranked libp2p peers (GET /registry/peers). */
|
|
48
|
+
peers() {
|
|
49
|
+
return (0, import_csd_registry.discoverPeers)(this.src);
|
|
50
|
+
}
|
|
51
|
+
/** Resolve a handle → identity (GET /identity/:handle). Returns null if unresolved. */
|
|
52
|
+
resolveName(handle) {
|
|
53
|
+
return (0, import_csd_registry.resolveName)(this.src, handle);
|
|
54
|
+
}
|
|
55
|
+
/** Reverse-resolve an address → identity (GET /address/:addr/identity). */
|
|
56
|
+
reverseName(address) {
|
|
57
|
+
return (0, import_csd_registry.reverseName)(this.src, address);
|
|
58
|
+
}
|
|
59
|
+
/** The deterministic, client-side resolvers (recompute from raw ChainRecord[]). */
|
|
60
|
+
get fromRecords() {
|
|
61
|
+
return import_csd_registry.fromRecords;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
+
0 && (module.exports = {
|
|
66
|
+
DOMAINS,
|
|
67
|
+
RegistryClient,
|
|
68
|
+
buildGatewayRecord,
|
|
69
|
+
buildIdentityCommit,
|
|
70
|
+
buildIdentityReveal,
|
|
71
|
+
buildPeerRecord,
|
|
72
|
+
epochOf,
|
|
73
|
+
fromRecords,
|
|
74
|
+
verifyGateway,
|
|
75
|
+
verifyIdentitySig,
|
|
76
|
+
verifyPeer
|
|
77
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as _inversealtruism_csd_registry from '@inversealtruism/csd-registry';
|
|
2
|
+
export { BuiltRecord, ChainRecord, DOMAINS, RankedGateway, RankedPeer, ResolveOpts, ResolvedIdentity, buildGatewayRecord, buildIdentityCommit, buildIdentityReveal, buildPeerRecord, epochOf, fromRecords, verifyGateway, verifyIdentitySig, verifyPeer } from '@inversealtruism/csd-registry';
|
|
3
|
+
import { F as FetchLike } from './http-D2CzfOsm.cjs';
|
|
4
|
+
|
|
5
|
+
interface RegistryClientOptions {
|
|
6
|
+
/** Indexer base URL exposing /registry/* + /identity/* (e.g. https://cairn-substrate.com/indexer). */
|
|
7
|
+
baseUrl: string;
|
|
8
|
+
fetch?: FetchLike;
|
|
9
|
+
}
|
|
10
|
+
declare class RegistryClient {
|
|
11
|
+
private readonly src;
|
|
12
|
+
constructor(opts: RegistryClientOptions);
|
|
13
|
+
/** Discover ranked content/pin gateways (GET /registry/gateways). */
|
|
14
|
+
gateways(): Promise<_inversealtruism_csd_registry.RankedGateway[]>;
|
|
15
|
+
/** Discover ranked libp2p peers (GET /registry/peers). */
|
|
16
|
+
peers(): Promise<_inversealtruism_csd_registry.RankedPeer[]>;
|
|
17
|
+
/** Resolve a handle → identity (GET /identity/:handle). Returns null if unresolved. */
|
|
18
|
+
resolveName(handle: string): Promise<_inversealtruism_csd_registry.ResolvedIdentity | null>;
|
|
19
|
+
/** Reverse-resolve an address → identity (GET /address/:addr/identity). */
|
|
20
|
+
reverseName(address: string): Promise<_inversealtruism_csd_registry.ResolvedIdentity | null>;
|
|
21
|
+
/** The deterministic, client-side resolvers (recompute from raw ChainRecord[]). */
|
|
22
|
+
get fromRecords(): {
|
|
23
|
+
peers: (records: _inversealtruism_csd_registry.ChainRecord[], opts: _inversealtruism_csd_registry.ResolveOpts) => _inversealtruism_csd_registry.RankedPeer[];
|
|
24
|
+
gateways: (records: _inversealtruism_csd_registry.ChainRecord[], opts: _inversealtruism_csd_registry.ResolveOpts) => _inversealtruism_csd_registry.RankedGateway[];
|
|
25
|
+
name: (records: _inversealtruism_csd_registry.ChainRecord[], handle: string, opts: _inversealtruism_csd_registry.ResolveOpts) => _inversealtruism_csd_registry.ResolvedIdentity | null;
|
|
26
|
+
reverse: (records: _inversealtruism_csd_registry.ChainRecord[], address: string, opts: _inversealtruism_csd_registry.ResolveOpts) => _inversealtruism_csd_registry.ResolvedIdentity | null;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { RegistryClient, type RegistryClientOptions };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as _inversealtruism_csd_registry from '@inversealtruism/csd-registry';
|
|
2
|
+
export { BuiltRecord, ChainRecord, DOMAINS, RankedGateway, RankedPeer, ResolveOpts, ResolvedIdentity, buildGatewayRecord, buildIdentityCommit, buildIdentityReveal, buildPeerRecord, epochOf, fromRecords, verifyGateway, verifyIdentitySig, verifyPeer } from '@inversealtruism/csd-registry';
|
|
3
|
+
import { F as FetchLike } from './http-D2CzfOsm.js';
|
|
4
|
+
|
|
5
|
+
interface RegistryClientOptions {
|
|
6
|
+
/** Indexer base URL exposing /registry/* + /identity/* (e.g. https://cairn-substrate.com/indexer). */
|
|
7
|
+
baseUrl: string;
|
|
8
|
+
fetch?: FetchLike;
|
|
9
|
+
}
|
|
10
|
+
declare class RegistryClient {
|
|
11
|
+
private readonly src;
|
|
12
|
+
constructor(opts: RegistryClientOptions);
|
|
13
|
+
/** Discover ranked content/pin gateways (GET /registry/gateways). */
|
|
14
|
+
gateways(): Promise<_inversealtruism_csd_registry.RankedGateway[]>;
|
|
15
|
+
/** Discover ranked libp2p peers (GET /registry/peers). */
|
|
16
|
+
peers(): Promise<_inversealtruism_csd_registry.RankedPeer[]>;
|
|
17
|
+
/** Resolve a handle → identity (GET /identity/:handle). Returns null if unresolved. */
|
|
18
|
+
resolveName(handle: string): Promise<_inversealtruism_csd_registry.ResolvedIdentity | null>;
|
|
19
|
+
/** Reverse-resolve an address → identity (GET /address/:addr/identity). */
|
|
20
|
+
reverseName(address: string): Promise<_inversealtruism_csd_registry.ResolvedIdentity | null>;
|
|
21
|
+
/** The deterministic, client-side resolvers (recompute from raw ChainRecord[]). */
|
|
22
|
+
get fromRecords(): {
|
|
23
|
+
peers: (records: _inversealtruism_csd_registry.ChainRecord[], opts: _inversealtruism_csd_registry.ResolveOpts) => _inversealtruism_csd_registry.RankedPeer[];
|
|
24
|
+
gateways: (records: _inversealtruism_csd_registry.ChainRecord[], opts: _inversealtruism_csd_registry.ResolveOpts) => _inversealtruism_csd_registry.RankedGateway[];
|
|
25
|
+
name: (records: _inversealtruism_csd_registry.ChainRecord[], handle: string, opts: _inversealtruism_csd_registry.ResolveOpts) => _inversealtruism_csd_registry.ResolvedIdentity | null;
|
|
26
|
+
reverse: (records: _inversealtruism_csd_registry.ChainRecord[], address: string, opts: _inversealtruism_csd_registry.ResolveOpts) => _inversealtruism_csd_registry.ResolvedIdentity | null;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { RegistryClient, type RegistryClientOptions };
|
package/dist/registry.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DOMAINS,
|
|
3
|
+
RegistryClient,
|
|
4
|
+
buildGatewayRecord,
|
|
5
|
+
buildIdentityCommit,
|
|
6
|
+
buildIdentityReveal,
|
|
7
|
+
buildPeerRecord,
|
|
8
|
+
epochOf,
|
|
9
|
+
fromRecords,
|
|
10
|
+
verifyGateway,
|
|
11
|
+
verifyIdentitySig,
|
|
12
|
+
verifyPeer
|
|
13
|
+
} from "./chunk-G7FABIF4.js";
|
|
14
|
+
export {
|
|
15
|
+
DOMAINS,
|
|
16
|
+
RegistryClient,
|
|
17
|
+
buildGatewayRecord,
|
|
18
|
+
buildIdentityCommit,
|
|
19
|
+
buildIdentityReveal,
|
|
20
|
+
buildPeerRecord,
|
|
21
|
+
epochOf,
|
|
22
|
+
fromRecords,
|
|
23
|
+
verifyGateway,
|
|
24
|
+
verifyIdentitySig,
|
|
25
|
+
verifyPeer
|
|
26
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@inversealtruism/cairn-sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "The Compute Substrate dApp kit — one cohesive toolkit to connect the Cairn Wallet, read the chain/board, publish self-certifying content, and resolve registries. Composes the published csd-* primitives.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
},
|
|
15
|
+
"./connect": {
|
|
16
|
+
"types": "./dist/connect.d.ts",
|
|
17
|
+
"import": "./dist/connect.js",
|
|
18
|
+
"require": "./dist/connect.cjs"
|
|
19
|
+
},
|
|
20
|
+
"./board": {
|
|
21
|
+
"types": "./dist/board.d.ts",
|
|
22
|
+
"import": "./dist/board.js",
|
|
23
|
+
"require": "./dist/board.cjs"
|
|
24
|
+
},
|
|
25
|
+
"./indexer": {
|
|
26
|
+
"types": "./dist/indexer.d.ts",
|
|
27
|
+
"import": "./dist/indexer.js",
|
|
28
|
+
"require": "./dist/indexer.cjs"
|
|
29
|
+
},
|
|
30
|
+
"./content": {
|
|
31
|
+
"types": "./dist/content.d.ts",
|
|
32
|
+
"import": "./dist/content.js",
|
|
33
|
+
"require": "./dist/content.cjs"
|
|
34
|
+
},
|
|
35
|
+
"./registry": {
|
|
36
|
+
"types": "./dist/registry.d.ts",
|
|
37
|
+
"import": "./dist/registry.js",
|
|
38
|
+
"require": "./dist/registry.cjs"
|
|
39
|
+
},
|
|
40
|
+
"./chain": {
|
|
41
|
+
"types": "./dist/chain.d.ts",
|
|
42
|
+
"import": "./dist/chain.js",
|
|
43
|
+
"require": "./dist/chain.cjs"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"files": [
|
|
47
|
+
"dist",
|
|
48
|
+
"LICENSE",
|
|
49
|
+
"README.md"
|
|
50
|
+
],
|
|
51
|
+
"scripts": {
|
|
52
|
+
"build": "tsup src/index.ts src/connect.ts src/board.ts src/indexer.ts src/content.ts src/registry.ts src/chain.ts --format esm,cjs --dts --clean",
|
|
53
|
+
"test": "tsx test/sdk.test.ts && tsx test/connect.test.ts",
|
|
54
|
+
"test:live": "node examples/read-only.mjs",
|
|
55
|
+
"build:example": "node scripts/build-example.mjs",
|
|
56
|
+
"clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\""
|
|
57
|
+
},
|
|
58
|
+
"dependencies": {
|
|
59
|
+
"@inversealtruism/csd-codec": "^0.1.3",
|
|
60
|
+
"@inversealtruism/csd-crypto": "^0.1.3",
|
|
61
|
+
"@inversealtruism/csd-tx": "^0.1.3",
|
|
62
|
+
"@inversealtruism/csd-client": "^0.1.3",
|
|
63
|
+
"@inversealtruism/csd-light": "^0.1.3",
|
|
64
|
+
"@inversealtruism/csd-registry": "^0.1.3"
|
|
65
|
+
},
|
|
66
|
+
"devDependencies": {
|
|
67
|
+
"esbuild": "^0.27.0",
|
|
68
|
+
"tsup": "^8.5.1",
|
|
69
|
+
"tsx": "^4.19.2",
|
|
70
|
+
"typescript": "^5.6.0"
|
|
71
|
+
},
|
|
72
|
+
"sideEffects": false,
|
|
73
|
+
"packageManager": "pnpm@10.32.1",
|
|
74
|
+
"pnpm": {
|
|
75
|
+
"onlyBuiltDependencies": [
|
|
76
|
+
"esbuild"
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
"license": "MIT",
|
|
80
|
+
"publishConfig": {
|
|
81
|
+
"access": "public"
|
|
82
|
+
},
|
|
83
|
+
"repository": {
|
|
84
|
+
"type": "git",
|
|
85
|
+
"url": "git+https://github.com/InverseAltruism/cairn-sdk.git"
|
|
86
|
+
},
|
|
87
|
+
"homepage": "https://cairn-substrate.com",
|
|
88
|
+
"keywords": [
|
|
89
|
+
"compute-substrate",
|
|
90
|
+
"csd",
|
|
91
|
+
"cairn",
|
|
92
|
+
"wallet",
|
|
93
|
+
"dapp",
|
|
94
|
+
"sdk",
|
|
95
|
+
"blockchain"
|
|
96
|
+
]
|
|
97
|
+
}
|