Skip to content

Commit

Permalink
add wasm file
Browse files Browse the repository at this point in the history
  • Loading branch information
perfogic committed Nov 27, 2024
1 parent b704e93 commit 0b4eb5e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 21 deletions.
13 changes: 8 additions & 5 deletions packages/orchestrator/src/services/contract-simulate/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { setTimeout } from "timers/promises";
import env from "../../configs/env";
import { logger } from "../../configs/logger";
import { ITERATION_DELAY } from "../../constants";
import CwAppBitcoinCode from "./wasm/cw-app-bitcoin";

class ContractSimulator {
static simulateAppCwBitcoin: AppBitcoinClient;
Expand Down Expand Up @@ -74,13 +73,17 @@ class ContractSimulator {

this.initialized = true;

await Promise.all([this.loadStateAndCode(env.cosmos.appBitcoin)]);
await Promise.all([
this.loadStateAndCode("cw-app-bitcoin", env.cosmos.appBitcoin),
]);
this.logger.info("Finish state crawler!");
};

static async tryInitializeWithOldData() {
try {
await Promise.all([this.loadStateAndCode(env.cosmos.appBitcoin)]);
await Promise.all([
this.loadStateAndCode("cw-app-bitcoin", env.cosmos.appBitcoin),
]);
this.simulateAppCwBitcoin = new AppBitcoinClient(
this.simulateClient as any,
this.sender,
Expand All @@ -92,8 +95,8 @@ class ContractSimulator {
}
}

static async loadStateAndCode(contractAddress: string) {
const code = Buffer.from(CwAppBitcoinCode.code, "base64");
static async loadStateAndCode(fileName: string, contractAddress: string) {
const code = readFileSync(path.join(__dirname, `wasm/${fileName}.wasm`));
const state = readFileSync(
path.join(
os.homedir(),
Expand Down

This file was deleted.

Binary file not shown.
20 changes: 10 additions & 10 deletions packages/orchestrator/src/services/signer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ class SignerService implements RelayerInterface {
this.logger.info(`Starting signer server!`);
let { xpriv, xpub } = await this.loadOrGenerateXpriv();
ContractSimulator.sync();
const signatoryKey = await this.appBitcoinClient.signatoryKey({
addr: this.appBitcoinClient.sender,
});

if (signatoryKey === null) {
const tx = await this.appBitcoinClient.setSignatoryKey({
xpub: encodeXpub({ key: xpub }),
});
this.logger.info(`Setting signatory key at: ${tx.transactionHash}`);
}
// const signatoryKey = await this.appBitcoinClient.signatoryKey({
// addr: this.appBitcoinClient.sender,
// });

// if (signatoryKey === null) {
// const tx = await this.appBitcoinClient.setSignatoryKey({
// xpub: encodeXpub({ key: xpub }),
// });
// this.logger.info(`Setting signatory key at: ${tx.transactionHash}`);
// }

this.logger.info(`Signer is running...`);
await Promise.all([
Expand Down

0 comments on commit 0b4eb5e

Please sign in to comment.