Skip to content

Commit

Permalink
Merge pull request #28 from noislabs/upgrade-deps2
Browse files Browse the repository at this point in the history
Upgrade depensencies and deno version
  • Loading branch information
webmaster128 committed Feb 19, 2024
2 parents b9afb11 + 8c6d722 commit 5b5f9bb
Show file tree
Hide file tree
Showing 7 changed files with 404 additions and 175 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deno.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

strategy:
matrix:
deno-version: [1.36.1]
deno-version: [1.40.5]

steps:
- name: Git Checkout Deno Module
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# See https://hub.docker.com/r/denoland/deno/tags for available images
FROM denoland/deno:alpine-1.36.1
FROM denoland/deno:alpine-1.40.5

WORKDIR /app

Expand Down
517 changes: 381 additions & 136 deletions deno.lock

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ export {
CosmWasmClient,
SigningCosmWasmClient,
toBinary,
} from "npm:@cosmjs/cosmwasm-stargate@^0.31.1";
} from "npm:@cosmjs/cosmwasm-stargate@^0.32.2";
export {
assertIsDeliverTxSuccess,
calculateFee,
GasPrice,
logs,
} from "npm:@cosmjs/stargate@^0.31.1";
export { sha256 } from "npm:@cosmjs/crypto@^0.31.1";
export { toUtf8 } from "npm:@cosmjs/encoding@^0.31.1";
export { Decimal, Uint53 } from "npm:@cosmjs/math@^0.31.1";
export { DirectSecp256k1HdWallet } from "npm:@cosmjs/proto-signing@^0.31.1";
export { Tendermint34Client, Tendermint37Client } from "npm:@cosmjs/tendermint-rpc@^0.31.1";
export { assert, isDefined, sleep } from "npm:@cosmjs/utils@^0.31.1";
export type { Coin } from "npm:@cosmjs/amino@^0.31.1";
export type { MsgExecuteContractEncodeObject } from "npm:@cosmjs/cosmwasm-stargate@^0.31.1";
export type { SignerData } from "npm:@cosmjs/stargate@^0.31.1";
export type { TendermintClient } from "npm:@cosmjs/tendermint-rpc@^0.31.1";
} from "npm:@cosmjs/stargate@^0.32.2";
export { sha256 } from "npm:@cosmjs/crypto@^0.32.2";
export { toUtf8 } from "npm:@cosmjs/encoding@^0.32.2";
export { Decimal, Uint53 } from "npm:@cosmjs/math@^0.32.2";
export { DirectSecp256k1HdWallet } from "npm:@cosmjs/proto-signing@^0.32.2";
export { connectComet } from "npm:@cosmjs/tendermint-rpc@^0.32.2";
export { assert, isDefined, sleep } from "npm:@cosmjs/utils@^0.32.2";
export type { Coin } from "npm:@cosmjs/amino@^0.32.2";
export type { MsgExecuteContractEncodeObject } from "npm:@cosmjs/cosmwasm-stargate@^0.32.2";
export type { SignerData } from "npm:@cosmjs/stargate@^0.32.2";
export type { CometClient } from "npm:@cosmjs/tendermint-rpc@^0.32.2";

// drand
export type { ChainClient, ChainOptions, RandomnessBeacon } from "npm:drand-client@^1.2.0";
Expand Down
8 changes: 4 additions & 4 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
calculateFee,
ChainClient,
Coin,
connectComet,
CosmWasmClient,
Decimal,
DirectSecp256k1HdWallet,
Expand All @@ -26,7 +27,6 @@ import {
import { JobsObserver } from "./jobs.ts";
import { Submitter } from "./submitter.ts";
import { queryIsAllowlisted, queryIsIncentivized } from "./drand_contract.ts";
import { connectTendermint } from "./tendermint.ts";
import { Config } from "./config.ts";

// Constants
Expand Down Expand Up @@ -89,8 +89,8 @@ if (import.meta.main) {

const wallet = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic, { prefix: config.prefix });
const [firstAccount] = await wallet.getAccounts();
const tmClient = await connectTendermint(rpcEndpoint);
const client = await SigningCosmWasmClient.createWithSigner(tmClient, wallet, {
const cometClient = await connectComet(rpcEndpoint);
const client = await SigningCosmWasmClient.createWithSigner(cometClient, wallet, {
gasPrice: GasPrice.fromString(config.gasPrice),
});

Expand Down Expand Up @@ -174,7 +174,7 @@ if (import.meta.main) {

const submitter = new Submitter({
client,
tmClient,
cometClient,
broadcaster2,
broadcaster3,
getNextSignData,
Expand Down
10 changes: 5 additions & 5 deletions submitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ import {
assertIsDeliverTxSuccess,
calculateFee,
ChainClient,
CometClient,
CosmWasmClient,
isDefined,
logs,
RandomnessBeacon,
SignerData,
SigningCosmWasmClient,
TendermintClient,
} from "./deps.ts";
import { makeAddBeaconMessage, queryIsIncentivized } from "./drand_contract.ts";
import { ibcPacketsSent } from "./ibc.ts";
import { BeaconCache } from "./cache.ts";

interface Capture {
client: SigningCosmWasmClient;
tmClient: TendermintClient;
cometClient: CometClient;
broadcaster2: CosmWasmClient | null;
broadcaster3: CosmWasmClient | null;
botAddress: string;
Expand All @@ -33,7 +33,7 @@ interface Capture {

export class Submitter {
private client: SigningCosmWasmClient;
private tmClient: TendermintClient;
private cometClient: CometClient;
private broadcaster2: CosmWasmClient | null;
private broadcaster3: CosmWasmClient | null;
private botAddress: string;
Expand All @@ -48,7 +48,7 @@ export class Submitter {

constructor(capture: Capture) {
this.client = capture.client;
this.tmClient = capture.tmClient;
this.cometClient = capture.cometClient;
this.broadcaster2 = capture.broadcaster2;
this.broadcaster3 = capture.broadcaster3;
this.botAddress = capture.botAddress;
Expand Down Expand Up @@ -165,7 +165,7 @@ export class Submitter {
`✔ #${beacon.round} committed (Points: ${points}; Payout: ${payout}; Gas: ${result.gasUsed}/${result.gasWanted}; Jobs processed: ${jobs}; Transaction: ${result.transactionHash})`,
);
const publishTime = timeOfRound(beacon.round) / 1000;
const { block } = await this.tmClient.block(result.height);
const { block } = await this.cometClient.block(result.height);
const commitTime = block.header.time.getTime() / 1000; // seconds with fractional part
const diff = commitTime - publishTime;
console.info(
Expand Down
16 changes: 0 additions & 16 deletions tendermint.ts

This file was deleted.

0 comments on commit 5b5f9bb

Please sign in to comment.