Wrong error message on /swap #1365

Closed
opened 2025-12-01 16:03:55 +00:00 by Egge21M · 0 comments
Egge21M commented 2025-12-01 16:03:55 +00:00 (Migrated from github.com)

When sending a swap payload without either no inputs or no outputs (empty list) the mint returns a 11010 (Inputs and outputs not of same unit) instead of the 11002 (transaction not balanced) error. Probably due to the fact that there are no ids in the input/output to determine the unit.

Here are some logs from testing:

[sqlite3-integration module=WalletService module=RequestRateLimiter] DEBUG: Mint request {
  method: "POST",
  endpoint: "http://localhost:3338/v1/swap",
  requestBody: "{\n  \"inputs\": [\n    {\n      \"id\": \"001b6c716bf42c7e\",\n      \"amount\": 32,\n      \"secret\": \"c51d06255a492d1b8d5a35039f5ad4bf0b370cda130502094820c44d87e5e6af\",\n      \"C\": \"02281f64f578317808dde78c199ec68b585fba15d0dc90a9b91fc7d3e0eb4c4030\",\n      \"mintUrl\": \"http://localhost:3338\",\n      \"state\": \"inflight\",\n      \"createdByOperationId\": \"9e9skBsss9nnx-zfqkEoyw\"\n    },\n    {\n      \"id\": \"001b6c716bf42c7e\",\n      \"amount\": 8,\n      \"secret\": \"94a80d42c9d16563cb5de5f6c4e0718f6dad209971634e0b086f518e0d5b3a0e\",\n      \"C\": \"02fe89a5b1beb664b4ba48b3668c893734dba1d6bcf6391edad2b016b499516de9\",\n      \"mintUrl\": \"http://localhost:3338\",\n      \"state\": \"inflight\",\n      \"createdByOperationId\": \"9e9skBsss9nnx-zfqkEoyw\"\n    }\n  ],\n  \"outputs\": []\n}",
}

[sqlite3-integration module=WalletService module=RequestRateLimiter] DEBUG: Mint response error {
  endpoint: "http://localhost:3338/v1/swap",
  status: 400,
  errorData: "{\n  \"code\": 11010,\n  \"detail\": \"Input unit must match output\"\n}",
}
793 | 				status: response.status,
794 | 				errorData: JSON.stringify(errorData, null, 2)
795 | 			});
796 | 			if (response.status === 400 && errorData && typeof errorData.code === "number" && typeof errorData.detail === "string") {
797 | 				const { code, detail } = errorData;
798 | 				throw new MintOperationError(code, detail);
                ^
MintOperationError: Input unit must match output
 status: 400,
   code: 11010,
When sending a swap payload without either no inputs or no outputs (empty list) the mint returns a 11010 (Inputs and outputs not of same unit) instead of the 11002 (transaction not balanced) error. Probably due to the fact that there are no ids in the input/output to determine the unit. Here are some logs from testing: ``` [sqlite3-integration module=WalletService module=RequestRateLimiter] DEBUG: Mint request { method: "POST", endpoint: "http://localhost:3338/v1/swap", requestBody: "{\n \"inputs\": [\n {\n \"id\": \"001b6c716bf42c7e\",\n \"amount\": 32,\n \"secret\": \"c51d06255a492d1b8d5a35039f5ad4bf0b370cda130502094820c44d87e5e6af\",\n \"C\": \"02281f64f578317808dde78c199ec68b585fba15d0dc90a9b91fc7d3e0eb4c4030\",\n \"mintUrl\": \"http://localhost:3338\",\n \"state\": \"inflight\",\n \"createdByOperationId\": \"9e9skBsss9nnx-zfqkEoyw\"\n },\n {\n \"id\": \"001b6c716bf42c7e\",\n \"amount\": 8,\n \"secret\": \"94a80d42c9d16563cb5de5f6c4e0718f6dad209971634e0b086f518e0d5b3a0e\",\n \"C\": \"02fe89a5b1beb664b4ba48b3668c893734dba1d6bcf6391edad2b016b499516de9\",\n \"mintUrl\": \"http://localhost:3338\",\n \"state\": \"inflight\",\n \"createdByOperationId\": \"9e9skBsss9nnx-zfqkEoyw\"\n }\n ],\n \"outputs\": []\n}", } [sqlite3-integration module=WalletService module=RequestRateLimiter] DEBUG: Mint response error { endpoint: "http://localhost:3338/v1/swap", status: 400, errorData: "{\n \"code\": 11010,\n \"detail\": \"Input unit must match output\"\n}", } 793 | status: response.status, 794 | errorData: JSON.stringify(errorData, null, 2) 795 | }); 796 | if (response.status === 400 && errorData && typeof errorData.code === "number" && typeof errorData.detail === "string") { 797 | const { code, detail } = errorData; 798 | throw new MintOperationError(code, detail); ^ MintOperationError: Input unit must match output status: 400, code: 11010, ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cashubtc/cdk#1365
No description provided.