Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions cleanup_unused_images.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/usr/bin/env python3

import os
import shutil
from pathlib import Path

unused_images = [
"assets/data-infra/Architecture.png",
"assets/data-infra/BQ_Query_Cost.png",
"assets/home/near.png",
"assets/lantstool/lantstool-logo-circle.svg",
"assets/welcome-pages/10.templates.png",
"assets/welcome-pages/7.discover.png",
"assets/welcome-pages/8.near-core.png",
"assets/welcome-pages/awesomenear.jpg",
"assets/welcome-pages/blocks.png",
"assets/welcome-pages/chain-abstraction-landing.png",
"assets/welcome-pages/contracts-landing.png",
"assets/welcome-pages/contracts.png",
"assets/welcome-pages/cross-call.png",
"assets/welcome-pages/crossword.png",
"assets/welcome-pages/data-lake-landing.png",
"assets/welcome-pages/donation.png",
"assets/welcome-pages/examples-landing.png",
"assets/welcome-pages/examples.png",
"assets/welcome-pages/experiment.png",
"assets/welcome-pages/factory.png",
"assets/welcome-pages/frontend-bos.png",
"assets/welcome-pages/ft.png",
"assets/welcome-pages/guest-book.png",
"assets/welcome-pages/mintbase-templates.png",
"assets/welcome-pages/monitor.png",
"assets/welcome-pages/multiple.png",
"assets/welcome-pages/near-cli.png",
"assets/welcome-pages/near-zero-to-hero.png",
"assets/welcome-pages/nft-marketplace-js.png",
"assets/welcome-pages/nft-marketplace-rs.png",
"assets/welcome-pages/nomicon.png",
"assets/welcome-pages/primitives-landing.png",
"assets/welcome-pages/primitives.png",
"assets/welcome-pages/protocol.png",
"assets/welcome-pages/quickstart.png",
"assets/welcome-pages/random.png",
"assets/welcome-pages/relayer-overview.png",
"assets/welcome-pages/smartcontract-js.png",
"assets/welcome-pages/smartcontract-rust.png",
"assets/welcome-pages/smartcontract.png",
"assets/welcome-pages/transaction.png",
"assets/welcome-pages/tutorials.png",
"assets/welcome-pages/update.png",
"assets/welcome-pages/validate.png"
]

def backup_and_remove_images():
# Create backup directory
backup_dir = Path("website/static/docs/assets/backup")
backup_dir.mkdir(parents=True, exist_ok=True)

base_dir = Path("website/static/docs")
for image_path in unused_images:
full_path = base_dir / image_path
if full_path.exists():
# Create backup with folder structure
backup_path = backup_dir / image_path
backup_path.parent.mkdir(parents=True, exist_ok=True)

# Move file to backup
shutil.move(str(full_path), str(backup_path))
print(f"moved {image_path} to backup")

if __name__ == "__main__":
backup_and_remove_images()
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: "Learn how to get started with Chain Signatures on NEAR, a groundbr

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)
![img](/docs/assets/chain-abstraction/account-abstraction-diagram.png)

This innovation leverages Multi-Party Computation (MPC) and a distributed network of node operators to create joint signatures from arbitrary payloads, allowing NEAR accounts to control external blockchain accounts.

Expand Down
2 changes: 1 addition & 1 deletion docs/data-infrastructure/big-query.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ ORDER BY 1 DESC;
You can check how much data it will query before running it in the BigQuery console UI. Again, since BigQuery uses a columnar data structure and partitions, it's recommended to select only the columns and partitions (`block_date`) needed to avoid unnecessary query costs.
:::

![Query Costs](/docs/assets/data-infra/BQ_Query_Cost.png "BQ Query Costs")
![Query Costs](/img/data-infra/BQ_Query_Cost.png "BQ Query Costs")

## Architecture

Expand Down
2 changes: 1 addition & 1 deletion docs/smart-contracts/anatomy/environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ The `predecessor` is the account that called the method in the contract. Meanwhi

During a simple transaction (no [cross-contract calls](../anatomy/crosscontract.md)) the `predecessor` is the same as the `signer`. For example, if **alice.near** calls **contract.near**, from the contract's perspective, **alice.near** is both the `signer` and the `predecessor`. However, if **contract.near** creates a [cross-contract call](../anatomy/crosscontract.md), then the `predecessor` changes down the line. In the example below, when **pool.near** executes, it would see **contract.near** as the `predecessor` and **alice.near** as the `signer`.

![img](https://miro.medium.com/max/1400/1*LquSNOoRyXpITQF9ugsDpQ.png)
![img](/docs/assets/smart-contracts/anatomy/environment.png)
*You can access information about the users interacting with your smart contract*

:::tip
Expand Down
6 changes: 3 additions & 3 deletions docs/smart-contracts/security/callbacks.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ In order for your contract to call itself when a cross-contract call is done, yo
## User's Money
When a method panics, the money attached to that transaction returns to the `predecessor`. This means that, if you make a cross-contract call and it fails, then the money **returns to your contract**. If the money came from a user calling your contract, then you should transfer it back during the callback.

![img](https://miro.medium.com/max/1400/1*Hp4TOcaBqm9LS0wkgWw3nA.png)
![img](/docs/assets/smart-contracts/security/callback-flow1.png)
*If the user attached money, we need to manually return it in the callback*

:::caution
Expand All @@ -41,10 +41,10 @@ Between a cross-contract call and its callback **any method of your contract can

Imagine that we develop a `deposit_and_stake` with the following **wrong logic**: (1) The user sends us money, (2) we add it to its balance, (3) we try to stake it in a validator, (4) if the staking fails, we remove the balance in the callback. Then, a user could schedule a call to withdraw between (2) and (4), and, if the staking failed, we would send money twice to the user.

![img](https://miro.medium.com/max/1400/1*VweWHQYGLBa70uceiWHLQA.png)
![img](/docs/assets/smart-contracts/security/callback-flow2.png)
*Between a cross-contract call and the callback anything could happen*

Luckily for us the solution is rather simple. Instead of immediately adding the money to our user’s balance, we wait until the callback. There we check, and if the staking went well, then we add it to their balance.

![img](https://miro.medium.com/max/1400/1*o0YVDCp_7l-L3njJMGhU4w.png)
![img](/docs/assets/smart-contracts/security/callback-flow3.png)
*Correct way to handle deposits in a cross-contract call*
4 changes: 2 additions & 2 deletions docs/smart-contracts/security/reentrancy.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ Always make sure to keep your state in a consistent state after a method finishe
### Example
Imagine that we develop a `deposit_and_stake` with the following **wrong logic**: (1) The user sends us money, (2) we add it to its balance, (3) we try to stake it in a validator, (4) if the staking fails, we remove the balance in the callback. Then, a user could schedule a call to withdraw between (2) and (4), and, if the staking failed, we would send money twice to the user.

![img](https://miro.medium.com/max/1400/1*VweWHQYGLBa70uceiWHLQA.png)
![img](/docs/assets/smart-contracts/security/callback-flow2.png)
*Between a cross-contract call and the callback anything could happen*

Luckily for us the solution is rather simple. Instead of immediately adding the money to our user’s balance, we wait until the callback. There we check, and if the staking went well, then we add it to their balance.

![img](https://miro.medium.com/max/1400/1*o0YVDCp_7l-L3njJMGhU4w.png)
![img](/docs/assets/smart-contracts/security/callback-flow3.png)
*Correct way to handle deposits in a cross-contract call*
2 changes: 1 addition & 1 deletion docs/tutorials/templates/blog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Blogchain is a template for creating onchain blogs using Mintbase. It allows use

Blogchain makes your content unstoppable. Transform your blogs into smart contracts and posts into NFTs.

![img](https://i.imgur.com/oAVyr9o.png)
![img](/img/tutorials/templates/blog-preview.png)

:::tip Mintbase Templates
This is part of the [Mintbase Templates](https://github.com/Mintbase/templates), a collection of templates that you can use to scaffold your own project
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/templates/marketplace.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This tutorial provides a step-by-step guide to creating a marketplace frontend u

Unlock Your NFT Storefront: Clone & Customize Your Path to Blockchain Success with this whitelabel marketplace template!

![img](https://i.imgur.com/FjcUss9.png)
![img](/img/tutorials/templates/marketplace-preview.png)

:::tip Mintbase Templates
This is part of the [Mintbase Templates](https://github.com/Mintbase/templates), a collection of templates that you can use to scaffold your own project
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/templates/minter.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ In this tutorial, we will walk through how to create a simple NFT minter using N

This is a Next.js 14 frontend minter example that includes a simple interface from which you can mint nfts easily

![img](https://i.imgur.com/QDJPsAA.png)
![img](/img/tutorials/templates/minter-preview.png)

:::tip Mintbase Templates
This is part of the [Mintbase Templates](https://github.com/Mintbase/templates), a collection of templates that you can use to scaffold your own project
Expand Down
6 changes: 3 additions & 3 deletions docs/web3-apps/ethereum-wallets.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Notice that the modal uses a `projectId`, which refers to your unique project on
3. Create a project on Cloud Reown.
4. You can copy your `projectId`:

![reown_projectid](https://doc.aurora.dev/assets/images/reown_projectid-dbd1cc5521998d2f16545598ac925a5e.png)
![reown_projectid](/docs/assets/web3-apps/reown_projectid.png)

:::tip

Expand Down Expand Up @@ -151,11 +151,11 @@ import { setupEthereumWallets } from "@near-wallet-selector/ethereum-wallets";

That is it! Just re-build your project and click on login! You should see Ethereum Wallets option in your Near Selector:

![ethwallets_popup1](https://doc.aurora.dev/assets/images/ethwallets_popup1-b113d70e3578a75f0f996aa3bcdf43e9.png)
![ethwallets_popup1](/docs/assets/web3-apps/ethwallets_popup1.png)

And after click to be able to choose the EVM wallet of your taste:

![ethwallets_popup2](https://doc.aurora.dev/assets/images/ethwallets_popup2-8484d037a465af5134f112fba6eef918.png)
![ethwallets_popup2](/docs/assets/web3-apps/ethwallets_popup2.png)

---

Expand Down
41 changes: 41 additions & 0 deletions find_external_images.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env python3

import os
import re
from pathlib import Path

EXTERNAL_PATTERNS = [
r'!\[.*?\]\((https?://(?!github\.com/near/docs).*?\.(?:png|jpg|jpeg|gif|svg|webp))\)',
r'<img.*?src=[\'"](https?://(?!github\.com/near/docs).*?\.(?:png|jpg|jpeg|gif|svg|webp))[\'"].*?>',
]

def find_external_images(root_dir: str) -> dict:
external_refs = {}

for path in Path(root_dir).rglob('*.md'):
with open(path, 'r', encoding='utf-8') as f:
content = f.read()

for pattern in EXTERNAL_PATTERNS:
matches = re.finditer(pattern, content)
for match in matches:
url = match.group(1)
if 'shields.io' not in url: # ignore badges
if url not in external_refs:
external_refs[url] = []
external_refs[url].append(str(path))

return external_refs

if __name__ == '__main__':
docs_dir = os.path.join(os.path.dirname(__file__), 'docs')
results = find_external_images(docs_dir)

if results:
print("found external images that should be localized:")
for url, files in results.items():
print(f"\n{url}")
for file in files:
print(f" referenced in: {file}")
else:
print("no external images found that need localization")
65 changes: 65 additions & 0 deletions localize_external_images.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/usr/bin/env python3

import os
import re
import requests
from pathlib import Path
from urllib.parse import urlparse

# List of external images to localize
external_images = {
"https://doc.aurora.dev/assets/images/reown_projectid-dbd1cc5521998d2f16545598ac925a5e.png": "assets/web3-apps/reown_projectid.png",
"https://doc.aurora.dev/assets/images/ethwallets_popup1-b113d70e3578a75f0f996aa3bcdf43e9.png": "assets/web3-apps/ethwallets_popup1.png",
"https://doc.aurora.dev/assets/images/ethwallets_popup2-8484d037a465af5134f112fba6eef918.png": "assets/web3-apps/ethwallets_popup2.png",
"https://pages.near.org/wp-content/uploads/2024/02/acct-abstraction-blog-1.png": "assets/chain-abstraction/account-abstraction-diagram.png",
"https://miro.medium.com/max/1400/1*LquSNOoRyXpITQF9ugsDpQ.png": "assets/smart-contracts/anatomy/environment.png",
"https://miro.medium.com/max/1400/1*Hp4TOcaBqm9LS0wkgWw3nA.png": "assets/smart-contracts/security/callback-flow1.png",
"https://miro.medium.com/max/1400/1*VweWHQYGLBa70uceiWHLQA.png": "assets/smart-contracts/security/callback-flow2.png",
"https://miro.medium.com/max/1400/1*o0YVDCp_7l-L3njJMGhU4w.png": "assets/smart-contracts/security/callback-flow3.png",
"https://i.imgur.com/FjcUss9.png": "assets/tutorials/templates/marketplace-preview.png",
"https://i.imgur.com/oAVyr9o.png": "assets/tutorials/templates/blog-preview.png",
"https://i.imgur.com/QDJPsAA.png": "assets/tutorials/templates/minter-preview.png"
}

def download_and_update_images():
base_dir = Path("website/static/docs")

# Download images
for url, local_path in external_images.items():
full_path = base_dir / local_path
full_path.parent.mkdir(parents=True, exist_ok=True)

if not full_path.exists():
try:
response = requests.get(url)
response.raise_for_status()
with open(full_path, "wb") as f:
f.write(response.content)
print(f"downloaded {url} to {local_path}")
except Exception as e:
print(f"failed to download {url}: {e}")

# Update references in markdown files
docs_dir = Path("docs")
for md_file in docs_dir.rglob("*.md"):
with open(md_file, "r", encoding="utf-8") as f:
content = f.read()

modified = False
for url, local_path in external_images.items():
# Update markdown image syntax
content_new = content.replace(f"]({url})", f"](/docs/{local_path})")
# Update HTML image tags
content_new = content_new.replace(f'src="{url}"', f'src="/docs/{local_path}"')

if content_new != content:
content = content_new
modified = True
print(f"updated references in {md_file}")

if modified:
with open(md_file, "w", encoding="utf-8") as f:
f.write(content)

if __name__ == "__main__":
download_and_update_images()
1 change: 1 addition & 0 deletions website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const config = {
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'throw',
onBrokenAnchors: 'throw',
staticDirectories: ['static', '../static'],
presets: [
[
'@docusaurus/preset-classic',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import LantstoolLogo from '@site/static/docs/assets/lantstool/lantstool-logo-circle.svg';
import LantstoolLogo from '/img/lantstool/lantstool-logo-circle.svg';
import cn from './LantstoolLabel.module.scss';

export const LantstoolLabel = () => (
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website/static/img/data-infra/Architecture.png
Binary file added website/static/img/data-infra/BQ_Query_Cost.png
Loading