Skip to content

Commit 01283a8

Browse files
authored
chore: add bitcoin signet network (#4891)
1 parent 58a66f1 commit 01283a8

File tree

7 files changed

+68
-5
lines changed

7 files changed

+68
-5
lines changed

.changeset/cold-moose-divide.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
'@reown/appkit-adapter-bitcoin': patch
3+
'@reown/appkit-utils': patch
4+
'@reown/appkit': patch
5+
'pay-test-exchange': patch
6+
'@reown/appkit-adapter-ethers': patch
7+
'@reown/appkit-adapter-ethers5': patch
8+
'@reown/appkit-adapter-solana': patch
9+
'@reown/appkit-adapter-wagmi': patch
10+
'@reown/appkit-cdn': patch
11+
'@reown/appkit-cli': patch
12+
'@reown/appkit-codemod': patch
13+
'@reown/appkit-common': patch
14+
'@reown/appkit-controllers': patch
15+
'@reown/appkit-core': patch
16+
'@reown/appkit-experimental': patch
17+
'@reown/appkit-pay': patch
18+
'@reown/appkit-polyfills': patch
19+
'@reown/appkit-scaffold-ui': patch
20+
'@reown/appkit-siwe': patch
21+
'@reown/appkit-siwx': patch
22+
'@reown/appkit-testing': patch
23+
'@reown/appkit-ui': patch
24+
'@reown/appkit-universal-connector': patch
25+
'@reown/appkit-wallet': patch
26+
'@reown/appkit-wallet-button': patch
27+
---
28+
29+
Added bitcoin signet network

apps/laboratory/src/utils/ConstantsUtil.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
baseSepolia,
99
berachain,
1010
bitcoin,
11+
bitcoinSignet,
1112
bitcoinTestnet,
1213
gnosis,
1314
hedera,
@@ -103,7 +104,10 @@ const SolanaNetworks = [solana, solanaTestnet, solanaDevnet, solanaNotExist] as
103104
...AppKitNetwork[]
104105
]
105106

106-
const BitcoinNetworks = [bitcoin, bitcoinTestnet] as [AppKitNetwork, ...AppKitNetwork[]]
107+
const BitcoinNetworks = [bitcoin, bitcoinTestnet, bitcoinSignet] as [
108+
AppKitNetwork,
109+
...AppKitNetwork[]
110+
]
107111

108112
export const ConstantsUtil = {
109113
SigningSucceededToastTitle: 'Signing Succeeded',

packages/adapters/bitcoin/src/connectors/UnisatConnector/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { type CaipNetwork, ConstantsUtil } from '@reown/appkit-common'
22
import { CoreHelperUtil, type RequestArguments } from '@reown/appkit-controllers'
33
import type { BitcoinConnector } from '@reown/appkit-utils/bitcoin'
4-
import { bitcoin, bitcoinTestnet } from '@reown/appkit/networks'
4+
import { bitcoin, bitcoinSignet, bitcoinTestnet } from '@reown/appkit/networks'
55

66
import { MethodNotSupportedError } from '../../errors/MethodNotSupportedError.js'
77
import { AddressPurpose } from '../../utils/BitcoinConnector.js'
@@ -212,6 +212,8 @@ export class UnisatConnector extends ProviderEventEmitter implements BitcoinConn
212212
return 'BITCOIN_MAINNET'
213213
case bitcoinTestnet.caipNetworkId:
214214
return 'BITCOIN_TESTNET'
215+
case bitcoinSignet.caipNetworkId:
216+
return 'BITCOIN_SIGNET'
215217
default:
216218
throw new Error('UnisatConnector: unsupported network')
217219
}

packages/adapters/bitcoin/src/connectors/UnisatConnector/types.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ import type { CaipNetwork } from '@reown/appkit-common'
22
import type { BitcoinConnector } from '@reown/appkit-utils/bitcoin'
33

44
export namespace UnisatConnector {
5-
export type Chain = 'BITCOIN_MAINNET' | 'BITCOIN_TESTNET' | 'FRACTAL_BITCOIN_MAINNET'
5+
export type Chain =
6+
| 'BITCOIN_MAINNET'
7+
| 'BITCOIN_TESTNET'
8+
| 'BITCOIN_SIGNET'
9+
| 'FRACTAL_BITCOIN_MAINNET'
610
export type Network = 'livenet' | 'testnet'
711
export type Id = 'unisat' | 'bitget' | 'binancew3w'
812

packages/adapters/bitcoin/tests/connectors/UnisatConnector.test.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { type Mock, beforeEach, describe, expect, it, vi } from 'vitest'
22

33
import type { CaipNetwork } from '@reown/appkit-common'
44
import { CoreHelperUtil } from '@reown/appkit-controllers'
5-
import { bitcoin, bitcoinTestnet } from '@reown/appkit/networks'
5+
import { bitcoin, bitcoinSignet, bitcoinTestnet } from '@reown/appkit/networks'
66

77
import { UnisatConnector } from '../../src/connectors/UnisatConnector'
88
import type { UnisatConnector as UnisatConnectorTypes } from '../../src/connectors/UnisatConnector/types'
@@ -349,6 +349,12 @@ describe('UnisatConnector', () => {
349349
it('should switch network', async () => {
350350
await connector.switchNetwork(bitcoin.caipNetworkId)
351351
expect(wallet.switchChain).toHaveBeenCalledWith('BITCOIN_MAINNET')
352+
353+
await connector.switchNetwork(bitcoinTestnet.caipNetworkId)
354+
expect(wallet.switchChain).toHaveBeenCalledWith('BITCOIN_TESTNET')
355+
356+
await connector.switchNetwork(bitcoinSignet.caipNetworkId)
357+
expect(wallet.switchChain).toHaveBeenCalledWith('BITCOIN_SIGNET')
352358
})
353359
})
354360
})

packages/appkit-utils/src/PresetsUtil.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ export const PresetsUtil = {
110110
// Bitcoin
111111
'000000000019d6689c085ae165831e93': '0b4838db-0161-4ffe-022d-532bf03dba00',
112112
// Bitcoin Testnet
113-
'000000000933ea01ad0ee984209779ba': '39354064-d79b-420b-065d-f980c4b78200'
113+
'000000000933ea01ad0ee984209779ba': '39354064-d79b-420b-065d-f980c4b78200',
114+
// Bitcoin Signet
115+
'00000008819873e925422c1ff0f99f7c': 'b3406e4a-bbfc-44fb-e3a6-89673c78b700'
114116
} as Record<string, string>,
115117

116118
ConnectorImageIds: {

packages/appkit/src/networks/bitcoin.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,19 @@ export const bitcoinTestnet = defineChain({
3030
},
3131
testnet: true
3232
})
33+
34+
export const bitcoinSignet = defineChain({
35+
id: '00000008819873e925422c1ff0f99f7c',
36+
caipNetworkId: 'bip122:00000008819873e925422c1ff0f99f7c',
37+
chainNamespace: 'bip122',
38+
name: 'Bitcoin Signet',
39+
nativeCurrency: {
40+
name: 'Bitcoin',
41+
symbol: 'BTC',
42+
decimals: 8
43+
},
44+
rpcUrls: {
45+
default: { http: ['https://rpc.walletconnect.org/v1'] }
46+
},
47+
testnet: true
48+
})

0 commit comments

Comments
 (0)