@@ -122,6 +122,7 @@ describe("example-native-token-transfers", () => {
122
122
let ntt : SolanaNtt < "Devnet" , "Solana" > ;
123
123
let signer : Signer ;
124
124
let sender : AccountAddress < "Solana" > ;
125
+ let tokenAddress : string ;
125
126
126
127
beforeAll ( async ( ) => {
127
128
try {
@@ -189,15 +190,14 @@ describe("example-native-token-transfers", () => {
189
190
TOKEN_PROGRAM
190
191
) ;
191
192
193
+ tokenAddress = mint . publicKey . toBase58 ( ) ;
192
194
// Create our contract client
193
195
ntt = new SolanaNtt ( "Devnet" , "Solana" , connection , {
194
196
...ctx . config . contracts ,
195
197
ntt : {
196
- token : mint . publicKey . toBase58 ( ) ,
198
+ token : tokenAddress ,
197
199
manager : NTT_ADDRESS ,
198
- transceiver : {
199
- wormhole : NTT_ADDRESS ,
200
- } ,
200
+ transceiver : { wormhole : NTT_ADDRESS } ,
201
201
} ,
202
202
} ) ;
203
203
} catch ( e ) {
@@ -222,10 +222,7 @@ describe("example-native-token-transfers", () => {
222
222
) ;
223
223
224
224
// init
225
- const initTxs = ntt . initialize ( {
226
- payer,
227
- owner : payer ,
228
- chain : "Solana" ,
225
+ const initTxs = ntt . initialize ( sender , {
229
226
mint : mint . publicKey ,
230
227
outboundLimit : 1000000n ,
231
228
mode : "burning" ,
@@ -322,20 +319,6 @@ describe("example-native-token-transfers", () => {
322
319
// get from balance
323
320
const balance = await connection . getTokenAccountBalance ( tokenAccount ) ;
324
321
expect ( balance . value . amount ) . toBe ( "9900000" ) ;
325
-
326
- // grab logs
327
- //await connection.confirmTransaction(redeemTx, "confirmed");
328
- //const tx = await anchor
329
- // .getProvider()
330
- // .connection.getParsedTransaction(redeemTx, {
331
- // commitment: "confirmed",
332
- // });
333
- // console.log(tx);
334
- // const log = tx.meta.logMessages[1];
335
- // const message = log.substring(log.indexOf(':') + 1);
336
- // console.log(message);
337
- // TODO: assert other stuff in the message
338
- // console.log(nttManagerMessage);
339
322
} ) ;
340
323
341
324
it ( "Can receive tokens" , async ( ) => {
@@ -385,40 +368,38 @@ describe("example-native-token-transfers", () => {
385
368
throw e ;
386
369
}
387
370
388
- // expect(released).to.equal(true);
371
+ // expect(released).toEqual(true);
372
+ expect ( ( await counterValue ( ) ) . toString ( ) ) . toEqual ( "2" ) ;
389
373
} ) ;
390
374
} ) ;
391
375
392
376
describe ( "Static Checks" , ( ) => {
393
- const wh = new Wormhole ( "Testnet " , [ SolanaPlatform ] ) ;
394
-
377
+ const wh = new Wormhole ( "Devnet " , [ SolanaPlatform ] ) ;
378
+ const ctx = wh . getChain ( "Solana" ) ;
395
379
const overrides = {
396
380
Solana : {
397
- token : "EetppHswYvV1jjRWoQKC1hejdeBDHR9NNzNtCyRQfrrQ" ,
398
- manager : "NTtAaoDJhkeHeaVUHnyhwbPNAN6WgBpHkHBTc6d7vLK" ,
399
- transceiver : {
400
- wormhole : "ExVbjD8inGXkt7Cx8jVr4GF175sQy1MeqgfaY53Ah8as" ,
401
- } ,
381
+ token : tokenAddress ,
382
+ manager : NTT_ADDRESS ,
383
+ transceiver : { wormhole : NTT_ADDRESS } ,
402
384
} ,
403
385
} ;
404
386
405
387
describe ( "ABI Versions Test" , function ( ) {
406
- const ctx = wh . getChain ( "Solana" ) ;
407
388
test ( "It initializes from Rpc" , async function ( ) {
408
- const ntt = await SolanaNtt . fromRpc ( await ctx . getRpc ( ) , {
389
+ const ntt = await SolanaNtt . fromRpc ( connection , {
409
390
Solana : {
410
391
...ctx . config ,
411
392
contracts : {
412
393
...ctx . config . contracts ,
413
- ... { ntt : overrides [ "Solana" ] } ,
394
+ ntt : overrides [ "Solana" ] ,
414
395
} ,
415
396
} ,
416
397
} ) ;
417
398
expect ( ntt ) . toBeTruthy ( ) ;
418
399
} ) ;
419
400
420
401
test ( "It initializes from constructor" , async function ( ) {
421
- const ntt = new SolanaNtt ( "Testnet " , "Solana" , await ctx . getRpc ( ) , {
402
+ const ntt = new SolanaNtt ( "Devnet " , "Solana" , connection , {
422
403
...ctx . config . contracts ,
423
404
...{ ntt : overrides [ "Solana" ] } ,
424
405
} ) ;
@@ -427,11 +408,11 @@ describe("example-native-token-transfers", () => {
427
408
428
409
test ( "It gets the correct version" , async function ( ) {
429
410
const version = await SolanaNtt . getVersion (
430
- await ctx . getRpc ( ) ,
411
+ connection ,
431
412
{ ntt : overrides [ "Solana" ] } ,
432
413
new SolanaAddress ( payer . publicKey . toBase58 ( ) )
433
414
) ;
434
- expect ( version ) . toBe ( "1 .0.0" ) ;
415
+ expect ( version ) . toBe ( "2 .0.0" ) ;
435
416
} ) ;
436
417
} ) ;
437
418
} ) ;
0 commit comments