Skip to content

Commit 5a7d7c9

Browse files
committed
feat: Stacks executor route
1 parent 3e91b7c commit 5a7d7c9

28 files changed

Lines changed: 1459 additions & 53 deletions

.github/workflows/publish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ jobs:
4040
--workspace sdk/definitions \
4141
--workspace evm/ts \
4242
--workspace solana \
43+
--workspace stacks \
4344
--workspace sui \
4445
--workspace sdk/route
4546
# OIDC authentication is used automatically by npm CLI 11.5.1+

Dockerfile.cli

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ COPY solana/package.json solana/package.json
4848
COPY solana/ts solana/ts
4949
COPY evm/ts evm/ts
5050
COPY solana/tsconfig.*.json solana/
51+
COPY stacks/ts stacks/ts
5152
COPY sui/ts sui/ts
5253
COPY cli/package.json cli/package.json
5354
COPY cli/package-lock.json cli/package-lock.json

cli/package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@
4040
"@wormhole-foundation/sdk-solana": "^4.7.0",
4141
"@wormhole-foundation/sdk-solana-core": "^4.7.0"
4242
},
43+
"@wormhole-foundation/sdk-stacks-ntt": {
44+
"@wormhole-foundation/sdk-base": "^4.4.0",
45+
"@wormhole-foundation/sdk-definitions": "^4.4.0",
46+
"@wormhole-foundation/sdk-stacks": "^4.4.0",
47+
"@wormhole-foundation/sdk-stacks-core": "^4.4.0"
48+
},
4349
"@wormhole-foundation/sdk-sui-ntt": {
4450
"@wormhole-foundation/sdk-base": "^4.7.0",
4551
"@wormhole-foundation/sdk-definitions": "^4.7.0",

evm/ts/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
Evm Ntt Implementation
22
----------------------
33

4-
5-
4+
> **Note:** These are low-level protocol classes. If you are trying to perform a transfer, use the higher-level Route abstractions such as [`NttExecutorRoute`](../../sdk/route/src/executor/executor.ts) instead.
65
76

87
# Building

evm/ts/src/ntt.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,11 @@ export class EvmNtt<N extends Network, C extends EvmChains>
563563
}
564564

565565
// TODO: should this be some map of idx to transceiver?
566-
async *redeem(attestations: Ntt.Attestation[]) {
566+
async *redeem(
567+
attestations: Ntt.Attestation[],
568+
payer: AccountAddress<C>,
569+
recipient?: AccountAddress<C>
570+
) {
567571
if (attestations.length !== this.xcvrs.length)
568572
throw new Error(
569573
"Not enough attestations for the registered Transceivers"
@@ -648,7 +652,7 @@ export class EvmNtt<N extends Network, C extends EvmChains>
648652
async *completeInboundQueuedTransfer(
649653
fromChain: Chain,
650654
transceiverMessage: Ntt.Message,
651-
payer?: AccountAddress<C>
655+
payer: AccountAddress<C>
652656
) {
653657
const tx =
654658
await this.manager.completeInboundQueuedTransfer.populateTransaction(

foo.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
npm ci
4+
5+
npm i @wormhole-foundation/sdk@latest
6+
7+
npm r -w evm/ts @wormhole-foundation/sdk-base @wormhole-foundation/sdk-definitions @wormhole-foundation/sdk-evm @wormhole-foundation/sdk-evm-core
8+
npm r -w sdk/definitions @wormhole-foundation/sdk-base @wormhole-foundation/sdk-definitions
9+
npm r -w sdk/examples @wormhole-foundation/sdk
10+
npm r -w sdk/route @wormhole-foundation/sdk-connect
11+
npm r -w solana @wormhole-foundation/sdk-base @wormhole-foundation/sdk-definitions @wormhole-foundation/sdk-solana @wormhole-foundation/sdk-solana-core
12+
npm r -w sui/ts @wormhole-foundation/sdk-base @wormhole-foundation/sdk-definitions @wormhole-foundation/sdk-sui @wormhole-foundation/sdk-sui-core
13+
npm r -w stacks/ts @wormhole-foundation/sdk-base @wormhole-foundation/sdk-definitions @wormhole-foundation/sdk-stacks @wormhole-foundation/sdk-stacks-core
14+
15+
npm i -w evm/ts --save-peer @wormhole-foundation/sdk-base@latest @wormhole-foundation/sdk-definitions@latest @wormhole-foundation/sdk-evm@latest @wormhole-foundation/sdk-evm-core@latest
16+
npm i -w sdk/definitions --save-peer @wormhole-foundation/sdk-base@latest @wormhole-foundation/sdk-definitions@latest
17+
npm i -w sdk/examples @wormhole-foundation/sdk@latest
18+
npm i -w sdk/route --save-peer @wormhole-foundation/sdk-connect@latest
19+
npm i -w solana --save-peer @wormhole-foundation/sdk-base@latest @wormhole-foundation/sdk-definitions@latest @wormhole-foundation/sdk-solana@latest @wormhole-foundation/sdk-solana-core@latest
20+
npm i -w sui/ts --save-peer @wormhole-foundation/sdk-base@latest @wormhole-foundation/sdk-definitions@latest @wormhole-foundation/sdk-sui@latest @wormhole-foundation/sdk-sui-core@latest
21+
npm i -w stacks/ts --save-peer @wormhole-foundation/sdk-base@latest @wormhole-foundation/sdk-definitions@latest @wormhole-foundation/sdk-stacks@latest @wormhole-foundation/sdk-stacks-core@latest

package-lock.json

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"build:solana": "npm run build --workspace=sdk/definitions --workspace=solana",
1010
"build:evm": "npm run build --workspace=sdk/definitions --workspace=sdk/evm",
1111
"build:sui": "npm run build --workspace=sdk/definitions --workspace=sui/ts",
12+
"build:stacks": "npm run build --workspace=sdk/definitions --workspace=stacks/ts",
1213
"typecheck:cli": "npm run typecheck --workspace=cli",
1314
"generate": "npm run generate --workspaces --if-present",
1415
"test": "npm run test --workspaces --if-present",
@@ -38,6 +39,7 @@
3839
"sdk/definitions",
3940
"evm/ts",
4041
"solana",
42+
"stacks/ts",
4143
"sui/ts",
4244
"sdk/route",
4345
"sdk/examples",

sdk/definitions/src/ntt.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,12 +263,15 @@ export interface Ntt<N extends Network, C extends Chain> {
263263
/**
264264
* redeem redeems a set of Attestations to the corresponding transceivers on the destination chain
265265
* @param attestations The attestations to redeem, the length should be equal to the number of transceivers
266+
* @param payer The account that will pay for the transaction
267+
* @param recipient The recipient address (only used for Stacks, can be undefined for other platforms)
266268
*
267269
* TODO: replace with Map<transceiver type, Attestation>
268270
*/
269271
redeem(
270272
attestations: Ntt.Attestation[],
271-
payer?: AccountAddress<C>
273+
payer: AccountAddress<C>,
274+
recipient?: AccountAddress<C>
272275
): AsyncGenerator<UnsignedTransaction<N, C>>;
273276

274277
/** Get the address for the account that custodies locked tokens */
@@ -370,7 +373,7 @@ export interface Ntt<N extends Network, C extends Chain> {
370373
completeInboundQueuedTransfer(
371374
fromChain: Chain,
372375
transceiverMessage: Ntt.Message,
373-
payer?: AccountAddress<C>
376+
payer: AccountAddress<C>
374377
): AsyncGenerator<UnsignedTransaction<N, C>>;
375378

376379
/**

sdk/route/src/executor/consts.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ export const getDefaultReferrerAddress = (chain: Chain): ChainAddress => {
2121
} else if (chainToPlatform(chain) === "Sui") {
2222
address =
2323
"0xbfa1240e48c622d97881473953be730091161b7931d89bd6afe667841cf69ef4";
24+
} else if (chainToPlatform(chain) === "Stacks") {
25+
address = "ST117FG1AKZ7724AXYMMABVPE4G2MNQ453SNS0S3"; // TODO: update to actual referrer address
2426
} else {
2527
throw new Error(`No referrer address for chain ${chain}`);
2628
}

0 commit comments

Comments
 (0)