Skip to content

Commit

Permalink
feat: adds smart contract info in send confirmation popup
Browse files Browse the repository at this point in the history
  • Loading branch information
jeeanribeiro committed Nov 29, 2022
1 parent 136964c commit 49bb511
Showing 1 changed file with 25 additions and 2 deletions.
Expand Up @@ -14,6 +14,7 @@
BasicActivityDetails,
ActivityInformation,
} from 'shared/components'
import { Tab } from 'shared/components/enums'
import type { OutputOptions } from '@iota/wallet'
import { prepareOutput, selectedAccount } from '@core/account'
import { localize } from '@core/i18n'
Expand All @@ -38,6 +39,13 @@
import { ledgerPreparedOutput } from '@core/ledger'
import { getStorageDepositFromOutput } from '@core/wallet/utils/generateActivity/helper'
import { handleError } from '@core/error/handlers/handleError'
import {
ACCOUNTS_CONTRACT,
CONTRACT_FUNCTIONS,
GAS_BUDGET,
TARGET_CONTRACTS,
TRANSFER_ALLOWANCE,
} from '@core/layer-2'
export let _onMount: (..._: any[]) => Promise<void> = async () => {}
export let disableBack = false
Expand All @@ -58,6 +66,7 @@
let expirationTimePicker: ExpirationTimePicker
let initialExpirationDate: ExpirationTime = getInitialExpirationDate()
let activeTab: Tab
$: transactionDetails = get(newTransactionDetails)
$: recipientAddress = recipient.type === 'account' ? recipient.account.depositAddress : recipient.address
Expand All @@ -78,6 +87,18 @@
type: ActivityType.Basic,
direction: ActivityDirection.Outgoing,
inclusionState: InclusionState.Pending,
...(layer2Parameters?.networkAddress && {
layer2Parameters: {
...transactionDetails.layer2Parameters,
gasBudget: GAS_BUDGET,
},
}),
...(layer2Parameters?.networkAddress && {
parsedLayer2Metadata: {
targetContract: TARGET_CONTRACTS[ACCOUNTS_CONTRACT],
contractFunction: CONTRACT_FUNCTIONS[TRANSFER_ALLOWANCE],
},
}),
}
$: asset =
Expand Down Expand Up @@ -196,7 +217,9 @@
{:else if transactionDetails.type === NewTransactionType.NftTransfer}
<NftActivityDetails {activity} />
{/if}
<ActivityInformation {activity} networkAddress={layer2Parameters?.networkAddress} />
<div class="pt-4">
<ActivityInformation {activity} networkAddress={layer2Parameters?.networkAddress} bind:activeTab />
</div>
{#if !hideGiftToggle}
<KeyValueBox keyText={localize('general.giftStorageDeposit')}>
<Toggle
Expand All @@ -208,7 +231,7 @@
/>
</KeyValueBox>
{/if}
{#if initialExpirationDate !== undefined}
{#if initialExpirationDate !== undefined && activeTab === Tab.Transaction}
<KeyValueBox keyText={localize('general.expirationTime')}>
<ExpirationTimePicker
slot="value"
Expand Down

0 comments on commit 49bb511

Please sign in to comment.