Skip to content

Commit

Permalink
added ability to build tests from a local js-soroban-client folder path
Browse files Browse the repository at this point in the history
  • Loading branch information
sreuland committed May 23, 2023
1 parent 019d1c4 commit 979ffb0
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 8 deletions.
8 changes: 7 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,15 @@ RUN npm install -g ts-node yarn
# Install js-soroban-client
ARG JS_SOROBAN_CLIENT_NPM_VERSION
ADD package.json /home/tester/
ADD js-soroban-client /home/tester/js-soroban-client
RUN sudo chown -R tester:tester /home/tester
RUN yarn install --network-concurrency 1
RUN yarn add "soroban-client@${JS_SOROBAN_CLIENT_NPM_VERSION}" --network-concurrency 1
RUN if echo "$JS_SOROBAN_CLIENT_NPM_VERSION" | grep -q '.*file:.*'; then \
yarn add ${JS_SOROBAN_CLIENT_NPM_VERSION} --network-concurrency 1; \
else \
yarn add "soroban-client@${JS_SOROBAN_CLIENT_NPM_VERSION}" --network-concurrency 1; \
fi

ADD *.ts /home/tester/bin/
RUN ["sudo", "chmod", "+x", "/home/tester/bin/invoke.ts"]

Expand Down
12 changes: 5 additions & 7 deletions invoke.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,16 @@ async function main() {
params.push(xdr.ScVal.scvSymbol(param));
});
}

const txn = await server.prepareTransaction(
new SorobanClient.TransactionBuilder(sourceAccount, {

const originalTxn = new SorobanClient.TransactionBuilder(sourceAccount, {
fee: "100",
networkPassphrase,
})
.addOperation(contract.call(functionName, ...params))
.setTimeout(30)
.build(),
networkPassphrase
);

.build();

const txn = await server.prepareTransaction(originalTxn,networkPassphrase);
txn.sign(secretKey);
const send = await server.sendTransaction(txn);
if (send.errorResultXdr) {
Expand Down
19 changes: 19 additions & 0 deletions js-soroban-client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
This is a placeholder file only.

the system-teset/js-soroban-client directory can be used if you want to build system-test
with a local file path for the js-soroban-client project rather than pulling it from remote
npm or gh ref.

js-soroban-client$ `yarn build`

then copy the entire js-soroban-client directory over the top of system-test/js-soroban-client,
or soft link the directories, but be careful in soft link case as you don't want to accidentally delete, etc.

once you have the system-teset/js-soroban-client ready, then build system-test and trigger it to use with:

```
make .... JS_SOROBAN_CLIENT_NPM_VERSION=file:/home/tester/js-soroban-client build
```

system-teset/js-soroban-client is copied to the `/home/tester/js-soroban-client` path in the docker image.

0 comments on commit 979ffb0

Please sign in to comment.