Skip to content

Commit

Permalink
Merge branch 'develop' into 'master'
Browse files Browse the repository at this point in the history
Develop

See merge request papers/airgap/airgap-wallet!604
  • Loading branch information
AndreasGassmann committed Sep 21, 2022
2 parents d38d18f + 15015e2 commit 0885576
Show file tree
Hide file tree
Showing 7 changed files with 711 additions and 1,051 deletions.
1,506 changes: 605 additions & 901 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
"dependencies": {
"@airgap/angular-core": "0.0.31",
"@airgap/angular-ngrx": "0.0.31",
"@airgap/beacon-sdk": "3.1.1",
"@airgap/coinlib-core": "0.13.5",
"@airgap/beacon-sdk": "3.1.5-beta.0",
"@airgap/coinlib-core": "0.13.6",
"@airgap/sapling-wasm": "0.0.7",
"@angular/animations": "^11.2.9",
"@angular/common": "^11.2.9",
Expand Down Expand Up @@ -107,7 +107,7 @@
"@obsidiansystems/hw-app-xtz": "^4.72.3",
"@robingenz/capacitor-android-dark-mode-support": "^1.0.1",
"@sentry/browser": "6.2.5",
"@taquito/taquito": "^10.0.0",
"@taquito/taquito": "14.0.0",
"@types/ledgerhq__hw-transport": "^4.21.2",
"@types/ledgerhq__hw-transport-u2f": "^4.21.1",
"@types/ledgerhq__hw-transport-webusb": "^4.70.0",
Expand Down
55 changes: 15 additions & 40 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
ICoinSubProtocol,
MainProtocolSymbols,
NetworkType,
TezblockBlockExplorer,
TezosBlockExplorer,
TezosFA1p2Protocol,
TezosFA2Protocol,
TezosFA2ProtocolConfig,
Expand All @@ -30,7 +30,7 @@ import {
TezosNetwork,
TezosProtocol,
TezosProtocolNetwork,
TezosProtocolNetworkExtras,
TezosIndexerClient,
TezosProtocolOptions,
TezosSaplingExternalMethodProvider,
TezosShieldedTezProtocol
Expand Down Expand Up @@ -201,33 +201,17 @@ export class AppComponent implements AfterViewInit {
}

private async initializeProtocols(): Promise<void> {
const jakartanetNetwork: TezosProtocolNetwork = new TezosProtocolNetwork(
'Jakartanet',
const ghostnetNetwork: TezosProtocolNetwork = new TezosProtocolNetwork(
'Ghostnet',
NetworkType.TESTNET,
'https://tezos-jakartanet-node.prod.gke.papers.tech',
new TezblockBlockExplorer('https//jakartanet.tezblock.io'),
new TezosProtocolNetworkExtras(
TezosNetwork.JAKARTANET,
'https://tezos-jakartanet-conseil.prod.gke.papers.tech',
TezosNetwork.JAKARTANET,
'airgap00391'
)
)
const jakartanetProtocol: TezosProtocol = new TezosProtocol(new TezosProtocolOptions(jakartanetNetwork))

const ithacanetNetwork: TezosProtocolNetwork = new TezosProtocolNetwork(
'Ithacanet',
NetworkType.TESTNET,
'https://tezos-ithacanet-node.prod.gke.papers.tech',
new TezblockBlockExplorer('https//ithacanet.tezblock.io'),
new TezosProtocolNetworkExtras(
TezosNetwork.ITHACANET,
'https://tezos-ithacanet-conseil.prod.gke.papers.tech',
TezosNetwork.ITHACANET,
'airgap00391'
)
'https://tezos-ghostnet-node.prod.gke.papers.tech',
new TezosBlockExplorer('https://ghostnet.tzkt.io'),
{
network: TezosNetwork.GHOSTNET,
indexerClient: new TezosIndexerClient('https://tezos-ghostnet-indexer.prod.gke.papers.tech')
}
)
const ithacanetProtocol: TezosProtocol = new TezosProtocol(new TezosProtocolOptions(ithacanetNetwork))
const ghostnetProtocol: TezosProtocol = new TezosProtocol(new TezosProtocolOptions(ghostnetNetwork))

const externalMethodProvider:
| TezosSaplingExternalMethodProvider
Expand All @@ -241,11 +225,8 @@ export class AppComponent implements AfterViewInit {
)

this.protocolService.init({
extraActiveProtocols: [ithacanetProtocol, shieldedTezProtocol, jakartanetProtocol],
extraPassiveSubProtocols: [
[jakartanetProtocol, new TezosKtProtocol(new TezosProtocolOptions(jakartanetNetwork))],
[ithacanetProtocol, new TezosKtProtocol(new TezosProtocolOptions(ithacanetNetwork))]
]
extraActiveProtocols: [ghostnetProtocol, shieldedTezProtocol],
extraPassiveSubProtocols: [[ghostnetProtocol, new TezosKtProtocol(new TezosProtocolOptions(ghostnetNetwork))]]
})

await Promise.all([this.getGenericSubProtocols(), this.initializeTezosDomains()])
Expand All @@ -268,12 +249,7 @@ export class AppComponent implements AfterViewInit {
tezosOptions.network.type,
tezosOptions.network.rpcUrl,
tezosOptions.network.blockExplorer,
new TezosProtocolNetworkExtras(
tezosOptions.network.extras.network,
tezosOptions.network.extras.conseilUrl,
tezosOptions.network.extras.conseilNetwork,
tezosOptions.network.extras.conseilApiKey
)
tezosOptions.network.extras
)
if (
tezosProtocolNetwork.type === NetworkType.TESTNET &&
Expand Down Expand Up @@ -334,8 +310,7 @@ export class AppComponent implements AfterViewInit {
private async initializeTezosDomains(): Promise<void> {
const tezosDomainsAddresses: Record<TezosNetwork, string | undefined> = {
[TezosNetwork.MAINNET]: 'KT1GBZmSxmnKJXGMdMLbugPfLyUPmuLSMwKS',
[TezosNetwork.ITHACANET]: undefined,
[TezosNetwork.JAKARTANET]: undefined
[TezosNetwork.GHOSTNET]: undefined
}

const tezosNetworks: TezosProtocolNetwork[] = (await this.protocolService.getNetworksForProtocol(
Expand Down
46 changes: 23 additions & 23 deletions src/app/models/ActionGroup.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import { AirGapCoinWallet, AirGapMarketWallet, ICoinProtocol } from '@airgap/coinlib-core'
import { MainProtocolSymbols, SubProtocolSymbols } from '@airgap/coinlib-core'
import { Action } from '@airgap/coinlib-core/actions/Action'
import { ImportAccountAction, ImportAccoutActionContext } from '@airgap/coinlib-core/actions/GetKtAccountsAction'
import { LinkedAction } from '@airgap/coinlib-core/actions/LinkedAction'
import { SimpleAction } from '@airgap/coinlib-core/actions/SimpleAction'
import { CosmosDelegationActionType } from '@airgap/coinlib-core/protocols/cosmos/CosmosProtocol'
import { SubProtocolType } from '@airgap/coinlib-core/protocols/ICoinSubProtocol'
import { MainProtocolSymbols, SubProtocolSymbols } from '@airgap/coinlib-core'

import { AccountTransactionListPage } from '../pages/account-transaction-list/account-transaction-list'
import { DataServiceKey } from '../services/data/data.service'
import { ErrorCategory, handleErrorSentry } from '../services/sentry-error-handler/sentry-error-handler'

import { AddTokenAction, AddTokenActionContext } from './actions/AddTokenAction'
import { ButtonAction, ButtonActionContext } from './actions/ButtonAction'
import { CollectiblesAction } from './actions/CollectiblesAction'
import { AirGapDelegatorAction, AirGapDelegatorActionContext } from './actions/DelegatorAction'
import { FundAccountAction } from './actions/FundAccountAction'
import { AirGapTezosMigrateAction } from './actions/TezosMigrateAction'
// import { FundAccountAction } from './actions/FundAccountAction'
import { CollectiblesAction } from './actions/CollectiblesAction'

interface DelegatorButtonActionContext extends ButtonActionContext {
type: any
Expand All @@ -39,9 +39,9 @@ export class ActionGroup {
actionMap.set(SubProtocolSymbols.XTZ_KT, async () => {
return this.getTezosKTActions()
})
// actionMap.set(MainProtocolSymbols.XTZ_SHIELDED, async () => {
// return this.getTezosShieldedTezActions()
// })
actionMap.set(MainProtocolSymbols.XTZ_SHIELDED, async () => {
return this.getTezosShieldedTezActions()
})
actionMap.set(MainProtocolSymbols.ETH, async () => {
return this.getEthereumActions()
})
Expand Down Expand Up @@ -152,23 +152,23 @@ export class ActionGroup {
return [migrateAction]
}

// private getTezosShieldedTezActions(): Action<any, any>[] {
// const fundAction: ButtonAction<void, void> = new ButtonAction(
// { name: 'account-transaction-list.fund_label', icon: 'logo-usd', identifier: 'fund-action' },
// () => {
// const action = new FundAccountAction({
// wallet: this.callerContext.wallet,
// accountProvider: this.callerContext.accountProvider,
// dataService: this.callerContext.dataService,
// router: this.callerContext.router
// })

// return action
// }
// )

// return [fundAction]
// }
private getTezosShieldedTezActions(): Action<any, any>[] {
const fundAction: ButtonAction<void, void> = new ButtonAction(
{ name: 'account-transaction-list.fund_label', icon: 'logo-usd', identifier: 'fund-action' },
() => {
const action = new FundAccountAction({
wallet: this.callerContext.wallet,
accountProvider: this.callerContext.accountProvider,
dataService: this.callerContext.dataService,
router: this.callerContext.router
})

return action
}
)

return [fundAction]
}

private async getCosmosActions(): Promise<Action<any, any>[]> {
const delegateButtonAction = this.createDelegateButtonAction()
Expand Down
4 changes: 2 additions & 2 deletions src/app/pages/transaction-confirm/transaction-confirm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,15 +268,15 @@ export class TransactionConfirmPage {
new BigNumber(wallet.protocol.feeDefaults.medium).shiftedBy(wallet.protocol.feeDecimals).toString(),
true
)

const airGapTxs = await protocol.getTransactionDetails(
{
publicKey: wallet.publicKey,
transaction: unsignedTx
},
{ knownViewingKeys: this.accountService.getKnownViewingKeys() }
)

this.accountService.startInteraction(wallet, unsignedTx, IACMessageType.TransactionSignRequest, airGapTxs)
} catch (error) {
this.toastCtrl
Expand Down
74 changes: 28 additions & 46 deletions src/app/services/beacon/beacon.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,8 @@ import {
import { Injectable } from '@angular/core'
import { LoadingController, ModalController, ToastController } from '@ionic/angular'
import { ICoinProtocol, MainProtocolSymbols, RawEthereumTransaction } from '@airgap/coinlib-core'
import { TezosNetwork, TezosProtocol } from '@airgap/coinlib-core/protocols/tezos/TezosProtocol'
import {
TezblockBlockExplorer,
TezosProtocolNetwork,
TezosProtocolNetworkExtras,
TezosProtocolOptions
} from '@airgap/coinlib-core/protocols/tezos/TezosProtocolOptions'
import { TezosProtocol } from '@airgap/coinlib-core/protocols/tezos/TezosProtocol'
import { TezosBlockExplorer, TezosProtocolNetwork, TezosProtocolOptions } from '@airgap/coinlib-core/protocols/tezos/TezosProtocolOptions'
import { ProtocolService } from '@airgap/angular-core'
import { NetworkType } from '@airgap/coinlib-core/utils/ProtocolNetwork'
import { BeaconRequestPage } from 'src/app/pages/beacon-request/beacon-request.page'
Expand Down Expand Up @@ -220,8 +215,7 @@ export class BeaconService {
network &&
network.type &&
(network.type === BeaconNetworkType.MAINNET ||
network.type === BeaconNetworkType.ITHACANET ||
network.type === BeaconNetworkType.JAKARTANET ||
network.type === BeaconNetworkType.GHOSTNET ||
network.type === BeaconNetworkType.CUSTOM)
)
}
Expand Down Expand Up @@ -293,7 +287,7 @@ export class BeaconService {
error.data && Array.isArray(error.data)
? `The contract returned the following error: ${error.data.find((f) => f && f.with && f.with.string).with.string}`
: error.message
} catch { }
} catch {}

console.error('error.message', errorMessage)

Expand All @@ -307,7 +301,19 @@ export class BeaconService {

public async getProtocolBasedOnBeaconNetwork(network: Network): Promise<TezosProtocol> {
const configs: {
[key in Exclude<BeaconNetworkType, BeaconNetworkType.DELPHINET | BeaconNetworkType.EDONET | BeaconNetworkType.FLORENCENET | BeaconNetworkType.GRANADANET | BeaconNetworkType.HANGZHOUNET>]: TezosProtocolNetwork
[key in Exclude<
BeaconNetworkType,
| BeaconNetworkType.DELPHINET
| BeaconNetworkType.EDONET
| BeaconNetworkType.FLORENCENET
| BeaconNetworkType.GRANADANET
| BeaconNetworkType.HANGZHOUNET
| BeaconNetworkType.JAKARTANET
| BeaconNetworkType.ITHACANET
| BeaconNetworkType.KATHMANDUNET
| BeaconNetworkType.MONDAYNET
| BeaconNetworkType.DAILYNET
>]: TezosProtocolNetwork
} = {
[BeaconNetworkType.MAINNET]: {
identifier: undefined,
Expand All @@ -317,48 +323,29 @@ export class BeaconService {
blockExplorer: undefined,
extras: {
network: undefined,
conseilUrl: undefined,
conseilNetwork: undefined,
conseilApiKey: undefined
}
},
[BeaconNetworkType.JAKARTANET]: {
identifier: undefined,
name: network.name || 'Jakartanet',
type: NetworkType.TESTNET,
rpcUrl: network.rpcUrl || 'https://tezos-jakartanet-node.prod.gke.papers.tech',
blockExplorer: new TezblockBlockExplorer('https://jakartanet.tezblock.io'),
extras: {
network: TezosNetwork.JAKARTANET,
conseilUrl: 'https://tezos-jakartanet-conseil.prod.gke.papers.tech',
conseilNetwork: TezosNetwork.JAKARTANET,
conseilApiKey: 'airgap00391'
indexerClient: undefined
}
},
[BeaconNetworkType.ITHACANET]: {
[BeaconNetworkType.GHOSTNET]: {
identifier: undefined,
name: network.name || 'Ithacanet',
name: network.name || 'Ghostnet',
type: NetworkType.TESTNET,
rpcUrl: network.rpcUrl || 'https://tezos-ithacanet-node.prod.gke.papers.tech',
blockExplorer: new TezblockBlockExplorer('https://ithacanet.tezblock.io'),
rpcUrl: network.rpcUrl || 'https://tezos-ghostnet-node.prod.gke.papers.tech',
blockExplorer: new TezosBlockExplorer('https://ghostnet.tzkt.io'),
extras: {
network: TezosNetwork.ITHACANET,
conseilUrl: 'https://tezos-ithacanet-conseil.prod.gke.papers.tech',
conseilNetwork: TezosNetwork.ITHACANET,
conseilApiKey: 'airgap00391'
network: undefined,
indexerClient: undefined
}
},
[BeaconNetworkType.CUSTOM]: {
identifier: undefined,
name: network.name || 'Custom Network',
type: NetworkType.CUSTOM,
rpcUrl: network.rpcUrl || '',
blockExplorer: new TezblockBlockExplorer(''),
blockExplorer: new TezosBlockExplorer(''),
extras: {
network: TezosNetwork.MAINNET,
conseilUrl: '',
conseilNetwork: TezosNetwork.MAINNET,
conseilApiKey: ''
network: undefined,
indexerClient: undefined
}
}
}
Expand All @@ -370,12 +357,7 @@ export class BeaconService {
configs[network.type].type,
configs[network.type].rpcUrl,
configs[network.type].blockExplorer,
new TezosProtocolNetworkExtras(
configs[network.type].extras.network,
configs[network.type].extras.conseilUrl,
configs[network.type].extras.conseilNetwork,
configs[network.type].extras.conseilApiKey
)
configs[network.type].extras
)
)
)
Expand Down
Loading

0 comments on commit 0885576

Please sign in to comment.