Skip to content

Commit

Permalink
Merge pull request #47 from ensdomains/dot
Browse files Browse the repository at this point in the history
Add support for DOT
  • Loading branch information
Arachnid authored Sep 1, 2020
2 parents 0fb0c77 + 5ca6960 commit 6f75119
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,13 @@ const vectors: Array<TestVector> = [
{ text: 'TJCnKsPa7y5okkXvQAidZBzqx3QyQ6sxMW', hex: '415a523b449890854c8fc460ab602df9f31fe4293f'},
],
},
{
name: 'DOT',
coinType: 354,
passingVectors: [
{ text: '1FRMM8PEiWXYax7rpS6X4XZX1aAAxSWx1CrKTyrVYhV24fg', hex: '0aff6865635ae11013a83835c019d44ec3f865145943f487ae82a8e7bed3a66b' },
],
},
{
name: 'KSM',
coinType: 434,
Expand Down
5 changes: 5 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ function ksmAddrEncoder(data: Buffer): string {
return ss58Encode(Uint8Array.from(data), 2)
}

function dotAddrEncoder(data: Buffer): string {
return ss58Encode(Uint8Array.from(data), 0)
}

function ksmAddrDecoder(data: string): Buffer {
return new Buffer(ss58Decode(data))
}
Expand Down Expand Up @@ -278,6 +282,7 @@ const formats: IFormat[] = [
getConfig('XLM', 148, strEncoder, strDecoder),
getConfig('EOS', 194, eosAddrEncoder, eosAddrDecoder),
getConfig('TRX', 195, bs58Encode, bs58Decode),
getConfig('DOT', 354, dotAddrEncoder, ksmAddrDecoder),
getConfig('KSM', 434, ksmAddrEncoder, ksmAddrDecoder),
hexChecksumChain('XDAI', 700),
bech32Chain('BNB', 714, 'bnb'),
Expand Down

0 comments on commit 6f75119

Please sign in to comment.