Skip to content

Commit

Permalink
test fix example
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben-Rey committed Jul 27, 2023
1 parent baa5a91 commit f5c0c3a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
24 changes: 12 additions & 12 deletions examples/smartContracts/deployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { IAccount } from '../../src/interfaces/IAccount';
import { IContractData } from '../../src/interfaces/IContractData';
import { Client } from '../../src/web3/Client';
import { EOperationStatus } from '../../src/interfaces/EOperationStatus';
import { Args } from '../../src/utils/arguments';

import { readFileSync } from 'fs';
import { u64ToBytes, u8toByte } from '../../src/utils/serializers';
import { fromMAS } from '../../src';

import { Args, fromMAS, u64ToBytes, u8toByte } from '../../src';
const path = require('path');
const chalk = require('chalk');

Expand Down Expand Up @@ -74,19 +74,19 @@ export const deploySmartContracts = async (
fee = 0n,
maxGas = 1_000_000n,
maxCoins = fromMAS(0.1),
deployerAccount?: IAccount,
deployerAccount: IAccount,
): Promise<string> => {
let deploymentOperationId: string;
try {
// do checks
if (!deployerAccount) {
const baseAccount = web3Client.wallet().getBaseAccount();
if (baseAccount === null) {
throw new Error('Failed to get base account');
} else {
deployerAccount = baseAccount;
}
}
// if (!deployerAccount) {
// const baseAccount = web3Client.wallet().getBaseAccount();
// if (baseAccount === null) {
// throw new Error('Failed to get base account');
// } else {
// deployerAccount = baseAccount;
// }
// }

// check deployer account balance
const coinsRequired = contractsToDeploy.reduce(
Expand Down
10 changes: 6 additions & 4 deletions examples/smartContracts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { IEvent } from '../../src/interfaces/IEvent';
import { IReadData } from '../../src/interfaces/IReadData';
import { WalletClient } from '../../src/web3/WalletClient';
import { awaitTxConfirmation, deploySmartContracts } from './deployer';
import { Args } from '../../src/utils/arguments';
import { readFileSync } from 'fs';
import { Client } from '../../src/web3/Client';
import {
Expand All @@ -16,16 +15,19 @@ import {
} from '../../src/web3/EventPoller';
import { INodeStatus } from '../../src/interfaces/INodeStatus';
import { withTimeoutRejection } from '../../src/utils/time';
import { strToBytes } from '../../src/utils/serializers';
import { IDatastoreEntryInput } from '../../src/interfaces/IDatastoreEntryInput';
import { ICallData } from '../../src/interfaces/ICallData';
import * as dotenv from 'dotenv';
import { IProvider, ProviderType } from '../../src/interfaces/IProvider';
import { fromMAS, toMAS } from '../../src';
import {
Args,
IDeserializedResult,
ISerializable,
} from '../../src/interfaces/ISerializable';
fromMAS,
strToBytes,
toMAS,
} from '../../src';

const path = require('path');
const chalk = require('chalk');
const ora = require('ora');
Expand Down

0 comments on commit f5c0c3a

Please sign in to comment.