@opendatalabs/vana-sdk 3.7.0 → 3.7.2
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/dist/config/contracts.config.cjs +12 -0
- package/dist/config/contracts.config.cjs.map +1 -1
- package/dist/config/contracts.config.js +12 -0
- package/dist/config/contracts.config.js.map +1 -1
- package/dist/contracts/contractController.cjs +10 -1
- package/dist/contracts/contractController.cjs.map +1 -1
- package/dist/contracts/contractController.d.ts +8 -6
- package/dist/contracts/contractController.js +14 -2
- package/dist/contracts/contractController.js.map +1 -1
- package/dist/direct/controller.cjs +15 -6
- package/dist/direct/controller.cjs.map +1 -1
- package/dist/direct/controller.d.ts +13 -10
- package/dist/direct/controller.js +15 -6
- package/dist/direct/controller.js.map +1 -1
- package/dist/direct/endpoints.cjs +4 -2
- package/dist/direct/endpoints.cjs.map +1 -1
- package/dist/direct/endpoints.js +4 -2
- package/dist/direct/endpoints.js.map +1 -1
- package/dist/direct/escrow-payment.cjs +2 -1
- package/dist/direct/escrow-payment.cjs.map +1 -1
- package/dist/direct/escrow-payment.js +2 -1
- package/dist/direct/escrow-payment.js.map +1 -1
- package/dist/direct/types.cjs.map +1 -1
- package/dist/direct/types.d.ts +2 -0
- package/dist/direct/types.js.map +1 -1
- package/dist/generated/addresses.cjs +17 -5
- package/dist/generated/addresses.cjs.map +1 -1
- package/dist/generated/addresses.d.ts +29 -7
- package/dist/generated/addresses.js +17 -5
- package/dist/generated/addresses.js.map +1 -1
- package/dist/index.browser.d.ts +1 -0
- package/dist/index.browser.js +27 -6
- package/dist/index.browser.js.map +2 -2
- package/dist/index.node.cjs +27 -6
- package/dist/index.node.cjs.map +2 -2
- package/dist/index.node.d.ts +1 -0
- package/dist/index.node.js +27 -6
- package/dist/index.node.js.map +2 -2
- package/package.json +1 -1
|
@@ -25,6 +25,18 @@ const CONTRACTS = {
|
|
|
25
25
|
// ========================================
|
|
26
26
|
// DATA PORTABILITY CONTRACTS
|
|
27
27
|
// ========================================
|
|
28
|
+
DataPortabilityEscrow: {
|
|
29
|
+
addresses: {
|
|
30
|
+
14800: "0x07d7769081adc3a3DBe91f5E4B98E9A5a6B292e3",
|
|
31
|
+
1480: "0x07d7769081adc3a3DBe91f5E4B98E9A5a6B292e3"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
FeeRegistry: {
|
|
35
|
+
addresses: {
|
|
36
|
+
14800: "0xb4FA18443E0FA6cdC0280D20b8cCDB2377D13Bf2",
|
|
37
|
+
1480: "0xb4FA18443E0FA6cdC0280D20b8cCDB2377D13Bf2"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
28
40
|
DataPortabilityPermissions: {
|
|
29
41
|
addresses: {
|
|
30
42
|
14800: "0xD54523048AdD05b4d734aFaE7C68324Ebb7373eF",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/config/contracts.config.ts"],"sourcesContent":["// SOURCE CONFIGURATION - Complete contract registry\n// Generated output: src/generated/addresses.ts\n\n/**\n * Complete contract configuration for the Vana protocol.\n *\n * ⚠️ THIS IS A SOURCE FILE - EDIT THIS TO ADD/UPDATE CONTRACTS\n *\n * @remarks\n * This file contains all contract addresses and discovery metadata in one place.\n *\n * **Contract Types:**\n * - Entry Points: Contracts without `discovery` field (must be known externally)\n * - Discoverable: Contracts with `discovery` field (auto-discovered from parent)\n *\n * **Build Process:**\n * 1. Edit this file to add/update contracts\n * 2. Run `npm run discover-addresses` to validate and generate complete registry\n * 3. Run `npm run fetch-abis` to fetch ABIs for all contracts\n *\n * @category Configuration\n * @internal This is a source file - apps should import from src/generated/addresses.ts\n */\n\ninterface DiscoveryMetadata {\n /** Parent contract to discover this from */\n parent: string;\n /** Getter function name on parent contract */\n getter: string;\n}\n\ninterface ContractConfig {\n addresses: {\n 14800: string;\n 1480: string;\n };\n /** If present, this contract can be auto-discovered from parent */\n discovery?: DiscoveryMetadata;\n}\n\nexport const CONTRACTS: Record<string, ContractConfig> = {\n // ========================================\n // DATA PORTABILITY CONTRACTS\n // ========================================\n DataPortabilityPermissions: {\n addresses: {\n 14800: \"0xD54523048AdD05b4d734aFaE7C68324Ebb7373eF\",\n 1480: \"0xD54523048AdD05b4d734aFaE7C68324Ebb7373eF\",\n },\n },\n DataPortabilityServers: {\n addresses: {\n 14800: \"0x1483B1F634DBA75AeaE60da7f01A679aabd5ee2c\",\n 1480: \"0x1483B1F634DBA75AeaE60da7f01A679aabd5ee2c\",\n },\n },\n DataPortabilityGrantees: {\n addresses: {\n 14800: \"0x8325C0A0948483EdA023A1A2Fd895e62C5131234\",\n 1480: \"0x8325C0A0948483EdA023A1A2Fd895e62C5131234\",\n },\n },\n DataRegistry: {\n addresses: {\n 14800: \"0x8C8788f98385F6ba1adD4234e551ABba0f82Cb7C\",\n 1480: \"0x8C8788f98385F6ba1adD4234e551ABba0f82Cb7C\",\n },\n },\n\n // ========================================\n // COMPUTING INFRASTRUCTURE\n // ========================================\n ComputeEngine: {\n addresses: {\n 14800: \"0xb2BFe33FA420c45F1Cf1287542ad81ae935447bd\",\n 1480: \"0xb2BFe33FA420c45F1Cf1287542ad81ae935447bd\",\n },\n },\n ComputeEngineTreasury: {\n addresses: {\n 14800: \"0xceB33C501B624D984bD1Ed3298f6D1d8F7CE03d1\",\n 1480: \"0xceB33C501B624D984bD1Ed3298f6D1d8F7CE03d1\",\n },\n discovery: {\n parent: \"ComputeEngine\",\n getter: \"computeEngineTreasury\",\n },\n },\n QueryEngine: {\n addresses: {\n 14800: \"0xd25Eb66EA2452cf3238A2eC6C1FD1B7F5B320490\",\n 1480: \"0xd25Eb66EA2452cf3238A2eC6C1FD1B7F5B320490\",\n },\n },\n VanaTreasury: {\n addresses: {\n 14800: \"0x8B32Ef32f22e72cc25D53f6E858f57cAe7E198f9\",\n 1480: \"0x8B32Ef32f22e72cc25D53f6E858f57cAe7E198f9\",\n },\n discovery: {\n parent: \"QueryEngine\",\n getter: \"queryEngineTreasury\",\n },\n },\n DataRefinerRegistry: {\n addresses: {\n 14800: \"0x93c3EF89369fDcf08Be159D9DeF0F18AB6Be008c\",\n 1480: \"0x93c3EF89369fDcf08Be159D9DeF0F18AB6Be008c\",\n },\n },\n ComputeInstructionRegistry: {\n addresses: {\n 14800: \"0x5786B12b4c6Ba2bFAF0e77Ed30Bf6d32805563A5\",\n 1480: \"0x5786B12b4c6Ba2bFAF0e77Ed30Bf6d32805563A5\",\n },\n },\n\n // ========================================\n // TEE POOLS (Canonical Deployments)\n // ========================================\n TeePoolPhala: {\n addresses: {\n 14800: \"0xE8EC6BD73b23Ad40E6B9a6f4bD343FAc411bD99A\",\n 1480: \"0xE8EC6BD73b23Ad40E6B9a6f4bD343FAc411bD99A\",\n },\n },\n TeePoolEphemeralStandard: {\n addresses: {\n 14800: \"0xe124bae846D5ec157f75Bd9e68ca87C4d2AB835A\",\n 1480: \"0xe124bae846D5ec157f75Bd9e68ca87C4d2AB835A\",\n },\n },\n TeePoolPersistentStandard: {\n addresses: {\n 14800: \"0xe8bB8d0629651Cf33e0845d743976Dc1f0971d76\",\n 1480: \"0xe8bB8d0629651Cf33e0845d743976Dc1f0971d76\",\n },\n },\n TeePoolPersistentGpu: {\n addresses: {\n 14800: \"0x1c346Cd74f8551f8fa13f3F4b6b8dAE22338E6a9\",\n 1480: \"0x1c346Cd74f8551f8fa13f3F4b6b8dAE22338E6a9\",\n },\n },\n TeePoolDedicatedStandard: {\n addresses: {\n 14800: \"0xf024b7ac5E8417416f53B41ecfa58C8e9396687d\",\n 1480: \"0xf024b7ac5E8417416f53B41ecfa58C8e9396687d\",\n },\n },\n TeePoolDedicatedGpu: {\n addresses: {\n 14800: \"0xB1686FA9620bBf851714d1cB47b8a4Bf4664644E\",\n 1480: \"0xB1686FA9620bBf851714d1cB47b8a4Bf4664644E\",\n },\n },\n\n // ========================================\n // VANA EPOCH / DLP REGISTRY\n // ========================================\n // Note: DLP rewards-specific contracts (DLPPerformance, DLPRewardDeployer,\n // DLPRewardDeployerTreasury, DLPRewardSwap, SwapHelper) were removed in the\n // protocol unification cleanup. VanaEpoch, DLPRegistry, and DLPRegistryTreasury\n // are kept because they may be referenced beyond the rewards system.\n VanaEpoch: {\n addresses: {\n 14800: \"0x2063cFF0609D59bCCc196E20Eb58A8696a6b15A0\",\n 1480: \"0x2063cFF0609D59bCCc196E20Eb58A8696a6b15A0\",\n },\n },\n DLPRegistry: {\n addresses: {\n 14800: \"0x4D59880a924526d1dD33260552Ff4328b1E18a43\",\n 1480: \"0x4D59880a924526d1dD33260552Ff4328b1E18a43\",\n },\n },\n DLPRegistryTreasury: {\n addresses: {\n 14800: \"0xb12ce1d27bEeFe39b6F0110b1AB77C21Aa0c9F9a\",\n 1480: \"0xb12ce1d27bEeFe39b6F0110b1AB77C21Aa0c9F9a\",\n },\n discovery: {\n parent: \"DLPRegistry\",\n getter: \"treasury\",\n },\n },\n\n // ========================================\n // VANA POOL (STAKING)\n // ========================================\n VanaPoolStaking: {\n addresses: {\n 14800: \"0x641C18E2F286c86f96CE95C8ec1EB9fC0415Ca0e\",\n 1480: \"0x641C18E2F286c86f96CE95C8ec1EB9fC0415Ca0e\",\n },\n },\n VanaPoolTreasury: {\n addresses: {\n 14800: \"0x143BE72CF2541604A7691933CAccd6D9cC17c003\",\n 1480: \"0x143BE72CF2541604A7691933CAccd6D9cC17c003\",\n },\n discovery: {\n parent: \"VanaPoolStaking\",\n getter: \"vanaPoolTreasury\",\n },\n },\n VanaPoolEntity: {\n addresses: {\n 14800: \"0x44f20490A82e1f1F1cC25Dd3BA8647034eDdce30\",\n 1480: \"0x44f20490A82e1f1F1cC25Dd3BA8647034eDdce30\",\n },\n discovery: {\n parent: \"VanaPoolStaking\",\n getter: \"vanaPoolEntity\",\n },\n },\n\n // ========================================\n // DLP DEPLOYMENT & TOKEN SYSTEM\n // ========================================\n DATFactory: {\n addresses: {\n 14800: \"0x40f8bccF35a75ecef63BC3B1B3E06ffEB9220644\",\n 1480: \"0x40f8bccF35a75ecef63BC3B1B3E06ffEB9220644\",\n },\n },\n DAT: {\n addresses: {\n 14800: \"0xA706b93ccED89f13340673889e29F0a5cd84212d\",\n 1480: \"0xA706b93ccED89f13340673889e29F0a5cd84212d\",\n },\n },\n DATPausable: {\n addresses: {\n 14800: \"0xe69FE86f0B95cC2f8416Fe22815c85DC8887e76e\",\n 1480: \"0xe69FE86f0B95cC2f8416Fe22815c85DC8887e76e\",\n },\n },\n DATVotes: {\n addresses: {\n 14800: \"0xaE04c8A77E9B27869eb563720524A9aE0baf1831\",\n 1480: \"0xaE04c8A77E9B27869eb563720524A9aE0baf1831\",\n },\n },\n\n // ========================================\n // EXTERNAL DEPENDENCIES (DeFi)\n // ========================================\n WVANA: {\n addresses: {\n 14800: \"0xbccc4b4c6530F82FE309c5E845E50b5E9C89f2AD\",\n 1480: \"0x00EDdD9621Fb08436d0331c149D1690909a5906d\",\n },\n },\n UniswapV3NonfungiblePositionManager: {\n addresses: {\n 14800: \"0x48Bd633f4B9128a38Ebb4a48b6975EB3Eaf1931b\",\n 1480: \"0x45a2992e1bFdCF9b9AcE0a84A238f2E56F481816\",\n },\n },\n UniswapV3QuoterV2: {\n addresses: {\n 14800: \"0x3152246f3CD4dD465292Dd4Ffd792E2Cf602e332\",\n 1480: \"0x1b13728ea3C90863990aC0e05987CfeC1888908c\",\n },\n },\n\n // ========================================\n // UTILITY CONTRACTS\n // ========================================\n Multicall3: {\n addresses: {\n 14800: \"0xD8d2dFca27E8797fd779F8547166A2d3B29d360E\",\n 1480: \"0xD8d2dFca27E8797fd779F8547166A2d3B29d360E\",\n },\n },\n Multisend: {\n addresses: {\n 14800: \"0x8807e8BCDFbaA8c2761760f3FBA37F6f7F2C5b2d\",\n 1480: \"0x8807e8BCDFbaA8c2761760f3FBA37F6f7F2C5b2d\",\n },\n },\n} as const;\n\n// Legacy DLPRoot* and deprecated TeePool entries were removed in the protocol\n// unification cleanup. They were part of the old DLP rewards system superseded\n// by other contracts.\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAA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ACR,QAAQ;AAAA,IACV;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,YAAY;AAAA,IACV,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,aAAa;AAAA,IACX,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,UAAU;AAAA,IACR,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,OAAO;AAAA,IACL,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,qCAAqC;AAAA,IACnC,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,mBAAmB;AAAA,IACjB,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,YAAY;AAAA,IACV,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,WAAW;AAAA,IACT,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/config/contracts.config.ts"],"sourcesContent":["// SOURCE CONFIGURATION - Complete contract registry\n// Generated output: src/generated/addresses.ts\n\n/**\n * Complete contract configuration for the Vana protocol.\n *\n * ⚠️ THIS IS A SOURCE FILE - EDIT THIS TO ADD/UPDATE CONTRACTS\n *\n * @remarks\n * This file contains all contract addresses and discovery metadata in one place.\n *\n * **Contract Types:**\n * - Entry Points: Contracts without `discovery` field (must be known externally)\n * - Discoverable: Contracts with `discovery` field (auto-discovered from parent)\n *\n * **Build Process:**\n * 1. Edit this file to add/update contracts\n * 2. Run `npm run discover-addresses` to validate and generate complete registry\n * 3. Run `npm run fetch-abis` to fetch ABIs for all contracts\n *\n * @category Configuration\n * @internal This is a source file - apps should import from src/generated/addresses.ts\n */\n\ninterface DiscoveryMetadata {\n /** Parent contract to discover this from */\n parent: string;\n /** Getter function name on parent contract */\n getter: string;\n}\n\ninterface ContractConfig {\n addresses: {\n 14800: string;\n 1480: string;\n };\n /** If present, this contract can be auto-discovered from parent */\n discovery?: DiscoveryMetadata;\n}\n\nexport const CONTRACTS: Record<string, ContractConfig> = {\n // ========================================\n // DATA PORTABILITY CONTRACTS\n // ========================================\n DataPortabilityEscrow: {\n addresses: {\n 14800: \"0x07d7769081adc3a3DBe91f5E4B98E9A5a6B292e3\",\n 1480: \"0x07d7769081adc3a3DBe91f5E4B98E9A5a6B292e3\",\n },\n },\n FeeRegistry: {\n addresses: {\n 14800: \"0xb4FA18443E0FA6cdC0280D20b8cCDB2377D13Bf2\",\n 1480: \"0xb4FA18443E0FA6cdC0280D20b8cCDB2377D13Bf2\",\n },\n },\n DataPortabilityPermissions: {\n addresses: {\n 14800: \"0xD54523048AdD05b4d734aFaE7C68324Ebb7373eF\",\n 1480: \"0xD54523048AdD05b4d734aFaE7C68324Ebb7373eF\",\n },\n },\n DataPortabilityServers: {\n addresses: {\n 14800: \"0x1483B1F634DBA75AeaE60da7f01A679aabd5ee2c\",\n 1480: \"0x1483B1F634DBA75AeaE60da7f01A679aabd5ee2c\",\n },\n },\n DataPortabilityGrantees: {\n addresses: {\n 14800: \"0x8325C0A0948483EdA023A1A2Fd895e62C5131234\",\n 1480: \"0x8325C0A0948483EdA023A1A2Fd895e62C5131234\",\n },\n },\n DataRegistry: {\n addresses: {\n 14800: \"0x8C8788f98385F6ba1adD4234e551ABba0f82Cb7C\",\n 1480: \"0x8C8788f98385F6ba1adD4234e551ABba0f82Cb7C\",\n },\n },\n\n // ========================================\n // COMPUTING INFRASTRUCTURE\n // ========================================\n ComputeEngine: {\n addresses: {\n 14800: \"0xb2BFe33FA420c45F1Cf1287542ad81ae935447bd\",\n 1480: \"0xb2BFe33FA420c45F1Cf1287542ad81ae935447bd\",\n },\n },\n ComputeEngineTreasury: {\n addresses: {\n 14800: \"0xceB33C501B624D984bD1Ed3298f6D1d8F7CE03d1\",\n 1480: \"0xceB33C501B624D984bD1Ed3298f6D1d8F7CE03d1\",\n },\n discovery: {\n parent: \"ComputeEngine\",\n getter: \"computeEngineTreasury\",\n },\n },\n QueryEngine: {\n addresses: {\n 14800: \"0xd25Eb66EA2452cf3238A2eC6C1FD1B7F5B320490\",\n 1480: \"0xd25Eb66EA2452cf3238A2eC6C1FD1B7F5B320490\",\n },\n },\n VanaTreasury: {\n addresses: {\n 14800: \"0x8B32Ef32f22e72cc25D53f6E858f57cAe7E198f9\",\n 1480: \"0x8B32Ef32f22e72cc25D53f6E858f57cAe7E198f9\",\n },\n discovery: {\n parent: \"QueryEngine\",\n getter: \"queryEngineTreasury\",\n },\n },\n DataRefinerRegistry: {\n addresses: {\n 14800: \"0x93c3EF89369fDcf08Be159D9DeF0F18AB6Be008c\",\n 1480: \"0x93c3EF89369fDcf08Be159D9DeF0F18AB6Be008c\",\n },\n },\n ComputeInstructionRegistry: {\n addresses: {\n 14800: \"0x5786B12b4c6Ba2bFAF0e77Ed30Bf6d32805563A5\",\n 1480: \"0x5786B12b4c6Ba2bFAF0e77Ed30Bf6d32805563A5\",\n },\n },\n\n // ========================================\n // TEE POOLS (Canonical Deployments)\n // ========================================\n TeePoolPhala: {\n addresses: {\n 14800: \"0xE8EC6BD73b23Ad40E6B9a6f4bD343FAc411bD99A\",\n 1480: \"0xE8EC6BD73b23Ad40E6B9a6f4bD343FAc411bD99A\",\n },\n },\n TeePoolEphemeralStandard: {\n addresses: {\n 14800: \"0xe124bae846D5ec157f75Bd9e68ca87C4d2AB835A\",\n 1480: \"0xe124bae846D5ec157f75Bd9e68ca87C4d2AB835A\",\n },\n },\n TeePoolPersistentStandard: {\n addresses: {\n 14800: \"0xe8bB8d0629651Cf33e0845d743976Dc1f0971d76\",\n 1480: \"0xe8bB8d0629651Cf33e0845d743976Dc1f0971d76\",\n },\n },\n TeePoolPersistentGpu: {\n addresses: {\n 14800: \"0x1c346Cd74f8551f8fa13f3F4b6b8dAE22338E6a9\",\n 1480: \"0x1c346Cd74f8551f8fa13f3F4b6b8dAE22338E6a9\",\n },\n },\n TeePoolDedicatedStandard: {\n addresses: {\n 14800: \"0xf024b7ac5E8417416f53B41ecfa58C8e9396687d\",\n 1480: \"0xf024b7ac5E8417416f53B41ecfa58C8e9396687d\",\n },\n },\n TeePoolDedicatedGpu: {\n addresses: {\n 14800: \"0xB1686FA9620bBf851714d1cB47b8a4Bf4664644E\",\n 1480: \"0xB1686FA9620bBf851714d1cB47b8a4Bf4664644E\",\n },\n },\n\n // ========================================\n // VANA EPOCH / DLP REGISTRY\n // ========================================\n // Note: DLP rewards-specific contracts (DLPPerformance, DLPRewardDeployer,\n // DLPRewardDeployerTreasury, DLPRewardSwap, SwapHelper) were removed in the\n // protocol unification cleanup. VanaEpoch, DLPRegistry, and DLPRegistryTreasury\n // are kept because they may be referenced beyond the rewards system.\n VanaEpoch: {\n addresses: {\n 14800: \"0x2063cFF0609D59bCCc196E20Eb58A8696a6b15A0\",\n 1480: \"0x2063cFF0609D59bCCc196E20Eb58A8696a6b15A0\",\n },\n },\n DLPRegistry: {\n addresses: {\n 14800: \"0x4D59880a924526d1dD33260552Ff4328b1E18a43\",\n 1480: \"0x4D59880a924526d1dD33260552Ff4328b1E18a43\",\n },\n },\n DLPRegistryTreasury: {\n addresses: {\n 14800: \"0xb12ce1d27bEeFe39b6F0110b1AB77C21Aa0c9F9a\",\n 1480: \"0xb12ce1d27bEeFe39b6F0110b1AB77C21Aa0c9F9a\",\n },\n discovery: {\n parent: \"DLPRegistry\",\n getter: \"treasury\",\n },\n },\n\n // ========================================\n // VANA POOL (STAKING)\n // ========================================\n VanaPoolStaking: {\n addresses: {\n 14800: \"0x641C18E2F286c86f96CE95C8ec1EB9fC0415Ca0e\",\n 1480: \"0x641C18E2F286c86f96CE95C8ec1EB9fC0415Ca0e\",\n },\n },\n VanaPoolTreasury: {\n addresses: {\n 14800: \"0x143BE72CF2541604A7691933CAccd6D9cC17c003\",\n 1480: \"0x143BE72CF2541604A7691933CAccd6D9cC17c003\",\n },\n discovery: {\n parent: \"VanaPoolStaking\",\n getter: \"vanaPoolTreasury\",\n },\n },\n VanaPoolEntity: {\n addresses: {\n 14800: \"0x44f20490A82e1f1F1cC25Dd3BA8647034eDdce30\",\n 1480: \"0x44f20490A82e1f1F1cC25Dd3BA8647034eDdce30\",\n },\n discovery: {\n parent: \"VanaPoolStaking\",\n getter: \"vanaPoolEntity\",\n },\n },\n\n // ========================================\n // DLP DEPLOYMENT & TOKEN SYSTEM\n // ========================================\n DATFactory: {\n addresses: {\n 14800: \"0x40f8bccF35a75ecef63BC3B1B3E06ffEB9220644\",\n 1480: \"0x40f8bccF35a75ecef63BC3B1B3E06ffEB9220644\",\n },\n },\n DAT: {\n addresses: {\n 14800: \"0xA706b93ccED89f13340673889e29F0a5cd84212d\",\n 1480: \"0xA706b93ccED89f13340673889e29F0a5cd84212d\",\n },\n },\n DATPausable: {\n addresses: {\n 14800: \"0xe69FE86f0B95cC2f8416Fe22815c85DC8887e76e\",\n 1480: \"0xe69FE86f0B95cC2f8416Fe22815c85DC8887e76e\",\n },\n },\n DATVotes: {\n addresses: {\n 14800: \"0xaE04c8A77E9B27869eb563720524A9aE0baf1831\",\n 1480: \"0xaE04c8A77E9B27869eb563720524A9aE0baf1831\",\n },\n },\n\n // ========================================\n // EXTERNAL DEPENDENCIES (DeFi)\n // ========================================\n WVANA: {\n addresses: {\n 14800: \"0xbccc4b4c6530F82FE309c5E845E50b5E9C89f2AD\",\n 1480: \"0x00EDdD9621Fb08436d0331c149D1690909a5906d\",\n },\n },\n UniswapV3NonfungiblePositionManager: {\n addresses: {\n 14800: \"0x48Bd633f4B9128a38Ebb4a48b6975EB3Eaf1931b\",\n 1480: \"0x45a2992e1bFdCF9b9AcE0a84A238f2E56F481816\",\n },\n },\n UniswapV3QuoterV2: {\n addresses: {\n 14800: \"0x3152246f3CD4dD465292Dd4Ffd792E2Cf602e332\",\n 1480: \"0x1b13728ea3C90863990aC0e05987CfeC1888908c\",\n },\n },\n\n // ========================================\n // UTILITY CONTRACTS\n // ========================================\n Multicall3: {\n addresses: {\n 14800: \"0xD8d2dFca27E8797fd779F8547166A2d3B29d360E\",\n 1480: \"0xD8d2dFca27E8797fd779F8547166A2d3B29d360E\",\n },\n },\n Multisend: {\n addresses: {\n 14800: \"0x8807e8BCDFbaA8c2761760f3FBA37F6f7F2C5b2d\",\n 1480: \"0x8807e8BCDFbaA8c2761760f3FBA37F6f7F2C5b2d\",\n },\n },\n} as const;\n\n// Legacy DLPRoot* and deprecated TeePool entries were removed in the protocol\n// unification cleanup. They were part of the old DLP rewards system superseded\n// by other contracts.\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwCO,MAAM,YAA4C;AAAA;AAAA;AAAA;AAAA,EAIvD,uBAAuB;AAAA,IACrB,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,aAAa;AAAA,IACX,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,4BAA4B;AAAA,IAC1B,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,wBAAwB;AAAA,IACtB,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,yBAAyB;AAAA,IACvB,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,cAAc;AAAA,IACZ,WAAW;AAAA,MACT,OAAO;AA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R;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,OAAO;AAAA,IACL,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,qCAAqC;AAAA,IACnC,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,mBAAmB;AAAA,IACjB,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,YAAY;AAAA,IACV,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,WAAW;AAAA,IACT,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AACF;","names":[]}
|
|
@@ -2,6 +2,18 @@ const CONTRACTS = {
|
|
|
2
2
|
// ========================================
|
|
3
3
|
// DATA PORTABILITY CONTRACTS
|
|
4
4
|
// ========================================
|
|
5
|
+
DataPortabilityEscrow: {
|
|
6
|
+
addresses: {
|
|
7
|
+
14800: "0x07d7769081adc3a3DBe91f5E4B98E9A5a6B292e3",
|
|
8
|
+
1480: "0x07d7769081adc3a3DBe91f5E4B98E9A5a6B292e3"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
FeeRegistry: {
|
|
12
|
+
addresses: {
|
|
13
|
+
14800: "0xb4FA18443E0FA6cdC0280D20b8cCDB2377D13Bf2",
|
|
14
|
+
1480: "0xb4FA18443E0FA6cdC0280D20b8cCDB2377D13Bf2"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
5
17
|
DataPortabilityPermissions: {
|
|
6
18
|
addresses: {
|
|
7
19
|
14800: "0xD54523048AdD05b4d734aFaE7C68324Ebb7373eF",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/config/contracts.config.ts"],"sourcesContent":["// SOURCE CONFIGURATION - Complete contract registry\n// Generated output: src/generated/addresses.ts\n\n/**\n * Complete contract configuration for the Vana protocol.\n *\n * ⚠️ THIS IS A SOURCE FILE - EDIT THIS TO ADD/UPDATE CONTRACTS\n *\n * @remarks\n * This file contains all contract addresses and discovery metadata in one place.\n *\n * **Contract Types:**\n * - Entry Points: Contracts without `discovery` field (must be known externally)\n * - Discoverable: Contracts with `discovery` field (auto-discovered from parent)\n *\n * **Build Process:**\n * 1. Edit this file to add/update contracts\n * 2. Run `npm run discover-addresses` to validate and generate complete registry\n * 3. Run `npm run fetch-abis` to fetch ABIs for all contracts\n *\n * @category Configuration\n * @internal This is a source file - apps should import from src/generated/addresses.ts\n */\n\ninterface DiscoveryMetadata {\n /** Parent contract to discover this from */\n parent: string;\n /** Getter function name on parent contract */\n getter: string;\n}\n\ninterface ContractConfig {\n addresses: {\n 14800: string;\n 1480: string;\n };\n /** If present, this contract can be auto-discovered from parent */\n discovery?: DiscoveryMetadata;\n}\n\nexport const CONTRACTS: Record<string, ContractConfig> = {\n // ========================================\n // DATA PORTABILITY CONTRACTS\n // ========================================\n DataPortabilityPermissions: {\n addresses: {\n 14800: \"0xD54523048AdD05b4d734aFaE7C68324Ebb7373eF\",\n 1480: \"0xD54523048AdD05b4d734aFaE7C68324Ebb7373eF\",\n },\n },\n DataPortabilityServers: {\n addresses: {\n 14800: \"0x1483B1F634DBA75AeaE60da7f01A679aabd5ee2c\",\n 1480: \"0x1483B1F634DBA75AeaE60da7f01A679aabd5ee2c\",\n },\n },\n DataPortabilityGrantees: {\n addresses: {\n 14800: \"0x8325C0A0948483EdA023A1A2Fd895e62C5131234\",\n 1480: \"0x8325C0A0948483EdA023A1A2Fd895e62C5131234\",\n },\n },\n DataRegistry: {\n addresses: {\n 14800: \"0x8C8788f98385F6ba1adD4234e551ABba0f82Cb7C\",\n 1480: \"0x8C8788f98385F6ba1adD4234e551ABba0f82Cb7C\",\n },\n },\n\n // ========================================\n // COMPUTING INFRASTRUCTURE\n // ========================================\n ComputeEngine: {\n addresses: {\n 14800: \"0xb2BFe33FA420c45F1Cf1287542ad81ae935447bd\",\n 1480: \"0xb2BFe33FA420c45F1Cf1287542ad81ae935447bd\",\n },\n },\n ComputeEngineTreasury: {\n addresses: {\n 14800: \"0xceB33C501B624D984bD1Ed3298f6D1d8F7CE03d1\",\n 1480: \"0xceB33C501B624D984bD1Ed3298f6D1d8F7CE03d1\",\n },\n discovery: {\n parent: \"ComputeEngine\",\n getter: \"computeEngineTreasury\",\n },\n },\n QueryEngine: {\n addresses: {\n 14800: \"0xd25Eb66EA2452cf3238A2eC6C1FD1B7F5B320490\",\n 1480: \"0xd25Eb66EA2452cf3238A2eC6C1FD1B7F5B320490\",\n },\n },\n VanaTreasury: {\n addresses: {\n 14800: \"0x8B32Ef32f22e72cc25D53f6E858f57cAe7E198f9\",\n 1480: \"0x8B32Ef32f22e72cc25D53f6E858f57cAe7E198f9\",\n },\n discovery: {\n parent: \"QueryEngine\",\n getter: \"queryEngineTreasury\",\n },\n },\n DataRefinerRegistry: {\n addresses: {\n 14800: \"0x93c3EF89369fDcf08Be159D9DeF0F18AB6Be008c\",\n 1480: \"0x93c3EF89369fDcf08Be159D9DeF0F18AB6Be008c\",\n },\n },\n ComputeInstructionRegistry: {\n addresses: {\n 14800: \"0x5786B12b4c6Ba2bFAF0e77Ed30Bf6d32805563A5\",\n 1480: \"0x5786B12b4c6Ba2bFAF0e77Ed30Bf6d32805563A5\",\n },\n },\n\n // ========================================\n // TEE POOLS (Canonical Deployments)\n // ========================================\n TeePoolPhala: {\n addresses: {\n 14800: \"0xE8EC6BD73b23Ad40E6B9a6f4bD343FAc411bD99A\",\n 1480: \"0xE8EC6BD73b23Ad40E6B9a6f4bD343FAc411bD99A\",\n },\n },\n TeePoolEphemeralStandard: {\n addresses: {\n 14800: \"0xe124bae846D5ec157f75Bd9e68ca87C4d2AB835A\",\n 1480: \"0xe124bae846D5ec157f75Bd9e68ca87C4d2AB835A\",\n },\n },\n TeePoolPersistentStandard: {\n addresses: {\n 14800: \"0xe8bB8d0629651Cf33e0845d743976Dc1f0971d76\",\n 1480: \"0xe8bB8d0629651Cf33e0845d743976Dc1f0971d76\",\n },\n },\n TeePoolPersistentGpu: {\n addresses: {\n 14800: \"0x1c346Cd74f8551f8fa13f3F4b6b8dAE22338E6a9\",\n 1480: \"0x1c346Cd74f8551f8fa13f3F4b6b8dAE22338E6a9\",\n },\n },\n TeePoolDedicatedStandard: {\n addresses: {\n 14800: \"0xf024b7ac5E8417416f53B41ecfa58C8e9396687d\",\n 1480: \"0xf024b7ac5E8417416f53B41ecfa58C8e9396687d\",\n },\n },\n TeePoolDedicatedGpu: {\n addresses: {\n 14800: \"0xB1686FA9620bBf851714d1cB47b8a4Bf4664644E\",\n 1480: \"0xB1686FA9620bBf851714d1cB47b8a4Bf4664644E\",\n },\n },\n\n // ========================================\n // VANA EPOCH / DLP REGISTRY\n // ========================================\n // Note: DLP rewards-specific contracts (DLPPerformance, DLPRewardDeployer,\n // DLPRewardDeployerTreasury, DLPRewardSwap, SwapHelper) were removed in the\n // protocol unification cleanup. VanaEpoch, DLPRegistry, and DLPRegistryTreasury\n // are kept because they may be referenced beyond the rewards system.\n VanaEpoch: {\n addresses: {\n 14800: \"0x2063cFF0609D59bCCc196E20Eb58A8696a6b15A0\",\n 1480: \"0x2063cFF0609D59bCCc196E20Eb58A8696a6b15A0\",\n },\n },\n DLPRegistry: {\n addresses: {\n 14800: \"0x4D59880a924526d1dD33260552Ff4328b1E18a43\",\n 1480: \"0x4D59880a924526d1dD33260552Ff4328b1E18a43\",\n },\n },\n DLPRegistryTreasury: {\n addresses: {\n 14800: \"0xb12ce1d27bEeFe39b6F0110b1AB77C21Aa0c9F9a\",\n 1480: \"0xb12ce1d27bEeFe39b6F0110b1AB77C21Aa0c9F9a\",\n },\n discovery: {\n parent: \"DLPRegistry\",\n getter: \"treasury\",\n },\n },\n\n // ========================================\n // VANA POOL (STAKING)\n // ========================================\n VanaPoolStaking: {\n addresses: {\n 14800: \"0x641C18E2F286c86f96CE95C8ec1EB9fC0415Ca0e\",\n 1480: \"0x641C18E2F286c86f96CE95C8ec1EB9fC0415Ca0e\",\n },\n },\n VanaPoolTreasury: {\n addresses: {\n 14800: \"0x143BE72CF2541604A7691933CAccd6D9cC17c003\",\n 1480: \"0x143BE72CF2541604A7691933CAccd6D9cC17c003\",\n },\n discovery: {\n parent: \"VanaPoolStaking\",\n getter: \"vanaPoolTreasury\",\n },\n },\n VanaPoolEntity: {\n addresses: {\n 14800: \"0x44f20490A82e1f1F1cC25Dd3BA8647034eDdce30\",\n 1480: \"0x44f20490A82e1f1F1cC25Dd3BA8647034eDdce30\",\n },\n discovery: {\n parent: \"VanaPoolStaking\",\n getter: \"vanaPoolEntity\",\n },\n },\n\n // ========================================\n // DLP DEPLOYMENT & TOKEN SYSTEM\n // ========================================\n DATFactory: {\n addresses: {\n 14800: \"0x40f8bccF35a75ecef63BC3B1B3E06ffEB9220644\",\n 1480: \"0x40f8bccF35a75ecef63BC3B1B3E06ffEB9220644\",\n },\n },\n DAT: {\n addresses: {\n 14800: \"0xA706b93ccED89f13340673889e29F0a5cd84212d\",\n 1480: \"0xA706b93ccED89f13340673889e29F0a5cd84212d\",\n },\n },\n DATPausable: {\n addresses: {\n 14800: \"0xe69FE86f0B95cC2f8416Fe22815c85DC8887e76e\",\n 1480: \"0xe69FE86f0B95cC2f8416Fe22815c85DC8887e76e\",\n },\n },\n DATVotes: {\n addresses: {\n 14800: \"0xaE04c8A77E9B27869eb563720524A9aE0baf1831\",\n 1480: \"0xaE04c8A77E9B27869eb563720524A9aE0baf1831\",\n },\n },\n\n // ========================================\n // EXTERNAL DEPENDENCIES (DeFi)\n // ========================================\n WVANA: {\n addresses: {\n 14800: \"0xbccc4b4c6530F82FE309c5E845E50b5E9C89f2AD\",\n 1480: \"0x00EDdD9621Fb08436d0331c149D1690909a5906d\",\n },\n },\n UniswapV3NonfungiblePositionManager: {\n addresses: {\n 14800: \"0x48Bd633f4B9128a38Ebb4a48b6975EB3Eaf1931b\",\n 1480: \"0x45a2992e1bFdCF9b9AcE0a84A238f2E56F481816\",\n },\n },\n UniswapV3QuoterV2: {\n addresses: {\n 14800: \"0x3152246f3CD4dD465292Dd4Ffd792E2Cf602e332\",\n 1480: \"0x1b13728ea3C90863990aC0e05987CfeC1888908c\",\n },\n },\n\n // ========================================\n // UTILITY CONTRACTS\n // ========================================\n Multicall3: {\n addresses: {\n 14800: \"0xD8d2dFca27E8797fd779F8547166A2d3B29d360E\",\n 1480: \"0xD8d2dFca27E8797fd779F8547166A2d3B29d360E\",\n },\n },\n Multisend: {\n addresses: {\n 14800: \"0x8807e8BCDFbaA8c2761760f3FBA37F6f7F2C5b2d\",\n 1480: \"0x8807e8BCDFbaA8c2761760f3FBA37F6f7F2C5b2d\",\n },\n },\n} as const;\n\n// Legacy DLPRoot* and deprecated TeePool entries were removed in the protocol\n// unification cleanup. They were part of the old DLP rewards system superseded\n// by other contracts.\n"],"mappings":"AAwCO,MAAM,YAA4C;AAAA;AAAA;AAAA;AAAA,EAIvD,4BAA4B;AAAA,IAC1B,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,wBAAwB;AAAA,IACtB,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,yBAAyB;AAAA,IACvB,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,cAAc;AAAA,IACZ,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,eAAe;AAAA,IACb,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,uBAAuB;AAAA,IACrB,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,IACA,WAAW;AAAA,MACT,QAAQ;AAAA,MACR,Q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,MACP,MAAM;AAAA,IACR;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,YAAY;AAAA,IACV,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,WAAW;AAAA,IACT,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/config/contracts.config.ts"],"sourcesContent":["// SOURCE CONFIGURATION - Complete contract registry\n// Generated output: src/generated/addresses.ts\n\n/**\n * Complete contract configuration for the Vana protocol.\n *\n * ⚠️ THIS IS A SOURCE FILE - EDIT THIS TO ADD/UPDATE CONTRACTS\n *\n * @remarks\n * This file contains all contract addresses and discovery metadata in one place.\n *\n * **Contract Types:**\n * - Entry Points: Contracts without `discovery` field (must be known externally)\n * - Discoverable: Contracts with `discovery` field (auto-discovered from parent)\n *\n * **Build Process:**\n * 1. Edit this file to add/update contracts\n * 2. Run `npm run discover-addresses` to validate and generate complete registry\n * 3. Run `npm run fetch-abis` to fetch ABIs for all contracts\n *\n * @category Configuration\n * @internal This is a source file - apps should import from src/generated/addresses.ts\n */\n\ninterface DiscoveryMetadata {\n /** Parent contract to discover this from */\n parent: string;\n /** Getter function name on parent contract */\n getter: string;\n}\n\ninterface ContractConfig {\n addresses: {\n 14800: string;\n 1480: string;\n };\n /** If present, this contract can be auto-discovered from parent */\n discovery?: DiscoveryMetadata;\n}\n\nexport const CONTRACTS: Record<string, ContractConfig> = {\n // ========================================\n // DATA PORTABILITY CONTRACTS\n // ========================================\n DataPortabilityEscrow: {\n addresses: {\n 14800: \"0x07d7769081adc3a3DBe91f5E4B98E9A5a6B292e3\",\n 1480: \"0x07d7769081adc3a3DBe91f5E4B98E9A5a6B292e3\",\n },\n },\n FeeRegistry: {\n addresses: {\n 14800: \"0xb4FA18443E0FA6cdC0280D20b8cCDB2377D13Bf2\",\n 1480: \"0xb4FA18443E0FA6cdC0280D20b8cCDB2377D13Bf2\",\n },\n },\n DataPortabilityPermissions: {\n addresses: {\n 14800: \"0xD54523048AdD05b4d734aFaE7C68324Ebb7373eF\",\n 1480: \"0xD54523048AdD05b4d734aFaE7C68324Ebb7373eF\",\n },\n },\n DataPortabilityServers: {\n addresses: {\n 14800: \"0x1483B1F634DBA75AeaE60da7f01A679aabd5ee2c\",\n 1480: \"0x1483B1F634DBA75AeaE60da7f01A679aabd5ee2c\",\n },\n },\n DataPortabilityGrantees: {\n addresses: {\n 14800: \"0x8325C0A0948483EdA023A1A2Fd895e62C5131234\",\n 1480: \"0x8325C0A0948483EdA023A1A2Fd895e62C5131234\",\n },\n },\n DataRegistry: {\n addresses: {\n 14800: \"0x8C8788f98385F6ba1adD4234e551ABba0f82Cb7C\",\n 1480: \"0x8C8788f98385F6ba1adD4234e551ABba0f82Cb7C\",\n },\n },\n\n // ========================================\n // COMPUTING INFRASTRUCTURE\n // ========================================\n ComputeEngine: {\n addresses: {\n 14800: \"0xb2BFe33FA420c45F1Cf1287542ad81ae935447bd\",\n 1480: \"0xb2BFe33FA420c45F1Cf1287542ad81ae935447bd\",\n },\n },\n ComputeEngineTreasury: {\n addresses: {\n 14800: \"0xceB33C501B624D984bD1Ed3298f6D1d8F7CE03d1\",\n 1480: \"0xceB33C501B624D984bD1Ed3298f6D1d8F7CE03d1\",\n },\n discovery: {\n parent: \"ComputeEngine\",\n getter: \"computeEngineTreasury\",\n },\n },\n QueryEngine: {\n addresses: {\n 14800: \"0xd25Eb66EA2452cf3238A2eC6C1FD1B7F5B320490\",\n 1480: \"0xd25Eb66EA2452cf3238A2eC6C1FD1B7F5B320490\",\n },\n },\n VanaTreasury: {\n addresses: {\n 14800: \"0x8B32Ef32f22e72cc25D53f6E858f57cAe7E198f9\",\n 1480: \"0x8B32Ef32f22e72cc25D53f6E858f57cAe7E198f9\",\n },\n discovery: {\n parent: \"QueryEngine\",\n getter: \"queryEngineTreasury\",\n },\n },\n DataRefinerRegistry: {\n addresses: {\n 14800: \"0x93c3EF89369fDcf08Be159D9DeF0F18AB6Be008c\",\n 1480: \"0x93c3EF89369fDcf08Be159D9DeF0F18AB6Be008c\",\n },\n },\n ComputeInstructionRegistry: {\n addresses: {\n 14800: \"0x5786B12b4c6Ba2bFAF0e77Ed30Bf6d32805563A5\",\n 1480: \"0x5786B12b4c6Ba2bFAF0e77Ed30Bf6d32805563A5\",\n },\n },\n\n // ========================================\n // TEE POOLS (Canonical Deployments)\n // ========================================\n TeePoolPhala: {\n addresses: {\n 14800: \"0xE8EC6BD73b23Ad40E6B9a6f4bD343FAc411bD99A\",\n 1480: \"0xE8EC6BD73b23Ad40E6B9a6f4bD343FAc411bD99A\",\n },\n },\n TeePoolEphemeralStandard: {\n addresses: {\n 14800: \"0xe124bae846D5ec157f75Bd9e68ca87C4d2AB835A\",\n 1480: \"0xe124bae846D5ec157f75Bd9e68ca87C4d2AB835A\",\n },\n },\n TeePoolPersistentStandard: {\n addresses: {\n 14800: \"0xe8bB8d0629651Cf33e0845d743976Dc1f0971d76\",\n 1480: \"0xe8bB8d0629651Cf33e0845d743976Dc1f0971d76\",\n },\n },\n TeePoolPersistentGpu: {\n addresses: {\n 14800: \"0x1c346Cd74f8551f8fa13f3F4b6b8dAE22338E6a9\",\n 1480: \"0x1c346Cd74f8551f8fa13f3F4b6b8dAE22338E6a9\",\n },\n },\n TeePoolDedicatedStandard: {\n addresses: {\n 14800: \"0xf024b7ac5E8417416f53B41ecfa58C8e9396687d\",\n 1480: \"0xf024b7ac5E8417416f53B41ecfa58C8e9396687d\",\n },\n },\n TeePoolDedicatedGpu: {\n addresses: {\n 14800: \"0xB1686FA9620bBf851714d1cB47b8a4Bf4664644E\",\n 1480: \"0xB1686FA9620bBf851714d1cB47b8a4Bf4664644E\",\n },\n },\n\n // ========================================\n // VANA EPOCH / DLP REGISTRY\n // ========================================\n // Note: DLP rewards-specific contracts (DLPPerformance, DLPRewardDeployer,\n // DLPRewardDeployerTreasury, DLPRewardSwap, SwapHelper) were removed in the\n // protocol unification cleanup. VanaEpoch, DLPRegistry, and DLPRegistryTreasury\n // are kept because they may be referenced beyond the rewards system.\n VanaEpoch: {\n addresses: {\n 14800: \"0x2063cFF0609D59bCCc196E20Eb58A8696a6b15A0\",\n 1480: \"0x2063cFF0609D59bCCc196E20Eb58A8696a6b15A0\",\n },\n },\n DLPRegistry: {\n addresses: {\n 14800: \"0x4D59880a924526d1dD33260552Ff4328b1E18a43\",\n 1480: \"0x4D59880a924526d1dD33260552Ff4328b1E18a43\",\n },\n },\n DLPRegistryTreasury: {\n addresses: {\n 14800: \"0xb12ce1d27bEeFe39b6F0110b1AB77C21Aa0c9F9a\",\n 1480: \"0xb12ce1d27bEeFe39b6F0110b1AB77C21Aa0c9F9a\",\n },\n discovery: {\n parent: \"DLPRegistry\",\n getter: \"treasury\",\n },\n },\n\n // ========================================\n // VANA POOL (STAKING)\n // ========================================\n VanaPoolStaking: {\n addresses: {\n 14800: \"0x641C18E2F286c86f96CE95C8ec1EB9fC0415Ca0e\",\n 1480: \"0x641C18E2F286c86f96CE95C8ec1EB9fC0415Ca0e\",\n },\n },\n VanaPoolTreasury: {\n addresses: {\n 14800: \"0x143BE72CF2541604A7691933CAccd6D9cC17c003\",\n 1480: \"0x143BE72CF2541604A7691933CAccd6D9cC17c003\",\n },\n discovery: {\n parent: \"VanaPoolStaking\",\n getter: \"vanaPoolTreasury\",\n },\n },\n VanaPoolEntity: {\n addresses: {\n 14800: \"0x44f20490A82e1f1F1cC25Dd3BA8647034eDdce30\",\n 1480: \"0x44f20490A82e1f1F1cC25Dd3BA8647034eDdce30\",\n },\n discovery: {\n parent: \"VanaPoolStaking\",\n getter: \"vanaPoolEntity\",\n },\n },\n\n // ========================================\n // DLP DEPLOYMENT & TOKEN SYSTEM\n // ========================================\n DATFactory: {\n addresses: {\n 14800: \"0x40f8bccF35a75ecef63BC3B1B3E06ffEB9220644\",\n 1480: \"0x40f8bccF35a75ecef63BC3B1B3E06ffEB9220644\",\n },\n },\n DAT: {\n addresses: {\n 14800: \"0xA706b93ccED89f13340673889e29F0a5cd84212d\",\n 1480: \"0xA706b93ccED89f13340673889e29F0a5cd84212d\",\n },\n },\n DATPausable: {\n addresses: {\n 14800: \"0xe69FE86f0B95cC2f8416Fe22815c85DC8887e76e\",\n 1480: \"0xe69FE86f0B95cC2f8416Fe22815c85DC8887e76e\",\n },\n },\n DATVotes: {\n addresses: {\n 14800: \"0xaE04c8A77E9B27869eb563720524A9aE0baf1831\",\n 1480: \"0xaE04c8A77E9B27869eb563720524A9aE0baf1831\",\n },\n },\n\n // ========================================\n // EXTERNAL DEPENDENCIES (DeFi)\n // ========================================\n WVANA: {\n addresses: {\n 14800: \"0xbccc4b4c6530F82FE309c5E845E50b5E9C89f2AD\",\n 1480: \"0x00EDdD9621Fb08436d0331c149D1690909a5906d\",\n },\n },\n UniswapV3NonfungiblePositionManager: {\n addresses: {\n 14800: \"0x48Bd633f4B9128a38Ebb4a48b6975EB3Eaf1931b\",\n 1480: \"0x45a2992e1bFdCF9b9AcE0a84A238f2E56F481816\",\n },\n },\n UniswapV3QuoterV2: {\n addresses: {\n 14800: \"0x3152246f3CD4dD465292Dd4Ffd792E2Cf602e332\",\n 1480: \"0x1b13728ea3C90863990aC0e05987CfeC1888908c\",\n },\n },\n\n // ========================================\n // UTILITY CONTRACTS\n // ========================================\n Multicall3: {\n addresses: {\n 14800: \"0xD8d2dFca27E8797fd779F8547166A2d3B29d360E\",\n 1480: \"0xD8d2dFca27E8797fd779F8547166A2d3B29d360E\",\n },\n },\n Multisend: {\n addresses: {\n 14800: \"0x8807e8BCDFbaA8c2761760f3FBA37F6f7F2C5b2d\",\n 1480: \"0x8807e8BCDFbaA8c2761760f3FBA37F6f7F2C5b2d\",\n },\n },\n} as const;\n\n// Legacy DLPRoot* and deprecated TeePool entries were removed in the protocol\n// unification cleanup. They were part of the old DLP rewards system superseded\n// by other contracts.\n"],"mappings":"AAwCO,MAAM,YAA4C;AAAA;AAAA;AAAA;AAA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A,EACA,gBAAgB;AAAA,IACd,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,IACA,WAAW;AAAA,MACT,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,YAAY;AAAA,IACV,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,aAAa;AAAA,IACX,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,UAAU;AAAA,IACR,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,OAAO;AAAA,IACL,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,qCAAqC;AAAA,IACnC,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,mBAAmB;AAAA,IACjB,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,YAAY;AAAA,IACV,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,WAAW;AAAA,IACT,WAAW;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AACF;","names":[]}
|
|
@@ -92,7 +92,16 @@ class ContractFactory {
|
|
|
92
92
|
getAvailableContracts() {
|
|
93
93
|
const chainAddresses = import_addresses.CONTRACT_ADDRESSES[this.chainId];
|
|
94
94
|
if (!chainAddresses) return [];
|
|
95
|
-
return Object.keys(chainAddresses)
|
|
95
|
+
return Object.keys(chainAddresses).filter(
|
|
96
|
+
(contract) => {
|
|
97
|
+
try {
|
|
98
|
+
(0, import_abi.getAbi)(contract);
|
|
99
|
+
return true;
|
|
100
|
+
} catch {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
);
|
|
96
105
|
}
|
|
97
106
|
}
|
|
98
107
|
function clearContractCache(contract, chainId) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/contracts/contractController.ts"],"sourcesContent":["/**\n * Provides type-safe contract interaction utilities for the Vana protocol.\n *\n * @remarks\n * This module enables strongly-typed smart contract interactions with automatic\n * ABI loading, address resolution, and instance caching. It follows viem's patterns\n * for contract typing while providing Vana-specific conveniences.\n *\n * @category Contracts\n * @module contractController\n */\n\nimport type { Abi } from \"abitype\";\nimport {\n getContract,\n type GetContractReturnType,\n type PublicClient,\n type WalletClient,\n} from \"viem\";\nimport { type ContractAbis, getAbi, type VanaContract } from \"../generated/abi\";\nimport type { VanaChainId, ContractInfo } from \"../types/index\";\nimport { getContractAddress, CONTRACT_ADDRESSES } from \"../generated/addresses\";\nimport { createClient } from \"../core/client\";\nimport { vanaMainnet } from \"../config/chains\";\n\n// Cache for contract instances - keyed by contract name and chain ID\nconst contractCache = new Map<string, GetContractReturnType<Abi>>();\n\n// Export cache for testing\nexport const contractCacheForTesting = contractCache;\n\n/**\n * Creates a cache key for contract instances.\n *\n * @remarks\n * Generates unique keys for caching contract instances per chain to prevent\n * cross-chain contamination and improve performance.\n *\n * @param contract - The contract name to create a cache key for\n * @param chainId - The chain ID to include in the cache key\n * @returns A string cache key combining contract name and chain ID\n *\n * @internal\n */\nfunction createCacheKey(contract: VanaContract, chainId: number): string {\n return `${contract}:${chainId}`;\n}\n\n/**\n * Gets a typed contract instance for the specified contract name.\n *\n * @remarks\n * Provides complete type safety following viem's patterns with automatic\n * ABI loading and address resolution. Contract instances are cached per\n * chain for performance. Use const assertion for full type inference.\n *\n * @param contract - Name of the contract to instantiate.\n * Use const assertion for full typing: `\"DataRegistry\" as const`\n * @param client - Optional viem client instance.\n * Defaults to auto-configured client. Obtain via `createClient()` or viem.\n * @returns A fully typed contract instance with methods corresponding to the contract's ABI\n *\n * @example\n * ```typescript\n * // Full type inference with const assertion\n * const dataRegistry = getContractController(\"DataRegistry\" as const, client);\n *\n * // Now dataRegistry has full type inference for all methods\n * const result = await dataRegistry.read.getFileCount(); // Type: bigint\n * await dataRegistry.write.addFile([url, proof]); // Typed parameters\n *\n * // Auto-configured client\n * const permissions = getContractController(\"DataPortabilityPermissions\" as const);\n * const granted = await permissions.read.hasPermission([grantor, grantee]);\n * ```\n *\n * @category Contracts\n */\nexport function getContractController<T extends VanaContract>(\n contract: T,\n client:\n | PublicClient\n | WalletClient\n | ReturnType<typeof createClient> = createClient(),\n): GetContractReturnType<ContractAbis[T]> {\n const chainId = client.chain?.id ?? vanaMainnet.id;\n const cacheKey = createCacheKey(contract, chainId);\n\n let controller = contractCache.get(cacheKey);\n\n if (!controller) {\n controller = getContract({\n address: getContractAddress(chainId, contract),\n abi: getAbi(contract),\n client,\n }) as GetContractReturnType<ContractAbis[T]>;\n\n contractCache.set(cacheKey, controller);\n }\n\n return controller as GetContractReturnType<ContractAbis[T]>;\n}\n\n/**\n * Gets contract information without creating a contract instance.\n *\n * @remarks\n * Returns contract address and ABI for manual contract interaction or\n * custom client configuration. Useful when you need contract details\n * but don't want to create a client connection.\n *\n * @param contract - Name of the contract.\n * Use const assertion for typed ABI.\n * @param chainId - Chain ID to get contract info for.\n * Defaults to Vana mainnet (1480).\n * @returns Contract information with typed ABI\n *\n * @example\n * ```typescript\n * const info = getContractInfo(\"DataRegistry\" as const, 14800);\n * console.log(info.address); // Typed as Address\n * console.log(info.abi); // Fully typed ABI\n *\n * // Use with custom viem client\n * const contract = getContract({\n * ...info,\n * client: customClient\n * });\n * ```\n *\n * @category Contracts\n */\nexport function getContractInfo<T extends VanaContract>(\n contract: T,\n chainId: VanaChainId = vanaMainnet.id as VanaChainId,\n): ContractInfo<ContractAbis[T]> {\n return {\n address: getContractAddress(chainId, contract),\n abi: getAbi(contract),\n };\n}\n\n/**\n * Provides type-safe contract factory for creating multiple contract instances.\n *\n * @remarks\n * Alternative API for applications that need to create multiple contracts\n * with the same client. The factory pattern reduces boilerplate and ensures\n * consistent client configuration across contracts.\n *\n * @example\n * ```typescript\n * const factory = new ContractFactory(client);\n *\n * const dataRegistry = factory.create(\"DataRegistry\" as const);\n * const permissions = factory.create(\"DataPortabilityPermissions\" as const);\n *\n * // List available contracts\n * const contracts = factory.getAvailableContracts();\n * ```\n *\n * @category Contracts\n */\nexport class ContractFactory {\n private readonly client:\n | PublicClient\n | WalletClient\n | ReturnType<typeof createClient>;\n private readonly chainId: number;\n\n constructor(\n client: PublicClient | WalletClient | ReturnType<typeof createClient>,\n ) {\n this.client = client;\n try {\n this.chainId = client.chain?.id ?? vanaMainnet.id;\n } catch {\n this.chainId = vanaMainnet.id;\n }\n }\n\n /**\n * Creates a typed contract instance\n *\n * @param contract - Contract name (use const assertion for full typing)\n * @returns Fully typed contract instance\n */\n create<T extends VanaContract>(\n contract: T,\n ): GetContractReturnType<ContractAbis[T]> {\n return getContractController(contract, this.client);\n }\n\n /**\n * Gets contract information without creating an instance\n *\n * @param contract - Contract name\n * @returns Contract information with typed ABI\n */\n getInfo<T extends VanaContract>(contract: T): ContractInfo<ContractAbis[T]> {\n return getContractInfo(contract, this.chainId as VanaChainId);\n }\n\n /**\n * Lists all available contracts for the current chain\n *\n * @returns Array of contract names available on this chain\n */\n getAvailableContracts(): VanaContract[] {\n // Return all contract names that have addresses on this chain\n const chainAddresses = CONTRACT_ADDRESSES[this.chainId];\n if (!chainAddresses) return [];\n\n return Object.keys(chainAddresses) as VanaContract[];\n }\n}\n\n/**\n * Clears the contract cache. Useful for testing or when chain configurations change.\n *\n * @param contract - Optional specific contract to clear, or clear all if not provided\n * @param chainId - Optional specific chain to clear, or clear all if not provided\n */\nexport function clearContractCache(\n contract?: VanaContract,\n chainId?: number,\n): void {\n if (contract && chainId) {\n const cacheKey = createCacheKey(contract, chainId);\n contractCache.delete(cacheKey);\n } else if (contract) {\n // Clear all instances of this contract across all chains\n for (const key of contractCache.keys()) {\n if (key.startsWith(`${contract}:`)) {\n contractCache.delete(key);\n }\n }\n } else if (chainId) {\n // Clear all contracts for this chain\n for (const key of contractCache.keys()) {\n if (key.endsWith(`:${chainId}`)) {\n contractCache.delete(key);\n }\n }\n } else {\n // Clear entire cache\n contractCache.clear();\n }\n}\n\n// Function is already exported above, no need for redundant export\n\n// Type-only exports for enhanced type safety\nexport type { GetContractReturnType } from \"viem\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaA,kBAKO;AACP,iBAA6D;AAE7D,uBAAuD;AACvD,oBAA6B;AAC7B,oBAA4B;AAG5B,MAAM,gBAAgB,oBAAI,IAAwC;AAG3D,MAAM,0BAA0B;AAevC,SAAS,eAAe,UAAwB,SAAyB;AACvE,SAAO,GAAG,QAAQ,IAAI,OAAO;AAC/B;AAgCO,SAAS,sBACd,UACA,aAGsC,4BAAa,GACX;AACxC,QAAM,UAAU,OAAO,OAAO,MAAM,0BAAY;AAChD,QAAM,WAAW,eAAe,UAAU,OAAO;AAEjD,MAAI,aAAa,cAAc,IAAI,QAAQ;AAE3C,MAAI,CAAC,YAAY;AACf,qBAAa,yBAAY;AAAA,MACvB,aAAS,qCAAmB,SAAS,QAAQ;AAAA,MAC7C,SAAK,mBAAO,QAAQ;AAAA,MACpB;AAAA,IACF,CAAC;AAED,kBAAc,IAAI,UAAU,UAAU;AAAA,EACxC;AAEA,SAAO;AACT;AA+BO,SAAS,gBACd,UACA,UAAuB,0BAAY,IACJ;AAC/B,SAAO;AAAA,IACL,aAAS,qCAAmB,SAAS,QAAQ;AAAA,IAC7C,SAAK,mBAAO,QAAQ;AAAA,EACtB;AACF;AAuBO,MAAM,gBAAgB;AAAA,EACV;AAAA,EAIA;AAAA,EAEjB,YACE,QACA;AACA,SAAK,SAAS;AACd,QAAI;AACF,WAAK,UAAU,OAAO,OAAO,MAAM,0BAAY;AAAA,IACjD,QAAQ;AACN,WAAK,UAAU,0BAAY;AAAA,IAC7B;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,OACE,UACwC;AACxC,WAAO,sBAAsB,UAAU,KAAK,MAAM;AAAA,EACpD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,QAAgC,UAA4C;AAC1E,WAAO,gBAAgB,UAAU,KAAK,OAAsB;AAAA,EAC9D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,wBAAwC;AAEtC,UAAM,iBAAiB,oCAAmB,KAAK,OAAO;AACtD,QAAI,CAAC,eAAgB,QAAO,CAAC;AAE7B,WAAO,OAAO,KAAK,cAAc;AAAA,EACnC;AACF;AAQO,SAAS,mBACd,UACA,SACM;AACN,MAAI,YAAY,SAAS;AACvB,UAAM,WAAW,eAAe,UAAU,OAAO;AACjD,kBAAc,OAAO,QAAQ;AAAA,EAC/B,WAAW,UAAU;AAEnB,eAAW,OAAO,cAAc,KAAK,GAAG;AACtC,UAAI,IAAI,WAAW,GAAG,QAAQ,GAAG,GAAG;AAClC,sBAAc,OAAO,GAAG;AAAA,MAC1B;AAAA,IACF;AAAA,EACF,WAAW,SAAS;AAElB,eAAW,OAAO,cAAc,KAAK,GAAG;AACtC,UAAI,IAAI,SAAS,IAAI,OAAO,EAAE,GAAG;AAC/B,sBAAc,OAAO,GAAG;AAAA,MAC1B;AAAA,IACF;AAAA,EACF,OAAO;AAEL,kBAAc,MAAM;AAAA,EACtB;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/contracts/contractController.ts"],"sourcesContent":["/**\n * Provides type-safe contract interaction utilities for the Vana protocol.\n *\n * @remarks\n * This module enables strongly-typed smart contract interactions with automatic\n * ABI loading, address resolution, and instance caching. It follows viem's patterns\n * for contract typing while providing Vana-specific conveniences.\n *\n * @category Contracts\n * @module contractController\n */\n\nimport type { Abi } from \"abitype\";\nimport {\n getContract,\n type GetContractReturnType,\n type PublicClient,\n type WalletClient,\n} from \"viem\";\nimport { type ContractAbis, getAbi, type VanaContract } from \"../generated/abi\";\nimport type { VanaChainId, ContractInfo } from \"../types/index\";\nimport {\n getContractAddress,\n CONTRACT_ADDRESSES,\n type VanaContractAddress,\n} from \"../generated/addresses\";\nimport { createClient } from \"../core/client\";\nimport { vanaMainnet } from \"../config/chains\";\n\ntype AddressedVanaContract = Extract<VanaContract, VanaContractAddress>;\n\n// Cache for contract instances - keyed by contract name and chain ID\nconst contractCache = new Map<string, GetContractReturnType<Abi>>();\n\n// Export cache for testing\nexport const contractCacheForTesting = contractCache;\n\n/**\n * Creates a cache key for contract instances.\n *\n * @remarks\n * Generates unique keys for caching contract instances per chain to prevent\n * cross-chain contamination and improve performance.\n *\n * @param contract - The contract name to create a cache key for\n * @param chainId - The chain ID to include in the cache key\n * @returns A string cache key combining contract name and chain ID\n *\n * @internal\n */\nfunction createCacheKey(\n contract: AddressedVanaContract,\n chainId: number,\n): string {\n return `${contract}:${chainId}`;\n}\n\n/**\n * Gets a typed contract instance for the specified contract name.\n *\n * @remarks\n * Provides complete type safety following viem's patterns with automatic\n * ABI loading and address resolution. Contract instances are cached per\n * chain for performance. Use const assertion for full type inference.\n *\n * @param contract - Name of the contract to instantiate.\n * Use const assertion for full typing: `\"DataRegistry\" as const`\n * @param client - Optional viem client instance.\n * Defaults to auto-configured client. Obtain via `createClient()` or viem.\n * @returns A fully typed contract instance with methods corresponding to the contract's ABI\n *\n * @example\n * ```typescript\n * // Full type inference with const assertion\n * const dataRegistry = getContractController(\"DataRegistry\" as const, client);\n *\n * // Now dataRegistry has full type inference for all methods\n * const result = await dataRegistry.read.getFileCount(); // Type: bigint\n * await dataRegistry.write.addFile([url, proof]); // Typed parameters\n *\n * // Auto-configured client\n * const permissions = getContractController(\"DataPortabilityPermissions\" as const);\n * const granted = await permissions.read.hasPermission([grantor, grantee]);\n * ```\n *\n * @category Contracts\n */\nexport function getContractController<T extends AddressedVanaContract>(\n contract: T,\n client:\n | PublicClient\n | WalletClient\n | ReturnType<typeof createClient> = createClient(),\n): GetContractReturnType<ContractAbis[T]> {\n const chainId = client.chain?.id ?? vanaMainnet.id;\n const cacheKey = createCacheKey(contract, chainId);\n\n let controller = contractCache.get(cacheKey);\n\n if (!controller) {\n controller = getContract({\n address: getContractAddress(chainId, contract),\n abi: getAbi(contract),\n client,\n }) as GetContractReturnType<ContractAbis[T]>;\n\n contractCache.set(cacheKey, controller);\n }\n\n return controller as GetContractReturnType<ContractAbis[T]>;\n}\n\n/**\n * Gets contract information without creating a contract instance.\n *\n * @remarks\n * Returns contract address and ABI for manual contract interaction or\n * custom client configuration. Useful when you need contract details\n * but don't want to create a client connection.\n *\n * @param contract - Name of the contract.\n * Use const assertion for typed ABI.\n * @param chainId - Chain ID to get contract info for.\n * Defaults to Vana mainnet (1480).\n * @returns Contract information with typed ABI\n *\n * @example\n * ```typescript\n * const info = getContractInfo(\"DataRegistry\" as const, 14800);\n * console.log(info.address); // Typed as Address\n * console.log(info.abi); // Fully typed ABI\n *\n * // Use with custom viem client\n * const contract = getContract({\n * ...info,\n * client: customClient\n * });\n * ```\n *\n * @category Contracts\n */\nexport function getContractInfo<T extends AddressedVanaContract>(\n contract: T,\n chainId: VanaChainId = vanaMainnet.id as VanaChainId,\n): ContractInfo<ContractAbis[T]> {\n return {\n address: getContractAddress(chainId, contract),\n abi: getAbi(contract),\n };\n}\n\n/**\n * Provides type-safe contract factory for creating multiple contract instances.\n *\n * @remarks\n * Alternative API for applications that need to create multiple contracts\n * with the same client. The factory pattern reduces boilerplate and ensures\n * consistent client configuration across contracts.\n *\n * @example\n * ```typescript\n * const factory = new ContractFactory(client);\n *\n * const dataRegistry = factory.create(\"DataRegistry\" as const);\n * const permissions = factory.create(\"DataPortabilityPermissions\" as const);\n *\n * // List available contracts\n * const contracts = factory.getAvailableContracts();\n * ```\n *\n * @category Contracts\n */\nexport class ContractFactory {\n private readonly client:\n | PublicClient\n | WalletClient\n | ReturnType<typeof createClient>;\n private readonly chainId: number;\n\n constructor(\n client: PublicClient | WalletClient | ReturnType<typeof createClient>,\n ) {\n this.client = client;\n try {\n this.chainId = client.chain?.id ?? vanaMainnet.id;\n } catch {\n this.chainId = vanaMainnet.id;\n }\n }\n\n /**\n * Creates a typed contract instance\n *\n * @param contract - Contract name (use const assertion for full typing)\n * @returns Fully typed contract instance\n */\n create<T extends AddressedVanaContract>(\n contract: T,\n ): GetContractReturnType<ContractAbis[T]> {\n return getContractController(contract, this.client);\n }\n\n /**\n * Gets contract information without creating an instance\n *\n * @param contract - Contract name\n * @returns Contract information with typed ABI\n */\n getInfo<T extends AddressedVanaContract>(\n contract: T,\n ): ContractInfo<ContractAbis[T]> {\n return getContractInfo(contract, this.chainId as VanaChainId);\n }\n\n /**\n * Lists all available contracts for the current chain\n *\n * @returns Array of contract names available on this chain\n */\n getAvailableContracts(): AddressedVanaContract[] {\n // Return contract names that have both an address and an ABI on this chain.\n const chainAddresses = CONTRACT_ADDRESSES[this.chainId];\n if (!chainAddresses) return [];\n\n return Object.keys(chainAddresses).filter(\n (contract): contract is AddressedVanaContract => {\n try {\n getAbi(contract as VanaContract);\n return true;\n } catch {\n return false;\n }\n },\n );\n }\n}\n\n/**\n * Clears the contract cache. Useful for testing or when chain configurations change.\n *\n * @param contract - Optional specific contract to clear, or clear all if not provided\n * @param chainId - Optional specific chain to clear, or clear all if not provided\n */\nexport function clearContractCache(\n contract?: AddressedVanaContract,\n chainId?: number,\n): void {\n if (contract && chainId) {\n const cacheKey = createCacheKey(contract, chainId);\n contractCache.delete(cacheKey);\n } else if (contract) {\n // Clear all instances of this contract across all chains\n for (const key of contractCache.keys()) {\n if (key.startsWith(`${contract}:`)) {\n contractCache.delete(key);\n }\n }\n } else if (chainId) {\n // Clear all contracts for this chain\n for (const key of contractCache.keys()) {\n if (key.endsWith(`:${chainId}`)) {\n contractCache.delete(key);\n }\n }\n } else {\n // Clear entire cache\n contractCache.clear();\n }\n}\n\n// Function is already exported above, no need for redundant export\n\n// Type-only exports for enhanced type safety\nexport type { GetContractReturnType } from \"viem\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaA,kBAKO;AACP,iBAA6D;AAE7D,uBAIO;AACP,oBAA6B;AAC7B,oBAA4B;AAK5B,MAAM,gBAAgB,oBAAI,IAAwC;AAG3D,MAAM,0BAA0B;AAevC,SAAS,eACP,UACA,SACQ;AACR,SAAO,GAAG,QAAQ,IAAI,OAAO;AAC/B;AAgCO,SAAS,sBACd,UACA,aAGsC,4BAAa,GACX;AACxC,QAAM,UAAU,OAAO,OAAO,MAAM,0BAAY;AAChD,QAAM,WAAW,eAAe,UAAU,OAAO;AAEjD,MAAI,aAAa,cAAc,IAAI,QAAQ;AAE3C,MAAI,CAAC,YAAY;AACf,qBAAa,yBAAY;AAAA,MACvB,aAAS,qCAAmB,SAAS,QAAQ;AAAA,MAC7C,SAAK,mBAAO,QAAQ;AAAA,MACpB;AAAA,IACF,CAAC;AAED,kBAAc,IAAI,UAAU,UAAU;AAAA,EACxC;AAEA,SAAO;AACT;AA+BO,SAAS,gBACd,UACA,UAAuB,0BAAY,IACJ;AAC/B,SAAO;AAAA,IACL,aAAS,qCAAmB,SAAS,QAAQ;AAAA,IAC7C,SAAK,mBAAO,QAAQ;AAAA,EACtB;AACF;AAuBO,MAAM,gBAAgB;AAAA,EACV;AAAA,EAIA;AAAA,EAEjB,YACE,QACA;AACA,SAAK,SAAS;AACd,QAAI;AACF,WAAK,UAAU,OAAO,OAAO,MAAM,0BAAY;AAAA,IACjD,QAAQ;AACN,WAAK,UAAU,0BAAY;AAAA,IAC7B;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,OACE,UACwC;AACxC,WAAO,sBAAsB,UAAU,KAAK,MAAM;AAAA,EACpD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,QACE,UAC+B;AAC/B,WAAO,gBAAgB,UAAU,KAAK,OAAsB;AAAA,EAC9D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,wBAAiD;AAE/C,UAAM,iBAAiB,oCAAmB,KAAK,OAAO;AACtD,QAAI,CAAC,eAAgB,QAAO,CAAC;AAE7B,WAAO,OAAO,KAAK,cAAc,EAAE;AAAA,MACjC,CAAC,aAAgD;AAC/C,YAAI;AACF,iCAAO,QAAwB;AAC/B,iBAAO;AAAA,QACT,QAAQ;AACN,iBAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAQO,SAAS,mBACd,UACA,SACM;AACN,MAAI,YAAY,SAAS;AACvB,UAAM,WAAW,eAAe,UAAU,OAAO;AACjD,kBAAc,OAAO,QAAQ;AAAA,EAC/B,WAAW,UAAU;AAEnB,eAAW,OAAO,cAAc,KAAK,GAAG;AACtC,UAAI,IAAI,WAAW,GAAG,QAAQ,GAAG,GAAG;AAClC,sBAAc,OAAO,GAAG;AAAA,MAC1B;AAAA,IACF;AAAA,EACF,WAAW,SAAS;AAElB,eAAW,OAAO,cAAc,KAAK,GAAG;AACtC,UAAI,IAAI,SAAS,IAAI,OAAO,EAAE,GAAG;AAC/B,sBAAc,OAAO,GAAG;AAAA,MAC1B;AAAA,IACF;AAAA,EACF,OAAO;AAEL,kBAAc,MAAM;AAAA,EACtB;AACF;","names":[]}
|
|
@@ -13,7 +13,9 @@ import type { Abi } from "abitype";
|
|
|
13
13
|
import { type GetContractReturnType, type PublicClient, type WalletClient } from "viem";
|
|
14
14
|
import { type ContractAbis, type VanaContract } from "../generated/abi";
|
|
15
15
|
import type { VanaChainId, ContractInfo } from "../types/index";
|
|
16
|
+
import { type VanaContractAddress } from "../generated/addresses";
|
|
16
17
|
import { createClient } from "../core/client";
|
|
18
|
+
type AddressedVanaContract = Extract<VanaContract, VanaContractAddress>;
|
|
17
19
|
export declare const contractCacheForTesting: Map<string, {
|
|
18
20
|
address: `0x${string}`;
|
|
19
21
|
abi: Abi;
|
|
@@ -48,7 +50,7 @@ export declare const contractCacheForTesting: Map<string, {
|
|
|
48
50
|
*
|
|
49
51
|
* @category Contracts
|
|
50
52
|
*/
|
|
51
|
-
export declare function getContractController<T extends
|
|
53
|
+
export declare function getContractController<T extends AddressedVanaContract>(contract: T, client?: PublicClient | WalletClient | ReturnType<typeof createClient>): GetContractReturnType<ContractAbis[T]>;
|
|
52
54
|
/**
|
|
53
55
|
* Gets contract information without creating a contract instance.
|
|
54
56
|
*
|
|
@@ -78,7 +80,7 @@ export declare function getContractController<T extends VanaContract>(contract:
|
|
|
78
80
|
*
|
|
79
81
|
* @category Contracts
|
|
80
82
|
*/
|
|
81
|
-
export declare function getContractInfo<T extends
|
|
83
|
+
export declare function getContractInfo<T extends AddressedVanaContract>(contract: T, chainId?: VanaChainId): ContractInfo<ContractAbis[T]>;
|
|
82
84
|
/**
|
|
83
85
|
* Provides type-safe contract factory for creating multiple contract instances.
|
|
84
86
|
*
|
|
@@ -110,20 +112,20 @@ export declare class ContractFactory {
|
|
|
110
112
|
* @param contract - Contract name (use const assertion for full typing)
|
|
111
113
|
* @returns Fully typed contract instance
|
|
112
114
|
*/
|
|
113
|
-
create<T extends
|
|
115
|
+
create<T extends AddressedVanaContract>(contract: T): GetContractReturnType<ContractAbis[T]>;
|
|
114
116
|
/**
|
|
115
117
|
* Gets contract information without creating an instance
|
|
116
118
|
*
|
|
117
119
|
* @param contract - Contract name
|
|
118
120
|
* @returns Contract information with typed ABI
|
|
119
121
|
*/
|
|
120
|
-
getInfo<T extends
|
|
122
|
+
getInfo<T extends AddressedVanaContract>(contract: T): ContractInfo<ContractAbis[T]>;
|
|
121
123
|
/**
|
|
122
124
|
* Lists all available contracts for the current chain
|
|
123
125
|
*
|
|
124
126
|
* @returns Array of contract names available on this chain
|
|
125
127
|
*/
|
|
126
|
-
getAvailableContracts():
|
|
128
|
+
getAvailableContracts(): AddressedVanaContract[];
|
|
127
129
|
}
|
|
128
130
|
/**
|
|
129
131
|
* Clears the contract cache. Useful for testing or when chain configurations change.
|
|
@@ -131,5 +133,5 @@ export declare class ContractFactory {
|
|
|
131
133
|
* @param contract - Optional specific contract to clear, or clear all if not provided
|
|
132
134
|
* @param chainId - Optional specific chain to clear, or clear all if not provided
|
|
133
135
|
*/
|
|
134
|
-
export declare function clearContractCache(contract?:
|
|
136
|
+
export declare function clearContractCache(contract?: AddressedVanaContract, chainId?: number): void;
|
|
135
137
|
export type { GetContractReturnType } from "viem";
|
|
@@ -2,7 +2,10 @@ import {
|
|
|
2
2
|
getContract
|
|
3
3
|
} from "viem";
|
|
4
4
|
import { getAbi } from "../generated/abi/index.js";
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
getContractAddress,
|
|
7
|
+
CONTRACT_ADDRESSES
|
|
8
|
+
} from "../generated/addresses.js";
|
|
6
9
|
import { createClient } from "../core/client.js";
|
|
7
10
|
import { vanaMainnet } from "../config/chains.js";
|
|
8
11
|
const contractCache = /* @__PURE__ */ new Map();
|
|
@@ -67,7 +70,16 @@ class ContractFactory {
|
|
|
67
70
|
getAvailableContracts() {
|
|
68
71
|
const chainAddresses = CONTRACT_ADDRESSES[this.chainId];
|
|
69
72
|
if (!chainAddresses) return [];
|
|
70
|
-
return Object.keys(chainAddresses)
|
|
73
|
+
return Object.keys(chainAddresses).filter(
|
|
74
|
+
(contract) => {
|
|
75
|
+
try {
|
|
76
|
+
getAbi(contract);
|
|
77
|
+
return true;
|
|
78
|
+
} catch {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
);
|
|
71
83
|
}
|
|
72
84
|
}
|
|
73
85
|
function clearContractCache(contract, chainId) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/contracts/contractController.ts"],"sourcesContent":["/**\n * Provides type-safe contract interaction utilities for the Vana protocol.\n *\n * @remarks\n * This module enables strongly-typed smart contract interactions with automatic\n * ABI loading, address resolution, and instance caching. It follows viem's patterns\n * for contract typing while providing Vana-specific conveniences.\n *\n * @category Contracts\n * @module contractController\n */\n\nimport type { Abi } from \"abitype\";\nimport {\n getContract,\n type GetContractReturnType,\n type PublicClient,\n type WalletClient,\n} from \"viem\";\nimport { type ContractAbis, getAbi, type VanaContract } from \"../generated/abi\";\nimport type { VanaChainId, ContractInfo } from \"../types/index\";\nimport { getContractAddress, CONTRACT_ADDRESSES } from \"../generated/addresses\";\nimport { createClient } from \"../core/client\";\nimport { vanaMainnet } from \"../config/chains\";\n\n// Cache for contract instances - keyed by contract name and chain ID\nconst contractCache = new Map<string, GetContractReturnType<Abi>>();\n\n// Export cache for testing\nexport const contractCacheForTesting = contractCache;\n\n/**\n * Creates a cache key for contract instances.\n *\n * @remarks\n * Generates unique keys for caching contract instances per chain to prevent\n * cross-chain contamination and improve performance.\n *\n * @param contract - The contract name to create a cache key for\n * @param chainId - The chain ID to include in the cache key\n * @returns A string cache key combining contract name and chain ID\n *\n * @internal\n */\nfunction createCacheKey(contract: VanaContract, chainId: number): string {\n return `${contract}:${chainId}`;\n}\n\n/**\n * Gets a typed contract instance for the specified contract name.\n *\n * @remarks\n * Provides complete type safety following viem's patterns with automatic\n * ABI loading and address resolution. Contract instances are cached per\n * chain for performance. Use const assertion for full type inference.\n *\n * @param contract - Name of the contract to instantiate.\n * Use const assertion for full typing: `\"DataRegistry\" as const`\n * @param client - Optional viem client instance.\n * Defaults to auto-configured client. Obtain via `createClient()` or viem.\n * @returns A fully typed contract instance with methods corresponding to the contract's ABI\n *\n * @example\n * ```typescript\n * // Full type inference with const assertion\n * const dataRegistry = getContractController(\"DataRegistry\" as const, client);\n *\n * // Now dataRegistry has full type inference for all methods\n * const result = await dataRegistry.read.getFileCount(); // Type: bigint\n * await dataRegistry.write.addFile([url, proof]); // Typed parameters\n *\n * // Auto-configured client\n * const permissions = getContractController(\"DataPortabilityPermissions\" as const);\n * const granted = await permissions.read.hasPermission([grantor, grantee]);\n * ```\n *\n * @category Contracts\n */\nexport function getContractController<T extends VanaContract>(\n contract: T,\n client:\n | PublicClient\n | WalletClient\n | ReturnType<typeof createClient> = createClient(),\n): GetContractReturnType<ContractAbis[T]> {\n const chainId = client.chain?.id ?? vanaMainnet.id;\n const cacheKey = createCacheKey(contract, chainId);\n\n let controller = contractCache.get(cacheKey);\n\n if (!controller) {\n controller = getContract({\n address: getContractAddress(chainId, contract),\n abi: getAbi(contract),\n client,\n }) as GetContractReturnType<ContractAbis[T]>;\n\n contractCache.set(cacheKey, controller);\n }\n\n return controller as GetContractReturnType<ContractAbis[T]>;\n}\n\n/**\n * Gets contract information without creating a contract instance.\n *\n * @remarks\n * Returns contract address and ABI for manual contract interaction or\n * custom client configuration. Useful when you need contract details\n * but don't want to create a client connection.\n *\n * @param contract - Name of the contract.\n * Use const assertion for typed ABI.\n * @param chainId - Chain ID to get contract info for.\n * Defaults to Vana mainnet (1480).\n * @returns Contract information with typed ABI\n *\n * @example\n * ```typescript\n * const info = getContractInfo(\"DataRegistry\" as const, 14800);\n * console.log(info.address); // Typed as Address\n * console.log(info.abi); // Fully typed ABI\n *\n * // Use with custom viem client\n * const contract = getContract({\n * ...info,\n * client: customClient\n * });\n * ```\n *\n * @category Contracts\n */\nexport function getContractInfo<T extends VanaContract>(\n contract: T,\n chainId: VanaChainId = vanaMainnet.id as VanaChainId,\n): ContractInfo<ContractAbis[T]> {\n return {\n address: getContractAddress(chainId, contract),\n abi: getAbi(contract),\n };\n}\n\n/**\n * Provides type-safe contract factory for creating multiple contract instances.\n *\n * @remarks\n * Alternative API for applications that need to create multiple contracts\n * with the same client. The factory pattern reduces boilerplate and ensures\n * consistent client configuration across contracts.\n *\n * @example\n * ```typescript\n * const factory = new ContractFactory(client);\n *\n * const dataRegistry = factory.create(\"DataRegistry\" as const);\n * const permissions = factory.create(\"DataPortabilityPermissions\" as const);\n *\n * // List available contracts\n * const contracts = factory.getAvailableContracts();\n * ```\n *\n * @category Contracts\n */\nexport class ContractFactory {\n private readonly client:\n | PublicClient\n | WalletClient\n | ReturnType<typeof createClient>;\n private readonly chainId: number;\n\n constructor(\n client: PublicClient | WalletClient | ReturnType<typeof createClient>,\n ) {\n this.client = client;\n try {\n this.chainId = client.chain?.id ?? vanaMainnet.id;\n } catch {\n this.chainId = vanaMainnet.id;\n }\n }\n\n /**\n * Creates a typed contract instance\n *\n * @param contract - Contract name (use const assertion for full typing)\n * @returns Fully typed contract instance\n */\n create<T extends VanaContract>(\n contract: T,\n ): GetContractReturnType<ContractAbis[T]> {\n return getContractController(contract, this.client);\n }\n\n /**\n * Gets contract information without creating an instance\n *\n * @param contract - Contract name\n * @returns Contract information with typed ABI\n */\n getInfo<T extends VanaContract>(contract: T): ContractInfo<ContractAbis[T]> {\n return getContractInfo(contract, this.chainId as VanaChainId);\n }\n\n /**\n * Lists all available contracts for the current chain\n *\n * @returns Array of contract names available on this chain\n */\n getAvailableContracts(): VanaContract[] {\n // Return all contract names that have addresses on this chain\n const chainAddresses = CONTRACT_ADDRESSES[this.chainId];\n if (!chainAddresses) return [];\n\n return Object.keys(chainAddresses) as VanaContract[];\n }\n}\n\n/**\n * Clears the contract cache. Useful for testing or when chain configurations change.\n *\n * @param contract - Optional specific contract to clear, or clear all if not provided\n * @param chainId - Optional specific chain to clear, or clear all if not provided\n */\nexport function clearContractCache(\n contract?: VanaContract,\n chainId?: number,\n): void {\n if (contract && chainId) {\n const cacheKey = createCacheKey(contract, chainId);\n contractCache.delete(cacheKey);\n } else if (contract) {\n // Clear all instances of this contract across all chains\n for (const key of contractCache.keys()) {\n if (key.startsWith(`${contract}:`)) {\n contractCache.delete(key);\n }\n }\n } else if (chainId) {\n // Clear all contracts for this chain\n for (const key of contractCache.keys()) {\n if (key.endsWith(`:${chainId}`)) {\n contractCache.delete(key);\n }\n }\n } else {\n // Clear entire cache\n contractCache.clear();\n }\n}\n\n// Function is already exported above, no need for redundant export\n\n// Type-only exports for enhanced type safety\nexport type { GetContractReturnType } from \"viem\";\n"],"mappings":"AAaA;AAAA,EACE;AAAA,OAIK;AACP,SAA4B,cAAiC;AAE7D,SAAS,oBAAoB,0BAA0B;AACvD,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAG5B,MAAM,gBAAgB,oBAAI,IAAwC;AAG3D,MAAM,0BAA0B;AAevC,SAAS,eAAe,UAAwB,SAAyB;AACvE,SAAO,GAAG,QAAQ,IAAI,OAAO;AAC/B;AAgCO,SAAS,sBACd,UACA,SAGsC,aAAa,GACX;AACxC,QAAM,UAAU,OAAO,OAAO,MAAM,YAAY;AAChD,QAAM,WAAW,eAAe,UAAU,OAAO;AAEjD,MAAI,aAAa,cAAc,IAAI,QAAQ;AAE3C,MAAI,CAAC,YAAY;AACf,iBAAa,YAAY;AAAA,MACvB,SAAS,mBAAmB,SAAS,QAAQ;AAAA,MAC7C,KAAK,OAAO,QAAQ;AAAA,MACpB;AAAA,IACF,CAAC;AAED,kBAAc,IAAI,UAAU,UAAU;AAAA,EACxC;AAEA,SAAO;AACT;AA+BO,SAAS,gBACd,UACA,UAAuB,YAAY,IACJ;AAC/B,SAAO;AAAA,IACL,SAAS,mBAAmB,SAAS,QAAQ;AAAA,IAC7C,KAAK,OAAO,QAAQ;AAAA,EACtB;AACF;AAuBO,MAAM,gBAAgB;AAAA,EACV;AAAA,EAIA;AAAA,EAEjB,YACE,QACA;AACA,SAAK,SAAS;AACd,QAAI;AACF,WAAK,UAAU,OAAO,OAAO,MAAM,YAAY;AAAA,IACjD,QAAQ;AACN,WAAK,UAAU,YAAY;AAAA,IAC7B;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,OACE,UACwC;AACxC,WAAO,sBAAsB,UAAU,KAAK,MAAM;AAAA,EACpD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,QAAgC,UAA4C;AAC1E,WAAO,gBAAgB,UAAU,KAAK,OAAsB;AAAA,EAC9D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,wBAAwC;AAEtC,UAAM,iBAAiB,mBAAmB,KAAK,OAAO;AACtD,QAAI,CAAC,eAAgB,QAAO,CAAC;AAE7B,WAAO,OAAO,KAAK,cAAc;AAAA,EACnC;AACF;AAQO,SAAS,mBACd,UACA,SACM;AACN,MAAI,YAAY,SAAS;AACvB,UAAM,WAAW,eAAe,UAAU,OAAO;AACjD,kBAAc,OAAO,QAAQ;AAAA,EAC/B,WAAW,UAAU;AAEnB,eAAW,OAAO,cAAc,KAAK,GAAG;AACtC,UAAI,IAAI,WAAW,GAAG,QAAQ,GAAG,GAAG;AAClC,sBAAc,OAAO,GAAG;AAAA,MAC1B;AAAA,IACF;AAAA,EACF,WAAW,SAAS;AAElB,eAAW,OAAO,cAAc,KAAK,GAAG;AACtC,UAAI,IAAI,SAAS,IAAI,OAAO,EAAE,GAAG;AAC/B,sBAAc,OAAO,GAAG;AAAA,MAC1B;AAAA,IACF;AAAA,EACF,OAAO;AAEL,kBAAc,MAAM;AAAA,EACtB;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/contracts/contractController.ts"],"sourcesContent":["/**\n * Provides type-safe contract interaction utilities for the Vana protocol.\n *\n * @remarks\n * This module enables strongly-typed smart contract interactions with automatic\n * ABI loading, address resolution, and instance caching. It follows viem's patterns\n * for contract typing while providing Vana-specific conveniences.\n *\n * @category Contracts\n * @module contractController\n */\n\nimport type { Abi } from \"abitype\";\nimport {\n getContract,\n type GetContractReturnType,\n type PublicClient,\n type WalletClient,\n} from \"viem\";\nimport { type ContractAbis, getAbi, type VanaContract } from \"../generated/abi\";\nimport type { VanaChainId, ContractInfo } from \"../types/index\";\nimport {\n getContractAddress,\n CONTRACT_ADDRESSES,\n type VanaContractAddress,\n} from \"../generated/addresses\";\nimport { createClient } from \"../core/client\";\nimport { vanaMainnet } from \"../config/chains\";\n\ntype AddressedVanaContract = Extract<VanaContract, VanaContractAddress>;\n\n// Cache for contract instances - keyed by contract name and chain ID\nconst contractCache = new Map<string, GetContractReturnType<Abi>>();\n\n// Export cache for testing\nexport const contractCacheForTesting = contractCache;\n\n/**\n * Creates a cache key for contract instances.\n *\n * @remarks\n * Generates unique keys for caching contract instances per chain to prevent\n * cross-chain contamination and improve performance.\n *\n * @param contract - The contract name to create a cache key for\n * @param chainId - The chain ID to include in the cache key\n * @returns A string cache key combining contract name and chain ID\n *\n * @internal\n */\nfunction createCacheKey(\n contract: AddressedVanaContract,\n chainId: number,\n): string {\n return `${contract}:${chainId}`;\n}\n\n/**\n * Gets a typed contract instance for the specified contract name.\n *\n * @remarks\n * Provides complete type safety following viem's patterns with automatic\n * ABI loading and address resolution. Contract instances are cached per\n * chain for performance. Use const assertion for full type inference.\n *\n * @param contract - Name of the contract to instantiate.\n * Use const assertion for full typing: `\"DataRegistry\" as const`\n * @param client - Optional viem client instance.\n * Defaults to auto-configured client. Obtain via `createClient()` or viem.\n * @returns A fully typed contract instance with methods corresponding to the contract's ABI\n *\n * @example\n * ```typescript\n * // Full type inference with const assertion\n * const dataRegistry = getContractController(\"DataRegistry\" as const, client);\n *\n * // Now dataRegistry has full type inference for all methods\n * const result = await dataRegistry.read.getFileCount(); // Type: bigint\n * await dataRegistry.write.addFile([url, proof]); // Typed parameters\n *\n * // Auto-configured client\n * const permissions = getContractController(\"DataPortabilityPermissions\" as const);\n * const granted = await permissions.read.hasPermission([grantor, grantee]);\n * ```\n *\n * @category Contracts\n */\nexport function getContractController<T extends AddressedVanaContract>(\n contract: T,\n client:\n | PublicClient\n | WalletClient\n | ReturnType<typeof createClient> = createClient(),\n): GetContractReturnType<ContractAbis[T]> {\n const chainId = client.chain?.id ?? vanaMainnet.id;\n const cacheKey = createCacheKey(contract, chainId);\n\n let controller = contractCache.get(cacheKey);\n\n if (!controller) {\n controller = getContract({\n address: getContractAddress(chainId, contract),\n abi: getAbi(contract),\n client,\n }) as GetContractReturnType<ContractAbis[T]>;\n\n contractCache.set(cacheKey, controller);\n }\n\n return controller as GetContractReturnType<ContractAbis[T]>;\n}\n\n/**\n * Gets contract information without creating a contract instance.\n *\n * @remarks\n * Returns contract address and ABI for manual contract interaction or\n * custom client configuration. Useful when you need contract details\n * but don't want to create a client connection.\n *\n * @param contract - Name of the contract.\n * Use const assertion for typed ABI.\n * @param chainId - Chain ID to get contract info for.\n * Defaults to Vana mainnet (1480).\n * @returns Contract information with typed ABI\n *\n * @example\n * ```typescript\n * const info = getContractInfo(\"DataRegistry\" as const, 14800);\n * console.log(info.address); // Typed as Address\n * console.log(info.abi); // Fully typed ABI\n *\n * // Use with custom viem client\n * const contract = getContract({\n * ...info,\n * client: customClient\n * });\n * ```\n *\n * @category Contracts\n */\nexport function getContractInfo<T extends AddressedVanaContract>(\n contract: T,\n chainId: VanaChainId = vanaMainnet.id as VanaChainId,\n): ContractInfo<ContractAbis[T]> {\n return {\n address: getContractAddress(chainId, contract),\n abi: getAbi(contract),\n };\n}\n\n/**\n * Provides type-safe contract factory for creating multiple contract instances.\n *\n * @remarks\n * Alternative API for applications that need to create multiple contracts\n * with the same client. The factory pattern reduces boilerplate and ensures\n * consistent client configuration across contracts.\n *\n * @example\n * ```typescript\n * const factory = new ContractFactory(client);\n *\n * const dataRegistry = factory.create(\"DataRegistry\" as const);\n * const permissions = factory.create(\"DataPortabilityPermissions\" as const);\n *\n * // List available contracts\n * const contracts = factory.getAvailableContracts();\n * ```\n *\n * @category Contracts\n */\nexport class ContractFactory {\n private readonly client:\n | PublicClient\n | WalletClient\n | ReturnType<typeof createClient>;\n private readonly chainId: number;\n\n constructor(\n client: PublicClient | WalletClient | ReturnType<typeof createClient>,\n ) {\n this.client = client;\n try {\n this.chainId = client.chain?.id ?? vanaMainnet.id;\n } catch {\n this.chainId = vanaMainnet.id;\n }\n }\n\n /**\n * Creates a typed contract instance\n *\n * @param contract - Contract name (use const assertion for full typing)\n * @returns Fully typed contract instance\n */\n create<T extends AddressedVanaContract>(\n contract: T,\n ): GetContractReturnType<ContractAbis[T]> {\n return getContractController(contract, this.client);\n }\n\n /**\n * Gets contract information without creating an instance\n *\n * @param contract - Contract name\n * @returns Contract information with typed ABI\n */\n getInfo<T extends AddressedVanaContract>(\n contract: T,\n ): ContractInfo<ContractAbis[T]> {\n return getContractInfo(contract, this.chainId as VanaChainId);\n }\n\n /**\n * Lists all available contracts for the current chain\n *\n * @returns Array of contract names available on this chain\n */\n getAvailableContracts(): AddressedVanaContract[] {\n // Return contract names that have both an address and an ABI on this chain.\n const chainAddresses = CONTRACT_ADDRESSES[this.chainId];\n if (!chainAddresses) return [];\n\n return Object.keys(chainAddresses).filter(\n (contract): contract is AddressedVanaContract => {\n try {\n getAbi(contract as VanaContract);\n return true;\n } catch {\n return false;\n }\n },\n );\n }\n}\n\n/**\n * Clears the contract cache. Useful for testing or when chain configurations change.\n *\n * @param contract - Optional specific contract to clear, or clear all if not provided\n * @param chainId - Optional specific chain to clear, or clear all if not provided\n */\nexport function clearContractCache(\n contract?: AddressedVanaContract,\n chainId?: number,\n): void {\n if (contract && chainId) {\n const cacheKey = createCacheKey(contract, chainId);\n contractCache.delete(cacheKey);\n } else if (contract) {\n // Clear all instances of this contract across all chains\n for (const key of contractCache.keys()) {\n if (key.startsWith(`${contract}:`)) {\n contractCache.delete(key);\n }\n }\n } else if (chainId) {\n // Clear all contracts for this chain\n for (const key of contractCache.keys()) {\n if (key.endsWith(`:${chainId}`)) {\n contractCache.delete(key);\n }\n }\n } else {\n // Clear entire cache\n contractCache.clear();\n }\n}\n\n// Function is already exported above, no need for redundant export\n\n// Type-only exports for enhanced type safety\nexport type { GetContractReturnType } from \"viem\";\n"],"mappings":"AAaA;AAAA,EACE;AAAA,OAIK;AACP,SAA4B,cAAiC;AAE7D;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAK5B,MAAM,gBAAgB,oBAAI,IAAwC;AAG3D,MAAM,0BAA0B;AA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,iBAAO;AAAA,QACT,QAAQ;AACN,iBAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAQO,SAAS,mBACd,UACA,SACM;AACN,MAAI,YAAY,SAAS;AACvB,UAAM,WAAW,eAAe,UAAU,OAAO;AACjD,kBAAc,OAAO,QAAQ;AAAA,EAC/B,WAAW,UAAU;AAEnB,eAAW,OAAO,cAAc,KAAK,GAAG;AACtC,UAAI,IAAI,WAAW,GAAG,QAAQ,GAAG,GAAG;AAClC,sBAAc,OAAO,GAAG;AAAA,MAC1B;AAAA,IACF;AAAA,EACF,WAAW,SAAS;AAElB,eAAW,OAAO,cAAc,KAAK,GAAG;AACtC,UAAI,IAAI,SAAS,IAAI,OAAO,EAAE,GAAG;AAC/B,sBAAc,OAAO,GAAG;AAAA,MAC1B;AAAA,IACF;AAAA,EACF,OAAO;AAEL,kBAAc,MAAM;AAAA,EACtB;AACF;","names":[]}
|
|
@@ -23,6 +23,8 @@ __export(controller_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(controller_exports);
|
|
24
24
|
var import_accounts = require("viem/accounts");
|
|
25
25
|
var import_scopes = require("../protocol/scopes");
|
|
26
|
+
var import_escrow = require("../protocol/escrow");
|
|
27
|
+
var import_addresses = require("../generated/addresses");
|
|
26
28
|
var import_access_request_client = require("./access-request-client");
|
|
27
29
|
var import_endpoints = require("./endpoints");
|
|
28
30
|
var import_errors = require("./errors");
|
|
@@ -62,13 +64,20 @@ function createDirectDataController(config) {
|
|
|
62
64
|
appAddress: account.address,
|
|
63
65
|
signMessage
|
|
64
66
|
});
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
const escrowChainId = config.escrow?.chainId ?? chainId;
|
|
68
|
+
const defaultEscrowContract = import_addresses.CONTRACTS.DataPortabilityEscrow.addresses[escrowChainId] ?? void 0;
|
|
69
|
+
if (!config.escrow?.escrowContract && !defaultEscrowContract) {
|
|
70
|
+
throw new import_errors.DirectConfigError(
|
|
71
|
+
`No DataPortabilityEscrow address found in the registry for chainId ${escrowChainId}. Provide an explicit escrow.escrowContract in the controller config.`
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
const escrow = {
|
|
75
|
+
client: config.escrow?.client ?? (0, import_escrow.createEscrowGatewayClient)(endpoints.escrowGatewayUrl),
|
|
76
|
+
escrowContract: config.escrow?.escrowContract ?? defaultEscrowContract,
|
|
77
|
+
chainId: escrowChainId,
|
|
78
|
+
nonceSource: config.escrow?.nonceSource,
|
|
70
79
|
signTypedData
|
|
71
|
-
}
|
|
80
|
+
};
|
|
72
81
|
return {
|
|
73
82
|
appAddress: account.address,
|
|
74
83
|
getAppAddress() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/direct/controller.ts"],"sourcesContent":["/**\n * Direct Data Controller — the server-side facade for the two-tab Data\n * Portability flow.\n *\n * @remarks\n * One controller owns an app's private key, source, scopes, app identity, and\n * payment flow. It exposes the three methods the builder guide documents:\n *\n * - {@link DirectDataController.createAccessRequest} — start an approval request.\n * - {@link DirectDataController.getAccessRequestStatus} — poll while the Vana tab is open.\n * - {@link DirectDataController.readApprovedData} — read from the Personal Server,\n * handling 402 Payment Required.\n *\n * Access requests are created through the Vana Account access-request API; the\n * Personal Server read uses Web3Signed auth; and payment uses the DPv2 escrow\n * surface (`protocol/escrow`) — when a read returns `402`, the controller signs\n * a `GenericPayment` with the app key, settles it through the escrow gateway,\n * and retries.\n *\n * @category Direct\n * @module direct/controller\n */\n\nimport { privateKeyToAccount } from \"viem/accounts\";\nimport type { Hex } from \"viem\";\nimport type { Web3SignedSignFn } from \"../auth/web3-signed-builder\";\nimport { parseScope } from \"../protocol/scopes\";\nimport {\n createDefaultAccessRequestClient,\n type FetchLike,\n} from \"./access-request-client\";\nimport {\n getDirectDefaultNetwork,\n getDirectEndpoints,\n getDirectNetworkChainId,\n} from \"./endpoints\";\nimport { AccessNotApprovedError, DirectConfigError } from \"./errors\";\nimport {\n type EscrowPaymentConfig,\n type SignTypedDataFn,\n} from \"./escrow-payment\";\nimport {\n readPersonalServerData,\n type PersonalServerFetch,\n} from \"./personal-server-read\";\nimport type {\n AccessRequest,\n AccessRequestClient,\n AccessRequestStatus,\n ApprovedDataResult,\n AppIdentity,\n DirectAppConfig,\n DirectEnv,\n DirectNetwork,\n DirectServiceEndpoints,\n} from \"./types\";\n\n/** Configuration for {@link createDirectDataController}. */\nexport interface DirectDataControllerConfig {\n /** Target environment. Defaults to `\"production\"`. */\n env?: DirectEnv;\n /**\n * Target Vana network for chain-aware defaults. Defaults to the selected\n * environment's historical network (`mainnet` for production, `moksha` for\n * dev). Use `network: \"moksha\"` with the default production env for\n * production app/API URLs on testnet.\n */\n network?: DirectNetwork;\n /**\n * The app private key (`0x`-prefixed, 32 bytes). Server-side only — this key\n * is the app's on-chain identity and is never exposed to the browser.\n */\n appPrivateKey?: string;\n /**\n * @deprecated Use {@link DirectDataControllerConfig.appPrivateKey}. Accepted as\n * a backwards-compatible alias; if both are set, `appPrivateKey` wins.\n */\n builderPrivateKey?: string;\n /** App identity advertised during approval. */\n app: DirectAppConfig;\n /** Data source key (e.g. `\"icloud_notes\"`). */\n source: string;\n /** Scopes to request (e.g. `[\"icloud_notes.notes\"]`). At least one required. */\n scopes: string[];\n /**\n * Override the resolved service endpoints (partial). Useful for pointing at a\n * non-standard deployment.\n */\n endpoints?: Partial<DirectServiceEndpoints>;\n /**\n * Client for the Vana Account access-request API. Defaults to a client against\n * the resolved Vana Account endpoints; inject your own to point at a custom\n * deployment or to supply a test double.\n */\n accessRequestClient?: AccessRequestClient;\n /**\n * Escrow settlement config used when a Personal Server read returns `402`.\n *\n * @remarks\n * Wires the DPv2 escrow gateway (`protocol/escrow`). The controller supplies\n * the EIP-712 `signTypedData` from the app key automatically, so you provide\n * the gateway `client`, the `escrowContract` address, and (optionally) the\n * `chainId` and a durable `nonceSource`. If omitted, a `402` from the Personal\n * Server throws {@link PaymentRequiredError} carrying the amount/asset owed.\n */\n escrow?: DirectEscrowConfig;\n /** `fetch` used by the default access-request client. Defaults to `globalThis.fetch`. */\n fetchFn?: FetchLike;\n /** `fetch` used for the Personal Server read. Defaults to `globalThis.fetch`. */\n personalServerFetch?: PersonalServerFetch;\n}\n\n/**\n * Controller-level escrow config — the {@link EscrowPaymentConfig} minus the\n * `signTypedData` and `chainId` the controller injects itself.\n */\nexport interface DirectEscrowConfig extends Omit<\n EscrowPaymentConfig,\n \"signTypedData\" | \"chainId\"\n> {\n /**\n * Chain id for the EIP-712 domain. Defaults to the controller's environment\n * (1480 for mainnet, 14800 for moksha).\n */\n chainId?: number;\n}\n\n/**\n * Server-side controller for the direct Data Portability flow.\n *\n * @typeParam T - Shape of the data returned by {@link DirectDataController.readApprovedData}.\n */\nexport interface DirectDataController {\n /** The on-chain address of the app, derived from `appPrivateKey`. */\n readonly appAddress: string;\n\n /**\n * The app's on-chain address — the address to fund and inspect in the Builder\n * activity report. Equivalent to {@link DirectDataController.appAddress}.\n *\n * @returns The app's `0x`-prefixed address.\n */\n getAppAddress(): string;\n\n /**\n * The app's full identity: its configured id/name/homepage plus the derived\n * on-chain address. Useful for telling builders which app address to fund or\n * look up.\n *\n * @returns `{ id, name, homepageUrl, address }`.\n */\n getAppIdentity(): AppIdentity;\n\n /**\n * Create an access request the user can approve.\n *\n * @param input - The post-approval return URL.\n * @returns `{ requestId, approvalUrl, appAddress }`.\n */\n createAccessRequest(input: { returnUrl: string }): Promise<AccessRequest>;\n\n /**\n * Fetch the current status of an access request.\n *\n * @param requestId - The `dcr_*` id from {@link DirectDataController.createAccessRequest}.\n * @returns `{ status, personalServerUrl?, grantId?, scope? }`.\n */\n getAccessRequestStatus(requestId: string): Promise<AccessRequestStatus>;\n\n /**\n * Read the approved data from the user's Personal Server.\n *\n * @remarks\n * Resolves the request to its grant + Personal Server and performs a Web3Signed\n * read. Hides the `402 Payment Required` flow by default: if a read needs\n * payment and `escrow` is configured, it settles the grant via the escrow\n * gateway and retries, attaching a {@link DirectPaymentReceipt} under\n * `payment` so callers can inspect amount/asset/fee breakdown. If `escrow` is\n * not configured, it throws {@link PaymentRequiredError} carrying the\n * amount/asset owed.\n *\n * @param input - The `dcr_*` request id to read.\n * @returns `{ scope, data, payment? }`.\n * @throws {@link AccessNotApprovedError} if the request is not approved.\n * @throws {@link PaymentRequiredError} if payment is required but unsettled.\n */\n readApprovedData<T = unknown>(input: {\n requestId: string;\n }): Promise<ApprovedDataResult<T>>;\n}\n\nfunction isHexPrivateKey(value: string): value is Hex {\n return /^0x[0-9a-fA-F]{64}$/.test(value);\n}\n\n/**\n * Create a {@link DirectDataController}.\n *\n * @param config - Controller configuration (env, key, app identity, source, scopes).\n * @returns A ready-to-use controller.\n * @throws {@link DirectConfigError} when the key or scopes are invalid.\n */\nexport function createDirectDataController(\n config: DirectDataControllerConfig,\n): DirectDataController {\n // `appPrivateKey` is the documented field; `builderPrivateKey` is a\n // deprecated alias kept for backwards compatibility.\n const privateKey = config.appPrivateKey ?? config.builderPrivateKey;\n if (!privateKey || !isHexPrivateKey(privateKey)) {\n throw new DirectConfigError(\n \"appPrivateKey must be a 0x-prefixed 32-byte hex string\",\n );\n }\n if (!config.scopes || config.scopes.length === 0) {\n throw new DirectConfigError(\"At least one scope is required\");\n }\n // Validate scopes eagerly so misconfiguration fails at construction.\n for (const scope of config.scopes) {\n parseScope(scope);\n }\n\n const env: DirectEnv = config.env ?? \"production\";\n const network: DirectNetwork = config.network ?? getDirectDefaultNetwork(env);\n const defaultEndpoints = getDirectEndpoints(env);\n const chainId = config.endpoints?.chainId ?? getDirectNetworkChainId(network);\n const endpoints: DirectServiceEndpoints = {\n ...defaultEndpoints,\n ...config.endpoints,\n chainId,\n };\n\n const account = privateKeyToAccount(privateKey as Hex);\n const signMessage: Web3SignedSignFn = (message: string) =>\n account.signMessage({ message });\n // viem's account.signTypedData satisfies the structural SignTypedDataFn used\n // by the escrow GenericPayment signer.\n const signTypedData = account.signTypedData as unknown as SignTypedDataFn;\n const accessRequestClient: AccessRequestClient =\n config.accessRequestClient ??\n createDefaultAccessRequestClient({\n baseUrl: endpoints.accessRequestBaseUrl,\n approvalBaseUrl: endpoints.approvalAppBaseUrl,\n fetchFn: config.fetchFn,\n appAddress: account.address,\n signMessage,\n });\n\n const escrow: EscrowPaymentConfig | undefined = config.escrow\n ? {\n client: config.escrow.client,\n escrowContract: config.escrow.escrowContract,\n chainId: config.escrow.chainId ?? chainId,\n nonceSource: config.escrow.nonceSource,\n signTypedData,\n }\n : undefined;\n\n return {\n appAddress: account.address,\n\n getAppAddress(): string {\n return account.address;\n },\n\n getAppIdentity(): AppIdentity {\n return {\n id: config.app.id,\n name: config.app.name,\n homepageUrl: config.app.homepageUrl,\n address: account.address,\n };\n },\n\n async createAccessRequest(input): Promise<AccessRequest> {\n return accessRequestClient.createAccessRequest({\n appAddress: account.address,\n app: config.app,\n source: config.source,\n scopes: config.scopes,\n returnUrl: input.returnUrl,\n });\n },\n\n async getAccessRequestStatus(\n requestId: string,\n ): Promise<AccessRequestStatus> {\n return accessRequestClient.getAccessRequestStatus(requestId);\n },\n\n async readApprovedData<T = unknown>(input: {\n requestId: string;\n }): Promise<ApprovedDataResult<T>> {\n const status = await accessRequestClient.getAccessRequestStatus(\n input.requestId,\n );\n if (\n status.status !== \"approved\" ||\n !status.personalServerUrl ||\n !status.grantId ||\n !status.scope\n ) {\n throw new AccessNotApprovedError(\n \"Request is not approved or is missing grantId/scope/personalServerUrl\",\n {\n requestId: input.requestId,\n status: status.status,\n hasPersonalServerUrl: Boolean(status.personalServerUrl),\n hasGrantId: Boolean(status.grantId),\n hasScope: Boolean(status.scope),\n },\n );\n }\n\n const result = await readPersonalServerData({\n personalServerUrl: status.personalServerUrl,\n scope: status.scope,\n grantId: status.grantId,\n payerAddress: account.address,\n signMessage,\n escrow,\n fetchFn: config.personalServerFetch,\n });\n\n return {\n scope: status.scope,\n data: result.data as T,\n payment: result.payment,\n };\n },\n };\n}\n"],"mappings":";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AAA,QACd,MAAM,OAAO;AAAA,QACb,SAAS,OAAO;AAAA,MAClB;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/direct/controller.ts"],"sourcesContent":["/**\n * Direct Data Controller — the server-side facade for the two-tab Data\n * Portability flow.\n *\n * @remarks\n * One controller owns an app's private key, source, scopes, app identity, and\n * payment flow. It exposes the three methods the builder guide documents:\n *\n * - {@link DirectDataController.createAccessRequest} — start an approval request.\n * - {@link DirectDataController.getAccessRequestStatus} — poll while the Vana tab is open.\n * - {@link DirectDataController.readApprovedData} — read from the Personal Server,\n * handling 402 Payment Required.\n *\n * Access requests are created through the Vana Account access-request API; the\n * Personal Server read uses Web3Signed auth; and payment uses the DPv2 escrow\n * surface (`protocol/escrow`) — when a read returns `402`, the controller signs\n * a `GenericPayment` with the app key, settles it through the escrow gateway,\n * and retries.\n *\n * @category Direct\n * @module direct/controller\n */\n\nimport { privateKeyToAccount } from \"viem/accounts\";\nimport type { Hex } from \"viem\";\nimport type { Web3SignedSignFn } from \"../auth/web3-signed-builder\";\nimport { parseScope } from \"../protocol/scopes\";\nimport { createEscrowGatewayClient } from \"../protocol/escrow\";\nimport { CONTRACTS } from \"../generated/addresses\";\nimport {\n createDefaultAccessRequestClient,\n type FetchLike,\n} from \"./access-request-client\";\nimport {\n getDirectDefaultNetwork,\n getDirectEndpoints,\n getDirectNetworkChainId,\n} from \"./endpoints\";\nimport { AccessNotApprovedError, DirectConfigError } from \"./errors\";\nimport {\n type EscrowPaymentConfig,\n type SignTypedDataFn,\n} from \"./escrow-payment\";\nimport {\n readPersonalServerData,\n type PersonalServerFetch,\n} from \"./personal-server-read\";\nimport type {\n AccessRequest,\n AccessRequestClient,\n AccessRequestStatus,\n ApprovedDataResult,\n AppIdentity,\n DirectAppConfig,\n DirectEnv,\n DirectNetwork,\n DirectServiceEndpoints,\n} from \"./types\";\n\n/** Configuration for {@link createDirectDataController}. */\nexport interface DirectDataControllerConfig {\n /** Target environment. Defaults to `\"production\"`. */\n env?: DirectEnv;\n /**\n * Target Vana network for chain-aware defaults. Defaults to the selected\n * environment's historical network (`mainnet` for production, `moksha` for\n * dev). Use `network: \"moksha\"` with the default production env for\n * production app/API URLs on testnet.\n */\n network?: DirectNetwork;\n /**\n * The app private key (`0x`-prefixed, 32 bytes). Server-side only — this key\n * is the app's on-chain identity and is never exposed to the browser.\n */\n appPrivateKey?: string;\n /**\n * @deprecated Use {@link DirectDataControllerConfig.appPrivateKey}. Accepted as\n * a backwards-compatible alias; if both are set, `appPrivateKey` wins.\n */\n builderPrivateKey?: string;\n /** App identity advertised during approval. */\n app: DirectAppConfig;\n /** Data source key (e.g. `\"icloud_notes\"`). */\n source: string;\n /** Scopes to request (e.g. `[\"icloud_notes.notes\"]`). At least one required. */\n scopes: string[];\n /**\n * Override the resolved service endpoints (partial). Useful for pointing at a\n * non-standard deployment.\n */\n endpoints?: Partial<DirectServiceEndpoints>;\n /**\n * Client for the Vana Account access-request API. Defaults to a client against\n * the resolved Vana Account endpoints; inject your own to point at a custom\n * deployment or to supply a test double.\n */\n accessRequestClient?: AccessRequestClient;\n /**\n * Escrow settlement config used when a Personal Server read returns `402`.\n *\n * @remarks\n * Wires the DPv2 escrow gateway (`protocol/escrow`). The controller supplies\n * the EIP-712 `signTypedData` from the app key automatically.\n *\n * When omitted (or partially omitted), the SDK derives defaults from the\n * per-network endpoints table and the contract registry:\n * - `client` defaults to a gateway client at `endpoints.escrowGatewayUrl`\n * - `escrowContract` defaults to `CONTRACTS.DataPortabilityEscrow.addresses[chainId]`\n * - `chainId` defaults to the controller's resolved chain id\n *\n * Provide this field only to override a specific default.\n */\n escrow?: Partial<DirectEscrowConfig>;\n /** `fetch` used by the default access-request client. Defaults to `globalThis.fetch`. */\n fetchFn?: FetchLike;\n /** `fetch` used for the Personal Server read. Defaults to `globalThis.fetch`. */\n personalServerFetch?: PersonalServerFetch;\n}\n\n/**\n * Controller-level escrow config — the {@link EscrowPaymentConfig} minus the\n * `signTypedData` and `chainId` the controller injects itself.\n */\nexport interface DirectEscrowConfig extends Omit<\n EscrowPaymentConfig,\n \"signTypedData\" | \"chainId\"\n> {\n /**\n * Chain id for the EIP-712 domain. Defaults to the controller's environment\n * (1480 for mainnet, 14800 for moksha).\n */\n chainId?: number;\n}\n\n/**\n * Server-side controller for the direct Data Portability flow.\n *\n * @typeParam T - Shape of the data returned by {@link DirectDataController.readApprovedData}.\n */\nexport interface DirectDataController {\n /** The on-chain address of the app, derived from `appPrivateKey`. */\n readonly appAddress: string;\n\n /**\n * The app's on-chain address — the address to fund and inspect in the Builder\n * activity report. Equivalent to {@link DirectDataController.appAddress}.\n *\n * @returns The app's `0x`-prefixed address.\n */\n getAppAddress(): string;\n\n /**\n * The app's full identity: its configured id/name/homepage plus the derived\n * on-chain address. Useful for telling builders which app address to fund or\n * look up.\n *\n * @returns `{ id, name, homepageUrl, address }`.\n */\n getAppIdentity(): AppIdentity;\n\n /**\n * Create an access request the user can approve.\n *\n * @param input - The post-approval return URL.\n * @returns `{ requestId, approvalUrl, appAddress }`.\n */\n createAccessRequest(input: { returnUrl: string }): Promise<AccessRequest>;\n\n /**\n * Fetch the current status of an access request.\n *\n * @param requestId - The `dcr_*` id from {@link DirectDataController.createAccessRequest}.\n * @returns `{ status, personalServerUrl?, grantId?, scope? }`.\n */\n getAccessRequestStatus(requestId: string): Promise<AccessRequestStatus>;\n\n /**\n * Read the approved data from the user's Personal Server.\n *\n * @remarks\n * Resolves the request to its grant + Personal Server and performs a Web3Signed\n * read. Hides the `402 Payment Required` flow by default: if a read needs\n * payment, it signs the Personal Server's payment challenge, retries with\n * `X-PAYMENT`, and attaches a {@link DirectPaymentReceipt} under `payment`\n * when the Personal Server returns one.\n *\n * @param input - The `dcr_*` request id to read.\n * @returns `{ scope, data, payment? }`.\n * @throws {@link AccessNotApprovedError} if the request is not approved.\n * @throws {@link PaymentRequiredError} if payment is required but unsettled.\n */\n readApprovedData<T = unknown>(input: {\n requestId: string;\n }): Promise<ApprovedDataResult<T>>;\n}\n\nfunction isHexPrivateKey(value: string): value is Hex {\n return /^0x[0-9a-fA-F]{64}$/.test(value);\n}\n\n/**\n * Create a {@link DirectDataController}.\n *\n * @param config - Controller configuration (env, key, app identity, source, scopes).\n * @returns A ready-to-use controller.\n * @throws {@link DirectConfigError} when the key or scopes are invalid.\n */\nexport function createDirectDataController(\n config: DirectDataControllerConfig,\n): DirectDataController {\n // `appPrivateKey` is the documented field; `builderPrivateKey` is a\n // deprecated alias kept for backwards compatibility.\n const privateKey = config.appPrivateKey ?? config.builderPrivateKey;\n if (!privateKey || !isHexPrivateKey(privateKey)) {\n throw new DirectConfigError(\n \"appPrivateKey must be a 0x-prefixed 32-byte hex string\",\n );\n }\n if (!config.scopes || config.scopes.length === 0) {\n throw new DirectConfigError(\"At least one scope is required\");\n }\n // Validate scopes eagerly so misconfiguration fails at construction.\n for (const scope of config.scopes) {\n parseScope(scope);\n }\n\n const env: DirectEnv = config.env ?? \"production\";\n const network: DirectNetwork = config.network ?? getDirectDefaultNetwork(env);\n const defaultEndpoints = getDirectEndpoints(env);\n const chainId = config.endpoints?.chainId ?? getDirectNetworkChainId(network);\n const endpoints: DirectServiceEndpoints = {\n ...defaultEndpoints,\n ...config.endpoints,\n chainId,\n };\n\n const account = privateKeyToAccount(privateKey as Hex);\n const signMessage: Web3SignedSignFn = (message: string) =>\n account.signMessage({ message });\n // viem's account.signTypedData satisfies the structural SignTypedDataFn used\n // by the escrow GenericPayment signer.\n const signTypedData = account.signTypedData as unknown as SignTypedDataFn;\n const accessRequestClient: AccessRequestClient =\n config.accessRequestClient ??\n createDefaultAccessRequestClient({\n baseUrl: endpoints.accessRequestBaseUrl,\n approvalBaseUrl: endpoints.approvalAppBaseUrl,\n fetchFn: config.fetchFn,\n appAddress: account.address,\n signMessage,\n });\n\n // Build the escrow payment config, defaulting from the per-network endpoints\n // table and the contract registry when `config.escrow` is omitted or partial.\n const escrowChainId = config.escrow?.chainId ?? chainId;\n const defaultEscrowContract =\n CONTRACTS.DataPortabilityEscrow.addresses[\n escrowChainId as keyof typeof CONTRACTS.DataPortabilityEscrow.addresses\n ] ?? undefined;\n if (!config.escrow?.escrowContract && !defaultEscrowContract) {\n throw new DirectConfigError(\n `No DataPortabilityEscrow address found in the registry for chainId ${escrowChainId}. ` +\n `Provide an explicit escrow.escrowContract in the controller config.`,\n );\n }\n const escrow: EscrowPaymentConfig = {\n client:\n config.escrow?.client ??\n createEscrowGatewayClient(endpoints.escrowGatewayUrl),\n escrowContract:\n config.escrow?.escrowContract ?? (defaultEscrowContract as `0x${string}`),\n chainId: escrowChainId,\n nonceSource: config.escrow?.nonceSource,\n signTypedData,\n };\n\n return {\n appAddress: account.address,\n\n getAppAddress(): string {\n return account.address;\n },\n\n getAppIdentity(): AppIdentity {\n return {\n id: config.app.id,\n name: config.app.name,\n homepageUrl: config.app.homepageUrl,\n address: account.address,\n };\n },\n\n async createAccessRequest(input): Promise<AccessRequest> {\n return accessRequestClient.createAccessRequest({\n appAddress: account.address,\n app: config.app,\n source: config.source,\n scopes: config.scopes,\n returnUrl: input.returnUrl,\n });\n },\n\n async getAccessRequestStatus(\n requestId: string,\n ): Promise<AccessRequestStatus> {\n return accessRequestClient.getAccessRequestStatus(requestId);\n },\n\n async readApprovedData<T = unknown>(input: {\n requestId: string;\n }): Promise<ApprovedDataResult<T>> {\n const status = await accessRequestClient.getAccessRequestStatus(\n input.requestId,\n );\n if (\n status.status !== \"approved\" ||\n !status.personalServerUrl ||\n !status.grantId ||\n !status.scope\n ) {\n throw new AccessNotApprovedError(\n \"Request is not approved or is missing grantId/scope/personalServerUrl\",\n {\n requestId: input.requestId,\n status: status.status,\n hasPersonalServerUrl: Boolean(status.personalServerUrl),\n hasGrantId: Boolean(status.grantId),\n hasScope: Boolean(status.scope),\n },\n );\n }\n\n const result = await readPersonalServerData({\n personalServerUrl: status.personalServerUrl,\n scope: status.scope,\n grantId: status.grantId,\n payerAddress: account.address,\n signMessage,\n escrow,\n fetchFn: config.personalServerFetch,\n });\n\n return {\n scope: status.scope,\n data: result.data as T,\n payment: result.payment,\n };\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAuBA,sBAAoC;AAGpC,oBAA2B;AAC3B,oBAA0C;AAC1C,uBAA0B;AAC1B,mCAGO;AACP,uBAIO;AACP,oBAA0D;AAK1D,kCAGO;AAsJP,SAAS,gBAAgB,OAA6B;AACpD,SAAO,sBAAsB,KAAK,KAAK;AACzC;AASO,SAAS,2BACd,QACsB;AAGtB,QAAM,aAAa,OAAO,iBAAiB,OAAO;AAClD,MAAI,CAAC,cAAc,CAAC,gBAAgB,UAAU,GAAG;AAC/C,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,MAAI,CAAC,OAAO,UAAU,OAAO,OAAO,WAAW,GAAG;AAChD,UAAM,IAAI,gCAAkB,gCAAgC;AAAA,EAC9D;AAEA,aAAW,SAAS,OAAO,QAAQ;AACjC,kCAAW,KAAK;AAAA,EAClB;AAEA,QAAM,MAAiB,OAAO,OAAO;AACrC,QAAM,UAAyB,OAAO,eAAW,0CAAwB,GAAG;AAC5E,QAAM,uBAAmB,qCAAmB,GAAG;AAC/C,QAAM,UAAU,OAAO,WAAW,eAAW,0CAAwB,OAAO;AAC5E,QAAM,YAAoC;AAAA,IACxC,GAAG;AAAA,IACH,GAAG,OAAO;AAAA,IACV;AAAA,EACF;AAEA,QAAM,cAAU,qCAAoB,UAAiB;AACrD,QAAM,cAAgC,CAAC,YACrC,QAAQ,YAAY,EAAE,QAAQ,CAAC;AAGjC,QAAM,gBAAgB,QAAQ;AAC9B,QAAM,sBACJ,OAAO,2BACP,+DAAiC;AAAA,IAC/B,SAAS,UAAU;AAAA,IACnB,iBAAiB,UAAU;AAAA,IAC3B,SAAS,OAAO;AAAA,IAChB,YAAY,QAAQ;AAAA,IACpB;AAAA,EACF,CAAC;AAIH,QAAM,gBAAgB,OAAO,QA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YACtD,YAAY,QAAQ,OAAO,OAAO;AAAA,YAClC,UAAU,QAAQ,OAAO,KAAK;AAAA,UAChC;AAAA,QACF;AAAA,MACF;AAEA,YAAM,SAAS,UAAM,oDAAuB;AAAA,QAC1C,mBAAmB,OAAO;AAAA,QAC1B,OAAO,OAAO;AAAA,QACd,SAAS,OAAO;AAAA,QAChB,cAAc,QAAQ;AAAA,QACtB;AAAA,QACA;AAAA,QACA,SAAS,OAAO;AAAA,MAClB,CAAC;AAED,aAAO;AAAA,QACL,OAAO,OAAO;AAAA,QACd,MAAM,OAAO;AAAA,QACb,SAAS,OAAO;AAAA,MAClB;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
|
@@ -67,12 +67,17 @@ export interface DirectDataControllerConfig {
|
|
|
67
67
|
*
|
|
68
68
|
* @remarks
|
|
69
69
|
* Wires the DPv2 escrow gateway (`protocol/escrow`). The controller supplies
|
|
70
|
-
* the EIP-712 `signTypedData` from the app key automatically
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
70
|
+
* the EIP-712 `signTypedData` from the app key automatically.
|
|
71
|
+
*
|
|
72
|
+
* When omitted (or partially omitted), the SDK derives defaults from the
|
|
73
|
+
* per-network endpoints table and the contract registry:
|
|
74
|
+
* - `client` defaults to a gateway client at `endpoints.escrowGatewayUrl`
|
|
75
|
+
* - `escrowContract` defaults to `CONTRACTS.DataPortabilityEscrow.addresses[chainId]`
|
|
76
|
+
* - `chainId` defaults to the controller's resolved chain id
|
|
77
|
+
*
|
|
78
|
+
* Provide this field only to override a specific default.
|
|
74
79
|
*/
|
|
75
|
-
escrow?: DirectEscrowConfig
|
|
80
|
+
escrow?: Partial<DirectEscrowConfig>;
|
|
76
81
|
/** `fetch` used by the default access-request client. Defaults to `globalThis.fetch`. */
|
|
77
82
|
fetchFn?: FetchLike;
|
|
78
83
|
/** `fetch` used for the Personal Server read. Defaults to `globalThis.fetch`. */
|
|
@@ -134,11 +139,9 @@ export interface DirectDataController {
|
|
|
134
139
|
* @remarks
|
|
135
140
|
* Resolves the request to its grant + Personal Server and performs a Web3Signed
|
|
136
141
|
* read. Hides the `402 Payment Required` flow by default: if a read needs
|
|
137
|
-
* payment
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
* not configured, it throws {@link PaymentRequiredError} carrying the
|
|
141
|
-
* amount/asset owed.
|
|
142
|
+
* payment, it signs the Personal Server's payment challenge, retries with
|
|
143
|
+
* `X-PAYMENT`, and attaches a {@link DirectPaymentReceipt} under `payment`
|
|
144
|
+
* when the Personal Server returns one.
|
|
142
145
|
*
|
|
143
146
|
* @param input - The `dcr_*` request id to read.
|
|
144
147
|
* @returns `{ scope, data, payment? }`.
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { privateKeyToAccount } from "viem/accounts";
|
|
2
2
|
import { parseScope } from "../protocol/scopes.js";
|
|
3
|
+
import { createEscrowGatewayClient } from "../protocol/escrow.js";
|
|
4
|
+
import { CONTRACTS } from "../generated/addresses.js";
|
|
3
5
|
import {
|
|
4
6
|
createDefaultAccessRequestClient
|
|
5
7
|
} from "./access-request-client.js";
|
|
@@ -47,13 +49,20 @@ function createDirectDataController(config) {
|
|
|
47
49
|
appAddress: account.address,
|
|
48
50
|
signMessage
|
|
49
51
|
});
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
const escrowChainId = config.escrow?.chainId ?? chainId;
|
|
53
|
+
const defaultEscrowContract = CONTRACTS.DataPortabilityEscrow.addresses[escrowChainId] ?? void 0;
|
|
54
|
+
if (!config.escrow?.escrowContract && !defaultEscrowContract) {
|
|
55
|
+
throw new DirectConfigError(
|
|
56
|
+
`No DataPortabilityEscrow address found in the registry for chainId ${escrowChainId}. Provide an explicit escrow.escrowContract in the controller config.`
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
const escrow = {
|
|
60
|
+
client: config.escrow?.client ?? createEscrowGatewayClient(endpoints.escrowGatewayUrl),
|
|
61
|
+
escrowContract: config.escrow?.escrowContract ?? defaultEscrowContract,
|
|
62
|
+
chainId: escrowChainId,
|
|
63
|
+
nonceSource: config.escrow?.nonceSource,
|
|
55
64
|
signTypedData
|
|
56
|
-
}
|
|
65
|
+
};
|
|
57
66
|
return {
|
|
58
67
|
appAddress: account.address,
|
|
59
68
|
getAppAddress() {
|