Skip to content

Commit

Permalink
chore: fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
pedroferreira1 committed Jan 29, 2025
1 parent 6e91732 commit c86ac88
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
13 changes: 5 additions & 8 deletions __tests__/integration/nanocontracts/bet.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import fs from 'fs';
import { isEmpty } from 'lodash';
import { GenesisWalletHelper } from '../helpers/genesis-wallet.helper';
import {
Expand All @@ -23,7 +24,6 @@ import Serializer from '../../../src/nano_contracts/serializer';
import { NanoContractTransactionError, NanoRequest404Error } from '../../../src/errors';
import { OutputType } from '../../../src/wallet/types';
import NanoContractTransactionParser from '../../../src/nano_contracts/parser';
import fs from 'fs';

let fundsTx;
const builtInBlueprintId = '3cb032600bdf7db784800e4ea911b10676fa2f67591f82bb62628c234e771595';
Expand Down Expand Up @@ -489,20 +489,17 @@ describe('full cycle of bet nano contract', () => {
// The hathor-core and the wallet-lib are still not ready for
// using nano contracts with a Multisig wallet
it.skip('bet deposit built in with multisig wallet', async () => {
await executeTests(mhWallet, builInBlueprintId);
await executeTests(mhWallet, builtInBlueprintId);
});

it('bet deposit on chain blueprint', async () => {
// For now the on chain blueprints needs a signature from a specific address
// so we must always generate the same seed
const seed = 'bicycle dice amused car lock outdoor auto during nest accident soon sauce slot enact hand they member source job forward vibrant lab catch coach';
const seed =
'bicycle dice amused car lock outdoor auto during nest accident soon sauce slot enact hand they member source job forward vibrant lab catch coach';
const ocbWallet = await generateWalletHelper({ seed });
const address0 = await ocbWallet.getAddressAtIndex(0);
await GenesisWalletHelper.injectFunds(
ocbWallet,
address0,
1000n
);
await GenesisWalletHelper.injectFunds(ocbWallet, address0, 1000n);
// Use the bet blueprint code
const code = fs.readFileSync('./__tests__/integration/configuration/bet.py', 'utf8');
const tx = await ocbWallet.createOnChainBlueprintTransaction(code, address0);
Expand Down
17 changes: 6 additions & 11 deletions src/nano_contracts/on_chain_blueprint.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
/* eslint-disable max-classes-per-file */

/**
* Copyright (c) Hathor Labs and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

import zlib from 'zlib';
import { ON_CHAIN_BLUEPRINTS_INFO_VERSION, ON_CHAIN_BLUEPRINTS_VERSION } from '../constants';
import Transaction from '../models/transaction';
import Input from '../models/input';
import Output from '../models/output';
import { hexToBuffer, intToBytes } from '../utils/buffer';
import zlib from 'zlib';

import { intToBytes } from '../utils/buffer';

export enum CodeKind {
PYTHON_GZIP = 'python+gzip',
Expand Down Expand Up @@ -49,11 +48,7 @@ class OnChainBlueprint extends Transaction {

signature: Buffer | null;

constructor(
code: Code,
pubkey: Buffer,
signature: Buffer | null = null
) {
constructor(code: Code, pubkey: Buffer, signature: Buffer | null = null) {
super([], []);
this.version = ON_CHAIN_BLUEPRINTS_VERSION;

Check warning on line 53 in src/nano_contracts/on_chain_blueprint.ts

View check run for this annotation

Codecov / codecov/patch

src/nano_contracts/on_chain_blueprint.ts#L52-L53

Added lines #L52 - L53 were not covered by tests

Expand Down Expand Up @@ -117,4 +112,4 @@ class OnChainBlueprint extends Transaction {
}
}

export default OnChainBlueprint;
export default OnChainBlueprint;

0 comments on commit c86ac88

Please sign in to comment.