Skip to content

Commit 54fa92b

Browse files
committed
sdk: get/setPauser for transceivers
1 parent 1bd6ebd commit 54fa92b

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
@@ -68,6 +68,17 @@ export class EvmNttWormholeTranceiver<N extends Network, C extends EvmChains>
6868
yield this.manager.createUnsignedTx(tx, "WormholeTransceiver.registerPeer");
6969
}
7070

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

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)