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

Added Hardwaretor (HAW) Token #716

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
31 changes: 31 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Node.js CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x, 20.x, 22.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build --if-present
- run: npm test
30 changes: 30 additions & 0 deletions dist/diffTokenLists.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { TokenInfo } from './types';
export declare type TokenInfoChangeKey = Exclude<keyof TokenInfo, 'address' | 'chainId'>;
export declare type TokenInfoChanges = Array<TokenInfoChangeKey>;
/**
* Differences between a base list and an updated list.
*/
export interface TokenListDiff {
/**
* Tokens from updated with chainId/address not present in base list
*/
readonly added: TokenInfo[];
/**
* Tokens from base with chainId/address not present in the updated list
*/
readonly removed: TokenInfo[];
/**
* The token info that changed
*/
readonly changed: {
[chainId: number]: {
[address: string]: TokenInfoChanges;
};
};
}
/**
* Computes the diff of a token list where the first argument is the base and the second argument is the updated list.
* @param base base list
* @param update updated list
*/
export declare function diffTokenLists(base: TokenInfo[], update: TokenInfo[]): TokenListDiff;
17 changes: 17 additions & 0 deletions dist/getVersionUpgrade.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Enum describing types of version differences
*/
import { Version } from './types';
export declare enum VersionUpgrade {
NONE = 0,
PATCH = 1,
MINOR = 2,
MAJOR = 3
}
/**
* Return the upgrade type from the base version to the update version.
* Note that downgrades and equivalent versions are both treated as `NONE`.
* @param base base list
* @param update update to the list
*/
export declare function getVersionUpgrade(base: Version, update: Version): VersionUpgrade;
9 changes: 9 additions & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import schema from './tokenlist.schema.json';
export * from './types';
export * from './isVersionUpdate';
export * from './getVersionUpgrade';
export * from './diffTokenLists';
export * from './minVersionBump';
export * from './nextVersion';
export * from './versionComparator';
export { schema };
8 changes: 8 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

'use strict'

if (process.env.NODE_ENV === 'production') {
module.exports = require('./token-lists.cjs.production.min.js')
} else {
module.exports = require('./token-lists.cjs.development.js')
}
5 changes: 5 additions & 0 deletions dist/isVersionUpdate.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Version } from './types';
/**
* Returns true if versionB is an update over versionA
*/
export declare function isVersionUpdate(base: Version, update: Version): boolean;
8 changes: 8 additions & 0 deletions dist/minVersionBump.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { VersionUpgrade } from './getVersionUpgrade';
import { TokenInfo } from './types';
/**
* Returns the minimum version bump for the given list
* @param baseList the base list of tokens
* @param updatedList the updated list of tokens
*/
export declare function minVersionBump(baseList: TokenInfo[], updatedList: TokenInfo[]): VersionUpgrade;
8 changes: 8 additions & 0 deletions dist/nextVersion.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { VersionUpgrade } from './getVersionUpgrade';
import { Version } from './types';
/**
* Returns the next version of the list given a base version and the upgrade type
* @param base current version
* @param bump the upgrade type
*/
export declare function nextVersion(base: Version, bump: VersionUpgrade): Version;
Loading