NEWTON
Asked
11 months ago
128
views
0
Hi everyone,
When i try to invoke my functions with arguments from my frontend app using starknetjs, i get error invalid character, which i presume is an issue from my function accepting felt, but i'm passing texts. Is there any way to convert to felts from the browser or does starknetjs do this by default?
Anyone knows how i can solve the error?
This question was originally posted on StarkNet Discord
Newton
asked
11 months ago
0
Accepted answer
Hi,
invoke
like in invokeFunction
on the Provider ?
1- There is nothing wrong about using strings. You should use string as you can see from the type that is used in the invokeFunction
here https://github.com/0xs34n/starknet.js/blob/b4785793ea912dc8562de4c69b0dcbda4358e144/src/types/lib.ts#L20
2- The correct way to proceed (assuming you want to write to the blockchain) would be (1) create an account and (2) execute
a contract function from that account. But before that, did you connect to your wallet? How did you do that? The way it works is the transaction needs to be signed by the user and the easiest way is definitely to ask your wallet to sign it for you.
3- You also need to check the version of starknet-js. What version are you using?
4- If you are stuck, there are several things you could do: (1) find an example and make sure it works; (2) explain where you are stuck (3) provide the code extract and the exact error message you get in details
This answer was originally posted on StarkNet Discord
Newton
answered
11 months ago
anyone know how to disconnect the connected wallet on the frontend with starknetjs or another way?
How can I interact with my contract on Starknet using starknetjs?
How do I connect my DAPP to Starknet mainnet using starknetjs?
How do I connect my DAPP to Starknet testnet using starknetjs?
How do I connect my DAPP to a Starknet node using starknetjs?
How do I connect my DAPP to Starknet-devnet using starknetjs?
How do I develop against cairo devnet with browser wallets?
What are the efficiency gains of direct Cairo vs. transpiling with warp?
How do I log/print in Cairo 1.0?
How can I pass an array of felt to call with Nile in StarkNet?
How to import uint256 in Cairo?
A switch statement in Cairo lang to set two distinct values
How does Account Abstraction improve the UX compared to other methods?
How to install Nethermind's Solidity to Cairo transpiler without an error "command not found: warp"?