@frontiertower/frontier-sdk 0.3.4 → 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/README.md +30 -0
- package/dist/index.d.mts +816 -1
- package/dist/index.d.ts +816 -1
- package/dist/index.js +534 -0
- package/dist/index.mjs +531 -0
- package/package.json +2 -5
package/dist/index.d.ts
CHANGED
|
@@ -54,6 +54,60 @@ interface ExecuteCall {
|
|
|
54
54
|
/** Calldata */
|
|
55
55
|
data: string;
|
|
56
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Swap parameters for token swaps
|
|
59
|
+
*/
|
|
60
|
+
interface SwapParams {
|
|
61
|
+
/** Symbol of the token to swap from (e.g., 'USDC') */
|
|
62
|
+
sourceToken: string;
|
|
63
|
+
/** Symbol of the token to swap to (e.g., 'WETH') */
|
|
64
|
+
targetToken: string;
|
|
65
|
+
/** Network identifier for source chain (e.g., 'base') */
|
|
66
|
+
sourceNetwork: string;
|
|
67
|
+
/** Network identifier for target chain (e.g., 'ethereum') */
|
|
68
|
+
targetNetwork: string;
|
|
69
|
+
/** Amount to swap in human-readable format (e.g., '100.5') */
|
|
70
|
+
amount: string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Swap result status
|
|
74
|
+
*/
|
|
75
|
+
declare enum SwapResultStatus {
|
|
76
|
+
COMPLETED = "COMPLETED",
|
|
77
|
+
SUBMITTED = "SUBMITTED"
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Result of a swap operation
|
|
81
|
+
*/
|
|
82
|
+
interface SwapResult {
|
|
83
|
+
/** Source chain configuration */
|
|
84
|
+
sourceChain: object;
|
|
85
|
+
/** Target chain configuration */
|
|
86
|
+
targetChain: object;
|
|
87
|
+
/** Source token configuration */
|
|
88
|
+
sourceToken: object;
|
|
89
|
+
/** Target token configuration */
|
|
90
|
+
targetToken: object;
|
|
91
|
+
/** Status of the swap */
|
|
92
|
+
status: SwapResultStatus;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Quote for a swap operation
|
|
96
|
+
*/
|
|
97
|
+
interface SwapQuote {
|
|
98
|
+
/** Source chain configuration */
|
|
99
|
+
sourceChain: object;
|
|
100
|
+
/** Target chain configuration */
|
|
101
|
+
targetChain: object;
|
|
102
|
+
/** Source token configuration */
|
|
103
|
+
sourceToken: object;
|
|
104
|
+
/** Target token configuration */
|
|
105
|
+
targetToken: object;
|
|
106
|
+
/** Expected output amount in human-readable format */
|
|
107
|
+
expectedAmountOut: string;
|
|
108
|
+
/** Minimum output amount in human-readable format */
|
|
109
|
+
minAmountOut: string;
|
|
110
|
+
}
|
|
57
111
|
/**
|
|
58
112
|
* Wallet access class for interacting with the user's wallet
|
|
59
113
|
*
|
|
@@ -256,6 +310,103 @@ declare class WalletAccess {
|
|
|
256
310
|
* ```
|
|
257
311
|
*/
|
|
258
312
|
transferFrontierDollar(to: string, amount: string, overrides?: GasOverrides): Promise<UserOperationReceipt>;
|
|
313
|
+
/**
|
|
314
|
+
* Execute multiple calls atomically with a single signature
|
|
315
|
+
*
|
|
316
|
+
* Executes multiple contract interactions in a single transaction.
|
|
317
|
+
* All calls are executed atomically - if one fails, all fail.
|
|
318
|
+
*
|
|
319
|
+
* @param calls - Array of execute call parameters
|
|
320
|
+
* @param overrides - Optional gas overrides
|
|
321
|
+
* @returns User operation receipt with transaction details
|
|
322
|
+
* @throws {Error} If any transaction fails
|
|
323
|
+
*
|
|
324
|
+
* @example
|
|
325
|
+
* ```typescript
|
|
326
|
+
* import { encodeFunctionData } from 'viem';
|
|
327
|
+
*
|
|
328
|
+
* const receipt = await sdk.getWallet().executeBatchCall([
|
|
329
|
+
* {
|
|
330
|
+
* to: '0xToken1',
|
|
331
|
+
* value: 0n,
|
|
332
|
+
* data: encodeFunctionData({ abi: erc20Abi, functionName: 'approve', args: [...] })
|
|
333
|
+
* },
|
|
334
|
+
* {
|
|
335
|
+
* to: '0xProtocol',
|
|
336
|
+
* value: 0n,
|
|
337
|
+
* data: encodeFunctionData({ abi: protocolAbi, functionName: 'deposit', args: [...] })
|
|
338
|
+
* }
|
|
339
|
+
* ]);
|
|
340
|
+
* ```
|
|
341
|
+
*/
|
|
342
|
+
executeBatchCall(calls: ExecuteCall[], overrides?: GasOverrides): Promise<UserOperationReceipt>;
|
|
343
|
+
/**
|
|
344
|
+
* Get list of supported token symbols for the current chain
|
|
345
|
+
*
|
|
346
|
+
* Returns an array of token symbols that are supported for swaps
|
|
347
|
+
* and other operations on the current network.
|
|
348
|
+
*
|
|
349
|
+
* @returns Array of token symbols (e.g., ['FTD', 'USDC', 'WETH'])
|
|
350
|
+
*
|
|
351
|
+
* @example
|
|
352
|
+
* ```typescript
|
|
353
|
+
* const tokens = await sdk.getWallet().getSupportedTokens();
|
|
354
|
+
* console.log('Supported tokens:', tokens); // ['FTD', 'USDC', 'WETH']
|
|
355
|
+
* ```
|
|
356
|
+
*/
|
|
357
|
+
getSupportedTokens(): Promise<string[]>;
|
|
358
|
+
/**
|
|
359
|
+
* Execute a token swap
|
|
360
|
+
*
|
|
361
|
+
* @param sourceToken - Symbol of the token to swap from (e.g., 'USDC')
|
|
362
|
+
* @param targetToken - Symbol of the token to swap to (e.g., 'WETH')
|
|
363
|
+
* @param sourceNetwork - Network identifier for source chain (e.g., 'base')
|
|
364
|
+
* @param targetNetwork - Network identifier for target chain (e.g., 'ethereum')
|
|
365
|
+
* @param amount - Amount to swap in human-readable format (e.g., '100.5')
|
|
366
|
+
* @returns Swap result with status and transaction details
|
|
367
|
+
* @throws {Error} If swap fails or tokens/networks are not supported
|
|
368
|
+
*
|
|
369
|
+
* @example
|
|
370
|
+
* ```typescript
|
|
371
|
+
* const result = await sdk.getWallet().swap(
|
|
372
|
+
* 'USDC',
|
|
373
|
+
* 'WETH',
|
|
374
|
+
* 'base',
|
|
375
|
+
* 'ethereum',
|
|
376
|
+
* '100.5'
|
|
377
|
+
* );
|
|
378
|
+
* console.log('Swap status:', result.status);
|
|
379
|
+
* ```
|
|
380
|
+
*/
|
|
381
|
+
swap(sourceToken: string, targetToken: string, sourceNetwork: string, targetNetwork: string, amount: string): Promise<SwapResult>;
|
|
382
|
+
/**
|
|
383
|
+
* Get a quote for a token swap without executing it
|
|
384
|
+
*
|
|
385
|
+
* Returns the expected output amount for a given swap.
|
|
386
|
+
* Useful for displaying swap previews to users before confirmation.
|
|
387
|
+
*
|
|
388
|
+
* @param sourceToken - Symbol of the token to swap from (e.g., 'USDC')
|
|
389
|
+
* @param targetToken - Symbol of the token to swap to (e.g., 'WETH')
|
|
390
|
+
* @param sourceNetwork - Network identifier for source chain (e.g., 'base')
|
|
391
|
+
* @param targetNetwork - Network identifier for target chain (e.g., 'ethereum')
|
|
392
|
+
* @param amount - Amount to swap in human-readable format (e.g., '100.5')
|
|
393
|
+
* @returns Quote with expected and minimum output amounts
|
|
394
|
+
* @throws {Error} If tokens/networks are not supported
|
|
395
|
+
*
|
|
396
|
+
* @example
|
|
397
|
+
* ```typescript
|
|
398
|
+
* const quote = await sdk.getWallet().quoteSwap(
|
|
399
|
+
* 'USDC',
|
|
400
|
+
* 'WETH',
|
|
401
|
+
* 'base',
|
|
402
|
+
* 'ethereum',
|
|
403
|
+
* '100.5'
|
|
404
|
+
* );
|
|
405
|
+
* console.log('Expected output:', quote.expectedAmountOut);
|
|
406
|
+
* console.log('Minimum output:', quote.minAmountOut);
|
|
407
|
+
* ```
|
|
408
|
+
*/
|
|
409
|
+
quoteSwap(sourceToken: string, targetToken: string, sourceNetwork: string, targetNetwork: string, amount: string): Promise<SwapQuote>;
|
|
259
410
|
}
|
|
260
411
|
|
|
261
412
|
/**
|
|
@@ -636,6 +787,660 @@ declare class UserAccess {
|
|
|
636
787
|
addUserContact(data: UserContactPayload): Promise<void>;
|
|
637
788
|
}
|
|
638
789
|
|
|
790
|
+
/**
|
|
791
|
+
* Sponsor passes API
|
|
792
|
+
*
|
|
793
|
+
* Sponsor pass creation and management
|
|
794
|
+
*/
|
|
795
|
+
type SponsorPassStatus = 'active' | 'revoked';
|
|
796
|
+
interface SponsorPass {
|
|
797
|
+
id: number;
|
|
798
|
+
sponsor: number;
|
|
799
|
+
sponsorName: string;
|
|
800
|
+
firstName: string;
|
|
801
|
+
lastName: string;
|
|
802
|
+
email: string;
|
|
803
|
+
status: SponsorPassStatus;
|
|
804
|
+
expiresAt: string | null;
|
|
805
|
+
createdAt: string;
|
|
806
|
+
updatedAt: string;
|
|
807
|
+
revokedAt: string | null;
|
|
808
|
+
}
|
|
809
|
+
/**
|
|
810
|
+
* Payload for creating a SponsorPass.
|
|
811
|
+
*/
|
|
812
|
+
interface CreateSponsorPassRequest {
|
|
813
|
+
sponsor: number;
|
|
814
|
+
firstName: string;
|
|
815
|
+
lastName: string;
|
|
816
|
+
email: string;
|
|
817
|
+
expiresAt?: string;
|
|
818
|
+
}
|
|
819
|
+
interface ListSponsorPassesParams {
|
|
820
|
+
limit?: number;
|
|
821
|
+
offset?: number;
|
|
822
|
+
}
|
|
823
|
+
interface ListAllSponsorPassesParams extends ListSponsorPassesParams {
|
|
824
|
+
includeRevoked?: boolean;
|
|
825
|
+
}
|
|
826
|
+
interface Sponsor {
|
|
827
|
+
id: number;
|
|
828
|
+
name: string;
|
|
829
|
+
dailyRate: string;
|
|
830
|
+
notes: string;
|
|
831
|
+
createdAt: string;
|
|
832
|
+
updatedAt: string;
|
|
833
|
+
}
|
|
834
|
+
interface ListSponsorsParams {
|
|
835
|
+
limit?: number;
|
|
836
|
+
offset?: number;
|
|
837
|
+
}
|
|
838
|
+
/**
|
|
839
|
+
* Partnerships access class for interacting with partnership-related features.
|
|
840
|
+
*
|
|
841
|
+
* This class provides methods to:
|
|
842
|
+
* - Create SponsorPasses
|
|
843
|
+
* - List active SponsorPasses
|
|
844
|
+
* - List all SponsorPasses (optionally including revoked)
|
|
845
|
+
* - Retrieve and revoke SponsorPasses
|
|
846
|
+
*/
|
|
847
|
+
declare class PartnershipsAccess {
|
|
848
|
+
private sdk;
|
|
849
|
+
constructor(sdk: FrontierSDK);
|
|
850
|
+
/**
|
|
851
|
+
* Create a SponsorPass
|
|
852
|
+
* Requires permission: `partnerships:createSponsorPass` or `partnerships:*`
|
|
853
|
+
*
|
|
854
|
+
* @param payload - SponsorPass creation payload
|
|
855
|
+
* @returns Created SponsorPass
|
|
856
|
+
*
|
|
857
|
+
* @example
|
|
858
|
+
* ```typescript
|
|
859
|
+
* const pass = await sdk.getPartnerships().createSponsorPass({
|
|
860
|
+
* sponsor: 123,
|
|
861
|
+
* firstName: 'Ada',
|
|
862
|
+
* lastName: 'Lovelace',
|
|
863
|
+
* email: 'ada@example.com',
|
|
864
|
+
* });
|
|
865
|
+
* console.log('Created SponsorPass:', pass.id);
|
|
866
|
+
* ```
|
|
867
|
+
*/
|
|
868
|
+
createSponsorPass(payload: CreateSponsorPassRequest): Promise<SponsorPass>;
|
|
869
|
+
/**
|
|
870
|
+
* List active SponsorPasses (paginated)
|
|
871
|
+
* Requires permission: `partnerships:listActiveSponsorPasses` or `partnerships:*`
|
|
872
|
+
*
|
|
873
|
+
* @param payload.limit - Maximum number of results to return
|
|
874
|
+
* @param payload.offset - Offset into the result set
|
|
875
|
+
* @returns Paginated response of active SponsorPasses
|
|
876
|
+
*
|
|
877
|
+
* @example
|
|
878
|
+
* ```typescript
|
|
879
|
+
* const active = await sdk.getPartnerships().listActiveSponsorPasses({ limit: 20, offset: 0 });
|
|
880
|
+
* console.log('Active count:', active.count);
|
|
881
|
+
* ```
|
|
882
|
+
*/
|
|
883
|
+
listActiveSponsorPasses(payload?: ListSponsorPassesParams): Promise<PaginatedResponse<SponsorPass>>;
|
|
884
|
+
/**
|
|
885
|
+
* List all SponsorPasses (paginated)
|
|
886
|
+
* Requires permission: `partnerships:listAllSponsorPasses` or `partnerships:*`
|
|
887
|
+
*
|
|
888
|
+
* @param payload.includeRevoked - When true, include revoked passes
|
|
889
|
+
* @returns Paginated response of SponsorPasses
|
|
890
|
+
*
|
|
891
|
+
* @example
|
|
892
|
+
* ```typescript
|
|
893
|
+
* const all = await sdk.getPartnerships().listAllSponsorPasses({ includeRevoked: true, limit: 50, offset: 0 });
|
|
894
|
+
* console.log('Total passes:', all.count);
|
|
895
|
+
* ```
|
|
896
|
+
*/
|
|
897
|
+
listAllSponsorPasses(payload?: ListAllSponsorPassesParams): Promise<PaginatedResponse<SponsorPass>>;
|
|
898
|
+
listSponsors(payload?: ListSponsorsParams): Promise<PaginatedResponse<Sponsor>>;
|
|
899
|
+
getSponsor(payload: {
|
|
900
|
+
id: number;
|
|
901
|
+
}): Promise<Sponsor>;
|
|
902
|
+
/**
|
|
903
|
+
* Retrieve a specific SponsorPass by ID
|
|
904
|
+
* Requires permission: `partnerships:getSponsorPass` or `partnerships:*`
|
|
905
|
+
*
|
|
906
|
+
* @param payload.id - SponsorPass ID
|
|
907
|
+
* @returns SponsorPass
|
|
908
|
+
*
|
|
909
|
+
* @example
|
|
910
|
+
* ```typescript
|
|
911
|
+
* const pass = await sdk.getPartnerships().getSponsorPass({ id: 123 });
|
|
912
|
+
* console.log('SponsorPass:', pass);
|
|
913
|
+
* ```
|
|
914
|
+
*/
|
|
915
|
+
getSponsorPass(payload: {
|
|
916
|
+
id: number;
|
|
917
|
+
}): Promise<SponsorPass>;
|
|
918
|
+
/**
|
|
919
|
+
* Revoke a SponsorPass by ID
|
|
920
|
+
* Requires permission: `partnerships:revokeSponsorPass` or `partnerships:*`
|
|
921
|
+
*
|
|
922
|
+
* Note: backend revokes (does not delete).
|
|
923
|
+
*
|
|
924
|
+
* @param payload.id - SponsorPass ID
|
|
925
|
+
*
|
|
926
|
+
* @example
|
|
927
|
+
* ```typescript
|
|
928
|
+
* await sdk.getPartnerships().revokeSponsorPass({ id: 123 });
|
|
929
|
+
* ```
|
|
930
|
+
*/
|
|
931
|
+
revokeSponsorPass(payload: {
|
|
932
|
+
id: number;
|
|
933
|
+
}): Promise<void>;
|
|
934
|
+
}
|
|
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
|
+
|
|
639
1444
|
declare class FrontierSDK {
|
|
640
1445
|
private requestId;
|
|
641
1446
|
private pendingRequests;
|
|
@@ -643,6 +1448,8 @@ declare class FrontierSDK {
|
|
|
643
1448
|
private storage;
|
|
644
1449
|
private chain;
|
|
645
1450
|
private user;
|
|
1451
|
+
private partnerships;
|
|
1452
|
+
private thirdParty;
|
|
646
1453
|
constructor();
|
|
647
1454
|
private handleMessage;
|
|
648
1455
|
/**
|
|
@@ -667,6 +1474,14 @@ declare class FrontierSDK {
|
|
|
667
1474
|
* Get user access instance
|
|
668
1475
|
*/
|
|
669
1476
|
getUser(): UserAccess;
|
|
1477
|
+
/**
|
|
1478
|
+
* Get partnerships access instance
|
|
1479
|
+
*/
|
|
1480
|
+
getPartnerships(): PartnershipsAccess;
|
|
1481
|
+
/**
|
|
1482
|
+
* Get third-party access instance
|
|
1483
|
+
*/
|
|
1484
|
+
getThirdParty(): ThirdPartyAccess;
|
|
670
1485
|
/**
|
|
671
1486
|
* Cleanup: Remove event listeners
|
|
672
1487
|
* Call this when your app is being destroyed
|
|
@@ -686,4 +1501,4 @@ interface SDKResponse {
|
|
|
686
1501
|
error?: string;
|
|
687
1502
|
}
|
|
688
1503
|
|
|
689
|
-
export { ChainAccess, type ChainConfig, type ExecuteCall, FrontierSDK, type GasOverrides, type PaginatedResponse, type ReferralDetails, type ReferralOverview, type SDKRequest, type SDKResponse, type SmartAccount, StorageAccess, 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 };
|