The One Question bounty closes Thursday 10 December.

Join in
We Them Media logo We Them Media Support us

Frontend Interaction With Cairo Smart Contract on Starknet

The picture loads from YouTube. The player loads only when you press Play. Turn on captions in the player if you need them.

An instructor leads a class on connecting a frontend to a Cairo contract on Starknet, matching each part to its Ethereum equivalent: the contract interface, JSON-RPC and wallet connection libraries. They build a web app and read values from a deployed token contract. Wallet connection does not work before time runs out, so students suggest fixes and corrected code is promised.

Not by We Them Media Channel: Web3Bridge. Published Tuesday 11 June 2024.

Titles are the owner’s. It plays from their channel.

Transcript

This transcript may contain errors. This video belongs to Web3Bridge. Letters mark each change of speaker.

These are the speakers’ own words. We have not checked their claims.

0:33 A: Okay. Okay, so, so what we want to do today, right, is frontend integration. Frontend integration. So we've written, you know, over the course of, uh, the training, we've We've learned about the Cairo, we've written the Cairo as a programming language, we've written a smart contract using Cairo, we've learned how to test, we've learned how to deploy and, you know, all other things like that. So the question is now, how do we interact with the blockchain? a smart contract. So what we know is that, you know, if you have a smart contract and you just deployed it, so it's only a fellow, uh, nerdy person that will be able to interact with it using, you know, using the indexer or the- what's it called- or the block explorer. So, but if you want users to actually make use of the smart contract, then you have to, you have to, um, what's it called, you have to provide a front end for them to interact with it. It's just, um, it's just a normal interaction. And so this also, since everyone here already has an idea about interacting with a smart contract on Ethereum. So what I'm going to do is to give us, you know, um, I'm just going to give us what we already know in the Ethereum space, their equivalents here. So I'm going to give us what we already know in the Ethereum space, their equivalents here. So on Ethereum, if you want to interact with the smart contracts So there are some things that you need. Number one, when you've deployed the smart contract, you need the API of the contract, right? What is an API? Anybody?

3:16 B: Um, application binary interface, which we use to connect with the- from the front end to the back end. So that's what the backend gives us in form of JSON. Then we can just use it to speak with our frontend, just like APIs in web too, something similar.

3:40 A: So API simply means, um, Application Binary Interface, right? Now, so Sorry, I can't hear anything.

4:12 C: Is that only from my side?

4:13 A: It's not only from your side. It's not only from your side. Okay, so on, on Ethereum, you know, we have what we call, um, ethers.js, right? Yes or yes? Yes.

4:44 B: Yes, yes.

4:45 C: Yes.

5:36 A: Okay, I hope everyone can see my screen. So I'm trying to- normally I don't- let me just put README here. So today's class is- Uh, what's this? Thank you. Um, true. Let me just put this here. So since, you know, the people that we are talking to here, they are not novice into the world of integrating, so we just look at, um, comparison between Ethereum. We are just going to bring our knowledge of Ethereum, we are going to bring them towards Stagnate, right? So on Ethereum, if you want to connect, we have what we call what? ABI. So in this place also, we also have what? ABI. And what is ABI? Application Binary Interface. Okay, now we know that when you want to connect with the, you know, with the backend, or which is the blockchain basically, there is the protocol that you make use of, right? So the protocol is called what? Yeah, we have the JSON-RPC. That's the medium of communication. In a normal Web2, in normal Web2, you want to communicate with the what's it called, with the backend, you can use the HTTP, right? You can make use of the HTTP request, the REST API. But in this place, we use what we call the JSON-RPC. Now that JSON-RPC, there is now an abstraction over it that you can make use of in web- in Ethereum. On Ethereum, you have connectors like It has JS, right? Web3.js. Web3.js. Which other one? Third Web.js, right? Is it Third Web.js or what?

8:29 C: I don't even know.

8:34 A: Then we have the- we have Vim, right? So we are- we have all these ones. that you can make use of in order to connect to the backend. In StarkNet, what do we have? We have just one. We have the StarkNet, the StarkNet.js. Do you get? Now on Web3, we have what we call- we have Wagmi, right? What is Wagmi?

9:04 C: Well, gonna make it For connecting, for they use it with all these VIM and packages.

9:20 A: Wagmi is the provide connection React interface for for Ethereum. So in this place we have what we call what the Stacknet React. This one that you don't even know Wagmi. So in

9:35 C: this case,

9:38 A: uh, StarkNet. Yeah, so we also have, you know, uh, wallet connectors, right, on StarkNet, on Ethereum. I mean, now we have wallet connectors on Ethereum. So we have- what are the wallet connectors that we have? We have GateKit, right?

10:03 C: Yes, yes.

10:04 A: Which other one do you have? Web3 modal. We have connect, we have Web3 modal.

10:12 C: Web3 React.

10:15 A: So in StackNet.js, we have- what do we have? We have get GetStackNets. We have GetStackNets and we also have StackNetsKit. We have these 2. So when we have all of this, we are good to go. So I hope you already know the kinds of front- the kinds of wallets that we have in StarkNet now. You don't need to- you don't have to be told. What are the front- what are the wallets that we have on StarkNet? What are what?

11:02 C: Agents, Bravos.

11:05 A: Agents, Bravos. So, um, so Agents and Bravos, basically. Okay. So what we are going to do now is, okay, let's try to Let's try to- what's it called- let's try to bootstrap a front end. Let's try to bootstrap a front end. And I know there are different ways in which you can do it. So number one, in fact, that I even showed you, this is enough. This is enough, the class. Like with this one though, I can say that, okay, since you already know that in Ethereum you want to do this, you, you need this, you need this, you need this and that. So, and I've given you what's their equivalent in, in StarkNet, then you are, you are good to go. So let me not leave it like that. So let's, let's do something. So what are we going to do? So let's say that we want to, uh, we want to create a front end, and in the front end we want to make use of- so, uh, we want to make use of, like, want to make it from start. So what we are going to do is we are going to try to do it from start. That is, we are going to create a, you know, a Next.js app and try to install everything on our own from start. That's number one. Number 2 is now we are not going to explore the different, um, what's it called, we're not going to explore the different, uh, templates that you can make use of to easily bootstrap it. So let's start with, um, with creating So in the one that I want to create, the StarkNet that we are going to use, of course we are going to, um, the StarkNet.js is a constant, the constant key. Then, um, StarkNet.js, we use the StarkNetKit. So the reason we are using that one is because that's a 1.2 We can use StackNet to get, um, the- in fact, you get StackNet. So it's in that. So that's all, that's all, that's all. Okay, so what we are going to do now is, you know, Right, so how do you even do this again? Create next app. So what is the name of our project? What should we name it? AAOS. Those are the first letters of the names of the people that I saw there. AAOS. Do you want to use TypeScript? Of course. You have to. Yes, please. Of course, of course, of course. Would you like to customize the import alias? No. All those ones, they are Yeah, in our dictionary. So the first thing that we are going to do is Okay, so, um, created here. So, let me check. Okay, so we all know what this means, right? Yeah. Nobody is here. So The first thing that we are going to do is you go to- you go to the GetStackNet this time. No, no, no, the StackNetKit rather. So let's go to the StackNetKit and try to install that first. So to install the StackNetKit, you just have to do npm install StackNetKit. So where is it? So in this place we say bun add stacknetkit. So how do we install it? Get

22:29 C: started. Sorry, out of curiosity, Don't mind me, sir. I see you're using Bun.

22:34 A: Yes.

22:36 C: Yeah, but I don't know what it is.

22:40 A: Ah, you don't know Bun? It's a JavaScript runtime. This is it. You can check bun. Okay. So the way it works is that- okay, we still need a provider. This is not okay. So we've installed that, we've installed StackNet. So the next one that we are going to install is, uh, StackNet.js. So npm install. So for the latest, so I would want us to use this, this one with the latest feature so that we don't, uh, we don't see any, any error. So npm- so that's going to be yarn add startnet@next. Okay, we install that also. Um, then it should run something. Sorry. Okay. Sorry, I need to, I need to check something. Okay. StackNet, StackNet, and the StackNet.js, right? So what we are now going to do is let's try to connect to a particular- let's try, we are going to set it up first. So what I'm actually looking for is the one that has Uh, the one that is going to give the provider- all these ones, you have to, you have to write a significant amount of code. Okay. This is the same for all of them. So it's going to send all of them in there. Then we are going to So, uh, we are going to try to interact with the contract. So let me just look for one of the contracts that I've already deployed. I'm going to look for one of the contracts that I've already deployed on Starknet. I have one ERC-20 contract. I just- somewhere. Address, wage. Okay, so let's work with this. So this is a contract. Okay, I want to see if, uh, okay, this one is a 2.4 by 3.

31:24 C: Oh, we can actually see the- we can actually see the screen, sir.

31:27 A: You cannot see my screen?

31:28 C: Um, I can only see StarkNet GSA.

31:40 A: You should be able to see my screen now.

31:42 C: I can see it now.

31:47 A: You can see it. Where am I?

31:51 C: Voyager.

32:00 A: That's what you should be seeing now. Sorry, let me check again. I'm trying to look for a, um, a 2.6.4 contract. Let me just see. Open transfer. Why are all these contracts Okay, as a test token, I want to allow- so this one now, it allows anyone to meet. So anyone will be able to meet using this. So the good thing about this is, you know, as it is a Starknet, so you can go to the contract and And also we deploy it. Um, so if you want to- the contract address, well, the first thing that we need is the contract address, right? This is the contract address. So let me just come to our page here. So in our page, you can just create, uh, the utils folder. Inside the source, inside the source, you can create the fields. And in this place, let's just say contract. Should we make it JSON? Let's just make it TS. So here we can say we can export constant So this one will be what? Contract address. So this is the contract address. Then the next one, the next information that we need is the ABI. So this is the contract ABI, so you just copy it. So this is the contract API. So we already have the API. Now let's go to- what's it called? Let's go to StarkNet.js. and understand what are the things that you need to, uh, what are the things that you need to have if you want to interact with the contracts. So, you know, Starknet, this is the normal, normal thing. You can run it on the local node and you can also connect to- so this is the way it is. We have the Starknet network and then we have your dApp, right? This is the StarkNet network and this is your dApp. So the, the what connects StarkNet network and your dApp is what StarkNet.js is, the bridge between your dApp and what, and the StarkNet. Which means that basically most of the things that I want to do on the frontend, we are going to- it's going to require us to use this StarkNet.js. Now in this StarkNet.js You know, we have, uh, what we call- we have, uh, provider and we have signer. Now anything- any- number one is that anything that requires writing to state is going to require what? A signer. Do you get it? It's just like in Ethereum also, you know, we have useContractRead and useContractWrite. So for useContractSuite, you can only use- you can use what? Provider. You don't need to add wallet to it. But for anything that requires what? Signer, then it's going to require, um, what's it called? It's going to require a private key. So which means that you have to be connected to the wallet. So let's start with the account. We have account and we have contract. So if you want to deploy an account, you can make use of what? A provider. Or if you want to deploy a contract. So both, uh, all the accounts here are smart contracts. So you can make use of this provider to interact with an account or to interact with a contract. And we also have this utils. Now in this utils, that's where you are going to see, um, stuff like maybe you want to convert from fields to string, from string to fields, all those ones like that. You are going to find them here. So you see that only provider objects is talking directly to the network. So your dApp will talk mainly to accounts and contract objects. So you will define the provider with which network you want to work. So we have signer and utils objects contain many useful information for interacting. So the contract object is mainly used to read the accounts. So the contract is used to read from this thing, while the account does, uh, it has wallets. It can add wallets as a way to pay fees to the network. So the accounts- we have contracts and we have the accounts. So contract is mainly for reading, while accounts can be used for writing. And that account also, you are going to have You are going to have the signer in it. So this one is now saying, how do you, how do you connect your network to StarkNet? So you can make use of any of these. The number one thing is for you to import the provider. After you've imported the provider, then, you know, the provider, you, you can put in the sequencer. We've talked about the sequencer, right? So this sequencer here is for mainnet, this one is for Goerli, this one is for Devnet. So you can do it for, um, you can do it for Sepolia also. So this is Juno, these other clients. So we can do- so this one is for testnet. Then after you've done that You can now start specific methods. Some methods are available only if connected to a sequencer and some are available only if connected to a node. That is using RPC. So for example, if you want to estimate the fee of an L1 to L2, you need to use the method that is available only in the sequencer. So look at this provider. Estimate fee. So connecting to an existing account. So you can also import accounts from, uh, from StarkNet. Now when you are making use of accounts, it has accounts, they have what's it called, they have a private key. So it will require you to make use of what, of private key. So we have provider, new provider, this is this constant private key equals to this. Account address. So you know, so that account, new account is provider, account address, and what, and private key. So this is how you, this is how you create a new account. You already know what the provider is, you already created that, then account address. And so you can also create a contract. Yes. So to connect to a deployed contract, you don't need this. You've already got the- so if you want to get, what's it called, um, the ABI, you can make use of this to get your ABI directly. However, this is not ideal. So the reason it is not ideal is because if you are getting your ABI directly from the provider every time, every time, every time, it means you are going to be giving the provider load, you know, the RPC that you are using is going to be overloading it. So that's the reason it is not ideal to be using, to be using that. Okay, so this is how to connect to a contract. So we have new contract. You can see here you have the ABI, the address And the what? And the provider. The ABI, the address, and the provider. So if you want to interact with your contracts, you have, you have your dApp and you have the contract. So if you want to read anything, read, you can call the contract using the provider. However, if you want to write, you want to call, or you want to invoke, you have to make use of what? You have to make use of an account. You get- you have to make use of an account. And, um, so this is like- this is an example of how to make use of- how to use normal providers. So, but if you want to write, you can see that in this case now You just connected the contract that you've created. It only requires a provider. But if you want to write, so this one is write to contract memory. So you can see this one now, write to contract memory. So let's, let's do some, let's do some practicals now, you know. For, for this, now one thing that I also prefer to use is that, you know, because this one now, because this, it is, um, how do I call it, because this one, what we are doing here now, we are using the, um, an app router. Right, we are using an App Router. So I'm just going to give you one, one small tip. So I'm just going to give you one small tip. You know, we have different types of state management, uh, this thing in, in React. So the state management that I now I'm also like learning now, so we are just going to use it here together. So we are going to use the resource tag. So I think it should be easy to use because of the documentation. So if we make mistake, you know, I think this is it. Yeah. So we are just going to install the Zustand. Now, why am I using this Zustand? So the reason I'm using this Zustand here is because it is- it gives you the functionality of, you know, instead of using, um, createContext, uh, useContext, and all those stuff like that, instead of using that, if you use Zustand, you don't need to createContext. But you can- you don't need to create context, like wrap context around all your React files, but you can still make use of- you can create hooks and just use them. So that's the reason I feel that this makes sense, and I think that you guys love it too. Don't mind me, I like using- you can see I'm using Bun, I'm also using ZodStart. All right, so we have-

45:06 D: hello, sir.

45:08 A: Yes.

45:10 D: Yeah, um, if you, if you on your VS Code, the, the, your code snippet is, um, is tiny, you can zoom it so that you can see you know, stuff that are going on there. Yeah,

45:26 A: this- okay, how about now?

45:28 D: All right, thank you, sir. It's okay now. Thank

45:32 A: you. Okay, so, so the way it works is, um, in this one you are just going to create a store. So I'll just come to- should I use this? So in this place, I just created the stock, and let me name this one stocknet. Yes, or start Nestor. Then let me- I'm going to copy this. So in this case now You know, this, this TypeScript supposed to indicate that I'm using TypeScript. Yeah, this place here. TypeScript. So I'm just going to copy this. So in this case now, you see we have import createZustand, type Store. We have So this is a state variable, this is, uh, what's it called, this is a function and all other things like that. So let's see what we can do with this. So I think we are going to just name this TaknetStore. So in the StackNet store, what are the things that we need? Number one, we need a provider and we need a- we need a provider and we need an account, right? So we need something to- we need a provider, a universal provider, and we also need- so we can just So we can import this. Okay, we need a provider, we need an account, but this account We are going to get it somewhere else. Hmm, let's think. Okay, so when we have provider like this, we can actually have, uh, what is it called, set provider also. Something like this, like something like this. But we really don't, we really don't need it, do we? Because we can just use Darknet store. And yeah, so the provider here, we just So let's go to- so we are just going to use this, but our own distance now, uh, the SN- wait, where is this constant coming from? The constant should be from the utils. Okay, so this one should be SN Sepolia. Okay, what's this? What's your problem? What's the color of the problem? Network. Okay, another thing that we can just do instead of, uh, all of those problems, so you can just use this one, you can just use this, and we just make use of an RPC update import. So we just make use of an RPC So to get the RPC, we are going to use Voyager, the free Voyager RPC. Voyager Online. So there is a free RPC Okay, so this is it. So just use the Sepolia genome. Okay, so we are- we already have this. Now what this cert provider is going to do is just going to- this one is going to give us, uh, what's it called? You can use this to set- you want to set the, uh, the provider somewhere else. So you can make use of this to provide another provider. That'll be- that'll be- so let's export this here. So which means that with this one that we have here now, let's We can just go to, let's say, in the page. Let's remove all these ones. Oh, let's- okay. Let's just change one. Let's see how it looks like. Hello from April Bridge, right? So we can just, um, so if you are going to be using that, uh, provider, so we need to set useClient, right? Then we say const provider. So we are using the Starknet store right now. We can then, we can then bring in, uh, what's it called, those, uh, the contracts. We cannot view the contracts. So you know that, so for the contract, we have ABI, contract ABI. Are you not supposed to be- The utils in this place now is contract API. Are you not supposed to have the imports? Oh, it looks rubbish. What? Um, is rubbish now. No, now that's wrong. It's used, uh-huh, contracts. Yeah, so because that's not the only thing there, so I think we also have the contract address again. Cool. So we put the contract address here too, and then the provider, right? Okay, so we have this. Now you can see it gives us this. If we are going to be using async, then we have to put, um, what's it called, async in this place, right? So this balance that we now have here, I can now- so balance of contract- no, no, no, no, no, not balance of contract address. In fact, that's not what we want. Let's get the name of the contract. I've been- let's get the name first. So let's, let's check that out. Hey, are we in goal or position? Oh, wait, wait, wait, wait, wait. How can we do that? Or is it because of the async? Okay. So I think if you are going to use- there is already layout here. Now you'll be able to use async in this. Okay, we have to use, uh, what's it called?

59:31 D: I think you can actually create another async function apart, like another function on its own, an async function. It can handle that.

59:47 A: It can,

59:52 D: like, um, you can create an, like, another function, an async function.

59:58 A: Async function is only in server components. That's what it's saying that you can only- error: async or await is not yet supported in client component. Release server components. This error is often caused by accidental adding this. Let's, let's check it out if this will work. Let's add async here. AwaitAsync. Let's see. So because of this, so because of this one now, it cannot use, um, it needs the UseClient. Meanwhile, async cannot work in the UseClient. So, um, So the- what we can do here in that case is, okay, let's, let's remove this first. So this one is Since this is still simple, provider. Okay, so let's check this out. What's the problem again? Expected indentation. Where, where, where, where? Export default as in exactly 7 months. I don't understand. Cannot read property of undefined. So let's check the Contracts might not be there. Who are the name? Contracts. There's name there now. Why are you doing this? Oh, oh, oh, so the thing is there is possibility of this one being undefined. Cannot read property of undefined. That's wrong. See you. See you. Okay, so I don't have time. Supposed to shoot, supposed to just walk. Okay. Cool. I think if you just use this line, I think there you can start. Oh, we might have to call all the tests inside. Since we have use client here, then it means we can

67:02 C: Why not, why not create a useEffect around

67:06 A: clients? That's what I want to do now, though we still have to remove it later. Okay. Let's- so let's see, name is currently nothing there. Contract address. Wait, why is name not there? Oh. Okay, let's check the signals.

69:30 C: This is reading the contract instance, so we won't see the data inside.

69:36 A: Let's bring everything like this. Okay, this is now- this is supposed to work like Fetch. Okay, okay. So what also usually is Is something provider. So let's see if this works. Okay, these 2 is supposed to work. Try easy. Now I'm thinking maybe there is something wrong. Get chain ID is supposed to work now. String. So, okay, so after it's done with the API provider, Something is wrong with the provider. Let's redo it. See the same thing. Provider equals to- Okay, this is now. That's normal. How am I supposed to work? Oh, API rate limit exceeded. Wow. So what we have to do is get Okay, I think it's possible to get an Alchemy RPC or an Infura RPC. So what is wrong is I think the rate limit of the RPC is exceeded. So that's the reason. So let me try to get an I like this. So I'm going to be using the Infura. Where is it? I'm going to be using the Infura. Let me just look for how it is connected. Okay, so let's try this. So the reason it wasn't working was because of Let's see if. Okay, so let's try this. Contract address not found. Okay. Contract not found. This is a Boolean. Oh, this means it's expected non-whitespace character after JSON. Solution 64. Unexpected non-whitespace character after JSON, at position 16. This one is Most likely because of this API. Oh, oh, oh, oh, okay. I think I get it. It's a bit- All right, Jason. One is good. Let me just remove this. Again, transfer. Very nice. Okay, I think another thing that we can do is we should copy this Contract here, we can go to this place and you say getClass, getClassAt. Okay, this one is limited, so we are going to use our own This is realistic. Okay. Ah, same error. Unexpected token ID. This is mainnet. Wow, are we making the same Are we making the same error? Okay, this works. So I guess there is an error somewhere. Let's remove this first. This is Sepolia in the page also. And let's now look for this, this contract class. This is the API. The same error. Okay, so we have the same error just now. I guess we need to use another contract. Let's look for another contract. Z has a contract on- oh, let me Let's try this. Please class hash and try that. Yes. Let's try this. So why something that name is not a function? Okay, let's look for the functions in this one. I think this was it. Create contracts. That's it now. Okay, let's try. Let's try this first. Okay, um, so I think we need to first console.log Let's see what we have there.

102:11 E: Hello, sir. There's a function called getName. Try that one.

102:29 A: Okay. This is not the panel. The section- That's contract. This is the contract address. Let's check. So why is it not showing something? There's supposed to be a console log. May the main So maybe what we would do is, so you revert back and- This client, or there's another option. We use that after this. So const, right? Okay, it is showing here. It's displayed by an argument. No, no, no, no, no, it's not showing. Okay, so it is showing this now. The problem is we now we need we need to convert like this one now is in felt. So we need to convert from float to string. We need to convert from float to string. So, um, Okay. Okay. What's the name of this? What's the name of this? Uh, something like this. So just go to our view, it's user. So this one will be fieldToString. So fieldToString. Okay, so let's check what they gain. Yeah, so I said I was going to- is that instead of this place, actually, instead of like putting There it is. I'm using all these, um, let me just look. Sorry. Okay, instead of putting all of this in this place, instead of putting all of this in So we can actually- so since we already- so we can actually just build this, uh, in this form. So we can have, let's say, contracts. Contracts. So if we have that So this provider is already- this provider is actually the one here. Ah, I've forgotten how usually It's initial provider. Okay, so this one now, this contract here. I use it in this page here. So let's say instead of using this useEffect and this, so we should be able to say that, uh, wait, we still need to await contract equals to this. So this await is the problem. So which means instead of using await, it just says So let's see, let's see if that works. Okay, it works. So which means that with this now, with this now We've already like- we already have the, the contract. So what are the other things that we can get from it? What are the other things that we can get from it? So you want to get the balance of someone, so we can use this to get it. But no, let's check, let's check the contract again first. So that is it. You can do- Read contract status. So you want to use getSymbol. So we are not doing this. So let's get symbol. Symbol. So that would be contract.getSymbol. So when it gets the symbol, it's also going to convert that. So let's check. Then we can get decimals also. Okay. I don't see it to, to the center. Okay, so we've read symbol up again. This is not it. Let me just put this here. So let's get decimal. Let's read this decimal. So we already know that decimal is going to be a number, normal, right? So there's no need of There's no need of converting this. Hey, is it also in 13? Let's check. Let's pay each month. Okay, I think there is something with this one. The query is not even showing anything. Let's see the query for this one. Cannot report your phone defined. Wait, okay, I might need to Report this. I think it's that late meeting or something. It's affecting everything. Get this also. So the next thing that we are not going to look at, the next one that we are not going to Where's the song? I'm not sure. So all these ones that we've done now, all these ones, they are, um, they are read contracts. So what if you want to do a write contract? What if you want to do a write contract? So if you want to do a write contract We need, so I'm just going to look at. I'm going to show us how to integrate what connection into it. New account provider. So where is StarkNet? It's So the way this one works is we have connect and disconnect from. So to establish a wallet connection, you are going to do this wallet equals to await connect. So below is an example. So you can have connect wallet which is going to do all of this. So in our own- this thing here, we can have connect wallet. Let's say we have connect wallet here. Let me mute this here first. So what this one does is when you call this- let me- I'm going to copy this and put it here first. So this connect is coming from StarkNetKit. So if wallet- and so set connection. So here we need a connection. So in this place you can just set connection. For now, let's make it any. We have address, address, then so we have provider and we have selected address. So let's have set address. Okay, this and this. So address wallet. Okay, let's just use this one. Set provider. So we have connect wallet here. So let's try, let's try something, um, on the page, on the page. So you see this line, so we are going to have a button here. Yeah, so we have this. So let's see what it gives us. So we should click on it. Oh wait, it's supposed to call this. In this place, let's see how it connects. So I think what's going to happen here is that instead of- So since we have all these set connections, set address, It's set connection. Okay, set address. So we can also have- we have set provider. So we just have- where is it? So in this page here, instead of this, we have this. This from here. Now all these sets connection, they will now come from All this set connection will now come from, uh, set connection is going to come from here. So set connection, set provider, set address. Yes. So let's, let's see what that gives us. Connect wallet. Oh, oh, oh, oh, wait. Okay, there is no I was expecting that to give a modal actually, but it's not. Yes, sir. So I have 2 theories on why that is not working. One of it is that it is probably because I don't think, um, there is a StarkNet wallet on the browser that I'm using. Okay, so probably because there is no Okay, connect wallet. Disconnect. Okay, so I think this is one aspect of it. There are some, there are some things that we are not able to do here, but let's use the template of the StarkNet React. So I believe that With that, make less, make less mistake. Okay. So, to start, just- So, we are going to- So we are going to move to the back, then here we say coupon create account. So is there- let's just use Wagmi. So we are using Next.js. So this one is going to bootstrap most of the things for us. Then you should be able to continue from there. Okay, so login, then So I need to open this first, then bind on get. Okay, so this already has- so we can just include another chain here, which is this folia that we are using. So you go to, uh, localhost. So this one you can choose. So let's say we are connecting agent. So for this one, just like I've mentioned, yeah, there is no wallet, there is no wallet on this browser. On this browser, I guess there is a- there is wallet in this one. Yeah, there is wallet in this other one. So I'm going to look for a way to- okay, let me Yeah, so there is wallets in this one, so I can connect to Bravo, I can connect to Argent. Yeah. So what I'm going to try to do now is let's, uh, Let's see, you want to call- you just copy from this place. What do we want to copy? Yeah, we need this for this. Let's copy this views first. So we just copy it and then I'll see paste, then copy again. So I guess in utils we already have Have this, then contract also. We already have contracts. Then we can also just copy this. This is our store. You can see that that's nice. So if we should copy our store and we paste it here, let's see if it just works. Then in our page here, let's see if we can just Do some stuff here. Okay, let's, let's try something. This page that we have here, let's copy the whole page, then go to- then we are going to create the new- let's see, let's use from and paste, paste it here, right? So we've not installed StarkNet yet here, so just install it here. Stack- oh, I've written the stack nets. Okay, so let's, let's, let's try it. Let's see if it will just work or we still have to fix something. Oh, we not, we not add, um, just add, just found. Have you now? Where is itself? Source path. Let's see. Okay, so this, this just works. Let's check this. Okay, this is still not working yet. Okay, let's check something else. What if- what's wrong with this one? Okay. Okay. Oh, you are supposed to even do it from here because that place doesn't have Then copy as such, then connect this one. Okay. is its age. So, sorry, let's check something. So, user accounts. So when we are using accounts, if you are going to connect to If you are going to connect to- what's it called- we are going to connect to this, uh, to the contract using the account. So we are going to- so in fact, instead of in this place, we can use it there. Ignite is it? Store, partner store. Yeah. So from here, use the accounts, then- So we can now use this account in this place instead of provider. So if you have accounts in this place- Hello, everybody. Hello, everybody. So since you are using accounts now, contract. So we have contracts. So you can use contract.call. So this contract.call now is going to have, uh, the method that you want to call, then the arguments. So let's look at the contract. I think there is mint function in the contract. So in the right, how can we call like this? Okay, let's try this transfer. So we call transfer, we have recipient and amount. So the transfer- not want to call transfer. So the recipients We have recipient and amount. So let's say that the amount is 200 and recipient is- so I'll just do- I'll use my Bravo wallet as recipient. And yeah, so I'm going to connect my agent. So, this one now. Okay, it's not allowing it there. Let me bring it here. Okay, so let's try this again. We are going to- ah, cannot convert to a gigant. So let me put private key there. Okay, so accounts, connect wallet, transfer. Why is the modal not working? That's the problem. Okay, so I don't know the reason the wallets are not popping up. Contrast to the sclera is negative. I don't know the reason the wallets are not popping up. So this is supposed to pop the wallet up. That's supposed to pop the wallet up. Yeah. So then I'll copy this. What? Sorry. Thanks. So, I don't know the reason the wallets are not popping up. I don't know the reason the wallets are not popping up. Maybe I'm going to look for a way to fix that and send you guys the code, but we just have to stop here for now. Time has gone ahead. Wallets are supposed to be popping up. I don't know if it's in their hands.

182:08 F: I think wallet doesn't pop up. Like, I think because you've connected before, that's why this is not popping up.

182:22 A: What?

182:22 F: So you have to- I think because you've connected before, that's why it's not popping up.

182:27 A: Like, in this place, the status is disconnected.

182:32 F: Okay, the thing is, when you click on connect now, because you've connected before, it just connects automatically. Automatically. I think you need to remove it from your connected app.

182:46 A: Yes, yes, yes, yes, that's true also. Okay, that's another thing, but then it's cool. So it means someone will have to create a new account. Um, well, anyhow that it is, I'm going to look for a way to fix it. And yeah, I'm going to send you guys the, um, the code of the fixed version. So we are going to stop here. Thanks for joining the class. Thank you.

183:40 D: Thank you, sir.

183:41 A: You're welcome. Thank

183:47 F: you.

More from this hub

Something wrong, or a video you want off this page? Write to wethem.xyz@gmail.com and it is fixed or taken down within 48 hours.