From 1e2180d25d5f847e5ea671140978fcc75532183d Mon Sep 17 00:00:00 2001 From: krau5 Date: Fri, 13 Oct 2023 11:53:57 +0200 Subject: [PATCH] Partially fixed checks --- 01-wallet/test/tonweb/step7.ts | 2 +- 02-contract/test/counter.step10.ts | 8 ++++---- 02-contract/test/counter.step7.ts | 8 ++++---- 02-contract/test/counter.step9.ts | 8 ++++---- 02-contract/test/deploy.step8.ts | 4 ++-- 02-contract/test/getCounter.ts | 2 +- 02-contract/test/{ => imports}/stdlib.fc | 0 02-contract/test/index.sh | 4 ++-- 02-contract/test/sendIncrement.ts | 4 ++-- 04-testing/test/index.sh | 2 +- 04-testing/test/step3.spec.ts | 6 +++--- 04-testing/test/step4.spec.ts | 6 +++--- 04-testing/test/step5.spec.ts | 6 +++--- 13 files changed, 30 insertions(+), 30 deletions(-) rename 02-contract/test/{ => imports}/stdlib.fc (100%) diff --git a/01-wallet/test/tonweb/step7.ts b/01-wallet/test/tonweb/step7.ts index 497be11..3c670af 100644 --- a/01-wallet/test/tonweb/step7.ts +++ b/01-wallet/test/tonweb/step7.ts @@ -21,4 +21,4 @@ async function main() { console.log("workchain:", walletAddress.wc); } -main(); \ No newline at end of file +main(); diff --git a/02-contract/test/counter.step10.ts b/02-contract/test/counter.step10.ts index 52a9412..416b2d2 100644 --- a/02-contract/test/counter.step10.ts +++ b/02-contract/test/counter.step10.ts @@ -1,4 +1,4 @@ -import { Contract, ContractProvider, Sender, Address, Cell, contractAddress, beginCell } from "@ton/core"; +import { Contract, ContractProvider, Sender, Address, Cell, contractAddress, beginCell } from "ton-core"; export default class Counter implements Contract { @@ -10,7 +10,7 @@ export default class Counter implements Contract { const address = contractAddress(workchain, { code, data }); return new Counter(address, { code, data }); } - + constructor(readonly address: Address, readonly init?: { code: Cell, data: Cell }) {} async sendDeploy(provider: ContractProvider, via: Sender) { @@ -19,7 +19,7 @@ export default class Counter implements Contract { bounce: false }); } - + async sendIncrement(provider: ContractProvider, via: Sender) { const messageBody = beginCell() .storeUint(1, 32) // op (op #1 = increment) @@ -35,4 +35,4 @@ export default class Counter implements Contract { const { stack } = await provider.get("counter", []); return stack.readBigNumber(); } -} \ No newline at end of file +} diff --git a/02-contract/test/counter.step7.ts b/02-contract/test/counter.step7.ts index 74b795a..bf1d963 100644 --- a/02-contract/test/counter.step7.ts +++ b/02-contract/test/counter.step7.ts @@ -1,4 +1,4 @@ -import { Contract, ContractProvider, Sender, Address, Cell, contractAddress, beginCell } from "@ton/core"; +import { Contract, ContractProvider, Sender, Address, Cell, contractAddress, beginCell } from "ton-core"; export default class Counter implements Contract { @@ -10,7 +10,7 @@ export default class Counter implements Contract { const address = contractAddress(workchain, { code, data }); return new Counter(address, { code, data }); } - + constructor(readonly address: Address, readonly init?: { code: Cell, data: Cell }) {} async sendDeploy(provider: ContractProvider, via: Sender) { @@ -18,5 +18,5 @@ export default class Counter implements Contract { value: "0.01", // send 0.01 TON to contract for rent bounce: false }); - } -} \ No newline at end of file + } +} diff --git a/02-contract/test/counter.step9.ts b/02-contract/test/counter.step9.ts index 9a0ed13..5febb5d 100644 --- a/02-contract/test/counter.step9.ts +++ b/02-contract/test/counter.step9.ts @@ -1,4 +1,4 @@ -import { Contract, ContractProvider, Sender, Address, Cell, contractAddress, beginCell } from "@ton/core"; +import { Contract, ContractProvider, Sender, Address, Cell, contractAddress, beginCell } from "ton-core"; export default class Counter implements Contract { @@ -10,7 +10,7 @@ export default class Counter implements Contract { const address = contractAddress(workchain, { code, data }); return new Counter(address, { code, data }); } - + constructor(readonly address: Address, readonly init?: { code: Cell, data: Cell }) {} async sendDeploy(provider: ContractProvider, via: Sender) { @@ -19,9 +19,9 @@ export default class Counter implements Contract { bounce: false }); } - + async getCounter(provider: ContractProvider) { const { stack } = await provider.get("counter", []); return stack.readBigNumber(); } -} \ No newline at end of file +} diff --git a/02-contract/test/deploy.step8.ts b/02-contract/test/deploy.step8.ts index 360674d..6b3f254 100644 --- a/02-contract/test/deploy.step8.ts +++ b/02-contract/test/deploy.step8.ts @@ -3,8 +3,8 @@ dotenv.config({ path: "../../.env" }); import * as fs from "fs"; import { getHttpEndpoint } from "@orbs-network/ton-access"; -import { mnemonicToWalletKey } from "@ton/crypto"; -import { TonClient, Cell, WalletContractV4 } from "@ton/ton"; +import { mnemonicToWalletKey } from "ton-crypto"; +import { TonClient, Cell, WalletContractV4 } from "ton"; import Counter from "./counter.step7"; // this is the interface class from step 7 export async function run() { diff --git a/02-contract/test/getCounter.ts b/02-contract/test/getCounter.ts index a403e2d..ff7ca17 100644 --- a/02-contract/test/getCounter.ts +++ b/02-contract/test/getCounter.ts @@ -2,7 +2,7 @@ import dotenv from "dotenv"; dotenv.config({ path: "../../.env" }); import { getHttpEndpoint } from "@orbs-network/ton-access"; -import { TonClient, Address } from "@ton/ton"; +import { TonClient, Address } from "ton"; import Counter from "./counter.step9"; // this is the interface class we just implemented export async function run() { diff --git a/02-contract/test/stdlib.fc b/02-contract/test/imports/stdlib.fc similarity index 100% rename from 02-contract/test/stdlib.fc rename to 02-contract/test/imports/stdlib.fc diff --git a/02-contract/test/index.sh b/02-contract/test/index.sh index 0ceb79d..334a99e 100755 --- a/02-contract/test/index.sh +++ b/02-contract/test/index.sh @@ -3,11 +3,11 @@ npm init --yes npm install dotenv npm install ts-node npm install @ton-community/func-js -npm install @ton/ton @ton/core @ton/crypto +npm install ton ton-core ton-crypto npm install @orbs-network/ton-access npx func-js stdlib.fc counter.fc --boc counter.cell npx ts-node deploy.step8.ts > deploy.step8.output.txt COUNTER_ADDRESS=`cut -d : -s -f 2 < deploy.step8.output.txt` npx ts-node step9.ts > step9.output.txt diff step9.output.txt step9.expected.txt COUNTER_ADDRESS=`cut -d : -s -f 2 < deploy.step8.output.txt` npx ts-node step10.ts > step10.output.txt -diff step10.output.txt step10.expected.txt \ No newline at end of file +diff step10.output.txt step10.expected.txt diff --git a/02-contract/test/sendIncrement.ts b/02-contract/test/sendIncrement.ts index 054c595..defd606 100644 --- a/02-contract/test/sendIncrement.ts +++ b/02-contract/test/sendIncrement.ts @@ -2,8 +2,8 @@ import dotenv from "dotenv"; dotenv.config({ path: "../../.env" }); import { getHttpEndpoint } from "@orbs-network/ton-access"; -import { mnemonicToWalletKey } from "@ton/crypto"; -import { TonClient, WalletContractV4, Address } from "@ton/ton"; +import { mnemonicToWalletKey } from "ton-crypto"; +import { TonClient, WalletContractV4, Address } from "ton"; import Counter from "./counter.step10"; // this is the interface class we just implemented export async function run() { diff --git a/04-testing/test/index.sh b/04-testing/test/index.sh index e6d46cf..a105e47 100755 --- a/04-testing/test/index.sh +++ b/04-testing/test/index.sh @@ -7,4 +7,4 @@ npx jest step2 npx jest step3 npx jest step4 npx jest step5 | grep "#DEBUG#" > step5.output.txt -diff step5.output.txt step5.expected.txt \ No newline at end of file +diff step5.output.txt step5.expected.txt diff --git a/04-testing/test/step3.spec.ts b/04-testing/test/step3.spec.ts index 81e1ff1..d3bd4a2 100644 --- a/04-testing/test/step3.spec.ts +++ b/04-testing/test/step3.spec.ts @@ -2,13 +2,13 @@ import * as fs from "fs"; import { Cell } from "@ton/core"; import { Blockchain, SandboxContract, TreasuryContract } from "@ton/sandbox"; import Counter from "./counter"; // this is the interface class from tutorial 2 -import "@ton-community/test-utils"; // register matchers +import "@ton/test-utils"; // register matchers describe("Counter tests", () => { let blockchain: Blockchain; let wallet1: SandboxContract; let counterContract: SandboxContract; - + beforeEach(async () => { // prepare Counter's initial code and data cells for deployment const counterCode = Cell.fromBoc(fs.readFileSync("counter.cell"))[0]; // compilation output from tutorial 2 @@ -28,4 +28,4 @@ describe("Counter tests", () => { const value = await counterContract.getCounter(); expect(value).toEqual(17n); }); -}); \ No newline at end of file +}); diff --git a/04-testing/test/step4.spec.ts b/04-testing/test/step4.spec.ts index c761b5c..e0349ba 100644 --- a/04-testing/test/step4.spec.ts +++ b/04-testing/test/step4.spec.ts @@ -2,13 +2,13 @@ import * as fs from "fs"; import { Cell } from "@ton/core"; import { Blockchain, SandboxContract, TreasuryContract } from "@ton/sandbox"; import Counter from "./counter"; // this is the interface class from tutorial 2 -import "@ton-community/test-utils"; // register matchers +import "@ton/test-utils"; // register matchers describe("Counter tests", () => { let blockchain: Blockchain; let wallet1: SandboxContract; let counterContract: SandboxContract; - + beforeEach(async () => { // prepare Counter's initial code and data cells for deployment const counterCode = Cell.fromBoc(fs.readFileSync("counter.cell"))[0]; // compilation output from tutorial 2 @@ -34,4 +34,4 @@ describe("Counter tests", () => { const counterValue = await counterContract.getCounter(); expect(counterValue).toEqual(18n); }) -}); \ No newline at end of file +}); diff --git a/04-testing/test/step5.spec.ts b/04-testing/test/step5.spec.ts index 24f0b2b..91f187d 100644 --- a/04-testing/test/step5.spec.ts +++ b/04-testing/test/step5.spec.ts @@ -2,13 +2,13 @@ import * as fs from "fs"; import { Cell, toNano } from "@ton/core"; import { Blockchain, SandboxContract, TreasuryContract } from "@ton/sandbox"; import Counter from "./counter"; // this is the interface class from tutorial 2 -import "@ton-community/test-utils"; // register matchers +import "@ton/test-utils"; // register matchers describe("Counter tests", () => { let blockchain: Blockchain; let wallet1: SandboxContract; let counterContract: SandboxContract; - + beforeEach(async () => { // prepare Counter's initial code and data cells for deployment const counterCode = Cell.fromBoc(fs.readFileSync("counter.debug.cell"))[0]; // version with ~dump instruction @@ -36,4 +36,4 @@ describe("Counter tests", () => { console.log("sending increment message"); await counterContract.sendIncrement(wallet1.getSender()); }) -}); \ No newline at end of file +});