Skip to content

Commit e191517

Browse files
committed
fix: fixed more builds
1 parent 5db3597 commit e191517

File tree

7 files changed

+87
-18
lines changed

7 files changed

+87
-18
lines changed

pythnet/message_buffer/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
"name": "message_buffer",
33
"version": "0.1.0",
44
"private": "true",
5+
"type": "module",
56
"scripts": {
6-
"init-buffer": "pnpm exec ts-node scripts/setup_message_buffer.ts",
7+
"init-buffer": "ts-node scripts/setup_message_buffer.ts",
78
"test:format": "prettier --check .",
89
"fix:format": "prettier --write ."
910
},
@@ -27,4 +28,4 @@
2728
"pnpm": ">=10.19.0"
2829
},
2930
"packageManager": "[email protected]"
30-
}
31+
}

target_chains/cosmwasm/deploy-scripts/package.json

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,58 @@
3636
"pnpm": ">=10.19.0"
3737
},
3838
"packageManager": "[email protected]",
39-
"type": "module"
39+
"type": "module",
40+
"exports": {
41+
"./build-contract": {
42+
"require": {
43+
"default": "./dist/cjs/build-contract.js",
44+
"types": "./dist/cjs/build-contract.d.ts"
45+
},
46+
"import": {
47+
"default": "./dist/esm/build-contract.js",
48+
"types": "./dist/esm/build-contract.d.ts"
49+
}
50+
},
51+
"./configs": {
52+
"require": {
53+
"default": "./dist/cjs/configs.js",
54+
"types": "./dist/cjs/configs.d.ts"
55+
},
56+
"import": {
57+
"default": "./dist/esm/configs.js",
58+
"types": "./dist/esm/configs.d.ts"
59+
}
60+
},
61+
"./helper": {
62+
"require": {
63+
"default": "./dist/cjs/helper.js",
64+
"types": "./dist/cjs/helper.d.ts"
65+
},
66+
"import": {
67+
"default": "./dist/esm/helper.js",
68+
"types": "./dist/esm/helper.d.ts"
69+
}
70+
},
71+
"./instantiate-pyth": {
72+
"require": {
73+
"default": "./dist/cjs/instantiate-pyth.js",
74+
"types": "./dist/cjs/instantiate-pyth.d.ts"
75+
},
76+
"import": {
77+
"default": "./dist/esm/instantiate-pyth.js",
78+
"types": "./dist/esm/instantiate-pyth.d.ts"
79+
}
80+
},
81+
"./instantiate-wormhole": {
82+
"require": {
83+
"default": "./dist/cjs/instantiate-wormhole.js",
84+
"types": "./dist/cjs/instantiate-wormhole.d.ts"
85+
},
86+
"import": {
87+
"default": "./dist/esm/instantiate-wormhole.js",
88+
"types": "./dist/esm/instantiate-wormhole.d.ts"
89+
}
90+
},
91+
"./package.json": "./package.json"
92+
}
4093
}

target_chains/cosmwasm/deploy-scripts/src/build-contract.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import { readFileSync, writeFileSync } from "fs";
22
import toml from "@ltd/j-toml";
33
import { exec } from "child_process";
4-
import yargs from "yargs";
4+
import createCLI from "yargs";
55
import { hideBin } from "yargs/helpers";
66

7-
const argv = yargs(hideBin(process.argv))
7+
const yargs = createCLI(hideBin(process.argv));
8+
9+
const argv = yargs
810
.usage("USAGE: npm run build-contract -- <command>")
911
.option("cosmwasm", {
1012
type: "boolean",

target_chains/cosmwasm/deploy-scripts/src/configs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { getDefaultDeploymentConfig } from "@pythnetwork/contract-manager/core/base";
2-
import { DeploymentType } from "./helper";
2+
import type { DeploymentType } from "./helper.js";
33

44
function getPythSources(deploymentType: DeploymentType) {
55
const config = getDefaultDeploymentConfig(deploymentType);

target_chains/cosmwasm/deploy-scripts/src/instantiate-pyth.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
1-
import yargs from "yargs";
1+
import createCLI from "yargs";
22
import { hideBin } from "yargs/helpers";
33
import { sha256 } from "@cosmjs/crypto";
4-
import { getPythConfig } from "./configs";
5-
import { DefaultStore, Store } from "@pythnetwork/contract-manager/node/store";
4+
import { getPythConfig } from "./configs.js";
65
import { CosmWasmChain } from "@pythnetwork/contract-manager/core/chains";
76
import { toPrivateKey } from "@pythnetwork/contract-manager/core/base";
87
import { CosmWasmPriceFeedContract } from "@pythnetwork/contract-manager/core/contracts/cosmwasm";
98
import { CHAINS } from "@pythnetwork/xc-admin-common";
10-
import { DeploymentType, getContractBytesDict } from "./helper";
9+
import { type DeploymentType, getContractBytesDict } from "./helper.js";
10+
import {
11+
DefaultStore,
12+
Store,
13+
} from "@pythnetwork/contract-manager/node/utils/store";
1114

12-
const argv = yargs(hideBin(process.argv))
15+
const yargs = createCLI(hideBin(process.argv));
16+
17+
const argv = yargs
1318
.usage("USAGE: npm run instantiate-pyth -- <command>")
1419
.option("private-key", {
1520
type: "string",
@@ -62,13 +67,13 @@ async function run() {
6267
);
6368

6469
const checksum = Buffer.from(
65-
sha256(contractBytesDict[pythArtifactZipName]),
70+
sha256(contractBytesDict[pythArtifactZipName]!),
6671
).toString("hex");
6772

6873
console.log(`Downloaded wasm checksum ${checksum}`);
6974

7075
const storeCodeRes = await chainExecutor.storeCode({
71-
contractBytes: contractBytesDict[pythArtifactZipName],
76+
contractBytes: contractBytesDict[pythArtifactZipName]!,
7277
});
7378

7479
console.log(

target_chains/cosmwasm/deploy-scripts/src/instantiate-wormhole.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
1-
import yargs from "yargs";
1+
import createCLI from "yargs";
22
import { hideBin } from "yargs/helpers";
3-
import { getWormholeConfig } from "./configs";
3+
import { getWormholeConfig } from "./configs.js";
44
import {
55
CosmWasmPriceFeedContract,
66
CosmWasmWormholeContract,
77
} from "@pythnetwork/contract-manager/core/contracts/cosmwasm";
88
import { toPrivateKey } from "@pythnetwork/contract-manager/core/base";
99
import { CosmWasmChain } from "@pythnetwork/contract-manager/core/chains";
10-
import { DefaultStore, Store } from "@pythnetwork/contract-manager/node/store";
1110
import { CHAINS } from "@pythnetwork/xc-admin-common";
12-
import { DeploymentType } from "./helper";
11+
import type { DeploymentType } from "./helper.js";
12+
import {
13+
DefaultStore,
14+
Store,
15+
} from "@pythnetwork/contract-manager/node/utils/store";
16+
17+
const yargs = createCLI(hideBin(process.argv));
1318

1419
const argv = yargs(hideBin(process.argv))
1520
.usage("USAGE: npm run wormhole-stub -- <command>")
@@ -81,6 +86,8 @@ async function run() {
8186
);
8287
if (argv.deploy === "stable") {
8388
console.log("Syncing guardian sets for mainnet contract");
89+
// @ts-expect-error - TODO: typings indicate that syncMainnetGuardianSets() does not exist
90+
// on the contract object, which means this has a high probabiltiy to explode at runtime
8491
await contract.syncMainnetGuardianSets(privateKey);
8592
console.log("Sync complete");
8693
}

target_chains/cosmwasm/deploy-scripts/tsconfig.build.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"compilerOptions": {
44
"noEmit": false,
55
"incremental": false,
6-
"declaration": true
6+
"declaration": true,
7+
"isolatedModules": false
78
},
89
"exclude": [
910
"node_modules",

0 commit comments

Comments
 (0)