@@ -38,7 +38,7 @@ export namespace Ntt {
38
38
token : string ;
39
39
manager : string ;
40
40
transceiver : {
41
- wormhole : string ;
41
+ wormhole ? : string ;
42
42
} ;
43
43
quoter ?: string ;
44
44
} ;
@@ -85,6 +85,12 @@ export namespace Ntt {
85
85
payload : Uint8Array ;
86
86
} ;
87
87
88
+ export type Peer < C extends Chain > = {
89
+ address : ChainAddress < C > ;
90
+ tokenDecimals : number ;
91
+ inboundLimit : bigint ;
92
+ } ;
93
+
88
94
// TODO: should layoutify this but couldnt immediately figure out how to
89
95
// specify the length of the array as an encoded value
90
96
export function encodeTransceiverInstructions ( ixs : TransceiverInstruction [ ] ) {
@@ -126,12 +132,31 @@ export namespace Ntt {
126
132
* @typeparam C the chain
127
133
*/
128
134
export interface Ntt < N extends Network , C extends Chain > {
135
+ getMode ( ) : Promise < Ntt . Mode > ;
136
+
137
+ isPaused ( ) : Promise < boolean > ;
138
+
139
+ pause (
140
+ payer ?: AccountAddress < C >
141
+ ) : AsyncGenerator < UnsignedTransaction < N , C > > ;
142
+
143
+ unpause (
144
+ payer ?: AccountAddress < C >
145
+ ) : AsyncGenerator < UnsignedTransaction < N , C > > ;
146
+
147
+ getOwner ( ) : Promise < AccountAddress < C > > ;
148
+
149
+ setOwner ( newOwner : AccountAddress < C > , payer ?: AccountAddress < C > ) : AsyncGenerator < UnsignedTransaction < N , C > > ;
150
+
151
+ getThreshold ( ) : Promise < number > ;
152
+
129
153
setPeer (
130
154
peer : ChainAddress ,
131
155
tokenDecimals : number ,
132
156
inboundLimit : bigint ,
133
157
payer ?: AccountAddress < C >
134
158
) : AsyncGenerator < UnsignedTransaction < N , C > > ;
159
+
135
160
setWormholeTransceiverPeer (
136
161
peer : ChainAddress ,
137
162
payer ?: AccountAddress < C >
@@ -182,16 +207,44 @@ export interface Ntt<N extends Network, C extends Chain> {
182
207
/** Get the number of decimals associated with the token under management */
183
208
getTokenDecimals ( ) : Promise < number > ;
184
209
210
+ /** Get the peer information for the given chain if it exists */
211
+ getPeer < C extends Chain > ( chain : C ) : Promise < Ntt . Peer < C > | null > ;
212
+
213
+ getTransceiver ( ix : number ) : Promise < NttTransceiver < N , C , Ntt . Attestation > | null > ;
214
+
185
215
/**
186
216
* getCurrentOutboundCapacity returns the current outbound capacity of the Ntt manager
187
217
*/
188
218
getCurrentOutboundCapacity ( ) : Promise < bigint > ;
219
+
220
+ /**
221
+ * getOutboundLimit returns the maximum outbound capacity of the Ntt manager
222
+ */
223
+ getOutboundLimit ( ) : Promise < bigint > ;
224
+
225
+ /**
226
+ * setOutboundLimit sets the maximum outbound capacity of the Ntt manager
227
+ */
228
+ setOutboundLimit ( limit : bigint , payer ?: AccountAddress < C > ) : AsyncGenerator < UnsignedTransaction < N , C > > ;
229
+
189
230
/**
190
231
* getCurrentInboundCapacity returns the current inbound capacity of the Ntt manager
191
232
* @param fromChain the chain to check the inbound capacity for
192
233
*/
193
234
getCurrentInboundCapacity ( fromChain : Chain ) : Promise < bigint > ;
194
235
236
+ /**
237
+ * getInboundLimit returns the maximum inbound capacity of the Ntt manager
238
+ * @param fromChain the chain to check the inbound limit for
239
+ */
240
+ getInboundLimit ( fromChain : Chain ) : Promise < bigint > ;
241
+
242
+ setInboundLimit (
243
+ fromChain : Chain ,
244
+ limit : bigint ,
245
+ payer ?: AccountAddress < C >
246
+ ) : AsyncGenerator < UnsignedTransaction < N , C > > ;
247
+
195
248
/**
196
249
* getIsApproved returns whether an attestation is approved
197
250
* an attestation is approved when it has been validated but has not necessarily
@@ -231,17 +284,37 @@ export interface Ntt<N extends Network, C extends Chain> {
231
284
token : TokenAddress < C > ,
232
285
payer ?: AccountAddress < C >
233
286
) : AsyncGenerator < UnsignedTransaction < N , C > > ;
287
+
288
+ /**
289
+ * Given a manager address, the rest of the addresses (token address and
290
+ * transceiver addresses) can be queried from the manager contract directly.
291
+ * This method verifies that the addresses that were used to construct the Ntt
292
+ * instance match the addresses that are stored in the manager contract.
293
+ *
294
+ * TODO: perhaps a better way to do this would be by allowing async protocol
295
+ * initializers so this can be done when constructing the Ntt instance.
296
+ * That would be a larger change (in the connect sdk) so we do this for now.
297
+ *
298
+ * @returns the addresses that don't match the expected addresses, or null if
299
+ * they all match
300
+ */
301
+ verifyAddresses ( ) : Promise < Partial < Ntt . Contracts > | null > ;
234
302
}
235
303
236
304
export interface NttTransceiver <
237
305
N extends Network ,
238
306
C extends Chain ,
239
307
A extends Ntt . Attestation
240
308
> {
309
+
310
+ getAddress ( ) : ChainAddress < C > ;
311
+
241
312
/** setPeer sets a peer address for a given chain
242
313
* Note: Admin only
243
314
*/
244
- setPeer ( peer : ChainAddress < Chain > ) : AsyncGenerator < UnsignedTransaction < N , C > > ;
315
+ setPeer ( peer : ChainAddress < Chain > , payer ?: AccountAddress < C > ) : AsyncGenerator < UnsignedTransaction < N , C > > ;
316
+
317
+ getPeer < C extends Chain > ( chain : C ) : Promise < ChainAddress < C > | null > ;
245
318
246
319
/**
247
320
* receive calls the `receive*` method on the transceiver
0 commit comments