@orbinum/sdk 0.5.0 → 0.6.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/LICENSE +21 -0
- package/README.md +16 -499
- package/dist/index.d.mts +337 -737
- package/dist/index.d.ts +337 -737
- package/dist/index.js +200 -399
- package/dist/index.mjs +193 -390
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -27,7 +27,7 @@ __export(index_exports, {
|
|
|
27
27
|
BN254_R: () => BN254_R,
|
|
28
28
|
Blake2256: () => import_substrate_bindings3.Blake2256,
|
|
29
29
|
CircuitId: () => CircuitId,
|
|
30
|
-
CircuitType: () =>
|
|
30
|
+
CircuitType: () => import_proof_generator.CircuitType,
|
|
31
31
|
CryptoPrecompiles: () => CryptoPrecompiles,
|
|
32
32
|
ENCRYPTED_MEMO_SIZE: () => ENCRYPTED_MEMO_SIZE,
|
|
33
33
|
EncryptedMemo: () => EncryptedMemo,
|
|
@@ -50,7 +50,7 @@ __export(index_exports, {
|
|
|
50
50
|
Storage: () => import_substrate_bindings3.Storage,
|
|
51
51
|
SubstrateClient: () => SubstrateClient,
|
|
52
52
|
VaultLockedError: () => VaultLockedError,
|
|
53
|
-
WebArtifactProvider: () =>
|
|
53
|
+
WebArtifactProvider: () => import_proof_generator.WebArtifactProvider,
|
|
54
54
|
ZkVerifierModule: () => ZkVerifierModule,
|
|
55
55
|
accountIdHexToSs58: () => accountIdHexToSs58,
|
|
56
56
|
addressToAccountIdHex: () => addressToAccountIdHex,
|
|
@@ -59,17 +59,16 @@ __export(index_exports, {
|
|
|
59
59
|
bigintTo32Be: () => bigintTo32Be,
|
|
60
60
|
bigintTo32Le: () => bigintTo32Le,
|
|
61
61
|
bigintTo32LeArr: () => bigintTo32LeArr,
|
|
62
|
-
buildDisclosurePublicSignals: () => buildDisclosurePublicSignals,
|
|
63
62
|
buildDummyTransferInput: () => buildDummyTransferInput,
|
|
64
63
|
bytesToBigintLE: () => bytesToBigintLE,
|
|
65
64
|
computeNullifier: () => computeNullifier,
|
|
66
65
|
computePathIndices: () => computePathIndices,
|
|
67
66
|
connectInjectedExtension: () => import_pjs_signer.connectInjectedExtension,
|
|
67
|
+
createNoteDisclosureKey: () => createNoteDisclosureKey,
|
|
68
|
+
decodeNoteDisclosureKey: () => decodeNoteDisclosureKey,
|
|
68
69
|
decodePrecompileCalldata: () => decodePrecompileCalldata,
|
|
69
|
-
decryptDisclosureSignals: () => decryptDisclosureSignals,
|
|
70
70
|
decryptJson: () => decryptJson,
|
|
71
71
|
decryptNoteRecord: () => decryptNoteRecord,
|
|
72
|
-
deriveBabyJubjubKeypair: () => deriveBabyJubjubKeypair,
|
|
73
72
|
deriveMasterKeyBytes: () => deriveMasterKeyBytes,
|
|
74
73
|
deriveOwnerPk: () => deriveOwnerPk,
|
|
75
74
|
deriveSpendingKeyFromSignature: () => deriveSpendingKeyFromSignature,
|
|
@@ -90,7 +89,6 @@ __export(index_exports, {
|
|
|
90
89
|
formatORB: () => formatORB,
|
|
91
90
|
fromBase64: () => fromBase64,
|
|
92
91
|
fromHex: () => fromHex,
|
|
93
|
-
generateDisclosureProof: () => import_proof_generator.generateDisclosureProof,
|
|
94
92
|
generateFeeClaimProof: () => generateFeeClaimProof,
|
|
95
93
|
generateTransferProof: () => generateTransferProof,
|
|
96
94
|
generateUnshieldProof: () => generateUnshieldProof,
|
|
@@ -1319,6 +1317,46 @@ var IndexerClient = class {
|
|
|
1319
1317
|
`/shielded/address/${encodeURIComponent(address.toLowerCase())}${qs}`
|
|
1320
1318
|
);
|
|
1321
1319
|
}
|
|
1320
|
+
// ─── Relayers ──────────────────────────────────────────────────────────────
|
|
1321
|
+
/** Returns a paginated list of relayers. Filter by active status with `active`. */
|
|
1322
|
+
async getRelayers(params) {
|
|
1323
|
+
const qs = this.buildQuery({
|
|
1324
|
+
page: params?.page,
|
|
1325
|
+
limit: params?.limit,
|
|
1326
|
+
active: params?.active === void 0 ? void 0 : params.active ? "true" : "false"
|
|
1327
|
+
});
|
|
1328
|
+
return this.get(`/relayers${qs}`);
|
|
1329
|
+
}
|
|
1330
|
+
/** Returns a single relayer by EVM address, or null if not found. */
|
|
1331
|
+
async getRelayer(evmAddress) {
|
|
1332
|
+
return this.getOrNull(`/relayers/${encodeURIComponent(evmAddress.toLowerCase())}`);
|
|
1333
|
+
}
|
|
1334
|
+
/** Returns a paginated list of relay fee events. */
|
|
1335
|
+
async getRelayFees(params) {
|
|
1336
|
+
const qs = this.buildQuery({
|
|
1337
|
+
page: params?.page,
|
|
1338
|
+
limit: params?.limit,
|
|
1339
|
+
relayer: params?.relayer,
|
|
1340
|
+
type: params?.type
|
|
1341
|
+
});
|
|
1342
|
+
return this.get(`/relayers/fees${qs}`);
|
|
1343
|
+
}
|
|
1344
|
+
/** Returns aggregated relay fee balances per asset for a given relayer account. */
|
|
1345
|
+
async getRelayFeesSummary(relayer) {
|
|
1346
|
+
return this.get(
|
|
1347
|
+
`/relayers/fees/summary/${encodeURIComponent(relayer)}`
|
|
1348
|
+
);
|
|
1349
|
+
}
|
|
1350
|
+
// ─── Registered assets ─────────────────────────────────────────────────────
|
|
1351
|
+
/** Returns a paginated list of assets registered via register_asset. */
|
|
1352
|
+
async getRegisteredAssets(params) {
|
|
1353
|
+
const qs = this.buildQuery({ page: params?.page, limit: params?.limit });
|
|
1354
|
+
return this.get(`/shielded/assets${qs}`);
|
|
1355
|
+
}
|
|
1356
|
+
/** Returns a single registered asset by its ID, or null if not found. */
|
|
1357
|
+
async getRegisteredAsset(assetId) {
|
|
1358
|
+
return this.getOrNull(`/shielded/assets/${encodeURIComponent(assetId)}`);
|
|
1359
|
+
}
|
|
1322
1360
|
// ─── Stats & Health ────────────────────────────────────────────────────────
|
|
1323
1361
|
/** Returns aggregated indexer statistics. */
|
|
1324
1362
|
async getStats() {
|
|
@@ -1903,7 +1941,7 @@ var ShieldedPoolModule = class {
|
|
|
1903
1941
|
/**
|
|
1904
1942
|
* Claims accrued relay fees into the shielded pool.
|
|
1905
1943
|
* This is a SIGNED transaction — the relayer must sign it with their wallet.
|
|
1906
|
-
* Before calling this, generate a ZK
|
|
1944
|
+
* Before calling this, generate a ZK value proof with generateFeeClaimProof() (not yet implemented).
|
|
1907
1945
|
*
|
|
1908
1946
|
* Extrinsic: shieldedPool.claim_shielded_fees(commitment, amount, asset_id, memo, proof, public_signals)
|
|
1909
1947
|
*/
|
|
@@ -1922,95 +1960,6 @@ var ShieldedPoolModule = class {
|
|
|
1922
1960
|
await (txOptions !== void 0 ? tx.signAndSubmit(signer, txOptions) : tx.signAndSubmit(signer))
|
|
1923
1961
|
);
|
|
1924
1962
|
}
|
|
1925
|
-
// ─── Selective Disclosure ──────────────────────────────────────────────────
|
|
1926
|
-
/**
|
|
1927
|
-
* Requests a selective disclosure from a target account for a specific commitment.
|
|
1928
|
-
* The auditor's Baby Jubjub public key is included so the note owner knows
|
|
1929
|
-
* which key to encrypt to when generating the proof.
|
|
1930
|
-
* Extrinsic: shieldedPool.request_disclosure(target, commitment, required_fields,
|
|
1931
|
-
* reason, auditor_bjj_pk_x, auditor_bjj_pk_y)
|
|
1932
|
-
*/
|
|
1933
|
-
async requestDisclosure(params, signer, txOptions) {
|
|
1934
|
-
const entry = resolveTx(this.substrate.unsafe, "ShieldedPool", "request_disclosure");
|
|
1935
|
-
const tx = callUnsafeTx(entry, {
|
|
1936
|
-
target: params.target,
|
|
1937
|
-
commitment: import_polkadot_api2.Binary.fromBytes(new Uint8Array(params.commitment)),
|
|
1938
|
-
required_fields: {
|
|
1939
|
-
value: params.requiredFields.value,
|
|
1940
|
-
asset_id: params.requiredFields.assetId,
|
|
1941
|
-
owner: params.requiredFields.owner
|
|
1942
|
-
},
|
|
1943
|
-
reason: import_polkadot_api2.Binary.fromText(params.reason),
|
|
1944
|
-
auditor_bjj_pk_x: import_polkadot_api2.Binary.fromBytes(new Uint8Array(params.auditorBjjPkX)),
|
|
1945
|
-
auditor_bjj_pk_y: import_polkadot_api2.Binary.fromBytes(new Uint8Array(params.auditorBjjPkY))
|
|
1946
|
-
});
|
|
1947
|
-
return toTxResult(
|
|
1948
|
-
await (txOptions !== void 0 ? tx.signAndSubmit(signer, txOptions) : tx.signAndSubmit(signer))
|
|
1949
|
-
);
|
|
1950
|
-
}
|
|
1951
|
-
/**
|
|
1952
|
-
* Submits a Groth16 ZK disclosure proof for a note commitment.
|
|
1953
|
-
* The proof reveals the selected fields (value, asset_id, owner_hash) on-chain.
|
|
1954
|
-
* Use generateDisclosureProof() + buildDisclosurePublicSignals() before calling this.
|
|
1955
|
-
* Extrinsic: shieldedPool.disclose(commitment, proof_bytes, public_signals, auditor)
|
|
1956
|
-
*/
|
|
1957
|
-
async disclose(params, signer, txOptions) {
|
|
1958
|
-
const entry = resolveTx(this.substrate.unsafe, "ShieldedPool", "disclose");
|
|
1959
|
-
const tx = callUnsafeTx(entry, {
|
|
1960
|
-
commitment: import_polkadot_api2.Binary.fromBytes(new Uint8Array(params.commitment)),
|
|
1961
|
-
proof_bytes: import_polkadot_api2.Binary.fromBytes(new Uint8Array(params.proofBytes)),
|
|
1962
|
-
public_signals: import_polkadot_api2.Binary.fromBytes(new Uint8Array(params.publicSignals)),
|
|
1963
|
-
auditor: params.auditor
|
|
1964
|
-
});
|
|
1965
|
-
return toTxResult(
|
|
1966
|
-
await (txOptions !== void 0 ? tx.signAndSubmit(signer, txOptions) : tx.signAndSubmit(signer))
|
|
1967
|
-
);
|
|
1968
|
-
}
|
|
1969
|
-
/**
|
|
1970
|
-
* Rejects a pending disclosure request from an auditor for a specific commitment.
|
|
1971
|
-
* Extrinsic: shieldedPool.reject_disclosure(auditor, commitment, reason)
|
|
1972
|
-
*/
|
|
1973
|
-
async rejectDisclosure(params, signer, txOptions) {
|
|
1974
|
-
const entry = resolveTx(this.substrate.unsafe, "ShieldedPool", "reject_disclosure");
|
|
1975
|
-
const tx = callUnsafeTx(entry, {
|
|
1976
|
-
auditor: params.auditor,
|
|
1977
|
-
commitment: import_polkadot_api2.Binary.fromBytes(new Uint8Array(params.commitment)),
|
|
1978
|
-
reason: import_polkadot_api2.Binary.fromText(params.reason)
|
|
1979
|
-
});
|
|
1980
|
-
return toTxResult(
|
|
1981
|
-
await (txOptions !== void 0 ? tx.signAndSubmit(signer, txOptions) : tx.signAndSubmit(signer))
|
|
1982
|
-
);
|
|
1983
|
-
}
|
|
1984
|
-
/**
|
|
1985
|
-
* Cleans up a disclosure request that has passed its expiration block.
|
|
1986
|
-
* Permissionless — any account can prune expired requests.
|
|
1987
|
-
* Extrinsic: shieldedPool.prune_expired_request(target, auditor, commitment)
|
|
1988
|
-
*/
|
|
1989
|
-
async pruneExpiredRequest(params, signer, txOptions) {
|
|
1990
|
-
const entry = resolveTx(this.substrate.unsafe, "ShieldedPool", "prune_expired_request");
|
|
1991
|
-
const tx = callUnsafeTx(entry, {
|
|
1992
|
-
target: params.target,
|
|
1993
|
-
auditor: params.auditor,
|
|
1994
|
-
commitment: import_polkadot_api2.Binary.fromBytes(new Uint8Array(params.commitment))
|
|
1995
|
-
});
|
|
1996
|
-
return toTxResult(
|
|
1997
|
-
await (txOptions !== void 0 ? tx.signAndSubmit(signer, txOptions) : tx.signAndSubmit(signer))
|
|
1998
|
-
);
|
|
1999
|
-
}
|
|
2000
|
-
/**
|
|
2001
|
-
* Revokes a previously submitted voluntary disclosure record.
|
|
2002
|
-
* Only applies to self-disclosures (auditor = None). Auditor-requested records are permanent.
|
|
2003
|
-
* Extrinsic: shieldedPool.revoke_disclosure_record(commitment)
|
|
2004
|
-
*/
|
|
2005
|
-
async revokeDisclosureRecord(params, signer, txOptions) {
|
|
2006
|
-
const entry = resolveTx(this.substrate.unsafe, "ShieldedPool", "revoke_disclosure_record");
|
|
2007
|
-
const tx = callUnsafeTx(entry, {
|
|
2008
|
-
commitment: import_polkadot_api2.Binary.fromBytes(new Uint8Array(params.commitment))
|
|
2009
|
-
});
|
|
2010
|
-
return toTxResult(
|
|
2011
|
-
await (txOptions !== void 0 ? tx.signAndSubmit(signer, txOptions) : tx.signAndSubmit(signer))
|
|
2012
|
-
);
|
|
2013
|
-
}
|
|
2014
1963
|
};
|
|
2015
1964
|
|
|
2016
1965
|
// src/account-mapping/AccountMappingModule.ts
|
|
@@ -2761,14 +2710,8 @@ var SP_SEL = {
|
|
|
2761
2710
|
PRIVATE_TRANSFER: new Uint8Array([140, 15, 93, 36]),
|
|
2762
2711
|
// unshield(bytes,bytes32,bytes32,uint32,uint256,bytes32,uint256,bytes32) → 0xd21d9a79
|
|
2763
2712
|
UNSHIELD: new Uint8Array([210, 29, 154, 121]),
|
|
2764
|
-
//
|
|
2765
|
-
|
|
2766
|
-
// disclose(bytes32,bytes,bytes,bytes32) → 0xea8a4165 (caller = note owner)
|
|
2767
|
-
DISCLOSE: new Uint8Array([234, 138, 65, 101]),
|
|
2768
|
-
// rejectDisclosure(bytes32,bytes32,bytes) → 0x72b895a9 (caller = target)
|
|
2769
|
-
REJECT_DISCLOSURE: new Uint8Array([114, 184, 149, 169]),
|
|
2770
|
-
// pruneExpiredRequest(bytes32,bytes32,bytes32) → 0x0c338dcf (permissionless)
|
|
2771
|
-
PRUNE_EXPIRED_REQUEST: new Uint8Array([12, 51, 141, 207])
|
|
2713
|
+
// claimShieldedFees(bytes32,uint256,uint32,bytes,bytes,bytes) → 0x42e1e74c
|
|
2714
|
+
CLAIM_SHIELDED_FEES: new Uint8Array([66, 225, 231, 76])
|
|
2772
2715
|
};
|
|
2773
2716
|
var KNOWN_PRECOMPILES = {
|
|
2774
2717
|
// ── Ethereum standard (EIP) ─────────────────────────────────────────────
|
|
@@ -2814,10 +2757,7 @@ var KNOWN_PRECOMPILES = {
|
|
|
2814
2757
|
"9feb22ea": "shield(uint32,bytes32,bytes)",
|
|
2815
2758
|
"8c0f5d24": "privateTransfer(bytes,bytes32,bytes32[],bytes32[],bytes[],uint32,uint256)",
|
|
2816
2759
|
d21d9a79: "unshield(bytes,bytes32,bytes32,uint32,uint256,bytes32,uint256,bytes32)",
|
|
2817
|
-
|
|
2818
|
-
ea8a4165: "disclose(bytes32,bytes,bytes,bytes32)",
|
|
2819
|
-
"72b895a9": "rejectDisclosure(bytes32,bytes32,bytes)",
|
|
2820
|
-
"0c338dcf": "pruneExpiredRequest(bytes32,bytes32,bytes32)"
|
|
2760
|
+
"42e1e74c": "claimShieldedFees(bytes32,uint256,uint32,bytes,bytes,bytes)"
|
|
2821
2761
|
}
|
|
2822
2762
|
}
|
|
2823
2763
|
};
|
|
@@ -2980,132 +2920,77 @@ var ShieldedPoolPrecompile = class {
|
|
|
2980
2920
|
data: this.buildUnshieldCalldata(params)
|
|
2981
2921
|
});
|
|
2982
2922
|
}
|
|
2983
|
-
// ───
|
|
2923
|
+
// ─── claimShieldedFees ───────────────────────────────────────────────────────────────────
|
|
2984
2924
|
/**
|
|
2985
2925
|
* Returns the ABI-encoded calldata for
|
|
2986
|
-
* `
|
|
2987
|
-
*
|
|
2988
|
-
* The **EVM caller** of the resulting transaction is treated as the **auditor**
|
|
2989
|
-
* on-chain. No explicit auditor argument is needed.
|
|
2990
|
-
*/
|
|
2991
|
-
buildRequestDisclosureCalldata(params) {
|
|
2992
|
-
if (params.auditorBjjPkX.length !== 32)
|
|
2993
|
-
throw new RangeError("requestDisclosure: auditorBjjPkX must be 32 bytes");
|
|
2994
|
-
if (params.auditorBjjPkY.length !== 32)
|
|
2995
|
-
throw new RangeError("requestDisclosure: auditorBjjPkY must be 32 bytes");
|
|
2996
|
-
const target = fromHex(params.target);
|
|
2997
|
-
const commitment = fromHex(params.commitment);
|
|
2998
|
-
const reasonBytes = new TextEncoder().encode(params.reason);
|
|
2999
|
-
return encodeHex(
|
|
3000
|
-
SP_SEL.REQUEST_DISCLOSURE,
|
|
3001
|
-
{ type: "bytes32", value: target },
|
|
3002
|
-
{ type: "bytes32", value: commitment },
|
|
3003
|
-
{ type: "bool", value: params.disclosedValue },
|
|
3004
|
-
{ type: "bool", value: params.disclosedAssetId },
|
|
3005
|
-
{ type: "bool", value: params.disclosedOwner },
|
|
3006
|
-
{ type: "bytes", value: reasonBytes },
|
|
3007
|
-
{ type: "bytes32", value: params.auditorBjjPkX },
|
|
3008
|
-
{ type: "bytes32", value: params.auditorBjjPkY }
|
|
3009
|
-
);
|
|
3010
|
-
}
|
|
3011
|
-
/**
|
|
3012
|
-
* Requests selective disclosure of a specific commitment.
|
|
2926
|
+
* `claimShieldedFees(bytes32,uint256,uint32,bytes,bytes,bytes)`.
|
|
3013
2927
|
*
|
|
3014
|
-
*
|
|
3015
|
-
*
|
|
2928
|
+
* ABI layout (params after selector):
|
|
2929
|
+
* - `commitment` — bytes32 (fixed)
|
|
2930
|
+
* - `amount` — uint256 (fixed)
|
|
2931
|
+
* - `asset_id` — uint32 (fixed, right-aligned)
|
|
2932
|
+
* - `memo` — bytes (dynamic)
|
|
2933
|
+
* - `proof` — bytes (dynamic, 128 bytes Groth16)
|
|
2934
|
+
* - `publicSignals` — bytes (dynamic, 76 bytes)
|
|
3016
2935
|
*
|
|
3017
|
-
*
|
|
2936
|
+
* The validator identity is derived from `msg.sender` in the precompile —
|
|
2937
|
+
* do NOT include it in the calldata.
|
|
3018
2938
|
*/
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
/**
|
|
3024
|
-
* Returns the ABI-encoded calldata for `disclose(bytes32,bytes,bytes,bytes32)`.
|
|
3025
|
-
*
|
|
3026
|
-
* The **EVM caller** is treated as the **note owner** on-chain.
|
|
3027
|
-
* `params.proofBytes` must be exactly 128 bytes; `params.publicSignals` exactly 256 bytes.
|
|
3028
|
-
*/
|
|
3029
|
-
buildDiscloseCalldata(params) {
|
|
3030
|
-
if (params.proofBytes.length !== 128)
|
|
3031
|
-
throw new RangeError("disclose: proofBytes must be exactly 128 bytes");
|
|
3032
|
-
if (params.publicSignals.length !== 256)
|
|
3033
|
-
throw new RangeError("disclose: publicSignals must be exactly 256 bytes");
|
|
3034
|
-
const commitment = fromHex(params.commitment);
|
|
3035
|
-
const auditor = fromHex(params.auditor);
|
|
3036
|
-
return encodeHex(
|
|
3037
|
-
SP_SEL.DISCLOSE,
|
|
3038
|
-
{ type: "bytes32", value: commitment },
|
|
3039
|
-
{ type: "bytes", value: params.proofBytes },
|
|
3040
|
-
{ type: "bytes", value: params.publicSignals },
|
|
3041
|
-
{ type: "bytes32", value: auditor }
|
|
2939
|
+
buildClaimShieldedFeesCalldata(params) {
|
|
2940
|
+
EncryptedMemo.validate(
|
|
2941
|
+
params.encryptedMemo,
|
|
2942
|
+
"buildClaimShieldedFeesCalldata.encryptedMemo"
|
|
3042
2943
|
);
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
* Extrinsic: `shieldedPool.disclose(commitment, proofBytes, publicSignals, auditor)`
|
|
3052
|
-
*/
|
|
3053
|
-
async disclose(params, signer) {
|
|
3054
|
-
return signer({ to: this.addr, data: this.buildDiscloseCalldata(params) });
|
|
3055
|
-
}
|
|
3056
|
-
// ─── rejectDisclosure ──────────────────────────────────────────────────────
|
|
3057
|
-
/**
|
|
3058
|
-
* Returns the ABI-encoded calldata for `rejectDisclosure(bytes32,bytes32,bytes)`.
|
|
3059
|
-
*
|
|
3060
|
-
* The **EVM caller** is treated as the **target** (note owner) on-chain.
|
|
3061
|
-
*/
|
|
3062
|
-
buildRejectDisclosureCalldata(params) {
|
|
3063
|
-
const auditor = fromHex(params.auditor);
|
|
2944
|
+
if (params.proof.length === 0) {
|
|
2945
|
+
throw new Error("claimShieldedFees: proof must not be empty");
|
|
2946
|
+
}
|
|
2947
|
+
if (params.publicSignals.length !== 76) {
|
|
2948
|
+
throw new Error(
|
|
2949
|
+
`claimShieldedFees: publicSignals must be 76 bytes, got ${params.publicSignals.length}`
|
|
2950
|
+
);
|
|
2951
|
+
}
|
|
3064
2952
|
const commitment = fromHex(params.commitment);
|
|
3065
|
-
const reasonBytes = new TextEncoder().encode(params.reason);
|
|
3066
2953
|
return encodeHex(
|
|
3067
|
-
SP_SEL.
|
|
3068
|
-
{ type: "bytes32", value: auditor },
|
|
2954
|
+
SP_SEL.CLAIM_SHIELDED_FEES,
|
|
3069
2955
|
{ type: "bytes32", value: commitment },
|
|
3070
|
-
{ type: "
|
|
2956
|
+
{ type: "uint", value: params.amount },
|
|
2957
|
+
{ type: "uint", value: BigInt(params.assetId) },
|
|
2958
|
+
{ type: "bytes", value: params.encryptedMemo },
|
|
2959
|
+
{ type: "bytes", value: params.proof },
|
|
2960
|
+
{ type: "bytes", value: params.publicSignals }
|
|
3071
2961
|
);
|
|
3072
2962
|
}
|
|
3073
2963
|
/**
|
|
3074
|
-
*
|
|
2964
|
+
* Claims accumulated relay fees as a private shielded note.
|
|
3075
2965
|
*
|
|
3076
|
-
*
|
|
2966
|
+
* This extrinsic is for **validators/relayers** who have accrued fees in
|
|
2967
|
+
* `pallet-relayer` and want to receive them privately inside the shielded pool
|
|
2968
|
+
* instead of as a public balance credit.
|
|
3077
2969
|
*
|
|
3078
|
-
*
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
/**
|
|
3085
|
-
* Returns the ABI-encoded calldata for `pruneExpiredRequest(bytes32,bytes32,bytes32)`.
|
|
2970
|
+
* The ZK `value_proof` binds `commitment` to `(amount, assetId, ownerPk, blinding)`
|
|
2971
|
+
* so the runtime can verify the note encodes exactly the claimed fee amount,
|
|
2972
|
+
* preventing a malicious relayer from inflating the withdrawal.
|
|
2973
|
+
*
|
|
2974
|
+
* The `msg.sender` EVM address is used as the validator identity; it must match
|
|
2975
|
+
* the address that has pending relay fees in `pallet-relayer`.
|
|
3086
2976
|
*
|
|
3087
|
-
*
|
|
2977
|
+
* Extrinsic: `shieldedPool.claim_shielded_fees(commitment, amount, assetId, memo, proof, publicSignals)`
|
|
3088
2978
|
*/
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
SP_SEL.PRUNE_EXPIRED_REQUEST,
|
|
3095
|
-
{ type: "bytes32", value: target },
|
|
3096
|
-
{ type: "bytes32", value: auditor },
|
|
3097
|
-
{ type: "bytes32", value: commitment }
|
|
3098
|
-
);
|
|
2979
|
+
async claimShieldedFees(params, signer) {
|
|
2980
|
+
return signer({
|
|
2981
|
+
to: this.addr,
|
|
2982
|
+
data: this.buildClaimShieldedFeesCalldata(params)
|
|
2983
|
+
});
|
|
3099
2984
|
}
|
|
3100
2985
|
/**
|
|
3101
|
-
*
|
|
3102
|
-
*
|
|
3103
|
-
* Permissionless: any EVM account can call this once `expires_at` has passed.
|
|
3104
|
-
*
|
|
3105
|
-
* Extrinsic: `shieldedPool.pruneExpiredRequest(target, auditor, commitment)`
|
|
2986
|
+
* Estimates the EVM gas for a `claimShieldedFees` call.
|
|
3106
2987
|
*/
|
|
3107
|
-
async
|
|
3108
|
-
return
|
|
2988
|
+
async estimateClaimShieldedFeesGas(params, from) {
|
|
2989
|
+
return this.evm.estimateGas({
|
|
2990
|
+
from,
|
|
2991
|
+
to: this.addr,
|
|
2992
|
+
data: this.buildClaimShieldedFeesCalldata(params)
|
|
2993
|
+
});
|
|
3109
2994
|
}
|
|
3110
2995
|
};
|
|
3111
2996
|
|
|
@@ -4114,6 +3999,56 @@ function tryDecryptNoteVerbose(commitment, viewingSecretKey, spendingKey, ownOwn
|
|
|
4114
3999
|
};
|
|
4115
4000
|
}
|
|
4116
4001
|
|
|
4002
|
+
// src/shielded-pool/protocol/NoteDisclosure.ts
|
|
4003
|
+
var import_poseidon_lite3 = require("poseidon-lite");
|
|
4004
|
+
var PREFIX = "orbdisc:";
|
|
4005
|
+
var VERSION = 1;
|
|
4006
|
+
function toHex2(n) {
|
|
4007
|
+
return "0x" + n.toString(16);
|
|
4008
|
+
}
|
|
4009
|
+
function fromHex2(s) {
|
|
4010
|
+
return BigInt(s);
|
|
4011
|
+
}
|
|
4012
|
+
function createNoteDisclosureKey(note) {
|
|
4013
|
+
const payload = {
|
|
4014
|
+
v: VERSION,
|
|
4015
|
+
c: toHex2(note.commitment),
|
|
4016
|
+
val: toHex2(note.value),
|
|
4017
|
+
aid: toHex2(note.assetId),
|
|
4018
|
+
opk: toHex2(note.ownerPk),
|
|
4019
|
+
bld: toHex2(note.blinding)
|
|
4020
|
+
};
|
|
4021
|
+
const json = JSON.stringify(payload);
|
|
4022
|
+
const b64 = btoa(json).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
4023
|
+
return PREFIX + b64;
|
|
4024
|
+
}
|
|
4025
|
+
function decodeNoteDisclosureKey(key) {
|
|
4026
|
+
try {
|
|
4027
|
+
if (!key.startsWith(PREFIX)) return null;
|
|
4028
|
+
const b64 = key.slice(PREFIX.length).replace(/-/g, "+").replace(/_/g, "/");
|
|
4029
|
+
const json = atob(b64);
|
|
4030
|
+
const payload = JSON.parse(json);
|
|
4031
|
+
if (payload.v !== VERSION) return null;
|
|
4032
|
+
const disclosure = {
|
|
4033
|
+
commitment: fromHex2(payload.c),
|
|
4034
|
+
value: fromHex2(payload.val),
|
|
4035
|
+
assetId: fromHex2(payload.aid),
|
|
4036
|
+
ownerPk: fromHex2(payload.opk),
|
|
4037
|
+
blinding: fromHex2(payload.bld)
|
|
4038
|
+
};
|
|
4039
|
+
const recomputed = (0, import_poseidon_lite3.poseidon4)([
|
|
4040
|
+
disclosure.value,
|
|
4041
|
+
disclosure.assetId,
|
|
4042
|
+
disclosure.ownerPk,
|
|
4043
|
+
disclosure.blinding
|
|
4044
|
+
]);
|
|
4045
|
+
if (recomputed !== disclosure.commitment) return null;
|
|
4046
|
+
return disclosure;
|
|
4047
|
+
} catch {
|
|
4048
|
+
return null;
|
|
4049
|
+
}
|
|
4050
|
+
}
|
|
4051
|
+
|
|
4117
4052
|
// src/shielded-pool/protocol/coinSelection.ts
|
|
4118
4053
|
var TRANSFER_TREE_DEPTH = 20;
|
|
4119
4054
|
function selectNotes(notes, needed) {
|
|
@@ -4150,49 +4085,6 @@ function buildDummyTransferInput(assetId) {
|
|
|
4150
4085
|
};
|
|
4151
4086
|
}
|
|
4152
4087
|
|
|
4153
|
-
// src/shielded-pool/protocol/disclosure.ts
|
|
4154
|
-
var import_proof_generator = require("@orbinum/proof-generator");
|
|
4155
|
-
var import_baby_jubjub5 = require("@zk-kit/baby-jubjub");
|
|
4156
|
-
var import_poseidon_lite3 = require("poseidon-lite");
|
|
4157
|
-
function hexFieldToBytes32(hex) {
|
|
4158
|
-
const clean = hex.startsWith("0x") || hex.startsWith("0X") ? hex.slice(2) : hex;
|
|
4159
|
-
return fromHex(clean.padStart(64, "0"));
|
|
4160
|
-
}
|
|
4161
|
-
function deriveBabyJubjubKeypair(substrateSigningKey) {
|
|
4162
|
-
let keyBigInt = 0n;
|
|
4163
|
-
for (let i = 0; i < substrateSigningKey.length; i++) {
|
|
4164
|
-
keyBigInt = keyBigInt << 8n | BigInt(substrateSigningKey[i]);
|
|
4165
|
-
}
|
|
4166
|
-
const sk = (0, import_poseidon_lite3.poseidon1)([keyBigInt]);
|
|
4167
|
-
const pk = (0, import_baby_jubjub5.mulPointEscalar)(import_baby_jubjub5.Base8, sk);
|
|
4168
|
-
return { sk, pkX: pk[0], pkY: pk[1] };
|
|
4169
|
-
}
|
|
4170
|
-
function buildDisclosurePublicSignals(commitment, auditorPkX, auditorPkY, proofOutput) {
|
|
4171
|
-
const buf = new Uint8Array(256);
|
|
4172
|
-
buf.set(hexFieldToBytes32(commitment), 0);
|
|
4173
|
-
buf.set(bigintTo32Le(auditorPkX), 32);
|
|
4174
|
-
buf.set(bigintTo32Le(auditorPkY), 64);
|
|
4175
|
-
buf.set(hexFieldToBytes32(proofOutput.encryptedData.epkX), 96);
|
|
4176
|
-
buf.set(hexFieldToBytes32(proofOutput.encryptedData.epkY), 128);
|
|
4177
|
-
buf.set(hexFieldToBytes32(proofOutput.encryptedData.encValue), 160);
|
|
4178
|
-
buf.set(hexFieldToBytes32(proofOutput.encryptedData.encAssetId), 192);
|
|
4179
|
-
buf.set(hexFieldToBytes32(proofOutput.encryptedData.encOwnerHash), 224);
|
|
4180
|
-
return Array.from(buf);
|
|
4181
|
-
}
|
|
4182
|
-
function decryptDisclosureSignals(auditorBjjSk, enc) {
|
|
4183
|
-
const shared = (0, import_baby_jubjub5.mulPointEscalar)([enc.epkX, enc.epkY], auditorBjjSk);
|
|
4184
|
-
const sharedX = shared[0];
|
|
4185
|
-
const sharedY = shared[1];
|
|
4186
|
-
const k0 = (0, import_poseidon_lite3.poseidon3)([sharedX, sharedY, 0n]);
|
|
4187
|
-
const k1 = (0, import_poseidon_lite3.poseidon3)([sharedX, sharedY, 1n]);
|
|
4188
|
-
const k2 = (0, import_poseidon_lite3.poseidon3)([sharedX, sharedY, 2n]);
|
|
4189
|
-
return {
|
|
4190
|
-
value: (enc.encValue - k0 + BN254_R) % BN254_R,
|
|
4191
|
-
assetId: (enc.encAssetId - k1 + BN254_R) % BN254_R,
|
|
4192
|
-
ownerHash: (enc.encOwnerHash - k2 + BN254_R) % BN254_R
|
|
4193
|
-
};
|
|
4194
|
-
}
|
|
4195
|
-
|
|
4196
4088
|
// src/utils/blinding.ts
|
|
4197
4089
|
function randomBlinding() {
|
|
4198
4090
|
const buf = new Uint8Array(32);
|
|
@@ -4204,7 +4096,7 @@ function randomBlinding() {
|
|
|
4204
4096
|
// src/privacy-keys/PrivacyKeys.ts
|
|
4205
4097
|
var import_hkdf2 = require("@noble/hashes/hkdf.js");
|
|
4206
4098
|
var import_sha23 = require("@noble/hashes/sha2.js");
|
|
4207
|
-
var
|
|
4099
|
+
var import_baby_jubjub5 = require("@zk-kit/baby-jubjub");
|
|
4208
4100
|
var IVK_DOMAIN = new TextEncoder().encode("orbinum-ivk-v1");
|
|
4209
4101
|
function deriveSpendingKeyMessage(chainId, address) {
|
|
4210
4102
|
return `orbinum-spending-key-v1
|
|
@@ -4227,13 +4119,13 @@ function deriveViewingSecretKey(spendingKey) {
|
|
|
4227
4119
|
}
|
|
4228
4120
|
function deriveViewingPublicKey(ivsk) {
|
|
4229
4121
|
const ivskScalar = BigInt(toHex(ivsk)) % BABYJUB_SUBORDER || 1n;
|
|
4230
|
-
const ivkPoint = (0,
|
|
4231
|
-
const packed = (0,
|
|
4122
|
+
const ivkPoint = (0, import_baby_jubjub5.mulPointEscalar)(import_baby_jubjub5.Base8, ivskScalar);
|
|
4123
|
+
const packed = (0, import_baby_jubjub5.packPoint)(ivkPoint);
|
|
4232
4124
|
return bigintTo32Le(packed);
|
|
4233
4125
|
}
|
|
4234
4126
|
function deriveOwnerPk(spendingKey) {
|
|
4235
4127
|
try {
|
|
4236
|
-
const pubPoint = (0,
|
|
4128
|
+
const pubPoint = (0, import_baby_jubjub5.mulPointEscalar)(import_baby_jubjub5.Base8, spendingKey);
|
|
4237
4129
|
return pubPoint[0];
|
|
4238
4130
|
} catch {
|
|
4239
4131
|
return 0n;
|
|
@@ -4504,9 +4396,9 @@ async function decryptNoteRecord(key, rec) {
|
|
|
4504
4396
|
}
|
|
4505
4397
|
|
|
4506
4398
|
// src/proof-generator/unshield.ts
|
|
4507
|
-
var
|
|
4399
|
+
var import_proof_generator = require("@orbinum/proof-generator");
|
|
4508
4400
|
var import_utils3 = require("@noble/ciphers/utils.js");
|
|
4509
|
-
var
|
|
4401
|
+
var import_baby_jubjub6 = require("@zk-kit/baby-jubjub");
|
|
4510
4402
|
var import_poseidon_lite4 = require("poseidon-lite");
|
|
4511
4403
|
|
|
4512
4404
|
// src/proof-generator/merkle.ts
|
|
@@ -4529,7 +4421,7 @@ async function generateUnshieldProof(inputs, options = {}) {
|
|
|
4529
4421
|
if (changeValue < 0n) {
|
|
4530
4422
|
throw new Error("changeValue must be >= 0.");
|
|
4531
4423
|
}
|
|
4532
|
-
const changeOwnerPubkey = inputs.changeOwnerPubkey ?? (0,
|
|
4424
|
+
const changeOwnerPubkey = inputs.changeOwnerPubkey ?? (0, import_baby_jubjub6.mulPointEscalar)(import_baby_jubjub6.Base8, inputs.spendingKey)[0];
|
|
4533
4425
|
const changeBlinding = inputs.changeBlinding ?? (changeValue > 0n ? bytesToBigintLE((0, import_utils3.randomBytes)(32)) : 0n);
|
|
4534
4426
|
const changeCommitment = changeValue > 0n ? (0, import_poseidon_lite4.poseidon4)([changeValue, inputs.assetId, changeOwnerPubkey, changeBlinding]) : 0n;
|
|
4535
4427
|
const circuitInputs = {
|
|
@@ -4550,15 +4442,15 @@ async function generateUnshieldProof(inputs, options = {}) {
|
|
|
4550
4442
|
change_blinding: changeBlinding.toString(),
|
|
4551
4443
|
change_owner_pubkey: changeOwnerPubkey.toString()
|
|
4552
4444
|
};
|
|
4553
|
-
const provider = options.provider ?? new
|
|
4445
|
+
const provider = options.provider ?? new import_proof_generator.WebArtifactProvider();
|
|
4554
4446
|
const opts = { provider };
|
|
4555
4447
|
if (options.verbose !== void 0) opts.verbose = options.verbose;
|
|
4556
|
-
const proofResult = await (0,
|
|
4448
|
+
const proofResult = await (0, import_proof_generator.generateProof)(import_proof_generator.CircuitType.Unshield, circuitInputs, opts);
|
|
4557
4449
|
return { ...proofResult, changeCommitment, changeValue, changeBlinding, changeOwnerPubkey };
|
|
4558
4450
|
}
|
|
4559
4451
|
|
|
4560
4452
|
// src/proof-generator/transfer.ts
|
|
4561
|
-
var
|
|
4453
|
+
var import_proof_generator2 = require("@orbinum/proof-generator");
|
|
4562
4454
|
async function generateTransferProof(params, options = {}) {
|
|
4563
4455
|
const root = leHexToBigint(params.merkleRoot).toString();
|
|
4564
4456
|
const [i0, i1] = params.inputs;
|
|
@@ -4583,47 +4475,38 @@ async function generateTransferProof(params, options = {}) {
|
|
|
4583
4475
|
output_owner_pubkeys: [o0.ownerPk.toString(), o1.ownerPk.toString()],
|
|
4584
4476
|
output_blindings: [o0.blinding.toString(), o1.blinding.toString()]
|
|
4585
4477
|
};
|
|
4586
|
-
const provider = options.provider ?? new
|
|
4478
|
+
const provider = options.provider ?? new import_proof_generator2.WebArtifactProvider();
|
|
4587
4479
|
const opts = { provider };
|
|
4588
4480
|
if (options.verbose !== void 0) opts.verbose = options.verbose;
|
|
4589
|
-
return (0,
|
|
4481
|
+
return (0, import_proof_generator2.generateProof)(import_proof_generator2.CircuitType.Transfer, circuitInputs, opts);
|
|
4590
4482
|
}
|
|
4591
4483
|
|
|
4592
4484
|
// src/proof-generator/fee-claim.ts
|
|
4593
|
-
var
|
|
4594
|
-
function hexSignalToBytes(hex) {
|
|
4595
|
-
const clean = hex.startsWith("0x") || hex.startsWith("0X") ? hex.slice(2) : hex;
|
|
4596
|
-
const padded = clean.padStart(64, "0");
|
|
4597
|
-
const bytes = new Uint8Array(32);
|
|
4598
|
-
for (let i = 0; i < 32; i++) {
|
|
4599
|
-
bytes[i] = parseInt(padded.slice(i * 2, i * 2 + 2), 16);
|
|
4600
|
-
}
|
|
4601
|
-
return bytes;
|
|
4602
|
-
}
|
|
4485
|
+
var import_proof_generator3 = require("@orbinum/proof-generator");
|
|
4603
4486
|
async function generateFeeClaimProof(inputs, options = {}) {
|
|
4604
|
-
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
inputs.
|
|
4609
|
-
inputs.
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
);
|
|
4618
|
-
const [, ,
|
|
4619
|
-
const
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4487
|
+
if (inputs.amount <= 0n) {
|
|
4488
|
+
throw new Error("Fee claim amount must be greater than zero.");
|
|
4489
|
+
}
|
|
4490
|
+
const circuitInputs = {
|
|
4491
|
+
commitment: inputs.commitment.toString(),
|
|
4492
|
+
value: inputs.amount.toString(),
|
|
4493
|
+
asset_id: inputs.assetId.toString(),
|
|
4494
|
+
owner_pubkey: inputs.ownerPubkey.toString(),
|
|
4495
|
+
blinding: inputs.blinding.toString()
|
|
4496
|
+
};
|
|
4497
|
+
const provider = options.provider ?? new import_proof_generator3.WebArtifactProvider();
|
|
4498
|
+
const opts = { provider };
|
|
4499
|
+
if (options.verbose !== void 0) opts.verbose = options.verbose;
|
|
4500
|
+
const proofResult = await (0, import_proof_generator3.generateProof)(import_proof_generator3.CircuitType.ValueProof, circuitInputs, opts);
|
|
4501
|
+
const [sigCommitment, sigValue, sigAssetId, sigOwnerHash] = proofResult.publicSignals.map(BigInt);
|
|
4502
|
+
const buf = new Uint8Array(76);
|
|
4503
|
+
buf.set(bigintTo32Le(sigCommitment), 0);
|
|
4504
|
+
buf.set(bigintTo32Le(sigValue).subarray(0, 8), 32);
|
|
4505
|
+
buf.set(bigintTo32Le(sigAssetId).subarray(0, 4), 40);
|
|
4506
|
+
buf.set(bigintTo32Le(sigOwnerHash), 44);
|
|
4624
4507
|
return {
|
|
4625
|
-
proof:
|
|
4626
|
-
publicSignals: Array.from(
|
|
4508
|
+
proof: proofResult.proof,
|
|
4509
|
+
publicSignals: Array.from(buf)
|
|
4627
4510
|
};
|
|
4628
4511
|
}
|
|
4629
4512
|
|
|
@@ -4693,6 +4576,17 @@ function decodePrecompileCalldata(address, input) {
|
|
|
4693
4576
|
return { fnSig, args: {} };
|
|
4694
4577
|
}
|
|
4695
4578
|
}
|
|
4579
|
+
if (fnSig.startsWith("claimShieldedFees(")) {
|
|
4580
|
+
try {
|
|
4581
|
+
const data = fromHex(input.slice(10));
|
|
4582
|
+
const commitment = toHex(data.slice(0, 32));
|
|
4583
|
+
const amount = decodeUint(data, 32);
|
|
4584
|
+
const assetId = decodeUint(data, 64);
|
|
4585
|
+
return { fnSig, args: { commitment, amount, assetId } };
|
|
4586
|
+
} catch {
|
|
4587
|
+
return { fnSig, args: {} };
|
|
4588
|
+
}
|
|
4589
|
+
}
|
|
4696
4590
|
return { fnSig, args: {} };
|
|
4697
4591
|
}
|
|
4698
4592
|
|
|
@@ -4700,8 +4594,8 @@ function decodePrecompileCalldata(address, input) {
|
|
|
4700
4594
|
var CircuitId = {
|
|
4701
4595
|
Transfer: 1,
|
|
4702
4596
|
Unshield: 2,
|
|
4703
|
-
|
|
4704
|
-
PrivateLink:
|
|
4597
|
+
ValueProof: 4,
|
|
4598
|
+
PrivateLink: 5
|
|
4705
4599
|
};
|
|
4706
4600
|
|
|
4707
4601
|
// src/utils/string.ts
|
|
@@ -4890,39 +4784,6 @@ function mapExtrinsicArgs(section, method, args) {
|
|
|
4890
4784
|
recipient: get(5, "recipient")
|
|
4891
4785
|
};
|
|
4892
4786
|
}
|
|
4893
|
-
if (m_norm === "setauditpolicy") {
|
|
4894
|
-
return {
|
|
4895
|
-
auditors: get(0, "auditors"),
|
|
4896
|
-
conditions: get(1, "conditions"),
|
|
4897
|
-
max_frequency: get(2, "max_frequency"),
|
|
4898
|
-
valid_until: get(3, "valid_until")
|
|
4899
|
-
};
|
|
4900
|
-
}
|
|
4901
|
-
if (m_norm === "requestdisclosure") {
|
|
4902
|
-
return {
|
|
4903
|
-
target: get(0, "target"),
|
|
4904
|
-
commitment: get(1, "commitment"),
|
|
4905
|
-
required_fields: get(2, "required_fields"),
|
|
4906
|
-
reason: get(3, "reason"),
|
|
4907
|
-
auditor_bjj_pk_x: get(4, "auditor_bjj_pk_x"),
|
|
4908
|
-
auditor_bjj_pk_y: get(5, "auditor_bjj_pk_y")
|
|
4909
|
-
};
|
|
4910
|
-
}
|
|
4911
|
-
if (m_norm === "disclose") {
|
|
4912
|
-
return {
|
|
4913
|
-
commitment: get(0, "commitment"),
|
|
4914
|
-
proof_bytes: get(1, "proof_bytes"),
|
|
4915
|
-
public_signals: get(2, "public_signals"),
|
|
4916
|
-
auditor: get(3, "auditor")
|
|
4917
|
-
};
|
|
4918
|
-
}
|
|
4919
|
-
if (m_norm === "rejectdisclosure") {
|
|
4920
|
-
return {
|
|
4921
|
-
auditor: get(0, "auditor"),
|
|
4922
|
-
commitment: get(1, "commitment"),
|
|
4923
|
-
reason: get(2, "reason")
|
|
4924
|
-
};
|
|
4925
|
-
}
|
|
4926
4787
|
if (m_norm === "registerasset") {
|
|
4927
4788
|
return {
|
|
4928
4789
|
name: get(0, "name"),
|
|
@@ -4937,19 +4798,6 @@ function mapExtrinsicArgs(section, method, args) {
|
|
|
4937
4798
|
if (m_norm === "unverifyasset") {
|
|
4938
4799
|
return { asset_id: get(0, "asset_id") };
|
|
4939
4800
|
}
|
|
4940
|
-
if (m_norm === "batchsubmitdisclosureproofs") {
|
|
4941
|
-
return { submissions: get(0, "submissions") };
|
|
4942
|
-
}
|
|
4943
|
-
if (m_norm === "pruneexpiredrequest") {
|
|
4944
|
-
return {
|
|
4945
|
-
target: get(0, "target"),
|
|
4946
|
-
auditor: get(1, "auditor"),
|
|
4947
|
-
commitment: get(2, "commitment")
|
|
4948
|
-
};
|
|
4949
|
-
}
|
|
4950
|
-
if (m_norm === "revokedisclosurerecord") {
|
|
4951
|
-
return { commitment: get(0, "commitment") };
|
|
4952
|
-
}
|
|
4953
4801
|
}
|
|
4954
4802
|
if (s === "ethereum" && m === "transact") {
|
|
4955
4803
|
return { transaction: get(0, "transaction") };
|
|
@@ -5173,51 +5021,6 @@ function mapZkEventData(method, data) {
|
|
|
5173
5021
|
};
|
|
5174
5022
|
}
|
|
5175
5023
|
const m_norm = m.replace(/_/g, "");
|
|
5176
|
-
if (m_norm === "auditpolicyset") {
|
|
5177
|
-
return {
|
|
5178
|
-
account: get(0, "account"),
|
|
5179
|
-
version: get(1, "version")
|
|
5180
|
-
};
|
|
5181
|
-
}
|
|
5182
|
-
if (m_norm === "disclosed") {
|
|
5183
|
-
return {
|
|
5184
|
-
target: get(0, "target"),
|
|
5185
|
-
auditor: get(1, "auditor"),
|
|
5186
|
-
commitment: get(2, "commitment"),
|
|
5187
|
-
signals: get(3, "signals")
|
|
5188
|
-
};
|
|
5189
|
-
}
|
|
5190
|
-
if (m_norm === "disclosurerequested") {
|
|
5191
|
-
return {
|
|
5192
|
-
target: get(0, "target"),
|
|
5193
|
-
auditor: get(1, "auditor"),
|
|
5194
|
-
commitment: get(2, "commitment"),
|
|
5195
|
-
required_fields: get(3, "required_fields"),
|
|
5196
|
-
auditor_bjj_pk_x: get(4, "auditor_bjj_pk_x"),
|
|
5197
|
-
auditor_bjj_pk_y: get(5, "auditor_bjj_pk_y")
|
|
5198
|
-
};
|
|
5199
|
-
}
|
|
5200
|
-
if (m_norm === "disclosurerejected") {
|
|
5201
|
-
return {
|
|
5202
|
-
target: get(0, "target"),
|
|
5203
|
-
auditor: get(1, "auditor"),
|
|
5204
|
-
commitment: get(2, "commitment"),
|
|
5205
|
-
reason: get(3, "reason")
|
|
5206
|
-
};
|
|
5207
|
-
}
|
|
5208
|
-
if (m_norm === "disclosurerequestexpired") {
|
|
5209
|
-
return {
|
|
5210
|
-
target: get(0, "target"),
|
|
5211
|
-
auditor: get(1, "auditor"),
|
|
5212
|
-
commitment: get(2, "commitment")
|
|
5213
|
-
};
|
|
5214
|
-
}
|
|
5215
|
-
if (m_norm === "disclosurerecordrevoked") {
|
|
5216
|
-
return {
|
|
5217
|
-
who: get(0, "who"),
|
|
5218
|
-
commitment: get(1, "commitment")
|
|
5219
|
-
};
|
|
5220
|
-
}
|
|
5221
5024
|
if (m_norm === "assetregistered") {
|
|
5222
5025
|
return { asset_id: get(0, "asset_id") };
|
|
5223
5026
|
}
|
|
@@ -5497,17 +5300,16 @@ var import_polkadot_api4 = require("polkadot-api");
|
|
|
5497
5300
|
bigintTo32Be,
|
|
5498
5301
|
bigintTo32Le,
|
|
5499
5302
|
bigintTo32LeArr,
|
|
5500
|
-
buildDisclosurePublicSignals,
|
|
5501
5303
|
buildDummyTransferInput,
|
|
5502
5304
|
bytesToBigintLE,
|
|
5503
5305
|
computeNullifier,
|
|
5504
5306
|
computePathIndices,
|
|
5505
5307
|
connectInjectedExtension,
|
|
5308
|
+
createNoteDisclosureKey,
|
|
5309
|
+
decodeNoteDisclosureKey,
|
|
5506
5310
|
decodePrecompileCalldata,
|
|
5507
|
-
decryptDisclosureSignals,
|
|
5508
5311
|
decryptJson,
|
|
5509
5312
|
decryptNoteRecord,
|
|
5510
|
-
deriveBabyJubjubKeypair,
|
|
5511
5313
|
deriveMasterKeyBytes,
|
|
5512
5314
|
deriveOwnerPk,
|
|
5513
5315
|
deriveSpendingKeyFromSignature,
|
|
@@ -5528,7 +5330,6 @@ var import_polkadot_api4 = require("polkadot-api");
|
|
|
5528
5330
|
formatORB,
|
|
5529
5331
|
fromBase64,
|
|
5530
5332
|
fromHex,
|
|
5531
|
-
generateDisclosureProof,
|
|
5532
5333
|
generateFeeClaimProof,
|
|
5533
5334
|
generateTransferProof,
|
|
5534
5335
|
generateUnshieldProof,
|