Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #297

Merged
merged 5 commits into from
Jan 9, 2025
Merged

Dev #297

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions apps/demo.lasereyes.build/lib/btc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ export const satoshisToBTC = (satoshis: number): string => {
}

export const getBtcJsNetwork = (network: string): bitcoin.networks.Network => {
return network === 'mainnet' ||
network === 'fractal_mainnet' ||
network === 'fractal_testnet'
return network === MAINNET ||
network === FRACTAL_MAINNET ||
network === FRACTAL_TESTNET
? bitcoin.networks.bitcoin
: bitcoin.networks.testnet
}
Expand Down
2 changes: 1 addition & 1 deletion packages/lasereyes-core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@omnisat/lasereyes-core",
"private": false,
"version": "0.0.54",
"version": "0.0.55-rc.1",
"type": "module",
"main": "./dist/index.umd.cjs",
"module": "./dist/index.js",
Expand Down
21 changes: 7 additions & 14 deletions packages/lasereyes-core/src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ export class LaserEyesClient {
})
}

subscribeKeys(
this.$store,
['hasProvider'],
this.checkInitializationComplete.bind(this)
)
// subscribeKeys(
// this.$store,
// ['hasProvider'],
// this.checkInitializationComplete.bind(this)
// )

// Hack to trigger check for wallet providers
triggerDOMShakeHack()
triggerDOMShakeHack(() => this.$store.setKey('isInitializing', false))
}

private handleIsInitializingChanged(value: boolean) {
Expand All @@ -116,6 +116,7 @@ export class LaserEyesClient {
const provider = this.$providerMap[defaultWallet]
await provider?.connect(defaultWallet)
this.$store.setKey('connected', true)
this.$store.setKey('provider', defaultWallet)
} catch (error) {
this.$store.setKey('isConnecting', false)
this.disconnect()
Expand Down Expand Up @@ -178,14 +179,6 @@ export class LaserEyesClient {
}
}

checkInitializationComplete() {
if (
Object.values(this.$store.get().hasProvider).every((e) => e !== undefined)
) {
this.$store.setKey('isInitializing', false)
}
}

private watchNetworkChange() {
this.$store.setKey('balance', undefined)
}
Expand Down
2 changes: 0 additions & 2 deletions packages/lasereyes-core/src/client/providers/xverse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ export default class XVerseProvider extends WalletProvider {
throw new Error('Could not find the addresses')
}
if (foundAddress && foundPaymentAddress) {
this.$store.setKey('provider', XVERSE)
this.$store.setKey('address', foundAddress.address)
this.$store.setKey('paymentAddress', foundPaymentAddress.address)
}
Expand All @@ -170,7 +169,6 @@ export default class XVerseProvider extends WalletProvider {
},
}
await getAddress(getAddressOptions as GetAddressOptions)
this.$store.setKey('connected', true)
} catch (e) {
throw e
}
Expand Down
23 changes: 12 additions & 11 deletions packages/lasereyes-core/src/client/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ import {
import { NetworkType } from '../types'
import { LaserEyesStoreType } from './types'

export function triggerDOMShakeHack() {
export function triggerDOMShakeHack(callback: VoidFunction) {
if (typeof window !== 'undefined' && typeof localStorage !== 'undefined') {
setTimeout(() => {
const node = document.createTextNode(' ')
document.body.appendChild(node)
node.remove()
callback()
}, 1500)
}
}
Expand All @@ -44,17 +45,17 @@ export function createStores(): {
accounts: [],
balance: undefined,
hasProvider: {
[LEATHER]: undefined,
[UNISAT]: undefined,
[MAGIC_EDEN]: undefined,
[OKX]: undefined,
[OP_NET]: undefined,
[ORANGE]: undefined,
[OYL]: undefined,
[LEATHER]: false,
[UNISAT]: false,
[MAGIC_EDEN]: false,
[OKX]: false,
[OP_NET]: false,
[ORANGE]: false,
[OYL]: false,
[SPARROW]: true,
[PHANTOM]: undefined,
[WIZZ]: undefined,
[XVERSE]: undefined,
[PHANTOM]: false,
[WIZZ]: false,
[XVERSE]: false,
},
}),
$network: atom(MAINNET),
Expand Down
2 changes: 1 addition & 1 deletion packages/lasereyes-react/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@omnisat/lasereyes-react",
"private": false,
"version": "0.0.49",
"version": "0.0.50-rc.0",
"type": "module",
"main": "./dist/index.umd.cjs",
"module": "./dist/index.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/lasereyes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"url": "https://github.com/omnisat/lasereyes-mono.git"
},
"private": false,
"version": "0.0.132",
"version": "0.0.133-rc.1",
"type": "module",
"main": "./dist/index.umd.cjs",
"module": "./dist/index.js",
Expand Down Expand Up @@ -56,4 +56,4 @@
"publishConfig": {
"access": "public"
}
}
}
Loading