File tree 4 files changed +40
-5
lines changed
4 files changed +40
-5
lines changed Original file line number Diff line number Diff line change @@ -151,11 +151,22 @@ export class EvmNtt<N extends Network, C extends EvmChains>
151
151
) ;
152
152
if ( ! isExecuted ) return false ;
153
153
// Also check that the transfer is not queued for it to be considered complete
154
- const queued = await this . getInboundQueuedTransfer (
155
- attestation . emitterChain ,
156
- payload [ "nttManagerPayload" ]
154
+ return ! ( await this . getIsTransferInboundQueued ( attestation ) ) ;
155
+ }
156
+
157
+ async getIsTransferInboundQueued (
158
+ attestation : Ntt . Attestation
159
+ ) : Promise < boolean > {
160
+ const payload =
161
+ attestation . payloadName === "WormholeTransfer"
162
+ ? attestation . payload
163
+ : attestation . payload . payload ;
164
+ return (
165
+ ( await this . getInboundQueuedTransfer (
166
+ attestation . emitterChain ,
167
+ payload [ "nttManagerPayload" ]
168
+ ) ) !== null
157
169
) ;
158
- return queued === null ;
159
170
}
160
171
161
172
getIsApproved ( attestation : Ntt . Attestation ) : Promise < boolean > {
Original file line number Diff line number Diff line change @@ -241,6 +241,12 @@ export interface Ntt<N extends Network, C extends Chain> {
241
241
*/
242
242
getIsExecuted ( attestation : Ntt . Attestation ) : Promise < boolean > ;
243
243
244
+ /**
245
+ * getIsTransferInboundQueued returns whether the transfer is inbound queued
246
+ * @param attestation the attestation to check
247
+ */
248
+ getIsTransferInboundQueued ( attestation : Ntt . Attestation ) : Promise < boolean > ;
249
+
244
250
/**
245
251
* getInboundQueuedTransfer returns the details of an inbound queued transfer
246
252
* @param transceiverMessage the transceiver message
Original file line number Diff line number Diff line change @@ -175,7 +175,6 @@ export namespace NttRoute {
175
175
capacity : bigint
176
176
) : boolean {
177
177
const threshold = ( capacity * 95n ) / 100n ;
178
- console . log ( amount , threshold , amount > threshold ) ;
179
178
return amount > threshold ;
180
179
}
181
180
}
Original file line number Diff line number Diff line change @@ -567,6 +567,25 @@ export class SolanaNtt<N extends Network, C extends SolanaChains>
567
567
return ! ! inboxItem . releaseStatus . released ;
568
568
}
569
569
570
+ async getIsTransferInboundQueued (
571
+ attestation : Ntt . Attestation
572
+ ) : Promise < boolean > {
573
+ if ( attestation . payloadName !== "WormholeTransfer" ) return false ;
574
+ const payload = attestation . payload [ "nttManagerPayload" ] ;
575
+ let inboxItem ;
576
+ try {
577
+ inboxItem = await this . program . account . inboxItem . fetch (
578
+ this . pdas . inboxItemAccount ( attestation . emitterChain , payload )
579
+ ) ;
580
+ } catch ( e : any ) {
581
+ if ( e . message ?. includes ( "Account does not exist" ) ) {
582
+ return false ;
583
+ }
584
+ throw e ;
585
+ }
586
+ return ! ! inboxItem . releaseStatus . releaseAfter ;
587
+ }
588
+
570
589
async getIsApproved ( attestation : Ntt . Attestation ) : Promise < boolean > {
571
590
const digest = ( attestation as WormholeNttTransceiver . VAA ) . hash ;
572
591
const vaaAddress = utils . derivePostedVaaKey (
You can’t perform that action at this time.
0 commit comments