@smithii_io/mixoor 0.0.9 → 0.0.10
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/src/index.js +13 -13
- package/dist/src/index.js.map +1 -1
- package/dist/src/index.mjs +13 -14
- package/dist/src/index.mjs.map +1 -1
- package/dist/test/_setup.js +3 -10
- package/dist/test/_setup.js.map +1 -1
- package/dist/test/transfer.test.js +6 -7
- package/dist/test/transfer.test.js.map +1 -1
- package/dist/types/src/generated/errors/mixoor.d.ts +3 -1
- package/dist/types/src/generated/errors/mixoor.d.ts.map +1 -1
- package/dist/types/src/generated/instructions/transfer.d.ts +8 -8
- package/dist/types/src/generated/instructions/transfer.d.ts.map +1 -1
- package/dist/types/src/utils/circuit.d.ts +2 -2
- package/dist/types/src/utils/circuit.d.ts.map +1 -1
- package/dist/types/src/utils/pda.d.ts +2 -0
- package/dist/types/src/utils/pda.d.ts.map +1 -1
- package/dist/types/test/_setup.d.ts +1 -1
- package/dist/types/test/_setup.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/src/index.js
CHANGED
|
@@ -381,6 +381,7 @@ var MIXOOR_ERROR__INVALID_MERKLE_TREE = 6009;
|
|
|
381
381
|
var MIXOOR_ERROR__POSEIDON_HASH_ERROR = 6010;
|
|
382
382
|
var MIXOOR_ERROR__MERKLE_TREE_FULL = 6011;
|
|
383
383
|
var MIXOOR_ERROR__INVALID_MERKLE_PROOF = 6012;
|
|
384
|
+
var MIXOOR_ERROR__PUBLIC_INPUT_MISMATCH = 6013;
|
|
384
385
|
var mixoorErrorMessages;
|
|
385
386
|
if (process.env.NODE_ENV !== "production") {
|
|
386
387
|
mixoorErrorMessages = {
|
|
@@ -396,6 +397,7 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
396
397
|
[MIXOOR_ERROR__MISSING_TOKEN_ACCOUNT]: `Missing token account`,
|
|
397
398
|
[MIXOOR_ERROR__OVERFLOW]: `Overflow`,
|
|
398
399
|
[MIXOOR_ERROR__POSEIDON_HASH_ERROR]: `Poseidon hash error`,
|
|
400
|
+
[MIXOOR_ERROR__PUBLIC_INPUT_MISMATCH]: `Public input does not match instruction parameter`,
|
|
399
401
|
[MIXOOR_ERROR__UNKNOWN_ROOT]: `Unknown merkle root`
|
|
400
402
|
};
|
|
401
403
|
}
|
|
@@ -846,8 +848,8 @@ function getTransferInstructionDataEncoder() {
|
|
|
846
848
|
kit.getArrayEncoder(kit.fixEncoderSize(kit.getBytesEncoder(), 32), { size: 7 })
|
|
847
849
|
],
|
|
848
850
|
["nullifierHash", kit.fixEncoderSize(kit.getBytesEncoder(), 32)],
|
|
849
|
-
["
|
|
850
|
-
["
|
|
851
|
+
["relayerFee", kit.getU64Encoder()],
|
|
852
|
+
["recipientAmount", kit.getU64Encoder()]
|
|
851
853
|
]),
|
|
852
854
|
(value) => ({ ...value, discriminator: TRANSFER_DISCRIMINATOR })
|
|
853
855
|
);
|
|
@@ -863,8 +865,8 @@ function getTransferInstructionDataDecoder() {
|
|
|
863
865
|
kit.getArrayDecoder(kit.fixDecoderSize(kit.getBytesDecoder(), 32), { size: 7 })
|
|
864
866
|
],
|
|
865
867
|
["nullifierHash", kit.fixDecoderSize(kit.getBytesDecoder(), 32)],
|
|
866
|
-
["
|
|
867
|
-
["
|
|
868
|
+
["relayerFee", kit.getU64Decoder()],
|
|
869
|
+
["recipientAmount", kit.getU64Decoder()]
|
|
868
870
|
]);
|
|
869
871
|
}
|
|
870
872
|
function getTransferInstructionDataCodec() {
|
|
@@ -920,6 +922,7 @@ async function getTransferInstructionAsync(input, config) {
|
|
|
920
922
|
kit.getBytesEncoder().encode(
|
|
921
923
|
new Uint8Array([110, 117, 108, 108, 105, 102, 105, 101, 114])
|
|
922
924
|
),
|
|
925
|
+
kit.getAddressEncoder().encode(expectAddress(accounts.pool.value)),
|
|
923
926
|
kit.fixEncoderSize(kit.getBytesEncoder(), 32).encode(
|
|
924
927
|
expectSome(args.nullifierHash)
|
|
925
928
|
)
|
|
@@ -1222,14 +1225,6 @@ async function generateProof(input) {
|
|
|
1222
1225
|
const publicInputs = publicSignals.map(
|
|
1223
1226
|
(signal) => publicSignalToBytes(signal)
|
|
1224
1227
|
);
|
|
1225
|
-
console.log(
|
|
1226
|
-
"DEBUG: Generated Public Inputs (Keys: root, nullifierHash, recipient, relayer, fee, refund, poolId):"
|
|
1227
|
-
);
|
|
1228
|
-
publicInputs.forEach((input2, i) => {
|
|
1229
|
-
const hexBE = Buffer.from(input2).toString("hex");
|
|
1230
|
-
const hexLE = Buffer.from(input2.slice().reverse()).toString("hex");
|
|
1231
|
-
console.log(`Input ${i}: BE=${hexBE} | LE=${hexLE}`);
|
|
1232
|
-
});
|
|
1233
1228
|
const proof_a = g1PointToBytes([proof.pi_a[0], proof.pi_a[1]]);
|
|
1234
1229
|
const proof_b = g2PointToBytes([
|
|
1235
1230
|
[proof.pi_b[0][0], proof.pi_b[0][1]],
|
|
@@ -1388,7 +1383,11 @@ async function findNullifierAddress(seeds, config = {}) {
|
|
|
1388
1383
|
const { programAddress = MIXOOR_PROGRAM_ADDRESS } = config;
|
|
1389
1384
|
return await kit.getProgramDerivedAddress({
|
|
1390
1385
|
programAddress,
|
|
1391
|
-
seeds: [
|
|
1386
|
+
seeds: [
|
|
1387
|
+
"nullifier",
|
|
1388
|
+
kit.getAddressEncoder().encode(seeds.pool),
|
|
1389
|
+
seeds.nullifierHash
|
|
1390
|
+
]
|
|
1392
1391
|
});
|
|
1393
1392
|
}
|
|
1394
1393
|
|
|
@@ -1407,6 +1406,7 @@ exports.MIXOOR_ERROR__MERKLE_TREE_FULL = MIXOOR_ERROR__MERKLE_TREE_FULL;
|
|
|
1407
1406
|
exports.MIXOOR_ERROR__MISSING_TOKEN_ACCOUNT = MIXOOR_ERROR__MISSING_TOKEN_ACCOUNT;
|
|
1408
1407
|
exports.MIXOOR_ERROR__OVERFLOW = MIXOOR_ERROR__OVERFLOW;
|
|
1409
1408
|
exports.MIXOOR_ERROR__POSEIDON_HASH_ERROR = MIXOOR_ERROR__POSEIDON_HASH_ERROR;
|
|
1409
|
+
exports.MIXOOR_ERROR__PUBLIC_INPUT_MISMATCH = MIXOOR_ERROR__PUBLIC_INPUT_MISMATCH;
|
|
1410
1410
|
exports.MIXOOR_ERROR__UNKNOWN_ROOT = MIXOOR_ERROR__UNKNOWN_ROOT;
|
|
1411
1411
|
exports.MIXOOR_PROGRAM_ADDRESS = MIXOOR_PROGRAM_ADDRESS;
|
|
1412
1412
|
exports.MerkleTree = MerkleTree;
|