@quantovainc/qcore 0.5.6 → 0.5.7
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 +4 -1
- package/index.d.ts +2 -0
- package/package.json +1 -1
- package/pkg/README.md +4 -1
- package/pkg/package.json +1 -1
- package/pkg/qcore_js.d.ts +2 -0
- package/pkg/qcore_js_bg.js +17 -0
- package/pkg/qcore_js_bg.wasm +0 -0
- package/pkg/qcore_js_bg.wasm.d.ts +2 -0
- package/pkg-node/README.md +4 -1
- package/pkg-node/package.json +1 -1
- package/pkg-node/qcore_js.d.ts +2 -0
- package/pkg-node/qcore_js.js +17 -0
- package/pkg-node/qcore_js_bg.wasm +0 -0
- package/shared.js +2 -0
- package/shared.mjs +2 -0
package/README.md
CHANGED
|
@@ -155,7 +155,10 @@ than you intended.
|
|
|
155
155
|
This comparison lives in the Client and only in the Client. The raw core.* signing functions, such as
|
|
156
156
|
core.sign_transfer, take the actual fee that goes on the wire, not a ceiling, and do no gateway
|
|
157
157
|
comparison at all. A developer who calls core.* directly has no fee cap, so reach for the Client whenever
|
|
158
|
-
a gateway you do not control reports the fee.
|
|
158
|
+
a gateway you do not control reports the fee. The raw signing functions also take the validity deadline
|
|
159
|
+
ready made and do not compare it with the chain head, so call core.checkValidUntil with a head you trust
|
|
160
|
+
first. A SigningSession reserves each nonce it hands out until it is signed, and a flow that stops early
|
|
161
|
+
frees its nonce with release.
|
|
159
162
|
|
|
160
163
|
A contract call pays one transfer fee for every started 1210 units of its meter limit, and the chain
|
|
161
164
|
refuses a call that pays less. The raw call signers, core.sign_call, core.signPayableCall, and
|
package/index.d.ts
CHANGED
|
@@ -212,6 +212,8 @@ export interface SigningSession {
|
|
|
212
212
|
rememberAddress(address: string): void;
|
|
213
213
|
checkTarget(address: string): void;
|
|
214
214
|
slot(key: string, reported: bigint, expected: bigint | undefined, order: boolean): bigint;
|
|
215
|
+
release(key: string, slot: bigint): void;
|
|
216
|
+
releasePending(key: string): void;
|
|
215
217
|
signed(key: string, slot: bigint): void;
|
|
216
218
|
outcome(key: string, slot: bigint, accepted: boolean): void;
|
|
217
219
|
nextNonce(key: string): bigint | undefined;
|
package/package.json
CHANGED
package/pkg/README.md
CHANGED
|
@@ -155,7 +155,10 @@ than you intended.
|
|
|
155
155
|
This comparison lives in the Client and only in the Client. The raw core.* signing functions, such as
|
|
156
156
|
core.sign_transfer, take the actual fee that goes on the wire, not a ceiling, and do no gateway
|
|
157
157
|
comparison at all. A developer who calls core.* directly has no fee cap, so reach for the Client whenever
|
|
158
|
-
a gateway you do not control reports the fee.
|
|
158
|
+
a gateway you do not control reports the fee. The raw signing functions also take the validity deadline
|
|
159
|
+
ready made and do not compare it with the chain head, so call core.checkValidUntil with a head you trust
|
|
160
|
+
first. A SigningSession reserves each nonce it hands out until it is signed, and a flow that stops early
|
|
161
|
+
frees its nonce with release.
|
|
159
162
|
|
|
160
163
|
A contract call pays one transfer fee for every started 1210 units of its meter limit, and the chain
|
|
161
164
|
refuses a call that pays less. The raw call signers, core.sign_call, core.signPayableCall, and
|
package/pkg/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "qcore-js",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "The JavaScript binding for the Quantova client core, generated over QCore with wasm-bindgen. The core does the key derivation, the post quantum signing, and the wire, the page does the fetch.",
|
|
5
|
-
"version": "0.5.
|
|
5
|
+
"version": "0.5.7",
|
|
6
6
|
"license": "Apache-2.0 OR MIT",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
package/pkg/qcore_js.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ export class SigningSession {
|
|
|
9
9
|
constructor(book: string[]);
|
|
10
10
|
nextNonce(key: string): bigint | undefined;
|
|
11
11
|
outcome(key: string, slot: bigint, accepted: boolean): void;
|
|
12
|
+
release(key: string, slot: bigint): void;
|
|
13
|
+
releasePending(key: string): void;
|
|
12
14
|
rememberAddress(address: string): void;
|
|
13
15
|
signed(key: string, slot: bigint): void;
|
|
14
16
|
slot(key: string, reported: bigint, expected: bigint | null | undefined, order: boolean): bigint;
|
package/pkg/qcore_js_bg.js
CHANGED
|
@@ -65,6 +65,23 @@ export class SigningSession {
|
|
|
65
65
|
const len0 = WASM_VECTOR_LEN;
|
|
66
66
|
wasm.signingsession_outcome(this.__wbg_ptr, ptr0, len0, slot, accepted);
|
|
67
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* @param {string} key
|
|
70
|
+
* @param {bigint} slot
|
|
71
|
+
*/
|
|
72
|
+
release(key, slot) {
|
|
73
|
+
const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
74
|
+
const len0 = WASM_VECTOR_LEN;
|
|
75
|
+
wasm.signingsession_release(this.__wbg_ptr, ptr0, len0, slot);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* @param {string} key
|
|
79
|
+
*/
|
|
80
|
+
releasePending(key) {
|
|
81
|
+
const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
82
|
+
const len0 = WASM_VECTOR_LEN;
|
|
83
|
+
wasm.signingsession_releasePending(this.__wbg_ptr, ptr0, len0);
|
|
84
|
+
}
|
|
68
85
|
/**
|
|
69
86
|
* @param {string} address
|
|
70
87
|
*/
|
package/pkg/qcore_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -46,6 +46,8 @@ export const signingsession_isHeld: (a: number, b: number, c: number, d: bigint)
|
|
|
46
46
|
export const signingsession_new: (a: number, b: number) => [number, number, number];
|
|
47
47
|
export const signingsession_nextNonce: (a: number, b: number, c: number) => [number, bigint];
|
|
48
48
|
export const signingsession_outcome: (a: number, b: number, c: number, d: bigint, e: number) => void;
|
|
49
|
+
export const signingsession_release: (a: number, b: number, c: number, d: bigint) => void;
|
|
50
|
+
export const signingsession_releasePending: (a: number, b: number, c: number) => void;
|
|
49
51
|
export const signingsession_rememberAddress: (a: number, b: number, c: number) => void;
|
|
50
52
|
export const signingsession_signed: (a: number, b: number, c: number, d: bigint) => void;
|
|
51
53
|
export const signingsession_slot: (a: number, b: number, c: number, d: bigint, e: number, f: bigint, g: number) => [bigint, number, number];
|
package/pkg-node/README.md
CHANGED
|
@@ -155,7 +155,10 @@ than you intended.
|
|
|
155
155
|
This comparison lives in the Client and only in the Client. The raw core.* signing functions, such as
|
|
156
156
|
core.sign_transfer, take the actual fee that goes on the wire, not a ceiling, and do no gateway
|
|
157
157
|
comparison at all. A developer who calls core.* directly has no fee cap, so reach for the Client whenever
|
|
158
|
-
a gateway you do not control reports the fee.
|
|
158
|
+
a gateway you do not control reports the fee. The raw signing functions also take the validity deadline
|
|
159
|
+
ready made and do not compare it with the chain head, so call core.checkValidUntil with a head you trust
|
|
160
|
+
first. A SigningSession reserves each nonce it hands out until it is signed, and a flow that stops early
|
|
161
|
+
frees its nonce with release.
|
|
159
162
|
|
|
160
163
|
A contract call pays one transfer fee for every started 1210 units of its meter limit, and the chain
|
|
161
164
|
refuses a call that pays less. The raw call signers, core.sign_call, core.signPayableCall, and
|
package/pkg-node/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qcore-js",
|
|
3
3
|
"description": "The JavaScript binding for the Quantova client core, generated over QCore with wasm-bindgen. The core does the key derivation, the post quantum signing, and the wire, the page does the fetch.",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.7",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
package/pkg-node/qcore_js.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ export class SigningSession {
|
|
|
9
9
|
constructor(book: string[]);
|
|
10
10
|
nextNonce(key: string): bigint | undefined;
|
|
11
11
|
outcome(key: string, slot: bigint, accepted: boolean): void;
|
|
12
|
+
release(key: string, slot: bigint): void;
|
|
13
|
+
releasePending(key: string): void;
|
|
12
14
|
rememberAddress(address: string): void;
|
|
13
15
|
signed(key: string, slot: bigint): void;
|
|
14
16
|
slot(key: string, reported: bigint, expected: bigint | null | undefined, order: boolean): bigint;
|
package/pkg-node/qcore_js.js
CHANGED
|
@@ -67,6 +67,23 @@ class SigningSession {
|
|
|
67
67
|
const len0 = WASM_VECTOR_LEN;
|
|
68
68
|
wasm.signingsession_outcome(this.__wbg_ptr, ptr0, len0, slot, accepted);
|
|
69
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* @param {string} key
|
|
72
|
+
* @param {bigint} slot
|
|
73
|
+
*/
|
|
74
|
+
release(key, slot) {
|
|
75
|
+
const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
76
|
+
const len0 = WASM_VECTOR_LEN;
|
|
77
|
+
wasm.signingsession_release(this.__wbg_ptr, ptr0, len0, slot);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* @param {string} key
|
|
81
|
+
*/
|
|
82
|
+
releasePending(key) {
|
|
83
|
+
const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
84
|
+
const len0 = WASM_VECTOR_LEN;
|
|
85
|
+
wasm.signingsession_releasePending(this.__wbg_ptr, ptr0, len0);
|
|
86
|
+
}
|
|
70
87
|
/**
|
|
71
88
|
* @param {string} address
|
|
72
89
|
*/
|
|
Binary file
|
package/shared.js
CHANGED
|
@@ -479,6 +479,7 @@ function makeClient(core) {
|
|
|
479
479
|
async _accountSlot(from, expectedNonce) {
|
|
480
480
|
const acct = await this.account(from);
|
|
481
481
|
const reported = gatewayInteger(acct.nonce, 'nonce');
|
|
482
|
+
this._session.releasePending(from);
|
|
482
483
|
return BigInt(this._session.slot(from, reported, this._expected(expectedNonce, 'expected nonce'), false));
|
|
483
484
|
}
|
|
484
485
|
|
|
@@ -666,6 +667,7 @@ function makeClient(core) {
|
|
|
666
667
|
const signer = core.orderSigner(ownerSeed, accountIndex(ownerIndex));
|
|
667
668
|
const orderKey = contract + '/' + signer;
|
|
668
669
|
const reportedOrder = await this.contractNonce(contract, signer);
|
|
670
|
+
this._session.releasePending(orderKey);
|
|
669
671
|
const nonce = BigInt(this._session.slot(orderKey, reportedOrder, this._expected(expectedOrderNonce, 'expected order nonce'), true));
|
|
670
672
|
if (typeof orderSpec.layoutHash !== 'string') throw new Error('the order spec needs the layout hash the compiler emits for this entry');
|
|
671
673
|
const orderExpiry = wholeNumber(orderSpec.expiry, 'order expiry', U64_MAX);
|
package/shared.mjs
CHANGED
|
@@ -479,6 +479,7 @@ function makeClient(core) {
|
|
|
479
479
|
async _accountSlot(from, expectedNonce) {
|
|
480
480
|
const acct = await this.account(from);
|
|
481
481
|
const reported = gatewayInteger(acct.nonce, 'nonce');
|
|
482
|
+
this._session.releasePending(from);
|
|
482
483
|
return BigInt(this._session.slot(from, reported, this._expected(expectedNonce, 'expected nonce'), false));
|
|
483
484
|
}
|
|
484
485
|
|
|
@@ -666,6 +667,7 @@ function makeClient(core) {
|
|
|
666
667
|
const signer = core.orderSigner(ownerSeed, accountIndex(ownerIndex));
|
|
667
668
|
const orderKey = contract + '/' + signer;
|
|
668
669
|
const reportedOrder = await this.contractNonce(contract, signer);
|
|
670
|
+
this._session.releasePending(orderKey);
|
|
669
671
|
const nonce = BigInt(this._session.slot(orderKey, reportedOrder, this._expected(expectedOrderNonce, 'expected order nonce'), true));
|
|
670
672
|
if (typeof orderSpec.layoutHash !== 'string') throw new Error('the order spec needs the layout hash the compiler emits for this entry');
|
|
671
673
|
const orderExpiry = wholeNumber(orderSpec.expiry, 'order expiry', U64_MAX);
|