Refactor getting private key
This commit is contained in:
parent
9df58b9511
commit
7229e6c97c
@ -133,8 +133,10 @@ export const SignTxEmbed = () => {
|
||||
|
||||
// Balance Check
|
||||
// Use a temporary read-only client for balance
|
||||
const { privKey } = await getPathKey(`${network.namespace}:${network.chainId}`, account.index)
|
||||
|
||||
const tempWallet = await DirectSecp256k1Wallet.fromKey(
|
||||
new Uint8Array(Buffer.from((await getPathKey(`${network.namespace}:${network.chainId}`, account.index)).privKey.replace(/^0x/, ''), 'hex')),
|
||||
new Uint8Array(Buffer.from(privKey.replace(/^0x/, ''), 'hex')),
|
||||
network.addressPrefix
|
||||
);
|
||||
|
||||
@ -222,6 +224,7 @@ export const SignTxEmbed = () => {
|
||||
|
||||
try {
|
||||
const { privKey } = await getPathKey(`${requestedNetwork.namespace}:${chainId}`, account.index);
|
||||
|
||||
const privateKeyBytes = Buffer.from(privKey.replace(/^0x/, ''), 'hex');
|
||||
const wallet = await DirectSecp256k1Wallet.fromKey(new Uint8Array(privateKeyBytes), requestedNetwork.addressPrefix); // Wrap in Uint8Array
|
||||
|
||||
@ -370,7 +373,7 @@ export const SignTxEmbed = () => {
|
||||
disabled={isTxLoading}
|
||||
style={{ marginTop: 10 }}
|
||||
>
|
||||
Reject
|
||||
Reject
|
||||
</Button>
|
||||
</View>
|
||||
</>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user