diff --git a/apps/demo.lasereyes.build/components/App.tsx b/apps/demo.lasereyes.build/components/App.tsx
index b5983605..4b5a0491 100644
--- a/apps/demo.lasereyes.build/components/App.tsx
+++ b/apps/demo.lasereyes.build/components/App.tsx
@@ -11,6 +11,7 @@ import {
SIGNET,
SUPPORTED_WALLETS,
TESTNET,
+ LaserEyesLogo,
TESTNET4,
useLaserEyes,
WalletIcon,
@@ -146,7 +147,7 @@ const App = ({ setNetwork }: { setNetwork: (n: NetworkType) => void }) => {
-
{Object.values(SUPPORTED_WALLETS).map(
diff --git a/apps/demo.lasereyes.build/components/WalletCard.tsx b/apps/demo.lasereyes.build/components/WalletCard.tsx
index cb62b5f5..aba41633 100644
--- a/apps/demo.lasereyes.build/components/WalletCard.tsx
+++ b/apps/demo.lasereyes.build/components/WalletCard.tsx
@@ -294,8 +294,6 @@ const WalletCard = ({
//@ts-ignore
setSignedPsbt(signPsbtResponse)
- console.log(signPsbtResponse)
-
if (
typeof signPsbtResponse.signedPsbtHex === 'string' &&
!signPsbtResponse.txId
@@ -382,7 +380,8 @@ const WalletCard = ({
try {
const inscriptionTxId = await inscribe(
Buffer.from(inscriptionText).toString('base64'),
- 'text/plain'
+ 'text/plain',
+ network
)
toast.success(
diff --git a/packages/lasereyes-core/package.json b/packages/lasereyes-core/package.json
index fbe4c00f..826ac225 100644
--- a/packages/lasereyes-core/package.json
+++ b/packages/lasereyes-core/package.json
@@ -1,7 +1,7 @@
{
"name": "@omnisat/lasereyes-core",
"private": false,
- "version": "0.0.44",
+ "version": "0.0.45-rc.1",
"type": "module",
"main": "./dist/index.umd.cjs",
"module": "./dist/index.js",
diff --git a/packages/lasereyes-core/src/client/providers/index.ts b/packages/lasereyes-core/src/client/providers/index.ts
index cbf6cdf3..3afb4698 100644
--- a/packages/lasereyes-core/src/client/providers/index.ts
+++ b/packages/lasereyes-core/src/client/providers/index.ts
@@ -118,6 +118,7 @@ export abstract class WalletProvider {
paymentAddress: this.$store.get().paymentAddress,
paymentPublicKey: this.$store.get().paymentPublicKey,
signPsbt: this.signPsbt.bind(this),
+ network: this.$network.get(),
})
}
}
diff --git a/packages/lasereyes-core/src/client/providers/unisat.ts b/packages/lasereyes-core/src/client/providers/unisat.ts
index a9c3a159..45331ea8 100644
--- a/packages/lasereyes-core/src/client/providers/unisat.ts
+++ b/packages/lasereyes-core/src/client/providers/unisat.ts
@@ -96,7 +96,6 @@ export default class UnisatProvider extends WalletProvider {
if (!unisatAccounts) throw new Error('No accounts found')
await this.getNetwork().then((network) => {
if (this.network !== network) {
- console.log('Network changed')
this.switchNetwork(this.network)
}
})
diff --git a/packages/lasereyes-core/src/constants/networks.ts b/packages/lasereyes-core/src/constants/networks.ts
index ec5490f6..f27679a4 100644
--- a/packages/lasereyes-core/src/constants/networks.ts
+++ b/packages/lasereyes-core/src/constants/networks.ts
@@ -28,6 +28,11 @@ export const ORANGE_TESTNET = 'Testnet'
export const LEATHER_MAINNET = 'mainnet'
export const LEATHER_TESTNET = 'testnet'
+
+export const CMDRUID_MAINNET = 'main'
+export const CMDRUID_TESTNET = 'testnet'
+export const CMDRUID_SIGNET = 'signet'
+
export const MAINNET = 'mainnet'
export const SIGNET = 'signet'
export const TESTNET = 'testnet'
@@ -82,6 +87,16 @@ export const getOrangeNetwork = (network: string): BitcoinNetworkType => {
return ORANGE_MAINNET as BitcoinNetworkType
}
+export const getCmDruidNetwork = (network: string) => {
+ if (network === MAINNET) return CMDRUID_MAINNET
+ if (network === TESTNET4) return CMDRUID_TESTNET
+ if (network === TESTNET) return CMDRUID_TESTNET
+ if (network === SIGNET) return CMDRUID_SIGNET
+ if (network === FRACTAL_MAINNET) return CMDRUID_MAINNET
+ if (network === FRACTAL_TESTNET) return CMDRUID_MAINNET
+ return CMDRUID_MAINNET
+}
+
export const getNetworkForUnisat = (network: string) => {
if (network === UNISAT_MAINNET) return MAINNET
if (network === UNISAT_TESTNET) return TESTNET
diff --git a/packages/lasereyes-core/src/lib/inscribe.ts b/packages/lasereyes-core/src/lib/inscribe.ts
index a0327dd2..933d1fc1 100644
--- a/packages/lasereyes-core/src/lib/inscribe.ts
+++ b/packages/lasereyes-core/src/lib/inscribe.ts
@@ -8,9 +8,10 @@ import {
calculateValueOfUtxosGathered,
getAddressType,
getAddressUtxos,
+ getBitcoinNetwork,
getRedeemScript,
} from './helpers'
-import { MAINNET, P2SH, P2TR } from '../constants'
+import { getCmDruidNetwork, MAINNET, P2SH, P2TR } from '../constants'
import axios from 'axios'
import { getMempoolSpaceUrl } from './urls'
import * as bip39 from 'bip39'
@@ -36,6 +37,7 @@ export const inscribeContent = async ({
paymentAddress,
paymentPublicKey,
signPsbt,
+ network = MAINNET,
}: {
contentBase64?: string
mimeType?: ContentType
@@ -49,7 +51,8 @@ export const inscribeContent = async ({
psbtHex: string,
psbtBase64: string,
finalize?: boolean,
- broadcast?: boolean
+ broadcast?: boolean,
+ network?: NetworkType
) => Promise<
| {
signedPsbtHex: string | undefined
@@ -58,12 +61,13 @@ export const inscribeContent = async ({
}
| undefined
>
+ network: NetworkType
}) => {
try {
if (!contentBase64 && !inscriptions) {
throw new Error('contentBase64 or inscriptions is required')
}
- const privKeyBuff = await generatePrivateKey()
+ const privKeyBuff = await generatePrivateKey(network)
const privKey = Buffer.from(privKeyBuff!).toString('hex')
const ixs = inscriptions
? inscriptions
@@ -72,13 +76,12 @@ export const inscribeContent = async ({
mimeType,
})
- console.log('INSCRIPTIONS', ixs)
-
const commitTx = await getCommitTx({
inscriptions: ixs,
paymentAddress,
paymentPublicKey,
privKey,
+ network,
})
if (!commitTx || !commitTx?.psbtHex) {
@@ -92,18 +95,20 @@ export const inscribeContent = async ({
commitTxHex,
commitTxBase64,
true,
- false
+ false,
+ network
)
if (!response) throw new Error('sign psbt failed')
const psbt = bitcoin.Psbt.fromHex(response?.signedPsbtHex || '')
const extracted = psbt.extractTransaction()
- const commitTxId = await broadcastTx(extracted.toHex(), MAINNET)
+ const commitTxId = await broadcastTx(extracted.toHex(), network)
if (!commitTxId) throw new Error('commit tx failed')
return await executeReveal({
inscriptions: ixs,
ordinalAddress,
privKey,
commitTxId,
+ network,
})
} catch (e) {
throw e
@@ -115,11 +120,13 @@ export const getCommitTx = async ({
paymentAddress,
paymentPublicKey,
privKey,
+ network,
}: {
inscriptions: { content: string; mimeType: ContentType }[]
paymentAddress: string
paymentPublicKey?: string
privKey: string
+ network: NetworkType
isDry?: boolean
}): Promise<
| {
@@ -137,15 +144,16 @@ export const getCommitTx = async ({
if (contentSize > 390000)
throw new Error('Content size is too large, must be less than 390kb')
- const { fastestFee } = await getRecommendedFees(MAINNET)
+ const { fastestFee } = await getRecommendedFees(network)
const pubKey = ecc.keys.get_pubkey(String(privKey), true)
const psbt = new bitcoin.Psbt({
- network: bitcoin.networks.bitcoin,
+ network: getBitcoinNetwork(network),
})
const { inscriberAddress } = createRevealAddressAndKeys(
pubKey,
- inscriptions
+ inscriptions,
+ network
)
const estimatedSize = 5 * 34 * quantity
@@ -155,7 +163,7 @@ export const getCommitTx = async ({
const inscribeFees = Math.floor(commitSatsNeeded + revealSatsNeeded)
const utxosGathered: MempoolUtxo[] = await getAddressUtxos(
paymentAddress,
- MAINNET
+ network
)
const filteredUtxos = utxosGathered
.filter((utxo: MempoolUtxo) => utxo.value > 3000)
@@ -171,10 +179,13 @@ export const getCommitTx = async ({
}
let accSats = 0
- const addressScript = await bitcoin.address.toOutputScript(paymentAddress)
+ const addressScript = await bitcoin.address.toOutputScript(
+ paymentAddress,
+ getBitcoinNetwork(network)
+ )
let counter = 0
for await (const utxo of filteredUtxos) {
- const paymentAddressType = getAddressType(paymentAddress, MAINNET)
+ const paymentAddressType = getAddressType(paymentAddress, network)
console.log({ paymentAddressType })
psbt.addInput({
hash: utxo.txid,
@@ -189,7 +200,7 @@ export const getCommitTx = async ({
}
if (paymentAddressType === P2SH) {
- let redeemScript = getRedeemScript(paymentPublicKey!, MAINNET)
+ let redeemScript = getRedeemScript(paymentPublicKey!, network)
psbt.updateInput(counter, { redeemScript })
}
@@ -229,12 +240,14 @@ export const executeReveal = async ({
ordinalAddress,
commitTxId,
privKey,
+ network,
isDry,
}: {
inscriptions: { content: string; mimeType: ContentType }[]
ordinalAddress: string
commitTxId: string
privKey: string
+ network: NetworkType
isDry?: boolean
}) => {
try {
@@ -244,12 +257,16 @@ export const executeReveal = async ({
const tapleaf = Tap.encodeScript(script)
const [tpubkey, cblock] = Tap.getPubKey(pubKey, { target: tapleaf })
- const txResult = await waitForTransaction(String(commitTxId))
+ const txResult = await waitForTransaction(String(commitTxId), network)
if (!txResult) {
throw new Error('ERROR WAITING FOR COMMIT TX')
}
- const commitTxOutputValue = await getOutputValueByVOutIndex(commitTxId, 0)
+ const commitTxOutputValue = await getOutputValueByVOutIndex(
+ commitTxId,
+ 0,
+ network
+ )
if (commitTxOutputValue === 0 || !commitTxOutputValue) {
throw new Error('ERROR GETTING FIRST INPUT VALUE')
}
@@ -279,17 +296,17 @@ export const executeReveal = async ({
return Tx.util.getTxid(txData)
}
- return await broadcastTx(Tx.encode(txData).hex, MAINNET)
+ return await broadcastTx(Tx.encode(txData).hex, network)
} catch (e: any) {
throw e
}
}
-export async function generatePrivateKey() {
+export async function generatePrivateKey(network: NetworkType) {
const entropy = crypto.getRandomValues(new Uint8Array(32))
const mnemonic = bip39.entropyToMnemonic(Buffer.from(entropy))
const seed = await bip39.mnemonicToSeed(mnemonic)
- const root: BIP32Interface = bip32.fromSeed(seed)
+ const root: BIP32Interface = bip32.fromSeed(seed, getBitcoinNetwork(network))
return root?.derivePath("m/44'/0'/0'/0/0").privateKey
}
@@ -353,12 +370,16 @@ export const createInscriptionScript = (
export const createRevealAddressAndKeys = (
pubKey: any,
- inscriptions: { content: string; mimeType: ContentType }[]
+ inscriptions: { content: string; mimeType: ContentType }[],
+ network: NetworkType = MAINNET
) => {
const script = createInscriptionScript(pubKey, inscriptions)
const tapleaf = Tap.encodeScript(script)
const [tpubkey] = Tap.getPubKey(pubKey, { target: tapleaf })
- const inscriberAddress = Address.p2tr.fromPubKey(tpubkey)
+ const inscriberAddress = Address.p2tr.fromPubKey(
+ tpubkey,
+ getCmDruidNetwork(network)
+ )
return {
inscriberAddress,
@@ -393,12 +414,15 @@ export async function getRawTransaction(
}
}
-export async function waitForTransaction(txId: string): Promise {
+export async function waitForTransaction(
+ txId: string,
+ network: NetworkType
+): Promise {
const timeout: number = 60000
const startTime: number = Date.now()
while (true) {
try {
- const rawTx: any = await getRawTransaction(txId)
+ const rawTx: any = await getRawTransaction(txId, network)
if (rawTx) {
console.log('Transaction found in mempool:', txId)
return true
@@ -431,14 +455,15 @@ export const getRecommendedFees = async (network: NetworkType) => {
export async function getOutputValueByVOutIndex(
commitTxId: string,
- vOut: number
+ vOut: number,
+ network: NetworkType
): Promise {
const timeout: number = 60000
const startTime: number = Date.now()
while (true) {
try {
- const rawTx: any = await getTransaction(commitTxId)
+ const rawTx: any = await getTransaction(commitTxId, network)
if (rawTx && rawTx.vout && rawTx.vout.length > 0) {
return Math.floor(rawTx.vout[vOut].value)
diff --git a/packages/lasereyes-react/lib/icons/index.tsx b/packages/lasereyes-react/lib/icons/index.tsx
index 320acd74..a05fdd8c 100644
--- a/packages/lasereyes-react/lib/icons/index.tsx
+++ b/packages/lasereyes-react/lib/icons/index.tsx
@@ -7,5 +7,6 @@ export * from './wizz'
export * from './okx'
export * from './magiceden'
export * from './orange.tsx'
+export * from './lasereyes-logo.tsx'
export * from './walletIcon'
diff --git a/packages/lasereyes-react/lib/icons/lasereyes-logo.tsx b/packages/lasereyes-react/lib/icons/lasereyes-logo.tsx
new file mode 100644
index 00000000..461052c8
--- /dev/null
+++ b/packages/lasereyes-react/lib/icons/lasereyes-logo.tsx
@@ -0,0 +1,474 @@
+const LaserEyesLogo = ({
+ color = 'green',
+ width = 135,
+ height,
+ ...props
+}: {
+ color?: string
+ width?: number
+ height?: number
+}) => {
+ const aspectRatio = 135 / 56
+ const calculatedHeight = height || width! / aspectRatio
+ const calculatedWidth = width || height! * aspectRatio
+
+ if (color === 'orange') {
+ return (
+
+ )
+ }
+
+ return (
+
+ )
+}
+
+export { LaserEyesLogo }
diff --git a/packages/lasereyes-react/package.json b/packages/lasereyes-react/package.json
index 8ed33bfa..e7f7fa42 100644
--- a/packages/lasereyes-react/package.json
+++ b/packages/lasereyes-react/package.json
@@ -1,7 +1,7 @@
{
"name": "@omnisat/lasereyes-react",
"private": false,
- "version": "0.0.36",
+ "version": "0.0.37-rc.1",
"type": "module",
"main": "./dist/index.umd.cjs",
"module": "./dist/index.js",
diff --git a/packages/lasereyes-vue/package.json b/packages/lasereyes-vue/package.json
index 24ca1d5f..aeb47d1e 100644
--- a/packages/lasereyes-vue/package.json
+++ b/packages/lasereyes-vue/package.json
@@ -1,7 +1,7 @@
{
"name": "@omnisat/lasereyes-vue",
"private": false,
- "version": "0.0.5",
+ "version": "0.0.6-rc.0",
"type": "module",
"files": [
"dist"
diff --git a/packages/lasereyes/index.ts b/packages/lasereyes/index.ts
index 012d2174..d12bc665 100644
--- a/packages/lasereyes/index.ts
+++ b/packages/lasereyes/index.ts
@@ -11,4 +11,5 @@ export {
UnisatLogo,
WizzLogo,
XverseLogo,
+ LaserEyesLogo,
} from '@omnisat/lasereyes-react'
diff --git a/packages/lasereyes/package.json b/packages/lasereyes/package.json
index e31d0f1c..218200e1 100644
--- a/packages/lasereyes/package.json
+++ b/packages/lasereyes/package.json
@@ -20,7 +20,7 @@
"url": "https://github.com/omnisat/lasereyes-mono.git"
},
"private": false,
- "version": "0.0.119",
+ "version": "0.0.120-rc.2",
"type": "module",
"main": "./dist/index.umd.cjs",
"module": "./dist/index.js",
@@ -48,8 +48,8 @@
"vite-plugin-dts": "^4.2.1"
},
"dependencies": {
- "@omnisat/lasereyes-core": "0.0.44",
- "@omnisat/lasereyes-react": "0.0.36",
+ "@omnisat/lasereyes-core": "workspace:*",
+ "@omnisat/lasereyes-react": "workspace:*",
"bip39": "^3.1.0"
},
"license": "MIT",