Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
correct links which are outdated
Browse files Browse the repository at this point in the history
fixes #808
  • Loading branch information
iamveritas committed Sep 14, 2021
1 parent 4b3413d commit 8737696
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions docs/01_technical-overview/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ In general, there are two objects that are used to interact with a blockchain vi
## JsonRpc
The `JsonRpc` object is typically used when signing is not necessary. Some examples include [getting block information](how-to-guides/00_how-to-get-block-information.md), [getting transaction information](how-to-guides/02_how-to-get-transaction-information.md), or [getting table information](how-to-guides/09_how-to-get-table-information.md).

The requests made by the `JsonRpc` object will either use a built-in `fetch` library, or [the `fetch` library passed in by the user](basic-usage/01_commonjs.md) to issue requests to the endpoint specified when instantiating the `JsonRpc` object. When the various methods ([get_abi](https://github.com/EOSIO/eosjs/blob/master/src/eosjs-jsonrpc.ts#L66), [get_account](https://github.com/EOSIO/eosjs/blob/master/src/eosjs-jsonrpc.ts#L71), [get_block_header_state](https://github.com/EOSIO/eosjs/blob/master/src/eosjs-jsonrpc.ts#L76), etc) of the `JsonRpc` object are invoked, the calls are delegated to the `JsonRpc` object's [fetch function](https://github.com/EOSIO/eosjs/blob/master/src/eosjs-jsonrpc.ts#L42-L63), which in turn, delegate the requests to the `fetch` library.
The requests made by the `JsonRpc` object will either use a built-in `fetch` library, or [the `fetch` library passed in by the user](basic-usage/01_commonjs.md) to issue requests to the endpoint specified when instantiating the `JsonRpc` object. When the various methods ([get_abi](https://github.com/EOSIO/eosjs/blob/4b3413d6170c07682be06e8400c668688d115c0c/src/eosjs-jsonrpc.ts#L119), [get_account](https://github.com/EOSIO/eosjs/blob/4b3413d6170c07682be06e8400c668688d115c0c/src/eosjs-jsonrpc.ts#L123), [get_block_header_state](https://github.com/EOSIO/eosjs/blob/4b3413d6170c07682be06e8400c668688d115c0c/src/eosjs-jsonrpc.ts#L145), etc) of the `JsonRpc` object are invoked, the calls are delegated to the `JsonRpc` object's [fetch function](https://github.com/EOSIO/eosjs/blob/4b3413d6170c07682be06e8400c668688d115c0c/src/eosjs-jsonrpc.ts#L77), which in turn, delegate the requests to the `fetch` library.

## Api
The `Api` object is typically used when transacting on an EOSIO-based blockchain. Some examples include [staking](how-to-guides/03_how-to-stake.md), [creating an account](how-to-guides/05_how-to-create-an-account.md), or [proposing multi-sig transactions](how-to-guides/13_how-to-propose-a-multisig-transaction.md).

The typical use of the `Api` object is to call its [`transact` method](https://github.com/EOSIO/eosjs/blob/master/src/eosjs-api.ts#L214-L254). This method performs a number of steps depending on the input passed to it:
The typical use of the `Api` object is to call its [`transact` method](https://github.com/EOSIO/eosjs/blob/release/22.1.x/src/eosjs-api.ts#L334). This method performs a number of steps depending on the input passed to it:

* The `transact` method first checks if the **chainId** was set in the `Api` constructor, and if not, uses the [`JsonRpc` object's](#jsonrpc) [`get_info`](https://github.com/EOSIO/eosjs/blob/master/src/eosjs-jsonrpc.ts#L101) method to retrieve the **chainId**.
* The `transact` method then checks if the `expireSeconds` and either `blocksBehind` or `useLastIrreversible` fields are set and well-formed in the [optional configuration object, as specified in *How to Submit a Transaction*](how-to-guides/01_how-to-submit-a-transaction.md#).
* If so, either the *last_irreversible_block_num* or the block *blocksBehind* the head block retrieved from [`JsonRpc`'s `get_info`](https://github.com/EOSIO/eosjs/blob/master/src/eosjs-jsonrpc.ts#L101) is set as the reference block and the transaction header is serialized using this reference block and the `expireSeconds` field.
* The `transact` method first checks if the **chainId** was set in the `Api` constructor, and if not, uses the [`JsonRpc` object's](#jsonrpc) [`get_info`](https://github.com/EOSIO/eosjs/blob/4b3413d6170c07682be06e8400c668688d115c0c/src/eosjs-jsonrpc.ts#L183) method to retrieve the **chainId**.
* The `transact` method then checks if the `expireSeconds` and either `blocksBehind` or `useLastIrreversible` fields are set and well-formed in the [optional configuration object, as specified in *How to Submit a Transaction*](how-to-guides/01_how-to-submit-a-transaction.md#).
* If so, either the *last_irreversible_block_num* or the block *blocksBehind* the head block retrieved from [`JsonRpc`'s `get_info`](https://github.com/EOSIO/eosjs/blob/4b3413d6170c07682be06e8400c668688d115c0c/src/eosjs-jsonrpc.ts#L183) is set as the reference block and the transaction header is serialized using this reference block and the `expireSeconds` field.
* The `transact` method then checks if the appropriate TAPOS fields are present in the transaction ([they can either be specified directly in the transaction or in the optional configuration object](how-to-guides/01_how-to-submit-a-transaction.md#)) and throws an Error if not.
* The necessary `abi`s for a transaction are then retrieved for the case when `transact` is expected to sign the transaction.
* The `actions` are serialized using the `eosjs-serialize` `ser` object.
* The entire transaction is then [serialized](https://github.com/EOSIO/eosjs/blob/master/src/eosjs-api.ts#L154-L166), also using the `eosjs-serialize` `ser` object.
* The entire transaction is then [serialized](https://github.com/EOSIO/eosjs/blob/4b3413d6170c07682be06e8400c668688d115c0c/src/eosjs-api.ts#L376), also using the `eosjs-serialize` `ser` object.
* The transaction is then optionally signed, using the `signatureProvider`, the previously retrieved `abi`s, the private keys of the `signatureProvider`, and the `chainId`.
* The transaction is then optionally compressed, using the `deflate` function of a Javascript zlib library.
* The transaction is then optionally broadcasted using `JsonRpc`'s [`push_transaction`](https://github.com/EOSIO/eosjs/blob/master/src/eosjs-jsonrpc.ts#L187).
* The transaction is then optionally broadcasted using `JsonRpc`'s [`send_transaction`](https://github.com/EOSIO/eosjs/blob/4b3413d6170c07682be06e8400c668688d115c0c/src/eosjs-jsonrpc.ts#L344).

0 comments on commit 8737696

Please sign in to comment.