const tx = await program.methods
.initialStore()
.accounts({
signer: authority.publicKey,
store: store.publicKey,
storeVault: vault,
})
.signers([authority, store])
.rpc();
вот тут уязвимость, можно сделать sql-injectiondiesel::dsl::sql(&format!(r#""{}"{}"#, key, value))
Ну, глупо не глупо, а пособеситься охота. Что ж, придется химичить)
Если правильно понял, то файлы d.ts в проекте, где у меня нет файлов js, не нужны?
const file = document.querySelector('input[type="file"]').files[0];
const totalBytes = file.size;
let bytesUploaded = 0;
await fetch("<upload file url>", {
method: "PUT",
headers: {
"Content-Type": "<file content type>"
},
body: file.stream().pipeThrough(new TransformStream({
transform(chunk, controller) {
controller.enqueue(chunk);
bytesUploaded += chunk.byteLength;
// report progress
},
flush(controller) {
// report finish
},
})),
duplex: "half", // нужно так как у нас не ReadableStream а TransformStream в body
});
Ванильный js это XMLHttpRequest. а fetch это высокоуровневая обертка.
Это плохо, потому что только он позволяет отслеживать прогресс загрузки
Можете на его основе свой составить https://github.com/bingo347/eslint-config