Skip to content

Commit

Permalink
solana: Update verifyAddreses to return wormhole transceiver as `em…
Browse files Browse the repository at this point in the history
…itterAccount`
  • Loading branch information
nvsriram committed Oct 28, 2024
1 parent b7d7caf commit 49c9bc0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1798,7 +1798,7 @@ async function nttFromManager<N extends Network, C extends Chain>(
ntt: {
manager: nativeManagerAddress,
token: null,
transceiver: { "wormhole": nativeManagerAddress },
transceiver: {},
}
});
const diff = await onlyManager.verifyAddresses();
Expand Down
16 changes: 14 additions & 2 deletions solana/ts/sdk/ntt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1183,16 +1183,28 @@ export class SolanaNtt<N extends Network, C extends SolanaChains>
}

async verifyAddresses(): Promise<Partial<Ntt.Contracts> | null> {
// NOTE: transceivers are not being compared as there is no reverse lookup
// given manager address to the registered transceivers
// NOTE: This function should only be called when the wormhole transceiver is the manager.
// For the generic transceiver case, transceivers can not be compared as there is no
// reverse lookup given manager address to the registered transceivers.
const whTransceiver = await this.getWormholeTransceiver();
const local: Partial<Ntt.Contracts> = {
manager: this.managerAddress,
token: this.tokenAddress,
transceiver: {
...(whTransceiver && {
wormhole: whTransceiver.pdas.emitterAccount().toBase58(),
}),
},
};

const remote: Partial<Ntt.Contracts> = {
manager: this.program.programId.toBase58(),
token: (await this.getConfig()).mint.toBase58(),
transceiver: {
wormhole: NTT.transceiverPdas(this.program.programId)
.emitterAccount()
.toBase58(),
},
};

const deleteMatching = (a: any, b: any) => {
Expand Down

0 comments on commit 49c9bc0

Please sign in to comment.