From bcad5e351b8f5324d7884c7e8b8c9723dafb7c28 Mon Sep 17 00:00:00 2001 From: Felipe Mendes Date: Fri, 6 Dec 2024 15:38:07 -0300 Subject: [PATCH 01/12] feat: add base implementation for okx connector --- packages/adapters/bitcoin/src/adapter.ts | 15 +- .../bitcoin/src/connectors/OKXConnector.ts | 141 ++++++++++++++++++ 2 files changed, 155 insertions(+), 1 deletion(-) create mode 100644 packages/adapters/bitcoin/src/connectors/OKXConnector.ts diff --git a/packages/adapters/bitcoin/src/adapter.ts b/packages/adapters/bitcoin/src/adapter.ts index 0e233930c6..5ec69e9bdb 100644 --- a/packages/adapters/bitcoin/src/adapter.ts +++ b/packages/adapters/bitcoin/src/adapter.ts @@ -12,6 +12,7 @@ import { SatsConnectConnector } from './connectors/SatsConnectConnector.js' import { WalletStandardConnector } from './connectors/WalletStandardConnector.js' import { WalletConnectProvider } from './utils/WalletConnectProvider.js' import { LeatherConnector } from './connectors/LeatherConnector.js' +import { OKXConnector } from './connectors/OKXConnector.js' export class BitcoinAdapter extends AdapterBlueprint { private eventsToUnbind: (() => void)[] = [] @@ -78,6 +79,10 @@ export class BitcoinAdapter extends AdapterBlueprint { } } override syncConnectors(_options?: AppKitOptions, appKit?: AppKit): void { + function getActiveNetwork() { + return appKit?.getCaipNetwork() + } + WalletStandardConnector.watchWallets({ callback: this.addConnector.bind(this), requestedChains: this.networks @@ -86,7 +91,7 @@ export class BitcoinAdapter extends AdapterBlueprint { this.addConnector( ...SatsConnectConnector.getWallets({ requestedChains: this.networks, - getActiveNetwork: () => appKit?.getCaipNetwork() + getActiveNetwork }).map(connector => { switch (connector.wallet.id) { case LeatherConnector.ProviderId: @@ -99,6 +104,14 @@ export class BitcoinAdapter extends AdapterBlueprint { } }) ) + + const okxConnector = OKXConnector.getWallet({ + requestedChains: this.networks, + getActiveNetwork + }) + if (okxConnector) { + this.addConnector(okxConnector) + } } override syncConnection( diff --git a/packages/adapters/bitcoin/src/connectors/OKXConnector.ts b/packages/adapters/bitcoin/src/connectors/OKXConnector.ts new file mode 100644 index 0000000000..aeb1fcaae6 --- /dev/null +++ b/packages/adapters/bitcoin/src/connectors/OKXConnector.ts @@ -0,0 +1,141 @@ +import type { CaipNetwork } from '@reown/appkit-common' +import type { BitcoinConnector } from '../utils/BitcoinConnector.js' +import { ProviderEventEmitter } from '../utils/ProviderEventEmitter.js' +import type { RequestArguments } from '@reown/appkit-core' +import { MethodNotSupportedError } from '../errors/MethodNotSupportedError.js' + +export class OKXConnector extends ProviderEventEmitter implements BitcoinConnector { + public readonly id = 'OKX' + public readonly name = 'OKX Wallet' + public readonly chain = 'bip122' + public readonly type = 'ANNOUNCED' + public readonly imageUrl = '' + + public readonly provider = this + + private readonly wallet: OKXConnector.Wallet + private readonly requestedChains: CaipNetwork[] = [] + private readonly getActiveNetwork: () => CaipNetwork | undefined + + constructor({ wallet, requestedChains, getActiveNetwork }: OKXConnector.ConstructorParams) { + super() + this.wallet = wallet + this.requestedChains = requestedChains + this.getActiveNetwork = getActiveNetwork + } + + public get chains() { + return this.requestedChains + } + + public async connect(): Promise { + const result = await this.wallet.connect() + + return result.address + } + + public async disconnect(): Promise { + await this.wallet.disconnect() + } + + public async getAccountAddresses(): Promise { + const accounts = await this.wallet.getAccounts() + + return accounts.map(account => ({ + address: account, + purpose: 'payment' + })) + } + + public async signMessage(params: BitcoinConnector.SignMessageParams): Promise { + return this.wallet.signMessage(params.message) + } + + public async sendTransfer(params: BitcoinConnector.SendTransferParams): Promise { + const network = this.getActiveNetwork() + + if (!network) { + throw new Error('No active network available') + } + + const from = (await this.wallet.getAccounts())[0] + + if (!from) { + throw new Error('No account available') + } + + const value = (Number(params.amount) / 10 ** network.nativeCurrency.decimals).toString() + + const result = await this.wallet.send({ + from, + to: params.recipient, + value + }) + + return result.txhash + } + + public async signPSBT( + params: BitcoinConnector.SignPSBTParams + ): Promise { + const psbtHex = Buffer.from(params.psbt, 'base64').toString('hex') + + const signedPsbtHex = await this.wallet.signPSBT(psbtHex) + + let txid: string | undefined = undefined + if (params.broadcast) { + txid = await this.wallet.pushPSBT(signedPsbtHex) + } + + return { + psbt: Buffer.from(signedPsbtHex, 'hex').toString('base64'), + txid + } + } + + public request(_args: RequestArguments): Promise { + return Promise.reject(new MethodNotSupportedError(this.id, 'request')) + } + + public static getWallet(params: OKXConnector.GetWalletParams): OKXConnector | undefined { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const wallet = (window as any)?.okxwallet?.bitcoin + + if (wallet) { + return new OKXConnector({ wallet, ...params }) + } + + return undefined + } +} + +export namespace OKXConnector { + export type ConstructorParams = { + wallet: Wallet + requestedChains: CaipNetwork[] + getActiveNetwork: () => CaipNetwork | undefined + } + + export type Wallet = { + /* + * This interface doesn't include all available methods + * Reference: https://www.okx.com/web3/build/docs/sdks/chains/bitcoin/provider + */ + connect(): Promise<{ address: string; publicKey: string }> + disconnect(): Promise + getAccounts(): Promise + signMessage(signStr: string, type?: 'ecdsa' | 'bip322-simple'): Promise + signPSBT(psbtHex: string): Promise + pushPSBT(psbtHex: string): Promise + send(params: { + from: string + to: string + value: string + satBytes?: string + memo?: string + memoPos?: number + }): Promise<{ txhash: string }> + } + + export type GetWalletParams = Omit +} From 2e63990b7bba91546c4f0a6806f7f594b9368b64 Mon Sep 17 00:00:00 2001 From: Felipe Mendes Date: Mon, 9 Dec 2024 13:16:00 -0300 Subject: [PATCH 02/12] feat: add events binding and psbt generation for different addresses --- apps/laboratory/package.json | 1 + .../Bitcoin/BitcoinSignPSBTTest.tsx | 1 + apps/laboratory/src/utils/BitcoinUtil.ts | 32 +++++++++++++++++-- packages/adapters/bitcoin/package.json | 1 + .../bitcoin/src/connectors/OKXConnector.ts | 30 ++++++++++++++--- pnpm-lock.yaml | 8 ++++- 6 files changed, 66 insertions(+), 7 deletions(-) diff --git a/apps/laboratory/package.json b/apps/laboratory/package.json index 7f73facf70..01a19fc0f1 100644 --- a/apps/laboratory/package.json +++ b/apps/laboratory/package.json @@ -71,6 +71,7 @@ "playwright:debug:multichain-ethers5-siwe": "pnpm playwright:test:multichain-ethers5-siwe --debug" }, "dependencies": { + "@bitcoinerlab/secp256k1": "1.1.1", "@chakra-ui/icons": "2.1.1", "@chakra-ui/react": "2.8.2", "@emotion/react": "11.11.3", diff --git a/apps/laboratory/src/components/Bitcoin/BitcoinSignPSBTTest.tsx b/apps/laboratory/src/components/Bitcoin/BitcoinSignPSBTTest.tsx index 9ca1ddf746..2d715959b3 100644 --- a/apps/laboratory/src/components/Bitcoin/BitcoinSignPSBTTest.tsx +++ b/apps/laboratory/src/components/Bitcoin/BitcoinSignPSBTTest.tsx @@ -46,6 +46,7 @@ export function BitcoinSignPSBTTest() { } try { + setLoading(true) const utxos = await BitcoinUtil.getUTXOs(address, caipNetwork.caipNetworkId) const feeRate = await BitcoinUtil.getFeeRate() diff --git a/apps/laboratory/src/utils/BitcoinUtil.ts b/apps/laboratory/src/utils/BitcoinUtil.ts index a4f83c5e5c..9f3cf8182a 100644 --- a/apps/laboratory/src/utils/BitcoinUtil.ts +++ b/apps/laboratory/src/utils/BitcoinUtil.ts @@ -2,13 +2,16 @@ import type { BitcoinConnector } from '@reown/appkit-adapter-bitcoin' import type { CaipNetwork, CaipNetworkId } from '@reown/appkit' import * as networks from '@reown/appkit/networks' import * as bitcoin from 'bitcoinjs-lib' +import * as bitcoinPSBTUtils from 'bitcoinjs-lib/src/psbt/psbtutils' +import ecc from '@bitcoinerlab/secp256k1' + +bitcoin.initEccLib(ecc) export const BitcoinUtil = { createSignPSBTParams(params: BitcoinUtil.CreateSignPSBTParams): BitcoinConnector.SignPSBTParams { const network = this.getBitcoinNetwork(params.network.caipNetworkId) - + const payment = this.getPaymentByAddress(params.senderAddress, network) const psbt = new bitcoin.Psbt({ network }) - const payment = bitcoin.payments.p2wpkh({ address: params.senderAddress, network }) if (!payment.output) { throw new Error('Invalid payment output') @@ -113,6 +116,31 @@ export const BitcoinUtil = { getBitcoinNetwork(networkId: CaipNetworkId): bitcoin.Network { return this.isTestnet(networkId) ? bitcoin.networks.testnet : bitcoin.networks.bitcoin + }, + + getPaymentByAddress( + address: string, + network: bitcoin.networks.Network + ): bitcoin.payments.Payment { + const output = bitcoin.address.toOutputScript(address, network) + + if (bitcoinPSBTUtils.isP2MS(output)) { + return bitcoin.payments.p2ms({ output, network }) + } else if (bitcoinPSBTUtils.isP2PK(output)) { + return bitcoin.payments.p2pk({ output, network }) + } else if (bitcoinPSBTUtils.isP2PKH(output)) { + return bitcoin.payments.p2pkh({ output, network }) + } else if (bitcoinPSBTUtils.isP2WPKH(output)) { + return bitcoin.payments.p2wpkh({ output, network }) + } else if (bitcoinPSBTUtils.isP2WSHScript(output)) { + return bitcoin.payments.p2wsh({ output, network }) + } else if (bitcoinPSBTUtils.isP2SHScript(output)) { + return bitcoin.payments.p2sh({ output, network }) + } else if (bitcoinPSBTUtils.isP2TR(output)) { + return bitcoin.payments.p2tr({ output, network }) + } + + throw new Error('Unsupported payment type') } } diff --git a/packages/adapters/bitcoin/package.json b/packages/adapters/bitcoin/package.json index db768ac8d4..5a4f8279c8 100644 --- a/packages/adapters/bitcoin/package.json +++ b/packages/adapters/bitcoin/package.json @@ -32,6 +32,7 @@ "@wallet-standard/app": "1.0.1", "@wallet-standard/base": "1.0.1", "@walletconnect/universal-provider": "2.17.0", + "bitcoinjs-lib": "7.0.0-rc.0", "sats-connect": "3.0.1" }, "devDependencies": { diff --git a/packages/adapters/bitcoin/src/connectors/OKXConnector.ts b/packages/adapters/bitcoin/src/connectors/OKXConnector.ts index aeb1fcaae6..cf655c6e4f 100644 --- a/packages/adapters/bitcoin/src/connectors/OKXConnector.ts +++ b/packages/adapters/bitcoin/src/connectors/OKXConnector.ts @@ -31,10 +31,13 @@ export class OKXConnector extends ProviderEventEmitter implements BitcoinConnect public async connect(): Promise { const result = await this.wallet.connect() + this.bindEvents() + return result.address } public async disconnect(): Promise { + this.unbindEvents() await this.wallet.disconnect() } @@ -80,11 +83,11 @@ export class OKXConnector extends ProviderEventEmitter implements BitcoinConnect ): Promise { const psbtHex = Buffer.from(params.psbt, 'base64').toString('hex') - const signedPsbtHex = await this.wallet.signPSBT(psbtHex) + const signedPsbtHex = await this.wallet.signPsbt(psbtHex) let txid: string | undefined = undefined if (params.broadcast) { - txid = await this.wallet.pushPSBT(signedPsbtHex) + txid = await this.wallet.pushPsbt(signedPsbtHex) } return { @@ -97,6 +100,23 @@ export class OKXConnector extends ProviderEventEmitter implements BitcoinConnect return Promise.reject(new MethodNotSupportedError(this.id, 'request')) } + public bindEvents(): void { + this.unbindEvents() + + this.wallet.on('accountChanged', account => { + if (typeof account === 'object' && account && 'address' in account) { + this.emit('accountsChanged', [account.address]) + } + }) + this.wallet.on('disconnect', () => { + this.emit('disconnect') + }) + } + + public unbindEvents(): void { + this.wallet.removeAllListeners() + } + public static getWallet(params: OKXConnector.GetWalletParams): OKXConnector | undefined { // eslint-disable-next-line @typescript-eslint/no-explicit-any const wallet = (window as any)?.okxwallet?.bitcoin @@ -125,8 +145,8 @@ export namespace OKXConnector { disconnect(): Promise getAccounts(): Promise signMessage(signStr: string, type?: 'ecdsa' | 'bip322-simple'): Promise - signPSBT(psbtHex: string): Promise - pushPSBT(psbtHex: string): Promise + signPsbt(psbtHex: string): Promise + pushPsbt(psbtHex: string): Promise send(params: { from: string to: string @@ -135,6 +155,8 @@ export namespace OKXConnector { memo?: string memoPos?: number }): Promise<{ txhash: string }> + on(event: string, listener: (param?: unknown) => void): void + removeAllListeners(): void } export type GetWalletParams = Omit diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 69be5b7e0f..60d991f0cc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -235,6 +235,9 @@ importers: apps/laboratory: dependencies: + '@bitcoinerlab/secp256k1': + specifier: 1.1.1 + version: 1.1.1 '@chakra-ui/icons': specifier: 2.1.1 version: 2.1.1(@chakra-ui/system@2.6.2(@emotion/react@11.11.3(@types/react@18.2.62)(react@18.3.1))(@emotion/styled@11.11.0(@emotion/react@11.11.3(@types/react@18.2.62)(react@18.3.1))(@types/react@18.2.62)(react@18.3.1))(react@18.3.1))(react@18.3.1) @@ -1163,6 +1166,9 @@ importers: '@walletconnect/universal-provider': specifier: 2.17.0 version: 2.17.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + bitcoinjs-lib: + specifier: 7.0.0-rc.0 + version: 7.0.0-rc.0(typescript@5.3.3) sats-connect: specifier: 3.0.1 version: 3.0.1(typescript@5.3.3) @@ -30297,7 +30303,7 @@ snapshots: regenerator-transform@0.15.2: dependencies: - '@babel/runtime': 7.24.5 + '@babel/runtime': 7.26.0 regexp.prototype.flags@1.5.3: dependencies: From 6ff0a3e793a320db167e9bd1a41e579351140e69 Mon Sep 17 00:00:00 2001 From: Felipe Mendes Date: Mon, 9 Dec 2024 14:57:16 -0300 Subject: [PATCH 03/12] test: add tests for OKXConnector --- .../bitcoin/src/connectors/OKXConnector.ts | 4 +- .../tests/connectors/OKXConnector.test.ts | 185 ++++++++++++++++++ 2 files changed, 187 insertions(+), 2 deletions(-) create mode 100644 packages/adapters/bitcoin/tests/connectors/OKXConnector.test.ts diff --git a/packages/adapters/bitcoin/src/connectors/OKXConnector.ts b/packages/adapters/bitcoin/src/connectors/OKXConnector.ts index cf655c6e4f..4bc8a1385f 100644 --- a/packages/adapters/bitcoin/src/connectors/OKXConnector.ts +++ b/packages/adapters/bitcoin/src/connectors/OKXConnector.ts @@ -100,7 +100,7 @@ export class OKXConnector extends ProviderEventEmitter implements BitcoinConnect return Promise.reject(new MethodNotSupportedError(this.id, 'request')) } - public bindEvents(): void { + private bindEvents(): void { this.unbindEvents() this.wallet.on('accountChanged', account => { @@ -113,7 +113,7 @@ export class OKXConnector extends ProviderEventEmitter implements BitcoinConnect }) } - public unbindEvents(): void { + private unbindEvents(): void { this.wallet.removeAllListeners() } diff --git a/packages/adapters/bitcoin/tests/connectors/OKXConnector.test.ts b/packages/adapters/bitcoin/tests/connectors/OKXConnector.test.ts new file mode 100644 index 0000000000..dadc2d4a81 --- /dev/null +++ b/packages/adapters/bitcoin/tests/connectors/OKXConnector.test.ts @@ -0,0 +1,185 @@ +import { beforeEach, describe, vi, type Mock, expect, it } from 'vitest' +import { OKXConnector } from '../../src/connectors/OKXConnector' +import type { CaipNetwork } from '@reown/appkit-common' +import { bitcoin, bitcoinTestnet } from '@reown/appkit/networks' +import { MethodNotSupportedError } from '../../src/errors/MethodNotSupportedError' + +function mockOKXWallet(): { [K in keyof OKXConnector.Wallet]: Mock } { + return { + connect: vi.fn(() => Promise.resolve({ address: 'mock_address', publicKey: 'publicKey' })), + disconnect: vi.fn(), + getAccounts: vi.fn(() => Promise.resolve(['mock_address'])), + signMessage: vi.fn(() => Promise.resolve('mock_signature')), + signPsbt: vi.fn(() => Promise.resolve(Buffer.from('mock_psbt').toString('hex'))), + pushPsbt: vi.fn(() => Promise.resolve('mock_txhash')), + send: vi.fn(() => Promise.resolve({ txhash: 'mock_txhash' })), + on: vi.fn(), + removeAllListeners: vi.fn() + } +} + +describe('OKXConnector', () => { + let wallet: ReturnType + let requestedChains: CaipNetwork[] + let connector: OKXConnector + let getActiveNetwork: Mock<() => CaipNetwork | undefined> + + beforeEach(() => { + requestedChains = [bitcoin, bitcoinTestnet] + getActiveNetwork = vi.fn(() => bitcoin) + wallet = mockOKXWallet() + connector = new OKXConnector({ wallet, requestedChains, getActiveNetwork }) + }) + + it('should validate metadata', () => { + expect(connector.id).toBe('OKX') + expect(connector.name).toBe('OKX Wallet') + expect(connector.chain).toBe('bip122') + expect(connector.type).toBe('ANNOUNCED') + expect(connector.imageUrl).toBe('') + }) + + describe('connect', () => { + it('should connect the wallet', async () => { + const address = await connector.connect() + + expect(address).toBe('mock_address') + expect(wallet.connect).toHaveBeenCalled() + }) + + it('should bind events', async () => { + await connector.connect() + + expect(wallet.removeAllListeners).toHaveBeenCalled() + expect(wallet.on).toHaveBeenNthCalledWith(1, 'accountChanged', expect.any(Function)) + expect(wallet.on).toHaveBeenNthCalledWith(2, 'disconnect', expect.any(Function)) + }) + }) + + describe('disconnect', () => { + it('should disconnect the wallet', async () => { + await connector.disconnect() + + expect(wallet.disconnect).toHaveBeenCalled() + }) + + it('should unbind events', async () => { + await connector.disconnect() + + expect(wallet.removeAllListeners).toHaveBeenCalled() + }) + }) + + describe('getAccountAddresses', () => { + it('should get account addresses', async () => { + const accounts = await connector.getAccountAddresses() + + expect(accounts).toEqual([{ address: 'mock_address', purpose: 'payment' }]) + expect(wallet.getAccounts).toHaveBeenCalled() + }) + }) + + describe('signMessage', () => { + it('should sign a message', async () => { + const signature = await connector.signMessage({ address: 'mock_address', message: 'message' }) + + expect(signature).toBe('mock_signature') + expect(wallet.signMessage).toHaveBeenCalledWith('message') + }) + }) + + describe('sendTransfer', () => { + it('should send a transfer', async () => { + const txid = await connector.sendTransfer({ amount: '1500', recipient: 'mock_to_address' }) + + expect(txid).toBe('mock_txhash') + expect(wallet.send).toHaveBeenCalledWith({ + from: 'mock_address', + to: 'mock_to_address', + value: '0.000015' + }) + }) + + it('should throw an error if the network is unavailable', async () => { + getActiveNetwork.mockReturnValueOnce(undefined) + + await expect( + connector.sendTransfer({ amount: '1500', recipient: 'mock_to_address' }) + ).rejects.toThrow('No active network available') + }) + + it('should throw an error if no account is available', async () => { + wallet.getAccounts.mockResolvedValueOnce([]) + + await expect( + connector.sendTransfer({ amount: '1500', recipient: 'mock_to_address' }) + ).rejects.toThrow('No account available') + }) + }) + + describe('signPSBT', () => { + it('should sign a PSBT without broadcast', async () => { + const result = await connector.signPSBT({ + psbt: Buffer.from('mock_psbt').toString('base64'), + signInputs: [], + broadcast: false + }) + + expect(result).toEqual({ psbt: 'bW9ja19wc2J0', txid: undefined }) + }) + + it('should sign a PSBT with broadcast', async () => { + getActiveNetwork.mockReturnValueOnce(bitcoinTestnet) + + const result = await connector.signPSBT({ + psbt: Buffer.from('mock_psbt').toString('base64'), + signInputs: [], + broadcast: true + }) + + expect(result).toEqual({ psbt: 'bW9ja19wc2J0', txid: 'mock_txhash' }) + }) + }) + + describe('request', () => { + it('should throw an error because request is not supported', async () => { + await expect(connector.request({} as any)).rejects.toThrow(MethodNotSupportedError) + }) + }) + + describe('events', () => { + it('should emit accountChanged event', async () => { + const listener = vi.fn(account => { + expect(account).toEqual(['mock_address']) + }) + connector.on('accountsChanged', listener) + await connector.connect() + + wallet.on.mock.calls[0]![1]({ address: 'mock_address' }) + + expect(listener).toHaveBeenCalled() + }) + + it('should emit disconnect event', async () => { + const listener = vi.fn() + connector.on('disconnect', listener) + await connector.connect() + + wallet.on.mock.calls[1]![1]() + + expect(listener).toHaveBeenCalled() + }) + }) + + describe('getWallet', () => { + it('should return undefined if there is no wallet', () => { + expect(OKXConnector.getWallet({ getActiveNetwork, requestedChains: [] })).toBeUndefined() + }) + + it('should return the Connector if there is a wallet', () => { + ;(window as any).okxwallet = { bitcoin: wallet } + const connector = OKXConnector.getWallet({ getActiveNetwork, requestedChains }) + expect(connector).toBeInstanceOf(OKXConnector) + }) + }) +}) From bbd5ed58736aeb8d43a90bc1f419fcf3fc930816 Mon Sep 17 00:00:00 2001 From: Felipe Mendes Date: Mon, 9 Dec 2024 15:05:07 -0300 Subject: [PATCH 04/12] fix: chains mapping --- packages/adapters/bitcoin/src/connectors/OKXConnector.ts | 3 ++- .../adapters/bitcoin/tests/connectors/OKXConnector.test.ts | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/adapters/bitcoin/src/connectors/OKXConnector.ts b/packages/adapters/bitcoin/src/connectors/OKXConnector.ts index 4bc8a1385f..fb6d144533 100644 --- a/packages/adapters/bitcoin/src/connectors/OKXConnector.ts +++ b/packages/adapters/bitcoin/src/connectors/OKXConnector.ts @@ -3,6 +3,7 @@ import type { BitcoinConnector } from '../utils/BitcoinConnector.js' import { ProviderEventEmitter } from '../utils/ProviderEventEmitter.js' import type { RequestArguments } from '@reown/appkit-core' import { MethodNotSupportedError } from '../errors/MethodNotSupportedError.js' +import { bitcoin } from '@reown/appkit/networks' export class OKXConnector extends ProviderEventEmitter implements BitcoinConnector { public readonly id = 'OKX' @@ -25,7 +26,7 @@ export class OKXConnector extends ProviderEventEmitter implements BitcoinConnect } public get chains() { - return this.requestedChains + return this.requestedChains.filter(chain => chain.caipNetworkId === bitcoin.caipNetworkId) } public async connect(): Promise { diff --git a/packages/adapters/bitcoin/tests/connectors/OKXConnector.test.ts b/packages/adapters/bitcoin/tests/connectors/OKXConnector.test.ts index dadc2d4a81..503be56181 100644 --- a/packages/adapters/bitcoin/tests/connectors/OKXConnector.test.ts +++ b/packages/adapters/bitcoin/tests/connectors/OKXConnector.test.ts @@ -39,6 +39,10 @@ describe('OKXConnector', () => { expect(connector.imageUrl).toBe('') }) + it('should return only mainnet chain', () => { + expect(connector.chains).toEqual([bitcoin]) + }) + describe('connect', () => { it('should connect the wallet', async () => { const address = await connector.connect() From 0eb360edd7fede7d163202106e745a4edcc57ab1 Mon Sep 17 00:00:00 2001 From: Felipe Mendes Date: Mon, 9 Dec 2024 15:15:21 -0300 Subject: [PATCH 05/12] feat: add image url for OKXConnector --- packages/adapters/bitcoin/src/connectors/OKXConnector.ts | 3 ++- .../adapters/bitcoin/tests/connectors/OKXConnector.test.ts | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/adapters/bitcoin/src/connectors/OKXConnector.ts b/packages/adapters/bitcoin/src/connectors/OKXConnector.ts index fb6d144533..46994bdd31 100644 --- a/packages/adapters/bitcoin/src/connectors/OKXConnector.ts +++ b/packages/adapters/bitcoin/src/connectors/OKXConnector.ts @@ -10,7 +10,8 @@ export class OKXConnector extends ProviderEventEmitter implements BitcoinConnect public readonly name = 'OKX Wallet' public readonly chain = 'bip122' public readonly type = 'ANNOUNCED' - public readonly imageUrl = '' + public readonly imageUrl = + 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJDSURBVHgB7Zq9jtpAEMfHlhEgQLiioXEkoAGECwoKxMcTRHmC5E3IoyRPkPAEkI7unJYmTgEFTYwA8a3NTKScLnCHN6c9r1e3P2llWQy7M/s1Gv1twCP0ej37dDq9x+Zut1t3t9vZjDEHIiSRSPg4ZpDL5fxkMvn1cDh8m0wmfugfO53OoFQq/crn8wxfY9EymQyrVCqMfHvScZx1p9ls3pFxXBy/bKlUipGPrVbLuQqAfsCliq3zl0H84zwtjQrOw4Mt1W63P5LvBm2d+Xz+YzqdgkqUy+WgWCy+Mc/nc282m4FqLBYL+3g8fjDxenq72WxANZbLJeA13zDX67UDioL5ybXwafMYu64Ltn3bdDweQ5R97fd7GyhBQMipx4POeEDHIu2LfDdBIGGz+hJ9CQ1ABjoA2egAZPM6AgiCAEQhsi/C4jHyPA/6/f5NG3Ks2+3CYDC4aTccDrn6ojG54MnEvG00GoVmWLIRNZ7wTCwDHYBsdACy0QHIhiuRETxlICWpMMhGZHmqS8qH6JLyGegAZKMDkI0uKf8X4SWlaZo+Pp1bRrwlJU8ZKLIvUjKh0WiQ3sRUbNVq9c5Ebew7KEo2m/1p4jJ4qAmDaqDQBzj5XyiAT4VCQezJigAU+IDU+z8vJFnGWeC+bKQV/5VZ71FV6L7PA3gg3tXrdQ+DgLhC+75Wq3no69P3MC0NFQpx2lL04Ql9gHK1bRDjsSBIvScBnDTk1WrlGIZBorIDEYJj+rhdgnQ67VmWRe0zlplXl81vcyEt0rSoYDUAAAAASUVORK5CYII=' public readonly provider = this diff --git a/packages/adapters/bitcoin/tests/connectors/OKXConnector.test.ts b/packages/adapters/bitcoin/tests/connectors/OKXConnector.test.ts index 503be56181..09a884ddae 100644 --- a/packages/adapters/bitcoin/tests/connectors/OKXConnector.test.ts +++ b/packages/adapters/bitcoin/tests/connectors/OKXConnector.test.ts @@ -36,7 +36,9 @@ describe('OKXConnector', () => { expect(connector.name).toBe('OKX Wallet') expect(connector.chain).toBe('bip122') expect(connector.type).toBe('ANNOUNCED') - expect(connector.imageUrl).toBe('') + expect(connector.imageUrl).toBe( + 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJDSURBVHgB7Zq9jtpAEMfHlhEgQLiioXEkoAGECwoKxMcTRHmC5E3IoyRPkPAEkI7unJYmTgEFTYwA8a3NTKScLnCHN6c9r1e3P2llWQy7M/s1Gv1twCP0ej37dDq9x+Zut1t3t9vZjDEHIiSRSPg4ZpDL5fxkMvn1cDh8m0wmfugfO53OoFQq/crn8wxfY9EymQyrVCqMfHvScZx1p9ls3pFxXBy/bKlUipGPrVbLuQqAfsCliq3zl0H84zwtjQrOw4Mt1W63P5LvBm2d+Xz+YzqdgkqUy+WgWCy+Mc/nc282m4FqLBYL+3g8fjDxenq72WxANZbLJeA13zDX67UDioL5ybXwafMYu64Ltn3bdDweQ5R97fd7GyhBQMipx4POeEDHIu2LfDdBIGGz+hJ9CQ1ABjoA2egAZPM6AgiCAEQhsi/C4jHyPA/6/f5NG3Ks2+3CYDC4aTccDrn6ojG54MnEvG00GoVmWLIRNZ7wTCwDHYBsdACy0QHIhiuRETxlICWpMMhGZHmqS8qH6JLyGegAZKMDkI0uKf8X4SWlaZo+Pp1bRrwlJU8ZKLIvUjKh0WiQ3sRUbNVq9c5Ebew7KEo2m/1p4jJ4qAmDaqDQBzj5XyiAT4VCQezJigAU+IDU+z8vJFnGWeC+bKQV/5VZ71FV6L7PA3gg3tXrdQ+DgLhC+75Wq3no69P3MC0NFQpx2lL04Ql9gHK1bRDjsSBIvScBnDTk1WrlGIZBorIDEYJj+rhdgnQ67VmWRe0zlplXl81vcyEt0rSoYDUAAAAASUVORK5CYII=' + ) }) it('should return only mainnet chain', () => { From b2ef70a3b785c7ec05b89f562db38802160bdebf Mon Sep 17 00:00:00 2001 From: Felipe Mendes Date: Mon, 9 Dec 2024 15:17:45 -0300 Subject: [PATCH 06/12] fix: formating issue --- .../bitcoin/src/connectors/OKXConnector.ts | 330 +++++++-------- .../tests/connectors/OKXConnector.test.ts | 382 +++++++++--------- 2 files changed, 356 insertions(+), 356 deletions(-) diff --git a/packages/adapters/bitcoin/src/connectors/OKXConnector.ts b/packages/adapters/bitcoin/src/connectors/OKXConnector.ts index 46994bdd31..3230847a94 100644 --- a/packages/adapters/bitcoin/src/connectors/OKXConnector.ts +++ b/packages/adapters/bitcoin/src/connectors/OKXConnector.ts @@ -1,165 +1,165 @@ -import type { CaipNetwork } from '@reown/appkit-common' -import type { BitcoinConnector } from '../utils/BitcoinConnector.js' -import { ProviderEventEmitter } from '../utils/ProviderEventEmitter.js' -import type { RequestArguments } from '@reown/appkit-core' -import { MethodNotSupportedError } from '../errors/MethodNotSupportedError.js' -import { bitcoin } from '@reown/appkit/networks' - -export class OKXConnector extends ProviderEventEmitter implements BitcoinConnector { - public readonly id = 'OKX' - public readonly name = 'OKX Wallet' - public readonly chain = 'bip122' - public readonly type = 'ANNOUNCED' - public readonly imageUrl = - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJDSURBVHgB7Zq9jtpAEMfHlhEgQLiioXEkoAGECwoKxMcTRHmC5E3IoyRPkPAEkI7unJYmTgEFTYwA8a3NTKScLnCHN6c9r1e3P2llWQy7M/s1Gv1twCP0ej37dDq9x+Zut1t3t9vZjDEHIiSRSPg4ZpDL5fxkMvn1cDh8m0wmfugfO53OoFQq/crn8wxfY9EymQyrVCqMfHvScZx1p9ls3pFxXBy/bKlUipGPrVbLuQqAfsCliq3zl0H84zwtjQrOw4Mt1W63P5LvBm2d+Xz+YzqdgkqUy+WgWCy+Mc/nc282m4FqLBYL+3g8fjDxenq72WxANZbLJeA13zDX67UDioL5ybXwafMYu64Ltn3bdDweQ5R97fd7GyhBQMipx4POeEDHIu2LfDdBIGGz+hJ9CQ1ABjoA2egAZPM6AgiCAEQhsi/C4jHyPA/6/f5NG3Ks2+3CYDC4aTccDrn6ojG54MnEvG00GoVmWLIRNZ7wTCwDHYBsdACy0QHIhiuRETxlICWpMMhGZHmqS8qH6JLyGegAZKMDkI0uKf8X4SWlaZo+Pp1bRrwlJU8ZKLIvUjKh0WiQ3sRUbNVq9c5Ebew7KEo2m/1p4jJ4qAmDaqDQBzj5XyiAT4VCQezJigAU+IDU+z8vJFnGWeC+bKQV/5VZ71FV6L7PA3gg3tXrdQ+DgLhC+75Wq3no69P3MC0NFQpx2lL04Ql9gHK1bRDjsSBIvScBnDTk1WrlGIZBorIDEYJj+rhdgnQ67VmWRe0zlplXl81vcyEt0rSoYDUAAAAASUVORK5CYII=' - - public readonly provider = this - - private readonly wallet: OKXConnector.Wallet - private readonly requestedChains: CaipNetwork[] = [] - private readonly getActiveNetwork: () => CaipNetwork | undefined - - constructor({ wallet, requestedChains, getActiveNetwork }: OKXConnector.ConstructorParams) { - super() - this.wallet = wallet - this.requestedChains = requestedChains - this.getActiveNetwork = getActiveNetwork - } - - public get chains() { - return this.requestedChains.filter(chain => chain.caipNetworkId === bitcoin.caipNetworkId) - } - - public async connect(): Promise { - const result = await this.wallet.connect() - - this.bindEvents() - - return result.address - } - - public async disconnect(): Promise { - this.unbindEvents() - await this.wallet.disconnect() - } - - public async getAccountAddresses(): Promise { - const accounts = await this.wallet.getAccounts() - - return accounts.map(account => ({ - address: account, - purpose: 'payment' - })) - } - - public async signMessage(params: BitcoinConnector.SignMessageParams): Promise { - return this.wallet.signMessage(params.message) - } - - public async sendTransfer(params: BitcoinConnector.SendTransferParams): Promise { - const network = this.getActiveNetwork() - - if (!network) { - throw new Error('No active network available') - } - - const from = (await this.wallet.getAccounts())[0] - - if (!from) { - throw new Error('No account available') - } - - const value = (Number(params.amount) / 10 ** network.nativeCurrency.decimals).toString() - - const result = await this.wallet.send({ - from, - to: params.recipient, - value - }) - - return result.txhash - } - - public async signPSBT( - params: BitcoinConnector.SignPSBTParams - ): Promise { - const psbtHex = Buffer.from(params.psbt, 'base64').toString('hex') - - const signedPsbtHex = await this.wallet.signPsbt(psbtHex) - - let txid: string | undefined = undefined - if (params.broadcast) { - txid = await this.wallet.pushPsbt(signedPsbtHex) - } - - return { - psbt: Buffer.from(signedPsbtHex, 'hex').toString('base64'), - txid - } - } - - public request(_args: RequestArguments): Promise { - return Promise.reject(new MethodNotSupportedError(this.id, 'request')) - } - - private bindEvents(): void { - this.unbindEvents() - - this.wallet.on('accountChanged', account => { - if (typeof account === 'object' && account && 'address' in account) { - this.emit('accountsChanged', [account.address]) - } - }) - this.wallet.on('disconnect', () => { - this.emit('disconnect') - }) - } - - private unbindEvents(): void { - this.wallet.removeAllListeners() - } - - public static getWallet(params: OKXConnector.GetWalletParams): OKXConnector | undefined { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const wallet = (window as any)?.okxwallet?.bitcoin - - if (wallet) { - return new OKXConnector({ wallet, ...params }) - } - - return undefined - } -} - -export namespace OKXConnector { - export type ConstructorParams = { - wallet: Wallet - requestedChains: CaipNetwork[] - getActiveNetwork: () => CaipNetwork | undefined - } - - export type Wallet = { - /* - * This interface doesn't include all available methods - * Reference: https://www.okx.com/web3/build/docs/sdks/chains/bitcoin/provider - */ - connect(): Promise<{ address: string; publicKey: string }> - disconnect(): Promise - getAccounts(): Promise - signMessage(signStr: string, type?: 'ecdsa' | 'bip322-simple'): Promise - signPsbt(psbtHex: string): Promise - pushPsbt(psbtHex: string): Promise - send(params: { - from: string - to: string - value: string - satBytes?: string - memo?: string - memoPos?: number - }): Promise<{ txhash: string }> - on(event: string, listener: (param?: unknown) => void): void - removeAllListeners(): void - } - - export type GetWalletParams = Omit -} +import type { CaipNetwork } from '@reown/appkit-common' +import type { BitcoinConnector } from '../utils/BitcoinConnector.js' +import { ProviderEventEmitter } from '../utils/ProviderEventEmitter.js' +import type { RequestArguments } from '@reown/appkit-core' +import { MethodNotSupportedError } from '../errors/MethodNotSupportedError.js' +import { bitcoin } from '@reown/appkit/networks' + +export class OKXConnector extends ProviderEventEmitter implements BitcoinConnector { + public readonly id = 'OKX' + public readonly name = 'OKX Wallet' + public readonly chain = 'bip122' + public readonly type = 'ANNOUNCED' + public readonly imageUrl = + 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJDSURBVHgB7Zq9jtpAEMfHlhEgQLiioXEkoAGECwoKxMcTRHmC5E3IoyRPkPAEkI7unJYmTgEFTYwA8a3NTKScLnCHN6c9r1e3P2llWQy7M/s1Gv1twCP0ej37dDq9x+Zut1t3t9vZjDEHIiSRSPg4ZpDL5fxkMvn1cDh8m0wmfugfO53OoFQq/crn8wxfY9EymQyrVCqMfHvScZx1p9ls3pFxXBy/bKlUipGPrVbLuQqAfsCliq3zl0H84zwtjQrOw4Mt1W63P5LvBm2d+Xz+YzqdgkqUy+WgWCy+Mc/nc282m4FqLBYL+3g8fjDxenq72WxANZbLJeA13zDX67UDioL5ybXwafMYu64Ltn3bdDweQ5R97fd7GyhBQMipx4POeEDHIu2LfDdBIGGz+hJ9CQ1ABjoA2egAZPM6AgiCAEQhsi/C4jHyPA/6/f5NG3Ks2+3CYDC4aTccDrn6ojG54MnEvG00GoVmWLIRNZ7wTCwDHYBsdACy0QHIhiuRETxlICWpMMhGZHmqS8qH6JLyGegAZKMDkI0uKf8X4SWlaZo+Pp1bRrwlJU8ZKLIvUjKh0WiQ3sRUbNVq9c5Ebew7KEo2m/1p4jJ4qAmDaqDQBzj5XyiAT4VCQezJigAU+IDU+z8vJFnGWeC+bKQV/5VZ71FV6L7PA3gg3tXrdQ+DgLhC+75Wq3no69P3MC0NFQpx2lL04Ql9gHK1bRDjsSBIvScBnDTk1WrlGIZBorIDEYJj+rhdgnQ67VmWRe0zlplXl81vcyEt0rSoYDUAAAAASUVORK5CYII=' + + public readonly provider = this + + private readonly wallet: OKXConnector.Wallet + private readonly requestedChains: CaipNetwork[] = [] + private readonly getActiveNetwork: () => CaipNetwork | undefined + + constructor({ wallet, requestedChains, getActiveNetwork }: OKXConnector.ConstructorParams) { + super() + this.wallet = wallet + this.requestedChains = requestedChains + this.getActiveNetwork = getActiveNetwork + } + + public get chains() { + return this.requestedChains.filter(chain => chain.caipNetworkId === bitcoin.caipNetworkId) + } + + public async connect(): Promise { + const result = await this.wallet.connect() + + this.bindEvents() + + return result.address + } + + public async disconnect(): Promise { + this.unbindEvents() + await this.wallet.disconnect() + } + + public async getAccountAddresses(): Promise { + const accounts = await this.wallet.getAccounts() + + return accounts.map(account => ({ + address: account, + purpose: 'payment' + })) + } + + public async signMessage(params: BitcoinConnector.SignMessageParams): Promise { + return this.wallet.signMessage(params.message) + } + + public async sendTransfer(params: BitcoinConnector.SendTransferParams): Promise { + const network = this.getActiveNetwork() + + if (!network) { + throw new Error('No active network available') + } + + const from = (await this.wallet.getAccounts())[0] + + if (!from) { + throw new Error('No account available') + } + + const value = (Number(params.amount) / 10 ** network.nativeCurrency.decimals).toString() + + const result = await this.wallet.send({ + from, + to: params.recipient, + value + }) + + return result.txhash + } + + public async signPSBT( + params: BitcoinConnector.SignPSBTParams + ): Promise { + const psbtHex = Buffer.from(params.psbt, 'base64').toString('hex') + + const signedPsbtHex = await this.wallet.signPsbt(psbtHex) + + let txid: string | undefined = undefined + if (params.broadcast) { + txid = await this.wallet.pushPsbt(signedPsbtHex) + } + + return { + psbt: Buffer.from(signedPsbtHex, 'hex').toString('base64'), + txid + } + } + + public request(_args: RequestArguments): Promise { + return Promise.reject(new MethodNotSupportedError(this.id, 'request')) + } + + private bindEvents(): void { + this.unbindEvents() + + this.wallet.on('accountChanged', account => { + if (typeof account === 'object' && account && 'address' in account) { + this.emit('accountsChanged', [account.address]) + } + }) + this.wallet.on('disconnect', () => { + this.emit('disconnect') + }) + } + + private unbindEvents(): void { + this.wallet.removeAllListeners() + } + + public static getWallet(params: OKXConnector.GetWalletParams): OKXConnector | undefined { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const wallet = (window as any)?.okxwallet?.bitcoin + + if (wallet) { + return new OKXConnector({ wallet, ...params }) + } + + return undefined + } +} + +export namespace OKXConnector { + export type ConstructorParams = { + wallet: Wallet + requestedChains: CaipNetwork[] + getActiveNetwork: () => CaipNetwork | undefined + } + + export type Wallet = { + /* + * This interface doesn't include all available methods + * Reference: https://www.okx.com/web3/build/docs/sdks/chains/bitcoin/provider + */ + connect(): Promise<{ address: string; publicKey: string }> + disconnect(): Promise + getAccounts(): Promise + signMessage(signStr: string, type?: 'ecdsa' | 'bip322-simple'): Promise + signPsbt(psbtHex: string): Promise + pushPsbt(psbtHex: string): Promise + send(params: { + from: string + to: string + value: string + satBytes?: string + memo?: string + memoPos?: number + }): Promise<{ txhash: string }> + on(event: string, listener: (param?: unknown) => void): void + removeAllListeners(): void + } + + export type GetWalletParams = Omit +} diff --git a/packages/adapters/bitcoin/tests/connectors/OKXConnector.test.ts b/packages/adapters/bitcoin/tests/connectors/OKXConnector.test.ts index 09a884ddae..63c0b87ae0 100644 --- a/packages/adapters/bitcoin/tests/connectors/OKXConnector.test.ts +++ b/packages/adapters/bitcoin/tests/connectors/OKXConnector.test.ts @@ -1,191 +1,191 @@ -import { beforeEach, describe, vi, type Mock, expect, it } from 'vitest' -import { OKXConnector } from '../../src/connectors/OKXConnector' -import type { CaipNetwork } from '@reown/appkit-common' -import { bitcoin, bitcoinTestnet } from '@reown/appkit/networks' -import { MethodNotSupportedError } from '../../src/errors/MethodNotSupportedError' - -function mockOKXWallet(): { [K in keyof OKXConnector.Wallet]: Mock } { - return { - connect: vi.fn(() => Promise.resolve({ address: 'mock_address', publicKey: 'publicKey' })), - disconnect: vi.fn(), - getAccounts: vi.fn(() => Promise.resolve(['mock_address'])), - signMessage: vi.fn(() => Promise.resolve('mock_signature')), - signPsbt: vi.fn(() => Promise.resolve(Buffer.from('mock_psbt').toString('hex'))), - pushPsbt: vi.fn(() => Promise.resolve('mock_txhash')), - send: vi.fn(() => Promise.resolve({ txhash: 'mock_txhash' })), - on: vi.fn(), - removeAllListeners: vi.fn() - } -} - -describe('OKXConnector', () => { - let wallet: ReturnType - let requestedChains: CaipNetwork[] - let connector: OKXConnector - let getActiveNetwork: Mock<() => CaipNetwork | undefined> - - beforeEach(() => { - requestedChains = [bitcoin, bitcoinTestnet] - getActiveNetwork = vi.fn(() => bitcoin) - wallet = mockOKXWallet() - connector = new OKXConnector({ wallet, requestedChains, getActiveNetwork }) - }) - - it('should validate metadata', () => { - expect(connector.id).toBe('OKX') - expect(connector.name).toBe('OKX Wallet') - expect(connector.chain).toBe('bip122') - expect(connector.type).toBe('ANNOUNCED') - expect(connector.imageUrl).toBe( - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJDSURBVHgB7Zq9jtpAEMfHlhEgQLiioXEkoAGECwoKxMcTRHmC5E3IoyRPkPAEkI7unJYmTgEFTYwA8a3NTKScLnCHN6c9r1e3P2llWQy7M/s1Gv1twCP0ej37dDq9x+Zut1t3t9vZjDEHIiSRSPg4ZpDL5fxkMvn1cDh8m0wmfugfO53OoFQq/crn8wxfY9EymQyrVCqMfHvScZx1p9ls3pFxXBy/bKlUipGPrVbLuQqAfsCliq3zl0H84zwtjQrOw4Mt1W63P5LvBm2d+Xz+YzqdgkqUy+WgWCy+Mc/nc282m4FqLBYL+3g8fjDxenq72WxANZbLJeA13zDX67UDioL5ybXwafMYu64Ltn3bdDweQ5R97fd7GyhBQMipx4POeEDHIu2LfDdBIGGz+hJ9CQ1ABjoA2egAZPM6AgiCAEQhsi/C4jHyPA/6/f5NG3Ks2+3CYDC4aTccDrn6ojG54MnEvG00GoVmWLIRNZ7wTCwDHYBsdACy0QHIhiuRETxlICWpMMhGZHmqS8qH6JLyGegAZKMDkI0uKf8X4SWlaZo+Pp1bRrwlJU8ZKLIvUjKh0WiQ3sRUbNVq9c5Ebew7KEo2m/1p4jJ4qAmDaqDQBzj5XyiAT4VCQezJigAU+IDU+z8vJFnGWeC+bKQV/5VZ71FV6L7PA3gg3tXrdQ+DgLhC+75Wq3no69P3MC0NFQpx2lL04Ql9gHK1bRDjsSBIvScBnDTk1WrlGIZBorIDEYJj+rhdgnQ67VmWRe0zlplXl81vcyEt0rSoYDUAAAAASUVORK5CYII=' - ) - }) - - it('should return only mainnet chain', () => { - expect(connector.chains).toEqual([bitcoin]) - }) - - describe('connect', () => { - it('should connect the wallet', async () => { - const address = await connector.connect() - - expect(address).toBe('mock_address') - expect(wallet.connect).toHaveBeenCalled() - }) - - it('should bind events', async () => { - await connector.connect() - - expect(wallet.removeAllListeners).toHaveBeenCalled() - expect(wallet.on).toHaveBeenNthCalledWith(1, 'accountChanged', expect.any(Function)) - expect(wallet.on).toHaveBeenNthCalledWith(2, 'disconnect', expect.any(Function)) - }) - }) - - describe('disconnect', () => { - it('should disconnect the wallet', async () => { - await connector.disconnect() - - expect(wallet.disconnect).toHaveBeenCalled() - }) - - it('should unbind events', async () => { - await connector.disconnect() - - expect(wallet.removeAllListeners).toHaveBeenCalled() - }) - }) - - describe('getAccountAddresses', () => { - it('should get account addresses', async () => { - const accounts = await connector.getAccountAddresses() - - expect(accounts).toEqual([{ address: 'mock_address', purpose: 'payment' }]) - expect(wallet.getAccounts).toHaveBeenCalled() - }) - }) - - describe('signMessage', () => { - it('should sign a message', async () => { - const signature = await connector.signMessage({ address: 'mock_address', message: 'message' }) - - expect(signature).toBe('mock_signature') - expect(wallet.signMessage).toHaveBeenCalledWith('message') - }) - }) - - describe('sendTransfer', () => { - it('should send a transfer', async () => { - const txid = await connector.sendTransfer({ amount: '1500', recipient: 'mock_to_address' }) - - expect(txid).toBe('mock_txhash') - expect(wallet.send).toHaveBeenCalledWith({ - from: 'mock_address', - to: 'mock_to_address', - value: '0.000015' - }) - }) - - it('should throw an error if the network is unavailable', async () => { - getActiveNetwork.mockReturnValueOnce(undefined) - - await expect( - connector.sendTransfer({ amount: '1500', recipient: 'mock_to_address' }) - ).rejects.toThrow('No active network available') - }) - - it('should throw an error if no account is available', async () => { - wallet.getAccounts.mockResolvedValueOnce([]) - - await expect( - connector.sendTransfer({ amount: '1500', recipient: 'mock_to_address' }) - ).rejects.toThrow('No account available') - }) - }) - - describe('signPSBT', () => { - it('should sign a PSBT without broadcast', async () => { - const result = await connector.signPSBT({ - psbt: Buffer.from('mock_psbt').toString('base64'), - signInputs: [], - broadcast: false - }) - - expect(result).toEqual({ psbt: 'bW9ja19wc2J0', txid: undefined }) - }) - - it('should sign a PSBT with broadcast', async () => { - getActiveNetwork.mockReturnValueOnce(bitcoinTestnet) - - const result = await connector.signPSBT({ - psbt: Buffer.from('mock_psbt').toString('base64'), - signInputs: [], - broadcast: true - }) - - expect(result).toEqual({ psbt: 'bW9ja19wc2J0', txid: 'mock_txhash' }) - }) - }) - - describe('request', () => { - it('should throw an error because request is not supported', async () => { - await expect(connector.request({} as any)).rejects.toThrow(MethodNotSupportedError) - }) - }) - - describe('events', () => { - it('should emit accountChanged event', async () => { - const listener = vi.fn(account => { - expect(account).toEqual(['mock_address']) - }) - connector.on('accountsChanged', listener) - await connector.connect() - - wallet.on.mock.calls[0]![1]({ address: 'mock_address' }) - - expect(listener).toHaveBeenCalled() - }) - - it('should emit disconnect event', async () => { - const listener = vi.fn() - connector.on('disconnect', listener) - await connector.connect() - - wallet.on.mock.calls[1]![1]() - - expect(listener).toHaveBeenCalled() - }) - }) - - describe('getWallet', () => { - it('should return undefined if there is no wallet', () => { - expect(OKXConnector.getWallet({ getActiveNetwork, requestedChains: [] })).toBeUndefined() - }) - - it('should return the Connector if there is a wallet', () => { - ;(window as any).okxwallet = { bitcoin: wallet } - const connector = OKXConnector.getWallet({ getActiveNetwork, requestedChains }) - expect(connector).toBeInstanceOf(OKXConnector) - }) - }) -}) +import { beforeEach, describe, vi, type Mock, expect, it } from 'vitest' +import { OKXConnector } from '../../src/connectors/OKXConnector' +import type { CaipNetwork } from '@reown/appkit-common' +import { bitcoin, bitcoinTestnet } from '@reown/appkit/networks' +import { MethodNotSupportedError } from '../../src/errors/MethodNotSupportedError' + +function mockOKXWallet(): { [K in keyof OKXConnector.Wallet]: Mock } { + return { + connect: vi.fn(() => Promise.resolve({ address: 'mock_address', publicKey: 'publicKey' })), + disconnect: vi.fn(), + getAccounts: vi.fn(() => Promise.resolve(['mock_address'])), + signMessage: vi.fn(() => Promise.resolve('mock_signature')), + signPsbt: vi.fn(() => Promise.resolve(Buffer.from('mock_psbt').toString('hex'))), + pushPsbt: vi.fn(() => Promise.resolve('mock_txhash')), + send: vi.fn(() => Promise.resolve({ txhash: 'mock_txhash' })), + on: vi.fn(), + removeAllListeners: vi.fn() + } +} + +describe('OKXConnector', () => { + let wallet: ReturnType + let requestedChains: CaipNetwork[] + let connector: OKXConnector + let getActiveNetwork: Mock<() => CaipNetwork | undefined> + + beforeEach(() => { + requestedChains = [bitcoin, bitcoinTestnet] + getActiveNetwork = vi.fn(() => bitcoin) + wallet = mockOKXWallet() + connector = new OKXConnector({ wallet, requestedChains, getActiveNetwork }) + }) + + it('should validate metadata', () => { + expect(connector.id).toBe('OKX') + expect(connector.name).toBe('OKX Wallet') + expect(connector.chain).toBe('bip122') + expect(connector.type).toBe('ANNOUNCED') + expect(connector.imageUrl).toBe( + 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJDSURBVHgB7Zq9jtpAEMfHlhEgQLiioXEkoAGECwoKxMcTRHmC5E3IoyRPkPAEkI7unJYmTgEFTYwA8a3NTKScLnCHN6c9r1e3P2llWQy7M/s1Gv1twCP0ej37dDq9x+Zut1t3t9vZjDEHIiSRSPg4ZpDL5fxkMvn1cDh8m0wmfugfO53OoFQq/crn8wxfY9EymQyrVCqMfHvScZx1p9ls3pFxXBy/bKlUipGPrVbLuQqAfsCliq3zl0H84zwtjQrOw4Mt1W63P5LvBm2d+Xz+YzqdgkqUy+WgWCy+Mc/nc282m4FqLBYL+3g8fjDxenq72WxANZbLJeA13zDX67UDioL5ybXwafMYu64Ltn3bdDweQ5R97fd7GyhBQMipx4POeEDHIu2LfDdBIGGz+hJ9CQ1ABjoA2egAZPM6AgiCAEQhsi/C4jHyPA/6/f5NG3Ks2+3CYDC4aTccDrn6ojG54MnEvG00GoVmWLIRNZ7wTCwDHYBsdACy0QHIhiuRETxlICWpMMhGZHmqS8qH6JLyGegAZKMDkI0uKf8X4SWlaZo+Pp1bRrwlJU8ZKLIvUjKh0WiQ3sRUbNVq9c5Ebew7KEo2m/1p4jJ4qAmDaqDQBzj5XyiAT4VCQezJigAU+IDU+z8vJFnGWeC+bKQV/5VZ71FV6L7PA3gg3tXrdQ+DgLhC+75Wq3no69P3MC0NFQpx2lL04Ql9gHK1bRDjsSBIvScBnDTk1WrlGIZBorIDEYJj+rhdgnQ67VmWRe0zlplXl81vcyEt0rSoYDUAAAAASUVORK5CYII=' + ) + }) + + it('should return only mainnet chain', () => { + expect(connector.chains).toEqual([bitcoin]) + }) + + describe('connect', () => { + it('should connect the wallet', async () => { + const address = await connector.connect() + + expect(address).toBe('mock_address') + expect(wallet.connect).toHaveBeenCalled() + }) + + it('should bind events', async () => { + await connector.connect() + + expect(wallet.removeAllListeners).toHaveBeenCalled() + expect(wallet.on).toHaveBeenNthCalledWith(1, 'accountChanged', expect.any(Function)) + expect(wallet.on).toHaveBeenNthCalledWith(2, 'disconnect', expect.any(Function)) + }) + }) + + describe('disconnect', () => { + it('should disconnect the wallet', async () => { + await connector.disconnect() + + expect(wallet.disconnect).toHaveBeenCalled() + }) + + it('should unbind events', async () => { + await connector.disconnect() + + expect(wallet.removeAllListeners).toHaveBeenCalled() + }) + }) + + describe('getAccountAddresses', () => { + it('should get account addresses', async () => { + const accounts = await connector.getAccountAddresses() + + expect(accounts).toEqual([{ address: 'mock_address', purpose: 'payment' }]) + expect(wallet.getAccounts).toHaveBeenCalled() + }) + }) + + describe('signMessage', () => { + it('should sign a message', async () => { + const signature = await connector.signMessage({ address: 'mock_address', message: 'message' }) + + expect(signature).toBe('mock_signature') + expect(wallet.signMessage).toHaveBeenCalledWith('message') + }) + }) + + describe('sendTransfer', () => { + it('should send a transfer', async () => { + const txid = await connector.sendTransfer({ amount: '1500', recipient: 'mock_to_address' }) + + expect(txid).toBe('mock_txhash') + expect(wallet.send).toHaveBeenCalledWith({ + from: 'mock_address', + to: 'mock_to_address', + value: '0.000015' + }) + }) + + it('should throw an error if the network is unavailable', async () => { + getActiveNetwork.mockReturnValueOnce(undefined) + + await expect( + connector.sendTransfer({ amount: '1500', recipient: 'mock_to_address' }) + ).rejects.toThrow('No active network available') + }) + + it('should throw an error if no account is available', async () => { + wallet.getAccounts.mockResolvedValueOnce([]) + + await expect( + connector.sendTransfer({ amount: '1500', recipient: 'mock_to_address' }) + ).rejects.toThrow('No account available') + }) + }) + + describe('signPSBT', () => { + it('should sign a PSBT without broadcast', async () => { + const result = await connector.signPSBT({ + psbt: Buffer.from('mock_psbt').toString('base64'), + signInputs: [], + broadcast: false + }) + + expect(result).toEqual({ psbt: 'bW9ja19wc2J0', txid: undefined }) + }) + + it('should sign a PSBT with broadcast', async () => { + getActiveNetwork.mockReturnValueOnce(bitcoinTestnet) + + const result = await connector.signPSBT({ + psbt: Buffer.from('mock_psbt').toString('base64'), + signInputs: [], + broadcast: true + }) + + expect(result).toEqual({ psbt: 'bW9ja19wc2J0', txid: 'mock_txhash' }) + }) + }) + + describe('request', () => { + it('should throw an error because request is not supported', async () => { + await expect(connector.request({} as any)).rejects.toThrow(MethodNotSupportedError) + }) + }) + + describe('events', () => { + it('should emit accountChanged event', async () => { + const listener = vi.fn(account => { + expect(account).toEqual(['mock_address']) + }) + connector.on('accountsChanged', listener) + await connector.connect() + + wallet.on.mock.calls[0]![1]({ address: 'mock_address' }) + + expect(listener).toHaveBeenCalled() + }) + + it('should emit disconnect event', async () => { + const listener = vi.fn() + connector.on('disconnect', listener) + await connector.connect() + + wallet.on.mock.calls[1]![1]() + + expect(listener).toHaveBeenCalled() + }) + }) + + describe('getWallet', () => { + it('should return undefined if there is no wallet', () => { + expect(OKXConnector.getWallet({ getActiveNetwork, requestedChains: [] })).toBeUndefined() + }) + + it('should return the Connector if there is a wallet', () => { + ;(window as any).okxwallet = { bitcoin: wallet } + const connector = OKXConnector.getWallet({ getActiveNetwork, requestedChains }) + expect(connector).toBeInstanceOf(OKXConnector) + }) + }) +}) From 82e3e00cf8ade94476f5b4969d195429d94fcaa0 Mon Sep 17 00:00:00 2001 From: Felipe Mendes Date: Mon, 9 Dec 2024 15:20:14 -0300 Subject: [PATCH 07/12] chore: add changeset --- .changeset/good-pets-listen.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .changeset/good-pets-listen.md diff --git a/.changeset/good-pets-listen.md b/.changeset/good-pets-listen.md new file mode 100644 index 0000000000..849714b96c --- /dev/null +++ b/.changeset/good-pets-listen.md @@ -0,0 +1,21 @@ +--- +'@reown/appkit-scaffold-ui': patch +'@reown/appkit': patch +'@reown/appkit-core': patch +'@reown/appkit-ui': patch +'@reown/appkit-adapter-ethers': patch +'@reown/appkit-adapter-ethers5': patch +'@reown/appkit-adapter-solana': patch +'@reown/appkit-adapter-wagmi': patch +'@reown/appkit-utils': patch +'@reown/appkit-cdn': patch +'appkit-cli': patch +'@reown/appkit-common': patch +'@reown/appkit-experimental': patch +'@reown/appkit-polyfills': patch +'@reown/appkit-siwe': patch +'@reown/appkit-siwx': patch +'@reown/appkit-wallet': patch +--- + +Add Bitcoin OKX Wallet connector From d559d11808b2aa0866863e3eef7ae3b0080ccd13 Mon Sep 17 00:00:00 2001 From: Felipe Mendes Date: Mon, 9 Dec 2024 16:00:26 -0300 Subject: [PATCH 08/12] chore: set static non rc version for bitcoinjs-lib --- packages/adapters/bitcoin/package.json | 2 +- pnpm-lock.yaml | 474 +++++-------------------- 2 files changed, 81 insertions(+), 395 deletions(-) diff --git a/packages/adapters/bitcoin/package.json b/packages/adapters/bitcoin/package.json index 5a4f8279c8..713313ed8b 100644 --- a/packages/adapters/bitcoin/package.json +++ b/packages/adapters/bitcoin/package.json @@ -32,7 +32,7 @@ "@wallet-standard/app": "1.0.1", "@wallet-standard/base": "1.0.1", "@walletconnect/universal-provider": "2.17.0", - "bitcoinjs-lib": "7.0.0-rc.0", + "bitcoinjs-lib": "6.1.7", "sats-connect": "3.0.1" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 39e65e9687..650ab4e34b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -212,7 +212,7 @@ importers: version: 7.92.0(react@18.3.1) '@solana/wallet-adapter-wallets': specifier: 0.19.32 - version: 0.19.32(@babel/core@7.26.0)(@babel/runtime@7.26.0)(@sentry/types@7.119.1)(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bs58@6.0.0)(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(tslib@2.8.1)(utf-8-validate@5.0.10) + version: 0.19.32(@babel/core@7.26.0)(@babel/runtime@7.24.5)(@sentry/types@7.119.1)(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bs58@6.0.0)(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(tslib@2.8.1)(utf-8-validate@5.0.10) '@solana/web3.js': specifier: 1.95.8 version: 1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10) @@ -294,7 +294,7 @@ importers: version: 1.44.0 '@synthetixio/synpress': specifier: 4.0.0-alpha.7 - version: 4.0.0-alpha.7(@playwright/test@1.44.0)(@swc/core@1.9.3)(bufferutil@4.0.8)(playwright-core@1.44.0)(postcss@8.4.49)(ts-node@10.9.2(@swc/core@1.9.3)(@types/node@20.11.5)(typescript@5.3.3))(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8) + version: 4.0.0-alpha.7(@playwright/test@1.44.0)(@swc/core@1.9.3(@swc/helpers@0.5.15))(bufferutil@4.0.8)(playwright-core@1.44.0)(postcss@8.4.49)(ts-node@10.9.2(@swc/core@1.9.3(@swc/helpers@0.5.15))(@types/node@20.11.5)(typescript@5.3.3))(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8) '@types/node': specifier: 20.11.5 version: 20.11.5 @@ -360,7 +360,7 @@ importers: version: 7.92.0(react@18.3.1) '@solana/wallet-adapter-wallets': specifier: 0.19.32 - version: 0.19.32(@babel/core@7.26.0)(@babel/runtime@7.24.5)(@sentry/types@7.119.1)(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bs58@6.0.0)(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(tslib@2.8.1)(utf-8-validate@5.0.10) + version: 0.19.32(@babel/core@7.26.0)(@babel/runtime@7.26.0)(@sentry/types@7.119.1)(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bs58@6.0.0)(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(tslib@2.8.1)(utf-8-validate@5.0.10) '@solana/web3.js': specifier: 1.95.8 version: 1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10) @@ -439,7 +439,7 @@ importers: version: 1.44.0 '@synthetixio/synpress': specifier: 4.0.0-alpha.7 - version: 4.0.0-alpha.7(@playwright/test@1.44.0)(@swc/core@1.9.3)(bufferutil@4.0.8)(playwright-core@1.44.0)(postcss@8.4.49)(ts-node@10.9.2(@swc/core@1.9.3)(@types/node@20.11.5)(typescript@5.3.3))(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8) + version: 4.0.0-alpha.7(@playwright/test@1.44.0)(@swc/core@1.9.3(@swc/helpers@0.5.15))(bufferutil@4.0.8)(playwright-core@1.44.0)(postcss@8.4.49)(ts-node@10.9.2(@swc/core@1.9.3(@swc/helpers@0.5.15))(@types/node@20.11.5)(typescript@5.3.3))(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8) '@types/node': specifier: 20.11.5 version: 20.11.5 @@ -743,7 +743,7 @@ importers: version: 2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8) wagmi: specifier: 2.12.17 - version: 2.12.17(@tanstack/query-core@5.59.16)(@tanstack/react-query@5.56.2(react@18.3.1))(@types/react@18.3.1)(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.28.0)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8) + version: 2.12.17(@tanstack/query-core@5.59.16)(@tanstack/react-query@5.56.2(react@18.3.1))(@types/react@18.3.1)(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(rollup@4.28.0)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8) devDependencies: '@types/react': specifier: 18.3.1 @@ -833,7 +833,7 @@ importers: version: 0.1.14(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) '@solana/wallet-adapter-wallets': specifier: 0.19.32 - version: 0.19.32(@babel/core@7.26.0)(@babel/runtime@7.26.0)(@sentry/types@7.119.1)(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.76.3(@babel/core@7.26.0)(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(tslib@2.8.1)(utf-8-validate@5.0.10) + version: 0.19.32(@babel/core@7.26.0)(@babel/runtime@7.26.0)(@sentry/types@7.119.1)(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bs58@6.0.0)(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(tslib@2.8.1)(utf-8-validate@5.0.10) '@tanstack/react-query': specifier: 5.24.8 version: 5.24.8(react@18.3.1) @@ -882,7 +882,7 @@ importers: version: 5.2.11(@types/node@20.11.5)(lightningcss@1.28.2)(terser@5.36.0) wagmi: specifier: 2.12.17 - version: 2.12.17(@tanstack/query-core@5.59.16)(@tanstack/react-query@5.24.8(react@18.3.1))(@types/react@18.2.62)(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(rollup@4.28.0)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8) + version: 2.12.17(@tanstack/query-core@5.59.16)(@tanstack/react-query@5.24.8(react@18.3.1))(@types/react@18.2.62)(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.28.0)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8) devDependencies: '@types/react': specifier: 18.2.62 @@ -966,7 +966,7 @@ importers: version: 0.1.14(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) '@solana/wallet-adapter-wallets': specifier: 0.19.32 - version: 0.19.32(@babel/core@7.26.0)(@babel/runtime@7.26.0)(@sentry/types@7.119.1)(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(react-native@0.76.3(@babel/core@7.26.0)(bufferutil@4.0.8)(utf-8-validate@5.0.10))(tslib@2.8.1)(utf-8-validate@5.0.10) + version: 0.19.32(@babel/core@7.26.0)(@babel/runtime@7.26.0)(@sentry/types@7.119.1)(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(tslib@2.8.1)(utf-8-validate@5.0.10) vue: specifier: 3.4.3 version: 3.4.3(typescript@5.3.3) @@ -1091,8 +1091,8 @@ importers: specifier: 2.17.0 version: 2.17.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) bitcoinjs-lib: - specifier: 7.0.0-rc.0 - version: 7.0.0-rc.0(typescript@5.3.3) + specifier: 6.1.7 + version: 6.1.7 sats-connect: specifier: 3.0.1 version: 3.0.1(typescript@5.3.3) @@ -1665,7 +1665,7 @@ importers: version: 3.2.25 ts-node: specifier: 10.9.2 - version: 10.9.2(@swc/core@1.9.3)(@types/node@20.11.5)(typescript@5.3.3) + version: 10.9.2(@swc/core@1.9.3(@swc/helpers@0.5.15))(@types/node@20.11.5)(typescript@5.3.3) packages/common: dependencies: @@ -8521,6 +8521,10 @@ packages: resolution: {integrity: sha512-Fk8+Vc+e2rMoDU5gXkW9tD+313rhkm5h6N9HfZxXvYU9LedttVvmXKTgd9k5rsQJjkSfsv6XRM8uhJv94SrvcA==} engines: {node: '>=8.0.0'} + bitcoinjs-lib@6.1.7: + resolution: {integrity: sha512-tlf/r2DGMbF7ky1MgUqXHzypYHakkEnm0SZP23CJKIqNY/5uNAnMbFhMJdhjrL/7anfb/U8+AlpdjPWjPnAalg==} + engines: {node: '>=8.0.0'} + bitcoinjs-lib@7.0.0-rc.0: resolution: {integrity: sha512-7CQgOIbREemKR/NT2uc3uO/fkEy+6CM0sLxboVVY6bv6DbZmPt3gg5Y/hhWgQFeZu5lfTbtVAv32MIxf7lMh4g==} engines: {node: '>=18.0.0'} @@ -19934,16 +19938,6 @@ snapshots: optionalDependencies: '@types/react': 18.2.62 - '@react-native/virtualized-lists@0.76.3(@types/react@18.2.62)(react-native@0.76.3(@babel/core@7.26.0)(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)': - dependencies: - invariant: 2.2.4 - nullthrows: 1.1.1 - react: 18.3.1 - react-native: 0.76.3(@babel/core@7.26.0)(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10) - optionalDependencies: - '@types/react': 18.2.62 - optional: true - '@react-native/virtualized-lists@0.76.3(@types/react@18.3.1)(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)': dependencies: invariant: 2.2.4 @@ -19953,13 +19947,6 @@ snapshots: optionalDependencies: '@types/react': 18.3.1 - '@react-native/virtualized-lists@0.76.3(react-native@0.76.3(@babel/core@7.26.0)(bufferutil@4.0.8)(utf-8-validate@5.0.10))': - dependencies: - invariant: 2.2.4 - nullthrows: 1.1.1 - react-native: 0.76.3(@babel/core@7.26.0)(bufferutil@4.0.8)(utf-8-validate@5.0.10) - optional: true - '@rollup/plugin-inject@5.0.5(rollup@4.28.0)': dependencies: '@rollup/pluginutils': 5.1.3(rollup@4.28.0) @@ -20729,28 +20716,11 @@ snapshots: - tslib - utf-8-validate - '@solana/wallet-adapter-trezor@0.1.2(@babel/core@7.26.0)(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(react-native@0.76.3(@babel/core@7.26.0)(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1)(utf-8-validate@5.0.10)': - dependencies: - '@solana/wallet-adapter-base': 0.9.23(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) - '@solana/web3.js': 1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10) - '@trezor/connect-web': 9.4.5(@babel/core@7.26.0)(bufferutil@4.0.8)(react-native@0.76.3(@babel/core@7.26.0)(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1)(utf-8-validate@5.0.10) - buffer: 6.0.3 - transitivePeerDependencies: - - '@babel/core' - - bufferutil - - encoding - - expo-constants - - expo-localization - - react-native - - supports-color - - tslib - - utf-8-validate - - '@solana/wallet-adapter-trezor@0.1.2(@babel/core@7.26.0)(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(react-native@0.76.3(@babel/core@7.26.0)(bufferutil@4.0.8)(utf-8-validate@5.0.10))(tslib@2.8.1)(utf-8-validate@5.0.10)': + '@solana/wallet-adapter-trezor@0.1.2(@babel/core@7.26.0)(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1)(utf-8-validate@5.0.10)': dependencies: '@solana/wallet-adapter-base': 0.9.23(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) '@solana/web3.js': 1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10) - '@trezor/connect-web': 9.4.5(@babel/core@7.26.0)(bufferutil@4.0.8)(react-native@0.76.3(@babel/core@7.26.0)(bufferutil@4.0.8)(utf-8-validate@5.0.10))(tslib@2.8.1)(utf-8-validate@5.0.10) + '@trezor/connect-web': 9.4.5(@babel/core@7.26.0)(bufferutil@4.0.8)(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1)(utf-8-validate@5.0.10) buffer: 6.0.3 transitivePeerDependencies: - '@babel/core' @@ -20934,75 +20904,7 @@ snapshots: - tslib - utf-8-validate - '@solana/wallet-adapter-wallets@0.19.32(@babel/core@7.26.0)(@babel/runtime@7.26.0)(@sentry/types@7.119.1)(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.76.3(@babel/core@7.26.0)(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(tslib@2.8.1)(utf-8-validate@5.0.10)': - dependencies: - '@solana/wallet-adapter-alpha': 0.1.10(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) - '@solana/wallet-adapter-avana': 0.1.13(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) - '@solana/wallet-adapter-bitkeep': 0.3.20(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) - '@solana/wallet-adapter-bitpie': 0.5.18(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) - '@solana/wallet-adapter-clover': 0.4.19(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) - '@solana/wallet-adapter-coin98': 0.5.20(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) - '@solana/wallet-adapter-coinbase': 0.1.19(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) - '@solana/wallet-adapter-coinhub': 0.3.18(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) - '@solana/wallet-adapter-fractal': 0.1.8(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@solana/wallet-adapter-huobi': 0.1.15(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) - '@solana/wallet-adapter-hyperpay': 0.1.14(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) - '@solana/wallet-adapter-keystone': 0.1.15(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(utf-8-validate@5.0.10) - '@solana/wallet-adapter-krystal': 0.1.12(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) - '@solana/wallet-adapter-ledger': 0.9.25(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) - '@solana/wallet-adapter-mathwallet': 0.9.18(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) - '@solana/wallet-adapter-neko': 0.2.12(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) - '@solana/wallet-adapter-nightly': 0.1.16(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) - '@solana/wallet-adapter-nufi': 0.1.17(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) - '@solana/wallet-adapter-onto': 0.1.7(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) - '@solana/wallet-adapter-particle': 0.1.12(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bs58@6.0.0) - '@solana/wallet-adapter-phantom': 0.9.24(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) - '@solana/wallet-adapter-safepal': 0.5.18(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) - '@solana/wallet-adapter-saifu': 0.1.15(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) - '@solana/wallet-adapter-salmon': 0.1.14(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) - '@solana/wallet-adapter-sky': 0.1.15(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) - '@solana/wallet-adapter-solflare': 0.6.28(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) - '@solana/wallet-adapter-solong': 0.9.18(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) - '@solana/wallet-adapter-spot': 0.1.15(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) - '@solana/wallet-adapter-tokenary': 0.1.12(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) - '@solana/wallet-adapter-tokenpocket': 0.4.19(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) - '@solana/wallet-adapter-torus': 0.11.28(@babel/runtime@7.26.0)(@sentry/types@7.119.1)(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(utf-8-validate@5.0.10) - '@solana/wallet-adapter-trezor': 0.1.2(@babel/core@7.26.0)(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(react-native@0.76.3(@babel/core@7.26.0)(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1)(utf-8-validate@5.0.10) - '@solana/wallet-adapter-trust': 0.1.13(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) - '@solana/wallet-adapter-unsafe-burner': 0.1.7(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) - '@solana/wallet-adapter-walletconnect': 0.1.16(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(utf-8-validate@5.0.10) - '@solana/wallet-adapter-xdefi': 0.1.7(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) - '@solana/web3.js': 1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10) - transitivePeerDependencies: - - '@azure/app-configuration' - - '@azure/cosmos' - - '@azure/data-tables' - - '@azure/identity' - - '@azure/keyvault-secrets' - - '@azure/storage-blob' - - '@babel/core' - - '@babel/runtime' - - '@capacitor/preferences' - - '@netlify/blobs' - - '@planetscale/database' - - '@react-native-async-storage/async-storage' - - '@sentry/types' - - '@upstash/redis' - - '@vercel/kv' - - bs58 - - bufferutil - - encoding - - expo-constants - - expo-localization - - ioredis - - react - - react-dom - - react-native - - supports-color - - tslib - - utf-8-validate - - '@solana/wallet-adapter-wallets@0.19.32(@babel/core@7.26.0)(@babel/runtime@7.26.0)(@sentry/types@7.119.1)(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(react-native@0.76.3(@babel/core@7.26.0)(bufferutil@4.0.8)(utf-8-validate@5.0.10))(tslib@2.8.1)(utf-8-validate@5.0.10)': + '@solana/wallet-adapter-wallets@0.19.32(@babel/core@7.26.0)(@babel/runtime@7.26.0)(@sentry/types@7.119.1)(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(tslib@2.8.1)(utf-8-validate@5.0.10)': dependencies: '@solana/wallet-adapter-alpha': 0.1.10(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) '@solana/wallet-adapter-avana': 0.1.13(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) @@ -21035,7 +20937,7 @@ snapshots: '@solana/wallet-adapter-tokenary': 0.1.12(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) '@solana/wallet-adapter-tokenpocket': 0.4.19(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) '@solana/wallet-adapter-torus': 0.11.28(@babel/runtime@7.26.0)(@sentry/types@7.119.1)(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(utf-8-validate@5.0.10) - '@solana/wallet-adapter-trezor': 0.1.2(@babel/core@7.26.0)(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(react-native@0.76.3(@babel/core@7.26.0)(bufferutil@4.0.8)(utf-8-validate@5.0.10))(tslib@2.8.1)(utf-8-validate@5.0.10) + '@solana/wallet-adapter-trezor': 0.1.2(@babel/core@7.26.0)(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1)(utf-8-validate@5.0.10) '@solana/wallet-adapter-trust': 0.1.13(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) '@solana/wallet-adapter-unsafe-burner': 0.1.7(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)) '@solana/wallet-adapter-walletconnect': 0.1.16(@solana/web3.js@1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(utf-8-validate@5.0.10) @@ -21827,7 +21729,7 @@ snapshots: - utf-8-validate - zod - '@synthetixio/synpress-cache@0.0.1-alpha.7(@swc/core@1.9.3)(playwright-core@1.44.0)(postcss@8.4.49)(ts-node@10.9.2(@swc/core@1.9.3)(@types/node@20.11.5)(typescript@5.3.3))(typescript@5.3.3)': + '@synthetixio/synpress-cache@0.0.1-alpha.7(@swc/core@1.9.3(@swc/helpers@0.5.15))(playwright-core@1.44.0)(postcss@8.4.49)(ts-node@10.9.2(@swc/core@1.9.3(@swc/helpers@0.5.15))(@types/node@20.11.5)(typescript@5.3.3))(typescript@5.3.3)': dependencies: axios: 1.6.7 chalk: 5.3.0 @@ -21838,7 +21740,7 @@ snapshots: gradient-string: 2.0.2 playwright-core: 1.44.0 progress: 2.0.3 - tsup: 8.0.2(@swc/core@1.9.3)(postcss@8.4.49)(ts-node@10.9.2(@swc/core@1.9.3)(@types/node@20.11.5)(typescript@5.3.3))(typescript@5.3.3) + tsup: 8.0.2(@swc/core@1.9.3(@swc/helpers@0.5.15))(postcss@8.4.49)(ts-node@10.9.2(@swc/core@1.9.3(@swc/helpers@0.5.15))(@types/node@20.11.5)(typescript@5.3.3))(typescript@5.3.3) unzipper: 0.10.14 zod: 3.22.4 transitivePeerDependencies: @@ -21854,10 +21756,10 @@ snapshots: dependencies: '@playwright/test': 1.44.0 - '@synthetixio/synpress-metamask@0.0.1-alpha.7(patch_hash=fj5b4lzbslgihe6pqcmuyxpfd4)(@playwright/test@1.44.0)(@swc/core@1.9.3)(bufferutil@4.0.8)(playwright-core@1.44.0)(postcss@8.4.49)(ts-node@10.9.2(@swc/core@1.9.3)(@types/node@20.11.5)(typescript@5.3.3))(typescript@5.3.3)(utf-8-validate@5.0.10)': + '@synthetixio/synpress-metamask@0.0.1-alpha.7(patch_hash=fj5b4lzbslgihe6pqcmuyxpfd4)(@playwright/test@1.44.0)(@swc/core@1.9.3(@swc/helpers@0.5.15))(bufferutil@4.0.8)(playwright-core@1.44.0)(postcss@8.4.49)(ts-node@10.9.2(@swc/core@1.9.3(@swc/helpers@0.5.15))(@types/node@20.11.5)(typescript@5.3.3))(typescript@5.3.3)(utf-8-validate@5.0.10)': dependencies: '@playwright/test': 1.44.0 - '@synthetixio/synpress-cache': 0.0.1-alpha.7(@swc/core@1.9.3)(playwright-core@1.44.0)(postcss@8.4.49)(ts-node@10.9.2(@swc/core@1.9.3)(@types/node@20.11.5)(typescript@5.3.3))(typescript@5.3.3) + '@synthetixio/synpress-cache': 0.0.1-alpha.7(@swc/core@1.9.3(@swc/helpers@0.5.15))(playwright-core@1.44.0)(postcss@8.4.49)(ts-node@10.9.2(@swc/core@1.9.3(@swc/helpers@0.5.15))(@types/node@20.11.5)(typescript@5.3.3))(typescript@5.3.3) '@synthetixio/synpress-core': 0.0.1-alpha.7(@playwright/test@1.44.0) '@viem/anvil': 0.0.7(bufferutil@4.0.8)(utf-8-validate@5.0.10) fs-extra: 11.2.0 @@ -21874,13 +21776,13 @@ snapshots: - typescript - utf-8-validate - '@synthetixio/synpress@4.0.0-alpha.7(@playwright/test@1.44.0)(@swc/core@1.9.3)(bufferutil@4.0.8)(playwright-core@1.44.0)(postcss@8.4.49)(ts-node@10.9.2(@swc/core@1.9.3)(@types/node@20.11.5)(typescript@5.3.3))(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8)': + '@synthetixio/synpress@4.0.0-alpha.7(@playwright/test@1.44.0)(@swc/core@1.9.3(@swc/helpers@0.5.15))(bufferutil@4.0.8)(playwright-core@1.44.0)(postcss@8.4.49)(ts-node@10.9.2(@swc/core@1.9.3(@swc/helpers@0.5.15))(@types/node@20.11.5)(typescript@5.3.3))(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8)': dependencies: '@playwright/test': 1.44.0 '@synthetixio/ethereum-wallet-mock': 0.0.1-alpha.7(@playwright/test@1.44.0)(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8) - '@synthetixio/synpress-cache': 0.0.1-alpha.7(@swc/core@1.9.3)(playwright-core@1.44.0)(postcss@8.4.49)(ts-node@10.9.2(@swc/core@1.9.3)(@types/node@20.11.5)(typescript@5.3.3))(typescript@5.3.3) + '@synthetixio/synpress-cache': 0.0.1-alpha.7(@swc/core@1.9.3(@swc/helpers@0.5.15))(playwright-core@1.44.0)(postcss@8.4.49)(ts-node@10.9.2(@swc/core@1.9.3(@swc/helpers@0.5.15))(@types/node@20.11.5)(typescript@5.3.3))(typescript@5.3.3) '@synthetixio/synpress-core': 0.0.1-alpha.7(@playwright/test@1.44.0) - '@synthetixio/synpress-metamask': 0.0.1-alpha.7(patch_hash=fj5b4lzbslgihe6pqcmuyxpfd4)(@playwright/test@1.44.0)(@swc/core@1.9.3)(bufferutil@4.0.8)(playwright-core@1.44.0)(postcss@8.4.49)(ts-node@10.9.2(@swc/core@1.9.3)(@types/node@20.11.5)(typescript@5.3.3))(typescript@5.3.3)(utf-8-validate@5.0.10) + '@synthetixio/synpress-metamask': 0.0.1-alpha.7(patch_hash=fj5b4lzbslgihe6pqcmuyxpfd4)(@playwright/test@1.44.0)(@swc/core@1.9.3(@swc/helpers@0.5.15))(bufferutil@4.0.8)(playwright-core@1.44.0)(postcss@8.4.49)(ts-node@10.9.2(@swc/core@1.9.3(@swc/helpers@0.5.15))(@types/node@20.11.5)(typescript@5.3.3))(typescript@5.3.3)(utf-8-validate@5.0.10) transitivePeerDependencies: - '@microsoft/api-extractor' - '@swc/core' @@ -22141,19 +22043,9 @@ snapshots: - expo-localization - react-native - '@trezor/analytics@1.2.3(react-native@0.76.3(@babel/core@7.26.0)(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1)': - dependencies: - '@trezor/env-utils': 1.2.1(react-native@0.76.3(@babel/core@7.26.0)(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1) - '@trezor/utils': 9.2.3(tslib@2.8.1) - tslib: 2.8.1 - transitivePeerDependencies: - - expo-constants - - expo-localization - - react-native - - '@trezor/analytics@1.2.3(react-native@0.76.3(@babel/core@7.26.0)(bufferutil@4.0.8)(utf-8-validate@5.0.10))(tslib@2.8.1)': + '@trezor/analytics@1.2.3(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1)': dependencies: - '@trezor/env-utils': 1.2.1(react-native@0.76.3(@babel/core@7.26.0)(bufferutil@4.0.8)(utf-8-validate@5.0.10))(tslib@2.8.1) + '@trezor/env-utils': 1.2.1(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1) '@trezor/utils': 9.2.3(tslib@2.8.1) tslib: 2.8.1 transitivePeerDependencies: @@ -22187,26 +22079,11 @@ snapshots: - react-native - utf-8-validate - '@trezor/blockchain-link-utils@1.2.4(bufferutil@4.0.8)(react-native@0.76.3(@babel/core@7.26.0)(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1)(utf-8-validate@5.0.10)': - dependencies: - '@mobily/ts-belt': 3.13.1 - '@solana/web3.js': 1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10) - '@trezor/env-utils': 1.2.1(react-native@0.76.3(@babel/core@7.26.0)(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1) - '@trezor/utils': 9.2.4(tslib@2.8.1) - tslib: 2.8.1 - transitivePeerDependencies: - - bufferutil - - encoding - - expo-constants - - expo-localization - - react-native - - utf-8-validate - - '@trezor/blockchain-link-utils@1.2.4(bufferutil@4.0.8)(react-native@0.76.3(@babel/core@7.26.0)(bufferutil@4.0.8)(utf-8-validate@5.0.10))(tslib@2.8.1)(utf-8-validate@5.0.10)': + '@trezor/blockchain-link-utils@1.2.4(bufferutil@4.0.8)(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1)(utf-8-validate@5.0.10)': dependencies: '@mobily/ts-belt': 3.13.1 '@solana/web3.js': 1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10) - '@trezor/env-utils': 1.2.1(react-native@0.76.3(@babel/core@7.26.0)(bufferutil@4.0.8)(utf-8-validate@5.0.10))(tslib@2.8.1) + '@trezor/env-utils': 1.2.1(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1) '@trezor/utils': 9.2.4(tslib@2.8.1) tslib: 2.8.1 transitivePeerDependencies: @@ -22241,37 +22118,13 @@ snapshots: - supports-color - utf-8-validate - '@trezor/blockchain-link@2.3.4(bufferutil@4.0.8)(react-native@0.76.3(@babel/core@7.26.0)(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1)(utf-8-validate@5.0.10)': + '@trezor/blockchain-link@2.3.4(bufferutil@4.0.8)(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1)(utf-8-validate@5.0.10)': dependencies: '@solana/buffer-layout': 4.0.1 '@solana/web3.js': 1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10) '@trezor/blockchain-link-types': 1.2.3(bufferutil@4.0.8)(tslib@2.8.1)(utf-8-validate@5.0.10) - '@trezor/blockchain-link-utils': 1.2.4(bufferutil@4.0.8)(react-native@0.76.3(@babel/core@7.26.0)(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1)(utf-8-validate@5.0.10) - '@trezor/env-utils': 1.2.1(react-native@0.76.3(@babel/core@7.26.0)(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1) - '@trezor/utils': 9.2.4(tslib@2.8.1) - '@trezor/utxo-lib': 2.2.4(tslib@2.8.1) - '@types/web': 0.0.174 - events: 3.3.0 - ripple-lib: 1.10.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) - socks-proxy-agent: 8.0.4 - tslib: 2.8.1 - ws: 8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) - transitivePeerDependencies: - - bufferutil - - encoding - - expo-constants - - expo-localization - - react-native - - supports-color - - utf-8-validate - - '@trezor/blockchain-link@2.3.4(bufferutil@4.0.8)(react-native@0.76.3(@babel/core@7.26.0)(bufferutil@4.0.8)(utf-8-validate@5.0.10))(tslib@2.8.1)(utf-8-validate@5.0.10)': - dependencies: - '@solana/buffer-layout': 4.0.1 - '@solana/web3.js': 1.95.8(bufferutil@4.0.8)(utf-8-validate@5.0.10) - '@trezor/blockchain-link-types': 1.2.3(bufferutil@4.0.8)(tslib@2.8.1)(utf-8-validate@5.0.10) - '@trezor/blockchain-link-utils': 1.2.4(bufferutil@4.0.8)(react-native@0.76.3(@babel/core@7.26.0)(bufferutil@4.0.8)(utf-8-validate@5.0.10))(tslib@2.8.1)(utf-8-validate@5.0.10) - '@trezor/env-utils': 1.2.1(react-native@0.76.3(@babel/core@7.26.0)(bufferutil@4.0.8)(utf-8-validate@5.0.10))(tslib@2.8.1) + '@trezor/blockchain-link-utils': 1.2.4(bufferutil@4.0.8)(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1)(utf-8-validate@5.0.10) + '@trezor/env-utils': 1.2.1(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1) '@trezor/utils': 9.2.4(tslib@2.8.1) '@trezor/utxo-lib': 2.2.4(tslib@2.8.1) '@types/web': 0.0.174 @@ -22298,18 +22151,9 @@ snapshots: - expo-localization - react-native - '@trezor/connect-analytics@1.2.3(react-native@0.76.3(@babel/core@7.26.0)(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1)': + '@trezor/connect-analytics@1.2.3(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1)': dependencies: - '@trezor/analytics': 1.2.3(react-native@0.76.3(@babel/core@7.26.0)(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1) - tslib: 2.8.1 - transitivePeerDependencies: - - expo-constants - - expo-localization - - react-native - - '@trezor/connect-analytics@1.2.3(react-native@0.76.3(@babel/core@7.26.0)(bufferutil@4.0.8)(utf-8-validate@5.0.10))(tslib@2.8.1)': - dependencies: - '@trezor/analytics': 1.2.3(react-native@0.76.3(@babel/core@7.26.0)(bufferutil@4.0.8)(utf-8-validate@5.0.10))(tslib@2.8.1) + '@trezor/analytics': 1.2.3(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1) tslib: 2.8.1 transitivePeerDependencies: - expo-constants @@ -22326,19 +22170,9 @@ snapshots: - expo-localization - react-native - '@trezor/connect-common@0.2.5(react-native@0.76.3(@babel/core@7.26.0)(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1)': + '@trezor/connect-common@0.2.5(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1)': dependencies: - '@trezor/env-utils': 1.2.1(react-native@0.76.3(@babel/core@7.26.0)(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1) - '@trezor/utils': 9.2.4(tslib@2.8.1) - tslib: 2.8.1 - transitivePeerDependencies: - - expo-constants - - expo-localization - - react-native - - '@trezor/connect-common@0.2.5(react-native@0.76.3(@babel/core@7.26.0)(bufferutil@4.0.8)(utf-8-validate@5.0.10))(tslib@2.8.1)': - dependencies: - '@trezor/env-utils': 1.2.1(react-native@0.76.3(@babel/core@7.26.0)(bufferutil@4.0.8)(utf-8-validate@5.0.10))(tslib@2.8.1) + '@trezor/env-utils': 1.2.1(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1) '@trezor/utils': 9.2.4(tslib@2.8.1) tslib: 2.8.1 transitivePeerDependencies: @@ -22362,26 +22196,10 @@ snapshots: - supports-color - utf-8-validate - '@trezor/connect-web@9.4.5(@babel/core@7.26.0)(bufferutil@4.0.8)(react-native@0.76.3(@babel/core@7.26.0)(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1)(utf-8-validate@5.0.10)': - dependencies: - '@trezor/connect': 9.4.5(@babel/core@7.26.0)(bufferutil@4.0.8)(react-native@0.76.3(@babel/core@7.26.0)(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1)(utf-8-validate@5.0.10) - '@trezor/connect-common': 0.2.5(react-native@0.76.3(@babel/core@7.26.0)(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1) - '@trezor/utils': 9.2.4(tslib@2.8.1) - tslib: 2.8.1 - transitivePeerDependencies: - - '@babel/core' - - bufferutil - - encoding - - expo-constants - - expo-localization - - react-native - - supports-color - - utf-8-validate - - '@trezor/connect-web@9.4.5(@babel/core@7.26.0)(bufferutil@4.0.8)(react-native@0.76.3(@babel/core@7.26.0)(bufferutil@4.0.8)(utf-8-validate@5.0.10))(tslib@2.8.1)(utf-8-validate@5.0.10)': + '@trezor/connect-web@9.4.5(@babel/core@7.26.0)(bufferutil@4.0.8)(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1)(utf-8-validate@5.0.10)': dependencies: - '@trezor/connect': 9.4.5(@babel/core@7.26.0)(bufferutil@4.0.8)(react-native@0.76.3(@babel/core@7.26.0)(bufferutil@4.0.8)(utf-8-validate@5.0.10))(tslib@2.8.1)(utf-8-validate@5.0.10) - '@trezor/connect-common': 0.2.5(react-native@0.76.3(@babel/core@7.26.0)(bufferutil@4.0.8)(utf-8-validate@5.0.10))(tslib@2.8.1) + '@trezor/connect': 9.4.5(@babel/core@7.26.0)(bufferutil@4.0.8)(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1)(utf-8-validate@5.0.10) + '@trezor/connect-common': 0.2.5(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1) '@trezor/utils': 9.2.4(tslib@2.8.1) tslib: 2.8.1 transitivePeerDependencies: @@ -22425,47 +22243,16 @@ snapshots: - supports-color - utf-8-validate - '@trezor/connect@9.4.5(@babel/core@7.26.0)(bufferutil@4.0.8)(react-native@0.76.3(@babel/core@7.26.0)(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1)(utf-8-validate@5.0.10)': - dependencies: - '@babel/preset-typescript': 7.26.0(@babel/core@7.26.0) - '@ethereumjs/common': 4.4.0 - '@ethereumjs/tx': 5.4.0 - '@fivebinaries/coin-selection': 2.2.1 - '@trezor/blockchain-link': 2.3.4(bufferutil@4.0.8)(react-native@0.76.3(@babel/core@7.26.0)(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1)(utf-8-validate@5.0.10) - '@trezor/blockchain-link-types': 1.2.3(bufferutil@4.0.8)(tslib@2.8.1)(utf-8-validate@5.0.10) - '@trezor/connect-analytics': 1.2.3(react-native@0.76.3(@babel/core@7.26.0)(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1) - '@trezor/connect-common': 0.2.5(react-native@0.76.3(@babel/core@7.26.0)(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1) - '@trezor/protobuf': 1.2.5(tslib@2.8.1) - '@trezor/protocol': 1.2.2(tslib@2.8.1) - '@trezor/schema-utils': 1.2.3(tslib@2.8.1) - '@trezor/transport': 1.3.5(tslib@2.8.1) - '@trezor/utils': 9.2.4(tslib@2.8.1) - '@trezor/utxo-lib': 2.2.4(tslib@2.8.1) - blakejs: 1.2.1 - bs58: 6.0.0 - bs58check: 4.0.0 - cross-fetch: 4.0.0 - tslib: 2.8.1 - transitivePeerDependencies: - - '@babel/core' - - bufferutil - - encoding - - expo-constants - - expo-localization - - react-native - - supports-color - - utf-8-validate - - '@trezor/connect@9.4.5(@babel/core@7.26.0)(bufferutil@4.0.8)(react-native@0.76.3(@babel/core@7.26.0)(bufferutil@4.0.8)(utf-8-validate@5.0.10))(tslib@2.8.1)(utf-8-validate@5.0.10)': + '@trezor/connect@9.4.5(@babel/core@7.26.0)(bufferutil@4.0.8)(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1)(utf-8-validate@5.0.10)': dependencies: '@babel/preset-typescript': 7.26.0(@babel/core@7.26.0) '@ethereumjs/common': 4.4.0 '@ethereumjs/tx': 5.4.0 '@fivebinaries/coin-selection': 2.2.1 - '@trezor/blockchain-link': 2.3.4(bufferutil@4.0.8)(react-native@0.76.3(@babel/core@7.26.0)(bufferutil@4.0.8)(utf-8-validate@5.0.10))(tslib@2.8.1)(utf-8-validate@5.0.10) + '@trezor/blockchain-link': 2.3.4(bufferutil@4.0.8)(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1)(utf-8-validate@5.0.10) '@trezor/blockchain-link-types': 1.2.3(bufferutil@4.0.8)(tslib@2.8.1)(utf-8-validate@5.0.10) - '@trezor/connect-analytics': 1.2.3(react-native@0.76.3(@babel/core@7.26.0)(bufferutil@4.0.8)(utf-8-validate@5.0.10))(tslib@2.8.1) - '@trezor/connect-common': 0.2.5(react-native@0.76.3(@babel/core@7.26.0)(bufferutil@4.0.8)(utf-8-validate@5.0.10))(tslib@2.8.1) + '@trezor/connect-analytics': 1.2.3(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1) + '@trezor/connect-common': 0.2.5(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1) '@trezor/protobuf': 1.2.5(tslib@2.8.1) '@trezor/protocol': 1.2.2(tslib@2.8.1) '@trezor/schema-utils': 1.2.3(tslib@2.8.1) @@ -22494,19 +22281,12 @@ snapshots: optionalDependencies: react-native: 0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10) - '@trezor/env-utils@1.2.1(react-native@0.76.3(@babel/core@7.26.0)(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1)': - dependencies: - tslib: 2.8.1 - ua-parser-js: 1.0.39 - optionalDependencies: - react-native: 0.76.3(@babel/core@7.26.0)(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10) - - '@trezor/env-utils@1.2.1(react-native@0.76.3(@babel/core@7.26.0)(bufferutil@4.0.8)(utf-8-validate@5.0.10))(tslib@2.8.1)': + '@trezor/env-utils@1.2.1(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(tslib@2.8.1)': dependencies: tslib: 2.8.1 ua-parser-js: 1.0.39 optionalDependencies: - react-native: 0.76.3(@babel/core@7.26.0)(bufferutil@4.0.8)(utf-8-validate@5.0.10) + react-native: 0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10) '@trezor/protobuf@1.2.5(tslib@2.8.1)': dependencies: @@ -23237,15 +23017,15 @@ snapshots: - utf-8-validate - zod - '@wagmi/connectors@5.1.15(@types/react@18.2.62)(@wagmi/core@2.13.8(@tanstack/query-core@5.59.16)(@types/react@18.2.62)(react@18.3.1)(typescript@5.3.3)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8)))(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(rollup@4.28.0)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8)': + '@wagmi/connectors@5.1.15(@types/react@18.3.1)(@wagmi/core@2.13.8(@tanstack/query-core@5.59.16)(@types/react@18.3.1)(react@18.3.1)(typescript@5.3.3)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8)))(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.28.0)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8)': dependencies: '@coinbase/wallet-sdk': 4.0.4 '@metamask/sdk': 0.28.4(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.28.0)(utf-8-validate@5.0.10) '@safe-global/safe-apps-provider': 0.18.3(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8) '@safe-global/safe-apps-sdk': 9.1.0(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8) - '@wagmi/core': 2.13.8(@tanstack/query-core@5.59.16)(@types/react@18.2.62)(react@18.3.1)(typescript@5.3.3)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8)) - '@walletconnect/ethereum-provider': 2.17.0(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10) - '@walletconnect/modal': 2.7.0(@types/react@18.2.62)(react@18.3.1) + '@wagmi/core': 2.13.8(@tanstack/query-core@5.59.16)(@types/react@18.3.1)(react@18.3.1)(typescript@5.3.3)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8)) + '@walletconnect/ethereum-provider': 2.17.0(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10) + '@walletconnect/modal': 2.7.0(@types/react@18.3.1)(react@18.3.1) cbw-sdk: '@coinbase/wallet-sdk@3.9.3' viem: 2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8) optionalDependencies: @@ -23275,10 +23055,10 @@ snapshots: - utf-8-validate - zod - '@wagmi/connectors@5.1.15(@types/react@18.3.1)(@wagmi/core@2.13.8(@tanstack/query-core@5.59.16)(@types/react@18.3.1)(react@18.3.1)(typescript@5.3.3)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8)))(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.28.0)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8)': + '@wagmi/connectors@5.1.15(@types/react@18.3.1)(@wagmi/core@2.13.8(@tanstack/query-core@5.59.16)(@types/react@18.3.1)(react@18.3.1)(typescript@5.3.3)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8)))(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(rollup@4.28.0)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8)': dependencies: '@coinbase/wallet-sdk': 4.0.4 - '@metamask/sdk': 0.28.4(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.28.0)(utf-8-validate@5.0.10) + '@metamask/sdk': 0.28.4(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.28.0)(utf-8-validate@5.0.10) '@safe-global/safe-apps-provider': 0.18.3(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8) '@safe-global/safe-apps-sdk': 9.1.0(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8) '@wagmi/core': 2.13.8(@tanstack/query-core@5.59.16)(@types/react@18.3.1)(react@18.3.1)(typescript@5.3.3)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8)) @@ -24598,6 +24378,15 @@ snapshots: typeforce: 1.18.0 varuint-bitcoin: 1.1.2 + bitcoinjs-lib@6.1.7: + dependencies: + '@noble/hashes': 1.6.1 + bech32: 2.0.0 + bip174: 2.1.1 + bs58check: 3.0.1 + typeforce: 1.18.0 + varuint-bitcoin: 1.1.2 + bitcoinjs-lib@7.0.0-rc.0(typescript@5.3.3): dependencies: '@noble/hashes': 1.6.1 @@ -29148,13 +28937,13 @@ snapshots: possible-typed-array-names@1.0.0: {} - postcss-load-config@4.0.2(postcss@8.4.49)(ts-node@10.9.2(@swc/core@1.9.3)(@types/node@20.11.5)(typescript@5.3.3)): + postcss-load-config@4.0.2(postcss@8.4.49)(ts-node@10.9.2(@swc/core@1.9.3(@swc/helpers@0.5.15))(@types/node@20.11.5)(typescript@5.3.3)): dependencies: lilconfig: 3.1.2 yaml: 2.6.1 optionalDependencies: postcss: 8.4.49 - ts-node: 10.9.2(@swc/core@1.9.3)(@types/node@20.11.5)(typescript@5.3.3) + ts-node: 10.9.2(@swc/core@1.9.3(@swc/helpers@0.5.15))(@types/node@20.11.5)(typescript@5.3.3) postcss-value-parser@4.2.0: {} @@ -29602,109 +29391,6 @@ snapshots: - supports-color - utf-8-validate - react-native@0.76.3(@babel/core@7.26.0)(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10): - dependencies: - '@jest/create-cache-key-function': 29.7.0 - '@react-native/assets-registry': 0.76.3 - '@react-native/codegen': 0.76.3(@babel/preset-env@7.26.0(@babel/core@7.26.0)) - '@react-native/community-cli-plugin': 0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(bufferutil@4.0.8)(utf-8-validate@5.0.10) - '@react-native/gradle-plugin': 0.76.3 - '@react-native/js-polyfills': 0.76.3 - '@react-native/normalize-colors': 0.76.3 - '@react-native/virtualized-lists': 0.76.3(@types/react@18.2.62)(react-native@0.76.3(@babel/core@7.26.0)(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1) - abort-controller: 3.0.0 - anser: 1.4.10 - ansi-regex: 5.0.1 - babel-jest: 29.7.0(@babel/core@7.26.0) - babel-plugin-syntax-hermes-parser: 0.23.1 - base64-js: 1.5.1 - chalk: 4.1.2 - commander: 12.1.0 - event-target-shim: 5.0.1 - flow-enums-runtime: 0.0.6 - glob: 7.2.3 - invariant: 2.2.4 - jest-environment-node: 29.7.0 - jsc-android: 250231.0.0 - memoize-one: 5.2.1 - metro-runtime: 0.81.0 - metro-source-map: 0.81.0 - mkdirp: 0.5.6 - nullthrows: 1.1.1 - pretty-format: 29.7.0 - promise: 8.3.0 - react: 18.3.1 - react-devtools-core: 5.3.2(bufferutil@4.0.8)(utf-8-validate@5.0.10) - react-refresh: 0.14.2 - regenerator-runtime: 0.13.11 - scheduler: 0.24.0-canary-efb381bbf-20230505 - semver: 7.6.3 - stacktrace-parser: 0.1.10 - whatwg-fetch: 3.6.20 - ws: 6.2.3(bufferutil@4.0.8)(utf-8-validate@5.0.10) - yargs: 17.7.2 - optionalDependencies: - '@types/react': 18.2.62 - transitivePeerDependencies: - - '@babel/core' - - '@babel/preset-env' - - '@react-native-community/cli-server-api' - - bufferutil - - encoding - - supports-color - - utf-8-validate - optional: true - - react-native@0.76.3(@babel/core@7.26.0)(bufferutil@4.0.8)(utf-8-validate@5.0.10): - dependencies: - '@jest/create-cache-key-function': 29.7.0 - '@react-native/assets-registry': 0.76.3 - '@react-native/codegen': 0.76.3(@babel/preset-env@7.26.0(@babel/core@7.26.0)) - '@react-native/community-cli-plugin': 0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(bufferutil@4.0.8)(utf-8-validate@5.0.10) - '@react-native/gradle-plugin': 0.76.3 - '@react-native/js-polyfills': 0.76.3 - '@react-native/normalize-colors': 0.76.3 - '@react-native/virtualized-lists': 0.76.3(react-native@0.76.3(@babel/core@7.26.0)(bufferutil@4.0.8)(utf-8-validate@5.0.10)) - abort-controller: 3.0.0 - anser: 1.4.10 - ansi-regex: 5.0.1 - babel-jest: 29.7.0(@babel/core@7.26.0) - babel-plugin-syntax-hermes-parser: 0.23.1 - base64-js: 1.5.1 - chalk: 4.1.2 - commander: 12.1.0 - event-target-shim: 5.0.1 - flow-enums-runtime: 0.0.6 - glob: 7.2.3 - invariant: 2.2.4 - jest-environment-node: 29.7.0 - jsc-android: 250231.0.0 - memoize-one: 5.2.1 - metro-runtime: 0.81.0 - metro-source-map: 0.81.0 - mkdirp: 0.5.6 - nullthrows: 1.1.1 - pretty-format: 29.7.0 - promise: 8.3.0 - react-devtools-core: 5.3.2(bufferutil@4.0.8)(utf-8-validate@5.0.10) - react-refresh: 0.14.2 - regenerator-runtime: 0.13.11 - scheduler: 0.24.0-canary-efb381bbf-20230505 - semver: 7.6.3 - stacktrace-parser: 0.1.10 - whatwg-fetch: 3.6.20 - ws: 6.2.3(bufferutil@4.0.8)(utf-8-validate@5.0.10) - yargs: 17.7.2 - transitivePeerDependencies: - - '@babel/core' - - '@babel/preset-env' - - '@react-native-community/cli-server-api' - - bufferutil - - encoding - - supports-color - - utf-8-validate - optional: true - react-qr-reader@2.2.1(react-dom@16.13.1(react@16.13.1))(react@16.13.1): dependencies: jsqr: 1.4.0 @@ -30807,7 +30493,7 @@ snapshots: ts-mixer@6.0.4: {} - ts-node@10.9.2(@swc/core@1.9.3)(@types/node@20.11.5)(typescript@5.3.3): + ts-node@10.9.2(@swc/core@1.9.3(@swc/helpers@0.5.15))(@types/node@20.11.5)(typescript@5.3.3): dependencies: '@cspotcode/source-map-support': 0.8.1 '@tsconfig/node10': 1.0.11 @@ -30844,7 +30530,7 @@ snapshots: tsscmp@1.0.6: {} - tsup@8.0.2(@swc/core@1.9.3)(postcss@8.4.49)(ts-node@10.9.2(@swc/core@1.9.3)(@types/node@20.11.5)(typescript@5.3.3))(typescript@5.3.3): + tsup@8.0.2(@swc/core@1.9.3(@swc/helpers@0.5.15))(postcss@8.4.49)(ts-node@10.9.2(@swc/core@1.9.3(@swc/helpers@0.5.15))(@types/node@20.11.5)(typescript@5.3.3))(typescript@5.3.3): dependencies: bundle-require: 4.2.1(esbuild@0.19.12) cac: 6.7.14 @@ -30854,7 +30540,7 @@ snapshots: execa: 5.1.1 globby: 11.1.0 joycon: 3.1.1 - postcss-load-config: 4.0.2(postcss@8.4.49)(ts-node@10.9.2(@swc/core@1.9.3)(@types/node@20.11.5)(typescript@5.3.3)) + postcss-load-config: 4.0.2(postcss@8.4.49)(ts-node@10.9.2(@swc/core@1.9.3(@swc/helpers@0.5.15))(@types/node@20.11.5)(typescript@5.3.3)) resolve-from: 5.0.0 rollup: 4.28.0 source-map: 0.8.0-beta.0 @@ -31446,10 +31132,10 @@ snapshots: - utf-8-validate - zod - wagmi@2.12.17(@tanstack/query-core@5.59.16)(@tanstack/react-query@5.24.8(react@18.3.1))(@types/react@18.2.62)(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(rollup@4.28.0)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8): + wagmi@2.12.17(@tanstack/query-core@5.59.16)(@tanstack/react-query@5.56.2(react@18.3.1))(@types/react@18.2.62)(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(rollup@4.28.0)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8): dependencies: - '@tanstack/react-query': 5.24.8(react@18.3.1) - '@wagmi/connectors': 5.1.15(@types/react@18.2.62)(@wagmi/core@2.13.8(@tanstack/query-core@5.59.16)(@types/react@18.2.62)(react@18.3.1)(typescript@5.3.3)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8)))(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(rollup@4.28.0)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8) + '@tanstack/react-query': 5.56.2(react@18.3.1) + '@wagmi/connectors': 5.1.15(@types/react@18.2.62)(@wagmi/core@2.13.8(@tanstack/query-core@5.59.16)(@types/react@18.2.62)(react@18.3.1)(typescript@5.3.3)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8)))(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.2.62)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.28.0)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8) '@wagmi/core': 2.13.8(@tanstack/query-core@5.59.16)(@types/react@18.2.62)(react@18.3.1)(typescript@5.3.3)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8)) react: 18.3.1 use-sync-external-store: 1.2.0(react@18.3.1) @@ -31482,11 +31168,11 @@ snapshots: - utf-8-validate - zod - wagmi@2.12.17(@tanstack/query-core@5.59.16)(@tanstack/react-query@5.56.2(react@18.3.1))(@types/react@18.2.62)(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(rollup@4.28.0)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8): + wagmi@2.12.17(@tanstack/query-core@5.59.16)(@tanstack/react-query@5.56.2(react@18.3.1))(@types/react@18.3.1)(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.28.0)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8): dependencies: '@tanstack/react-query': 5.56.2(react@18.3.1) - '@wagmi/connectors': 5.1.15(@types/react@18.2.62)(@wagmi/core@2.13.8(@tanstack/query-core@5.59.16)(@types/react@18.2.62)(react@18.3.1)(typescript@5.3.3)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8)))(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(rollup@4.28.0)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8) - '@wagmi/core': 2.13.8(@tanstack/query-core@5.59.16)(@types/react@18.2.62)(react@18.3.1)(typescript@5.3.3)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8)) + '@wagmi/connectors': 5.1.15(@types/react@18.3.1)(@wagmi/core@2.13.8(@tanstack/query-core@5.59.16)(@types/react@18.3.1)(react@18.3.1)(typescript@5.3.3)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8)))(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.28.0)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8) + '@wagmi/core': 2.13.8(@tanstack/query-core@5.59.16)(@types/react@18.3.1)(react@18.3.1)(typescript@5.3.3)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8)) react: 18.3.1 use-sync-external-store: 1.2.0(react@18.3.1) viem: 2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8) @@ -31518,14 +31204,14 @@ snapshots: - utf-8-validate - zod - wagmi@2.12.17(@tanstack/query-core@5.59.16)(@tanstack/react-query@5.56.2(react@18.3.1))(@types/react@18.3.1)(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.28.0)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8): + wagmi@2.12.17(@tanstack/query-core@5.59.16)(@tanstack/react-query@5.56.2(react@18.3.1))(@types/react@18.3.1)(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.28.0)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.21.34(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8): dependencies: '@tanstack/react-query': 5.56.2(react@18.3.1) - '@wagmi/connectors': 5.1.15(@types/react@18.3.1)(@wagmi/core@2.13.8(@tanstack/query-core@5.59.16)(@types/react@18.3.1)(react@18.3.1)(typescript@5.3.3)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8)))(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.28.0)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8) - '@wagmi/core': 2.13.8(@tanstack/query-core@5.59.16)(@types/react@18.3.1)(react@18.3.1)(typescript@5.3.3)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8)) + '@wagmi/connectors': 5.1.15(@types/react@18.3.1)(@wagmi/core@2.13.8(@tanstack/query-core@5.59.16)(@types/react@18.3.1)(react@18.3.1)(typescript@5.3.3)(viem@2.21.34(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8)))(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.28.0)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.21.34(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8) + '@wagmi/core': 2.13.8(@tanstack/query-core@5.59.16)(@types/react@18.3.1)(react@18.3.1)(typescript@5.3.3)(viem@2.21.34(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8)) react: 18.3.1 use-sync-external-store: 1.2.0(react@18.3.1) - viem: 2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8) + viem: 2.21.34(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8) optionalDependencies: typescript: 5.3.3 transitivePeerDependencies: @@ -31554,14 +31240,14 @@ snapshots: - utf-8-validate - zod - wagmi@2.12.17(@tanstack/query-core@5.59.16)(@tanstack/react-query@5.56.2(react@18.3.1))(@types/react@18.3.1)(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.28.0)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.21.34(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8): + wagmi@2.12.17(@tanstack/query-core@5.59.16)(@tanstack/react-query@5.56.2(react@18.3.1))(@types/react@18.3.1)(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(rollup@4.28.0)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8): dependencies: '@tanstack/react-query': 5.56.2(react@18.3.1) - '@wagmi/connectors': 5.1.15(@types/react@18.3.1)(@wagmi/core@2.13.8(@tanstack/query-core@5.59.16)(@types/react@18.3.1)(react@18.3.1)(typescript@5.3.3)(viem@2.21.34(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8)))(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.76.3(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.3.1)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.28.0)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.21.34(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8) - '@wagmi/core': 2.13.8(@tanstack/query-core@5.59.16)(@types/react@18.3.1)(react@18.3.1)(typescript@5.3.3)(viem@2.21.34(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8)) + '@wagmi/connectors': 5.1.15(@types/react@18.3.1)(@wagmi/core@2.13.8(@tanstack/query-core@5.59.16)(@types/react@18.3.1)(react@18.3.1)(typescript@5.3.3)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8)))(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(rollup@4.28.0)(typescript@5.3.3)(utf-8-validate@5.0.10)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8) + '@wagmi/core': 2.13.8(@tanstack/query-core@5.59.16)(@types/react@18.3.1)(react@18.3.1)(typescript@5.3.3)(viem@2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8)) react: 18.3.1 use-sync-external-store: 1.2.0(react@18.3.1) - viem: 2.21.34(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8) + viem: 2.21.26(bufferutil@4.0.8)(typescript@5.3.3)(utf-8-validate@5.0.10)(zod@3.23.8) optionalDependencies: typescript: 5.3.3 transitivePeerDependencies: From e337331aa7f5804d0a9166925b33feec70093027 Mon Sep 17 00:00:00 2001 From: Felipe Mendes Date: Mon, 9 Dec 2024 17:50:48 -0300 Subject: [PATCH 09/12] refactor: get imageUrl from extension --- .../bitcoin/src/connectors/OKXConnector.ts | 20 +++++++++++++------ .../tests/connectors/OKXConnector.test.ts | 14 +++++++++---- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/packages/adapters/bitcoin/src/connectors/OKXConnector.ts b/packages/adapters/bitcoin/src/connectors/OKXConnector.ts index 3230847a94..e48f6f45f6 100644 --- a/packages/adapters/bitcoin/src/connectors/OKXConnector.ts +++ b/packages/adapters/bitcoin/src/connectors/OKXConnector.ts @@ -10,8 +10,7 @@ export class OKXConnector extends ProviderEventEmitter implements BitcoinConnect public readonly name = 'OKX Wallet' public readonly chain = 'bip122' public readonly type = 'ANNOUNCED' - public readonly imageUrl = - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJDSURBVHgB7Zq9jtpAEMfHlhEgQLiioXEkoAGECwoKxMcTRHmC5E3IoyRPkPAEkI7unJYmTgEFTYwA8a3NTKScLnCHN6c9r1e3P2llWQy7M/s1Gv1twCP0ej37dDq9x+Zut1t3t9vZjDEHIiSRSPg4ZpDL5fxkMvn1cDh8m0wmfugfO53OoFQq/crn8wxfY9EymQyrVCqMfHvScZx1p9ls3pFxXBy/bKlUipGPrVbLuQqAfsCliq3zl0H84zwtjQrOw4Mt1W63P5LvBm2d+Xz+YzqdgkqUy+WgWCy+Mc/nc282m4FqLBYL+3g8fjDxenq72WxANZbLJeA13zDX67UDioL5ybXwafMYu64Ltn3bdDweQ5R97fd7GyhBQMipx4POeEDHIu2LfDdBIGGz+hJ9CQ1ABjoA2egAZPM6AgiCAEQhsi/C4jHyPA/6/f5NG3Ks2+3CYDC4aTccDrn6ojG54MnEvG00GoVmWLIRNZ7wTCwDHYBsdACy0QHIhiuRETxlICWpMMhGZHmqS8qH6JLyGegAZKMDkI0uKf8X4SWlaZo+Pp1bRrwlJU8ZKLIvUjKh0WiQ3sRUbNVq9c5Ebew7KEo2m/1p4jJ4qAmDaqDQBzj5XyiAT4VCQezJigAU+IDU+z8vJFnGWeC+bKQV/5VZ71FV6L7PA3gg3tXrdQ+DgLhC+75Wq3no69P3MC0NFQpx2lL04Ql9gHK1bRDjsSBIvScBnDTk1WrlGIZBorIDEYJj+rhdgnQ67VmWRe0zlplXl81vcyEt0rSoYDUAAAAASUVORK5CYII=' + public readonly imageUrl: string public readonly provider = this @@ -19,11 +18,17 @@ export class OKXConnector extends ProviderEventEmitter implements BitcoinConnect private readonly requestedChains: CaipNetwork[] = [] private readonly getActiveNetwork: () => CaipNetwork | undefined - constructor({ wallet, requestedChains, getActiveNetwork }: OKXConnector.ConstructorParams) { + constructor({ + wallet, + requestedChains, + getActiveNetwork, + imageUrl + }: OKXConnector.ConstructorParams) { super() this.wallet = wallet this.requestedChains = requestedChains this.getActiveNetwork = getActiveNetwork + this.imageUrl = imageUrl } public get chains() { @@ -121,10 +126,12 @@ export class OKXConnector extends ProviderEventEmitter implements BitcoinConnect public static getWallet(params: OKXConnector.GetWalletParams): OKXConnector | undefined { // eslint-disable-next-line @typescript-eslint/no-explicit-any - const wallet = (window as any)?.okxwallet?.bitcoin + const okxwallet = (window as any)?.okxwallet + const wallet = okxwallet?.bitcoin + const imageUrl = okxwallet?.cardano?.icon || '' if (wallet) { - return new OKXConnector({ wallet, ...params }) + return new OKXConnector({ wallet, imageUrl, ...params }) } return undefined @@ -136,6 +143,7 @@ export namespace OKXConnector { wallet: Wallet requestedChains: CaipNetwork[] getActiveNetwork: () => CaipNetwork | undefined + imageUrl: string } export type Wallet = { @@ -161,5 +169,5 @@ export namespace OKXConnector { removeAllListeners(): void } - export type GetWalletParams = Omit + export type GetWalletParams = Omit } diff --git a/packages/adapters/bitcoin/tests/connectors/OKXConnector.test.ts b/packages/adapters/bitcoin/tests/connectors/OKXConnector.test.ts index 63c0b87ae0..1f2cbb2db1 100644 --- a/packages/adapters/bitcoin/tests/connectors/OKXConnector.test.ts +++ b/packages/adapters/bitcoin/tests/connectors/OKXConnector.test.ts @@ -23,12 +23,14 @@ describe('OKXConnector', () => { let requestedChains: CaipNetwork[] let connector: OKXConnector let getActiveNetwork: Mock<() => CaipNetwork | undefined> + let imageUrl: string beforeEach(() => { + imageUrl = 'mock_image_url' requestedChains = [bitcoin, bitcoinTestnet] getActiveNetwork = vi.fn(() => bitcoin) wallet = mockOKXWallet() - connector = new OKXConnector({ wallet, requestedChains, getActiveNetwork }) + connector = new OKXConnector({ wallet, requestedChains, getActiveNetwork, imageUrl }) }) it('should validate metadata', () => { @@ -36,9 +38,7 @@ describe('OKXConnector', () => { expect(connector.name).toBe('OKX Wallet') expect(connector.chain).toBe('bip122') expect(connector.type).toBe('ANNOUNCED') - expect(connector.imageUrl).toBe( - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJDSURBVHgB7Zq9jtpAEMfHlhEgQLiioXEkoAGECwoKxMcTRHmC5E3IoyRPkPAEkI7unJYmTgEFTYwA8a3NTKScLnCHN6c9r1e3P2llWQy7M/s1Gv1twCP0ej37dDq9x+Zut1t3t9vZjDEHIiSRSPg4ZpDL5fxkMvn1cDh8m0wmfugfO53OoFQq/crn8wxfY9EymQyrVCqMfHvScZx1p9ls3pFxXBy/bKlUipGPrVbLuQqAfsCliq3zl0H84zwtjQrOw4Mt1W63P5LvBm2d+Xz+YzqdgkqUy+WgWCy+Mc/nc282m4FqLBYL+3g8fjDxenq72WxANZbLJeA13zDX67UDioL5ybXwafMYu64Ltn3bdDweQ5R97fd7GyhBQMipx4POeEDHIu2LfDdBIGGz+hJ9CQ1ABjoA2egAZPM6AgiCAEQhsi/C4jHyPA/6/f5NG3Ks2+3CYDC4aTccDrn6ojG54MnEvG00GoVmWLIRNZ7wTCwDHYBsdACy0QHIhiuRETxlICWpMMhGZHmqS8qH6JLyGegAZKMDkI0uKf8X4SWlaZo+Pp1bRrwlJU8ZKLIvUjKh0WiQ3sRUbNVq9c5Ebew7KEo2m/1p4jJ4qAmDaqDQBzj5XyiAT4VCQezJigAU+IDU+z8vJFnGWeC+bKQV/5VZ71FV6L7PA3gg3tXrdQ+DgLhC+75Wq3no69P3MC0NFQpx2lL04Ql9gHK1bRDjsSBIvScBnDTk1WrlGIZBorIDEYJj+rhdgnQ67VmWRe0zlplXl81vcyEt0rSoYDUAAAAASUVORK5CYII=' - ) + expect(connector.imageUrl).toBe('mock_image_url') }) it('should return only mainnet chain', () => { @@ -187,5 +187,11 @@ describe('OKXConnector', () => { const connector = OKXConnector.getWallet({ getActiveNetwork, requestedChains }) expect(connector).toBeInstanceOf(OKXConnector) }) + + it('should get image url', () => { + ;(window as any).okxwallet = { bitcoin: wallet, cardano: { icon: 'mock_image' } } + const connector = OKXConnector.getWallet({ getActiveNetwork, requestedChains }) + expect(connector?.imageUrl).toBe('mock_image') + }) }) }) From 6bae34cb3f165e4f0501447d1b4befc7e05738cb Mon Sep 17 00:00:00 2001 From: Felipe Mendes Date: Mon, 9 Dec 2024 18:12:00 -0300 Subject: [PATCH 10/12] refactor: create format units util --- .../bitcoin/src/connectors/OKXConnector.ts | 5 ++--- .../adapters/bitcoin/src/utils/UnitsUtil.ts | 12 +++++++++++ .../bitcoin/tests/utils/UnitsUtils.test.ts | 21 +++++++++++++++++++ 3 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 packages/adapters/bitcoin/src/utils/UnitsUtil.ts create mode 100644 packages/adapters/bitcoin/tests/utils/UnitsUtils.test.ts diff --git a/packages/adapters/bitcoin/src/connectors/OKXConnector.ts b/packages/adapters/bitcoin/src/connectors/OKXConnector.ts index e48f6f45f6..9cf3212e1a 100644 --- a/packages/adapters/bitcoin/src/connectors/OKXConnector.ts +++ b/packages/adapters/bitcoin/src/connectors/OKXConnector.ts @@ -4,6 +4,7 @@ import { ProviderEventEmitter } from '../utils/ProviderEventEmitter.js' import type { RequestArguments } from '@reown/appkit-core' import { MethodNotSupportedError } from '../errors/MethodNotSupportedError.js' import { bitcoin } from '@reown/appkit/networks' +import { UnitsUtil } from '../utils/UnitsUtil.js' export class OKXConnector extends ProviderEventEmitter implements BitcoinConnector { public readonly id = 'OKX' @@ -74,12 +75,10 @@ export class OKXConnector extends ProviderEventEmitter implements BitcoinConnect throw new Error('No account available') } - const value = (Number(params.amount) / 10 ** network.nativeCurrency.decimals).toString() - const result = await this.wallet.send({ from, to: params.recipient, - value + value: UnitsUtil.parseSatoshis(params.amount, network) }) return result.txhash diff --git a/packages/adapters/bitcoin/src/utils/UnitsUtil.ts b/packages/adapters/bitcoin/src/utils/UnitsUtil.ts new file mode 100644 index 0000000000..ef4b47aa5b --- /dev/null +++ b/packages/adapters/bitcoin/src/utils/UnitsUtil.ts @@ -0,0 +1,12 @@ +import type { CaipNetwork } from '@reown/appkit-common' + +export const UnitsUtil = { + parseSatoshis(amount: string, network: CaipNetwork): string { + const value = parseFloat(amount) / 10 ** network.nativeCurrency.decimals + + // eslint-disable-next-line new-cap + return Intl.NumberFormat('en-US', { + maximumFractionDigits: network.nativeCurrency.decimals + }).format(value) + } +} diff --git a/packages/adapters/bitcoin/tests/utils/UnitsUtils.test.ts b/packages/adapters/bitcoin/tests/utils/UnitsUtils.test.ts new file mode 100644 index 0000000000..e2609b4111 --- /dev/null +++ b/packages/adapters/bitcoin/tests/utils/UnitsUtils.test.ts @@ -0,0 +1,21 @@ +import { describe, expect, it } from 'vitest' +import { UnitsUtil } from '../../src/utils/UnitsUtil' +import { bitcoin } from '@reown/appkit/networks' + +describe('UnitsUtils', () => { + describe('parseSatoshis', () => { + it.each([ + ['100000000', '1'], + ['10000000', '0.1'], + ['1000000', '0.01'], + ['100000', '0.001'], + ['10000', '0.0001'], + ['1000', '0.00001'], + ['100', '0.000001'], + ['10', '0.0000001'], + ['1', '0.00000001'] + ])('should parse %s satoshis to %s btc', (satoshis, expected) => { + expect(UnitsUtil.parseSatoshis(satoshis, bitcoin)).toEqual(expected) + }) + }) +}) From d68166b03a8422eb3770eb2e83f36368be1d7b8f Mon Sep 17 00:00:00 2001 From: Felipe Mendes Date: Mon, 9 Dec 2024 18:20:10 -0300 Subject: [PATCH 11/12] chore: add workaround comment --- packages/adapters/bitcoin/src/connectors/OKXConnector.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/adapters/bitcoin/src/connectors/OKXConnector.ts b/packages/adapters/bitcoin/src/connectors/OKXConnector.ts index 9cf3212e1a..a671e6bf3e 100644 --- a/packages/adapters/bitcoin/src/connectors/OKXConnector.ts +++ b/packages/adapters/bitcoin/src/connectors/OKXConnector.ts @@ -127,6 +127,10 @@ export class OKXConnector extends ProviderEventEmitter implements BitcoinConnect // eslint-disable-next-line @typescript-eslint/no-explicit-any const okxwallet = (window as any)?.okxwallet const wallet = okxwallet?.bitcoin + /** + * OKX doesn't provide a way to get the image URL specifally for bitcoin + * so we use the icon for cardano as a fallback + */ const imageUrl = okxwallet?.cardano?.icon || '' if (wallet) { From 85f3ce719e4a00675cef503b20a5c674e930a64a Mon Sep 17 00:00:00 2001 From: Felipe Mendes Date: Mon, 9 Dec 2024 18:21:03 -0300 Subject: [PATCH 12/12] fix: formating issue --- .../adapters/bitcoin/src/utils/UnitsUtil.ts | 24 +++++------ .../bitcoin/tests/utils/UnitsUtils.test.ts | 42 +++++++++---------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/packages/adapters/bitcoin/src/utils/UnitsUtil.ts b/packages/adapters/bitcoin/src/utils/UnitsUtil.ts index ef4b47aa5b..0aa4cd4a60 100644 --- a/packages/adapters/bitcoin/src/utils/UnitsUtil.ts +++ b/packages/adapters/bitcoin/src/utils/UnitsUtil.ts @@ -1,12 +1,12 @@ -import type { CaipNetwork } from '@reown/appkit-common' - -export const UnitsUtil = { - parseSatoshis(amount: string, network: CaipNetwork): string { - const value = parseFloat(amount) / 10 ** network.nativeCurrency.decimals - - // eslint-disable-next-line new-cap - return Intl.NumberFormat('en-US', { - maximumFractionDigits: network.nativeCurrency.decimals - }).format(value) - } -} +import type { CaipNetwork } from '@reown/appkit-common' + +export const UnitsUtil = { + parseSatoshis(amount: string, network: CaipNetwork): string { + const value = parseFloat(amount) / 10 ** network.nativeCurrency.decimals + + // eslint-disable-next-line new-cap + return Intl.NumberFormat('en-US', { + maximumFractionDigits: network.nativeCurrency.decimals + }).format(value) + } +} diff --git a/packages/adapters/bitcoin/tests/utils/UnitsUtils.test.ts b/packages/adapters/bitcoin/tests/utils/UnitsUtils.test.ts index e2609b4111..35164c0478 100644 --- a/packages/adapters/bitcoin/tests/utils/UnitsUtils.test.ts +++ b/packages/adapters/bitcoin/tests/utils/UnitsUtils.test.ts @@ -1,21 +1,21 @@ -import { describe, expect, it } from 'vitest' -import { UnitsUtil } from '../../src/utils/UnitsUtil' -import { bitcoin } from '@reown/appkit/networks' - -describe('UnitsUtils', () => { - describe('parseSatoshis', () => { - it.each([ - ['100000000', '1'], - ['10000000', '0.1'], - ['1000000', '0.01'], - ['100000', '0.001'], - ['10000', '0.0001'], - ['1000', '0.00001'], - ['100', '0.000001'], - ['10', '0.0000001'], - ['1', '0.00000001'] - ])('should parse %s satoshis to %s btc', (satoshis, expected) => { - expect(UnitsUtil.parseSatoshis(satoshis, bitcoin)).toEqual(expected) - }) - }) -}) +import { describe, expect, it } from 'vitest' +import { UnitsUtil } from '../../src/utils/UnitsUtil' +import { bitcoin } from '@reown/appkit/networks' + +describe('UnitsUtils', () => { + describe('parseSatoshis', () => { + it.each([ + ['100000000', '1'], + ['10000000', '0.1'], + ['1000000', '0.01'], + ['100000', '0.001'], + ['10000', '0.0001'], + ['1000', '0.00001'], + ['100', '0.000001'], + ['10', '0.0000001'], + ['1', '0.00000001'] + ])('should parse %s satoshis to %s btc', (satoshis, expected) => { + expect(UnitsUtil.parseSatoshis(satoshis, bitcoin)).toEqual(expected) + }) + }) +})