Skip to content

Commit

Permalink
fix: dogecoin high fees
Browse files Browse the repository at this point in the history
  • Loading branch information
kvhnuke committed Dec 30, 2023
1 parent 0c8c086 commit 62c6605
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 13 deletions.
20 changes: 10 additions & 10 deletions packages/extension/src/libs/keyring/public-keyring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
3 changes: 2 additions & 1 deletion packages/extension/src/providers/bitcoin/libs/api-ss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ class API implements ProviderAPIInterface {
return toBN(balance.balance)
.add(toBN(balance.unconfirmedBalance))
.toString();
});
})
.catch(() => "0");
}
async broadcastTx(rawtx: string): Promise<boolean> {
return fetch(`${this.node}/api/v1/send`, {
Expand Down
3 changes: 2 additions & 1 deletion packages/extension/src/providers/bitcoin/libs/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<boolean> {
return fetch(`${this.node}transactions`, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const bitcoinOptions: BitcoinNetworkOptions = {
wif: 0xef,
dustThreshold: null,
paymentType: PaymentType.P2WPKH,
maxFeeRate: 5000 * 2,
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const bitcoinOptions: BitcoinNetworkOptions = {
wif: 0x80,
dustThreshold: null,
paymentType: PaymentType.P2WPKH,
maxFeeRate: 5000,
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const dogeOptions: BitcoinNetworkOptions = {
wif: 0x9e,
dustThreshold: null,
paymentType: PaymentType.P2PKH,
maxFeeRate: 5000 * 4,
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const litecoinOptions: BitcoinNetworkOptions = {
wif: 0xb0,
dustThreshold: null,
paymentType: PaymentType.P2WPKH,
maxFeeRate: 5000 * 2,
},
};

Expand Down
1 change: 1 addition & 0 deletions packages/extension/src/providers/bitcoin/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface BitcoinNetworkInfo {
wif: number;
dustThreshold: null;
paymentType: PaymentType;
maxFeeRate: number;
}

export interface HaskoinBalanceType {
Expand Down
5 changes: 4 additions & 1 deletion packages/extension/src/providers/bitcoin/ui/libs/signer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

1 comment on commit 62c6605

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.