-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #146 from tonlabs/1.5.0-rc
Version 1.5.0
- Loading branch information
Showing
18 changed files
with
239 additions
and
7,876 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -116,3 +116,5 @@ dist | |
.yarn/build-state.yml | ||
.yarn/install-state.gz | ||
.pnp.* | ||
.idea | ||
/package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { doneTests, initTests } from "./init" | ||
import path from "path" | ||
import { ParamParser } from "../controllers/contract/param-parser" | ||
|
||
beforeAll(initTests) | ||
afterAll(doneTests) | ||
|
||
function dataPath(name: string): string { | ||
return path.resolve(__dirname, "..", "..", "src", "__tests__", "data", name) | ||
} | ||
|
||
test("Contract alone args file", async () => { | ||
const file = dataPath("contracts-input-alone.json") | ||
const abi = { name: "a", type: "string[]" } | ||
const args = ParamParser.components(abi, `@${file}`) | ||
expect(args).toEqual([1, 2, 3]) | ||
}) | ||
|
||
test("Contract multi args file", async () => { | ||
const file = dataPath("contracts-input.json") | ||
const abi = { name: "a", type: "string[]" } | ||
const args = ParamParser.components(abi, `@${file}@test1`) | ||
expect(args).toEqual({ a: [1, 2, 3] }) | ||
const args2 = ParamParser.components(abi, `@${file}@test2`) | ||
expect(args2).toEqual({ b: [1, 2, 3] }) | ||
const args3 = ParamParser.components(abi, `@${file}@test2.b`) | ||
expect(args3).toEqual([1, 2, 3]) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[1, 2, 3] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"test1": { | ||
"a": [1, 2, 3] | ||
}, | ||
"test2": { | ||
"b": [1, 2, 3] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
import { Command, CommandArg, Terminal, ToolController } from "../../core" | ||
import { resolveContract, resolveTvcAsBase64 } from "../../core/utils" | ||
import { | ||
resolveContract, | ||
resolveTvcAsBase64, | ||
} from "../../core/solFileResolvers" | ||
import { Account, AccountType } from "@eversdk/appkit" | ||
import { TonClient } from "@eversdk/core" | ||
import { getAccount } from "./accounts" | ||
|
@@ -75,14 +78,35 @@ const functionArg: CommandArg = { | |
defaultValue: "", | ||
} | ||
|
||
const JSON_ARG_DESCR = ` | ||
Value is resolved to the JSON object. Can be provided in several variants: | ||
- \`name:value\` pairs. | ||
Array values must be specified as [item,...]. | ||
Spaces are not allowed. If value contains spaces or special symbols "[],:" it must be enclosed in "" or ''. | ||
Example: \`'foo:1,bar:"2",baz:[1,2,3]'\`. | ||
Result: \`{ foo: 1, bar: "2", baz: [1, 2, 3] }\`. | ||
- \`{ name: value, ... }\` – JSON object. | ||
Example: \`'{foo:1,bar:"2",baz:[1,2,3]}\`. | ||
Result: \`{ foo: 1, bar: "2", baz: [1, 2, 3] }\`. | ||
- \`@file\` – JSON object loaded from the specified file. | ||
Example: \`@./args.json\`. | ||
File args.json: \`{ foo: 1, bar: "2", baz: [1, 2, 3] }\`. | ||
Result: \`{ foo: 1, bar: "2", baz: [1, 2, 3] }\`. | ||
- \`@file@field\` – specified field of the JSON object loaded from the specified file. | ||
\`field\` is a path to nested field separated by \`.\` (e.g. \`foo.bar.baz\`). | ||
Example: \`@./args.json@f1\`. | ||
File args.json: \`{ f1: { foo: 1, bar: "2", baz: [1, 2, 3] } }\`. | ||
Result: \`{ foo: 1, bar: "2", baz: [1, 2, 3] }\`. | ||
Example: \`@./[email protected]\`. | ||
File args.json: \`{ f1: { foo: 1, bar: "2", baz: [1, 2, 3] } }\`. | ||
Result: \`[1, 2, 3]\`. | ||
` | ||
|
||
const inputOpt: CommandArg = { | ||
name: "input", | ||
alias: "i", | ||
title: "Function parameters as name:value,...", | ||
description: | ||
"Array values must be specified as [item,...]. " + | ||
'Spaces are not allowed. If value contains spaces or special symbols "[],:" ' + | ||
"it must be enclosed in \"\" or ''", | ||
description: `Value for function parameters.${JSON_ARG_DESCR}`, | ||
type: "string", | ||
defaultValue: "", | ||
} | ||
|
@@ -93,9 +117,7 @@ const dataOpt: CommandArg = { | |
title: "Deploying initial data as name:value,...", | ||
description: | ||
"This data is required to calculate the account address and to deploy contract.\n" + | ||
"Array values must be specified as [item,...]. " + | ||
'Spaces are not allowed. If value contains spaces or special symbols "[],:" ' + | ||
"it must be enclosed in \"\" or ''", | ||
JSON_ARG_DESCR, | ||
type: "string", | ||
defaultValue: "", | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.