diff --git a/packages/desktop/components/NetworkCard.svelte b/packages/desktop/components/NetworkCard.svelte index 89cf7bcb74..61641ea492 100644 --- a/packages/desktop/components/NetworkCard.svelte +++ b/packages/desktop/components/NetworkCard.svelte @@ -1,8 +1,8 @@ @@ -65,16 +77,5 @@ {localize('views.governance.details.proposalInformation.title')} - + diff --git a/packages/desktop/components/popups/AliasConfirmationPopup.svelte b/packages/desktop/components/popups/AliasConfirmationPopup.svelte index de9d77f044..e09b22f67d 100644 --- a/packages/desktop/components/popups/AliasConfirmationPopup.svelte +++ b/packages/desktop/components/popups/AliasConfirmationPopup.svelte @@ -1,4 +1,5 @@ -{localize('popups.walletFinder.title')} + + {localize('popups.walletFinder.title')} +
- {localize('popups.walletFinder.body')} - + + {localize('popups.walletFinder.body')} +
- - -
diff --git a/packages/desktop/features/wallet.features.ts b/packages/desktop/features/wallet.features.ts index 1ffd4156b4..7863baebf5 100644 --- a/packages/desktop/features/wallet.features.ts +++ b/packages/desktop/features/wallet.features.ts @@ -19,6 +19,9 @@ const walletFeatures: IWalletFeatures = { burnToken: { enabled: true, }, + unwrapToken: { + enabled: true, + }, }, activityHistory: { enabled: true, diff --git a/packages/desktop/views/dashboard/Dashboard.svelte b/packages/desktop/views/dashboard/Dashboard.svelte index 6d56897d29..123d269924 100644 --- a/packages/desktop/views/dashboard/Dashboard.svelte +++ b/packages/desktop/views/dashboard/Dashboard.svelte @@ -1,7 +1,7 @@ @@ -124,8 +133,8 @@ bind:selectedExpirationPeriod bind:selectedTimelockPeriod bind:giftStorageDeposit - estimatedGasFee={calculateGasFeeInGlow(estimatedGas, gasPrice)} - maxGasFee={calculateGasFeeInGlow(gasLimit, gasPrice)} + {estimatedGasFee} + {maxGasFee} storageDeposit={getStorageDepositFromOutput(output)} {destinationNetworkId} {disableChangeExpiration} diff --git a/packages/desktop/views/dashboard/wallet/Wallet.svelte b/packages/desktop/views/dashboard/wallet/Wallet.svelte index 3117f949e5..3e45d7b3fe 100644 --- a/packages/desktop/views/dashboard/wallet/Wallet.svelte +++ b/packages/desktop/views/dashboard/wallet/Wallet.svelte @@ -1,6 +1,6 @@ - -
- -
-
- {#if keyText} - - {keyText} - - {:else} - - {/if} - {#if tooltipText} - - {/if} -
- {#if valueText} -
- - {valueText} - -
- {:else} - - {/if} -
-
-
diff --git a/packages/shared/src/components/boxes/index.js b/packages/shared/src/components/boxes/index.js index d2a0aceeee..661b4d99e7 100644 --- a/packages/shared/src/components/boxes/index.js +++ b/packages/shared/src/components/boxes/index.js @@ -1,4 +1,3 @@ export { default as Box } from './Box.svelte' -export { default as KeyValueBox } from './KeyValueBox.svelte' export { default as AddressBox } from './AddressBox.svelte' export { default as CopyableBox } from './CopyableBox.svelte' diff --git a/packages/shared/src/components/molecules/activity-info/AliasActivityInformation.svelte b/packages/shared/src/components/molecules/activity-info/AliasActivityInformation.svelte index 79d10c03e3..54e2c557d7 100644 --- a/packages/shared/src/components/molecules/activity-info/AliasActivityInformation.svelte +++ b/packages/shared/src/components/molecules/activity-info/AliasActivityInformation.svelte @@ -1,18 +1,24 @@ -{#each Object.entries(detailsList) as [key, value]} - -{/each} +
diff --git a/packages/shared/src/components/molecules/activity-info/ConsolidationActivityInformation.svelte b/packages/shared/src/components/molecules/activity-info/ConsolidationActivityInformation.svelte index bbed7d6656..53c831933a 100644 --- a/packages/shared/src/components/molecules/activity-info/ConsolidationActivityInformation.svelte +++ b/packages/shared/src/components/molecules/activity-info/ConsolidationActivityInformation.svelte @@ -1,22 +1,30 @@ -{#each Object.entries(transactionDetailsList) as [key, value]} - -{/each} +
diff --git a/packages/shared/src/components/molecules/activity-info/FoundryActivityInformation.svelte b/packages/shared/src/components/molecules/activity-info/FoundryActivityInformation.svelte index 55c6105da6..a65dcabc05 100644 --- a/packages/shared/src/components/molecules/activity-info/FoundryActivityInformation.svelte +++ b/packages/shared/src/components/molecules/activity-info/FoundryActivityInformation.svelte @@ -1,25 +1,36 @@ -{#each Object.entries(detailsList) as [key, value]} - -{/each} +
diff --git a/packages/shared/src/components/molecules/activity-info/GenericActivityInformation.svelte b/packages/shared/src/components/molecules/activity-info/GenericActivityInformation.svelte index 4d8ba509d1..3ad753788b 100644 --- a/packages/shared/src/components/molecules/activity-info/GenericActivityInformation.svelte +++ b/packages/shared/src/components/molecules/activity-info/GenericActivityInformation.svelte @@ -1,89 +1,106 @@ -{#each Object.entries(transactionDetailsList) as [key, value]} - -{/each} -{#if activity.asyncData?.claimingTransactionId} - - - -{/if} +
diff --git a/packages/shared/src/components/molecules/activity-info/GovernanceActivityInformation.svelte b/packages/shared/src/components/molecules/activity-info/GovernanceActivityInformation.svelte index 11524f486c..a334dad578 100644 --- a/packages/shared/src/components/molecules/activity-info/GovernanceActivityInformation.svelte +++ b/packages/shared/src/components/molecules/activity-info/GovernanceActivityInformation.svelte @@ -1,33 +1,38 @@ -{#each Object.entries(transactionDetailsList) as [key, value]} - -{/each} +
diff --git a/packages/shared/src/components/molecules/activity-info/NftActivityInformation.svelte b/packages/shared/src/components/molecules/activity-info/NftActivityInformation.svelte index 128453ec5a..99e40f0cc1 100644 --- a/packages/shared/src/components/molecules/activity-info/NftActivityInformation.svelte +++ b/packages/shared/src/components/molecules/activity-info/NftActivityInformation.svelte @@ -1,9 +1,9 @@ -{#each Object.entries(detailsList) as [key, value]} - {#if value} - - {/if} -{/each} +
diff --git a/packages/shared/src/components/molecules/activity-info/NftMetadataInformation.svelte b/packages/shared/src/components/molecules/activity-info/NftMetadataInformation.svelte index 86c99944e9..816c27b1ae 100644 --- a/packages/shared/src/components/molecules/activity-info/NftMetadataInformation.svelte +++ b/packages/shared/src/components/molecules/activity-info/NftMetadataInformation.svelte @@ -1,66 +1,62 @@ -{#each Object.entries(nftMetadataDetailsList) as [key, value]} - -{/each} +
diff --git a/packages/shared/src/components/molecules/activity-info/SmartContractActivityInformation.svelte b/packages/shared/src/components/molecules/activity-info/SmartContractActivityInformation.svelte index 6bbf96808b..ed052c6a00 100644 --- a/packages/shared/src/components/molecules/activity-info/SmartContractActivityInformation.svelte +++ b/packages/shared/src/components/molecules/activity-info/SmartContractActivityInformation.svelte @@ -1,25 +1,32 @@ -{#each Object.entries(detailsList) as [key, value]} - -{/each} +
diff --git a/packages/shared/src/components/molecules/activity-info/TokenActivityInformation.svelte b/packages/shared/src/components/molecules/activity-info/TokenActivityInformation.svelte index 750cff00c8..e35e1d581b 100644 --- a/packages/shared/src/components/molecules/activity-info/TokenActivityInformation.svelte +++ b/packages/shared/src/components/molecules/activity-info/TokenActivityInformation.svelte @@ -1,44 +1,65 @@ -{#each Object.entries(detailsList) as [key, value]} - -{/each} +
diff --git a/packages/shared/src/lib/core/account/stores/selected-account-id.store.ts b/packages/shared/src/lib/core/account/stores/selected-account-id.store.ts index a29b9f5354..ae59c75543 100644 --- a/packages/shared/src/lib/core/account/stores/selected-account-id.store.ts +++ b/packages/shared/src/lib/core/account/stores/selected-account-id.store.ts @@ -1,3 +1,7 @@ -import { writable } from 'svelte/store' +import { get, writable } from 'svelte/store' -export const selectedAccountIndex = writable(null) +export const selectedAccountIndex = writable(0) + +export function getSelectedAccountIndex(): number { + return get(selectedAccountIndex) +} diff --git a/packages/shared/src/lib/core/activity/utils/helper/getLayer2ActivityInformation.ts b/packages/shared/src/lib/core/activity/utils/helper/getLayer2ActivityInformation.ts index a592e56bb9..51b1c1ab48 100644 --- a/packages/shared/src/lib/core/activity/utils/helper/getLayer2ActivityInformation.ts +++ b/packages/shared/src/lib/core/activity/utils/helper/getLayer2ActivityInformation.ts @@ -1,4 +1,5 @@ -import { parseLayer2Metadata, getDestinationNetworkFromAddress } from '@core/layer-2/utils' +import { parseLayer2Metadata } from '@core/layer-2/utils' +import { getDestinationNetworkFromAddress } from '@core/layer-2/actions' import { Layer2Metadata } from '@core/layer-2/types' import { SenderInfo } from '../../types' import { SubjectType } from '@core/wallet/enums' diff --git a/packages/shared/src/lib/core/activity/utils/helper/getSubjectFromActivity.ts b/packages/shared/src/lib/core/activity/utils/helper/getSubjectFromActivity.ts index 070c904f89..fc53c3f2d1 100644 --- a/packages/shared/src/lib/core/activity/utils/helper/getSubjectFromActivity.ts +++ b/packages/shared/src/lib/core/activity/utils/helper/getSubjectFromActivity.ts @@ -1,7 +1,7 @@ import { ActivityType } from '@core/activity/enums' import { Activity } from '@core/activity/types' import { localize } from '@core/i18n' -import { getLayer2NetworkFromAddress } from '@core/layer-2/utils' +import { getLayer2NetworkFromAddress } from '@core/layer-2/actions' import { truncateString } from '@core/utils' import { SubjectType } from '@core/wallet/enums' import type { Subject } from '@core/wallet/types' diff --git a/packages/shared/src/lib/core/layer-2/utils/buildEvmTransactionData.ts b/packages/shared/src/lib/core/layer-2/actions/buildEvmTransactionData.ts similarity index 87% rename from packages/shared/src/lib/core/layer-2/utils/buildEvmTransactionData.ts rename to packages/shared/src/lib/core/layer-2/actions/buildEvmTransactionData.ts index 24cb946202..c985d5d505 100644 --- a/packages/shared/src/lib/core/layer-2/utils/buildEvmTransactionData.ts +++ b/packages/shared/src/lib/core/layer-2/actions/buildEvmTransactionData.ts @@ -1,6 +1,6 @@ -import { getEvmTransactionValueFromAmount } from '@core/layer-2' import { Converter } from '@core/utils' import Web3 from 'web3' +import { getEvmTransactionValueFromAmount } from '../helpers/getEvmTransactionValueFromAmount' import { GAS_LIMIT_MULTIPLIER } from '../constants' import { EvmTransactionData } from '../types' @@ -17,7 +17,7 @@ export async function buildEvmTransactionData( const gasPrice = await provider.eth.getGasPrice() const hexGasPrice = Converter.decimalToHex(Number(gasPrice), true) const estimatedGas = await provider.eth.estimateGas({ from: originAddress, to: destinationAddress, data }) - const gasLimit = GAS_LIMIT_MULTIPLIER * estimatedGas // Double to ensure we have enough gas + const gasLimit = Math.floor(estimatedGas * GAS_LIMIT_MULTIPLIER) const to = destinationAddress diff --git a/packages/shared/src/lib/core/layer-2/actions/buildUnwrapAssetParameters.ts b/packages/shared/src/lib/core/layer-2/actions/buildUnwrapAssetParameters.ts new file mode 100644 index 0000000000..36c3cb5f26 --- /dev/null +++ b/packages/shared/src/lib/core/layer-2/actions/buildUnwrapAssetParameters.ts @@ -0,0 +1,50 @@ +import { + ILayer2AssetAllowance, + ILayer2SendMetadataParameter, + ILayer2SendOptionsParameter, + ILayer2TargetAddressParameter, +} from '../interfaces' +import { buildUnwrapAssetTargetAddress } from './buildUnwrapAssetTargetAddress' + +interface IUnwrapAssetParameters { + targetAddress: ILayer2TargetAddressParameter + assetAllowance: ILayer2AssetAllowance + adjustMinimumStorageDeposit: boolean + sendMetadata: ILayer2SendMetadataParameter + sendOptions: ILayer2SendOptionsParameter +} + +export function buildUnwrapAssetParameters(recipientAddress: string): Partial { + const targetAddress = buildUnwrapAssetTargetAddress(recipientAddress) + + const sendMetadata: ILayer2SendMetadataParameter = { + targetContract: 0, + entrypoint: 0, + params: { + items: [], + }, + allowance: { + baseTokens: 0, + nativeTokens: [], + nfts: [], + }, + gasBudget: 0, + } + + const sendOptions: ILayer2SendOptionsParameter = { + timelock: 0, + expiration: { + time: 0, + returnAddress: { + data: new Uint8Array([]), + }, + }, + } + + return { + targetAddress, + adjustMinimumStorageDeposit: false, + sendMetadata, + sendOptions, + } +} diff --git a/packages/shared/src/lib/core/layer-2/actions/buildUnwrapAssetTargetAddress.ts b/packages/shared/src/lib/core/layer-2/actions/buildUnwrapAssetTargetAddress.ts new file mode 100644 index 0000000000..3e19940de3 --- /dev/null +++ b/packages/shared/src/lib/core/layer-2/actions/buildUnwrapAssetTargetAddress.ts @@ -0,0 +1,11 @@ +import { getNetwork } from '@core/network/stores' +import { Bech32Helper } from '@core/utils' +import { ILayer2TargetAddressParameter } from '../interfaces' + +export function buildUnwrapAssetTargetAddress(address: string): ILayer2TargetAddressParameter { + const hrp = getNetwork()?.getMetadata().protocol.bech32Hrp ?? '' + const { addressBytes } = Bech32Helper.fromBech32(address, hrp) ?? {} + return { + data: new Uint8Array([0, ...(addressBytes ?? [])]), + } +} diff --git a/packages/shared/src/lib/core/layer-2/utils/estimateGasForLayer1ToLayer2Transaction.ts b/packages/shared/src/lib/core/layer-2/actions/estimateGasForLayer1ToLayer2Transaction.ts similarity index 55% rename from packages/shared/src/lib/core/layer-2/utils/estimateGasForLayer1ToLayer2Transaction.ts rename to packages/shared/src/lib/core/layer-2/actions/estimateGasForLayer1ToLayer2Transaction.ts index 2992e8ac89..b3624d06fe 100644 --- a/packages/shared/src/lib/core/layer-2/utils/estimateGasForLayer1ToLayer2Transaction.ts +++ b/packages/shared/src/lib/core/layer-2/actions/estimateGasForLayer1ToLayer2Transaction.ts @@ -1,50 +1,64 @@ -import { getNetwork, isStardustNetwork } from '@core/network' +import { NetworkId, getNetwork, isStardustNetwork } from '@core/network' import { getSelectedAccount } from '@core/account/stores' import { SendFlowParameters, SendFlowType } from '@core/wallet' import { FALLBACK_ESTIMATED_GAS, ISC_MAGIC_CONTRACT_ADDRESS } from '../constants' import { AssetType } from '../enums' import { TransferredAsset } from '../types' -import { getIscpTransferSmartContractData } from '../utils' +import { getIscpTransferSmartContractData } from './getIscpTransferSmartContractData' export async function estimateGasForLayer1ToLayer2Transaction(sendFlowParameters: SendFlowParameters): Promise { const { recipient, destinationNetworkId } = sendFlowParameters ?? {} - if (destinationNetworkId && isStardustNetwork(destinationNetworkId)) { + if (!destinationNetworkId || (destinationNetworkId && isStardustNetwork(destinationNetworkId))) { return 0 } - const address = recipient?.address ?? '' - - const chain = destinationNetworkId ? getNetwork()?.getChain(destinationNetworkId) : undefined - const provider = chain?.getProvider() const transferredAsset = getTransferredAsset(sendFlowParameters) - - const fallbackGas = FALLBACK_ESTIMATED_GAS.toJSNumber() - if (!chain || !provider || !transferredAsset) { - return fallbackGas + if (!transferredAsset) { + return 0 } try { - const coinType = chain.getConfiguration().coinType - const evmAddress = getSelectedAccount()?.evmAddresses?.[coinType] - const data = getIscpTransferSmartContractData(address, transferredAsset, chain) - if (data) { - const gas = await provider.eth.estimateGas({ - from: evmAddress, - to: ISC_MAGIC_CONTRACT_ADDRESS, - data, - }) - return gas - } else { - return Promise.resolve(fallbackGas) - } + const gas = await getGasEstimateForMagicContractCall(destinationNetworkId, recipient?.address, transferredAsset) + return gas } catch (err) { - // If the from in estimateGas doesn't have funds, the node throw an error. - console.error(err) - return Promise.resolve(fallbackGas) + return FALLBACK_ESTIMATED_GAS[sendFlowParameters.type] } } +async function getGasEstimateForMagicContractCall( + networkId: NetworkId, + address: string | undefined, + transferredAsset: TransferredAsset +): Promise { + const chain = getNetwork()?.getChain(networkId) + if (!chain) { + return Promise.reject('Invalid chain') + } + + const provider = chain?.getProvider() + if (!provider) { + return Promise.reject('Invalid provider') + } + + if (!address) { + return Promise.reject('Invalid address') + } + + const data = getIscpTransferSmartContractData(address, transferredAsset, chain) + if (!data) { + return Promise.reject('Invalid data') + } + + const coinType = chain.getConfiguration().coinType + const evmAddress = getSelectedAccount()?.evmAddresses?.[coinType] + return provider.eth.estimateGas({ + from: evmAddress, + to: ISC_MAGIC_CONTRACT_ADDRESS, + data, + }) +} + function getTransferredAsset(sendFlowParameters: SendFlowParameters): TransferredAsset | undefined { if (sendFlowParameters.type === SendFlowType.NftTransfer) { return sendFlowParameters.nft diff --git a/packages/shared/src/lib/core/layer-2/actions/fetchSelectedAccountLayer2Balance.ts b/packages/shared/src/lib/core/layer-2/actions/fetchSelectedAccountLayer2Balance.ts index 20893e6820..83a70f49e8 100644 --- a/packages/shared/src/lib/core/layer-2/actions/fetchSelectedAccountLayer2Balance.ts +++ b/packages/shared/src/lib/core/layer-2/actions/fetchSelectedAccountLayer2Balance.ts @@ -1,9 +1,10 @@ -import { ContractType, evmAddressToAgentID, getAgentBalanceParameters, getSmartContractHexName } from '@core/layer-2' +import { ContractType } from '@core/layer-2' import { IChain, getNetwork } from '@core/network' import { ISC_MAGIC_CONTRACT_ADDRESS } from '../constants' import { Converter } from '@core/utils/convert' import { TOKEN_ID_BYTE_LENGTH } from '@core/token/constants' import { setLayer2AccountBalanceForChain } from '../stores' +import { evmAddressToAgentId, getAgentBalanceParameters, getSmartContractHexName } from '../helpers' import { getActiveProfile } from '@core/profile/stores' import { IAccountState } from '@core/account' import { calculateAndAddPersistedBalanceChange } from '@core/activity/actions' @@ -58,7 +59,7 @@ async function getLayer2NativeTokenBalancesForAddress( ): Promise<{ balance: number; tokenId: string }[]> { const accountsCoreContract = getSmartContractHexName('accounts') const getBalanceFunc = getSmartContractHexName('balance') - const agentID = evmAddressToAgentID(evmAddress) + const agentID = evmAddressToAgentId(evmAddress) const parameters = getAgentBalanceParameters(agentID) try { const contract = chain.getContract(ContractType.IscMagic, ISC_MAGIC_CONTRACT_ADDRESS) diff --git a/packages/shared/src/lib/core/layer-2/utils/getDestinationNetworkFromAddress.ts b/packages/shared/src/lib/core/layer-2/actions/getDestinationNetworkFromAddress.ts similarity index 100% rename from packages/shared/src/lib/core/layer-2/utils/getDestinationNetworkFromAddress.ts rename to packages/shared/src/lib/core/layer-2/actions/getDestinationNetworkFromAddress.ts diff --git a/packages/shared/src/lib/core/layer-2/actions/getGasFeesForLayer1ToLayer2Transaction.ts b/packages/shared/src/lib/core/layer-2/actions/getGasFeesForLayer1ToLayer2Transaction.ts new file mode 100644 index 0000000000..ddae720aad --- /dev/null +++ b/packages/shared/src/lib/core/layer-2/actions/getGasFeesForLayer1ToLayer2Transaction.ts @@ -0,0 +1,25 @@ +import { SendFlowParameters } from '@core/wallet' +import { BigIntLike } from '@ethereumjs/util' +import { GAS_LIMIT_MULTIPLIER } from '../constants' +import { calculateGasFeeInGlow } from '../helpers' +import { estimateGasForLayer1ToLayer2Transaction } from './estimateGasForLayer1ToLayer2Transaction' +import { getGasPriceInWei } from './getGasPriceInWei' + +export async function getGasFeesForLayer1ToLayer2Transaction( + sendFlowParameters: SendFlowParameters +): Promise<{ estimatedGasFee: BigIntLike; maxGasFee: BigIntLike }> { + try { + if (sendFlowParameters.destinationNetworkId) { + const estimatedGas = await estimateGasForLayer1ToLayer2Transaction(sendFlowParameters) + const gasLimit = Math.floor(estimatedGas * GAS_LIMIT_MULTIPLIER) + const gasPrice = await getGasPriceInWei(sendFlowParameters.destinationNetworkId) + const estimatedGasFee = calculateGasFeeInGlow(estimatedGas, gasPrice) + const maxGasFee = calculateGasFeeInGlow(gasLimit, gasPrice) + return { estimatedGasFee, maxGasFee } + } else { + return { estimatedGasFee: BigInt(0), maxGasFee: BigInt(0) } + } + } catch (error) { + return { estimatedGasFee: BigInt(0), maxGasFee: BigInt(0) } + } +} diff --git a/packages/shared/src/lib/core/layer-2/utils/getIscpTransferSmartContractData.ts b/packages/shared/src/lib/core/layer-2/actions/getIscpTransferSmartContractData.ts similarity index 87% rename from packages/shared/src/lib/core/layer-2/utils/getIscpTransferSmartContractData.ts rename to packages/shared/src/lib/core/layer-2/actions/getIscpTransferSmartContractData.ts index a5420370dd..d99df541cc 100644 --- a/packages/shared/src/lib/core/layer-2/utils/getIscpTransferSmartContractData.ts +++ b/packages/shared/src/lib/core/layer-2/actions/getIscpTransferSmartContractData.ts @@ -1,16 +1,16 @@ import { IChain } from '@core/network' -import { - evmAddressToAgentID, - getAgentBalanceParameters, - getLayer2AssetAllowance, - getSmartContractHexName, -} from '@core/layer-2/utils' import { getSelectedAccount } from '@core/account/stores' import { ContractType } from '@core/layer-2/enums' import { ISC_MAGIC_CONTRACT_ADDRESS } from '@core/layer-2/constants' import { handleError } from '@core/error/handlers' import { IError } from '@core/error/interfaces' import { TransferredAsset } from '../types' +import { + buildAssetAllowance, + evmAddressToAgentId, + getAgentBalanceParameters, + getSmartContractHexName, +} from '../helpers' export function getIscpTransferSmartContractData( recipientAddress: string, @@ -31,9 +31,9 @@ export function getIscpTransferSmartContractData( const accountsCoreContract = getSmartContractHexName('accounts') const transferAllowanceTo = getSmartContractHexName('transferAllowanceTo') - const agentId = evmAddressToAgentID(recipientAddress) + const agentId = evmAddressToAgentId(recipientAddress) const parameters = getAgentBalanceParameters(agentId) - const allowance = getLayer2AssetAllowance(transferredAsset) + const allowance = buildAssetAllowance(transferredAsset) const contract = chain.getContract(ContractType.IscMagic, ISC_MAGIC_CONTRACT_ADDRESS) const method = contract.methods.call(accountsCoreContract, transferAllowanceTo, parameters, allowance) diff --git a/packages/shared/src/lib/core/layer-2/utils/getLayer2MetadataForTransfer.ts b/packages/shared/src/lib/core/layer-2/actions/getLayer2MetadataForTransfer.ts similarity index 96% rename from packages/shared/src/lib/core/layer-2/utils/getLayer2MetadataForTransfer.ts rename to packages/shared/src/lib/core/layer-2/actions/getLayer2MetadataForTransfer.ts index 3c29111376..e63017d0ea 100644 --- a/packages/shared/src/lib/core/layer-2/utils/getLayer2MetadataForTransfer.ts +++ b/packages/shared/src/lib/core/layer-2/actions/getLayer2MetadataForTransfer.ts @@ -1,9 +1,9 @@ -import { encodeAddress, encodeAssetAllowance, encodeSmartContractParameters } from '../helpers' -import BigInteger from 'big-integer' import type { SendFlowParameters, TokenSendFlowParameters } from '@core/wallet/types' +import BigInteger from 'big-integer' +import { estimateGasForLayer1ToLayer2Transaction } from './estimateGasForLayer1ToLayer2Transaction' import { SpecialStream } from '../classes' import { ACCOUNTS_CONTRACT, EXTERNALLY_OWNED_ACCOUNT, GAS_LIMIT_MULTIPLIER, TRANSFER_ALLOWANCE } from '../constants' -import { estimateGasForLayer1ToLayer2Transaction } from './estimateGasForLayer1ToLayer2Transaction' +import { encodeAddress, encodeAssetAllowance, encodeSmartContractParameters } from '../helpers' export async function getLayer2MetadataForTransfer(sendFlowParameters: SendFlowParameters): Promise { const metadataStream = new SpecialStream() @@ -12,7 +12,7 @@ export async function getLayer2MetadataForTransfer(sendFlowParameters: SendFlowP const encodedAddress = address ? encodeAddress(address.toLowerCase()) : '' const estimatedGas = await estimateGasForLayer1ToLayer2Transaction(sendFlowParameters as TokenSendFlowParameters) - const gasLimit = estimatedGas * GAS_LIMIT_MULTIPLIER + const gasLimit = Math.floor(estimatedGas * GAS_LIMIT_MULTIPLIER) metadataStream.writeUInt32('senderContract', EXTERNALLY_OWNED_ACCOUNT) metadataStream.writeUInt32('targetContract', ACCOUNTS_CONTRACT) diff --git a/packages/shared/src/lib/core/layer-2/utils/getLayer2NetworkFromAddress.ts b/packages/shared/src/lib/core/layer-2/actions/getLayer2NetworkFromAddress.ts similarity index 100% rename from packages/shared/src/lib/core/layer-2/utils/getLayer2NetworkFromAddress.ts rename to packages/shared/src/lib/core/layer-2/actions/getLayer2NetworkFromAddress.ts diff --git a/packages/shared/src/lib/core/layer-2/actions/index.ts b/packages/shared/src/lib/core/layer-2/actions/index.ts index 13ccca383d..c6fe3ed883 100644 --- a/packages/shared/src/lib/core/layer-2/actions/index.ts +++ b/packages/shared/src/lib/core/layer-2/actions/index.ts @@ -1,4 +1,14 @@ +export * from './buildEvmTransactionData' +export * from './buildUnwrapAssetParameters' +export * from './buildUnwrapAssetTargetAddress' +export * from './estimateGasForLayer1ToLayer2Transaction' export * from './fetchSelectedAccountLayer2Balance' export * from './generateAndStoreEvmAddressForAccount' +export * from './getDestinationNetworkFromAddress' +export * from './getGasFeesForLayer1ToLayer2Transaction' export * from './getGasPriceInWei' +export * from './getIscpTransferSmartContractData' +export * from './getLayer2MetadataForTransfer' +export * from './getLayer2NetworkFromAddress' export * from './pollLayer2Tokens' +export * from './signEvmTransactionWithStronghold' diff --git a/packages/shared/src/lib/core/layer-2/utils/signEvmTransactionWithStronghold.ts b/packages/shared/src/lib/core/layer-2/actions/signEvmTransactionWithStronghold.ts similarity index 93% rename from packages/shared/src/lib/core/layer-2/utils/signEvmTransactionWithStronghold.ts rename to packages/shared/src/lib/core/layer-2/actions/signEvmTransactionWithStronghold.ts index a1369838f3..be5dd8be60 100644 --- a/packages/shared/src/lib/core/layer-2/utils/signEvmTransactionWithStronghold.ts +++ b/packages/shared/src/lib/core/layer-2/actions/signEvmTransactionWithStronghold.ts @@ -2,6 +2,7 @@ import { TxData } from '@ethereumjs/tx' import { IAccountState } from '@core/account' import { prepareEvmTransaction } from '@core/layer-2/utils' import { EvmChainId, getEvmTransactionOptions } from '@core/network' +import { removeLeadingZeros } from '@core/utils/buffer' import { Transaction } from '@ethereumjs/tx' import { ECDSASignature, fromRpcSig } from '@ethereumjs/util' import type { Bip44 } from '@iota/wallet/types' @@ -34,8 +35,8 @@ function createSignedTransaction( const vHex = padHexString(signature.v.toString(16)) rawTx[6] = Buffer.from(vHex, 'hex') - rawTx[7] = signature.r - rawTx[8] = signature.s + rawTx[7] = removeLeadingZeros(signature.r) + rawTx[8] = removeLeadingZeros(signature.s) const signedTransaction = Transaction.fromValuesArray(rawTx, getEvmTransactionOptions(chainId)) return signedTransaction diff --git a/packages/shared/src/lib/core/layer-2/constants/fallback-estimated-gas.constant.ts b/packages/shared/src/lib/core/layer-2/constants/fallback-estimated-gas.constant.ts index f1321c8e24..0fb6530e5f 100644 --- a/packages/shared/src/lib/core/layer-2/constants/fallback-estimated-gas.constant.ts +++ b/packages/shared/src/lib/core/layer-2/constants/fallback-estimated-gas.constant.ts @@ -1,11 +1,13 @@ -import BigInteger from 'big-integer' +import { SendFlowType } from '@core/wallet' /** - * We need a fallback estimated gas, since we cannot estimate calls to the magic contract. + * We need a fallback estimated gas, since we cannot estimate calls to the magic contract if there is no balance on the sender address. * For L1 -> L2 transfers we observed the following gas costs: - * Base Token Transfer: 22 000 glow - * Native Token Transfer: 63 000 glow - * NFT Transfer: 75 600 glow - * Therefor we set the fallback estimated gas to 100 000 glow - */ -export const FALLBACK_ESTIMATED_GAS = BigInteger(100000) + * Base Token Transfer: < 24200 glow + * Native Token Transfer: < 24350 glow + * NFT Transfer: < 24700 glow */ +export const FALLBACK_ESTIMATED_GAS: { [key in SendFlowType]: number } = { + [SendFlowType.BaseCoinTransfer]: 24200, + [SendFlowType.TokenTransfer]: 24350, + [SendFlowType.NftTransfer]: 24700, +} diff --git a/packages/shared/src/lib/core/layer-2/constants/gas-limit-multiplier.constant.ts b/packages/shared/src/lib/core/layer-2/constants/gas-limit-multiplier.constant.ts index 29bb90a5ec..057efa4e59 100644 --- a/packages/shared/src/lib/core/layer-2/constants/gas-limit-multiplier.constant.ts +++ b/packages/shared/src/lib/core/layer-2/constants/gas-limit-multiplier.constant.ts @@ -1 +1 @@ -export const GAS_LIMIT_MULTIPLIER = 2 +export const GAS_LIMIT_MULTIPLIER: number = 1.1 diff --git a/packages/shared/src/lib/core/layer-2/utils/getLayer2AssetAllowance.ts b/packages/shared/src/lib/core/layer-2/helpers/buildAssetAllowance.ts similarity index 88% rename from packages/shared/src/lib/core/layer-2/utils/getLayer2AssetAllowance.ts rename to packages/shared/src/lib/core/layer-2/helpers/buildAssetAllowance.ts index 67eb770fb8..51e166d222 100644 --- a/packages/shared/src/lib/core/layer-2/utils/getLayer2AssetAllowance.ts +++ b/packages/shared/src/lib/core/layer-2/helpers/buildAssetAllowance.ts @@ -2,7 +2,7 @@ import { AssetType } from '../enums' import { ILayer2AssetAllowance } from '../interfaces' import { TransferredAsset } from '../types' -export function getLayer2AssetAllowance(transferredAsset: TransferredAsset): ILayer2AssetAllowance { +export function buildAssetAllowance(transferredAsset: TransferredAsset): ILayer2AssetAllowance { if (transferredAsset.type === AssetType.Nft) { return { baseTokens: '0', diff --git a/packages/shared/src/lib/core/layer-2/utils/calculateGasFeeInGlow.ts b/packages/shared/src/lib/core/layer-2/helpers/calculateGasFeeInGlow.ts similarity index 87% rename from packages/shared/src/lib/core/layer-2/utils/calculateGasFeeInGlow.ts rename to packages/shared/src/lib/core/layer-2/helpers/calculateGasFeeInGlow.ts index 371964c4ad..dfbb4df11f 100644 --- a/packages/shared/src/lib/core/layer-2/utils/calculateGasFeeInGlow.ts +++ b/packages/shared/src/lib/core/layer-2/helpers/calculateGasFeeInGlow.ts @@ -1,5 +1,5 @@ import { BigIntLike } from '@ethereumjs/util' -import { WEI_PER_GLOW } from '../constants' +import { WEI_PER_GLOW } from '../constants/wei.constants' export function calculateGasFeeInGlow(gasAmount: BigIntLike, gasPriceInWei: BigIntLike | undefined): BigIntLike { if (gasAmount && gasPriceInWei) { diff --git a/packages/shared/src/lib/core/layer-2/helpers/encodeAssetAllowance.ts b/packages/shared/src/lib/core/layer-2/helpers/encodeAssetAllowance.ts index da9b426c2d..2eaf05f684 100644 --- a/packages/shared/src/lib/core/layer-2/helpers/encodeAssetAllowance.ts +++ b/packages/shared/src/lib/core/layer-2/helpers/encodeAssetAllowance.ts @@ -1,11 +1,11 @@ +import { INft } from '@core/nfts/interfaces' +import { IPersistedToken } from '@core/token/interfaces' +import { SendFlowParameters, SendFlowType, TokenTransferData } from '@core/wallet' import { Converter } from '@iota/util.js' import BigInteger from 'big-integer' -import { SendFlowType, SendFlowParameters, TokenTransferData } from '@core/wallet' import { SpecialStream } from '../classes' import { Allowance } from '../enums' -import { specialNativeTokenAmountEncoding } from '../utils' -import { INft } from '@core/nfts/interfaces' -import { IPersistedToken } from '@core/token/interfaces' +import { specialNativeTokenAmountEncoding } from './' export function encodeAssetAllowance(sendFlowParameters: SendFlowParameters): Uint8Array { const allowance = new SpecialStream() diff --git a/packages/shared/src/lib/core/layer-2/utils/evmAddressToAgentID.ts b/packages/shared/src/lib/core/layer-2/helpers/evmAddressToAgentId.ts similarity index 92% rename from packages/shared/src/lib/core/layer-2/utils/evmAddressToAgentID.ts rename to packages/shared/src/lib/core/layer-2/helpers/evmAddressToAgentId.ts index ea73ef9d2a..b207d1303f 100644 --- a/packages/shared/src/lib/core/layer-2/utils/evmAddressToAgentID.ts +++ b/packages/shared/src/lib/core/layer-2/helpers/evmAddressToAgentId.ts @@ -1,6 +1,6 @@ import { Converter } from '@iota/util.js' -export function evmAddressToAgentID(evmStoreAccount: string): Uint8Array { +export function evmAddressToAgentId(evmStoreAccount: string): Uint8Array { // This function constructs an AgentID that is required to be used with contracts // Wasp understands different AgentID types and each AgentID needs to provide a certain ID that describes it's address type. // In the case of EVM addresses it's ID 3. diff --git a/packages/shared/src/lib/core/layer-2/utils/getAgentBalanceParameters.ts b/packages/shared/src/lib/core/layer-2/helpers/getAgentBalanceParameters.ts similarity index 100% rename from packages/shared/src/lib/core/layer-2/utils/getAgentBalanceParameters.ts rename to packages/shared/src/lib/core/layer-2/helpers/getAgentBalanceParameters.ts diff --git a/packages/shared/src/lib/core/layer-2/utils/getEvmTransactionValueFromAmount.ts b/packages/shared/src/lib/core/layer-2/helpers/getEvmTransactionValueFromAmount.ts similarity index 100% rename from packages/shared/src/lib/core/layer-2/utils/getEvmTransactionValueFromAmount.ts rename to packages/shared/src/lib/core/layer-2/helpers/getEvmTransactionValueFromAmount.ts diff --git a/packages/shared/src/lib/core/layer-2/utils/getSmartContractHexName.ts b/packages/shared/src/lib/core/layer-2/helpers/getSmartContractHexName.ts similarity index 100% rename from packages/shared/src/lib/core/layer-2/utils/getSmartContractHexName.ts rename to packages/shared/src/lib/core/layer-2/helpers/getSmartContractHexName.ts diff --git a/packages/shared/src/lib/core/layer-2/helpers/index.ts b/packages/shared/src/lib/core/layer-2/helpers/index.ts index b183a763af..c55fd09733 100644 --- a/packages/shared/src/lib/core/layer-2/helpers/index.ts +++ b/packages/shared/src/lib/core/layer-2/helpers/index.ts @@ -1,3 +1,10 @@ +export * from './buildAssetAllowance' +export * from './calculateGasFeeInGlow' export * from './encodeAddress' export * from './encodeAssetAllowance' export * from './encodeSmartContractParameters' +export * from './evmAddressToAgentId' +export * from './getAgentBalanceParameters' +export * from './getEvmTransactionValueFromAmount' +export * from './getSmartContractHexName' +export * from './specialNativeTokenAmountEncoding' diff --git a/packages/shared/src/lib/core/layer-2/utils/specialNativeTokenAmountEncoding.ts b/packages/shared/src/lib/core/layer-2/helpers/specialNativeTokenAmountEncoding.ts similarity index 100% rename from packages/shared/src/lib/core/layer-2/utils/specialNativeTokenAmountEncoding.ts rename to packages/shared/src/lib/core/layer-2/helpers/specialNativeTokenAmountEncoding.ts diff --git a/packages/shared/src/lib/core/layer-2/index.ts b/packages/shared/src/lib/core/layer-2/index.ts index 60c30f4ac7..264050151f 100644 --- a/packages/shared/src/lib/core/layer-2/index.ts +++ b/packages/shared/src/lib/core/layer-2/index.ts @@ -1,5 +1,4 @@ export * from './abis' -export * from './actions' export * from './constants' export * from './classes' export * from './constants' diff --git a/packages/shared/src/lib/core/layer-2/interfaces/index.ts b/packages/shared/src/lib/core/layer-2/interfaces/index.ts index a9e48daa0e..eca0d9fa1b 100644 --- a/packages/shared/src/lib/core/layer-2/interfaces/index.ts +++ b/packages/shared/src/lib/core/layer-2/interfaces/index.ts @@ -2,7 +2,13 @@ export * from './erc20-evm-transaction-options.interface' export * from './evm-address.interface' export * from './evm-transaction-data.interface' export * from './evm-transaction-signature.interface' -export * from './layer2-asset-allowance.interface' -export * from './layer2-profile-balance.interface' -export * from './layer2-smart-contract-call-data.interface' -export * from './layer2-transfer-allowance-metadata.interface' +export * from './layer-2-asset-allowance.interface' +export * from './layer-2-profile-balance.interface' +export * from './layer-2-smart-contract-call-data.interface' +export * from './layer-2-transfer-allowance-metadata.interface' +export * from './layer-2-send-metadata-parameter.interface' +export * from './layer-2-send-metadata-parameter-parameters.interface' +export * from './layer-2-send-options-expiration.interface' +export * from './layer-2-send-options-parameter.interface' +export * from './layer-2-target-address-parameter.interface' +export * from './native-token-amount.interface' diff --git a/packages/shared/src/lib/core/layer-2/interfaces/layer-2-asset-allowance.interface.ts b/packages/shared/src/lib/core/layer-2/interfaces/layer-2-asset-allowance.interface.ts new file mode 100644 index 0000000000..a5865a74a6 --- /dev/null +++ b/packages/shared/src/lib/core/layer-2/interfaces/layer-2-asset-allowance.interface.ts @@ -0,0 +1,7 @@ +import { INativeTokenAmount } from './native-token-amount.interface' + +export interface ILayer2AssetAllowance { + baseTokens: string | number + nativeTokens: INativeTokenAmount[] + nfts: string[] +} diff --git a/packages/shared/src/lib/core/layer-2/interfaces/layer2-profile-balance.interface.ts b/packages/shared/src/lib/core/layer-2/interfaces/layer-2-profile-balance.interface.ts similarity index 100% rename from packages/shared/src/lib/core/layer-2/interfaces/layer2-profile-balance.interface.ts rename to packages/shared/src/lib/core/layer-2/interfaces/layer-2-profile-balance.interface.ts diff --git a/packages/shared/src/lib/core/layer-2/interfaces/layer-2-send-metadata-parameter-parameters.interface.ts b/packages/shared/src/lib/core/layer-2/interfaces/layer-2-send-metadata-parameter-parameters.interface.ts new file mode 100644 index 0000000000..39fa4369aa --- /dev/null +++ b/packages/shared/src/lib/core/layer-2/interfaces/layer-2-send-metadata-parameter-parameters.interface.ts @@ -0,0 +1,8 @@ +export interface ILayer2SendMetadataParameterParameters { + items: ILayer2SendMetadataParameterItem[] +} + +export interface ILayer2SendMetadataParameterItem { + key: Uint8Array + value: Uint8Array +} diff --git a/packages/shared/src/lib/core/layer-2/interfaces/layer-2-send-metadata-parameter.interface.ts b/packages/shared/src/lib/core/layer-2/interfaces/layer-2-send-metadata-parameter.interface.ts new file mode 100644 index 0000000000..ffbd876cd5 --- /dev/null +++ b/packages/shared/src/lib/core/layer-2/interfaces/layer-2-send-metadata-parameter.interface.ts @@ -0,0 +1,10 @@ +import { ILayer2AssetAllowance } from './layer-2-asset-allowance.interface' +import { ILayer2SendMetadataParameterParameters } from './layer-2-send-metadata-parameter-parameters.interface' + +export interface ILayer2SendMetadataParameter { + targetContract: number + entrypoint: number + params: ILayer2SendMetadataParameterParameters + allowance: ILayer2AssetAllowance + gasBudget: number +} diff --git a/packages/shared/src/lib/core/layer-2/interfaces/layer-2-send-options-expiration.interface.ts b/packages/shared/src/lib/core/layer-2/interfaces/layer-2-send-options-expiration.interface.ts new file mode 100644 index 0000000000..45a0057bab --- /dev/null +++ b/packages/shared/src/lib/core/layer-2/interfaces/layer-2-send-options-expiration.interface.ts @@ -0,0 +1,6 @@ +import { ILayer2TargetAddressParameter } from './layer-2-target-address-parameter.interface' + +export interface ILayer2SendOptionsExpiration { + time: number + returnAddress: ILayer2TargetAddressParameter +} diff --git a/packages/shared/src/lib/core/layer-2/interfaces/layer-2-send-options-parameter.interface.ts b/packages/shared/src/lib/core/layer-2/interfaces/layer-2-send-options-parameter.interface.ts new file mode 100644 index 0000000000..06323c2d9e --- /dev/null +++ b/packages/shared/src/lib/core/layer-2/interfaces/layer-2-send-options-parameter.interface.ts @@ -0,0 +1,6 @@ +import { ILayer2SendOptionsExpiration } from './layer-2-send-options-expiration.interface' + +export interface ILayer2SendOptionsParameter { + timelock: number + expiration: ILayer2SendOptionsExpiration +} diff --git a/packages/shared/src/lib/core/layer-2/interfaces/layer2-smart-contract-call-data.interface.ts b/packages/shared/src/lib/core/layer-2/interfaces/layer-2-smart-contract-call-data.interface.ts similarity index 70% rename from packages/shared/src/lib/core/layer-2/interfaces/layer2-smart-contract-call-data.interface.ts rename to packages/shared/src/lib/core/layer-2/interfaces/layer-2-smart-contract-call-data.interface.ts index 2637289be9..97b59f7728 100644 --- a/packages/shared/src/lib/core/layer-2/interfaces/layer2-smart-contract-call-data.interface.ts +++ b/packages/shared/src/lib/core/layer-2/interfaces/layer-2-smart-contract-call-data.interface.ts @@ -1,4 +1,4 @@ -import { ILayer2AssetAllowance } from './layer2-asset-allowance.interface' +import { ILayer2AssetAllowance } from './layer-2-asset-allowance.interface' export interface ILayer2SmartContractCallData extends ILayer2AssetAllowance { senderContract: string diff --git a/packages/shared/src/lib/core/layer-2/interfaces/layer-2-target-address-parameter.interface.ts b/packages/shared/src/lib/core/layer-2/interfaces/layer-2-target-address-parameter.interface.ts new file mode 100644 index 0000000000..ce03e0b58b --- /dev/null +++ b/packages/shared/src/lib/core/layer-2/interfaces/layer-2-target-address-parameter.interface.ts @@ -0,0 +1,3 @@ +export interface ILayer2TargetAddressParameter { + data: Uint8Array +} diff --git a/packages/shared/src/lib/core/layer-2/interfaces/layer2-transfer-allowance-metadata.interface.ts b/packages/shared/src/lib/core/layer-2/interfaces/layer-2-transfer-allowance-metadata.interface.ts similarity index 51% rename from packages/shared/src/lib/core/layer-2/interfaces/layer2-transfer-allowance-metadata.interface.ts rename to packages/shared/src/lib/core/layer-2/interfaces/layer-2-transfer-allowance-metadata.interface.ts index 0bb7c4760c..91739d1d0d 100644 --- a/packages/shared/src/lib/core/layer-2/interfaces/layer2-transfer-allowance-metadata.interface.ts +++ b/packages/shared/src/lib/core/layer-2/interfaces/layer-2-transfer-allowance-metadata.interface.ts @@ -1,4 +1,4 @@ -import { ILayer2SmartContractCallData } from '@core/layer-2/interfaces/layer2-smart-contract-call-data.interface' +import { ILayer2SmartContractCallData } from './layer-2-smart-contract-call-data.interface' export interface ILayer2TransferAllowanceMetadata extends ILayer2SmartContractCallData { ethereumAddress: string diff --git a/packages/shared/src/lib/core/layer-2/interfaces/layer2-asset-allowance.interface.ts b/packages/shared/src/lib/core/layer-2/interfaces/layer2-asset-allowance.interface.ts deleted file mode 100644 index 2805b7a12c..0000000000 --- a/packages/shared/src/lib/core/layer-2/interfaces/layer2-asset-allowance.interface.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { NativeTokenAmount } from '@core/token/types' - -export interface ILayer2AssetAllowance { - baseTokens: string - nativeTokens: NativeTokenAmount[] - nfts: string[] -} diff --git a/packages/shared/src/lib/core/token/types/native-token-amount.type.ts b/packages/shared/src/lib/core/layer-2/interfaces/native-token-amount.interface.ts similarity index 73% rename from packages/shared/src/lib/core/token/types/native-token-amount.type.ts rename to packages/shared/src/lib/core/layer-2/interfaces/native-token-amount.interface.ts index b22dce5ab2..129311a579 100644 --- a/packages/shared/src/lib/core/token/types/native-token-amount.type.ts +++ b/packages/shared/src/lib/core/layer-2/interfaces/native-token-amount.interface.ts @@ -1,5 +1,5 @@ // The WASP Node expects the following NativeTokenAmount object. -export type NativeTokenAmount = { +export interface INativeTokenAmount { ID: string[] amount: string } diff --git a/packages/shared/src/lib/core/layer-2/utils/calculateEstimatedGasFeeFromTransactionData.ts b/packages/shared/src/lib/core/layer-2/utils/calculateEstimatedGasFeeFromTransactionData.ts index a7c849e20d..626df4cab1 100644 --- a/packages/shared/src/lib/core/layer-2/utils/calculateEstimatedGasFeeFromTransactionData.ts +++ b/packages/shared/src/lib/core/layer-2/utils/calculateEstimatedGasFeeFromTransactionData.ts @@ -1,6 +1,6 @@ import { BigIntLike } from '@ethereumjs/util' import { EvmTransactionData } from '../types' -import { calculateGasFeeInGlow } from './calculateGasFeeInGlow' +import { calculateGasFeeInGlow } from '../helpers' export function calculateEstimatedGasFeeFromTransactionData( transactionData: EvmTransactionData diff --git a/packages/shared/src/lib/core/layer-2/utils/calculateMaxGasFeeFromTransactionData.ts b/packages/shared/src/lib/core/layer-2/utils/calculateMaxGasFeeFromTransactionData.ts index f4172b6112..ac02787ec1 100644 --- a/packages/shared/src/lib/core/layer-2/utils/calculateMaxGasFeeFromTransactionData.ts +++ b/packages/shared/src/lib/core/layer-2/utils/calculateMaxGasFeeFromTransactionData.ts @@ -1,6 +1,6 @@ import { BigIntLike } from '@ethereumjs/util' import { EvmTransactionData } from '../types' -import { calculateGasFeeInGlow } from './calculateGasFeeInGlow' +import { calculateGasFeeInGlow } from '../helpers' export function calculateMaxGasFeeFromTransactionData(transactionData: EvmTransactionData): BigIntLike | undefined { const { gasLimit, gasPrice } = transactionData diff --git a/packages/shared/src/lib/core/layer-2/utils/index.ts b/packages/shared/src/lib/core/layer-2/utils/index.ts index 7f80b0181a..bc97d0b89b 100644 --- a/packages/shared/src/lib/core/layer-2/utils/index.ts +++ b/packages/shared/src/lib/core/layer-2/utils/index.ts @@ -1,23 +1,9 @@ -export * from './calculateMaxGasFeeFromTransactionData' export * from './calculateEstimatedGasFeeFromTransactionData' -export * from './calculateGasFeeInGlow' -export * from './evmAddressToAgentID' +export * from './calculateMaxGasFeeFromTransactionData' export * from './getAbiForContractType' -export * from './getAgentBalanceParameters' export * from './getAmountFromEvmTransactionValue' -export * from './getDestinationNetworkFromAddress' -export * from './buildEvmTransactionData' -export * from './estimateGasForLayer1ToLayer2Transaction' export * from './getErc20TokenMetadata' export * from './getErc20TransferSmartContractData' -export * from './getEvmTransactionValueFromAmount' -export * from './getIscpTransferSmartContractData' -export * from './getLayer2AssetAllowance' -export * from './getLayer2MetadataForTransfer' -export * from './getLayer2NetworkFromAddress' -export * from './getSmartContractHexName' export * from './parseLayer2Metadata' export * from './parseLayer2MetadataForTransfer' export * from './prepareEvmTransaction' -export * from './signEvmTransactionWithStronghold' -export * from './specialNativeTokenAmountEncoding' diff --git a/packages/shared/src/lib/core/layer-2/utils/prepareEvmTransaction.ts b/packages/shared/src/lib/core/layer-2/utils/prepareEvmTransaction.ts index 6a12caa04a..93601944ed 100644 --- a/packages/shared/src/lib/core/layer-2/utils/prepareEvmTransaction.ts +++ b/packages/shared/src/lib/core/layer-2/utils/prepareEvmTransaction.ts @@ -1,10 +1,9 @@ -import { Transaction } from '@ethereumjs/tx' +import { EvmChainId, getEvmTransactionOptions } from '@core/network' import { RLP } from '@ethereumjs/rlp' +import { Transaction } from '@ethereumjs/tx' import { bufArrToArr } from '@ethereumjs/util' - import { IEvmTransactionSignature } from '../interfaces' import { EvmTransactionData } from '../types' -import { EvmChainId, getEvmTransactionOptions } from '@core/network' export function prepareEvmTransaction( transactionData: EvmTransactionData, diff --git a/packages/shared/src/lib/core/ledger/classes/ledger.class.ts b/packages/shared/src/lib/core/ledger/classes/ledger.class.ts index 46b8e7e44c..3864c9aa85 100644 --- a/packages/shared/src/lib/core/ledger/classes/ledger.class.ts +++ b/packages/shared/src/lib/core/ledger/classes/ledger.class.ts @@ -12,7 +12,7 @@ import { import { MILLISECONDS_PER_SECOND, sleep } from '@core/utils' import { TxData } from '@ethereumjs/tx' import type { Bip44 } from '@iota/wallet/types' -import { PopupId, closePopup, openPopup } from '../../../../../../desktop/lib/auxiliary/popup' +import { PopupId, openPopup } from '../../../../../../desktop/lib/auxiliary/popup' import { DEFAULT_LEDGER_API_REQUEST_OPTIONS } from '../constants' import { LedgerApiMethod } from '../enums' import { ILedgerApiBridge } from '../interfaces' @@ -58,7 +58,7 @@ export class Ledger { preventClose: true, props: { isEvmTransaction: true, - toAmount: getAmountFromEvmTransactionValue(txData?.value?.toString()), + toAmount: getAmountFromEvmTransactionValue(txData?.value?.toString()).toString(), toAddress: txData.to, chainId, maxGasFee, @@ -77,7 +77,12 @@ export class Ledger { ) if (promptVerification) { - closePopup(true) + openPopup( + { + id: PopupId.SendFlow, + }, + true + ) } const { r, v, s } = transactionSignature diff --git a/packages/shared/src/lib/core/network/classes/iscp-chain.class.ts b/packages/shared/src/lib/core/network/classes/iscp-chain.class.ts index df9c9c1f88..bc5cc673e0 100644 --- a/packages/shared/src/lib/core/network/classes/iscp-chain.class.ts +++ b/packages/shared/src/lib/core/network/classes/iscp-chain.class.ts @@ -1,11 +1,6 @@ +import { Contract, ContractType, getAbiForContractType } from '@core/layer-2' import { get } from 'svelte/store' - import Web3 from 'web3' - -import { ContractType } from '@core/layer-2/enums' -import { getAbiForContractType } from '@core/layer-2/utils' -import { Contract } from '@core/layer-2/types' - import { NetworkHealth } from '../enums' import { IBlock, IChain, IChainStatus, IIscpChainConfiguration, IIscpChainMetadata } from '../interfaces' import { chainStatuses } from '../stores' diff --git a/packages/shared/src/lib/core/token/types/index.ts b/packages/shared/src/lib/core/token/types/index.ts index 62650d322f..2cf49aafcd 100644 --- a/packages/shared/src/lib/core/token/types/index.ts +++ b/packages/shared/src/lib/core/token/types/index.ts @@ -1,4 +1,3 @@ -export * from './native-token-amount.type' export * from './token-metadata.type' export * from './token-verification.type' export * from './tracked-tokens.type' diff --git a/packages/shared/src/lib/core/utils/buffer.ts b/packages/shared/src/lib/core/utils/buffer.ts new file mode 100644 index 0000000000..725dc9a360 --- /dev/null +++ b/packages/shared/src/lib/core/utils/buffer.ts @@ -0,0 +1,11 @@ +export function removeLeadingZeros(buffer: Buffer): Buffer { + let indexToSliceFrom = 0 + for (let i = 0; i < buffer.length; i++) { + if (buffer[i] === 0) { + indexToSliceFrom = i + 1 + } else { + break + } + } + return buffer.subarray(indexToSliceFrom) +} diff --git a/packages/shared/src/lib/core/utils/index.ts b/packages/shared/src/lib/core/utils/index.ts index ac7cc40fbb..864bfb6c30 100644 --- a/packages/shared/src/lib/core/utils/index.ts +++ b/packages/shared/src/lib/core/utils/index.ts @@ -1,3 +1,4 @@ +export * from './buffer' export * from './constants' export * from './crypto' export * from './enums' diff --git a/packages/shared/src/lib/core/utils/interfaces/index.ts b/packages/shared/src/lib/core/utils/interfaces/index.ts index 1667af39d9..7e56c65794 100644 --- a/packages/shared/src/lib/core/utils/interfaces/index.ts +++ b/packages/shared/src/lib/core/utils/interfaces/index.ts @@ -1,5 +1,4 @@ export * from './date-difference.interface' export * from './dropdown-item.interface' export * from './format-iota-unit-options.interface' -export * from './key-value-box-list.interface' export * from './validation-options.interface' diff --git a/packages/shared/src/lib/core/utils/interfaces/key-value-box-list.interface.ts b/packages/shared/src/lib/core/utils/interfaces/key-value-box-list.interface.ts deleted file mode 100644 index 620e59337a..0000000000 --- a/packages/shared/src/lib/core/utils/interfaces/key-value-box-list.interface.ts +++ /dev/null @@ -1,9 +0,0 @@ -export interface IKeyValueBoxList { - [key: string]: { - data: string - isCopyable?: boolean - copyValue?: string - isTooltipVisible?: boolean - alternateKey?: string - } -} diff --git a/packages/shared/src/lib/core/utils/tests/buffer.test.ts b/packages/shared/src/lib/core/utils/tests/buffer.test.ts new file mode 100644 index 0000000000..f259410cdf --- /dev/null +++ b/packages/shared/src/lib/core/utils/tests/buffer.test.ts @@ -0,0 +1,24 @@ +import { removeLeadingZeros } from '../buffer' + +describe('buffer', () => { + test('Removes leading zeros', () => { + const buffer = Buffer.from([0, 0, 1]) + expect(removeLeadingZeros(buffer)).toEqual(Buffer.from([1])) + }) + + test('Buffer contains non-zero elements only', () => { + const buffer1 = Buffer.from([1, 2, 3]) + expect(removeLeadingZeros(buffer1)).toEqual(buffer1) + + const buffer2 = Buffer.from([1]) + expect(removeLeadingZeros(buffer2)).toEqual(buffer2) + + const buffer3 = Buffer.from([1, 0, 0]) + expect(removeLeadingZeros(buffer3)).toEqual(buffer3) + }) + + test('Keeps non-leading zeros untouched', () => { + const buffer = Buffer.from([1, 0, 0, 1]) + expect(removeLeadingZeros(buffer)).toEqual(buffer) + }) +}) diff --git a/packages/shared/src/lib/core/wallet/actions/index.ts b/packages/shared/src/lib/core/wallet/actions/index.ts index 56375838ff..e8d94a0e5a 100644 --- a/packages/shared/src/lib/core/wallet/actions/index.ts +++ b/packages/shared/src/lib/core/wallet/actions/index.ts @@ -9,5 +9,6 @@ export * from './mintNativeToken' export * from './mintNft' export * from './rejectActivity' export * from './sendOutput' +export * from './unwrapStardustAsset' export * from './send' diff --git a/packages/shared/src/lib/core/wallet/actions/send/createEvmTransactionFromSendFlowParameters.ts b/packages/shared/src/lib/core/wallet/actions/send/createEvmTransactionFromSendFlowParameters.ts index 910c5d86a7..5fbe881082 100644 --- a/packages/shared/src/lib/core/wallet/actions/send/createEvmTransactionFromSendFlowParameters.ts +++ b/packages/shared/src/lib/core/wallet/actions/send/createEvmTransactionFromSendFlowParameters.ts @@ -1,15 +1,15 @@ import { IAccountState } from '@core/account' -import { AssetType } from '@core/layer-2' -import { ISC_MAGIC_CONTRACT_ADDRESS } from '@core/layer-2/constants' -import { EvmTransactionData, TransferredAsset } from '@core/layer-2/types' import { - buildEvmTransactionData, + AssetType, + EvmTransactionData, + ISC_MAGIC_CONTRACT_ADDRESS, + TransferredAsset, getErc20TransferSmartContractData, - getIscpTransferSmartContractData, -} from '@core/layer-2/utils' +} from '@core/layer-2' +import { buildEvmTransactionData, getIscpTransferSmartContractData } from '@core/layer-2/actions' import { IChain } from '@core/network/interfaces' -import { IToken } from '@core/token/interfaces' import { TokenStandard } from '@core/token/enums' +import { IToken } from '@core/token/interfaces' import { SendFlowType } from '@core/wallet/stores' import { SendFlowParameters } from '@core/wallet/types' diff --git a/packages/shared/src/lib/core/wallet/actions/send/sendTransactionFromEvm.ts b/packages/shared/src/lib/core/wallet/actions/send/sendTransactionFromEvm.ts index a07b3fe471..37da407297 100644 --- a/packages/shared/src/lib/core/wallet/actions/send/sendTransactionFromEvm.ts +++ b/packages/shared/src/lib/core/wallet/actions/send/sendTransactionFromEvm.ts @@ -4,6 +4,7 @@ import { EvmTransactionData } from '@core/layer-2' import { LedgerAppName } from '@core/ledger' import { IChain } from '@core/network' import { checkActiveProfileAuth } from '@core/profile/actions' + import { signAndSendEvmTransaction } from './signAndSendEvmTransaction' import { generateActivityFromEvmTransaction } from '@core/activity/utils/generateActivityFromEvmTransaction' import { PersistedEvmTransaction } from '@core/activity' @@ -11,7 +12,7 @@ import { PersistedEvmTransaction } from '@core/activity' export async function sendTransactionFromEvm( transaction: EvmTransactionData, chain: IChain, - callback: () => void + callback?: () => void ): Promise { const account = getSelectedAccount() const provider = chain.getProvider() @@ -37,8 +38,11 @@ export async function sendTransactionFromEvm( const activity = await generateActivityFromEvmTransaction(evmTransaction, networkId, provider) addActivitiesToAccountActivitiesInAllAccountActivities(account.index, [activity]) + + if (callback && typeof callback === 'function') { + callback() + } } - callback() }, { stronghold: true, ledger: true }, LedgerAppName.Ethereum diff --git a/packages/shared/src/lib/core/wallet/actions/send/signAndSendEvmTransaction.ts b/packages/shared/src/lib/core/wallet/actions/send/signAndSendEvmTransaction.ts index 36db766d66..70d018ce33 100644 --- a/packages/shared/src/lib/core/wallet/actions/send/signAndSendEvmTransaction.ts +++ b/packages/shared/src/lib/core/wallet/actions/send/signAndSendEvmTransaction.ts @@ -2,7 +2,7 @@ import { IAccountState } from '@core/account' import { updateSelectedAccount } from '@core/account/stores' import { handleError } from '@core/error/handlers' import { EvmTransactionData } from '@core/layer-2/types' -import { signEvmTransactionWithStronghold } from '@core/layer-2/utils' +import { signEvmTransactionWithStronghold } from '@core/layer-2/actions' import { Ledger } from '@core/ledger/classes' import { EvmChainId } from '@core/network/enums' import { isActiveLedgerProfile, isSoftwareProfile } from '@core/profile/stores' diff --git a/packages/shared/src/lib/core/wallet/actions/unwrapStardustAsset.ts b/packages/shared/src/lib/core/wallet/actions/unwrapStardustAsset.ts new file mode 100644 index 0000000000..b0532a8ac9 --- /dev/null +++ b/packages/shared/src/lib/core/wallet/actions/unwrapStardustAsset.ts @@ -0,0 +1,39 @@ +import { getSelectedAccountIndex } from '@core/account/stores' +import { handleError } from '@core/error/handlers' +import { ContractType, ILayer2AssetAllowance, ISC_MAGIC_CONTRACT_ADDRESS } from '@core/layer-2' +import { buildEvmTransactionData, buildUnwrapAssetParameters } from '@core/layer-2/actions' +import { ETHEREUM_COIN_TYPE, IChain, NetworkId, SupportedNetworkId, getNetwork } from '@core/network' +import { getActiveProfilePersistedEvmAddressesByAccountIndex } from '@core/profile/stores' +import Web3 from 'web3' +import { sendTransactionFromEvm } from '../actions/send' + +export async function unwrapStardustAsset( + assetAllowance: ILayer2AssetAllowance, + recipientAddress: string +): Promise { + try { + const { targetAddress, adjustMinimumStorageDeposit, sendMetadata, sendOptions } = + buildUnwrapAssetParameters(recipientAddress) + + const chain = getNetwork()?.getChain(SupportedNetworkId.ShimmerEvmTestnet as NetworkId) + const contract = chain?.getContract(ContractType.IscMagic, ISC_MAGIC_CONTRACT_ADDRESS) + const data = + (await contract?.methods + .send(targetAddress, assetAllowance, adjustMinimumStorageDeposit, sendMetadata, sendOptions) + .encodeABI()) ?? '' + + const provider = chain?.getProvider() as Web3 + const originAddress = + getActiveProfilePersistedEvmAddressesByAccountIndex(getSelectedAccountIndex())?.[ETHEREUM_COIN_TYPE] ?? '' + const transactionData = await buildEvmTransactionData( + provider, + originAddress, + ISC_MAGIC_CONTRACT_ADDRESS, + '0', + data + ) + await sendTransactionFromEvm(transactionData, chain as IChain) + } catch (err) { + handleError(err) + } +} diff --git a/packages/shared/src/lib/core/wallet/tests/getOutputParameters.test.ts b/packages/shared/src/lib/core/wallet/tests/getOutputParameters.test.ts index ece7031b27..a1da6e43cd 100644 --- a/packages/shared/src/lib/core/wallet/tests/getOutputParameters.test.ts +++ b/packages/shared/src/lib/core/wallet/tests/getOutputParameters.test.ts @@ -94,8 +94,20 @@ jest.mock('../../profile/actions/active-profile/getCoinType', () => ({ getCoinType: jest.fn((_) => '1'), })) -jest.mock('../../layer-2/utils/estimateGasForLayer1ToLayer2Transaction', () => ({ - estimateGasForLayer1ToLayer2Transaction: jest.fn(() => FALLBACK_ESTIMATED_GAS.toJSNumber()), +jest.mock('../../layer-2/actions/getGasPriceInWei', () => ({ + getGasPriceInWei: jest.fn((_) => 1_000_000_000_000n), +})) + +jest.mock('../../layer-2/actions/estimateGasForLayer1ToLayer2Transaction', () => ({ + estimateGasForLayer1ToLayer2Transaction: jest.fn(({ type }) => FALLBACK_ESTIMATED_GAS[type]), +})) + +jest.mock('../../layer-2/constants/gas-limit-multiplier.constant', () => ({ + GAS_LIMIT_MULTIPLIER: 1.1, +})) + +jest.mock('../../layer-2/constants/wei.constants', () => ({ + WEI_PER_GLOW: BigInt(1_000_000_000_000), })) jest.mock('../../network/actions/getActiveNetworkId.ts', () => ({ @@ -226,10 +238,10 @@ describe('File: getOutputParameters.ts', () => { const output = await getOutputParameters(sendFlowParameters, senderAddress) const expectedOutput = { recipientAddress: destinationNetwork.aliasAddress, - amount: (Number(FALLBACK_ESTIMATED_GAS) + Number(amount)).toString(), + amount: '1000026620', features: { metadata: - '0x00000000025e4b3ca1e3f423c09a0c010161200300010000070c000c30680e00000090000f0ea000060009000d300000000000808094ebdc03', + '0x00000000025e4b3ca1e3f423fccf01010161200300010000070c000c30680e00000090000f0ea000060009000d300000000000808094ebdc03', sender: senderAddress, }, unlocks: { expirationUnixTime: 1680163475 }, @@ -258,7 +270,7 @@ describe('File: getOutputParameters.ts', () => { const expectedOutput = { recipientAddress: destinationNetwork.aliasAddress, - amount: FALLBACK_ESTIMATED_GAS.toString(), + amount: '26785', assets: { nativeTokens: [ { @@ -269,7 +281,7 @@ describe('File: getOutputParameters.ts', () => { }, features: { metadata: - '0x00000000025e4b3ca1e3f423c09a0c010161200300010000070c000c30680e00000090000f0ea000060009000d300000000000400108cd4dcad7ccc383111942671ee8cdc487ddd250398331ca2692b8b1a81551a1c30100000000043b9aca00', + '0x00000000025e4b3ca1e3f423a1d101010161200300010000070c000c30680e00000090000f0ea000060009000d300000000000400108cd4dcad7ccc383111942671ee8cdc487ddd250398331ca2692b8b1a81551a1c30100000000043b9aca00', sender: senderAddress, }, unlocks: { expirationUnixTime: 1680163475 }, @@ -289,13 +301,13 @@ describe('File: getOutputParameters.ts', () => { const expectedOutput = { recipientAddress: destinationNetwork.aliasAddress, - amount: FALLBACK_ESTIMATED_GAS.toString(), + amount: '27170', assets: { nftId, }, features: { metadata: - '0x00000000025e4b3ca1e3f423c09a0c010161200300010000070c000c30680e00000090000f0ea000060009000d3000000000002001cd9430ff870a22f81f92428e5c06975fa3ec1a993331aa3db9fb2298e931ade1', + '0x00000000025e4b3ca1e3f423a2d401010161200300010000070c000c30680e00000090000f0ea000060009000d3000000000002001cd9430ff870a22f81f92428e5c06975fa3ec1a993331aa3db9fb2298e931ade1', sender: senderAddress, }, unlocks: {}, diff --git a/packages/shared/src/lib/core/wallet/utils/getOutputParameters.ts b/packages/shared/src/lib/core/wallet/utils/getOutputParameters.ts index c7219227dc..564293012f 100644 --- a/packages/shared/src/lib/core/wallet/utils/getOutputParameters.ts +++ b/packages/shared/src/lib/core/wallet/utils/getOutputParameters.ts @@ -1,11 +1,11 @@ -import { estimateGasForLayer1ToLayer2Transaction, getLayer2MetadataForTransfer } from '@core/layer-2/utils' +import { getGasFeesForLayer1ToLayer2Transaction, getLayer2MetadataForTransfer } from '@core/layer-2/actions' +import { ChainConfiguration, ChainType, getActiveNetworkId, getChainConfiguration, isEvmChain } from '@core/network' import { getCoinType } from '@core/profile/actions' import { Converter, convertDateToUnixTimestamp } from '@core/utils' import { SendFlowParameters, Subject } from '@core/wallet/types' import { Assets, OutputParams } from '@iota/wallet/out/types' import { ReturnStrategy } from '../enums' import { SendFlowType } from '../stores' -import { ChainConfiguration, ChainType, getActiveNetworkId, getChainConfiguration, isEvmChain } from '@core/network' export async function getOutputParameters( sendFlowParameters: SendFlowParameters, @@ -18,10 +18,7 @@ export async function getOutputParameters( const chainConfig = isToLayer2 ? getChainConfiguration(destinationNetworkId) : undefined const destinationAddress = getDestinationAddress(recipient, chainConfig) - const estimatedGas = await estimateGasForLayer1ToLayer2Transaction(sendFlowParameters) - let amount = getAmountFromTransactionData(sendFlowParameters) - amount = isToLayer2 ? (estimatedGas + parseInt(amount, 10)).toString() : amount const assets = getAssetsFromTransactionData(sendFlowParameters) @@ -32,6 +29,11 @@ export async function getOutputParameters( const expirationUnixTime = expirationDate ? convertDateToUnixTimestamp(expirationDate) : undefined const timelockUnixTime = timelockDate ? convertDateToUnixTimestamp(timelockDate) : undefined + if (isToLayer2) { + const { maxGasFee } = await getGasFeesForLayer1ToLayer2Transaction(sendFlowParameters) + amount = (parseInt(amount, 10) + Number(maxGasFee ?? 0)).toString() + } + return { recipientAddress: destinationAddress, amount, diff --git a/packages/shared/src/lib/features/interfaces/wallet-features.interface.ts b/packages/shared/src/lib/features/interfaces/wallet-features.interface.ts index dd2d634046..63f82337c5 100644 --- a/packages/shared/src/lib/features/interfaces/wallet-features.interface.ts +++ b/packages/shared/src/lib/features/interfaces/wallet-features.interface.ts @@ -8,6 +8,7 @@ export interface IWalletFeatures extends IFeatureFlag { walletConnect: IFeatureFlag assets: IFeatureFlag & { burnToken: IFeatureFlag + unwrapToken: IFeatureFlag } activityHistory: IFeatureFlag & { sync: IFeatureFlag diff --git a/packages/shared/src/locales/en.json b/packages/shared/src/locales/en.json index 8a95aaaa45..d5fb5458ab 100644 --- a/packages/shared/src/locales/en.json +++ b/packages/shared/src/locales/en.json @@ -1207,7 +1207,8 @@ "standard": "Standard", "name": "Name", "tokenId": "Token ID", - "url": "URL" + "url": "URL", + "description": "Description" }, "buttons": { "verifyToken": "I verify this token" diff --git a/yarn.lock b/yarn.lock index 706bc92312..3ef85160b7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -342,15 +342,16 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@bloomwalletio/ui@0.7.0": - version "0.7.0" - resolved "https://npm.pkg.github.com/download/@bloomwalletio/ui/0.7.0/644b7f7d5608b7cef279725e75a731a505dd3618#644b7f7d5608b7cef279725e75a731a505dd3618" - integrity sha512-665sGBFhZ6eCkb73wtjJlWh2xubAyn+ALqOrt5c8hLZ6BvHeq9H87IV5/j60d3P6wcl3pwFpO1ouNE3j/JNuQA== +"@bloomwalletio/ui@0.7.10": + version "0.7.10" + resolved "https://npm.pkg.github.com/download/@bloomwalletio/ui/0.7.10/517dde2cd81244de9848c41d202bc93d21bfd393#517dde2cd81244de9848c41d202bc93d21bfd393" + integrity sha512-7lfkfCAvpwQd6otDeSoLJ47RYNjvRwCcHJ9Y96EMq8nfRXfGfsR5aPJWDgqTFw2AW020k0YLK41WpXhgpUD0SQ== dependencies: "@floating-ui/dom" "1.4.3" "@popperjs/core" "2.11.8" flowbite "1.7.0" flowbite-svelte "0.39.2" + svelte-json-tree "2.1.0" tailwind-merge "1.13.2" "@chainsafe/as-sha256@^0.4.1": @@ -1298,10 +1299,10 @@ dependencies: big-integer "^1.6.51" -"@iota/wallet@2.0.3-rc.45": - version "2.0.3-rc.45" - resolved "https://registry.yarnpkg.com/@iota/wallet/-/wallet-2.0.3-rc.45.tgz#987dafde51fc009a8e79b5998bdc8813a1cffb9e" - integrity sha512-kakwzS8oCv1JefQTOK0YcRjJIEOfoTg2Qmdmd4AOdmA2buSs+UiF4c6PX3rM1oRxDT02HC0U32HMzkMfIPMJRQ== +"@iota/wallet@2.0.3-rc.46": + version "2.0.3-rc.46" + resolved "https://registry.yarnpkg.com/@iota/wallet/-/wallet-2.0.3-rc.46.tgz#7e683cd26d42a8cf14a5562f785231317fbe7e78" + integrity sha512-p7ve//m3eNQ5iHr3Wih0kHVY9/FoSZw1DfUkeIFJOAyjo2HnyJyQdheYG6Eioi3+QGHh6cgkzeIiEaAbiMQFyQ== dependencies: "@iota/types" "^1.0.0-beta.15" cargo-cp-artifact "^0.1.6" @@ -9957,6 +9958,11 @@ svelte-i18n@3.7.0: sade "^1.8.1" tiny-glob "^0.2.9" +svelte-json-tree@2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/svelte-json-tree/-/svelte-json-tree-2.1.0.tgz#616cadae86326881a80bcdb04b451ed57bef7898" + integrity sha512-IAU//hE5bIA0SoM9AuP7xOoD9PUcMh4fio0oI52r0XJ7iNDytW7AnBdkIn1QSYLUyWzvQX3tp59JfLYfhd7lTw== + svelte-loader@3.1.9: version "3.1.9" resolved "https://registry.yarnpkg.com/svelte-loader/-/svelte-loader-3.1.9.tgz#950015ad5b30fb205fceee0dd6d37f228237605c"