Skip to content
by Unity Nodes
NEAR Protocol

OpenClaw Agent Swaps via NEAR Intents: How to Get Your Bot to Swap Tokens on Your Behalf

about 6:31 long

Nothing is loaded from YouTube until you press play, and then without tracking cookies.

About this video

This tutorial walks you through how to leverage NEAR Intents with your OpenClaw agent and have it perform swaps on your behalf.

NEAR is the Blockchain for AI Website: near.org NEAR AI: near.ai Intents: near.org/intents Chain Abstraction: proximity.dev Sharding: nearone.org

For the devs GitHub: github.com/near Dev Docs: docs.near.org Devhub: devhub.near.page @NEARDevHub

Connect with socials Twitter:   / nearprotocol   Blog: near.org/blog Medium:   / nearprotocol   #NEAR #nearprotocol #NEARAI

Transcript

1,186 words

Captions as YouTube publishes them, usually machine-generated, so product and people names can be misheard.

  1. 0:04

    Hey folks, in this demo I'm going to show how to use your agent using openclaw or whatever else you might be using to actually leverage near intents and actually make a swap directly inside the agent. Um there's a couple things I want to preface here that are important to understand how this all works. Uh you can do this a couple different ways where you can actually install the CLI

  2. 0:26

    um directly and using that you can actually have it execute stuff. The challenge there sometimes might be is one two parts. One is obviously if where do you keep keys? Do you give your bot a wallet? Um how do you structure all of that? Uh if don't want to give them a wallet, you can have it just create the deposit address for near intents and it will do that for you. Uh there's also

  3. 0:50

    another path here that we can go where you actually give it a wallet and you allow it to start to try to execute some stuff on their own. I think it's a little bit more interesting to see if we can actually get it to use that. So I did have it make its own wallet already.

  4. 1:03

    Um and we funded it just with 10 year so that way we can kind of go through this demo here. But it's up to you how you do that. There are security implications about putting your private keys and giving all that different stuff. So just be aware of that. But I think it's really cool to see for the demo. We can actually get it to use its own wallet to make a swap for us. So, previously I have did a marketplace demo. That's what you see here. So, I'm now talking to my

  5. 1:26

    agent and with that prepared wallet, I'm going to have them swap here on intent. So, let's let's ask them to do a swap on intense. And again, the idea here is that I want the agent to do as much as it can on its own. So again, as I mentioned, I preset a wallet here and it should use that. So let's see if it goes and grabs its wallet and checks what's in there. Let's see how it sets up. So there's a couple different ways of how you go about this.

  6. 1:54

    Whether you install the CLI, whether you set up a skill, you know, there's some options here of what's the best way to do this. Uh if you go to near uh near intense docs and you provide those docs to your agent, it will parse out some things from there. will leverage like the one click even um to do some swaps on its own as well. So there's a lot of flexibility here of how your agent can

  7. 2:19

    learn and it's also dependent on how you want to leverage that. So here I'm just asking to do a basic swap. Um again I do not have mine set to be um overly verbose and so it is doing work right now and doing stuff in the background and then will report back to me. Um you can possibly set your your agent to be certain amount of verbo verbosity of um you know as it's doing things it's planning it's thinking and going through stuff uh it can show you different things but uh I'm using telegram and I'm

  8. 2:50

    highlighting it on the phone because I think it's really great to see how you could be on the go. Um the idea here is to be able to maximize your time to do different things. Uh so I am not tethered to a desk necessarily to work with my agent by any means. Uh but you could be using Discord, you can be using WhatsApp, there's all different options out there of what you can actually

  9. 3:11

    leverage for this. Um but Telegram kind of is a nice way to go about it. Uh if you see at the top there, um I do use topics and uh the nice thing about topics is obviously lets me organize my own thoughts a little bit better. Um but it also gives some different context for the agents as well per different category. All right. So, it's it's doing that. It's going through. It's checking its wallet config. So, it's going through all the different steps. Great.

  10. 3:41

    Okay. So, it looks like it went through and uh swapped. So, let's actually see if it if it did what it's supposed to do. Let's check this out because it just just did stuff. Um, I did prep it a little bit of just like, hey, we want to do a swap, but, uh, let's look at what this is here.

  11. 4:06

    Uh, so it looks like it, uh, this is great. Okay, so it it it transferred 2N to that address. I'm going to bet that is the deposit address. Yeah. So, deposit transaction. Let's see the actual swap. Here we are interacting with intents. That was our original wallet.

  12. 4:33

    Let's see. Let's see. Okay. Message intent transfer. There's our two near. There's our wallet back signer. Yeah. Okay. All right. Looks like a new owner. Okay. Okay. So, there's there's all that. So, that looks that looks good. It's all it's all there. Uh let's let's jump back here for a second and let me click into the original wallet.

  13. 5:20

    So look at that. There is two USDC on there uh that it purchased with the two near. Uh pretty cool. So that worked. Um that was pretty simple. Now you say, "Oh, this is just demo whatever." But um again it alls I did before is I actually I gave it the directions and I I gave it the documentation from near intents and I said go learn this and then I asked it to go and swap to near for two US you know for whatever the equivalent price

  14. 5:58

    quote is in USDC which ended up being about two near about two USDC and go from there and it just does a swap and you can see it even took the ch did a dry run first and then it actually executed it. Um, so it went through all the proper steps it needed to now as I do things going forward and if I need to swap I can just let it do that. If it needs to do a swap and then maybe interact with like the near marketplace at marketplace.near.ai, it can do that now as well. If it needs to swap a token in order to actually

  15. 6:31

    better do that, it can start to do those things. And now as it's learned this and it has been able to access this, you have a great opportunity to really expand your bot's capability. So this was the using near intents here right in my agent and you can see it worked uh and it and it went through uh no problem. That's it. Thanks.