@fangorn-network/sdk 0.1.3 → 0.1.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/lib/cli/cli.js +1 -1
- package/lib/cli/sell.js +5 -4
- package/lib/config.d.ts +5 -0
- package/lib/config.js +5 -2
- package/lib/test/mem-registry.d.ts +2 -2
- package/lib/test/testbed.d.ts +5118 -5118
- package/package.json +2 -1
package/lib/cli/cli.js
CHANGED
|
@@ -321,7 +321,7 @@ program.command("rm").description("Stage record deletes (and drop them from the
|
|
|
321
321
|
process.exit(1);
|
|
322
322
|
}
|
|
323
323
|
});
|
|
324
|
-
program.command("commit").description("Put/delete a namespace's records in a new local commit (does not push)").argument("[file]", "JSON file: {\"records\":[{\"id\",\"type\",\"payload\"}],\"deletes\":[\"id\"]} (default: the staging area, see `fangorn add`)").option("--replace", "Snapshot semantics: the file replaces the namespace's previous contents (omitted entries are removed)").option("--paid <fields>", "Comma-separated payload fields to sell: sealed (field-v1) and priced with signed terms").option("--price <usdc>", "Price of each paid record, in USDC (e.g. 0.01)").option("--share <percent>", "Share of each sale paid to the referrer (Fangorn takes none by default)", "0").option("--deadline-days <days>", "Days the signed terms stay buyable", "365").option("--key-server <url>", "Key server a new deposit is sealed to (an existing deposit keeps its own
|
|
324
|
+
program.command("commit").description("Put/delete a namespace's records in a new local commit (does not push)").argument("[file]", "JSON file: {\"records\":[{\"id\",\"type\",\"payload\"}],\"deletes\":[\"id\"]} (default: the staging area, see `fangorn add`)").option("--replace", "Snapshot semantics: the file replaces the namespace's previous contents (omitted entries are removed)").option("--paid <fields>", "Comma-separated payload fields to sell: sealed (field-v1) and priced with signed terms").option("--price <usdc>", "Price of each paid record, in USDC (e.g. 0.01)").option("--share <percent>", "Share of each sale paid to the referrer (Fangorn takes none by default)", "0").option("--deadline-days <days>", "Days the signed terms stay buyable", "365").option("--key-server <url>", "Key server a new deposit is sealed to (an existing deposit keeps its own; default: the network's)").action(async (file, options) => {
|
|
325
325
|
try {
|
|
326
326
|
const repo = LocalRepo.open();
|
|
327
327
|
if (file && !existsSync(file)) throw new Error(`file not found: ${file}`);
|
package/lib/cli/sell.js
CHANGED
|
@@ -40,15 +40,16 @@ async function sealRecords(fangorn, repo, records, o) {
|
|
|
40
40
|
signer
|
|
41
41
|
});
|
|
42
42
|
else {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
const keyServer = o.keyServer ?? fangorn.getConfig().keyServer;
|
|
44
|
+
if (!keyServer) throw new Error("no key server: pass keyServer (CLI: --key-server)");
|
|
45
|
+
const res = await fetch(`${keyServer}/pubkey`);
|
|
46
|
+
if (!res.ok) throw new Error(`key server ${keyServer}/pubkey: HTTP ${res.status.toString()}`);
|
|
46
47
|
const { pubkey } = await res.json();
|
|
47
48
|
kRepo = newRepoKey();
|
|
48
49
|
const deposit = makeDeposit({
|
|
49
50
|
kRepo,
|
|
50
51
|
keyServerPubkey: hexToBytes(pubkey),
|
|
51
|
-
keyServer
|
|
52
|
+
keyServer,
|
|
52
53
|
scope
|
|
53
54
|
});
|
|
54
55
|
out.push({
|
package/lib/config.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ interface NetworkConfig {
|
|
|
20
20
|
ipfsGateway: string;
|
|
21
21
|
logWindow?: bigint;
|
|
22
22
|
signedUrlWorker?: string;
|
|
23
|
+
keyServer?: string;
|
|
23
24
|
}
|
|
24
25
|
declare const BaseSepoliaConfig: {
|
|
25
26
|
dataRegistryContractAddress: "0x0F3eb0E62CF610dbaC6B3aD4Bf4cE38Ab50EBCC5";
|
|
@@ -349,6 +350,7 @@ declare const BaseSepoliaConfig: {
|
|
|
349
350
|
ipfsGateway: string;
|
|
350
351
|
logWindow: bigint;
|
|
351
352
|
signedUrlWorker: string;
|
|
353
|
+
keyServer: string;
|
|
352
354
|
};
|
|
353
355
|
declare const ArbitrumSepoliaConfig: {
|
|
354
356
|
dataRegistryContractAddress: "0x44B5a9C43F5905699747e062A126a588816436C4";
|
|
@@ -403,6 +405,8 @@ declare const ArbitrumSepoliaConfig: {
|
|
|
403
405
|
caip2: number;
|
|
404
406
|
ipfsGateway: string;
|
|
405
407
|
logWindow: bigint;
|
|
408
|
+
signedUrlWorker: string;
|
|
409
|
+
keyServer: string;
|
|
406
410
|
};
|
|
407
411
|
/**
|
|
408
412
|
* The default network: what `Fangorn.create` uses without a `config`, and the CLI
|
|
@@ -736,6 +740,7 @@ declare const FangornConfig: {
|
|
|
736
740
|
ipfsGateway: string;
|
|
737
741
|
logWindow: bigint;
|
|
738
742
|
signedUrlWorker: string;
|
|
743
|
+
keyServer: string;
|
|
739
744
|
};
|
|
740
745
|
/**
|
|
741
746
|
* The networks supported by Fangorn, by the name `CHAIN_NAME` takes.
|
package/lib/config.js
CHANGED
|
@@ -19,7 +19,8 @@ const BaseSepoliaConfig = {
|
|
|
19
19
|
caip2: 84532,
|
|
20
20
|
ipfsGateway: "https://ipfs-test.fangorn.network",
|
|
21
21
|
logWindow: 50000n,
|
|
22
|
-
signedUrlWorker: "https://base-sepolia.storage-worker.fangorn.network"
|
|
22
|
+
signedUrlWorker: "https://base-sepolia.storage-worker.fangorn.network",
|
|
23
|
+
keyServer: "https://keys-test.fangorn.network"
|
|
23
24
|
};
|
|
24
25
|
const ArbitrumSepoliaConfig = {
|
|
25
26
|
dataRegistryContractAddress: "0x44B5a9C43F5905699747e062A126a588816436C4",
|
|
@@ -29,7 +30,9 @@ const ArbitrumSepoliaConfig = {
|
|
|
29
30
|
rpcUrl: "https://sepolia-rollup.arbitrum.io/rpc",
|
|
30
31
|
caip2: 421614,
|
|
31
32
|
ipfsGateway: "https://ipfs-test.fangorn.network",
|
|
32
|
-
logWindow: 100000n
|
|
33
|
+
logWindow: 100000n,
|
|
34
|
+
signedUrlWorker: "https://arbitrum-sepolia.storage-worker.fangorn.network",
|
|
35
|
+
keyServer: "https://arbitrum-sepolia.keys-test.fangorn.network"
|
|
33
36
|
};
|
|
34
37
|
/**
|
|
35
38
|
* The default network: what `Fangorn.create` uses without a `config`, and the CLI
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { PreparedTx } from "../contracts/write.js";
|
|
2
2
|
import { CommitUpdate, LogFilter, Registry, RepoRef, UpdateEntry } from "../contracts/data-registry/index.js";
|
|
3
3
|
import "../contracts/index.js";
|
|
4
|
-
import * as
|
|
4
|
+
import * as viem5999 from "viem";
|
|
5
5
|
import { Address, Hash, Hex, LocalAccount } from "viem";
|
|
6
6
|
|
|
7
7
|
//#region src/test/mem-registry.d.ts
|
|
8
8
|
/** The EIP-712 domain a MemRegistry signs under. */
|
|
9
|
-
declare const MEM_DOMAIN:
|
|
9
|
+
declare const MEM_DOMAIN: viem5999.TypedDataDomain;
|
|
10
10
|
/** One ordering and the registry state over it, shared by every signer of a MemRegistry. */
|
|
11
11
|
declare class MemLedger {
|
|
12
12
|
/** H: position and head */
|