diff --git a/index.d.ts b/index.d.ts index 75ec3f4..4c75849 100644 --- a/index.d.ts +++ b/index.d.ts @@ -403,6 +403,18 @@ export declare function syntheticKeyToPuzzleHash(syntheticKey: Buffer): Buffer * @returns {BigInt} The cost of the coin spends. */ export declare function getCost(coinSpends: Array): bigint +/** + * Returns the mainnet genesis challenge. + * + * @returns {Buffer} The mainnet genesis challenge. + */ +export declare function getMainnetGenesisChallenge(): Buffer +/** + * Returns the testnet11 genesis challenge. + * + * @returns {Buffer} The testnet11 genesis challenge. + */ +export declare function getTestnet11GenesisChallenge(): Buffer export declare class Peer { /** * Creates a new Peer instance. diff --git a/index.js b/index.js index 9f71def..2388884 100644 --- a/index.js +++ b/index.js @@ -310,7 +310,7 @@ if (!nativeBinding) { throw new Error(`Failed to load native binding`) } -const { newLineageProof, newEveProof, Peer, selectCoins, sendXch, morphLauncherId, createServerCoin, mintStore, oracleSpend, addFee, masterPublicKeyToWalletSyntheticKey, masterPublicKeyToFirstPuzzleHash, masterSecretKeyToWalletSyntheticSecretKey, secretKeyToPublicKey, puzzleHashToAddress, addressToPuzzleHash, adminDelegatedPuzzleFromKey, writerDelegatedPuzzleFromKey, oracleDelegatedPuzzle, signCoinSpends, getCoinId, updateStoreMetadata, updateStoreOwnership, meltStore, signMessage, verifySignedMessage, syntheticKeyToPuzzleHash, getCost } = nativeBinding +const { newLineageProof, newEveProof, Peer, selectCoins, sendXch, morphLauncherId, createServerCoin, mintStore, oracleSpend, addFee, masterPublicKeyToWalletSyntheticKey, masterPublicKeyToFirstPuzzleHash, masterSecretKeyToWalletSyntheticSecretKey, secretKeyToPublicKey, puzzleHashToAddress, addressToPuzzleHash, adminDelegatedPuzzleFromKey, writerDelegatedPuzzleFromKey, oracleDelegatedPuzzle, signCoinSpends, getCoinId, updateStoreMetadata, updateStoreOwnership, meltStore, signMessage, verifySignedMessage, syntheticKeyToPuzzleHash, getCost, getMainnetGenesisChallenge, getTestnet11GenesisChallenge } = nativeBinding module.exports.newLineageProof = newLineageProof module.exports.newEveProof = newEveProof @@ -340,3 +340,5 @@ module.exports.signMessage = signMessage module.exports.verifySignedMessage = verifySignedMessage module.exports.syntheticKeyToPuzzleHash = syntheticKeyToPuzzleHash module.exports.getCost = getCost +module.exports.getMainnetGenesisChallenge = getMainnetGenesisChallenge +module.exports.getTestnet11GenesisChallenge = getTestnet11GenesisChallenge diff --git a/src/lib.rs b/src/lib.rs index 883772d..5d5b057 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1313,3 +1313,19 @@ pub fn get_cost(coin_spends: Vec) -> napi::Result { .map_err(js::err)? .to_js() } + +#[napi] +/// Returns the mainnet genesis challenge. +/// +/// @returns {Buffer} The mainnet genesis challenge. +pub fn get_mainnet_genesis_challenge() -> napi::Result { + MAINNET_CONSTANTS.genesis_challenge.to_js() +} + +#[napi] +/// Returns the testnet11 genesis challenge. +/// +/// @returns {Buffer} The testnet11 genesis challenge. +pub fn get_testnet11_genesis_challenge() -> napi::Result { + TESTNET11_CONSTANTS.genesis_challenge.to_js() +}