-
Notifications
You must be signed in to change notification settings - Fork 62
/
blockchain.ts
47 lines (42 loc) · 1.37 KB
/
blockchain.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import {
Blockchain,
BlockchainMessage,
ResponseInput,
ExtensionApp,
DesktopApp,
WebApp,
App
} from '@airgap/beacon-types'
import { TezosSaplingPermissionResponse } from './types/messages/permission-response'
import { extensionList, desktopList, webList, iOSList } from './ui/alert/wallet-lists'
export class TezosSaplingBlockchain implements Blockchain {
public readonly identifier: string = 'tezos-sapling'
async validateRequest(_input: BlockchainMessage): Promise<void> {
// No special validation required
}
async handleResponse(_input: ResponseInput): Promise<void> {
// No special response handling required.
}
async getWalletLists(): Promise<{
extensionList: ExtensionApp[]
desktopList: DesktopApp[]
webList: WebApp[]
iOSList: App[]
}> {
return {
extensionList: extensionList,
desktopList: desktopList,
webList: webList,
iOSList: iOSList
}
}
async getAccountInfosFromPermissionResponse(
permissionResponse: TezosSaplingPermissionResponse
): Promise<{ accountId: string; address: string; publicKey: string }[]> {
return permissionResponse.blockchainData.accounts.map((account) => ({
accountId: account.accountId,
address: account.address,
publicKey: account.viewingKey ?? '' // Public key or viewing key is not shared in permission request for privacy reasons
}))
}
}