Skip to content

Commit

Permalink
New docs draft (near#1040)
Browse files Browse the repository at this point in the history
* Added emojis to Integration docs

* Fixed Integrate welcome links

* Brought back tutorials in Develop section

* Reorganized Tutorials

* AS

* Update welcome.md

* Non working version of the component

* Added new components for code tabs

* Add doc sites links

* Added code snippets to github

* Update docusaurus.config.js

* update links

* Update environment.md

* Converted environment large code snip to table

* Added AS code in the cross-contract section

* ordered anatomy and crosscontract

* added type warning

* Update crosscontract.md

* fix links

* Update package-lock.json

* updated xcc, storage and security

* Reorganized docs + Added quickstarts

* WIP: unit testing

* Added Github snippets for integration

* WIP: Fixing layout

* Reverted layout to old format

* Simplified cross-contract call examples

* Added storage examples

* added security storage page

* Fixed code across pages

* Renamed and reorganized sections

* General Corrections and Improvements

* Minor changes

* Migrated to workspaces

* Removed icons and minor fixes

* Returned home icon

* Updated actions

* Updated actions

* Updated actions and added frontend info

* Added example of retrieving result from a wallet redirect

* prepared for enclave docs

* added js enclave docs

* Added web2to3 docs

* minor estetic changes

* add visual in protocol.md

* Move image to correct folder

* Update docs/1.concepts/1.basics/protocol.md

* Update docs/1.concepts/1.basics/protocol.md

Co-authored-by: Damián Parrino <bucanero@users.noreply.github.com>

* updated donation example

* Updated frontend

* clean

* Update introduction.md

* spell edit

* updated cross-contract calls to sdk 4.0.0

* Added FT docs

* Returned icon to frontend to call attention

* updated what is a contract

* separate intro from 'test' category

* update to ft docs

* Add explanation on calculating 30% rewards (near#1084)

* add piece on calculating 30% rewards

* Apply suggestions from code review

* Minor changes in FT docs

* Changed order in sidebar

* Finished NFT and updated FT

* minor improvements

* move RPC

* Update nft.md

* Updated nft & added dao docs

* removed icon from frontend

* Added frontend to integrate

* added sybil docs

* update

* Update docusaurus.config.js

* fix: spelling mistake

* finished frontend docs

* Added icons

* Reorganized and revised

* Reorganized

* Reestructured

* insert indexer content

* Update events.md

* change quote box types to lesson

* Reorganized and Improved docs

* Reorganized

* create FAQ section

* add unanswered FAQ text from old docs

* simplify URL

* Update docusaurus.config.js

* Update frontrunning.md

* Add Gleap widget

* Updated explorers and indexer for explorer

* modified title

* update gitignore to ignore package lock json

* move first faq to anatomy

* move second faq questino to anatomy

* fix links

* move third faq to storage

* move 4th faq to storage

* 5th question to NAJ

* move q6 to tools welcome

* q7 to deploy in develop

* q8 t0 validators

* q9 to validators

* answered alreadty answered

* question already answered

* fully integrated faq content to rest of newdocs

* stylistic fixes

* stylistic changes

* stylistic changes

* capitalize

* change info class blockquotes to lesson

* change info tag to lesson

* Reorganized and Improved

* links

* fix links

* Reorganized and updated docs

* added missing assets

* fixed sections location

* added tutorials

* Added guest book example

* move getter lesson to storage

* grant updating deployed SC its own version

* move prog lang plan to whatiscontract

* move M1 dev setup to deploy

* Worked on examples

* Added xcc example

* removed banned

* added 1yn docs

* removed videos and outdated resources

* removed vm as a standalone category

* Added new to near

* minor changes

* changed links to internal examples

* reorganized concepts

* fixed actions

* update on actions

* links

* fix links

* links

* move old docs

* added providers

* added more providers

* updated rpc

* rpc update

* links

* docs wip

* avoiding token loss

* account

* account

* protocol

* token loss

* account

* transactions

* account

* transaction

* transaction

* transaction

* transaction

* transaction

* minor changes to oracles

* links

* links

* links

* links

* Update docs/1.concepts/1.basics/transactions/overview.md

Co-authored-by: Damián Parrino <bucanero@users.noreply.github.com>

* Update docs/1.concepts/1.basics/token-loss.md

Co-authored-by: Damián Parrino <bucanero@users.noreply.github.com>

* Update docs/1.concepts/1.basics/transactions/overview.md

Co-authored-by: Damián Parrino <bucanero@users.noreply.github.com>

* Update docs/1.concepts/1.basics/transactions/overview.md

Co-authored-by: Damián Parrino <bucanero@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Damián Parrino <bucanero@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Damián Parrino <bucanero@users.noreply.github.com>

* Added DAO & Multisig

* links

* updated what is web3

* improved what is a contract

* Added contract's life

* updated dao

* added passphrases link

* storage docs

sync with Josh

* Added example on creating accounts on mainnet/testnet

* updated text / code

* updated actions

* fix links

* fix links

* Went through and fixed all grammar and simplified things in develop section

* Fixed typo

* improved landing pages

* redirected examples to our own page

* minor changes

* Code review with Guille on call

* initial commit

* Update docs/2.develop/contracts/anatomy.md

* Apply suggestions from code review

fix links

* Update package-lock.json

* Update account.md

* add redirect to near-nodes site

* fixed code snippets in quickstart

* added arrow to contract examples

* fixed code links

* fix snippet in actions

* fixed code snippets cross-contract

* reorganized and added quicklinks

* finished reviewing PR

* added exchange information

* minor change

* improved seo

* fix links

* naj

* naj

* naj

Co-authored-by: gagdiez <gagdiez.c@gmail.com>
Co-authored-by: Dennis <10233439+idea404@users.noreply.github.com>
Co-authored-by: Max <max.khrp@gmail.com>
Co-authored-by: BenKurrek <bkurrek@uwaterloo.ca>
  • Loading branch information
5 people authored Jul 18, 2022
1 parent 89637e0 commit 7c4609d
Show file tree
Hide file tree
Showing 301 changed files with 21,956 additions and 10,069 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ website/.docusaurus/*
neardev
.idea
.docz
package-lock.json
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions docs/faq/developer-faq.md → 0.old/faq/developer-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ On the other hand, things like interaction with storage is done through our runt

### How do you update a property of an object within a PersistentVector? {#how-do-you-update-a-property-of-an-object-within-a-persistentvector}

**important** This question is specific to Assemblyscript.
**important** This question is specific to AssemblyScript.

You have to replace the whole object. Persistent collections are ultimately just wrappers around storage.get and storage.set operating on JSON-serialized objects.

### How is PersistentMap used? {#how-is-persistentmap-used}

**important** This question is specific to Assemblyscript.
**important** This question is specific to AssemblyScript.

PersitentMap stores a key value pair, whereby the key is either a string or number and the value is usually an object. If you want to retrieve a particular value, you have to include the key to the value.

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ sidebar_label: Accounts

## Introduction {#introduction}

Please see the [documentation for accounts](/docs/concepts/account) for basic information.
Please see the [documentation for accounts](/concepts/basics/account) for basic information.

- For exchanges, NEAR supports [implicit account](https://nomicon.io/DataStructures/Account.html#implicit-account-ids) creation which allows the creation of accounts without paying for transactions.
- You can create an implicit account by following the steps in [this guide](/docs/roles/integrator/implicit-accounts).
- Accounts must have enough tokens to cover its storage which currently costs 0.0001 NEAR per byte. This equates to a minimum balance of 0.0182 NEAR for an account with one access key. You can query the live storage price using the [`protocol-config`](https://docs.near.org/docs/api/rpc#protocol-config) RPC endpoint. For more details on storage fees see [this section of the economics paper](https://near.org/papers/economics-in-sharded-blockchain/#transaction-and-storage-fees).
- Accounts must have enough tokens to cover its storage which currently costs 0.0001 NEAR per byte. This equates to a minimum balance of 0.0182 NEAR for an account with one access key. You can query the live storage price using the [`protocol-config`](https://docs.near.org/api/rpc/setup#protocol-config) RPC endpoint. For more details on storage fees see [this section of the economics paper](https://near.org/papers/economics-in-sharded-blockchain/#transaction-and-storage-fees).

## Transfer from Function Call {#transfer-from-function-call}

NEAR allows transfers to happen within a function call. More importantly, when an account is deployed with some contract, it is possible that the only way to transfer tokens from that account is through a function call. Therefore, exchanges need to support transfers through function calls as well. We recommend the following approach:

Exchange can [query block by height](/docs/api/rpc#block) to get blocks on each height, and for every block,
[query its chunk](/docs/api/rpc#chunk) to obtain the transactions included in the block. For each transaction,
[query its status](/docs/api/rpc#transaction-status-with-receipts) to see the receipts generated from
Exchange can [query block by height](/api/rpc/setup#block) to get blocks on each height, and for every block,
[query its chunk](/api/rpc/setup#chunk) to obtain the transactions included in the block. For each transaction,
[query its status](/api/rpc/setup#transaction-status-with-receipts) to see the receipts generated from
transactions. Since exchanges are only interested in transfers to their addresses, they only need to filter receipts that
only contain `Transfer` action and whose `predecessor_id` is not `system` (receipts with `predecessor_id` equal to `system`
are [refunds](https://nomicon.io/RuntimeSpec/Refunds.html)). Then, to check whether the receipt succeeds, it is sufficient
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ sidebar_label: Balance Changes
## Prerequisites {#prerequisites}

- [NEAR Account](/docs/develop/basics/create-account)
- [NEAR-CLI](/docs/tools/near-cli)
- Credentials for sender account stored locally by running [`near login`](/docs/tools/near-cli#near-login)
- [NEAR-CLI](/tools/cli)
- Credentials for sender account stored locally by running [`near login`](/tools/cli#near-login)

### Native NEAR (Ⓝ) {#native-near}

> Balance changes on accounts can be tracked by using our [changes RPC endpoint](/docs/api/rpc#view-account-changes). You can test this out by sending tokens to an account using [NEAR-CLI](/docs/tools/near-cli#near-send) and then viewing the changes made.
> Balance changes on accounts can be tracked by using our [changes RPC endpoint](/api/rpc/setup#view-account-changes). You can test this out by sending tokens to an account using [NEAR-CLI](/tools/cli#near-send) and then viewing the changes made.
## Send Tokens {#send-tokens}

- Send tokens using [`near send`](/docs/tools/near-cli#near-send)
- Send tokens using [`near send`](/tools/cli#near-send)

```bash
near send sender.testnet receiver.testnet 1
Expand All @@ -35,7 +35,7 @@ https://explorer.testnet.near.org/transactions/4To336bYcoGc3LMucJPMk6fMk5suKfCrd
## View Balance Changes {#view-balance-changes}

- Open the transaction URL in [NEAR Explorer](https://explorer.testnet.near.org/) and copy the `BLOCK HASH`.
- Using the `BLOCK HASH` and the accountId, query the [changes RPC endpoint](/docs/api/rpc#view-account-changes) to view changes.
- Using the `BLOCK HASH` and the accountId, query the [changes RPC endpoint](/api/rpc/setup#view-account-changes) to view changes.

**Example Query using HTTPie:**

Expand Down Expand Up @@ -82,7 +82,7 @@ http post https://rpc.testnet.near.org jsonrpc=2.0 id=dontcare \

---

Alternatively, you can view account balances by [querying `view_account`](/docs/api/rpc#view-account) which only requires an accountId.
Alternatively, you can view account balances by [querying `view_account`](/api/rpc/setup#view-account) which only requires an accountId.

**Example HTTPie Request:**

Expand Down Expand Up @@ -113,7 +113,7 @@ Alternatively, you can view account balances by [querying `view_account`](/docs/
}
```

**Note:** Gas prices can change between blocks. Even for transactions with deterministic gas cost the cost in NEAR could also be different. You can query the gas price for recent blocks using the [`gas_price` RPC endpoint](https://docs.near.org/docs/api/rpc#gas-price).
**Note:** Gas prices can change between blocks. Even for transactions with deterministic gas cost the cost in NEAR could also be different. You can query the gas price for recent blocks using the [`gas_price` RPC endpoint](https://docs.near.org/api/rpc/setup#gas-price).

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ http post https://rpc.testnet.near.org jsonrpc=2.0 id=dontcare method=EXPERIMENT
# in the line above, testnet may be replaced with mainnet or betanet
```

It's `43200` seconds or `~12` hours. You can view the live configuration for `epoch_length` using the [`protocol_config` RPC endpoint](/docs/api/rpc#protocol-config).
It's `43200` seconds or `~12` hours. You can view the live configuration for `epoch_length` using the [`protocol_config` RPC endpoint](/api/rpc/setup#protocol-config).

In the response we find `transaction_validity_period": 86400` (and since it takes about 1 second to produce a block, this period is about 24 hrs)

Expand Down Expand Up @@ -223,7 +223,7 @@ An account can have arbitrarily many keys, as long as it has enough tokens for t

### Which balance look-ups exists? What is required? {#which-balance-look-ups-exists-what-is-required}

We have an [RPC method for viewing account](/docs/api/rpc#view_account).
We have an [RPC method for viewing account](/api/rpc/setup#view_account).

The [JS implementation is here](https://github.com/near/near-api-js/blob/d7f0cb87ec320b723734045a4ee9d17d94574a19/src/providers/json-rpc-provider.ts#L73). Note that in this RPC interface you can specify the finality requirement (whether to query the latest state or finalized state).

Expand All @@ -242,7 +242,7 @@ Accounts don’t have associated resources. Gas amount is predetermined for all
### How do we know how much gas to add to a transaction? {#how-do-we-know-how-much-gas-to-add-to-a-transaction}

- See reference documentation here: https://nomicon.io/Economics/
- See API documentation for [discovering gas price via RPC here](/docs/api/rpc#gas-price).
- See API documentation for [discovering gas price via RPC here](/api/rpc/setup#gas-price).

The issuer of a transaction should attach some amount of gas by taking a guess at budget which will get the transaction processed. The contract knows how much to fund different cross contract calls. Gas price is calculated and fixed per block, but may change from block to block depending on how full / busy the block is. If blocks become more than half full then gas price increases.

Expand All @@ -252,7 +252,7 @@ We're also considering adding a max gas price limit.

### How do we follow Tx status? {#how-do-we-follow-tx-status}

See related [RPC interface for fetching transaction status here](/docs/api/rpc#transaction-status).
See related [RPC interface for fetching transaction status here](/api/rpc/setup#transaction-status).

### How are transactions constructed and signed? {#how-are-transactions-constructed-and-signed}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ Output:

This gives us the same account ID as `near-cli`, so this is encouraging.

**Note:** The default network for `near-cli` is `testnet`. If you would like to change this to `mainnet` or `betanet`, please see [`near-cli` network selection](/docs/tools/near-cli#network-selection) for instructions.
**Note:** The default network for `near-cli` is `testnet`. If you would like to change this to `mainnet` or `betanet`, please see [`near-cli` network selection](/tools/cli#network-selection) for instructions.

>Got a question?
<a href="https://stackoverflow.com/questions/tagged/nearprotocol">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ One notable aspect of the standard is that method names are prefixed with `ft_`.

## Get balance {#get-balance}

Using the abstraction of the [NEAR CLI](/docs/tools/near-cli) tool, we can check the balance of a user's account with [`near view`](/docs/tools/near-cli#near-view):
Using the abstraction of the [NEAR CLI](/tools/cli) tool, we can check the balance of a user's account with [`near view`](/tools/cli#near-view):

`near view ft.demo.testnet ft_balance_of '{"account_id": "mike.testnet"}'`

Expand All @@ -23,7 +23,7 @@ View call: ft.demo.testnet.ft_balance_of({"account_id": "mike.testnet"})
'1000000'
```

Alternatively, you can [call a contract function](/docs/api/rpc#call-a-contract-function) using the `query` RPC endpoint. Below is an example using HTTPie:
Alternatively, you can [call a contract function](/api/rpc/setup#call-a-contract-function) using the `query` RPC endpoint. Below is an example using HTTPie:

```bash
http post https://rpc.testnet.near.org jsonrpc=2.0 id=ftbalance method=query \
Expand Down Expand Up @@ -273,7 +273,7 @@ If there is not enough deposit for the storage or returned value is `null` - you
- with JSON RPC call:
At the top of this section is a link detailing how to [construct a transaction](/docs/tutorials/create-transactions#low-level----create-a-transaction) without the full abstraction of the [`near-api-js` library](https://www.npmjs.com/package/near-api-js). For this and future examples that use the [RPC method `broadcast_tx_commit`](https://docs.near.org/docs/api/rpc#send-transaction-await) we will provide a JSON-like object meant to act similar to [pseudocode](https://en.wikipedia.org/wiki/Pseudocode), only imparting high-level details of a transaction. This code block below is the first example of this, detailing what goes into the transaction discussed currently, involving the method `storage_deposit`.
At the top of this section is a link detailing how to [construct a transaction](/docs/tutorials/create-transactions#low-level----create-a-transaction) without the full abstraction of the [`near-api-js` library](https://www.npmjs.com/package/near-api-js). For this and future examples that use the [RPC method `broadcast_tx_commit`](https://docs.near.org/api/rpc/setup#send-transaction-await) we will provide a JSON-like object meant to act similar to [pseudocode](https://en.wikipedia.org/wiki/Pseudocode), only imparting high-level details of a transaction. This code block below is the first example of this, detailing what goes into the transaction discussed currently, involving the method `storage_deposit`.
```yaml
Transaction: {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
id: simple-fts
title: Minting FTs (Simple)
sidebar_label: Minting FTs (Simple)
---

In this tutorial, you'll learn how to easily create your own Fungible Tokens (FT) without doing any software development by using a readily-available smart contract.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
id: live-app-review
title: NEAR Application Reviews
sidebar_label: Application Reviews
title: Application Reviews
---

> **Get insights and explanations directly from NEAR Core team members as they talk through the intricacies of dApp development.**
Expand Down
Loading

0 comments on commit 7c4609d

Please sign in to comment.