Skip to content

Commit

Permalink
label to psbt
Browse files Browse the repository at this point in the history
  • Loading branch information
Damilola Debel committed Aug 26, 2024
1 parent 710bc7f commit f7dbfc8
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 33 deletions.
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
"dependencies": {
"@airgap/aeternity": "0.13.32",
"@airgap/acurast": "0.13.32",
"@airgap/angular-core": "0.0.48",
"@airgap/angular-ngrx": "0.0.48",
"@airgap/angular-core": "0.0.49-beta.0",
"@airgap/angular-ngrx": "0.0.49-beta.0",
"@airgap/astar": "0.13.32",
"@airgap/bitcoin": "0.13.32",
"@airgap/coinlib-core": "0.13.32",
Expand Down
1 change: 1 addition & 0 deletions src/app/pages/select-account/select-account.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
[placeholder]="placeholder"
[wallets]="wallets"
(walletSetEmitter)="setWallet($event)"
[labels]="labels"
(dismissEmitter)="dismiss()"
></airgap-account-selection>
26 changes: 18 additions & 8 deletions src/app/pages/select-account/select-account.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export class SelectAccountPage {
public placeholder: string

public wallets: AirGapWallet[]
public labels: string[]
public symbolFilter: MainProtocolSymbols | undefined

constructor(
Expand All @@ -34,21 +35,30 @@ export class SelectAccountPage {
this.placeholder = this.translateService.instant(`select-account.${type}.placeholder`)

this.secretsService.getSecretsObservable().subscribe(async (secrets: MnemonicSecret[]) => {
const wallets: (AirGapWallet | undefined)[][] = await Promise.all(secrets.map((secret) => Promise.all(
secret.wallets.map(async (wallet: AirGapWallet) => {
return wallet.status === AirGapWalletStatus.ACTIVE && (!this.symbolFilter || (await wallet.protocol.getIdentifier() === this.symbolFilter))
? wallet
: undefined
})
)))
const wallets: (AirGapWallet | undefined)[][] = await Promise.all(
secrets.map((secret) =>
Promise.all(
secret.wallets.map(async (wallet: AirGapWallet) => {
return wallet.status === AirGapWalletStatus.ACTIVE &&
(!this.symbolFilter || (await wallet.protocol.getIdentifier()) === this.symbolFilter)
? wallet
: undefined
})
)
)
)

this.wallets = flattened(wallets).filter((wallet: AirGapWallet | undefined) => wallet !== undefined)
this.labels = secrets.map((secret) => {
console.log(secret.label)
return secret.label
})
})
}

public async setWallet(wallet: AirGapWallet) {
this.modalController
.dismiss(this.navParams.get('type') === 'message-signing' ? (await wallet.protocol.getIdentifier()) : wallet) // TODO: change to always return wallet, but it will require a change wherever the "message-signing" is used
.dismiss(this.navParams.get('type') === 'message-signing' ? await wallet.protocol.getIdentifier() : wallet) // TODO: change to always return wallet, but it will require a change wherever the "message-signing" is used
.catch((err) => console.error(err))
}

Expand Down
12 changes: 5 additions & 7 deletions src/app/services/iac/iac.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,7 @@ import {
UiEventElementsService,
UiEventService
} from '@airgap/angular-core'
import {
AirGapWallet,
AirGapWalletStatus,
MainProtocolSymbols,
UnsignedTransaction
} from '@airgap/coinlib-core'
import { AirGapWallet, AirGapWalletStatus, MainProtocolSymbols, UnsignedTransaction } from '@airgap/coinlib-core'
import { Inject, Injectable } from '@angular/core'

import { SignTransactionInfo } from '../../models/sign-transaction-info'
Expand Down Expand Up @@ -210,7 +205,10 @@ export class IACService extends BaseIACService {
}

// ETH: MetaMask requests don't contain the public key information, we need to do the matching based on the sourceFingerprint
if (!correctWallet && (signTransactionRequest.protocol === MainProtocolSymbols.ETH || signTransactionRequest.protocol === MainProtocolSymbols.OPTIMISM)) {
if (
!correctWallet &&
(signTransactionRequest.protocol === MainProtocolSymbols.ETH || signTransactionRequest.protocol === MainProtocolSymbols.OPTIMISM)
) {
const transaction: RawTypedEthereumTransaction = unsignedTransaction.transaction

const fingerprint = transaction.masterFingerprint ?? metadata.sourceFingerprint
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@
"@airgap/serializer" "^0.13.32"
"@stablelib/ed25519" "^1.0.3"

"@airgap/[email protected].48":
version "0.0.48"
resolved "https://registry.npmjs.org/@airgap/angular-core/-/angular-core-0.0.48.tgz"
integrity sha512-j3rK8AeW3ieQl+7Y/6n9ymHcLIUIxqAxtCRA7Xacgviq2jhehacU5rh3ZyP2Up8P64NsYieZirz6hbnmKistLA==
"@airgap/[email protected].49-beta.0":
version "0.0.49-beta.0"
resolved "https://registry.npmjs.org/@airgap/angular-core/-/angular-core-0.0.49-beta.0.tgz"
integrity sha512-1Rb6hGjfe+pH8FdDoOhXz3tJUuaxwwjPk1BmusV6OuPjduPcSN++fhEGE1kjOVVT+pBsP2W5X6dj3+dCdIfEow==
dependencies:
tslib "^2.3.0"

"@airgap/[email protected].48":
version "0.0.48"
resolved "https://registry.npmjs.org/@airgap/angular-ngrx/-/angular-ngrx-0.0.48.tgz"
integrity sha512-DassvxjYbWN3rPkkYIQhMXxzpiroCyIiOesoBcCgBL5xI2EQIv3jrlONTLNC5ReddP42U1y0/5W+mDo6PVHJDg==
"@airgap/[email protected].49-beta.0":
version "0.0.49-beta.0"
resolved "https://registry.npmjs.org/@airgap/angular-ngrx/-/angular-ngrx-0.0.49-beta.0.tgz"
integrity sha512-pzGzEp/DxjAj2MJVj8zLIAafCynZ1lN5Vss1To4Sy7v9Kd5Qgo6YQTBEl2xdRzPQUN1shVWpeSoVOQP3RhuwzQ==
dependencies:
tslib "^2.3.0"

Expand Down

0 comments on commit f7dbfc8

Please sign in to comment.