This repository was archived by the owner on Jan 22, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 939
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Repair the type of the
chain
argument to useSignTransaction
and `…
…useSignAndSendTransaction`
1 parent
bef21e0
commit ef5372a
Showing
4 changed files
with
87 additions
and
6 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
packages/react/src/__typetests__/useSignAndSendTransaction-typetest.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* eslint-disable react-hooks/rules-of-hooks */ | ||
|
||
import { address } from '@solana/addresses'; | ||
import { UiWalletAccount } from '@wallet-standard/ui'; | ||
|
||
import { useSignAndSendTransaction } from '../useSignAndSendTransaction'; | ||
|
||
const mockWalletAccount = { | ||
address: address('123'), | ||
chains: ['solana:danknet', 'bitcoin:mainnet'] as const, | ||
features: [], | ||
publicKey: new Uint8Array([1, 2, 3]), | ||
'~uiWalletHandle': null as unknown as UiWalletAccount['~uiWalletHandle'], | ||
} as const; | ||
|
||
// [DESCRIBE] useSignAndSendTransaction. | ||
{ | ||
// It accepts any chain in the solana namespace | ||
useSignAndSendTransaction(mockWalletAccount, 'solana:danknet'); | ||
useSignAndSendTransaction(mockWalletAccount, 'solana:basednet'); | ||
|
||
// It accepts one of the chains actually supported by the wallet account | ||
useSignAndSendTransaction(mockWalletAccount, 'solana:danknet'); | ||
|
||
// It rejects a chain in a non-Solana namespace | ||
useSignAndSendTransaction( | ||
mockWalletAccount, | ||
// @ts-expect-error Non-Solana chain | ||
'bitcoin:mainnet', | ||
); | ||
} |
31 changes: 31 additions & 0 deletions
31
packages/react/src/__typetests__/useSignTransaction-typetest.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* eslint-disable react-hooks/rules-of-hooks */ | ||
|
||
import { address } from '@solana/addresses'; | ||
import { UiWalletAccount } from '@wallet-standard/ui'; | ||
|
||
import { useSignTransaction } from '../useSignTransaction'; | ||
|
||
const mockWalletAccount = { | ||
address: address('123'), | ||
chains: ['solana:danknet', 'bitcoin:mainnet'] as const, | ||
features: [], | ||
publicKey: new Uint8Array([1, 2, 3]), | ||
'~uiWalletHandle': null as unknown as UiWalletAccount['~uiWalletHandle'], | ||
} as const; | ||
|
||
// [DESCRIBE] useSignTransaction. | ||
{ | ||
// It accepts any chain in the solana namespace | ||
useSignTransaction(mockWalletAccount, 'solana:danknet'); | ||
useSignTransaction(mockWalletAccount, 'solana:basednet'); | ||
|
||
// It accepts one of the chains actually supported by the wallet account | ||
useSignTransaction(mockWalletAccount, 'solana:danknet'); | ||
|
||
// It rejects a chain in a non-Solana namespace | ||
useSignTransaction( | ||
mockWalletAccount, | ||
// @ts-expect-error Non-Solana chain | ||
'bitcoin:mainnet', | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters