|
1 | | -import { Argv } from "yargs"; |
| 1 | +import type { Argv } from "yargs"; |
2 | 2 | import { spawnSync } from "child_process"; |
3 | 3 | import { AptosAccount, AptosClient, BCS, TxnBuilderTypes } from "aptos"; |
4 | 4 | import fs from "fs"; |
5 | 5 | import sha3 from "js-sha3"; |
6 | | -import { ethers } from "ethers"; |
7 | | -import { DefaultStore } from "@pythnetwork/contract-manager/node/store"; |
8 | 6 | import { AptosChain } from "@pythnetwork/contract-manager/core/chains"; |
9 | 7 | import { getDefaultDeploymentConfig } from "@pythnetwork/contract-manager/core/base"; |
| 8 | +import { DefaultStore } from "@pythnetwork/contract-manager/node/utils/store"; |
10 | 9 |
|
11 | 10 | const NETWORK_CHOICES = Object.entries(DefaultStore.chains) |
12 | | - .filter(([chain, config]) => { |
| 11 | + .filter(([_, config]) => { |
13 | 12 | return config instanceof AptosChain; |
14 | 13 | }) |
15 | 14 | .map(([chain, _]) => { |
@@ -181,7 +180,7 @@ export const builder: (args: Argv<any>) => Argv<any> = (yargs) => |
181 | 180 | const guardian_addresses_serializer = new BCS.Serializer(); |
182 | 181 | guardian_addresses_serializer.serializeU32AsUleb128(1); |
183 | 182 | guardian_addresses_serializer.serializeBytes( |
184 | | - Buffer.from(guardian_address, "hex"), |
| 183 | + Buffer.from(guardian_address!, "hex"), |
185 | 184 | ); |
186 | 185 |
|
187 | 186 | const args = [ |
@@ -351,7 +350,8 @@ export const builder: (args: Argv<any>) => Argv<any> = (yargs) => |
351 | 350 | const addr2 = argv["addr-2"]; |
352 | 351 | const url = `${endpoint}/accounts/${addr1}/resource/0x1::code::PackageRegistry`; |
353 | 352 | const response = await (await fetch(url)).json(); |
354 | | - for (const module of response.data.packages[0].modules) { |
| 353 | + // @ts-expect-error - TODO: Please improve typings on the .json() response here |
| 354 | + for (const module of response?.data?.packages[0]?.modules ?? []) { |
355 | 355 | const moduleName = module.name; |
356 | 356 | const addr1Module = `${endpoint}/accounts/${addr1}/module/${moduleName}`; |
357 | 357 | const addr2Module = `${endpoint}/accounts/${addr2}/module/${moduleName}`; |
@@ -513,11 +513,3 @@ function createDeployDerivedTransaction( |
513 | 513 | ), |
514 | 514 | ); |
515 | 515 | } |
516 | | - |
517 | | -function hex(x: string): string { |
518 | | - return ethers.utils.hexlify(x, { allowMissingPrefix: true }); |
519 | | -} |
520 | | - |
521 | | -function evm_address(x: string): string { |
522 | | - return hex(x).substring(2).padStart(64, "0"); |
523 | | -} |
0 commit comments