diff --git a/crates/shielder-relayer/src/fee.rs b/crates/shielder-relayer/src/fee.rs index f8455f03..6539e660 100644 --- a/crates/shielder-relayer/src/fee.rs +++ b/crates/shielder-relayer/src/fee.rs @@ -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, /// Gas cost for relay call (in native token). #[schema(value_type = String)] @@ -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, diff --git a/ts/shielder-sdk/__tests/client/actions.test.ts b/ts/shielder-sdk/__tests/client/actions.test.ts index db850b67..c84c96ed 100644 --- a/ts/shielder-sdk/__tests/client/actions.test.ts +++ b/ts/shielder-sdk/__tests/client/actions.test.ts @@ -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 }, diff --git a/ts/shielder-sdk/package.json b/ts/shielder-sdk/package.json index 9e273f37..93edca28 100644 --- a/ts/shielder-sdk/package.json +++ b/ts/shielder-sdk/package.json @@ -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": [ diff --git a/ts/shielder-sdk/src/chain/relayer.ts b/ts/shielder-sdk/src/chain/relayer.ts index 16cc4b90..eefcbc3f 100644 --- a/ts/shielder-sdk/src/chain/relayer.ts +++ b/ts/shielder-sdk/src/chain/relayer.ts @@ -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() }), @@ -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 },