@xandeum/web3.js 0.6.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.
- package/dist/find.d.ts +1 -1
- package/dist/find.js +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/docs/html/assets/navigation.js +1 -1
- package/docs/html/assets/search.js +1 -1
- package/docs/html/functions/armageddon.html +2 -2
- package/docs/html/functions/assignCoowner.html +2 -2
- package/docs/html/functions/bigbang.html +2 -2
- package/docs/html/functions/copyPath.html +2 -2
- package/docs/html/functions/createDirectory.html +2 -2
- package/docs/html/functions/createFile.html +2 -2
- package/docs/html/functions/exists.html +2 -2
- package/docs/html/functions/find.html +10 -0
- package/docs/html/functions/getMetadata.html +2 -2
- package/docs/html/functions/getXandeumResult.html +2 -2
- package/docs/html/functions/listDirectoryEntry.html +2 -2
- package/docs/html/functions/move.html +2 -2
- package/docs/html/functions/peek.html +2 -2
- package/docs/html/functions/poke.html +2 -2
- package/docs/html/functions/removeDirectory.html +2 -2
- package/docs/html/functions/removeFile.html +2 -2
- package/docs/html/functions/renamePath.html +2 -2
- package/docs/html/functions/subscribeResult.html +2 -2
- package/docs/html/functions/unsubscribeResult.html +2 -2
- package/docs/html/hierarchy.html +1 -1
- package/docs/html/index.html +2 -2
- package/docs/html/modules.html +1 -1
- package/docs/markdown/README.md +1 -1
- package/docs/markdown/functions/armageddon.md +2 -2
- package/docs/markdown/functions/assignCoowner.md +2 -2
- package/docs/markdown/functions/bigbang.md +2 -2
- package/docs/markdown/functions/copyPath.md +2 -2
- package/docs/markdown/functions/createDirectory.md +2 -2
- package/docs/markdown/functions/createFile.md +2 -2
- package/docs/markdown/functions/exists.md +2 -2
- package/docs/markdown/functions/find.md +44 -0
- package/docs/markdown/functions/getMetadata.md +2 -2
- package/docs/markdown/functions/getXandeumResult.md +2 -2
- package/docs/markdown/functions/listDirectoryEntry.md +2 -2
- package/docs/markdown/functions/move.md +2 -2
- package/docs/markdown/functions/peek.md +2 -2
- package/docs/markdown/functions/poke.md +2 -2
- package/docs/markdown/functions/removeDirectory.md +2 -2
- package/docs/markdown/functions/removeFile.md +2 -2
- package/docs/markdown/functions/renamePath.md +2 -2
- package/docs/markdown/functions/subscribeResult.md +2 -2
- package/docs/markdown/functions/unsubscribeResult.md +2 -2
- package/docs/markdown/globals.md +3 -2
- package/docs/markdown/summary.md +49 -0
- package/package.json +1 -1
- package/src/bigbang.ts +1 -1
- package/src/find.ts +53 -0
- package/src/index.ts +1 -0
- package/typedoc.json +1 -1
package/docs/markdown/globals.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
[**Xandeum Web3 Library v0.
|
|
1
|
+
[**Xandeum Web3 Library v0.8.0**](README.md)
|
|
2
2
|
|
|
3
3
|
***
|
|
4
4
|
|
|
5
|
-
# Xandeum Web3 Library v0.
|
|
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
package/src/bigbang.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { programId } from './const'
|
|
|
9
9
|
* @param replica_count - A stringified integer representing the number of replicas for the new file system.
|
|
10
10
|
* @returns A Promise that resolves to a Solana `Transaction` object containing the bigbang instruction.
|
|
11
11
|
*/
|
|
12
|
-
export async function bigbang
|
|
12
|
+
export async function bigbang(replica_count:string,wallet: PublicKey): Promise<Transaction> {
|
|
13
13
|
const instructionData = Buffer.concat([
|
|
14
14
|
Buffer.from(Int8Array.from([0]).buffer),
|
|
15
15
|
Buffer.from(Uint8Array.of(...new BN(replica_count).toArray('le', 8)))
|
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
package/typedoc.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"excludeInternal": true,
|
|
16
16
|
"excludeNotDocumented": false,
|
|
17
17
|
"gitRemote": "origin",
|
|
18
|
-
"gitRevision": "
|
|
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,
|