Skip to content

Commit e18cb1f

Browse files
workflows: wire post-confirmation SEND balance + hodler
Why: - After confirmation, update balances and hodler verifications for sender and receiver. - Native deposits remain trigger-driven; SEND is workflow-driven to avoid double counting. Test plan: - Simulate or run a SEND transfer: - token_balances upsert for both addresses with correct chain/token. - distribution_verifications upsert with type=send_token_hodler and preserved weight.
1 parent f01f6be commit e18cb1f

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

packages/workflows/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@my/workflows",
3-
"version": "0.0.8",
3+
"version": "0.0.9",
44
"files": [
55
"package.json",
66
"src"

packages/workflows/src/transfer-workflow/workflow.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ const {
1313
decodeTransferUserOpActivity,
1414
updateTemporalSendAccountTransferActivity,
1515
getEventFromTransferActivity,
16+
readBalanceActivity,
17+
persistBalanceActivity,
18+
upsertSendTokenHodlerVerificationActivity,
1619
} = proxyActivities<ReturnType<typeof createTransferActivities>>({
1720
// TODO: make this configurable
1821
startToCloseTimeout: '10 minutes',
@@ -129,6 +132,39 @@ export async function transfer(userOp: UserOperation<'v0.7'>, note?: string) {
129132
to,
130133
})
131134

135+
// After confirmation, read and persist balances for SEND-only
136+
if (token) {
137+
const fromRead = await readBalanceActivity({ token, account: from })
138+
if (fromRead) {
139+
await persistBalanceActivity({
140+
userId: fromRead.userId,
141+
token: fromRead.token,
142+
balance: fromRead.balance,
143+
address: fromRead.address,
144+
chainId: fromRead.chainId,
145+
})
146+
await upsertSendTokenHodlerVerificationActivity({
147+
userId: fromRead.userId,
148+
balance: fromRead.balance,
149+
})
150+
}
151+
152+
const toRead = await readBalanceActivity({ token, account: to })
153+
if (toRead) {
154+
await persistBalanceActivity({
155+
userId: toRead.userId,
156+
token: toRead.token,
157+
balance: toRead.balance,
158+
address: toRead.address,
159+
chainId: toRead.chainId,
160+
})
161+
await upsertSendTokenHodlerVerificationActivity({
162+
userId: toRead.userId,
163+
balance: toRead.balance,
164+
})
165+
}
166+
}
167+
132168
await updateTemporalSendAccountTransferActivity({
133169
workflow_id: workflowId,
134170
status: 'confirmed',

0 commit comments

Comments
 (0)