@quantovainc/qcore 0.1.16 → 0.1.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quantovainc/qcore",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "description": "Quantova's post quantum client core for JavaScript. Signs with ML-DSA-65 and builds Q1 addresses.",
5
5
  "scripts": {
6
6
  "build": "RUSTFLAGS=\"--remap-path-prefix=$HOME/quantova-stack=/qcore --remap-path-prefix=$HOME/.cargo=/cargo --remap-path-prefix=$HOME/.rustup=/rustup\" wasm-pack build --target bundler --out-dir pkg && RUSTFLAGS=\"--remap-path-prefix=$HOME/quantova-stack=/qcore --remap-path-prefix=$HOME/.cargo=/cargo --remap-path-prefix=$HOME/.rustup=/rustup\" wasm-pack build --target nodejs --out-dir pkg-node",
Binary file
Binary file
package/shared.js CHANGED
@@ -183,12 +183,18 @@ function makeClient(core) {
183
183
  const configured = this.network && this.network.chainId;
184
184
  if (configured && name !== configured) {
185
185
  throw new Error(`the gateway reports chain ${name} but this client is configured for ${configured}; refusing to sign a transaction that would be valid on a network you did not choose`);
186
- } else if (!configured && name === 'Q-main-net-1' && !this.acknowledgeMainnet) {
186
+ } else if (!configured && !this.acknowledgeMainnet && this._isMainnetId(BigInt(core.chainIdFromName(name)))) {
187
187
  throw new Error(`the gateway reports the mainnet chain ${name} but this client did not choose a network; refusing to sign a mainnet transaction without acknowledgeMainnet`);
188
188
  }
189
189
  return BigInt(core.chainIdFromName(name));
190
190
  }
191
191
 
192
+ // The canonical mainnet name is still an open convention (the chain crate's id vs the "Q-main-net-1"
193
+ // preset), so until it is settled the gate prompts for either candidate rather than miss the real one.
194
+ _isMainnetId(id) {
195
+ return id === BigInt(core.mainnetChainId()) || id === BigInt(core.chainIdFromName('Q-main-net-1'));
196
+ }
197
+
192
198
  async _call(method, body) {
193
199
  const controller = new AbortController();
194
200
  const timer = setTimeout(() => controller.abort(), TIMEOUT_MS);