@xandeum/web3.js 0.5.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/bigbang.d.ts +2 -1
  2. package/dist/bigbang.js +7 -1
  3. package/dist/find.d.ts +1 -1
  4. package/dist/find.js +2 -2
  5. package/dist/index.d.ts +1 -0
  6. package/dist/index.js +3 -1
  7. package/docs/html/assets/navigation.js +1 -1
  8. package/docs/html/assets/search.js +1 -1
  9. package/docs/html/functions/armageddon.html +2 -2
  10. package/docs/html/functions/assignCoowner.html +2 -2
  11. package/docs/html/functions/bigbang.html +4 -3
  12. package/docs/html/functions/copyPath.html +2 -2
  13. package/docs/html/functions/createDirectory.html +2 -2
  14. package/docs/html/functions/createFile.html +2 -2
  15. package/docs/html/functions/exists.html +2 -2
  16. package/docs/html/functions/find.html +10 -0
  17. package/docs/html/functions/getMetadata.html +2 -2
  18. package/docs/html/functions/getXandeumResult.html +2 -2
  19. package/docs/html/functions/listDirectoryEntry.html +2 -2
  20. package/docs/html/functions/move.html +2 -2
  21. package/docs/html/functions/peek.html +2 -2
  22. package/docs/html/functions/poke.html +2 -2
  23. package/docs/html/functions/removeDirectory.html +2 -2
  24. package/docs/html/functions/removeFile.html +2 -2
  25. package/docs/html/functions/renamePath.html +2 -2
  26. package/docs/html/functions/subscribeResult.html +2 -2
  27. package/docs/html/functions/unsubscribeResult.html +2 -2
  28. package/docs/html/hierarchy.html +1 -1
  29. package/docs/html/index.html +2 -2
  30. package/docs/html/modules.html +1 -1
  31. package/docs/markdown/README.md +1 -1
  32. package/docs/markdown/functions/armageddon.md +2 -2
  33. package/docs/markdown/functions/assignCoowner.md +2 -2
  34. package/docs/markdown/functions/bigbang.md +9 -3
  35. package/docs/markdown/functions/copyPath.md +2 -2
  36. package/docs/markdown/functions/createDirectory.md +2 -2
  37. package/docs/markdown/functions/createFile.md +2 -2
  38. package/docs/markdown/functions/exists.md +2 -2
  39. package/docs/markdown/functions/find.md +44 -0
  40. package/docs/markdown/functions/getMetadata.md +2 -2
  41. package/docs/markdown/functions/getXandeumResult.md +2 -2
  42. package/docs/markdown/functions/listDirectoryEntry.md +2 -2
  43. package/docs/markdown/functions/move.md +2 -2
  44. package/docs/markdown/functions/peek.md +2 -2
  45. package/docs/markdown/functions/poke.md +2 -2
  46. package/docs/markdown/functions/removeDirectory.md +2 -2
  47. package/docs/markdown/functions/removeFile.md +2 -2
  48. package/docs/markdown/functions/renamePath.md +2 -2
  49. package/docs/markdown/functions/subscribeResult.md +2 -2
  50. package/docs/markdown/functions/unsubscribeResult.md +2 -2
  51. package/docs/markdown/globals.md +3 -2
  52. package/docs/markdown/summary.md +49 -0
  53. package/package.json +1 -1
  54. package/src/bigbang.ts +4 -1
  55. package/src/find.ts +53 -0
  56. package/src/index.ts +1 -0
  57. package/typedoc.json +1 -1
@@ -1,4 +1,4 @@
1
- [**Xandeum Web3 Library v0.5.0**](../README.md)
1
+ [**Xandeum Web3 Library v0.8.0**](../README.md)
2
2
 
3
3
  ***
4
4
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **poke**(`fsid`, `path`, `position`, `wallet`, `dataKey`): `Promise`\<`Transaction`\>
10
10
 
11
- Defined in: [poke.ts:19](https://github.com/Xandeum/xandeum-web3.js/blob/ingolstadt/src/poke.ts#L19)
11
+ Defined in: [poke.ts:19](https://github.com/Xandeum/xandeum-web3.js/blob/master/src/poke.ts#L19)
12
12
 
13
13
  Constructs a Solana transaction to perform a poke\operation, which writes data
14
14
  to a file at the specified path and byte position.
@@ -1,4 +1,4 @@
1
- [**Xandeum Web3 Library v0.5.0**](../README.md)
1
+ [**Xandeum Web3 Library v0.8.0**](../README.md)
2
2
 
3
3
  ***
4
4
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **removeDirectory**(`fsid`, `path`, `wallet`): `Promise`\<`Transaction`\>
10
10
 
11
- Defined in: [removeDirectory.ts:17](https://github.com/Xandeum/xandeum-web3.js/blob/ingolstadt/src/removeDirectory.ts#L17)
11
+ Defined in: [removeDirectory.ts:17](https://github.com/Xandeum/xandeum-web3.js/blob/master/src/removeDirectory.ts#L17)
12
12
 
13
13
  Constructs a Solana transaction to perform a "remove directory" operation
14
14
  in a file system, identified by a file system ID (`fsid`).
@@ -1,4 +1,4 @@
1
- [**Xandeum Web3 Library v0.5.0**](../README.md)
1
+ [**Xandeum Web3 Library v0.8.0**](../README.md)
2
2
 
3
3
  ***
4
4
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **removeFile**(`fsid`, `path`, `wallet`): `Promise`\<`Transaction`\>
10
10
 
11
- Defined in: [removeFile.ts:17](https://github.com/Xandeum/xandeum-web3.js/blob/ingolstadt/src/removeFile.ts#L17)
11
+ Defined in: [removeFile.ts:17](https://github.com/Xandeum/xandeum-web3.js/blob/master/src/removeFile.ts#L17)
12
12
 
13
13
  Constructs a Solana transaction to remove a file from a file system,
14
14
  identified by a file system ID (`fsid`) and a UTF-8 encoded file path.
@@ -1,4 +1,4 @@
1
- [**Xandeum Web3 Library v0.5.0**](../README.md)
1
+ [**Xandeum Web3 Library v0.8.0**](../README.md)
2
2
 
3
3
  ***
4
4
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **renamePath**(`fsid`, `oldPath`, `name`, `wallet`): `Promise`\<`Transaction`\>
10
10
 
11
- Defined in: [renamePath.ts:18](https://github.com/Xandeum/xandeum-web3.js/blob/ingolstadt/src/renamePath.ts#L18)
11
+ Defined in: [renamePath.ts:18](https://github.com/Xandeum/xandeum-web3.js/blob/master/src/renamePath.ts#L18)
12
12
 
13
13
  Constructs a Solana transaction to rename (or move) a file or directory
14
14
  within a file system, based on a provided file system ID (`fsid`).
@@ -1,4 +1,4 @@
1
- [**Xandeum Web3 Library v0.5.0**](../README.md)
1
+ [**Xandeum Web3 Library v0.8.0**](../README.md)
2
2
 
3
3
  ***
4
4
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **subscribeResult**(`connection`, `tx`, `onResult`, `onError?`, `onClose?`): `void`
10
10
 
11
- Defined in: [webSocket.ts:40](https://github.com/Xandeum/xandeum-web3.js/blob/ingolstadt/src/webSocket.ts#L40)
11
+ Defined in: [webSocket.ts:40](https://github.com/Xandeum/xandeum-web3.js/blob/master/src/webSocket.ts#L40)
12
12
 
13
13
  Opens a WebSocket connection and subscribes to the result of a transaction
14
14
  via the custom `xandeumResultSubscribe` method.
@@ -1,4 +1,4 @@
1
- [**Xandeum Web3 Library v0.5.0**](../README.md)
1
+ [**Xandeum Web3 Library v0.8.0**](../README.md)
2
2
 
3
3
  ***
4
4
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **unsubscribeResult**(`connection`, `subscriptionId`): `void`
10
10
 
11
- Defined in: [webSocket.ts:103](https://github.com/Xandeum/xandeum-web3.js/blob/ingolstadt/src/webSocket.ts#L103)
11
+ Defined in: [webSocket.ts:103](https://github.com/Xandeum/xandeum-web3.js/blob/master/src/webSocket.ts#L103)
12
12
 
13
13
  Sends a WebSocket JSON-RPC message to unsubscribe from a previously subscribed transaction result
14
14
  using the `xandeumResultUnsubscribed` method (note: custom method, ensure server-side implementation matches).
@@ -1,8 +1,8 @@
1
- [**Xandeum Web3 Library v0.5.0**](README.md)
1
+ [**Xandeum Web3 Library v0.8.0**](README.md)
2
2
 
3
3
  ***
4
4
 
5
- # Xandeum Web3 Library v0.5.0
5
+ # Xandeum Web3 Library v0.8.0
6
6
 
7
7
  ## Functions
8
8
 
@@ -13,6 +13,7 @@
13
13
  - [createDirectory](functions/createDirectory.md)
14
14
  - [createFile](functions/createFile.md)
15
15
  - [exists](functions/exists.md)
16
+ - [find](functions/find.md)
16
17
  - [getMetadata](functions/getMetadata.md)
17
18
  - [getXandeumResult](functions/getXandeumResult.md)
18
19
  - [listDirectoryEntry](functions/listDirectoryEntry.md)
@@ -0,0 +1,49 @@
1
+ # Summary
2
+
3
+ ## Getting Started
4
+
5
+ * [Introduction](README.md)
6
+ * [Globals](globals.md)
7
+
8
+ ## Core Functions
9
+
10
+ ### File System Management
11
+
12
+ * [bigbang](functions/bigbang.md)
13
+ * [armageddon](functions/armageddon.md)
14
+
15
+ ### File Operations
16
+
17
+ * [createFile](functions/createFile.md)
18
+ * [removeFile](functions/removeFile.md)
19
+ * [copyPath](functions/copyPath.md)
20
+ * [renamePath](functions/renamePath.md)
21
+ * [move](functions/move.md)
22
+
23
+ ### Directory Operations
24
+
25
+ * [createDirectory](functions/createDirectory.md)
26
+ * [removeDirectory](functions/removeDirectory.md)
27
+ * [listDirectoryEntry](functions/listDirectoryEntry.md)
28
+
29
+ ### File Content Operations
30
+
31
+ * [peek](functions/peek.md)
32
+ * [poke](functions/poke.md)
33
+
34
+ ### Search & Query
35
+
36
+ * [find](functions/find.md)
37
+
38
+ ### Metadata & Utilities
39
+
40
+ * [exists](functions/exists.md)
41
+ * [getMetadata](functions/getMetadata.md)
42
+ * [getXandeumResult](functions/getXandeumResult.md)
43
+ * [assignCoowner](functions/assignCoowner.md)
44
+
45
+ ### WebSocket Functions
46
+
47
+ * [subscribeResult](functions/subscribeResult.md)
48
+ * [unsubscribeResult](functions/unsubscribeResult.md)
49
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xandeum/web3.js",
3
- "version": "0.5.0",
3
+ "version": "0.8.0",
4
4
  "description": "Xandeum javascript api",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/bigbang.ts CHANGED
@@ -1,15 +1,18 @@
1
1
  import { Transaction, TransactionInstruction, PublicKey } from '@solana/web3.js'
2
+ import BN from 'bn.js'
2
3
  import { programId } from './const'
3
4
 
4
5
  /**
5
6
  * Constructs a Solana transaction that triggers the "bigbang" instruction and create new file system.
6
7
  *
7
8
  * @param wallet - The public key of the wallet that will sign and authorize the transaction.
9
+ * @param replica_count - A stringified integer representing the number of replicas for the new file system.
8
10
  * @returns A Promise that resolves to a Solana `Transaction` object containing the bigbang instruction.
9
11
  */
10
- export async function bigbang (wallet: PublicKey): Promise<Transaction> {
12
+ export async function bigbang(replica_count:string,wallet: PublicKey): Promise<Transaction> {
11
13
  const instructionData = Buffer.concat([
12
14
  Buffer.from(Int8Array.from([0]).buffer),
15
+ Buffer.from(Uint8Array.of(...new BN(replica_count).toArray('le', 8)))
13
16
  ])
14
17
 
15
18
  const instruction = new TransactionInstruction({
package/src/find.ts ADDED
@@ -0,0 +1,53 @@
1
+ import { Connection } from "@solana/web3.js"
2
+
3
+ export interface RpcRequest {
4
+ jsonrpc: string
5
+ id: number
6
+ method: string
7
+ params: any[]
8
+ }
9
+
10
+ /**
11
+ * Sends a JSON-RPC request to the Xandeum RPC endpoint to search for a file or directory
12
+ * within a specified path.
13
+ *
14
+ * This function calls the custom RPC method `find`, which is return an array of
15
+ * directory entry metadata — names, types etc.
16
+ *
17
+ * @param connection - The solana web3 connection with Xandeum-compatible JSON-RPC endpoint (e.g., `'https://api.devnet.solana.com'`).
18
+ * @param path - The filesystem path where the search will be performed (e.g., `/documents`).
19
+ * @param query - The query to search for (e.g., `'myfile.txt'`).
20
+ *
21
+ * @returns A `Promise<any>` resolving to the parsed JSON response from the RPC server,
22
+ * typically including a `result` array containing directory entry objects.
23
+ */
24
+
25
+ export async function find (
26
+ connection: Connection,
27
+ path: string,
28
+ query: string,
29
+ ): Promise<any> {
30
+ const url = connection.rpcEndpoint;
31
+ const requestBody: RpcRequest = {
32
+ jsonrpc: '2.0',
33
+ id: 1,
34
+ method: 'find',
35
+ params: [path,query]
36
+ }
37
+
38
+ const response = await fetch(url, {
39
+ method: 'POST',
40
+ headers: {
41
+ 'Content-Type': 'application/json'
42
+ },
43
+ body: JSON.stringify(requestBody)
44
+ })
45
+
46
+ if (!response.ok) {
47
+ const errorText = await response.text();
48
+ return Error(`error! status: ${response.status}, message: ${errorText}`);
49
+ }
50
+
51
+ const data = await response.json()
52
+ return data
53
+ }
package/src/index.ts CHANGED
@@ -15,3 +15,4 @@ export * from "./assignCoowner";
15
15
  export {exists } from "./exists";
16
16
  export {listDirectoryEntry} from "./listDirectoryEntery";
17
17
  export {getMetadata} from "./getMetadata";
18
+ export {find} from "./find";
package/typedoc.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "excludeInternal": true,
16
16
  "excludeNotDocumented": false,
17
17
  "gitRemote": "origin",
18
- "gitRevision": "ingolstadt",
18
+ "gitRevision": "master",
19
19
  "sourceLinkTemplate": "https://github.com/Xandeum/xandeum-web3.js/blob/{gitRevision}/{path}#L{line}",
20
20
  "visibilityFilters": {
21
21
  "protected": false,