import axios from 'axios'
import React, { FC } from 'react'
import { Button, View } from 'react-native'
import { BackupMethods, usePortal } from '@portal-hq/core'
const ProvisionWalletButton: FC = () => {
const portal = usePortal()
const handleProvisionWallet = async () => {
// Get the existing encrypted client backup share from your API.
const backupShare = await axios.get('/clients/[clientId]/backup')
// Set the new signing share by running provisionWallet.
await portal.provisionWallet(
backupShare,
BackupMethods.GoogleDrive, /* or BackupMethods.iCloud */
)
}
return (
<View>
<Button onPress={handleProvisionWallet} title="Provision your wallet" />
</View>
)
}
export default ProvisionWalletButton