@@ -75,7 +75,7 @@ See example [here](https://github.com/wormhole-foundation/wormhole-sdk-ts/blob/m
75
75
60_000 ,
76
76
);
77
77
```
78
- See example [ here] ( https://github.com/wormhole-foundation/wormhole-sdk-ts/blob/main/examples/src/index.ts#L49 )
78
+ See example [ here] ( https://github.com/wormhole-foundation/wormhole-sdk-ts/blob/main/examples/src/index.ts#L67 )
79
79
<!-- EXAMPLE_WORMHOLE_VAA-->
80
80
81
81
@@ -330,9 +330,9 @@ The protocol that underlies all Wormhole activity is the Core protocol. This pro
330
330
331
331
<!-- EXAMPLE_CORE_BRIDGE-->
332
332
``` ts
333
- const wh = await wormhole (" Testnet" , [solana ]);
333
+ const wh = await wormhole (" Testnet" , [solana , evm ]);
334
334
335
- const chain = wh .getChain (" Solana " );
335
+ const chain = wh .getChain (" Avalanche " );
336
336
const { signer, address } = await getSigner (chain );
337
337
338
338
// Get a reference to the core messaging bridge
@@ -361,19 +361,23 @@ The protocol that underlies all Wormhole activity is the Core protocol. This pro
361
361
const [whm] = await chain .parseTransaction (txid ! .txid );
362
362
363
363
// Or pull the full message content as an Unsigned VAA
364
- // const msgs = await coreBridge.parseMessages(txid!.txid);
365
- // console.log(msgs);
364
+ // console.log(await coreBridge.parseMessages(txid!.txid));
366
365
367
366
// Wait for the vaa to be signed and available with a timeout
368
367
const vaa = await wh .getVaa (whm ! , " Uint8Array" , 60_000 );
369
368
console .log (vaa );
369
+
370
370
// Also possible to search by txid but it takes longer to show up
371
371
// console.log(await wh.getVaaByTxHash(txid!.txid, "Uint8Array"));
372
372
373
+ // Note: calling verifyMessage manually is typically not a useful thing to do
374
+ // as the VAA is typically submitted to the counterpart contract for
375
+ // a given protocol and the counterpart contract will verify the VAA
376
+ // this is simply for demo purposes
373
377
const verifyTxs = coreBridge .verifyMessage (address .address , vaa ! );
374
378
console .log (await signSendWait (chain , verifyTxs , signer ));
375
379
```
376
- See example [ here] ( https://github.com/wormhole-foundation/wormhole-sdk-ts/blob/main/examples/src/messaging.ts#L7 )
380
+ See example [ here] ( https://github.com/wormhole-foundation/wormhole-sdk-ts/blob/main/examples/src/messaging.ts#L8 )
377
381
<!-- EXAMPLE_CORE_BRIDGE-->
378
382
379
383
Within the payload is the information necessary to perform whatever action is required based on the Protocol that uses it.
@@ -699,13 +703,13 @@ After choosing the best route, extra parameters like `amount`, `nativeGasDropoff
699
703
// validate the transfer params passed, this returns a new type of ValidatedTransferParams
700
704
// which (believe it or not) is a validated version of the input params
701
705
// this new var must be passed to the next step, quote
702
- const validated = await bestRoute .validate (transferParams );
706
+ const validated = await bestRoute .validate (tr , transferParams );
703
707
if (! validated .valid ) throw validated .error ;
704
708
console .log (" Validated parameters: " , validated .params );
705
709
706
710
// get a quote for the transfer, this too returns a new type that must
707
711
// be passed to the next step, execute (if you like the quote)
708
- const quote = await bestRoute .quote (validated .params );
712
+ const quote = await bestRoute .quote (tr , validated .params );
709
713
if (! quote .success ) throw quote .error ;
710
714
console .log (" Best route quote: " , quote );
711
715
```
@@ -719,7 +723,7 @@ Finally, assuming the quote looks good, the route can initiate the request with
719
723
``` ts
720
724
// Now the transfer may be initiated
721
725
// A receipt will be returned, guess what you gotta do with that?
722
- const receipt = await bestRoute .initiate (sender .signer , quote , receiver .address );
726
+ const receipt = await bestRoute .initiate (tr , sender .signer , quote , receiver .address );
723
727
console .log (" Initiated transfer with receipt: " , receipt );
724
728
```
725
729
See example [ here] ( https://github.com/wormhole-foundation/wormhole-sdk-ts/blob/main/examples/src/router.ts#L95 )
0 commit comments