@blaze-cardano/core
Advanced tools
@@ -8,2 +8,3 @@ import * as _cardano_sdk_util from '@cardano-sdk/util'; | ||
import * as bip39 from '@scure/bip39'; | ||
export { wordlist } from '@scure/bip39/wordlists/english'; | ||
@@ -73,2 +74,3 @@ declare const Slot: (value: number) => C.Cardano.Slot; | ||
type Credential = C.Serialization.Credential; | ||
type CredentialCore = C.Cardano.Credential; | ||
declare const Ed25519PublicKeyHex: (value: string) => Crypto.Ed25519PublicKeyHex; | ||
@@ -113,2 +115,8 @@ type Ed25519PublicKeyHex = Crypto.Ed25519PublicKeyHex; | ||
type Ed25519SignatureHex = Crypto.Ed25519SignatureHex; | ||
declare const Ed25519PublicKey: typeof Crypto.Ed25519PublicKey; | ||
type Ed25519PublicKey = Crypto.Ed25519PublicKey; | ||
declare const Ed25519Signature: typeof Crypto.Ed25519Signature; | ||
type Ed25519Signature = Crypto.Ed25519Signature; | ||
declare const Bip32PrivateKey: typeof Crypto.Bip32PrivateKey; | ||
type Bip32PrivateKey = Crypto.Bip32PrivateKey; | ||
declare const PlutusLanguageVersion: typeof C.Cardano.PlutusLanguageVersion; | ||
@@ -150,2 +158,3 @@ type PlutusLanguageVersion = C.Cardano.PlutusLanguageVersion; | ||
type NetworkId = C.Cardano.ChainId["networkId"]; | ||
declare const DatumKind: typeof C.Serialization.DatumKind; | ||
type Evaluator = (tx: Transaction, additionalUtxos: TransactionUnspentOutput[]) => Promise<Redeemers>; | ||
@@ -243,3 +252,2 @@ | ||
*/ | ||
declare const addressFromBech32: typeof C.Cardano.Address.fromBech32; | ||
/** | ||
@@ -338,2 +346,2 @@ * Function to create an Address from a validator script. | ||
export { Address, AddressType, AssetId, AssetName, CborSet, CborWriter, Certificate, CertificateType, CostModel, type CostModels, Costmdls, Credential, CredentialType, type Datum, DatumHash, Ed25519KeyHashHex, Ed25519PrivateExtendedKeyHex, Ed25519PrivateNormalKeyHex, Ed25519PublicKeyHex, Ed25519SignatureHex, type Evaluator, ExUnits, Hash, Hash28ByteBase16, Hash32ByteBase16, HashAsPubKeyHex, NativeScript, NetworkId, PaymentAddress, PlutusData, PlutusLanguageVersion, PlutusV1Script, PlutusV2Script, PlutusV3Script, PolicyId, PolicyIdToHash, PoolId, type ProtocolParameters, Redeemer, RedeemerPurpose, RedeemerTag, Redeemers, RewardAccount, RewardAddress, Script, type ScriptHash, Slot, StakeDelegation, type StakeDelegationCertificate, StakeRegistration, type TokenMap, Transaction, TransactionBody, TransactionId, TransactionInput, type TransactionInputSet, TransactionOutput, TransactionUnspentOutput, type TransactionWitnessPlutusData, TransactionWitnessSet, Value, VkeyWitness, addressFromBech32, addressFromCredential, addressFromValidator, blake2b_224, blake2b_256, derivePublicKey, entropyToMnemonic, fromHex, generateMnemonic, getPaymentAddress, hardCodedProtocolParams, mnemonicToEntropy, sha2_256, sha3_256, signMessage, toHex }; | ||
export { Address, AddressType, AssetId, AssetName, Bip32PrivateKey, CborSet, CborWriter, Certificate, CertificateType, CostModel, type CostModels, Costmdls, Credential, type CredentialCore, CredentialType, type Datum, DatumHash, DatumKind, Ed25519KeyHashHex, Ed25519PrivateExtendedKeyHex, Ed25519PrivateNormalKeyHex, Ed25519PublicKey, Ed25519PublicKeyHex, Ed25519Signature, Ed25519SignatureHex, type Evaluator, ExUnits, Hash, Hash28ByteBase16, Hash32ByteBase16, HashAsPubKeyHex, NativeScript, NetworkId, PaymentAddress, PlutusData, PlutusLanguageVersion, PlutusV1Script, PlutusV2Script, PlutusV3Script, PolicyId, PolicyIdToHash, PoolId, type ProtocolParameters, Redeemer, RedeemerPurpose, RedeemerTag, Redeemers, RewardAccount, RewardAddress, Script, type ScriptHash, Slot, StakeDelegation, type StakeDelegationCertificate, StakeRegistration, type TokenMap, Transaction, TransactionBody, TransactionId, TransactionInput, type TransactionInputSet, TransactionOutput, TransactionUnspentOutput, type TransactionWitnessPlutusData, TransactionWitnessSet, Value, VkeyWitness, addressFromCredential, addressFromValidator, blake2b_224, blake2b_256, derivePublicKey, entropyToMnemonic, fromHex, generateMnemonic, getPaymentAddress, hardCodedProtocolParams, mnemonicToEntropy, sha2_256, sha3_256, signMessage, toHex }; |
@@ -37,2 +37,3 @@ "use strict"; | ||
AssetName: () => AssetName, | ||
Bip32PrivateKey: () => Bip32PrivateKey2, | ||
CborSet: () => CborSet, | ||
@@ -47,6 +48,9 @@ CborWriter: () => CborWriter, | ||
DatumHash: () => DatumHash, | ||
DatumKind: () => DatumKind, | ||
Ed25519KeyHashHex: () => Ed25519KeyHashHex2, | ||
Ed25519PrivateExtendedKeyHex: () => Ed25519PrivateExtendedKeyHex, | ||
Ed25519PrivateNormalKeyHex: () => Ed25519PrivateNormalKeyHex, | ||
Ed25519PublicKey: () => Ed25519PublicKey2, | ||
Ed25519PublicKeyHex: () => Ed25519PublicKeyHex2, | ||
Ed25519Signature: () => Ed25519Signature2, | ||
Ed25519SignatureHex: () => Ed25519SignatureHex2, | ||
@@ -61,3 +65,2 @@ ExUnits: () => ExUnits, | ||
NetworkId: () => NetworkId, | ||
OpaqueString: () => import_util2.OpaqueString, | ||
PaymentAddress: () => PaymentAddress, | ||
@@ -91,3 +94,2 @@ PlutusData: () => PlutusData, | ||
VkeyWitness: () => VkeyWitness, | ||
addressFromBech32: () => addressFromBech32, | ||
addressFromCredential: () => addressFromCredential, | ||
@@ -108,3 +110,4 @@ addressFromValidator: () => addressFromValidator, | ||
toHex: () => toHex, | ||
typedHex: () => import_util2.typedHex | ||
typedHex: () => import_util2.typedHex, | ||
wordlist: () => import_english.wordlist | ||
}); | ||
@@ -154,2 +157,5 @@ module.exports = __toCommonJS(src_exports); | ||
var Ed25519SignatureHex2 = Crypto.Ed25519SignatureHex; | ||
var Ed25519PublicKey2 = Crypto.Ed25519PublicKey; | ||
var Ed25519Signature2 = Crypto.Ed25519Signature; | ||
var Bip32PrivateKey2 = Crypto.Bip32PrivateKey; | ||
var PlutusLanguageVersion = C.Cardano.PlutusLanguageVersion; | ||
@@ -168,2 +174,3 @@ var NativeScript = C.Serialization.NativeScript; | ||
var NetworkId = C.Cardano.NetworkId; | ||
var DatumKind = C.Serialization.DatumKind; | ||
@@ -175,7 +182,6 @@ // src/util.ts | ||
var sha3 = __toESM(require("@noble/hashes/sha3")); | ||
var import_sha512 = require("@noble/hashes/sha512"); | ||
var blake = __toESM(require("blakejs")); | ||
var bip39 = __toESM(require("@scure/bip39")); | ||
var ed = __toESM(require("@noble/ed25519")); | ||
ed.etc.sha512Sync = (...m) => (0, import_sha512.sha512)(ed.etc.concatBytes(...m)); | ||
var import_ed25519 = require("@noble/curves/ed25519"); | ||
var import_english = require("@scure/bip39/wordlists/english"); | ||
function getPaymentAddress(address) { | ||
@@ -228,10 +234,10 @@ const bech = address.toBech32(); | ||
return Ed25519PublicKeyHex2( | ||
toHex(ed.getPublicKey(fromHex(privateKey.slice(0, 64)))) | ||
toHex(import_ed25519.ed25519.getPublicKey(fromHex(privateKey.slice(0, 64)))) | ||
); | ||
} else { | ||
return Ed25519PublicKeyHex2(toHex(ed.getPublicKey(fromHex(privateKey)))); | ||
return Ed25519PublicKeyHex2(toHex(import_ed25519.ed25519.getPublicKey(fromHex(privateKey)))); | ||
} | ||
} | ||
function signMessage(message, privateKey) { | ||
return Ed25519SignatureHex2(toHex(ed.sign(message, privateKey))); | ||
return Ed25519SignatureHex2(toHex(import_ed25519.ed25519.sign(message, privateKey))); | ||
} | ||
@@ -241,3 +247,2 @@ var generateMnemonic2 = bip39.generateMnemonic; | ||
var mnemonicToEntropy2 = bip39.mnemonicToEntropy; | ||
var addressFromBech32 = Address.fromBech32; | ||
var addressFromValidator = (network, validator) => new Address({ | ||
@@ -656,2 +661,3 @@ paymentPart: { hash: validator.hash(), type: CredentialType.ScriptHash }, | ||
AssetName, | ||
Bip32PrivateKey, | ||
CborSet, | ||
@@ -666,6 +672,9 @@ CborWriter, | ||
DatumHash, | ||
DatumKind, | ||
Ed25519KeyHashHex, | ||
Ed25519PrivateExtendedKeyHex, | ||
Ed25519PrivateNormalKeyHex, | ||
Ed25519PublicKey, | ||
Ed25519PublicKeyHex, | ||
Ed25519Signature, | ||
Ed25519SignatureHex, | ||
@@ -680,3 +689,2 @@ ExUnits, | ||
NetworkId, | ||
OpaqueString, | ||
PaymentAddress, | ||
@@ -710,3 +718,2 @@ PlutusData, | ||
VkeyWitness, | ||
addressFromBech32, | ||
addressFromCredential, | ||
@@ -727,3 +734,4 @@ addressFromValidator, | ||
toHex, | ||
typedHex | ||
typedHex, | ||
wordlist | ||
}); |
{ | ||
"name": "@blaze-cardano/core", | ||
"version": "0.0.1", | ||
"version": "0.1.0", | ||
"description": "Blaze cardano core library", | ||
"main": "./dist/index.js", | ||
"module": "./dist/index.mjs", | ||
"types": "./dist/index.d.ts", | ||
"files": [ | ||
"dist/**" | ||
], | ||
"exports": { | ||
".": { | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.js" | ||
} | ||
}, | ||
"devDependencies": { | ||
@@ -25,10 +25,12 @@ "eslint": "^8.57.0", | ||
"@cardano-sdk/util": "^0.15.1", | ||
"@noble/curves": "^1.4.0", | ||
"@noble/ed25519": "^2.1.0", | ||
"@noble/hashes": "^1.4.0", | ||
"@scure/bip39": "^1.3.0", | ||
"blakejs": "^1.2.1" | ||
"blakejs": "^1.2.1", | ||
"rxjs": "7.8.1" | ||
}, | ||
"scripts": { | ||
"build": "tsup src/index.ts --format esm,cjs --dts --external rxjs", | ||
"dev": "tsup src/index.ts --format esm,cjs --watch --dts --external rxjs", | ||
"build": "tsup src/index.ts --format esm,cjs --dts ", | ||
"dev": "tsup src/index.ts --format esm,cjs --watch --dts", | ||
"lint": "eslint \"src/**/*.ts*\"", | ||
@@ -35,0 +37,0 @@ "clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
95607
31.25%15
150%2159
31.09%9
28.57%