diff --git a/packages/extension/src/libs/keyring/public-keyring.ts b/packages/extension/src/libs/keyring/public-keyring.ts index 87fbc4349..6f58aa10d 100644 --- a/packages/extension/src/libs/keyring/public-keyring.ts +++ b/packages/extension/src/libs/keyring/public-keyring.ts @@ -64,16 +64,16 @@ class PublicKeyRing { walletType: WalletType.mnemonic, isHardware: false, }; - allKeys["ltc1qccf4af6j3xm9v3r6ujt7dlmvazywzq82hnuwgx"] = { - address: "ltc1qccf4af6j3xm9v3r6ujt7dlmvazywzq82hnuwgx", - basePath: "m/49'/2'/0'/1", - name: "fake ltc account #4", - pathIndex: 0, - publicKey: "0x0", - signerType: SignerType.secp256k1btc, - walletType: WalletType.mnemonic, - isHardware: false, - }; + // allKeys["ltc1qccf4af6j3xm9v3r6ujt7dlmvazywzq82hnuwgx"] = { + // address: "ltc1qccf4af6j3xm9v3r6ujt7dlmvazywzq82hnuwgx", + // basePath: "m/49'/2'/0'/1", + // name: "fake ltc account #4", + // pathIndex: 0, + // publicKey: "0x0", + // signerType: SignerType.secp256k1btc, + // walletType: WalletType.mnemonic, + // isHardware: false, + // }; } return allKeys; } diff --git a/packages/extension/src/providers/bitcoin/libs/api-ss.ts b/packages/extension/src/providers/bitcoin/libs/api-ss.ts index 42671d7c5..df9899e73 100644 --- a/packages/extension/src/providers/bitcoin/libs/api-ss.ts +++ b/packages/extension/src/providers/bitcoin/libs/api-ss.ts @@ -63,7 +63,8 @@ class API implements ProviderAPIInterface { return toBN(balance.balance) .add(toBN(balance.unconfirmedBalance)) .toString(); - }); + }) + .catch(() => "0"); } async broadcastTx(rawtx: string): Promise { return fetch(`${this.node}/api/v1/send`, { diff --git a/packages/extension/src/providers/bitcoin/libs/api.ts b/packages/extension/src/providers/bitcoin/libs/api.ts index 1ee289e6f..da9dc6bf0 100644 --- a/packages/extension/src/providers/bitcoin/libs/api.ts +++ b/packages/extension/src/providers/bitcoin/libs/api.ts @@ -56,7 +56,8 @@ class API implements ProviderAPIInterface { .then((balance: HaskoinBalanceType) => { if ((balance as any).error) return "0"; return toBN(balance.confirmed).addn(balance.unconfirmed).toString(); - }); + }) + .catch(() => "0"); } async broadcastTx(rawtx: string): Promise { return fetch(`${this.node}transactions`, { diff --git a/packages/extension/src/providers/bitcoin/libs/ss-fee-handler.ts b/packages/extension/src/providers/bitcoin/libs/ss-fee-handler.ts index 1cc641602..81151b173 100644 --- a/packages/extension/src/providers/bitcoin/libs/ss-fee-handler.ts +++ b/packages/extension/src/providers/bitcoin/libs/ss-fee-handler.ts @@ -19,6 +19,8 @@ const SSFeeHandler = async ( .then((json: FeeType) => { if (json.fast.satsPerKiloByte < 0) json.fast.satsPerKiloByte = json.average.satsPerKiloByte; + if (json.average.satsPerKiloByte < 0) + json.average.satsPerKiloByte = json.slow.satsPerKiloByte; return { [GasPriceTypes.FASTEST]: Math.ceil(json.fast.satsPerKiloByte / 1024) + 5, diff --git a/packages/extension/src/providers/bitcoin/networks/bitcoin-testnet.ts b/packages/extension/src/providers/bitcoin/networks/bitcoin-testnet.ts index fe2c96906..fe9c716d2 100644 --- a/packages/extension/src/providers/bitcoin/networks/bitcoin-testnet.ts +++ b/packages/extension/src/providers/bitcoin/networks/bitcoin-testnet.ts @@ -46,6 +46,7 @@ const bitcoinOptions: BitcoinNetworkOptions = { wif: 0xef, dustThreshold: null, paymentType: PaymentType.P2WPKH, + maxFeeRate: 5000 * 2, }, }; diff --git a/packages/extension/src/providers/bitcoin/networks/bitcoin.ts b/packages/extension/src/providers/bitcoin/networks/bitcoin.ts index 8e17d7db0..20641fb26 100644 --- a/packages/extension/src/providers/bitcoin/networks/bitcoin.ts +++ b/packages/extension/src/providers/bitcoin/networks/bitcoin.ts @@ -39,6 +39,7 @@ const bitcoinOptions: BitcoinNetworkOptions = { wif: 0x80, dustThreshold: null, paymentType: PaymentType.P2WPKH, + maxFeeRate: 5000, }, }; diff --git a/packages/extension/src/providers/bitcoin/networks/dogecoin.ts b/packages/extension/src/providers/bitcoin/networks/dogecoin.ts index 63b06beea..589503314 100644 --- a/packages/extension/src/providers/bitcoin/networks/dogecoin.ts +++ b/packages/extension/src/providers/bitcoin/networks/dogecoin.ts @@ -41,6 +41,7 @@ const dogeOptions: BitcoinNetworkOptions = { wif: 0x9e, dustThreshold: null, paymentType: PaymentType.P2PKH, + maxFeeRate: 5000 * 4, }, }; diff --git a/packages/extension/src/providers/bitcoin/networks/litecoin.ts b/packages/extension/src/providers/bitcoin/networks/litecoin.ts index a565d52e9..050b569e7 100644 --- a/packages/extension/src/providers/bitcoin/networks/litecoin.ts +++ b/packages/extension/src/providers/bitcoin/networks/litecoin.ts @@ -41,6 +41,7 @@ const litecoinOptions: BitcoinNetworkOptions = { wif: 0xb0, dustThreshold: null, paymentType: PaymentType.P2WPKH, + maxFeeRate: 5000 * 2, }, }; diff --git a/packages/extension/src/providers/bitcoin/types/index.ts b/packages/extension/src/providers/bitcoin/types/index.ts index d5c965487..011822d6d 100644 --- a/packages/extension/src/providers/bitcoin/types/index.ts +++ b/packages/extension/src/providers/bitcoin/types/index.ts @@ -19,6 +19,7 @@ export interface BitcoinNetworkInfo { wif: number; dustThreshold: null; paymentType: PaymentType; + maxFeeRate: number; } export interface HaskoinBalanceType { diff --git a/packages/extension/src/providers/bitcoin/ui/libs/signer.ts b/packages/extension/src/providers/bitcoin/ui/libs/signer.ts index afe2e7098..dbafcb399 100644 --- a/packages/extension/src/providers/bitcoin/ui/libs/signer.ts +++ b/packages/extension/src/providers/bitcoin/ui/libs/signer.ts @@ -32,7 +32,10 @@ const TransactionSigner = ( }); }, }; - const tx = new Psbt({ network: network.networkInfo }); + const tx = new Psbt({ + network: network.networkInfo, + maximumFeeRate: network.networkInfo.maxFeeRate, + }); payload.inputs .map((u) => { const res: {