Skip to content

Commit 538222e

Browse files
committed
solana: ts: add functions to get inbound/outbound limit instructions
1 parent 7b974cc commit 538222e

File tree

1 file changed

+43
-11
lines changed

1 file changed

+43
-11
lines changed

solana/ts/sdk/ntt.ts

+43-11
Original file line numberDiff line numberDiff line change
@@ -757,32 +757,64 @@ export class NTT {
757757
chain: ChainName
758758
limit: BN
759759
}) {
760-
const ix = await this.program.methods.setOutboundLimit({
760+
const ix = await this.createOutboundLimitInstruction({
761+
owner: args.owner.publicKey,
761762
limit: args.limit
762-
})
763+
});
764+
return this.sendAndConfirmTransaction(
765+
new Transaction().add(ix),
766+
[args.owner]
767+
);
768+
}
769+
770+
async createOutboundLimitInstruction(args: {
771+
owner: PublicKey
772+
limit: BN
773+
}) {
774+
return this.program.methods
775+
.setOutboundLimit({
776+
limit: args.limit
777+
})
763778
.accounts({
764-
owner: args.owner.publicKey,
779+
owner: args.owner,
765780
config: this.configAccountAddress(),
766781
rateLimit: this.outboxRateLimitAccountAddress(),
767-
}).instruction();
768-
return sendAndConfirmTransaction(this.program.provider.connection, new Transaction().add(ix), [args.owner]);
782+
})
783+
.instruction();
769784
}
770785

771786
async setInboundLimit(args: {
772787
owner: Keypair
773788
chain: ChainName
774789
limit: BN
775790
}) {
776-
const ix = await this.program.methods.setInboundLimit({
777-
chainId: { id: toChainId(args.chain) },
791+
const ix = await this.createInboundLimitInstruction({
792+
owner: args.owner.publicKey,
793+
chain: args.chain,
778794
limit: args.limit
779-
})
795+
});
796+
return this.sendAndConfirmTransaction(
797+
new Transaction().add(ix),
798+
[args.owner]
799+
);
800+
}
801+
802+
async createInboundLimitInstruction(args: {
803+
owner: PublicKey
804+
chain: ChainName
805+
limit: BN
806+
}) {
807+
return this.program.methods
808+
.setInboundLimit({
809+
chainId: { id: toChainId(args.chain) },
810+
limit: args.limit
811+
})
780812
.accounts({
781-
owner: args.owner.publicKey,
813+
owner: args.owner,
782814
config: this.configAccountAddress(),
783815
rateLimit: this.inboxRateLimitAccountAddress(args.chain),
784-
}).instruction();
785-
return sendAndConfirmTransaction(this.program.provider.connection, new Transaction().add(ix), [args.owner]);
816+
})
817+
.instruction();
786818
}
787819

788820
async createReceiveWormholeMessageInstruction(args: {

0 commit comments

Comments
 (0)