# @xlabs-libs/wallet-aggregator-core

> Basic Wallet abstractions to interact with blockchains.

Latest version **0.0.1-alpha.23** (published 2025-02-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install @xlabs-libs/wallet-aggregator-core
pnpm add @xlabs-libs/wallet-aggregator-core
yarn add @xlabs-libs/wallet-aggregator-core
bun add @xlabs-libs/wallet-aggregator-core
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1-alpha.23 |
| Published | 2025-02-10 |
| First published | 2023-01-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 75.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 13 |
| Maintainers | yuliferna, mpicco-randlabs, sebastianscatularo, mpicco, alex99y |

## Links

- npm: https://www.npmjs.com/package/@xlabs-libs/wallet-aggregator-core
- Repository: https://github.com/XLabs/wallet-aggregator-sdk.git#master
- Homepage: https://github.com/XLabs/wallet-aggregator-sdk/tree/master#readme
- Issues: https://github.com/XLabs/wallet-aggregator-sdk/issues
- npm.io page: https://npm.io/package/@xlabs-libs/wallet-aggregator-core

## Dependencies (1)

- [eventemitter3](https://npm.io/package/eventemitter3.md) ^5.0.0

## Recent versions

- 0.0.1-alpha.23 (latest) — 2025-02-10
- 0.0.1-alpha.22 — 2024-12-10
- 0.0.1-alpha.21 — 2024-06-17
- 0.0.1-alpha.20 — 2024-05-27
- 0.0.1-alpha.19 — 2024-05-06
- 0.0.1-alpha.18 — 2023-10-10
- 0.0.1-alpha.17 — 2023-07-18
- 0.0.1-alpha.16 — 2023-07-10
- 0.0.1-alpha.15 — 2023-07-06
- 0.0.1-alpha.14 — 2023-05-17
- 0.0.1-alpha.13 — 2023-05-01
- 0.0.1-alpha.12 — 2023-04-20
- 0.0.1-alpha.11 — 2023-04-03
- 0.0.1-alpha.10 — 2023-03-10
- 0.0.1-alpha.9 — 2023-02-17
- … 8 more at https://npm.io/package/@xlabs-libs/wallet-aggregator-core/versions

## README

## Wallet Aggregator - Core

Basic Wallet abstractions to interact with blockchains.

In order to implement a wallet for a given chain through the sdk, simply import the `Wallet` class and extend from it. The abstraction defines a set of generic arguments to define the types the methods it will expect and interact with (e.g. a transaction request type, a message to sign, the result of submitting a tx to network, etc).

The `Wallet` class implements the `EventEmitter` interface, letting the client subscribe to the following events:

| Event            | Description                                                                                |
| ---------------- | ------------------------------------------------------------------------------------------ |
| `connect`        | Signals the wallet has succesfully connected                                               |
| `disconnect`     | Signals the wallet has succesfully disconnected                                            |
| `networkChanged` | Signals whether a change in the network was detected. Useful for working with EVM wallets. |

New events can be added by extending the `WalletEvents` class.

Example:

```ts
import { Wallet, WalletEvents } from "@xlabs/wallet-aggregator-core";

// define types
type MyUnsignedTransactionType = // ...
// ...
interface MyEventsType extends WalletEvents {
  // ...
}

class MyBlockchainWallet extends Wallet<
  MyUnsignedTransactionType,
  MySignedTransactionType,
  MySignedTransactionType,
  MySubmitTransactionResultType,
  MyNetworkInfoType,
  MyMessageType,
  MyMessageResultType,
  MyEventsType
> {
  // code...
}
```

The blockchain IDs follow those of Wormhole. A [constants file](./src/constants.ts) is provided with said chain ids.

Refer to the Wormhole [documentation](https://docs.wormhole.com/wormhole/overview) if you wish to know more about the project.

---
_Source: https://npm.io/package/@xlabs-libs/wallet-aggregator-core · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
