# orbiter-chaincore-dev

> Orbier Finance Chain SDK

Latest version **1.0.1** (published 2023-04-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install orbiter-chaincore-dev
pnpm add orbiter-chaincore-dev
yarn add orbiter-chaincore-dev
bun add orbiter-chaincore-dev
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2023-04-02 |
| First published | 2023-04-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 29 |
| Unpacked size | 698.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| Author | Orbiter Finance Team |
| Maintainers | rldwzl |

## Links

- npm: https://www.npmjs.com/package/orbiter-chaincore-dev
- Repository: https://github.com/Orbiter-Finance/ChainCore
- Homepage: https://github.com/Orbiter-Finance/ChainCore#readme
- Issues: https://github.com/Orbiter-Finance/ChainCore/issues
- npm.io page: https://npm.io/package/orbiter-chaincore-dev

## Dependencies (29)

- [qs](https://npm.io/package/qs.md) ^6.11.0
- [chai](https://npm.io/package/chai.md) ^4.3.6
- [keyv](https://npm.io/package/keyv.md) ^4.5.0
- [web3](https://npm.io/package/web3.md) ^1.8.0
- [dayjs](https://npm.io/package/dayjs.md) ^1.11.5
- [mocha](https://npm.io/package/mocha.md) ^10.0.0
- [redis](https://npm.io/package/redis.md) ^3.1.2
- [ethers](https://npm.io/package/ethers.md) ^5.7.1
- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [ioredis](https://npm.io/package/ioredis.md) ^5.3.1
- [typedoc](https://npm.io/package/typedoc.md) ^0.23.18
- [winston](https://npm.io/package/winston.md) ^3.8.2
- [fs-extra](https://npm.io/package/fs-extra.md) ^10.1.0
- [starknet](https://npm.io/package/starknet.md) 3.10.0
- [web3-utils](https://npm.io/package/web3-utils.md) ^1.8.0
- [@types/chai](https://npm.io/package/@types/chai.md) ^4.3.3
- [alchemy-sdk](https://npm.io/package/alchemy-sdk.md) ^2.1.1
- [cross-fetch](https://npm.io/package/cross-fetch.md) ^3.1.5
- [bignumber.js](https://npm.io/package/bignumber.js.md) ^9.1.0
- [web3-eth-abi](https://npm.io/package/web3-eth-abi.md) ^1.8.0
- [patch-package](https://npm.io/package/patch-package.md) ^6.5.1
- [@imtbl/imx-sdk](https://npm.io/package/@imtbl/imx-sdk.md) ^1.20.2
- [logstash-client](https://npm.io/package/logstash-client.md) ^1.1.1
- [winston-logstash](https://npm.io/package/winston-logstash.md) ^1.1.0
- [@alch/alchemy-web3](https://npm.io/package/@alch/alchemy-web3.md) ^1.4.6
- [@dydxprotocol/v3-client](https://npm.io/package/@dydxprotocol/v3-client.md) ^1.9.1
- [postinstall-postinstall](https://npm.io/package/postinstall-postinstall.md) ^2.1.0
- [winston-daily-rotate-file](https://npm.io/package/winston-daily-rotate-file.md) ^4.7.1
- [@loopring-web/loopring-sdk](https://npm.io/package/@loopring-web/loopring-sdk.md) ^2.0.13

## Recent versions

- 1.0.1 (latest) — 2023-04-02
- 1.0.0 — 2023-04-02

## README

# Orbiter-Finance ChainCoreBin

[Hacker News](https://github.com/Orbiter-Finance) showcase using typescript
```
  / _ \   _ __  | |__   (_) | |_    ___   _ __          |  ___| (_)  _ __     __ _   _ __     ___    ___ 
 | | | | | '__| | '_ \  | | | __|  / _ \ | '__|  _____  | |_    | | | '_ \   / _` | | '_ \   / __|  / _ \
 | |_| | | |    | |_) | | | | |_  |  __/ | |    |_____| |  _|   | | | | | | | (_| | | | | | | (__  |  __/
  \___/  |_|    |_.__/  |_|  \__|  \___| |_|            |_|     |_| |_| |_|  \__,_| |_| |_|  \___|  \___|
                                                        
```
## QuickStart
### Chain structure

- chains.json Mainnet
- testnet.json Testnet

```json
{
  // Whether to enable debug mode, default false
  "debug": false,
  "api": {
    // API interface of block browser
    "url": "https://api.etherscan.io/api",
    // Interface request key, if any
    "key": "You Key"
  },
  // ChainID
  "chainId": "1",
  // NetworkId In most public chains, the network ID and the public chain ID are the same
  "networkId": "1",
  // Orbiter custom id，unique, not repeated
  "internalId": "1",
  // Chain Name
  "name": "Ethereum Mainnet",
  // The default main currency of the public chain
  "nativeCurrency": {
    // Token Name
    "name": "Ether",
    // Token Symbol
    "symbol": "ETH",
    // Token decimals
    "decimals": 18,
    // Token Contract Address
    "address": "0x0000000000000000000000000000000000000000"
  },
  // RPC server address
  "rpc": [
    "wss://eth-mainnet.alchemyapi.io/v2/You Key"
  ],
  // The monitoring method to enable
  "watch": ["rpc", "api"],
  // contract address to monitor
  "contracts": ["0xd9d74a29307cc6fc8bf424ee4217f1a587fbc8dc"],
  // List of contract tokens to monitor
  "tokens": [
    // The structure is consistent with nativeCurrency
    {
      "name": "USD Coin",
      "symbol": "USDC",
      "decimals": 6,
      "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
    }
  ]
}
```

### Easy access to code

```
import { logger, ScanChainMain } from "../..";
import mainChains from "../chains.json";
import testChains from "../testnet.json";
const scanChain = new ScanChainMain(<any>[...mainChains, ...testChains]);
scanChain.startScanChain("internalId", ["Wallet Address", "xxxx"])

```

### Monitored cursor position

- The monitored cursor position is stored and the cache directory

#### Struct

```
{
  "cache": [
    [
      "keyv:ApiCursor:{Wallet Address}",
      {
        "value": "{\"value\":{\"blockNumber\":{Last Watch Tx Number},\"hash\":\"{Last Watch Tx Hash}\",\"timestamp\":{Last Watch Tx Time}}},\"expires\":null}"
      }
    ],
    [
      "keyv:rpcScan:288",
      {
        "value": "{\"value\":{RPC Last Scan Block Number}},\"expires\":null}"
      }
    ]
  ],
  "lastExpire": 1654672839824
}

```
### Query historical transactions
- If you need to query historical transactions, you need to rebuild the cursor index, and you need to modify the index file in the cache directory corresponding to the public chain
- Api Major Modified Fields
  - blockNumber   // Start scanning from this block
  - hash // Start scanning from this Hash
  - timestamp // Start scanning from this Time
- RPC Major Modified Fields
  - rpcScan-> value // Start scanning from this block

> Code document[the file](./docs/index.html) Modules document[the file](./docs/modules.html)
### Requirement

- Node.js 8.x+
- Typescript 2.8+

---
_Source: https://npm.io/package/orbiter-chaincore-dev · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
