Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bumped packages #3560

Merged
merged 2 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions apps/wallet-mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,19 +124,19 @@
"@shopify/flash-list": "^1.4.1",
"@types/bip39": "^3.0.0",
"@types/pbkdf2": "^3.1.2",
"@yoroi/api": "1.5.1",
"@yoroi/common": "1.5.3",
"@yoroi/exchange": "2.1.0",
"@yoroi/explorers": "1.0.1",
"@yoroi/identicon": "1.0.0",
"@yoroi/links": "1.5.6",
"@yoroi/portfolio": "1.0.1",
"@yoroi/resolver": "2.0.5",
"@yoroi/setup-wallet": "1.0.0",
"@yoroi/staking": "1.5.1",
"@yoroi/swap": "2.0.0",
"@yoroi/api": "^1.5.2",
"@yoroi/common": "^1.5.4",
"@yoroi/exchange": "^2.1.1",
"@yoroi/explorers": "^1.0.2",
"@yoroi/identicon": "^1.0.1",
"@yoroi/links": "^1.5.7",
"@yoroi/portfolio": "^1.0.2",
"@yoroi/resolver": "^2.0.6",
"@yoroi/setup-wallet": "^1.0.1",
"@yoroi/staking": "^1.5.2",
"@yoroi/swap": "^2.0.1",
"@yoroi/theme": "^1.0.0",
"@yoroi/transfer": "1.0.0",
"@yoroi/transfer": "^1.0.1",
"add": "2.0.6",
"assert": "^2.0.0",
"axios": "^1.5.0",
Expand Down Expand Up @@ -257,7 +257,7 @@
"@types/uuid": "^8.3.4",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.32.0",
"@yoroi/types": "1.5.6",
"@yoroi/types": "^1.5.7",
"babel-eslint": "^10.1.0",
"babel-jest": "^29.2.1",
"babel-loader": "8.2.2",
Expand Down Expand Up @@ -303,7 +303,7 @@
},
"engineStrict": true,
"engine": {
"node": "~16.19.0",
"node": "~18.00.0",
"npm": "~7.19.1"
},
"ts-node": {
Expand Down
8 changes: 4 additions & 4 deletions packages/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@yoroi/api",
"version": "1.5.1",
"version": "1.5.2",
"description": "The API package of Yoroi SDK",
"keywords": [
"yoroi",
Expand Down Expand Up @@ -133,9 +133,7 @@
]
},
"dependencies": {
"@emurgo/cip14-js": "^3.0.1",
"@yoroi/common": "1.5.3",
"@yoroi/types": "1.5.6"
"@emurgo/cip14-js": "^3.0.1"
},
"devDependencies": {
"@commitlint/config-conventional": "^17.0.2",
Expand All @@ -150,6 +148,7 @@
"@types/jest": "^29.5.12",
"@types/react": "^18.2.55",
"@types/react-test-renderer": "^18.0.7",
"@yoroi/types": "^1.5.7",
"axios": "^1.5.0",
"axios-mock-adapter": "^1.21.5",
"commitlint": "^17.0.2",
Expand All @@ -173,6 +172,7 @@
"zod": "^3.22.1"
},
"peerDependencies": {
"@yoroi/common": "^1.5.4",
"axios": "^1.5.0",
"react": ">= 16.8.0 <= 19.0.0",
"react-query": "^3.39.3",
Expand Down
6 changes: 2 additions & 4 deletions packages/common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@yoroi/common",
"version": "1.5.3",
"version": "1.5.4",
"description": "The Common package of Yoroi SDK",
"keywords": [
"yoroi",
Expand Down Expand Up @@ -146,6 +146,7 @@
"@types/jest": "^29.5.12",
"@types/react": "^18.2.55",
"@types/react-test-renderer": "^18.0.7",
"@yoroi/types": "^1.5.7",
"axios": "^1.5.0",
"axios-mock-adapter": "^1.21.5",
"bignumber.js": "^9.0.1",
Expand All @@ -172,9 +173,6 @@
"typescript": "^5.3.3",
"zod": "^3.22.1"
},
"dependencies": {
"@yoroi/types": "1.5.6"
},
"peerDependencies": {
"@react-native-async-storage/async-storage": ">= 1.19.3 <= 1.20.0",
"axios": "^1.5.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/dapp-connector/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@yoroi/dapp-connector",
"version": "1.0.0",
"version": "1.0.1",
"description": "The Dapp Connector package of Yoroi SDK",
"keywords": [
"yoroi",
Expand Down Expand Up @@ -155,7 +155,7 @@
"@types/jest": "^29.5.12",
"@types/react": "^18.2.55",
"@types/react-test-renderer": "^18.0.7",
"@yoroi/types": "1.5.6",
"@yoroi/types": "^1.5.7",
"axios-mock-adapter": "^1.21.5",
"bignumber.js": "^9.0.1",
"commitlint": "^17.0.2",
Expand Down
8 changes: 3 additions & 5 deletions packages/exchange/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@yoroi/exchange",
"version": "2.1.0",
"version": "2.1.1",
"description": "The Exchange package of Yoroi SDK",
"keywords": [
"yoroi",
Expand Down Expand Up @@ -128,10 +128,6 @@
"<rootDir>/jest.setup.js"
]
},
"dependencies": {
"@yoroi/common": "1.5.3",
"@yoroi/types": "1.5.6"
},
"devDependencies": {
"@commitlint/config-conventional": "^17.0.2",
"@react-native-async-storage/async-storage": "^1.19.3",
Expand All @@ -143,6 +139,7 @@
"@types/jest": "^29.5.12",
"@types/react": "^18.2.55",
"@types/react-test-renderer": "^18.0.7",
"@yoroi/types": "^1.5.7",
"axios": "^1.5.0",
"commitlint": "^17.0.2",
"del-cli": "^5.0.0",
Expand All @@ -167,6 +164,7 @@
},
"peerDependencies": {
"@react-native-async-storage/async-storage": ">= 1.19.3 <= 1.20.0",
"@yoroi/common": "^1.5.4",
"axios": "^1.5.0",
"immer": "^10.0.2",
"react": ">= 16.8.0 <= 19.0.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/explorers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@yoroi/explorers",
"version": "1.0.1",
"version": "1.0.2",
"description": "The Explorers package of Yoroi SDK",
"keywords": [
"yoroi",
Expand Down Expand Up @@ -144,7 +144,7 @@
"@types/jest": "^29.5.12",
"@types/react": "^18.2.55",
"@types/react-test-renderer": "^18.0.7",
"@yoroi/types": "1.5.6",
"@yoroi/types": "^1.5.7",
"bignumber.js": "^9.0.1",
"commitlint": "^17.0.2",
"del-cli": "^5.0.0",
Expand All @@ -168,7 +168,7 @@
"typescript": "^5.3.3"
},
"peerDependencies": {
"@yoroi/common": "1.5.3",
"@yoroi/common": "1.5.4",
"immer": "^10.0.3",
"react": ">= 16.8.0 <= 19.0.0",
"react-native-mmkv": "^2.11.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/identicon/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@yoroi/identicon",
"version": "1.0.0",
"version": "1.0.1",
"description": "The package to create wallet identicons of Yoroi SDK",
"keywords": [
"yoroi",
Expand Down
8 changes: 3 additions & 5 deletions packages/links/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@yoroi/links",
"version": "1.5.6",
"version": "1.5.7",
"description": "The package for managing links of Yoroi SDK",
"keywords": [
"yoroi",
Expand Down Expand Up @@ -136,10 +136,6 @@
"<rootDir>/jest.setup.js"
]
},
"dependencies": {
"@yoroi/common": "1.5.3",
"@yoroi/types": "1.5.6"
},
"devDependencies": {
"@commitlint/config-conventional": "^17.0.2",
"@react-native-async-storage/async-storage": "^1.19.3",
Expand All @@ -151,6 +147,7 @@
"@types/jest": "^29.5.12",
"@types/react": "^18.2.55",
"@types/react-test-renderer": "^18.0.7",
"@yoroi/types": "^1.5.7",
"commitlint": "^17.0.2",
"del-cli": "^5.0.0",
"dependency-cruiser": "^13.1.1",
Expand All @@ -173,6 +170,7 @@
"zod": "^3.22.2"
},
"peerDependencies": {
"@yoroi/common": "^1.5.4",
"immer": "^10.0.2",
"react": ">= 16.8.0 <= 19.0.0",
"zod": "^3.22.2"
Expand Down
109 changes: 108 additions & 1 deletion packages/portfolio/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,108 @@
# Portfolio package for Yoroi
# @yoroi/portfolio

The `@yoroi/portfolio` package is an all-in-one solution for managing token portfolios, images, prices, balances, and token information within the Yoroi wallet ecosystem. Designed with modern web and mobile applications in mind, this package not only handles token data but also offers integrated CDN support for images, ensuring smooth and efficient loading, especially on mobile devices.

By leveraging CDN, it avoids the "lag" associated with directly using IPFS, specially in cases where the images are not pinned to any service.

Additionally, `@yoroi/portfolio` comes with built-in support for DeFi prices, allowing to fetch and manage the latest token prices with ease.

- [Installation](#installation)
- [Overview](#overview)
- [API Reference](#api-reference)
- [PortfolioTokenManager](#portfolio-token-manager-maker)
- [PortfolioBalanceManager](#portfolio-balance-manager-maker)
- [Features](#features)
- [Contributing](#contributing)

## Installation

You can install the package through:

```bash
// npm
npm install @yoroi/portfolio

// yarn
yarn add @yoroi/portfolio

// workspace
yarn workspace <your-package> add @yoroi/portfolio
```

## Overview

The `@yoroi/portfolio` package provides two primary factory functions, and one goal which is to facilitate dealing with tokens on web3.
Dealing with Cardano native assets presents unique challenges due to the platform's design and its UTxO model, which differs from the account-based models used by other blockchains like Ethereum. Unlike traditional blockchains where tokens are treated as simple balances, Cardano’s native assets (secondary tokens) are handled in the same way as ADA (primary token), the network’s native currency, and are tied to specific UTxOs.

This requires developers to manage multiple inputs and outputs meticulously, which complicates token transactions, especially when interacting with multiple tokens simultaneously. Additionally, the lack of standardized token behavior—since each token can have its own set of rules and characteristics—adds another layer of complexity. Managing token metadata, ensuring compatibility with wallets, and handling the intricacies of multi-asset transactions make working with Cardano tokens a demanding task, requiring a deep understanding of the platform’s architecture.

Therefore this package was broken into two main factory functions:

`portfolioTokenManagerMaker`: Manages token information, including caching and synchronization with external APIs, the token manager was design to aggregate information per network.
`portfolioBalanceManagerMaker`: Manages token balances, including primary and secondary tokens, and synchronizes these balances based on wallet information, its primary dependency is the UTxOs, most of the information is derived from it. It also takes that token manager as dependency to identify token info properties.

## API Reference

### Portfolio Token Manager Maker

Description

The `portfolioTokenManagerMaker` factory function creates a token manager that leverages the Yoroi CDN to get information about the tokens and also provide details about the traits and the discovery process of a token it handles the following:

- Hydration: Loads cached token information from storage.
- Synchronization: Synchronizes token information with external APIs, handling unknown tokens and invalidated caches.
- Clearing: Clears token information from storage and cache.
- Observation: Notifies observers about changes in the token information.

Dependencies

- `api`: An object that provides methods to fetch token information from an external API.
- `storage`: An object that provides methods to store and retrieve token information locally.
- `observer` (optional): An observer manager to handle events related to token information changes.

Returns

A frozen object containing methods to `hydrate`, `sync`hronize, `clear`, and `destroy` the token manager.

### Portfolio Balance Manager Maker

Description

The `portfolioBalanceManagerMaker` factory function creates a balance manager to manage token balances and prices it handles the following:

- Hydration: Loads token balances from storage, including primary and secondary tokens.
- Synchronization: Synchronizes token balances based on UTxOs updates (new transactions).
- Primary Balance Management: Manages the primary token's balance, including breakdown into different parts.
- Observation: Notifies observers about changes in token balances.

Dependencies

- `tokenManager`: An instance of `Portfolio.Manager.Token` created by `portfolioTokenManagerMaker`.
- `primaryTokenInfo`: Information about the primary token (e.g., ADA) in the portfolio.
- `storage`: An object that provides methods to store and retrieve balance information locally.
- `sourceId`: A unique identifier for the source of events.
- `observer` (optional): An observer manager to handle events related to balance changes.
- `queue` (optional): A task queue manager to handle asynchronous operations in sequence.

Returns

A frozen object containing methods to `hydrate`, `refresh`, `syncBalances`, `synchBalances`, `destroy`, `clear` and many more to manage the balances and prices of the primary token and secondary token.

## Features

- Caching: Efficiently cache token information and balances for quick access, it leverages the `cache-control` and `eTag` from the backend to avoid hitting the API constantly.
- Synchronization: Keep token information and balances up-to-date with external sources ([`CIP68`](https://cips.cardano.org/cip/CIP-68), Token Registry the off-chain token record [`CIP26`](https://cips.cardano.org/cip/CIP-26)).
- Event Observation: Allows client to subscribe to handle events related to tokens and balances. (check the `Token.Event` for all options)
- Primary Token Management: Special handling for primary tokens, including detailed breakdowns of balances (rewards, locked deposit - cost to keep UTxOs).
- Customization: Extensible with custom observers and task queues (it manages concurrency automatically, therefore many wallets can synchronize at the same time, it ensures the persisted and cached state are atomic).
- Loose Checking: There are some loose checks to list tokens that were minted with wrong metadata (not following the specs, [`CIP25`](https://cips.cardano.org/cip/CIP-25)).
- DeFi: Support token activity and price history, for now the supported protocols are:
- Cardano
- [MinSwap v1 & v2](https://minswap.org)
- [SundaeSwap (**comming soon**)](https://sundae.fi)

If you are looking for more information about the APIs, events and types please check [here](https://github.com/Emurgo/yoroi/tree/develop/packages/types/src/portfolio)

## Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue to discuss any changes or improvements.
8 changes: 4 additions & 4 deletions packages/portfolio/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@yoroi/portfolio",
"version": "1.0.1",
"version": "1.0.2",
"description": "The Portfolio package of Yoroi SDK",
"keywords": [
"yoroi",
Expand Down Expand Up @@ -145,7 +145,7 @@
"@types/jest": "^29.5.12",
"@types/react": "^18.2.55",
"@types/react-test-renderer": "^18.0.7",
"@yoroi/types": "1.5.6",
"@yoroi/types": "^1.5.7",
"bignumber.js": "^9.0.1",
"commitlint": "^17.0.2",
"del-cli": "^5.0.0",
Expand All @@ -170,8 +170,8 @@
},
"peerDependencies": {
"@react-native-async-storage/async-storage": "^1.19.3",
"@yoroi/api": "1.5.1",
"@yoroi/common": "1.5.3",
"@yoroi/api": "1.5.2",
"@yoroi/common": "1.5.4",
"bignumber.js": "^9.0.1",
"immer": "^10.0.3",
"react": ">= 16.8.0 <= 19.0.0",
Expand Down
Loading
Loading