diff --git a/docs/1.concepts/3.advanced/indexers.md b/docs/1.concepts/3.advanced/indexers.md index e634f60dcb4..350d0b1196e 100644 --- a/docs/1.concepts/3.advanced/indexers.md +++ b/docs/1.concepts/3.advanced/indexers.md @@ -88,4 +88,4 @@ We hope this article gives you an understanding of the Indexer concept. Also, we ## What's next? We encourage you to learn more about the [Lake Indexer project](/build/data-infrastructure/lake-framework/near-lake). Please, proceed to [Tutorials](/build/data-infrastructure/lake-framework/near-lake-state-changes-indexer) section to learn how to build an indexer on practice. -Alternatively, there are a few other third-party indexers that are tightly integrated with the NEAR ecosystem. You can review all of your data sourcing options (including The Graph, Pagoda, Pipespeak, and SubQuery) under [data tools](/concepts/data-flow/data-storage#data-tools). +Alternatively, there are a few other third-party indexers that are tightly integrated with the NEAR ecosystem. You can review all of your data sourcing options (including The Graph, Pagoda, Pikespeak, and SubQuery) under [data tools](/concepts/data-flow/data-storage#data-tools). diff --git a/docs/1.concepts/abstraction/chain-signatures.md b/docs/1.concepts/abstraction/chain-signatures.md index 5a1dc7b3195..d56d5b21bca 100644 --- a/docs/1.concepts/abstraction/chain-signatures.md +++ b/docs/1.concepts/abstraction/chain-signatures.md @@ -12,10 +12,6 @@ This unlocks the next level of blockchain interoperability by giving ownership o ![chain-signatures](/docs/assets/welcome-pages/chain-signatures-overview.png) _Diagram of a chain signature in NEAR_ -:::caution -This technology is currently in `alpha` and should only be used in a `testnet` environment. -::: - --- ## How It Works @@ -72,10 +68,10 @@ The essence of Multi-Party Computation (MPC) is to enable independent parties to NEAR's MPC service is comprised of several independent nodes, **none of which can sign by itself**, but instead create **signature-shares** that are **aggregated through multiple rounds** to **jointly** sign a transaction. -This service continuously listens for signature requests (i.e. users calling the `sign` method on the `multichain` smart contract) and when a call is detected the MPC service: +This service continuously listens for signature requests (i.e. users calling the `sign` method on the `v1.signer` smart contract) and when a call is detected the MPC service: 1. Asks its nodes to jointly derive a signature for the `payload` using the account identified by the `path` - 2. Once complete, call the `multichain` contract to store the resulting `Signature` + 2. Once complete, call the `v1.signer` contract to store the resulting `Signature` :::info A Custom MPC Service Generally, MPC signing services work by sharing a master key, which needs to be re-created each time a node joins or leaves. diff --git a/docs/1.concepts/web3/blockchain.md b/docs/1.concepts/web3/blockchain.md index 65fb7839f3d..aedd5c37411 100644 --- a/docs/1.concepts/web3/blockchain.md +++ b/docs/1.concepts/web3/blockchain.md @@ -153,7 +153,7 @@ There are a lot of blockchains out there and it might be hard to choose the most Historically, the first blockchain to introduce smart contracts was Ethereum. However, as the number of users grew, transaction speed and cost skyrocketed, and it became apparent that it couldn't handle the demand. So, a number of [scaling solutions](https://ethereum.org/en/developers/docs/scaling/) appeared - [layer 2 chains](https://ethereum.org/en/developers/docs/scaling/#layer-2-scaling), [sidechains](https://ethereum.org/en/developers/docs/scaling/sidechains/), and [plasma chains](https://ethereum.org/en/developers/docs/scaling/plasma/). However, they all use some kind of workarounds with their own unique drawbacks. Ethereum tries to fix the core problem and redesign its network - like switching to a Proof-of-stake consensus, which is ongoing for quite a long time, but exact timeline when all of the problems will be fixed is very unclear. -Meanwhile, a new generation of blockchains started to appear. They learned from the Etherium mistakes, and designed them from ground-up to be fast, cheap and scalable. +Meanwhile, a new generation of blockchains started to appear. They learned from the Ethereum mistakes, and designed them from ground-up to be fast, cheap and scalable. Choosing the right one is by no means an easy task, but for us we found the [NEAR](https://near.org/) blockchain to be an ideal solution, because of the following properties: - Transactions are cheap and very fast. - Designed to be extremely scalable from the beginning. This means we can count that transaction cost and speed will remain stable in the future. diff --git a/docs/1.concepts/web3/near.md b/docs/1.concepts/web3/near.md index 8fd15f32247..31974c7c2f4 100644 --- a/docs/1.concepts/web3/near.md +++ b/docs/1.concepts/web3/near.md @@ -148,7 +148,7 @@ As an alternative to building your own indexer with a database and an API server By now, we should be familiar with necessary concepts to start developing WEB 3.0 applications, so let’s explore the development tools available. -First of all, we need a development and testing environment. Of course, we could theoraticaly perform development and testing on the main blockchain network, but this would not be cheap. For this reason, NEAR provides [several networks](../../1.concepts/basics/networks.md) that can be used during development: +First of all, we need a development and testing environment. Of course, we could theoretically perform development and testing on the main blockchain network, but this would not be cheap. For this reason, NEAR provides [several networks](../../1.concepts/basics/networks.md) that can be used during development: - testnet - public NEAR network which is identical to mainnet and can be used for free. - localnet - you can deploy your personal NEAR network on your own environment. Because it’s owned by you, data and code can be kept private during development. More info on how you can run your own node can be [found here](https://near-nodes.io/validator/running-a-node). Alternatively, you can bootstrap an entire testing infrastructure in Docker on your local machine using Kurtosis - [guide is here](../../2.build/2.smart-contracts/testing/kurtosis-localnet.md). - workspaces - you can start your own local network to perform e2e testing. More info [here](../../2.build/2.smart-contracts/testing/integration-test.md). diff --git a/docs/1.concepts/web3/nfts.md b/docs/1.concepts/web3/nfts.md index 37b3b3b20d3..984a802ac7b 100644 --- a/docs/1.concepts/web3/nfts.md +++ b/docs/1.concepts/web3/nfts.md @@ -325,7 +325,7 @@ In the blockchain world, creation of new NFTs is usually called minting. And as -* Users can mint them directly. This can be done by either allowing creation of NFTs from scratch, or by using more complex processes, like breeding or upgrading. The most famous example of such process is breeding in [CrytoKitties](https://www.cryptokitties.co/) game - new NFTs are created by combining existing ones. With this approach users usually have to pay to cover the storage and gas cost of NFTs creation. +* Users can mint them directly. This can be done by either allowing creation of NFTs from scratch, or by using more complex processes, like breeding or upgrading. The most famous example of such process is breeding in [CryptoKitties](https://www.cryptokitties.co/) game - new NFTs are created by combining existing ones. With this approach users usually have to pay to cover the storage and gas cost of NFTs creation. * NFTs can be distributed by the developer to a set of users - it is usually called [NFTs airdrop](https://www.investopedia.com/terms/a/airdrop-cryptocurrency.asp). Most often this is used as a marketing strategy to kickstart NFTs usage in applications. Storage and gas costs in this case are covered by developers. * NFTs can be bought on a market or obtained from the lootbox. Depending on an exact strategy, costs can either be paid by a user or by developer. Also, in this case NFTs sometimes can be minted on-demand, to avoid paying upfront costs. @@ -516,7 +516,7 @@ Implementing an own Marketplace contract is more involved since there is no stan * [Basic marketplace example](../../3.tutorials/nfts/8-marketplace.md) * [Paras ](https://paras.id/)marketplace contract - [source](https://github.com/ParasHQ/paras-marketplace-contract/tree/master/paras-marketplace-contract/src). -As for third-party solutions, the most complete one is [Mintibase](https://www.mintbase.io/), which provides a full suite of components for NFTs integration - including contracts, indexer, API and a web client: +As for third-party solutions, the most complete one is [Mintbase](https://www.mintbase.io/), which provides a full suite of components for NFTs integration - including contracts, indexer, API and a web client: diff --git a/docs/2.build/1.chain-abstraction/chain-signatures.md b/docs/2.build/1.chain-abstraction/chain-signatures/chain-signatures.md similarity index 87% rename from docs/2.build/1.chain-abstraction/chain-signatures.md rename to docs/2.build/1.chain-abstraction/chain-signatures/chain-signatures.md index 73d68b8f4f0..78a78b5088b 100644 --- a/docs/2.build/1.chain-abstraction/chain-signatures.md +++ b/docs/2.build/1.chain-abstraction/chain-signatures/chain-signatures.md @@ -31,33 +31,37 @@ There are five steps to create a Chain Signature: 1. [Deriving the Foreign Address](#1-deriving-the-foreign-address) - Construct the address that will be controlled on the target blockchain 2. [Creating a Transaction](#2-creating-the-transaction) - Create the transaction or message to be signed -3. [Requesting a Signature](#3-requesting-the-signature) - Call the NEAR `multichain` contract requesting it to sign the transaction +3. [Requesting a Signature](#3-requesting-the-signature) - Call the NEAR `v1.signer` contract requesting it to sign the transaction 4. [Reconstructing the Signature](#4-reconstructing-the-signature) - Reconstruct the signature from the MPC service's response 5. [Relaying the Signed Transaction](#5-relaying-the-signature) - Send the signed transaction to the destination chain for execution ![chain-signatures](/docs/assets/welcome-pages/chain-signatures-overview.png) _Diagram of a chain signature in NEAR_ -:::info MPC testnet contracts +:::info MPC Contracts If you want to try things out, these are the smart contracts available on `testnet`: - `v1.signer-prod.testnet`: [MPC signer](https://github.com/near/mpc/tree/v0.2.0/contract) contract, latest release, made up of 8 MPC nodes -- `canhazgas.testnet`: [Multichain Gas Station](multichain-gas-relayer/gas-station.md) contract -- `nft.kagi.testnet`: [NFT Chain Key](nft-keys.md) contract +- `canhazgas.testnet`: [Multichain Gas Station](../multichain-gas-relayer/gas-station.md) contract ::: +:::info MPC mainnet contracts + +- `v1.signer`: [MPC signer](https://github.com/near/mpc/tree/v0.2.0/contract) contract, latest release, made up of 8 MPC nodes +- `canhazgas.near`: [Multichain Gas Station](../multichain-gas-relayer/gas-station.md) contract +::: + --- ## 1. Deriving the Foreign Address -Chain Signatures use [`derivation paths`](../../1.concepts/abstraction/chain-signatures.md#one-account-multiple-chains) to represent accounts on the target blockchain. The external address to be controlled can be deterministically derived from: +Chain Signatures use [`derivation paths`](../../../1.concepts/abstraction/chain-signatures.md#one-account-multiple-chains) to represent accounts on the target blockchain. The external address to be controlled can be deterministically derived from: - The NEAR address (e.g., `example.near`, `example.testnet`, etc.) - A derivation path (a string such as `ethereum-1`, `ethereum-2`, etc.) -- The MPC service's public key - - `secp256k1:4NfTiv3UsGahebgTaHyD9vF8KYKMBnfd6kh94mK6xv8fGBiJB8TBtFMP5WWXz6B89Ac1fbpzPwAvoyQebemHFwx3` +- The MPC service's public key (see the tip bellow for the MPC service public keys) We provide code to derive the address, as it's a complex process that involves multiple steps of hashing and encoding: @@ -76,21 +80,22 @@ We provide code to derive the address, as it's a complex process that involves m -:::info +:::tip -The same NEAR account and path will always produce the same address on the target blockchain. +We recommend hardcoding the derivation paths in your application to ensure the signature request is made to the correct account -- `example.near` + `ethereum-1` = `0x1b48b83a308ea4beb845db088180dc3389f8aa3b` -- `example.near` + `ethereum-2` = `0x99c5d3025dc736541f2d97c3ef3c90de4d221315` +- **v1.signer-prod.testnet** (testnet): `secp256k1:4NfTiv3UsGahebgTaHyD9vF8KYKMBnfd6kh94mK6xv8fGBiJB8TBtFMP5WWXz6B89Ac1fbpzPwAvoyQebemHFwx3` + +- **v1.signer** (mainnet): `secp256k1:3tFRbMqmoa6AAALMrEFAYCEoHcqKxeW38YptwowBVBtXK1vo36HDbUWuR6EZmoK4JcH6HDkNMGGqP1ouV7VZUWya` ::: -:::tip +:::info -We recommend hardcoding the derivation paths in your application to ensure the signature request is made to the correct account +The same NEAR account and path will always produce the same address on the target blockchain. -#### v1.signer-prod.testnet -`secp256k1:4NfTiv3UsGahebgTaHyD9vF8KYKMBnfd6kh94mK6xv8fGBiJB8TBtFMP5WWXz6B89Ac1fbpzPwAvoyQebemHFwx3` +- `example.near` + `ethereum-1` = `0x1b48b83a308ea4beb845db088180dc3389f8aa3b` +- `example.near` + `ethereum-2` = `0x99c5d3025dc736541f2d97c3ef3c90de4d221315` ::: diff --git a/docs/2.build/1.chain-abstraction/chain-signatures/getting-started.md b/docs/2.build/1.chain-abstraction/chain-signatures/getting-started.md new file mode 100644 index 00000000000..ace96e3b6e1 --- /dev/null +++ b/docs/2.build/1.chain-abstraction/chain-signatures/getting-started.md @@ -0,0 +1,99 @@ +--- +id: getting-started +title: Getting Started with Chain Signatures +--- + +Chain Signatures is a groundbreaking technology built on NEAR that enables all accounts, including smart contracts, to sign and execute transactions across multiple blockchains. + +![img](https://pages.near.org/wp-content/uploads/2024/02/acct-abstraction-blog-1.png) + +This innovation leverages Multi-Party Computation (MPC) and a distributed network of node operators to create joint signatures from arbitrary payloads, allowing NEAR users to control external blockchain accounts. + +Chain Signatures enhances blockchain interoperability, giving ownership of diverse assets, cross-chain accounts, and data to a single NEAR account. + +--- + +## How does it work? + +When a NEAR account - could be a user or a **smart contract** - wants to interact with a foreign blockchain, it just need to follow four simple steps. + +#### 1. Deriving Foreign Addresses + +Chain Signatures uses [derivation paths](../../../1.concepts/abstraction/chain-signatures.md#derivation-paths-one-account-multiple-chains) to represent accounts on foreign blockchains + +The NEAR account’s name and the derivation path are used to mathematically derive a unique address for the user on the foreign blockchain + +
+ + Derivation Paths + +A NEAR account will always derive the same address on the foreign blockchain using the same derivation path + +Notice that, since the foreign address is derived from the NEAR account name, it is not possible for another NEAR account to control the same address + +
+ + +#### 2. Creating the Transaction + +The client constructs the foreign transaction to be signed, which varies depending on the target blockchain + +#### 3. Requesting the Signature + +A NEAR account or contract calls the sign method of the MPC smart contract ([v1.signer](https://nearblocks.io/address/v1.signer)) to sign the transaction and waits while our MPC service generates the signature + +#### 4. Relaying the Signature + +Once the signature is ready, the client reconstructs the signed transaction using the signature and broadcasts it to the destination blockchain + +:::tip + +Using Chain Signatures, developers can build cross-chain DeFi applications with seamless user experiences, eliminating the need for traditional bridges. This process eliminates the need for traditional bridges and enables developers to build innovative cross-chain DeFi applications with seamless user experiences. + +::: + +--- + +## Use Cases + +Chain Signatures can be used to build a wide range of applications that leverage blockchain interoperability. Here are some examples: + +1. **DeFi on Bitcoin (and other chain without smart contracts)** + * Chain signatures allow NEAR smart contract to program assets on Bitcoin + * Build lending, swaps, runes launchpads, passkey-based Bitcoin wallets, and more +2. **Chain agnostic applications** + * Since chain signatures can sign transactions for all blockchains, developers can support every single chain with just one smart contract + * Multichain DEXs, lending protocols, oracles, derivatives, and more +3. **Multichain account abstraction** + * Users can control assets on all chains with just their NEAR account, and can utilize account abstraction features on any chain including passkeys, key rotation, etc + * Using the multichain gas relayer, users can pay for gas fees on any chain using USDC +4. **Privacy** + * Chain signatures can be used to encrypt and decrypt information in a programmatic way + * This enables privacy applications, and even decrypting information based on ownership of assets/NFTs + +--- + +## How to Get Started? + +1. **Familiarize Yourself with Chain Signatures:** + * Understand the [basics of Chain Signatures](https://docs.near.org/concepts/abstraction/chain-signatures) and how they simplify blockchain interactions. + * Review the technical [explainer](https://near.org/blog/unlocking-web3-usability-with-account-aggregation). +2. **Explore the Use Cases:** + * Review [examples of use cases for Chain Signatures](https://pages.near.org/blog/unlocking-multichain-web3-with-near-chain-signatures/), such as Multichain DAO, Multichain NFT Minter, and Bitcoin Runes Airdrop. +3. **Access Resources and Documentation:** + * Visit the [Chain Signatures documentation](https://docs.near.org/build/chain-abstraction/chain-signatures) for detailed technical information and code snippets. + * Check out the [Linktree for Chain Signatures](https://linktr.ee/chainsignatures) for various resources, including demos and tutorials. +4. **Try the Demos:** + * Use the [command-line-based demo](https://github.com/near-examples/chainsig-script) to derive accounts and send transactions on Bitcoin, Ethereum, Doge, and Ripple. + * Check out the [web app demo](https://github.com/near-examples/near-multichain/tree/main). +5. **Engage with the Community:** + * Join the [Chain Abstraction developers’ channel on Telegram](https://t.me/chain\_abstraction) to connect with other developers and get support. + +--- + +## Where to Learn More? + +To dive deeper into Chain Signatures and its applications, you can explore the following resources: + +- **Technical Blogs and Deep Dives:** Read [high-level use cases](https://pages.near.org/blog/unlocking-multichain-web3-with-near-chain-signatures) and technical [explainer](https://near.org/blog/unlocking-web3-usability-with-account-aggregation) posts on the NEAR blog +* **Community and Support:** Engage with the NEAR community on social media platforms like Twitter and participate in discussions to stay updated on the latest developments diff --git a/docs/2.build/1.chain-abstraction/fastauth-sdk.md b/docs/2.build/1.chain-abstraction/fastauth-sdk.md index b01a8e8a7dc..dfa58e4e6ed 100644 --- a/docs/2.build/1.chain-abstraction/fastauth-sdk.md +++ b/docs/2.build/1.chain-abstraction/fastauth-sdk.md @@ -75,7 +75,7 @@ service cloud.firestore { - Press the gear button next to "Project Overview", and go to "Project settings" - Under "Your apps", click on the `` button - Set the app nickname as `issuer-gcp` and hit "Register app" -- You should see the code needed for initilization and authentication of Firestore, such as: +- You should see the code needed for initialization and authentication of Firestore, such as: ```js // Import the functions you need from the SDKs you need import { initializeApp } from "firebase/app"; @@ -253,7 +253,7 @@ const onCLick = () => selector.then((selector: any) => selector.wallet('fast-aut }),); ``` -Wehenever the user tries to login, call `onClick`. +Whenever the user tries to login, call `onClick`. ### Getting added to the MPC recovery service diff --git a/docs/2.build/1.chain-abstraction/meta-transactions.md b/docs/2.build/1.chain-abstraction/meta-transactions.md index 7167cca077a..5816879abc2 100644 --- a/docs/2.build/1.chain-abstraction/meta-transactions.md +++ b/docs/2.build/1.chain-abstraction/meta-transactions.md @@ -86,7 +86,7 @@ In this method we are creating an arbitrary smart contract call, instantiating a As mentioned in the above note in order to be able to relay on the client side it's necessary to have access to signing transactions directly on the client. Luckily leveraging the near biometric library it's possible to do so in a non custodial way. -By calling this method and passing in the URL for the account creation endpoint (mentioned in the server section) as well as the `accoundId` everything is handled under the hood to successfully create an account. +By calling this method and passing in the URL for the account creation endpoint (mentioned in the server section) as well as the `accountId` everything is handled under the hood to successfully create an account. diff --git a/docs/2.build/1.chain-abstraction/multichain-gas-relayer/gas-station.md b/docs/2.build/1.chain-abstraction/multichain-gas-relayer/gas-station.md index b8d1d1255d5..841cb6133fc 100644 --- a/docs/2.build/1.chain-abstraction/multichain-gas-relayer/gas-station.md +++ b/docs/2.build/1.chain-abstraction/multichain-gas-relayer/gas-station.md @@ -119,7 +119,7 @@ Users who wish to get transactions signed and relayed by this contract and its a If you want to try things out, this smart contract is available on: - testnet: `canhazgas.testnet` -- mainnet: `TBD` +- mainnet: `canhazgas.near` ::: diff --git a/docs/2.build/1.chain-abstraction/multichain-gas-relayer/getting-started.md b/docs/2.build/1.chain-abstraction/multichain-gas-relayer/getting-started.md new file mode 100644 index 00000000000..fb7feca4e55 --- /dev/null +++ b/docs/2.build/1.chain-abstraction/multichain-gas-relayer/getting-started.md @@ -0,0 +1,71 @@ +--- +id: getting-started +title: "Multichain Gas Relayer: Getting Started Guide" +--- + +[Chain Signatures](../chain-signatures/getting-started.md) lets users manage remote accounts and transact on any blockchain from a single NEAR account. The Multichain Gas Relayer further simplifies this process by eliminating the need for users to acquire the tokens needed in the foreign chain to execute their transactions. + +![img](https://pages.near.org/wp-content/uploads/2024/02/acct-abstraction-blog-1.png) + +In other words, the Multichain Gas Relayer provides gas abstraction for foreign chains, allowing NEAR accounts to pay for the gas needed in the target chain using our native token (NEAR) and fungible tokens (e.g. USDC and USDT). + + +--- + +## Why a Multichain Gas Relayer? + +NEAR's mission is to build blockchain infrastructure for Chain Abstracted applications. Chain abstraction aims to make blockchain technology more user-friendly by simplifying interactions. + +A key step in achieving this is reducing the complexity of paying for transaction gas across different blockchains. Users should be able to pay for cross-chain transactions with a single asset or have the gas fees fully sponsored on their behalf. + +--- + +## How Does it Work? + +The Multichain Gas Relayer has 3 core components: + +1. **Gas Station Smart Contract**: A smart contract on NEAR that manages the creation, signing, of transactions to foreign chains. It also handles gas fee calculations and collects NEAR tokens for gas payments on foreign chains + +2. **Multichain Relayer Server**: This server coordinates the relaying of transactions between NEAR and other blockchains. It listens for signed transaction payloads and submits them to the appropriate foreign chain RPCs + +3. **Chain Signatures**: A network of distributed Multi-Party Computation (MPC) signers that cooperatively sign transactions. This ensures secure transaction signing and validation on the NEAR blockchain before relaying to foreign chains + +#### System Workflow + +![chain-signatures](/docs/assets/welcome-pages/multi-chain-gas-diagram.png) +_Diagram of a chain signature in NEAR with gas being covered by the Relayer_ + +1. **Transaction Creation**: An account sends a transaction to the Gas Station Contract, specifying the foreign chain transaction and attaching NEAR tokens to cover gas fees on the foreign chain. + +2. **Transaction Signing**: The Gas Station Contract invokes Chain Signatures MPC signing service to sign the transaction. This step may require multiple calls due to gas limitations on NEAR, especially for complex transactions + +3. **Event Emission and Indexing**: Once the transactions are signed, the Gas Station Contract emits an event. The Gas Station Event Indexer picks up this event and triggers the Multichain Relayer Server to relay the signed transactions + +4. **Relaying Transactions**: The Multichain Relayer Server first sends a funding transaction to ensure the user’s account on the foreign chain has sufficient gas. Once confirmed, it sends the user’s originally intended signed transaction to the foreign chain for execution + +--- + +## Example Real-World Flow + +* Alice has an `alice.near` account that maps to a remote Optimism (OP) address, `0xabc` +* Alice wants to interact with a Farcaster application on OP using her NEAR account, but she prefers to pay for gas with assets she has on hand, specifically USDT +* Alice initiates an on-chain action on Farcaster from her NEAR account. She sends the transaction to a gas station smart contract, including the OP transaction payload in the arguments and attaching the necessary USDT amount for the cross-chain gas payment +* The transaction bundle is sent to the NEAR gas station contract, which then forwards it to the NEAR MPC signing service. This bundle includes (1) the transaction to fund the user's `0xabc` address with the ETH needed for gas, and (2) the user's original transaction to take action on the Farcaster application +* The MPC service will sign both transactions and forward the signed transactions back to the gas station contract +* The relayer operator will observe the events (signed transactions) emitted from the gas station contract and submit them to the Optimism network. This process starts by initiating a fund transfer from a treasury paymaster account on Optimism that holds ETH. The paymaster account will transfer ETH to the user's `0xabc` address, equivalent to the USDT originally sent by the user +* Then the relayer will submit the final transaction, and the originally intended Farcaster transaction will be executed from the user's `0xabc` address, using ETH to cover the gas + +--- + +## What chains are supported? + +Currently, the Multichain Gas Relayer supports [Base](https://www.base.org/), [Optimism](https://www.optimism.io/), [Arbitrum](https://arbitrum.io/) and [Binance Smart Chain](https://www.bnbchain.org/en/bnb-smart-chain), and [Ethereum](https://ethereum.org/en/). + +These chains were selected based on multiple factors including interest from key partners, low gas fees, and fast finality for transactions. Support for EDDSA chains like [Solana](https://solana.com/) will be coming soon in conjunction with EDDSA support for NEAR chain signatures. + +--- + +## Where can I go to learn more? + +* Visit our [docs](./overview.md) to learn more about how to integrate the Multichain Gas Relayer into your product +* Join the NEAR Chain Abstraction [developer group](https://t.me/chain\_abstraction) on Telegram to ask questions and discuss ideas with other developers. \ No newline at end of file diff --git a/docs/2.build/1.chain-abstraction/multichain-gas-relayer/multichain-server.md b/docs/2.build/1.chain-abstraction/multichain-gas-relayer/multichain-server.md index e0c018b7529..9b9f826593d 100644 --- a/docs/2.build/1.chain-abstraction/multichain-gas-relayer/multichain-server.md +++ b/docs/2.build/1.chain-abstraction/multichain-gas-relayer/multichain-server.md @@ -47,7 +47,7 @@ For independent deployments of gas station contracts, generally, nonce synchroni 1. The wallet sends a NEAR transaction to the gas station contract that contains 2 actions: 1. A transfer of `NEAR` (or FT Transfer in the future) to cover gas on the foreign chain 2. A `create_transaction` function call to the gas station contract `canhazgas.testnet` containing the unsigned foreign chain transaction to be signed by the MPC signing service, assuming the unsigned transaction passes validation. - > (note: `mainnet` contract address TBD) + > (note: `mainnet` contract address is `canhazgas.near`) 2. The Gas Station Contract calls the MPC signing service to sign both a funding transaction, which ensures the user's foreign chain account has sufficient gas to execute the desired transaction, and signs the unsigned foreign chain transaction. 3. Upon receipt of both the signed transactions, the Gas Station Contract emits an event which is picked up by the indexer, which then calls the `/send_funding_and_user_signed_txns` with the 2 signed transactions from the indexer. 4. The multichain relayer server sends the funding transaction to the foreign chain RPC to fund the user's account with gas. diff --git a/docs/2.build/1.chain-abstraction/multichain-gas-relayer/overview.md b/docs/2.build/1.chain-abstraction/multichain-gas-relayer/overview.md index 199324ba8a6..e5187dfbec7 100644 --- a/docs/2.build/1.chain-abstraction/multichain-gas-relayer/overview.md +++ b/docs/2.build/1.chain-abstraction/multichain-gas-relayer/overview.md @@ -28,7 +28,7 @@ This section provides an overview of the system design, including the main compo 2. [**Gas Station Contract**](gas-station.md): A smart contract on NEAR that manages the creation, signing, and relaying of transactions to foreign chains. It also handles gas fee calculations and collects NEAR tokens for gas payments on foreign chains. -3. [**MPC Signing Service**](../chain-signatures.md): A network of trusted Multi-Party Computation (MPC) signers that cooperatively sign transactions. This ensures secure transaction signing and validation on the NEAR blockchain before relaying to foreign chains. +3. [**MPC Signing Service**](../chain-signatures/chain-signatures.md): A network of trusted Multi-Party Computation (MPC) signers that cooperatively sign transactions. This ensures secure transaction signing and validation on the NEAR blockchain before relaying to foreign chains. ### Technical Diagram diff --git a/docs/2.build/1.chain-abstraction/multichain-gas-relayer/relayer-gas-example.md b/docs/2.build/1.chain-abstraction/multichain-gas-relayer/relayer-gas-example.md index abfd78660ce..5441db3499f 100644 --- a/docs/2.build/1.chain-abstraction/multichain-gas-relayer/relayer-gas-example.md +++ b/docs/2.build/1.chain-abstraction/multichain-gas-relayer/relayer-gas-example.md @@ -70,7 +70,7 @@ To run the [Gas Station indexer](https://github.com/near/gas-station-event-index make install ``` -3. Update the [`config.toml`](https://github.com/near/gas-station-event-indexer/blob/main/config.toml) configuration file with appropriate values +3. Update the [`config.toml`](https://github.com/near/gas-station-event-indexer/blob/main/config.toml) configuration file with appropriate values (use `canhazgas.near` for mainnet) ``` network = "testnet" # gas station contract account id @@ -135,7 +135,7 @@ The following instructions are only need to be called once to initialize the acc mint json-args {} prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' \ sign-as .testnet network-config testnet sign-with-keychain send ``` -3. Approve the Gas Station for this Token +3. Approve the Gas Station for this Token (use or use `canhazgas.near` for mainnet): ```shell near contract call-function as-transaction v2.nft.kagi.testnet \ ckt_approve_call json-args '{"token_id":"","account_id":"canhazgas.testnet","msg":""}' \ @@ -145,7 +145,7 @@ The following instructions are only need to be called once to initialize the acc ### Manual test steps -1. Get paymaster info for the chain you want to send to from the gas station contract, then optionally manually set nonces: +1. Get paymaster info for the chain you want to send to from the gas station contract, then optionally manually set nonces (use `canhazgas.near` for mainnet): ```shell near contract call-function as-transaction canhazgas.testnet \ get_paymasters json-args '{"chain_id": ""}' \ @@ -165,7 +165,7 @@ The following instructions are only need to be called once to initialize the acc ] ------------------------------------ ``` - 1. You may need to manually set the nonce for the paymaster to be able to send the transaction: + 1. You may need to manually set the nonce for the paymaster to be able to send the transaction (use `canhazgas.near` for mainnet): ```shell near contract call-function as-transaction canhazgas.testnet \ get_paymasters json-args '{"chain_id": ""}' \ @@ -215,7 +215,7 @@ Python and Rust output different hex RLP encoded transactions. You should transfer the amount of `NEAR` that's needed to cover gas both on NEAR and on the foreign chain. You also need to paste in the RLP generated hex for the EVM transaction you want on the other chain generated in step 1. When it asks you to send or display, choose send. - For example: + For example (use `canhazgas.near` for mainnet): ```shell near contract call-function as-transaction canhazgas.testnet \ create_transaction json-args '{"transaction_rlp_hex":"eb80851bf08eb000825208947b965bdb7f0464843572eb2b8c17bdf27b720b14872386f26fc1000080808080","use_paymaster":true,"token_id":""}' \ @@ -232,7 +232,7 @@ Python and Rust output different hex RLP encoded transactions. } ------------------------------------ ``` -6. Get the `"id"` from the receipts from the result in the previous step, and use that to call `sign_next` twice: +6. Get the `"id"` from the receipts from the result in the previous step, and use that to call `sign_next` twice (use `canhazgas.near` for mainnet): ```shell near contract call-function as-transaction canhazgas.testnet \ sign_next json-args '{"id":""}' \ @@ -253,7 +253,7 @@ Python and Rust output different hex RLP encoded transactions. ### Optional for testing purposes -Instead of creating a signed transaction and calling the gas station contract to sign it, you can get the recently signed transactions by calling the contract while replacing the `blockheight` with a more recent block height: +Instead of creating a signed transaction and calling the gas station contract to sign it, you can get the recently signed transactions by calling the contract while replacing the `blockheight` with a more recent block height (use `canhazgas.near` for mainnet): ```sh near contract call-function as-read-only canhazgas.testnet list_signed_transaction_sequences_after json-args '{"block_height":"157111000"}' network-config testnet now diff --git a/docs/2.build/1.chain-abstraction/wallet.md b/docs/2.build/1.chain-abstraction/wallet.md index 9843cec2f06..e85b42351bc 100644 --- a/docs/2.build/1.chain-abstraction/wallet.md +++ b/docs/2.build/1.chain-abstraction/wallet.md @@ -10,7 +10,7 @@ You'll also learn how to ensure that a signature on one chain is not used to tak ### Key derivation -When signing using [chain signatures](./chain-signatures.md) each account has an unlimited number of keys. Each key's public key is derived from the account name and the key extension which is an arbitrary string. +When signing using [chain signatures](./chain-signatures/chain-signatures.md) each account has an unlimited number of keys. Each key's public key is derived from the account name and the key extension which is an arbitrary string. User's keys can be described as follow: @@ -94,7 +94,7 @@ In the following examples, the messages are coming from the user's wallet fronte - [Using a personal Bitcoin key](#using-a-personal-bitcoin-key) - [Using a personal EVM key to sign a Binance transaction](#using-a-personal-evm-key-to-sign-a-binance-transaction) - [Using an untyped domain key](#using-an-untyped-domain-key) -- [Using another domains Bitcoin key](#using-another-domains-bitcoin-key) +- [Using another domain's Bitcoin key](#using-another-domains-bitcoin-key) :::tip Wallet developers should follow this user flow format. diff --git a/docs/2.build/2.smart-contracts/anatomy/collections.md b/docs/2.build/2.smart-contracts/anatomy/collections.md index 566afb6d2c9..61859ca936a 100644 --- a/docs/2.build/2.smart-contracts/anatomy/collections.md +++ b/docs/2.build/2.smart-contracts/anatomy/collections.md @@ -6,17 +6,14 @@ import {CodeTabs, Language, Github} from "@site/src/components/codetabs" import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -When deciding on data structures to use for the data of the application, it is important to understand the tradeoffs of data structures in your smart contract. - -Choosing the wrong structure can create a bottleneck as the application scales, and migrating the state to the new data structures will come at a cost. +When deciding on data structures it is important to understand their tradeoffs. Choosing the wrong structure can create a bottleneck as the application scales, and migrating the state to the new data structures will come at a cost. You can choose between two types of collections: 1. Native collections (e.g. `Array`, `Map`, `Set`), provided by the the language -2. SDK collections (e.g. `UnorderedMap`, `Vector`), provided by the NEAR SDK - -Since the SDK reads all the contract's attributes when a function is executed - and writes them back when it finishes - understanding how the SDK stores and loads both types of collections is crucial to decide which one to use. +2. SDK collections (e.g. `IterableMap`, `Vector`), provided by the NEAR SDK +Understanding how the contract stores and loads both types of collections is crucial to decide which one to use. :::tip @@ -24,9 +21,9 @@ Use native collections for small amounts of data that need to be accessed all to ::: -:::info +:::info How the State is Handled -Contracts store all their data in a `key-value` database. The SDK handles this database, and stores values [serialized in JSON or Borsh](./serialization.md) +Each time the contract is executed, the first thing it will do is to read the values and [deserialize](./serialization.md) them into memory, and after the function finishes, it will [serialize](./serialization.md) and write the values back to the database. ::: @@ -35,10 +32,10 @@ Contracts store all their data in a `key-value` database. The SDK handles this d ## Native Collections Native collections are those provided by the language: -- JS: `Array`, `Set`, `Map` -- Rust: `Vector`, `HashMap`, `Set` +- JS: `Array`, `Set`, `Map`, `Object` ... +- Rust: `Vector`, `HashMap`, `Set` ... -All entries in a native collection are serialized into a single value and stored together into the state. This means that every time a function execute, the SDK will read and deserialize all entries in the native collection. +All entries in a native collection are **serialized into a single value** and **stored together** into the state. This means that every time a function execute, the SDK will read and **deserialize all entries** in the native collection.
@@ -54,9 +51,9 @@ Native collections are useful if you are planning to store smalls amounts of dat ::: -:::warning Keep Native Collections Small +:::danger Keep Native Collections Small -As the collection grows, reading and writing it will cost more and more gas. If the collections grows too large, your contract might end up expending all its available gas in reading/writing the state, thus becoming unusable +As the native collection grows, deserializing it from memory will cost more and more gas. If the collections grows too large, your contract might expend all the gas trying to read its state, making it fail on each function call ::: @@ -64,9 +61,9 @@ As the collection grows, reading and writing it will cost more and more gas. If ## SDK Collections -The NEAR SDKs expose collections that are optimized to store large amounts of data in the contract's state. These collections are built to have an interface similar to native collections. +The NEAR SDKs expose collections that are optimized for random access of large amounts of data. SDK collections are instantiated using a "prefix", which is used as an index to split the data into chunks. This way, SDK collections can defer reading and writing to the store until needed. -SDK collections are instantiated using a "prefix", which is used as an index to split the data into chunks. This way, SDK collections can defer reading and writing to the store until needed. +These collections are built to have an interface similar to native collections.
@@ -93,32 +90,44 @@ SDK collections are useful when you are planning to store large amounts of data | SDK Collection | Native Equivalent | Description | |----------------|-------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `Vector` | `Array` | A growable array type. The values are sharded in memory and can be used for iterable and indexable values that are dynamically sized. | -| `LookupMap` | `Map` | This structure behaves as a thin wrapper around the key-value storage available to contracts. This structure does not contain any metadata about the elements in the map, so it is not iterable. | -| `UnorderedMap` | `Map` | Similar to `LookupMap`, except that it stores additional data to be able to iterate through elements in the data structure. | | `LookupSet` | `Set` | A set, which is similar to `LookupMap` but without storing values, can be used for checking the unique existence of values. This structure is not iterable and can only be used for lookups. | | `UnorderedSet` | `Set` | An iterable equivalent of `LookupSet` which stores additional metadata for the elements contained in the set. | +| `LookupMap` | `Map` | This structure behaves as a thin wrapper around the key-value storage available to contracts. This structure does not contain any metadata about the elements in the map, so it is not iterable. | +| `UnorderedMap` | `Map` | Similar to `LookupMap`, except that it stores additional data to be able to iterate through elements in the data structure. | -:::info Note +| SDK collection | `std` equivalent | Description | +|-----------------------------------------------|-----------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `store::Vector` | `Vec` | A growable array type. The values are sharded in memory and can be used for iterable and indexable values that are dynamically sized. | +| store::LookupMap`` | HashMap`` | This structure behaves as a thin wrapper around the key-value storage available to contracts. This structure does not contairn any metadata about the elements in the map, so it is not iterable. | +| store::IterableMap`` | HashMap`` | Similar to `LookupMap`, except that it stores additional data to be able to iterate through elements in the data structure. | +| store::UnorderedMap`` | HashMap`` | Similar to `LookupMap`, except that it stores additional data to be able to iterate through elements in the data structure. | +| `store::LookupSet` | `HashSet` | A set, which is similar to `LookupMap` but without storing values, can be used for checking the unique existence of values. This structure is not iterable and can only be used for lookups. | +| `store::IterableSet` | `HashSet` | An iterable equivalent of `LookupSet` which stores additional metadata for the elements contained in the set. | +| `store::UnorderedSet` | `HashSet` | An iterable equivalent of `LookupSet` which stores additional metadata for the elements contained in the set. | -The `near_sdk::collections` will be moving to `near_sdk::store` and have updated APIs. If you would like to access these updated structures as they are being implemented, enable the `unstable` feature on `near-sdk`. + -::: + + +:::info Note +The `near_sdk::collections` is now deprecated in favor of `near_sdk::store`. To use `near_sdk::collections` you will have to use the [`legacy` feature](https://github.com/near-examples/storage-examples/blob/2a138a6e8915e08ce76718add3e36c04c2ea2fbb/collections-rs/legacy/Cargo.toml#L11). -| SDK collection | `std` equivalent | Description | -|----------------------------------------|------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `LazyOption` | `Option` | Optional value in storage. This value will only be read from storage when interacted with. This value will be `Some` when the value is saved in storage, and `None` if the value at the prefix does not exist. | -| `Vector` | `Vec` | A growable array type. The values are sharded in memory and can be used for iterable and indexable values that are dynamically sized. | -| LookupMap`` | HashMap`` | This structure behaves as a thin wrapper around the key-value storage available to contracts. This structure does not contain any metadata about the elements in the map, so it is not iterable. | -| UnorderedMap`` | HashMap`` | Similar to `LookupMap`, except that it stores additional data to be able to iterate through elements in the data structure. | -| TreeMap`` | BTreeMap`` | An ordered equivalent of `UnorderedMap`. The underlying implementation is based on an [AVL tree](https://en.wikipedia.org/wiki/AVL_tree). This structure should be used when a consistent order is needed or accessing the min/max keys is needed. | -| `LookupSet` | `HashSet` | A set, which is similar to `LookupMap` but without storing values, can be used for checking the unique existence of values. This structure is not iterable and can only be used for lookups. | -| `UnorderedSet` | `HashSet` | An iterable equivalent of `LookupSet` which stores additional metadata for the elements contained in the set. | +::: +| SDK collection | `std` equivalent | Description | +|----------------------------------------------------|------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `collections::Vector` | `Vec` | A growable array type. The values are sharded in memory and can be used for iterable and indexable values that are dynamically sized. | +| collections::LookupMap`` | HashMap`` | This structure behaves as a thin wrapper around the key-value storage available to contracts. This structure does not contairn any metadata about the elements in the map, so it is not iterable. | +| collections::UnorderedMap`` | HashMap`` | Similar to `LookupMap`, except that it stores additional data to be able to iterate through elements in the data structure. | +| collections::TreeMap`` | BTreeMap`` | An ordered equivalent of `UnorderedMap`. The underlying implementation is based on an [AVL tree](https://en.wikipedia.org/wiki/AVL_tree). This structure should be used when a consistent order is needed or accessing the min/max keys is needed. | +| `collections::LookupSet` | `HashSet` | A set, which is similar to `LookupMap` but without storing values, can be used for checking the unique existence of values. This structure is not iterable and can only be used for lookups. | +| `collections::UnorderedSet` | `HashSet` | An iterable equivalent of `LookupSet` which stores additional metadata for the elements contained in the set. | +| `collections::LazyOption` | `Option` | Optional value in storage. This value will only be read from storage when interacted with. This value will be `Some` when the value is saved in storage, and `None` if the value at the prefix does not exist. | @@ -131,8 +140,11 @@ The `near_sdk::collections` will be moving to `near_sdk::store` and have updated | `Vector` | ✅ | ✅ | ✅ | ✅ | | `LookupSet` | | | | | | `UnorderedSet` | ✅ | ✅ | | ✅ | +| `IterableSet` | ✅ | ✅ | | ✅ | | `LookupMap` | | | | | | `UnorderedMap` | ✅ | ✅ | | ✅ | +| `IterableMap` | ✅ | ✅ | | ✅ | +| `TreeMap` | ✅ | ✅ | ✅ | ✅ |
@@ -143,8 +155,9 @@ The `near_sdk::collections` will be moving to `near_sdk::store` and have updated | `Vector` | O(1) | O(1)\* | O(1)\*\* | O(n) | O(n) | O(n) | | `LookupSet` | O(1) | O(1) | O(1) | O(1) | N/A | N/A | | `UnorderedSet` | O(1) | O(1) | O(1) | O(1) | O(n) | O(n) | +| `IterableSet` | O(1) | O(1) | O(1) | O(1) | O(n) | O(n) | | `LookupMap` | O(1) | O(1) | O(1) | O(1) | N/A | N/A | -| `UnorderedMap` | O(1) | O(1) | O(1) | O(1) | O(n) | O(n) | +| `IterableMap` | O(1) | O(1) | O(1) | O(1) | O(n) | O(n) | | `TreeMap` | O(1) | O(log n) | O(log n) | O(log n) | O(n) | O(n) | _\* - to insert at the end of the vector using `push_back` (or `push_front` for deque)_ @@ -152,7 +165,11 @@ _\*\* - to delete from the end of the vector using `pop` (or `pop_front` for deq --- -## Collections Cookbook +## SDK Collections Cookbook + +Let's see how to use the SDK collections in practice + +
### Instantiation @@ -160,32 +177,45 @@ All structures need to be initialized using a **unique `prefix`**, which will be - + + + +:::tip + +Do not forget to use the `schema` to define how your contract's state is structured + +::: + + url="https://github.com/near-examples/storage-examples/blob/main/collections-rs/store/src/lib.rs" + start="24" end="47"/> :::tip - Notice how we use `enums` to ensure all collections have a different prefix. Moreover, `enums` are very efficient since they get serialized into a single `byte` prefix. + Notice how we use `enums` to ensure all collections have a different prefix. Another advantage of using `enums` is that they are serialized into a single `byte` prefix. ::: - + + -:::warning + :::tip -Because the values are not kept in memory and are lazily loaded from storage, it's important to make sure if a collection is replaced or removed, that the storage is cleared. In addition, it is important that if the collection is modified, the collection itself is updated in state because most collections will store some metadata. + Notice how we use `enums` to ensure all collections have a different prefix. Another advantage of using `enums` is that they are serialized into a single `byte` prefix. -::: + ::: + + + :::danger @@ -199,60 +229,94 @@ Be careful of not using the same prefix in two collections, otherwise, their sto Implements a [vector/array](https://en.wikipedia.org/wiki/Array_data_structure) which persists in the contract's storage. Please refer to the Rust and JS SDK's for a full reference on their interfaces. - - - - - - - - - + + + + + + + + + + +
-### Map +### LookupMap Implements a [map/dictionary](https://en.wikipedia.org/wiki/Associative_array) which persists in the contract's storage. Please refer to the Rust and JS SDK's for a full reference on their interfaces. - - - - - - - - - + + + + + + + +
-### Set +### UnorderedMap / IterableMap + +Implements a [map/dictionary](https://en.wikipedia.org/wiki/Associative_array) which persists in the contract's storage. Please refer to the Rust and JS SDK's for a full reference on their interfaces. + + + + + + + + + + +
+ +### LookupSet Implements a [set](https://en.wikipedia.org/wiki/Set_(abstract_data_type)) which persists in the contract's storage. Please refer to the Rust and JS SDK's for a full reference on their interfaces. - - - - - - - - - - + + + + + + + + + + +
+ +### UnorderedSet / IterableSet + +Implements a [map/dictionary](https://en.wikipedia.org/wiki/Associative_array) which persists in the contract's storage. Please refer to the Rust and JS SDK's for a full reference on their interfaces. + + + + + + + + +
@@ -260,23 +324,18 @@ Implements a [set](https://en.wikipedia.org/wiki/Set_(abstract_data_type)) which An ordered equivalent of Map. The underlying implementation is based on an [AVL](https://en.wikipedia.org/wiki/AVL_tree). You should use this structure when you need to: have a consistent order, or access the min/max keys. - - - - - - + + + + +
-### `LazyOption` +### LazyOption (Legacy) -It's a type of persistent collection that only stores a single value. -The goal is to prevent a contract from deserializing the given value until it's needed. -An example can be a large blob of metadata that is only needed when it's requested in a view call, -but not needed for the majority of contract operations. +LazyOptions are great to store large values (i.e. a wasm file), since its value will not be read from storage until it is interacted with. It acts like an `Option` that can either hold a value or not and also requires a unique prefix (a key in this case) like other persistent collections. @@ -287,90 +346,26 @@ Compared to other collections, `LazyOption` only allows you to initialize the va ## Nesting Collections -It is possible to nest collections. When nesting SDK collections, remember to **assign different prefixes to all collections** (including the nested ones). +When nesting SDK collections, be careful to **use different prefixes** for all collections, including the nested ones. - While you can create nested maps, you first need to construct or deconstruct the structure from state. This is a temporary solution that will soon be automatically handled by the SDK. - - ```ts - import { NearBindgen, call, view, near, UnorderedMap } from "near-sdk-js"; - - @NearBindgen({}) - class StatusMessage { - records: UnorderedMap; - constructor() { - this.records = new UnorderedMap("a"); - } - - @call({}) - set_status({ message, prefix }: { message: string; prefix: string }) { - let account_id = near.signerAccountId(); - - const inner: any = this.records.get("b" + prefix); - const inner_map: UnorderedMap = inner - ? UnorderedMap.deserialize(inner) - : new UnorderedMap("b" + prefix); - - inner_map.set(account_id, message); - - this.records.set("b" + prefix, inner_map); - } - - @view({}) - get_status({ account_id, prefix }: { account_id: string; prefix: string }) { - const inner: any = this.records.get("b" + prefix); - const inner_map: UnorderedMap = inner - ? UnorderedMap.deserialize(inner) - : new UnorderedMap("b" + prefix); - return inner_map.get(account_id); - } - } - ``` + - In Rust the simplest way to avoid collisions between nested collections is by using `enums` + - ```rust - use near_sdk::borsh::{self, BorshDeserialize, BorshSerialize}; - use near_sdk::collections::{UnorderedMap, UnorderedSet}; - use near_sdk::{env, near, AccountId, BorshStorageKey, CryptoHash}; - - #[near(contract_state)] - pub struct Contract { - pub accounts: UnorderedMap>, - } - - impl Default for Contract { - fn default() -> Self { - Self { - accounts: UnorderedMap::new(StorageKeys::Accounts), - } - } - } - - #[near(serializers = [borsh])] - pub enum StorageKeys { - Accounts, - SubAccount { account_hash: CryptoHash }, - } - - #[near] - impl Contract { - pub fn get_tokens(&self, account_id: &AccountId) -> Vec { - let tokens = self.accounts.get(account_id).unwrap_or_else(|| { - UnorderedSet::new(StorageKeys::SubAccount { - account_hash: env::sha256_array(account_id.as_bytes()), - }) - }); - tokens.to_vec() - } - } - ``` + :::tip + + Notice how we use `enums` that take a `String` argument to ensure all collections have a different prefix + + ::: @@ -384,13 +379,6 @@ Because the values are not kept in memory and are lazily loaded from storage, it Some error-prone patterns to avoid that cannot be restricted at the type level are: - - - - - - - @@ -446,9 +434,9 @@ assert!( // as reads, and the writes are performed on [`Drop`](https://doc.rust-lang.org/std/ops/trait.Drop.html) // so if the collection is kept in static memory or something like `std::mem::forget` is used, // the changes will not be persisted. -use near_sdk::store::LookupSet; +use near_sdk::store::IterableSet; -let mut m: LookupSet = LookupSet::new(b"l"); +let mut m: IterableSet = IterableSet::new(b"l"); m.insert(1); assert!(m.contains(&1)); @@ -456,7 +444,7 @@ assert!(m.contains(&1)); // m.flush(); std::mem::forget(m); -m = LookupSet::new(b"l"); +m = IterableSet::new(b"l"); assert!(!m.contains(&1)); ``` @@ -470,7 +458,7 @@ Some issues for more context: - https://github.com/near/near-sdk-rs/issues/560 - https://github.com/near/near-sdk-rs/issues/703 -The following cases are the most commonly encountered bugs that cannot be restricted at the type level: +The following cases are the most commonly encountered bugs that cannot be restricted at the type level (only relevant for `near_sdk::collections`, not `near_sdk::store`): ```rust use near_sdk::borsh::{self, BorshSerialize}; @@ -502,8 +490,7 @@ let n = root.get(&1).unwrap(); assert!(n.is_empty()); assert!(n.contains(&"test".to_string())); -// Bug 2 (only relevant for `near_sdk::collections`, not `near_sdk::store`): Nested -// collection is modified without updating the collection itself in the outer collection. +// Bug 2: Nested collection is modified without updating the collection itself in the outer collection. // // This is fixed at the type level in `near_sdk::store` because the values are modified // in-place and guarded by regular Rust borrow-checker rules. @@ -527,35 +514,53 @@ assert!(n.contains(&"some value".to_string())); ## Pagination -Persistent collections such as `UnorderedMap`, `UnorderedSet` and `Vector` may +Persistent collections such as `IterableMap/UnorderedMap`, `IterableSet/UnorderedSet` and `Vector` may contain more elements than the amount of gas available to read them all. In order to expose them all through view calls, we can use pagination. -This can be done using iterators with [`Skip`](https://doc.rust-lang.org/std/iter/struct.Skip.html) and [`Take`](https://doc.rust-lang.org/std/iter/struct.Take.html). This will only load elements from storage within the range. -Example of pagination for `UnorderedMap`: -```rust -#[near(contract_state)] -#[derive(PanicOnDefault)] -pub struct Contract { - pub status_updates: UnorderedMap, -} + + + With JavaScript this can be done using iterators with [`toArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator/toArray) and [`slice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice). -#[near] -impl Contract { - /// Retrieves multiple elements from the `UnorderedMap`. - /// - `from_index` is the index to start from. - /// - `limit` is the maximum number of elements to return. - pub fn get_updates(&self, from_index: usize, limit: usize) -> Vec<(AccountId, String)> { - self.status_updates - .iter() - .skip(from_index) - .take(limit) - .collect() - } -} -``` + ```ts + /// Returns multiple elements from the `UnorderedMap`. + /// - `from_index` is the index to start from. + /// - `limit` is the maximum number of elements to return. + @view({}) + get_updates({ from_index, limit }: { from_index: number, limit:number }) { + return this.status_updates.toArray().slice(from_index, limit); + } + ``` + + + + With Rust this can be done using iterators with [`Skip`](https://doc.rust-lang.org/std/iter/struct.Skip.html) and [`Take`](https://doc.rust-lang.org/std/iter/struct.Take.html). This will only load elements from storage within the range. + + ```rust + #[near(contract_state)] + #[derive(PanicOnDefault)] + pub struct Contract { + pub status_updates: IterableMap, + } + + #[near] + impl Contract { + /// Retrieves multiple elements from the `IterableMap`. + /// - `from_index` is the index to start from. + /// - `limit` is the maximum number of elements to return. + pub fn get_updates(&self, from_index: usize, limit: usize) -> Vec<(AccountId, String)> { + self.status_updates + .iter() + .skip(from_index) + .take(limit) + .collect() + } + } + ``` + + --- diff --git a/docs/2.build/2.smart-contracts/testing/kurtosis-localnet.md b/docs/2.build/2.smart-contracts/testing/kurtosis-localnet.md index 1c5c72d6fc3..a958378a90b 100644 --- a/docs/2.build/2.smart-contracts/testing/kurtosis-localnet.md +++ b/docs/2.build/2.smart-contracts/testing/kurtosis-localnet.md @@ -622,9 +622,9 @@ Once you've logged in, you can sign a message with an optional donation. --- -## Managing NEAR Pacakages +## Managing NEAR Packages -The Kurtosis NEAR Pacakages you create will continue to run on your local machine for as long as your Docker engine is running. This package runs inside of a Kurtosis "enclave" which is an environment isolated from both your computer and other enclaves. In practice, this means that you can have multiple independent local NEAR clusters running on your machine simply by rerunning the script we executed from the [setup instructions](#setup). +The Kurtosis NEAR Packages you create will continue to run on your local machine for as long as your Docker engine is running. This package runs inside of a Kurtosis "enclave" which is an environment isolated from both your computer and other enclaves. In practice, this means that you can have multiple independent local NEAR clusters running on your machine simply by rerunning the script we executed from the [setup instructions](#setup). ### View Package Status diff --git a/docs/2.build/5.primitives/ft.md b/docs/2.build/5.primitives/ft.md index 3ce1811eda0..cd9eb8d1a78 100644 --- a/docs/2.build/5.primitives/ft.md +++ b/docs/2.build/5.primitives/ft.md @@ -33,7 +33,7 @@ import CLICreateToken from "./ft/near-cli/create.md" import SmartContractSendToken from "./ft/smart-contract/send.md" import SmartContractAttachTokenToCall from "./ft/smart-contract/attach-to-call.md" -Besides the native NEAR token, NEAR accounts have access to a [multitude of tokens](https://guide.ref.finance/developers-1/cli-trading#query-whitelisted-tokens) to use thoughtout the ecosystem. Moreover, it is even possible for users to create their own fungible tokens. +Besides the native NEAR token, NEAR accounts have access to a [multitude of tokens](https://guide.ref.finance/developers-1/cli-trading#query-whitelisted-tokens) to use throughout the ecosystem. Moreover, it is even possible for users to create their own fungible tokens. In contrast with the NEAR native token, fungible token (FT) are **not stored** in the user's account. In fact, each FT lives in **their own contract** which is in charge of doing **bookkeeping**. This is, the contract keeps track of how many tokens each user has, and handles transfers internally. diff --git a/docs/2.build/6.data-infrastructure/lake-data-structures/state_change.mdx b/docs/2.build/6.data-infrastructure/lake-data-structures/state_change.mdx index 1af0fdcb5d9..4554f436e5c 100644 --- a/docs/2.build/6.data-infrastructure/lake-data-structures/state_change.mdx +++ b/docs/2.build/6.data-infrastructure/lake-data-structures/state_change.mdx @@ -11,7 +11,7 @@ import TabItem from '@theme/TabItem'; ## Definition -This entitiy from `nearcore` describes how account's state has changed and the reason +This entity from `nearcore` describes how account's state has changed and the reason ## `StateChangeWithCauseView` @@ -101,4 +101,3 @@ export type StateChange = { - diff --git a/docs/2.build/6.data-infrastructure/lake-data-structures/transaction.mdx b/docs/2.build/6.data-infrastructure/lake-data-structures/transaction.mdx index 093fec57137..34f941f9679 100644 --- a/docs/2.build/6.data-infrastructure/lake-data-structures/transaction.mdx +++ b/docs/2.build/6.data-infrastructure/lake-data-structures/transaction.mdx @@ -10,7 +10,7 @@ import TabItem from '@theme/TabItem'; ## Definition -Transaction is the main way of interraction between a user and a blockchain. Transaction contains: +Transaction is the main way of interaction between a user and a blockchain. Transaction contains: - Signer account ID - Receiver account ID - Actions diff --git a/docs/2.build/6.data-infrastructure/lake-framework/migrating-to-near-lake-framework.md b/docs/2.build/6.data-infrastructure/lake-framework/migrating-to-near-lake-framework.md index 44e00dda479..a954186dd4d 100644 --- a/docs/2.build/6.data-infrastructure/lake-framework/migrating-to-near-lake-framework.md +++ b/docs/2.build/6.data-infrastructure/lake-framework/migrating-to-near-lake-framework.md @@ -499,7 +499,7 @@ We are posting the complete diffs for the reference - /// Specify a custom download URL for the genesis file. - #[clap(long)] - pub download_genesis_url: Option, -- /// Download the verified NEAR config file automtically. +- /// Download the verified NEAR config file automatically. - #[clap(long)] - pub download_config: bool, - /// Specify a custom download URL for the config file. diff --git a/docs/2.build/6.data-infrastructure/lake-framework/running-near-lake/credentials.md b/docs/2.build/6.data-infrastructure/lake-framework/running-near-lake/credentials.md index 9c9e6ce033e..666bcca61d8 100644 --- a/docs/2.build/6.data-infrastructure/lake-framework/running-near-lake/credentials.md +++ b/docs/2.build/6.data-infrastructure/lake-framework/running-near-lake/credentials.md @@ -30,7 +30,7 @@ aws_secret_access_key= [AWS docs: Configuration and credential file settings](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html) -#### Environment varibales +#### Environment variables Alternatively, you can provide your AWS credentials via environment variables with constant names: diff --git a/docs/4.tools/cli-rs.md b/docs/4.tools/cli-rs.md index baa8f452d33..4b5cfd7c842 100644 --- a/docs/4.tools/cli-rs.md +++ b/docs/4.tools/cli-rs.md @@ -66,7 +66,7 @@ You'll get redirected to `wallet.testnet.near.org`. Once there, grant authorizat If you're on Mac you'll have the option to use the [Mac Keychain](https://support.apple.com/guide/keychain-access/what-is-keychain-access-kyca1083/mac) option. -Either storage option is fine. Using the legacy storage option will save a file in your root directory in a hidden folder called `./near-credentials`. This storage option is compatable with the `near-cli` tool (a cli tool without the guided prompts but similar functionality). +Either storage option is fine. Using the legacy storage option will save a file in your root directory in a hidden folder called `./near-credentials`. This storage option is compatible with the `near-cli` tool (a cli tool without the guided prompts but similar functionality). **Good Job!** Now you can use `near-cli-rs` to it's full capacity. @@ -129,7 +129,7 @@ Operate Transactions | Option | Description | | ---------------------- | --------------------------- | | `view-status` | View a transaction status | -| `construct-tansaction` | Construct a new transaction | +| `construct-transaction` | Construct a new transaction | ### Config diff --git a/docs/4.tools/near-api-js/quick-reference.md b/docs/4.tools/near-api-js/quick-reference.md index 333df1e91f8..d8de49d4789 100644 --- a/docs/4.tools/near-api-js/quick-reference.md +++ b/docs/4.tools/near-api-js/quick-reference.md @@ -245,7 +245,7 @@ const provider = new FailoverRpcProvider(jsonProviders); await connect({ networkId: 'mainnet', provider: provider, - // this isn't used if `provider` is specified, but is still required for backward compativility + // this isn't used if `provider` is specified, but is still required for backward compatibility nodeUrl: 'https://rpc.mainnet.near.org', }); ``` diff --git a/docs/5.api/rpc/access-keys.md b/docs/5.api/rpc/access-keys.md index e7c5cc3a4bd..652f421a8fa 100644 --- a/docs/5.api/rpc/access-keys.md +++ b/docs/5.api/rpc/access-keys.md @@ -132,6 +132,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ error.name ERROR_CAUSE
error.cause.name + Status Code Reason Solution @@ -140,6 +141,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ HANDLER_ERROR UNKNOWN_BLOCK + 200 The requested block has not been produced yet or it has been garbage-collected (cleaned up to save space on the RPC node)
    @@ -150,6 +152,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ INVALID_ACCOUNT + 200 The requested account_id is invalid
      @@ -159,6 +162,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ UNKNOWN_ACCOUNT + 200 The requested account_id has not been found while viewing since the account has not been created or has been already deleted
        @@ -169,6 +173,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ UNKNOWN_ACCESS_KEY + 200 The requested public_key has not been found while viewing since the public key has not been created or has been already deleted
          @@ -179,6 +184,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ UNAVAILABLE_SHARD + 200 The node was unable to found the requested data because it does not track the shard where data is present
            @@ -188,6 +194,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ NO_SYNCED_BLOCKS + 200 The node is still syncing and the requested block is not in the database yet
              @@ -199,6 +206,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ REQUEST_VALIDATION_ERROR PARSE_ERROR + 400 Passed arguments can't be parsed by JSON RPC server (missing arguments, wrong format, etc.)
                @@ -210,6 +218,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ INTERNAL_ERROR INTERNAL_ERROR + 500 Something went wrong with the node itself or overloaded
                  @@ -448,6 +457,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ error.name ERROR_CAUSE
                  error.cause.name + Status Code Reason Solution @@ -456,6 +466,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ HANDLER_ERROR UNKNOWN_BLOCK + 200 The requested block has not been produced yet or it has been garbage-collected (cleaned up to save space on the RPC node)
                    @@ -466,6 +477,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ INVALID_ACCOUNT + 200 The requested account_id is invalid
                      @@ -475,6 +487,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ UNKNOWN_ACCOUNT + 200 The requested account_id has not been found while viewing since the account has not been created or has been already deleted
                        @@ -485,6 +498,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ UNAVAILABLE_SHARD + 200 The node was unable to find the requested data because it does not track the shard where data is present
                          @@ -494,6 +508,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ NO_SYNCED_BLOCKS + 200 The node is still syncing and the requested block is not in the database yet
                            @@ -505,6 +520,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ REQUEST_VALIDATION_ERROR PARSE_ERROR + 400 Passed arguments can't be parsed by JSON RPC server (missing arguments, wrong format, etc.)
                              @@ -516,6 +532,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ INTERNAL_ERROR INTERNAL_ERROR + 500 Something went wrong with the node itself or overloaded
                                @@ -669,6 +686,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER error.name ERROR_CAUSE
                                error.cause.name + Status Code Reason Solution @@ -677,6 +695,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER HANDLER_ERROR UNKNOWN_BLOCK + 200 The requested block has not been produced yet or it has been garbage-collected (cleaned up to save space on the RPC node)
                                  @@ -687,6 +706,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER NOT_SYNCED_YET + 200 The node is still syncing and the requested block is not in the database yet
                                    @@ -698,6 +718,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER REQUEST_VALIDATION_ERROR PARSE_ERROR + 400 Passed arguments can't be parsed by JSON RPC server (missing arguments, wrong format, etc.)
                                      @@ -709,6 +730,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER INTERNAL_ERROR INTERNAL_ERROR + 500 Something went wrong with the node itself or overloaded
                                        @@ -862,6 +884,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER error.name ERROR_CAUSE
                                        error.cause.name + Status Code Reason Solution @@ -870,6 +893,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER HANDLER_ERROR UNKNOWN_BLOCK + 200 The requested block has not been produced yet or it has been garbage-collected (cleaned up to save space on the RPC node)
                                          @@ -880,6 +904,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER NOT_SYNCED_YET + 200 The node is still syncing and the requested block is not in the database yet
                                            @@ -891,6 +916,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER REQUEST_VALIDATION_ERROR PARSE_ERROR + 400 Passed arguments can't be parsed by JSON RPC server (missing arguments, wrong format, etc.)
                                              @@ -902,6 +928,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER INTERNAL_ERROR INTERNAL_ERROR + 500 Something went wrong with the node itself or overloaded
                                                diff --git a/docs/5.api/rpc/block-chunk.md b/docs/5.api/rpc/block-chunk.md index 77abf5e5ad2..217b6d03cd0 100644 --- a/docs/5.api/rpc/block-chunk.md +++ b/docs/5.api/rpc/block-chunk.md @@ -283,6 +283,7 @@ Here is the exhaustive list of the error variants that can be returned by `block error.name ERROR_CAUSE
                                                error.cause.name + Status Code Reason Solution @@ -291,6 +292,7 @@ Here is the exhaustive list of the error variants that can be returned by `block HANDLER_ERROR UNKNOWN_BLOCK + 200 The requested block has not been produced yet or it has been garbage-collected (cleaned up to save space on the RPC node)
                                                  @@ -301,6 +303,7 @@ Here is the exhaustive list of the error variants that can be returned by `block NOT_SYNCED_YET + 200 The node is still syncing and the requested block is not in the database yet
                                                    @@ -312,6 +315,7 @@ Here is the exhaustive list of the error variants that can be returned by `block REQUEST_VALIDATION_ERROR PARSE_ERROR + 400 Passed arguments can't be parsed by JSON RPC server (missing arguments, wrong format, etc.)
                                                      @@ -323,6 +327,7 @@ Here is the exhaustive list of the error variants that can be returned by `block INTERNAL_ERROR INTERNAL_ERROR + 500 Something went wrong with the node itself or overloaded
                                                        @@ -532,6 +537,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER error.name ERROR_CAUSE
                                                        error.cause.name + Status Code Reason Solution @@ -540,6 +546,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER HANDLER_ERROR UNKNOWN_BLOCK + 200 The requested block has not been produced yet or it has been garbage-collected (cleaned up to save space on the RPC node)
                                                          @@ -550,6 +557,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER NOT_SYNCED_YET + 200 The node is still syncing and the requested block is not in the database yet
                                                            @@ -561,6 +569,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER REQUEST_VALIDATION_ERROR PARSE_ERROR + 400 Passed arguments can't be parsed by JSON RPC server (missing arguments, wrong format, etc.)
                                                              @@ -572,6 +581,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER INTERNAL_ERROR INTERNAL_ERROR + 500 Something went wrong with the node itself or overloaded
                                                                @@ -737,6 +747,7 @@ Here is the exhaustive list of the error variants that can be returned by `chunk error.name ERROR_CAUSE
                                                                error.cause.name + Status Code Reason Solution @@ -745,6 +756,7 @@ Here is the exhaustive list of the error variants that can be returned by `chunk HANDLER_ERROR UNKNOWN_BLOCK + 200 The requested block has not been produced yet or it has been garbage-collected (cleaned up to save space on the RPC node)
                                                                  @@ -755,6 +767,7 @@ Here is the exhaustive list of the error variants that can be returned by `chunk UNKNOWN_CHUNK + 200 The requested chunk can't be found in a database
                                                                    @@ -765,6 +778,7 @@ Here is the exhaustive list of the error variants that can be returned by `chunk INVALID_SHARD_ID + 200 Provided shard_id does not exist
                                                                      @@ -774,6 +788,7 @@ Here is the exhaustive list of the error variants that can be returned by `chunk NOT_SYNCED_YET + 200 The node is still syncing and the requested chunk is not in the database yet
                                                                        @@ -785,6 +800,7 @@ Here is the exhaustive list of the error variants that can be returned by `chunk REQUEST_VALIDATION_ERROR PARSE_ERROR + 400 Passed arguments can't be parsed by JSON RPC server (missing arguments, wrong format, etc.)
                                                                          @@ -796,6 +812,7 @@ Here is the exhaustive list of the error variants that can be returned by `chunk INTERNAL_ERROR INTERNAL_ERROR + 500 Something went wrong with the node itself or overloaded
                                                                            diff --git a/docs/5.api/rpc/contracts.md b/docs/5.api/rpc/contracts.md index a240ffb0dd9..689f2c4a30e 100644 --- a/docs/5.api/rpc/contracts.md +++ b/docs/5.api/rpc/contracts.md @@ -123,6 +123,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ error.name ERROR_CAUSE
                                                                            error.cause.name + Status Code Reason Solution @@ -131,6 +132,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ HANDLER_ERROR UNKNOWN_BLOCK + 200 The requested block has not been produced yet or it has been garbage-collected (cleaned up to save space on the RPC node)
                                                                              @@ -141,6 +143,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ INVALID_ACCOUNT + 200 The requested account_id is invalid
                                                                                @@ -150,6 +153,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ UNKNOWN_ACCOUNT + 200 The requested account_id has not been found while viewing since the account has not been created or has been already deleted
                                                                                  @@ -160,6 +164,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ UNAVAILABLE_SHARD + 200 The node was unable to find the requested data because it does not track the shard where data is present
                                                                                    @@ -169,6 +174,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ NO_SYNCED_BLOCKS + 200 The node is still syncing and the requested block is not in the database yet
                                                                                      @@ -180,6 +186,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ REQUEST_VALIDATION_ERROR PARSE_ERROR + 400 Passed arguments can't be parsed by JSON RPC server (missing arguments, wrong format, etc.)
                                                                                        @@ -191,6 +198,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ INTERNAL_ERROR INTERNAL_ERROR + 500 Something went wrong with the node itself or overloaded
                                                                                          @@ -344,6 +352,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER error.name ERROR_CAUSE
                                                                                          error.cause.name + Status Code Reason Solution @@ -352,6 +361,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER HANDLER_ERROR UNKNOWN_BLOCK + 200 The requested block has not been produced yet or it has been garbage-collected (cleaned up to save space on the RPC node)
                                                                                            @@ -362,6 +372,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER NOT_SYNCED_YET + 200 The node is still syncing and the requested block is not in the database yet
                                                                                              @@ -373,6 +384,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER REQUEST_VALIDATION_ERROR PARSE_ERROR + 400 Passed arguments can't be parsed by JSON RPC server (missing arguments, wrong format, etc.)
                                                                                                @@ -384,6 +396,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER INTERNAL_ERROR INTERNAL_ERROR + 500 Something went wrong with the node itself or overloaded
                                                                                                  @@ -508,6 +521,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ error.name ERROR_CAUSE
                                                                                                  error.cause.name + Status Code Reason Solution @@ -516,6 +530,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ HANDLER_ERROR UNKNOWN_BLOCK + 200 The requested block has not been produced yet or it has been garbage-collected (cleaned up to save space on the RPC node)
                                                                                                    @@ -526,6 +541,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ INVALID_ACCOUNT + 200 The requested account_id is invalid
                                                                                                      @@ -535,6 +551,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ UNKNOWN_ACCOUNT + 200 The requested account_id has not been found while viewing since the account has not been created or has been already deleted
                                                                                                        @@ -545,6 +562,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ NO_CONTRACT_CODE + 200 The account does not have any contract deployed on it
                                                                                                          @@ -555,6 +573,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ UNAVAILABLE_SHARD + 200 The node was unable to find the requested data because it does not track the shard where data is present
                                                                                                            @@ -564,6 +583,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ NO_SYNCED_BLOCKS + 200 The node is still syncing and the requested block is not in the database yet
                                                                                                              @@ -575,6 +595,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ REQUEST_VALIDATION_ERROR PARSE_ERROR + 400 Passed arguments can't be parsed by JSON RPC server (missing arguments, wrong format, etc.)
                                                                                                                @@ -586,6 +607,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ INTERNAL_ERROR INTERNAL_ERROR + 500 Something went wrong with the node itself or overloaded
                                                                                                                  @@ -900,6 +922,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ error.name ERROR_CAUSE
                                                                                                                  error.cause.name + Status Code Reason Solution @@ -908,6 +931,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ HANDLER_ERROR UNKNOWN_BLOCK + 200 The requested block has not been produced yet or it has been garbage-collected (cleaned up to save space on the RPC node)
                                                                                                                    @@ -918,6 +942,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ INVALID_ACCOUNT + 200 The requested account_id is invalid
                                                                                                                      @@ -927,6 +952,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ UNKNOWN_ACCOUNT + 200 The requested account_id has not been found while viewing since the account has not been created or has been already deleted
                                                                                                                        @@ -937,6 +963,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ NO_CONTRACT_CODE + 200 The account does not have any contract deployed on it
                                                                                                                          @@ -947,6 +974,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ TOO_LARGE_CONTRACT_STATE + 200 The requested contract state is too large to be returned from this node (the default limit is 50kb of state size)
                                                                                                                            @@ -957,6 +985,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ UNAVAILABLE_SHARD + 200 The node was unable to find the requested data because it does not track the shard where data is present
                                                                                                                              @@ -966,6 +995,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ NO_SYNCED_BLOCKS + 200 The node is still syncing and the requested block is not in the database yet
                                                                                                                                @@ -977,6 +1007,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ REQUEST_VALIDATION_ERROR PARSE_ERROR + 400 Passed arguments can't be parsed by JSON RPC server (missing arguments, wrong format, etc.)
                                                                                                                                  @@ -988,6 +1019,7 @@ Here is the exhaustive list of the error variants that can be returned by `view_ INTERNAL_ERROR INTERNAL_ERROR + 500 Something went wrong with the node itself or overloaded
                                                                                                                                    @@ -1139,6 +1171,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER error.name ERROR_CAUSE
                                                                                                                                    error.cause.name + Status Code Reason Solution @@ -1147,6 +1180,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER HANDLER_ERROR UNKNOWN_BLOCK + 200 The requested block has not been produced yet or it has been garbage-collected (cleaned up to save space on the RPC node)
                                                                                                                                      @@ -1157,6 +1191,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER NOT_SYNCED_YET + 200 The node is still syncing and the requested block is not in the database yet
                                                                                                                                        @@ -1168,6 +1203,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER REQUEST_VALIDATION_ERROR PARSE_ERROR + 400 Passed arguments can't be parsed by JSON RPC server (missing arguments, wrong format, etc.)
                                                                                                                                          @@ -1179,6 +1215,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER INTERNAL_ERROR INTERNAL_ERROR + 500 Something went wrong with the node itself or overloaded
                                                                                                                                            @@ -1313,6 +1350,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER error.name ERROR_CAUSE
                                                                                                                                            error.cause.name + Status Code Reason Solution @@ -1321,6 +1359,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER HANDLER_ERROR UNKNOWN_BLOCK + 200 The requested block has not been produced yet or it has been garbage-collected (cleaned up to save space on the RPC node)
                                                                                                                                              @@ -1331,6 +1370,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER NOT_SYNCED_YET + 200 The node is still syncing and the requested block is not in the database yet
                                                                                                                                                @@ -1342,6 +1382,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER REQUEST_VALIDATION_ERROR PARSE_ERROR + 400 Passed arguments can't be parsed by JSON RPC server (missing arguments, wrong format, etc.)
                                                                                                                                                  @@ -1353,6 +1394,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER INTERNAL_ERROR INTERNAL_ERROR + 500 Something went wrong with the node itself or overloaded
                                                                                                                                                    @@ -1538,6 +1580,7 @@ Here is the exhaustive list of the error variants that can be returned by `call_ error.name ERROR_CAUSE
                                                                                                                                                    error.cause.name + Status Code Reason Solution @@ -1546,6 +1589,7 @@ Here is the exhaustive list of the error variants that can be returned by `call_ HANDLER_ERROR UNKNOWN_BLOCK + 200 The requested block has not been produced yet or it has been garbage-collected (cleaned up to save space on the RPC node)
                                                                                                                                                      @@ -1556,6 +1600,7 @@ Here is the exhaustive list of the error variants that can be returned by `call_ INVALID_ACCOUNT + 200 The requested account_id is invalid
                                                                                                                                                        @@ -1565,6 +1610,7 @@ Here is the exhaustive list of the error variants that can be returned by `call_ UNKNOWN_ACCOUNT + 200 The requested account_id has not been found while viewing since the account has not been created or has been already deleted
                                                                                                                                                          @@ -1575,6 +1621,7 @@ Here is the exhaustive list of the error variants that can be returned by `call_ NO_CONTRACT_CODE + 200 The requested contract_code has not been found while viewing
                                                                                                                                                            @@ -1585,6 +1632,7 @@ Here is the exhaustive list of the error variants that can be returned by `call_ CONTRACT_EXECUTION_ERROR + 200 The execution of the view function call failed (crashed, run out of the default 200 TGas limit, etc)
                                                                                                                                                              @@ -1594,6 +1642,7 @@ Here is the exhaustive list of the error variants that can be returned by `call_ UNAVAILABLE_SHARD + 200 The node was unable to find the requested data because it does not track the shard where data is present
                                                                                                                                                                @@ -1603,6 +1652,7 @@ Here is the exhaustive list of the error variants that can be returned by `call_ NO_SYNCED_BLOCKS + 200 The node is still syncing and the requested block is not in the database yet
                                                                                                                                                                  @@ -1614,6 +1664,7 @@ Here is the exhaustive list of the error variants that can be returned by `call_ REQUEST_VALIDATION_ERROR PARSE_ERROR + 400 Passed arguments can't be parsed by JSON RPC server (missing arguments, wrong format, etc.)
                                                                                                                                                                    @@ -1625,6 +1676,7 @@ Here is the exhaustive list of the error variants that can be returned by `call_ INTERNAL_ERROR INTERNAL_ERROR + 500 Something went wrong with the node itself or overloaded
                                                                                                                                                                      diff --git a/docs/5.api/rpc/gas.md b/docs/5.api/rpc/gas.md index 604e8a2f282..7a887152386 100644 --- a/docs/5.api/rpc/gas.md +++ b/docs/5.api/rpc/gas.md @@ -167,6 +167,7 @@ Here is the exhaustive list of the error variants that can be returned by `gas_p error.name ERROR_CAUSE
                                                                                                                                                                      error.cause.name + Status Code Reason Solution @@ -175,6 +176,7 @@ Here is the exhaustive list of the error variants that can be returned by `gas_p HANDLER_ERROR UNKNOWN_BLOCK + 200 The requested block has not been produced yet or it has been garbage-collected (cleaned up to save space on the RPC node)
                                                                                                                                                                        @@ -186,6 +188,7 @@ Here is the exhaustive list of the error variants that can be returned by `gas_p REQUEST_VALIDATION_ERROR PARSE_ERROR + 400 Passed arguments can't be parsed by JSON RPC server (missing arguments, wrong format, etc.)
                                                                                                                                                                          @@ -197,6 +200,7 @@ Here is the exhaustive list of the error variants that can be returned by `gas_p INTERNAL_ERROR INTERNAL_ERROR + 500 Something went wrong with the node itself or overloaded
                                                                                                                                                                            diff --git a/docs/5.api/rpc/maintenance-windows.md b/docs/5.api/rpc/maintenance-windows.md index ba1af597404..1664151f7a7 100644 --- a/docs/5.api/rpc/maintenance-windows.md +++ b/docs/5.api/rpc/maintenance-windows.md @@ -109,6 +109,7 @@ Here is the exhaustive list of the error variants that can be returned by `maint error.name ERROR_CAUSE
                                                                                                                                                                            error.cause.name + Status Code Reason Solution @@ -117,6 +118,7 @@ Here is the exhaustive list of the error variants that can be returned by `maint INTERNAL_ERROR INTERNAL_ERROR + 500 Something went wrong with the node itself or overloaded
                                                                                                                                                                              diff --git a/docs/5.api/rpc/network.md b/docs/5.api/rpc/network.md index c3f4060afb0..48ea415472f 100644 --- a/docs/5.api/rpc/network.md +++ b/docs/5.api/rpc/network.md @@ -282,6 +282,7 @@ Here is the exhaustive list of the error variants that can be returned by `statu error.name ERROR_CAUSE
                                                                                                                                                                              error.cause.name + Status Code Reason Solution @@ -290,6 +291,7 @@ Here is the exhaustive list of the error variants that can be returned by `statu INTERNAL_ERROR INTERNAL_ERROR + 500 Something went wrong with the node itself or overloaded
                                                                                                                                                                                @@ -405,6 +407,7 @@ Here is the exhaustive list of the error variants that can be returned by `netwo error.name ERROR_CAUSE
                                                                                                                                                                                error.cause.name + Status Code Reason Solution @@ -413,6 +416,7 @@ Here is the exhaustive list of the error variants that can be returned by `netwo INTERNAL_ERROR INTERNAL_ERROR + 500 Something went wrong with the node itself or overloaded
                                                                                                                                                                                  @@ -1356,6 +1360,7 @@ Here is the exhaustive list of the error variants that can be returned by `valid error.name ERROR_CAUSE
                                                                                                                                                                                  error.cause.name + Status Code Reason Solution @@ -1364,6 +1369,7 @@ Here is the exhaustive list of the error variants that can be returned by `valid HANDLER_ERROR UNKNOWN_EPOCH + 200 An epoch for the provided block can't be found in a database
                                                                                                                                                                                    @@ -1376,6 +1382,7 @@ Here is the exhaustive list of the error variants that can be returned by `valid REQUEST_VALIDATION_ERROR PARSE_ERROR + 400 Passed arguments can't be parsed by JSON RPC server (missing arguments, wrong format, etc.)
                                                                                                                                                                                      @@ -1387,6 +1394,7 @@ Here is the exhaustive list of the error variants that can be returned by `valid INTERNAL_ERROR INTERNAL_ERROR + 500 Something went wrong with the node itself or overloaded
                                                                                                                                                                                        diff --git a/docs/5.api/rpc/protocol.md b/docs/5.api/rpc/protocol.md index e12188276a0..24d883d9377 100644 --- a/docs/5.api/rpc/protocol.md +++ b/docs/5.api/rpc/protocol.md @@ -323,6 +323,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER error.name ERROR_CAUSE
                                                                                                                                                                                        error.cause.name + Status Code Reason Solution @@ -331,6 +332,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER INTERNAL_ERROR INTERNAL_ERROR + 500 Something went wrong with the node itself or overloaded
                                                                                                                                                                                          @@ -633,6 +635,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER error.name ERROR_CAUSE
                                                                                                                                                                                          error.cause.name + Status Code Reason Solution @@ -641,6 +644,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER HANDLER_ERROR UNKNOWN_BLOCK + 200 The requested block has not been produced yet or it has been garbage-collected (cleaned up to save space on the RPC node)
                                                                                                                                                                                            @@ -652,6 +656,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER INTERNAL_ERROR INTERNAL_ERROR + 500 Something went wrong with the node itself or overloaded
                                                                                                                                                                                              diff --git a/docs/5.api/rpc/providers.md b/docs/5.api/rpc/providers.md index da371d7af3e..adebcf997fb 100644 --- a/docs/5.api/rpc/providers.md +++ b/docs/5.api/rpc/providers.md @@ -25,7 +25,7 @@ If you want to use a custom RPC provider with NEAR Wallet Selector, [check this | [BlockPi](https://chains.blockpi.io/#/near) | `https://public-rpc.blockpi.io/http/near` | | [dRPC](https://drpc.org/) | `https://near.drpc.org` | | [fast-near web4](https://github.com/vgrichina/fast-near) | `https://rpc.web4.near.page` | -| [FASTNEAR Free](https://twitter.com/fast_near/status/1779578631318368269) | `https://free.rpc.fastnear.com` | +| [FASTNEAR](https://fastnear.com) | `https://free.rpc.fastnear.com` | | [Gateway.fm](https://gateway.fm/) | `https://rpc.near.gateway.fm/` | | [GetBlock](https://getblock.io/nodes/near/) | `https://getblock.io/nodes/near/` | | [Lava Network](https://www.lavanet.xyz/get-started/near) | `https://near.lava.build` | @@ -43,6 +43,7 @@ If you want to use a custom RPC provider with NEAR Wallet Selector, [check this | -------------------------------------------------------------------------- | ------------------------------------------------------------ | | [NEAR](setup.md) | `https://rpc.testnet.near.org` | | [Pagoda](https://www.pagoda.co/console) | `https://rpc.testnet.pagoda.co` | +| [FASTNEAR](https://fastnear.com) | `https://test.rpc.fastnear.com` | ## RPC Failover diff --git a/docs/5.api/rpc/transactions.md b/docs/5.api/rpc/transactions.md index 65fe3f16e9b..8bd08b2e0ef 100644 --- a/docs/5.api/rpc/transactions.md +++ b/docs/5.api/rpc/transactions.md @@ -180,6 +180,7 @@ Here is the exhaustive list of the error variants that can be returned by `broad error.name ERROR_CAUSE
                                                                                                                                                                                              error.cause.name + Status Code Reason Solution @@ -188,6 +189,7 @@ Here is the exhaustive list of the error variants that can be returned by `broad HANDLER_ERROR INVALID_TRANSACTION + 200 An error happened during transaction execution
                                                                                                                                                                                                @@ -199,6 +201,7 @@ Here is the exhaustive list of the error variants that can be returned by `broad TIMEOUT_ERROR + 408 Transaction was routed, but has not been recorded on chain in 10 seconds.
                                                                                                                                                                                                  @@ -211,6 +214,7 @@ Here is the exhaustive list of the error variants that can be returned by `broad REQUEST_VALIDATION_ERROR PARSE_ERROR + 400 Passed arguments can't be parsed by JSON RPC server (missing arguments, wrong format, etc.)
                                                                                                                                                                                                    @@ -222,6 +226,7 @@ Here is the exhaustive list of the error variants that can be returned by `broad INTERNAL_ERROR INTERNAL_ERROR + 500 Something went wrong with the node itself or overloaded
                                                                                                                                                                                                      @@ -416,6 +421,7 @@ Here is the exhaustive list of the error variants that can be returned by `tx` m error.name ERROR_CAUSE
                                                                                                                                                                                                      error.cause.name + Status Code Reason Solution @@ -424,6 +430,7 @@ Here is the exhaustive list of the error variants that can be returned by `tx` m HANDLER_ERROR INVALID_TRANSACTION + 200 An error happened during transaction execution
                                                                                                                                                                                                        @@ -433,6 +440,7 @@ Here is the exhaustive list of the error variants that can be returned by `tx` m UNKNOWN_TRANSACTION + 200 The requested transaction is not available on the node since it might have not been recorded on the chain yet or has been garbage-collected
                                                                                                                                                                                                          @@ -444,6 +452,7 @@ Here is the exhaustive list of the error variants that can be returned by `tx` m TIMEOUT_ERROR + 408 It was unable to wait for the transaction status for reasonable time
                                                                                                                                                                                                            @@ -455,6 +464,7 @@ Here is the exhaustive list of the error variants that can be returned by `tx` m REQUEST_VALIDATION_ERROR PARSE_ERROR + 400 Passed arguments can't be parsed by JSON RPC server (missing arguments, wrong format, etc.)
                                                                                                                                                                                                              @@ -466,6 +476,7 @@ Here is the exhaustive list of the error variants that can be returned by `tx` m INTERNAL_ERROR INTERNAL_ERROR + 500 Something went wrong with the node itself or overloaded
                                                                                                                                                                                                                @@ -794,6 +805,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER error.name ERROR_CAUSE
                                                                                                                                                                                                                error.cause.name + Status Code Reason Solution @@ -802,6 +814,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER HANDLER_ERROR INVALID_TRANSACTION + 200 An error happened during transaction execution
                                                                                                                                                                                                                  @@ -811,6 +824,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER UNKNOWN_TRANSACTION + 200 The requested transaction is not available on the node since it might have not been recorded on the chain yet or has been garbage-collected
                                                                                                                                                                                                                    @@ -822,6 +836,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER TIMEOUT_ERROR + 408 It was unable to wait for the transaction status for reasonable time
                                                                                                                                                                                                                      @@ -833,6 +848,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER REQUEST_VALIDATION_ERROR PARSE_ERROR + 400 Passed arguments can't be parsed by JSON RPC server (missing arguments, wrong format, etc.)
                                                                                                                                                                                                                        @@ -844,6 +860,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER INTERNAL_ERROR INTERNAL_ERROR + 500 Something went wrong with the node itself or overloaded
                                                                                                                                                                                                                          @@ -961,6 +978,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER error.name ERROR_CAUSE
                                                                                                                                                                                                                          error.cause.name + Status Code Reason Solution @@ -969,6 +987,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER HANDLER_ERROR UNKNOWN_RECEIPT + 200 The receipt with the given receipt_id was never observed on the node
                                                                                                                                                                                                                            @@ -980,6 +999,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER REQUEST_VALIDATION_ERROR PARSE_ERROR + 400 Passed arguments can't be parsed by JSON RPC server (missing arguments, wrong format, etc.)
                                                                                                                                                                                                                              @@ -991,6 +1011,7 @@ Here is the exhaustive list of the error variants that can be returned by `EXPER INTERNAL_ERROR INTERNAL_ERROR + 500 Something went wrong with the node itself or overloaded
                                                                                                                                                                                                                                @@ -1126,6 +1147,7 @@ Here is the exhaustive list of the error variants that can be returned by `broad error.name ERROR_CAUSE
                                                                                                                                                                                                                                error.cause.name + Status Code Reason Solution @@ -1134,6 +1156,7 @@ Here is the exhaustive list of the error variants that can be returned by `broad REQUEST_VALIDATION_ERROR PARSE_ERROR + 400 Passed arguments can't be parsed by JSON RPC server (missing arguments, wrong format, etc.)
                                                                                                                                                                                                                                  @@ -1303,6 +1326,7 @@ Here is the exhaustive list of the error variants that can be returned by `broad error.name ERROR_CAUSE
                                                                                                                                                                                                                                  error.cause.name + Status Code Reason Solution @@ -1311,6 +1335,7 @@ Here is the exhaustive list of the error variants that can be returned by `broad HANDLER_ERROR INVALID_TRANSACTION + 200 An error happened during transaction execution
                                                                                                                                                                                                                                    @@ -1322,6 +1347,7 @@ Here is the exhaustive list of the error variants that can be returned by `broad TIMEOUT_ERROR + 408 Transaction was routed, but has not been recorded on chain in 10 seconds.
                                                                                                                                                                                                                                      @@ -1334,6 +1360,7 @@ Here is the exhaustive list of the error variants that can be returned by `broad REQUEST_VALIDATION_ERROR PARSE_ERROR + 400 Passed arguments can't be parsed by JSON RPC server (missing arguments, wrong format, etc.)
                                                                                                                                                                                                                                        @@ -1345,6 +1372,7 @@ Here is the exhaustive list of the error variants that can be returned by `broad INTERNAL_ERROR INTERNAL_ERROR + 500 Something went wrong with the node itself or overloaded
                                                                                                                                                                                                                                          diff --git a/docs/6.integrations/errors/error-implementation.md b/docs/6.integrations/errors/error-implementation.md index 7e511c6abe4..803bd37c68f 100644 --- a/docs/6.integrations/errors/error-implementation.md +++ b/docs/6.integrations/errors/error-implementation.md @@ -441,6 +441,13 @@ pub enum ReceiptValidationError { NumberInputDataDependenciesExceeded { number_of_input_data_dependencies: u64, limit: u64 }, /// An error occurred while validating actions of an ActionReceipt. ActionsValidation(ActionsValidationError), + /// Receipt is bigger than the limit. + /// ReceiptSizeExceeded means that there was a receipt above the size limit (currently 4MiB). + /// NEAR will refuse to execute receipts that are above the size limit. + /// The most likely source of such receipts would be cross-contract calls with a lot of large actions + /// (contract deployment, function call with large args, etc). + /// This error means that the user has to adjust their contract to generate smaller receipts. + ReceiptSizeExceeded { size: u64, limit: u64 }, } ``` @@ -466,6 +473,9 @@ ReceiptValidationError::NumberInputDataDependenciesExceeded { number_of_input_da "The number of input data dependencies {} exceeded the limit {} in an ActionReceipt" ReceiptValidationError::ActionsValidation(e) + +ReceiptValidationError::ReceiptSizeExceeded { size, limit } +"The size of the receipt exceeded the limit: {} > {}", ``` diff --git a/docs/pagoda/alerts/setup.md b/docs/pagoda/alerts/setup.md index 4219694557c..83ed926be7d 100644 --- a/docs/pagoda/alerts/setup.md +++ b/docs/pagoda/alerts/setup.md @@ -42,7 +42,7 @@ Follow the steps above to begin setting-up telegram alerts. When selecting the d ### Private Message Alerts -1. On the device that is logged into the telegram aclick "Open Telegram" or scan the QR code. +1. On the device that is logged into the telegram click "Open Telegram" or scan the QR code. diff --git a/docs/pagoda/alerts/webhooks.md b/docs/pagoda/alerts/webhooks.md index 7a7d9f47425..61c82ebc2dc 100644 --- a/docs/pagoda/alerts/webhooks.md +++ b/docs/pagoda/alerts/webhooks.md @@ -140,7 +140,7 @@ copy that entire line and head on over to console.pagoda.co ## Step 5: Integrating Webhook into Pagoda Console -Once at console.pagoda.co, you should be greeted by the log-in page. Select the Non-funcable Token (NFT) project to start exploring the NFT contract +Once at console.pagoda.co, you should be greeted by the log-in page. Select the Non-fungible Token (NFT) project to start exploring the NFT contract @@ -181,12 +181,12 @@ But for now, we'll keep it easy and select any Successful Action. We're almost done! Under destination select webhooks. Now that webhook we created earlier go ahead and copy and paste it into here. Then hit "Create" :::tip -Don't forget to remove the `{}` around the name of your event! `ifttt.com/trigger/...`, not `ifftt.com/{trigger}/...` +Don't forget to remove the `{}` around the name of your event! `ifttt.com/trigger/...`, not `ifttt.com/{trigger}/...` ::: -Remember to hit the "+ Create Alert" button on this page... +Remember to hit the "+ Create Alert" button on this page... @@ -210,6 +210,6 @@ Select the `new_default_metadata` function (we are choosing this one because we And that's it! You've just triggered something in the real world with an event that happened on the NEAR Blockchain. Hopefully this inspires you to create your own webhook using IFTTT and the Pagoda Console. -We'd love to see what you create! Tag [@PagodaPlatform](https://twitter.com/PagodaPlatform) on Twitter with a novel implementation of a webhhook and trigger and we might retweet it. +We'd love to see what you create! Tag [@PagodaPlatform](https://twitter.com/PagodaPlatform) on Twitter with a novel implementation of a webhook and trigger and we might retweet it. Happy hacking! diff --git a/docs/pagoda/rpc/intro.md b/docs/pagoda/rpc/intro.md index 1e252efddab..6fc91453125 100644 --- a/docs/pagoda/rpc/intro.md +++ b/docs/pagoda/rpc/intro.md @@ -19,7 +19,7 @@ The Pagoda RPC provides you with instant access to maintenance free, scalable NE Developers can interact with on-chain data and send different types of transactions to the network by utilizing the RPC endpoints. -In addition to the powerful node infrastructure, we also created the Pagoda RPC Stats page so that you can have visibility into your RPC usage and performances and take control of your project from the infrastructure level. What’s more? You can subscribe to the alerts from our Status page so that you can follow the health of Pagoda RPC real time. All accesible via [Pagoda Console](https://console.pagoda.co/). +In addition to the powerful node infrastructure, we also created the Pagoda RPC Stats page so that you can have visibility into your RPC usage and performances and take control of your project from the infrastructure level. What’s more? You can subscribe to the alerts from our Status page so that you can follow the health of Pagoda RPC real time. All accessible via [Pagoda Console](https://console.pagoda.co/). ## Setup diff --git a/docs/pagoda/rpc/setup.md b/docs/pagoda/rpc/setup.md index 493500a7b61..486a5577247 100644 --- a/docs/pagoda/rpc/setup.md +++ b/docs/pagoda/rpc/setup.md @@ -37,7 +37,7 @@ With a dedicated API key, developers are able to: - Access higher request throughput and increased concurrent requests - Query data from [Enhanced APIs](api.md), gaining access to free processed data for NFT, FT and NEAR balances, ownership, and metadata -- Utlize dedicated, individualized usage metrics +- Utilize dedicated, individualized usage metrics ### Test your API keys diff --git a/docs/pagoda/rpc/stats.md b/docs/pagoda/rpc/stats.md index 1f80b174c3a..e780bd9693a 100644 --- a/docs/pagoda/rpc/stats.md +++ b/docs/pagoda/rpc/stats.md @@ -28,7 +28,7 @@ Aggregated key metrics available at the top of the dashboard are ## Set a Time Period -Data is sent with UTC time to the browser and the browser adjusts to the user’s timezon. +Data is sent with UTC time to the browser and the browser adjusts to the user’s timezone. - Last 15 Minutes is the last complete 15 minutes. This updates every few seconds. - Last 1 Hour is the last fully completed hour; from 00 to 59 minutes and 59 seconds. diff --git a/website/sidebars.js b/website/sidebars.js index aa8534fe7d8..d5a1764267d 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -88,15 +88,27 @@ const sidebar = { ] }, { - "Chain Signatures": [ + "type": "category", + "label": "Chain Signatures", + "link": { + "type": "doc", + "id": "build/chain-abstraction/chain-signatures/getting-started" + }, + "items": [ "concepts/abstraction/chain-signatures", - 'build/chain-abstraction/chain-signatures', - 'build/chain-abstraction/nft-chain-keys', + 'build/chain-abstraction/chain-signatures/chain-signatures', + // 'build/chain-abstraction/nft-chain-keys', ] }, // 'build/chain-abstraction/wallet', { - "Multichain Gas Relayer": [ + "type": "category", + "label": "Multichain Gas Relayer", + "link": { + "type": "doc", + "id": "build/chain-abstraction/multichain-gas-relayer/getting-started" + }, + "items": [ "build/chain-abstraction/multichain-gas-relayer/overview", "build/chain-abstraction/multichain-gas-relayer/gas-station", "build/chain-abstraction/multichain-gas-relayer/multichain-server", diff --git a/website/src/theme/Navbar/Logo/index.js b/website/src/theme/Navbar/Logo/index.js index 0ab73ab1715..d85776fb19c 100644 --- a/website/src/theme/Navbar/Logo/index.js +++ b/website/src/theme/Navbar/Logo/index.js @@ -1,13 +1,11 @@ import React from 'react'; import Logo from '@theme/Logo'; -import BrowserOnly from '@docusaurus/BrowserOnly'; +import useIsBrowser from '@docusaurus/useIsBrowser'; export default function NavbarLogo() { - + const isBrowser = useIsBrowser(); // if embedded in an iframe, do not show the logo - - {() => { if (window.location !== window.parent.location) return null; }} - + if (isBrowser && typeof window !== 'undefined' && window.self !== window.top) return null; return (