-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: init commit for signing of tx changes
Signed-off-by: Ivaylo Nikolov <[email protected]>
- Loading branch information
1 parent
e1e119e
commit 2c848c5
Showing
9 changed files
with
240 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import ObjectMap from "../ObjectMap.js"; | ||
import PublicKey from "../PublicKey.js"; | ||
|
||
/** | ||
* @augments {ObjectMap<PublicKey, Uint8Array>} | ||
*/ | ||
export default class SignaturePairMap extends ObjectMap { | ||
constructor() { | ||
super((s) => PublicKey.fromString(s)); | ||
} | ||
|
||
/** | ||
* @param {import("@hashgraph/proto").proto.ISignatureMap} sigMap | ||
* @returns {SignaturePairMap} | ||
*/ | ||
static _fromTransactionSigMap(sigMap) { | ||
const signatures = new SignaturePairMap(); | ||
|
||
const sigPairs = sigMap.sigPair != null ? sigMap.sigPair : []; | ||
|
||
console.log(sigMap); | ||
for (const sigPair of sigPairs) { | ||
if (sigPair.pubKeyPrefix != null) { | ||
if (sigPair.ed25519 != null) { | ||
signatures._set( | ||
PublicKey.fromBytesED25519(sigPair.pubKeyPrefix), | ||
sigPair.ed25519, | ||
); | ||
} else if (sigPair.ECDSASecp256k1 != null) { | ||
signatures._set( | ||
PublicKey.fromBytesECDSA(sigPair.pubKeyPrefix), | ||
sigPair.ECDSASecp256k1, | ||
); | ||
} | ||
} | ||
} | ||
|
||
return signatures; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.