@frontiertower/frontier-sdk 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -933,6 +933,514 @@ declare class PartnershipsAccess {
933
933
  }): Promise<void>;
934
934
  }
935
935
 
936
+ /**
937
+ * Developer account information
938
+ */
939
+ interface Developer {
940
+ /** Unique developer identifier */
941
+ id: number;
942
+ /** Developer name */
943
+ name: string;
944
+ /** Developer description */
945
+ description: string;
946
+ /** Developer email */
947
+ email: string;
948
+ /** API key */
949
+ apiKey: string;
950
+ /** Creation timestamp */
951
+ createdAt: string;
952
+ /** Last update timestamp */
953
+ updatedAt: string;
954
+ }
955
+ /**
956
+ * Request payload for updating developer information
957
+ */
958
+ interface UpdateDeveloperRequest {
959
+ /** Developer name */
960
+ name?: string;
961
+ /** Developer description */
962
+ description?: string;
963
+ /** Developer email */
964
+ email?: string;
965
+ }
966
+ /**
967
+ * Response from rotating an API key
968
+ */
969
+ interface RotateKeyResponse {
970
+ /** Response message */
971
+ message: string;
972
+ /** Updated developer with new API key */
973
+ developer: Developer;
974
+ }
975
+ /**
976
+ * App status
977
+ */
978
+ type AppStatus = 'in_review' | 'accepted' | 'released' | 'rejected' | 'request_deactivation' | 'deactivated';
979
+ /**
980
+ * App permission type
981
+ */
982
+ type AppPermission = string;
983
+ /**
984
+ * Registered app information
985
+ */
986
+ interface App {
987
+ /** Unique app identifier */
988
+ id: number;
989
+ /** Developer ID */
990
+ developer: number;
991
+ /** App icon URL */
992
+ icon: string | null;
993
+ /** App name */
994
+ name: string;
995
+ /** Human-readable app identifier */
996
+ readableId: string;
997
+ /** App description */
998
+ description: string;
999
+ /** App URL */
1000
+ url: string;
1001
+ /** CNAME entry for domain verification */
1002
+ cnameEntry: string;
1003
+ /** TXT entry for domain verification */
1004
+ txtEntry: string | null;
1005
+ /** App permissions */
1006
+ permissions: AppPermission[];
1007
+ /** Permission disclaimer text */
1008
+ permissionDisclaimer: string;
1009
+ /** App status */
1010
+ status: AppStatus;
1011
+ /** Review notes from admin */
1012
+ reviewNotes: string;
1013
+ /** Creation timestamp */
1014
+ createdAt: string;
1015
+ /** Last update timestamp */
1016
+ updatedAt: string;
1017
+ }
1018
+ /**
1019
+ * Request payload for creating an app
1020
+ */
1021
+ interface CreateAppRequest {
1022
+ /** Developer ID */
1023
+ developer: number;
1024
+ /** App URL */
1025
+ url: string;
1026
+ /** CNAME entry for domain verification */
1027
+ cnameEntry: string;
1028
+ /** TXT entry for domain verification */
1029
+ txtEntry?: string;
1030
+ /** App permissions */
1031
+ permissions: AppPermission[];
1032
+ /** Permission disclaimer text */
1033
+ permissionDisclaimer: string;
1034
+ }
1035
+ /**
1036
+ * Request payload for updating an app
1037
+ */
1038
+ interface UpdateAppRequest {
1039
+ /** Developer ID */
1040
+ developer?: number;
1041
+ /** App URL */
1042
+ url?: string;
1043
+ /** CNAME entry for domain verification */
1044
+ cnameEntry?: string;
1045
+ /** TXT entry for domain verification */
1046
+ txtEntry?: string;
1047
+ /** App permissions */
1048
+ permissions?: AppPermission[];
1049
+ /** Permission disclaimer text */
1050
+ permissionDisclaimer?: string;
1051
+ }
1052
+ /**
1053
+ * Webhook status
1054
+ */
1055
+ type WebhookStatus = 'IN_REVIEW' | 'LIVE' | 'REJECTED';
1056
+ /**
1057
+ * Webhook event type
1058
+ */
1059
+ type WebhookEvent = string;
1060
+ /**
1061
+ * Webhook scope - maps event categories to specific IDs or '*' for all
1062
+ */
1063
+ type WebhookScope = Record<string, number[] | '*'>;
1064
+ /**
1065
+ * Webhook configuration
1066
+ */
1067
+ interface WebhookConfig {
1068
+ /** Event types subscribed to */
1069
+ events: WebhookEvent[];
1070
+ /** Scope of the webhook */
1071
+ scope: WebhookScope;
1072
+ }
1073
+ /**
1074
+ * Webhook information
1075
+ */
1076
+ interface Webhook {
1077
+ /** Unique webhook identifier */
1078
+ id: number;
1079
+ /** Developer ID */
1080
+ developer: number;
1081
+ /** Webhook name */
1082
+ name: string;
1083
+ /** Webhook description */
1084
+ description: string;
1085
+ /** Target URL for webhook delivery */
1086
+ targetUrl: string;
1087
+ /** Webhook configuration */
1088
+ config: WebhookConfig;
1089
+ /** Signing public key */
1090
+ signingPublicKey: string;
1091
+ /** Webhook status */
1092
+ status: WebhookStatus;
1093
+ /** Review notes from admin */
1094
+ reviewNotes: string;
1095
+ /** Creation timestamp */
1096
+ createdAt: string;
1097
+ /** Last update timestamp */
1098
+ updatedAt: string;
1099
+ }
1100
+ /**
1101
+ * Request payload for creating a webhook
1102
+ */
1103
+ interface CreateWebhookRequest {
1104
+ /** Developer ID */
1105
+ developer: number;
1106
+ /** Webhook name */
1107
+ name: string;
1108
+ /** Webhook description */
1109
+ description: string;
1110
+ /** Target URL for webhook delivery */
1111
+ targetUrl: string;
1112
+ /** Webhook configuration */
1113
+ config: WebhookConfig;
1114
+ }
1115
+ /**
1116
+ * Request payload for updating a webhook
1117
+ */
1118
+ interface UpdateWebhookRequest {
1119
+ /** Developer ID */
1120
+ developer?: number;
1121
+ /** Webhook name */
1122
+ name?: string;
1123
+ /** Webhook description */
1124
+ description?: string;
1125
+ /** Target URL for webhook delivery */
1126
+ targetUrl?: string;
1127
+ /** Webhook configuration */
1128
+ config?: WebhookConfig;
1129
+ }
1130
+ /**
1131
+ * Response from rotating a webhook signing key
1132
+ */
1133
+ interface RotateWebhookKeyResponse {
1134
+ /** Response message */
1135
+ message: string;
1136
+ /** Updated webhook with new signing key */
1137
+ webhook: Webhook;
1138
+ }
1139
+ /**
1140
+ * Pagination parameters
1141
+ */
1142
+ interface ListParams {
1143
+ /** Maximum number of results to return */
1144
+ limit?: number;
1145
+ /** Offset into the result set */
1146
+ offset?: number;
1147
+ }
1148
+ /**
1149
+ * Parameters for listing apps
1150
+ */
1151
+ interface ListAppsParams extends ListParams {
1152
+ /** Filter by developer ID */
1153
+ developerId?: number;
1154
+ }
1155
+ /**
1156
+ * Parameters for listing webhooks
1157
+ */
1158
+ interface ListWebhooksParams extends ListParams {
1159
+ /** Filter by developer ID */
1160
+ developerId?: number;
1161
+ }
1162
+ /**
1163
+ * Third-party access class for interacting with third-party developer features.
1164
+ *
1165
+ * This class provides methods to:
1166
+ * - Manage developer accounts
1167
+ * - Register and manage apps
1168
+ * - Configure webhooks for event notifications
1169
+ *
1170
+ * All methods require appropriate permissions and authentication.
1171
+ */
1172
+ declare class ThirdPartyAccess {
1173
+ private sdk;
1174
+ constructor(sdk: FrontierSDK);
1175
+ /**
1176
+ * List developer accounts (paginated)
1177
+ * Requires permission: `thirdParty:listDevelopers` or `thirdParty:*`
1178
+ *
1179
+ * @param payload.limit - Maximum number of results to return
1180
+ * @param payload.offset - Offset into the result set
1181
+ * @returns Paginated response of developers
1182
+ *
1183
+ * @example
1184
+ * ```typescript
1185
+ * const developers = await sdk.getThirdParty().listDevelopers({ limit: 20, offset: 0 });
1186
+ * console.log('Total developers:', developers.count);
1187
+ * ```
1188
+ */
1189
+ listDevelopers(payload?: ListParams): Promise<PaginatedResponse<Developer>>;
1190
+ /**
1191
+ * Get developer details by ID
1192
+ * Requires permission: `thirdParty:getDeveloper` or `thirdParty:*`
1193
+ *
1194
+ * @param payload.id - Developer ID
1195
+ * @returns Developer details
1196
+ *
1197
+ * @example
1198
+ * ```typescript
1199
+ * const developer = await sdk.getThirdParty().getDeveloper({ id: 123 });
1200
+ * console.log('Developer:', developer.name);
1201
+ * ```
1202
+ */
1203
+ getDeveloper(payload: {
1204
+ id: number;
1205
+ }): Promise<Developer>;
1206
+ /**
1207
+ * Update developer information
1208
+ * Requires permission: `thirdParty:updateDeveloper` or `thirdParty:*`
1209
+ *
1210
+ * @param payload.id - Developer ID
1211
+ * @param payload.data - Update data
1212
+ * @returns Updated developer
1213
+ *
1214
+ * @example
1215
+ * ```typescript
1216
+ * const developer = await sdk.getThirdParty().updateDeveloper({
1217
+ * id: 123,
1218
+ * data: { name: 'New Name', website: 'https://example.com' }
1219
+ * });
1220
+ * ```
1221
+ */
1222
+ updateDeveloper(payload: {
1223
+ id: number;
1224
+ data: UpdateDeveloperRequest;
1225
+ }): Promise<Developer>;
1226
+ /**
1227
+ * Rotate developer API key
1228
+ * Requires permission: `thirdParty:rotateDeveloperApiKey` or `thirdParty:*`
1229
+ *
1230
+ * Note: The new API key is only shown once in the response
1231
+ *
1232
+ * @param payload.id - Developer ID
1233
+ * @returns Response containing the new API key
1234
+ *
1235
+ * @example
1236
+ * ```typescript
1237
+ * const result = await sdk.getThirdParty().rotateDeveloperApiKey({ id: 123 });
1238
+ * console.log('New API key:', result.apiKey);
1239
+ * // Store this key securely - it won't be shown again!
1240
+ * ```
1241
+ */
1242
+ rotateDeveloperApiKey(payload: {
1243
+ id: number;
1244
+ }): Promise<RotateKeyResponse>;
1245
+ /**
1246
+ * List registered apps (paginated)
1247
+ * Requires permission: `thirdParty:listApps` or `thirdParty:*`
1248
+ *
1249
+ * @param payload.limit - Maximum number of results to return
1250
+ * @param payload.offset - Offset into the result set
1251
+ * @param payload.developerId - Filter by developer ID
1252
+ * @returns Paginated response of apps
1253
+ *
1254
+ * @example
1255
+ * ```typescript
1256
+ * const apps = await sdk.getThirdParty().listApps({ limit: 20, offset: 0 });
1257
+ * console.log('Total apps:', apps.count);
1258
+ *
1259
+ * // Filter by developer
1260
+ * const devApps = await sdk.getThirdParty().listApps({ developerId: 123 });
1261
+ * ```
1262
+ */
1263
+ listApps(payload?: ListAppsParams): Promise<PaginatedResponse<App>>;
1264
+ /**
1265
+ * Register a new app
1266
+ * Requires permission: `thirdParty:createApp` or `thirdParty:*`
1267
+ *
1268
+ * Note: App name, description, and icon are automatically fetched from the URL's metadata
1269
+ *
1270
+ * @param payload - App creation payload with URL
1271
+ * @returns Created app
1272
+ *
1273
+ * @example
1274
+ * ```typescript
1275
+ * const app = await sdk.getThirdParty().createApp({
1276
+ * url: 'https://myapp.example.com'
1277
+ * });
1278
+ * console.log('Created app:', app.id, app.name);
1279
+ * ```
1280
+ */
1281
+ createApp(payload: CreateAppRequest): Promise<App>;
1282
+ /**
1283
+ * Get app details by ID
1284
+ * Requires permission: `thirdParty:getApp` or `thirdParty:*`
1285
+ *
1286
+ * @param payload.id - App ID
1287
+ * @returns App details
1288
+ *
1289
+ * @example
1290
+ * ```typescript
1291
+ * const app = await sdk.getThirdParty().getApp({ id: 123 });
1292
+ * console.log('App:', app.name, app.status);
1293
+ * ```
1294
+ */
1295
+ getApp(payload: {
1296
+ id: number;
1297
+ }): Promise<App>;
1298
+ /**
1299
+ * Update an app
1300
+ * Requires permission: `thirdParty:updateApp` or `thirdParty:*`
1301
+ *
1302
+ * @param payload.id - App ID
1303
+ * @param payload.data - Update data
1304
+ * @returns Updated app
1305
+ *
1306
+ * @example
1307
+ * ```typescript
1308
+ * const app = await sdk.getThirdParty().updateApp({
1309
+ * id: 123,
1310
+ * data: { name: 'Updated App Name', description: 'New description' }
1311
+ * });
1312
+ * ```
1313
+ */
1314
+ updateApp(payload: {
1315
+ id: number;
1316
+ data: UpdateAppRequest;
1317
+ }): Promise<App>;
1318
+ /**
1319
+ * Request app deactivation
1320
+ * Requires permission: `thirdParty:deleteApp` or `thirdParty:*`
1321
+ *
1322
+ * @param payload.id - App ID
1323
+ *
1324
+ * @example
1325
+ * ```typescript
1326
+ * await sdk.getThirdParty().deleteApp({ id: 123 });
1327
+ * ```
1328
+ */
1329
+ deleteApp(payload: {
1330
+ id: number;
1331
+ }): Promise<void>;
1332
+ /**
1333
+ * List webhooks (paginated)
1334
+ * Requires permission: `thirdParty:listWebhooks` or `thirdParty:*`
1335
+ *
1336
+ * Note: Maximum 3 webhooks per developer account
1337
+ *
1338
+ * @param payload.limit - Maximum number of results to return
1339
+ * @param payload.offset - Offset into the result set
1340
+ * @param payload.developerId - Filter by developer ID
1341
+ * @returns Paginated response of webhooks
1342
+ *
1343
+ * @example
1344
+ * ```typescript
1345
+ * const webhooks = await sdk.getThirdParty().listWebhooks({ limit: 10, offset: 0 });
1346
+ * console.log('Total webhooks:', webhooks.count);
1347
+ *
1348
+ * // Filter by developer
1349
+ * const devWebhooks = await sdk.getThirdParty().listWebhooks({ developerId: 123 });
1350
+ * ```
1351
+ */
1352
+ listWebhooks(payload?: ListWebhooksParams): Promise<PaginatedResponse<Webhook>>;
1353
+ /**
1354
+ * Create a new webhook
1355
+ * Requires permission: `thirdParty:createWebhook` or `thirdParty:*`
1356
+ *
1357
+ * Note: New webhooks require admin approval before going live
1358
+ *
1359
+ * @param payload - Webhook creation payload
1360
+ * @returns Created webhook
1361
+ *
1362
+ * @example
1363
+ * ```typescript
1364
+ * const webhook = await sdk.getThirdParty().createWebhook({
1365
+ * url: 'https://myapp.example.com/webhooks',
1366
+ * events: ['app.approved', 'user.registered']
1367
+ * });
1368
+ * console.log('Created webhook:', webhook.id);
1369
+ * ```
1370
+ */
1371
+ createWebhook(payload: CreateWebhookRequest): Promise<Webhook>;
1372
+ /**
1373
+ * Get webhook details by ID
1374
+ * Requires permission: `thirdParty:getWebhook` or `thirdParty:*`
1375
+ *
1376
+ * @param payload.id - Webhook ID
1377
+ * @returns Webhook details
1378
+ *
1379
+ * @example
1380
+ * ```typescript
1381
+ * const webhook = await sdk.getThirdParty().getWebhook({ id: 123 });
1382
+ * console.log('Webhook:', webhook.url, webhook.status);
1383
+ * ```
1384
+ */
1385
+ getWebhook(payload: {
1386
+ id: number;
1387
+ }): Promise<Webhook>;
1388
+ /**
1389
+ * Update a webhook
1390
+ * Requires permission: `thirdParty:updateWebhook` or `thirdParty:*`
1391
+ *
1392
+ * Note: Config changes require admin approval before going live
1393
+ *
1394
+ * @param payload.id - Webhook ID
1395
+ * @param payload.data - Update data
1396
+ * @returns Updated webhook
1397
+ *
1398
+ * @example
1399
+ * ```typescript
1400
+ * const webhook = await sdk.getThirdParty().updateWebhook({
1401
+ * id: 123,
1402
+ * data: { url: 'https://newurl.example.com/webhooks' }
1403
+ * });
1404
+ * ```
1405
+ */
1406
+ updateWebhook(payload: {
1407
+ id: number;
1408
+ data: UpdateWebhookRequest;
1409
+ }): Promise<Webhook>;
1410
+ /**
1411
+ * Delete a webhook
1412
+ * Requires permission: `thirdParty:deleteWebhook` or `thirdParty:*`
1413
+ *
1414
+ * @param payload.id - Webhook ID
1415
+ *
1416
+ * @example
1417
+ * ```typescript
1418
+ * await sdk.getThirdParty().deleteWebhook({ id: 123 });
1419
+ * ```
1420
+ */
1421
+ deleteWebhook(payload: {
1422
+ id: number;
1423
+ }): Promise<void>;
1424
+ /**
1425
+ * Rotate webhook signing key
1426
+ * Requires permission: `thirdParty:rotateWebhookSigningKey` or `thirdParty:*`
1427
+ *
1428
+ * Note: The new signing public key is returned in the response
1429
+ *
1430
+ * @param payload.id - Webhook ID
1431
+ * @returns Response containing the new signing public key
1432
+ *
1433
+ * @example
1434
+ * ```typescript
1435
+ * const result = await sdk.getThirdParty().rotateWebhookSigningKey({ id: 123 });
1436
+ * console.log('New signing key:', result.signingPublicKey);
1437
+ * ```
1438
+ */
1439
+ rotateWebhookSigningKey(payload: {
1440
+ id: number;
1441
+ }): Promise<RotateWebhookKeyResponse>;
1442
+ }
1443
+
936
1444
  declare class FrontierSDK {
937
1445
  private requestId;
938
1446
  private pendingRequests;
@@ -941,6 +1449,7 @@ declare class FrontierSDK {
941
1449
  private chain;
942
1450
  private user;
943
1451
  private partnerships;
1452
+ private thirdParty;
944
1453
  constructor();
945
1454
  private handleMessage;
946
1455
  /**
@@ -969,6 +1478,10 @@ declare class FrontierSDK {
969
1478
  * Get partnerships access instance
970
1479
  */
971
1480
  getPartnerships(): PartnershipsAccess;
1481
+ /**
1482
+ * Get third-party access instance
1483
+ */
1484
+ getThirdParty(): ThirdPartyAccess;
972
1485
  /**
973
1486
  * Cleanup: Remove event listeners
974
1487
  * Call this when your app is being destroyed
@@ -988,4 +1501,4 @@ interface SDKResponse {
988
1501
  error?: string;
989
1502
  }
990
1503
 
991
- export { ChainAccess, type ChainConfig, type CreateSponsorPassRequest, type ExecuteCall, FrontierSDK, type GasOverrides, type ListSponsorsParams, type PaginatedResponse, PartnershipsAccess, type ReferralDetails, type ReferralOverview, type SDKRequest, type SDKResponse, type SmartAccount, type Sponsor, type SponsorPass, StorageAccess, type SwapParams, type SwapQuote, type SwapResult, SwapResultStatus, type User, UserAccess, type UserContact, type UserContactPayload, type UserOperationReceipt, type UserProfile, WalletAccess };
1504
+ export { type App, type AppPermission, type AppStatus, ChainAccess, type ChainConfig, type CreateAppRequest, type CreateSponsorPassRequest, type CreateWebhookRequest, type Developer, type ExecuteCall, FrontierSDK, type GasOverrides, type ListParams, type ListSponsorsParams, type PaginatedResponse, PartnershipsAccess, type ReferralDetails, type ReferralOverview, type RotateKeyResponse, type RotateWebhookKeyResponse, type SDKRequest, type SDKResponse, type SmartAccount, type Sponsor, type SponsorPass, StorageAccess, type SwapParams, type SwapQuote, type SwapResult, SwapResultStatus, ThirdPartyAccess, type UpdateAppRequest, type UpdateDeveloperRequest, type UpdateWebhookRequest, type User, UserAccess, type UserContact, type UserContactPayload, type UserOperationReceipt, type UserProfile, WalletAccess, type Webhook, type WebhookConfig, type WebhookEvent, type WebhookScope, type WebhookStatus };