@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.mjs
CHANGED
|
@@ -357,6 +357,7 @@ var MIXOOR_ERROR__INVALID_MERKLE_TREE = 6009;
|
|
|
357
357
|
var MIXOOR_ERROR__POSEIDON_HASH_ERROR = 6010;
|
|
358
358
|
var MIXOOR_ERROR__MERKLE_TREE_FULL = 6011;
|
|
359
359
|
var MIXOOR_ERROR__INVALID_MERKLE_PROOF = 6012;
|
|
360
|
+
var MIXOOR_ERROR__PUBLIC_INPUT_MISMATCH = 6013;
|
|
360
361
|
var mixoorErrorMessages;
|
|
361
362
|
if (process.env.NODE_ENV !== "production") {
|
|
362
363
|
mixoorErrorMessages = {
|
|
@@ -372,6 +373,7 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
372
373
|
[MIXOOR_ERROR__MISSING_TOKEN_ACCOUNT]: `Missing token account`,
|
|
373
374
|
[MIXOOR_ERROR__OVERFLOW]: `Overflow`,
|
|
374
375
|
[MIXOOR_ERROR__POSEIDON_HASH_ERROR]: `Poseidon hash error`,
|
|
376
|
+
[MIXOOR_ERROR__PUBLIC_INPUT_MISMATCH]: `Public input does not match instruction parameter`,
|
|
375
377
|
[MIXOOR_ERROR__UNKNOWN_ROOT]: `Unknown merkle root`
|
|
376
378
|
};
|
|
377
379
|
}
|
|
@@ -822,8 +824,8 @@ function getTransferInstructionDataEncoder() {
|
|
|
822
824
|
getArrayEncoder(fixEncoderSize(getBytesEncoder(), 32), { size: 7 })
|
|
823
825
|
],
|
|
824
826
|
["nullifierHash", fixEncoderSize(getBytesEncoder(), 32)],
|
|
825
|
-
["
|
|
826
|
-
["
|
|
827
|
+
["relayerFee", getU64Encoder()],
|
|
828
|
+
["recipientAmount", getU64Encoder()]
|
|
827
829
|
]),
|
|
828
830
|
(value) => ({ ...value, discriminator: TRANSFER_DISCRIMINATOR })
|
|
829
831
|
);
|
|
@@ -839,8 +841,8 @@ function getTransferInstructionDataDecoder() {
|
|
|
839
841
|
getArrayDecoder(fixDecoderSize(getBytesDecoder(), 32), { size: 7 })
|
|
840
842
|
],
|
|
841
843
|
["nullifierHash", fixDecoderSize(getBytesDecoder(), 32)],
|
|
842
|
-
["
|
|
843
|
-
["
|
|
844
|
+
["relayerFee", getU64Decoder()],
|
|
845
|
+
["recipientAmount", getU64Decoder()]
|
|
844
846
|
]);
|
|
845
847
|
}
|
|
846
848
|
function getTransferInstructionDataCodec() {
|
|
@@ -896,6 +898,7 @@ async function getTransferInstructionAsync(input, config) {
|
|
|
896
898
|
getBytesEncoder().encode(
|
|
897
899
|
new Uint8Array([110, 117, 108, 108, 105, 102, 105, 101, 114])
|
|
898
900
|
),
|
|
901
|
+
getAddressEncoder().encode(expectAddress(accounts.pool.value)),
|
|
899
902
|
fixEncoderSize(getBytesEncoder(), 32).encode(
|
|
900
903
|
expectSome(args.nullifierHash)
|
|
901
904
|
)
|
|
@@ -1198,14 +1201,6 @@ async function generateProof(input) {
|
|
|
1198
1201
|
const publicInputs = publicSignals.map(
|
|
1199
1202
|
(signal) => publicSignalToBytes(signal)
|
|
1200
1203
|
);
|
|
1201
|
-
console.log(
|
|
1202
|
-
"DEBUG: Generated Public Inputs (Keys: root, nullifierHash, recipient, relayer, fee, refund, poolId):"
|
|
1203
|
-
);
|
|
1204
|
-
publicInputs.forEach((input2, i) => {
|
|
1205
|
-
const hexBE = Buffer.from(input2).toString("hex");
|
|
1206
|
-
const hexLE = Buffer.from(input2.slice().reverse()).toString("hex");
|
|
1207
|
-
console.log(`Input ${i}: BE=${hexBE} | LE=${hexLE}`);
|
|
1208
|
-
});
|
|
1209
1204
|
const proof_a = g1PointToBytes([proof.pi_a[0], proof.pi_a[1]]);
|
|
1210
1205
|
const proof_b = g2PointToBytes([
|
|
1211
1206
|
[proof.pi_b[0][0], proof.pi_b[0][1]],
|
|
@@ -1364,10 +1359,14 @@ async function findNullifierAddress(seeds, config = {}) {
|
|
|
1364
1359
|
const { programAddress = MIXOOR_PROGRAM_ADDRESS } = config;
|
|
1365
1360
|
return await getProgramDerivedAddress({
|
|
1366
1361
|
programAddress,
|
|
1367
|
-
seeds: [
|
|
1362
|
+
seeds: [
|
|
1363
|
+
"nullifier",
|
|
1364
|
+
getAddressEncoder().encode(seeds.pool),
|
|
1365
|
+
seeds.nullifierHash
|
|
1366
|
+
]
|
|
1368
1367
|
});
|
|
1369
1368
|
}
|
|
1370
1369
|
|
|
1371
|
-
export { AssetType, DEPOSIT_DISCRIMINATOR, INITIALIZE_POOL_DISCRIMINATOR, MIXOOR_ERROR__INSUFFICIENT_FUNDS, MIXOOR_ERROR__INVALID_AMOUNT, MIXOOR_ERROR__INVALID_ASSET_TYPE, MIXOOR_ERROR__INVALID_MERKLE_PROOF, MIXOOR_ERROR__INVALID_MERKLE_TREE, MIXOOR_ERROR__INVALID_MERKLE_TREE_ADDRESS, MIXOOR_ERROR__INVALID_PROOF, MIXOOR_ERROR__INVALID_PUBLIC_INPUTS, MIXOOR_ERROR__MERKLE_TREE_FULL, MIXOOR_ERROR__MISSING_TOKEN_ACCOUNT, MIXOOR_ERROR__OVERFLOW, MIXOOR_ERROR__POSEIDON_HASH_ERROR, MIXOOR_ERROR__UNKNOWN_ROOT, MIXOOR_PROGRAM_ADDRESS, MerkleTree, MixoorAccount, MixoorInstruction, NULLIFIER_ACCOUNT_DISCRIMINATOR, POOL_DISCRIMINATOR, TRANSFER_DISCRIMINATOR, VAULT_DISCRIMINATOR, decodeNullifierAccount, decodePool, decodeVault, extractMerkleRootFromAccount, fetchAllMaybeNullifierAccount, fetchAllMaybePool, fetchAllMaybeVault, fetchAllNullifierAccount, fetchAllPool, fetchAllVault, fetchMaybeNullifierAccount, fetchMaybePool, fetchMaybeVault, fetchNullifierAccount, fetchPool, fetchVault, findMerkleTreeAddress, findNullifierAddress, findPoolAddress, findVaultAddress, fromHex, generateCommitment, generateNullifier, generateProof, getAssetTypeCodec, getAssetTypeDecoder, getAssetTypeEncoder, getCommitmentInsertedCodec, getCommitmentInsertedDecoder, getCommitmentInsertedEncoder, getDepositDiscriminatorBytes, getDepositInstruction, getDepositInstructionAsync, getDepositInstructionDataCodec, getDepositInstructionDataDecoder, getDepositInstructionDataEncoder, getInitializePoolDiscriminatorBytes, getInitializePoolInstruction, getInitializePoolInstructionAsync, getInitializePoolInstructionDataCodec, getInitializePoolInstructionDataDecoder, getInitializePoolInstructionDataEncoder, getMixoorErrorMessage, getNullifierAccountCodec, getNullifierAccountDecoder, getNullifierAccountDiscriminatorBytes, getNullifierAccountEncoder, getNullifierAccountSize, getPoolCodec, getPoolDecoder, getPoolDiscriminatorBytes, getPoolEncoder, getPoolSize, getRootEntryCodec, getRootEntryDecoder, getRootEntryEncoder, getTransferDiscriminatorBytes, getTransferInstruction, getTransferInstructionAsync, getTransferInstructionDataCodec, getTransferInstructionDataDecoder, getTransferInstructionDataEncoder, getVaultCodec, getVaultDecoder, getVaultDiscriminatorBytes, getVaultEncoder, getVaultSize, identifyMixoorAccount, identifyMixoorInstruction, isMixoorError, parseDepositInstruction, parseInitializePoolInstruction, parseTransferInstruction, poseidonHash, randomBytes, toHex };
|
|
1370
|
+
export { AssetType, DEPOSIT_DISCRIMINATOR, INITIALIZE_POOL_DISCRIMINATOR, MIXOOR_ERROR__INSUFFICIENT_FUNDS, MIXOOR_ERROR__INVALID_AMOUNT, MIXOOR_ERROR__INVALID_ASSET_TYPE, MIXOOR_ERROR__INVALID_MERKLE_PROOF, MIXOOR_ERROR__INVALID_MERKLE_TREE, MIXOOR_ERROR__INVALID_MERKLE_TREE_ADDRESS, MIXOOR_ERROR__INVALID_PROOF, MIXOOR_ERROR__INVALID_PUBLIC_INPUTS, MIXOOR_ERROR__MERKLE_TREE_FULL, MIXOOR_ERROR__MISSING_TOKEN_ACCOUNT, MIXOOR_ERROR__OVERFLOW, MIXOOR_ERROR__POSEIDON_HASH_ERROR, MIXOOR_ERROR__PUBLIC_INPUT_MISMATCH, MIXOOR_ERROR__UNKNOWN_ROOT, MIXOOR_PROGRAM_ADDRESS, MerkleTree, MixoorAccount, MixoorInstruction, NULLIFIER_ACCOUNT_DISCRIMINATOR, POOL_DISCRIMINATOR, TRANSFER_DISCRIMINATOR, VAULT_DISCRIMINATOR, decodeNullifierAccount, decodePool, decodeVault, extractMerkleRootFromAccount, fetchAllMaybeNullifierAccount, fetchAllMaybePool, fetchAllMaybeVault, fetchAllNullifierAccount, fetchAllPool, fetchAllVault, fetchMaybeNullifierAccount, fetchMaybePool, fetchMaybeVault, fetchNullifierAccount, fetchPool, fetchVault, findMerkleTreeAddress, findNullifierAddress, findPoolAddress, findVaultAddress, fromHex, generateCommitment, generateNullifier, generateProof, getAssetTypeCodec, getAssetTypeDecoder, getAssetTypeEncoder, getCommitmentInsertedCodec, getCommitmentInsertedDecoder, getCommitmentInsertedEncoder, getDepositDiscriminatorBytes, getDepositInstruction, getDepositInstructionAsync, getDepositInstructionDataCodec, getDepositInstructionDataDecoder, getDepositInstructionDataEncoder, getInitializePoolDiscriminatorBytes, getInitializePoolInstruction, getInitializePoolInstructionAsync, getInitializePoolInstructionDataCodec, getInitializePoolInstructionDataDecoder, getInitializePoolInstructionDataEncoder, getMixoorErrorMessage, getNullifierAccountCodec, getNullifierAccountDecoder, getNullifierAccountDiscriminatorBytes, getNullifierAccountEncoder, getNullifierAccountSize, getPoolCodec, getPoolDecoder, getPoolDiscriminatorBytes, getPoolEncoder, getPoolSize, getRootEntryCodec, getRootEntryDecoder, getRootEntryEncoder, getTransferDiscriminatorBytes, getTransferInstruction, getTransferInstructionAsync, getTransferInstructionDataCodec, getTransferInstructionDataDecoder, getTransferInstructionDataEncoder, getVaultCodec, getVaultDecoder, getVaultDiscriminatorBytes, getVaultEncoder, getVaultSize, identifyMixoorAccount, identifyMixoorInstruction, isMixoorError, parseDepositInstruction, parseInitializePoolInstruction, parseTransferInstruction, poseidonHash, randomBytes, toHex };
|
|
1372
1371
|
//# sourceMappingURL=index.mjs.map
|
|
1373
1372
|
//# sourceMappingURL=index.mjs.map
|