Skip to content

Commit

Permalink
Merge branch 'develop' into release/desktop-1.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuditi authored May 23, 2024
2 parents 3b437fc + 8fc10f7 commit d287e48
Show file tree
Hide file tree
Showing 46 changed files with 166 additions and 146 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
let baseCoinTransfer: TokenTransferData | undefined
let isSmartContractCall = false
let methodName: string | undefined = undefined
let inputs: IParsedInput[] | undefined = undefined
let inputs: Record<string, unknown> | undefined = undefined
let busy = false
let selectedGasSpeed = GasSpeed.Required
Expand Down Expand Up @@ -89,7 +89,10 @@
)
methodName = parsedData?.parsedMethod?.name
inputs = parsedData?.parsedMethod?.inputs
inputs = parsedData?.parsedMethod?.inputs.reduce((acc, input: IParsedInput) => {
acc[input.name] = input.value
return acc
}, {})
switch (parsedData?.type) {
case ParsedSmartContractType.CoinTransfer: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { requestTokensFromFaucet } from '@contexts/developer'
import { localize } from '@core/i18n'
import { getL1Network } from '@core/network'
import { getStardustNetwork } from '@core/network'
import { closePopup } from '@desktop/auxiliary/popup'
import { Error } from '@bloomwalletio/ui'
import { handleError } from '@core/error/handlers/handleError'
Expand All @@ -10,7 +10,7 @@
let isBusy = false
let error: string | undefined
const network = getL1Network()
const network = getStardustNetwork()
async function onConfirmClick(): Promise<void> {
error = undefined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import PopupTemplate from '../PopupTemplate.svelte'
import { IAccountState } from '@core/account'
import { getProposalStatusForMilestone } from '@contexts/governance'
import { getL1Network } from '@core/network/stores'
import { getStardustNetwork } from '@core/network/stores'
function onCancelClick(): void {
closePopup()
Expand Down Expand Up @@ -49,7 +49,7 @@
}
// TODO: User can only remove a proposal when he is not voting for it
const { currentMilestone } = getL1Network()
const { currentMilestone } = getStardustNetwork()
$: status = getProposalStatusForMilestone($currentMilestone, $selectedProposal?.milestones)
$: showAlert = status === EventStatus.Commencing || status === EventStatus.Holding
</script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<script lang="ts">
import { IconName } from '@bloomwalletio/ui'
import { localize } from '@core/i18n'
import { FAUCET_URLS, getL1Network } from '@core/network'
import { FAUCET_URLS, getStardustNetwork } from '@core/network'
import { PopupId, openPopup } from '@desktop/auxiliary/popup'
import { ButtonTile } from '../../../components'
const network = getL1Network()
const network = getStardustNetwork()
function onGetTokensClick(): void {
openPopup({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
import { onMount } from 'svelte'
import { ProposalStatusInfo } from './'
import { getTimeDifference, milestoneToDate } from '@core/utils'
import { getL1Network } from '@core/network/stores'
import { getStardustNetwork } from '@core/network/stores'
import { time } from '@core/app/stores'
export let proposal: IProposalWithStatus
let hasVoted = false
const currentMilestone = getL1Network().currentMilestone
const currentMilestone = getStardustNetwork().currentMilestone
$: $participationOverviewForSelectedAccount, proposal, setHasVoted()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import { ProposalCard } from './'
import ProposalListMenu from './ProposalListMenu.svelte'
import { localize } from '@core/i18n'
import { getL1Network } from '@core/network'
import { getStardustNetwork } from '@core/network'
const { currentMilestone } = getL1Network()
const { currentMilestone } = getStardustNetwork()
$: proposals = getProposalsWithStatus($registeredProposalsForSelectedAccount, $currentMilestone)
let searchTerm = ''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import { openPopup } from '@desktop/auxiliary/popup/actions'
import { PopupId } from '@desktop/auxiliary/popup'
import { localize } from '@core/i18n'
import { getL1Network } from '@core/network/stores'
import { getStardustNetwork } from '@core/network/stores'
export let onQuestionClick: (questionIndex: number) => void
export let onAnswerClick: (answerValue: number, questionIndex: number) => void
Expand All @@ -31,7 +31,7 @@
let percentages: IProposalAnswerPercentages = {}
let winnerAnswerIndex: number
const { currentMilestone } = getL1Network()
const { currentMilestone } = getStardustNetwork()
$: status = getProposalStatusForMilestone($currentMilestone, $selectedProposal?.milestones)
$: answers = [...(question?.answers ?? []), { value: 0, text: 'Abstain', additionalInfo: '' }]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
import { formatDate, localize } from '@core/i18n'
import { DATE_FORMAT, milestoneToDate } from '@core/utils'
import { getL1Network } from '@core/network/stores'
import { getStardustNetwork } from '@core/network/stores'
export let milestones: Record<EventStatus, number>
export let status: EventStatus
export let anchor: HTMLElement
export let placement: 'top' | 'bottom' | 'left' | 'right' = 'right'
const currentMilestone = getL1Network().currentMilestone
const currentMilestone = getStardustNetwork().currentMilestone
let eventProgress: number
switch (status) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import { getTimeDifference, milestoneToDate } from '@core/utils'
import { EventStatus } from '@iota/sdk/out/types'
import { ProposalDetailsMenu, ProposalStatusPill } from '../'
import { getL1Network } from '@core/network/stores'
import { getStardustNetwork } from '@core/network/stores'
export let proposal: IProposal
const currentMilestone = getL1Network().currentMilestone
const currentMilestone = getStardustNetwork().currentMilestone
let remainingTime: string = ''
$: switch (proposal?.status) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
} from '@contexts/governance/utils'
import { selectedAccount } from '@core/account/stores'
import { formatDate, localize } from '@core/i18n'
import { getL1Network } from '@core/network/stores'
import { getStardustNetwork } from '@core/network/stores'
import { activeProfile } from '@core/profile/stores'
import { formatTokenAmount } from '@core/token'
import { visibleSelectedAccountTokens } from '@core/token/stores'
Expand All @@ -23,7 +23,7 @@
milestone: number
}
const currentMilestone = getL1Network().currentMilestone
const currentMilestone = getStardustNetwork().currentMilestone
$: proposalDateData = getNextProposalDateData($currentMilestone)
function getNextProposalDateData(_currentMilestone: number): IProposalDateData | undefined {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import { selectedAccount } from '@core/account/stores'
import { handleError } from '@core/error/handlers'
import { localize } from '@core/i18n'
import { getL1Network } from '@core/network/stores'
import { getStardustNetwork } from '@core/network/stores'
import { getBestTimeDuration, milestoneToDate } from '@core/utils'
import { PopupId, openPopup } from '@desktop/auxiliary/popup'
import { ProposalQuestion } from '../../components'
Expand All @@ -43,7 +43,7 @@
let openedQuestionIndex: number = -1
let isUpdatingVotedAnswerValues: boolean = false
let lastAction: 'vote' | 'stopVote'
const currentMilestone = getL1Network().currentMilestone
const currentMilestone = getStardustNetwork().currentMilestone
$: selectedProposalOverview = $participationOverviewForSelectedAccount?.participations?.[$selectedProposal?.id]
$: trackedParticipations = Object.values(selectedProposalOverview ?? {})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
} from '@contexts/governance'
import { Text, Progress, TooltipIcon } from '@bloomwalletio/ui'
import { getDecimalSeparator, localize } from '@core/i18n'
import { getL1Network } from '@core/network'
import { getStardustNetwork } from '@core/network'
import { getSignificantDigitsAndRound } from '@core/utils'
export let proposal: IProposal
export let projected: boolean = false
const QUORUM_PERCENTAGE_DECIMAL = 0.05
const currentMilestone = getL1Network().currentMilestone
const currentMilestone = getStardustNetwork().currentMilestone
$: ({ actualPercentage, projectedPercentage } = getCirculatingSupplyVotedPercentage(
$selectedParticipationEventStatus,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
ProposalQuestionListPane,
QuorumProgress,
} from '../components/proposal-details'
import { getL1Network } from '@core/network'
import { getStardustNetwork } from '@core/network'
import { getProposalWithStatus } from '@contexts/governance/utils'
let statusLoaded: boolean = false
Expand All @@ -38,7 +38,7 @@
clearSelectedParticipationEventStatus()
})
const { currentMilestone } = getL1Network()
const { currentMilestone } = getStardustNetwork()
$: proposal = getProposalWithStatus($selectedProposal, $currentMilestone)
</script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
NetworkType,
getEvmNetwork,
getIscChains,
getL1Network,
getStardustNetwork,
getNetwork,
isEvmNetwork,
} from '@core/network'
Expand Down Expand Up @@ -107,7 +107,7 @@
}
function getLayer1RecipientOption(accountIndexToExclude?: number): INetworkRecipientSelectorOption {
const network = getL1Network()
const network = getStardustNetwork()
return {
networkId: network.id,
name: network.name,
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Bloom Labs Ltd <[email protected]>",
"license": "PolyForm Strict License 1.0.0",
"dependencies": {
"@bloomwalletio/ui": "0.21.0",
"@bloomwalletio/ui": "0.21.1",
"@ethereumjs/common": "4.3.0",
"@ethereumjs/rlp": "5.0.2",
"@ethereumjs/tx": "5.3.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
const url = getExplorerUrl(activity.destinationNetworkId, ExplorerEndpoint.Address, address)
openUrlInBrowser(url)
}
// change inputs from object with index as key to object with name as key
$: inputs = activity.inputs?.reduce((acc, input) => {
acc[input.name] = input.value
return acc
}, {})
</script>

<Table
Expand Down Expand Up @@ -41,7 +47,7 @@
},
{
key: localize('general.inputs'),
value: activity.inputs,
value: inputs,
},
{
key: localize('general.data'),
Expand Down
4 changes: 4 additions & 0 deletions packages/shared/src/components/avatars/NetworkAvatar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
[SupportedNetworkId.ShimmerEvm]: 'shimmer-evm-background',
[SupportedNetworkId.IotaTestnetEvm]: 'iota-evm-background/90',
[SupportedNetworkId.TestnetEvm]: 'shimmer-evm-background/90',
[SupportedNetworkId.Ethereum]: '#627eea',
[SupportedNetworkId.Sepolia]: 'text-secondary',
}
const AVATAR_TEXT_COLOR: { [id in NetworkId]?: string } = {
Expand All @@ -29,6 +31,8 @@
[SupportedNetworkId.ShimmerEvm]: 'shimmer-evm',
[SupportedNetworkId.IotaTestnetEvm]: '#FFFFFF',
[SupportedNetworkId.TestnetEvm]: '#FFFFFF',
[SupportedNetworkId.Ethereum]: '#FFFFFF',
[SupportedNetworkId.Sepolia]: '#FFFFFF',
}
let anchor: HTMLElement
Expand Down
12 changes: 12 additions & 0 deletions packages/shared/src/components/avatars/TokenAvatar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@
[SupportedNetworkId.TestnetEvm]: {
[BASE_TOKEN_ID]: 'text-secondary',
},
[SupportedNetworkId.Ethereum]: {
[BASE_TOKEN_ID]: '#627eea',
},
[SupportedNetworkId.Sepolia]: {
[BASE_TOKEN_ID]: 'text-secondary',
},
}
const AVATAR_TEXT_COLOR: { [networkId: string]: { [tokenId: string]: string } } = {
Expand Down Expand Up @@ -65,6 +71,12 @@
[SupportedNetworkId.TestnetEvm]: {
[BASE_TOKEN_ID]: '#FFFFFF',
},
[SupportedNetworkId.Ethereum]: {
[BASE_TOKEN_ID]: '#FFFFFF',
},
[SupportedNetworkId.Sepolia]: {
[BASE_TOKEN_ID]: '#FFFFFF',
},
}
const IMAGE_SIZES: Record<typeof size, keyof CoinGeckoCoinImage> = {
Expand Down
4 changes: 2 additions & 2 deletions packages/shared/src/components/inputs/NetworkInput.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { IOption, SelectInput } from '@bloomwalletio/ui'
import { localize } from '@core/i18n'
import { NetworkId, getEvmNetworks, getL1Network } from '@core/network'
import { NetworkId, getEvmNetworks, getStardustNetwork } from '@core/network'
export let networkId: NetworkId | undefined
export let error: string | undefined
Expand All @@ -28,7 +28,7 @@
function getNetworkOptions(showLayer2: boolean): IOption[] {
const options: IOption[] = []
if (showLayer1) {
const l1Network = getL1Network()
const l1Network = getStardustNetwork()
options.push({ label: l1Network.name, value: l1Network.id })
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { INode } from '@iota/sdk/out/types'
import { DEFAULT_NETWORK_METADATA, EMPTY_NODE } from '@core/network/constants'
import { IClientOptions, INodeInfoResponse } from '@core/network/interfaces'
import { getL1Network } from '@core/network/stores'
import { getStardustNetwork } from '@core/network/stores'
import {
checkIfOnSameNetwork,
checkNodeUrlValidity,
Expand Down Expand Up @@ -96,7 +96,7 @@
const networkName = nodeInfoResponse?.nodeInfo?.protocol.networkName
if (options.checkSameNetwork) {
const stardustNetwork = getL1Network()
const stardustNetwork = getStardustNetwork()
const isInSameNetwork = stardustNetwork?.protocol.networkName === networkName
if (!isInSameNetwork) {
formError = localize('error.node.differentNetwork')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ export const DEFAULT_NETWORK_ICON: { [id in NetworkId]?: IconName } = {
[SupportedNetworkId.ShimmerEvm]: IconName.Shimmer,
[SupportedNetworkId.IotaTestnetEvm]: IconName.Iota,
[SupportedNetworkId.TestnetEvm]: IconName.Shimmer,
[SupportedNetworkId.Ethereum]: IconName.Ethereum,
[SupportedNetworkId.Sepolia]: IconName.Ethereum,
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,10 @@ export const DEFAULT_TOKEN_ICON: { [networkId in NetworkId]?: { [tokenId: string
[SupportedNetworkId.TestnetEvm]: {
[BASE_TOKEN_ID]: IconName.Shimmer,
},
[SupportedNetworkId.Ethereum]: {
[BASE_TOKEN_ID]: IconName.Ethereum,
},
[SupportedNetworkId.Sepolia]: {
[BASE_TOKEN_ID]: IconName.Ethereum,
},
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { get } from 'svelte/store'
import { TrackedParticipationOverview } from '@iota/sdk/out/types'
import { getL1Network } from '@core/network/stores'
import { getStardustNetwork } from '@core/network/stores'
import { MILESTONE_NOT_FOUND } from '@core/network/constants'

export function calculateTotalVotesForTrackedParticipations(
trackedParticipations: TrackedParticipationOverview[]
): bigint {
const currentMilestone = get(getL1Network().currentMilestone)
const currentMilestone = get(getStardustNetwork().currentMilestone)
if (currentMilestone === MILESTONE_NOT_FOUND) {
return BigInt(0)
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { get } from 'svelte/store'
import { EventStatus } from '@iota/sdk/out/types'
import { getL1Network } from '@core/network/stores'
import { getStardustNetwork } from '@core/network/stores'
import { ProposalError } from '../enums'
import { IProposal } from '../interfaces'
import { getProposalStatusForMilestone } from './getProposalStatusForMilestone'
Expand All @@ -13,7 +13,7 @@ export function createProposalFromError(
// @ts-expect-error
const isEventError = err?.error?.match(/(the requested data)|(was not found)/)?.length > 0
if (isEventError) {
const currentMilestone = get(getL1Network().currentMilestone)
const currentMilestone = get(getStardustNetwork().currentMilestone)
const status = getProposalStatusForMilestone(currentMilestone, proposal.milestones)
const isNodeOutdated = status !== EventStatus.Ended
const error = isNodeOutdated ? ProposalError.NodeOutdated : ProposalError.ResultsNotAvailable
Expand Down
Loading

0 comments on commit d287e48

Please sign in to comment.