# @coolwallet/evm

> Coolwallet EVMOS sdk

Latest version **2.0.9** (published 2026-09-01) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @coolwallet/evm
pnpm add @coolwallet/evm
yarn add @coolwallet/evm
bun add @coolwallet/evm
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 2.0.9 |
| Published | 2026-09-01 |
| First published | 2022-04-15 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 9 |
| Unpacked size | 1.5 MB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 37 |
| Author | coolwallet-team |
| Maintainers | coolwallet-team |

## Links

- npm: https://www.npmjs.com/package/@coolwallet/evm
- Repository: https://github.com/CoolBitX-Technology/coolwallet-sdk
- Homepage: https://github.com/CoolBitX-Technology/coolwallet-sdk#readme
- Issues: https://github.com/CoolBitX-Technology/coolwallet-sdk/issues
- npm.io page: https://npm.io/package/@coolwallet/evm

## Dependencies (9)

- [ajv](https://npm.io/package/ajv.md) ^8.10.0
- [rlp](https://npm.io/package/rlp.md) ^3.0.0
- [bn.js](https://npm.io/package/bn.js.md) ^5.2.0
- [keccak](https://npm.io/package/keccak.md) ^3.0.2
- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [elliptic](https://npm.io/package/elliptic.md) ^6.5.4
- [web3-utils](https://npm.io/package/web3-utils.md) ^1.7.1
- [@coolwallet/core](https://npm.io/package/@coolwallet/core.md) ^2.0.2-beta.1
- [@metamask/eth-sig-util](https://npm.io/package/@metamask/eth-sig-util.md) ^4.0.0

## Recent versions

- 2.0.9 (latest) — 2026-09-01
- 2.0.5-beta.1 (beta) — 2026-01-08
- 2.0.8 — 2026-07-30
- 2.0.7 — 2026-07-14
- 2.0.6 — 2026-04-30
- 2.0.5 — 2026-01-15
- 2.0.4 — 2025-09-18
- 2.0.4-beta.0 — 2025-09-18
- 2.0.3 — 2025-09-16
- 2.0.3-beta.0 — 2025-09-15
- 2.0.2 — 2025-08-08
- 2.0.1 — 2025-05-23
- 2.0.1-beta.2 — 2025-05-16
- 2.0.1-beta.0 — 2025-05-16
- 2.0.0 — 2025-05-05
- … 52 more at https://npm.io/package/@coolwallet/evm/versions

## README

# CoolWallet EVM Compatible SDK

Typescript library with support for the integration of EVM compatible chain for third party application, include the functionalities of generation of addresses and signed transactions.

## Install

```shell
npm install @coolwallet/evm
```

## Usage

```javascript
import EVM from '@coolwallet/evm';
import { crypto } from '@coolwallet/core';
import { createTransport } from '@coolwallet/transport-web-ble';

// Select the chain
const chainId = 137; // Polygon Mainnet
const evm = new EVM(chainId);

const transport = await createTransport();

const { privateKey: appPrivateKey } = crypto.key.generateKeyPair();

const appId = 'appId that had been registered by wallet';

const addressIndex = 0;

const address = await evm.getAddress(transport, appPrivateKey, appId, addressIndex);

const transaction = {
  nonce: '0x21d',
  gasPrice: '0x59682f00',
  gasLimit: '0x5208',
  to: '0x81bb32e4A7e4d0500d11A52F3a5F60c9A6Ef126C',
  value: '0x5af3107a4000',
  data: '0x00',
};

const signTxData = {
  transport,
  appPrivateKey,
  appId,
  transaction,
  addressIndex,
};

const normalTx = await evm.signTransaction(signTxData);

const signTxData = {
  transport,
  appPrivateKey,
  appId,
  transaction,
  addressIndex,
};

const erc20Transaction = {
  nonce: '0x85',
  gasPrice: '0x23a427985a',
  gasLimit: '0x72c2',
  to: '0xe41d2489571d322189246dafa5ebde1f4699f498',
  value: '0x0',
  data: '0x00',
  option: {
    symbol: 'USDT',
    unit: '6',
  },
};

const erc20SignTxData = {
  transport,
  appPrivateKey,
  appId,
  transaction: erc20Transaction,
  addressIndex,
};

const erc20Tx = await evm.signERC20Transaction(erc20SignTxData);
```

## Methods

### getAddress

#### Description

The address generated is compatible to BIP44 with **account** and **change** set to 0, which means calling `getAddress` with `addressIndex = i` will get the address of folllowing BIP44 path:

```none
m/44'/60'/0'/0/{i}
```

In the design of current hardware, we only support path `m/44'/60'/0'/0/{i}` for speed optimization. This might change in the future and we will then open a more general interface to deal with custom path.

```javascript
async getAddress(
    transport: types.Transport,
    appPrivateKey: string,
    appId: string,
    addressIndex: number
): Promise<string>
```

#### Arguments

|      Arg      |                 Description                  |   Type    | Required |
| :-----------: | :------------------------------------------: | :-------: | :------: |
|   transport   | Object to communicate with CoolWallet device | Transport |   True   |
| appPrivateKey |  Private key for the connected application   |  string   |   True   |
|     appId     |       ID for the connected application       |  string   |   True   |
| addressIndex  |  The from address index in BIP44 derivation  |  number   |   True   |

### signTransaction

#### Description

Sign Ethereum Transaction. If the transaction has non-empty `data` field, the card will display `SMART` instead of transfering amount.

```javascript
async signTransaction(signTxData: types.signTx): Promise<string>
```

#### signTx Arguments

|      Arg      |                       Description                       |    Type     | Required |
| :-----------: | :-----------------------------------------------------: | :---------: | :------: |
|   transport   |      Object to communicate with CoolWallet device       |  Transport  |   True   |
| appPrivateKey |        Private key for the connected application        |   string    |   True   |
|     appId     |            ID for the connected application             |   string    |   True   |
|  transaction  | Essential information/property for Ethereum Transaction | Transaction |   True   |
| addressIndex  |       The from address index in BIP44 derivation        |   number    |   True   |
|   publicKey   |             Public key of the from address              |   string    |   True   |

### signMessage

#### Description

Perform ethereum `personal_sign`.

```javascript
async signMessage(signMsgData: types.signMsg): Promise<string>

```

#### signMsg Arguments

|      Arg      |                 Description                  |   Type    | Required |
| :-----------: | :------------------------------------------: | :-------: | :------: |
|   transport   | Object to communicate with CoolWallet device | Transport |   True   |
| appPrivateKey |  Private key for the connected application   |  string   |   True   |
|     appId     |       ID for the connected application       |  string   |   True   |
|    message    |               Message to sign                |  string   |   True   |
| addressIndex  |  The from address index in BIP44 derivation  |  number   |   True   |

### signTypedData

#### Description

Perform ethereum `sign_typed_data`.

```javascript
async signTypedData(typedData: types.signTyped): Promise<string>
```

#### signTyped Arguments

|      Arg      |                 Description                  |   Type    | Required |
| :-----------: | :------------------------------------------: | :-------: | :------: |
|   transport   | Object to communicate with CoolWallet device | Transport |   True   |
| appPrivateKey |  Private key for the connected application   |  string   |   True   |
|     appId     |       ID for the connected application       |  string   |   True   |
|   typedData   |      Typed structured data to be signed      |    any    |   True   |
| addressIndex  |  The from address index in BIP44 derivation  |  number   |   True   |


## Add New Chain

1. `mkdir src/chain/new`
2. Create index.ts and token.ts in `src/chain/new`
3. `token.ts`:

```javascript
export const TOKENS = {};
```

4. `index.ts`:

```javascript
import { TOKENS } from './token';
import { ChainProps } from '../types';

class NewChain extends ChainProps {
  id = NewChainId as number;
  symbol = 'NewChainSymbol';
  signature = '';
  tokens = TOKENS;
}

export default new NewChain();
```

5. export `NewChain` from `src/chain/index.ts`

```javascript
export { default as NEW } from './new';
```

6. Add `NewChain` to `tools/chain` to generate encoded data which should be signed.

```javascript
console.log('New Chain Information', CHAIN.NEW.toHexChainInfo());
```

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