Skip to content

Commit 05f83a8

Browse files
committed
sdk: get/setPauser for transceivers
1 parent ab66a47 commit 05f83a8

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

evm/ts/src/ntt.ts

+11
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,17 @@ export class EvmNttWormholeTranceiver<N extends Network, C extends EvmChains>
6767
yield this.manager.createUnsignedTx(tx, "WormholeTransceiver.registerPeer");
6868
}
6969

70+
async getPauser(): Promise<AccountAddress<C> | null> {
71+
const pauser = await this.transceiver.pauser();
72+
return new EvmAddress(pauser) as AccountAddress<C>;
73+
}
74+
75+
async *setPauser(pauser: AccountAddress<C>) {
76+
const canonicalPauser = canonicalAddress({chain: this.manager.chain, address: pauser});
77+
const tx = await this.transceiver.transferPauserCapability.populateTransaction(canonicalPauser);
78+
yield this.manager.createUnsignedTx(tx, "WormholeTransceiver.setPauser");
79+
}
80+
7081
async getPeer<C extends Chain>(chain: C): Promise<ChainAddress<C> | null> {
7182
const peer = await this.transceiver.getWormholePeer(toChainId(chain));
7283
const peerAddress = Buffer.from(peer.substring(2), 'hex');

sdk/definitions/src/ntt.ts

+4
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,10 @@ export interface NttTransceiver<
356356

357357
getPeer<C extends Chain>(chain: C): Promise<ChainAddress<C> | null>;
358358

359+
setPauser(newPauser: AccountAddress<C>, payer?: AccountAddress<C>): AsyncGenerator<UnsignedTransaction<N, C>>;
360+
361+
getPauser(): Promise<AccountAddress<C> | null>;
362+
359363
/**
360364
* receive calls the `receive*` method on the transceiver
361365
*

solana/ts/sdk/ntt.ts

+8
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ export class SolanaNttWormholeTransceiver<N extends Network, C extends SolanaCha
5353
readonly address: PublicKey
5454
) {}
5555

56+
async getPauser(): Promise<AccountAddress<C> | null> {
57+
return null
58+
}
59+
60+
async *setPauser(_newPauser: AccountAddress<C>, _payer: AccountAddress<C>) {
61+
throw new Error("Method not implemented.");
62+
}
63+
5664
async *receive(_attestation: WormholeNttTransceiver.VAA) {
5765
// TODO: this is implemented below (in the transceiver code). it could get
5866
// tricky in general with multiple transceivers, as they might return an

0 commit comments

Comments
 (0)