Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: send nft button #5329

Merged
merged 4 commits into from
Dec 2, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
import { getNftByIdFromAllAccountNfts, INft } from '@core/nfts'
import { selectedAccountIndex } from '@core/account'
import { truncateString } from '@core/utils'
import { selectedAccountActivities } from '@core/wallet/stores'
import { NewTransactionType, selectedAccountActivities, setNewTransactionDetails } from '@core/wallet/stores'
import { ActivityType, formatTokenAmountPrecise } from '@core/wallet'
import { BASE_TOKEN } from '@core/network/constants'
import { activeProfile } from '@core/profile/stores'
import { Platform } from '@core/app'
import { ExplorerEndpoint, getOfficialExplorerUrl } from '@core/network'
import { openPopup } from '@auxiliary/popup'

const explorerUrl = getOfficialExplorerUrl($activeProfile?.networkProtocol, $activeProfile?.networkType)
const nft: INft = getNftByIdFromAllAccountNfts($selectedAccountIndex, $selectedNftId)
Expand Down Expand Up @@ -59,6 +60,18 @@
function handleExplorerClick(): void {
Platform.openUrl(`${explorerUrl}/${ExplorerEndpoint.Nft}/${id}`)
}

function handleSendClick(): void {
setNewTransactionDetails({
type: NewTransactionType.NftTransfer,
nftId: id,
recipient: undefined,
})
openPopup({
type: 'sendForm',
overflow: true,
})
}
</script>

<div class="flex flex-row w-full h-full space-x-4 overflow-auto">
Expand Down Expand Up @@ -115,7 +128,7 @@
<Button outline classes="flex-1" onClick={handleExplorerClick} disabled={!explorerUrl}
>{localize('general.viewOnExplorer')}</Button
>
<Button classes="flex-1">{localize('actions.send')}</Button>
<Button classes="flex-1" onClick={handleSendClick}>{localize('actions.send')}</Button>
</div>
</Pane>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
TARGET_CONTRACTS,
TRANSFER_ALLOWANCE,
} from '@core/layer-2'
import { dashboardRouter } from '@core/router'

export let _onMount: (..._: any[]) => Promise<void> = async () => {}
export let disableBack = false
Expand Down Expand Up @@ -165,6 +166,7 @@

async function sendOutputAndClosePopup(): Promise<void> {
await sendOutput(preparedOutput)
$dashboardRouter.reset()
closePopup()
}

Expand Down