Skip to content

Commit d752640

Browse files
evgenikokev1n-peters
authored andcommitted
update root readme based on adjusted example files
1 parent 597d70c commit d752640

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

README.md

+13-9
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ See example [here](https://github.com/wormhole-foundation/wormhole-sdk-ts/blob/m
7575
60_000,
7676
);
7777
```
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)
7979
<!--EXAMPLE_WORMHOLE_VAA-->
8080

8181

@@ -330,9 +330,9 @@ The protocol that underlies all Wormhole activity is the Core protocol. This pro
330330

331331
<!--EXAMPLE_CORE_BRIDGE-->
332332
```ts
333-
const wh = await wormhole("Testnet", [solana]);
333+
const wh = await wormhole("Testnet", [solana, evm]);
334334

335-
const chain = wh.getChain("Solana");
335+
const chain = wh.getChain("Avalanche");
336336
const { signer, address } = await getSigner(chain);
337337

338338
// 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
361361
const [whm] = await chain.parseTransaction(txid!.txid);
362362

363363
// 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));
366365

367366
// Wait for the vaa to be signed and available with a timeout
368367
const vaa = await wh.getVaa(whm!, "Uint8Array", 60_000);
369368
console.log(vaa);
369+
370370
// Also possible to search by txid but it takes longer to show up
371371
// console.log(await wh.getVaaByTxHash(txid!.txid, "Uint8Array"));
372372

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
373377
const verifyTxs = coreBridge.verifyMessage(address.address, vaa!);
374378
console.log(await signSendWait(chain, verifyTxs, signer));
375379
```
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)
377381
<!--EXAMPLE_CORE_BRIDGE-->
378382

379383
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
699703
// validate the transfer params passed, this returns a new type of ValidatedTransferParams
700704
// which (believe it or not) is a validated version of the input params
701705
// 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);
703707
if (!validated.valid) throw validated.error;
704708
console.log("Validated parameters: ", validated.params);
705709

706710
// get a quote for the transfer, this too returns a new type that must
707711
// 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);
709713
if (!quote.success) throw quote.error;
710714
console.log("Best route quote: ", quote);
711715
```
@@ -719,7 +723,7 @@ Finally, assuming the quote looks good, the route can initiate the request with
719723
```ts
720724
// Now the transfer may be initiated
721725
// 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);
723727
console.log("Initiated transfer with receipt: ", receipt);
724728
```
725729
See example [here](https://github.com/wormhole-foundation/wormhole-sdk-ts/blob/main/examples/src/router.ts#L95)

0 commit comments

Comments
 (0)