* Bump deps

* Responsebase import

* Do Ledger creation via newSubstrateApp
This commit is contained in:
Jaco
2022-08-19 10:47:44 +03:00
committed by GitHub
parent 0aae0e2bc2
commit 82ba3fb9b1
6 changed files with 1994 additions and 293 deletions
+2 -2
View File
@@ -33,8 +33,8 @@
},
"devDependencies": {
"@babel/core": "^7.18.10",
"@polkadot/dev": "^0.67.94",
"@types/jest": "^28.1.6"
"@polkadot/dev": "^0.67.112",
"@types/jest": "^28.1.7"
},
"resolutions": {
"typescript": "^4.7.4"
+1 -1
View File
@@ -26,6 +26,6 @@
"@ledgerhq/hw-transport": "^6.27.2",
"@polkadot/hw-ledger-transports": "10.1.4",
"@polkadot/util": "10.1.4",
"@zondax/ledger-substrate": "^0.34.0"
"@zondax/ledger-substrate": "^0.35.3"
}
}
+5 -2
View File
@@ -1,9 +1,12 @@
// Copyright 2017-2022 @polkadot/hw-ledger authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ResponseBase, SubstrateApp } from '@zondax/ledger-substrate';
import type { SubstrateApp } from '@zondax/ledger-substrate';
import type { ResponseBase } from '@zondax/ledger-substrate/dist/common';
import type { AccountOptions, LedgerAddress, LedgerSignature, LedgerTypes, LedgerVersion } from './types';
import { newSubstrateApp } from '@zondax/ledger-substrate';
import { transports } from '@polkadot/hw-ledger-transports';
import { u8aToBuffer } from '@polkadot/util';
@@ -80,7 +83,7 @@ export class Ledger {
const transport = await def.create();
this.#app = ledgerApps[this.#chain](transport);
this.#app = newSubstrateApp(transport, ledgerApps[this.#chain]);
}
return this.#app;
+16
View File
@@ -0,0 +1,16 @@
// Copyright 2017-2022 @polkadot/hw-ledger authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { supportedApps } from '@zondax/ledger-substrate/dist/supported_apps';
import { ledgerApps } from './defaults';
describe('ledgerApps', (): void => {
it.each(Object.keys(ledgerApps))('%s is known', (k): void => {
expect(
supportedApps.find(({ name }) =>
name === ledgerApps[k]
)
).toBeDefined();
});
});
+27 -31
View File
@@ -1,36 +1,32 @@
// Copyright 2017-2022 @polkadot/hw-ledger authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type Transport from '@ledgerhq/hw-transport';
import type { SubstrateApp } from '@zondax/ledger-substrate';
import { newAcalaApp, newAlephZeroApp, newAstarApp, newBifrostApp, newBifrostKusamaApp, newCentrifugeApp, newComposableApp, newDockApp, newEdgewareApp, newEquilibriumApp, newGenshiroApp, newInterlayApp, newKaruraApp, newKusamaApp, newNodleApp, newParallelApp, newPolkadexApp, newPolkadotApp, newPolymeshApp, newSoraApp, newStafiApp, newStatemineApp, newStatemintApp, newUniqueApp, newXXNetworkApp } from '@zondax/ledger-substrate';
// These match up with the keys of the knownLedger object in the @polkadot/networks/defaults/ledger.ts
export const ledgerApps: Record<string, (transport: Transport) => SubstrateApp> = {
acala: newAcalaApp,
'aleph-node': newAlephZeroApp,
astar: newAstarApp,
bifrost: newBifrostApp,
'bifrost-kusama': newBifrostKusamaApp,
centrifuge: newCentrifugeApp,
composable: newComposableApp,
'dock-mainnet': newDockApp,
edgeware: newEdgewareApp,
equilibrium: newEquilibriumApp,
genshiro: newGenshiroApp,
'interlay-parachain': newInterlayApp,
karura: newKaruraApp,
kusama: newKusamaApp,
'nodle-para': newNodleApp,
parallel: newParallelApp,
polkadex: newPolkadexApp,
polkadot: newPolkadotApp,
polymesh: newPolymeshApp,
sora: newSoraApp,
stafi: newStafiApp,
statemine: newStatemineApp,
statemint: newStatemintApp,
unique: newUniqueApp,
xxnetwork: newXXNetworkApp
// and maps to the known name in the @zondax/ledger-substrate/supported_apps package
export const ledgerApps: Record<string, string> = {
acala: 'Acala',
'aleph-node': 'AlephZero',
astar: 'Astar',
bifrost: 'Bifrost',
'bifrost-kusama': 'BifrostKusama',
centrifuge: 'Centrifuge',
composable: 'Composable',
'dock-mainnet': 'Dock',
edgeware: 'Edgeware',
equilibrium: 'Equilibrium',
genshiro: 'Genshiro',
'interlay-parachain': 'Interlay',
karura: 'Karura',
kusama: 'Kusama',
'nodle-para': 'Nodle',
parallel: 'Parallel',
polkadex: 'Polkadex',
polkadot: 'Polkadot',
polymesh: 'Polymesh',
sora: 'Sora',
stafi: 'Stafi',
statemine: 'Statemine',
statemint: 'Statemint',
unique: 'Unique',
xxnetwork: 'XXNetwork'
};
+1943 -257
View File
File diff suppressed because it is too large Load Diff