diff --git a/CHANGELOG.md b/CHANGELOG.md index 7233ee6..2c752f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,26 @@ All notable changes to this project will be documented in this file. +## [1.6.0] - 2023-02-13 + +### New + +- Added [support of Signature ID](https://github.com/tonlabs/ever-sdk/blob/master/CHANGELOG.md) on the networks with + `CapSignatureWithId` capability enabled. +- Added new option `everdev contract deploy --workchain` to specify in which workchain to deploy a contract. +- `everdev contract decode-tvc` command renamed to `everdev contract decode-stateinit`. +- Add a reference to stable solc and sold versions to the output of the + `everdev sold version` and `everdev sol version` commands. + +### Fixed + +- Double error messages generated by `everdev sol compile` command. +- Error: `unrecognized option '-i` which occurred when using a solidity compiler version below 0.57.0 +- The "constructor" function excluded from the list of callable functions +- Incorrect `GiverV1.abi.json` file has been replaced with the correct one. +- Set the `se` network as the default network if there is no default network. +- Set the `seGiver` giver as the default signer if there is no default signer. + ## [1.5.1] - 2022-12-23 ### New diff --git a/contracts/GiverV1.abi.json b/contracts/GiverV1.abi.json index e50b453..5e16e54 100644 --- a/contracts/GiverV1.abi.json +++ b/contracts/GiverV1.abi.json @@ -1,29 +1,20 @@ { - "ABI version": 2, - "version": "2.2", - "header": [ - "pubkey", - "time", - "expire" - ], - "functions": [ - { - "name": "sendGrams", - "inputs": [ + "ABI version": 1, + "functions": [ { - "name": "dest", - "type": "address" + "name": "constructor", + "inputs": [], + "outputs": [] }, { - "name": "amount", - "type": "uint64" + "name": "sendGrams", + "inputs": [ + { "name": "dest", "type": "address" }, + { "name": "amount", "type": "uint64" } + ], + "outputs": [] } - ], - "outputs": [ - ] - } - ], - "data": [], - "events": [], - "fields": [] + ], + "events": [], + "data": [] } diff --git a/contracts/GiverV3.abi.json b/contracts/GiverV3.abi.json index a75bcf7..7749f9f 100644 --- a/contracts/GiverV3.abi.json +++ b/contracts/GiverV3.abi.json @@ -1,49 +1,49 @@ { - "ABI version": 2, - "version": "2.2", - "header": ["time", "expire"], - "functions": [ - { - "name": "sendTransaction", - "inputs": [ - {"name":"dest","type":"address"}, - {"name":"value","type":"uint128"}, - {"name":"bounce","type":"bool"} - ], - "outputs": [ - ] - }, - { - "name": "getMessages", - "inputs": [ - ], - "outputs": [ - {"components":[{"name":"hash","type":"uint256"},{"name":"expireAt","type":"uint64"}],"name":"messages","type":"tuple[]"} - ] - }, - { - "name": "upgrade", - "inputs": [ - {"name":"newcode","type":"cell"} - ], - "outputs": [ - ] - }, - { - "name": "constructor", - "inputs": [ - ], - "outputs": [ - ] - } - ], - "data": [ - ], - "events": [ - ], - "fields": [ - {"name":"_pubkey","type":"uint256"}, - {"name":"_constructorFlag","type":"bool"}, - {"name":"m_messages","type":"map(uint256,uint64)"} - ] + "ABI version": 2, + "version": "2.3", + "header": ["time", "expire"], + "functions": [ + { + "name": "sendTransaction", + "inputs": [ + {"name":"dest","type":"address"}, + {"name":"value","type":"uint128"}, + {"name":"bounce","type":"bool"} + ], + "outputs": [ + ] + }, + { + "name": "getMessages", + "inputs": [ + ], + "outputs": [ + {"components":[{"name":"hash","type":"uint256"},{"name":"expireAt","type":"uint32"}],"name":"messages","type":"tuple[]"} + ] + }, + { + "name": "upgrade", + "inputs": [ + {"name":"newcode","type":"cell"} + ], + "outputs": [ + ] + }, + { + "name": "constructor", + "inputs": [ + ], + "outputs": [ + ] + } + ], + "data": [ + ], + "events": [ + ], + "fields": [ + {"name":"_pubkey","type":"uint256"}, + {"name":"_constructorFlag","type":"bool"}, + {"name":"m_messages","type":"map(uint256,uint32)"} + ] } diff --git a/contracts/GiverV3.keys.json b/contracts/GiverV3.keys.json deleted file mode 100644 index e3d8285..0000000 --- a/contracts/GiverV3.keys.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "public": "2ada2e65ab8eeab09490e3521415f45b6e42df9c760a639bcf53957550b25a16", - "secret": "172af540e43a524763dd53b26a066d472a97c4de37d5498170564510608250c3" -} \ No newline at end of file diff --git a/contracts/GiverV3.sol b/contracts/GiverV3.sol index 5f08ed4..c1f69e1 100644 --- a/contracts/GiverV3.sol +++ b/contracts/GiverV3.sol @@ -1,4 +1,4 @@ -pragma ton-solidity >= 0.59.0; +pragma ever-solidity >= 0.61.2; pragma AbiHeader time; pragma AbiHeader expire; @@ -22,7 +22,7 @@ abstract contract Upgradable { contract GiverV3 is Upgradable { uint8 constant MAX_CLEANUP_MSGS = 30; - mapping(uint256 => uint64) m_messages; + mapping(uint256 => uint32) m_messages; modifier acceptOnlyOwner { require(msg.pubkey() == tvm.pubkey(), 101); @@ -49,19 +49,19 @@ contract GiverV3 is Upgradable { /// @notice Function with predefined name called after signature check. Used to /// implement custom replay protection with parallel access. - function afterSignatureCheck(TvmSlice body, TvmCell message) private inline + function afterSignatureCheck(TvmSlice body, TvmCell) private inline returns (TvmSlice) { // owner check require(msg.pubkey() == tvm.pubkey(), 101); + uint256 bodyHash = tvm.hash(body); // load and drop message timestamp (uint64) - (, uint64 expireAt) = body.decode(uint64, uint32); + (, uint32 expireAt) = body.decode(uint64, uint32); require(expireAt > now, 57); - uint256 msgHash = tvm.hash(message); - require(!m_messages.exists(msgHash), 102); + require(!m_messages.exists(bodyHash), 102); tvm.accept(); - m_messages[msgHash] = expireAt; + m_messages[bodyHash] = expireAt; return body; } @@ -69,13 +69,13 @@ contract GiverV3 is Upgradable { /// @notice Allows to delete expired messages from dict. function gc() private inline { uint counter = 0; - for ((uint256 msgHash, uint64 expireAt) : m_messages) { + for ((uint256 bodyHash, uint32 expireAt) : m_messages) { if (counter >= MAX_CLEANUP_MSGS) { break; } counter++; if (expireAt <= now) { - delete m_messages[msgHash]; + delete m_messages[bodyHash]; } } } @@ -85,10 +85,10 @@ contract GiverV3 is Upgradable { */ struct Message { uint256 hash; - uint64 expireAt; + uint32 expireAt; } function getMessages() public view returns (Message[] messages) { - for ((uint256 msgHash, uint64 expireAt) : m_messages) { + for ((uint256 msgHash, uint32 expireAt) : m_messages) { messages.push(Message(msgHash, expireAt)); } } diff --git a/contracts/GiverV3.tvc b/contracts/GiverV3.tvc new file mode 100644 index 0000000..96a3c21 Binary files /dev/null and b/contracts/GiverV3.tvc differ diff --git a/contracts/GiverV2.keys.json b/contracts/seGiver.keys.json similarity index 100% rename from contracts/GiverV2.keys.json rename to contracts/seGiver.keys.json diff --git a/docs/guides/quick-start.md b/docs/guides/quick-start.md index 4802c6a..11efb5b 100644 --- a/docs/guides/quick-start.md +++ b/docs/guides/quick-start.md @@ -87,7 +87,7 @@ $ everdev s l Signer Public Key Used -------------------- ---------------------------------------------------------------- --------------------------- -giver_keys 2ada2e65ab8eeab09490e3521415f45b6e42df9c760a639bcf53957550b25a16 se network giver signer +seGiver 2ada2e65ab8eeab09490e3521415f45b6e42df9c760a639bcf53957550b25a16 se network giver signer EverNode SE Default Giver Keys owner_keys (Default) 3826202b129ea8c041b8d49a655512648fc94377d1958a7a4fc9f4b3051ecf7b ``` diff --git a/docs/guides/work-with-devnet.md b/docs/guides/work-with-devnet.md index d84b8a9..5020ba9 100644 --- a/docs/guides/work-with-devnet.md +++ b/docs/guides/work-with-devnet.md @@ -5,8 +5,9 @@ - [Working with DevNet: deploy and start using your own giver in Developer Network](#working-with-devnet-deploy-and-start-using-your-own-giver-in-developer-network) - [Contents](#contents) - [Deploying your own Giver](#deploying-your-own-giver) + - [Get your Devnet credentials](#get-your-devnet-credentials) - [Generate Giver keys](#generate-giver-keys) - - [Compile Giver code](#compile-giver-code) + - [Get giver code](#get-giver-code) - [Calculate Giver address](#calculate-giver-address) - [Sponsor Giver with public faucet](#sponsor-giver-with-public-faucet) - [Deploy Giver contract](#deploy-giver-contract) @@ -19,6 +20,17 @@ Working with DevNet is similar to working with SE except you usually don't have In order to deploy the Giver, do the following steps, like for an ordinary contract: +### Get your Devnet credentials + +First, go to https://www.evercloud.dev/ and register in the dashboard. +Follow this instruction: https://docs.evercloud.dev/products/evercloud/get-started. +Save your project ID and secret, if you enabled it. + +Now, run this command. Specifying secret is optional - only if you enabled it: +``` +$ everdev network credentials dev --project "Project Id" --access-key "Project secret" +``` + ### Generate Giver keys ``` @@ -31,29 +43,20 @@ test (Default) de101cde5c94540926fe862e965cf109b1b803989e7048657cf7c4caaa2a2 devnet_giver_keys 5a343ccbd62c15e3df1076bc34957ad2717469d84e4d6b3ef26112db80ac8e1b ``` -### Compile Giver code +### Get giver code -You can find compiled giver v2 contract with code [here](https://github.com/tonlabs/evernode-se/tree/master/contracts/giver_v2). You need to recompile code only if you want to change its code, so you can use compiled `GiverV2.tvc` file and move to the next step. - -**Attention!** -The code in repo is not compatible with the latest Solidity compilers, so if you would like to compile it yourself, you would need to migrate code to the latest Solidity version first. - -After modifying code, compile it: -``` -$ everdev sol compile GiverV2.sol -``` -In a case of success, compiler will generate two files: compiled code (`GiverV2.tvc`) and ABI (`GiverV2.abi.json`). You need these files for the next steps. +You can find the compiled giver v3 contract [here](https://github.com/tonlabs/evernode-se/tree/master/contracts/giver_v3). You will need `GiverV3.tvc` file. ### Calculate Giver address In order to deploy contract, you need to know its address: ``` -$ everdev contract info -n dev -s devnet_giver_keys GiverV2.tvc +$ everdev contract info -n dev -s devnet_giver_keys GiverV3.tvc Configuration - Network: dev (net.ton.dev, net1.ton.dev, net5.ton.dev) + Network: dev Signer: devnet_giver_keys (public 5a343ccbd62c15e3df1076bc34957ad2717469d84e4d6b3ef26112db80ac8e1b) Address: 0:93139197f2f58d674bee4ee71a42d8f1e7b6a3c3e041ded7a54d330bcc44f3b3 (calculated from TVC and signer public) @@ -75,14 +78,14 @@ Wait for operation completion. Check address balance in [Blockchain Explorer](ht ### Deploy Giver contract -For contract deployment you need to have compiled contract files (`GiverV2.tvc` and `GiverV2.abi.json`) and giver keys. To deploy contract execute next command: +For contract deployment you need to have compiled contract files (`GiverV3.tvc` and `GiverV3.abi.json`) and giver keys. To deploy contract execute next command: ``` -$ everdev contract deploy -n dev -s devnet_giver_keys GiverV2.tvc +$ everdev contract deploy -n dev -s devnet_giver_keys GiverV3.tvc Configuration - Network: dev (eri01.net.everos.dev, rbx01.net.everos.dev, gra01.net.everos.dev) + Network: dev Signer: devnet_giver_keys (public 5a343ccbd62c15e3df1076bc34957ad2717469d84e4d6b3ef26112db80ac8e1b) Address: 0:93139197f2f58d674bee4ee71a42d8f1e7b6a3c3e041ded7a54d330bcc44f3b3 (calculated from TVC and signer public) @@ -98,20 +101,20 @@ Done, now you have your own Giver, deployed to the DevNet! Let's configure `ever For convenience, you might need to configure `everdev` in order to use your Giver as default. To do it, execute the next command (change address to your Giver's address, obtained on previous steps): ``` -$ everdev network giver dev 0:93139197f2f58d674bee4ee71a42d8f1e7b6a3c3e041ded7a54d330bcc44f3b3 --signer devnet_giver_keys +$ everdev n g dev 0:93139197f2f58d674bee4ee71a42d8f1e7b6a3c3e041ded7a54d330bcc44f3b3 --signer devnet_giver_keys --type GiverV3 ``` Check: ``` -$ everdev n l -Network Endpoints Giver ------------- ----------------------------------------------- ------------------------------------------------------------------ -se (Default) http://localhost 0:b5e9240fc2d2f1ff8cbb1d1dee7fb7cae155e5f6320e585fcc685698994a19a5 - GiverV2 -dev eri01.net.everos.dev, rbx01.net.everos.dev, gra01.net.everos.dev 0:93139197f2f58d674bee4ee71a42d8f1e7b6a3c3e041ded7a54d330bcc44f3b3 - GiverV2 signed by devnet_giver_keys -main eri01.main.everos.dev, gra01.main.everos.dev, gra02.main.everos.dev ... +everdev n l +Network Endpoints Giver +------------ --------------------- ------------------------------------------------------------------ +se (Default) http://localhost 0:ece57bcc6c530283becbbd8a3b24d3c5987cdddc3c8b7b33be6e4a6312490415 + GiverV3 signed by seGiver +dev devnet.evercloud.dev 0:93139197f2f58d674bee4ee71a42d8f1e7b6a3c3e041ded7a54d330bcc44f3b3 + GiverV3 signed by devnet_giver_keys +main mainnet.evercloud.dev ``` If Giver is set, you will see you Giver's address and keypair name for the `dev` network. @@ -125,7 +128,7 @@ $ everdev contract topup --network dev --address
--value 10000 Configuration - Network: dev (eri01.net.everos.dev, rbx01.net.everos.dev, gra01.net.everos.dev) + Network: dev Signer: test (public de101cde5c94540926fe862e965cf109b1b803989e7048657cf7c4caaa2a257d) Address:
diff --git a/package.json b/package.json index cdbc0c6..4e3f894 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "everdev", - "version": "1.5.1", + "version": "1.6.0", "description": "Everscale Dev Environment", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -46,8 +46,8 @@ }, "dependencies": { "@eversdk/appkit": "^0.3.4", - "@eversdk/core": "^1.39.0", - "@eversdk/lib-node": "^1.39.0", + "@eversdk/core": "^1.41.1", + "@eversdk/lib-node": "^1.41.1", "chalk": "^2.4.2", "dockerode": "^3.3.1", "fs-extra": "^9.1.0", diff --git a/src/__tests__/parser.ts b/src/__tests__/parser.ts index b2894f9..28bc767 100644 --- a/src/__tests__/parser.ts +++ b/src/__tests__/parser.ts @@ -6,6 +6,7 @@ import { solidityCreateCommand, } from "../controllers/solidity" +import { NetworkTool, networkGiverCommand } from "../controllers/network" beforeAll(initTests) afterAll(doneTests) @@ -98,3 +99,72 @@ test("everdev create a.sol b.sol, should throw", async () => { expect(err.message).toMatch(/Unexpected argument/) } }) + +test("everdev network add giver with address in negative workchain", async () => { + const parser = new CommandLine() + await parser.parse([ + "network", + "giver", + "networkName", + "-2:1111111111111111111111111111111111111111111111111111111111111111", + "-s", + "seGiver", + "-t", + "GiverV1", + ]) + const { controller, command, args } = parser + expect(controller).toEqual(NetworkTool) + expect(command).toEqual(networkGiverCommand) + expect(args).toEqual({ + name: "networkName", + address: + "-2:1111111111111111111111111111111111111111111111111111111111111111", + signer: "seGiver", + type: "GiverV1", + value: "", + }) +}) + +test("everdev network add giver with address in positive workchain", async () => { + const parser = new CommandLine() + await parser.parse([ + "network", + "giver", + "networkName", + "0:1111111111111111111111111111111111111111111111111111111111111111", + "-s", + "seGiver", + "-t", + "GiverV1", + ]) + const { controller, command, args } = parser + expect(controller).toEqual(NetworkTool) + expect(command).toEqual(networkGiverCommand) + expect(args).toEqual({ + name: "networkName", + address: + "0:1111111111111111111111111111111111111111111111111111111111111111", + signer: "seGiver", + type: "GiverV1", + value: "", + }) +}) + +test("everdev network add giver with malformed address in negative workchain", async () => { + const parser = new CommandLine() + try { + await parser.parse([ + "network", + "giver", + "networkName", + "-1w:123", + "-s", + "seGiver", + "-t", + "GiverV1", + ]) + throw Error("Shouldn't resolve!") + } catch (err) { + expect(err.message).toMatch(/Unknown option/) + } +}) diff --git a/src/cli/index.ts b/src/cli/index.ts index 1196307..f5324ed 100644 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -143,11 +143,17 @@ export class CommandLine { } } } - async parse(programArgs: string[]) { for (let i = 0; i < programArgs.length; i++) { let arg = programArgs[i] - if (arg.startsWith("-") && !this.pending) { + if ( + arg.startsWith("-") && + !this.pending && + // exclude positional parameters - addressess in negative workchains. + // Don't require 64 digits after ':', thus repeating parser behavior + // for addresses in positive working chains + /^-[0-9a-f]+:/.test(arg) === false + ) { await this.parseOptionName(arg) } else { arg = arg.trim() diff --git a/src/controllers/contract/accounts.ts b/src/controllers/contract/accounts.ts index 549bf2a..5faa2ff 100644 --- a/src/controllers/contract/accounts.ts +++ b/src/controllers/contract/accounts.ts @@ -25,9 +25,18 @@ export async function getAccount( signer: string data: string address?: string + workchain?: string }, ): Promise { const address = args.address ?? "" + const abiConfig = + address === "" && args.workchain + ? { + abi: { + workchain: parseInt(args.workchain) || 0, + }, + } + : {} const network = new NetworkRegistry().get(args.network) const { project, accessKey } = network.credentials || {} const client = new TonClient({ @@ -36,6 +45,7 @@ export async function getAccount( ...(accessKey ? { access_key: accessKey } : {}), }, + ...abiConfig, }) const contract = args.file !== "" diff --git a/src/controllers/contract/index.ts b/src/controllers/contract/index.ts index a465353..24adc13 100644 --- a/src/controllers/contract/index.ts +++ b/src/controllers/contract/index.ts @@ -145,11 +145,26 @@ const preventUiOpt: CommandArg = { defaultValue: "false", } +const workchainOpt: CommandArg = { + name: "workchain", + alias: "w", + title: "Workchain. Default is 0", + type: "string", + defaultValue: "0", +} + export const contractInfoCommand: Command = { name: "info", alias: "i", title: "Prints contract summary", - args: [infoFileArg, networkOpt, signerOpt, dataOpt, addressOpt], + args: [ + infoFileArg, + networkOpt, + workchainOpt, + signerOpt, + dataOpt, + addressOpt, + ], async run( terminal: Terminal, args: { @@ -158,6 +173,7 @@ export const contractInfoCommand: Command = { signer: string data: string address: string + workchain: string }, ) { if (args.file === "" && args.address === "") { @@ -204,6 +220,7 @@ export const contractDeployCommand: Command = { args: [ abiFileArg, networkOpt, + workchainOpt, signerOpt, functionArg, inputOpt, @@ -222,6 +239,7 @@ export const contractDeployCommand: Command = { data: string value: string preventUi: boolean + workchain: string }, ) { let account = await getAccount(terminal, args) @@ -336,7 +354,15 @@ export const contractTopUpCommand: Command = { name: "topup", alias: "t", title: "Top up account from giver", - args: [infoFileArg, addressOpt, networkOpt, signerOpt, dataOpt, valueOpt], + args: [ + infoFileArg, + addressOpt, + networkOpt, + workchainOpt, + signerOpt, + dataOpt, + valueOpt, + ], async run( terminal: Terminal, args: { @@ -346,6 +372,7 @@ export const contractTopUpCommand: Command = { signer: string data: string value: string + workchain: string }, ) { if (args.file === "" && args.address === "") { @@ -394,6 +421,7 @@ export const contractRunCommand: Command = { args: [ abiFileArg, networkOpt, + workchainOpt, signerOpt, runSignerOpt, dataOpt, @@ -414,6 +442,7 @@ export const contractRunCommand: Command = { function: string input: string preventUi: boolean + workchain: string }, ) { const account = await getAccount(terminal, args) @@ -446,6 +475,7 @@ export const contractRunLocalCommand: Command = { args: [ abiFileArg, networkOpt, + workchainOpt, signerOpt, runSignerOpt, dataOpt, @@ -466,6 +496,7 @@ export const contractRunLocalCommand: Command = { function: string input: string preventUi: boolean + workchain: string }, ) { const account = await getAccount(terminal, args) @@ -501,6 +532,7 @@ export const contractRunExecutorCommand: Command = { args: [ abiFileArg, networkOpt, + workchainOpt, signerOpt, runSignerOpt, dataOpt, @@ -521,6 +553,7 @@ export const contractRunExecutorCommand: Command = { function: string input: string preventUi: boolean + workchain: string }, ) { const account = await getAccount(terminal, args) @@ -543,7 +576,7 @@ export const contractDecodeAccountDataCommand: Command = { name: "decode-data", alias: "dd", title: "Decode data from a contract deployed on the network", - args: [abiFileArg, networkOpt, addressOpt], + args: [abiFileArg, networkOpt, workchainOpt, addressOpt], async run( terminal: Terminal, args: { @@ -552,6 +585,7 @@ export const contractDecodeAccountDataCommand: Command = { signer: string data: string address: string + workchain: string }, ) { if (args.file === "" && args.address === "") { @@ -580,8 +614,8 @@ export const contractDecodeAccountDataCommand: Command = { }, } -export const contractDecodeTvcCommand: Command = { - name: "decode-tvc", +export const contractDecodeStateinitCommand: Command = { + name: "decode-stateinit", alias: "dt", title: "Decode tvc into code, data, libraries and special options", args: [tvcFileArg], @@ -620,7 +654,7 @@ export const Contract: ToolController = { commands: [ contractInfoCommand, contractDecodeAccountDataCommand, - contractDecodeTvcCommand, + contractDecodeStateinitCommand, contractTopUpCommand, contractDeployCommand, contractRunCommand, diff --git a/src/controllers/contract/run.ts b/src/controllers/contract/run.ts index c449d51..3cd641b 100644 --- a/src/controllers/contract/run.ts +++ b/src/controllers/contract/run.ts @@ -18,7 +18,9 @@ export async function resolveFunction( functionName: string, preventUi: boolean, ): Promise { - const functions = account.contract.abi.functions ?? [] + const functions = (account.contract.abi.functions ?? []).filter( + fn => fn.name !== "constructor", + ) functionName = functionName.trim() while (functionName === "" && !preventUi) { terminal.log("\nAvailable functions:\n") diff --git a/src/controllers/js/index.ts b/src/controllers/js/index.ts index 7c5e09a..1d43a26 100644 --- a/src/controllers/js/index.ts +++ b/src/controllers/js/index.ts @@ -9,7 +9,7 @@ import { jsWrapCommand } from "./wrap" export const jsCreateCommand: Command = { name: "create", alias: "c", - title: "Create FreeTON JS App", + title: "Create Everscale JS App", args: [ { isArg: true, @@ -36,7 +36,7 @@ export const jsCreateCommand: Command = { export const jsDemoCommand: Command = { name: "demo", - title: "Download FreeTON Demo", + title: "Download Everscale Demo", args: [ { isArg: true, diff --git a/src/controllers/network/giver.ts b/src/controllers/network/giver.ts index f14eac2..dcb63ef 100644 --- a/src/controllers/network/giver.ts +++ b/src/controllers/network/giver.ts @@ -32,7 +32,6 @@ async function giverV1Send( await giver.run("sendGrams", { dest: address, amount: value, - bounce: false, }) } diff --git a/src/controllers/network/index.ts b/src/controllers/network/index.ts index f265b55..a3e6e6f 100644 --- a/src/controllers/network/index.ts +++ b/src/controllers/network/index.ts @@ -158,7 +158,7 @@ export const networkGiverCommand: Command = { { name: "type", alias: "t", - title: "Type giver contract (GiverV1 | GiverV2 | GiverV3 | SafeMultisigWallet | SetcodeMultisigWallet)", + title: "Type giver contract (listed below)", type: "string", getVariants(): CommandArgVariant[] | Promise { return KnownContractNames.map(x => ({ value: x })) diff --git a/src/controllers/network/registry.ts b/src/controllers/network/registry.ts index e298f51..ad4f85b 100644 --- a/src/controllers/network/registry.ts +++ b/src/controllers/network/registry.ts @@ -126,7 +126,7 @@ export class NetworkRegistry { endpoints: ["mainnet.evercloud.dev"], }, ] - this.default = "dev" + this.default = "se" } } diff --git a/src/controllers/signer/registry.ts b/src/controllers/signer/registry.ts index cad3ca4..8720faa 100644 --- a/src/controllers/signer/registry.ts +++ b/src/controllers/signer/registry.ts @@ -8,6 +8,7 @@ import { signerKeys, signerNone, TonClient, + MnemonicDictionary, } from "@eversdk/core" import { NetworkRegistry } from "../network/registry" import { @@ -34,18 +35,6 @@ export const SE_DEFAULT_GIVER_SIGNER: SignerRegistryItem = { }, } -export enum MnemonicDictionary { - ton = 0, - english = 1, - chineseSimplified = 2, - chineseTraditional = 3, - french = 4, - italian = 5, - japanese = 6, - korean = 7, - spanish = 8, -} - export type SignerRegistryItem = { name: string description: string @@ -83,6 +72,10 @@ export class SignerRegistry { } if (!this.items.find(x => x.name === SE_DEFAULT_GIVER_SIGNER.name)) { this.items.push(SE_DEFAULT_GIVER_SIGNER) + // If GiverSE is only giver, set it default + if (this.items.length == 1) { + this.default = SE_DEFAULT_GIVER_SIGNER.name + } } } diff --git a/src/controllers/sold/index.ts b/src/controllers/sold/index.ts index ad1a307..1a8944b 100644 --- a/src/controllers/sold/index.ts +++ b/src/controllers/sold/index.ts @@ -1,3 +1,4 @@ +import chalk from "chalk" import { Command, Component, Terminal, ToolController } from "../../core" import { components } from "./components" @@ -6,6 +7,12 @@ export const soldVersionCommand: Command = { title: "Show Sold Version", async run(terminal: Terminal): Promise { terminal.log(await Component.getInfoAll(components)) + terminal.log( + chalk.yellow( + "\nYou can find the list of stable sold versions in Solidity Compiler changelog:" + + "\nhttps://github.com/tonlabs/TON-Solidity-Compiler/blob/master/Changelog_TON.md", + ), + ) }, } diff --git a/src/controllers/solidity/index.ts b/src/controllers/solidity/index.ts index b14b0b1..18ca583 100644 --- a/src/controllers/solidity/index.ts +++ b/src/controllers/solidity/index.ts @@ -1,3 +1,4 @@ +import chalk from "chalk" import { Command, Component, Terminal, ToolController } from "../../core" import path from "path" import { @@ -44,6 +45,12 @@ export const solidityVersionCommand: Command = { title: "Show Solidity Version", async run(terminal: Terminal): Promise { terminal.log(await Component.getInfoAll(components)) + terminal.log( + chalk.yellow( + "\nYou can find the list of stable solc versions in Solidity Compiler changelog:" + + "\nhttps://github.com/tonlabs/TON-Solidity-Compiler/blob/master/Changelog_TON.md", + ), + ) }, } @@ -105,7 +112,7 @@ export const solidityCompileCommand: Command = { name: "include-path", alias: "i", type: "folder", - title: "Additional path(s) for inputs (node_modules is default)", + title: "Additional path(s) for inputs (required solc 0.57.0 or higher), node_modules is default", defaultValue: "node_modules", }, ], @@ -169,8 +176,7 @@ export const solidityCompileCommand: Command = { await components.compiler.silentRun(terminal, fileDir, [ "-o", outputDir, - "-i", - ...includePath, + ...(await addIncludePathOption(includePath)), fileName, ]) linkerOut = await components.linker.silentRun( @@ -233,7 +239,7 @@ export const solidityAstCommand: Command = { name: "include-path", alias: "i", type: "folder", - title: "Additional path(s) for inputs (node_modules is default)", + title: "Additional path(s) for inputs (required solc 0.57.0 or higher), node_modules is default", defaultValue: "node_modules", }, ], @@ -266,8 +272,7 @@ export const solidityAstCommand: Command = { `--ast-${args.format}`, "--output-dir", args.outputDir, - "--include-path", - ...includePath, + ...(await addIncludePathOption(includePath)), fileName, ]) } @@ -354,3 +359,8 @@ export const Solidity: ToolController = { solidityUpdateCommand, ], } +async function addIncludePathOption(paths: string[]) { + return (await components.compiler.getCurrentVersion()) >= "0.57.0" + ? ["--include-path", ...paths] + : [] +} diff --git a/src/core/component.ts b/src/core/component.ts index 1db5da6..b8e34c7 100644 --- a/src/core/component.ts +++ b/src/core/component.ts @@ -116,9 +116,6 @@ export class Component { if (runTerminal.stdout !== "") { terminal.write(runTerminal.stdout) } - if (runTerminal.stderr !== "") { - terminal.writeError(runTerminal.stderr) - } throw error } } diff --git a/src/core/known-contracts.ts b/src/core/known-contracts.ts index 4ab6c23..4050aa4 100644 --- a/src/core/known-contracts.ts +++ b/src/core/known-contracts.ts @@ -117,6 +117,8 @@ const KnownContractsByCodeHash: { [codeHash: string]: KnownContract } = { KnownContracts.GiverV2, ccbfc821853aa641af3813ebd477e26818b51e4ca23e5f6d34509215aa7123d9: KnownContracts.GiverV2, + "5534bff04d2d0a14bb2257ec23027947c722159486ceff9e408d6a4d796a0989": + KnownContracts.GiverV3, e2b60b6b602c10ced7ea8ede4bdf96342c97570a3798066f3fb50a4b2b27a208: KnownContracts.SetcodeMultisigWallet, "207dc560c5956de1a2c1479356f8f3ee70a59767db2bf4788b1d61ad42cdad82":