File tree Expand file tree Collapse file tree 5 files changed +33
-3
lines changed
relay-bitcoin-wallet-adapter/src
ui/src/components/widgets Expand file tree Collapse file tree 5 files changed +33
-3
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @relayprotocol/relay-bitcoin-wallet-adapter ' : patch
3+ ' @relayprotocol/relay-sdk ' : patch
4+ ' @relayprotocol/relay-kit-ui ' : patch
5+ ---
6+
7+ Add bitcoin public key to quote params
Original file line number Diff line number Diff line change @@ -109,6 +109,10 @@ const SwapWidgetPage: NextPage = () => {
109109 adaptedWallet = adaptViemWallet ( walletClient )
110110 } else if ( isBitcoinWallet ( primaryWallet ) ) {
111111 const wallet = convertToLinkedWallet ( primaryWallet )
112+ const publicKey = primaryWallet . additionalAddresses . find (
113+ ( { address, type } ) =>
114+ address === wallet . address && type === 'payment'
115+ ) ?. publicKey
112116 adaptedWallet = adaptBitcoinWallet (
113117 wallet . address ,
114118 async ( _address , _psbt , dynamicParams ) => {
@@ -123,7 +127,8 @@ const SwapWidgetPage: NextPage = () => {
123127 } catch ( e ) {
124128 throw e
125129 }
126- }
130+ } ,
131+ publicKey
127132 )
128133 } else if (
129134 isSolanaWallet ( primaryWallet ) ||
Original file line number Diff line number Diff line change @@ -21,7 +21,8 @@ export const adaptBitcoinWallet = (
2121 address : string ,
2222 psbt : bitcoin . Psbt ,
2323 dynamicParams : DynamicSignPsbtParams
24- ) => Promise < string >
24+ ) => Promise < string > ,
25+ publicKey ?: string
2526) : AdaptedWallet => {
2627 return {
2728 vmType : 'bvm' ,
@@ -76,6 +77,9 @@ export const adaptBitcoinWallet = (
7677 //@ts -ignore
7778 switchChain : ( chainId : number ) => {
7879 throw 'Not yet implemented'
80+ } ,
81+ metadata : {
82+ publicKey
7983 }
8084 }
8185}
Original file line number Diff line number Diff line change @@ -14,8 +14,13 @@ export type SuiReceipt = {
1414 digest : string
1515}
1616
17+ export type BitcoinWalletMetadata = {
18+ publicKey ?: string
19+ }
20+
1721export type AdaptedWallet = {
1822 vmType : ChainVM
23+ metadata ?: BitcoinWalletMetadata
1924 getChainId : ( ) => Promise < number >
2025 handleSignMessageStep : (
2126 item : SignatureStepItem ,
@@ -52,5 +57,7 @@ export type AdaptedWallet = {
5257 items : TransactionStepItem [ ]
5358 ) => Promise < string | undefined >
5459 // detect if wallet is an EOA (externally owned account)
55- isEOA ?: ( chainId : number ) => Promise < { isEOA : boolean ; isEIP7702Delegated : boolean } >
60+ isEOA ?: (
61+ chainId : number
62+ ) => Promise < { isEOA : boolean ; isEIP7702Delegated : boolean } >
5663}
Original file line number Diff line number Diff line change @@ -611,6 +611,13 @@ const SwapWidgetRenderer: FC<SwapWidgetRendererProps> = ({
611611 refundTo : fromToken ?. chainId === 1337 ? address : undefined ,
612612 slippageTolerance : slippageTolerance ,
613613 topupGas : gasTopUpEnabled && gasTopUpRequired ,
614+ ...( linkedWallet ?. vmType === 'bvm' && wallet ?. metadata ?. publicKey
615+ ? {
616+ additionalData : {
617+ userPublicKey : wallet ?. metadata ?. publicKey
618+ }
619+ }
620+ : { } ) ,
614621 protocolVersion : quoteProtocol ,
615622 ...( quoteProtocol === 'preferV2' &&
616623 explicitDeposit !== undefined && {
You can’t perform that action at this time.
0 commit comments