From 735c278615eb198ab2925e941180c3d7527e2c1c Mon Sep 17 00:00:00 2001 From: Eliott Teissonniere Date: Fri, 8 Apr 2022 09:23:17 +0000 Subject: [PATCH 1/2] add nodl support --- src/__tests__/index.test.ts | 7 +++++++ src/index.ts | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/src/__tests__/index.test.ts b/src/__tests__/index.test.ts index 283994c8..dc0a197b 100644 --- a/src/__tests__/index.test.ts +++ b/src/__tests__/index.test.ts @@ -884,6 +884,13 @@ const vectors: Array = [ { text: '0x1001EEc06f2aDff074fC2A9492e132c33d6bd54d', hex: '1001eec06f2adff074fc2a9492e132c33d6bd54d' }, ], }, + { + name: 'NODL', + coinType: 1003, + passingVectors: [ + { text: '4k5Am7GnRscesBAG7NEuibjdstLTwBhwtYW1of2FC79DYkqF', hex: '823c7f65123aa9e1fdcfcd146590e7f058a348f282781eebbecc82d20852c627' }, + ], + }, { name: 'FTM_LEGACY', coinType: 1007, diff --git a/src/index.ts b/src/index.ts index 017ee202..60e665b6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -620,6 +620,10 @@ function ksmAddrDecoder(data: string): Buffer { return Buffer.from(ss58Decode(data)); } +function nodlAddrEncoder(data: Buffer): string { + return ss58Encode(Uint8Array.from(data), 37); +} + function ontAddrEncoder(data: Buffer): string { return bs58Encode(Buffer.concat([Buffer.from([0x17]), data])) } @@ -1522,6 +1526,7 @@ export const formats: IFormat[] = [ bech32Chain('RUNE', 931, 'thor'), bitcoinChain('BCD', 999, 'bcd', [[0x00]], [[0x05]]), hexChecksumChain('TT_LEGACY', 1001), + getConfig('NODL', 1003, nodlAddrEncoder, ksmAddrDecoder), hexChecksumChain('FTM_LEGACY', 1007), bech32Chain('ONE', 1023, 'one'), getConfig('ONT', 1024, ontAddrEncoder, ontAddrDecoder), From cafb4a7ed413da12784ea21d0e50df4015884011 Mon Sep 17 00:00:00 2001 From: Eliott Teissonniere Date: Fri, 8 Apr 2022 09:23:42 +0000 Subject: [PATCH 2/2] add to readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 8ff86a58..13723785 100644 --- a/README.md +++ b/README.md @@ -108,6 +108,7 @@ This library currently supports the following cryptocurrencies and address forma - NEM(XEM) (base32) - NEO (base58check) - NMC (base58check) + - NODL (ss58) - NRG (checksummed-hex) - NULS (base58) - ONE (bech32)