@orbinum/sdk 0.23.0 → 0.24.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/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/index.mjs +6 -6
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -124,7 +124,7 @@ declare class SubstrateClient {
|
|
|
124
124
|
static connect(wsUrl: string, timeoutMs?: number): Promise<SubstrateClient>;
|
|
125
125
|
/**
|
|
126
126
|
* Performs a raw JSON-RPC request. Use this for custom Orbinum RPCs
|
|
127
|
-
* (
|
|
127
|
+
* (`privacy_*`, `zkVerifier_*`, `relayer_*`, etc.).
|
|
128
128
|
*/
|
|
129
129
|
request<T>(method: string, params?: unknown[]): Promise<T>;
|
|
130
130
|
/**
|
|
@@ -2203,7 +2203,7 @@ declare function deriveViewingSecretKey(spendingKey: bigint): Uint8Array;
|
|
|
2203
2203
|
* Derive the packed BabyJubJub viewing public key (ivk) from ivsk bytes.
|
|
2204
2204
|
*
|
|
2205
2205
|
* ivsk_scalar = BigInt(ivsk_bytes_BE) % BABYJUB_SUBORDER (clamped to [1, ∞))
|
|
2206
|
-
* ivk_point =
|
|
2206
|
+
* ivk_point = fastMulBase(ivsk_scalar) → [Ax, Ay]
|
|
2207
2207
|
* result = bigintTo32Le(packPoint([Ax, Ay])) → 32-byte Uint8Array (LE)
|
|
2208
2208
|
*
|
|
2209
2209
|
* The packed bigint is stored in little-endian so it is consistent with the
|
package/dist/index.d.ts
CHANGED
|
@@ -124,7 +124,7 @@ declare class SubstrateClient {
|
|
|
124
124
|
static connect(wsUrl: string, timeoutMs?: number): Promise<SubstrateClient>;
|
|
125
125
|
/**
|
|
126
126
|
* Performs a raw JSON-RPC request. Use this for custom Orbinum RPCs
|
|
127
|
-
* (
|
|
127
|
+
* (`privacy_*`, `zkVerifier_*`, `relayer_*`, etc.).
|
|
128
128
|
*/
|
|
129
129
|
request<T>(method: string, params?: unknown[]): Promise<T>;
|
|
130
130
|
/**
|
|
@@ -2203,7 +2203,7 @@ declare function deriveViewingSecretKey(spendingKey: bigint): Uint8Array;
|
|
|
2203
2203
|
* Derive the packed BabyJubJub viewing public key (ivk) from ivsk bytes.
|
|
2204
2204
|
*
|
|
2205
2205
|
* ivsk_scalar = BigInt(ivsk_bytes_BE) % BABYJUB_SUBORDER (clamped to [1, ∞))
|
|
2206
|
-
* ivk_point =
|
|
2206
|
+
* ivk_point = fastMulBase(ivsk_scalar) → [Ax, Ay]
|
|
2207
2207
|
* result = bigintTo32Le(packPoint([Ax, Ay])) → 32-byte Uint8Array (LE)
|
|
2208
2208
|
*
|
|
2209
2209
|
* The packed bigint is stored in little-endian so it is consistent with the
|
package/dist/index.js
CHANGED
|
@@ -279,7 +279,7 @@ var SubstrateClient = class _SubstrateClient {
|
|
|
279
279
|
}
|
|
280
280
|
/**
|
|
281
281
|
* Performs a raw JSON-RPC request. Use this for custom Orbinum RPCs
|
|
282
|
-
* (
|
|
282
|
+
* (`privacy_*`, `zkVerifier_*`, `relayer_*`, etc.).
|
|
283
283
|
*/
|
|
284
284
|
async request(method, params = []) {
|
|
285
285
|
return this._papi._request(method, params);
|
|
@@ -3570,13 +3570,13 @@ function deriveViewingSecretKey(spendingKey) {
|
|
|
3570
3570
|
}
|
|
3571
3571
|
function deriveViewingPublicKey(ivsk) {
|
|
3572
3572
|
const ivskScalar = BigInt(toHex(ivsk)) % BABYJUB_SUBORDER || 1n;
|
|
3573
|
-
const ivkPoint = (
|
|
3573
|
+
const ivkPoint = fastMulBase(ivskScalar);
|
|
3574
3574
|
const packed = (0, import_baby_jubjub6.packPoint)(ivkPoint);
|
|
3575
3575
|
return bigintTo32Le(packed);
|
|
3576
3576
|
}
|
|
3577
3577
|
function deriveOwnerPk(spendingKey) {
|
|
3578
3578
|
try {
|
|
3579
|
-
const pubPoint = (
|
|
3579
|
+
const pubPoint = fastMulBase(spendingKey);
|
|
3580
3580
|
return pubPoint[0];
|
|
3581
3581
|
} catch {
|
|
3582
3582
|
return 0n;
|
package/dist/index.mjs
CHANGED
|
@@ -142,7 +142,7 @@ var SubstrateClient = class _SubstrateClient {
|
|
|
142
142
|
}
|
|
143
143
|
/**
|
|
144
144
|
* Performs a raw JSON-RPC request. Use this for custom Orbinum RPCs
|
|
145
|
-
* (
|
|
145
|
+
* (`privacy_*`, `zkVerifier_*`, `relayer_*`, etc.).
|
|
146
146
|
*/
|
|
147
147
|
async request(method, params = []) {
|
|
148
148
|
return this._papi._request(method, params);
|
|
@@ -3406,7 +3406,7 @@ ${canonicalAccountId(address)}`;
|
|
|
3406
3406
|
// src/privacy-keys/PrivacyKeys.ts
|
|
3407
3407
|
import { hkdf as hkdf2 } from "@noble/hashes/hkdf.js";
|
|
3408
3408
|
import { sha256 as sha2564 } from "@noble/hashes/sha2.js";
|
|
3409
|
-
import {
|
|
3409
|
+
import { packPoint as packPoint3 } from "@zk-kit/baby-jubjub";
|
|
3410
3410
|
var IVK_DOMAIN = new TextEncoder().encode("orbinum-ivk-v1");
|
|
3411
3411
|
var KEY_VERSION = "v2";
|
|
3412
3412
|
var MIN_SIGNATURE_BYTES = 32;
|
|
@@ -3436,13 +3436,13 @@ function deriveViewingSecretKey(spendingKey) {
|
|
|
3436
3436
|
}
|
|
3437
3437
|
function deriveViewingPublicKey(ivsk) {
|
|
3438
3438
|
const ivskScalar = BigInt(toHex(ivsk)) % BABYJUB_SUBORDER || 1n;
|
|
3439
|
-
const ivkPoint =
|
|
3439
|
+
const ivkPoint = fastMulBase(ivskScalar);
|
|
3440
3440
|
const packed = packPoint3(ivkPoint);
|
|
3441
3441
|
return bigintTo32Le(packed);
|
|
3442
3442
|
}
|
|
3443
3443
|
function deriveOwnerPk(spendingKey) {
|
|
3444
3444
|
try {
|
|
3445
|
-
const pubPoint =
|
|
3445
|
+
const pubPoint = fastMulBase(spendingKey);
|
|
3446
3446
|
return pubPoint[0];
|
|
3447
3447
|
} catch {
|
|
3448
3448
|
return 0n;
|
|
@@ -3755,7 +3755,7 @@ import {
|
|
|
3755
3755
|
WebArtifactProvider as WebArtifactProvider2
|
|
3756
3756
|
} from "@orbinum/proof-generator";
|
|
3757
3757
|
import { randomBytes as randomBytes3 } from "@noble/ciphers/utils.js";
|
|
3758
|
-
import { mulPointEscalar as
|
|
3758
|
+
import { mulPointEscalar as mulPointEscalar4, Base8 as Base82 } from "@zk-kit/baby-jubjub";
|
|
3759
3759
|
import { poseidon4 as poseidon44 } from "poseidon-lite";
|
|
3760
3760
|
|
|
3761
3761
|
// src/proof-generator/merkle.ts
|
|
@@ -3778,7 +3778,7 @@ async function generateUnshieldProof(inputs, options = {}) {
|
|
|
3778
3778
|
if (changeValue < 0n) {
|
|
3779
3779
|
throw new Error("changeValue must be >= 0.");
|
|
3780
3780
|
}
|
|
3781
|
-
const changeOwnerPubkey = inputs.changeOwnerPubkey ??
|
|
3781
|
+
const changeOwnerPubkey = inputs.changeOwnerPubkey ?? mulPointEscalar4(Base82, inputs.spendingKey)[0];
|
|
3782
3782
|
const changeBlinding = inputs.changeBlinding ?? (changeValue > 0n ? bytesToBigintLE(randomBytes3(32)) : 0n);
|
|
3783
3783
|
const changeCommitment = changeValue > 0n ? poseidon44([changeValue, inputs.assetId, changeOwnerPubkey, changeBlinding]) : 0n;
|
|
3784
3784
|
const circuitInputs = {
|