Skip to content

Commit 20e5107

Browse files
committed
feat: adds gateway usage source
1 parent 4cbf671 commit 20e5107

File tree

4 files changed

+46
-30
lines changed

4 files changed

+46
-30
lines changed

packages/service-utils/src/core/api.ts

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ type TeamCapabilities = {
112112
enabled: boolean;
113113
rateLimit: number;
114114
};
115+
gateway: {
116+
enabled: boolean;
117+
rateLimit: number;
118+
};
115119
};
116120

117121
type TeamPlan =
@@ -138,11 +142,11 @@ export type TeamResponse = {
138142
// invalidPayment = payment method not valid (billing failing repeatedly) => error state
139143
// pastDue = payment method on file but has past due payments => warning state
140144
billingStatus:
141-
| "noPayment"
142-
| "validPayment"
143-
| "invalidPayment"
144-
| "pastDue"
145-
| null;
145+
| "noPayment"
146+
| "validPayment"
147+
| "invalidPayment"
148+
| "pastDue"
149+
| null;
146150
canCreatePublicChains: boolean | null;
147151
enabledScopes: ServiceName[];
148152
isOnboarded: boolean;
@@ -202,36 +206,36 @@ export type ProjectEmbeddedWalletsService = {
202206

203207
export type ProjectService =
204208
| {
205-
name: "pay";
206-
actions: never[];
207-
payoutAddress: string | null;
208-
developerFeeBPS?: number | null;
209-
}
209+
name: "pay";
210+
actions: never[];
211+
payoutAddress: string | null;
212+
developerFeeBPS?: number | null;
213+
}
210214
| {
211-
name: "storage";
212-
actions: ("read" | "write")[];
213-
}
215+
name: "storage";
216+
actions: ("read" | "write")[];
217+
}
214218
| {
215-
name: "rpc";
216-
actions: never[];
217-
}
219+
name: "rpc";
220+
actions: never[];
221+
}
218222
| {
219-
name: "insight";
220-
actions: never[];
221-
}
223+
name: "insight";
224+
actions: never[];
225+
}
222226
| {
223-
name: "nebula";
224-
actions: never[];
225-
}
227+
name: "nebula";
228+
actions: never[];
229+
}
226230
| {
227-
name: "engineCloud";
228-
actions: never[];
229-
maskedAdminKey?: string | null;
230-
managementAccessToken?: string | null;
231-
rotationCode?: string | null;
232-
encryptedAdminKey?: string | null;
233-
encryptedWalletAccessToken?: string | null;
234-
}
231+
name: "engineCloud";
232+
actions: never[];
233+
maskedAdminKey?: string | null;
234+
managementAccessToken?: string | null;
235+
rotationCode?: string | null;
236+
encryptedAdminKey?: string | null;
237+
encryptedWalletAccessToken?: string | null;
238+
}
235239
| ProjectBundlerService
236240
| ProjectEmbeddedWalletsService;
237241

packages/service-utils/src/core/services.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ export const SERVICE_DEFINITIONS = {
8383
name: "storage",
8484
title: "Storage",
8585
},
86+
gateway: {
87+
// all actions allowed
88+
actions: [],
89+
description: "api.thirdweb.com",
90+
name: "gateway",
91+
title: "Gateway",
92+
},
8693
} as const;
8794

8895
export const SERVICE_NAMES = Object.keys(

packages/service-utils/src/core/usageV2.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export const USAGE_V2_SOURCES = [
1010
"wallet",
1111
"pay",
1212
"webhook",
13+
"gateway",
1314
] as const;
1415
export type UsageV2Source = (typeof USAGE_V2_SOURCES)[number];
1516

packages/service-utils/src/mocks.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ export const validTeamResponse: TeamResponse = {
8484
enabled: true,
8585
rateLimit: 1000,
8686
},
87+
gateway: {
88+
enabled: true,
89+
rateLimit: 1000,
90+
},
8791
platform: {
8892
auditLogs: true,
8993
ecosystemWallets: true,

0 commit comments

Comments
 (0)