Skip to content

Commit b4f0997

Browse files
cesarenaldiclaude
andcommitted
feat: refresh balance allowance cache after order approval settles
After an on-chain approval transaction confirms, trigger a server-side cache refresh so the next order placement sees up-to-date allowances. Refreshes COLLATERAL for buy orders and CONDITIONAL (with tokenId) for sell orders. No-ops when existing allowance is already sufficient. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 482e250 commit b4f0997

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

packages/client/src/actions/orders/prepare.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { OrderSide } from '@polymarket/bindings/clob';
1+
import { AssetType, OrderSide } from '@polymarket/bindings/clob';
22
import {
33
type EvmAddress,
44
type EvmSignature,
@@ -16,6 +16,7 @@ import type {
1616
} from '../../errors';
1717
import { parseUserInput } from '../../input';
1818
import type { TransactionHandle } from '../../types';
19+
import { updateBalanceAllowance } from '../account';
1920
import {
2021
type Erc20ApprovalWorkflowRequest,
2122
type Erc1155ApprovalForAllWorkflowRequest,
@@ -140,4 +141,12 @@ async function* ensureOrderApproval(
140141
});
141142

142143
await handle.wait();
144+
145+
await updateBalanceAllowance(client, {
146+
assetType:
147+
draft.side === OrderSide.BUY
148+
? AssetType.COLLATERAL
149+
: AssetType.CONDITIONAL,
150+
tokenId: draft.side === OrderSide.SELL ? draft.tokenId : undefined,
151+
});
143152
}

0 commit comments

Comments
 (0)