@gurge/sdk-react-native 0.3.120 → 0.3.124
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/common/src/crypto/babyJub.cjs +1 -1
- package/common/src/crypto/babyJub.mjs +4 -5
- package/common/src/crypto/eddsa.cjs +1 -1
- package/common/src/crypto/eddsa.mjs +4 -5
- package/common/src/crypto/poseidon.cjs +1 -1
- package/common/src/crypto/poseidon.mjs +7 -15
- package/common/src/data-structures/IndexedDB/key-val-store.cjs +1 -1
- package/common/src/data-structures/IndexedDB/key-val-store.mjs +18 -17
- package/common/src/functions/index.cjs +1 -1
- package/common/src/functions/index.mjs +0 -1
- package/common/src/functions/utils/bigint-math.utils.cjs +1 -1
- package/common/src/functions/utils/bigint-math.utils.mjs +1 -18
- package/common/src/functions/utils/index.cjs +1 -1
- package/common/src/functions/utils/index.mjs +1 -1
- package/common/src/webworker/utxoWorker/utxoWorkerLauncher.ts?worker&url.cjs +1 -1
- package/common/src/webworker/utxoWorker/utxoWorkerLauncher.ts?worker&url.mjs +1 -1
- package/common/src/webworker/viteWorkerURL.constant.mjs +3 -3
- package/common/src/webworker/zkProofWorker/zkProofWorkerLauncher.ts?worker&url.cjs +1 -1
- package/common/src/webworker/zkProofWorker/zkProofWorkerLauncher.ts?worker&url.mjs +1 -1
- package/package.json +2 -2
- package/scripts/patch-libsodium-for-rn.js +3 -8
- package/shims/circomlibjs-hinkal-fork.cjs +15 -2
- package/shims/circomlibjs.cjs +1 -1
- package/common/src/crypto/BabyJubRN.cjs +0 -1
- package/common/src/crypto/BabyJubRN.d.ts +0 -20
- package/common/src/crypto/BabyJubRN.mjs +0 -66
- package/common/src/crypto/EddsaRN.cjs +0 -1
- package/common/src/crypto/EddsaRN.d.ts +0 -19
- package/common/src/crypto/EddsaRN.mjs +0 -41
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../constants/vite.constants.cjs`)
|
|
1
|
+
const e=require(`../constants/vite.constants.cjs`);var t=require(`../../../shims/circomlibjs-hinkal-fork.cjs`).default,n=new class{babyjub=void 0;async init(){this.babyjub||=e.isReactNative?(0,t.buildBabyJubRN)():await(0,t.buildBabyjub)()}getJub(){return this.babyjub}},r=()=>n.getJub();exports.babyJubInstance=r,exports.jubHolder=n;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { isReactNative as e } from "../constants/vite.constants.mjs";
|
|
2
2
|
import { require_circomlibjs_hinkal_fork as t } from "../../../shims/circomlibjs-hinkal-fork.mjs";
|
|
3
|
-
import { BabyJubRN as n } from "./BabyJubRN.mjs";
|
|
4
3
|
//#region common/src/crypto/babyJub.ts
|
|
5
|
-
var
|
|
4
|
+
var n = t(), r = new class {
|
|
6
5
|
babyjub = void 0;
|
|
7
6
|
async init() {
|
|
8
|
-
this.babyjub ||= e ?
|
|
7
|
+
this.babyjub ||= e ? (0, n.buildBabyJubRN)() : await (0, n.buildBabyjub)();
|
|
9
8
|
}
|
|
10
9
|
getJub() {
|
|
11
10
|
return this.babyjub;
|
|
12
11
|
}
|
|
13
|
-
}(),
|
|
12
|
+
}(), i = () => r.getJub();
|
|
14
13
|
//#endregion
|
|
15
|
-
export {
|
|
14
|
+
export { i as babyJubInstance, r as jubHolder };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../constants/vite.constants.cjs`)
|
|
1
|
+
const e=require(`../constants/vite.constants.cjs`);var t=require(`../../../shims/circomlibjs-hinkal-fork.cjs`).default,n=new class{eddsa=void 0;async init(){this.eddsa||=e.isReactNative?await(0,t.buildEddsaRN)():await(0,t.buildEddsa)()}getEddsa(){return this.eddsa}},r=()=>n.getEddsa();exports.eddsaHolder=n,exports.eddsaInstance=r;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { isReactNative as e } from "../constants/vite.constants.mjs";
|
|
2
2
|
import { require_circomlibjs_hinkal_fork as t } from "../../../shims/circomlibjs-hinkal-fork.mjs";
|
|
3
|
-
import { buildEddsaRN as n } from "./EddsaRN.mjs";
|
|
4
3
|
//#region common/src/crypto/eddsa.ts
|
|
5
|
-
var
|
|
4
|
+
var n = t(), r = new class {
|
|
6
5
|
eddsa = void 0;
|
|
7
6
|
async init() {
|
|
8
|
-
this.eddsa ||= e ? await n() : await (0,
|
|
7
|
+
this.eddsa ||= e ? await (0, n.buildEddsaRN)() : await (0, n.buildEddsa)();
|
|
9
8
|
}
|
|
10
9
|
getEddsa() {
|
|
11
10
|
return this.eddsa;
|
|
12
11
|
}
|
|
13
|
-
}(),
|
|
12
|
+
}(), i = () => r.getEddsa();
|
|
14
13
|
//#endregion
|
|
15
|
-
export {
|
|
14
|
+
export { r as eddsaHolder, i as eddsaInstance };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
require("../../../_virtual/_rolldown/runtime.cjs");const e=require(`../constants/vite.constants.cjs`),t=require(`../functions/utils/amounts.utils.cjs`),n=require(`../../../shims/circomlibjs-hinkal-fork.cjs`);let r=require(`ethers`);var i=n.default,a=new class{poseidon=void 0;async init(){this.poseidon||=e.isReactNative?(0,i.buildPoseidonRN)():await(0,i.buildPoseidon)()}getPoseidon(){return this.poseidon}};function o(...e){let n=a.getPoseidon();return t.toBigInt(n.F.toString(n(e)))}var s=(...e)=>{let t=a.getPoseidon();return r.ethers.toBeHex(t.F.toString(t([...e])))};exports.poseidonFunction=o,exports.poseidonHash=s,exports.poseidonHolder=a;
|
|
@@ -2,31 +2,23 @@ import { isReactNative as e } from "../constants/vite.constants.mjs";
|
|
|
2
2
|
import { toBigInt as t } from "../functions/utils/amounts.utils.mjs";
|
|
3
3
|
import { require_circomlibjs_hinkal_fork as n } from "../../../shims/circomlibjs-hinkal-fork.mjs";
|
|
4
4
|
import { ethers as r } from "ethers";
|
|
5
|
-
import * as i from "poseidon-lite";
|
|
6
5
|
//#region common/src/crypto/poseidon.ts
|
|
7
|
-
var
|
|
8
|
-
let e = (e) => {
|
|
9
|
-
let t = i[`poseidon${e.length}`];
|
|
10
|
-
if (!t) throw Error(`Poseidon: arity ${e.length} not supported (1..16)`);
|
|
11
|
-
return t(e.map((e) => BigInt(e)));
|
|
12
|
-
};
|
|
13
|
-
return e.F = { toString: (e) => BigInt(e).toString() }, e;
|
|
14
|
-
}, s = new class {
|
|
6
|
+
var i = n(), a = new class {
|
|
15
7
|
poseidon = void 0;
|
|
16
8
|
async init() {
|
|
17
|
-
this.poseidon ||= e ?
|
|
9
|
+
this.poseidon ||= e ? (0, i.buildPoseidonRN)() : await (0, i.buildPoseidon)();
|
|
18
10
|
}
|
|
19
11
|
getPoseidon() {
|
|
20
12
|
return this.poseidon;
|
|
21
13
|
}
|
|
22
14
|
}();
|
|
23
|
-
function
|
|
24
|
-
let n =
|
|
15
|
+
function o(...e) {
|
|
16
|
+
let n = a.getPoseidon();
|
|
25
17
|
return t(n.F.toString(n(e)));
|
|
26
18
|
}
|
|
27
|
-
var
|
|
28
|
-
let t =
|
|
19
|
+
var s = (...e) => {
|
|
20
|
+
let t = a.getPoseidon();
|
|
29
21
|
return r.toBeHex(t.F.toString(t([...e])));
|
|
30
22
|
};
|
|
31
23
|
//#endregion
|
|
32
|
-
export {
|
|
24
|
+
export { o as poseidonFunction, s as poseidonHash, a as poseidonHolder };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../functions/utils/serialize.utils.cjs`),
|
|
1
|
+
const e=require("../../../../_virtual/_rolldown/runtime.cjs"),t=require(`../../functions/utils/serialize.utils.cjs`),n=require(`../../constants/vite.constants.cjs`),r=require(`../../../../shims/path.cjs`),i=require(`../../../../shims/idb-keyval.cjs`);require(`../../constants/index.cjs`);const a=require(`../cacheDevices/FileCacheDevice.cjs`);var o=()=>typeof globalThis<`u`&&`indexedDB`in globalThis&&globalThis.indexedDB!=null||n.isReactNative,s=class{idbPromise=null;idb(){return this.idbPromise||=n.isReactNative?Promise.resolve(i.default):Promise.resolve().then(()=>e.__toESM(require(`../../../../shims/idb-keyval.cjs`).default)),this.idbPromise}async get(e){let{get:t}=await this.idb();return t(e)}async set(e,t){let{set:n}=await this.idb();await n(e,t)}async update(e,t){let{update:n}=await this.idb(),r;return await n(e,e=>(r=t(e),r)),r}},c=class{device;constructor(){let e=r.default;this.device=new a.FileCacheDevice(!0,e.resolve(process.cwd(),`hinkalKeyValCache.json`))}async get(e){let n=this.device.get(e);if(n)return t.CustomJSONParse(n)}async set(e,n){this.device.set(e,t.CustomJSONStringify(n))}async update(e,t){let n=t(await this.get(e));return await this.set(e,n),n}},l=o()?new s:new c;exports.keyValStore=l;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { __toESM as e } from "../../../../_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import { CustomJSONParse as t, CustomJSONStringify as n } from "../../functions/utils/serialize.utils.mjs";
|
|
3
|
+
import { isReactNative as r } from "../../constants/vite.constants.mjs";
|
|
4
|
+
import { require_path as i } from "../../../../shims/path.mjs";
|
|
5
|
+
import { require_idb_keyval as a } from "../../../../shims/idb-keyval.mjs";
|
|
5
6
|
import "../../constants/index.mjs";
|
|
6
|
-
import { FileCacheDevice as
|
|
7
|
+
import { FileCacheDevice as o } from "../cacheDevices/FileCacheDevice.mjs";
|
|
7
8
|
//#region common/src/data-structures/IndexedDB/key-val-store.ts
|
|
8
|
-
var
|
|
9
|
+
var s = () => typeof globalThis < "u" && "indexedDB" in globalThis && globalThis.indexedDB != null || r, c = class {
|
|
9
10
|
idbPromise = null;
|
|
10
11
|
idb() {
|
|
11
|
-
return this.idbPromise ||= Promise.resolve(
|
|
12
|
+
return this.idbPromise ||= r ? Promise.resolve(a()) : import("../../../../shims/idb-keyval.mjs").then((t) => /* @__PURE__ */ e(t.default)), this.idbPromise;
|
|
12
13
|
}
|
|
13
14
|
async get(e) {
|
|
14
15
|
let { get: t } = await this.idb();
|
|
@@ -22,23 +23,23 @@ var o = () => typeof globalThis < "u" && "indexedDB" in globalThis && globalThis
|
|
|
22
23
|
let { update: n } = await this.idb(), r;
|
|
23
24
|
return await n(e, (e) => (r = t(e), r)), r;
|
|
24
25
|
}
|
|
25
|
-
},
|
|
26
|
+
}, l = class {
|
|
26
27
|
device;
|
|
27
28
|
constructor() {
|
|
28
|
-
let e =
|
|
29
|
-
this.device = new
|
|
29
|
+
let e = i();
|
|
30
|
+
this.device = new o(!0, e.resolve(process.cwd(), "hinkalKeyValCache.json"));
|
|
30
31
|
}
|
|
31
|
-
async get(
|
|
32
|
-
let n = this.device.get(
|
|
33
|
-
if (n) return
|
|
32
|
+
async get(e) {
|
|
33
|
+
let n = this.device.get(e);
|
|
34
|
+
if (n) return t(n);
|
|
34
35
|
}
|
|
35
|
-
async set(e,
|
|
36
|
-
this.device.set(e, t
|
|
36
|
+
async set(e, t) {
|
|
37
|
+
this.device.set(e, n(t));
|
|
37
38
|
}
|
|
38
39
|
async update(e, t) {
|
|
39
40
|
let n = t(await this.get(e));
|
|
40
41
|
return await this.set(e, n), n;
|
|
41
42
|
}
|
|
42
|
-
},
|
|
43
|
+
}, u = s() ? new c() : new l();
|
|
43
44
|
//#endregion
|
|
44
|
-
export {
|
|
45
|
+
export { u as keyValStore };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./utils/serialize.utils.cjs`),require(`./utils/abi.utils.cjs`),require(`./utils/caseInsensitive.utils.cjs`),require(`./utils/amounts.utils.cjs`),require(`./web3/etherFunctions.cjs`),require(`./utils/
|
|
1
|
+
require(`./utils/serialize.utils.cjs`),require(`./utils/abi.utils.cjs`),require(`./utils/caseInsensitive.utils.cjs`),require(`./utils/amounts.utils.cjs`),require(`./web3/etherFunctions.cjs`),require(`./utils/time.utils.cjs`),require(`./utils/upToDateState.cjs`),require(`./utils/cacheFunctions.cjs`),require(`./utils/enclaveHandshakeService.cjs`),require(`./utils/encryptInputForEnclave.cjs`),require(`./utils/solanaMint.utils.cjs`),require(`./utils/customEnclaveFunctionsRegister.cjs`),require(`./utils/serialize-utxos.utils.cjs`),require(`./utils/addresses.cjs`),require(`./utils/tron.utils.cjs`),require(`./web3/events/getInputUtxoAndBalance.cjs`),require(`./utils/get-signature-header.cjs`),require(`./utils/auth.utils.cjs`),require(`./utils/string.utils.cjs`),require(`./utils/token-check.utils.cjs`),require(`./utils/map.utils.cjs`),require(`./utils/mutexes.utils.cjs`),require(`./utils/erc20tokenFunctions.cjs`),require(`./web3/events/getShieldedBalance.cjs`),require(`./pre-transaction/outputUtxoProcessing.cjs`),require(`./utils/external-action.utils.cjs`),require(`./utils/bit.operations.cjs`),require(`./snarkjs/common.snarkjs.cjs`),require(`./pre-transaction/solana.cjs`),require(`./snarkjs/signedMessageHash.cjs`),require(`./pre-transaction/process-gas-estimates.cjs`),require(`./pre-transaction/getVolatileTransferAmount.cjs`),require(`./pre-transaction/constructAdminData.cjs`),require(`./utils/create-provider.cjs`),require(`./pre-transaction/convert-okx-instructions.cjs`),require(`./web3/getSolanaPriorityFee.cjs`),require(`./utils/process.utils.cjs`),require(`./pre-transaction/sendV0Transaction.cjs`),require(`./utils/bytes32.utils.cjs`),require(`./pre-transaction/recipientUtxoProcessing.cjs`),require(`./pre-transaction/ensureAmountChanges.cjs`),require(`./pre-transaction/getFeeStructure.cjs`),require(`./pre-transaction/waitForDepositedUtxosInMerkleTree.cjs`),require(`./pre-transaction/buildCommitmentValidationData.cjs`),require(`./pre-transaction/index.cjs`),require(`./snarkjs/generateZkProof.cjs`),require(`./snarkjs/generateMainAndCommitmentZkProof.cjs`),require(`./utils/resolve-sync.utils.cjs`),require(`./utils/reloadPage.cjs`),require(`./utils/cacheDevice.utils.cjs`),require(`./utils/involves-permit2-op.cjs`),require(`./utils/convertEmporiumOpToCallInfo.cjs`),require(`./utils/getRecipientInfoFromUserKeys.cjs`),require(`./utils/publicBalance.utils.cjs`),require(`./utils/postToOffscreen.cjs`),require(`./utils/getContractAddress.cjs`),require(`./utils/getUtxosFromReceipt.utils.cjs`),require(`./utils/getUtxosFromReceiptSolana.cjs`),require(`./utils/fees.utils.cjs`),require(`./utils/enclave-signature-storage.cjs`),require(`./utils/tx-confirmation.utils.cjs`),require(`./utils/tronSimulation.utils.cjs`),require(`./utils/getSignerFromContract.cjs`),require(`./utils/mnemonics.cjs`),require(`./utils/nearIntents.utils.cjs`),require(`./utils/index.cjs`),require(`./snarkjs/fetchOnChainRootHashes.cjs`),require(`./private-wallet/emporium.helpers.cjs`),require(`./snarkjs/constructGeneralZkProof.cjs`),require(`./web3/uniswapAPI.cjs`),require(`./web3/odosAPI.cjs`),require(`./web3/oneInchAPI.cjs`),require(`./web3/okxAPI.cjs`),require(`./web3/index.cjs`),require(`./snarkjs/constructSolanaZkProof.cjs`),require(`./snarkjs/index.cjs`),require(`./private-wallet/emporium.swap.helpers.cjs`),require(`./private-wallet/index.cjs`),require(`./auto-deposit-back-helpers/get-tokens-to-deposit-back.cjs`),require(`./auto-deposit-back-helpers/get-gas-token-records.cjs`),require(`./auto-deposit-back-helpers/select-gas-token.cjs`),require(`./auto-deposit-back-helpers/update-hinkal.cjs`),require(`./auto-deposit-back-helpers/index.cjs`);
|
|
@@ -3,7 +3,6 @@ import "./utils/abi.utils.mjs";
|
|
|
3
3
|
import "./utils/caseInsensitive.utils.mjs";
|
|
4
4
|
import "./utils/amounts.utils.mjs";
|
|
5
5
|
import "./web3/etherFunctions.mjs";
|
|
6
|
-
import "./utils/bigint-math.utils.mjs";
|
|
7
6
|
import "./utils/time.utils.mjs";
|
|
8
7
|
import "./utils/upToDateState.mjs";
|
|
9
8
|
import "./utils/cacheFunctions.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
require(`../../constants/protocol.constants.cjs`);
|
|
@@ -1,18 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
//#region common/src/functions/utils/bigint-math.utils.ts
|
|
3
|
-
var t = (t, n = e) => {
|
|
4
|
-
let r = t % n;
|
|
5
|
-
return r >= 0n ? r : r + n;
|
|
6
|
-
}, n = (n, r = e) => {
|
|
7
|
-
let i = 1n, a = 0n, o = t(n, r), s = r;
|
|
8
|
-
if (o === 0n) throw Error("Division by zero");
|
|
9
|
-
for (; o > 1n;) {
|
|
10
|
-
let e = s % o, t = s / o;
|
|
11
|
-
s = o, o = e;
|
|
12
|
-
let n = a - i * t;
|
|
13
|
-
a = i, i = n;
|
|
14
|
-
}
|
|
15
|
-
return i < 0n ? i + r : i;
|
|
16
|
-
};
|
|
17
|
-
//#endregion
|
|
18
|
-
export { t as mod, n as modInverse };
|
|
1
|
+
import "../../constants/protocol.constants.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./serialize.utils.cjs`),require(`./abi.utils.cjs`),require(`./caseInsensitive.utils.cjs`),require(`./amounts.utils.cjs`),require(`./
|
|
1
|
+
require(`./serialize.utils.cjs`),require(`./abi.utils.cjs`),require(`./caseInsensitive.utils.cjs`),require(`./amounts.utils.cjs`),require(`./time.utils.cjs`),require(`./upToDateState.cjs`),require(`./cacheFunctions.cjs`),require(`./enclaveHandshakeService.cjs`),require(`./encryptInputForEnclave.cjs`),require(`./solanaMint.utils.cjs`),require(`./customEnclaveFunctionsRegister.cjs`),require(`./serialize-utxos.utils.cjs`),require(`./addresses.cjs`),require(`./tron.utils.cjs`),require(`./get-signature-header.cjs`),require(`./auth.utils.cjs`),require(`./string.utils.cjs`),require(`./token-check.utils.cjs`),require(`./map.utils.cjs`),require(`./mutexes.utils.cjs`),require(`./erc20tokenFunctions.cjs`),require(`../pre-transaction/outputUtxoProcessing.cjs`),require(`./external-action.utils.cjs`),require(`./bit.operations.cjs`),require(`../pre-transaction/solana.cjs`),require(`../pre-transaction/process-gas-estimates.cjs`),require(`../pre-transaction/getVolatileTransferAmount.cjs`),require(`../pre-transaction/constructAdminData.cjs`),require(`./create-provider.cjs`),require(`../pre-transaction/convert-okx-instructions.cjs`),require(`./process.utils.cjs`),require(`../pre-transaction/sendV0Transaction.cjs`),require(`./bytes32.utils.cjs`),require(`../pre-transaction/recipientUtxoProcessing.cjs`),require(`../pre-transaction/ensureAmountChanges.cjs`),require(`../pre-transaction/getFeeStructure.cjs`),require(`../pre-transaction/waitForDepositedUtxosInMerkleTree.cjs`),require(`../pre-transaction/buildCommitmentValidationData.cjs`),require(`../pre-transaction/index.cjs`),require(`./bigint-math.utils.cjs`),require(`./resolve-sync.utils.cjs`),require(`./convertIntegrationProviderToExternalActionId.cjs`),require(`./evmNetworkFunctions.cjs`),require(`./userAgent.cjs`),require(`./reloadPage.cjs`),require(`./cacheDevice.utils.cjs`),require(`./getBlockExplorerUrl.cjs`),require(`./involves-permit2-op.cjs`),require(`./convertEmporiumOpToCallInfo.cjs`),require(`./getRecipientInfoFromUserKeys.cjs`),require(`./publicBalance.utils.cjs`),require(`./rpc-int-encode.cjs`),require(`./walletBalances.utils.cjs`),require(`./nftTokenFunctions.cjs`),require(`./inLogicMetadata.cjs`),require(`./networks.utils.cjs`),require(`./postToOffscreen.cjs`),require(`./solanaSendPreflight.utils.cjs`),require(`./prepareHinkal.cjs`),require(`./getContractAddress.cjs`),require(`./getUtxosFromReceipt.utils.cjs`),require(`./getUtxosFromReceiptSolana.cjs`),require(`./fees.utils.cjs`),require(`./enclave-utxo-storage.cjs`),require(`./enclave-signature-storage.cjs`),require(`./tx-confirmation.utils.cjs`),require(`./buildClaimableDepositPlan.cjs`),require(`./formatter.cjs`),require(`./tronSimulation.utils.cjs`),require(`./getSignerFromContract.cjs`),require(`./deposit-claimable.utils.cjs`),require(`./transfer-claimable.utils.cjs`),require(`./dispatchBalanceRefreshes.cjs`),require(`./lifi.utils.cjs`),require(`./enclave-recipient-info-storage.cjs`),require(`./solana-memo.cjs`),require(`./mnemonics.cjs`),require(`./nearIntents.utils.cjs`);
|
|
@@ -2,7 +2,6 @@ import "./serialize.utils.mjs";
|
|
|
2
2
|
import "./abi.utils.mjs";
|
|
3
3
|
import "./caseInsensitive.utils.mjs";
|
|
4
4
|
import "./amounts.utils.mjs";
|
|
5
|
-
import "./bigint-math.utils.mjs";
|
|
6
5
|
import "./time.utils.mjs";
|
|
7
6
|
import "./upToDateState.mjs";
|
|
8
7
|
import "./cacheFunctions.mjs";
|
|
@@ -38,6 +37,7 @@ import "../pre-transaction/getFeeStructure.mjs";
|
|
|
38
37
|
import "../pre-transaction/waitForDepositedUtxosInMerkleTree.mjs";
|
|
39
38
|
import "../pre-transaction/buildCommitmentValidationData.mjs";
|
|
40
39
|
import "../pre-transaction/index.mjs";
|
|
40
|
+
import "./bigint-math.utils.mjs";
|
|
41
41
|
import "./resolve-sync.utils.mjs";
|
|
42
42
|
import "./convertIntegrationProviderToExternalActionId.mjs";
|
|
43
43
|
import "./evmNetworkFunctions.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=`/assets/utxoWorkerLauncher-
|
|
1
|
+
var e=`/assets/utxoWorkerLauncher-x28Kdejz.js`;exports.default=e;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
const domain = 'https://storage.googleapis.com/hinkal-workers-staging';
|
|
3
3
|
|
|
4
4
|
const WORKER_CDN_URLS = {
|
|
5
|
-
ZKProof: domain + '/0.3.
|
|
6
|
-
SnarkJS: domain + '/0.3.
|
|
7
|
-
UTXO: domain + '/0.3.
|
|
5
|
+
ZKProof: domain + '/0.3.123/' + 'zkProofWorkerLauncher.js',
|
|
6
|
+
SnarkJS: domain + '/0.3.123/' + 'snarkjsWorkerLauncher.js',
|
|
7
|
+
UTXO: domain + '/0.3.123/' + 'utxoWorkerLauncher.js',
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
// Returns a blob:// URL which points
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=`/assets/zkProofWorkerLauncher-
|
|
1
|
+
var e=`/assets/zkProofWorkerLauncher-BYNX6ZQX.js`;exports.default=e;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gurge/sdk-react-native",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.124",
|
|
4
4
|
"description": "Prebundled Hinkal SDK for React Native — no Metro config required.",
|
|
5
5
|
"homepage": "hinkal.io",
|
|
6
6
|
"author": {
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"async-mutex": "^0.4.0",
|
|
60
60
|
"bs58": "^6.0.0",
|
|
61
61
|
"buffer": "6.0.3",
|
|
62
|
-
"circomlibjs-hinkal-fork": "^0.0.
|
|
62
|
+
"circomlibjs-hinkal-fork": "^0.0.11",
|
|
63
63
|
"dotenv": "^16.4.5",
|
|
64
64
|
"ethers": "^6.15.0",
|
|
65
65
|
"idb-keyval": "6.2.1",
|
|
@@ -14,10 +14,7 @@ const patchFile = (filePath) => {
|
|
|
14
14
|
if (content.includes(PATCH_MARKER)) return false;
|
|
15
15
|
if (!/require\(["']node:fs["']\)/.test(content)) return false;
|
|
16
16
|
|
|
17
|
-
fs.writeFileSync(
|
|
18
|
-
filePath,
|
|
19
|
-
`${PATCH_MARKER}\n${content.replace(/require\(["']node:fs["']\)/g, '({})')}`,
|
|
20
|
-
);
|
|
17
|
+
fs.writeFileSync(filePath, `${PATCH_MARKER}\n${content.replace(/require\(["']node:fs["']\)/g, '({})')}`);
|
|
21
18
|
return true;
|
|
22
19
|
};
|
|
23
20
|
|
|
@@ -49,12 +46,10 @@ let patched = 0;
|
|
|
49
46
|
for (const filePath of findLibsodiumFiles()) {
|
|
50
47
|
if (patchFile(filePath)) {
|
|
51
48
|
patched += 1;
|
|
52
|
-
console.log(`[@
|
|
49
|
+
console.log(`[@hinkal/sdk] patched libsodium for React Native: ${filePath}`);
|
|
53
50
|
}
|
|
54
51
|
}
|
|
55
52
|
|
|
56
53
|
if (patched === 0) {
|
|
57
|
-
console.warn(
|
|
58
|
-
'[@gurge/sdk-react-native] libsodium not found — postinstall patch skipped (install libsodium-wrappers first)',
|
|
59
|
-
);
|
|
54
|
+
console.warn('[@hinkal/sdk] libsodium not found — RN postinstall patch skipped (install libsodium-wrappers first)');
|
|
60
55
|
}
|
|
@@ -1,14 +1,27 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
|
|
3
|
+
const pkgRoot = path.dirname(require.resolve('circomlibjs-hinkal-fork/package.json'));
|
|
4
|
+
const {
|
|
5
|
+
buildBabyJubRN,
|
|
6
|
+
buildPoseidonRN,
|
|
7
|
+
buildEddsaRN,
|
|
8
|
+
} = require(path.join(pkgRoot, 'build/main.cjs'));
|
|
9
|
+
|
|
1
10
|
function notSupported(name) {
|
|
2
11
|
return () => {
|
|
3
12
|
throw new Error(
|
|
4
13
|
`[hinkal-rn] circomlibjs-hinkal-fork.${name} is not available on React Native. ` +
|
|
5
|
-
'
|
|
14
|
+
'Use buildBabyJubRN, buildPoseidonRN, or buildEddsaRN instead.',
|
|
6
15
|
);
|
|
7
16
|
};
|
|
8
17
|
}
|
|
9
18
|
|
|
10
19
|
module.exports = {
|
|
11
20
|
buildPoseidon: notSupported('buildPoseidon'),
|
|
12
|
-
|
|
21
|
+
buildPoseidonWasm: notSupported('buildPoseidonWasm'),
|
|
13
22
|
buildBabyjub: notSupported('buildBabyjub'),
|
|
23
|
+
buildEddsa: notSupported('buildEddsa'),
|
|
24
|
+
buildBabyJubRN,
|
|
25
|
+
buildPoseidonRN,
|
|
26
|
+
buildEddsaRN,
|
|
14
27
|
};
|
package/shims/circomlibjs.cjs
CHANGED
|
@@ -2,7 +2,7 @@ function notSupported(name) {
|
|
|
2
2
|
return () => {
|
|
3
3
|
throw new Error(
|
|
4
4
|
`[hinkal-rn] circomlibjs.${name} is not available on React Native. ` +
|
|
5
|
-
'
|
|
5
|
+
'Use circomlibjs-hinkal-fork RN builders instead.',
|
|
6
6
|
);
|
|
7
7
|
};
|
|
8
8
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`../constants/protocol.constants.cjs`),t=require(`../functions/utils/bigint-math.utils.cjs`);var n={p:e.CIRCOM_P,zero:0n,one:1n,e:e=>t.mod(BigInt(e)),add:(e,n)=>t.mod(e+n),sub:(e,n)=>t.mod(e-n),mul:(e,n)=>t.mod(e*n),div:(e,n)=>{if(n===0n)throw Error(`Division by zero in BabyJub field`);return t.mod(e*t.modInverse(n))},toString:e=>t.mod(e).toString()},r={X:n.zero,Y:n.one,Z:n.one,T:n.zero},i=e=>{let t=n.e(e[0]),r=n.e(e[1]);return{X:t,Y:r,Z:n.one,T:n.mul(t,r)}},a=e=>{let r=t.modInverse(e.Z);return[n.mul(e.X,r),n.mul(e.Y,r)]},o=n.e(`168700`),s=n.e(`168696`),c=(e,t)=>{let r=n.mul(e.X,t.X),i=n.mul(e.Y,t.Y),a=n.mul(n.mul(e.T,t.T),s),c=n.mul(e.Z,t.Z),l=n.sub(n.mul(n.add(e.X,e.Y),n.add(t.X,t.Y)),n.add(r,i)),u=n.sub(c,a),d=n.add(c,a),f=n.sub(i,n.mul(o,r));return{X:n.mul(l,u),Y:n.mul(d,f),T:n.mul(l,f),Z:n.mul(u,d)}},l=e=>{let t=n.mul(e.X,e.X),r=n.mul(e.Y,e.Y),i=n.mul(n.mul(e.Z,e.Z),2n),a=n.mul(o,t),s=n.sub(n.mul(n.add(e.X,e.Y),n.add(e.X,e.Y)),n.add(t,r)),c=n.add(a,r),l=n.sub(c,i),u=n.sub(a,r);return{X:n.mul(s,l),Y:n.mul(c,u),T:n.mul(s,u),Z:n.mul(l,c)}},u=class{static A=o;static D=s;F=n;A=o;D=s;Base8=[n.e(`5299619240641551281634865583518297030282874472190772894086521144482721001553`),n.e(`16950150798460657717958625567821834550301663161624707787222815936182638968203`)];addPoint(e,t){return a(c(i(e),i(t)))}mulPointEscalar(e,t){let n=r,o=i(e),s=BigInt(t);for(;s!==0n;)s%2n==1n&&(n=c(n,o)),o=l(o),s/=2n;return a(n)}};exports.BabyJubRN=u;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export declare class BabyJubRN {
|
|
2
|
-
static readonly A: bigint;
|
|
3
|
-
static readonly D: bigint;
|
|
4
|
-
F: {
|
|
5
|
-
p: bigint;
|
|
6
|
-
zero: bigint;
|
|
7
|
-
one: bigint;
|
|
8
|
-
e: (v: bigint | number | string) => bigint;
|
|
9
|
-
add: (a: bigint, b: bigint) => bigint;
|
|
10
|
-
sub: (a: bigint, b: bigint) => bigint;
|
|
11
|
-
mul: (a: bigint, b: bigint) => bigint;
|
|
12
|
-
div: (a: bigint, b: bigint) => bigint;
|
|
13
|
-
toString: (a: bigint) => string;
|
|
14
|
-
};
|
|
15
|
-
A: bigint;
|
|
16
|
-
D: bigint;
|
|
17
|
-
Base8: [bigint, bigint];
|
|
18
|
-
addPoint(a: [bigint, bigint], b: [bigint, bigint]): [bigint, bigint];
|
|
19
|
-
mulPointEscalar(base: [bigint, bigint], e: bigint | number | string): [bigint, bigint];
|
|
20
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { CIRCOM_P as e } from "../constants/protocol.constants.mjs";
|
|
2
|
-
import { mod as t, modInverse as n } from "../functions/utils/bigint-math.utils.mjs";
|
|
3
|
-
//#region common/src/crypto/BabyJubRN.ts
|
|
4
|
-
var r = {
|
|
5
|
-
p: e,
|
|
6
|
-
zero: 0n,
|
|
7
|
-
one: 1n,
|
|
8
|
-
e: (e) => t(BigInt(e)),
|
|
9
|
-
add: (e, n) => t(e + n),
|
|
10
|
-
sub: (e, n) => t(e - n),
|
|
11
|
-
mul: (e, n) => t(e * n),
|
|
12
|
-
div: (e, r) => {
|
|
13
|
-
if (r === 0n) throw Error("Division by zero in BabyJub field");
|
|
14
|
-
return t(e * n(r));
|
|
15
|
-
},
|
|
16
|
-
toString: (e) => t(e).toString()
|
|
17
|
-
}, i = {
|
|
18
|
-
X: r.zero,
|
|
19
|
-
Y: r.one,
|
|
20
|
-
Z: r.one,
|
|
21
|
-
T: r.zero
|
|
22
|
-
}, a = (e) => {
|
|
23
|
-
let t = r.e(e[0]), n = r.e(e[1]);
|
|
24
|
-
return {
|
|
25
|
-
X: t,
|
|
26
|
-
Y: n,
|
|
27
|
-
Z: r.one,
|
|
28
|
-
T: r.mul(t, n)
|
|
29
|
-
};
|
|
30
|
-
}, o = (e) => {
|
|
31
|
-
let t = n(e.Z);
|
|
32
|
-
return [r.mul(e.X, t), r.mul(e.Y, t)];
|
|
33
|
-
}, s = r.e("168700"), c = r.e("168696"), l = (e, t) => {
|
|
34
|
-
let n = r.mul(e.X, t.X), i = r.mul(e.Y, t.Y), a = r.mul(r.mul(e.T, t.T), c), o = r.mul(e.Z, t.Z), l = r.sub(r.mul(r.add(e.X, e.Y), r.add(t.X, t.Y)), r.add(n, i)), u = r.sub(o, a), d = r.add(o, a), f = r.sub(i, r.mul(s, n));
|
|
35
|
-
return {
|
|
36
|
-
X: r.mul(l, u),
|
|
37
|
-
Y: r.mul(d, f),
|
|
38
|
-
T: r.mul(l, f),
|
|
39
|
-
Z: r.mul(u, d)
|
|
40
|
-
};
|
|
41
|
-
}, u = (e) => {
|
|
42
|
-
let t = r.mul(e.X, e.X), n = r.mul(e.Y, e.Y), i = r.mul(r.mul(e.Z, e.Z), 2n), a = r.mul(s, t), o = r.sub(r.mul(r.add(e.X, e.Y), r.add(e.X, e.Y)), r.add(t, n)), c = r.add(a, n), l = r.sub(c, i), u = r.sub(a, n);
|
|
43
|
-
return {
|
|
44
|
-
X: r.mul(o, l),
|
|
45
|
-
Y: r.mul(c, u),
|
|
46
|
-
T: r.mul(o, u),
|
|
47
|
-
Z: r.mul(l, c)
|
|
48
|
-
};
|
|
49
|
-
}, d = class {
|
|
50
|
-
static A = s;
|
|
51
|
-
static D = c;
|
|
52
|
-
F = r;
|
|
53
|
-
A = s;
|
|
54
|
-
D = c;
|
|
55
|
-
Base8 = [r.e("5299619240641551281634865583518297030282874472190772894086521144482721001553"), r.e("16950150798460657717958625567821834550301663161624707787222815936182638968203")];
|
|
56
|
-
addPoint(e, t) {
|
|
57
|
-
return o(l(a(e), a(t)));
|
|
58
|
-
}
|
|
59
|
-
mulPointEscalar(e, t) {
|
|
60
|
-
let n = i, r = a(e), s = BigInt(t);
|
|
61
|
-
for (; s !== 0n;) s % 2n == 1n && (n = l(n, r)), r = u(r), s /= 2n;
|
|
62
|
-
return o(n);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
//#endregion
|
|
66
|
-
export { d as BabyJubRN };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require("../../../_virtual/_rolldown/runtime.cjs");const e=require(`./poseidon.cjs`),t=require(`../functions/utils/bigint-math.utils.cjs`),n=require(`./babyJub.cjs`);let r=require(`@noble/hashes/blake1.js`);var i=21888242871839275222246405745257275088614511777268538073601725287587578984328n/8n,a=(e,t=0,n=e.length-t)=>{let r=0n;for(let i=n-1;i>=0;--i)r=(r<<8n)+BigInt(e[t+i]);return r},o=(e,n,r,i)=>{let a=t.mod(r);for(let t=0;t<i;t+=1)e[n+t]=Number(a&255n),a>>=8n},s=e=>t.mod(e,i),c=e=>{let t=new Uint8Array(e);return t[0]&=248,t[31]&=127,t[31]|=64,t},l=class{constructor(e,t){this.babyJub=e,this.poseidon=t}prv2pub(e){let t=a(c((0,r.blake512)(e).slice(0,32)),0,32);return this.babyJub.mulPointEscalar(this.babyJub.Base8,t/8n)}signPoseidon(e,n){let i=c((0,r.blake512)(e)),l=a(i,0,32),u=this.babyJub.mulPointEscalar(this.babyJub.Base8,l/8n),d=new Uint8Array(64);d.set(i.slice(32),0),o(d,32,n,32);let f=s(a((0,r.blake512)(d),0,64)),p=this.babyJub.mulPointEscalar(this.babyJub.Base8,f),m=this.poseidon([p[0],p[1],u[0],u[1],n]);return{R8:p,S:s(f+s(t.mod(BigInt(this.poseidon.F.toString(m)))*l))}}},u=async()=>(await e.poseidonHolder.init(),await n.jubHolder.init(),new l(n.jubHolder.getJub(),e.poseidonHolder.getPoseidon()));exports.buildEddsaRN=u;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { BabyJubRN } from './BabyJubRN';
|
|
2
|
-
type PoseidonFn = {
|
|
3
|
-
(inputs: bigint[]): bigint;
|
|
4
|
-
F: {
|
|
5
|
-
toString: (v: bigint | number | string) => string;
|
|
6
|
-
};
|
|
7
|
-
};
|
|
8
|
-
export declare class EddsaRN {
|
|
9
|
-
private readonly babyJub;
|
|
10
|
-
private readonly poseidon;
|
|
11
|
-
constructor(babyJub: BabyJubRN, poseidon: PoseidonFn);
|
|
12
|
-
prv2pub(prv: Uint8Array): [bigint, bigint];
|
|
13
|
-
signPoseidon(prv: Uint8Array, msg: bigint): {
|
|
14
|
-
R8: [bigint, bigint];
|
|
15
|
-
S: bigint;
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
export declare const buildEddsaRN: () => Promise<EddsaRN>;
|
|
19
|
-
export {};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { poseidonHolder as e } from "./poseidon.mjs";
|
|
2
|
-
import { mod as t } from "../functions/utils/bigint-math.utils.mjs";
|
|
3
|
-
import { jubHolder as n } from "./babyJub.mjs";
|
|
4
|
-
import { blake512 as r } from "@noble/hashes/blake1.js";
|
|
5
|
-
//#region common/src/crypto/EddsaRN.ts
|
|
6
|
-
var i = 21888242871839275222246405745257275088614511777268538073601725287587578984328n / 8n, a = (e, t = 0, n = e.length - t) => {
|
|
7
|
-
let r = 0n;
|
|
8
|
-
for (let i = n - 1; i >= 0; --i) r = (r << 8n) + BigInt(e[t + i]);
|
|
9
|
-
return r;
|
|
10
|
-
}, o = (e, n, r, i) => {
|
|
11
|
-
let a = t(r);
|
|
12
|
-
for (let t = 0; t < i; t += 1) e[n + t] = Number(a & 255n), a >>= 8n;
|
|
13
|
-
}, s = (e) => t(e, i), c = (e) => {
|
|
14
|
-
let t = new Uint8Array(e);
|
|
15
|
-
return t[0] &= 248, t[31] &= 127, t[31] |= 64, t;
|
|
16
|
-
}, l = class {
|
|
17
|
-
constructor(e, t) {
|
|
18
|
-
this.babyJub = e, this.poseidon = t;
|
|
19
|
-
}
|
|
20
|
-
prv2pub(e) {
|
|
21
|
-
let t = a(c(r(e).slice(0, 32)), 0, 32);
|
|
22
|
-
return this.babyJub.mulPointEscalar(this.babyJub.Base8, t / 8n);
|
|
23
|
-
}
|
|
24
|
-
signPoseidon(e, n) {
|
|
25
|
-
let i = c(r(e)), l = a(i, 0, 32), u = this.babyJub.mulPointEscalar(this.babyJub.Base8, l / 8n), d = new Uint8Array(64);
|
|
26
|
-
d.set(i.slice(32), 0), o(d, 32, n, 32);
|
|
27
|
-
let f = s(a(r(d), 0, 64)), p = this.babyJub.mulPointEscalar(this.babyJub.Base8, f), m = this.poseidon([
|
|
28
|
-
p[0],
|
|
29
|
-
p[1],
|
|
30
|
-
u[0],
|
|
31
|
-
u[1],
|
|
32
|
-
n
|
|
33
|
-
]);
|
|
34
|
-
return {
|
|
35
|
-
R8: p,
|
|
36
|
-
S: s(f + s(t(BigInt(this.poseidon.F.toString(m))) * l))
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
}, u = async () => (await e.init(), await n.init(), new l(n.getJub(), e.getPoseidon()));
|
|
40
|
-
//#endregion
|
|
41
|
-
export { u as buildEddsaRN };
|