Skip to content

Commit 257d656

Browse files
authored
Merge pull request Stellar-Mail#1794 from Chigybillionz/postage
add postage
2 parents 9ea9aab + 1e9d7a0 commit 257d656

11 files changed

Lines changed: 301 additions & 160 deletions

File tree

src/routes/api/v1/postage/$messageId/refund.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const Route = createFileRoute("/api/v1/postage/$messageId/refund")({
1919
const messageId = hash32Schema.parse(params.messageId);
2020
const current = await getPostage(repository, messageId);
2121
requireActorMatches(context, current.recipient);
22-
const postage = await resolvePostage(repository, messageId, "refunded");
22+
const postage = await resolvePostage(context, messageId, "refunded");
2323
return apiSuccess(request, postage);
2424
}),
2525
},

src/routes/api/v1/postage/$messageId/settle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export const Route = createFileRoute("/api/v1/postage/$messageId/settle")({
7474
}
7575

7676
try {
77-
const postage = await resolvePostage(repository, messageId, "settled");
77+
const postage = await resolvePostage(context, messageId, "settled");
7878

7979
// Record successful settlement for idempotent replay
8080
if (rawIdempotencyKey) {

src/routes/api/v1/postage/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export const Route = createFileRoute("/api/v1/postage/")({
9292
relayId,
9393
sender: input.sender,
9494
};
95-
const postage = await submitPostage(repo, postageInput, new Date(), submitContext);
95+
const postage = await submitPostage(apiContext, postageInput, new Date(), submitContext);
9696

9797
if (rawIdempotencyKey) {
9898
await recordIdempotency(repo, input.sender, rawIdempotencyKey, 201, postage);

src/routes/api/v1/postage/quote.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export const Route = createFileRoute("/api/v1/postage/quote")({
6666
POST: ({ request }) =>
6767
handleApiRequest(request, async () => {
6868
const input = await parseJsonBody(request, quoteSchema);
69-
const quote = await quotePostage((await getApiContext()).repository, input);
69+
const quote = await quotePostage(await getApiContext(request), input);
7070
return apiSuccess(request, quote);
7171
}),
7272
},

src/server/api/metrics.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export const METRIC_DESCRIPTORS = {
7676
api_latency: ["method", "path", "status", "type", "synthetic"],
7777
api_errors_total: ["method", "path", "status", "type", "synthetic", "error_type"],
7878
abuse_dependency_fallback: ["check", "decision", "errorType", "policy", "route"],
79-
postage_limit_rejected: ["limit"],
79+
postage_limit_rejected: ["limit", "actorId", "ip", "fingerprint", "sender", "relayId"],
8080
} as const;
8181

8282
export type MetricName = keyof typeof METRIC_DESCRIPTORS;

0 commit comments

Comments
 (0)