-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: burn native tokens * chore: cleanup burn function * ui: update burning confirmation style * chore: remove redundant prop * enhancement: add feature flag * chore: remove empty line Co-authored-by: Nicole O'Brien <nicole.obrien@iota.org>
- Loading branch information
1 parent
d75daed
commit ce2df0c
Showing
5 changed files
with
59 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { selectedAccount } from '@core/account/stores/selected-account.store' | ||
import { handleError } from '@core/error/handlers/handleError' | ||
import { handleLedgerError } from '@core/ledger' | ||
import { activeProfile, ProfileType } from '@core/profile' | ||
import { get } from 'svelte/store' | ||
import { selectedAccountAssets } from '../stores' | ||
|
||
export async function burnAsset(assetId: string): Promise<void> { | ||
const account = get(selectedAccount) | ||
const _activeProfile = get(activeProfile) | ||
const nativeTokens = get(selectedAccountAssets).nativeTokens | ||
try { | ||
const balance = nativeTokens.find((_asset) => _asset.id === assetId)?.balance.available | ||
if (balance) { | ||
await account.burnNativeToken(assetId, '0x' + balance.toString(16)) | ||
} | ||
} catch (err) { | ||
if (_activeProfile.type === ProfileType.Ledger) { | ||
handleLedgerError(err.error) | ||
} else { | ||
handleError(err) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters