Skip to content

Commit

Permalink
feat: add ledger integration
Browse files Browse the repository at this point in the history
  • Loading branch information
nsonanh committed Sep 13, 2023
1 parent 8ca949b commit 986e03b
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/core/utils/Ledger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const CLA_FIELD = 0xe0;
* @example
* import { SymbolLedger } from '@/core/utils/Ledger'
* const sym = new SymbolLedger();
"44'/4343'/account'/change/accountIndex"
"44'/10111'/account'/change/accountIndex"
*/

export class SymbolLedger {
Expand Down
2 changes: 1 addition & 1 deletion src/core/validation/validators/DerivationPathValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class DerivationPathValidator {
*/
public static validate(value: any, networkType: NetworkType): boolean {
if (networkType === NetworkType.MAIN_NET) {
if (value.match(/^m\/44'\/4343'\/[0-9]+'\/[0-9]+'\/[0-9]+'/)) {
if (value.match(/^m\/44'\/10111'\/[0-9]+'\/[0-9]+'\/[0-9]+'/)) {
return value;
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/services/AccountService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class AccountService {
* Default account derivation path
* @var {string}
*/
private static readonly DEFAULT_ACCOUNT_PATH_MAIN_NET = `m/44'/4343'/0'/0'/0'`;
private static readonly DEFAULT_ACCOUNT_PATH_MAIN_NET = `m/44'/10111'/0'/0'/0'`;
private static readonly DEFAULT_ACCOUNT_PATH_TEST_NET = `m/44'/1'/0'/0'/0'`;

public getAccounts(): AccountModel[] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,10 @@ export class ModalTransactionConfirmationTs extends Vue {
if (signerPublicKey === this.currentAccount.publicKey.toLowerCase()) {
const publicKey = signerPublicKey;
const ledgerAccount = PublicAccount.createFromPublicKey(publicKey.toUpperCase(), networkType);
const multisigAccount = PublicAccount.createFromPublicKey(this.command.signerPublicKey, this.networkType);
let multisigAccount;
if (this.command.signerPublicKey) {
multisigAccount = PublicAccount.createFromPublicKey(this.command.signerPublicKey, this.networkType);
}
const stageTransactions = this.command.stageTransactions;
const maxFee = stageTransactions.sort((a, b) => a.maxFee.compare(b.maxFee))[0].maxFee;
// - open signature modal
Expand Down
2 changes: 0 additions & 2 deletions src/views/pages/profiles/access-ledger/AccessLedgerTs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,6 @@ export default class AccessLedgerTs extends Vue {
async mounted() {
this.accountService = new AccountService();
await this.$store.dispatch('temporary/initialize');
this.$store.commit('account/resetSelectedAddressesToInteract');
this.$store.commit('account/resetSelectedAddressesOptInToInteract');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ export default class ImportStrategyTs extends Vue {
description: 'import_mnemonic_passphrase_create_profile',
route: 'profiles.importProfile.info',
},
// {
// image: walletTypeImages.ledgerImg,
// title: 'access_ledger',
// description: 'access_your_ledger_account',
// route: 'profiles.accessLedger.info',
// },
{
image: walletTypeImages.ledgerImg,
title: 'access_ledger',
description: 'access_your_ledger_account',
route: 'profiles.accessLedger.info',
},
];

/**
Expand Down
3 changes: 3 additions & 0 deletions src/views/resources/Images.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import createImg from '@/views/resources/img/icons/Read.svg';
// @ts-ignore
import seedImg from '@/views/resources/img/icons/Incoming.svg';
// @ts-ignore
import ledgerImg from '@/views/resources/img/login/ledger.png';
// @ts-ignore
import importStepImage1 from '@/views/resources/img/login/1_4.png';
// @ts-ignore
import importStepImage2 from '@/views/resources/img/login/2_4.png';
Expand Down Expand Up @@ -125,6 +127,7 @@ import infoWhite from '@/views/resources/img/icons/info-white.png';
export const walletTypeImages = {
createImg,
seedImg,
ledgerImg,
};

export const importStepImage = {
Expand Down
Binary file added src/views/resources/img/login/ledger.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 986e03b

Please sign in to comment.