onledger.net 0f235d30d8 Add guard for empty disparate_dir in sync_instance
## Change

Add a guard to the `disparate_dir` cleanup in `sync_instance` to 
prevent accidental deletion of the contract state directory when 
`DISPARATE_DIR` is not set.

## Background

The `disparate` directory feature was introduced in the beta devkit 
image to support multisig deployments. The cluster script assumes 
`DISPARATE_DIR` is always set, however older NPM packages (below 
v0.6.8) do not pass this environment variable, leaving `$disparate_dir` 
as an empty string.

With an empty `$disparate_dir` this line:
```bash
[ -d $contract_dir/contract_fs/seed/state/$disparate_dir ] && rm -r $contract_dir/contract_fs/seed/state/$disparate_dir
```

Evaluates to:
```bash
[ -d $contract_dir/contract_fs/seed/state/ ] && rm -r $contract_dir/contract_fs/seed/state/
```

Deleting the entire state directory immediately after the contract 
bundle is copied in.

## Change

Add a guard so the deletion only runs when `$disparate_dir` is 
actually set:
```bash
# Before
[ -d $contract_dir/contract_fs/seed/state/$disparate_dir ] && rm -r $contract_dir/contract_fs/seed/state/$disparate_dir

# After
[ -n "$disparate_dir" ] && [ -d $contract_dir/contract_fs/seed/state/$disparate_dir ] && rm -r $contract_dir/contract_fs/seed/state/$disparate_dir
```

## Notes

- NPM v0.6.8 correctly passes `DISPARATE_DIR=disparate` and is 
required for full beta devkit compatibility
- This guard is defensive programming to protect against the state 
directory being accidentally deleted if an older NPM package is used 
with the beta image
- For non-multisig deployments the disparate directory cleanup is 
skipped entirely which is the correct behaviour
2026-03-31 23:04:32 +13:00
2024-01-12 11:04:16 +05:30

HotPocket developer kit

This is the source repository of developer kit for HotPocket smart contract development. This toolkit makes use of Docker and NodeJS to provide a cross-platform HotPocket development tool for developers. Using the HotPocket developer kit, developers can spin-up local HotPocket clusters on their development machines and test HotPocket smart contracts.

We use Docker containers to run HotPocket and smart contracts in a Linux environment. We also use Docker containers and NodeJS for tooling so developers can use the tools on any platform as long as they install Docker and NodeJS.

image

Public documentation

https://github.com/EvernodeXRPL/evernode-sdk/blob/main/hpdevkit/index.md

Prerequisites

Docker build

Docker image containing cluster management shell scripts.

cd docker
docker build -t evernode/hpdevkit .
docker push evernode/hpdevkit

Run

docker run -it --rm --mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock evernode/hpdevkit cluster create 2

hpdevkit npm build

hpdevkit is a cross-platform CLI tool distributed via NPM.

# local build
cd npm
npm install
npm run build

# publish to npm
npm login
npm run publish

NPM package

https://www.npmjs.com/package/hpdevkit

Description
Developer toolkit for Hot Pocket smart contract development.
Readme 483 KiB
Languages
JavaScript 80.8%
Shell 17.8%
Dockerfile 1.4%