Skip to content

Commit

Permalink
Use on-chain pubkey type if available
Browse files Browse the repository at this point in the history
  • Loading branch information
tombeynon committed Oct 13, 2022
1 parent 264a8b8 commit 4af23e6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/utils/SigningClient.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -279,14 +279,14 @@ function SigningClient(network, signer) {
if (!accountFromSigner) {
throw new Error("Failed to retrieve account from signer");
}
const pubkey = accountFromSigner.pubkey;
const signerPubkey = accountFromSigner.pubkey;
return AuthInfo.encode({
signerInfos: [
{
publicKey: {
typeUrl: pubkeyTypeUrl(),
typeUrl: pubkeyTypeUrl(account.pub_key),
value: PubKey.encode({
key: pubkey,
key: signerPubkey,
}).finish(),
},
sequence: Long.fromNumber(sequence, true),
Expand All @@ -297,7 +297,9 @@ function SigningClient(network, signer) {
}).finish()
}

function pubkeyTypeUrl(){
function pubkeyTypeUrl(pub_key){
if(pub_key && pub_key['@type']) return pub_key['@type']

if(network.path === 'injective'){
return '/injective.crypto.v1beta1.ethsecp256k1.PubKey'
}
Expand Down

0 comments on commit 4af23e6

Please sign in to comment.