@toon-protocol/townhouse 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-SXKZUTGE.js → chunk-IXG4IYTG.js} +119 -23
- package/dist/chunk-IXG4IYTG.js.map +1 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +16 -3
- package/dist/cli.js.map +1 -1
- package/dist/compose/townhouse-hs.yml +8 -8
- package/dist/image-manifest.json +10 -10
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/{manager-D9Y_iWHo.d.ts → manager-DSkD9Td1.d.ts} +14 -1
- package/package.json +2 -2
- package/dist/chunk-SXKZUTGE.js.map +0 -1
|
@@ -6444,6 +6444,19 @@ function validateConfig(raw) {
|
|
|
6444
6444
|
}
|
|
6445
6445
|
network = raw["network"];
|
|
6446
6446
|
}
|
|
6447
|
+
let endpoints;
|
|
6448
|
+
if (raw["endpoints"] !== void 0) {
|
|
6449
|
+
assertObject(raw["endpoints"], "config.endpoints");
|
|
6450
|
+
const e = raw["endpoints"];
|
|
6451
|
+
if (e["evmUrl"] !== void 0)
|
|
6452
|
+
assertString(e["evmUrl"], "config.endpoints.evmUrl");
|
|
6453
|
+
if (e["solUrl"] !== void 0)
|
|
6454
|
+
assertString(e["solUrl"], "config.endpoints.solUrl");
|
|
6455
|
+
endpoints = {
|
|
6456
|
+
...e["evmUrl"] !== void 0 ? { evmUrl: e["evmUrl"] } : {},
|
|
6457
|
+
...e["solUrl"] !== void 0 ? { solUrl: e["solUrl"] } : {}
|
|
6458
|
+
};
|
|
6459
|
+
}
|
|
6447
6460
|
let chainProviders;
|
|
6448
6461
|
if (raw["chainProviders"] !== void 0) {
|
|
6449
6462
|
if (!Array.isArray(raw["chainProviders"])) {
|
|
@@ -6577,6 +6590,7 @@ function validateConfig(raw) {
|
|
|
6577
6590
|
level: logging["level"]
|
|
6578
6591
|
},
|
|
6579
6592
|
...network !== void 0 ? { network } : {},
|
|
6593
|
+
...endpoints !== void 0 ? { endpoints } : {},
|
|
6580
6594
|
...chainProviders !== void 0 ? { chainProviders } : {}
|
|
6581
6595
|
};
|
|
6582
6596
|
}
|
|
@@ -14036,6 +14050,20 @@ var CHAIN_PRESETS = {
|
|
|
14036
14050
|
usdcAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
14037
14051
|
tokenNetworkAddress: "",
|
|
14038
14052
|
registryAddress: ""
|
|
14053
|
+
},
|
|
14054
|
+
// Akash-hosted Anvil devnet (chain-id 31338, deployed via akash-deploy.sh).
|
|
14055
|
+
// Contract addresses are the deterministic Foundry deploy from
|
|
14056
|
+
// contracts/evm/script/DeployLocal.s.sol (deployer + nonce, chain-id
|
|
14057
|
+
// independent), so this is settlement-complete. rpcUrl is empty by design —
|
|
14058
|
+
// the Akash ingress URL rotates per redeploy, so the operator supplies it
|
|
14059
|
+
// (TOON_RPC_URL / EVM_RPC_URL via `init --network akash --akash-evm-url`).
|
|
14060
|
+
"akash-anvil": {
|
|
14061
|
+
name: "akash-anvil",
|
|
14062
|
+
chainId: 31338,
|
|
14063
|
+
rpcUrl: "",
|
|
14064
|
+
usdcAddress: MOCK_USDC_ADDRESS,
|
|
14065
|
+
tokenNetworkAddress: "0xCafac3dD18aC6c6e92c921884f9E4176737C052c",
|
|
14066
|
+
registryAddress: "0xe7f1725e7734ce288f8367e1bb143e90bb3f0512"
|
|
14039
14067
|
}
|
|
14040
14068
|
};
|
|
14041
14069
|
function buildEvmProviderEntry(config, keyId) {
|
|
@@ -14070,6 +14098,12 @@ function buildMinaProviderEntry(config, keyId) {
|
|
|
14070
14098
|
network: config.network
|
|
14071
14099
|
};
|
|
14072
14100
|
}
|
|
14101
|
+
var DEV_EVM_PRESET = "akash-anvil";
|
|
14102
|
+
var DEV_SOLANA = {
|
|
14103
|
+
usdcMint: "6GbdrVghwNKTz9raga7y3Y4qqX5Zgg3AC4d48Kt7C59Q",
|
|
14104
|
+
programId: ""
|
|
14105
|
+
// TOON payment-channel program not deployed on the dev Solana node
|
|
14106
|
+
};
|
|
14073
14107
|
var RELAY_ONLY_CHAIN = "none";
|
|
14074
14108
|
var EVM_TIER = {
|
|
14075
14109
|
mainnet: { primary: "base-mainnet", also: ["arbitrum-one"] },
|
|
@@ -14122,7 +14156,11 @@ function evmSettlementComplete(p) {
|
|
|
14122
14156
|
}
|
|
14123
14157
|
function resolveNetworkProfile(network, opts = {}) {
|
|
14124
14158
|
if (network === "custom") {
|
|
14125
|
-
return resolveCustom(
|
|
14159
|
+
return resolveCustom(
|
|
14160
|
+
opts.customProviders ?? [],
|
|
14161
|
+
opts.endpoints ?? {},
|
|
14162
|
+
opts.keyId
|
|
14163
|
+
);
|
|
14126
14164
|
}
|
|
14127
14165
|
const tier = network;
|
|
14128
14166
|
const chainProviders = [];
|
|
@@ -14184,7 +14222,10 @@ function resolveNetworkProfile(network, opts = {}) {
|
|
|
14184
14222
|
}
|
|
14185
14223
|
return { network, chainProviders, nodeEnv, status };
|
|
14186
14224
|
}
|
|
14187
|
-
function resolveCustom(providers) {
|
|
14225
|
+
function resolveCustom(providers, endpoints, keyId) {
|
|
14226
|
+
if (providers.length === 0 && (endpoints.evmUrl || endpoints.solUrl)) {
|
|
14227
|
+
return resolveCustomEndpoints(endpoints, keyId);
|
|
14228
|
+
}
|
|
14188
14229
|
const status = {
|
|
14189
14230
|
evm: "unconfigured",
|
|
14190
14231
|
solana: "unconfigured",
|
|
@@ -14213,6 +14254,50 @@ function resolveCustom(providers) {
|
|
|
14213
14254
|
}
|
|
14214
14255
|
return { network: "custom", chainProviders: providers, nodeEnv, status };
|
|
14215
14256
|
}
|
|
14257
|
+
function resolveCustomEndpoints(endpoints, keyId) {
|
|
14258
|
+
const evm = CHAIN_PRESETS[DEV_EVM_PRESET];
|
|
14259
|
+
const status = {
|
|
14260
|
+
evm: "unconfigured",
|
|
14261
|
+
solana: "unconfigured",
|
|
14262
|
+
mina: "unconfigured"
|
|
14263
|
+
};
|
|
14264
|
+
const chainProviders = [];
|
|
14265
|
+
const nodeEnv = {
|
|
14266
|
+
EVM_CHAIN: DEV_EVM_PRESET,
|
|
14267
|
+
EVM_CHAIN_ID: String(evm.chainId),
|
|
14268
|
+
EVM_USDC_ADDRESS: evm.usdcAddress
|
|
14269
|
+
};
|
|
14270
|
+
if (endpoints.evmUrl) {
|
|
14271
|
+
nodeEnv.EVM_RPC_URL = endpoints.evmUrl;
|
|
14272
|
+
status.evm = "configured";
|
|
14273
|
+
if (keyId) {
|
|
14274
|
+
chainProviders.push(
|
|
14275
|
+
buildEvmProviderEntry({ ...evm, rpcUrl: endpoints.evmUrl }, keyId)
|
|
14276
|
+
);
|
|
14277
|
+
}
|
|
14278
|
+
} else {
|
|
14279
|
+
nodeEnv.EVM_CHAIN = RELAY_ONLY_CHAIN;
|
|
14280
|
+
}
|
|
14281
|
+
if (endpoints.solUrl) {
|
|
14282
|
+
nodeEnv.SOLANA_RPC_URL = endpoints.solUrl;
|
|
14283
|
+
nodeEnv.SOLANA_USDC_MINT = DEV_SOLANA.usdcMint;
|
|
14284
|
+
}
|
|
14285
|
+
return { network: "custom", chainProviders, nodeEnv, status };
|
|
14286
|
+
}
|
|
14287
|
+
|
|
14288
|
+
// src/config/network-profile.ts
|
|
14289
|
+
function resolveConfigNetworkProfile(config, keyId) {
|
|
14290
|
+
if (config.chainProviders && config.chainProviders.length > 0) {
|
|
14291
|
+
return resolveNetworkProfile("custom", {
|
|
14292
|
+
keyId,
|
|
14293
|
+
customProviders: config.chainProviders
|
|
14294
|
+
});
|
|
14295
|
+
}
|
|
14296
|
+
return resolveNetworkProfile(config.network ?? "mainnet", {
|
|
14297
|
+
keyId,
|
|
14298
|
+
endpoints: config.endpoints
|
|
14299
|
+
});
|
|
14300
|
+
}
|
|
14216
14301
|
|
|
14217
14302
|
// src/connector/hs-config-writer.ts
|
|
14218
14303
|
var HS_DIR = "/var/lib/anon/hs";
|
|
@@ -14229,11 +14314,10 @@ function writeHsConnectorConfig(configDir, config, options = {}) {
|
|
|
14229
14314
|
} catch {
|
|
14230
14315
|
}
|
|
14231
14316
|
}
|
|
14232
|
-
const
|
|
14233
|
-
|
|
14234
|
-
|
|
14235
|
-
|
|
14236
|
-
}).chainProviders;
|
|
14317
|
+
const derived = resolveConfigNetworkProfile(
|
|
14318
|
+
config,
|
|
14319
|
+
DEFAULT_HS_CHAIN_PROVIDERS[0]?.keyId
|
|
14320
|
+
).chainProviders;
|
|
14237
14321
|
const hsConfig = derived.length > 0 ? { ...config, chainProviders: derived } : { ...config, chainProviders: [...DEFAULT_HS_CHAIN_PROVIDERS] };
|
|
14238
14322
|
const generator = new ConnectorConfigGenerator(hsConfig);
|
|
14239
14323
|
const baseConfig = generator.generate([]);
|
|
@@ -14275,9 +14359,7 @@ import { join as join5 } from "path";
|
|
|
14275
14359
|
function writeHsNodeEnvFile(configDir, config) {
|
|
14276
14360
|
const composeDir = join5(configDir, "compose");
|
|
14277
14361
|
const envPath = join5(composeDir, ".env");
|
|
14278
|
-
const profile =
|
|
14279
|
-
customProviders: config.chainProviders
|
|
14280
|
-
});
|
|
14362
|
+
const profile = resolveConfigNetworkProfile(config);
|
|
14281
14363
|
const lines = [
|
|
14282
14364
|
"# Generated by `townhouse hs up` from the `network` mode \u2014 do not edit.",
|
|
14283
14365
|
`# network=${profile.network}`
|
|
@@ -20296,9 +20378,7 @@ async function waitForHealthy(url, timeoutMs) {
|
|
|
20296
20378
|
);
|
|
20297
20379
|
}
|
|
20298
20380
|
function buildNetworkNodeEnv(config) {
|
|
20299
|
-
const profile =
|
|
20300
|
-
customProviders: config.chainProviders
|
|
20301
|
-
});
|
|
20381
|
+
const profile = resolveConfigNetworkProfile(config);
|
|
20302
20382
|
const env = {};
|
|
20303
20383
|
for (const [key, value] of Object.entries(profile.nodeEnv)) {
|
|
20304
20384
|
if (value !== void 0) env[key] = value;
|
|
@@ -21835,12 +21915,10 @@ function registerChainsRoutes(app, deps) {
|
|
|
21835
21915
|
|
|
21836
21916
|
// src/api/routes/network.ts
|
|
21837
21917
|
var NETWORK_MODES = ["mainnet", "testnet", "devnet", "custom"];
|
|
21838
|
-
function networkView(
|
|
21839
|
-
const profile =
|
|
21840
|
-
customProviders: config.chainProviders
|
|
21841
|
-
});
|
|
21918
|
+
function networkView(config) {
|
|
21919
|
+
const profile = resolveConfigNetworkProfile(config);
|
|
21842
21920
|
return {
|
|
21843
|
-
network,
|
|
21921
|
+
network: config.network ?? "mainnet",
|
|
21844
21922
|
status: profile.status,
|
|
21845
21923
|
// Public endpoints only — no secrets in the network node env.
|
|
21846
21924
|
nodeEnv: profile.nodeEnv
|
|
@@ -21852,30 +21930,45 @@ var patchBodySchema4 = {
|
|
|
21852
21930
|
additionalProperties: false,
|
|
21853
21931
|
required: ["network"],
|
|
21854
21932
|
properties: {
|
|
21855
|
-
network: { type: "string", enum: NETWORK_MODES }
|
|
21933
|
+
network: { type: "string", enum: NETWORK_MODES },
|
|
21934
|
+
endpoints: {
|
|
21935
|
+
type: "object",
|
|
21936
|
+
additionalProperties: false,
|
|
21937
|
+
properties: {
|
|
21938
|
+
evmUrl: { type: "string", maxLength: 2048 },
|
|
21939
|
+
solUrl: { type: "string", maxLength: 2048 }
|
|
21940
|
+
}
|
|
21941
|
+
}
|
|
21856
21942
|
}
|
|
21857
21943
|
}
|
|
21858
21944
|
};
|
|
21859
21945
|
function registerNetworkRoutes(app, deps) {
|
|
21860
21946
|
app.get("/api/network", async (_request, reply) => {
|
|
21861
|
-
|
|
21862
|
-
|
|
21947
|
+
return reply.status(200).send({
|
|
21948
|
+
...networkView(deps.config),
|
|
21949
|
+
endpoints: deps.config.endpoints,
|
|
21950
|
+
ts: Date.now()
|
|
21951
|
+
});
|
|
21863
21952
|
});
|
|
21864
21953
|
app.patch(
|
|
21865
21954
|
"/api/network",
|
|
21866
21955
|
{ schema: patchBodySchema4 },
|
|
21867
21956
|
async (request, reply) => {
|
|
21868
21957
|
const next = request.body.network;
|
|
21958
|
+
const nextEndpoints = request.body.endpoints;
|
|
21869
21959
|
if (!acquireConfigMutex()) {
|
|
21870
21960
|
return reply.status(409).send({ error: "config_mutation_in_flight" });
|
|
21871
21961
|
}
|
|
21872
21962
|
const prior = deps.config.network;
|
|
21963
|
+
const priorEndpoints = deps.config.endpoints;
|
|
21873
21964
|
try {
|
|
21874
21965
|
deps.config.network = next;
|
|
21966
|
+
if (nextEndpoints !== void 0) deps.config.endpoints = nextEndpoints;
|
|
21875
21967
|
try {
|
|
21876
21968
|
validateConfig(deps.config);
|
|
21877
21969
|
} catch (validationError) {
|
|
21878
21970
|
deps.config.network = prior;
|
|
21971
|
+
deps.config.endpoints = priorEndpoints;
|
|
21879
21972
|
return reply.status(400).send({
|
|
21880
21973
|
error: "config_validation_error",
|
|
21881
21974
|
message: validationError instanceof Error ? validationError.message : "Invalid network"
|
|
@@ -21885,6 +21978,7 @@ function registerNetworkRoutes(app, deps) {
|
|
|
21885
21978
|
await saveConfig(deps.configPath, deps.config);
|
|
21886
21979
|
} catch (saveError) {
|
|
21887
21980
|
deps.config.network = prior;
|
|
21981
|
+
deps.config.endpoints = priorEndpoints;
|
|
21888
21982
|
return reply.status(500).send({
|
|
21889
21983
|
error: "config_save_failed",
|
|
21890
21984
|
message: saveError instanceof Error ? saveError.message : "Failed to persist config"
|
|
@@ -21895,6 +21989,7 @@ function registerNetworkRoutes(app, deps) {
|
|
|
21895
21989
|
await deps.orchestrator.regenerateConnectorConfig(activeNodes);
|
|
21896
21990
|
} catch (restartError) {
|
|
21897
21991
|
deps.config.network = prior;
|
|
21992
|
+
deps.config.endpoints = priorEndpoints;
|
|
21898
21993
|
try {
|
|
21899
21994
|
await saveConfig(deps.configPath, deps.config);
|
|
21900
21995
|
} catch {
|
|
@@ -21905,7 +22000,8 @@ function registerNetworkRoutes(app, deps) {
|
|
|
21905
22000
|
});
|
|
21906
22001
|
}
|
|
21907
22002
|
return reply.status(200).send({
|
|
21908
|
-
...networkView(
|
|
22003
|
+
...networkView(deps.config),
|
|
22004
|
+
endpoints: deps.config.endpoints,
|
|
21909
22005
|
restartTriggered: true,
|
|
21910
22006
|
restartedAt: Date.now()
|
|
21911
22007
|
});
|
|
@@ -22707,4 +22803,4 @@ export {
|
|
|
22707
22803
|
@scure/bip32/index.js:
|
|
22708
22804
|
(*! scure-bip32 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
|
|
22709
22805
|
*/
|
|
22710
|
-
//# sourceMappingURL=chunk-
|
|
22806
|
+
//# sourceMappingURL=chunk-IXG4IYTG.js.map
|