Skip to content

Commit

Permalink
Merge pull request #3391 from Koniverse/koni/dev/issue-2982_new
Browse files Browse the repository at this point in the history
[Issue-2982] Integrate Avail Ledger app
  • Loading branch information
saltict authored Jul 30, 2024
2 parents 5c51ff1 + 0f5a3c3 commit ff957f2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ const Component: React.FC<Props> = (props: Props) => {
}, [addExtraData, chain, isMessage, isMetadataOutdated, isMissingData, isRuntimeUpdated, loadingChain, networkName, signMode, t]);

const activeLedger = useMemo(() => isLedger && !loadingChain && alertData?.type !== 'error', [isLedger, loadingChain, alertData?.type]);
const forceUseMigrationApp = useMemo(() => isRuntimeUpdated || (isMessage && chainSlug !== 'avail_mainnet'), [isRuntimeUpdated, isMessage, chainSlug]);

const { error: ledgerError,
isLoading: isLedgerLoading,
Expand All @@ -255,7 +256,7 @@ const Component: React.FC<Props> = (props: Props) => {
refresh: refreshLedger,
signMessage: ledgerSignMessage,
signTransaction: ledgerSignTransaction,
warning: ledgerWarning } = useLedger(chainSlug, activeLedger, true, isRuntimeUpdated || isMessage, account.originGenesisHash);
warning: ledgerWarning } = useLedger(chainSlug, activeLedger, true, forceUseMigrationApp, account.originGenesisHash);

const isLedgerConnected = useMemo(() => !isLocked && !isLedgerLoading && !!ledger, [isLedgerLoading, isLocked, ledger]);

Expand Down
15 changes: 14 additions & 1 deletion packages/extension-koni-ui/src/constants/ledger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,19 @@ export const PredefinedLedgerNetwork: LedgerNetwork[] = [
slip44: 434,
isHide: true
},
{
accountName: 'Avail',
appName: 'Avail',
networkName: 'Avail network',
genesisHash: ChainInfoMap.avail_mainnet.substrateInfo?.genesisHash || '0xb91746b45e0346cc2f815a520b9c6cb4d5c0902af848db0a80f85932d2e8276a',
icon: 'substrate',
network: 'avail',
slug: ChainInfoMap.avail_mainnet.slug,
isDevMode: false,
isGeneric: false,
isEthereum: false,
slip44: 709
},
{
accountName: 'Acala',
appName: 'Acala',
Expand Down Expand Up @@ -501,7 +514,7 @@ export const BLOCK_DEFAULT_LEDGER_NETWORKS: string[] = ['*'];
export const BLOCK_TRANSFER_NATIVE_LEDGER_NETWORKS: string[] = [];
export const BLOCK_TRANSFER_TOKEN_LEDGER_NETWORKS: string[] = [];
export const BLOCK_TRANSFER_XCM_LEDGER_NETWORKS: string[] = ['*'];
export const BLOCK_TRANSFER_NFT_LEDGER_NETWORKS: string[] = ['astar'];
export const BLOCK_TRANSFER_NFT_LEDGER_NETWORKS: string[] = ['astar', 'avail_mainnet'];
/* TRANSFER */

/* STAKING */
Expand Down

1 comment on commit ff957f2

@saltict
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.