@storagehub/types-bundle 0.1.0 → 0.1.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.
@@ -1,6 +1,6 @@
1
- import { rpcDefinitions } from "./rpc";
2
- import { runtime } from "./runtime";
3
- import { ALL_TYPES } from "./types";
1
+ import { rpcDefinitions } from "./rpc.js";
2
+ import { runtime } from "./runtime.js";
3
+ import { ALL_TYPES } from "./types.js";
4
4
  export const storageHubDefinitions = {
5
5
  rpc: rpcDefinitions,
6
6
  runtime,
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@storagehub/types-bundle",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
+ "type": "module",
4
5
  "description": "Bundle definitions for Polkadot{.js} app & api",
5
6
  "private": false,
6
7
  "scripts": {
package/tsconfig.json CHANGED
@@ -9,6 +9,12 @@
9
9
  "declaration": true,
10
10
  "declarationDir": "dist/types",
11
11
  "allowImportingTsExtensions": false,
12
+ "module": "NodeNext",
13
+ "moduleResolution": "NodeNext",
14
+ "typeRoots": [
15
+ "dist/types",
16
+ "node_modules/@types"
17
+ ],
12
18
  },
13
19
  "exclude": [
14
20
  "node_modules",
@@ -1,21 +0,0 @@
1
- import type { OverrideBundleDefinition, OverrideBundleType } from "@polkadot/types/types";
2
- import { rpcDefinitions } from "./rpc";
3
- import { runtime } from "./runtime";
4
- import { ALL_TYPES } from "./types";
5
-
6
- export const storageHubDefinitions: OverrideBundleDefinition = {
7
- rpc: rpcDefinitions,
8
- runtime,
9
- types: [
10
- {
11
- minmax: [0, undefined],
12
- types: ALL_TYPES
13
- }
14
- ]
15
- };
16
-
17
- export const types: OverrideBundleType = {
18
- spec: {
19
- "storage-hub-runtime": storageHubDefinitions
20
- }
21
- };
package/src/rpc.ts DELETED
@@ -1,58 +0,0 @@
1
- import type { DefinitionRpc, DefinitionRpcSub } from "@polkadot/types/types";
2
-
3
- export const rpcDefinitions: Record<string, Record<string, DefinitionRpc | DefinitionRpcSub>> = {
4
- storagehubclient: {
5
- loadFileInStorage: {
6
- description:
7
- "Load a file in the local storage. This is the first step when uploading a file.",
8
- params: [
9
- {
10
- name: "file_path",
11
- type: "String"
12
- },
13
- {
14
- name: "location",
15
- type: "String"
16
- },
17
- {
18
- name: "owner",
19
- type: "AccountId32"
20
- },
21
- {
22
- name: "bucket_id",
23
- type: "H256"
24
- }
25
- ],
26
- type: "FileMetadata"
27
- },
28
- saveFileToDisk: {
29
- description: "Save a file from the local storage to the disk.",
30
- params: [
31
- {
32
- name: "file_key",
33
- type: "H256"
34
- },
35
- {
36
- name: "file_path",
37
- type: "String"
38
- }
39
- ],
40
- type: "SaveFileToDisk"
41
- },
42
- getForestRoot: {
43
- description: "Get the root of the forest trie.",
44
- params: [],
45
- type: "H256"
46
- },
47
- rotateBcsvKeys: {
48
- description: "Rotate (generate and insert) new keys of BCSV type for the Blockchain Service.",
49
- params: [
50
- {
51
- name: "seed",
52
- type: "String"
53
- }
54
- ],
55
- type: "String"
56
- }
57
- }
58
- };
package/src/runtime.ts DELETED
@@ -1,156 +0,0 @@
1
- import type { DefinitionCall, DefinitionsCall } from "@polkadot/types/types";
2
-
3
- const FILE_SYSTEM_V1: Record<string, DefinitionCall> = {
4
- query_earliest_file_volunteer_block: {
5
- description: "Query the earliest block number that a BSP can volunteer for a file.",
6
- params: [
7
- {
8
- name: "bspId",
9
- type: "BackupStorageProviderId"
10
- },
11
- {
12
- name: "fileKey",
13
- type: "H256"
14
- }
15
- ],
16
- type: "Result<BlockNumber, QueryFileEarliestVolunteerBlockError>"
17
- },
18
- query_bsp_confirm_chunks_to_prove_for_file: {
19
- description: "Query the chunks that a BSP needs to prove to confirm that it is storing a file.",
20
- params: [
21
- {
22
- name: "bspId",
23
- type: "BackupStorageProviderId"
24
- },
25
- {
26
- name: "fileKey",
27
- type: "H256"
28
- }
29
- ],
30
- type: "Result<Vec<ChunkId>, QueryBspConfirmChunksToProveForFileError>"
31
- }
32
- };
33
-
34
- const PROOFS_DEALER_V1: Record<string, DefinitionCall> = {
35
- get_last_tick_provider_submitted_proof: {
36
- description: "Get the last tick for which the submitter submitted a proof.",
37
- params: [
38
- {
39
- name: "providerId",
40
- type: "ProviderId"
41
- }
42
- ],
43
- type: "Result<BlockNumber, GetLastTickProviderSubmittedProofError>"
44
- },
45
- get_last_checkpoint_challenge_tick: {
46
- description: "Get the last checkpoint challenge tick.",
47
- params: [],
48
- type: "BlockNumber"
49
- },
50
- get_checkpoint_challenges: {
51
- description: "Get checkpoint challenges for a given block.",
52
- params: [
53
- {
54
- name: "tick",
55
- type: "BlockNumber"
56
- }
57
- ],
58
- type: "Result<Vec<(Key, Option<TrieRemoveMutation>)>, GetCheckpointChallengesError>"
59
- },
60
- get_challenge_period: {
61
- description: "Get the challenge period for a given Provider.",
62
- params: [
63
- {
64
- name: "providerId",
65
- type: "ProviderId"
66
- }
67
- ],
68
- type: "Result<BlockNumber, GetChallengePeriodError>"
69
- },
70
- get_checkpoint_challenge_period: {
71
- description: "Get the checkpoint challenge period.",
72
- params: [],
73
- type: "BlockNumber"
74
- },
75
- get_challenges_from_seed: {
76
- description: "Get challenges from a seed.",
77
- params: [
78
- {
79
- name: "seed",
80
- type: "RandomnessOutput"
81
- },
82
- {
83
- name: "providerId",
84
- type: "ProviderId"
85
- },
86
- {
87
- name: "count",
88
- type: "u32"
89
- }
90
- ],
91
- type: "Vec<Key>"
92
- },
93
- get_forest_challenges_from_seed: {
94
- description: "Get forest challenges from a seed.",
95
- params: [
96
- {
97
- name: "seed",
98
- type: "RandomnessOutput"
99
- },
100
- {
101
- name: "providerId",
102
- type: "ProviderId"
103
- }
104
- ],
105
- type: "Vec<Key>"
106
- },
107
- get_current_tick: {
108
- description: "Get the current tick.",
109
- params: [],
110
- type: "BlockNumber"
111
- },
112
- get_next_deadline_tick: {
113
- description: "Get the next deadline tick.",
114
- params: [
115
- {
116
- name: "providerId",
117
- type: "ProviderId"
118
- }
119
- ],
120
- type: "Result<BlockNumber, GetNextDeadlineTickError>"
121
- }
122
- };
123
-
124
- const STORAGE_PROVIDERS_V1: Record<string, DefinitionCall> = {
125
- get_bsp_info: {
126
- description: "Get the BSP info for a given BSP ID.",
127
- params: [
128
- {
129
- name: "bspId",
130
- type: "BackupStorageProviderId"
131
- }
132
- ],
133
- type: "Result<BackupStorageProvider, GetBspInfoError>"
134
- }
135
- };
136
-
137
- export const runtime: DefinitionsCall = {
138
- FileSystemApi: [
139
- {
140
- methods: FILE_SYSTEM_V1,
141
- version: 1
142
- }
143
- ],
144
- ProofsDealerApi: [
145
- {
146
- methods: PROOFS_DEALER_V1,
147
- version: 1
148
- }
149
- ],
150
- StorageProvidersApi: [
151
- {
152
- methods: STORAGE_PROVIDERS_V1,
153
- version: 1
154
- }
155
- ]
156
- };
package/src/types.ts DELETED
@@ -1,88 +0,0 @@
1
- import type { RegistryTypes } from "@polkadot/types/types";
2
-
3
- export const ALL_TYPES: RegistryTypes = {
4
- FileMetadata: {
5
- owner: "Vec<u8>",
6
- bucket_id: "Vec<u8>",
7
- location: "Vec<u8>",
8
- file_size: "u64",
9
- fingerprint: "[u8; 32]"
10
- },
11
- IncompleteFileStatus: {
12
- file_metadata: "FileMetadata",
13
- stored_chunks: "u64",
14
- total_chunks: "u64"
15
- },
16
- SaveFileToDisk: {
17
- _enum: {
18
- FileNotFound: null,
19
- Success: "FileMetadata",
20
- IncompleteFile: "IncompleteFileStatus"
21
- }
22
- },
23
- ProviderId: "H256",
24
- Key: "H256",
25
- RandomnessOutput: "H256",
26
- TrieRemoveMutation: {},
27
- BackupStorageProviderId: "H256",
28
- StorageData: "u32",
29
- MerklePatriciaRoot: "H256",
30
- ChunkId: "u64",
31
- BackupStorageProvider: {
32
- capacity: "StorageData",
33
- data_used: "StorageData",
34
- multiaddresses: "BoundedVec<u8, 5>",
35
- root: "MerklePatriciaRoot",
36
- last_capacity_change: "BlockNumber",
37
- owner_account: "AccountId",
38
- payment_account: "AccountId"
39
- },
40
- GetLastTickProviderSubmittedProofError: {
41
- _enum: {
42
- ProviderNotRegistered: null,
43
- ProviderNeverSubmittedProof: null,
44
- InternalApiError: null
45
- }
46
- },
47
- GetCheckpointChallengesError: {
48
- _enum: {
49
- TickGreaterThanLastCheckpointTick: null,
50
- NoCheckpointChallengesInTick: null,
51
- InternalApiError: null
52
- }
53
- },
54
- GetChallengePeriodError: {
55
- _enum: {
56
- ProviderNotRegistered: null
57
- }
58
- },
59
- GetBspInfoError: {
60
- _enum: {
61
- BspNotRegistered: null,
62
- InternalApiError: null
63
- }
64
- },
65
- GetNextDeadlineTickError: {
66
- _enum: {
67
- ProviderNotRegistered: null,
68
- ProviderNotInitialised: null,
69
- ArithmeticOverflow: null,
70
- InternalApiError: null
71
- }
72
- },
73
- QueryFileEarliestVolunteerBlockError: {
74
- _enum: {
75
- FailedToEncodeFingerprint: null,
76
- FailedToEncodeBsp: null,
77
- ThresholdArithmeticError: null,
78
- StorageRequestNotFound: null,
79
- InternalError: null
80
- }
81
- },
82
- QueryBspConfirmChunksToProveForFileError: {
83
- _enum: {
84
- StorageRequestNotFound: null,
85
- InternalError: null
86
- }
87
- }
88
- };