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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .changeset/cruel-coats-peel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
'@reown/appkit-controllers': patch
'@reown/appkit': patch
'@reown/appkit-common': patch
'@reown/appkit-adapter-bitcoin': 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
'@reown/appkit-cli': patch
'@reown/appkit-codemod': patch
'@reown/appkit-core': patch
'@reown/appkit-experimental': patch
'@reown/appkit-pay': patch
'@reown/appkit-polyfills': patch
'@reown/appkit-scaffold-ui': patch
'@reown/appkit-siwe': patch
'@reown/appkit-siwx': patch
'@reown/appkit-testing': patch
'@reown/appkit-ui': patch
'@reown/appkit-wallet': patch
'@reown/appkit-wallet-button': patch
---

Adds sui and stacks as predefined networks.
Exports `AVAILABLE_NAMESPACES` constant from `networks` and `common` packages.
5 changes: 3 additions & 2 deletions .github/workflows/ui_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,9 @@ jobs:
uses: actions/upload-artifact@v4
if: always() # Ensure it runs even if tests fail to get all blob data
with:
name: playwright-blob-artifact-shard-${{ matrix.shard }} # New unique artifact name pattern for blobs
path: ${{ github.workspace }}/apps/laboratory/playwright-blob-reports/report-${{ matrix.shard }}.zip # Path to the uniquely named blob file
# Upload every blob in the directory so the step succeeds regardless of the exact filename
name: playwright-blob-artifact-shard-${{ matrix.shard }}
path: ${{ github.workspace }}/apps/laboratory/playwright-blob-reports/*.zip
retention-days: 7

- name: Verify Cache Dir Exists Before Post Job
Expand Down
10 changes: 10 additions & 0 deletions apps/browser-extension/src/components/Token/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ const tokens: Record<ChainNamespace, { title: string; symbol: string; src: strin
title: 'Cosmos',
symbol: 'ATOM',
src: '/assets/images/atom.png'
},
sui: {
title: 'Sui',
symbol: 'SUI',
src: '/assets/images/sui.png'
},
stacks: {
title: 'Stacks',
symbol: 'STX',
src: '/assets/images/stx.png'
}
}

Expand Down
4 changes: 3 additions & 1 deletion packages/appkit-utils/src/ProviderUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ const CLEAN_PROVIDERS_STATE = {
solana: undefined,
polkadot: undefined,
bip122: undefined,
cosmos: undefined
cosmos: undefined,
sui: undefined,
stacks: undefined
}

const state = proxy<ProviderStoreUtilState>({
Expand Down
3 changes: 2 additions & 1 deletion packages/appkit/src/networks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ export * from './bitcoin.js'
export * from './utils.js'

// -- Types ---------------------------------------------------------------
export type { AppKitNetwork } from '@reown/appkit-common'
export type { AppKitNetwork, ChainNamespace } from '@reown/appkit-common'
export { AVAILABLE_NAMESPACES } from '@reown/appkit-common'
2 changes: 1 addition & 1 deletion packages/common/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// -- Utils -------------------------------------------------------------------
export { DateUtil } from './src/utils/DateUtil.js'
export { NetworkUtil } from './src/utils/NetworkUtil.js'
export { NetworkUtil, AVAILABLE_NAMESPACES } from './src/utils/NetworkUtil.js'
export { NumberUtil } from './src/utils/NumberUtil.js'
export { InputUtil } from './src/utils/InputUtil.js'
export { ContractUtil } from './src/utils/ContractUtil.js'
Expand Down
4 changes: 3 additions & 1 deletion packages/common/src/utils/ConstantsUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ export const ConstantsUtil = {
solana: 'Solana',
polkadot: 'Polkadot',
bip122: 'Bitcoin',
cosmos: 'Cosmos'
cosmos: 'Cosmos',
sui: 'Sui',
stacks: 'Stacks'
} as const satisfies Record<ChainNamespace, string>,
ADAPTER_TYPES: {
BITCOIN: 'bitcoin',
Expand Down
10 changes: 10 additions & 0 deletions packages/common/src/utils/NetworkUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,13 @@ export const NetworkUtil = {
return ConstantsUtil.CHAIN_NAME_MAP?.[namespace] || undefined
}
}

export const AVAILABLE_NAMESPACES: ChainNamespace[] = [
'eip155',
'solana',
'polkadot',
'bip122',
'cosmos',
'sui',
'stacks'
] as const
11 changes: 9 additions & 2 deletions packages/common/src/utils/TypeUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,14 @@ export type CaipAddress = `${ChainNamespace}:${ChainId}:${string}`

export type ChainId = string | number

export type InternalChainNamespace = 'eip155' | 'solana' | 'polkadot' | 'bip122' | 'cosmos'
export type InternalChainNamespace =
| 'eip155'
| 'solana'
| 'polkadot'
| 'bip122'
| 'cosmos'
| 'sui'
| 'stacks'

export type ChainNamespace<T extends string = InternalChainNamespace> = T | InternalChainNamespace

Expand All @@ -54,8 +61,8 @@ export type AdapterType =
| 'ethers'
| 'ethers5'
| 'universal'
| 'polkadot'
| 'bip122'
| 'polkadot'

export type TransactionStatus = 'confirmed' | 'failed' | 'pending'

Expand Down
31 changes: 15 additions & 16 deletions packages/controllers/src/controllers/ConnectorController.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { proxy, ref, snapshot, subscribe as sub } from 'valtio/vanilla'
import { subscribeKey as subKey } from 'valtio/vanilla/utils'

import { type ChainNamespace, ConstantsUtil, getW3mThemeVariables } from '@reown/appkit-common'
import {
AVAILABLE_NAMESPACES,
type ChainNamespace,
ConstantsUtil,
getW3mThemeVariables
} from '@reown/appkit-common'
import { W3mFrameRpcConstants } from '@reown/appkit-wallet/utils'

import { getPreferredAccountType } from '../utils/ChainControllerUtil.js'
Expand Down Expand Up @@ -30,28 +35,22 @@ export interface ConnectorControllerState {

type StateKey = keyof ConnectorControllerState

const defaultActiveConnectors = {
eip155: undefined,
solana: undefined,
polkadot: undefined,
bip122: undefined,
cosmos: undefined
}
const defaultActiveConnectors = Object.fromEntries(
AVAILABLE_NAMESPACES.map(namespace => [namespace, undefined])
) as Record<ChainNamespace, string | undefined>

const defaultFilterByNamespaceMap = Object.fromEntries(
AVAILABLE_NAMESPACES.map(namespace => [namespace, true])
) as Record<ChainNamespace, boolean>

// -- State --------------------------------------------- //
const state = proxy<ConnectorControllerState>({
allConnectors: [],
connectors: [],
activeConnector: undefined,
filterByNamespace: undefined,
activeConnectorIds: { ...defaultActiveConnectors },
filterByNamespaceMap: {
eip155: true,
solana: true,
polkadot: true,
bip122: true,
cosmos: true
}
activeConnectorIds: defaultActiveConnectors,
filterByNamespaceMap: defaultFilterByNamespaceMap
})

// -- Controller ---------------------------------------- //
Expand Down
6 changes: 5 additions & 1 deletion packages/controllers/src/utils/AssetUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ const namespaceImageIds: Record<ChainNamespace, string> = {
// Bitcoin
bip122: '0b4838db-0161-4ffe-022d-532bf03dba00',
// Cosmos
cosmos: ''
cosmos: '',
// Sui
sui: '',
// Stacks
stacks: ''
}

// -- State --------------------------------------------- //
Expand Down
4 changes: 3 additions & 1 deletion packages/controllers/src/utils/ConstantsUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,9 @@ export const ConstantsUtil = {
solana: 'So11111111111111111111111111111111111111111',
polkadot: '0x',
bip122: '0x',
cosmos: '0x'
cosmos: '0x',
sui: '0x',
stacks: '0x'
} as const satisfies Record<ChainNamespace, string>,

CONVERT_SLIPPAGE_TOLERANCE: 1,
Expand Down
2 changes: 2 additions & 0 deletions packages/controllers/src/utils/TypeUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,8 @@ export type NamespaceTypeMap = {
bip122: 'payment' | 'ordinal' | 'stx'
polkadot: 'eoa'
cosmos: 'eoa'
sui: 'eoa'
stacks: 'eoa'
}

export type AccountTypeMap = {
Expand Down
8 changes: 6 additions & 2 deletions packages/controllers/tests/utils/BalanceUtil.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ describe('BalanceUtil', () => {
solana: undefined,
polkadot: undefined,
bip122: undefined,
cosmos: undefined
cosmos: undefined,
sui: undefined,
stacks: undefined
}
vi.mocked(StorageUtil.getBalanceCacheForCaipAddress).mockReturnValue(undefined)
})
Expand Down Expand Up @@ -282,7 +284,9 @@ describe('BalanceUtil', () => {
solana: undefined,
polkadot: undefined,
bip122: undefined,
cosmos: undefined
cosmos: undefined,
sui: undefined,
stacks: undefined
}
vi.mocked(ERC7811Utils.getChainIdHexFromCAIP2ChainId).mockReturnValue(mockEthChainIdAsHex)
})
Expand Down
12 changes: 9 additions & 3 deletions packages/controllers/tests/utils/ChainControllerUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ describe('getChainsToDisconnect', () => {
solana: 'solana-connector',
polkadot: 'polkadot-connector',
bip122: 'bip122-connector',
cosmos: 'cosmos-connector'
cosmos: 'cosmos-connector',
sui: undefined,
stacks: undefined
}

const result = getChainsToDisconnect()
Expand All @@ -41,7 +43,9 @@ describe('getChainsToDisconnect', () => {
solana: 'solana-connector',
polkadot: 'polkadot-connector',
bip122: ConstantsUtil.CONNECTOR_ID.WALLET_CONNECT,
cosmos: 'cosmos-connector'
cosmos: 'cosmos-connector',
sui: undefined,
stacks: undefined
}

const result = getChainsToDisconnect('eip155')
Expand All @@ -65,7 +69,9 @@ describe('getChainsToDisconnect', () => {
solana: ConstantsUtil.CONNECTOR_ID.AUTH,
polkadot: 'polkadot-connector',
bip122: 'bip122-connector',
cosmos: 'cosmos-connector'
cosmos: 'cosmos-connector',
sui: undefined,
stacks: undefined
}

const result = getChainsToDisconnect('solana')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,18 @@ const mockConnectorState: ConnectorControllerState = {
solana: undefined,
polkadot: undefined,
bip122: undefined,
cosmos: undefined
cosmos: undefined,
sui: undefined,
stacks: undefined
},
filterByNamespaceMap: {
eip155: true,
solana: true,
polkadot: true,
bip122: true,
cosmos: true
cosmos: true,
sui: true,
stacks: true
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ describe('W3mConnectingExternalView', () => {
solana: undefined,
polkadot: undefined,
bip122: undefined,
cosmos: undefined
cosmos: undefined,
sui: undefined,
stacks: undefined
}
})
vi.spyOn(RouterController, 'replace').mockImplementation(() => {})
Expand Down
Loading