@inversealtruism/csd-client 0.1.19 → 0.1.20

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/dist/index.d.cts CHANGED
@@ -72,17 +72,54 @@ interface RpcSubmit {
72
72
  mempool_len?: number;
73
73
  err?: string | null;
74
74
  }
75
+ interface RpcProposalRecord {
76
+ proposal_id: string;
77
+ domain: string;
78
+ payload_hash: string;
79
+ uri: string;
80
+ proposer: string;
81
+ created_height: number;
82
+ created_epoch: number;
83
+ fee: number | bigint;
84
+ expires_epoch: number | bigint;
85
+ }
86
+ /** `/proposal/:id`. An unknown id answers `{ ok: false, err }`, which `proposal()` throws. */
75
87
  interface RpcProposal {
76
- ok?: boolean;
88
+ ok: boolean;
89
+ proposal: RpcProposalRecord;
90
+ err?: string;
91
+ }
92
+ /** One row of `/proposals/:domain/:limit`; the feed names no proposer. */
93
+ interface RpcProposalItem {
94
+ proposal_id: string;
77
95
  txid: string;
96
+ block_hash: string;
97
+ height: number;
98
+ time: number;
78
99
  domain: string;
79
100
  payload_hash: string;
80
101
  uri: string;
81
102
  expires_epoch: number | bigint;
82
- proposer: string;
103
+ }
104
+ interface RpcProposals {
105
+ ok: boolean;
106
+ tip: string;
107
+ height: number;
108
+ scanned_blocks: number;
109
+ count: number;
110
+ proposals: RpcProposalItem[];
111
+ }
112
+ interface RpcDomain {
113
+ domain: string;
114
+ proposals: number;
115
+ attestations: number;
116
+ }
117
+ interface RpcDomains {
118
+ ok: boolean;
119
+ tip: string;
83
120
  height: number;
84
- attestations?: unknown[];
85
- [k: string]: unknown;
121
+ count: number;
122
+ domains: RpcDomain[];
86
123
  }
87
124
  interface RpcTxInfo {
88
125
  ok: boolean;
@@ -93,12 +130,23 @@ interface RpcTxInfo {
93
130
  tx?: RpcTxJson;
94
131
  err?: string;
95
132
  }
133
+ /** `ok` is false while a node task has stopped. The last three are null until known and absent on nodes before
134
+ * overlay 0.1.7. */
96
135
  interface RpcHealth {
97
136
  ok: boolean;
98
- height?: number;
99
- peers?: number;
100
- mempool_len?: number;
101
- [k: string]: unknown;
137
+ tip: string;
138
+ height: number;
139
+ chainwork: string;
140
+ peer_count: number;
141
+ known_peers: number;
142
+ mempool_tx_count: number;
143
+ mempool_spent_outpoints: number;
144
+ mempool_bytes: number;
145
+ mempool_min_feerate_ppm: number | bigint | null;
146
+ mempool_max_feerate_ppm: number | bigint | null;
147
+ best_peer_height?: number | null;
148
+ blocks_behind?: number | null;
149
+ secs_since_tip_activity?: number | null;
102
150
  }
103
151
  interface WaitForTxResult {
104
152
  txid: string;
@@ -153,9 +201,9 @@ declare class CsdClient {
153
201
  available?: boolean;
154
202
  }): Promise<RpcUtxos>;
155
203
  proposal(id: string): Promise<RpcProposal>;
156
- proposals(domain: string, limit?: number): Promise<RpcProposal[]>;
204
+ proposals(domain: string, limit?: number): Promise<RpcProposals>;
157
205
  topDomain(domain: string, epoch?: number): Promise<unknown>;
158
- domains(): Promise<string[]>;
206
+ domains(): Promise<RpcDomains>;
159
207
  mempool(): Promise<unknown>;
160
208
  /**
161
209
  * Await a txid reaching `confirmations` (default 1) — the submit-then-confirm flow every
@@ -209,4 +257,4 @@ declare function verifyInputValues(client: {
209
257
  /** Convert a node /block header JSON into the codec's BlockHeader. */
210
258
  declare function rpcHeaderToHeader(h: RpcHeaderJson): BlockHeader;
211
259
 
212
- export { type ClientOptions, CsdClient, type RpcBlock, type RpcHeaderJson, type RpcHealth, type RpcProposal, type RpcSubmit, type RpcTip, type RpcTxInfo, type RpcTxJson, type RpcUtxo, type RpcUtxos, type WaitForTxResult, parseJsonExact, rpcHeaderToHeader, rpcTxToTx, verifyInputValues };
260
+ export { type ClientOptions, CsdClient, type RpcBlock, type RpcDomain, type RpcDomains, type RpcHeaderJson, type RpcHealth, type RpcProposal, type RpcProposalItem, type RpcProposalRecord, type RpcProposals, type RpcSubmit, type RpcTip, type RpcTxInfo, type RpcTxJson, type RpcUtxo, type RpcUtxos, type WaitForTxResult, parseJsonExact, rpcHeaderToHeader, rpcTxToTx, verifyInputValues };
package/dist/index.d.ts CHANGED
@@ -72,17 +72,54 @@ interface RpcSubmit {
72
72
  mempool_len?: number;
73
73
  err?: string | null;
74
74
  }
75
+ interface RpcProposalRecord {
76
+ proposal_id: string;
77
+ domain: string;
78
+ payload_hash: string;
79
+ uri: string;
80
+ proposer: string;
81
+ created_height: number;
82
+ created_epoch: number;
83
+ fee: number | bigint;
84
+ expires_epoch: number | bigint;
85
+ }
86
+ /** `/proposal/:id`. An unknown id answers `{ ok: false, err }`, which `proposal()` throws. */
75
87
  interface RpcProposal {
76
- ok?: boolean;
88
+ ok: boolean;
89
+ proposal: RpcProposalRecord;
90
+ err?: string;
91
+ }
92
+ /** One row of `/proposals/:domain/:limit`; the feed names no proposer. */
93
+ interface RpcProposalItem {
94
+ proposal_id: string;
77
95
  txid: string;
96
+ block_hash: string;
97
+ height: number;
98
+ time: number;
78
99
  domain: string;
79
100
  payload_hash: string;
80
101
  uri: string;
81
102
  expires_epoch: number | bigint;
82
- proposer: string;
103
+ }
104
+ interface RpcProposals {
105
+ ok: boolean;
106
+ tip: string;
107
+ height: number;
108
+ scanned_blocks: number;
109
+ count: number;
110
+ proposals: RpcProposalItem[];
111
+ }
112
+ interface RpcDomain {
113
+ domain: string;
114
+ proposals: number;
115
+ attestations: number;
116
+ }
117
+ interface RpcDomains {
118
+ ok: boolean;
119
+ tip: string;
83
120
  height: number;
84
- attestations?: unknown[];
85
- [k: string]: unknown;
121
+ count: number;
122
+ domains: RpcDomain[];
86
123
  }
87
124
  interface RpcTxInfo {
88
125
  ok: boolean;
@@ -93,12 +130,23 @@ interface RpcTxInfo {
93
130
  tx?: RpcTxJson;
94
131
  err?: string;
95
132
  }
133
+ /** `ok` is false while a node task has stopped. The last three are null until known and absent on nodes before
134
+ * overlay 0.1.7. */
96
135
  interface RpcHealth {
97
136
  ok: boolean;
98
- height?: number;
99
- peers?: number;
100
- mempool_len?: number;
101
- [k: string]: unknown;
137
+ tip: string;
138
+ height: number;
139
+ chainwork: string;
140
+ peer_count: number;
141
+ known_peers: number;
142
+ mempool_tx_count: number;
143
+ mempool_spent_outpoints: number;
144
+ mempool_bytes: number;
145
+ mempool_min_feerate_ppm: number | bigint | null;
146
+ mempool_max_feerate_ppm: number | bigint | null;
147
+ best_peer_height?: number | null;
148
+ blocks_behind?: number | null;
149
+ secs_since_tip_activity?: number | null;
102
150
  }
103
151
  interface WaitForTxResult {
104
152
  txid: string;
@@ -153,9 +201,9 @@ declare class CsdClient {
153
201
  available?: boolean;
154
202
  }): Promise<RpcUtxos>;
155
203
  proposal(id: string): Promise<RpcProposal>;
156
- proposals(domain: string, limit?: number): Promise<RpcProposal[]>;
204
+ proposals(domain: string, limit?: number): Promise<RpcProposals>;
157
205
  topDomain(domain: string, epoch?: number): Promise<unknown>;
158
- domains(): Promise<string[]>;
206
+ domains(): Promise<RpcDomains>;
159
207
  mempool(): Promise<unknown>;
160
208
  /**
161
209
  * Await a txid reaching `confirmations` (default 1) — the submit-then-confirm flow every
@@ -209,4 +257,4 @@ declare function verifyInputValues(client: {
209
257
  /** Convert a node /block header JSON into the codec's BlockHeader. */
210
258
  declare function rpcHeaderToHeader(h: RpcHeaderJson): BlockHeader;
211
259
 
212
- export { type ClientOptions, CsdClient, type RpcBlock, type RpcHeaderJson, type RpcHealth, type RpcProposal, type RpcSubmit, type RpcTip, type RpcTxInfo, type RpcTxJson, type RpcUtxo, type RpcUtxos, type WaitForTxResult, parseJsonExact, rpcHeaderToHeader, rpcTxToTx, verifyInputValues };
260
+ export { type ClientOptions, CsdClient, type RpcBlock, type RpcDomain, type RpcDomains, type RpcHeaderJson, type RpcHealth, type RpcProposal, type RpcProposalItem, type RpcProposalRecord, type RpcProposals, type RpcSubmit, type RpcTip, type RpcTxInfo, type RpcTxJson, type RpcUtxo, type RpcUtxos, type WaitForTxResult, parseJsonExact, rpcHeaderToHeader, rpcTxToTx, verifyInputValues };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inversealtruism/csd-client",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "engines": {
5
5
  "node": ">=18"
6
6
  },