@withautonomi/autonomi 0.2.2-rc.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.
- package/README.md +159 -0
- package/autonomi.d.ts +314 -0
- package/autonomi.js +1447 -0
- package/autonomi_bg.wasm +0 -0
- package/package.json +25 -0
package/README.md
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# `autonomi` - Autonomi client API
|
|
2
|
+
|
|
3
|
+
[](https://crates.io/crates/autonomi)
|
|
4
|
+
[](https://docs.rs/autonomi)
|
|
5
|
+
|
|
6
|
+
Connect to and build on the Autonomi network.
|
|
7
|
+
|
|
8
|
+
## Usage
|
|
9
|
+
|
|
10
|
+
Add the autonomi crate to your `Cargo.toml`:
|
|
11
|
+
|
|
12
|
+
```toml
|
|
13
|
+
[dependencies]
|
|
14
|
+
autonomi = { path = "../autonomi", version = "0.1.0" }
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Running tests
|
|
18
|
+
|
|
19
|
+
### Using a local EVM testnet
|
|
20
|
+
|
|
21
|
+
1. If you haven't, install Foundry, to be able to run Anvil
|
|
22
|
+
nodes: https://book.getfoundry.sh/getting-started/installation
|
|
23
|
+
2. Run a local EVM node:
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
cargo run --bin evm_testnet
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
3. Run a local network with the `local` feature and use the local evm node.
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
cargo run --bin=safenode-manager --features=local -- local run --build --clean --rewards-address <ETHEREUM_ADDRESS> evm-local
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
4. Then run the tests with the `local` feature and pass the EVM params again:
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
EVM_NETWORK=local cargo test --package=autonomi --features=local
|
|
39
|
+
# Or with logs
|
|
40
|
+
RUST_LOG=autonomi EVM_NETWORK=local cargo test --package=autonomi --features=local -- --nocapture
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Using a live testnet or mainnet
|
|
44
|
+
|
|
45
|
+
Using the hardcoded `Arbitrum One` option as an example, but you can also use the command flags of the steps above and
|
|
46
|
+
point it to a live network.
|
|
47
|
+
|
|
48
|
+
1. Run a local network with the `local` feature:
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
cargo run --bin=safenode-manager --features=local -- local run --build --clean --rewards-address <ETHEREUM_ADDRESS> evm-arbitrum-one
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
2. Then run the tests with the `local` feature. Make sure that the wallet of the private key you pass has enough gas and
|
|
55
|
+
payment tokens on the network (in this case Arbitrum One):
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
EVM_NETWORK=arbitrum-one EVM_PRIVATE_KEY=<PRIVATE_KEY> cargo test --package=autonomi --features=local
|
|
59
|
+
# Or with logs
|
|
60
|
+
RUST_LOG=autonomi EVM_NETWORK=arbitrum-one EVM_PRIVATE_KEY=<PRIVATE_KEY> cargo test --package=autonomi --features=local -- --nocapture
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### WebAssembly
|
|
64
|
+
|
|
65
|
+
To run a WASM test
|
|
66
|
+
|
|
67
|
+
- Install `wasm-pack`
|
|
68
|
+
- Make sure your Rust supports the `wasm32-unknown-unknown` target. (If you
|
|
69
|
+
have `rustup`: `rustup target add wasm32-unknown-unknown`.)
|
|
70
|
+
- Pass a bootstrap peer via `SAFE_PEERS`. This *has* to be the websocket address,
|
|
71
|
+
e.g. `/ip4/<ip>/tcp/<port>/ws/p2p/<peer ID>`.
|
|
72
|
+
- As well as the other environment variables needed for EVM payments (e.g. `RPC_URL`).
|
|
73
|
+
- Optionally specify the specific test, e.g. `-- put` to run `put()` in `wasm.rs` only.
|
|
74
|
+
|
|
75
|
+
Example:
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
SAFE_PEERS=/ip4/<ip>/tcp/<port>/ws/p2p/<peer ID> wasm-pack test --release --firefox autonomi --features=data,files --test wasm -- put
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
#### Test from JS in the browser
|
|
82
|
+
|
|
83
|
+
`wasm-pack test` does not execute JavaScript, but runs mostly WebAssembly. Again make sure the environment variables are
|
|
84
|
+
set and build the JS package:
|
|
85
|
+
|
|
86
|
+
```sh
|
|
87
|
+
wasm-pack build --dev --target=web autonomi --features=vault
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Then cd into `autonomi/tests-js`, and use `npm` to install and serve the test html file.
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
cd autonomi/tests-js
|
|
94
|
+
npm install
|
|
95
|
+
npm run serve
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Then go to `http://127.0.0.1:8080/tests-js` in the browser. Here, enter a `ws` multiaddr of a local node and press '
|
|
99
|
+
run'.
|
|
100
|
+
|
|
101
|
+
#### MetaMask example
|
|
102
|
+
|
|
103
|
+
There is a MetaMask example for doing a simple put operation.
|
|
104
|
+
|
|
105
|
+
Build the package with the `external-signer` feature (and again with the env variables) and run a webserver, e.g. with
|
|
106
|
+
Python:
|
|
107
|
+
|
|
108
|
+
```sh
|
|
109
|
+
wasm-pack build --dev --target=web autonomi --features=external-signer
|
|
110
|
+
python -m http.server --directory=autonomi 8000
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Then visit `http://127.0.0.1:8000/examples/metamask` in your (modern) browser.
|
|
114
|
+
|
|
115
|
+
Here, enter a `ws` multiaddr of a local node and press 'run'.
|
|
116
|
+
|
|
117
|
+
## Faucet (local)
|
|
118
|
+
|
|
119
|
+
There is no faucet server, but instead you can use the `Deployer wallet private key` printed in the EVM node output to
|
|
120
|
+
initialise a wallet from with almost infinite gas and payment tokens. Example:
|
|
121
|
+
|
|
122
|
+
```rust
|
|
123
|
+
let rpc_url = "http://localhost:54370/";
|
|
124
|
+
let payment_token_address = "0x5FbDB2315678afecb367f032d93F642f64180aa3";
|
|
125
|
+
let data_payments_address = "0x8464135c8F25Da09e49BC8782676a84730C318bC";
|
|
126
|
+
let private_key = "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80";
|
|
127
|
+
|
|
128
|
+
let network = Network::Custom(CustomNetwork::new(
|
|
129
|
+
rpc_url,
|
|
130
|
+
payment_token_address,
|
|
131
|
+
data_payments_address,
|
|
132
|
+
));
|
|
133
|
+
|
|
134
|
+
let deployer_wallet = Wallet::new_from_private_key(network, private_key).unwrap();
|
|
135
|
+
let receiving_wallet = Wallet::new_with_random_wallet(network);
|
|
136
|
+
|
|
137
|
+
// Send 10 payment tokens (atto)
|
|
138
|
+
let _ = deployer_wallet
|
|
139
|
+
.transfer_tokens(receiving_wallet.address(), Amount::from(10))
|
|
140
|
+
.await;
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Alternatively, you can provide the wallet address that should own all the gas and payment tokens to the EVM testnet
|
|
144
|
+
startup command using the `--genesis-wallet` flag:
|
|
145
|
+
|
|
146
|
+
```sh
|
|
147
|
+
cargo run --bin evm_testnet -- --genesis-wallet <ETHEREUM_ADDRESS>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
```shell
|
|
151
|
+
*************************
|
|
152
|
+
* Ethereum node started *
|
|
153
|
+
*************************
|
|
154
|
+
RPC URL: http://localhost:60093/
|
|
155
|
+
Payment token address: 0x5FbDB2315678afecb367f032d93F642f64180aa3
|
|
156
|
+
Chunk payments address: 0x8464135c8F25Da09e49BC8782676a84730C318bC
|
|
157
|
+
Deployer wallet private key: 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
|
|
158
|
+
Genesis wallet balance: (tokens: 20000000000000000000000000, gas: 9998998011366954730202)
|
|
159
|
+
```
|
package/autonomi.d.ts
ADDED
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* # Example
|
|
5
|
+
*
|
|
6
|
+
* ```js
|
|
7
|
+
* const secretKey = genSecretKey();
|
|
8
|
+
* await client.putUserDataToVault(userData, wallet, secretKey);
|
|
9
|
+
* const userDataFetched = await client.getUserDataFromVault(secretKey);
|
|
10
|
+
* ```
|
|
11
|
+
* @returns {SecretKey}
|
|
12
|
+
*/
|
|
13
|
+
export function genSecretKey(): SecretKey;
|
|
14
|
+
/**
|
|
15
|
+
* Get the current `EvmNetwork` that was set using environment variables that were used during the build process of this library.
|
|
16
|
+
* @returns {any}
|
|
17
|
+
*/
|
|
18
|
+
export function getEvmNetwork(): any;
|
|
19
|
+
/**
|
|
20
|
+
* Get a funded wallet for testing. This either uses a default private key or the `EVM_PRIVATE_KEY`
|
|
21
|
+
* environment variable that was used during the build process of this library.
|
|
22
|
+
* @returns {Wallet}
|
|
23
|
+
*/
|
|
24
|
+
export function getFundedWallet(): Wallet;
|
|
25
|
+
/**
|
|
26
|
+
* Enable tracing logging in the console.
|
|
27
|
+
*
|
|
28
|
+
* A level could be passed like `trace` or `warn`. Or set for a specific module/crate
|
|
29
|
+
* with `sn_networking=trace,autonomi=info`.
|
|
30
|
+
*
|
|
31
|
+
* # Example
|
|
32
|
+
*
|
|
33
|
+
* ```js
|
|
34
|
+
* logInit("sn_networking=warn,autonomi=trace");
|
|
35
|
+
* ```
|
|
36
|
+
* @param {string} directive
|
|
37
|
+
*/
|
|
38
|
+
export function logInit(directive: string): void;
|
|
39
|
+
/**
|
|
40
|
+
* Structure mapping paths to data addresses.
|
|
41
|
+
*/
|
|
42
|
+
export class Archive {
|
|
43
|
+
free(): void;
|
|
44
|
+
/**
|
|
45
|
+
* Create a new archive.
|
|
46
|
+
*/
|
|
47
|
+
constructor();
|
|
48
|
+
/**
|
|
49
|
+
* Add a new file to the archive.
|
|
50
|
+
* @param {string} path
|
|
51
|
+
* @param {string} data_addr
|
|
52
|
+
*/
|
|
53
|
+
addNewFile(path: string, data_addr: string): void;
|
|
54
|
+
/**
|
|
55
|
+
* @param {string} old_path
|
|
56
|
+
* @param {string} new_path
|
|
57
|
+
*/
|
|
58
|
+
renameFile(old_path: string, new_path: string): void;
|
|
59
|
+
/**
|
|
60
|
+
* @returns {any}
|
|
61
|
+
*/
|
|
62
|
+
map(): any;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
*/
|
|
66
|
+
export class AttoTokens {
|
|
67
|
+
free(): void;
|
|
68
|
+
/**
|
|
69
|
+
* @returns {string}
|
|
70
|
+
*/
|
|
71
|
+
toString(): string;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The `Client` object allows interaction with the network to store and retrieve data.
|
|
75
|
+
*
|
|
76
|
+
* To connect to the network, see {@link Client.connect}.
|
|
77
|
+
*
|
|
78
|
+
* # Example
|
|
79
|
+
*
|
|
80
|
+
* ```js
|
|
81
|
+
* let client = await Client.connect(["/ip4/127.0.0.1/tcp/36075/ws/p2p/12D3KooWALb...BhDAfJY"]);
|
|
82
|
+
* const dataAddr = await client.dataPut(new Uint8Array([0, 1, 2, 3]), wallet);
|
|
83
|
+
*
|
|
84
|
+
* const archive = new Archive();
|
|
85
|
+
* archive.addNewFile("foo", dataAddr);
|
|
86
|
+
*
|
|
87
|
+
* const archiveAddr = await client.archivePut(archive, wallet);
|
|
88
|
+
* const archiveFetched = await client.archiveGet(archiveAddr);
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
export class Client {
|
|
92
|
+
free(): void;
|
|
93
|
+
/**
|
|
94
|
+
* Connect to the network via the given peers.
|
|
95
|
+
*
|
|
96
|
+
* # Example
|
|
97
|
+
*
|
|
98
|
+
* ```js
|
|
99
|
+
* let client = await Client.connect(["/ip4/127.0.0.1/tcp/36075/ws/p2p/12D3KooWALb...BhDAfJY"]);
|
|
100
|
+
* ```
|
|
101
|
+
* @param {(string)[]} peers
|
|
102
|
+
* @returns {Promise<Client>}
|
|
103
|
+
*/
|
|
104
|
+
static connect(peers: (string)[]): Promise<Client>;
|
|
105
|
+
/**
|
|
106
|
+
* Upload a chunk to the network.
|
|
107
|
+
*
|
|
108
|
+
* Returns the hex encoded address of the chunk.
|
|
109
|
+
*
|
|
110
|
+
* This is not yet implemented.
|
|
111
|
+
* @param {Uint8Array} _data
|
|
112
|
+
* @param {Wallet} _wallet
|
|
113
|
+
* @returns {Promise<string>}
|
|
114
|
+
*/
|
|
115
|
+
chunkPut(_data: Uint8Array, _wallet: Wallet): Promise<string>;
|
|
116
|
+
/**
|
|
117
|
+
* Fetch the chunk from the network.
|
|
118
|
+
* @param {string} addr
|
|
119
|
+
* @returns {Promise<Uint8Array>}
|
|
120
|
+
*/
|
|
121
|
+
chunkGet(addr: string): Promise<Uint8Array>;
|
|
122
|
+
/**
|
|
123
|
+
* Upload data to the network.
|
|
124
|
+
*
|
|
125
|
+
* Returns the hex encoded address of the data.
|
|
126
|
+
* @param {Uint8Array} data
|
|
127
|
+
* @param {Wallet} wallet
|
|
128
|
+
* @returns {Promise<string>}
|
|
129
|
+
*/
|
|
130
|
+
dataPut(data: Uint8Array, wallet: Wallet): Promise<string>;
|
|
131
|
+
/**
|
|
132
|
+
* Fetch the data from the network.
|
|
133
|
+
* @param {string} addr
|
|
134
|
+
* @returns {Promise<Uint8Array>}
|
|
135
|
+
*/
|
|
136
|
+
dataGet(addr: string): Promise<Uint8Array>;
|
|
137
|
+
/**
|
|
138
|
+
* Get the cost of uploading data to the network.
|
|
139
|
+
* @param {Uint8Array} data
|
|
140
|
+
* @returns {Promise<AttoTokens>}
|
|
141
|
+
*/
|
|
142
|
+
dataCost(data: Uint8Array): Promise<AttoTokens>;
|
|
143
|
+
/**
|
|
144
|
+
* Fetch an archive from the network.
|
|
145
|
+
* @param {string} addr
|
|
146
|
+
* @returns {Promise<Archive>}
|
|
147
|
+
*/
|
|
148
|
+
archiveGet(addr: string): Promise<Archive>;
|
|
149
|
+
/**
|
|
150
|
+
* Upload an archive to the network.
|
|
151
|
+
*
|
|
152
|
+
* Returns the hex encoded address of the archive.
|
|
153
|
+
* @param {Archive} archive
|
|
154
|
+
* @param {Wallet} wallet
|
|
155
|
+
* @returns {Promise<string>}
|
|
156
|
+
*/
|
|
157
|
+
archivePut(archive: Archive, wallet: Wallet): Promise<string>;
|
|
158
|
+
/**
|
|
159
|
+
* Fetch the user data from the vault.
|
|
160
|
+
*
|
|
161
|
+
* # Example
|
|
162
|
+
*
|
|
163
|
+
* ```js
|
|
164
|
+
* const secretKey = genSecretKey();
|
|
165
|
+
* const userData = await client.getUserDataFromVault(secretKey);
|
|
166
|
+
* ```
|
|
167
|
+
* @param {SecretKey} secret_key
|
|
168
|
+
* @returns {Promise<UserData>}
|
|
169
|
+
*/
|
|
170
|
+
getUserDataFromVault(secret_key: SecretKey): Promise<UserData>;
|
|
171
|
+
/**
|
|
172
|
+
* Put the user data to the vault.
|
|
173
|
+
*
|
|
174
|
+
* # Example
|
|
175
|
+
*
|
|
176
|
+
* ```js
|
|
177
|
+
* const secretKey = genSecretKey();
|
|
178
|
+
* await client.putUserDataToVault(userData, wallet, secretKey);
|
|
179
|
+
* ```
|
|
180
|
+
* @param {UserData} user_data
|
|
181
|
+
* @param {Wallet} wallet
|
|
182
|
+
* @param {SecretKey} secret_key
|
|
183
|
+
* @returns {Promise<void>}
|
|
184
|
+
*/
|
|
185
|
+
putUserDataToVault(user_data: UserData, wallet: Wallet, secret_key: SecretKey): Promise<void>;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
*/
|
|
189
|
+
export class SecretKey {
|
|
190
|
+
free(): void;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Structure to keep track of uploaded archives, registers and other data.
|
|
194
|
+
*/
|
|
195
|
+
export class UserData {
|
|
196
|
+
free(): void;
|
|
197
|
+
/**
|
|
198
|
+
* Create a new user data structure.
|
|
199
|
+
*/
|
|
200
|
+
constructor();
|
|
201
|
+
/**
|
|
202
|
+
* Store an archive address in the user data with an optional name.
|
|
203
|
+
*
|
|
204
|
+
* # Example
|
|
205
|
+
*
|
|
206
|
+
* ```js
|
|
207
|
+
* userData.addFileArchive(archiveAddr, "foo");
|
|
208
|
+
* ```
|
|
209
|
+
* @param {string} archive
|
|
210
|
+
* @param {string | undefined} [name]
|
|
211
|
+
*/
|
|
212
|
+
addFileArchive(archive: string, name?: string): void;
|
|
213
|
+
/**
|
|
214
|
+
* @param {string} archive
|
|
215
|
+
*/
|
|
216
|
+
removeFileArchive(archive: string): void;
|
|
217
|
+
/**
|
|
218
|
+
* @returns {any}
|
|
219
|
+
*/
|
|
220
|
+
fileArchives(): any;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
*/
|
|
224
|
+
export class Wallet {
|
|
225
|
+
free(): void;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
229
|
+
|
|
230
|
+
export interface InitOutput {
|
|
231
|
+
readonly memory: WebAssembly.Memory;
|
|
232
|
+
readonly __wbg_client_free: (a: number, b: number) => void;
|
|
233
|
+
readonly __wbg_attotokens_free: (a: number, b: number) => void;
|
|
234
|
+
readonly attotokens_toString: (a: number, b: number) => void;
|
|
235
|
+
readonly client_connect: (a: number, b: number) => number;
|
|
236
|
+
readonly client_chunkPut: (a: number, b: number, c: number, d: number) => number;
|
|
237
|
+
readonly client_chunkGet: (a: number, b: number, c: number) => number;
|
|
238
|
+
readonly client_dataPut: (a: number, b: number, c: number, d: number) => number;
|
|
239
|
+
readonly client_dataGet: (a: number, b: number, c: number) => number;
|
|
240
|
+
readonly client_dataCost: (a: number, b: number, c: number) => number;
|
|
241
|
+
readonly __wbg_archive_free: (a: number, b: number) => void;
|
|
242
|
+
readonly archive_new: () => number;
|
|
243
|
+
readonly archive_addNewFile: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
244
|
+
readonly archive_renameFile: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
245
|
+
readonly archive_map: (a: number, b: number) => void;
|
|
246
|
+
readonly client_archiveGet: (a: number, b: number, c: number) => number;
|
|
247
|
+
readonly client_archivePut: (a: number, b: number, c: number) => number;
|
|
248
|
+
readonly __wbg_userdata_free: (a: number, b: number) => void;
|
|
249
|
+
readonly userdata_new: () => number;
|
|
250
|
+
readonly userdata_addFileArchive: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
251
|
+
readonly userdata_removeFileArchive: (a: number, b: number, c: number, d: number) => void;
|
|
252
|
+
readonly userdata_fileArchives: (a: number, b: number) => void;
|
|
253
|
+
readonly client_getUserDataFromVault: (a: number, b: number) => number;
|
|
254
|
+
readonly client_putUserDataToVault: (a: number, b: number, c: number, d: number) => number;
|
|
255
|
+
readonly __wbg_secretkey_free: (a: number, b: number) => void;
|
|
256
|
+
readonly genSecretKey: () => number;
|
|
257
|
+
readonly getEvmNetwork: (a: number) => void;
|
|
258
|
+
readonly __wbg_wallet_free: (a: number, b: number) => void;
|
|
259
|
+
readonly getFundedWallet: () => number;
|
|
260
|
+
readonly logInit: (a: number, b: number) => void;
|
|
261
|
+
readonly BrotliDecoderCreateInstance: (a: number, b: number, c: number) => number;
|
|
262
|
+
readonly BrotliDecoderSetParameter: (a: number, b: number, c: number) => void;
|
|
263
|
+
readonly BrotliDecoderDecompressPrealloc: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => void;
|
|
264
|
+
readonly BrotliDecoderDecompressWithReturnInfo: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
265
|
+
readonly BrotliDecoderDecompress: (a: number, b: number, c: number, d: number) => number;
|
|
266
|
+
readonly BrotliDecoderDecompressStream: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
|
|
267
|
+
readonly BrotliDecoderDecompressStreaming: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
268
|
+
readonly BrotliDecoderMallocU8: (a: number, b: number) => number;
|
|
269
|
+
readonly BrotliDecoderFreeU8: (a: number, b: number, c: number) => void;
|
|
270
|
+
readonly BrotliDecoderMallocUsize: (a: number, b: number) => number;
|
|
271
|
+
readonly BrotliDecoderFreeUsize: (a: number, b: number, c: number) => void;
|
|
272
|
+
readonly BrotliDecoderDestroyInstance: (a: number) => void;
|
|
273
|
+
readonly BrotliDecoderHasMoreOutput: (a: number) => number;
|
|
274
|
+
readonly BrotliDecoderTakeOutput: (a: number, b: number) => number;
|
|
275
|
+
readonly BrotliDecoderIsUsed: (a: number) => number;
|
|
276
|
+
readonly BrotliDecoderIsFinished: (a: number) => number;
|
|
277
|
+
readonly BrotliDecoderGetErrorCode: (a: number) => number;
|
|
278
|
+
readonly BrotliDecoderGetErrorString: (a: number) => number;
|
|
279
|
+
readonly BrotliDecoderErrorString: (a: number) => number;
|
|
280
|
+
readonly BrotliDecoderVersion: () => number;
|
|
281
|
+
readonly ring_core_0_17_8_bn_mul_mont: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
282
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
283
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
284
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
285
|
+
readonly __wbindgen_export_3: WebAssembly.Table;
|
|
286
|
+
readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hb1127ec8a5f76069: (a: number, b: number) => void;
|
|
287
|
+
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h7964ee7a46fd96a5: (a: number, b: number, c: number) => void;
|
|
288
|
+
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h6d1a6f0013d59045: (a: number, b: number, c: number) => void;
|
|
289
|
+
readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hdcedccdc30da04ac: (a: number, b: number) => void;
|
|
290
|
+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
291
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
292
|
+
readonly wasm_bindgen__convert__closures__invoke2_mut__h2d9c0b8c5965541d: (a: number, b: number, c: number, d: number) => void;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
296
|
+
/**
|
|
297
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
298
|
+
* a precompiled `WebAssembly.Module`.
|
|
299
|
+
*
|
|
300
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
301
|
+
*
|
|
302
|
+
* @returns {InitOutput}
|
|
303
|
+
*/
|
|
304
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
308
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
309
|
+
*
|
|
310
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
311
|
+
*
|
|
312
|
+
* @returns {Promise<InitOutput>}
|
|
313
|
+
*/
|
|
314
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|