
Security News
New React Server Components Vulnerabilities: DoS and Source Code Exposure
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.
@switchboard-xyz/function-simulator
Advanced tools
type definitions for using the Switchboard function simulator
![]()
A server run within a secure enclave to help debug Switchboard Functions.
| Variable | Definition |
|---|---|
| PORT | The network port to use for the websocket. Defaults to 8080 |
| SOLANA_MAINNET_RPC_URL | Solana mainnet RPC URL. Defaults to https://api.mainnet-beta.solana.com |
| SOLANA_DEVNET_RPC_URL | Solana devnet RPC URL. Defaults to https://api.devnet.solana.com |
Once the server is running, start sending data like so:
import WebSocket from "ws";
import * as sb from "@switchboard-xyz/function-simulator";
async function main() {
const ws = new WebSocket(sb.SIMULATION_SERVER_URL);
const message: sb.MsgInEcho = {
event: "echo",
data: {
message: "echo this message back to me",
},
};
ws.onopen = (event) => {
console.log(`sending echo`);
ws.send(JSON.stringify(message));
};
ws.onmessage = (event) => {
const msg = JSON.parse(event.data.toString("utf-8"));
console.log("received msg", msg);
process.exit(0);
};
}
container_verifyVerify a container can be pulled and created.
{
"event": "containerVerify",
"data": {
"container": "switchboardlabs/binance-oracle"
}
}
measurementRetrieve the measurement of a given image on dockerhub.
{
"event": "measurement",
"data": {
"containerRegistry": "dockerhub",
"container": "switchboardlabs/binance-oracle",
"version": "latest"
}
}
solana_simulateSimulate a Solana function with a given set of inputs and stream the container logs to the websocket client.
{
"event": "solanaSimulate",
"data": {
"fnKey": "YOUR_FUNCTION_PUBKEY",
"cluster": "Devnet",
"params": {
// override values
"containerRegistry": "dockerhub",
"container": "switchboardlabs/binance-oracle",
"version": "latest",
"fnData": "", // hex encoded FunctionAccountData
"fnRequestKey": "", // pubkey
"fnRequestData": "", // hex encoded FunctionRequestAccountData
"payer": "", // pubkey
"verifier": "", // pubkey
"rewardReceiver": "" // pubkey
}
}
}
The secrets server needs to run within a secure enclave. Currently only Microsoft Azure is supported in the docs.
Install the Azure CLI. See the Official Docs - How to install Azure CLI.
# Ubuntu
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
# Mac OS
brew update && brew install azure-cli
Login
az login
Run the following to create a cluster named function-simulator in uksouth, enable the confidential compute plugin, create a static IP address and assign it to the cluster.
az group create --name Default --location uksouth
az aks create --name function-simulator \
--resource-group Default \
--node-vm-size Standard_DC2s_v3 \
--generate-ssh-keys
az aks enable-addons --addons confcom --name function-simulator --resource-group Default
az network public-ip create --name function-simulator-ip --sku Standard \
--allocation-method Static \
--resource-group $(az aks show --resource-group Default --name function-simulator --query nodeResourceGroup -o tsv)
az aks update --name function-simulator \
--resource-group Default \
--load-balancer-managed-outbound-ip-count 0 \
--load-balancer-outbound-ips $(az network public-ip show --resource-group Default --query id --output tsv)
helm repo add jetstack https://charts.jetstack.io
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo update
az aks get-credentials -g Default -n sb-internal
helm install \
cert-manager jetstack/cert-manager \
--namespace cert-manager \
--create-namespace \
--version v1.9.1 \
--set installCRDs=true \
--set global.leaderElection.namespace=cert-manager
helm install ingress-nginx ingress-nginx/ingress-nginx \
--namespace ingress-nginx \
--create-namespace \
--timeout 600s \
--debug \
-f nginx-values.yaml
FAQs
type definitions for using the Switchboard function simulator
The npm package @switchboard-xyz/function-simulator receives a total of 0 weekly downloads. As such, @switchboard-xyz/function-simulator popularity was classified as not popular.
We found that @switchboard-xyz/function-simulator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.

Security News
GitHub has revoked npm classic tokens for publishing; maintainers must migrate, but OpenJS warns OIDC trusted publishing still has risky gaps for critical projects.