@xandeum/web3.js 0.8.0 → 0.8.3
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/bigbang.d.ts +1 -1
- package/dist/bigbang.js +1 -1
- package/dist/getXandeumResult.js +43 -23
- package/docs/html/functions/armageddon.html +2 -2
- package/docs/html/functions/assignCoowner.html +2 -2
- package/docs/html/functions/bigbang.html +3 -3
- 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 +2 -2
- 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 +3 -3
- 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 +2 -2
- 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 +2 -2
- package/package.json +1 -1
- package/src/bigbang.ts +1 -1
- package/src/getXandeumResult.ts +45 -26
- package/typedoc.json +1 -1
- package/docs/markdown/summary.md +0 -49
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[**Xandeum Web3 Library v0.8.
|
|
1
|
+
[**Xandeum Web3 Library v0.8.1**](../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/
|
|
11
|
+
Defined in: [removeFile.ts:17](https://github.com/Xandeum/xandeum-web3.js/blob/reinheim/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.8.
|
|
1
|
+
[**Xandeum Web3 Library v0.8.1**](../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/
|
|
11
|
+
Defined in: [renamePath.ts:18](https://github.com/Xandeum/xandeum-web3.js/blob/reinheim/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.8.
|
|
1
|
+
[**Xandeum Web3 Library v0.8.1**](../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/
|
|
11
|
+
Defined in: [webSocket.ts:40](https://github.com/Xandeum/xandeum-web3.js/blob/reinheim/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.8.
|
|
1
|
+
[**Xandeum Web3 Library v0.8.1**](../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/
|
|
11
|
+
Defined in: [webSocket.ts:103](https://github.com/Xandeum/xandeum-web3.js/blob/reinheim/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).
|
package/docs/markdown/globals.md
CHANGED
package/package.json
CHANGED
package/src/bigbang.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { programId } from './const'
|
|
|
6
6
|
* Constructs a Solana transaction that triggers the "bigbang" instruction and create new file system.
|
|
7
7
|
*
|
|
8
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.
|
|
9
|
+
* @param replica_count - A stringified integer representing the number of replicas for the new file system. Must be 2 or greater. The total number of copies will be replica_count + 1 (one original plus the replicas).
|
|
10
10
|
* @returns A Promise that resolves to a Solana `Transaction` object containing the bigbang instruction.
|
|
11
11
|
*/
|
|
12
12
|
export async function bigbang(replica_count:string,wallet: PublicKey): Promise<Transaction> {
|
package/src/getXandeumResult.ts
CHANGED
|
@@ -18,31 +18,50 @@ function sleep(ms: number) {
|
|
|
18
18
|
* @returns A `Promise<any>` resolving to the parsed JSON response from the RPC server,
|
|
19
19
|
* which includes the result of the transaction if available.
|
|
20
20
|
*/
|
|
21
|
-
export async function getXandeumResult(
|
|
21
|
+
export async function getXandeumResult(
|
|
22
|
+
connection: Connection,
|
|
23
|
+
signature: string
|
|
24
|
+
): Promise<any> {
|
|
22
25
|
const url = connection.rpcEndpoint;
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
const maxAttempts = 3;
|
|
27
|
+
const delayMs = 5000;
|
|
28
|
+
|
|
29
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
30
|
+
// Wait before every attempt (including the first one)
|
|
31
|
+
await sleep(delayMs);
|
|
32
|
+
|
|
33
|
+
const response = await fetch(url, {
|
|
34
|
+
method: "POST",
|
|
35
|
+
headers: { "Content-Type": "application/json" },
|
|
36
|
+
body: JSON.stringify({
|
|
37
|
+
jsonrpc: "2.0",
|
|
38
|
+
id: 1,
|
|
39
|
+
method: "getXandeumResult",
|
|
40
|
+
params: [signature],
|
|
41
|
+
}),
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
if (!response.ok) {
|
|
45
|
+
const text = await response.text();
|
|
46
|
+
console.error(`Attempt ${attempt}/${maxAttempts} failed: ${response.status} ${text}`);
|
|
47
|
+
if (attempt === maxAttempts) {
|
|
48
|
+
return { result: null, error: `HTTP ${response.status}` };
|
|
49
|
+
}
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const data = await response.json();
|
|
54
|
+
|
|
55
|
+
// Change this condition if Xandeum uses a different "not ready" value
|
|
56
|
+
if (data?.result != null && data.result !== "pending") {
|
|
57
|
+
console.log(`Got result on attempt ${attempt}`);
|
|
58
|
+
return data; // Success — return immediately
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
console.log(`Attempt ${attempt}/${maxAttempts}: still pending...`);
|
|
28
62
|
}
|
|
29
|
-
|
|
30
|
-
//
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
method: 'POST',
|
|
35
|
-
headers: {
|
|
36
|
-
'Content-Type': 'application/json'
|
|
37
|
-
},
|
|
38
|
-
body: JSON.stringify(requestBody)
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
if (!response.ok) {
|
|
42
|
-
const errorText = await response.text();
|
|
43
|
-
return new Error(`Error! status: ${response.status}, message: ${errorText}`);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const data = await response.json()
|
|
47
|
-
return data
|
|
48
|
-
}
|
|
63
|
+
|
|
64
|
+
// All 3 attempts done, still no result
|
|
65
|
+
console.log("Max attempts reached — result still not available");
|
|
66
|
+
return { result: null, error: "Result not ready after 3 attempts" };
|
|
67
|
+
}
|
package/typedoc.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"excludeInternal": true,
|
|
16
16
|
"excludeNotDocumented": false,
|
|
17
17
|
"gitRemote": "origin",
|
|
18
|
-
"gitRevision": "
|
|
18
|
+
"gitRevision": "reinheim",
|
|
19
19
|
"sourceLinkTemplate": "https://github.com/Xandeum/xandeum-web3.js/blob/{gitRevision}/{path}#L{line}",
|
|
20
20
|
"visibilityFilters": {
|
|
21
21
|
"protected": false,
|
package/docs/markdown/summary.md
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
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
|
-
|