Skip to content

Commit c47ef46

Browse files
fix: minor fix
1 parent c536c16 commit c47ef46

File tree

11 files changed

+3716
-3247
lines changed

11 files changed

+3716
-3247
lines changed

packages/extension/src/libs/spark-handler/callRPC.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
11
import axios from "axios";
22

3-
const rpcURL = "https://firo-rpc.publicnode.com/";
3+
const DEFAULT_TIMEOUT = 30000;
4+
5+
const RPC_URLS = {
6+
mainnet: "https://firo-rpc.publicnode.com/",
7+
};
8+
9+
const axiosInstance = axios.create({
10+
timeout: DEFAULT_TIMEOUT,
11+
headers: {
12+
"Content-Type": "application/json",
13+
}
14+
});
415

516
export async function callRPC<T = any>(
617
method: string,
718
params?: object
819
): Promise<T> {
920
try {
10-
const response = await axios.post(
11-
rpcURL,
21+
const response = await axiosInstance.post(
22+
RPC_URLS['mainnet'],
1223
{
1324
jsonrpc: "1.0",
1425
id: "js-client",
@@ -21,6 +32,10 @@ export async function callRPC<T = any>(
2132
},
2233
}
2334
);
35+
36+
if (!response.data || response.data.result === undefined) {
37+
throw new Error('Invalid RPC response structure');
38+
}
2439
return response.data.result;
2540
} catch (error) {
2641
console.error("RPC Error:", error);

packages/extension/src/providers/bitcoin/libs/api-firo.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class API implements ProviderAPIInterface {
2828
return getBitcoinAddress(pubkey, this.networkInfo);
2929
}
3030

31-
// eslint-disable-next-line @typescript-eslint/no-empty-function
31+
3232
async init(): Promise<void> {}
3333

3434
async getRawTransaction(hash: string): Promise<string | null> {
@@ -133,7 +133,7 @@ class API implements ProviderAPIInterface {
133133
ret.sort((a, b) => {
134134
return a.value - b.value;
135135
});
136-
return [ret.at(-1)!]; // TODO: check or filter same values
136+
return ret;
137137
}
138138

139139
async getUTXOs(pubkey: string): Promise<HaskoinUnspentType[]> {
@@ -145,7 +145,7 @@ class API implements ProviderAPIInterface {
145145
return filterOutOrdinals(
146146
address,
147147
this.networkInfo.name,
148-
await this.FiroToHaskoinUTXOs(utxos, address)
148+
[(await this.FiroToHaskoinUTXOs(utxos, address)).at(-1)!]
149149
).then((futxos) => {
150150
futxos.sort((a, b) => {
151151
return a.value - b.value;

packages/extension/src/providers/bitcoin/networks/firo-testnet.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { NetworkNames } from "@enkryptcom/types";
2+
import icon from './icons/firo.svg';
23
import {
34
BitcoinNetwork,
45
BitcoinNetworkOptions,
@@ -18,7 +19,7 @@ const firoOptions: BitcoinNetworkOptions = {
1819
isTestNetwork: true,
1920
currencyName: "tFIRO",
2021
currencyNameLong: "tFiro",
21-
icon: require("./icons/firo.svg"),
22+
icon,
2223
decimals: 8,
2324
node: "https://testexplorer.firo.org",
2425
coingeckoID: "zcoin",

packages/extension/src/providers/bitcoin/networks/firo.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { NetworkNames } from "@enkryptcom/types";
2+
import icon from './icons/firo.svg';
23
import {
34
BitcoinNetwork,
45
BitcoinNetworkOptions,
@@ -18,7 +19,7 @@ const firoOptions: BitcoinNetworkOptions = {
1819
isTestNetwork: false,
1920
currencyName: "FIRO",
2021
currencyNameLong: "Firo",
21-
icon: require("./icons/firo.svg"),
22+
icon,
2223
decimals: 8,
2324
node: "https://explorer.firo.org",
2425
coingeckoID: "zcoin",

packages/extension/src/providers/bitcoin/ui/send-transaction/components/send-spark-address-input.vue

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,23 @@
3333
</template>
3434

3535
<script setup lang="ts">
36-
import { computed } from "@vue/reactivity";
37-
import { PropType, ref } from "vue";
36+
import { PropType, ref, computed } from "vue";
3837
import { isAddress, isSparkAddress } from "@/providers/bitcoin/libs/utils";
3938
import { BitcoinNetwork } from "@/providers/bitcoin/types/bitcoin-network";
4039
4140
const isFocus = ref<boolean>(false);
4241
const addressInput = ref<HTMLInputElement>();
4342
44-
const pasteFromClipboard = () => {
45-
addressInput.value?.focus();
46-
document.execCommand("paste");
43+
const pasteFromClipboard = async () => {
44+
try {
45+
const text = await navigator.clipboard.readText();
46+
if (addressInput.value) {
47+
addressInput.value?.focus()
48+
emit("update:inputAddress", text);
49+
}
50+
} catch (err) {
51+
console.error("Failed to read clipboard:", err);
52+
}
4753
};
4854
defineExpose({ addressInput, pasteFromClipboard });
4955
@@ -83,7 +89,7 @@ const changeFocus = (val: FocusEvent) => {
8389
</script>
8490

8591
<style lang="less">
86-
@import "~@action/styles/theme.less";
92+
@import "@action/styles/theme.less";
8793
8894
.send-address-input {
8995
height: 64px;

packages/extension/src/providers/bitcoin/ui/send-transaction/tabs/spark-send-tab.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,8 @@ const close = () => {
266266
</script>
267267

268268
<style lang="less" scoped>
269-
@import "~@action/styles/theme.less";
270-
@import "~@action/styles/custom-scroll.less";
269+
@import "@action/styles/theme.less";
270+
@import "@action/styles/custom-scroll.less";
271271
272272
.form__container {
273273
display: flex;

packages/extension/src/providers/bitcoin/ui/send-transaction/tabs/transparent-send-tab.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,8 +575,8 @@ const sendAction = async () => {
575575
</script>
576576

577577
<style lang="less" scoped>
578-
@import "~@action/styles/theme.less";
579-
@import "~@action/styles/custom-scroll.less";
578+
@import "@action/styles/theme.less";
579+
@import "@action/styles/custom-scroll.less";
580580
581581
.form__container {
582582
display: flex;

packages/extension/src/ui/action/views/verify-send-from-spark-transaction/index.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
</template>
6969

7070
<script setup lang="ts">
71-
import { onBeforeMount, ref, ComponentPublicInstance, defineEmits } from "vue";
71+
import { onBeforeMount, ref, ComponentPublicInstance } from "vue";
7272
import { useRoute, useRouter } from "vue-router";
7373
import CloseIcon from "@action/icons/common/close-icon.vue";
7474
import BaseButton from "@action/components/base-button/index.vue";
@@ -215,8 +215,8 @@ const isHasScroll = () => {
215215
</script>
216216

217217
<style lang="less" scoped>
218-
@import "~@action/styles/theme.less";
219-
@import "~@action/styles/custom-scroll.less";
218+
@import "@action/styles/theme.less";
219+
@import "@action/styles/custom-scroll.less";
220220
221221
.container {
222222
width: 100%;

packages/extension/src/ui/action/views/verify-send-to-spark-transaction/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,8 @@ const isHasScroll = () => {
216216
</script>
217217

218218
<style lang="less" scoped>
219-
@import "~@action/styles/theme.less";
220-
@import "~@action/styles/custom-scroll.less";
219+
@import "@action/styles/theme.less";
220+
@import "@action/styles/custom-scroll.less";
221221
222222
.container {
223223
width: 100%;

packages/hw-wallets/src/ledger/bitcoin/configs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { NetworkNames } from "@enkryptcom/types";
2-
import { bip44Paths } from "@src/configs";
2+
import { bip44Paths } from "../../configs";
33

44
const supportedPaths = {
55
[NetworkNames.Bitcoin]: [bip44Paths.bitcoinSegwitLedger],

0 commit comments

Comments
 (0)