diff --git a/01-wallet/index.md b/01-wallet/index.md
index 5d9a632..f96b443 100644
--- a/01-wallet/index.md
+++ b/01-wallet/index.md
@@ -131,7 +131,7 @@ library:npmton
Next, we're going to install a JavaScript package named [ton](https://www.npmjs.com/package/ton) that will allow us to make TON API calls and manipulate TON objects. Install the package by opening terminal in the project directory and running:
```console
-npm install ton ton-crypto ton-core
+npm install @ton/ton @ton/crypto @ton/core
```
---
@@ -159,7 +159,7 @@ Create the file `step7.ts` with the following content:
network:testnet library:npmton
---
```ts
-import { mnemonicToWalletKey } from "ton-crypto";
+import { mnemonicToWalletKey } from "@ton/crypto";
import { WalletContractV4 } from "ton";
async function main() {
@@ -184,7 +184,7 @@ main();
network:mainnet library:npmton
---
```ts
-import { mnemonicToWalletKey } from "ton-crypto";
+import { mnemonicToWalletKey } from "@ton/crypto";
import { WalletContractV4 } from "ton";
async function main() {
@@ -302,7 +302,7 @@ network:testnet library:npmton
---
```ts
import { getHttpEndpoint } from "@orbs-network/ton-access";
-import { mnemonicToWalletKey } from "ton-crypto";
+import { mnemonicToWalletKey } from "@ton/crypto";
import { WalletContractV4, TonClient, fromNano } from "ton";
async function main() {
@@ -335,7 +335,7 @@ network:mainnet library:npmton
---
```ts
import { getHttpEndpoint } from "@orbs-network/ton-access";
-import { mnemonicToWalletKey } from "ton-crypto";
+import { mnemonicToWalletKey } from "@ton/crypto";
import { WalletContractV4, TonClient, fromNano } from "ton";
async function main() {
@@ -458,7 +458,7 @@ network:testnet library:npmton
---
```ts
import { getHttpEndpoint } from "@orbs-network/ton-access";
-import { mnemonicToWalletKey } from "ton-crypto";
+import { mnemonicToWalletKey } from "@ton/crypto";
import { TonClient, WalletContractV4, internal } from "ton";
async function main() {
@@ -516,7 +516,7 @@ network:mainnet library:npmton
---
```ts
import { getHttpEndpoint } from "@orbs-network/ton-access";
-import { mnemonicToWalletKey } from "ton-crypto";
+import { mnemonicToWalletKey } from "@ton/crypto";
import { TonClient, WalletContractV4, internal } from "ton";
async function main() {
diff --git a/01-wallet/test/npmton/index.sh b/01-wallet/test/npmton/index.sh
index 0160184..35840e7 100755
--- a/01-wallet/test/npmton/index.sh
+++ b/01-wallet/test/npmton/index.sh
@@ -2,7 +2,7 @@ set -ev
npm init --yes
npm install dotenv
npm install ts-node
-npm install ton ton-core ton-crypto
+npm install @ton/ton @ton/core @ton/crypto
npm install @orbs-network/ton-access
npx ts-node step7.ts > step7.output.txt
diff step7.output.txt step7.expected.txt
diff --git a/01-wallet/test/npmton/step7.ts b/01-wallet/test/npmton/step7.ts
index dcb0b0e..702e854 100644
--- a/01-wallet/test/npmton/step7.ts
+++ b/01-wallet/test/npmton/step7.ts
@@ -1,12 +1,12 @@
import dotenv from "dotenv";
dotenv.config({ path: "../../../.env" });
-import { mnemonicToWalletKey } from "ton-crypto";
-import { WalletContractV4 } from "ton";
+import { mnemonicToWalletKey } from "@ton/crypto";
+import { WalletContractV4 } from "@ton/ton";
async function main() {
- // open wallet v4 (notice the correct wallet version here)
- const mnemonic = process.env.MNEMONIC;; // your 24 secret words (replace ... with the rest of the words)
+ // Update step7.expected.txt before running the test, since it depends on your wallet address
+ const mnemonic = process.env.MNEMONIC; // your 24 secret words
const key = await mnemonicToWalletKey(mnemonic!.split(" "));
const wallet = WalletContractV4.create({ publicKey: key.publicKey, workchain: 0 });
@@ -17,4 +17,4 @@ async function main() {
console.log("workchain:", wallet.address.workChain);
}
-main();
\ No newline at end of file
+main();
diff --git a/01-wallet/test/npmton/step8.ts b/01-wallet/test/npmton/step8.ts
index 7404871..021e1de 100644
--- a/01-wallet/test/npmton/step8.ts
+++ b/01-wallet/test/npmton/step8.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 { WalletContractV4, TonClient, fromNano } from "ton";
+import { mnemonicToWalletKey } from "@ton/crypto";
+import { WalletContractV4, TonClient, fromNano } from "@ton/ton";
async function main() {
// open wallet v4 (notice the correct wallet version here)
diff --git a/01-wallet/test/npmton/step9.ts b/01-wallet/test/npmton/step9.ts
index 2513af5..c94c949 100644
--- a/01-wallet/test/npmton/step9.ts
+++ b/01-wallet/test/npmton/step9.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, internal } from "ton";
+import { mnemonicToWalletKey } from "@ton/crypto";
+import { TonClient, WalletContractV4, internal } from "@ton/ton";
async function main() {
// open wallet v4 (notice the correct wallet version here)
diff --git a/01-wallet/test/tonweb/step7.ts b/01-wallet/test/tonweb/step7.ts
index 497be11..22b9c22 100644
--- a/01-wallet/test/tonweb/step7.ts
+++ b/01-wallet/test/tonweb/step7.ts
@@ -5,7 +5,8 @@ import { mnemonicToKeyPair } from "tonweb-mnemonic";
import TonWeb from "tonweb";
async function main() {
- const mnemonic = process.env.MNEMONIC; // your 24 secret words (replace ... with the rest of the words)
+ // Update step7.expected.txt before running the test, since it depends on your wallet address
+ const mnemonic = process.env.MNEMONIC; // your 24 secret words
const key = await mnemonicToKeyPair(mnemonic!.split(" "));
// open wallet v4 (notice the correct wallet version here)
@@ -21,4 +22,4 @@ async function main() {
console.log("workchain:", walletAddress.wc);
}
-main();
\ No newline at end of file
+main();
diff --git a/02-contract/index.md b/02-contract/index.md
index d6d0f84..08c7535 100644
--- a/02-contract/index.md
+++ b/02-contract/index.md
@@ -166,7 +166,7 @@ The recommended way to interact with contracts is to create a small TypeScript c
Use the following code in `wrappers/Counter.ts` to create the initial data cell for deployment:
```ts
-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 {
@@ -183,7 +183,7 @@ export default class Counter implements Contract {
}
```
-Notice a few interesting things about this TypeScript code. First, it depends on the package [ton-core](https://www.npmjs.com/package/ton-core) instead of [ton](https://www.npmjs.com/package/ton), which contains a small subset of base types and is therefore slower to change - an important feature when building a stable interface for our contract. Second, the code that creates the data cell mimics the FunC API and is almost identical to our `save_data()` FunC function. Third, we can see the derivation of the contract address from the code cell and data cell using the function `contractAddress`.
+Notice a few interesting things about this TypeScript code. First, it depends on the package [@ton/core](https://www.npmjs.com/package/@ton/core) instead of [ton](https://www.npmjs.com/package/ton), which contains a small subset of base types and is therefore slower to change - an important feature when building a stable interface for our contract. Second, the code that creates the data cell mimics the FunC API and is almost identical to our `save_data()` FunC function. Third, we can see the derivation of the contract address from the code cell and data cell using the function `contractAddress`.
The actual deployment involves sending the first message that will cause our contract to be deployed. We can piggyback any message that is directed towards our contract. This can even be the increment message with op #1, but we will do something simpler. We will just send some TON coins to our contract (an empty message) and piggyback that. Let's make this part of our interface. Add the function `sendDeploy()` to `wrappers/Counter.ts` - this function will send the deployment message:
@@ -226,7 +226,7 @@ network:testnet
```ts
import * as fs from "fs";
import { getHttpEndpoint } from "@orbs-network/ton-access";
-import { mnemonicToWalletKey } from "ton-crypto";
+import { mnemonicToWalletKey } from "@ton/crypto";
import { TonClient, Cell, WalletContractV4 } from "ton";
import Counter from "../wrappers/Counter"; // this is the interface class from step 7
@@ -286,7 +286,7 @@ network:mainnet
```ts
import * as fs from "fs";
import { getHttpEndpoint } from "@orbs-network/ton-access";
-import { mnemonicToWalletKey } from "ton-crypto";
+import { mnemonicToWalletKey } from "@ton/crypto";
import { TonClient, Cell, WalletContractV4 } from "ton";
import Counter from "../wrappers/Counter"; // this is the interface class from step 7
@@ -501,7 +501,7 @@ network:testnet
---
```ts
import { getHttpEndpoint } from "@orbs-network/ton-access";
-import { mnemonicToWalletKey } from "ton-crypto";
+import { mnemonicToWalletKey } from "@ton/crypto";
import { TonClient, WalletContractV4, Address } from "ton";
import Counter from "../wrappers/Counter"; // this is the interface class we just implemented
@@ -553,7 +553,7 @@ network:mainnet
---
```ts
import { getHttpEndpoint } from "@orbs-network/ton-access";
-import { mnemonicToWalletKey } from "ton-crypto";
+import { mnemonicToWalletKey } from "@ton/crypto";
import { TonClient, WalletContractV4, Address } from "ton";
import Counter from "../wrappers/Counter"; // this is the interface class we just implemented
diff --git a/02-contract/test/counter.step10.ts b/02-contract/test/counter.step10.ts
index 93d6729..416b2d2 100644
--- a/02-contract/test/counter.step10.ts
+++ b/02-contract/test/counter.step10.ts
@@ -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 98fc955..bf1d963 100644
--- a/02-contract/test/counter.step7.ts
+++ b/02-contract/test/counter.step7.ts
@@ -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 a909635..5febb5d 100644
--- a/02-contract/test/counter.step9.ts
+++ b/02-contract/test/counter.step9.ts
@@ -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 6b3f254..16486cf 100644
--- a/02-contract/test/deploy.step8.ts
+++ b/02-contract/test/deploy.step8.ts
@@ -51,6 +51,8 @@ export async function run() {
console.log("deploy transaction confirmed!");
}
+run();
+
function sleep(ms: number) {
return new Promise(resolve => setTimeout(resolve, ms));
}
diff --git a/02-contract/test/step9.expected.txt b/02-contract/test/getCounter.expected.txt
similarity index 100%
rename from 02-contract/test/step9.expected.txt
rename to 02-contract/test/getCounter.expected.txt
diff --git a/02-contract/test/getCounter.ts b/02-contract/test/getCounter.ts
index ff7ca17..713222b 100644
--- a/02-contract/test/getCounter.ts
+++ b/02-contract/test/getCounter.ts
@@ -21,3 +21,5 @@ export async function run() {
//console.log("value:", counterValue.toString());
console.log("value:", counterValue >= 1000000000000n ? "more than 1T" : "less than 1T");
}
+
+run(); // only for testing purposes
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 84c741f..a624efe 100755
--- a/02-contract/test/index.sh
+++ b/02-contract/test/index.sh
@@ -5,9 +5,9 @@ npm install ts-node
npm install @ton-community/func-js
npm install ton ton-core ton-crypto
npm install @orbs-network/ton-access
-npx func-js stdlib.fc counter.fc --boc counter.cell
+npx func-js 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
+COUNTER_ADDRESS=`cut -d : -s -f 2 < deploy.step8.output.txt` npx ts-node getCounter.ts > getCounter.output.txt
+diff getCounter.output.txt getCounter.expected.txt
+COUNTER_ADDRESS=`cut -d : -s -f 2 < deploy.step8.output.txt` npx ts-node sendIncrement.ts > sendIncrement.output.txt
+diff sendIncrement.output.txt sendIncrement.expected.txt
diff --git a/02-contract/test/step10.expected.txt b/02-contract/test/sendIncrement.expected.txt
similarity index 100%
rename from 02-contract/test/step10.expected.txt
rename to 02-contract/test/sendIncrement.expected.txt
diff --git a/02-contract/test/sendIncrement.ts b/02-contract/test/sendIncrement.ts
index defd606..ea40c05 100644
--- a/02-contract/test/sendIncrement.ts
+++ b/02-contract/test/sendIncrement.ts
@@ -46,3 +46,5 @@ export async function run() {
function sleep(ms: number) {
return new Promise(resolve => setTimeout(resolve, ms));
}
+
+run(); // only for testing purposes
diff --git a/03-client/index.md b/03-client/index.md
index 255afb9..1e04f9e 100644
--- a/03-client/index.md
+++ b/03-client/index.md
@@ -38,7 +38,7 @@ npm install
We will need to install a few more packages that will allow us to interact with TON Blockchain. We've seen these packages in action in the previous tutorial. Run the following in terminal:
```console
-npm install ton ton-core ton-crypto
+npm install @ton/ton @ton/core @ton/crypto
npm install @orbs-network/ton-access
```
@@ -209,7 +209,7 @@ import { useEffect, useState } from 'react';
import Counter from '../contracts/counter';
import { useTonClient } from './useTonClient';
import { useAsyncInitialize } from './useAsyncInitialize';
-import { Address, OpenedContract } from 'ton-core';
+import { Address, OpenedContract } from '@ton/core';
export function useCounterContract() {
const client = useTonClient();
@@ -292,7 +292,7 @@ Create the file `src/hooks/useTonConnect.ts` with the following content:
```ts
import { useTonConnectUI } from '@tonconnect/ui-react';
-import { Sender, SenderArguments } from 'ton-core';
+import { Sender, SenderArguments } from '@ton/core';
export function useTonConnect(): { sender: Sender; connected: boolean } {
const [tonConnectUI] = useTonConnectUI();
@@ -327,7 +327,7 @@ import Counter from '../contracts/counter';
import { useTonClient } from './useTonClient';
import { useAsyncInitialize } from './useAsyncInitialize';
import { useTonConnect } from './useTonConnect';
-import { Address, OpenedContract } from 'ton-core';
+import { Address, OpenedContract } from '@ton/core';
export function useCounterContract() {
const client = useTonClient();
diff --git a/03-client/test/index.sh b/03-client/test/index.sh
index dd6a428..d0c4528 100755
--- a/03-client/test/index.sh
+++ b/03-client/test/index.sh
@@ -3,7 +3,7 @@ rm -rf ./temp
npm create vite@latest temp -- --template react-ts
cd temp
npm install
-npm install ton ton-core ton-crypto
+npm install @ton/ton @ton/core @ton/crypto
npm install @orbs-network/ton-access
npm install vite-plugin-node-polyfills
cp -f ../vite.config.ts .
diff --git a/03-client/test/src/contracts/counter.ts b/03-client/test/src/contracts/counter.ts
index 93d6729..52a9412 100644
--- a/03-client/test/src/contracts/counter.ts
+++ b/03-client/test/src/contracts/counter.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 {
diff --git a/03-client/test/src/hooks/useCounterContract.step6.ts b/03-client/test/src/hooks/useCounterContract.step6.ts
index ebbfa2d..da08ac3 100644
--- a/03-client/test/src/hooks/useCounterContract.step6.ts
+++ b/03-client/test/src/hooks/useCounterContract.step6.ts
@@ -2,7 +2,7 @@ import { useEffect, useState } from 'react';
import Counter from '../contracts/counter';
import { useTonClient } from './useTonClient';
import { useAsyncInitialize } from './useAsyncInitialize';
-import { Address, OpenedContract } from 'ton-core';
+import { Address, OpenedContract } from '@ton/core';
export function useCounterContract() {
const client = useTonClient();
diff --git a/03-client/test/src/hooks/useCounterContract.step7.ts b/03-client/test/src/hooks/useCounterContract.step7.ts
index fe1c895..35342a6 100644
--- a/03-client/test/src/hooks/useCounterContract.step7.ts
+++ b/03-client/test/src/hooks/useCounterContract.step7.ts
@@ -3,7 +3,7 @@ import Counter from '../contracts/counter';
import { useTonClient } from './useTonClient';
import { useAsyncInitialize } from './useAsyncInitialize';
import { useTonConnect } from './useTonConnect';
-import { Address, OpenedContract } from 'ton-core';
+import { Address, OpenedContract } from '@ton/core';
export function useCounterContract() {
const client = useTonClient();
diff --git a/03-client/test/src/hooks/useTonClient.ts b/03-client/test/src/hooks/useTonClient.ts
index 26f50eb..d3a8ff2 100644
--- a/03-client/test/src/hooks/useTonClient.ts
+++ b/03-client/test/src/hooks/useTonClient.ts
@@ -1,5 +1,5 @@
import { getHttpEndpoint } from '@orbs-network/ton-access';
-import { TonClient } from 'ton';
+import { TonClient } from '@ton/ton';
import { useAsyncInitialize } from './useAsyncInitialize';
export function useTonClient() {
diff --git a/03-client/test/src/hooks/useTonConnect.ts b/03-client/test/src/hooks/useTonConnect.ts
index 2944449..a31ac65 100644
--- a/03-client/test/src/hooks/useTonConnect.ts
+++ b/03-client/test/src/hooks/useTonConnect.ts
@@ -1,5 +1,5 @@
import { useTonConnectUI } from '@tonconnect/ui-react';
-import { Sender, SenderArguments } from 'ton-core';
+import { Sender, SenderArguments } from '@ton/core';
export function useTonConnect(): { sender: Sender; connected: boolean } {
const [tonConnectUI] = useTonConnectUI();
diff --git a/04-testing/index.md b/04-testing/index.md
index 5a541c1..7a44fee 100644
--- a/04-testing/index.md
+++ b/04-testing/index.md
@@ -19,7 +19,7 @@ Because testing is such as big deal in smart contract development, there's a sur
3. **Writing tests in FunC** - [toncli](https://github.com/disintar/toncli) is a command-line tool written in Python that runs on your machine and supports [debug](https://github.com/disintar/toncli/blob/master/docs/advanced/transaction_debug.md) and [unit tests](https://github.com/disintar/toncli/blob/master/docs/advanced/func_tests_new.md) for FunC contracts where the tests are also written in FunC ([example](https://github.com/BorysMinaiev/func-contest-1-tests-playground/blob/main/task-1/tests/test.fc)).
-4. **Bare-bones TVM with Sandbox** - [Sandbox](https://github.com/ton-community/sandbox) is a bare-bones version of just the [TVM](https://ton-blockchain.github.io/docs/tvm.pdf) running on [WebAssembly](https://webassembly.org/) with a thin JavaScript wrapper that allows test interactions from TypeScript.
+4. **Bare-bones TVM with Sandbox** - [Sandbox](https://github.com/ton-org/sandbox) is a bare-bones version of just the [TVM](https://ton-blockchain.github.io/docs/tvm.pdf) running on [WebAssembly](https://webassembly.org/) with a thin JavaScript wrapper that allows test interactions from TypeScript.
5. **Deploying beta contracts to mainnet** - This form of "testing in production" simply deploys alternative beta versions of your contracts to mainnet and uses real (not free) TON coin to play with them in a real environment. If you found a bug, you simply deploy new fixed beta versions and waste a little more money.
@@ -76,10 +76,10 @@ module.exports = {
And finally, run in terminal:
```console
-npm install ton-core @ton-community/sandbox @ton-community/test-utils
+npm install @ton/core @ton/sandbox @ton/test-utils
```
-This will install [Sandbox](https://github.com/ton-community/sandbox) and its dependencies. Sandbox is our magical library that will emulate TON Blockchain locally by running a bare-bones version of the TVM in process. This will guarantee that our tests will be blazingly fast and completely isolated.
+This will install [Sandbox](https://github.com/ton-org/sandbox) and its dependencies. Sandbox is our magical library that will emulate TON Blockchain locally by running a bare-bones version of the TVM in process. This will guarantee that our tests will be blazingly fast and completely isolated.
## Step 2: Load our contract in a test
@@ -104,8 +104,8 @@ Create the file `step2.spec.ts` with the following content:
```ts
import * as fs from "fs";
-import { Cell } from "ton-core";
-import { Blockchain, SandboxContract, TreasuryContract } from "@ton-community/sandbox";
+import { Cell } from "@ton/core";
+import { Blockchain, SandboxContract, TreasuryContract } from "@ton/sandbox";
import Counter from "./counter"; // this is the interface class from tutorial 2
describe("Counter tests", () => {
@@ -296,7 +296,7 @@ The console output should include something like this:
We can see that the debug messages are printed when the test is running. When we send some TON coin explicitly to the contract (7.123 coins), we can see that the first debug print indeed shows the expected value of `msg_value`. Since the TVM doesn't support floating points, the number is represented internally as a large integer (with 9 decimals, meaning multiplied by 10^9). On the second test, when we send the increment op, we can see both debug prints showing. This is because this message also includes a small amount of coins for gas.
-If you would like to see even more verbose log output from running your contracts, you can [increase the verbosity](https://github.com/ton-community/sandbox#viewing-logs) of the `blockchain` object after creating it in beforeEach:
+If you would like to see even more verbose log output from running your contracts, you can [increase the verbosity](https://github.com/ton-org/sandbox#viewing-logs) of the `blockchain` object after creating it in beforeEach:
```ts
blockchain.verbosity = {
@@ -339,7 +339,7 @@ Ready to claim your reward? Simply scan the QR code below or click 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/step2.spec.ts b/04-testing/test/step2.spec.ts
index 30ea970..541adfa 100644
--- a/04-testing/test/step2.spec.ts
+++ b/04-testing/test/step2.spec.ts
@@ -1,6 +1,6 @@
import * as fs from "fs";
-import { Cell } from "ton-core";
-import { Blockchain, SandboxContract, TreasuryContract } from "@ton-community/sandbox";
+import { Cell } from "@ton/core";
+import { Blockchain, SandboxContract, TreasuryContract } from "@ton/sandbox";
import Counter from "./counter"; // this is the interface class from tutorial 2
describe("Counter tests", () => {
diff --git a/04-testing/test/step3.spec.ts b/04-testing/test/step3.spec.ts
index 78e2edf..d3bd4a2 100644
--- a/04-testing/test/step3.spec.ts
+++ b/04-testing/test/step3.spec.ts
@@ -1,14 +1,14 @@
import * as fs from "fs";
-import { Cell } from "ton-core";
-import { Blockchain, SandboxContract, TreasuryContract } from "@ton-community/sandbox";
+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 Next, we're going to install a JavaScript package named ton that will allow us to make TON API calls and manipulate TON objects. Install the package by opening terminal in the project directory and running: The first thing we'll do is calculate the address of our wallet in code and see that it matches what we saw in the explorer. This action is completely offline since the wallet address is derived from the version of the wallet and the private key used to create it. Let's assume that your secret 24 word mnemonic is Create the file Create the file Create a new file Next, we're going to install a JavaScript package named ton that will allow us to make TON API calls and manipulate TON objects. Install the package by opening terminal in the project directory and running: The first thing we'll do is calculate the address of our wallet in code and see that it matches what we saw in the explorer. This action is completely offline since the wallet address is derived from the version of the wallet and the private key used to create it. Let's assume that your secret 24 word mnemonic is Create the file Create the file Create a new file Next, we're going to install a JavaScript package named ton that will allow us to make TON API calls and manipulate TON objects. Install the package by opening terminal in the project directory and running: The first thing we'll do is calculate the address of our wallet in code and see that it matches what we saw in the explorer. This action is completely offline since the wallet address is derived from the version of the wallet and the private key used to create it. Let's assume that your secret 24 word mnemonic is Create the file Create the file Create a new file Next, we're going to install a JavaScript package named ton that will allow us to make TON API calls and manipulate TON objects. Install the package by opening terminal in the project directory and running: The first thing we'll do is calculate the address of our wallet in code and see that it matches what we saw in the explorer. This action is completely offline since the wallet address is derived from the version of the wallet and the private key used to create it. Let's assume that your secret 24 word mnemonic is Create the file Create the file Create a new file We will need to install a few more packages that will allow us to interact with TON Blockchain. We've seen these packages in action in the previous tutorial. Run the following in terminal: Last but not least, we will need to overcome ton library's reliance on Nodejs Before starting, we're going to add another hook that will generate a Create the file We will need to install a few more packages that will allow us to interact with TON Blockchain. We've seen these packages in action in the previous tutorial. Run the following in terminal: Last but not least, we will need to overcome ton library's reliance on Nodejs Before starting, we're going to add another hook that will generate a Create the file We will need to install a few more packages that will allow us to interact with TON Blockchain. We've seen these packages in action in the previous tutorial. Run the following in terminal: Last but not least, we will need to overcome ton library's reliance on Nodejs Before starting, we're going to add another hook that will generate a Create the file We will need to install a few more packages that will allow us to interact with TON Blockchain. We've seen these packages in action in the previous tutorial. Run the following in terminal: Last but not least, we will need to overcome ton library's reliance on Nodejs Before starting, we're going to add another hook that will generate a Create the file Deploying your contract to testnet - Testnet is a live alternative instance of the entire TON Blockchain where TON coin isn't the real deal and is free to get. This instance is obviously not as secure as mainnet, but offers an interesting staging environment where you can play. Local blockchain with MyLocalTon - MyLocalTon is a Java-based desktop executable that runs a personal local instance of TON Blockchain on your machine that you can deploy contracts to and interact with. Another way to run a local private TON network is using Kubernetes with ton-k8s. Writing tests in FunC - toncli is a command-line tool written in Python that runs on your machine and supports debug and unit tests for FunC contracts where the tests are also written in FunC (example). Bare-bones TVM with Sandbox - Sandbox is a bare-bones version of just the TVM running on WebAssembly with a thin JavaScript wrapper that allows test interactions from TypeScript. Bare-bones TVM with Sandbox - Sandbox is a bare-bones version of just the TVM running on WebAssembly with a thin JavaScript wrapper that allows test interactions from TypeScript. Deploying beta contracts to mainnet - This form of "testing in production" simply deploys alternative beta versions of your contracts to mainnet and uses real (not free) TON coin to play with them in a real environment. If you found a bug, you simply deploy new fixed beta versions and waste a little more money. So which method should you choose? You definitely don't need all of them. And finally, run in terminal: This will install Sandbox and its dependencies. Sandbox is our magical library that will emulate TON Blockchain locally by running a bare-bones version of the TVM in process. This will guarantee that our tests will be blazingly fast and completely isolated. This will install Sandbox and its dependencies. Sandbox is our magical library that will emulate TON Blockchain locally by running a bare-bones version of the TVM in process. This will guarantee that our tests will be blazingly fast and completely isolated. Quick reminder, in tutorial 2, we compiled our Counter smart contract in step 6 and generated the file Dig into your completed tutorial 2 and copy both Before we start writing tests, let's create our test skeleton. In the skeleton, before each test starts, we'll initialize a fresh instance of the entire blockchain. This instance will require a wallet with enough TON for all our gas needs (we call this a "treasury") and a deployed version of the Counter. Create the file We can see that the debug messages are printed when the test is running. When we send some TON coin explicitly to the contract (7.123 coins), we can see that the first debug print indeed shows the expected value of If you would like to see even more verbose log output from running your contracts, you can increase the verbosity of the If you would like to see even more verbose log output from running your contracts, you can increase the verbosity of the Step 6: Set up your local machine f
npm install ts-node
npm install ton ton-crypto ton-core
+
npm install @ton/ton @ton/crypto @ton/core
Step 7: Get the wallet address programmatically
unfold sugar water ...
- this is the phrase we backed up in step 2.step7.ts
with the following content:import { mnemonicToWalletKey } from "ton-crypto";
+
import { mnemonicToWalletKey } from "@ton/crypto";
import { WalletContractV4 } from "ton";
async function main() {
@@ -209,7 +209,7 @@
Step 8: Read wallet state from the cha
step8.ts
with the following content:import { getHttpEndpoint } from "@orbs-network/ton-access";
-import { mnemonicToWalletKey } from "ton-crypto";
+import { mnemonicToWalletKey } from "@ton/crypto";
import { WalletContractV4, TonClient, fromNano } from "ton";
async function main() {
@@ -246,7 +246,7 @@
Step 9: Send transfer transactio
step9.ts
with this content:import { getHttpEndpoint } from "@orbs-network/ton-access";
-import { mnemonicToWalletKey } from "ton-crypto";
+import { mnemonicToWalletKey } from "@ton/crypto";
import { TonClient, WalletContractV4, internal } from "ton";
async function main() {
@@ -562,13 +562,13 @@
Step 6: Set up your local machine f
npm install ts-node
npm install ton ton-crypto ton-core
+
npm install @ton/ton @ton/crypto @ton/core
Step 7: Get the wallet address programmatically
unfold sugar water ...
- this is the phrase we backed up in step 2.step7.ts
with the following content:import { mnemonicToWalletKey } from "ton-crypto";
+
import { mnemonicToWalletKey } from "@ton/crypto";
import { WalletContractV4 } from "ton";
async function main() {
@@ -599,7 +599,7 @@
Step 8: Read wallet state from the cha
step8.ts
with the following content:import { getHttpEndpoint } from "@orbs-network/ton-access";
-import { mnemonicToWalletKey } from "ton-crypto";
+import { mnemonicToWalletKey } from "@ton/crypto";
import { WalletContractV4, TonClient, fromNano } from "ton";
async function main() {
@@ -636,7 +636,7 @@
Step 9: Send transfer transactio
step9.ts
with this content:import { getHttpEndpoint } from "@orbs-network/ton-access";
-import { mnemonicToWalletKey } from "ton-crypto";
+import { mnemonicToWalletKey } from "@ton/crypto";
import { TonClient, WalletContractV4, internal } from "ton";
async function main() {
diff --git a/docs/01-wallet/mainnet-npmton.html b/docs/01-wallet/mainnet-npmton.html
index a3a49f4..f337874 100644
--- a/docs/01-wallet/mainnet-npmton.html
+++ b/docs/01-wallet/mainnet-npmton.html
@@ -49,13 +49,13 @@
Step 6: Set up your local machine f
npm install ts-node
npm install ton ton-crypto ton-core
+
npm install @ton/ton @ton/crypto @ton/core
Step 7: Get the wallet address programmatically
unfold sugar water ...
- this is the phrase we backed up in step 2.step7.ts
with the following content:import { mnemonicToWalletKey } from "ton-crypto";
+
import { mnemonicToWalletKey } from "@ton/crypto";
import { WalletContractV4 } from "ton";
async function main() {
@@ -86,7 +86,7 @@
Step 8: Read wallet state from the cha
step8.ts
with the following content:import { getHttpEndpoint } from "@orbs-network/ton-access";
-import { mnemonicToWalletKey } from "ton-crypto";
+import { mnemonicToWalletKey } from "@ton/crypto";
import { WalletContractV4, TonClient, fromNano } from "ton";
async function main() {
@@ -123,7 +123,7 @@
Step 9: Send transfer transactio
step9.ts
with this content:import { getHttpEndpoint } from "@orbs-network/ton-access";
-import { mnemonicToWalletKey } from "ton-crypto";
+import { mnemonicToWalletKey } from "@ton/crypto";
import { TonClient, WalletContractV4, internal } from "ton";
async function main() {
diff --git a/docs/01-wallet/mainnet-npmton.md b/docs/01-wallet/mainnet-npmton.md
index d8e9c82..15d4b67 100644
--- a/docs/01-wallet/mainnet-npmton.md
+++ b/docs/01-wallet/mainnet-npmton.md
@@ -102,7 +102,7 @@ npm install ts-node
Next, we're going to install a JavaScript package named [ton](https://www.npmjs.com/package/ton) that will allow us to make TON API calls and manipulate TON objects. Install the package by opening terminal in the project directory and running:
```console
-npm install ton ton-crypto ton-core
+npm install @ton/ton @ton/crypto @ton/core
```
## Step 7: Get the wallet address programmatically
@@ -114,7 +114,7 @@ Let's assume that your secret 24 word mnemonic is `unfold sugar water ...` - thi
Create the file `step7.ts` with the following content:
```ts
-import { mnemonicToWalletKey } from "ton-crypto";
+import { mnemonicToWalletKey } from "@ton/crypto";
import { WalletContractV4 } from "ton";
async function main() {
@@ -159,7 +159,7 @@ Create the file `step8.ts` with the following content:
```ts
import { getHttpEndpoint } from "@orbs-network/ton-access";
-import { mnemonicToWalletKey } from "ton-crypto";
+import { mnemonicToWalletKey } from "@ton/crypto";
import { WalletContractV4, TonClient, fromNano } from "ton";
async function main() {
@@ -207,7 +207,7 @@ Create a new file `step9.ts` with this content:
```ts
import { getHttpEndpoint } from "@orbs-network/ton-access";
-import { mnemonicToWalletKey } from "ton-crypto";
+import { mnemonicToWalletKey } from "@ton/crypto";
import { TonClient, WalletContractV4, internal } from "ton";
async function main() {
diff --git a/docs/01-wallet/testnet-npmton.html b/docs/01-wallet/testnet-npmton.html
index c716b88..4022181 100644
--- a/docs/01-wallet/testnet-npmton.html
+++ b/docs/01-wallet/testnet-npmton.html
@@ -51,13 +51,13 @@
Step 6: Set up your local machine f
npm install ts-node
npm install ton ton-crypto ton-core
+
npm install @ton/ton @ton/crypto @ton/core
Step 7: Get the wallet address programmatically
unfold sugar water ...
- this is the phrase we backed up in step 2.step7.ts
with the following content:import { mnemonicToWalletKey } from "ton-crypto";
+
import { mnemonicToWalletKey } from "@ton/crypto";
import { WalletContractV4 } from "ton";
async function main() {
@@ -88,7 +88,7 @@
Step 8: Read wallet state from the cha
step8.ts
with the following content:import { getHttpEndpoint } from "@orbs-network/ton-access";
-import { mnemonicToWalletKey } from "ton-crypto";
+import { mnemonicToWalletKey } from "@ton/crypto";
import { WalletContractV4, TonClient, fromNano } from "ton";
async function main() {
@@ -125,7 +125,7 @@
Step 9: Send transfer transactio
step9.ts
with this content:import { getHttpEndpoint } from "@orbs-network/ton-access";
-import { mnemonicToWalletKey } from "ton-crypto";
+import { mnemonicToWalletKey } from "@ton/crypto";
import { TonClient, WalletContractV4, internal } from "ton";
async function main() {
diff --git a/docs/01-wallet/testnet-npmton.md b/docs/01-wallet/testnet-npmton.md
index ad24aa2..1cfb424 100644
--- a/docs/01-wallet/testnet-npmton.md
+++ b/docs/01-wallet/testnet-npmton.md
@@ -106,7 +106,7 @@ npm install ts-node
Next, we're going to install a JavaScript package named [ton](https://www.npmjs.com/package/ton) that will allow us to make TON API calls and manipulate TON objects. Install the package by opening terminal in the project directory and running:
```console
-npm install ton ton-crypto ton-core
+npm install @ton/ton @ton/crypto @ton/core
```
## Step 7: Get the wallet address programmatically
@@ -118,7 +118,7 @@ Let's assume that your secret 24 word mnemonic is `unfold sugar water ...` - thi
Create the file `step7.ts` with the following content:
```ts
-import { mnemonicToWalletKey } from "ton-crypto";
+import { mnemonicToWalletKey } from "@ton/crypto";
import { WalletContractV4 } from "ton";
async function main() {
@@ -163,7 +163,7 @@ Create the file `step8.ts` with the following content:
```ts
import { getHttpEndpoint } from "@orbs-network/ton-access";
-import { mnemonicToWalletKey } from "ton-crypto";
+import { mnemonicToWalletKey } from "@ton/crypto";
import { WalletContractV4, TonClient, fromNano } from "ton";
async function main() {
@@ -211,7 +211,7 @@ Create a new file `step9.ts` with this content:
```ts
import { getHttpEndpoint } from "@orbs-network/ton-access";
-import { mnemonicToWalletKey } from "ton-crypto";
+import { mnemonicToWalletKey } from "@ton/crypto";
import { TonClient, WalletContractV4, internal } from "ton";
async function main() {
diff --git a/docs/03-client/index.html b/docs/03-client/index.html
index 56bcdb5..4a9e9ec 100644
--- a/docs/03-client/index.html
+++ b/docs/03-client/index.html
@@ -131,7 +131,7 @@
Step 3: Set up the project
npm install
npm install ton ton-core ton-crypto
+
npm install @ton/ton @ton/core @ton/crypto
npm install @orbs-network/ton-access
Buffer
that isn't available in the browser. We can do that by installing a polyfill. Run the following in terminal:Step 6: Read the counter value fro
import Counter from '../contracts/counter';
import { useTonClient } from './useTonClient';
import { useAsyncInitialize } from './useAsyncInitialize';
-import { Address, OpenedContract } from 'ton-core';
+import { Address, OpenedContract } from '@ton/core';
export function useCounterContract() {
const client = useTonClient();
@@ -302,7 +302,7 @@
Step 7: Increment the counter on-chain<
sender
object from the TON Connect interface. This sender represents the connected wallet and will allow us to send transactions on their behalf. While we're at it, we'll also expose the wallet connection state so we can alter the UI accordingly.src/hooks/useTonConnect.ts
with the following content:import { useTonConnectUI } from '@tonconnect/ui-react';
-import { Sender, SenderArguments } from 'ton-core';
+import { Sender, SenderArguments } from '@ton/core';
export function useTonConnect(): { sender: Sender; connected: boolean } {
const [tonConnectUI] = useTonConnectUI();
@@ -333,7 +333,7 @@
Step 7: Increment the counter on-chain<
import { useTonClient } from './useTonClient';
import { useAsyncInitialize } from './useAsyncInitialize';
import { useTonConnect } from './useTonConnect';
-import { Address, OpenedContract } from 'ton-core';
+import { Address, OpenedContract } from '@ton/core';
export function useCounterContract() {
const client = useTonClient();
@@ -599,7 +599,7 @@
Step 3: Set up the project
npm install
npm install ton ton-core ton-crypto
+
npm install @ton/ton @ton/core @ton/crypto
npm install @orbs-network/ton-access
Buffer
that isn't available in the browser. We can do that by installing a polyfill. Run the following in terminal:Step 6: Read the counter value fro
import Counter from '../contracts/counter';
import { useTonClient } from './useTonClient';
import { useAsyncInitialize } from './useAsyncInitialize';
-import { Address, OpenedContract } from 'ton-core';
+import { Address, OpenedContract } from '@ton/core';
export function useCounterContract() {
const client = useTonClient();
@@ -770,7 +770,7 @@
Step 7: Increment the counter on-chain<
sender
object from the TON Connect interface. This sender represents the connected wallet and will allow us to send transactions on their behalf. While we're at it, we'll also expose the wallet connection state so we can alter the UI accordingly.src/hooks/useTonConnect.ts
with the following content:import { useTonConnectUI } from '@tonconnect/ui-react';
-import { Sender, SenderArguments } from 'ton-core';
+import { Sender, SenderArguments } from '@ton/core';
export function useTonConnect(): { sender: Sender; connected: boolean } {
const [tonConnectUI] = useTonConnectUI();
@@ -801,7 +801,7 @@
Step 7: Increment the counter on-chain<
import { useTonClient } from './useTonClient';
import { useAsyncInitialize } from './useAsyncInitialize';
import { useTonConnect } from './useTonConnect';
-import { Address, OpenedContract } from 'ton-core';
+import { Address, OpenedContract } from '@ton/core';
export function useCounterContract() {
const client = useTonClient();
diff --git a/docs/03-client/mainnet-npmton.html b/docs/03-client/mainnet-npmton.html
index e06a4cb..bdeb32e 100644
--- a/docs/03-client/mainnet-npmton.html
+++ b/docs/03-client/mainnet-npmton.html
@@ -19,7 +19,7 @@
Step 3: Set up the project
npm install
npm install ton ton-core ton-crypto
+
npm install @ton/ton @ton/core @ton/crypto
npm install @orbs-network/ton-access
Buffer
that isn't available in the browser. We can do that by installing a polyfill. Run the following in terminal:Step 6: Read the counter value fro
import Counter from '../contracts/counter';
import { useTonClient } from './useTonClient';
import { useAsyncInitialize } from './useAsyncInitialize';
-import { Address, OpenedContract } from 'ton-core';
+import { Address, OpenedContract } from '@ton/core';
export function useCounterContract() {
const client = useTonClient();
@@ -190,7 +190,7 @@
Step 7: Increment the counter on-chain<
sender
object from the TON Connect interface. This sender represents the connected wallet and will allow us to send transactions on their behalf. While we're at it, we'll also expose the wallet connection state so we can alter the UI accordingly.src/hooks/useTonConnect.ts
with the following content:import { useTonConnectUI } from '@tonconnect/ui-react';
-import { Sender, SenderArguments } from 'ton-core';
+import { Sender, SenderArguments } from '@ton/core';
export function useTonConnect(): { sender: Sender; connected: boolean } {
const [tonConnectUI] = useTonConnectUI();
@@ -221,7 +221,7 @@
Step 7: Increment the counter on-chain<
import { useTonClient } from './useTonClient';
import { useAsyncInitialize } from './useAsyncInitialize';
import { useTonConnect } from './useTonConnect';
-import { Address, OpenedContract } from 'ton-core';
+import { Address, OpenedContract } from '@ton/core';
export function useCounterContract() {
const client = useTonClient();
diff --git a/docs/03-client/mainnet-npmton.md b/docs/03-client/mainnet-npmton.md
index b0f3a91..00b4eae 100644
--- a/docs/03-client/mainnet-npmton.md
+++ b/docs/03-client/mainnet-npmton.md
@@ -38,7 +38,7 @@ npm install
We will need to install a few more packages that will allow us to interact with TON Blockchain. We've seen these packages in action in the previous tutorial. Run the following in terminal:
```console
-npm install ton ton-core ton-crypto
+npm install @ton/ton @ton/core @ton/crypto
npm install @orbs-network/ton-access
```
@@ -184,7 +184,7 @@ import { useEffect, useState } from 'react';
import Counter from '../contracts/counter';
import { useTonClient } from './useTonClient';
import { useAsyncInitialize } from './useAsyncInitialize';
-import { Address, OpenedContract } from 'ton-core';
+import { Address, OpenedContract } from '@ton/core';
export function useCounterContract() {
const client = useTonClient();
@@ -267,7 +267,7 @@ Create the file `src/hooks/useTonConnect.ts` with the following content:
```ts
import { useTonConnectUI } from '@tonconnect/ui-react';
-import { Sender, SenderArguments } from 'ton-core';
+import { Sender, SenderArguments } from '@ton/core';
export function useTonConnect(): { sender: Sender; connected: boolean } {
const [tonConnectUI] = useTonConnectUI();
@@ -302,7 +302,7 @@ import Counter from '../contracts/counter';
import { useTonClient } from './useTonClient';
import { useAsyncInitialize } from './useAsyncInitialize';
import { useTonConnect } from './useTonConnect';
-import { Address, OpenedContract } from 'ton-core';
+import { Address, OpenedContract } from '@ton/core';
export function useCounterContract() {
const client = useTonClient();
diff --git a/docs/03-client/testnet-npmton.html b/docs/03-client/testnet-npmton.html
index d0404b4..3b8850d 100644
--- a/docs/03-client/testnet-npmton.html
+++ b/docs/03-client/testnet-npmton.html
@@ -19,7 +19,7 @@
Step 3: Set up the project
npm install
npm install ton ton-core ton-crypto
+
npm install @ton/ton @ton/core @ton/crypto
npm install @orbs-network/ton-access
Buffer
that isn't available in the browser. We can do that by installing a polyfill. Run the following in terminal:Step 6: Read the counter value fro
import Counter from '../contracts/counter';
import { useTonClient } from './useTonClient';
import { useAsyncInitialize } from './useAsyncInitialize';
-import { Address, OpenedContract } from 'ton-core';
+import { Address, OpenedContract } from '@ton/core';
export function useCounterContract() {
const client = useTonClient();
@@ -190,7 +190,7 @@
Step 7: Increment the counter on-chain<
sender
object from the TON Connect interface. This sender represents the connected wallet and will allow us to send transactions on their behalf. While we're at it, we'll also expose the wallet connection state so we can alter the UI accordingly.src/hooks/useTonConnect.ts
with the following content:import { useTonConnectUI } from '@tonconnect/ui-react';
-import { Sender, SenderArguments } from 'ton-core';
+import { Sender, SenderArguments } from '@ton/core';
export function useTonConnect(): { sender: Sender; connected: boolean } {
const [tonConnectUI] = useTonConnectUI();
@@ -221,7 +221,7 @@
Step 7: Increment the counter on-chain<
import { useTonClient } from './useTonClient';
import { useAsyncInitialize } from './useAsyncInitialize';
import { useTonConnect } from './useTonConnect';
-import { Address, OpenedContract } from 'ton-core';
+import { Address, OpenedContract } from '@ton/core';
export function useCounterContract() {
const client = useTonClient();
diff --git a/docs/03-client/testnet-npmton.md b/docs/03-client/testnet-npmton.md
index f5e4a2b..2cd72ed 100644
--- a/docs/03-client/testnet-npmton.md
+++ b/docs/03-client/testnet-npmton.md
@@ -38,7 +38,7 @@ npm install
We will need to install a few more packages that will allow us to interact with TON Blockchain. We've seen these packages in action in the previous tutorial. Run the following in terminal:
```console
-npm install ton ton-core ton-crypto
+npm install @ton/ton @ton/core @ton/crypto
npm install @orbs-network/ton-access
```
@@ -184,7 +184,7 @@ import { useEffect, useState } from 'react';
import Counter from '../contracts/counter';
import { useTonClient } from './useTonClient';
import { useAsyncInitialize } from './useAsyncInitialize';
-import { Address, OpenedContract } from 'ton-core';
+import { Address, OpenedContract } from '@ton/core';
export function useCounterContract() {
const client = useTonClient();
@@ -267,7 +267,7 @@ Create the file `src/hooks/useTonConnect.ts` with the following content:
```ts
import { useTonConnectUI } from '@tonconnect/ui-react';
-import { Sender, SenderArguments } from 'ton-core';
+import { Sender, SenderArguments } from '@ton/core';
export function useTonConnect(): { sender: Sender; connected: boolean } {
const [tonConnectUI] = useTonConnectUI();
@@ -302,7 +302,7 @@ import Counter from '../contracts/counter';
import { useTonClient } from './useTonClient';
import { useAsyncInitialize } from './useAsyncInitialize';
import { useTonConnect } from './useTonConnect';
-import { Address, OpenedContract } from 'ton-core';
+import { Address, OpenedContract } from '@ton/core';
export function useCounterContract() {
const client = useTonClient();
diff --git a/docs/04-testing/index.html b/docs/04-testing/index.html
index e302ccc..a536ea7 100644
--- a/docs/04-testing/index.html
+++ b/docs/04-testing/index.html
@@ -88,7 +88,7 @@
Oh so many ways to test
Step 1: Set up the project
};
npm install ton-core @ton-community/sandbox @ton-community/test-utils
+
-npm install @ton/core @ton/sandbox @ton/test-utils
Step 2: Load our contract in a test
counter.cell
which contains the TVM bytecode for our contract (code cell). In step 7, before deploying the contract, we initialized its persistent storage (data cell). Then, we created the TypeScript interface class counter.ts
that combines the two to deploy our contract.counter.cell
(also available here) and counter.ts
(also available here) to the project root.Step 2: Load our contract in a test
step2.spec.ts
with the following content:import * as fs from "fs";
-import { Cell } from "ton-core";
-import { Blockchain, SandboxContract, TreasuryContract } from "@ton-community/sandbox";
+import { Cell } from "@ton/core";
+import { Blockchain, SandboxContract, TreasuryContract } from "@ton/sandbox";
import Counter from "./counter"; // this is the interface class from tutorial 2
describe("Counter tests", () => {
@@ -278,7 +278,7 @@
Step 5: Debug by dumping variables
#DEBUG#: increment received
msg_value
. Since the TVM doesn't support floating points, the number is represented internally as a large integer (with 9 decimals, meaning multiplied by 10^9). On the second test, when we send the increment op, we can see both debug prints showing. This is because this message also includes a small amount of coins for gas.blockchain
object after creating it in beforeEach:blockchain
object after creating it in beforeEach:blockchain.verbosity = {
print: true,
blockchainLogs: true,
@@ -306,7 +306,7 @@
Reward
For your convenience, all the code in this tutorial is available in executable form here.
-In this tutorial we created our project skeleton manually, mostly so we can understand what happens under the hood. When creating a new contract project, you can have an excellent skeleton created automatically by an awesome dev tool called Blueprint. To create a new contract project with Blueprint, run in terminal and follow the on-screen instructions:
+In this tutorial we created our project skeleton manually, mostly so we can understand what happens under the hood. When creating a new contract project, you can have an excellent skeleton created automatically by an awesome dev tool called Blueprint. To create a new contract project with Blueprint, run in terminal and follow the on-screen instructions:
npm create ton@latest
If you found a mistake in this tutorial, please submit a PR and help us fix it. This tutorial platform is fully open source and available on https://github.com/ton-community/tutorials.
diff --git a/docs/04-testing/npmton.html b/docs/04-testing/npmton.html index df07244..dccbb91 100644 --- a/docs/04-testing/npmton.html +++ b/docs/04-testing/npmton.html @@ -9,7 +9,7 @@Deploying your contract to testnet - Testnet is a live alternative instance of the entire TON Blockchain where TON coin isn't the real deal and is free to get. This instance is obviously not as secure as mainnet, but offers an interesting staging environment where you can play.
Local blockchain with MyLocalTon - MyLocalTon is a Java-based desktop executable that runs a personal local instance of TON Blockchain on your machine that you can deploy contracts to and interact with. Another way to run a local private TON network is using Kubernetes with ton-k8s.
Writing tests in FunC - toncli is a command-line tool written in Python that runs on your machine and supports debug and unit tests for FunC contracts where the tests are also written in FunC (example).
Bare-bones TVM with Sandbox - Sandbox is a bare-bones version of just the TVM running on WebAssembly with a thin JavaScript wrapper that allows test interactions from TypeScript.
Bare-bones TVM with Sandbox - Sandbox is a bare-bones version of just the TVM running on WebAssembly with a thin JavaScript wrapper that allows test interactions from TypeScript.
Deploying beta contracts to mainnet - This form of "testing in production" simply deploys alternative beta versions of your contracts to mainnet and uses real (not free) TON coin to play with them in a real environment. If you found a bug, you simply deploy new fixed beta versions and waste a little more money.
So which method should you choose? You definitely don't need all of them.
@@ -46,9 +46,9 @@And finally, run in terminal:
-npm install ton-core @ton-community/sandbox @ton-community/test-utils
+npm install @ton/core @ton/sandbox @ton/test-utils
-This will install Sandbox and its dependencies. Sandbox is our magical library that will emulate TON Blockchain locally by running a bare-bones version of the TVM in process. This will guarantee that our tests will be blazingly fast and completely isolated.
+This will install Sandbox and its dependencies. Sandbox is our magical library that will emulate TON Blockchain locally by running a bare-bones version of the TVM in process. This will guarantee that our tests will be blazingly fast and completely isolated.
Step 2: Load our contract in a test
Quick reminder, in tutorial 2, we compiled our Counter smart contract in step 6 and generated the file counter.cell
which contains the TVM bytecode for our contract (code cell). In step 7, before deploying the contract, we initialized its persistent storage (data cell). Then, we created the TypeScript interface class counter.ts
that combines the two to deploy our contract.
Dig into your completed tutorial 2 and copy both counter.cell
(also available here) and counter.ts
(also available here) to the project root.
@@ -62,8 +62,8 @@ Step 2: Load our contract in a test
Before we start writing tests, let's create our test skeleton. In the skeleton, before each test starts, we'll initialize a fresh instance of the entire blockchain. This instance will require a wallet with enough TON for all our gas needs (we call this a "treasury") and a deployed version of the Counter.
Create the file step2.spec.ts
with the following content:
import * as fs from "fs";
-import { Cell } from "ton-core";
-import { Blockchain, SandboxContract, TreasuryContract } from "@ton-community/sandbox";
+import { Cell } from "@ton/core";
+import { Blockchain, SandboxContract, TreasuryContract } from "@ton/sandbox";
import Counter from "./counter"; // this is the interface class from tutorial 2
describe("Counter tests", () => {
@@ -199,7 +199,7 @@ Step 5: Debug by dumping variables
#DEBUG#: increment received
We can see that the debug messages are printed when the test is running. When we send some TON coin explicitly to the contract (7.123 coins), we can see that the first debug print indeed shows the expected value of msg_value
. Since the TVM doesn't support floating points, the number is represented internally as a large integer (with 9 decimals, meaning multiplied by 10^9). On the second test, when we send the increment op, we can see both debug prints showing. This is because this message also includes a small amount of coins for gas.
-If you would like to see even more verbose log output from running your contracts, you can increase the verbosity of the blockchain
object after creating it in beforeEach:
+If you would like to see even more verbose log output from running your contracts, you can increase the verbosity of the blockchain
object after creating it in beforeEach:
blockchain.verbosity = {
print: true,
blockchainLogs: true,
@@ -227,7 +227,7 @@ Reward
Conclusion
For your convenience, all the code in this tutorial is available in executable form here.
-In this tutorial we created our project skeleton manually, mostly so we can understand what happens under the hood. When creating a new contract project, you can have an excellent skeleton created automatically by an awesome dev tool called Blueprint. To create a new contract project with Blueprint, run in terminal and follow the on-screen instructions:
+In this tutorial we created our project skeleton manually, mostly so we can understand what happens under the hood. When creating a new contract project, you can have an excellent skeleton created automatically by an awesome dev tool called Blueprint. To create a new contract project with Blueprint, run in terminal and follow the on-screen instructions:
npm create ton@latest
If you found a mistake in this tutorial, please submit a PR and help us fix it. This tutorial platform is fully open source and available on https://github.com/ton-community/tutorials.
diff --git a/docs/04-testing/npmton.md b/docs/04-testing/npmton.md
index 5a541c1..7a44fee 100644
--- a/docs/04-testing/npmton.md
+++ b/docs/04-testing/npmton.md
@@ -19,7 +19,7 @@ Because testing is such as big deal in smart contract development, there's a sur
3. **Writing tests in FunC** - [toncli](https://github.com/disintar/toncli) is a command-line tool written in Python that runs on your machine and supports [debug](https://github.com/disintar/toncli/blob/master/docs/advanced/transaction_debug.md) and [unit tests](https://github.com/disintar/toncli/blob/master/docs/advanced/func_tests_new.md) for FunC contracts where the tests are also written in FunC ([example](https://github.com/BorysMinaiev/func-contest-1-tests-playground/blob/main/task-1/tests/test.fc)).
-4. **Bare-bones TVM with Sandbox** - [Sandbox](https://github.com/ton-community/sandbox) is a bare-bones version of just the [TVM](https://ton-blockchain.github.io/docs/tvm.pdf) running on [WebAssembly](https://webassembly.org/) with a thin JavaScript wrapper that allows test interactions from TypeScript.
+4. **Bare-bones TVM with Sandbox** - [Sandbox](https://github.com/ton-org/sandbox) is a bare-bones version of just the [TVM](https://ton-blockchain.github.io/docs/tvm.pdf) running on [WebAssembly](https://webassembly.org/) with a thin JavaScript wrapper that allows test interactions from TypeScript.
5. **Deploying beta contracts to mainnet** - This form of "testing in production" simply deploys alternative beta versions of your contracts to mainnet and uses real (not free) TON coin to play with them in a real environment. If you found a bug, you simply deploy new fixed beta versions and waste a little more money.
@@ -76,10 +76,10 @@ module.exports = {
And finally, run in terminal:
```console
-npm install ton-core @ton-community/sandbox @ton-community/test-utils
+npm install @ton/core @ton/sandbox @ton/test-utils
```
-This will install [Sandbox](https://github.com/ton-community/sandbox) and its dependencies. Sandbox is our magical library that will emulate TON Blockchain locally by running a bare-bones version of the TVM in process. This will guarantee that our tests will be blazingly fast and completely isolated.
+This will install [Sandbox](https://github.com/ton-org/sandbox) and its dependencies. Sandbox is our magical library that will emulate TON Blockchain locally by running a bare-bones version of the TVM in process. This will guarantee that our tests will be blazingly fast and completely isolated.
## Step 2: Load our contract in a test
@@ -104,8 +104,8 @@ Create the file `step2.spec.ts` with the following content:
```ts
import * as fs from "fs";
-import { Cell } from "ton-core";
-import { Blockchain, SandboxContract, TreasuryContract } from "@ton-community/sandbox";
+import { Cell } from "@ton/core";
+import { Blockchain, SandboxContract, TreasuryContract } from "@ton/sandbox";
import Counter from "./counter"; // this is the interface class from tutorial 2
describe("Counter tests", () => {
@@ -296,7 +296,7 @@ The console output should include something like this:
We can see that the debug messages are printed when the test is running. When we send some TON coin explicitly to the contract (7.123 coins), we can see that the first debug print indeed shows the expected value of `msg_value`. Since the TVM doesn't support floating points, the number is represented internally as a large integer (with 9 decimals, meaning multiplied by 10^9). On the second test, when we send the increment op, we can see both debug prints showing. This is because this message also includes a small amount of coins for gas.
-If you would like to see even more verbose log output from running your contracts, you can [increase the verbosity](https://github.com/ton-community/sandbox#viewing-logs) of the `blockchain` object after creating it in beforeEach:
+If you would like to see even more verbose log output from running your contracts, you can [increase the verbosity](https://github.com/ton-org/sandbox#viewing-logs) of the `blockchain` object after creating it in beforeEach:
```ts
blockchain.verbosity = {
@@ -339,7 +339,7 @@ Ready to claim your reward? Simply scan the QR code below or click