Skip to content

Commit

Permalink
fix: remove spark stuff from Firo testnet
Browse files Browse the repository at this point in the history
  • Loading branch information
narekpetrosyan committed Dec 23, 2024
1 parent 7e1d005 commit 2a1b0bc
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 16 deletions.
4 changes: 2 additions & 2 deletions packages/extension/src/libs/spark-handler/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ export async function sendFromSparkAddress(
to: string,
amount: string,
subtractFee = false
) {
return await callRPC<string[]>("spendspark", [
): Promise<string> {
return await callRPC<string>("spendspark", [
{
[to]: {
amount: Number(amount),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
/>

<div
v-if="
!!accountInfo.sparkAccount &&
(network.name === NetworkNames.Firo ||
network.name === NetworkNames.FiroTest)
"
v-if="!!accountInfo.sparkAccount && network.name === NetworkNames.Firo"
class="send-transaction__tabs"
>
<button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@

<div class="form__container-send-input">
<send-spark-address-input
v-if="network.name === 'Firo'"
ref="addressInputTo"
class="no-margin"
title="To address"
:value="addressTo"
:network="(network as BitcoinNetwork)"
@update:input-address="inputAddressTo"
@toggle:show-contacts="toggleSelectContactTo"
/>
<send-address-input
v-if="network.name !== 'Firo'"
ref="addressInputTo"
class="no-margin"
title="To address"
Expand Down
10 changes: 2 additions & 8 deletions packages/extension/src/ui/action/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,7 @@ const generateNewSparkAddress = async () => {
}
};
const getSparkAccountState = async (network: BaseNetwork) => {
if (
network.name === NetworkNames.Firo ||
network.name === NetworkNames.FiroTest
) {
if (network.name === NetworkNames.Firo) {
const sparkAccountResponse = await getSparkState();
accountHeaderData.value.sparkAccount = { ...sparkAccountResponse };
}
Expand All @@ -325,10 +322,7 @@ const setNetwork = async (network: BaseNetwork) => {
let sparkAccount: SparkAccount | null = null;
if (
network.name === NetworkNames.Firo ||
network.name === NetworkNames.FiroTest
) {
if (network.name === NetworkNames.Firo) {
const sparkAccountResponse = await getSparkState();
sparkAccount = { ...sparkAccountResponse };
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,30 @@ const sendAction = async () => {
value: txData.toToken.amount,
transactionHash: "",
};
const activityState = new ActivityState();
await sendFromSparkAddress(
txData.toAddress,
fromBase(txData.toToken.amount, txData.toToken.decimals).toString()
)
.then(() => {
.then((res) => {
trackSendEvents(SendEventType.SendComplete, {
network: network.value.name,
});
activityState.addActivities(
[
{
...txActivity,
...{ transactionHash: res },
},
],
{
address: network.value.displayAddress(txData.fromAddress),
network: network.value.name,
}
);
isSendDone.value = true;
if (getCurrentContext() === "popup") {
setTimeout(() => {
Expand Down

0 comments on commit 2a1b0bc

Please sign in to comment.