Skip to content

Commit

Permalink
Merge pull request #339 from nova-wallet/hotfix/watchonly-chain-account
Browse files Browse the repository at this point in the history
Fix watch only wallet crypto type
  • Loading branch information
ERussel committed Aug 3, 2022
2 parents fd0c798 + 3e28968 commit 4eb9bb8
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ final class WatchOnlyWalletOperationFactory: WatchOnlyWalletOperationFactoryProt
let substrateAccountId = try request.substrateAddress.toAccountId()
let evmAddress = try request.evmAddress?.toAccountId()

let substrateCryptoType = MultiassetCryptoType.sr25519.rawValue

return MetaAccountModel(
metaId: UUID().uuidString,
name: request.name,
substrateAccountId: substrateAccountId,
substrateCryptoType: 0,
substrateCryptoType: substrateCryptoType,
substratePublicKey: substrateAccountId,
ethereumAddress: evmAddress,
ethereumPublicKey: evmAddress,
Expand All @@ -38,11 +40,14 @@ final class WatchOnlyWalletOperationFactory: WatchOnlyWalletOperationFactoryProt
ClosureOperation {
let accountId = try newAddress.toAccountId(using: chain.chainFormat)

let cryptoType = chain.isEthereumBased ? MultiassetCryptoType.ethereumEcdsa :
MultiassetCryptoType.sr25519

let chainAccount = ChainAccountModel(
chainId: chain.chainId,
accountId: accountId,
publicKey: accountId,
cryptoType: 0
cryptoType: cryptoType.rawValue
)

return wallet.replacingChainAccount(chainAccount)
Expand Down

0 comments on commit 4eb9bb8

Please sign in to comment.