feat(sdk-coin-kaspa): implement Kaspa SDK module#8513
Draft
mohd-kashif wants to merge 1 commit intomasterfrom
Draft
feat(sdk-coin-kaspa): implement Kaspa SDK module#8513mohd-kashif wants to merge 1 commit intomasterfrom
mohd-kashif wants to merge 1 commit intomasterfrom
Conversation
eb84b72 to
612ae7d
Compare
253f21e to
939f666
Compare
- Kaspa coin class (UTXO, Schnorr/secp256k1, 8 decimals / sompi) - TransactionBuilder + TransactionBuilderFactory - KeyPair (Secp256k1ExtendedKeyPair, kaspa bech32 address derivation) - Transaction with Blake2b-256 sighash and Schnorr signatures - Utils: kaspa/kaspatest bech32 address validation - Full test suite: keyPair, transaction, builder, utils, coin, transactionFlow tests - .mocharc.yml and eslint config Jira: CECHO-388
939f666 to
ab449e0
Compare
Comment on lines
+22
to
+24
| export const MAINNET_RPC_URL = 'mainnet.kaspa.green'; | ||
| export const TESTNET10_RPC_URL = 'testnet-10.kaspa.green'; | ||
| export const TESTNET11_RPC_URL = 'testnet-11.kaspa.green'; |
Contributor
There was a problem hiding this comment.
Unused constants. Also, why are we storing RPC urls as constants?
| export const VERSION_SCRIPT = 8; // P2SH | ||
|
|
||
| // Decimals: 1 KASPA = 100_000_000 sompi (8 decimal places) | ||
| export const DECIMALS = 8; |
Contributor
There was a problem hiding this comment.
Can we not fetch this from statics. There should be a single source of truth for this.
Comment on lines
+49
to
+65
| recordKeysFromPrivateKey(prv: string): void { | ||
| if (!isValidPrivateKey(prv)) { | ||
| throw new Error('Unsupported private key'); | ||
| } | ||
| if (isValidXprv(prv)) { | ||
| this.hdNode = bip32.fromBase58(prv); | ||
| } else { | ||
| this.keyPair = ECPair.fromPrivateKey(Buffer.from(prv.slice(0, 64), 'hex')); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Build an ECPair from a public key or extended public key. | ||
| * | ||
| * @param {string} pub A raw public key | ||
| */ | ||
| recordKeysFromPublicKey(pub: string): void { |
Contributor
There was a problem hiding this comment.
How is this different from the implementation in base class - Secp256k1ExtendedKeyPair
|
|
||
| /** @inheritDoc */ | ||
| protected signImplementation({ key }: BaseKey): BaseTransaction { | ||
| return this._transaction; |
Contributor
There was a problem hiding this comment.
shouldn't we call the sign method of transaction here.
| * Parse a Kaspa transaction from prebuild. | ||
| */ | ||
| async parseTransaction(params: ParseTransactionOptions): Promise<ParsedTransaction> { | ||
| return {}; |
Contributor
There was a problem hiding this comment.
Why is this returning empty object
| import { BaseCoin as StaticsBaseCoin } from '@bitgo/statics'; | ||
| import { Kaspa } from './kaspa'; | ||
|
|
||
| export class Tkaspa extends Kaspa { |
Contributor
There was a problem hiding this comment.
This class is not adding any functionality. Can be removed.
| * Kaspa transaction sighash computation. | ||
| * | ||
| * Based on the Kaspa BIP-143-like sighash specification: | ||
| * https://github.com/kaspanet/docs/blob/main/Specs/BIP143-like%20SigHashes.md |
Contributor
|
If Kaspa follows UTXO model, why are we not extending abstract-UTXO module for it? |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Jira: CECHO-388