@fangorn-network/sdk 2026.3.11 → 2026.3.28
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 +311 -198
- package/lib/builders/a2aCardBuilder.js +1 -0
- package/lib/cli/cli.d.ts +0 -0
- package/lib/cli/cli.js +399 -380
- package/lib/cli/index.d.ts +170 -170
- package/lib/cli/index.js +1 -4
- package/lib/config.d.ts +543 -163
- package/lib/config.js +11 -8
- package/lib/fangorn.d.ts +31 -43
- package/lib/fangorn.js +101 -117
- package/lib/index.d.ts +8 -5
- package/lib/index.js +8 -7
- package/lib/modules/encryption/index.d.ts +4 -3
- package/lib/modules/encryption/lit.d.ts +3 -18
- package/lib/modules/encryption/lit.js +20 -49
- package/lib/modules/encryption/rand.js +2 -2
- package/lib/modules/encryption/types.d.ts +23 -8
- package/lib/modules/gadgets/settledGadget.d.ts +31 -0
- package/lib/modules/gadgets/settledGadget.js +75 -0
- package/lib/modules/gadgets/types.d.ts +16 -4
- package/lib/providers/storage/index.d.ts +15 -4
- package/lib/providers/storage/pinata/index.d.ts +5 -4
- package/lib/providers/storage/pinata/index.js +17 -2
- package/lib/providers/storage/storacha/index.d.ts +13 -0
- package/lib/providers/storage/storacha/index.js +49 -0
- package/lib/providers/storage/storacha/readOnly.d.ts +8 -0
- package/lib/providers/storage/storacha/readOnly.js +16 -0
- package/lib/{interface → registries}/datasource-registry/abi.d.ts +29 -43
- package/lib/registries/datasource-registry/abi.js +16 -0
- package/lib/registries/datasource-registry/index.d.ts +24 -0
- package/lib/{interface/datasource-registry/dataSourceRegistry.js → registries/datasource-registry/index.js} +35 -34
- package/lib/registries/index.d.ts +3 -0
- package/lib/registries/index.js +4 -0
- package/lib/registries/schema-registry/abi.d.ts +127 -0
- package/lib/registries/schema-registry/abi.js +19 -0
- package/lib/registries/schema-registry/index.d.ts +29 -0
- package/lib/registries/schema-registry/index.js +114 -0
- package/lib/registries/settlement-registry/abi.d.ts +228 -0
- package/lib/registries/settlement-registry/abi.js +29 -0
- package/lib/registries/settlement-registry/index.d.ts +72 -0
- package/lib/registries/settlement-registry/index.js +316 -0
- package/lib/registries/settlement-registry/types.d.ts +51 -0
- package/lib/roles/consumer/index.d.ts +64 -0
- package/lib/roles/consumer/index.js +114 -0
- package/lib/roles/consumer/types.d.ts +66 -0
- package/lib/roles/index.js +1 -0
- package/lib/roles/publisher/index.d.ts +68 -0
- package/lib/roles/publisher/index.js +205 -0
- package/lib/roles/publisher/types.d.ts +93 -0
- package/lib/roles/publisher/types.js +1 -0
- package/lib/roles/schema/index.d.ts +44 -0
- package/lib/roles/schema/index.js +137 -0
- package/lib/roles/schema/types.d.ts +67 -0
- package/lib/roles/schema/types.js +1 -0
- package/lib/test/index.d.ts +5 -2
- package/lib/test/index.js +5 -3
- package/lib/test/testbed.d.ts +52 -32
- package/lib/test/testbed.js +138 -137
- package/lib/types/index.d.ts +65 -21
- package/lib/types/index.js +1 -12
- package/lib/utils/index.d.ts +2 -3
- package/lib/utils/index.js +4 -18
- package/package.json +85 -81
- package/lib/cli/registry.d.ts +0 -29
- package/lib/cli/registry.js +0 -53
- package/lib/deployContract.d.ts +0 -23
- package/lib/deployContract.js +0 -78
- package/lib/interface/datasource-registry/abi.js +0 -110
- package/lib/interface/datasource-registry/dataSourceRegistry.d.ts +0 -24
- package/lib/interface/index.d.ts +0 -3
- package/lib/interface/index.js +0 -4
- package/lib/interface/manifest.d.ts +0 -7
- package/lib/interface/manifest.js +0 -10
- package/lib/interface/settlement-tracker/abi.d.ts +0 -26
- package/lib/interface/settlement-tracker/abi.js +0 -88
- package/lib/interface/settlement-tracker/settlementTracker.d.ts +0 -32
- package/lib/interface/settlement-tracker/settlementTracker.js +0 -64
- package/lib/modules/gadgets/acc/gadgets.d.ts +0 -7
- package/lib/modules/gadgets/acc/gadgets.js +0 -10
- package/lib/modules/gadgets/acc.d.ts +0 -15
- package/lib/modules/gadgets/acc.js +0 -24
- package/lib/modules/gadgets/builder.d.ts +0 -1
- package/lib/modules/gadgets/payment.d.ts +0 -23
- package/lib/modules/gadgets/payment.js +0 -88
- package/lib/test/test-gadget.d.ts +0 -7
- package/lib/test/test-gadget.js +0 -10
- /package/lib/{modules/gadgets/builder.js → registries/settlement-registry/types.js} +0 -0
- /package/lib/{providers/storage/s3/index.js → roles/consumer/types.js} +0 -0
- /package/lib/{providers/storage/s3 → roles}/index.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,83 +1,87 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
2
|
+
"name": "@fangorn-network/sdk",
|
|
3
|
+
"version": "2026.03.28",
|
|
4
|
+
"description": "A zero-knowledge conditional access control framework",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/fangorn-network/fangorn.git"
|
|
8
|
+
},
|
|
9
|
+
"bin": {
|
|
10
|
+
"fangorn": "lib/cli/cli.js"
|
|
11
|
+
},
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "lib/index.js",
|
|
15
|
+
"files": [
|
|
16
|
+
"lib/"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsdown",
|
|
20
|
+
"format": "prettier . --write",
|
|
21
|
+
"lint": "eslint . --max-warnings 0",
|
|
22
|
+
"prepare": "husky",
|
|
23
|
+
"test": "dotenvx run -f .env -- vitest run",
|
|
24
|
+
"test:e2e": "dotenvx run -f .env -- vitest run --config vitest.e2e.config.ts",
|
|
25
|
+
"tsc": "tsc",
|
|
26
|
+
"deploy": "dotenvx run -f .env -- tsx deploy.ts",
|
|
27
|
+
"prepare:cli": "npm run build",
|
|
28
|
+
"fangorn": "dotenvx run -f .env -- node dist/src/cli/cli.js"
|
|
29
|
+
},
|
|
30
|
+
"lint-staged": {
|
|
31
|
+
"*": "prettier --ignore-unknown --write"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@dotenvx/dotenvx": "^1.51.1",
|
|
35
|
+
"@eslint/js": "9.39.1",
|
|
36
|
+
"@types/node": "24.10.1",
|
|
37
|
+
"@vitest/coverage-v8": "4.0.15",
|
|
38
|
+
"@vitest/eslint-plugin": "1.5.1",
|
|
39
|
+
"eslint": "9.39.1",
|
|
40
|
+
"husky": "9.1.7",
|
|
41
|
+
"lint-staged": "16.2.7",
|
|
42
|
+
"prettier": "3.7.3",
|
|
43
|
+
"tsdown": "0.16.8",
|
|
44
|
+
"tsx": "^4.21.0",
|
|
45
|
+
"typescript": "5.8.3",
|
|
46
|
+
"typescript-eslint": "8.48.1",
|
|
47
|
+
"vitest": "^4.0.18"
|
|
48
|
+
},
|
|
49
|
+
"packageManager": "pnpm@10.4.0",
|
|
50
|
+
"engines": {
|
|
51
|
+
"node": ">=20.19.0"
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"@a2a-js/sdk": "^0.3.10",
|
|
55
|
+
"@clack/prompts": "^1.0.1",
|
|
56
|
+
"@lit-protocol/access-control-conditions": "^8.0.2",
|
|
57
|
+
"@lit-protocol/auth": "^8.2.2",
|
|
58
|
+
"@lit-protocol/auth-helpers": "^8.2.1",
|
|
59
|
+
"@lit-protocol/lit-client": "^8.3.1",
|
|
60
|
+
"@lit-protocol/networks": "^8.4.1",
|
|
61
|
+
"@semaphore-protocol/group": "^4.14.2",
|
|
62
|
+
"@semaphore-protocol/identity": "^4.14.2",
|
|
63
|
+
"@semaphore-protocol/proof": "^4.14.2",
|
|
64
|
+
"@storacha/client": "^2.1.3",
|
|
65
|
+
"agent0-sdk": "^1.5.3",
|
|
66
|
+
"commander": "^14.0.3",
|
|
67
|
+
"dotenv": "^17.2.3",
|
|
68
|
+
"ethers": "^6.16.0",
|
|
69
|
+
"pinata": "^2.5.2",
|
|
70
|
+
"solc": "^0.8.28",
|
|
71
|
+
"viem": "^2.47.1"
|
|
72
|
+
},
|
|
73
|
+
"overrides": {
|
|
74
|
+
"viem": "$viem"
|
|
75
|
+
},
|
|
76
|
+
"pnpm": {
|
|
77
|
+
"overrides": {
|
|
78
|
+
"write-file-atomic": "7.0.0"
|
|
79
|
+
},
|
|
80
|
+
"peerDependencyRules": {
|
|
81
|
+
"allowedVersions": {
|
|
82
|
+
"viem": ">=2.38.3",
|
|
83
|
+
"ethers": ">=5.7.2"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
83
87
|
}
|
package/lib/cli/registry.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Gadget } from "../modules/gadgets/types.js";
|
|
2
|
-
import { PaymentGadget } from "../modules/gadgets/payment.js";
|
|
3
|
-
import { Address } from "viem";
|
|
4
|
-
|
|
5
|
-
//#region src/cli/registry.d.ts
|
|
6
|
-
declare const GADGET_REGISTRY: {
|
|
7
|
-
readonly payment: {
|
|
8
|
-
readonly label: "Payment (x402)";
|
|
9
|
-
readonly argSchema: readonly ["usdcPrice"];
|
|
10
|
-
readonly build: (namedParams: Record<string, unknown>) => PaymentGadget;
|
|
11
|
-
readonly prompts: readonly [{
|
|
12
|
-
readonly key: "usdcPrice";
|
|
13
|
-
readonly message: "USDC price:";
|
|
14
|
-
readonly placeholder: "1.00";
|
|
15
|
-
}, {
|
|
16
|
-
readonly key: "chainName";
|
|
17
|
-
readonly message: "Chain name:";
|
|
18
|
-
readonly placeholder: "arbitrumSepolia";
|
|
19
|
-
}, {
|
|
20
|
-
readonly key: "settlementTrackerContractAddress";
|
|
21
|
-
readonly message: "Settlement tracker contract address:";
|
|
22
|
-
readonly placeholder: "0x...";
|
|
23
|
-
}];
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
declare function selectGadget(owner: Address, name: string, tag: string, price: string): Promise<Gadget>;
|
|
27
|
-
type GadgetType = keyof typeof GADGET_REGISTRY;
|
|
28
|
-
//#endregion
|
|
29
|
-
export { GADGET_REGISTRY, GadgetType, selectGadget };
|
package/lib/cli/registry.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { computeTagCommitment, fieldToHex } from "../utils/index.js";
|
|
2
|
-
import { handleCancel } from "./index.js";
|
|
3
|
-
import { PaymentGadget } from "../modules/gadgets/payment.js";
|
|
4
|
-
import { select, text } from "@clack/prompts";
|
|
5
|
-
|
|
6
|
-
//#region src/cli/registry.ts
|
|
7
|
-
const GADGET_REGISTRY = { payment: {
|
|
8
|
-
label: "Payment (x402)",
|
|
9
|
-
argSchema: ["usdcPrice"],
|
|
10
|
-
build: (namedParams) => new PaymentGadget(namedParams),
|
|
11
|
-
prompts: [
|
|
12
|
-
{
|
|
13
|
-
key: "usdcPrice",
|
|
14
|
-
message: "USDC price:",
|
|
15
|
-
placeholder: "1.00"
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
key: "chainName",
|
|
19
|
-
message: "Chain name:",
|
|
20
|
-
placeholder: "arbitrumSepolia"
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
key: "settlementTrackerContractAddress",
|
|
24
|
-
message: "Settlement tracker contract address:",
|
|
25
|
-
placeholder: "0x..."
|
|
26
|
-
}
|
|
27
|
-
]
|
|
28
|
-
} };
|
|
29
|
-
async function selectGadget(owner, name, tag, price) {
|
|
30
|
-
const gadgetType = await select({
|
|
31
|
-
message: "Select access control gadget:",
|
|
32
|
-
options: Object.entries(GADGET_REGISTRY).map(([value, { label }]) => ({
|
|
33
|
-
value,
|
|
34
|
-
label
|
|
35
|
-
}))
|
|
36
|
-
});
|
|
37
|
-
handleCancel(gadgetType);
|
|
38
|
-
const def = GADGET_REGISTRY[gadgetType];
|
|
39
|
-
const params = {};
|
|
40
|
-
for (const { key, message, placeholder } of def.prompts) {
|
|
41
|
-
const val = await text({
|
|
42
|
-
message,
|
|
43
|
-
placeholder
|
|
44
|
-
});
|
|
45
|
-
handleCancel(val);
|
|
46
|
-
params[key] = val;
|
|
47
|
-
}
|
|
48
|
-
params.commitment = fieldToHex(await computeTagCommitment(owner, name, tag, price));
|
|
49
|
-
return def.build(params);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
//#endregion
|
|
53
|
-
export { GADGET_REGISTRY, selectGadget };
|
package/lib/deployContract.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Account, Address } from "viem";
|
|
2
|
-
|
|
3
|
-
//#region src/deployContract.d.ts
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Deploys any contract by name from the local contracts directory.
|
|
7
|
-
*/
|
|
8
|
-
declare function deployContract({
|
|
9
|
-
account,
|
|
10
|
-
contractName,
|
|
11
|
-
constructorArgs,
|
|
12
|
-
chain
|
|
13
|
-
}: {
|
|
14
|
-
account: Account;
|
|
15
|
-
contractName: string;
|
|
16
|
-
constructorArgs?: any[];
|
|
17
|
-
chain: any;
|
|
18
|
-
}): Promise<{
|
|
19
|
-
address: Address;
|
|
20
|
-
abi: any;
|
|
21
|
-
}>;
|
|
22
|
-
//#endregion
|
|
23
|
-
export { deployContract };
|
package/lib/deployContract.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from "fs";
|
|
2
|
-
import { fileURLToPath } from "url";
|
|
3
|
-
import { dirname, join } from "path";
|
|
4
|
-
import { createPublicClient, createWalletClient, encodeDeployData, http } from "viem";
|
|
5
|
-
import solc from "solc";
|
|
6
|
-
|
|
7
|
-
//#region src/deployContract.ts
|
|
8
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
9
|
-
function compileContract(contractName) {
|
|
10
|
-
const fileName = `${contractName}.sol`;
|
|
11
|
-
const source = readFileSync(join(__dirname, "..", "contracts", "src", fileName), "utf-8");
|
|
12
|
-
const input = {
|
|
13
|
-
language: "Solidity",
|
|
14
|
-
sources: { [fileName]: { content: source } },
|
|
15
|
-
settings: {
|
|
16
|
-
metadata: {
|
|
17
|
-
appendCBOR: false,
|
|
18
|
-
useLiteralContent: false
|
|
19
|
-
},
|
|
20
|
-
optimizer: {
|
|
21
|
-
enabled: true,
|
|
22
|
-
runs: 200
|
|
23
|
-
},
|
|
24
|
-
outputSelection: { "*": { "*": ["abi", "evm.bytecode"] } }
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
const output = JSON.parse(solc.compile(JSON.stringify(input)));
|
|
28
|
-
const errors = output.errors?.filter((e) => e.severity === "error");
|
|
29
|
-
if (errors && errors.length > 0) {
|
|
30
|
-
console.error(`Compilation errors in ${fileName}:`, errors);
|
|
31
|
-
throw new Error(`${contractName} compilation failed`);
|
|
32
|
-
}
|
|
33
|
-
const contractData = output.contracts[fileName][contractName];
|
|
34
|
-
return {
|
|
35
|
-
abi: contractData.abi,
|
|
36
|
-
bytecode: contractData.evm.bytecode.object
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Deploys any contract by name from the local contracts directory.
|
|
41
|
-
*/
|
|
42
|
-
async function deployContract({ account, contractName, constructorArgs = [], chain }) {
|
|
43
|
-
console.log(`Compiling ${contractName}...`);
|
|
44
|
-
const compiled = compileContract(contractName);
|
|
45
|
-
const rpcUrl = process.env.CHAIN_RPC_URL;
|
|
46
|
-
if (!rpcUrl) throw new Error("CHAIN_RPC_URL environment variable required");
|
|
47
|
-
const publicClient = createPublicClient({ transport: http(rpcUrl) });
|
|
48
|
-
const walletClient = createWalletClient({
|
|
49
|
-
account,
|
|
50
|
-
transport: http(rpcUrl)
|
|
51
|
-
});
|
|
52
|
-
console.log(`Deploying ${contractName}...`);
|
|
53
|
-
const deployData = encodeDeployData({
|
|
54
|
-
abi: compiled.abi,
|
|
55
|
-
bytecode: `0x${compiled.bytecode}`,
|
|
56
|
-
args: constructorArgs
|
|
57
|
-
});
|
|
58
|
-
const gasPrice = await publicClient.getGasPrice();
|
|
59
|
-
console.log("the gas price is " + gasPrice);
|
|
60
|
-
const gasEstimate = await publicClient.estimateGas({
|
|
61
|
-
data: deployData,
|
|
62
|
-
account: walletClient.account.address
|
|
63
|
-
});
|
|
64
|
-
const txHash = await walletClient.sendTransaction({
|
|
65
|
-
data: deployData,
|
|
66
|
-
gas: gasEstimate + gasEstimate / 10n,
|
|
67
|
-
chain
|
|
68
|
-
});
|
|
69
|
-
const address = (await publicClient.waitForTransactionReceipt({ hash: txHash })).contractAddress;
|
|
70
|
-
console.log(`${contractName} deployed at: ${address}`);
|
|
71
|
-
return {
|
|
72
|
-
address,
|
|
73
|
-
abi: compiled.abi
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
//#endregion
|
|
78
|
-
export { deployContract };
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
//#region src/interface/datasource-registry/abi.ts
|
|
2
|
-
const DS_REGISTRY_ABI = [
|
|
3
|
-
{
|
|
4
|
-
name: "registerDataSource",
|
|
5
|
-
type: "function",
|
|
6
|
-
stateMutability: "nonpayable",
|
|
7
|
-
inputs: [{
|
|
8
|
-
name: "name",
|
|
9
|
-
type: "string"
|
|
10
|
-
}, {
|
|
11
|
-
name: "agentId",
|
|
12
|
-
type: "string"
|
|
13
|
-
}],
|
|
14
|
-
outputs: [{
|
|
15
|
-
name: "id",
|
|
16
|
-
type: "bytes32"
|
|
17
|
-
}]
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
name: "updateDataSource",
|
|
21
|
-
type: "function",
|
|
22
|
-
stateMutability: "nonpayable",
|
|
23
|
-
inputs: [{
|
|
24
|
-
name: "name",
|
|
25
|
-
type: "string"
|
|
26
|
-
}, {
|
|
27
|
-
name: "newManifestCid",
|
|
28
|
-
type: "string"
|
|
29
|
-
}],
|
|
30
|
-
outputs: []
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
name: "getDataSource",
|
|
34
|
-
type: "function",
|
|
35
|
-
stateMutability: "view",
|
|
36
|
-
inputs: [{
|
|
37
|
-
name: "owner",
|
|
38
|
-
type: "address"
|
|
39
|
-
}, {
|
|
40
|
-
name: "name",
|
|
41
|
-
type: "string"
|
|
42
|
-
}],
|
|
43
|
-
outputs: [{
|
|
44
|
-
name: "manifestCid",
|
|
45
|
-
type: "string"
|
|
46
|
-
}]
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
name: "getOwnedDataSources",
|
|
50
|
-
type: "function",
|
|
51
|
-
stateMutability: "view",
|
|
52
|
-
inputs: [{
|
|
53
|
-
name: "owner",
|
|
54
|
-
type: "address"
|
|
55
|
-
}],
|
|
56
|
-
outputs: [{ type: "bytes32[]" }]
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
name: "DataSourceCreated",
|
|
60
|
-
type: "event",
|
|
61
|
-
inputs: [
|
|
62
|
-
{
|
|
63
|
-
name: "id",
|
|
64
|
-
type: "bytes32",
|
|
65
|
-
indexed: true
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
name: "owner",
|
|
69
|
-
type: "address",
|
|
70
|
-
indexed: true
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
name: "name",
|
|
74
|
-
type: "string",
|
|
75
|
-
indexed: false
|
|
76
|
-
}
|
|
77
|
-
]
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
name: "DataSourceUpdated",
|
|
81
|
-
type: "event",
|
|
82
|
-
inputs: [{
|
|
83
|
-
name: "id",
|
|
84
|
-
type: "bytes32",
|
|
85
|
-
indexed: true
|
|
86
|
-
}, {
|
|
87
|
-
name: "newManifestCid",
|
|
88
|
-
type: "string",
|
|
89
|
-
indexed: false
|
|
90
|
-
}]
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
name: "NotOwner",
|
|
94
|
-
type: "error",
|
|
95
|
-
inputs: []
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
name: "DataSourceNotFound",
|
|
99
|
-
type: "error",
|
|
100
|
-
inputs: []
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
name: "DataSourceAlreadyExists",
|
|
104
|
-
type: "error",
|
|
105
|
-
inputs: []
|
|
106
|
-
}
|
|
107
|
-
];
|
|
108
|
-
|
|
109
|
-
//#endregion
|
|
110
|
-
export { DS_REGISTRY_ABI };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as viem0 from "viem";
|
|
2
|
-
import { Address, Hash, Hex, PublicClient, WalletClient } from "viem";
|
|
3
|
-
|
|
4
|
-
//#region src/interface/datasource-registry/dataSourceRegistry.d.ts
|
|
5
|
-
interface Vault {
|
|
6
|
-
manifestCid: string;
|
|
7
|
-
owner: Address;
|
|
8
|
-
name: string;
|
|
9
|
-
}
|
|
10
|
-
declare class DataSourceRegistry {
|
|
11
|
-
private publicClient;
|
|
12
|
-
private walletClient;
|
|
13
|
-
private contractAddress;
|
|
14
|
-
constructor(contractAddress: Address, publicClient: PublicClient, walletClient: WalletClient);
|
|
15
|
-
private getWriteConfig;
|
|
16
|
-
getContractAddress(): `0x${string}`;
|
|
17
|
-
getDataSource(owner: Address, name: string): Promise<Vault>;
|
|
18
|
-
getOwnedDataSources(address: Address): Promise<Hex[]>;
|
|
19
|
-
registerDataSource(name: string, agentId: string): Promise<Hex>;
|
|
20
|
-
updateDataSource(name: string, newManifestCid: string): Promise<Hash>;
|
|
21
|
-
waitForTransaction(hash: Hash): Promise<viem0.TransactionReceipt>;
|
|
22
|
-
}
|
|
23
|
-
//#endregion
|
|
24
|
-
export { DataSourceRegistry, Vault };
|
package/lib/interface/index.d.ts
DELETED
package/lib/interface/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { VaultEntry, VaultManifest } from "../types/index.js";
|
|
2
|
-
|
|
3
|
-
//#region src/interface/manifest.d.ts
|
|
4
|
-
declare function findEntry(manifest: VaultManifest, tag: string): VaultEntry | undefined;
|
|
5
|
-
declare function findEntryByCid(manifest: VaultManifest, cid: string): VaultEntry | undefined;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { findEntry, findEntryByCid };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
//#region src/interface/manifest.ts
|
|
2
|
-
function findEntry(manifest, tag) {
|
|
3
|
-
return manifest.entries.find((e) => e.tag === tag);
|
|
4
|
-
}
|
|
5
|
-
function findEntryByCid(manifest, cid) {
|
|
6
|
-
return manifest.entries.find((e) => e.cid === cid);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
//#endregion
|
|
10
|
-
export { findEntry, findEntryByCid };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
//#region src/interface/settlement-tracker/abi.d.ts
|
|
2
|
-
declare const SETTLEMENT_TRACKER_ABI: ({
|
|
3
|
-
name: string;
|
|
4
|
-
type: string;
|
|
5
|
-
stateMutability: string;
|
|
6
|
-
inputs: {
|
|
7
|
-
name: string;
|
|
8
|
-
type: string;
|
|
9
|
-
}[];
|
|
10
|
-
outputs: {
|
|
11
|
-
name: string;
|
|
12
|
-
type: string;
|
|
13
|
-
}[];
|
|
14
|
-
} | {
|
|
15
|
-
name: string;
|
|
16
|
-
type: string;
|
|
17
|
-
inputs: {
|
|
18
|
-
name: string;
|
|
19
|
-
type: string;
|
|
20
|
-
indexed: boolean;
|
|
21
|
-
}[];
|
|
22
|
-
stateMutability?: undefined;
|
|
23
|
-
outputs?: undefined;
|
|
24
|
-
})[];
|
|
25
|
-
//#endregion
|
|
26
|
-
export { SETTLEMENT_TRACKER_ABI };
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
//#region src/interface/settlement-tracker/abi.ts
|
|
2
|
-
const SETTLEMENT_TRACKER_ABI = [
|
|
3
|
-
{
|
|
4
|
-
name: "pay",
|
|
5
|
-
type: "function",
|
|
6
|
-
stateMutability: "payable",
|
|
7
|
-
inputs: [
|
|
8
|
-
{
|
|
9
|
-
name: "commitment",
|
|
10
|
-
type: "bytes32"
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
name: "from",
|
|
14
|
-
type: "address"
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
name: "to",
|
|
18
|
-
type: "address"
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
name: "value",
|
|
22
|
-
type: "uint256"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
name: "validAfter",
|
|
26
|
-
type: "uint256"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
name: "validBefore",
|
|
30
|
-
type: "uint256"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
name: "nonce",
|
|
34
|
-
type: "bytes32"
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
name: "v",
|
|
38
|
-
type: "uint8"
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
name: "r",
|
|
42
|
-
type: "bytes32"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
name: "s",
|
|
46
|
-
type: "bytes32"
|
|
47
|
-
}
|
|
48
|
-
],
|
|
49
|
-
outputs: []
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
name: "checkSettlement",
|
|
53
|
-
type: "function",
|
|
54
|
-
stateMutability: "view",
|
|
55
|
-
inputs: [{
|
|
56
|
-
name: "commitment",
|
|
57
|
-
type: "bytes32"
|
|
58
|
-
}, {
|
|
59
|
-
name: "user",
|
|
60
|
-
type: "address"
|
|
61
|
-
}],
|
|
62
|
-
outputs: [{
|
|
63
|
-
name: "amount",
|
|
64
|
-
type: "uint256"
|
|
65
|
-
}]
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
name: "SettlementRecordedd",
|
|
69
|
-
type: "event",
|
|
70
|
-
inputs: [{
|
|
71
|
-
name: "hash",
|
|
72
|
-
type: "bytes32",
|
|
73
|
-
indexed: true
|
|
74
|
-
}, {
|
|
75
|
-
name: "amount",
|
|
76
|
-
type: "uint256",
|
|
77
|
-
indexed: false
|
|
78
|
-
}]
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
name: "TransferFailed",
|
|
82
|
-
type: "error",
|
|
83
|
-
inputs: []
|
|
84
|
-
}
|
|
85
|
-
];
|
|
86
|
-
|
|
87
|
-
//#endregion
|
|
88
|
-
export { SETTLEMENT_TRACKER_ABI };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import * as viem0 from "viem";
|
|
2
|
-
import { Address, Hash, Hex, PublicClient, WalletClient } from "viem";
|
|
3
|
-
|
|
4
|
-
//#region src/interface/settlement-tracker/settlementTracker.d.ts
|
|
5
|
-
declare class SettlementTracker {
|
|
6
|
-
private publicClient;
|
|
7
|
-
private walletClient;
|
|
8
|
-
private contractAddress;
|
|
9
|
-
constructor(contractAddress: Address, publicClient: PublicClient, walletClient: WalletClient);
|
|
10
|
-
private getWriteConfig;
|
|
11
|
-
getContractAddress(): `0x${string}`;
|
|
12
|
-
checkSettlement(commitment: Hex, user: Address): Promise<boolean>;
|
|
13
|
-
/**
|
|
14
|
-
* Settles the payment on-chain using the EIP-3009 authorization
|
|
15
|
-
* This is usually called by the Facilitator.
|
|
16
|
-
*/
|
|
17
|
-
pay(args: {
|
|
18
|
-
commitment: Hex;
|
|
19
|
-
from: Address;
|
|
20
|
-
to: Address;
|
|
21
|
-
value: bigint;
|
|
22
|
-
validAfter: bigint;
|
|
23
|
-
validBefore: bigint;
|
|
24
|
-
nonce: Hex;
|
|
25
|
-
v: number;
|
|
26
|
-
r: Hex;
|
|
27
|
-
s: Hex;
|
|
28
|
-
}): Promise<Hash>;
|
|
29
|
-
waitForTransaction(hash: Hash): Promise<viem0.TransactionReceipt>;
|
|
30
|
-
}
|
|
31
|
-
//#endregion
|
|
32
|
-
export { SettlementTracker };
|