@blockula/sdk 1.0.2 → 1.0.4
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 +1 -1
- package/dist/index.d.ts +64 -0
- package/dist/index.js +23 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ const agentGrantCode = encodeKeyGrant(await agent.keyGrant(wallet.account));
|
|
|
22
22
|
await wallet.addSessionKey(agentGrantCode, "claude", { limit: "10", periodBlocks: 86_400, expiresInBlocks: 30 * 86_400 });
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
For a chain you
|
|
25
|
+
For a chain you made (`blockula summon`), pass its node: `new Client("https://<your node>", { chainId, genesisHash })`.
|
|
26
26
|
|
|
27
27
|
## Which network?
|
|
28
28
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1233,6 +1233,54 @@ export interface HistoryPage {
|
|
|
1233
1233
|
*/
|
|
1234
1234
|
paged: boolean;
|
|
1235
1235
|
}
|
|
1236
|
+
/** An account as the node labels it: its primary `.boo` name when it has one (chain text). */
|
|
1237
|
+
export interface AccountLabel {
|
|
1238
|
+
address: string;
|
|
1239
|
+
name: string | null;
|
|
1240
|
+
short: string;
|
|
1241
|
+
}
|
|
1242
|
+
/** One row of `/api/accounts`. */
|
|
1243
|
+
export interface DirectoryAccount {
|
|
1244
|
+
account: AccountLabel;
|
|
1245
|
+
/** Its active names, primary first. */
|
|
1246
|
+
names: string[];
|
|
1247
|
+
balance: string;
|
|
1248
|
+
balance_display: string;
|
|
1249
|
+
transferable: string;
|
|
1250
|
+
transferable_display: string;
|
|
1251
|
+
/** The height of its newest finalized tx this node holds, or null. */
|
|
1252
|
+
last_active: number | null;
|
|
1253
|
+
validator: boolean;
|
|
1254
|
+
program: boolean;
|
|
1255
|
+
/** A system account's role (treasury, community, …), or null. */
|
|
1256
|
+
system: string | null;
|
|
1257
|
+
}
|
|
1258
|
+
/** A page of `/api/accounts`. */
|
|
1259
|
+
export interface AccountsPage {
|
|
1260
|
+
sort: "balance" | "recent" | "names";
|
|
1261
|
+
accounts: DirectoryAccount[];
|
|
1262
|
+
/** The next page's `after`, or null at the end. */
|
|
1263
|
+
next: string | null;
|
|
1264
|
+
/** Rows in this listing (named accounts only for `names`). */
|
|
1265
|
+
total: number;
|
|
1266
|
+
accounts_total: number;
|
|
1267
|
+
}
|
|
1268
|
+
/** One row of `/api/names`. */
|
|
1269
|
+
export interface DirectoryName {
|
|
1270
|
+
name: string;
|
|
1271
|
+
owner: AccountLabel;
|
|
1272
|
+
registered_at: number;
|
|
1273
|
+
expires_at: number;
|
|
1274
|
+
grace_until: number;
|
|
1275
|
+
status: "active" | "grace";
|
|
1276
|
+
}
|
|
1277
|
+
/** A page of `/api/names`. */
|
|
1278
|
+
export interface NamesPage {
|
|
1279
|
+
sort: "recent" | "alpha";
|
|
1280
|
+
names: DirectoryName[];
|
|
1281
|
+
next: string | null;
|
|
1282
|
+
total: number;
|
|
1283
|
+
}
|
|
1236
1284
|
export declare class Client {
|
|
1237
1285
|
/** The chain's address prefix: given, learned from `/api/status`, or `boo` until then. */
|
|
1238
1286
|
prefix: string;
|
|
@@ -1358,6 +1406,22 @@ export declare class Client {
|
|
|
1358
1406
|
limit?: number;
|
|
1359
1407
|
}): Promise<any>;
|
|
1360
1408
|
search(q: string): Promise<any>;
|
|
1409
|
+
/**
|
|
1410
|
+
* The people directory: accounts richest first (`balance`), by their newest tx (`recent`; not
|
|
1411
|
+
* offered on very large chains) or by name (`names`: named accounts only), a page at a time
|
|
1412
|
+
* (pass the previous page's `next` as `after`; at most 100). Names are chain text: show them as text.
|
|
1413
|
+
*/
|
|
1414
|
+
accounts(opts?: {
|
|
1415
|
+
sort?: "balance" | "recent" | "names";
|
|
1416
|
+
limit?: number;
|
|
1417
|
+
after?: string;
|
|
1418
|
+
}): Promise<AccountsPage>;
|
|
1419
|
+
/** Registered names (active, or in their grace), newest registration first (`recent`) or alphabetically (`alpha`), a page at a time. */
|
|
1420
|
+
names(opts?: {
|
|
1421
|
+
sort?: "recent" | "alpha";
|
|
1422
|
+
limit?: number;
|
|
1423
|
+
after?: string;
|
|
1424
|
+
}): Promise<NamesPage>;
|
|
1361
1425
|
/** The validator set: `active` this epoch, `next_epoch` (with `joining`/`leaving`), `candidates`, `jailed`, `tombstoned` and `removed`, each with stake, self-bond, commission, jail and liveness; epoch timing; the churn limit and slashing parameters. */
|
|
1362
1426
|
validators(): Promise<any>;
|
|
1363
1427
|
/** Hunts (bounties on GitHub issues), biggest first. */
|
package/dist/index.js
CHANGED
|
@@ -1965,6 +1965,17 @@ function canonicalNodeUrl(u) {
|
|
|
1965
1965
|
return u;
|
|
1966
1966
|
}
|
|
1967
1967
|
}
|
|
1968
|
+
/** `?sort=&limit=&after=` from the options that are set. */
|
|
1969
|
+
function pageQuery(opts) {
|
|
1970
|
+
const q = new URLSearchParams();
|
|
1971
|
+
if (opts.sort)
|
|
1972
|
+
q.set("sort", opts.sort);
|
|
1973
|
+
if (opts.limit !== undefined)
|
|
1974
|
+
q.set("limit", String(opts.limit));
|
|
1975
|
+
if (opts.after)
|
|
1976
|
+
q.set("after", opts.after);
|
|
1977
|
+
return q.size ? `?${q}` : "";
|
|
1978
|
+
}
|
|
1968
1979
|
export class Client {
|
|
1969
1980
|
/** The chain's address prefix: given, learned from `/api/status`, or `boo` until then. */
|
|
1970
1981
|
prefix;
|
|
@@ -2220,6 +2231,18 @@ export class Client {
|
|
|
2220
2231
|
return this.call(`/key/${keyIdHex}${q.size ? `?${q}` : ""}`);
|
|
2221
2232
|
}
|
|
2222
2233
|
search(q) { return this.call(`/search/${encodeURIComponent(q)}`); }
|
|
2234
|
+
/**
|
|
2235
|
+
* The people directory: accounts richest first (`balance`), by their newest tx (`recent`; not
|
|
2236
|
+
* offered on very large chains) or by name (`names`: named accounts only), a page at a time
|
|
2237
|
+
* (pass the previous page's `next` as `after`; at most 100). Names are chain text: show them as text.
|
|
2238
|
+
*/
|
|
2239
|
+
accounts(opts = {}) {
|
|
2240
|
+
return this.call(`/accounts${pageQuery(opts)}`);
|
|
2241
|
+
}
|
|
2242
|
+
/** Registered names (active, or in their grace), newest registration first (`recent`) or alphabetically (`alpha`), a page at a time. */
|
|
2243
|
+
names(opts = {}) {
|
|
2244
|
+
return this.call(`/names${pageQuery(opts)}`);
|
|
2245
|
+
}
|
|
2223
2246
|
/** The validator set: `active` this epoch, `next_epoch` (with `joining`/`leaving`), `candidates`, `jailed`, `tombstoned` and `removed`, each with stake, self-bond, commission, jail and liveness; epoch timing; the churn limit and slashing parameters. */
|
|
2224
2247
|
validators() { return this.call("/validators"); }
|
|
2225
2248
|
/** Hunts (bounties on GitHub issues), biggest first. */
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blockula/sdk",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.0.4",
|
|
4
|
+
"description": "🧛 TypeScript SDK for Blockula: wallets with post-quantum signatures (ML-DSA-65), .boo names and transfers. Experimental software, provided as is under MIT.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@scure/base": "2.4.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@types/node": "
|
|
31
|
+
"@types/node": "^26.6.6",
|
|
32
32
|
"tsx": "*",
|
|
33
33
|
"typescript": "^7.0.2"
|
|
34
34
|
},
|