[Question] Is it possible to compile "cargo-near" into "wasm"?
Closed this issue · 1 comments
I want to compile "cargo-near" into wasm and do "cargo near create-dev-account" inside react. But after git clone, I tried to compile it into wasm-pack, but I keep getting errors.
- Is it okay to compile "cargo-near" into wasm and use it?
- I want to create an account by calling create-dev-account inside the react rather than cli, what should I do?
@KimCookieYa You don't need cargo-near for that. There is a faucet service that you just need to call with the account ID and public key, which will create a new account on testnet for you. There is also implementation for that in near-api-js:
Here is how it is used in near-cli (JS):
Just for the reference, here is the implementation inside near-cli-rs (which is used by cargo-near), that uses the faucet API to create a funded account on testnet: https://github.com/near/near-cli-rs/blob/main/src/commands/account/create_account/sponsor_by_faucet_service/mod.rs#L78-L83
Here are two testnet faucet services that I know: