Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/large-doors-drive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@reown/appkit-adapter-bitcoin': patch
'@reown/appkit': patch
---

Fixes issue in Leather wallet where requests would target mainnet instead of testnet
18 changes: 9 additions & 9 deletions apps/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@
"@radix-ui/react-switch": "1.2.6",
"@radix-ui/react-tabs": "1.1.13",
"@radix-ui/react-tooltip": "1.2.8",
"@reown/appkit": "1.8.4",
"@reown/appkit-adapter-bitcoin": "1.8.4",
"@reown/appkit-adapter-ethers": "1.8.4",
"@reown/appkit-adapter-solana": "1.8.4",
"@reown/appkit-common": "1.8.4",
"@reown/appkit-controllers": "1.8.4",
"@reown/appkit-scaffold-ui": "1.8.4",
"@reown/appkit-ui": "1.8.4",
"@reown/appkit": "1.8.8",
"@reown/appkit-adapter-bitcoin": "1.8.8",
"@reown/appkit-adapter-ethers": "1.8.8",
"@reown/appkit-adapter-solana": "1.8.8",
"@reown/appkit-common": "1.8.8",
"@reown/appkit-controllers": "1.8.8",
"@reown/appkit-scaffold-ui": "1.8.8",
"@reown/appkit-ui": "1.8.8",
"@sentry/core": "8.55.0",
"@sentry/nextjs": "8.55.0",
"@solana/web3.js": "1.98.4",
Expand All @@ -69,7 +69,7 @@
"@types/react": "19.1.15",
"@types/react-dom": "19.1.9",
"@mailsac/api": "1.0.8",
"@reown/appkit-testing": "1.8.4",
"@reown/appkit-testing": "1.8.8",
"@playwright/test": "1.48.2",
"eslint": "8.56.0",
"eslint-config-next": "14.1.0",
Expand Down
2 changes: 1 addition & 1 deletion apps/laboratory/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
import './out/types/routes.d.ts'
import "./out/types/routes.d.ts";

// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
"elliptic": ">=6.6.1",
"ws": ">=7.5.10",
"chalk": "<=5.3.0",
"strip-ansi": "<=7.1.0",
"strip-ansi": "6.0.1",
"color-convert": "<=2.0.1",
"color-name": "<=1.1.4",
"is-core-module": "<=2.13.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapters/bitcoin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"sats-connect": "3.5.0"
},
"devDependencies": {
"@leather.io/rpc": "2.1.21",
"@leather.io/rpc": "2.20.13",
"@vitest/coverage-v8": "2.1.9",
"@wallet-standard/features": "1.0.3",
"@walletconnect/types": "2.21.7",
Expand Down
19 changes: 7 additions & 12 deletions packages/adapters/bitcoin/src/connectors/LeatherConnector.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import type {
SendTransferRequestParams,
SendTransferResponseBody,
SignPsbtRequestParams,
SignPsbtResponseBody
} from '@leather.io/rpc'
import type { RpcEndpointMap, RpcSendTransferParams } from '@leather.io/rpc'

import type { BitcoinConnector } from '@reown/appkit-utils/bitcoin'
import { bitcoin, bitcoinTestnet } from '@reown/appkit/networks'
Expand Down Expand Up @@ -54,8 +49,8 @@ export class LeatherConnector extends SatsConnectConnector {
recipient
}: BitcoinConnector.SendTransferParams): Promise<string> {
const params: LeatherConnector.SendTransferParams = {
address: recipient,
amount
recipients: [{ address: recipient, amount }],
network: this.getNetwork()
}

const res: LeatherConnector.SendTransferResponse = await this.internalRequest(
Expand Down Expand Up @@ -109,11 +104,11 @@ export namespace LeatherConnector {

export type Network = 'mainnet' | 'testnet' | 'signet' | 'sbtcDevenv' | 'devnet'

export type SendTransferParams = SendTransferRequestParams
export type SendTransferParams = RpcSendTransferParams

export type SendTransferResponse = SendTransferResponseBody
export type SendTransferResponse = { txid: string }

export type SignPSBTParams = SignPsbtRequestParams
export type SignPSBTParams = RpcEndpointMap['signPsbt']['request']['params']

export type SignPSBTResponse = SignPsbtResponseBody
export type SignPSBTResponse = { hex: string; txid?: string }
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,26 @@ describe('LeatherConnector', () => {
const res = await connector.sendTransfer({ amount: '100', recipient: 'address' })

expect(res).toBe(txid)
expect(requestSpy).toHaveBeenCalledWith('sendTransfer', { address: 'address', amount: '100' })
expect(requestSpy).toHaveBeenCalledWith('sendTransfer', {
recipients: [{ address: 'address', amount: '100' }],
network: 'mainnet'
})
})

it('should send a transfer for testnet', async () => {
getActiveNetwork.mockReturnValueOnce(bitcoinTestnet)

const txid = 'txid'
const requestSpy = vi.spyOn(mocks.wallet, 'request')
requestSpy.mockResolvedValue(mockSatsConnectProvider.mockRequestResolve({ txid }))

const res = await connector.sendTransfer({ amount: '100', recipient: 'address' })

expect(res).toBe(txid)
expect(requestSpy).toHaveBeenCalledWith('sendTransfer', {
recipients: [{ address: 'address', amount: '100' }],
network: 'testnet'
})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: API Changes Not Reflected in Connector

The sendTransfer tests now expect a new API format, including recipients and network parameters, but the diff doesn't show corresponding LeatherConnector implementation updates. This mismatch could cause sendTransfer to fail. Also, the test expecting network: 'mainnet' might be flaky without explicitly mocking getActiveNetwork.

Fix in Cursor Fix in Web

})

it('should sign a PSBT', async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/appkit/exports/constants.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const PACKAGE_VERSION = '1.8.7'
export const PACKAGE_VERSION = '1.8.8'
Loading
Loading