diff --git a/Dockerfile b/Dockerfile index 2d3f378..0fe4af9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -82,6 +82,7 @@ RUN if echo "$JS_STELLAR_SDK_NPM_VERSION" | grep -q '.*file:.*'; then \ ADD *.ts /home/tester/bin/ RUN ["sudo", "chmod", "+x", "/home/tester/bin/invoke.ts"] +RUN ["sudo", "chmod", "+x", "/home/tester/bin/install.ts"] FROM base as build diff --git a/features/dapp_develop/dapp_develop.feature b/features/dapp_develop/dapp_develop.feature index 81383ba..3ac6943 100644 --- a/features/dapp_develop/dapp_develop.feature +++ b/features/dapp_develop/dapp_develop.feature @@ -5,7 +5,7 @@ Feature: DApp Contract Development Scenario Outline: DApp developer compiles, installs, deploys and invokes a contract Given I used cargo to compile example contract And I used rpc to verify my account is on the network - And I used cli to install contract / on network using my secret key + And I used cli to install contract / on network from tool using my secret key And I used cli to deploy contract / by installed hash using my secret key When I invoke function on with request parameters from tool using my secret key Then The result should be diff --git a/features/dapp_develop/dapp_develop_test.go b/features/dapp_develop/dapp_develop_test.go index 071e2bf..c30a798 100644 --- a/features/dapp_develop/dapp_develop_test.go +++ b/features/dapp_develop/dapp_develop_test.go @@ -101,13 +101,13 @@ func deployContractUsingConfigParamsStep(ctx context.Context, contractExamplesSu return nil } -func installContractStep(ctx context.Context, contractExamplesSubPath string, compiledContractFileName string) error { +func installContractStep(ctx context.Context, contractExamplesSubPath string, compiledContractFileName string, tool string) error { testConfig := ctx.Value(e2e.TestConfigContextKey).(*testConfig) contractWorkingDirectory := fmt.Sprintf("%s/soroban_examples", testConfig.TestWorkingDir) var err error - if testConfig.InstalledContractId, err = installContract(compiledContractFileName, contractWorkingDirectory, contractExamplesSubPath, testConfig.E2EConfig); err != nil { + if testConfig.InstalledContractId, err = installContract(compiledContractFileName, contractWorkingDirectory, contractExamplesSubPath, tool, testConfig.E2EConfig); err != nil { return err } @@ -335,7 +335,7 @@ func initializeScenario(scenarioCtx *godog.ScenarioContext) { scenarioCtx.Step(`^I used cli to add Network Config ([\S|\s]+) for rpc and standalone$`, createNetworkConfigStep) scenarioCtx.Step(`^I used cli to add Identity ([\S|\s]+) for my secret key$`, createMyIdentityStep) scenarioCtx.Step(`^I used cli to deploy contract ([\S|\s]+) / ([\S|\s]+) using Identity ([\S|\s]+) and Network Config ([\S|\s]+)$`, deployContractUsingConfigParamsStep) - scenarioCtx.Step(`^I used cli to install contract ([\S|\s]+) / ([\S|\s]+) on network using my secret key$`, installContractStep) + scenarioCtx.Step(`^I used cli to install contract ([\S|\s]+) / ([\S|\s]+) on network from tool ([\S|\s]+) using my secret key$`, installContractStep) scenarioCtx.Step(`^I used cli to deploy contract ([\S|\s]+) / ([\S|\s]+) by installed hash using my secret key$`, deployContractStep) scenarioCtx.Step(`^I used cli to deploy contract ([\S|\s]+) / ([\S|\s]+) using my secret key$`, deployContractStep) scenarioCtx.Step(`^I used cli to add Identity ([\S|\s]+) for tester secret key$`, createTestAccountIdentityStep) diff --git a/features/dapp_develop/main.go b/features/dapp_develop/main.go index 358c997..d69a583 100644 --- a/features/dapp_develop/main.go +++ b/features/dapp_develop/main.go @@ -2,6 +2,7 @@ package dapp_develop import ( "fmt" + "strings" "github.com/go-cmd/cmd" @@ -95,7 +96,50 @@ func deployContractUsingConfigParams(compiledContractFileName string, contractWo } // returns the installed contract id -func installContract(compiledContractFileName string, contractWorkingDirectory string, contractExamplesSubPath string, e2eConfig *e2e.E2EConfig) (string, error) { +func installContract(compiledContractFileName string, contractWorkingDirectory string, contractExamplesSubPath string, tool string, e2eConfig *e2e.E2EConfig) (string, error) { + var response string + var err error + + switch tool { + case "CLI": + response, err = installContractFromCliTool(compiledContractFileName, contractWorkingDirectory, contractExamplesSubPath, e2eConfig) + case "NODEJS": + response, err = installContractFromNodeJSTool(compiledContractFileName, contractWorkingDirectory, contractExamplesSubPath, e2eConfig) + default: + err = fmt.Errorf("%s tool not supported for invoke yet", tool) + } + + if err != nil { + return "", err + } + + return response, nil +} + +func installContractFromNodeJSTool(compiledContractFileName string, contractWorkingDirectory string, contractExamplesSubPath string, e2eConfig *e2e.E2EConfig) (string, error) { + args := []string{ + + "--wasm", fmt.Sprintf("./%s/%s/target/wasm32-unknown-unknown/release/%s", contractWorkingDirectory, contractExamplesSubPath, compiledContractFileName), + "--rpc-url", e2eConfig.TargetNetworkRPCURL, + "--source", e2eConfig.TargetNetworkSecretKey, + "--network-passphrase", e2eConfig.TargetNetworkPassPhrase, + } + envCmd := cmd.NewCmd("./install.ts", args...) + status, stdOutLines, err := e2e.RunCommand(envCmd, e2eConfig) + stdOut := strings.TrimSpace(strings.Join(stdOutLines, "\n")) + + if status != 0 || err != nil { + return "", fmt.Errorf("nodejs install of example contract %s had error %v, %v, stdout: %v", compiledContractFileName, status, err, stdOut) + } + + if stdOut == "" { + return "", fmt.Errorf("nodejs install of example contract %s did not print any response", compiledContractFileName) + } + + return stdOut, nil +} + +func installContractFromCliTool(compiledContractFileName string, contractWorkingDirectory string, contractExamplesSubPath string, e2eConfig *e2e.E2EConfig) (string, error) { envCmd := cmd.NewCmd("soroban", "contract", "install", diff --git a/install.ts b/install.ts new file mode 100644 index 0000000..6de4166 --- /dev/null +++ b/install.ts @@ -0,0 +1,91 @@ +#!/usr/bin/env ts-node-script + +import * as fs from 'fs'; +import { ArgumentParser } from 'argparse'; +import { + Keypair, + TransactionBuilder, + SorobanRpc, + scValToNative, + xdr, + Operation, + OperationOptions, +} from '@stellar/stellar-sdk'; + +const { Server } = SorobanRpc; + +async function main() { + const parser = new ArgumentParser({ description: 'Install a contract' }) + + parser.add_argument('--wasm', { dest: 'wasm', required: true, help: 'Path to wasm binary' }); + parser.add_argument('--rpc-url', { dest: 'rpcUrl', required: true, help: 'RPC URL' }); + parser.add_argument('--source', { dest: 'source', required: true, help: 'Secret key' }); + parser.add_argument('--network-passphrase', { dest: 'networkPassphrase', required: true, help: 'Network passphrase' }); + + const { + wasm, + rpcUrl, + networkPassphrase, + source, + } = parser.parse_args() as Record; + + + const server = new Server(rpcUrl, { allowHttp: true }); + const secretKey = Keypair.fromSecret(source); + const account = secretKey.publicKey(); + const sourceAccount = await server.getAccount(account); + const wasmBuffer = fs.readFileSync(wasm); + + + const options: OperationOptions.InvokeHostFunction = { + "func": xdr.HostFunction.hostFunctionTypeUploadContractWasm(Buffer.from(wasmBuffer)), + "source": account + }; + const op = Operation.invokeHostFunction(options); + + const originalTxn = new TransactionBuilder(sourceAccount, { + fee: "100", + networkPassphrase + }) + .addOperation(op) + .setTimeout(30) + .build(); + + const txn = await server.prepareTransaction(originalTxn); + txn.sign(secretKey); + const send = await server.sendTransaction(txn); + if (send.errorResult) { + throw new Error(`Transaction failed: ${JSON.stringify(send)}`); + } + let response = await server.getTransaction(send.hash); + for (let i = 0; i < 50; i++) { + switch (response.status) { + case "NOT_FOUND": { + // retry + await new Promise(resolve => setTimeout(resolve, 100)); + response = await server.getTransaction(send.hash); + break; + } + case "SUCCESS": { + if (!response.returnValue) { + throw new Error(`No invoke host fn return value provided: ${JSON.stringify(response)}`); + } + + const parsed = scValToNative(response.returnValue); + console.log(JSON.stringify(parsed)); + return; + } + case "FAILED": { + throw new Error(`Transaction failed: ${JSON.stringify(response)}`); + } + default: + throw new Error(`Unknown transaction status: ${response.status}`); + } + } + throw new Error("Transaction timed out"); +} + +main().catch(err => { + console.error(JSON.stringify(err)); + throw err; +}); diff --git a/package-lock.json b/package-lock.json index 40a45f9..1bd7e84 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,204 +1,377 @@ { "name": "system-test", "version": "1.0.0", - "lockfileVersion": 1, + "lockfileVersion": 3, "requires": true, - "dependencies": { - "@types/argparse": { + "packages": { + "": { + "name": "system-test", + "version": "1.0.0", + "dependencies": { + "@stellar/stellar-sdk": "^11.2.1", + "argparse": "^2.0.1", + "tslib": "^2.5.0", + "typescript": "^4.9.5" + }, + "devDependencies": { + "@types/argparse": "^2.0.10", + "@types/node": "^18.14.6" + } + }, + "node_modules/@stellar/js-xdr": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@stellar/js-xdr/-/js-xdr-3.1.0.tgz", + "integrity": "sha512-mYTyFnhgyQgyvpAYZRO1LurUn2MxcIZRj74zZz/BxKEk7zrL4axhQ1ez0HL2BRi0wlG6cHn5BeD/t9Xcyp7CSQ==" + }, + "node_modules/@stellar/stellar-base": { + "version": "10.0.2", + "resolved": "https://registry.npmjs.org/@stellar/stellar-base/-/stellar-base-10.0.2.tgz", + "integrity": "sha512-SK7WgnSc2xn4vYRRLsjbA6fstyzZfFKUTg/PTrl1Cc5RbhbBSLXVKqd2hw0gAjZ8vHpEMmZvfZgBJnTAYUbrPA==", + "dependencies": { + "@stellar/js-xdr": "^3.0.1", + "base32.js": "^0.1.0", + "bignumber.js": "^9.1.2", + "buffer": "^6.0.3", + "sha.js": "^2.3.6", + "tweetnacl": "^1.0.3", + "typescript": "^5.3.3" + }, + "optionalDependencies": { + "sodium-native": "^4.0.5" + } + }, + "node_modules/@stellar/stellar-base/node_modules/bignumber.js": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.2.tgz", + "integrity": "sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug==", + "engines": { + "node": "*" + } + }, + "node_modules/@stellar/stellar-base/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/@stellar/stellar-base/node_modules/sodium-native": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/sodium-native/-/sodium-native-4.0.6.tgz", + "integrity": "sha512-uYsyycwcz9kYDwpXxJmL2YZosynsxcP6RPySbARVJdC9uNDa2CMjzJ7/WsMMvThKgvAYsBWdZc7L/WSVj9lTcA==", + "hasInstallScript": true, + "optional": true, + "dependencies": { + "node-gyp-build": "^4.6.0" + } + }, + "node_modules/@stellar/stellar-base/node_modules/typescript": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", + "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/@stellar/stellar-sdk": { + "version": "11.2.1", + "resolved": "https://registry.npmjs.org/@stellar/stellar-sdk/-/stellar-sdk-11.2.1.tgz", + "integrity": "sha512-vP/BathLaNYYHBG8hFCG3A/sCKrd9dL4cYVNDCCFZu9IwiZ4Sd3tc2EdpK3HXyC64vV5hC0v8I2G0LbnRSzi7g==", + "dependencies": { + "@stellar/stellar-base": "^10.0.2", + "axios": "^1.6.5", + "bignumber.js": "^9.1.2", + "eventsource": "^2.0.2", + "randombytes": "^2.1.0", + "toml": "^3.0.0", + "typescript": "^5.3.3", + "urijs": "^1.19.1" + } + }, + "node_modules/@stellar/stellar-sdk/node_modules/axios": { + "version": "1.6.7", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.7.tgz", + "integrity": "sha512-/hDJGff6/c7u0hDkvkGxR/oy6CbCs8ziCsC7SqmhjfozqiJGc8Z11wrv9z9lYfY4K8l+H9TpjcMDX0xOZmx+RA==", + "dependencies": { + "follow-redirects": "^1.15.4", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/@stellar/stellar-sdk/node_modules/bignumber.js": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.2.tgz", + "integrity": "sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug==", + "engines": { + "node": "*" + } + }, + "node_modules/@stellar/stellar-sdk/node_modules/typescript": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", + "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/@types/argparse": { "version": "2.0.10", "resolved": "https://registry.npmjs.org/@types/argparse/-/argparse-2.0.10.tgz", "integrity": "sha512-C4wahC3gz3vQtvPazrJ5ONwmK1zSDllQboiWvpMM/iOswCYfBREFnjFbq/iWKIVOCl8+m5Pk6eva6/ZSsDuIGA==", "dev": true }, - "@types/eventsource": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/@types/eventsource/-/eventsource-1.1.11.tgz", - "integrity": "sha512-L7wLDZlWm5mROzv87W0ofIYeQP5K2UhoFnnUyEWLKM6UBb0ZNRgAqp98qE5DkgfBXdWfc2kYmw9KZm4NLjRbsw==" - }, - "@types/node": { + "node_modules/@types/node": { "version": "18.14.6", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.14.6.tgz", - "integrity": "sha512-93+VvleD3mXwlLI/xASjw0FzKcwzl3OdTCzm1LaRfqgS21gfFtK3zDXM5Op9TeeMsJVOaJ2VRDpT9q4Y3d0AvA==" - }, - "@types/randombytes": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@types/randombytes/-/randombytes-2.0.0.tgz", - "integrity": "sha512-bz8PhAVlwN72vqefzxa14DKNT8jK/mV66CSjwdVQM/k3Th3EPKfUtdMniwZgMedQTFuywAsfjnZsg+pEnltaMA==", - "requires": { - "@types/node": "*" - } - }, - "@types/urijs": { - "version": "1.19.19", - "resolved": "https://registry.npmjs.org/@types/urijs/-/urijs-1.19.19.tgz", - "integrity": "sha512-FDJNkyhmKLw7uEvTxx5tSXfPeQpO0iy73Ry+PmYZJvQy0QIWX8a7kJ4kLWRf+EbTPJEPDSgPXHaM7pzr5lmvCg==" + "integrity": "sha512-93+VvleD3mXwlLI/xASjw0FzKcwzl3OdTCzm1LaRfqgS21gfFtK3zDXM5Op9TeeMsJVOaJ2VRDpT9q4Y3d0AvA==", + "dev": true }, - "argparse": { + "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" }, - "axios": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.25.0.tgz", - "integrity": "sha512-cD8FOb0tRH3uuEe6+evtAbgJtfxr7ly3fQjYcMcuPlgkwVS9xboaVIpcDV+cYQe+yGykgwZCs1pzjntcGa6l5g==", - "requires": { - "follow-redirects": "^1.14.7" - } + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, - "base32.js": { + "node_modules/base32.js": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/base32.js/-/base32.js-0.1.0.tgz", - "integrity": "sha512-n3TkB02ixgBOhTvANakDb4xaMXnYUVkNoRFJjQflcqMQhyEKxEHdj3E6N8t8sUQ0mjH/3/JxzlXuz3ul/J90pQ==" + "integrity": "sha512-n3TkB02ixgBOhTvANakDb4xaMXnYUVkNoRFJjQflcqMQhyEKxEHdj3E6N8t8sUQ0mjH/3/JxzlXuz3ul/J90pQ==", + "engines": { + "node": ">=0.12.0" + } }, - "base64-js": { + "node_modules/base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" - }, - "bignumber.js": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-4.1.0.tgz", - "integrity": "sha512-eJzYkFYy9L4JzXsbymsFn3p54D+llV27oTQ+ziJG7WFRheJcNZilgVXMG0LoZtlQSKBsJdWtLFqOD0u+U0jZKA==" - }, - "buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" } }, - "crc": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/crc/-/crc-3.8.0.tgz", - "integrity": "sha512-iX3mfgcTMIq3ZKLIsVFAbv7+Mc10kxabAGQb8HvjA1o3T1PIYprbakQ65d3I+2HGHt6nSKkM9PYjgoJO2KcFBQ==", - "requires": { - "buffer": "^5.1.0" + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" } }, - "es6-promise": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", - "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" + "node_modules/eventsource": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-2.0.2.tgz", + "integrity": "sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA==", + "engines": { + "node": ">=12.0.0" + } }, - "follow-redirects": { - "version": "1.15.2", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", - "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==" + "node_modules/follow-redirects": { + "version": "1.15.5", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz", + "integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } }, - "ieee754": { + "node_modules/ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] }, - "inherits": { + "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, - "js-xdr": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/js-xdr/-/js-xdr-1.3.0.tgz", - "integrity": "sha512-fjLTm2uBtFvWsE3l2J14VjTuuB8vJfeTtYuNS7LiLHDWIX2kt0l1pqq9334F8kODUkKPMuULjEcbGbkFFwhx5g==", - "requires": { - "lodash": "^4.17.5", - "long": "^2.2.3" + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" } }, - "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, - "long": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/long/-/long-2.4.0.tgz", - "integrity": "sha512-ijUtjmO/n2A5PaosNG9ZGDsQ3vxJg7ZW8vsY8Kp0f2yIZWhSJvjmegV7t+9RPQKxKrvj8yKGehhS+po14hPLGQ==" + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } }, - "node-gyp-build": { + "node_modules/node-gyp-build": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.0.tgz", "integrity": "sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==", - "optional": true + "optional": true, + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dependencies": { + "safe-buffer": "^5.1.0" + } }, - "safe-buffer": { + "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] }, - "sha.js": { + "node_modules/sha.js": { "version": "2.4.11", "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", - "requires": { + "dependencies": { "inherits": "^2.0.1", "safe-buffer": "^5.0.1" - } - }, - "sodium-native": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/sodium-native/-/sodium-native-3.4.1.tgz", - "integrity": "sha512-PaNN/roiFWzVVTL6OqjzYct38NSXewdl2wz8SRB51Br/MLIJPrbM3XexhVWkq7D3UWMysfrhKVf1v1phZq6MeQ==", - "optional": true, - "requires": { - "node-gyp-build": "^4.3.0" - } - }, - "soroban-client": { - "version": "git+https://github.com/stellar/js-soroban-client.git#1e9c3fbe2587be4816a6668226f1e50e4828974b", - "from": "git+https://github.com/stellar/js-soroban-client.git#main", - "requires": { - "@types/eventsource": "^1.1.2", - "@types/node": "18.11.9", - "@types/randombytes": "^2.0.0", - "@types/urijs": "^1.19.6", - "axios": "0.25.0", - "es6-promise": "^4.2.4", - "lodash": "4.17.21", - "stellar-base": "8.2.2-soroban.12", - "urijs": "^1.19.1" }, - "dependencies": { - "@types/node": { - "version": "18.11.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.9.tgz", - "integrity": "sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg==" - } + "bin": { + "sha.js": "bin.js" } }, - "stellar-base": { - "version": "8.2.2-soroban.12", - "resolved": "https://registry.npmjs.org/stellar-base/-/stellar-base-8.2.2-soroban.12.tgz", - "integrity": "sha512-bQQxRFA2GXoNsr2ZFN+eK9Du1hSu0+t983tHRMI3nyWlLgZInKg7B9ZFa4UjLbLYpxQ4mE1EYupk3bulqNA91A==", - "requires": { - "base32.js": "^0.1.0", - "bignumber.js": "^4.0.0", - "crc": "^3.5.0", - "js-xdr": "^1.1.3", - "lodash": "^4.17.21", - "sha.js": "^2.3.6", - "sodium-native": "^3.3.0", - "tweetnacl": "^1.0.3" - } + "node_modules/toml": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/toml/-/toml-3.0.0.tgz", + "integrity": "sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w==" }, - "tslib": { + "node_modules/tslib": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==" }, - "tweetnacl": { + "node_modules/tweetnacl": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" }, - "typescript": { + "node_modules/typescript": { "version": "4.9.5", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==" + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } }, - "urijs": { + "node_modules/urijs": { "version": "1.19.11", "resolved": "https://registry.npmjs.org/urijs/-/urijs-1.19.11.tgz", "integrity": "sha512-HXgFDgDommxn5/bIv0cnQZsPhHDA90NPHD6+c/v21U5+Sx5hoP8+dP9IZXBU1gIfvdRfhG8cel9QNPeionfcCQ==" diff --git a/package.json b/package.json index 855f94c..ce67b84 100644 --- a/package.json +++ b/package.json @@ -6,9 +6,11 @@ "author": "dev@stellar.org", "private": true, "scripts": { - "invoke": "ts-node invoke.ts" + "contract-invoke": "ts-node invoke.ts", + "contract-install": "ts-node install.ts" }, "dependencies": { + "@stellar/stellar-sdk": "^11.2.1", "argparse": "^2.0.1", "tslib": "^2.5.0", "typescript": "^4.9.5"