@fangorn-network/sdk 2026.10.1-9.0-dev → 2026.10.19-dev

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 CHANGED
@@ -56,7 +56,7 @@ You can also configure via environment variables (these take precedence over the
56
56
  ETH_PRIVATE_KEY=0x...
57
57
  PINATA_JWT=...
58
58
  PINATA_GATEWAY=https://your-gateway.mypinata.cloud
59
- CHAIN_NAME=arbitrumSepolia # or baseSepolia
59
+ CHAIN_NAME=arbitrumSepolia
60
60
  ACCESS_WORKER_URL=https://access-worker.your-subdomain.workers.dev # optional (sealed fields)
61
61
  SIGNED_URL_WORKER_URL=https://pinata-url-provider.your-subdomain.workers.dev # optional
62
62
  ```
@@ -598,18 +598,7 @@ gadget_ behind the same handle shape, so committed data doesn't change form.
598
598
  | AppRegistry | `0x55e6209ea1833ceD900989a3b3b22466934E04A5` | Apps: owner, accepted publishers, bans, storage subscription (ERC-5643, USDC); what each app excludes |
599
599
  | MembershipRegistry | `0xDF17030Cd65435C86eb043F31DDACa99E819E347` | Time-limited, unlinkable access to an app's paid records (USDC + Semaphore) |
600
600
 
601
- ### Base Sepolia
602
-
603
- | Contract | Address |
604
- | -------------------- | -------------------------------------------- |
605
- | DataRegistry | `0xE9183f768865dd2Cde5f1B71F8446F0Cd798ebe0` |
606
- | AppRegistry | `0x0D3e98399df41b558048Cdd7D71723c37A3A9D6F` |
607
- | MembershipRegistry | `0x0e96C012b5c53622EcDAA82F342E31C2623A04f5` |
608
-
609
- Use it from the SDK with `Fangorn.create({ config: BaseSepoliaConfig, ... })`, or
610
- from the CLI with `CHAIN_NAME=baseSepolia` (or pick it in `fangorn init`).
611
-
612
- `FangornConfig` (Arbitrum Sepolia) and `BaseSepoliaConfig` in `src/config.ts` are the authoritative list and what the SDK
601
+ `FangornConfig` in `src/config.ts` is the authoritative list and what the SDK
613
602
  uses by default — prefer it over any address copied out of a document,
614
603
  including this table. The sources are `fangorn-network/contracts`
615
604
  (`solidity/script/Deployments.sol`); regenerate the ABIs with `pnpm abis`.
package/lib/cli/cli.js CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import getNetwork, { nonBlank, toAppId } from "../config.js";
2
+ import { FangornConfig, nonBlank, toAppId } from "../config.js";
3
3
  import { PublisherStatus } from "../contracts/types.js";
4
4
  import "../contracts/index.js";
5
5
  import { Fangorn } from "../fangorn.js";
6
- import { handleCancel, selectChain } from "./index.js";
6
+ import { handleCancel } from "./index.js";
7
7
  import { createPublicClient, formatEther, formatUnits, http } from "viem";
8
8
  import { privateKeyToAccount } from "viem/accounts";
9
9
  import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
@@ -35,13 +35,11 @@ function loadConfig() {
35
35
  const accessWorkerUrl = process.env.ACCESS_WORKER_URL;
36
36
  const signedUrlWorkerUrl = process.env.SIGNED_URL_WORKER_URL;
37
37
  const envAppId = nonBlank(process.env.FANGORN_APP_ID);
38
- const envChain = nonBlank(process.env.CHAIN_NAME);
39
38
  if (existsSync(CONFIG_PATH)) {
40
39
  const stored = readStoredConfig();
41
- const storedChain = stored.chainName === "Arbitrum Sepolia" ? "arbitrumSepolia" : stored.chainName;
42
40
  _config = {
43
41
  privateKey: stored.privateKey,
44
- cfg: getNetwork(envChain ?? storedChain),
42
+ cfg: FangornConfig,
45
43
  appId: envAppId ?? nonBlank(stored.appId),
46
44
  pinataJwt: stored.pinataJwt,
47
45
  pinataGateway: stored.pinataGateway,
@@ -54,7 +52,7 @@ function loadConfig() {
54
52
  if (!privateKey) throw new Error("Incomplete environment configuration. Missing: ETH_PRIVATE_KEY\nSet it or run `fangorn init` to use a config file.");
55
53
  _config = {
56
54
  privateKey,
57
- cfg: getNetwork(envChain ?? "arbitrumSepolia"),
55
+ cfg: FangornConfig,
58
56
  appId: envAppId,
59
57
  pinataJwt: pinataJwt ?? "",
60
58
  pinataGateway: pinataGateway ?? "",
@@ -155,7 +153,6 @@ program.name("fangorn").description("Fangorn Network CLI").version("0.4.0");
155
153
  program.option("--app <name-or-id>", "App (global namespace) for this command — overrides the stored app (see `set-app`)");
156
154
  program.command("init").description("Configure your Fangorn credentials").action(async () => {
157
155
  intro("Fangorn Setup");
158
- const chainName = await selectChain();
159
156
  const privateKey = await text({
160
157
  message: "Wallet private key (stored locally, never transmitted):",
161
158
  placeholder: "0x...",
@@ -184,7 +181,7 @@ program.command("init").description("Configure your Fangorn credentials").action
184
181
  handleCancel(signedUrlWorkerUrl);
185
182
  writeStoredConfig({
186
183
  privateKey,
187
- chainName,
184
+ chainName: "Arbitrum Sepolia",
188
185
  pinataJwt,
189
186
  pinataGateway,
190
187
  accessWorkerUrl,
@@ -322,11 +319,9 @@ appCmd.command("agent").description("Register this app's gateway as an ERC-8004
322
319
  const agent = new SDK({
323
320
  chainId: cfg.cfg.caip2,
324
321
  rpcUrl: cfg.cfg.rpcUrl,
325
- ...cfg.cfg.caip2 === 421614 && {
326
- subgraphUrl: ERC8004_SUBGRAPH,
327
- registryOverrides: { [cfg.cfg.caip2]: ERC8004_ARBITRUM_SEPOLIA },
328
- subgraphOverrides: { [cfg.cfg.caip2]: ERC8004_SUBGRAPH }
329
- },
322
+ subgraphUrl: ERC8004_SUBGRAPH,
323
+ registryOverrides: { [cfg.cfg.caip2]: ERC8004_ARBITRUM_SEPOLIA },
324
+ subgraphOverrides: { [cfg.cfg.caip2]: ERC8004_SUBGRAPH },
330
325
  ipfs: "pinata",
331
326
  pinataJwt: cfg.pinataJwt,
332
327
  privateKey: cfg.privateKey
@@ -1,10 +1,98 @@
1
1
  import "./cli.js";
2
- import * as viem5646 from "viem";
2
+ import * as viem0 from "viem";
3
3
 
4
4
  //#region src/cli/index.d.ts
5
- declare const getChain: (chainStr: string) => viem5646.Chain;
5
+ declare const getChain: (chainStr: string) => {
6
+ blockExplorers: {
7
+ readonly default: {
8
+ readonly name: "Arbiscan";
9
+ readonly url: "https://sepolia.arbiscan.io";
10
+ readonly apiUrl: "https://api-sepolia.arbiscan.io/api";
11
+ };
12
+ };
13
+ blockTime: 250;
14
+ contracts: {
15
+ readonly multicall3: {
16
+ readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
17
+ readonly blockCreated: 81930;
18
+ };
19
+ };
20
+ ensTlds?: readonly string[] | undefined;
21
+ id: 421614;
22
+ name: "Arbitrum Sepolia";
23
+ nativeCurrency: {
24
+ readonly name: "Arbitrum Sepolia Ether";
25
+ readonly symbol: "ETH";
26
+ readonly decimals: 18;
27
+ };
28
+ experimental_preconfirmationTime?: number | undefined | undefined;
29
+ rpcUrls: {
30
+ readonly default: {
31
+ readonly http: readonly ["https://sepolia-rollup.arbitrum.io/rpc"];
32
+ };
33
+ };
34
+ sourceId?: number | undefined | undefined;
35
+ testnet: true;
36
+ custom?: Record<string, unknown> | undefined;
37
+ extendSchema?: Record<string, unknown> | undefined;
38
+ fees?: viem0.ChainFees<undefined> | undefined;
39
+ formatters?: undefined;
40
+ prepareTransactionRequest?: ((args: viem0.PrepareTransactionRequestParameters, options: {
41
+ phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
42
+ }) => Promise<viem0.PrepareTransactionRequestParameters>) | [fn: ((args: viem0.PrepareTransactionRequestParameters, options: {
43
+ phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
44
+ }) => Promise<viem0.PrepareTransactionRequestParameters>) | undefined, options: {
45
+ runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
46
+ }] | undefined;
47
+ serializers?: viem0.ChainSerializers<undefined, viem0.TransactionSerializable> | undefined;
48
+ verifyHash?: ((client: viem0.Client, parameters: viem0.VerifyHashActionParameters) => Promise<viem0.VerifyHashActionReturnType>) | undefined;
49
+ };
6
50
  declare const handleCancel: (value: unknown) => void;
7
- declare const selectChain: () => Promise<string>;
51
+ declare const selectChain: () => Promise<{
52
+ blockExplorers: {
53
+ readonly default: {
54
+ readonly name: "Arbiscan";
55
+ readonly url: "https://sepolia.arbiscan.io";
56
+ readonly apiUrl: "https://api-sepolia.arbiscan.io/api";
57
+ };
58
+ };
59
+ blockTime: 250;
60
+ contracts: {
61
+ readonly multicall3: {
62
+ readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
63
+ readonly blockCreated: 81930;
64
+ };
65
+ };
66
+ ensTlds?: readonly string[] | undefined;
67
+ id: 421614;
68
+ name: "Arbitrum Sepolia";
69
+ nativeCurrency: {
70
+ readonly name: "Arbitrum Sepolia Ether";
71
+ readonly symbol: "ETH";
72
+ readonly decimals: 18;
73
+ };
74
+ experimental_preconfirmationTime?: number | undefined | undefined;
75
+ rpcUrls: {
76
+ readonly default: {
77
+ readonly http: readonly ["https://sepolia-rollup.arbitrum.io/rpc"];
78
+ };
79
+ };
80
+ sourceId?: number | undefined | undefined;
81
+ testnet: true;
82
+ custom?: Record<string, unknown> | undefined;
83
+ extendSchema?: Record<string, unknown> | undefined;
84
+ fees?: viem0.ChainFees<undefined> | undefined;
85
+ formatters?: undefined;
86
+ prepareTransactionRequest?: ((args: viem0.PrepareTransactionRequestParameters, options: {
87
+ phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
88
+ }) => Promise<viem0.PrepareTransactionRequestParameters>) | [fn: ((args: viem0.PrepareTransactionRequestParameters, options: {
89
+ phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
90
+ }) => Promise<viem0.PrepareTransactionRequestParameters>) | undefined, options: {
91
+ runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
92
+ }] | undefined;
93
+ serializers?: viem0.ChainSerializers<undefined, viem0.TransactionSerializable> | undefined;
94
+ verifyHash?: ((client: viem0.Client, parameters: viem0.VerifyHashActionParameters) => Promise<viem0.VerifyHashActionReturnType>) | undefined;
95
+ }>;
8
96
  declare function parseGadgetArg(raw: string): {
9
97
  type: string;
10
98
  args: string[];
package/lib/cli/index.js CHANGED
@@ -4,7 +4,7 @@ import { isCancel, select } from "@clack/prompts";
4
4
 
5
5
  //#region src/cli/index.ts
6
6
  const getChain = (chainStr) => {
7
- return getNetwork(chainStr).chain;
7
+ return getNetwork(chainStr);
8
8
  };
9
9
  const handleCancel = (value) => {
10
10
  if (isCancel(value)) process.exit(0);
@@ -15,13 +15,10 @@ const selectChain = async () => {
15
15
  options: [{
16
16
  value: "arbitrumSepolia",
17
17
  label: "Arbitrum Sepolia"
18
- }, {
19
- value: "baseSepolia",
20
- label: "Base Sepolia"
21
18
  }]
22
19
  });
23
20
  handleCancel(chainChoice);
24
- return chainChoice.toString();
21
+ return getNetwork(chainChoice.toString());
25
22
  };
26
23
  function parseGadgetArg(raw) {
27
24
  const match = /^(\w+)\(([^)]*)\)$/.exec(raw);