@orbinum/sdk 2.0.0 → 2.1.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/dist/index.d.mts CHANGED
@@ -2215,6 +2215,18 @@ interface UnshieldProofResult extends ProofResult {
2215
2215
  */
2216
2216
  declare function generateUnshieldProof(inputs: UnshieldProofInputs, options?: ProofOptions): Promise<UnshieldProofResult>;
2217
2217
 
2218
+ /**
2219
+ * Witness assembly for the fee-claim circuit — accrued relayer fees minted
2220
+ * straight into a shielded note.
2221
+ *
2222
+ * No input note and no merkle path: this proves knowledge of a commitment's
2223
+ * preimage, so the chain can check the note encodes exactly the amount being
2224
+ * claimed and a relayer cannot inflate its own payout.
2225
+ *
2226
+ * The public signals are a fixed 76-byte buffer the runtime parses by offset,
2227
+ * so their layout is a wire contract rather than an implementation detail.
2228
+ */
2229
+
2218
2230
  /**
2219
2231
  * Inputs required to generate a fee-claim proof.
2220
2232
  *
@@ -3080,6 +3092,23 @@ type ShieldParams = {
3080
3092
  /** Encrypted memo bytes (180 bytes). Required — notes without valid memos are irrecoverable. */
3081
3093
  encryptedMemo: Uint8Array;
3082
3094
  };
3095
+ /**
3096
+ * How the relay fee recipient is decided.
3097
+ *
3098
+ * It is not a parameter anywhere in this module: the chain reads it from the
3099
+ * dispatch origin, which calldata cannot influence. A `relayer` field would be an
3100
+ * unauthenticated claim — anyone could take a propagated proof, resubmit it
3101
+ * naming themselves, and collect a fee they never paid for.
3102
+ *
3103
+ * | Submitted via | Credited |
3104
+ * |---|---|
3105
+ * | EVM precompile | whoever signed that EVM transaction and paid its gas |
3106
+ * | Signed extrinsic | the signer's registered EVM address |
3107
+ * | Unsigned extrinsic | the block author |
3108
+ *
3109
+ * `fee` below still matters: it is a ZK public input, so it cannot be altered
3110
+ * without regenerating the proof. Only the *recipient* moved to the origin.
3111
+ */
3083
3112
  /** Parameters for shieldedPool.unshield — withdraws from the pool to a clear address. */
3084
3113
  type UnshieldParams = {
3085
3114
  /** ZK proof bytes */
@@ -3187,7 +3216,9 @@ type ClaimShieldedFeesParams = {
3187
3216
  * which means the Orbinum node must be reachable on first use.
3188
3217
  * Signing is delegated to a SubstrateSigner (see polkadot-api/signer).
3189
3218
  *
3190
- * Parameter order matches the Orbinum runtime extrinsics exactly.
3219
+ * Arguments are passed BY NAME through PAPI, so the field names not the
3220
+ * order — have to match the runtime's. A renamed parameter fails at
3221
+ * encoding rather than silently shifting a value into the wrong slot.
3191
3222
  */
3192
3223
  declare class ShieldedPoolModule {
3193
3224
  private readonly substrate;
@@ -3204,14 +3235,22 @@ declare class ShieldedPoolModule {
3204
3235
  * Withdraws tokens from the shielded pool to a public address.
3205
3236
  * Submits as an UNSIGNED (gasless) transaction — fee is embedded in the ZK proof.
3206
3237
  * Pass a `signer` to fall back to signed submission (e.g. for testing).
3207
- * Extrinsic: shieldedPool.unshield(proof, merkleRoot, nullifier, assetId, amount, recipient, fee, changeCommitment, changeEncryptedMemo, relayer, circuitVersion)
3238
+ * Extrinsic: shieldedPool.unshield(proof, merkleRoot, nullifier, assetId, amount, recipient, fee, changeCommitment, changeEncryptedMemo, circuitVersion)
3239
+ *
3240
+ * The relay fee recipient is NOT a parameter: the chain takes it from the
3241
+ * dispatch origin. Submitting unsigned credits the block author; submitting
3242
+ * through the EVM precompile credits whoever signed that transaction.
3208
3243
  */
3209
3244
  unshield(params: UnshieldParams, signer?: PolkadotSigner, options?: SubmitOptions): Promise<TxResult>;
3210
3245
  /**
3211
3246
  * Performs a private (shielded) transfer between two notes.
3212
3247
  * Submits as an UNSIGNED (gasless) transaction — fee is embedded in the ZK proof.
3213
3248
  * Pass a `signer` to fall back to signed submission (e.g. for testing).
3214
- * Extrinsic: shieldedPool.privateTransfer(proof, merkleRoot, nullifiers, commitments, memos, assetId, fee, relayer, circuitVersion)
3249
+ * Extrinsic: shieldedPool.privateTransfer(proof, merkleRoot, nullifiers, commitments, memos, assetId, fee, circuitVersion)
3250
+ *
3251
+ * The relay fee recipient is NOT a parameter: the chain takes it from the
3252
+ * dispatch origin. Submitting unsigned credits the block author; submitting
3253
+ * through the EVM precompile credits whoever signed that transaction.
3215
3254
  */
3216
3255
  privateTransfer(params: PrivateTransferParams, signer?: PolkadotSigner, options?: SubmitOptions): Promise<TxResult>;
3217
3256
  /**
@@ -3394,7 +3433,9 @@ declare class ShieldedPoolPrecompile {
3394
3433
  * hidden by design, so any address (a relayer included) can submit a valid
3395
3434
  * proof.
3396
3435
  *
3397
- * Extrinsic: `shieldedPool.privateTransfer(proof, merkleRoot, nullifiers, commitments, memos)`
3436
+ * Extrinsic: `shieldedPool.privateTransfer(proof, merkleRoot, nullifiers,
3437
+ * commitments, memos, assetId, fee, circuitVersion)` — eight arguments; see
3438
+ * `buildPrivateTransferCalldata` for the encoding order.
3398
3439
  */
3399
3440
  privateTransfer(params: PrivateTransferParams, signer: EvmSigner): Promise<string>;
3400
3441
  /**
@@ -3403,7 +3444,14 @@ declare class ShieldedPoolPrecompile {
3403
3444
  * `params.recipientAddress` must be a 0x-prefixed AccountId32. To send to an
3404
3445
  * EVM address, derive it first with `evmToImplicitSubstrate(evmAddr)`.
3405
3446
  *
3406
- * Extrinsic: `shieldedPool.unshield(proof, merkleRoot, nullifier, assetId, amount, recipient)`
3447
+ * Extrinsic: `shieldedPool.unshield(proof, merkleRoot, nullifier, assetId,
3448
+ * amount, recipient, fee, changeCommitment, changeEncryptedMemo,
3449
+ * circuitVersion)` — ten arguments; see `buildUnshieldCalldata`.
3450
+ *
3451
+ * **The relay fee goes to whoever `signer` is.** The chain takes the recipient
3452
+ * from `msg.sender`, not from calldata, so the account behind this signer is
3453
+ * the one credited — and it is also the one paying gas. Relaying on someone
3454
+ * else's behalf and being paid for it is the same act here.
3407
3455
  */
3408
3456
  unshield(params: UnshieldParams, signer: EvmSigner): Promise<string>;
3409
3457
  /**
@@ -3419,7 +3467,9 @@ declare class ShieldedPoolPrecompile {
3419
3467
  * The `msg.sender` address is the validator identity, and must match the
3420
3468
  * one with pending fees.
3421
3469
  *
3422
- * Extrinsic: `shieldedPool.claim_shielded_fees(commitment, amount, assetId, memo, proof, publicSignals)`
3470
+ * Extrinsic: `shieldedPool.claim_shielded_fees(commitment, amount, assetId,
3471
+ * memo, proof, publicSignals, circuitVersion)` — seven arguments; see
3472
+ * `buildClaimShieldedFeesCalldata`.
3423
3473
  */
3424
3474
  claimShieldedFees(params: ClaimShieldedFeesParams, signer: EvmSigner): Promise<string>;
3425
3475
  estimateShieldGas(params: ShieldParams, from: string): Promise<bigint>;
@@ -3904,13 +3954,18 @@ declare function isGhostNoteError(rawMessage: string): boolean;
3904
3954
  * `fee`, and without this a host is left reverse-engineering the number from a
3905
3955
  * failed extrinsic.
3906
3956
  *
3907
- * A runtime upgrade can change these. They are exported as the current chain's
3908
- * values, which is what every caller needs today; a chain that has moved on
3909
- * should pass its own.
3957
+ * These are the current chain's values, which is what every caller needs today.
3958
+ * A chain that has moved on should pass its own — and note that not all of them
3959
+ * need a runtime upgrade to move: see `MIN_GASLESS_FEE`.
3910
3960
  */
3911
3961
  /**
3912
3962
  * Smallest fee an unsigned (gasless) shielded-pool extrinsic may carry, in
3913
- * planck. Mirrors the runtime's `MinGaslessFee`.
3963
+ * planck the default of `pallet-relayer`'s `MinRelayFee`.
3964
+ *
3965
+ * MUTABLE STORAGE, not a runtime constant: governance moves it with
3966
+ * `set_min_relay_fee`, no upgrade required. A wallet that hardcodes this value
3967
+ * starts failing with `FeeTooLow` the moment the floor rises, so read
3968
+ * `min_relay_fee()` when the answer has to be current.
3914
3969
  *
3915
3970
  * Below it the pallet rejects with `FeeTooLow`. The fee is paid to the block
3916
3971
  * author by the runtime, which is what lets a user with no public balance spend
@@ -4317,10 +4372,13 @@ declare function getPrecompileLabel(address: string | null | undefined): string
4317
4372
  * `unshield` — a classifier that checks in the wrong order reports every
4318
4373
  * unshield as a shield, silently, and a new pallet method breaks it again.
4319
4374
  */
4320
- type PrecompileMethod = 'shield' | 'unshield' | 'privateTransfer' | 'shieldBatch';
4375
+ type PrecompileMethod = 'shield' | 'unshield' | 'privateTransfer' | 'shieldBatch' | 'claimShieldedFees';
4321
4376
  type DecodedPrecompile = {
4322
4377
  fnSig: string;
4323
- /** The operation, from the selector. Null for a known precompile's unmapped call. */
4378
+ /**
4379
+ * The operation, from the selector. Null only when the args below could not
4380
+ * be decoded either — every signature this file decodes maps to a name.
4381
+ */
4324
4382
  method: PrecompileMethod | null;
4325
4383
  args: Record<string, unknown>;
4326
4384
  };
@@ -5357,7 +5415,9 @@ interface FeeClaimDeps {
5357
5415
  buildNote: (params: {
5358
5416
  value: bigint;
5359
5417
  assetId: bigint;
5360
- }) => Promise<ZkNote>;
5418
+ }) => Promise<{
5419
+ note: ZkNote;
5420
+ }>;
5361
5421
  resolver: Pick<CircuitVersionResolver, 'resolve'>;
5362
5422
  pool: Pick<ShieldedPoolModule, 'claimShieldedFees'>;
5363
5423
  /** Where the minted note lands once the claim finalizes. */
package/dist/index.d.ts CHANGED
@@ -2215,6 +2215,18 @@ interface UnshieldProofResult extends ProofResult {
2215
2215
  */
2216
2216
  declare function generateUnshieldProof(inputs: UnshieldProofInputs, options?: ProofOptions): Promise<UnshieldProofResult>;
2217
2217
 
2218
+ /**
2219
+ * Witness assembly for the fee-claim circuit — accrued relayer fees minted
2220
+ * straight into a shielded note.
2221
+ *
2222
+ * No input note and no merkle path: this proves knowledge of a commitment's
2223
+ * preimage, so the chain can check the note encodes exactly the amount being
2224
+ * claimed and a relayer cannot inflate its own payout.
2225
+ *
2226
+ * The public signals are a fixed 76-byte buffer the runtime parses by offset,
2227
+ * so their layout is a wire contract rather than an implementation detail.
2228
+ */
2229
+
2218
2230
  /**
2219
2231
  * Inputs required to generate a fee-claim proof.
2220
2232
  *
@@ -3080,6 +3092,23 @@ type ShieldParams = {
3080
3092
  /** Encrypted memo bytes (180 bytes). Required — notes without valid memos are irrecoverable. */
3081
3093
  encryptedMemo: Uint8Array;
3082
3094
  };
3095
+ /**
3096
+ * How the relay fee recipient is decided.
3097
+ *
3098
+ * It is not a parameter anywhere in this module: the chain reads it from the
3099
+ * dispatch origin, which calldata cannot influence. A `relayer` field would be an
3100
+ * unauthenticated claim — anyone could take a propagated proof, resubmit it
3101
+ * naming themselves, and collect a fee they never paid for.
3102
+ *
3103
+ * | Submitted via | Credited |
3104
+ * |---|---|
3105
+ * | EVM precompile | whoever signed that EVM transaction and paid its gas |
3106
+ * | Signed extrinsic | the signer's registered EVM address |
3107
+ * | Unsigned extrinsic | the block author |
3108
+ *
3109
+ * `fee` below still matters: it is a ZK public input, so it cannot be altered
3110
+ * without regenerating the proof. Only the *recipient* moved to the origin.
3111
+ */
3083
3112
  /** Parameters for shieldedPool.unshield — withdraws from the pool to a clear address. */
3084
3113
  type UnshieldParams = {
3085
3114
  /** ZK proof bytes */
@@ -3187,7 +3216,9 @@ type ClaimShieldedFeesParams = {
3187
3216
  * which means the Orbinum node must be reachable on first use.
3188
3217
  * Signing is delegated to a SubstrateSigner (see polkadot-api/signer).
3189
3218
  *
3190
- * Parameter order matches the Orbinum runtime extrinsics exactly.
3219
+ * Arguments are passed BY NAME through PAPI, so the field names not the
3220
+ * order — have to match the runtime's. A renamed parameter fails at
3221
+ * encoding rather than silently shifting a value into the wrong slot.
3191
3222
  */
3192
3223
  declare class ShieldedPoolModule {
3193
3224
  private readonly substrate;
@@ -3204,14 +3235,22 @@ declare class ShieldedPoolModule {
3204
3235
  * Withdraws tokens from the shielded pool to a public address.
3205
3236
  * Submits as an UNSIGNED (gasless) transaction — fee is embedded in the ZK proof.
3206
3237
  * Pass a `signer` to fall back to signed submission (e.g. for testing).
3207
- * Extrinsic: shieldedPool.unshield(proof, merkleRoot, nullifier, assetId, amount, recipient, fee, changeCommitment, changeEncryptedMemo, relayer, circuitVersion)
3238
+ * Extrinsic: shieldedPool.unshield(proof, merkleRoot, nullifier, assetId, amount, recipient, fee, changeCommitment, changeEncryptedMemo, circuitVersion)
3239
+ *
3240
+ * The relay fee recipient is NOT a parameter: the chain takes it from the
3241
+ * dispatch origin. Submitting unsigned credits the block author; submitting
3242
+ * through the EVM precompile credits whoever signed that transaction.
3208
3243
  */
3209
3244
  unshield(params: UnshieldParams, signer?: PolkadotSigner, options?: SubmitOptions): Promise<TxResult>;
3210
3245
  /**
3211
3246
  * Performs a private (shielded) transfer between two notes.
3212
3247
  * Submits as an UNSIGNED (gasless) transaction — fee is embedded in the ZK proof.
3213
3248
  * Pass a `signer` to fall back to signed submission (e.g. for testing).
3214
- * Extrinsic: shieldedPool.privateTransfer(proof, merkleRoot, nullifiers, commitments, memos, assetId, fee, relayer, circuitVersion)
3249
+ * Extrinsic: shieldedPool.privateTransfer(proof, merkleRoot, nullifiers, commitments, memos, assetId, fee, circuitVersion)
3250
+ *
3251
+ * The relay fee recipient is NOT a parameter: the chain takes it from the
3252
+ * dispatch origin. Submitting unsigned credits the block author; submitting
3253
+ * through the EVM precompile credits whoever signed that transaction.
3215
3254
  */
3216
3255
  privateTransfer(params: PrivateTransferParams, signer?: PolkadotSigner, options?: SubmitOptions): Promise<TxResult>;
3217
3256
  /**
@@ -3394,7 +3433,9 @@ declare class ShieldedPoolPrecompile {
3394
3433
  * hidden by design, so any address (a relayer included) can submit a valid
3395
3434
  * proof.
3396
3435
  *
3397
- * Extrinsic: `shieldedPool.privateTransfer(proof, merkleRoot, nullifiers, commitments, memos)`
3436
+ * Extrinsic: `shieldedPool.privateTransfer(proof, merkleRoot, nullifiers,
3437
+ * commitments, memos, assetId, fee, circuitVersion)` — eight arguments; see
3438
+ * `buildPrivateTransferCalldata` for the encoding order.
3398
3439
  */
3399
3440
  privateTransfer(params: PrivateTransferParams, signer: EvmSigner): Promise<string>;
3400
3441
  /**
@@ -3403,7 +3444,14 @@ declare class ShieldedPoolPrecompile {
3403
3444
  * `params.recipientAddress` must be a 0x-prefixed AccountId32. To send to an
3404
3445
  * EVM address, derive it first with `evmToImplicitSubstrate(evmAddr)`.
3405
3446
  *
3406
- * Extrinsic: `shieldedPool.unshield(proof, merkleRoot, nullifier, assetId, amount, recipient)`
3447
+ * Extrinsic: `shieldedPool.unshield(proof, merkleRoot, nullifier, assetId,
3448
+ * amount, recipient, fee, changeCommitment, changeEncryptedMemo,
3449
+ * circuitVersion)` — ten arguments; see `buildUnshieldCalldata`.
3450
+ *
3451
+ * **The relay fee goes to whoever `signer` is.** The chain takes the recipient
3452
+ * from `msg.sender`, not from calldata, so the account behind this signer is
3453
+ * the one credited — and it is also the one paying gas. Relaying on someone
3454
+ * else's behalf and being paid for it is the same act here.
3407
3455
  */
3408
3456
  unshield(params: UnshieldParams, signer: EvmSigner): Promise<string>;
3409
3457
  /**
@@ -3419,7 +3467,9 @@ declare class ShieldedPoolPrecompile {
3419
3467
  * The `msg.sender` address is the validator identity, and must match the
3420
3468
  * one with pending fees.
3421
3469
  *
3422
- * Extrinsic: `shieldedPool.claim_shielded_fees(commitment, amount, assetId, memo, proof, publicSignals)`
3470
+ * Extrinsic: `shieldedPool.claim_shielded_fees(commitment, amount, assetId,
3471
+ * memo, proof, publicSignals, circuitVersion)` — seven arguments; see
3472
+ * `buildClaimShieldedFeesCalldata`.
3423
3473
  */
3424
3474
  claimShieldedFees(params: ClaimShieldedFeesParams, signer: EvmSigner): Promise<string>;
3425
3475
  estimateShieldGas(params: ShieldParams, from: string): Promise<bigint>;
@@ -3904,13 +3954,18 @@ declare function isGhostNoteError(rawMessage: string): boolean;
3904
3954
  * `fee`, and without this a host is left reverse-engineering the number from a
3905
3955
  * failed extrinsic.
3906
3956
  *
3907
- * A runtime upgrade can change these. They are exported as the current chain's
3908
- * values, which is what every caller needs today; a chain that has moved on
3909
- * should pass its own.
3957
+ * These are the current chain's values, which is what every caller needs today.
3958
+ * A chain that has moved on should pass its own — and note that not all of them
3959
+ * need a runtime upgrade to move: see `MIN_GASLESS_FEE`.
3910
3960
  */
3911
3961
  /**
3912
3962
  * Smallest fee an unsigned (gasless) shielded-pool extrinsic may carry, in
3913
- * planck. Mirrors the runtime's `MinGaslessFee`.
3963
+ * planck the default of `pallet-relayer`'s `MinRelayFee`.
3964
+ *
3965
+ * MUTABLE STORAGE, not a runtime constant: governance moves it with
3966
+ * `set_min_relay_fee`, no upgrade required. A wallet that hardcodes this value
3967
+ * starts failing with `FeeTooLow` the moment the floor rises, so read
3968
+ * `min_relay_fee()` when the answer has to be current.
3914
3969
  *
3915
3970
  * Below it the pallet rejects with `FeeTooLow`. The fee is paid to the block
3916
3971
  * author by the runtime, which is what lets a user with no public balance spend
@@ -4317,10 +4372,13 @@ declare function getPrecompileLabel(address: string | null | undefined): string
4317
4372
  * `unshield` — a classifier that checks in the wrong order reports every
4318
4373
  * unshield as a shield, silently, and a new pallet method breaks it again.
4319
4374
  */
4320
- type PrecompileMethod = 'shield' | 'unshield' | 'privateTransfer' | 'shieldBatch';
4375
+ type PrecompileMethod = 'shield' | 'unshield' | 'privateTransfer' | 'shieldBatch' | 'claimShieldedFees';
4321
4376
  type DecodedPrecompile = {
4322
4377
  fnSig: string;
4323
- /** The operation, from the selector. Null for a known precompile's unmapped call. */
4378
+ /**
4379
+ * The operation, from the selector. Null only when the args below could not
4380
+ * be decoded either — every signature this file decodes maps to a name.
4381
+ */
4324
4382
  method: PrecompileMethod | null;
4325
4383
  args: Record<string, unknown>;
4326
4384
  };
@@ -5357,7 +5415,9 @@ interface FeeClaimDeps {
5357
5415
  buildNote: (params: {
5358
5416
  value: bigint;
5359
5417
  assetId: bigint;
5360
- }) => Promise<ZkNote>;
5418
+ }) => Promise<{
5419
+ note: ZkNote;
5420
+ }>;
5361
5421
  resolver: Pick<CircuitVersionResolver, 'resolve'>;
5362
5422
  pool: Pick<ShieldedPoolModule, 'claimShieldedFees'>;
5363
5423
  /** Where the minted note lands once the claim finalizes. */
package/dist/index.js CHANGED
@@ -3460,7 +3460,11 @@ var ShieldedPoolModule = class {
3460
3460
  * Withdraws tokens from the shielded pool to a public address.
3461
3461
  * Submits as an UNSIGNED (gasless) transaction — fee is embedded in the ZK proof.
3462
3462
  * Pass a `signer` to fall back to signed submission (e.g. for testing).
3463
- * Extrinsic: shieldedPool.unshield(proof, merkleRoot, nullifier, assetId, amount, recipient, fee, changeCommitment, changeEncryptedMemo, relayer, circuitVersion)
3463
+ * Extrinsic: shieldedPool.unshield(proof, merkleRoot, nullifier, assetId, amount, recipient, fee, changeCommitment, changeEncryptedMemo, circuitVersion)
3464
+ *
3465
+ * The relay fee recipient is NOT a parameter: the chain takes it from the
3466
+ * dispatch origin. Submitting unsigned credits the block author; submitting
3467
+ * through the EVM precompile credits whoever signed that transaction.
3464
3468
  */
3465
3469
  async unshield(params, signer, options) {
3466
3470
  const entry = resolveTx(this.substrate.unsafe, "ShieldedPool", "unshield");
@@ -3484,8 +3488,6 @@ var ShieldedPoolModule = class {
3484
3488
  fee: params.fee ?? 0n,
3485
3489
  change_commitment: changeCommitment,
3486
3490
  change_encrypted_memo: changeEncryptedMemo,
3487
- relayer: void 0,
3488
- // Option<H160> — None for direct Substrate submissions
3489
3491
  circuit_version: params.circuitVersion
3490
3492
  });
3491
3493
  if (signer) {
@@ -3497,7 +3499,11 @@ var ShieldedPoolModule = class {
3497
3499
  * Performs a private (shielded) transfer between two notes.
3498
3500
  * Submits as an UNSIGNED (gasless) transaction — fee is embedded in the ZK proof.
3499
3501
  * Pass a `signer` to fall back to signed submission (e.g. for testing).
3500
- * Extrinsic: shieldedPool.privateTransfer(proof, merkleRoot, nullifiers, commitments, memos, assetId, fee, relayer, circuitVersion)
3502
+ * Extrinsic: shieldedPool.privateTransfer(proof, merkleRoot, nullifiers, commitments, memos, assetId, fee, circuitVersion)
3503
+ *
3504
+ * The relay fee recipient is NOT a parameter: the chain takes it from the
3505
+ * dispatch origin. Submitting unsigned credits the block author; submitting
3506
+ * through the EVM precompile credits whoever signed that transaction.
3501
3507
  */
3502
3508
  async privateTransfer(params, signer, options) {
3503
3509
  const nullifiers = params.inputs.map((inp) => inp.nullifier);
@@ -3518,8 +3524,6 @@ var ShieldedPoolModule = class {
3518
3524
  encrypted_memos: memos,
3519
3525
  asset_id: params.assetId,
3520
3526
  fee: params.fee ?? 0n,
3521
- relayer: void 0,
3522
- // Option<H160> — None for direct Substrate submissions
3523
3527
  circuit_version: params.circuitVersion
3524
3528
  });
3525
3529
  if (signer) {
@@ -4036,7 +4040,9 @@ var ShieldedPoolPrecompile = class {
4036
4040
  * hidden by design, so any address (a relayer included) can submit a valid
4037
4041
  * proof.
4038
4042
  *
4039
- * Extrinsic: `shieldedPool.privateTransfer(proof, merkleRoot, nullifiers, commitments, memos)`
4043
+ * Extrinsic: `shieldedPool.privateTransfer(proof, merkleRoot, nullifiers,
4044
+ * commitments, memos, assetId, fee, circuitVersion)` — eight arguments; see
4045
+ * `buildPrivateTransferCalldata` for the encoding order.
4040
4046
  */
4041
4047
  async privateTransfer(params, signer) {
4042
4048
  return signer({ to: this.addr, data: buildPrivateTransferCalldata(params) });
@@ -4048,7 +4054,14 @@ var ShieldedPoolPrecompile = class {
4048
4054
  * `params.recipientAddress` must be a 0x-prefixed AccountId32. To send to an
4049
4055
  * EVM address, derive it first with `evmToImplicitSubstrate(evmAddr)`.
4050
4056
  *
4051
- * Extrinsic: `shieldedPool.unshield(proof, merkleRoot, nullifier, assetId, amount, recipient)`
4057
+ * Extrinsic: `shieldedPool.unshield(proof, merkleRoot, nullifier, assetId,
4058
+ * amount, recipient, fee, changeCommitment, changeEncryptedMemo,
4059
+ * circuitVersion)` — ten arguments; see `buildUnshieldCalldata`.
4060
+ *
4061
+ * **The relay fee goes to whoever `signer` is.** The chain takes the recipient
4062
+ * from `msg.sender`, not from calldata, so the account behind this signer is
4063
+ * the one credited — and it is also the one paying gas. Relaying on someone
4064
+ * else's behalf and being paid for it is the same act here.
4052
4065
  */
4053
4066
  async unshield(params, signer) {
4054
4067
  return signer({ to: this.addr, data: buildUnshieldCalldata(params) });
@@ -4067,7 +4080,9 @@ var ShieldedPoolPrecompile = class {
4067
4080
  * The `msg.sender` address is the validator identity, and must match the
4068
4081
  * one with pending fees.
4069
4082
  *
4070
- * Extrinsic: `shieldedPool.claim_shielded_fees(commitment, amount, assetId, memo, proof, publicSignals)`
4083
+ * Extrinsic: `shieldedPool.claim_shielded_fees(commitment, amount, assetId,
4084
+ * memo, proof, publicSignals, circuitVersion)` — seven arguments; see
4085
+ * `buildClaimShieldedFeesCalldata`.
4071
4086
  */
4072
4087
  async claimShieldedFees(params, signer) {
4073
4088
  return signer({
@@ -4081,7 +4096,12 @@ var ShieldedPoolPrecompile = class {
4081
4096
  // AccountId32, so estimating from a different address measures a different
4082
4097
  // call.
4083
4098
  async estimateShieldGas(params, from) {
4084
- return this.evm.estimateGas({ from, to: this.addr, data: buildShieldCalldata(params) });
4099
+ return this.evm.estimateGas({
4100
+ from,
4101
+ to: this.addr,
4102
+ data: buildShieldCalldata(params),
4103
+ value: `0x${params.amount.toString(16)}`
4104
+ });
4085
4105
  }
4086
4106
  async estimatePrivateTransferGas(params, from) {
4087
4107
  return this.evm.estimateGas({
@@ -5188,6 +5208,7 @@ function methodOf(fnSig) {
5188
5208
  if (fnSig.startsWith("unshield(")) return "unshield";
5189
5209
  if (fnSig.startsWith("privateTransfer(")) return "privateTransfer";
5190
5210
  if (fnSig.startsWith("shieldBatch(")) return "shieldBatch";
5211
+ if (fnSig.startsWith("claimShieldedFees(")) return "claimShieldedFees";
5191
5212
  if (fnSig.startsWith("shield(")) return "shield";
5192
5213
  return null;
5193
5214
  }
@@ -7302,7 +7323,7 @@ async function unshieldNote(deps, params, onProgress) {
7302
7323
  var import_proof_generator8 = require("@orbinum/proof-generator");
7303
7324
  async function claimFees(deps, { assetId, amount, signer }, onStep) {
7304
7325
  onStep?.("building-note");
7305
- const note = await deps.buildNote({ value: amount, assetId: BigInt(assetId) });
7326
+ const { note } = await deps.buildNote({ value: amount, assetId: BigInt(assetId) });
7306
7327
  const { provider } = await deps.resolver.resolve(import_proof_generator8.CircuitType.ValueProof, note.circuitVersion);
7307
7328
  onStep?.("generating-proof");
7308
7329
  const proofOutput = await generateFeeClaimProof(
package/dist/index.mjs CHANGED
@@ -2200,7 +2200,11 @@ var ShieldedPoolModule = class {
2200
2200
  * Withdraws tokens from the shielded pool to a public address.
2201
2201
  * Submits as an UNSIGNED (gasless) transaction — fee is embedded in the ZK proof.
2202
2202
  * Pass a `signer` to fall back to signed submission (e.g. for testing).
2203
- * Extrinsic: shieldedPool.unshield(proof, merkleRoot, nullifier, assetId, amount, recipient, fee, changeCommitment, changeEncryptedMemo, relayer, circuitVersion)
2203
+ * Extrinsic: shieldedPool.unshield(proof, merkleRoot, nullifier, assetId, amount, recipient, fee, changeCommitment, changeEncryptedMemo, circuitVersion)
2204
+ *
2205
+ * The relay fee recipient is NOT a parameter: the chain takes it from the
2206
+ * dispatch origin. Submitting unsigned credits the block author; submitting
2207
+ * through the EVM precompile credits whoever signed that transaction.
2204
2208
  */
2205
2209
  async unshield(params, signer, options) {
2206
2210
  const entry = resolveTx(this.substrate.unsafe, "ShieldedPool", "unshield");
@@ -2224,8 +2228,6 @@ var ShieldedPoolModule = class {
2224
2228
  fee: params.fee ?? 0n,
2225
2229
  change_commitment: changeCommitment,
2226
2230
  change_encrypted_memo: changeEncryptedMemo,
2227
- relayer: void 0,
2228
- // Option<H160> — None for direct Substrate submissions
2229
2231
  circuit_version: params.circuitVersion
2230
2232
  });
2231
2233
  if (signer) {
@@ -2237,7 +2239,11 @@ var ShieldedPoolModule = class {
2237
2239
  * Performs a private (shielded) transfer between two notes.
2238
2240
  * Submits as an UNSIGNED (gasless) transaction — fee is embedded in the ZK proof.
2239
2241
  * Pass a `signer` to fall back to signed submission (e.g. for testing).
2240
- * Extrinsic: shieldedPool.privateTransfer(proof, merkleRoot, nullifiers, commitments, memos, assetId, fee, relayer, circuitVersion)
2242
+ * Extrinsic: shieldedPool.privateTransfer(proof, merkleRoot, nullifiers, commitments, memos, assetId, fee, circuitVersion)
2243
+ *
2244
+ * The relay fee recipient is NOT a parameter: the chain takes it from the
2245
+ * dispatch origin. Submitting unsigned credits the block author; submitting
2246
+ * through the EVM precompile credits whoever signed that transaction.
2241
2247
  */
2242
2248
  async privateTransfer(params, signer, options) {
2243
2249
  const nullifiers = params.inputs.map((inp) => inp.nullifier);
@@ -2258,8 +2264,6 @@ var ShieldedPoolModule = class {
2258
2264
  encrypted_memos: memos,
2259
2265
  asset_id: params.assetId,
2260
2266
  fee: params.fee ?? 0n,
2261
- relayer: void 0,
2262
- // Option<H160> — None for direct Substrate submissions
2263
2267
  circuit_version: params.circuitVersion
2264
2268
  });
2265
2269
  if (signer) {
@@ -2776,7 +2780,9 @@ var ShieldedPoolPrecompile = class {
2776
2780
  * hidden by design, so any address (a relayer included) can submit a valid
2777
2781
  * proof.
2778
2782
  *
2779
- * Extrinsic: `shieldedPool.privateTransfer(proof, merkleRoot, nullifiers, commitments, memos)`
2783
+ * Extrinsic: `shieldedPool.privateTransfer(proof, merkleRoot, nullifiers,
2784
+ * commitments, memos, assetId, fee, circuitVersion)` — eight arguments; see
2785
+ * `buildPrivateTransferCalldata` for the encoding order.
2780
2786
  */
2781
2787
  async privateTransfer(params, signer) {
2782
2788
  return signer({ to: this.addr, data: buildPrivateTransferCalldata(params) });
@@ -2788,7 +2794,14 @@ var ShieldedPoolPrecompile = class {
2788
2794
  * `params.recipientAddress` must be a 0x-prefixed AccountId32. To send to an
2789
2795
  * EVM address, derive it first with `evmToImplicitSubstrate(evmAddr)`.
2790
2796
  *
2791
- * Extrinsic: `shieldedPool.unshield(proof, merkleRoot, nullifier, assetId, amount, recipient)`
2797
+ * Extrinsic: `shieldedPool.unshield(proof, merkleRoot, nullifier, assetId,
2798
+ * amount, recipient, fee, changeCommitment, changeEncryptedMemo,
2799
+ * circuitVersion)` — ten arguments; see `buildUnshieldCalldata`.
2800
+ *
2801
+ * **The relay fee goes to whoever `signer` is.** The chain takes the recipient
2802
+ * from `msg.sender`, not from calldata, so the account behind this signer is
2803
+ * the one credited — and it is also the one paying gas. Relaying on someone
2804
+ * else's behalf and being paid for it is the same act here.
2792
2805
  */
2793
2806
  async unshield(params, signer) {
2794
2807
  return signer({ to: this.addr, data: buildUnshieldCalldata(params) });
@@ -2807,7 +2820,9 @@ var ShieldedPoolPrecompile = class {
2807
2820
  * The `msg.sender` address is the validator identity, and must match the
2808
2821
  * one with pending fees.
2809
2822
  *
2810
- * Extrinsic: `shieldedPool.claim_shielded_fees(commitment, amount, assetId, memo, proof, publicSignals)`
2823
+ * Extrinsic: `shieldedPool.claim_shielded_fees(commitment, amount, assetId,
2824
+ * memo, proof, publicSignals, circuitVersion)` — seven arguments; see
2825
+ * `buildClaimShieldedFeesCalldata`.
2811
2826
  */
2812
2827
  async claimShieldedFees(params, signer) {
2813
2828
  return signer({
@@ -2821,7 +2836,12 @@ var ShieldedPoolPrecompile = class {
2821
2836
  // AccountId32, so estimating from a different address measures a different
2822
2837
  // call.
2823
2838
  async estimateShieldGas(params, from) {
2824
- return this.evm.estimateGas({ from, to: this.addr, data: buildShieldCalldata(params) });
2839
+ return this.evm.estimateGas({
2840
+ from,
2841
+ to: this.addr,
2842
+ data: buildShieldCalldata(params),
2843
+ value: `0x${params.amount.toString(16)}`
2844
+ });
2825
2845
  }
2826
2846
  async estimatePrivateTransferGas(params, from) {
2827
2847
  return this.evm.estimateGas({
@@ -3935,6 +3955,7 @@ function methodOf(fnSig) {
3935
3955
  if (fnSig.startsWith("unshield(")) return "unshield";
3936
3956
  if (fnSig.startsWith("privateTransfer(")) return "privateTransfer";
3937
3957
  if (fnSig.startsWith("shieldBatch(")) return "shieldBatch";
3958
+ if (fnSig.startsWith("claimShieldedFees(")) return "claimShieldedFees";
3938
3959
  if (fnSig.startsWith("shield(")) return "shield";
3939
3960
  return null;
3940
3961
  }
@@ -6038,7 +6059,7 @@ async function unshieldNote(deps, params, onProgress) {
6038
6059
  import { CircuitType as CircuitType7 } from "@orbinum/proof-generator";
6039
6060
  async function claimFees(deps, { assetId, amount, signer }, onStep) {
6040
6061
  onStep?.("building-note");
6041
- const note = await deps.buildNote({ value: amount, assetId: BigInt(assetId) });
6062
+ const { note } = await deps.buildNote({ value: amount, assetId: BigInt(assetId) });
6042
6063
  const { provider } = await deps.resolver.resolve(CircuitType7.ValueProof, note.circuitVersion);
6043
6064
  onStep?.("generating-proof");
6044
6065
  const proofOutput = await generateFeeClaimProof(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbinum/sdk",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "Official TypeScript SDK for Orbinum.",
5
5
  "author": "Orbinum",
6
6
  "license": "MIT",