@opendatalabs/vana-sdk 0.1.0-alpha.219f38c → 0.1.0-alpha.24ddb16
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/addresses.d.cts +21 -0
- package/dist/config/addresses.d.ts +21 -0
- package/dist/contracts/contractController.d.cts +21 -0
- package/dist/contracts/contractController.d.ts +21 -0
- package/dist/controllers/data.cjs +92 -79
- package/dist/controllers/data.cjs.map +1 -1
- package/dist/controllers/data.d.cts +11 -38
- package/dist/controllers/data.d.ts +11 -38
- package/dist/controllers/data.js +92 -79
- package/dist/controllers/data.js.map +1 -1
- package/dist/controllers/permissions.cjs +338 -91
- package/dist/controllers/permissions.cjs.map +1 -1
- package/dist/controllers/permissions.d.cts +62 -142
- package/dist/controllers/permissions.d.ts +62 -142
- package/dist/controllers/permissions.js +338 -91
- package/dist/controllers/permissions.js.map +1 -1
- package/dist/controllers/protocol.d.cts +29 -9
- package/dist/controllers/protocol.d.ts +29 -9
- package/dist/controllers/schemas.cjs +50 -26
- package/dist/controllers/schemas.cjs.map +1 -1
- package/dist/controllers/schemas.d.cts +10 -23
- package/dist/controllers/schemas.d.ts +10 -23
- package/dist/controllers/schemas.js +50 -26
- package/dist/controllers/schemas.js.map +1 -1
- package/dist/controllers/server.d.cts +6 -20
- package/dist/controllers/server.d.ts +6 -20
- package/dist/core/generics.cjs +3 -0
- package/dist/core/generics.cjs.map +1 -1
- package/dist/core/generics.js +3 -0
- package/dist/core/generics.js.map +1 -1
- package/dist/core.cjs +9 -24
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +36 -16
- package/dist/core.d.ts +36 -16
- package/dist/core.js +9 -24
- package/dist/core.js.map +1 -1
- package/dist/generated/abi/DataRegistryImplementation.cjs +13 -0
- package/dist/generated/abi/DataRegistryImplementation.cjs.map +1 -1
- package/dist/generated/abi/DataRegistryImplementation.d.cts +10 -0
- package/dist/generated/abi/DataRegistryImplementation.d.ts +10 -0
- package/dist/generated/abi/DataRegistryImplementation.js +13 -0
- package/dist/generated/abi/DataRegistryImplementation.js.map +1 -1
- package/dist/generated/abi/index.cjs +42 -0
- package/dist/generated/abi/index.cjs.map +1 -1
- package/dist/generated/abi/index.d.cts +31 -0
- package/dist/generated/abi/index.d.ts +31 -0
- package/dist/generated/abi/index.js +21 -0
- package/dist/generated/abi/index.js.map +1 -1
- package/dist/generated/event-types.cjs +17 -0
- package/dist/generated/event-types.cjs.map +1 -0
- package/dist/generated/event-types.d.cts +855 -0
- package/dist/generated/event-types.d.ts +855 -0
- package/dist/generated/event-types.js +1 -0
- package/dist/generated/event-types.js.map +1 -0
- package/dist/generated/eventRegistry.cjs +3351 -0
- package/dist/generated/eventRegistry.cjs.map +1 -0
- package/dist/generated/eventRegistry.d.cts +18 -0
- package/dist/generated/eventRegistry.d.ts +18 -0
- package/dist/generated/eventRegistry.js +3326 -0
- package/dist/generated/eventRegistry.js.map +1 -0
- package/dist/index.browser.d.cts +24 -2
- package/dist/index.browser.d.ts +24 -2
- package/dist/index.cjs +3 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/index.node.d.cts +24 -2
- package/dist/index.node.d.ts +24 -2
- package/dist/platform/ports/openpgp-port.cjs +74 -0
- package/dist/platform/ports/openpgp-port.cjs.map +1 -0
- package/dist/platform/ports/openpgp-port.d.cts +17 -0
- package/dist/platform/ports/openpgp-port.d.ts +17 -0
- package/dist/platform/ports/openpgp-port.js +59 -0
- package/dist/platform/ports/openpgp-port.js.map +1 -0
- package/dist/platform/ports/pgp-port.cjs +17 -0
- package/dist/platform/ports/pgp-port.cjs.map +1 -0
- package/dist/platform/ports/pgp-port.d.cts +37 -0
- package/dist/platform/ports/pgp-port.d.ts +37 -0
- package/dist/platform/ports/pgp-port.js +1 -0
- package/dist/platform/ports/pgp-port.js.map +1 -0
- package/dist/server/handler.d.cts +24 -2
- package/dist/server/handler.d.ts +24 -2
- package/dist/types/blockchain.cjs +17 -0
- package/dist/types/blockchain.cjs.map +1 -0
- package/dist/types/blockchain.d.cts +52 -0
- package/dist/types/blockchain.d.ts +52 -0
- package/dist/types/blockchain.js +1 -0
- package/dist/types/blockchain.js.map +1 -0
- package/dist/types/controller-context.cjs +17 -0
- package/dist/types/controller-context.cjs.map +1 -0
- package/dist/types/controller-context.d.cts +71 -0
- package/dist/types/controller-context.d.ts +71 -0
- package/dist/types/controller-context.js +1 -0
- package/dist/types/controller-context.js.map +1 -0
- package/dist/types/index.d.cts +5 -18
- package/dist/types/index.d.ts +5 -18
- package/dist/types/operations.cjs.map +1 -1
- package/dist/types/operations.d.cts +16 -28
- package/dist/types/operations.d.ts +16 -28
- package/dist/types/operations.js.map +1 -1
- package/dist/types/transactionResults.cjs.map +1 -1
- package/dist/types/transactionResults.d.cts +195 -16
- package/dist/types/transactionResults.d.ts +195 -16
- package/dist/types.d.cts +5 -18
- package/dist/types.d.ts +5 -18
- package/dist/utils/blockchain/registry.cjs.map +1 -1
- package/dist/utils/blockchain/registry.js.map +1 -1
- package/dist/utils/multicall.cjs.map +1 -1
- package/dist/utils/multicall.js.map +1 -1
- package/dist/utils/parseTransactionPojo.cjs +87 -0
- package/dist/utils/parseTransactionPojo.cjs.map +1 -0
- package/dist/utils/parseTransactionPojo.d.cts +37 -0
- package/dist/utils/parseTransactionPojo.d.ts +37 -0
- package/dist/utils/parseTransactionPojo.js +63 -0
- package/dist/utils/parseTransactionPojo.js.map +1 -0
- package/dist/utils/transactionHelpers.cjs +54 -0
- package/dist/utils/transactionHelpers.cjs.map +1 -0
- package/dist/utils/transactionHelpers.d.cts +86 -0
- package/dist/utils/transactionHelpers.d.ts +86 -0
- package/dist/utils/transactionHelpers.js +29 -0
- package/dist/utils/transactionHelpers.js.map +1 -0
- package/dist/utils/typeGuards.cjs +121 -0
- package/dist/utils/typeGuards.cjs.map +1 -0
- package/dist/utils/typeGuards.d.cts +155 -0
- package/dist/utils/typeGuards.d.ts +155 -0
- package/dist/utils/typeGuards.js +84 -0
- package/dist/utils/typeGuards.js.map +1 -0
- package/dist/utils/withEvents.cjs +44 -0
- package/dist/utils/withEvents.cjs.map +1 -0
- package/dist/utils/withEvents.d.cts +63 -0
- package/dist/utils/withEvents.d.ts +63 -0
- package/dist/utils/withEvents.js +18 -0
- package/dist/utils/withEvents.js.map +1 -0
- package/package.json +12 -8
- package/dist/config/eventMappings.cjs +0 -114
- package/dist/config/eventMappings.cjs.map +0 -1
- package/dist/config/eventMappings.d.cts +0 -108
- package/dist/config/eventMappings.d.ts +0 -108
- package/dist/config/eventMappings.js +0 -90
- package/dist/config/eventMappings.js.map +0 -1
- package/dist/transactionResults-B9AmH7ce.d.ts +0 -230
- package/dist/transactionResults-kQt393os.d.cts +0 -230
- package/dist/utils/eventParsing.cjs +0 -111
- package/dist/utils/eventParsing.cjs.map +0 -1
- package/dist/utils/eventParsing.d.cts +0 -51
- package/dist/utils/eventParsing.d.ts +0 -51
- package/dist/utils/eventParsing.js +0 -86
- package/dist/utils/eventParsing.js.map +0 -1
- package/dist/utils/transactionParsing.cjs +0 -84
- package/dist/utils/transactionParsing.cjs.map +0 -1
- package/dist/utils/transactionParsing.d.cts +0 -16
- package/dist/utils/transactionParsing.d.ts +0 -16
- package/dist/utils/transactionParsing.js +0 -62
- package/dist/utils/transactionParsing.js.map +0 -1
|
@@ -1,16 +1,37 @@
|
|
|
1
1
|
import { VanaContract } from '../generated/abi/index.cjs';
|
|
2
|
+
import '../generated/abi/ComputeEngineImplementation.cjs';
|
|
3
|
+
import '../generated/abi/DataRegistryImplementation.cjs';
|
|
4
|
+
import '../generated/abi/TeePoolImplementation.cjs';
|
|
5
|
+
import '../generated/abi/TeePoolPhalaImplementation.cjs';
|
|
2
6
|
import '../generated/abi/DataPortabilityPermissionsImplementation.cjs';
|
|
3
7
|
import '../generated/abi/DataPortabilityServersImplementation.cjs';
|
|
4
8
|
import '../generated/abi/DataPortabilityGranteesImplementation.cjs';
|
|
9
|
+
import '../generated/abi/DataRefinerRegistryImplementation.cjs';
|
|
10
|
+
import '../generated/abi/QueryEngineImplementation.cjs';
|
|
11
|
+
import '../generated/abi/ComputeInstructionRegistryImplementation.cjs';
|
|
12
|
+
import '../generated/abi/TeePoolEphemeralStandardImplementation.cjs';
|
|
13
|
+
import '../generated/abi/TeePoolPersistentStandardImplementation.cjs';
|
|
14
|
+
import '../generated/abi/TeePoolPersistentGpuImplementation.cjs';
|
|
15
|
+
import '../generated/abi/TeePoolDedicatedStandardImplementation.cjs';
|
|
16
|
+
import '../generated/abi/TeePoolDedicatedGpuImplementation.cjs';
|
|
5
17
|
import '../generated/abi/VanaEpochImplementation.cjs';
|
|
6
18
|
import '../generated/abi/DLPRegistryImplementation.cjs';
|
|
7
19
|
import '../generated/abi/DLPTreasuryImplementation.cjs';
|
|
8
20
|
import '../generated/abi/DLPRewardDeployerTreasuryImplementation.cjs';
|
|
9
21
|
import '../generated/abi/DLPPerformanceImplementation.cjs';
|
|
10
22
|
import '../generated/abi/DLPRewardDeployerImplementation.cjs';
|
|
23
|
+
import '../generated/abi/DLPRewardSwapImplementation.cjs';
|
|
24
|
+
import '../generated/abi/SwapHelperImplementation.cjs';
|
|
11
25
|
import '../generated/abi/DLPRootImplementation.cjs';
|
|
12
26
|
import '../generated/abi/DataLiquidityPoolImplementation.cjs';
|
|
13
27
|
import '../generated/abi/DLPRegistryTreasuryImplementation.cjs';
|
|
28
|
+
import '../generated/abi/VanaPoolStakingImplementation.cjs';
|
|
29
|
+
import '../generated/abi/VanaPoolEntityImplementation.cjs';
|
|
30
|
+
import '../generated/abi/VanaPoolTreasuryImplementation.cjs';
|
|
31
|
+
import '../generated/abi/DATImplementation.cjs';
|
|
32
|
+
import '../generated/abi/DATFactoryImplementation.cjs';
|
|
33
|
+
import '../generated/abi/DATPausableImplementation.cjs';
|
|
34
|
+
import '../generated/abi/DATVotesImplementation.cjs';
|
|
14
35
|
|
|
15
36
|
/**
|
|
16
37
|
* Registry of all Vana protocol smart contract addresses organized by contract name and chain ID.
|
|
@@ -1,16 +1,37 @@
|
|
|
1
1
|
import { VanaContract } from '../generated/abi/index.js';
|
|
2
|
+
import '../generated/abi/ComputeEngineImplementation.js';
|
|
3
|
+
import '../generated/abi/DataRegistryImplementation.js';
|
|
4
|
+
import '../generated/abi/TeePoolImplementation.js';
|
|
5
|
+
import '../generated/abi/TeePoolPhalaImplementation.js';
|
|
2
6
|
import '../generated/abi/DataPortabilityPermissionsImplementation.js';
|
|
3
7
|
import '../generated/abi/DataPortabilityServersImplementation.js';
|
|
4
8
|
import '../generated/abi/DataPortabilityGranteesImplementation.js';
|
|
9
|
+
import '../generated/abi/DataRefinerRegistryImplementation.js';
|
|
10
|
+
import '../generated/abi/QueryEngineImplementation.js';
|
|
11
|
+
import '../generated/abi/ComputeInstructionRegistryImplementation.js';
|
|
12
|
+
import '../generated/abi/TeePoolEphemeralStandardImplementation.js';
|
|
13
|
+
import '../generated/abi/TeePoolPersistentStandardImplementation.js';
|
|
14
|
+
import '../generated/abi/TeePoolPersistentGpuImplementation.js';
|
|
15
|
+
import '../generated/abi/TeePoolDedicatedStandardImplementation.js';
|
|
16
|
+
import '../generated/abi/TeePoolDedicatedGpuImplementation.js';
|
|
5
17
|
import '../generated/abi/VanaEpochImplementation.js';
|
|
6
18
|
import '../generated/abi/DLPRegistryImplementation.js';
|
|
7
19
|
import '../generated/abi/DLPTreasuryImplementation.js';
|
|
8
20
|
import '../generated/abi/DLPRewardDeployerTreasuryImplementation.js';
|
|
9
21
|
import '../generated/abi/DLPPerformanceImplementation.js';
|
|
10
22
|
import '../generated/abi/DLPRewardDeployerImplementation.js';
|
|
23
|
+
import '../generated/abi/DLPRewardSwapImplementation.js';
|
|
24
|
+
import '../generated/abi/SwapHelperImplementation.js';
|
|
11
25
|
import '../generated/abi/DLPRootImplementation.js';
|
|
12
26
|
import '../generated/abi/DataLiquidityPoolImplementation.js';
|
|
13
27
|
import '../generated/abi/DLPRegistryTreasuryImplementation.js';
|
|
28
|
+
import '../generated/abi/VanaPoolStakingImplementation.js';
|
|
29
|
+
import '../generated/abi/VanaPoolEntityImplementation.js';
|
|
30
|
+
import '../generated/abi/VanaPoolTreasuryImplementation.js';
|
|
31
|
+
import '../generated/abi/DATImplementation.js';
|
|
32
|
+
import '../generated/abi/DATFactoryImplementation.js';
|
|
33
|
+
import '../generated/abi/DATPausableImplementation.js';
|
|
34
|
+
import '../generated/abi/DATVotesImplementation.js';
|
|
14
35
|
|
|
15
36
|
/**
|
|
16
37
|
* Registry of all Vana protocol smart contract addresses organized by contract name and chain ID.
|
|
@@ -5,18 +5,39 @@ import { VanaContract, ContractAbis } from '../generated/abi/index.cjs';
|
|
|
5
5
|
import { VanaChainId } from '../types/chains.cjs';
|
|
6
6
|
import { ContractInfo } from '../types/contracts.cjs';
|
|
7
7
|
import { createClient } from '../core/client.cjs';
|
|
8
|
+
import '../generated/abi/ComputeEngineImplementation.cjs';
|
|
9
|
+
import '../generated/abi/DataRegistryImplementation.cjs';
|
|
10
|
+
import '../generated/abi/TeePoolImplementation.cjs';
|
|
11
|
+
import '../generated/abi/TeePoolPhalaImplementation.cjs';
|
|
8
12
|
import '../generated/abi/DataPortabilityPermissionsImplementation.cjs';
|
|
9
13
|
import '../generated/abi/DataPortabilityServersImplementation.cjs';
|
|
10
14
|
import '../generated/abi/DataPortabilityGranteesImplementation.cjs';
|
|
15
|
+
import '../generated/abi/DataRefinerRegistryImplementation.cjs';
|
|
16
|
+
import '../generated/abi/QueryEngineImplementation.cjs';
|
|
17
|
+
import '../generated/abi/ComputeInstructionRegistryImplementation.cjs';
|
|
18
|
+
import '../generated/abi/TeePoolEphemeralStandardImplementation.cjs';
|
|
19
|
+
import '../generated/abi/TeePoolPersistentStandardImplementation.cjs';
|
|
20
|
+
import '../generated/abi/TeePoolPersistentGpuImplementation.cjs';
|
|
21
|
+
import '../generated/abi/TeePoolDedicatedStandardImplementation.cjs';
|
|
22
|
+
import '../generated/abi/TeePoolDedicatedGpuImplementation.cjs';
|
|
11
23
|
import '../generated/abi/VanaEpochImplementation.cjs';
|
|
12
24
|
import '../generated/abi/DLPRegistryImplementation.cjs';
|
|
13
25
|
import '../generated/abi/DLPTreasuryImplementation.cjs';
|
|
14
26
|
import '../generated/abi/DLPRewardDeployerTreasuryImplementation.cjs';
|
|
15
27
|
import '../generated/abi/DLPPerformanceImplementation.cjs';
|
|
16
28
|
import '../generated/abi/DLPRewardDeployerImplementation.cjs';
|
|
29
|
+
import '../generated/abi/DLPRewardSwapImplementation.cjs';
|
|
30
|
+
import '../generated/abi/SwapHelperImplementation.cjs';
|
|
17
31
|
import '../generated/abi/DLPRootImplementation.cjs';
|
|
18
32
|
import '../generated/abi/DataLiquidityPoolImplementation.cjs';
|
|
19
33
|
import '../generated/abi/DLPRegistryTreasuryImplementation.cjs';
|
|
34
|
+
import '../generated/abi/VanaPoolStakingImplementation.cjs';
|
|
35
|
+
import '../generated/abi/VanaPoolEntityImplementation.cjs';
|
|
36
|
+
import '../generated/abi/VanaPoolTreasuryImplementation.cjs';
|
|
37
|
+
import '../generated/abi/DATImplementation.cjs';
|
|
38
|
+
import '../generated/abi/DATFactoryImplementation.cjs';
|
|
39
|
+
import '../generated/abi/DATPausableImplementation.cjs';
|
|
40
|
+
import '../generated/abi/DATVotesImplementation.cjs';
|
|
20
41
|
import '../config/chains.cjs';
|
|
21
42
|
|
|
22
43
|
declare const __contractCache: Map<string, {
|
|
@@ -5,18 +5,39 @@ import { VanaContract, ContractAbis } from '../generated/abi/index.js';
|
|
|
5
5
|
import { VanaChainId } from '../types/chains.js';
|
|
6
6
|
import { ContractInfo } from '../types/contracts.js';
|
|
7
7
|
import { createClient } from '../core/client.js';
|
|
8
|
+
import '../generated/abi/ComputeEngineImplementation.js';
|
|
9
|
+
import '../generated/abi/DataRegistryImplementation.js';
|
|
10
|
+
import '../generated/abi/TeePoolImplementation.js';
|
|
11
|
+
import '../generated/abi/TeePoolPhalaImplementation.js';
|
|
8
12
|
import '../generated/abi/DataPortabilityPermissionsImplementation.js';
|
|
9
13
|
import '../generated/abi/DataPortabilityServersImplementation.js';
|
|
10
14
|
import '../generated/abi/DataPortabilityGranteesImplementation.js';
|
|
15
|
+
import '../generated/abi/DataRefinerRegistryImplementation.js';
|
|
16
|
+
import '../generated/abi/QueryEngineImplementation.js';
|
|
17
|
+
import '../generated/abi/ComputeInstructionRegistryImplementation.js';
|
|
18
|
+
import '../generated/abi/TeePoolEphemeralStandardImplementation.js';
|
|
19
|
+
import '../generated/abi/TeePoolPersistentStandardImplementation.js';
|
|
20
|
+
import '../generated/abi/TeePoolPersistentGpuImplementation.js';
|
|
21
|
+
import '../generated/abi/TeePoolDedicatedStandardImplementation.js';
|
|
22
|
+
import '../generated/abi/TeePoolDedicatedGpuImplementation.js';
|
|
11
23
|
import '../generated/abi/VanaEpochImplementation.js';
|
|
12
24
|
import '../generated/abi/DLPRegistryImplementation.js';
|
|
13
25
|
import '../generated/abi/DLPTreasuryImplementation.js';
|
|
14
26
|
import '../generated/abi/DLPRewardDeployerTreasuryImplementation.js';
|
|
15
27
|
import '../generated/abi/DLPPerformanceImplementation.js';
|
|
16
28
|
import '../generated/abi/DLPRewardDeployerImplementation.js';
|
|
29
|
+
import '../generated/abi/DLPRewardSwapImplementation.js';
|
|
30
|
+
import '../generated/abi/SwapHelperImplementation.js';
|
|
17
31
|
import '../generated/abi/DLPRootImplementation.js';
|
|
18
32
|
import '../generated/abi/DataLiquidityPoolImplementation.js';
|
|
19
33
|
import '../generated/abi/DLPRegistryTreasuryImplementation.js';
|
|
34
|
+
import '../generated/abi/VanaPoolStakingImplementation.js';
|
|
35
|
+
import '../generated/abi/VanaPoolEntityImplementation.js';
|
|
36
|
+
import '../generated/abi/VanaPoolTreasuryImplementation.js';
|
|
37
|
+
import '../generated/abi/DATImplementation.js';
|
|
38
|
+
import '../generated/abi/DATFactoryImplementation.js';
|
|
39
|
+
import '../generated/abi/DATPausableImplementation.js';
|
|
40
|
+
import '../generated/abi/DATVotesImplementation.js';
|
|
20
41
|
import '../config/chains.js';
|
|
21
42
|
|
|
22
43
|
declare const __contractCache: Map<string, {
|
|
@@ -130,12 +130,17 @@ class DataController {
|
|
|
130
130
|
userAddress
|
|
131
131
|
);
|
|
132
132
|
} else {
|
|
133
|
-
|
|
133
|
+
const txResult = await this.addFileWithPermissionsAndSchema(
|
|
134
134
|
uploadResult.url,
|
|
135
135
|
userAddress,
|
|
136
136
|
encryptedPermissions,
|
|
137
137
|
schemaId || 0
|
|
138
138
|
);
|
|
139
|
+
result = {
|
|
140
|
+
fileId: 0,
|
|
141
|
+
// Placeholder - actual fileId available after waiting for events
|
|
142
|
+
transactionHash: txResult.hash
|
|
143
|
+
};
|
|
139
144
|
}
|
|
140
145
|
return {
|
|
141
146
|
fileId: result.fileId,
|
|
@@ -453,10 +458,11 @@ class DataController {
|
|
|
453
458
|
if (proof.dlp?.id) {
|
|
454
459
|
const fileId = parseInt(proof.fileId);
|
|
455
460
|
const dlpId = parseInt(proof.dlp.id);
|
|
456
|
-
|
|
457
|
-
|
|
461
|
+
let dlpIds = proofMap.get(fileId);
|
|
462
|
+
if (!dlpIds) {
|
|
463
|
+
dlpIds = [];
|
|
464
|
+
proofMap.set(fileId, dlpIds);
|
|
458
465
|
}
|
|
459
|
-
const dlpIds = proofMap.get(fileId);
|
|
460
466
|
if (!dlpIds.includes(dlpId)) {
|
|
461
467
|
dlpIds.push(dlpId);
|
|
462
468
|
}
|
|
@@ -1263,27 +1269,23 @@ class DataController {
|
|
|
1263
1269
|
}
|
|
1264
1270
|
const dataRegistryAddress = (0, import_addresses.getContractAddress)(chainId, "DataRegistry");
|
|
1265
1271
|
const dataRegistryAbi = (0, import_abi.getAbi)("DataRegistry");
|
|
1266
|
-
const
|
|
1267
|
-
const
|
|
1272
|
+
const account = this.context.walletClient.account || await this.getUserAddress();
|
|
1273
|
+
const from = typeof account === "string" ? account : account.address;
|
|
1274
|
+
const hash = await this.context.walletClient.writeContract({
|
|
1268
1275
|
address: dataRegistryAddress,
|
|
1269
1276
|
abi: dataRegistryAbi,
|
|
1270
1277
|
functionName: "addFileWithSchema",
|
|
1271
1278
|
args: [url, BigInt(schemaId)],
|
|
1272
|
-
account
|
|
1279
|
+
account,
|
|
1273
1280
|
chain: this.context.walletClient.chain || null
|
|
1274
1281
|
});
|
|
1275
|
-
const
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
const eventData = parseFileAddedEvent(receipt);
|
|
1283
|
-
return {
|
|
1284
|
-
fileId: Number(eventData.fileId),
|
|
1285
|
-
transactionHash: txHash
|
|
1286
|
-
};
|
|
1282
|
+
const { tx } = await import("../utils/transactionHelpers");
|
|
1283
|
+
return tx({
|
|
1284
|
+
hash,
|
|
1285
|
+
from,
|
|
1286
|
+
contract: "DataRegistry",
|
|
1287
|
+
fn: "addFileWithSchema"
|
|
1288
|
+
});
|
|
1287
1289
|
} catch (error) {
|
|
1288
1290
|
console.error("Failed to register file with schema:", error);
|
|
1289
1291
|
throw new Error(
|
|
@@ -1328,26 +1330,23 @@ class DataController {
|
|
|
1328
1330
|
}
|
|
1329
1331
|
const dataRegistryAddress = (0, import_addresses.getContractAddress)(chainId, "DataRegistry");
|
|
1330
1332
|
const dataRegistryAbi = (0, import_abi.getAbi)("DataRegistry");
|
|
1331
|
-
const
|
|
1333
|
+
const account = this.context.walletClient.account || ownerAddress;
|
|
1334
|
+
const from = typeof account === "string" ? account : account.address;
|
|
1335
|
+
const hash = await this.context.walletClient.writeContract({
|
|
1332
1336
|
address: dataRegistryAddress,
|
|
1333
1337
|
abi: dataRegistryAbi,
|
|
1334
1338
|
functionName: "addFileWithPermissions",
|
|
1335
1339
|
args: [url, ownerAddress, permissions],
|
|
1336
|
-
account
|
|
1340
|
+
account,
|
|
1337
1341
|
chain: this.context.walletClient.chain || null
|
|
1338
1342
|
});
|
|
1339
|
-
const
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
const eventData = parseFileAddedEvent(receipt);
|
|
1347
|
-
return {
|
|
1348
|
-
fileId: Number(eventData.fileId),
|
|
1349
|
-
transactionHash: txHash
|
|
1350
|
-
};
|
|
1343
|
+
const { tx } = await import("../utils/transactionHelpers");
|
|
1344
|
+
return tx({
|
|
1345
|
+
hash,
|
|
1346
|
+
from,
|
|
1347
|
+
contract: "DataRegistry",
|
|
1348
|
+
fn: "addFileWithPermissions"
|
|
1349
|
+
});
|
|
1351
1350
|
} catch (error) {
|
|
1352
1351
|
console.error("Failed to add file with permissions:", error);
|
|
1353
1352
|
throw new Error(
|
|
@@ -1377,26 +1376,23 @@ class DataController {
|
|
|
1377
1376
|
}
|
|
1378
1377
|
const dataRegistryAddress = (0, import_addresses.getContractAddress)(chainId, "DataRegistry");
|
|
1379
1378
|
const dataRegistryAbi = (0, import_abi.getAbi)("DataRegistry");
|
|
1380
|
-
const
|
|
1379
|
+
const account = this.context.walletClient.account || ownerAddress;
|
|
1380
|
+
const from = typeof account === "string" ? account : account.address;
|
|
1381
|
+
const hash = await this.context.walletClient.writeContract({
|
|
1381
1382
|
address: dataRegistryAddress,
|
|
1382
1383
|
abi: dataRegistryAbi,
|
|
1383
1384
|
functionName: "addFileWithPermissionsAndSchema",
|
|
1384
1385
|
args: [url, ownerAddress, permissions, BigInt(schemaId)],
|
|
1385
|
-
account
|
|
1386
|
+
account,
|
|
1386
1387
|
chain: this.context.walletClient.chain || null
|
|
1387
1388
|
});
|
|
1388
|
-
const
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
const eventData = parseFileAddedEvent(receipt);
|
|
1396
|
-
return {
|
|
1397
|
-
fileId: Number(eventData.fileId),
|
|
1398
|
-
transactionHash: txHash
|
|
1399
|
-
};
|
|
1389
|
+
const { tx } = await import("../utils/transactionHelpers");
|
|
1390
|
+
return tx({
|
|
1391
|
+
hash,
|
|
1392
|
+
from,
|
|
1393
|
+
contract: "DataRegistry",
|
|
1394
|
+
fn: "addFileWithPermissionsAndSchema"
|
|
1395
|
+
});
|
|
1400
1396
|
} catch (error) {
|
|
1401
1397
|
console.error("Failed to add file with permissions and schema:", error);
|
|
1402
1398
|
throw new Error(
|
|
@@ -1443,7 +1439,9 @@ class DataController {
|
|
|
1443
1439
|
"DataRefinerRegistry"
|
|
1444
1440
|
);
|
|
1445
1441
|
const dataRefinerRegistryAbi = (0, import_abi.getAbi)("DataRefinerRegistry");
|
|
1446
|
-
const
|
|
1442
|
+
const account = this.context.walletClient.account || await this.getUserAddress();
|
|
1443
|
+
const from = typeof account === "string" ? account : account.address;
|
|
1444
|
+
const hash = await this.context.walletClient.writeContract({
|
|
1447
1445
|
address: dataRefinerRegistryAddress,
|
|
1448
1446
|
abi: dataRefinerRegistryAbi,
|
|
1449
1447
|
functionName: "addRefinerWithSchemaId",
|
|
@@ -1453,20 +1451,27 @@ class DataController {
|
|
|
1453
1451
|
BigInt(params.schemaId),
|
|
1454
1452
|
params.refinementInstructionUrl
|
|
1455
1453
|
],
|
|
1456
|
-
account
|
|
1454
|
+
account,
|
|
1457
1455
|
chain: this.context.walletClient.chain || null
|
|
1458
1456
|
});
|
|
1459
|
-
const
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1457
|
+
const { tx } = await import("../utils/transactionHelpers");
|
|
1458
|
+
const txResult = tx({
|
|
1459
|
+
hash,
|
|
1460
|
+
from,
|
|
1461
|
+
contract: "DataRefinerRegistry",
|
|
1462
|
+
fn: "addRefinerWithSchemaId"
|
|
1463
|
+
});
|
|
1464
|
+
if (!this.context.waitForTransactionEvents) {
|
|
1465
|
+
throw new Error("waitForTransactionEvents not configured");
|
|
1466
|
+
}
|
|
1467
|
+
const result = await this.context.waitForTransactionEvents(txResult);
|
|
1468
|
+
const event = result.expectedEvents.RefinerAdded;
|
|
1469
|
+
if (!event) {
|
|
1470
|
+
throw new Error("RefinerAdded event not found in transaction");
|
|
1471
|
+
}
|
|
1467
1472
|
return {
|
|
1468
|
-
refinerId: Number(
|
|
1469
|
-
transactionHash:
|
|
1473
|
+
refinerId: Number(event.refinerId),
|
|
1474
|
+
transactionHash: hash
|
|
1470
1475
|
};
|
|
1471
1476
|
} catch (error) {
|
|
1472
1477
|
console.error("Failed to add refiner:", error);
|
|
@@ -1649,20 +1654,18 @@ class DataController {
|
|
|
1649
1654
|
"DataRefinerRegistry"
|
|
1650
1655
|
);
|
|
1651
1656
|
const dataRefinerRegistryAbi = (0, import_abi.getAbi)("DataRefinerRegistry");
|
|
1652
|
-
const
|
|
1657
|
+
const account = this.context.walletClient.account || await this.getUserAddress();
|
|
1658
|
+
const hash = await this.context.walletClient.writeContract({
|
|
1653
1659
|
address: dataRefinerRegistryAddress,
|
|
1654
1660
|
abi: dataRefinerRegistryAbi,
|
|
1655
1661
|
functionName: "updateSchemaId",
|
|
1656
1662
|
args: [BigInt(params.refinerId), BigInt(params.newSchemaId)],
|
|
1657
|
-
account
|
|
1663
|
+
account,
|
|
1658
1664
|
chain: this.context.walletClient.chain || null
|
|
1659
1665
|
});
|
|
1660
|
-
await this.context.publicClient.waitForTransactionReceipt({
|
|
1661
|
-
hash: txHash,
|
|
1662
|
-
timeout: 3e4
|
|
1663
|
-
});
|
|
1666
|
+
await this.context.publicClient.waitForTransactionReceipt({ hash });
|
|
1664
1667
|
return {
|
|
1665
|
-
transactionHash:
|
|
1668
|
+
transactionHash: hash
|
|
1666
1669
|
};
|
|
1667
1670
|
} catch (error) {
|
|
1668
1671
|
console.error("Failed to update schema ID:", error);
|
|
@@ -1714,26 +1717,32 @@ class DataController {
|
|
|
1714
1717
|
};
|
|
1715
1718
|
})
|
|
1716
1719
|
);
|
|
1717
|
-
let result;
|
|
1718
1720
|
if (this.context.relayerCallbacks?.submitFileAdditionWithPermissions) {
|
|
1719
|
-
result = await this.context.relayerCallbacks.submitFileAdditionWithPermissions(
|
|
1721
|
+
const result = await this.context.relayerCallbacks.submitFileAdditionWithPermissions(
|
|
1720
1722
|
uploadResult.url,
|
|
1721
1723
|
userAddress,
|
|
1722
1724
|
encryptedPermissions
|
|
1723
1725
|
);
|
|
1726
|
+
return {
|
|
1727
|
+
fileId: result.fileId,
|
|
1728
|
+
url: uploadResult.url,
|
|
1729
|
+
size: uploadResult.size,
|
|
1730
|
+
transactionHash: result.transactionHash
|
|
1731
|
+
};
|
|
1724
1732
|
} else {
|
|
1725
|
-
|
|
1733
|
+
const txResult = await this.addFileWithPermissions(
|
|
1726
1734
|
uploadResult.url,
|
|
1727
1735
|
userAddress,
|
|
1728
1736
|
encryptedPermissions
|
|
1729
1737
|
);
|
|
1738
|
+
return {
|
|
1739
|
+
fileId: 0,
|
|
1740
|
+
// Placeholder - user must wait for events to get actual fileId
|
|
1741
|
+
url: uploadResult.url,
|
|
1742
|
+
size: uploadResult.size,
|
|
1743
|
+
transactionHash: txResult.hash
|
|
1744
|
+
};
|
|
1730
1745
|
}
|
|
1731
|
-
return {
|
|
1732
|
-
fileId: result.fileId,
|
|
1733
|
-
url: uploadResult.url,
|
|
1734
|
-
size: uploadResult.size,
|
|
1735
|
-
transactionHash: result.transactionHash
|
|
1736
|
-
};
|
|
1737
1746
|
} catch (error) {
|
|
1738
1747
|
console.error("Failed to upload file with permissions:", error);
|
|
1739
1748
|
throw new Error(
|
|
@@ -1880,18 +1889,22 @@ class DataController {
|
|
|
1880
1889
|
}
|
|
1881
1890
|
const dataRegistryAddress = (0, import_addresses.getContractAddress)(chainId, "DataRegistry");
|
|
1882
1891
|
const dataRegistryAbi = (0, import_abi.getAbi)("DataRegistry");
|
|
1892
|
+
const walletAccount = this.context.walletClient.account || await this.getUserAddress();
|
|
1883
1893
|
const txHash = await this.context.walletClient.writeContract({
|
|
1884
1894
|
address: dataRegistryAddress,
|
|
1885
1895
|
abi: dataRegistryAbi,
|
|
1886
1896
|
functionName: "addFilePermission",
|
|
1887
1897
|
args: [BigInt(fileId), account, encryptedKey],
|
|
1888
|
-
account:
|
|
1898
|
+
account: walletAccount,
|
|
1889
1899
|
chain: this.context.walletClient.chain || null
|
|
1890
1900
|
});
|
|
1891
|
-
|
|
1901
|
+
const { tx } = await import("../utils/transactionHelpers");
|
|
1902
|
+
return tx({
|
|
1892
1903
|
hash: txHash,
|
|
1893
|
-
from:
|
|
1894
|
-
|
|
1904
|
+
from: typeof walletAccount === "string" ? walletAccount : walletAccount.address,
|
|
1905
|
+
contract: "DataRegistry",
|
|
1906
|
+
fn: "addFilePermission"
|
|
1907
|
+
});
|
|
1895
1908
|
} catch (error) {
|
|
1896
1909
|
console.error("Failed to add permission to file:", error);
|
|
1897
1910
|
throw new Error(
|