create-sia-app 0.1.7 → 0.1.9

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 (114) hide show
  1. package/package.json +2 -6
  2. package/template/AGENTS.md +143 -0
  3. package/template/CLAUDE.md +25 -46
  4. package/template/README.md +6 -12
  5. package/template/_gitignore +0 -1
  6. package/template/dist/assets/index-BEylY2j7.css +1 -0
  7. package/template/dist/assets/index-CnYqArKN.js +8741 -0
  8. package/template/dist/assets/sia_bg-BTOHUC1A.wasm +0 -0
  9. package/template/dist/assets/slab-download-worker-DhW6ZBJs.js +2 -0
  10. package/template/dist/assets/slab-upload-worker-B2uSB2iY.js +2 -0
  11. package/template/dist/index.html +13 -0
  12. package/template/e2e/smoke.spec.ts +20 -0
  13. package/template/index.html +0 -1
  14. package/template/package.json +2 -2
  15. package/template/playwright.config.ts +13 -0
  16. package/template/src/components/Navbar.tsx +3 -3
  17. package/template/src/components/auth/ApproveScreen.tsx +10 -13
  18. package/template/src/components/auth/AuthFlow.tsx +13 -10
  19. package/template/src/components/auth/ConnectScreen.tsx +2 -3
  20. package/template/src/components/auth/RecoveryScreen.tsx +7 -7
  21. package/template/src/components/upload/UploadZone.tsx +192 -74
  22. package/template/src/index.css +14 -4
  23. package/template/src/stores/auth.ts +6 -12
  24. package/template/test-results/.last-run.json +4 -0
  25. package/template/tsconfig.app.json +1 -1
  26. package/template/tsconfig.node.json +0 -1
  27. package/template/vite.config.ts +2 -3
  28. package/template/rust/README.md +0 -16
  29. package/template/rust/sia-sdk-rs/.changeset/added_cancel_function_to_cancel_inflight_packed_uploads.md +0 -6
  30. package/template/rust/sia-sdk-rs/.changeset/check_if_we_have_enough_hosts_prior_to_encoding_in_upload_slabs.md +0 -16
  31. package/template/rust/sia-sdk-rs/.changeset/fix_slab_length_in_packed_object.md +0 -5
  32. package/template/rust/sia-sdk-rs/.changeset/fix_upload_racing_race_conditon.md +0 -13
  33. package/template/rust/sia-sdk-rs/.changeset/improved_parallelism_of_packed_uploads.md +0 -5
  34. package/template/rust/sia-sdk-rs/.changeset/progress_callback_will_now_be_called_as_expected_for_packed_uploads.md +0 -5
  35. package/template/rust/sia-sdk-rs/.github/dependabot.yml +0 -10
  36. package/template/rust/sia-sdk-rs/.github/workflows/main.yml +0 -36
  37. package/template/rust/sia-sdk-rs/.github/workflows/prepare-release.yml +0 -34
  38. package/template/rust/sia-sdk-rs/.github/workflows/release.yml +0 -30
  39. package/template/rust/sia-sdk-rs/.rustfmt.toml +0 -4
  40. package/template/rust/sia-sdk-rs/Cargo.lock +0 -4127
  41. package/template/rust/sia-sdk-rs/Cargo.toml +0 -3
  42. package/template/rust/sia-sdk-rs/LICENSE +0 -21
  43. package/template/rust/sia-sdk-rs/README.md +0 -30
  44. package/template/rust/sia-sdk-rs/indexd/CHANGELOG.md +0 -79
  45. package/template/rust/sia-sdk-rs/indexd/Cargo.toml +0 -79
  46. package/template/rust/sia-sdk-rs/indexd/benches/upload.rs +0 -258
  47. package/template/rust/sia-sdk-rs/indexd/src/app_client.rs +0 -1710
  48. package/template/rust/sia-sdk-rs/indexd/src/builder.rs +0 -354
  49. package/template/rust/sia-sdk-rs/indexd/src/download.rs +0 -379
  50. package/template/rust/sia-sdk-rs/indexd/src/hosts.rs +0 -659
  51. package/template/rust/sia-sdk-rs/indexd/src/lib.rs +0 -827
  52. package/template/rust/sia-sdk-rs/indexd/src/mock.rs +0 -162
  53. package/template/rust/sia-sdk-rs/indexd/src/object_encryption.rs +0 -125
  54. package/template/rust/sia-sdk-rs/indexd/src/quic.rs +0 -575
  55. package/template/rust/sia-sdk-rs/indexd/src/rhp4.rs +0 -52
  56. package/template/rust/sia-sdk-rs/indexd/src/slabs.rs +0 -497
  57. package/template/rust/sia-sdk-rs/indexd/src/upload.rs +0 -629
  58. package/template/rust/sia-sdk-rs/indexd/src/wasm_time.rs +0 -41
  59. package/template/rust/sia-sdk-rs/indexd/src/web_transport.rs +0 -398
  60. package/template/rust/sia-sdk-rs/indexd_ffi/CHANGELOG.md +0 -76
  61. package/template/rust/sia-sdk-rs/indexd_ffi/Cargo.toml +0 -47
  62. package/template/rust/sia-sdk-rs/indexd_ffi/examples/python/README.md +0 -10
  63. package/template/rust/sia-sdk-rs/indexd_ffi/examples/python/example.py +0 -130
  64. package/template/rust/sia-sdk-rs/indexd_ffi/src/bin/uniffi-bindgen.rs +0 -3
  65. package/template/rust/sia-sdk-rs/indexd_ffi/src/builder.rs +0 -377
  66. package/template/rust/sia-sdk-rs/indexd_ffi/src/io.rs +0 -155
  67. package/template/rust/sia-sdk-rs/indexd_ffi/src/lib.rs +0 -1039
  68. package/template/rust/sia-sdk-rs/indexd_ffi/src/logging.rs +0 -58
  69. package/template/rust/sia-sdk-rs/indexd_ffi/src/tls.rs +0 -23
  70. package/template/rust/sia-sdk-rs/indexd_wasm/Cargo.toml +0 -33
  71. package/template/rust/sia-sdk-rs/indexd_wasm/src/lib.rs +0 -818
  72. package/template/rust/sia-sdk-rs/knope.toml +0 -54
  73. package/template/rust/sia-sdk-rs/sia_derive/CHANGELOG.md +0 -38
  74. package/template/rust/sia-sdk-rs/sia_derive/Cargo.toml +0 -19
  75. package/template/rust/sia-sdk-rs/sia_derive/src/lib.rs +0 -278
  76. package/template/rust/sia-sdk-rs/sia_sdk/CHANGELOG.md +0 -91
  77. package/template/rust/sia-sdk-rs/sia_sdk/Cargo.toml +0 -59
  78. package/template/rust/sia-sdk-rs/sia_sdk/benches/merkle_root.rs +0 -12
  79. package/template/rust/sia-sdk-rs/sia_sdk/src/blake2.rs +0 -22
  80. package/template/rust/sia-sdk-rs/sia_sdk/src/consensus.rs +0 -767
  81. package/template/rust/sia-sdk-rs/sia_sdk/src/encoding/v1.rs +0 -257
  82. package/template/rust/sia-sdk-rs/sia_sdk/src/encoding/v2.rs +0 -291
  83. package/template/rust/sia-sdk-rs/sia_sdk/src/encoding.rs +0 -26
  84. package/template/rust/sia-sdk-rs/sia_sdk/src/encoding_async/v2.rs +0 -367
  85. package/template/rust/sia-sdk-rs/sia_sdk/src/encoding_async.rs +0 -6
  86. package/template/rust/sia-sdk-rs/sia_sdk/src/encryption.rs +0 -303
  87. package/template/rust/sia-sdk-rs/sia_sdk/src/erasure_coding.rs +0 -347
  88. package/template/rust/sia-sdk-rs/sia_sdk/src/lib.rs +0 -15
  89. package/template/rust/sia-sdk-rs/sia_sdk/src/macros.rs +0 -435
  90. package/template/rust/sia-sdk-rs/sia_sdk/src/merkle.rs +0 -112
  91. package/template/rust/sia-sdk-rs/sia_sdk/src/rhp/merkle.rs +0 -357
  92. package/template/rust/sia-sdk-rs/sia_sdk/src/rhp/rpc.rs +0 -1507
  93. package/template/rust/sia-sdk-rs/sia_sdk/src/rhp/types.rs +0 -146
  94. package/template/rust/sia-sdk-rs/sia_sdk/src/rhp.rs +0 -7
  95. package/template/rust/sia-sdk-rs/sia_sdk/src/seed.rs +0 -278
  96. package/template/rust/sia-sdk-rs/sia_sdk/src/signing.rs +0 -236
  97. package/template/rust/sia-sdk-rs/sia_sdk/src/types/common.rs +0 -677
  98. package/template/rust/sia-sdk-rs/sia_sdk/src/types/currency.rs +0 -450
  99. package/template/rust/sia-sdk-rs/sia_sdk/src/types/specifier.rs +0 -110
  100. package/template/rust/sia-sdk-rs/sia_sdk/src/types/spendpolicy.rs +0 -778
  101. package/template/rust/sia-sdk-rs/sia_sdk/src/types/utils.rs +0 -117
  102. package/template/rust/sia-sdk-rs/sia_sdk/src/types/v1.rs +0 -1737
  103. package/template/rust/sia-sdk-rs/sia_sdk/src/types/v2.rs +0 -1726
  104. package/template/rust/sia-sdk-rs/sia_sdk/src/types/work.rs +0 -59
  105. package/template/rust/sia-sdk-rs/sia_sdk/src/types.rs +0 -16
  106. package/template/scripts/setup-rust.js +0 -29
  107. package/template/src/lib/format.ts +0 -35
  108. package/template/src/lib/hex.ts +0 -13
  109. package/template/src/lib/sdk.ts +0 -25
  110. package/template/src/lib/wasm-env.ts +0 -5
  111. package/template/wasm/indexd_wasm/indexd_wasm.d.ts +0 -309
  112. package/template/wasm/indexd_wasm/indexd_wasm.js +0 -1507
  113. package/template/wasm/indexd_wasm/indexd_wasm_bg.wasm +0 -0
  114. package/template/wasm/indexd_wasm/package.json +0 -31
@@ -1,59 +0,0 @@
1
- use serde::{Deserialize, Serialize};
2
- use uint::construct_uint;
3
-
4
- use crate::encoding::{self, SiaDecodable, SiaEncodable, V1SiaDecodable, V1SiaEncodable};
5
-
6
- construct_uint! {
7
- /// Work is a 256-bit unsigned integer.
8
- pub struct Work(4);
9
- }
10
-
11
- impl From<&[u8; 32]> for Work {
12
- fn from(bytes: &[u8; 32]) -> Self {
13
- Work::from_big_endian(bytes)
14
- }
15
- }
16
-
17
- impl SiaEncodable for Work {
18
- fn encode<W: std::io::Write>(&self, w: &mut W) -> encoding::Result<()> {
19
- self.to_big_endian().encode(w)
20
- }
21
- }
22
-
23
- impl SiaDecodable for Work {
24
- fn decode<R: std::io::Read>(r: &mut R) -> encoding::Result<Self> {
25
- Ok(Work::from_big_endian(&<[u8; 32]>::decode(r).map_err(
26
- |_| encoding::Error::Custom("invalid work".to_string()),
27
- )?))
28
- }
29
- }
30
-
31
- impl V1SiaEncodable for Work {
32
- fn encode_v1<W: std::io::Write>(&self, w: &mut W) -> encoding::Result<()> {
33
- self.to_big_endian().encode_v1(w)
34
- }
35
- }
36
-
37
- impl V1SiaDecodable for Work {
38
- fn decode_v1<R: std::io::Read>(r: &mut R) -> encoding::Result<Self> {
39
- Ok(Work::from_big_endian(&<[u8; 32]>::decode_v1(r)?))
40
- }
41
- }
42
-
43
- impl Serialize for Work {
44
- fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
45
- where
46
- S: serde::Serializer,
47
- {
48
- serializer.serialize_str(&self.to_string())
49
- }
50
- }
51
-
52
- impl<'de> Deserialize<'de> for Work {
53
- fn deserialize<D>(deserializer: D) -> Result<Work, D::Error>
54
- where
55
- D: serde::Deserializer<'de>,
56
- {
57
- Work::from_dec_str(&String::deserialize(deserializer)?).map_err(serde::de::Error::custom)
58
- }
59
- }
@@ -1,16 +0,0 @@
1
- mod common;
2
- mod currency;
3
- mod specifier;
4
- mod spendpolicy; // exposed in v2 types
5
-
6
- #[allow(clippy::manual_div_ceil)]
7
- mod work;
8
-
9
- pub use common::*;
10
- pub use currency::*;
11
- pub use specifier::*;
12
- pub use work::*;
13
-
14
- pub(crate) mod utils;
15
- pub mod v1;
16
- pub mod v2;
@@ -1,29 +0,0 @@
1
- import { existsSync } from 'fs'
2
- import { execSync } from 'child_process'
3
- import { resolve, dirname } from 'path'
4
- import { fileURLToPath } from 'url'
5
-
6
- const __dirname = dirname(fileURLToPath(import.meta.url))
7
- const targetDir = resolve(__dirname, '../rust/sia-sdk-rs')
8
-
9
- if (existsSync(targetDir)) {
10
- console.log('rust/sia-sdk-rs already exists, skipping clone.')
11
- process.exit(0)
12
- }
13
-
14
- const repo = 'https://github.com/alexfreska/sia-sdk-rs.git'
15
- const branch = 'alex/wasm-experimental'
16
-
17
- console.log(`Cloning ${repo} (branch: ${branch})...`)
18
-
19
- try {
20
- execSync(
21
- `git clone --branch ${branch} --single-branch --depth 1 ${repo} ${targetDir}`,
22
- { stdio: 'inherit' },
23
- )
24
- console.log('Rust SDK source cloned successfully.')
25
- } catch {
26
- console.warn(
27
- '\nWarning: Failed to clone Rust SDK source. This is optional — the pre-built WASM binary in wasm/ is what the app uses at runtime. The Rust source is only needed if you want to rebuild the WASM module.\n',
28
- )
29
- }
@@ -1,35 +0,0 @@
1
- export type FileMetadata = {
2
- name: string
3
- type: string
4
- size: number
5
- hash: string
6
- createdAt?: number
7
- updatedAt?: number
8
- }
9
-
10
- export function formatBytes(bytes: number): string {
11
- if (bytes === 0) return '0 B'
12
- const k = 1024
13
- const sizes = ['B', 'KB', 'MB', 'GB', 'TB']
14
- const i = Math.floor(Math.log(bytes) / Math.log(k))
15
- const value = bytes / k ** i
16
- return `${value.toFixed(i === 0 ? 0 : 1)} ${sizes[i]}`
17
- }
18
-
19
- export function formatDate(epochMs: number): string {
20
- return new Date(epochMs).toLocaleDateString(undefined, {
21
- year: 'numeric',
22
- month: 'short',
23
- day: 'numeric',
24
- })
25
- }
26
-
27
- export function decodeMetadata(
28
- metadataBytes: Uint8Array,
29
- ): Record<string, unknown> {
30
- try {
31
- return JSON.parse(new TextDecoder().decode(metadataBytes))
32
- } catch {
33
- return {}
34
- }
35
- }
@@ -1,13 +0,0 @@
1
- export function toHex(bytes: Uint8Array): string {
2
- return Array.from(bytes)
3
- .map((b) => b.toString(16).padStart(2, '0'))
4
- .join('')
5
- }
6
-
7
- export function fromHex(hex: string): Uint8Array {
8
- const bytes = new Uint8Array(hex.length / 2)
9
- for (let i = 0; i < hex.length; i += 2) {
10
- bytes[i / 2] = Number.parseInt(hex.substring(i, i + 2), 16)
11
- }
12
- return bytes
13
- }
@@ -1,25 +0,0 @@
1
- import init, {
2
- AppKey,
3
- Builder,
4
- generateRecoveryPhrase,
5
- PinnedObject,
6
- type SDK,
7
- validateRecoveryPhrase,
8
- } from 'indexd_wasm'
9
-
10
- let initialized = false
11
-
12
- export async function initWasm(): Promise<void> {
13
- if (initialized) return
14
- await init()
15
- initialized = true
16
- }
17
-
18
- export {
19
- AppKey,
20
- Builder,
21
- PinnedObject,
22
- type SDK,
23
- generateRecoveryPhrase,
24
- validateRecoveryPhrase,
25
- }
@@ -1,5 +0,0 @@
1
- // WASM environment stub — provides `env.now` required by the WASM binary
2
- // (used by Rust's std::time / chrono for timestamps in the browser).
3
- export function now(): number {
4
- return Date.now()
5
- }
@@ -1,309 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- /**
4
- * Install a panic hook and logging bridge so that Rust panics show a proper
5
- * stack trace and `log::debug!()` / `log::info!()` etc. appear in the browser
6
- * console.
7
- */
8
- export function init_panic_hook(): void;
9
- /**
10
- * Connects to a host via WebTransport and fetches its settings/prices.
11
- *
12
- * `address` should be a host address like `host.example.com:9883`.
13
- * Returns the host settings as a JS object.
14
- */
15
- export function fetchHostSettings(address: string): Promise<any>;
16
- /**
17
- * Validates a BIP-32 recovery phrase.
18
- */
19
- export function validateRecoveryPhrase(phrase: string): void;
20
- /**
21
- * Generates a new 12-word BIP-32 recovery phrase.
22
- */
23
- export function generateRecoveryPhrase(): string;
24
- export class AppKey {
25
- free(): void;
26
- [Symbol.dispose](): void;
27
- /**
28
- * Returns the hex-encoded public key.
29
- */
30
- publicKey(): string;
31
- /**
32
- * Verifies a signature against a message.
33
- */
34
- verifySignature(message: Uint8Array, signature: Uint8Array): boolean;
35
- /**
36
- * Imports an AppKey from a 64-byte ed25519 keypair or a 32-byte seed.
37
- */
38
- constructor(key: Uint8Array);
39
- /**
40
- * Signs a message, returning the 64-byte signature.
41
- */
42
- sign(message: Uint8Array): Uint8Array;
43
- /**
44
- * Exports the full 64-byte ed25519 keypair.
45
- */
46
- export(): Uint8Array;
47
- }
48
- export class Builder {
49
- free(): void;
50
- [Symbol.dispose](): void;
51
- /**
52
- * Returns the response URL the user must visit to authorize the connection.
53
- */
54
- responseUrl(): string;
55
- /**
56
- * Sets the maximum number of concurrent uploads (default: 3).
57
- * Lower values = more stable, higher values = faster but may crash browser.
58
- */
59
- withMaxUploads(max: number): void;
60
- /**
61
- * Polls for approval. Resolves when the user approves.
62
- */
63
- waitForApproval(): Promise<void>;
64
- /**
65
- * Requests a new app connection. Pass app metadata as a JSON object:
66
- * ```json
67
- * {
68
- * "app_id": [32 bytes as hex],
69
- * "name": "My App",
70
- * "description": "...",
71
- * "service_url": "https://...",
72
- * "logo_url": "https://..." (optional),
73
- * "callback_url": "https://..." (optional)
74
- * }
75
- * ```
76
- */
77
- requestConnection(app_meta_json: string): Promise<void>;
78
- /**
79
- * Sets the maximum number of concurrent downloads (default: 2).
80
- * Lower values = more stable, higher values = faster but may crash browser.
81
- */
82
- withMaxDownloads(max: number): void;
83
- /**
84
- * Sets the maximum number of concurrent price fetches (default: 1).
85
- * Lower values = more stable, higher values = faster but may crash browser.
86
- */
87
- withMaxPriceFetches(max: number): void;
88
- /**
89
- * Transitions the builder using a pre-fetched connection response.
90
- * Use this when the `POST /auth/connect` call was made out-of-band
91
- * (e.g. via curl) to work around CORS restrictions.
92
- *
93
- * `app_id_hex` is the hex-encoded app ID used in the request.
94
- * `response_json` is the JSON response from `POST /auth/connect`.
95
- */
96
- setConnectionResponse(app_id_hex: string, response_json: string): void;
97
- /**
98
- * Creates a new SDK builder for the given indexer URL.
99
- */
100
- constructor(indexer_url: string);
101
- /**
102
- * Registers the app using the user's recovery phrase and returns the SDK.
103
- */
104
- register(mnemonic: string): Promise<SDK>;
105
- /**
106
- * Attempts to connect using an existing app key.
107
- *
108
- * Returns the SDK if authenticated, or null if the key is not recognized.
109
- * Call `requestConnection` if null is returned.
110
- */
111
- connected(app_key: AppKey): Promise<any>;
112
- }
113
- export class PinnedObject {
114
- private constructor();
115
- free(): void;
116
- [Symbol.dispose](): void;
117
- /**
118
- * Updates the metadata.
119
- */
120
- updateMetadata(metadata: Uint8Array): void;
121
- /**
122
- * Returns the object's ID as a hex string.
123
- */
124
- id(): string;
125
- /**
126
- * Opens a sealed object (JSON) using the provided app key.
127
- */
128
- static open(app_key: AppKey, sealed_json: string): PinnedObject;
129
- /**
130
- * Seals the object for offline storage, returning JSON.
131
- */
132
- seal(app_key: AppKey): string;
133
- /**
134
- * Returns the total size of the object in bytes.
135
- */
136
- size(): number;
137
- /**
138
- * Returns the metadata as a Uint8Array.
139
- */
140
- metadata(): Uint8Array;
141
- }
142
- export class SDK {
143
- private constructor();
144
- free(): void;
145
- [Symbol.dispose](): void;
146
- /**
147
- * Pins an object to the indexer.
148
- */
149
- pinObject(object: PinnedObject): Promise<void>;
150
- /**
151
- * Prunes unused slabs from the indexer.
152
- */
153
- pruneSlabs(): Promise<void>;
154
- /**
155
- * Creates a share URL for an object, valid until the given timestamp (ms since epoch).
156
- */
157
- shareObject(object: PinnedObject, valid_until_ms: number): string;
158
- /**
159
- * Deletes an object from the indexer by its hex-encoded key.
160
- */
161
- deleteObject(key: string): Promise<void>;
162
- /**
163
- * Returns object events for syncing. Supports cursor-based pagination.
164
- *
165
- * `cursor_json` is an optional JSON string: `{"id": "hex...", "after": <epoch_ms>}`
166
- * `limit` is the maximum number of events to return.
167
- *
168
- * Returns a JS array of objects:
169
- * `[{ id: string, deleted: bool, updatedAt: number, object: PinnedObject | null }]`
170
- */
171
- objectEvents(cursor_json: string | null | undefined, limit: number): Promise<any>;
172
- /**
173
- * Retrieves a shared object from a signed share URL.
174
- * Accepts both `https://` and `sia://` schemes.
175
- */
176
- sharedObject(share_url: string): Promise<PinnedObject>;
177
- /**
178
- * Downloads an object with streaming chunks.
179
- * Fires `on_chunk(bytes)` after each slab is decoded and `on_progress(current, total)` for progress.
180
- */
181
- downloadStreaming(object: PinnedObject, on_chunk: Function, on_progress: Function): Promise<void>;
182
- /**
183
- * Uploads a Uint8Array with per-shard progress reporting.
184
- *
185
- * The `on_progress` callback receives `(current_shards, total_shards)`.
186
- */
187
- uploadWithProgress(data: Uint8Array, on_progress: Function): Promise<PinnedObject>;
188
- /**
189
- * Downloads an object's data with per-slab progress reporting.
190
- *
191
- * The `on_progress` callback receives `(current_slabs, total_slabs)`.
192
- */
193
- downloadWithProgress(object: PinnedObject, on_progress: Function): Promise<Uint8Array>;
194
- /**
195
- * Updates the metadata of an object already stored in the indexer.
196
- */
197
- updateObjectMetadata(object: PinnedObject): Promise<void>;
198
- /**
199
- * Returns hosts as a JSON array.
200
- */
201
- hosts(): Promise<any>;
202
- /**
203
- * Retrieves a pinned object by its hex-encoded key.
204
- */
205
- object(key: string): Promise<PinnedObject>;
206
- /**
207
- * Uploads a Uint8Array to the Sia network.
208
- *
209
- * Returns a PinnedObject containing the metadata needed to download the data.
210
- */
211
- upload(data: Uint8Array): Promise<PinnedObject>;
212
- /**
213
- * Returns account information as a JS object.
214
- */
215
- account(): Promise<any>;
216
- /**
217
- * Returns the app key used by this SDK instance.
218
- */
219
- appKey(): AppKey;
220
- /**
221
- * Downloads an object's data, returning a Uint8Array.
222
- */
223
- download(object: PinnedObject): Promise<Uint8Array>;
224
- }
225
-
226
- export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
227
-
228
- export interface InitOutput {
229
- readonly memory: WebAssembly.Memory;
230
- readonly __wbg_appkey_free: (a: number, b: number) => void;
231
- readonly __wbg_builder_free: (a: number, b: number) => void;
232
- readonly __wbg_pinnedobject_free: (a: number, b: number) => void;
233
- readonly __wbg_sdk_free: (a: number, b: number) => void;
234
- readonly appkey_export: (a: number) => any;
235
- readonly appkey_new: (a: number, b: number) => [number, number, number];
236
- readonly appkey_publicKey: (a: number) => [number, number];
237
- readonly appkey_sign: (a: number, b: number, c: number) => any;
238
- readonly appkey_verifySignature: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
239
- readonly builder_connected: (a: number, b: number) => any;
240
- readonly builder_new: (a: number, b: number) => [number, number, number];
241
- readonly builder_register: (a: number, b: number, c: number) => any;
242
- readonly builder_requestConnection: (a: number, b: number, c: number) => any;
243
- readonly builder_responseUrl: (a: number) => [number, number, number, number];
244
- readonly builder_setConnectionResponse: (a: number, b: number, c: number, d: number, e: number) => [number, number];
245
- readonly builder_waitForApproval: (a: number) => any;
246
- readonly builder_withMaxDownloads: (a: number, b: number) => [number, number];
247
- readonly builder_withMaxPriceFetches: (a: number, b: number) => [number, number];
248
- readonly builder_withMaxUploads: (a: number, b: number) => [number, number];
249
- readonly fetchHostSettings: (a: number, b: number) => any;
250
- readonly generateRecoveryPhrase: () => [number, number];
251
- readonly init_panic_hook: () => void;
252
- readonly pinnedobject_id: (a: number) => [number, number, number, number];
253
- readonly pinnedobject_metadata: (a: number) => [number, number, number];
254
- readonly pinnedobject_open: (a: number, b: number, c: number) => [number, number, number];
255
- readonly pinnedobject_seal: (a: number, b: number) => [number, number, number, number];
256
- readonly pinnedobject_size: (a: number) => [number, number, number];
257
- readonly pinnedobject_updateMetadata: (a: number, b: number, c: number) => [number, number];
258
- readonly sdk_account: (a: number) => any;
259
- readonly sdk_appKey: (a: number) => number;
260
- readonly sdk_deleteObject: (a: number, b: number, c: number) => any;
261
- readonly sdk_download: (a: number, b: number) => any;
262
- readonly sdk_downloadStreaming: (a: number, b: number, c: any, d: any) => any;
263
- readonly sdk_downloadWithProgress: (a: number, b: number, c: any) => any;
264
- readonly sdk_hosts: (a: number) => any;
265
- readonly sdk_object: (a: number, b: number, c: number) => any;
266
- readonly sdk_objectEvents: (a: number, b: number, c: number, d: number) => any;
267
- readonly sdk_pinObject: (a: number, b: number) => any;
268
- readonly sdk_pruneSlabs: (a: number) => any;
269
- readonly sdk_shareObject: (a: number, b: number, c: number) => [number, number, number, number];
270
- readonly sdk_sharedObject: (a: number, b: number, c: number) => any;
271
- readonly sdk_updateObjectMetadata: (a: number, b: number) => any;
272
- readonly sdk_upload: (a: number, b: number, c: number) => any;
273
- readonly sdk_uploadWithProgress: (a: number, b: number, c: number, d: any) => any;
274
- readonly validateRecoveryPhrase: (a: number, b: number) => [number, number];
275
- readonly wasm_bindgen__convert__closures_____invoke__h660d0571ab542b96: (a: number, b: number) => void;
276
- readonly wasm_bindgen__closure__destroy__he5035197fb444b8b: (a: number, b: number) => void;
277
- readonly wasm_bindgen__convert__closures_____invoke__h6280da76965e1dcd: (a: number, b: number, c: any) => void;
278
- readonly wasm_bindgen__closure__destroy__h0c75a1a3e92aa554: (a: number, b: number) => void;
279
- readonly wasm_bindgen__convert__closures_____invoke__hf411941149947cdb: (a: number, b: number, c: any, d: any) => void;
280
- readonly __wbindgen_malloc: (a: number, b: number) => number;
281
- readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
282
- readonly __wbindgen_exn_store: (a: number) => void;
283
- readonly __externref_table_alloc: () => number;
284
- readonly __wbindgen_externrefs: WebAssembly.Table;
285
- readonly __wbindgen_free: (a: number, b: number, c: number) => void;
286
- readonly __externref_table_dealloc: (a: number) => void;
287
- readonly __wbindgen_start: () => void;
288
- }
289
-
290
- export type SyncInitInput = BufferSource | WebAssembly.Module;
291
- /**
292
- * Instantiates the given `module`, which can either be bytes or
293
- * a precompiled `WebAssembly.Module`.
294
- *
295
- * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
296
- *
297
- * @returns {InitOutput}
298
- */
299
- export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
300
-
301
- /**
302
- * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
303
- * for everything else, calls `WebAssembly.instantiate` directly.
304
- *
305
- * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
306
- *
307
- * @returns {Promise<InitOutput>}
308
- */
309
- export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;