-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #134 from CityOfZion/CU-86a53cg51
CU-86a53cg51 - BSLib - Add support to Neo Legacy app
- Loading branch information
Showing
9 changed files
with
453 additions
and
3,713 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
common/changes/@cityofzion/bs-neo-legacy/CU-86a5z9zkg_2024-12-20-22-49.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"changes": [ | ||
{ | ||
"packageName": "@cityofzion/bs-neo-legacy", | ||
"comment": "Add Ledger support", | ||
"type": "minor" | ||
} | ||
], | ||
"packageName": "@cityofzion/bs-neo-legacy" | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
packages/bs-neo-legacy/src/__tests__/NeonJsLedgerServiceNeoLegacy.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import Transport from '@ledgerhq/hw-transport' | ||
import TransportNodeHid from '@ledgerhq/hw-transport-node-hid' | ||
import { NeonJsLedgerServiceNeoLegacy } from '../services/ledger/NeonJsLedgerServiceNeoLegacy' | ||
import { BSNeoLegacy } from '../services/BSNeoLegacy' | ||
import { BSNeoLegacyConstants } from '../constants/BSNeoLegacyConstants' | ||
|
||
let ledgerService: NeonJsLedgerServiceNeoLegacy<'neo-legacy'> | ||
let transport: Transport | ||
let bsNeoLegacy: BSNeoLegacy<'neo-legacy'> | ||
|
||
describe.skip('NeonJsLedgerServiceNeoLegacy', () => { | ||
beforeAll(async () => { | ||
const network = BSNeoLegacyConstants.TESTNET_NETWORKS[0]! | ||
bsNeoLegacy = new BSNeoLegacy('neo-legacy', network) | ||
|
||
transport = await TransportNodeHid.create() | ||
ledgerService = new NeonJsLedgerServiceNeoLegacy(bsNeoLegacy, async () => transport) | ||
}, 60000) | ||
|
||
it('Should be able to get all accounts', async () => { | ||
const accounts = await ledgerService.getAccounts(transport) | ||
expect(accounts.length).toBeGreaterThan(1) | ||
|
||
accounts.forEach((account, index) => { | ||
expect(account).toEqual( | ||
expect.objectContaining({ | ||
address: expect.any(String), | ||
key: expect.any(String), | ||
type: 'publicKey', | ||
bip44Path: bsNeoLegacy.bip44DerivationPath.replace('?', index.toString()), | ||
}) | ||
) | ||
}) | ||
}, 60000) | ||
|
||
it('Should be able to get account', async () => { | ||
const account = await ledgerService.getAccount(transport, 0) | ||
expect(account).toEqual( | ||
expect.objectContaining({ | ||
address: expect.any(String), | ||
key: expect.any(String), | ||
type: 'publicKey', | ||
bip44Path: bsNeoLegacy.bip44DerivationPath.replace('?', '0'), | ||
}) | ||
) | ||
}, 60000) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.