@@ -15,6 +15,7 @@ import {
15
15
SolanaPlatform ,
16
16
SolanaPlatformType ,
17
17
SolanaUnsignedTransaction ,
18
+ SolanaTransaction ,
18
19
} from '@wormhole-foundation/connect-sdk-solana' ;
19
20
import {
20
21
ChainId ,
@@ -30,14 +31,14 @@ import {
30
31
} from '@wormhole-foundation/connect-sdk' ;
31
32
import { Wormhole as WormholeCoreContract } from './types' ;
32
33
import {
33
- BridgeData ,
34
- createBridgeFeeTransferInstruction ,
35
34
createPostMessageInstruction ,
36
35
createPostVaaInstruction ,
37
36
createReadOnlyWormholeProgramInterface ,
38
37
createVerifySignaturesInstructions ,
38
+ createBridgeFeeTransferInstruction ,
39
39
derivePostedVaaKey ,
40
40
getWormholeBridgeData ,
41
+ BridgeData ,
41
42
} from './utils' ;
42
43
43
44
const SOLANA_SEQ_LOG = 'Program log: Sequence: ' ;
@@ -82,6 +83,7 @@ export class SolanaWormholeCore<N extends Network, C extends SolanaChains>
82
83
throw new Error (
83
84
`Network mismatch for chain ${ chain } : ${ conf . network } != ${ network } ` ,
84
85
) ;
86
+
85
87
return new SolanaWormholeCore (
86
88
network as N ,
87
89
chain ,
@@ -126,24 +128,20 @@ export class SolanaWormholeCore<N extends Network, C extends SolanaChains>
126
128
fee ,
127
129
) ;
128
130
129
- const { blockhash } = await SolanaPlatform . latestBlock ( this . connection ) ;
130
131
const transaction = new Transaction ( ) ;
131
- transaction . recentBlockhash = blockhash ;
132
132
transaction . feePayer = payer ;
133
133
transaction . add ( feeTransferIx , postMsgIx ) ;
134
- transaction . partialSign ( messageAccount ) ;
135
-
136
- yield this . createUnsignedTx ( transaction , 'Core.PublishMessage' ) ;
134
+ yield this . createUnsignedTx (
135
+ { transaction, signers : [ messageAccount ] } ,
136
+ 'Core.PublishMessage' ,
137
+ ) ;
137
138
}
138
139
139
140
async * verifyMessage ( sender : AnySolanaAddress , vaa : VAA ) {
140
141
yield * this . postVaa ( sender , vaa ) ;
141
142
}
142
143
143
- async * postVaa ( sender : AnySolanaAddress , vaa : VAA , blockhash ?: string ) {
144
- if ( ! blockhash )
145
- ( { blockhash } = await SolanaPlatform . latestBlock ( this . connection ) ) ;
146
-
144
+ async * postVaa ( sender : AnySolanaAddress , vaa : VAA ) {
147
145
const postedVaaAddress = derivePostedVaaKey (
148
146
this . coreBridge . programId ,
149
147
Buffer . from ( vaa . hash ) ,
@@ -170,11 +168,12 @@ export class SolanaWormholeCore<N extends Network, C extends SolanaChains>
170
168
const verifySigTx = new Transaction ( ) . add (
171
169
...verifySignaturesInstructions . slice ( i , i + 2 ) ,
172
170
) ;
173
- verifySigTx . recentBlockhash = blockhash ;
174
171
verifySigTx . feePayer = senderAddr ;
175
- verifySigTx . partialSign ( signatureSet ) ;
176
-
177
- yield this . createUnsignedTx ( verifySigTx , 'Core.VerifySignature' , true ) ;
172
+ yield this . createUnsignedTx (
173
+ { transaction : verifySigTx , signers : [ signatureSet ] } ,
174
+ 'Core.VerifySignature' ,
175
+ true ,
176
+ ) ;
178
177
}
179
178
180
179
// Finally create the VAA posting transaction
@@ -187,10 +186,9 @@ export class SolanaWormholeCore<N extends Network, C extends SolanaChains>
187
186
signatureSet . publicKey ,
188
187
) ,
189
188
) ;
190
- postVaaTx . recentBlockhash = blockhash ;
191
189
postVaaTx . feePayer = senderAddr ;
192
190
193
- yield this . createUnsignedTx ( postVaaTx , 'Core.PostVAA' ) ;
191
+ yield this . createUnsignedTx ( { transaction : postVaaTx } , 'Core.PostVAA' ) ;
194
192
}
195
193
196
194
static parseSequenceFromLog (
@@ -327,7 +325,7 @@ export class SolanaWormholeCore<N extends Network, C extends SolanaChains>
327
325
}
328
326
329
327
private createUnsignedTx (
330
- txReq : Transaction ,
328
+ txReq : SolanaTransaction ,
331
329
description : string ,
332
330
parallelizable : boolean = false ,
333
331
) : SolanaUnsignedTransaction < N , C > {
0 commit comments