<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Den</title>
    <description>The latest articles on DEV Community by Den (@denbite).</description>
    <link>https://dev.to/denbite</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3177067%2F67c154f0-c009-41e0-a6d5-2050993bc8d1.JPEG</url>
      <title>DEV Community: Den</title>
      <link>https://dev.to/denbite</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/denbite"/>
    <language>en</language>
    <item>
      <title>Choosing The Right Deployment Strategy for Smart Contracts on Near</title>
      <dc:creator>Den</dc:creator>
      <pubDate>Sun, 20 Jul 2025 13:46:00 +0000</pubDate>
      <link>https://dev.to/denbite/choosing-right-deployment-strategy-for-smart-contracts-on-near-48ah</link>
      <guid>https://dev.to/denbite/choosing-right-deployment-strategy-for-smart-contracts-on-near-48ah</guid>
      <description>&lt;p&gt;A new version of &lt;code&gt;nearcore&lt;/code&gt; has recently been released on Near Protocol Mainnet. Among other changes, it introduces support for &lt;a href="https://docs.near.org/smart-contracts/global-contracts" rel="noopener noreferrer"&gt;Global Contracts&lt;/a&gt;. This update solves a long-standing problem with contract deployment patterns and opens a new set of tools for developers. Now, we have multiple fundamentally different options for deploying the same contract logic. The best choice depends entirely on your app’s architecture and user experience goals. &lt;br&gt;
This article will walk you through those options, and by the end, you’ll know which questions to ask yourself to choose the most suitable strategy for your project.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Classic Way
&lt;/h3&gt;

&lt;p&gt;This is the default and most familiar pattern. You deploy a smart contract to a Near account by sending a transaction with the &lt;code&gt;DeployContract&lt;/code&gt; action, which includes the compiled WebAssembly code. The contract is deployed to the same account from which the transaction was sent. For example, deploying to &lt;code&gt;contract.testnet&lt;/code&gt; means the code now lives and runs under that exact account.&lt;/p&gt;

&lt;p&gt;A few key points to remember:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The contract code is stored directly in the account's state.&lt;/li&gt;
&lt;li&gt;The account is charged for using the storage at the rate of 1 NEAR per 100 KB, so a 500 KB contract will lock 5 NEAR on that account.&lt;/li&gt;
&lt;li&gt;This locked amount is not spent — it can be recovered by deleting or replacing the contract with a smaller one.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is important because if you deploy the same 500 KB contract to three accounts, each pays 5 NEAR for the storage — a total of 15 NEAR is locked just to hold the identical code. This redundancy is what Global Contracts aim to eliminate.&lt;/p&gt;

&lt;h3&gt;
  
  
  Global Contracts
&lt;/h3&gt;

&lt;p&gt;Global Contracts are reusable, globally-accessible smart contracts. Instead of every user or app deploying its own copy, a Global Contract is deployed once and then referenced by many accounts.&lt;/p&gt;

&lt;p&gt;There are two types of Global Contracts:&lt;/p&gt;

&lt;p&gt;a. &lt;strong&gt;By Hash&lt;/strong&gt; - An immutable contract is deployed globally and identified by its code hash.&lt;/p&gt;

&lt;p&gt;b. &lt;strong&gt;By Account ID&lt;/strong&gt; - An upgradable contract is published globally under a specific account ID.&lt;/p&gt;

&lt;p&gt;Global Contracts work through two new transaction actions: &lt;code&gt;DeployGlobalContract&lt;/code&gt; and &lt;code&gt;UseGlobalContract&lt;/code&gt;. First, a developer deploys a smart contract by sending a transaction with the &lt;code&gt;DeployGlobalContract&lt;/code&gt; action, which contains the compiled WebAssembly code and makes it available either by its code hash or by a specific account ID. This is a one-time, global publication — the contract doesn’t run under the sender’s account, but instead becomes available for others to reference.&lt;/p&gt;

&lt;p&gt;To use that contract, another user or application sends a transaction with the &lt;code&gt;UseGlobalContract&lt;/code&gt; action, referencing the Global Contract either by code hash, or account ID.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The contract code is distributed across all shards in the Near Protocol network, not stored inside any specific account’s storage.&lt;/li&gt;
&lt;li&gt;The account is charged 10x more for deploying a Global Contract, at the rate 10 NEAR per 100KB.&lt;/li&gt;
&lt;li&gt;This amount is entirely burnt and cannot be recovered later, unlike regular deployments where Near is simply locked.&lt;/li&gt;
&lt;li&gt;It costs almost nothing for a user to &lt;code&gt;UseGlobalContract&lt;/code&gt; as there're only a few bytes for the reference that are stored in the account's storage, the total fee is typically under 0.001 NEAR.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  You Can Use Both on One Account
&lt;/h3&gt;

&lt;p&gt;There’s nothing stopping you from deploying both a regular contract and a Global Contract by Account ID on the same Near account. Let's say &lt;code&gt;Contract A&lt;/code&gt; is deployed as a Global Contract, and &lt;code&gt;Contract B&lt;/code&gt; is a traditional contract on the same account. They coexist independently. The order of deployment also doesn’t matter.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to Choose the Right Strategy
&lt;/h3&gt;

&lt;p&gt;Ask yourself the following essential questions before deciding how to deploy your contracts:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Are you working in a local environment?&lt;/strong&gt; &lt;br&gt;
If you're just testing or building a prototype, regular deployments are simpler and more flexible. There's no need to burn tokens or register global references — just deploy and iterate.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Is the contract supposed to be deployed on many accounts?&lt;/strong&gt;&lt;br&gt;
If the same contract will be reused across many independent accounts — say, 10 or more — Global Contracts can significantly reduce overall cost and complexity. But if only a few accounts are involved, regular deployment remains the more economical choice.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Are these accounts managed by your team?&lt;/strong&gt;&lt;br&gt;
If all target accounts are under your infrastructure, you may prefer regular deployments for flexibility and cost recovery.&lt;br&gt;
3.1 &lt;strong&gt;Are there more than 10 accounts?&lt;/strong&gt;&lt;br&gt;
Global Contracts become financially efficient when reused at scale. If you're deploying the same contract to more than 10 accounts, it's likely worth considering.&lt;br&gt;
3.2 &lt;strong&gt;Do you need to upgrade the contract across many accounts in one step, even if it requires burning tokens?&lt;/strong&gt;&lt;br&gt;
If you want to be able to push updates to all deployed instances at once, then go with Global Contracts by Account ID, but keep in mind that the deployment cost is non-refundable.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Does your use case require the contract to be permanently immutable?&lt;/strong&gt;&lt;br&gt;
If the contract must never change, for example, due to security, compliance, or user trust, then using a Global Contract by Code Hash ensures immutability at the protocol level.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F27mjl1k8dppnrjryku6c.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F27mjl1k8dppnrjryku6c.jpeg" alt="Block Diagram with Questions" width="541" height="1280"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Real-World Examples
&lt;/h4&gt;

&lt;p&gt;To make this concrete, let’s look at several practical scenarios and how each maps to the right deployment strategy.&lt;/p&gt;

&lt;p&gt;— &lt;strong&gt;Guestbook App&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A minimal app that lets users leave public messages. &lt;br&gt;
It uses just one contract deployed under the app’s own account, with no need for reuse, upgrades, or external deployments. Since this is an internal deployment in a local environment, &lt;strong&gt;regular deployment&lt;/strong&gt; is the simplest and most appropriate option.&lt;/p&gt;

&lt;p&gt;— &lt;strong&gt;DeFi Protocol with On-Chain Oracles&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;An infrastructure-heavy application with multiple smart contracts handling liquidity, pricing, and execution.&lt;br&gt;
All contracts are deployed and maintained by the core team, and only used within the project’s ecosystem. Since the number of deployments is limited, upgradability is needed, and storage costs should be recoverable, the best fit is &lt;strong&gt;regular deployment&lt;/strong&gt;.&lt;br&gt;
However, if the protocol deploys a large number of identical oracle contracts and wants the ability to upgrade them all centrally, it may be more efficient to use a &lt;strong&gt;Global Contract with reference by Account ID&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;— &lt;strong&gt;DAO Factory&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A tool that allows any user to deploy their own DAO governance instance.&lt;br&gt;
The same contract is deployed many times by end users across different accounts. This clearly meets the threshold where Global Contracts become financially efficient. Since upgradeability may be useful down the line (e.g. to patch bugs or extend functionality), the right choice is &lt;strong&gt;Global Contract by Account ID&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;— &lt;strong&gt;NFT Collection Factory&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A service that lets users create their own NFT contracts with fixed metadata and royalty.&lt;br&gt;
Each user deploys the same contract, but once deployed, it should never be changed — security and immutability are critical here. This makes &lt;strong&gt;Global Contract by Hash&lt;/strong&gt; the best match.&lt;/p&gt;




&lt;p&gt;Thanks for reading. I hope this helped clarify when and why to use Global Contracts on Near. If it did — share it, comment, and let others in the ecosystem know.&lt;/p&gt;

</description>
      <category>nearprotocol</category>
      <category>blockchain</category>
      <category>web3</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Everything You Should Know about Accounts on Near</title>
      <dc:creator>Den</dc:creator>
      <pubDate>Sun, 29 Jun 2025 16:39:00 +0000</pubDate>
      <link>https://dev.to/denbite/everything-you-should-know-about-accounts-on-near-5gb7</link>
      <guid>https://dev.to/denbite/everything-you-should-know-about-accounts-on-near-5gb7</guid>
      <description>&lt;p&gt;I’ve gathered all the key information about Near accounts in one place, so you don’t have to spend time digging through scattered resources to understand how they work.&lt;/p&gt;

&lt;p&gt;In this article, we’re going to break down how accounts on Near work. We’ll cover:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The different types of accounts&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;What makes up a Near account under the hood&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Unique features like sub-accounts, account deletion, and Ethereum compatibility&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By the end, you’ll have a clear, complete picture of Near's account model and how to confidently use it in your projects&lt;/p&gt;

&lt;h3&gt;
  
  
  What Makes Up a Near Account
&lt;/h3&gt;

&lt;p&gt;Here’s what you need to know first.&lt;/p&gt;

&lt;p&gt;Every Near account has a total balance, which consists of two parts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Available Balance&lt;/strong&gt;: This is the balance you can use freely at any time to pay transaction fees, transfer tokens, stake, or perform other operations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Locked Balance&lt;/strong&gt;: These are tokens that are currently staked to a validator, whether you’re staking to your own validator or someone else’s. Locked funds don’t unlock instantly - it takes a little time, typically 4 epochs (20 hours).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Contracts
&lt;/h4&gt;

&lt;p&gt;A smart contract is a WebAssembly (WASM) program that can be deployed to an account. When you first create an account, it doesn’t have a contract by default. What makes NEAR flexible is that you can deploy, update, and even remove contracts from an account later. This means you can fully upgrade the code over time, something that’s not always possible on other blockchains. Once deployed, your contract can be called by anyone, and it has access to the account’s storage.&lt;/p&gt;

&lt;h4&gt;
  
  
  Storage
&lt;/h4&gt;

&lt;p&gt;Every NEAR account has its own persistent storage, built as a key-value store. It can only be read and modified by the contract deployed on that same account, other contracts can’t directly access your storage, neither for read nor for write.&lt;/p&gt;

&lt;p&gt;The data stored on your account is publicly visible. Anyone can read it through RPC calls — just something to keep in mind.&lt;/p&gt;

&lt;p&gt;Storage on Near isn’t free. There’s a storage staking rule - you must hold 1 &lt;code&gt;NEAR&lt;/code&gt; per 100 KB of storage used. This covers the account itself, contract code, stored data, and access keys.&lt;/p&gt;

&lt;p&gt;The cool thing is, when you delete data from your storage, the &lt;code&gt;NEAR&lt;/code&gt; tokens tied to that storage are automatically released back to your available balance. So you’re not permanently spending tokens, you’re simply locking them as long as you use the storage.&lt;/p&gt;

&lt;h4&gt;
  
  
  Access Keys
&lt;/h4&gt;

&lt;p&gt;This is one of Near's most unique features. Unlike many blockchains where each account is tied to a single key, Near accounts can have multiple keys at the same time, each with its own permissions.&lt;/p&gt;

&lt;p&gt;There are two types of access keys:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Full Access&lt;/strong&gt;: Gives complete control over the account.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Function Call&lt;/strong&gt;: Can only be used to call specific contract methods, usually with limited permissions. This key can only call non-payable methods—methods that don’t require a deposit. If you try to use it for a payable method, the transaction will simply fail.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Accounts can have as many keys as you like, you can add/remove them anytime. You can even remove all keys from an account, which effectively locks it. Once locked, the account can’t perform any actions anymore, unless the smart contract deployed on it was specifically designed to handle interactions without relying on access keys (you’ll see an example of this later in the article when we talk about the Wallet Contract).&lt;/p&gt;

&lt;h3&gt;
  
  
  Types of Accounts
&lt;/h3&gt;

&lt;p&gt;On Near, not all accounts are the same — there are a few distinct types, each with its own purpose and behavior. But before we dive into the details, let’s quickly look at the general rules that apply to all accounts.&lt;/p&gt;

&lt;p&gt;Every account, no matter the type, follows a simple set of naming rules:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Length&lt;/strong&gt;: Account names must be at least 2 characters long and can go up to 64 characters.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Allowed characters&lt;/strong&gt;: You can use lowercase letters (&lt;code&gt;a-z&lt;/code&gt;), digits (&lt;code&gt;0-9&lt;/code&gt;), and separators, including dots (&lt;code&gt;.&lt;/code&gt;), dashes (&lt;code&gt;-&lt;/code&gt;) and underscores (&lt;code&gt;_&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Separator Rules&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;An account name can’t start or end with a separator - no &lt;code&gt;_alice.&lt;/code&gt; or &lt;code&gt;.bob.near-&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Separators can’t follow each other - no &lt;code&gt;..&lt;/code&gt;, &lt;code&gt;--&lt;/code&gt;, &lt;code&gt;__&lt;/code&gt;, or mixed combinations like &lt;code&gt;.-&lt;/code&gt; or &lt;code&gt;_.&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;john.doe.near&lt;/code&gt;, &lt;code&gt;root&lt;/code&gt;, or &lt;code&gt;user_123.near&lt;/code&gt; are valid account names.&lt;/p&gt;

&lt;h4&gt;
  
  
  Named Accounts
&lt;/h4&gt;

&lt;p&gt;As the name suggests, named accounts come with a human-readable name, which makes life on Near a lot easier, especially when it comes to branding and user experience. You don’t have to memorize long, random strings of characters anymore.&lt;/p&gt;

&lt;p&gt;Creating a named account is simple, but not entirely free. You need to send a transaction to register the account on the blockchain. If you choose, you can also send some &lt;code&gt;NEAR&lt;/code&gt; tokens along with the transaction to pre-fund the account. Like any transaction on Near, you need to cover the network fee. The good news is, fees on Near are low, especially compared to other blockchains. In fact, some wallets or applications might even cover this fee for you using a relayer (a service that pays the transaction fee on your behalf). That said, not every wallet offers this, so in many cases, you’ll still need to pay this small fee yourself.&lt;/p&gt;

&lt;h5&gt;
  
  
  Sub-Accounts
&lt;/h5&gt;

&lt;p&gt;You’ve probably noticed examples like &lt;code&gt;child.user.near&lt;/code&gt; and might be wondering - can anyone create that account? Actually, no. Near uses a hierarchical account structure and accounts are separated by dots to indicate their level. For example, only &lt;code&gt;user.near&lt;/code&gt; can create &lt;code&gt;child.user.near&lt;/code&gt;, and if you try to create &lt;code&gt;child.user.near&lt;/code&gt; directly, your transaction will simply fail. The account &lt;code&gt;user.near&lt;/code&gt; must send the transaction to itself to create &lt;code&gt;child.user.near&lt;/code&gt;. No one else can do it.&lt;/p&gt;

&lt;p&gt;Here's an important nuance - once a sub-account is created, it's fully independent. It has its own access keys, assets, etc. It doesn't belong to the parent account in any operational sense. The only thing the parent controls is the ability to create the sub-account in the first place. After that, the two accounts are completely separate.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If only &lt;code&gt;user.near&lt;/code&gt; can create &lt;code&gt;child.user.near&lt;/code&gt;, who created &lt;code&gt;user.near&lt;/code&gt;?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you said &lt;code&gt;near&lt;/code&gt;, that’s exactly right. This brings us to the next section. &lt;/p&gt;

&lt;h5&gt;
  
  
  Top-Level Accounts
&lt;/h5&gt;

&lt;p&gt;The &lt;code&gt;near&lt;/code&gt; part isn’t just a label, it’s actually an account itself. In fact, it’s a special type of account called a top-level Account.&lt;/p&gt;

&lt;p&gt;Top-level accounts on Near are, in many ways, just like the named accounts we’ve already discussed. The key difference is that you can’t create a top-level account yourself.&lt;/p&gt;

&lt;p&gt;These accounts are predefined at the protocol level. They usually don’t have any Full Access keys attached, which means they can’t be deleted, and they technically belong to no one. They simply exist.&lt;/p&gt;

&lt;p&gt;What makes top-level accounts so useful is that they can also have a smart contract deployed on them, and in most cases, they do. For example, the &lt;code&gt;near&lt;/code&gt; account has a contract deployed on it that exposes the &lt;code&gt;create_account&lt;/code&gt; method. Anyone can call it to create sub-accounts under the top-level account, which are the regular named accounts like &lt;code&gt;user.near&lt;/code&gt;. It’s as simple as that.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You can check out the smart contract source code right &lt;a href="https://github.com/near/near-linkdrop" rel="noopener noreferrer"&gt;here&lt;/a&gt;. Though, this contract does more than just create accounts, it’s actually a broader tool with additional functionality called Linkdrop. But we won’t dive into those details in this article.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It’s also worth noting that &lt;code&gt;near&lt;/code&gt; isn’t the only top-level account. For example, the &lt;code&gt;tg&lt;/code&gt; top-level account was introduced at the beginning of 2024 to support the HERE Wallet on Telegram. They needed a dedicated top-level account because their use case required a custom smart contract deployed specifically to handle batch account creation and other custom features.&lt;/p&gt;

&lt;p&gt;I don’t know the exact requirements for getting a custom top-level account, but I guess that if your use case ever grows to the point where supporting millions of users would truly benefit from having a dedicated top-level account, there’s a chance you could request one.&lt;/p&gt;

&lt;h4&gt;
  
  
  Implicit Accounts
&lt;/h4&gt;

&lt;p&gt;Implicit accounts on Near work a little differently from the named accounts we’ve talked about so far. You won’t find a human-readable name here. Instead, the account ID is simply the hexadecimal representation of a public key.&lt;/p&gt;

&lt;p&gt;The public key generated from Ed25519 is exactly 32 bytes long, and when you convert it to a hexadecimal string, you get a 64-character account ID. &lt;/p&gt;

&lt;p&gt;You don’t need to send any transaction or pay any deposit to create an implicit account. You can generate it completely off-chain by simply creating a key pair and calculating the hex representation of the public key. That’s it. You can start using the address right away.&lt;/p&gt;

&lt;p&gt;When you first generate an implicit account, Near Protocol knows nothing about it yet. It officially comes into existence the moment someone sends &lt;code&gt;NEAR&lt;/code&gt;. At that moment, the blockchain registers the account with the exact public key you originally generated. This makes implicit accounts perfect for lightweight onboarding. You can start using the blockchain right away — no need to sign any transactions, no need to pay upfront fees. You simply generate a key pair and you’re good to go. If possible, you’re recommended to upgrade to a named account later.&lt;/p&gt;

&lt;p&gt;Also, it’s important to note that implicit accounts can’t have sub-accounts. Their account ID is already 64 characters long (the maximum allowed on Near), so there’s simply no room to add anything else.&lt;/p&gt;

&lt;h5&gt;
  
  
  Simple Example
&lt;/h5&gt;

&lt;p&gt;Imagine someone wants to send you &lt;code&gt;USDT&lt;/code&gt; on Near, but you don’t have an account yet.&lt;br&gt;
With a named account, you’d first need to register it by sending a transaction, which costs a small fee. If you skip this step and give them a name like &lt;code&gt;user.near&lt;/code&gt; that hasn’t been created yet, you’re putting the funds at risk.&lt;br&gt;
Why? Because anyone can create a named account that doesn’t exist yet. If you delay, someone else could create that same account before you and take the funds.&lt;/p&gt;

&lt;p&gt;But with implicit accounts, it’s different.&lt;br&gt;
When you generate an implicit account, the account address is derived from your public key.&lt;br&gt;
The only way someone else could take over that account is by generating the exact same key pair, which is practically impossible.&lt;/p&gt;

&lt;h4&gt;
  
  
  Ethereum Accounts
&lt;/h4&gt;

&lt;p&gt;Ethereum accounts on Near use the same familiar address format you’ll see in native EVM networks - a 20-byte hexadecimal string. If you’ve worked with Ethereum before, this format will feel instantly familiar.&lt;/p&gt;

&lt;p&gt;These accounts were introduced to support smooth integration with Ethereum tools, especially wallets. The goal is to let users sign transactions using their Ethereum keys and execute them directly on Near.&lt;/p&gt;

&lt;p&gt;When you create an Ethereum account on Near, a special &lt;a href="https://github.com/near/NEPs/issues/518" rel="noopener noreferrer"&gt;Wallet Contract&lt;/a&gt; is automatically deployed on it. One of its core methods is &lt;code&gt;rlp_execute(target: AccountId, tx_bytes_b64: Vec&amp;lt;u8&amp;gt;)&lt;/code&gt;. This function takes an Ethereum transaction, verifies the signature using your Ethereum key, checks the nonce to ensure the transaction is in the correct order, and then executes it directly on Near.&lt;/p&gt;

&lt;p&gt;It’s worth noting that Ethereum accounts on Near have limited capabilities, you can transfer &lt;code&gt;NEAR&lt;/code&gt; tokens, call functions on other smart contracts, and add or delete FunctionCall keys, but you cannot add Full Access keys or delete the account.&lt;/p&gt;

&lt;h3&gt;
  
  
  Deleting Accounts
&lt;/h3&gt;

&lt;p&gt;We’ve talked about how accounts can be created, but here’s something that makes Near stand out compared to many other blockchains - accounts on Near can also be fully deleted, and even recreated later, as many times as you need. This is not something you usually see on other chains, where account addresses are typically permanent.&lt;/p&gt;

&lt;p&gt;Account deletion is done via a special transaction, and when you delete an account, its remaining available Near balance is automatically transferred to a beneficiary account of your choice. The account itself is completely removed from the blockchain’s state.&lt;/p&gt;

&lt;p&gt;This feature gives you flexibility, but it also comes with a real risk of losing assets if you don’t handle the process carefully. When you delete an account, only the native &lt;code&gt;NEAR&lt;/code&gt; tokens are automatically transferred. Any other assets like FTs, or NFTs, won't be transferred automatically. If you forget to move those assets before deletion, you will lose them permanently.&lt;/p&gt;




&lt;p&gt;If you spot anything incorrect or notice something important I missed, please feel free to correct me or add your thoughts in the comments. I’d appreciate it!&lt;/p&gt;

&lt;p&gt;Otherwise, I hope this article helped you build a clear, practical understanding of Near accounts and gave you the confidence to work with them without second-guessing. &lt;br&gt;
Thanks for reading and have a great day!&lt;/p&gt;

</description>
      <category>web3</category>
      <category>blockchain</category>
      <category>nearprotocol</category>
    </item>
    <item>
      <title>The Smoothest Cross-Chain Integration I’ve Ever Built</title>
      <dc:creator>Den</dc:creator>
      <pubDate>Sun, 22 Jun 2025 15:54:00 +0000</pubDate>
      <link>https://dev.to/denbite/the-smoothest-cross-chain-integration-ive-ever-built-4kmk</link>
      <guid>https://dev.to/denbite/the-smoothest-cross-chain-integration-ive-ever-built-4kmk</guid>
      <description>&lt;p&gt;I used to think cross-chain swaps were one of the most complicated things in crypto.&lt;/p&gt;

&lt;p&gt;Every time I looked into them, I’d feel that familiar hesitation — too many moving parts, too many edge cases, and way too much waiting around.&lt;/p&gt;

&lt;p&gt;I believe that integrating them was always a pain in the ass. From juggling wallets and gas on multiple chains to writing spaghetti code to handle every possible failure, it felt like duct-taping over a fragmented system.&lt;/p&gt;

&lt;p&gt;Then, about a year ago, I came across an idea that completely changed how I looked at cross-chain swaps.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What if the swap didn’t have to leave the chain?&lt;/li&gt;
&lt;li&gt;What if you could make it happen from one place, atomically and as easily as updating a field in a smart contract?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And recently, I finally found a system that makes it real. It’s called &lt;strong&gt;NEAR Intents&lt;/strong&gt; — and on top of that, they’ve just released something called the &lt;strong&gt;1Click API&lt;/strong&gt;, which blew me away.&lt;/p&gt;

&lt;h2&gt;
  
  
  What are Near Intents?
&lt;/h2&gt;

&lt;p&gt;NEAR Intents is a multi-chain transaction protocol designed for peer-to-peer exchanges of any kind of resource, whether that’s tokens, NFTs, or even access rights to services or data. In other words, it enables people to trade whatever holds value to them.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyfx2sbkemzuvrd2qzpxz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyfx2sbkemzuvrd2qzpxz.png" alt="Image description" width="800" height="337"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The protocol is made up of three main components:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Solvers (or Market Makers)&lt;/strong&gt;&lt;br&gt;
These are automated agents that participate in the exchange process. Their job is to fulfill user requests by offering the resources the user wants, in return for whatever the user is offering. Solvers compete with one another to provide the best terms. If one solver offers a worse deal, another one can step in with a better one, effectively outbidding them. This competition ensures users always get the most favorable rate. Solvers earn a small fee from each successful trade, which motivates them to stay competitive and keep the system running efficiently.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Verifier Smart Contract&lt;/strong&gt;&lt;br&gt;
This contract runs on the NEAR Protocol and plays a key role in the system. It ensures that each trade is executed atomically, meaning it either happens in full or not at all, and it verifies the integrity of the transaction. We’ll dig into how exactly this verification works a bit later when we walk through an example.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Applications (or Distribution Channels)&lt;/strong&gt;&lt;br&gt;
These are the frontends or interfaces that users interact with (wallets, dApps, exchanges, or any other service that connects to the protocol). While technically optional, since it's peer-to-peer and users could interact with the protocol directly, in practice, most people use apps or wallets to make the experience smoother and more intuitive.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  How does the Cross-Chain part work?
&lt;/h3&gt;

&lt;p&gt;Right now, the main use case for Near Intents is peer-to-peer money transfers, swapping tokens across different networks. But how does Near make cross-chain swaps possible?&lt;/p&gt;

&lt;p&gt;That’s where Omni Bridge comes in. It’s a core service within the Near ecosystem that allows assets to move between blockchains. Here’s how it works: when a user wants to bridge tokens to Near, they burn the tokens on the source chain and generate a proof of that burn. This proof is then submitted to Near, where it’s verified by the Near Light Client. And once the proof checks out, the Near side mints the equivalent amount of corresponding tokens (NEP‑141) and credits them to the user’s account.&lt;/p&gt;

&lt;h3&gt;
  
  
  Walkthrough with Alice
&lt;/h3&gt;

&lt;p&gt;Let’s walk through how someone, say, Alice, would use Near Intents to swap 100 &lt;code&gt;USDT&lt;/code&gt; on Ethereum for &lt;code&gt;BTC&lt;/code&gt; on the Bitcoin network.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You can find another TypeScript example &lt;a href="https://github.com/nearuaguild/near-intents-ts-example" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  Step 1: Deposit to Near
&lt;/h4&gt;

&lt;p&gt;As described earlier, Alice starts by burning her &lt;code&gt;USDT&lt;/code&gt; tokens on Ethereum. She then sends the proof of that burn to Near. Once the proof is verified, she receives a bridged version of USDT, minted directly to her address on the Near Protocol.&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 2: Get a Quote
&lt;/h4&gt;

&lt;p&gt;Alice queries a JSON RPC endpoint for swap quotes, specifying that she wants to swap &lt;code&gt;100 USDT&lt;/code&gt; and receive &lt;code&gt;BTC&lt;/code&gt; in return.&lt;/p&gt;

&lt;p&gt;Under the hood, this triggers a short bidding window, about 1 second, where all available solvers receive Alice’s request. Each solver checks if they can fulfill the trade and, if so, responds with a quote. These responses include how much &lt;code&gt;BTC&lt;/code&gt; they can offer and until what time.&lt;/p&gt;

&lt;p&gt;Here’s what the request body for querying a quote looks like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"dontcare"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"jsonrpc"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"method"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"quote"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"params"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"defuse_asset_identifier_in"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"nep141:eth-0xdac17f958d2ee523a2206206994597c13d831ec7.omft.near"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;bridged&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;USDT&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"defuse_asset_identifier_out"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"nep141:btc.omft.near"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;bridged&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;BTC&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"exact_amount_in"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"100000000"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;USDT&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And below is an example of the response you’ll get back:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"jsonrpc"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"dontcare"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"result"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"defuse_asset_identifier_in"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"nep141:eth-0xdac17f958d2ee523a2206206994597c13d831ec7.omft.near"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"defuse_asset_identifier_out"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"nep141:btc.omft.near"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"amount_in"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"100000000"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;USDT&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"amount_out"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"99999"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.00099999&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;BTC&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"expiration_time"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2025-06-15T09:42:42.294Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"quote_hash"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2EKjNj2fYe73tbRJegHoeetNCc2oAb2kiFPpVs6VK54P"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"defuse_asset_identifier_in"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"nep141:eth-0xdac17f958d2ee523a2206206994597c13d831ec7.omft.near"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"defuse_asset_identifier_out"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"nep141:btc.omft.near"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"amount_in"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"100000000"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;USDT&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"amount_out"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"100000"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.001&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;BTC&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"expiration_time"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2025-06-15T09:42:42.424Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"quote_hash"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"JAvGrCio97STdSX5P52Xo1WpBur3S8LKmoDRzQtJijEw"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From the list of available quotes, she picks the one she likes best.&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 3: Create and Sign an Intent
&lt;/h4&gt;

&lt;p&gt;Now that Alice is happy with the quote, she creates an intent - a message saying, "I’m willing to give &lt;code&gt;100 USDT&lt;/code&gt; to receive &lt;code&gt;0.001 BTC&lt;/code&gt;".&lt;/p&gt;

&lt;p&gt;Here’s what the intent message looks like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;signer_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;alice.near&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;deadline&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;2025-06-15T09:42:42.424Z&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;intents&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="na"&gt;intent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;token_diff&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;diff&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;nep141:eth-0xdac17f958d2ee523a2206206994597c13d831ec7.omft.near&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;-100000000&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;nep141:btc.omft.near&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;1000000&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice that the &lt;code&gt;USDT&lt;/code&gt; amount is negative, which indicates the amount being sent in the swap.&lt;/p&gt;

&lt;p&gt;After the intent is created, we also need to generate a random 32-byte nonce, serialize all the data, and produce an ED25519 signature. It's worth noting here that the intent must be signed with a key that has already been registered on the Verifier Smart Contract. This allows the contract to verify both the validity of the signature and that the key belongs to your account.&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 4: Submit the Intent
&lt;/h4&gt;

&lt;p&gt;Alice submits the signed intent back to the RPC server. Solvers also sign their part, confirming that they’ll deliver the requested asset.&lt;/p&gt;

&lt;p&gt;The request should follow this specific format:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"jsonrpc"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"dontcare"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"method"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"publish_intent"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"params"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"quote_hashes"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"JAvGrCio97STdSX5P52Xo1WpBur3S8LKmoDRzQtJijEw"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"signed_data"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="nl"&gt;"standard"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"nep413"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="nl"&gt;"payload"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"message"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"{&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;deadline&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;2025-06-15T09:42:42.424Z&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;intents&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:[{&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;intent&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;token_diff&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;diff&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:{&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;nep141:eth-0xdac17f958d2ee523a2206206994597c13d831ec7.omft.near&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;-100000000&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;nep141:btc.omft.near&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;1000000&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;},&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;signer_id&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;alice.near&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;serialized&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;intent&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;message&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"nonce"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"D4DFuiyOSjNmYcmu/Rqkx/Q624mBnzk9WhnYdqUz0ek="&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;random&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;32&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;bytes&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;represented&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;as&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;base&lt;/span&gt;&lt;span class="mi"&gt;64&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;string&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"recipient"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"intents.near"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;verifier&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;smart&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;contract&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="nl"&gt;"signature"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ed25519:24nL3P37o27uCdsfyFqtCBEPuEgiu90AfaJSJSPpEE8vCAyYZTtgbBEyF7nkZ69nJwqReimDaU4n33zrSwziXiG1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="nl"&gt;"public_key"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ed25519:33fZjXn7DmM2XrAxZWK5XE6EnZugAusMtkKM9Zbb3P4J"&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In response, we’ll receive a JSON object that includes an &lt;code&gt;intent_hash&lt;/code&gt;, which can later be used to check the status of the execution.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"jsonrpc"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"dontcare"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"result"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"OK"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"intent_hash"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"9TBktE2kKuN0XHueyHwsJNQWY4EW73KMDkx9FizWJcsB"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once an intent is published to the RPC, the system builds a composite object that includes all the intents involved in the deal (it doesn't necessarily have to be just two parties, any number of participants are supported in a single agreement).&lt;/p&gt;

&lt;p&gt;After all intents are signed by their respective participants, they’re bundled and sent to the Verifier Smart Contract. That’s where the magic happens. The Verifier runs a method called &lt;code&gt;execute_intent&lt;/code&gt;, which does:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;It checks that each intent is signed with a public key that matches the one declared in the intent itself and that it's already registered with the Verifier contract (this ensures the intent was genuinely signed by the account it claims to come from)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Next, it verifies that the net asset flow across all intents equals zero.&lt;br&gt;
For example, if Alice offers &lt;code&gt;100 USDT&lt;/code&gt;, then the combined intents of the other participants must result in someone receiving exactly &lt;code&gt;100 USDT&lt;/code&gt;. Same with &lt;code&gt;BTC&lt;/code&gt;: if someone gives up &lt;code&gt;0.001 BTC&lt;/code&gt;, someone else must receive exactly that amount.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Once all checks pass, it simply updates token balances. Alice’s &lt;code&gt;USDT&lt;/code&gt; balance decreases by 100, but she gains &lt;code&gt;0.001 BTC&lt;/code&gt;. Her counterparty’s balances shift in the opposite direction.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Step 5: Withdraw
&lt;/h4&gt;

&lt;p&gt;Finally, Alice burns her bridged &lt;code&gt;BTC&lt;/code&gt; tokens on Near and submits the proof. Just like during the deposit flow, once verified, she receives native &lt;code&gt;BTC&lt;/code&gt; on the Bitcoin network.&lt;/p&gt;

&lt;h2&gt;
  
  
  Making It Seamless with 1Click API
&lt;/h2&gt;

&lt;p&gt;Now, let’s be real. That was a lot of steps. Even if Near Intents is cleaner than most cross-chain protocols, it still requires a solid grasp of knowledge about bridges, contracts, and signatures.&lt;/p&gt;

&lt;p&gt;This is exactly why 1Click API exists.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is 1Click API?
&lt;/h3&gt;

&lt;p&gt;1Click API wraps everything, from quoting to execution, into a single API call. You just tell it what you want to send, what you want to receive, and where it should go. Done.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpzj898p7kt05dcglk6wd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpzj898p7kt05dcglk6wd.png" alt="Image description" width="768" height="308"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The magic of 1Click lies in how little you have to do to make this happen. You simply have to make a &lt;strong&gt;POST&lt;/strong&gt; request to the &lt;code&gt;/quote&lt;/code&gt; endpoint. In that request, you describe what asset they are sending and of what amount, what asset they want to receive, and where it should go and how refunds should be handled if anything fails.&lt;/p&gt;

&lt;h3&gt;
  
  
  Walkthrough with Alice again
&lt;/h3&gt;

&lt;p&gt;To show how seamless this is, let’s go back to the example we explored earlier, of Alice swapping &lt;code&gt;100 USDT&lt;/code&gt; on Ethereum for &lt;code&gt;BTC&lt;/code&gt; on Bitcoin, and walk through how it works using the 1Click API.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You can find more TypeScript examples for various 1Click API use cases &lt;a href="https://github.com/nearuaguild/near-intents-1click-example" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  Step 1: Get a Quote
&lt;/h4&gt;

&lt;p&gt;Alice makes a &lt;strong&gt;POST&lt;/strong&gt; &lt;code&gt;/quote&lt;/code&gt; request with the details. &lt;/p&gt;

&lt;p&gt;Let’s walk through each important field to understand what it means and why we’re using those specific values.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The complete and latest 1Click API spec is available &lt;a href="https://docs.near-intents.org/near-intents/integration/distribution-channels/1click-api#api-specification-v0" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;depositType&lt;/code&gt; is set to &lt;code&gt;ORIGIN_CHAIN&lt;/code&gt;, because the funds originate outside of NEAR, we’re telling the API to expect the deposit on the origin chain&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;originAsset&lt;/code&gt; is set to &lt;code&gt;nep141:eth-0xdac17f958d2ee523a2206206994597c13d831ec7.omft.near&lt;/code&gt;, which is the address of the NEAR-bridged token that mirrors &lt;code&gt;USDT&lt;/code&gt; on Ethereum&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;destinationAsset&lt;/code&gt; is set to &lt;code&gt;nep141:btc.omft.near&lt;/code&gt;, same logic as above&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;amount&lt;/code&gt; is the number of &lt;code&gt;USDT&lt;/code&gt; tokens Alice wants to send. It's passed over as units, for &lt;code&gt;USDT&lt;/code&gt; with 6 decimals, it equals &lt;code&gt;100000000&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;recipientType&lt;/code&gt; is set to &lt;code&gt;ORIGIN_CHAIN&lt;/code&gt; and &lt;code&gt;recipient&lt;/code&gt; is Alice's Bitcoin wallet address&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;refundType&lt;/code&gt; is set to &lt;code&gt;ORIGIN_CHAIN&lt;/code&gt; and &lt;code&gt;refundTo&lt;/code&gt; is Alice's Ethereum wallet address. These parameters define where the funds should go if something goes wrong. It’s important to provide an address you own. If the refund address is incorrect, Alice could permanently lose access to the funds.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here’s what the request would look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"dry"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"swapType"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"EXACT_INPUT"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"slippageTolerance"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.1&lt;/span&gt;&lt;span class="err"&gt;%&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"depositType"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ORIGIN_CHAIN"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;expects&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;a&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;deposit&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;on&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Ethereum&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"originAsset"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"nep141:eth-0xdac17f958d2ee523a2206206994597c13d831ec7.omft.near"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;bridged&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;USDT&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"destinationAsset"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"nep141:btc.omft.near"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;bridged&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;BTC&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"amount"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"100000000"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;USDT&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"recipient"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"bc1q3pqz07f0t48lrxunyqqx4yk3f9gr65nfxncc0r"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;your&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Bitcoin&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;wallet&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"recipientType"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ORIGIN_CHAIN"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;withdraws&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;on&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Bitcoin&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"refundTo"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"0x427F9620Be0fe8Db2d840E2b6145D1CF2975bcaD"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"refundType"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ORIGIN_CHAIN"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"deadline"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2025-06-15T17:21:37.194Z"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step 2: Make the Deposit
&lt;/h4&gt;

&lt;p&gt;Now that we have the deposit address, Alice can send her &lt;code&gt;100 USDT&lt;/code&gt; to it on Ethereum. This transaction is what actually kicks off the swap.&lt;/p&gt;

&lt;p&gt;Let’s use &lt;code&gt;viem&lt;/code&gt; to send USDT:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;erc20Abi&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;viem&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;createWalletClient&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;http&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;viem&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;mainnet&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;viem/chains&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;walletClient&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createWalletClient&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;chain&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;mainnet&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;transport&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;http&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="c1"&gt;// use injected transport in a browser wallet&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;depositAddress&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;quote&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;depositAddress&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;txHash&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;walletClient&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;writeContract&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;account&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;0x427F9620Be0fe8Db2d840E2b6145D1CF2975bcaD&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// your address&lt;/span&gt;
    &lt;span class="na"&gt;address&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;0xdAC17F958D2ee523a2206206994597C13D831ec7&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// USDT token address&lt;/span&gt;
    &lt;span class="na"&gt;abi&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;erc20Abi&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;functionName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;transfer&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;args&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="nx"&gt;depositAddress&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="mi"&gt;100000000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// 100 USDT&lt;/span&gt;
    &lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After that, the 1Click begins monitoring for the transaction’s finalization. &lt;/p&gt;




&lt;p&gt;And that’s it! Once the transaction is fully finalized on the Bitcoin network, Alice will see her updated BTC balance in her wallet.&lt;/p&gt;

&lt;p&gt;Was that simple enough? Feel free to share your thoughts in the comments. And if you have any technical questions about the process, don’t hesitate to ask — I’ll be happy to help.&lt;/p&gt;

&lt;p&gt;Thanks for reading and have a great day!&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>web3</category>
      <category>javascript</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
