File tree 1 file changed +16
-8
lines changed
1 file changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -804,14 +804,22 @@ export class SolanaNtt<N extends Network, C extends SolanaChains>
804
804
}
805
805
806
806
async getIsApproved ( attestation : Ntt . Attestation ) : Promise < boolean > {
807
- const digest = ( attestation as WormholeNttTransceiver . VAA ) . hash ;
808
- const vaaAddress = utils . derivePostedVaaKey (
809
- this . core . address ,
810
- Buffer . from ( digest )
811
- ) ;
812
-
813
- const info = await this . connection . getAccountInfo ( vaaAddress ) ;
814
- return info !== null ;
807
+ if ( attestation . payloadName !== "WormholeTransfer" ) {
808
+ throw new Error ( `Invalid payload: ${ attestation . payloadName } ` ) ;
809
+ }
810
+ const payload = attestation . payload [ "nttManagerPayload" ] ;
811
+ try {
812
+ // check that the inbox item was initialized
813
+ const inboxItem = await this . program . account . inboxItem . fetch (
814
+ this . pdas . inboxItemAccount ( attestation . emitterChain , payload )
815
+ ) ;
816
+ return inboxItem . init ;
817
+ } catch ( e : any ) {
818
+ if ( e . message ?. includes ( "Account does not exist" ) ) {
819
+ return false ;
820
+ }
821
+ throw e ;
822
+ }
815
823
}
816
824
817
825
async * completeInboundQueuedTransfer (
You can’t perform that action at this time.
0 commit comments