@quantovainc/qcore 0.1.15 → 0.1.16
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/README.md +2 -2
- package/index.d.ts +26 -2
- package/package.json +2 -2
- package/pkg/README.md +2 -2
- package/pkg/qcore_js.d.ts +2 -0
- package/pkg/qcore_js.js +1 -1
- package/pkg/qcore_js_bg.js +40 -0
- package/pkg/qcore_js_bg.wasm +0 -0
- package/pkg/qcore_js_bg.wasm.d.ts +1 -0
- package/pkg-node/README.md +2 -2
- package/pkg-node/qcore_js.d.ts +2 -0
- package/pkg-node/qcore_js.js +41 -0
- package/pkg-node/qcore_js_bg.wasm +0 -0
- package/shared.js +8 -7
package/README.md
CHANGED
|
@@ -180,13 +180,13 @@ The [examples](examples) folder holds a runnable quickstart that mirrors the one
|
|
|
180
180
|
|
|
181
181
|
## Releases and provenance
|
|
182
182
|
|
|
183
|
-
Releases are published from CI by the publish workflow in `.github/workflows/publish.yml`, which runs on a pushed git tag. It
|
|
183
|
+
Releases are published from CI by the publish workflow in `.github/workflows/publish.yml`, which runs on a pushed git tag. It runs the offline tests and publishes with npm provenance, so the published tarball carries a provenance badge that ties it to this exact public commit. The wasm is built from the Rust core and committed to the repository, so confirming that the shipped wasm matches the source means rebuilding it from this commit and comparing the bytes. Nothing is published to a registry without an explicit tag. This package handles a user's keys and a published version cannot be taken back.
|
|
184
184
|
|
|
185
185
|
For the provenance publish to run, the maintainer adds an `NPM_TOKEN` automation secret to the repository, or configures npm trusted publishing for the package so the workflow authenticates over OIDC with no stored token.
|
|
186
186
|
|
|
187
187
|
## Security
|
|
188
188
|
|
|
189
|
-
To report a vulnerability,
|
|
189
|
+
To report a vulnerability, please disclose it privately to the Quantova team rather than through a public issue.
|
|
190
190
|
|
|
191
191
|
## Ownership and license
|
|
192
192
|
|
package/index.d.ts
CHANGED
|
@@ -23,6 +23,19 @@ export interface OrderLayout {
|
|
|
23
23
|
regionOff?: number | bigint;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
export interface SignedOrderField {
|
|
27
|
+
offset: number | bigint;
|
|
28
|
+
width: number | bigint;
|
|
29
|
+
value: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface SignedOrderSpec {
|
|
33
|
+
schemeOff: number | bigint;
|
|
34
|
+
ptrOff: number | bigint;
|
|
35
|
+
regionOff?: number | bigint;
|
|
36
|
+
fields: ReadonlyArray<SignedOrderField>;
|
|
37
|
+
}
|
|
38
|
+
|
|
26
39
|
export interface TransferResult {
|
|
27
40
|
signed: SignedTx;
|
|
28
41
|
outcome: any;
|
|
@@ -51,6 +64,18 @@ export interface QCore {
|
|
|
51
64
|
owner_index: bigint,
|
|
52
65
|
nonce: bigint,
|
|
53
66
|
): string;
|
|
67
|
+
buildTypedOrderCall(
|
|
68
|
+
chain_id: bigint,
|
|
69
|
+
contract: string,
|
|
70
|
+
selector_hex: string,
|
|
71
|
+
scheme_off: bigint,
|
|
72
|
+
ptr_off: bigint,
|
|
73
|
+
region_off: bigint,
|
|
74
|
+
fields_json: string,
|
|
75
|
+
owner_seed_hex: string,
|
|
76
|
+
owner_index: bigint,
|
|
77
|
+
nonce: bigint,
|
|
78
|
+
): string;
|
|
54
79
|
contractAddress(deployer: string, nonce: bigint): string | undefined;
|
|
55
80
|
chainIdFromName(name: string): bigint;
|
|
56
81
|
eventsBody(height: bigint): string;
|
|
@@ -161,8 +186,7 @@ export class Client {
|
|
|
161
186
|
callerIndex: number,
|
|
162
187
|
contract: string,
|
|
163
188
|
selectorHex: string,
|
|
164
|
-
|
|
165
|
-
fields: ReadonlyArray<number | bigint | string>,
|
|
189
|
+
orderSpec: SignedOrderSpec,
|
|
166
190
|
ownerSeedHex: string,
|
|
167
191
|
ownerIndex: number,
|
|
168
192
|
meterLimit: number | bigint,
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quantovainc/qcore",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"description": "Quantova's post quantum client core for JavaScript. Signs with ML-DSA-65 and builds Q1 addresses.",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"build": "wasm-pack build --target bundler --out-dir pkg && wasm-pack build --target nodejs --out-dir pkg-node",
|
|
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",
|
|
7
7
|
"test": "node test-conformance.js && node test-sign-validate.js && node test-transport.js && node test-fee-cap.js && node test-network.js"
|
|
8
8
|
},
|
|
9
9
|
"keywords": [
|
package/pkg/README.md
CHANGED
|
@@ -180,13 +180,13 @@ The [examples](examples) folder holds a runnable quickstart that mirrors the one
|
|
|
180
180
|
|
|
181
181
|
## Releases and provenance
|
|
182
182
|
|
|
183
|
-
Releases are published from CI by the publish workflow in `.github/workflows/publish.yml`, which runs on a pushed git tag. It
|
|
183
|
+
Releases are published from CI by the publish workflow in `.github/workflows/publish.yml`, which runs on a pushed git tag. It runs the offline tests and publishes with npm provenance, so the published tarball carries a provenance badge that ties it to this exact public commit. The wasm is built from the Rust core and committed to the repository, so confirming that the shipped wasm matches the source means rebuilding it from this commit and comparing the bytes. Nothing is published to a registry without an explicit tag. This package handles a user's keys and a published version cannot be taken back.
|
|
184
184
|
|
|
185
185
|
For the provenance publish to run, the maintainer adds an `NPM_TOKEN` automation secret to the repository, or configures npm trusted publishing for the package so the workflow authenticates over OIDC with no stored token.
|
|
186
186
|
|
|
187
187
|
## Security
|
|
188
188
|
|
|
189
|
-
To report a vulnerability,
|
|
189
|
+
To report a vulnerability, please disclose it privately to the Quantova team rather than through a public issue.
|
|
190
190
|
|
|
191
191
|
## Ownership and license
|
|
192
192
|
|
package/pkg/qcore_js.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ export function block_by_height_body(height: bigint): string;
|
|
|
9
9
|
|
|
10
10
|
export function buildSignedOrderCall(chain_id: bigint, contract: string, selector_hex: string, scheme_off: bigint, ptr_off: bigint, field_offs_csv: string, fields_csv: string, region_off: bigint, owner_seed_hex: string, owner_index: bigint, nonce: bigint): string;
|
|
11
11
|
|
|
12
|
+
export function buildTypedOrderCall(chain_id: bigint, contract: string, selector_hex: string, scheme_off: bigint, ptr_off: bigint, region_off: bigint, fields_json: string, owner_seed_hex: string, owner_index: bigint, nonce: bigint): string;
|
|
13
|
+
|
|
12
14
|
export function chainIdFromName(name: string): bigint;
|
|
13
15
|
|
|
14
16
|
export function contractAddress(deployer: string, nonce: bigint): string | undefined;
|
package/pkg/qcore_js.js
CHANGED
|
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./qcore_js_bg.js";
|
|
|
5
5
|
__wbg_set_wasm(wasm);
|
|
6
6
|
wasm.__wbindgen_start();
|
|
7
7
|
export {
|
|
8
|
-
account_body, address, block_by_height_body, buildSignedOrderCall, chainIdFromName, contractAddress, eventsBody, localChainId, mainnetChainId, mapSlotKey, mnemonicFromSeed, nonceSlotKey, orderSigner, parseEvents, scalarSlotKey, seedFromMnemonic, signPayableCall, signRegister, sign_call, sign_transfer, storageBody, storageValue, submit_body, testnetChainId, transaction_body, valid_address, vmDeployAddress
|
|
8
|
+
account_body, address, block_by_height_body, buildSignedOrderCall, buildTypedOrderCall, chainIdFromName, contractAddress, eventsBody, localChainId, mainnetChainId, mapSlotKey, mnemonicFromSeed, nonceSlotKey, orderSigner, parseEvents, scalarSlotKey, seedFromMnemonic, signPayableCall, signRegister, sign_call, sign_transfer, storageBody, storageValue, submit_body, testnetChainId, transaction_body, valid_address, vmDeployAddress
|
|
9
9
|
} from "./qcore_js_bg.js";
|
package/pkg/qcore_js_bg.js
CHANGED
|
@@ -103,6 +103,46 @@ export function buildSignedOrderCall(chain_id, contract, selector_hex, scheme_of
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
/**
|
|
107
|
+
* @param {bigint} chain_id
|
|
108
|
+
* @param {string} contract
|
|
109
|
+
* @param {string} selector_hex
|
|
110
|
+
* @param {bigint} scheme_off
|
|
111
|
+
* @param {bigint} ptr_off
|
|
112
|
+
* @param {bigint} region_off
|
|
113
|
+
* @param {string} fields_json
|
|
114
|
+
* @param {string} owner_seed_hex
|
|
115
|
+
* @param {bigint} owner_index
|
|
116
|
+
* @param {bigint} nonce
|
|
117
|
+
* @returns {string}
|
|
118
|
+
*/
|
|
119
|
+
export function buildTypedOrderCall(chain_id, contract, selector_hex, scheme_off, ptr_off, region_off, fields_json, owner_seed_hex, owner_index, nonce) {
|
|
120
|
+
let deferred6_0;
|
|
121
|
+
let deferred6_1;
|
|
122
|
+
try {
|
|
123
|
+
const ptr0 = passStringToWasm0(contract, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
124
|
+
const len0 = WASM_VECTOR_LEN;
|
|
125
|
+
const ptr1 = passStringToWasm0(selector_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
126
|
+
const len1 = WASM_VECTOR_LEN;
|
|
127
|
+
const ptr2 = passStringToWasm0(fields_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
128
|
+
const len2 = WASM_VECTOR_LEN;
|
|
129
|
+
const ptr3 = passStringToWasm0(owner_seed_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
130
|
+
const len3 = WASM_VECTOR_LEN;
|
|
131
|
+
const ret = wasm.buildTypedOrderCall(chain_id, ptr0, len0, ptr1, len1, scheme_off, ptr_off, region_off, ptr2, len2, ptr3, len3, owner_index, nonce);
|
|
132
|
+
var ptr5 = ret[0];
|
|
133
|
+
var len5 = ret[1];
|
|
134
|
+
if (ret[3]) {
|
|
135
|
+
ptr5 = 0; len5 = 0;
|
|
136
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
137
|
+
}
|
|
138
|
+
deferred6_0 = ptr5;
|
|
139
|
+
deferred6_1 = len5;
|
|
140
|
+
return getStringFromWasm0(ptr5, len5);
|
|
141
|
+
} finally {
|
|
142
|
+
wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
106
146
|
/**
|
|
107
147
|
* @param {string} name
|
|
108
148
|
* @returns {bigint}
|
package/pkg/qcore_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -5,6 +5,7 @@ export const account_body: (a: number, b: number) => [number, number];
|
|
|
5
5
|
export const address: (a: number, b: number, c: bigint) => [number, number, number, number];
|
|
6
6
|
export const block_by_height_body: (a: bigint) => [number, number];
|
|
7
7
|
export const buildSignedOrderCall: (a: bigint, b: number, c: number, d: number, e: number, f: bigint, g: bigint, h: number, i: number, j: number, k: number, l: bigint, m: number, n: number, o: bigint, p: bigint) => [number, number, number, number];
|
|
8
|
+
export const buildTypedOrderCall: (a: bigint, b: number, c: number, d: number, e: number, f: bigint, g: bigint, h: bigint, i: number, j: number, k: number, l: number, m: bigint, n: bigint) => [number, number, number, number];
|
|
8
9
|
export const chainIdFromName: (a: number, b: number) => bigint;
|
|
9
10
|
export const contractAddress: (a: number, b: number, c: bigint) => [number, number];
|
|
10
11
|
export const eventsBody: (a: bigint) => [number, number];
|
package/pkg-node/README.md
CHANGED
|
@@ -180,13 +180,13 @@ The [examples](examples) folder holds a runnable quickstart that mirrors the one
|
|
|
180
180
|
|
|
181
181
|
## Releases and provenance
|
|
182
182
|
|
|
183
|
-
Releases are published from CI by the publish workflow in `.github/workflows/publish.yml`, which runs on a pushed git tag. It
|
|
183
|
+
Releases are published from CI by the publish workflow in `.github/workflows/publish.yml`, which runs on a pushed git tag. It runs the offline tests and publishes with npm provenance, so the published tarball carries a provenance badge that ties it to this exact public commit. The wasm is built from the Rust core and committed to the repository, so confirming that the shipped wasm matches the source means rebuilding it from this commit and comparing the bytes. Nothing is published to a registry without an explicit tag. This package handles a user's keys and a published version cannot be taken back.
|
|
184
184
|
|
|
185
185
|
For the provenance publish to run, the maintainer adds an `NPM_TOKEN` automation secret to the repository, or configures npm trusted publishing for the package so the workflow authenticates over OIDC with no stored token.
|
|
186
186
|
|
|
187
187
|
## Security
|
|
188
188
|
|
|
189
|
-
To report a vulnerability,
|
|
189
|
+
To report a vulnerability, please disclose it privately to the Quantova team rather than through a public issue.
|
|
190
190
|
|
|
191
191
|
## Ownership and license
|
|
192
192
|
|
package/pkg-node/qcore_js.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ export function block_by_height_body(height: bigint): string;
|
|
|
9
9
|
|
|
10
10
|
export function buildSignedOrderCall(chain_id: bigint, contract: string, selector_hex: string, scheme_off: bigint, ptr_off: bigint, field_offs_csv: string, fields_csv: string, region_off: bigint, owner_seed_hex: string, owner_index: bigint, nonce: bigint): string;
|
|
11
11
|
|
|
12
|
+
export function buildTypedOrderCall(chain_id: bigint, contract: string, selector_hex: string, scheme_off: bigint, ptr_off: bigint, region_off: bigint, fields_json: string, owner_seed_hex: string, owner_index: bigint, nonce: bigint): string;
|
|
13
|
+
|
|
12
14
|
export function chainIdFromName(name: string): bigint;
|
|
13
15
|
|
|
14
16
|
export function contractAddress(deployer: string, nonce: bigint): string | undefined;
|
package/pkg-node/qcore_js.js
CHANGED
|
@@ -109,6 +109,47 @@ function buildSignedOrderCall(chain_id, contract, selector_hex, scheme_off, ptr_
|
|
|
109
109
|
}
|
|
110
110
|
exports.buildSignedOrderCall = buildSignedOrderCall;
|
|
111
111
|
|
|
112
|
+
/**
|
|
113
|
+
* @param {bigint} chain_id
|
|
114
|
+
* @param {string} contract
|
|
115
|
+
* @param {string} selector_hex
|
|
116
|
+
* @param {bigint} scheme_off
|
|
117
|
+
* @param {bigint} ptr_off
|
|
118
|
+
* @param {bigint} region_off
|
|
119
|
+
* @param {string} fields_json
|
|
120
|
+
* @param {string} owner_seed_hex
|
|
121
|
+
* @param {bigint} owner_index
|
|
122
|
+
* @param {bigint} nonce
|
|
123
|
+
* @returns {string}
|
|
124
|
+
*/
|
|
125
|
+
function buildTypedOrderCall(chain_id, contract, selector_hex, scheme_off, ptr_off, region_off, fields_json, owner_seed_hex, owner_index, nonce) {
|
|
126
|
+
let deferred6_0;
|
|
127
|
+
let deferred6_1;
|
|
128
|
+
try {
|
|
129
|
+
const ptr0 = passStringToWasm0(contract, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
130
|
+
const len0 = WASM_VECTOR_LEN;
|
|
131
|
+
const ptr1 = passStringToWasm0(selector_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
132
|
+
const len1 = WASM_VECTOR_LEN;
|
|
133
|
+
const ptr2 = passStringToWasm0(fields_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
134
|
+
const len2 = WASM_VECTOR_LEN;
|
|
135
|
+
const ptr3 = passStringToWasm0(owner_seed_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
136
|
+
const len3 = WASM_VECTOR_LEN;
|
|
137
|
+
const ret = wasm.buildTypedOrderCall(chain_id, ptr0, len0, ptr1, len1, scheme_off, ptr_off, region_off, ptr2, len2, ptr3, len3, owner_index, nonce);
|
|
138
|
+
var ptr5 = ret[0];
|
|
139
|
+
var len5 = ret[1];
|
|
140
|
+
if (ret[3]) {
|
|
141
|
+
ptr5 = 0; len5 = 0;
|
|
142
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
143
|
+
}
|
|
144
|
+
deferred6_0 = ptr5;
|
|
145
|
+
deferred6_1 = len5;
|
|
146
|
+
return getStringFromWasm0(ptr5, len5);
|
|
147
|
+
} finally {
|
|
148
|
+
wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
exports.buildTypedOrderCall = buildTypedOrderCall;
|
|
152
|
+
|
|
112
153
|
/**
|
|
113
154
|
* @param {string} name
|
|
114
155
|
* @returns {bigint}
|
|
Binary file
|
package/shared.js
CHANGED
|
@@ -297,7 +297,7 @@ function makeClient(core) {
|
|
|
297
297
|
return BigInt(core.storageValue(JSON.stringify(resp), core.scalarSlotKey(BigInt(slot))));
|
|
298
298
|
}
|
|
299
299
|
|
|
300
|
-
async callSignedOrder(callerSeedHex, callerIndex, contract, selectorHex,
|
|
300
|
+
async callSignedOrder(callerSeedHex, callerIndex, contract, selectorHex, orderSpec, ownerSeedHex, ownerIndex, meterLimit, maxFeeQuon) {
|
|
301
301
|
if (!core.valid_address(contract)) throw new Error('the contract is not a q1 address');
|
|
302
302
|
const ceiling = feeCeiling(maxFeeQuon);
|
|
303
303
|
const info = await this.nodeInfo();
|
|
@@ -310,15 +310,16 @@ function makeClient(core) {
|
|
|
310
310
|
}
|
|
311
311
|
const signer = core.orderSigner(ownerSeedHex, BigInt(ownerIndex));
|
|
312
312
|
const nonce = await this.contractNonce(contract, signer);
|
|
313
|
-
|
|
313
|
+
// orderSpec.fields are the signed fields in message order, each { offset, width, value } read
|
|
314
|
+
// from the interface descriptor, so a wide amount or an address is signed at its true width.
|
|
315
|
+
const order = JSON.parse(core.buildTypedOrderCall(
|
|
314
316
|
chainId,
|
|
315
317
|
contract,
|
|
316
318
|
selectorHex,
|
|
317
|
-
BigInt(
|
|
318
|
-
BigInt(
|
|
319
|
-
(
|
|
320
|
-
(fields || [])
|
|
321
|
-
BigInt(layout.regionOff || 0),
|
|
319
|
+
BigInt(orderSpec.schemeOff),
|
|
320
|
+
BigInt(orderSpec.ptrOff),
|
|
321
|
+
BigInt(orderSpec.regionOff || 0),
|
|
322
|
+
JSON.stringify(orderSpec.fields || []),
|
|
322
323
|
ownerSeedHex,
|
|
323
324
|
BigInt(ownerIndex),
|
|
324
325
|
nonce,
|