@permissionless-technologies/upp-sdk 0.3.1 → 0.3.4
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/{chunk-56LZ2RV6.js → chunk-3A2XAQPZ.js} +4 -4
- package/dist/{chunk-56LZ2RV6.js.map → chunk-3A2XAQPZ.js.map} +1 -1
- package/dist/{chunk-4MOXKZSE.cjs → chunk-ISA2WEA5.cjs} +4 -4
- package/dist/{chunk-4MOXKZSE.cjs.map → chunk-ISA2WEA5.cjs.map} +1 -1
- package/dist/{chunk-IYOR5TCO.cjs → chunk-KXPZUBPI.cjs} +19 -6
- package/dist/chunk-KXPZUBPI.cjs.map +1 -0
- package/dist/{chunk-GS4UCMW4.js → chunk-OD2SDC4L.js} +3 -3
- package/dist/{chunk-GS4UCMW4.js.map → chunk-OD2SDC4L.js.map} +1 -1
- package/dist/{chunk-7F75NGNB.js → chunk-QKI4QWLT.js} +19 -6
- package/dist/chunk-QKI4QWLT.js.map +1 -0
- package/dist/{chunk-4EMXHMJ5.cjs → chunk-RZE7Z5BR.cjs} +2 -2
- package/dist/{chunk-4EMXHMJ5.cjs.map → chunk-RZE7Z5BR.cjs.map} +1 -1
- package/dist/{chunk-52PPS4AT.cjs → chunk-SJDPDHSD.cjs} +4 -4
- package/dist/{chunk-52PPS4AT.cjs.map → chunk-SJDPDHSD.cjs.map} +1 -1
- package/dist/{chunk-4EDTZQ44.js → chunk-YVFH6RBX.js} +2 -2
- package/dist/{chunk-4EDTZQ44.js.map → chunk-YVFH6RBX.js.map} +1 -1
- package/dist/core/index.cjs +60 -60
- package/dist/core/index.js +4 -4
- package/dist/index.cjs +204 -204
- package/dist/index.js +6 -6
- package/dist/indexer/index.cjs +6 -6
- package/dist/indexer/index.js +1 -1
- package/dist/react/index.cjs +59 -18
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +49 -8
- package/dist/react/index.js.map +1 -1
- package/dist/{transfer-4GJJTWMH.js → transfer-QK3QUIA3.js} +4 -4
- package/dist/{transfer-4GJJTWMH.js.map → transfer-QK3QUIA3.js.map} +1 -1
- package/dist/{transfer-CLBDOA63.cjs → transfer-RCVNV4VC.cjs} +10 -10
- package/dist/{transfer-CLBDOA63.cjs.map → transfer-RCVNV4VC.cjs.map} +1 -1
- package/package.json +1 -1
- package/src/deployments/31337.json +1 -1
- package/dist/chunk-7F75NGNB.js.map +0 -1
- package/dist/chunk-IYOR5TCO.cjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export { NOTE_VERSION, createNote, createUPPClient, decryptNote, encryptNote } from './chunk-
|
|
2
|
-
export { buildTransfer, buildUPPTransferCircuitInputs, computeNullifier, formatOutputForContract, getDeployment, getDeploymentOrThrow, getMerkleProofsForNotes, getSupportedChainIds, getTokenAddress, hasDeployment, registerDeployment, syncMerkleTree } from './chunk-
|
|
3
|
-
export { makeRpcIndexer } from './chunk-
|
|
1
|
+
export { NOTE_VERSION, createNote, createUPPClient, decryptNote, encryptNote } from './chunk-OD2SDC4L.js';
|
|
2
|
+
export { buildTransfer, buildUPPTransferCircuitInputs, computeNullifier, formatOutputForContract, getDeployment, getDeploymentOrThrow, getMerkleProofsForNotes, getSupportedChainIds, getTokenAddress, hasDeployment, registerDeployment, syncMerkleTree } from './chunk-3A2XAQPZ.js';
|
|
3
|
+
export { makeRpcIndexer } from './chunk-YVFH6RBX.js';
|
|
4
4
|
export { DEFAULT_KEY_DERIVATION_CONFIG, deriveDualKeysFromSignature, deriveKeysFromSignature, deriveNullifierKey, derivePerNoteKey, derivePerNoteKeyFromKeys, deriveStarkKeysFromSignature, deriveStarkPerNoteKey, deriveStarkPerNoteKeyFromKeys, exportViewingKeysForAudit, getKeyDerivationMessage, getViewingKeyFromExport, validateAuditKeyExport, verifyKeysMatchSignature } from './chunk-2JQISXBD.js';
|
|
5
|
+
export { ADDRESS_VERSION, DirectAccountAdapter, NoteStore, RATE_PRECISION, STARK_ADDRESS_VERSION, STARK_STEALTH_ADDRESS_PREFIX, STEALTH_ADDRESS_PREFIX, SWAP_EVENTS_ABI, SWAP_ORDER_CANCELLED_EVENT, SWAP_ORDER_CLAIMED_EVENT, SWAP_ORDER_FILLED_EVENT, SWAP_ORDER_PLACED_EVENT, StorableAccountAdapter, computeCancelKeyHash, computeFillPercentage, computeGiveAmount, computeNoteEncryptionKey, computeRate, computeTakeAmount, computeTotalBuyAmount, createOneTimeKeys, decodeStarkStealthAddress, decodeStealthAddress, detectAddressType, encodeStarkStealthAddress, encodeStealthAddress, filterOrdersByASP, filterOrdersByTokenPair, formatRate, generateCancelSecret, generateStarkStealthAddress, generateStealthAddress, getCancelSecret, getOwnOrderIds, isFillerASPAccepted, isOrderActive, isValidStarkStealthAddress, isValidStealthAddress, removeCancelSecret, storeCancelSecret, verifyOwnership } from './chunk-QKI4QWLT.js';
|
|
6
|
+
export { DEMO_ASP_ID, DEMO_ASP_NAME, buildASPTree, computeMultiOriginASPRoot, computeSingleOriginASPRoot, createDemoASPRoot, generateASPProof, generateMultiOriginASPProof, generateSingleOriginASPProof, verifyASPProof } from './chunk-P37MRZ73.js';
|
|
7
|
+
import './chunk-XV72HNHN.js';
|
|
5
8
|
import './chunk-UAVWYXDN.js';
|
|
6
9
|
export { addPoints, computeSharedSecret, deriveDecryptionViewingKey, deriveEncryptionViewingKey, getBasePoint, getSubOrder, isOnCurve, mulPointScalar, packPoint, pointToTuple, privateToPublic, tupleToPoint } from './chunk-YOWDERVC.js';
|
|
7
10
|
export { STARK_AMOUNT_SCALE, STARK_ASP_TREE_DEPTH, STARK_STATE_TREE_DEPTH, addressToM31, buildStarkTransferWitness, buildStarkWithdrawWitness, computeTransferPublicInputsSeed, computeWithdrawPublicInputsSeed, isStarkAligned, packM31Digest, scaleAmountForStark, splitSecretToM31Limbs, truncateToM31 } from './chunk-XBNYAAMU.js';
|
|
8
11
|
export { MAX_TREE_DEPTH, MerkleTree, buildMerkleTree, getMerkleProof, verifyMerkleProof } from './chunk-ZU6J7KMY.js';
|
|
9
12
|
export { DIGEST_SIZE, M31_P, SECRET_LIMBS, computeStarkCommitment, computeStarkNullifier, computeStarkOwnerHash, keccakHashTwo, keccakM31, splitToM31Limbs } from './chunk-5V5HSN6Y.js';
|
|
10
|
-
export { ADDRESS_VERSION, DirectAccountAdapter, NoteStore, RATE_PRECISION, STARK_ADDRESS_VERSION, STARK_STEALTH_ADDRESS_PREFIX, STEALTH_ADDRESS_PREFIX, SWAP_EVENTS_ABI, SWAP_ORDER_CANCELLED_EVENT, SWAP_ORDER_CLAIMED_EVENT, SWAP_ORDER_FILLED_EVENT, SWAP_ORDER_PLACED_EVENT, StorableAccountAdapter, computeCancelKeyHash, computeFillPercentage, computeGiveAmount, computeNoteEncryptionKey, computeRate, computeTakeAmount, computeTotalBuyAmount, createOneTimeKeys, decodeStarkStealthAddress, decodeStealthAddress, detectAddressType, encodeStarkStealthAddress, encodeStealthAddress, filterOrdersByASP, filterOrdersByTokenPair, formatRate, generateCancelSecret, generateStarkStealthAddress, generateStealthAddress, getCancelSecret, getOwnOrderIds, isFillerASPAccepted, isOrderActive, isValidStarkStealthAddress, isValidStealthAddress, removeCancelSecret, storeCancelSecret, verifyOwnership } from './chunk-7F75NGNB.js';
|
|
11
|
-
export { DEMO_ASP_ID, DEMO_ASP_NAME, buildASPTree, computeMultiOriginASPRoot, computeSingleOriginASPRoot, createDemoASPRoot, generateASPProof, generateMultiOriginASPProof, generateSingleOriginASPProof, verifyASPProof } from './chunk-P37MRZ73.js';
|
|
12
|
-
import './chunk-XV72HNHN.js';
|
|
13
13
|
export { bigintToBytes, bytesToBigint, bytesToHex, hexToBytes, randomBytes, randomFieldElement } from './chunk-W77GRBO4.js';
|
|
14
14
|
export { BABYJUBJUB_SUBORDER, FIELD_PRIME, addressToField, fieldToAddress, isValidFieldElement, poseidon, poseidonHash, poseidonScalar, toFieldElement } from './chunk-V23OSL25.js';
|
|
15
15
|
export { ASP_TREE_DEPTH, STATE_TREE_DEPTH, formatProofForContract, generateProof, generateStealthProof, generateUPPProof, getStealthCircuitArtifacts, getUPPCircuitArtifacts, verifyProof } from './chunk-S4B7GYLN.js';
|
package/dist/indexer/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkRZE7Z5BR_cjs = require('../chunk-RZE7Z5BR.cjs');
|
|
4
4
|
var chunkERQE57IA_cjs = require('../chunk-ERQE57IA.cjs');
|
|
5
5
|
require('../chunk-G7VZBCD6.cjs');
|
|
6
6
|
|
|
@@ -8,23 +8,23 @@ require('../chunk-G7VZBCD6.cjs');
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, "computeSearchTag", {
|
|
10
10
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
11
|
+
get: function () { return chunkRZE7Z5BR_cjs.computeSearchTag; }
|
|
12
12
|
});
|
|
13
13
|
Object.defineProperty(exports, "makeRpcIndexer", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunkRZE7Z5BR_cjs.makeRpcIndexer; }
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "matchesSearchTag", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunkRZE7Z5BR_cjs.matchesSearchTag; }
|
|
20
20
|
});
|
|
21
21
|
Object.defineProperty(exports, "tryDecryptNote", {
|
|
22
22
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunkRZE7Z5BR_cjs.tryDecryptNote; }
|
|
24
24
|
});
|
|
25
25
|
Object.defineProperty(exports, "unpackNoteData", {
|
|
26
26
|
enumerable: true,
|
|
27
|
-
get: function () { return
|
|
27
|
+
get: function () { return chunkRZE7Z5BR_cjs.unpackNoteData; }
|
|
28
28
|
});
|
|
29
29
|
Object.defineProperty(exports, "createAutoAdapter", {
|
|
30
30
|
enumerable: true,
|
package/dist/indexer/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { computeSearchTag, makeRpcIndexer, matchesSearchTag, tryDecryptNote, unpackNoteData } from '../chunk-
|
|
1
|
+
export { computeSearchTag, makeRpcIndexer, matchesSearchTag, tryDecryptNote, unpackNoteData } from '../chunk-YVFH6RBX.js';
|
|
2
2
|
export { createAutoAdapter, createIndexedDBAdapter, createLocalStorageAdapter, createMemoryAdapter, indexedDBAdapter, localStorageAdapter, memoryAdapter } from '../chunk-XV72HNHN.js';
|
|
3
3
|
import '../chunk-Z6ZWNWWR.js';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/dist/react/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkKXPZUBPI_cjs = require('../chunk-KXPZUBPI.cjs');
|
|
4
4
|
var chunkNDM5EJEV_cjs = require('../chunk-NDM5EJEV.cjs');
|
|
5
5
|
var chunkERQE57IA_cjs = require('../chunk-ERQE57IA.cjs');
|
|
6
6
|
require('../chunk-3HQ7A6ZM.cjs');
|
|
@@ -107,7 +107,7 @@ function UPPAccountProvider({
|
|
|
107
107
|
return;
|
|
108
108
|
}
|
|
109
109
|
const accountStorage = chunkERQE57IA_cjs.createAutoAdapter(`upp_account`);
|
|
110
|
-
const adapter = new
|
|
110
|
+
const adapter = new chunkKXPZUBPI_cjs.StorableAccountAdapter(accountStorage, ethAddress);
|
|
111
111
|
accountAdapterRef.current = adapter;
|
|
112
112
|
const legacyKey = getStorageKey(ethAddress);
|
|
113
113
|
const legacySaved = typeof window !== "undefined" ? localStorage.getItem(legacyKey) : null;
|
|
@@ -148,7 +148,7 @@ function UPPAccountProvider({
|
|
|
148
148
|
const ownerHashHex2 = viem.toHex(account.keys.ownerHash, { size: 32 });
|
|
149
149
|
const storagePrefix = `upp_${chainId}_${ownerHashHex2.slice(0, 12)}`;
|
|
150
150
|
const noteStorage = chunkERQE57IA_cjs.createAutoAdapter(storagePrefix);
|
|
151
|
-
const store = new
|
|
151
|
+
const store = new chunkKXPZUBPI_cjs.NoteStore(noteStorage, "notes");
|
|
152
152
|
noteStoreRef.current = store;
|
|
153
153
|
noteStoreUnsub = store.onChange(() => {
|
|
154
154
|
if (!cancelled) setNotes([...store.getNotes()]);
|
|
@@ -372,8 +372,9 @@ function UPPAccountProvider({
|
|
|
372
372
|
false,
|
|
373
373
|
["decrypt"]
|
|
374
374
|
);
|
|
375
|
+
const currentStore = noteStoreRef.current;
|
|
375
376
|
const existingCommitments = new Set(
|
|
376
|
-
notes.map((n) => n.commitment.toLowerCase())
|
|
377
|
+
(currentStore ? currentStore.getNotes() : notes).map((n) => n.commitment.toLowerCase())
|
|
377
378
|
);
|
|
378
379
|
const candidates = [];
|
|
379
380
|
console.log("[syncNotes] Scanning contract:", contractAddress, "\u2014 existing:", existingCommitments.size, "notes");
|
|
@@ -594,7 +595,41 @@ function UPPAccountProvider({
|
|
|
594
595
|
}
|
|
595
596
|
try {
|
|
596
597
|
const currentNotes = store ? store.getNotes() : notes;
|
|
597
|
-
const
|
|
598
|
+
const snarkNotes = currentNotes.filter((n) => n.proofSystem !== "stark");
|
|
599
|
+
const unspentSnarkNotes = snarkNotes.filter((n) => n.status !== "spent");
|
|
600
|
+
if (unspentSnarkNotes.length > 0) {
|
|
601
|
+
const sdk2 = await loadSDK();
|
|
602
|
+
for (const note of unspentSnarkNotes) {
|
|
603
|
+
const correctLeaf = commitmentLeafMap.get(note.commitment.toLowerCase());
|
|
604
|
+
if (correctLeaf === void 0) continue;
|
|
605
|
+
const ownerSecret = BigInt(note.ownerSecret);
|
|
606
|
+
const commitment = BigInt(note.commitment);
|
|
607
|
+
const nullifier = await sdk2.poseidon([
|
|
608
|
+
ownerSecret % 2736030358979909402780800718157159386076813972158567259200215660948447373041n,
|
|
609
|
+
BigInt(correctLeaf),
|
|
610
|
+
commitment
|
|
611
|
+
]);
|
|
612
|
+
const nullifierHex = viem.toHex(nullifier, { size: 32 });
|
|
613
|
+
const isUsed = await client.readContract({
|
|
614
|
+
address: contractAddress,
|
|
615
|
+
abi: [{
|
|
616
|
+
type: "function",
|
|
617
|
+
name: "nullifierUsed",
|
|
618
|
+
inputs: [{ name: "", type: "bytes32" }],
|
|
619
|
+
outputs: [{ name: "", type: "bool" }],
|
|
620
|
+
stateMutability: "view"
|
|
621
|
+
}],
|
|
622
|
+
functionName: "nullifierUsed",
|
|
623
|
+
args: [nullifierHex]
|
|
624
|
+
});
|
|
625
|
+
if (isUsed) {
|
|
626
|
+
console.log(`[syncNotes] Marking note ${note.commitment.slice(0, 12)} as spent \u2014 nullifier found on-chain`);
|
|
627
|
+
if (store) store.markSpent(note.commitment);
|
|
628
|
+
repaired++;
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
const spentSnarkNotes = snarkNotes.filter((n) => n.status === "spent");
|
|
598
633
|
if (spentSnarkNotes.length > 0) {
|
|
599
634
|
const sdk2 = await loadSDK();
|
|
600
635
|
for (const note of spentSnarkNotes) {
|
|
@@ -697,11 +732,17 @@ function UPPAccountProvider({
|
|
|
697
732
|
}
|
|
698
733
|
};
|
|
699
734
|
}, [liveSyncInterval]);
|
|
735
|
+
react.useEffect(() => {
|
|
736
|
+
const contractAddr = indexerConfig?.contractAddress;
|
|
737
|
+
if (!masterKeys || !publicClientProp || !contractAddr) return;
|
|
738
|
+
startLiveSync(contractAddr, publicClientProp);
|
|
739
|
+
return () => stopLiveSync();
|
|
740
|
+
}, [masterKeys, publicClientProp, indexerConfig?.contractAddress]);
|
|
700
741
|
const ownerHashHex = masterKeys ? viem.toHex(masterKeys.ownerHash, { size: 32 }) : null;
|
|
701
742
|
const stealthAddress = react.useMemo(() => {
|
|
702
743
|
if (!masterKeys) return null;
|
|
703
744
|
try {
|
|
704
|
-
const { encodeStealthAddress } = (
|
|
745
|
+
const { encodeStealthAddress } = (chunkKXPZUBPI_cjs.init_stealth(), chunkG7VZBCD6_cjs.__toCommonJS(chunkKXPZUBPI_cjs.stealth_exports));
|
|
705
746
|
return encodeStealthAddress(masterKeys.ownerHash, masterKeys.viewingHash);
|
|
706
747
|
} catch {
|
|
707
748
|
return null;
|
|
@@ -710,7 +751,7 @@ function UPPAccountProvider({
|
|
|
710
751
|
const starkStealthAddress = react.useMemo(() => {
|
|
711
752
|
if (!starkMasterKeys) return null;
|
|
712
753
|
try {
|
|
713
|
-
const { encodeStarkStealthAddress } = (
|
|
754
|
+
const { encodeStarkStealthAddress } = (chunkKXPZUBPI_cjs.init_stealth(), chunkG7VZBCD6_cjs.__toCommonJS(chunkKXPZUBPI_cjs.stealth_exports));
|
|
714
755
|
return encodeStarkStealthAddress(starkMasterKeys.starkOwnerHash, starkMasterKeys.starkViewingHash);
|
|
715
756
|
} catch {
|
|
716
757
|
return null;
|
|
@@ -1561,7 +1602,7 @@ function usePoolTransfer(config) {
|
|
|
1561
1602
|
const recipientNote = await createNoteForSelf(amount, origin, token);
|
|
1562
1603
|
const changeNote = await createNoteForSelf(changeAmount, origin, token);
|
|
1563
1604
|
const [transferModule, proofModule, aspModule] = await Promise.all([
|
|
1564
|
-
import('../transfer-
|
|
1605
|
+
import('../transfer-RCVNV4VC.cjs'),
|
|
1565
1606
|
import('../proof-5OECB3RQ.cjs'),
|
|
1566
1607
|
import('../asp-TXSAFFD3.cjs')
|
|
1567
1608
|
]);
|
|
@@ -1720,7 +1761,7 @@ function useWithdraw(config) {
|
|
|
1720
1761
|
const token = BigInt(selectedNote.token);
|
|
1721
1762
|
setStage("creating_outputs");
|
|
1722
1763
|
const [transferModule, proofModule, sdk] = await Promise.all([
|
|
1723
|
-
import('../transfer-
|
|
1764
|
+
import('../transfer-RCVNV4VC.cjs'),
|
|
1724
1765
|
import('../proof-5OECB3RQ.cjs'),
|
|
1725
1766
|
import('../index.cjs')
|
|
1726
1767
|
]);
|
|
@@ -1983,7 +2024,7 @@ function useSwapOrderBook(config) {
|
|
|
1983
2024
|
try {
|
|
1984
2025
|
const logs = await config.publicClient.getLogs({
|
|
1985
2026
|
address: config.poolAddress,
|
|
1986
|
-
event:
|
|
2027
|
+
event: chunkKXPZUBPI_cjs.SWAP_ORDER_PLACED_EVENT,
|
|
1987
2028
|
fromBlock: config.fromBlock ?? 0n,
|
|
1988
2029
|
toBlock: "latest"
|
|
1989
2030
|
});
|
|
@@ -1999,10 +2040,10 @@ function useSwapOrderBook(config) {
|
|
|
1999
2040
|
blockNumber: log.blockNumber ?? 0n
|
|
2000
2041
|
}));
|
|
2001
2042
|
if (config.sellToken && config.buyToken) {
|
|
2002
|
-
parsedOrders =
|
|
2043
|
+
parsedOrders = chunkKXPZUBPI_cjs.filterOrdersByTokenPair(parsedOrders, config.sellToken, config.buyToken);
|
|
2003
2044
|
}
|
|
2004
2045
|
if (config.acceptableAspIds && config.acceptableAspIds.length > 0) {
|
|
2005
|
-
parsedOrders =
|
|
2046
|
+
parsedOrders = chunkKXPZUBPI_cjs.filterOrdersByASP(parsedOrders, config.acceptableAspIds);
|
|
2006
2047
|
}
|
|
2007
2048
|
const enriched = [];
|
|
2008
2049
|
for (const order of parsedOrders) {
|
|
@@ -2099,7 +2140,7 @@ function useSwap(config) {
|
|
|
2099
2140
|
}
|
|
2100
2141
|
setStage("creating_outputs");
|
|
2101
2142
|
const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
|
|
2102
|
-
import('../transfer-
|
|
2143
|
+
import('../transfer-RCVNV4VC.cjs'),
|
|
2103
2144
|
import('../proof-5OECB3RQ.cjs'),
|
|
2104
2145
|
import('../index.cjs'),
|
|
2105
2146
|
import('../asp-TXSAFFD3.cjs')
|
|
@@ -2181,8 +2222,8 @@ function useSwap(config) {
|
|
|
2181
2222
|
formattedProof.c[0],
|
|
2182
2223
|
formattedProof.c[1]
|
|
2183
2224
|
];
|
|
2184
|
-
const cancelSecret =
|
|
2185
|
-
const cancelKeyHash =
|
|
2225
|
+
const cancelSecret = chunkKXPZUBPI_cjs.generateCancelSecret();
|
|
2226
|
+
const cancelKeyHash = chunkKXPZUBPI_cjs.computeCancelKeyHash(cancelSecret);
|
|
2186
2227
|
const currentBlock = await cfg.publicClient.getBlockNumber();
|
|
2187
2228
|
const expiry = currentBlock + expiryBlocks;
|
|
2188
2229
|
return {
|
|
@@ -2230,7 +2271,7 @@ function useSwap(config) {
|
|
|
2230
2271
|
noteOverride
|
|
2231
2272
|
} = params;
|
|
2232
2273
|
const cfg = configRef.current;
|
|
2233
|
-
const giveAmount =
|
|
2274
|
+
const giveAmount = chunkKXPZUBPI_cjs.computeGiveAmount(takeAmount, rate);
|
|
2234
2275
|
setStage("selecting_notes");
|
|
2235
2276
|
let selectedNote;
|
|
2236
2277
|
if (noteOverride) {
|
|
@@ -2251,7 +2292,7 @@ function useSwap(config) {
|
|
|
2251
2292
|
}
|
|
2252
2293
|
setStage("creating_outputs");
|
|
2253
2294
|
const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
|
|
2254
|
-
import('../transfer-
|
|
2295
|
+
import('../transfer-RCVNV4VC.cjs'),
|
|
2255
2296
|
import('../proof-5OECB3RQ.cjs'),
|
|
2256
2297
|
import('../index.cjs'),
|
|
2257
2298
|
import('../asp-TXSAFFD3.cjs')
|
|
@@ -2481,7 +2522,7 @@ function useSwap(config) {
|
|
|
2481
2522
|
createNoteForSelf(changeAmount, origin, token)
|
|
2482
2523
|
]);
|
|
2483
2524
|
const [transferModule, proofModule, aspModule] = await Promise.all([
|
|
2484
|
-
import('../transfer-
|
|
2525
|
+
import('../transfer-RCVNV4VC.cjs'),
|
|
2485
2526
|
import('../proof-5OECB3RQ.cjs'),
|
|
2486
2527
|
import('../asp-TXSAFFD3.cjs')
|
|
2487
2528
|
]);
|