@fangorn-network/sdk 2026.9.22-dev → 2026.10.1-9.0-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.
Files changed (91) hide show
  1. package/README.md +190 -194
  2. package/lib/cli/cli.d.ts +0 -0
  3. package/lib/cli/cli.js +177 -201
  4. package/lib/cli/index.d.ts +3 -91
  5. package/lib/cli/index.js +5 -2
  6. package/lib/config.d.ts +358 -117
  7. package/lib/config.js +43 -23
  8. package/lib/contracts/app-registry/abi.d.ts +1033 -277
  9. package/lib/contracts/app-registry/abi.js +1214 -335
  10. package/lib/contracts/app-registry/index.d.ts +105 -65
  11. package/lib/contracts/app-registry/index.js +182 -175
  12. package/lib/contracts/data-registry/abi.d.ts +166 -187
  13. package/lib/contracts/data-registry/abi.js +207 -237
  14. package/lib/contracts/data-registry/index.d.ts +4 -151
  15. package/lib/contracts/data-registry/index.js +5 -279
  16. package/lib/contracts/index.d.ts +6 -7
  17. package/lib/contracts/index.js +6 -8
  18. package/lib/contracts/logs.d.ts +4 -1
  19. package/lib/contracts/logs.js +9 -2
  20. package/lib/contracts/membership-registry/abi.d.ts +1145 -0
  21. package/lib/contracts/membership-registry/abi.js +1333 -0
  22. package/lib/contracts/membership-registry/index.d.ts +79 -0
  23. package/lib/contracts/membership-registry/index.js +104 -0
  24. package/lib/contracts/types.d.ts +3 -1
  25. package/lib/contracts/types.js +3 -1
  26. package/lib/contracts/write.d.ts +34 -2
  27. package/lib/contracts/write.js +48 -1
  28. package/lib/crypto/encryption.js +4 -4
  29. package/lib/engine/car.d.ts +2 -2
  30. package/lib/engine/car.js +10 -5
  31. package/lib/engine/index.d.ts +99 -143
  32. package/lib/engine/index.js +156 -295
  33. package/lib/engine/records.d.ts +110 -0
  34. package/lib/engine/records.js +165 -0
  35. package/lib/engine/test-helpers.d.ts +7 -14
  36. package/lib/engine/test-helpers.js +7 -18
  37. package/lib/fangorn.d.ts +129 -156
  38. package/lib/fangorn.js +250 -250
  39. package/lib/feed.d.ts +7 -4
  40. package/lib/feed.js +4 -1
  41. package/lib/index.d.ts +9 -9
  42. package/lib/index.js +8 -9
  43. package/lib/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.js +77 -0
  44. package/lib/node_modules/@vitest/expect/dist/index.js +1414 -0
  45. package/lib/node_modules/@vitest/pretty-format/dist/index.js +858 -0
  46. package/lib/node_modules/@vitest/runner/dist/chunk-tasks.js +51 -0
  47. package/lib/node_modules/@vitest/runner/dist/index.js +1199 -0
  48. package/lib/node_modules/@vitest/runner/dist/utils.js +3 -0
  49. package/lib/node_modules/@vitest/snapshot/dist/index.js +1075 -0
  50. package/lib/node_modules/@vitest/spy/dist/index.js +353 -0
  51. package/lib/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js +7 -0
  52. package/lib/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js +81 -0
  53. package/lib/node_modules/@vitest/utils/dist/diff.js +1345 -0
  54. package/lib/node_modules/@vitest/utils/dist/display.js +534 -0
  55. package/lib/node_modules/@vitest/utils/dist/error.js +30 -0
  56. package/lib/node_modules/@vitest/utils/dist/helpers.js +118 -0
  57. package/lib/node_modules/@vitest/utils/dist/serialize.js +76 -0
  58. package/lib/node_modules/@vitest/utils/dist/source-map.js +93 -0
  59. package/lib/node_modules/@vitest/utils/dist/timers.js +36 -0
  60. package/lib/node_modules/chai/index.js +2874 -0
  61. package/lib/node_modules/magic-string/dist/magic-string.es.js +939 -0
  62. package/lib/node_modules/pathe/dist/shared/pathe.M-eThtNZ.js +81 -0
  63. package/lib/node_modules/tinyrainbow/dist/index.js +85 -0
  64. package/lib/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.js +5 -0
  65. package/lib/node_modules/vitest/dist/chunks/date.Bq6ZW5rf.js +50 -0
  66. package/lib/node_modules/vitest/dist/chunks/utils.DvEY5TfP.js +44 -0
  67. package/lib/node_modules/vitest/dist/chunks/vi.2VT5v0um.js +2578 -0
  68. package/lib/providers/storage/signed-url.d.ts +16 -6
  69. package/lib/providers/storage/signed-url.js +20 -8
  70. package/lib/registry.d.ts +116 -0
  71. package/lib/registry.js +182 -0
  72. package/lib/test/mem-registry.d.ts +51 -0
  73. package/lib/test/mem-registry.js +107 -0
  74. package/lib/test/sdk-suite.d.ts +13 -0
  75. package/lib/test/sdk-suite.js +226 -0
  76. package/lib/test/testbed.d.ts +16411 -61
  77. package/lib/test/testbed.js +190 -84
  78. package/lib/types/index.d.ts +13 -11
  79. package/package.json +89 -73
  80. package/lib/contracts/data-registry/test.d.ts +0 -1
  81. package/lib/contracts/data-registry/test.js +0 -1
  82. package/lib/contracts/settlement-registry/abi.d.ts +0 -466
  83. package/lib/contracts/settlement-registry/abi.js +0 -535
  84. package/lib/contracts/settlement-registry/index.d.ts +0 -163
  85. package/lib/contracts/settlement-registry/index.js +0 -264
  86. package/lib/contracts/subscription-registry/abi.d.ts +0 -179
  87. package/lib/contracts/subscription-registry/abi.js +0 -195
  88. package/lib/contracts/subscription-registry/index.d.ts +0 -59
  89. package/lib/contracts/subscription-registry/index.js +0 -116
  90. package/lib/engine/graph.d.ts +0 -70
  91. package/lib/engine/graph.js +0 -73
package/lib/config.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { keccak256, toHex } from "viem";
2
- import { arbitrumSepolia } from "viem/chains";
2
+ import { arbitrumSepolia, baseSepolia } from "viem/chains";
3
3
 
4
4
  //#region src/config.ts
5
5
  /**
@@ -8,36 +8,56 @@ import { arbitrumSepolia } from "viem/chains";
8
8
  function appId(name) {
9
9
  return keccak256(toHex(name));
10
10
  }
11
- const DEFAULT_APP = "fangorn";
12
- function toAppId(nameOrId) {
13
- return /^0x[0-9a-fA-F]{64}$/.test(nameOrId) ? nameOrId : appId(nameOrId);
14
- }
15
- /**
16
- * The networks supported by Fangorn currently
17
- */
18
- const SupportedNetworks = { ArbitrumSepolia: {
19
- name: "arbitrumSepolia",
20
- chain: arbitrumSepolia
21
- } };
22
11
  /**
23
- * Get the network based on the string name
24
- * @param name "arbitrumSepolia" is the only one supported right now
25
- * @returns The corresponding network if it is supported, otherwise an error
12
+ * Blank input means "not set", never an app called "". Returns the trimmed value,
13
+ * or undefined when it is missing or only whitespace, so it can sit on the left of
14
+ * a `??` fallback. `??` on the raw value would let "" through: it is not nullish.
26
15
  */
27
- function getNetwork(name) {
28
- if (name === SupportedNetworks.ArbitrumSepolia.name) return arbitrumSepolia;
29
- throw new Error(`Chain ${name} is not supported`);
16
+ function nonBlank(value) {
17
+ const trimmed = value?.trim();
18
+ return trimmed === "" ? void 0 : trimmed;
19
+ }
20
+ function toAppId(nameOrId) {
21
+ const name = nameOrId.trim();
22
+ if (!name) throw new Error("App name or id must not be blank.");
23
+ return /^0x[0-9a-fA-F]{64}$/.test(name) ? name : appId(name);
30
24
  }
31
25
  const FangornConfig = {
32
- dataRegistryContractAddress: "0x775026e905d7b58b34d16bcbd385fa630ee36c26",
33
- appRegistryContractAddress: "0x11d228c4774af3d9cae3b4b6874a12576a1a83ec",
34
- subscriptionRegistryContractAddress: "0x9c599136b195d70edea0106017fdf081a0401f9d",
35
- settlementRegistryContractAddress: "0xbbecb93142d1a5144260d2c30fe3c4a11fdda346",
26
+ dataRegistryContractAddress: "0x72B5f83526F3893aF9f1eE0f32A27218EA09f8aE",
27
+ appRegistryContractAddress: "0x55e6209ea1833ceD900989a3b3b22466934E04A5",
28
+ membershipRegistryContractAddress: "0xDF17030Cd65435C86eb043F31DDACa99E819E347",
29
+ appRegistryFromBlock: 319536642n,
36
30
  chain: arbitrumSepolia,
37
31
  rpcUrl: "https://sepolia-rollup.arbitrum.io/rpc",
38
32
  caip2: 421614,
39
33
  ipfsGateway: "https://ipfs.io"
40
34
  };
35
+ const BaseSepoliaConfig = {
36
+ dataRegistryContractAddress: "0xE9183f768865dd2Cde5f1B71F8446F0Cd798ebe0",
37
+ appRegistryContractAddress: "0x0D3e98399df41b558048Cdd7D71723c37A3A9D6F",
38
+ membershipRegistryContractAddress: "0x0e96C012b5c53622EcDAA82F342E31C2623A04f5",
39
+ appRegistryFromBlock: 48340483n,
40
+ chain: baseSepolia,
41
+ rpcUrl: "https://sepolia.base.org",
42
+ caip2: 84532,
43
+ ipfsGateway: "https://ipfs.io"
44
+ };
45
+ /**
46
+ * The networks supported by Fangorn, by the name `CHAIN_NAME` takes.
47
+ */
48
+ const SupportedNetworks = {
49
+ arbitrumSepolia: FangornConfig,
50
+ baseSepolia: BaseSepoliaConfig
51
+ };
52
+ /**
53
+ * Get a network's deployment by name ("arbitrumSepolia" or "baseSepolia").
54
+ * @returns The corresponding config if it is supported, otherwise an error
55
+ */
56
+ function getNetwork(name) {
57
+ const config = SupportedNetworks[name];
58
+ if (!config) throw new Error(`Chain ${name} is not supported. Use one of: ${Object.keys(SupportedNetworks).join(", ")}`);
59
+ return config;
60
+ }
41
61
 
42
62
  //#endregion
43
- export { DEFAULT_APP, FangornConfig, SupportedNetworks, appId, getNetwork as default, toAppId };
63
+ export { BaseSepoliaConfig, FangornConfig, SupportedNetworks, appId, getNetwork as default, nonBlank, toAppId };