Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions crates/shielder-relayer/src/fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ pub struct FeeDetails {
/// but excluding the commission.
#[schema(value_type = String)]
pub relayer_cost_native: U256,
/// The actual on-chain cost of the relay in fee token, including gas and pocket money,
/// but excluding the commission.
#[schema(value_type = String)]
pub relayer_cost_fee_token: U256,

/// The cost of pocket money in native.
#[schema(value_type = String)]
pub pocket_money_native: U256,
/// The cost of pocket money in fee token.
#[schema(value_type = String)]
pub pocket_money_fee_token: U256,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's return pocket_money_native as well!


/// Gas cost for relay call (in native token).
#[schema(value_type = String)]
Expand Down Expand Up @@ -85,6 +96,9 @@ pub fn compute_fee(
total_cost_native,
total_cost_fee_token: scale_u256(total_cost_native, native_to_fee_ratio)?,
relayer_cost_native,
relayer_cost_fee_token: scale_u256(relayer_cost_native, native_to_fee_ratio)?,
pocket_money_native: pocket_money,
pocket_money_fee_token: scale_u256(pocket_money, native_to_fee_ratio)?,
gas_cost_native,
gas_cost_fee_token: scale_u256(gas_cost_native, native_to_fee_ratio)?,
commission_native,
Expand Down
2 changes: 2 additions & 0 deletions ts/shielder-sdk/__tests/client/actions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,8 @@ describe("ShielderActions", () => {
gas_cost_native: 0n,
gas_cost_fee_token: 0n,
relayer_cost_native: 0n,
pocket_money_native: 0n,
pocket_money_fee_token: 0n,
commission_native: 0n,
commission_fee_token: 0n
},
Expand Down
2 changes: 1 addition & 1 deletion ts/shielder-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cardinal-cryptography/shielder-sdk",
"version": "0.3.0-rc.1",
"version": "0.3.0-rc.2",
"description": "A web package for interacting with Shielder, a part of zkOS privacy engine.",
"license": "Apache-2.0",
"keywords": [
Expand Down
4 changes: 4 additions & 0 deletions ts/shielder-sdk/src/chain/relayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ const quoteFeesResponseSchema = z.object({
gas_cost_native: z.coerce.bigint(),
gas_cost_fee_token: z.coerce.bigint(),
relayer_cost_native: z.coerce.bigint(),
pocket_money_native: z.coerce.bigint(),
pocket_money_fee_token: z.coerce.bigint(),
commission_native: z.coerce.bigint(),
commission_fee_token: z.coerce.bigint()
}),
Expand All @@ -42,6 +44,8 @@ export const quotedFeesFromExpectedTokenFee = (totalCostFeeToken: bigint) => {
gas_cost_native: 0n,
gas_cost_fee_token: 0n,
relayer_cost_native: 0n,
pocket_money_native: 0n,
pocket_money_fee_token: 0n,
commission_native: 0n,
commission_fee_token: 0n
},
Expand Down
Loading