From 27d0af1929d541000a57efbf8541ccdb59036e3e Mon Sep 17 00:00:00 2001 From: ennucore Date: Sat, 7 Jan 2023 23:40:29 +0100 Subject: [PATCH] Agorata CLI --- bin/cli.js | 52 +++++ contracts/main.ts | 4 +- contracts/nft-collection.fc | 4 - package-lock.json | 436 +++++++++++++++++++++++++++--------- package.json | 9 +- test/signing.spec.ts | 11 +- 6 files changed, 397 insertions(+), 119 deletions(-) create mode 100644 bin/cli.js diff --git a/bin/cli.js b/bin/cli.js new file mode 100644 index 0000000..29564e2 --- /dev/null +++ b/bin/cli.js @@ -0,0 +1,52 @@ +const main = require('../contracts/main'); +const subcommand = require('subcommand'); +const {Address} = require("ton"); +const {keyPairFromSeed, getSecureRandomBytes} = require("ton-crypto"); + + +const argv = process.argv.slice(2); +let commands = [ + { + name: 'sign-message', + options: [ // cliclopts options + // { + // name: 'loud', + // boolean: true, + // default: false, + // abbr: 'v', + // help: 'print out all output loudly' + // } + { + name: 'domain' + }, + { + name: 'collection' + }, + { + name: 'buyer', + help: 'Buyer\'s address' + }, + { + name: 'key', + help: 'Secret key, hex-encoded' + } + ], + command: function sign_message(args) { + let key = Buffer.from(args.key, 'hex'); + let collection = Address.parse(args.collection); + let buyer = Address.parse(args.buyer); + let signature = main.signBuy(args.domain, collection, buyer, key); + console.log(signature); + } + }, + { + name: 'keygen', + command: async function keygen(args) { + let keypair = keyPairFromSeed(await getSecureRandomBytes(32)); + console.log(keypair.secretKey.toString('hex')); + } + } +] + +let match = subcommand(commands); +let opts = match(argv); \ No newline at end of file diff --git a/contracts/main.ts b/contracts/main.ts index 075038e..af265aa 100644 --- a/contracts/main.ts +++ b/contracts/main.ts @@ -1,6 +1,6 @@ import BN from "bn.js"; -import {Cell, beginCell, Address, Slice} from "ton"; -import {C7Config, SmartContract} from "ton-contract-executor"; +import {Cell, beginCell, Address} from "ton"; +import {SmartContract} from "ton-contract-executor"; import {encodeOffChainContent, makeSnakeCell} from "./utils"; import {randomBytes} from "crypto"; import {keyPairFromSeed, KeyPair, sign, keyPairFromSecretKey} from "ton-crypto"; diff --git a/contracts/nft-collection.fc b/contracts/nft-collection.fc index 9ae5936..90061c9 100644 --- a/contracts/nft-collection.fc +++ b/contracts/nft-collection.fc @@ -175,10 +175,6 @@ int signature_data(slice sender_address, slice domain) method_id { return slice_hash(option_data.begin_parse()); } -slice getaddr() method_id { - return my_address(); -} - (int, cell) dnsresolve(slice subdomain, int category) method_id { throw_unless(70, mod(slice_bits(subdomain), 8) == 0); diff --git a/package-lock.json b/package-lock.json index 487f5b6..1112cce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,10 +10,12 @@ "hasInstallScript": true, "license": "MIT", "dependencies": { - "semver": "^7.3.7" + "semver": "^7.3.7", + "subcommand": "^2.1.1", + "ton-compiler": "^2.0.0" }, "devDependencies": { - "@swc/core": "^1.2.177", + "@swc/core": "^1.3.25", "@types/bn.js": "^5.1.0", "@types/chai": "^4.3.0", "@types/mocha": "^9.0.0", @@ -26,11 +28,7 @@ "mocha": "^9.1.3", "prando": "^6.0.1", "prettier": "^2.6.2", -<<<<<<< HEAD - "ton": "^12.1.3", -======= "ton": "^12.3.3", ->>>>>>> 86256c1adcbfda00056134b79ec21cf6bbba0db2 "ton-contract-executor": "^0.4.8", "ton-crypto": "^3.1.0", "ts-node": "^10.4.0", @@ -120,14 +118,11 @@ "hasInstallScript": true }, "node_modules/@swc/core": { - "version": "1.3.24", - "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.3.24.tgz", - "integrity": "sha512-QMOTd0AgiUT3K1crxLRqd3gw0f3FC8hhH1vvlIlryvYqU4c+FJ/T2G4ZhMKLxQlZ/jX6Rhk0gKINZRBxy2GFyQ==", + "version": "1.3.25", + "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.3.25.tgz", + "integrity": "sha512-wqzvM/wu6OsTVYPMStOpm7kIQcPX3GoZ0sC85qzDdsCxmJ1rmItLAD91sXPUmmdk0XqPYjLgT9MRDEIP5woz4g==", "dev": true, "hasInstallScript": true, - "bin": { - "swcx": "run_swcx.js" - }, "engines": { "node": ">=10" }, @@ -136,22 +131,38 @@ "url": "https://opencollective.com/swc" }, "optionalDependencies": { - "@swc/core-darwin-arm64": "1.3.24", - "@swc/core-darwin-x64": "1.3.24", - "@swc/core-linux-arm-gnueabihf": "1.3.24", - "@swc/core-linux-arm64-gnu": "1.3.24", - "@swc/core-linux-arm64-musl": "1.3.24", - "@swc/core-linux-x64-gnu": "1.3.24", - "@swc/core-linux-x64-musl": "1.3.24", - "@swc/core-win32-arm64-msvc": "1.3.24", - "@swc/core-win32-ia32-msvc": "1.3.24", - "@swc/core-win32-x64-msvc": "1.3.24" + "@swc/core-darwin-arm64": "1.3.25", + "@swc/core-darwin-x64": "1.3.25", + "@swc/core-linux-arm-gnueabihf": "1.3.25", + "@swc/core-linux-arm64-gnu": "1.3.25", + "@swc/core-linux-arm64-musl": "1.3.25", + "@swc/core-linux-x64-gnu": "1.3.25", + "@swc/core-linux-x64-musl": "1.3.25", + "@swc/core-win32-arm64-msvc": "1.3.25", + "@swc/core-win32-ia32-msvc": "1.3.25", + "@swc/core-win32-x64-msvc": "1.3.25" + } + }, + "node_modules/@swc/core-darwin-arm64": { + "version": "1.3.25", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.25.tgz", + "integrity": "sha512-8PWAVcjTJyj2VrqPBFOIi2w2P0Z8kOCbzHW3+pe+bSXxfGMG0MKPl5U2IXhsEL0ovm4xSFlqW0yygpoP3MmRPw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=10" } }, "node_modules/@swc/core-darwin-x64": { - "version": "1.3.24", - "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.3.24.tgz", - "integrity": "sha512-px+5vkGtgPH0m3FkkTBHynlRdS5rRz+lK+wiXIuBZFJSySWFl6RkKbvwkD+sf0MpazQlqwlv/rTOGJBw6oDffg==", + "version": "1.3.25", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.3.25.tgz", + "integrity": "sha512-5DHGiMYFEj5aa208tCjo7Sn5tiG4xPz+4gUiWVlglxqXFptkNim5xu/1G6VYm5Zk7dI5jJkjTU76GQG7IRvPug==", "cpu": [ "x64" ], @@ -164,6 +175,134 @@ "node": ">=10" } }, + "node_modules/@swc/core-linux-arm-gnueabihf": { + "version": "1.3.25", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.25.tgz", + "integrity": "sha512-YNfLxv9PhZk+jrJbpR1mMrYBUkufo0hiFv3S1OrX3l8edsIP4wPND5w9ZH0Oi898f6Jg9DBrY2zXJMQ+gWkbvA==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-linux-arm64-gnu": { + "version": "1.3.25", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.25.tgz", + "integrity": "sha512-kS+spM5/xQ6QvWF1ms3byfjnhUlpjTfFwgCyHnIKgjvsYkDa+vkAIhKq6HuEdaTPaCRCjts0Zarhub1nClUU0g==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-linux-arm64-musl": { + "version": "1.3.25", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.25.tgz", + "integrity": "sha512-vM3D7LWmjotUAJ2D4F+L+dspFeWrcPNVh0o8TCoTOYCt8DPD5YsUKTpIgOsZ+gReeWUAnNTh0Btx5pGGVfajGA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-linux-x64-gnu": { + "version": "1.3.25", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.25.tgz", + "integrity": "sha512-xUCLLMDlYa/zB8BftVa4SrxuVpcDxkltCfmBg5r2pZPVskhC5ZJsQZ/AvWNChoAB11shRhjTaWDlmxJEsa7TIg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-linux-x64-musl": { + "version": "1.3.25", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.25.tgz", + "integrity": "sha512-QzHU3BIaUVRSFNsUn3Qxx1vgtF/f5NqsFMAAPSq9Y8Yq5nrlc2t7cNuOROxHLbUqE+NPUp6+RglleJMoeWz5mA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-win32-arm64-msvc": { + "version": "1.3.25", + "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.25.tgz", + "integrity": "sha512-77VSVtneVOAUL4zkRyQZ6pWVpTsVVdqwly/DKnRnloglGKxYuk5DG5MUBsL72Nnfv4OCHjZ27eI3NUrpLsUb2Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-win32-ia32-msvc": { + "version": "1.3.25", + "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.25.tgz", + "integrity": "sha512-kz0v3K3H6OPEZR3ry72Ad/6C5GrZBRRUk69K58LORQ8tZXQD3UGl85pUbQqyHl8fR5NU76Muxgovj9CI9iTHGA==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-win32-x64-msvc": { + "version": "1.3.25", + "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.25.tgz", + "integrity": "sha512-nmQOAzIpNRRnupWzkenJmW4i+h1M76cVNUqEU2MjmtesEkRZEGqv//jefXiyCP2zcbeLNLKiB2ptVJhpd1BvRA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=10" + } + }, "node_modules/@tsconfig/node10": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", @@ -307,8 +446,7 @@ "node_modules/arg": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz", - "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==", - "dev": true + "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==" }, "node_modules/argparse": { "version": "2.0.1", @@ -358,8 +496,7 @@ "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, "node_modules/binary-extensions": { "version": "2.2.0", @@ -381,7 +518,6 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -509,6 +645,11 @@ "fsevents": "~2.3.2" } }, + "node_modules/cliclopts": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/cliclopts/-/cliclopts-1.1.1.tgz", + "integrity": "sha512-dJk8y+TJmOy9Kqha0aWN0rwM5E5EQCVjhl2GTz1CrkqzxkQZ26/hyrNmy7lwePdZc4iNcdHL1tTdcIBeNQhmww==" + }, "node_modules/cliui": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", @@ -553,8 +694,7 @@ "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" }, "node_modules/create-require": { "version": "1.1.1", @@ -572,7 +712,6 @@ "version": "4.3.3", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", - "dev": true, "dependencies": { "ms": "2.1.2" }, @@ -588,8 +727,7 @@ "node_modules/debug/node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, "node_modules/decamelize": { "version": "4.0.0", @@ -794,8 +932,7 @@ "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" }, "node_modules/fsevents": { "version": "2.3.2", @@ -833,7 +970,6 @@ "version": "7.2.0", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", - "dev": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -865,7 +1001,6 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, "dependencies": { "brace-expansion": "^1.1.7" }, @@ -904,7 +1039,6 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dev": true, "dependencies": { "once": "^1.3.0", "wrappy": "1" @@ -913,8 +1047,7 @@ "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "node_modules/io-ts": { "version": "2.2.20", @@ -1159,6 +1292,14 @@ "node": ">=10" } }, + "node_modules/minimist": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", + "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/mocha": { "version": "9.2.2", "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.2.2.tgz", @@ -1253,7 +1394,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, "dependencies": { "wrappy": "1" } @@ -1301,7 +1441,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -1424,7 +1563,6 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, "dependencies": { "glob": "^7.1.3" }, @@ -1552,6 +1690,16 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/subcommand": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/subcommand/-/subcommand-2.1.1.tgz", + "integrity": "sha512-cm7TQq9I8dA5LKUr+r8W7RzQlLsmTdCr6wXmjYueOoh/bQu55ODEw7GFhT42pUyoaLtO2rgmx1+8cSIjY9lR9g==", + "dependencies": { + "cliclopts": "^1.1.0", + "debug": "^4.1.1", + "minimist": "^1.2.0" + } + }, "node_modules/supports-color": { "version": "8.1.1", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", @@ -1583,7 +1731,6 @@ "version": "0.2.1", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==", - "dev": true, "dependencies": { "rimraf": "^3.0.0" }, @@ -1623,17 +1770,14 @@ } }, "node_modules/ton-compiler": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/ton-compiler/-/ton-compiler-0.9.0.tgz", - "integrity": "sha512-7ZyjmSSmI8s/hd+H3c8qCzvUxDWLml4T8Lhr3DNAucadWhAXiVniTgPHHQNt5nbfZMvHKGevGw18pRkf5cFBZA==", - "dev": true, + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ton-compiler/-/ton-compiler-2.0.0.tgz", + "integrity": "sha512-ZLljfTeneFPd3ENfxx/OHhwKZzQF8j8oShVjqS5LQC7O603xmzU6QD8XGe/syqIZJx2a5xvho1So0nqrbqXWQw==", "dependencies": { "arg": "^5.0.1", "tmp": "^0.2.1" }, "bin": { - "fift": "bin/fift", - "func": "bin/func", "ton-compiler": "bin/ton-compiler" } }, @@ -1648,8 +1792,6 @@ "ton-compiler": "^0.9.0" } }, -<<<<<<< HEAD -======= "node_modules/ton-contract-executor/node_modules/axios": { "version": "0.25.0", "resolved": "https://registry.npmjs.org/axios/-/axios-0.25.0.tgz", @@ -1665,7 +1807,6 @@ "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==", "dev": true }, ->>>>>>> 86256c1adcbfda00056134b79ec21cf6bbba0db2 "node_modules/ton-contract-executor/node_modules/ton": { "version": "9.9.0", "resolved": "https://registry.npmjs.org/ton/-/ton-9.9.0.tgz", @@ -1685,6 +1826,21 @@ "tweetnacl": "1.0.3" } }, + "node_modules/ton-contract-executor/node_modules/ton-compiler": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/ton-compiler/-/ton-compiler-0.9.0.tgz", + "integrity": "sha512-7ZyjmSSmI8s/hd+H3c8qCzvUxDWLml4T8Lhr3DNAucadWhAXiVniTgPHHQNt5nbfZMvHKGevGw18pRkf5cFBZA==", + "dev": true, + "dependencies": { + "arg": "^5.0.1", + "tmp": "^0.2.1" + }, + "bin": { + "fift": "bin/fift", + "func": "bin/func", + "ton-compiler": "bin/ton-compiler" + } + }, "node_modules/ton-contract-executor/node_modules/ton-crypto": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/ton-crypto/-/ton-crypto-2.1.0.tgz", @@ -1875,8 +2031,7 @@ "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" }, "node_modules/y18n": { "version": "5.0.8", @@ -2021,27 +2176,90 @@ "dev": true }, "@swc/core": { - "version": "1.3.24", - "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.3.24.tgz", - "integrity": "sha512-QMOTd0AgiUT3K1crxLRqd3gw0f3FC8hhH1vvlIlryvYqU4c+FJ/T2G4ZhMKLxQlZ/jX6Rhk0gKINZRBxy2GFyQ==", + "version": "1.3.25", + "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.3.25.tgz", + "integrity": "sha512-wqzvM/wu6OsTVYPMStOpm7kIQcPX3GoZ0sC85qzDdsCxmJ1rmItLAD91sXPUmmdk0XqPYjLgT9MRDEIP5woz4g==", "dev": true, "requires": { - "@swc/core-darwin-arm64": "1.3.24", - "@swc/core-darwin-x64": "1.3.24", - "@swc/core-linux-arm-gnueabihf": "1.3.24", - "@swc/core-linux-arm64-gnu": "1.3.24", - "@swc/core-linux-arm64-musl": "1.3.24", - "@swc/core-linux-x64-gnu": "1.3.24", - "@swc/core-linux-x64-musl": "1.3.24", - "@swc/core-win32-arm64-msvc": "1.3.24", - "@swc/core-win32-ia32-msvc": "1.3.24", - "@swc/core-win32-x64-msvc": "1.3.24" + "@swc/core-darwin-arm64": "1.3.25", + "@swc/core-darwin-x64": "1.3.25", + "@swc/core-linux-arm-gnueabihf": "1.3.25", + "@swc/core-linux-arm64-gnu": "1.3.25", + "@swc/core-linux-arm64-musl": "1.3.25", + "@swc/core-linux-x64-gnu": "1.3.25", + "@swc/core-linux-x64-musl": "1.3.25", + "@swc/core-win32-arm64-msvc": "1.3.25", + "@swc/core-win32-ia32-msvc": "1.3.25", + "@swc/core-win32-x64-msvc": "1.3.25" } }, + "@swc/core-darwin-arm64": { + "version": "1.3.25", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.25.tgz", + "integrity": "sha512-8PWAVcjTJyj2VrqPBFOIi2w2P0Z8kOCbzHW3+pe+bSXxfGMG0MKPl5U2IXhsEL0ovm4xSFlqW0yygpoP3MmRPw==", + "dev": true, + "optional": true + }, "@swc/core-darwin-x64": { - "version": "1.3.24", - "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.3.24.tgz", - "integrity": "sha512-px+5vkGtgPH0m3FkkTBHynlRdS5rRz+lK+wiXIuBZFJSySWFl6RkKbvwkD+sf0MpazQlqwlv/rTOGJBw6oDffg==", + "version": "1.3.25", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.3.25.tgz", + "integrity": "sha512-5DHGiMYFEj5aa208tCjo7Sn5tiG4xPz+4gUiWVlglxqXFptkNim5xu/1G6VYm5Zk7dI5jJkjTU76GQG7IRvPug==", + "dev": true, + "optional": true + }, + "@swc/core-linux-arm-gnueabihf": { + "version": "1.3.25", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.25.tgz", + "integrity": "sha512-YNfLxv9PhZk+jrJbpR1mMrYBUkufo0hiFv3S1OrX3l8edsIP4wPND5w9ZH0Oi898f6Jg9DBrY2zXJMQ+gWkbvA==", + "dev": true, + "optional": true + }, + "@swc/core-linux-arm64-gnu": { + "version": "1.3.25", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.25.tgz", + "integrity": "sha512-kS+spM5/xQ6QvWF1ms3byfjnhUlpjTfFwgCyHnIKgjvsYkDa+vkAIhKq6HuEdaTPaCRCjts0Zarhub1nClUU0g==", + "dev": true, + "optional": true + }, + "@swc/core-linux-arm64-musl": { + "version": "1.3.25", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.25.tgz", + "integrity": "sha512-vM3D7LWmjotUAJ2D4F+L+dspFeWrcPNVh0o8TCoTOYCt8DPD5YsUKTpIgOsZ+gReeWUAnNTh0Btx5pGGVfajGA==", + "dev": true, + "optional": true + }, + "@swc/core-linux-x64-gnu": { + "version": "1.3.25", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.25.tgz", + "integrity": "sha512-xUCLLMDlYa/zB8BftVa4SrxuVpcDxkltCfmBg5r2pZPVskhC5ZJsQZ/AvWNChoAB11shRhjTaWDlmxJEsa7TIg==", + "dev": true, + "optional": true + }, + "@swc/core-linux-x64-musl": { + "version": "1.3.25", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.25.tgz", + "integrity": "sha512-QzHU3BIaUVRSFNsUn3Qxx1vgtF/f5NqsFMAAPSq9Y8Yq5nrlc2t7cNuOROxHLbUqE+NPUp6+RglleJMoeWz5mA==", + "dev": true, + "optional": true + }, + "@swc/core-win32-arm64-msvc": { + "version": "1.3.25", + "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.25.tgz", + "integrity": "sha512-77VSVtneVOAUL4zkRyQZ6pWVpTsVVdqwly/DKnRnloglGKxYuk5DG5MUBsL72Nnfv4OCHjZ27eI3NUrpLsUb2Q==", + "dev": true, + "optional": true + }, + "@swc/core-win32-ia32-msvc": { + "version": "1.3.25", + "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.25.tgz", + "integrity": "sha512-kz0v3K3H6OPEZR3ry72Ad/6C5GrZBRRUk69K58LORQ8tZXQD3UGl85pUbQqyHl8fR5NU76Muxgovj9CI9iTHGA==", + "dev": true, + "optional": true + }, + "@swc/core-win32-x64-msvc": { + "version": "1.3.25", + "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.25.tgz", + "integrity": "sha512-nmQOAzIpNRRnupWzkenJmW4i+h1M76cVNUqEU2MjmtesEkRZEGqv//jefXiyCP2zcbeLNLKiB2ptVJhpd1BvRA==", "dev": true, "optional": true }, @@ -2163,8 +2381,7 @@ "arg": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz", - "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==", - "dev": true + "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==" }, "argparse": { "version": "2.0.1", @@ -2208,8 +2425,7 @@ "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, "binary-extensions": { "version": "2.2.0", @@ -2228,7 +2444,6 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -2320,6 +2535,11 @@ "readdirp": "~3.6.0" } }, + "cliclopts": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/cliclopts/-/cliclopts-1.1.1.tgz", + "integrity": "sha512-dJk8y+TJmOy9Kqha0aWN0rwM5E5EQCVjhl2GTz1CrkqzxkQZ26/hyrNmy7lwePdZc4iNcdHL1tTdcIBeNQhmww==" + }, "cliui": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", @@ -2358,8 +2578,7 @@ "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" }, "create-require": { "version": "1.1.1", @@ -2377,7 +2596,6 @@ "version": "4.3.3", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", - "dev": true, "requires": { "ms": "2.1.2" }, @@ -2385,8 +2603,7 @@ "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" } } }, @@ -2532,8 +2749,7 @@ "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" }, "fsevents": { "version": "2.3.2", @@ -2558,7 +2774,6 @@ "version": "7.2.0", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", - "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -2572,7 +2787,6 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, "requires": { "brace-expansion": "^1.1.7" } @@ -2610,7 +2824,6 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dev": true, "requires": { "once": "^1.3.0", "wrappy": "1" @@ -2619,8 +2832,7 @@ "inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "io-ts": { "version": "2.2.20", @@ -2795,6 +3007,11 @@ "brace-expansion": "^1.1.7" } }, + "minimist": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", + "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==" + }, "mocha": { "version": "9.2.2", "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.2.2.tgz", @@ -2867,7 +3084,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, "requires": { "wrappy": "1" } @@ -2899,8 +3115,7 @@ "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "dev": true + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==" }, "pathval": { "version": "1.1.1", @@ -2978,7 +3193,6 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, "requires": { "glob": "^7.1.3" } @@ -3050,6 +3264,16 @@ "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", "dev": true }, + "subcommand": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/subcommand/-/subcommand-2.1.1.tgz", + "integrity": "sha512-cm7TQq9I8dA5LKUr+r8W7RzQlLsmTdCr6wXmjYueOoh/bQu55ODEw7GFhT42pUyoaLtO2rgmx1+8cSIjY9lR9g==", + "requires": { + "cliclopts": "^1.1.0", + "debug": "^4.1.1", + "minimist": "^1.2.0" + } + }, "supports-color": { "version": "8.1.1", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", @@ -3075,7 +3299,6 @@ "version": "0.2.1", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==", - "dev": true, "requires": { "rimraf": "^3.0.0" } @@ -3137,10 +3360,9 @@ } }, "ton-compiler": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/ton-compiler/-/ton-compiler-0.9.0.tgz", - "integrity": "sha512-7ZyjmSSmI8s/hd+H3c8qCzvUxDWLml4T8Lhr3DNAucadWhAXiVniTgPHHQNt5nbfZMvHKGevGw18pRkf5cFBZA==", - "dev": true, + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ton-compiler/-/ton-compiler-2.0.0.tgz", + "integrity": "sha512-ZLljfTeneFPd3ENfxx/OHhwKZzQF8j8oShVjqS5LQC7O603xmzU6QD8XGe/syqIZJx2a5xvho1So0nqrbqXWQw==", "requires": { "arg": "^5.0.1", "tmp": "^0.2.1" @@ -3157,8 +3379,6 @@ "ton-compiler": "^0.9.0" }, "dependencies": { -<<<<<<< HEAD -======= "axios": { "version": "0.25.0", "resolved": "https://registry.npmjs.org/axios/-/axios-0.25.0.tgz", @@ -3174,7 +3394,6 @@ "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==", "dev": true }, ->>>>>>> 86256c1adcbfda00056134b79ec21cf6bbba0db2 "ton": { "version": "9.9.0", "resolved": "https://registry.npmjs.org/ton/-/ton-9.9.0.tgz", @@ -3194,6 +3413,16 @@ "tweetnacl": "1.0.3" } }, + "ton-compiler": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/ton-compiler/-/ton-compiler-0.9.0.tgz", + "integrity": "sha512-7ZyjmSSmI8s/hd+H3c8qCzvUxDWLml4T8Lhr3DNAucadWhAXiVniTgPHHQNt5nbfZMvHKGevGw18pRkf5cFBZA==", + "dev": true, + "requires": { + "arg": "^5.0.1", + "tmp": "^0.2.1" + } + }, "ton-crypto": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/ton-crypto/-/ton-crypto-2.1.0.tgz", @@ -3315,8 +3544,7 @@ "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" }, "y18n": { "version": "5.0.8", diff --git a/package.json b/package.json index 6b90707..2127f90 100644 --- a/package.json +++ b/package.json @@ -10,10 +10,11 @@ "build": "ts-node ./build/_build.ts", "deploy": "ts-node ./build/_deploy.ts", "deploy:testnet": "ts-node ./build/_deploy.ts", - "postinstall": "ts-node ./build/_setup.ts" + "postinstall": "ts-node ./build/_setup.ts", + "cli": "node --no-warnings --loader ts-node/esm bin/cli.js " }, "devDependencies": { - "@swc/core": "^1.2.177", + "@swc/core": "^1.3.25", "@types/bn.js": "^5.1.0", "@types/chai": "^4.3.0", "@types/mocha": "^9.0.0", @@ -46,6 +47,8 @@ "node": ">=16.15.0" }, "dependencies": { - "semver": "^7.3.7" + "semver": "^7.3.7", + "subcommand": "^2.1.1", + "ton-compiler": "^2.0.0" } } diff --git a/test/signing.spec.ts b/test/signing.spec.ts index e94490c..d521613 100644 --- a/test/signing.spec.ts +++ b/test/signing.spec.ts @@ -53,18 +53,17 @@ describe("Creating items tests", () => { expect(res.type).to.equal("success"); expect(res.exit_code).to.equal(0); }); - it("does not allow to buy an item if the signature is invalid", async () => { + it("does not allow to buy an item if the signature is for another user", async () => { main.setContractBalance(contract, 10 * main.TON(), randomAddress("collection")); - let ownerAddr = randomAddress("dude"); - let signature = signBuy("test", randomAddress("collection"), ownerAddr, ownerKeys.secretKey); + let signature = signBuy("test", randomAddress("collection"), randomAddress("dude"), ownerKeys.secretKey); const sendToSelfMessage = internalMessage({ - from: ownerAddr, + from: randomAddress("dude2"), body: main.createItem({domain: "test", signature: signature}), value: new BN(100 * main.TON()), }); const res = await contract.sendInternalMessage(sendToSelfMessage); - expect(res.type).to.equal("success"); - expect(res.exit_code).to.equal(0); + expect(res.type).to.equal("failed"); + expect(res.exit_code).to.equal(205); });