Skip to content

Commit

Permalink
Merge pull request #1861 from aeternity/feature/tx-contract-type
Browse files Browse the repository at this point in the history
test: avoid using `any`
  • Loading branch information
davidyuk authored Jul 20, 2023
2 parents 9ec682c + 629d386 commit dd35bf8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
10 changes: 6 additions & 4 deletions test/integration/paying-for.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { getSdk } from '.';
import {
AeSdk, Contract, MemoryAccount, Tag, UnexpectedTsError, Encoded,
} from '../../src';
import { InputNumber } from '../utils';
import { InputNumber, assertNotNull } from '../utils';

describe('Paying for transaction of another account', () => {
let aeSdk: AeSdk;
Expand Down Expand Up @@ -48,12 +48,13 @@ describe('Paying for transaction of another account', () => {
stateful entrypoint setValue(x: int) = put(state{ value = x })`;

let contractAddress: Encoded.ContractAddress;
let aeSdkNotPayingFee: any;
let payingContract: Contract<{
let aeSdkNotPayingFee: AeSdk;
type TestContract = Contract<{
init: (x: InputNumber) => void;
getValue: () => bigint;
setValue: (x: InputNumber) => void;
}>;
let payingContract: TestContract;

it('pays for contract deployment', async () => {
aeSdkNotPayingFee = await getSdk(0);
Expand All @@ -62,8 +63,9 @@ describe('Paying for transaction of another account', () => {
waitMined: false,
innerTx: true,
});
const contract = await aeSdkNotPayingFee.initializeContract({ sourceCode });
const contract: TestContract = await aeSdkNotPayingFee.initializeContract({ sourceCode });
const { rawTx: contractDeployTx, address } = await contract.$deploy([42]);
assertNotNull(address);
contractAddress = address;
await aeSdk.payForTransaction(contractDeployTx);
payingContract = await aeSdkNotPayingFee.initializeContract({ sourceCode, address });
Expand Down
4 changes: 2 additions & 2 deletions test/integration/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ describe('Aepp<->Wallet', function aeppWallet() {
});

it('Should receive `announcePresence` message from wallet', async () => {
const isReceived: any = new Promise((resolve) => {
const isReceived = new Promise<boolean>((resolve) => {
if (connections.aeppWindow.addEventListener == null) throw new UnexpectedTsError();
connections.aeppWindow.addEventListener('message', (msg) => {
resolve(msg.data.method === 'connection.announcePresence');
Expand Down Expand Up @@ -479,7 +479,7 @@ describe('Aepp<->Wallet', function aeppWallet() {

it('Aepp: receive notification for network update', async () => {
const message = await new Promise<Network>((resolve) => {
aepp.onNetworkChange = (msg: any) => resolve(msg);
aepp.onNetworkChange = (msg) => resolve(msg);
wallet.addNode('second_node', node, true);
});
message.networkId.should.be.equal(networkId);
Expand Down
4 changes: 2 additions & 2 deletions test/integration/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { describe, it, before } from 'mocha';
import { expect } from 'chai';
import { getSdk } from './index';
import {
AeSdk,
AeSdk, Contract,
commitmentHash, oracleQueryId, decode, encode, Encoded, Encoding,
ORACLE_TTL_TYPES, Tag, AE_AMOUNT_FORMATS, buildTx, unpackTx,
} from '../../src';
Expand Down Expand Up @@ -44,7 +44,7 @@ describe('Transaction', () => {
let aeSdk: AeSdk;
const address = 'ak_21A27UVVt3hDkBE5J7rhhqnH5YNb4Y1dqo4PnSybrH85pnWo7E';
const oracleId = encode(decode(address), Encoding.OracleAddress);
let contract: any;
let contract: Contract<{}>;

before(async () => {
aeSdk = await getSdk(0);
Expand Down

0 comments on commit dd35bf8

Please sign in to comment.