Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Sui package and Update demo for Aptos #680

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion connect/src/protocols/cctp/cctpTransfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,8 @@ export namespace CircleTransfer {

// https://developers.circle.com/stablecoins/docs/required-block-confirmations
const eta =
(srcChain.chain === "Polygon" ? 2_000 * 200 : finality.estimateFinalityTime(srcChain.chain)) + guardians.guardianAttestationEta;
(srcChain.chain === "Polygon" ? 2_000 * 200 : finality.estimateFinalityTime(srcChain.chain)) +
guardians.guardianAttestationEta;
if (!transfer.automatic) {
return {
sourceToken: { token: srcToken, amount: transfer.amount },
Expand Down
5 changes: 4 additions & 1 deletion connect/src/routes/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,10 @@ export abstract class AutomaticRoute<
}

export function isAutomatic<N extends Network>(route: Route<N>): route is AutomaticRoute<N> {
return (route as AutomaticRoute<N>).isAvailable !== undefined && (route.constructor as RouteConstructor).IS_AUTOMATIC;
return (
(route as AutomaticRoute<N>).isAvailable !== undefined &&
(route.constructor as RouteConstructor).IS_AUTOMATIC
);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion connect/src/routes/tokenBridge/manual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export class TokenBridgeRoute<N extends Network>
destinationTxs: dstTxIds,
};
}

async resume(txid: TransactionId): Promise<R> {
const xfer = await TokenTransfer.from(this.wh, txid, 10 * 1000);
return TokenTransfer.getReceipt(xfer);
Expand Down
10 changes: 2 additions & 8 deletions core/definitions/src/testing/mocks/guardian.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import type { Chain} from "@wormhole-foundation/sdk-base";
import type { Chain } from "@wormhole-foundation/sdk-base";
import { guardians } from "@wormhole-foundation/sdk-base";
import type { PayloadLiteral, VAA } from "../../index.js";
import {
Signature,
SignatureUtils,
createVAA,
deserialize,
serialize,
} from "../../index.js";
import { Signature, SignatureUtils, createVAA, deserialize, serialize } from "../../index.js";
import type { UniversalAddress } from "../../universalAddress.js";
import { keccak256 } from "../../utils.js";

Expand Down
2 changes: 1 addition & 1 deletion core/icons/src/constants/chainIcons.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// THIS FILE IS AUTO-GENERATED WITH `npm run gen`

import { Chain } from "@wormhole-foundation/sdk-base";
import type { Chain } from "@wormhole-foundation/sdk-base";

const PREFIX = "data:image/svg+xml;base64,";

Expand Down
4 changes: 4 additions & 0 deletions examples/src/helpers/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import cosmwasm from "../../../sdk/dist/esm/platforms/cosmwasm.js";
import evm from "../../../sdk/dist/esm/platforms/evm.js";
import solana from "../../../sdk/dist/esm/platforms/solana.js";
import sui from "../../../sdk/dist/esm/platforms/sui.js";
import aptos from "../../../sdk/dist/esm/platforms/aptos.js";

// Use .env.example as a template for your .env file and populate it with secrets
// for funded accounts on the relevant chain+network combos to run the example
Expand Down Expand Up @@ -87,6 +88,9 @@ export async function getSigner<N extends Network, C extends Chain>(
case "Sui":
signer = await sui.getSigner(await chain.getRpc(), getEnv("SUI_PRIVATE_KEY"));
break;
case "Aptos":
signer = await aptos.getSigner(await chain.getRpc(), getEnv("APTOS_PRIVATE_KEY"));
break;
default:
throw new Error("Unrecognized platform: " + platform);
}
Expand Down
6 changes: 6 additions & 0 deletions examples/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ import solana from "@wormhole-foundation/sdk/solana";
import sui from "@wormhole-foundation/sdk/sui";
import { getSigner } from "./helpers/index.js";

function delay(ms: number) {
return new Promise(resolve => setTimeout(resolve, ms));
}

(async function () {
// EXAMPLE_WORMHOLE_INIT
const wh = await wormhole("Testnet", [evm, solana, aptos, algorand, cosmwasm, sui]);
Expand Down Expand Up @@ -59,6 +63,8 @@ import { getSigner } from "./helpers/index.js";
const txids = await signSendWait(ctx, transfer, sender.signer);
console.log("Sent: ", txids);

await delay(1000);

// Get the wormhole message id from the transaction
const [whm] = await ctx.parseTransaction(txids[txids.length - 1]!.txid);
console.log("Wormhole Messages: ", whm);
Expand Down
Loading
Loading