Skip to content

Commit f7fff25

Browse files
fix: update symbol export
* update symbol type export * update tests v1.10.1
1 parent 0249d1c commit f7fff25

File tree

4 files changed

+47
-13
lines changed

4 files changed

+47
-13
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hyperbitjs/chains",
3-
"version": "1.10.0",
3+
"version": "1.10.1",
44
"license": "MIT",
55
"main": "dist/index.js",
66
"typings": "dist/index.d.ts",

src/types/base.ts

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -153,34 +153,61 @@ export type Algorithm =
153153
| 'zhash';
154154

155155
export type Symbol =
156-
| 'btc'
157156
| 'bch'
158157
| 'blk'
158+
| 'btc'
159+
| 'btcz'
160+
| 'btg'
161+
| 'bze'
159162
| 'cbn'
163+
| 'cdy'
160164
| 'city'
165+
| 'clore'
166+
| 'cmm'
161167
| 'dash'
162168
| 'dcr'
163-
| 'dnr'
164169
| 'dgb'
165-
| 'xdn'
170+
| 'dnr'
166171
| 'doge'
172+
| 'dogec'
173+
| 'dyn'
167174
| 'evr'
175+
| 'fdr'
176+
| 'firo'
177+
| 'fls'
178+
| 'flux'
179+
| 'fren'
168180
| 'ftc'
181+
| 'glink'
169182
| 'grs'
183+
| 'ilc'
184+
| 'kmd'
170185
| 'ltc'
186+
| 'ltz'
171187
| 'mewc'
172188
| 'mona'
173-
| 'nmc'
174189
| 'nav'
175-
| 'xna'
176190
| 'nbt'
177-
| 'ppc'
191+
| 'neox'
192+
| 'nmc'
178193
| 'pgn'
194+
| 'pivx'
195+
| 'ppc'
179196
| 'qtum'
180-
| 'rvn'
181197
| 'rdd'
182198
| 'rito'
183-
| 'vtc'
199+
| 'rtm'
200+
| 'rvc'
201+
| 'rvn'
202+
| 'satox'
203+
| 'tls'
204+
| 'vgc'
184205
| 'via'
206+
| 'vrsc'
207+
| 'vtc'
185208
| 'x42'
186-
| 'zec';
209+
| 'xdn'
210+
| 'xna'
211+
| 'zec'
212+
| 'zen'
213+
| 'zer';

src/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ export function findNetworkById(id: string): Network | undefined {
7070
return undefined;
7171
}
7272

73-
export function getChainIds(symbol: Symbol): string[] {
73+
export function getChainIds(network: Network['network']): string[] {
7474
return Object.keys(chains).reduce<string[]>((acc: string[], key: string) => {
75-
const n = chains[key as Symbol][symbol];
75+
const n = chains[key as Symbol][network];
7676
if (n) {
7777
return [...acc, n.id];
7878
}

test/index.test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,19 @@ describe('chains', () => {
3131

3232
it('should get a list of chain ids', () => {
3333
const names = getChainIds('mainnet');
34-
expect(names).toContain('E406C7BC-5DFD-461F-B67C-D8027DD72B96');
34+
expect(names).toContain('A44223B1-CEE2-4EE6-B331-36A6BF608A69');
3535
});
3636

3737
it('should get chain networks by network type', () => {
3838
const networks = getChainsByNetwork('mainnet');
3939
expect(networks.length).toBeGreaterThan(0);
40+
expect(networks[0].id).toBe('A44223B1-CEE2-4EE6-B331-36A6BF608A69');
41+
});
42+
43+
it('should get chain networks by network and symbol', () => {
44+
const networks = getChainsByNetwork('mainnet', 'btc');
45+
expect(networks.length).toBeGreaterThan(0);
4046
expect(networks[0].id).toBe('E406C7BC-5DFD-461F-B67C-D8027DD72B96');
47+
expect(networks[0].name).toBe('Bitcoin');
4148
});
4249
});

0 commit comments

Comments
 (0)