Skip to content

Commit 350f989

Browse files
committed
Merge branch 'solana/multi-transceiver-support' of https://github.com/wormhole-foundation/example-native-token-transfers into solana/multi-transceiver-support
2 parents b563f3a + a3517b1 commit 350f989

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

solana/ts/sdk/ntt.ts

+16-8
Original file line numberDiff line numberDiff line change
@@ -804,14 +804,22 @@ export class SolanaNtt<N extends Network, C extends SolanaChains>
804804
}
805805

806806
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+
}
815823
}
816824

817825
async *completeInboundQueuedTransfer(

0 commit comments

Comments
 (0)