@frontiertower/frontier-sdk 0.5.0 → 0.9.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 +21 -4
- package/dist/{chunk-7VB6TETG.mjs → chunk-HCHF3YXU.mjs} +12 -4
- package/dist/index.d.mts +514 -1
- package/dist/index.d.ts +514 -1
- package/dist/index.js +303 -4
- package/dist/index.mjs +299 -1
- package/dist/ui-utils/index.d.mts +5 -1
- package/dist/ui-utils/index.d.ts +5 -1
- package/dist/ui-utils/index.js +13 -4
- package/dist/ui-utils/index.mjs +3 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -25,6 +25,7 @@ __export(index_exports, {
|
|
|
25
25
|
PartnershipsAccess: () => PartnershipsAccess,
|
|
26
26
|
StorageAccess: () => StorageAccess,
|
|
27
27
|
SwapResultStatus: () => SwapResultStatus,
|
|
28
|
+
ThirdPartyAccess: () => ThirdPartyAccess,
|
|
28
29
|
UserAccess: () => UserAccess,
|
|
29
30
|
WalletAccess: () => WalletAccess,
|
|
30
31
|
createStandaloneHTML: () => createStandaloneHTML,
|
|
@@ -713,6 +714,296 @@ var PartnershipsAccess = class {
|
|
|
713
714
|
}
|
|
714
715
|
};
|
|
715
716
|
|
|
717
|
+
// src/access/third-party.ts
|
|
718
|
+
var ThirdPartyAccess = class {
|
|
719
|
+
constructor(sdk) {
|
|
720
|
+
this.sdk = sdk;
|
|
721
|
+
}
|
|
722
|
+
// ===========================================================================
|
|
723
|
+
// Developer Methods
|
|
724
|
+
// ===========================================================================
|
|
725
|
+
/**
|
|
726
|
+
* List developer accounts (paginated)
|
|
727
|
+
* Requires permission: `thirdParty:listDevelopers` or `thirdParty:*`
|
|
728
|
+
*
|
|
729
|
+
* @param payload.limit - Maximum number of results to return
|
|
730
|
+
* @param payload.offset - Offset into the result set
|
|
731
|
+
* @returns Paginated response of developers
|
|
732
|
+
*
|
|
733
|
+
* @example
|
|
734
|
+
* ```typescript
|
|
735
|
+
* const developers = await sdk.getThirdParty().listDevelopers({ limit: 20, offset: 0 });
|
|
736
|
+
* console.log('Total developers:', developers.count);
|
|
737
|
+
* ```
|
|
738
|
+
*/
|
|
739
|
+
async listDevelopers(payload) {
|
|
740
|
+
return this.sdk.request("thirdParty:listDevelopers", payload);
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* Get developer details by ID
|
|
744
|
+
* Requires permission: `thirdParty:getDeveloper` or `thirdParty:*`
|
|
745
|
+
*
|
|
746
|
+
* @param payload.id - Developer ID
|
|
747
|
+
* @returns Developer details
|
|
748
|
+
*
|
|
749
|
+
* @example
|
|
750
|
+
* ```typescript
|
|
751
|
+
* const developer = await sdk.getThirdParty().getDeveloper({ id: 123 });
|
|
752
|
+
* console.log('Developer:', developer.name);
|
|
753
|
+
* ```
|
|
754
|
+
*/
|
|
755
|
+
async getDeveloper(payload) {
|
|
756
|
+
return this.sdk.request("thirdParty:getDeveloper", payload);
|
|
757
|
+
}
|
|
758
|
+
/**
|
|
759
|
+
* Update developer information
|
|
760
|
+
* Requires permission: `thirdParty:updateDeveloper` or `thirdParty:*`
|
|
761
|
+
*
|
|
762
|
+
* @param payload.id - Developer ID
|
|
763
|
+
* @param payload.data - Update data
|
|
764
|
+
* @returns Updated developer
|
|
765
|
+
*
|
|
766
|
+
* @example
|
|
767
|
+
* ```typescript
|
|
768
|
+
* const developer = await sdk.getThirdParty().updateDeveloper({
|
|
769
|
+
* id: 123,
|
|
770
|
+
* data: { name: 'New Name', website: 'https://example.com' }
|
|
771
|
+
* });
|
|
772
|
+
* ```
|
|
773
|
+
*/
|
|
774
|
+
async updateDeveloper(payload) {
|
|
775
|
+
return this.sdk.request("thirdParty:updateDeveloper", payload);
|
|
776
|
+
}
|
|
777
|
+
/**
|
|
778
|
+
* Rotate developer API key
|
|
779
|
+
* Requires permission: `thirdParty:rotateDeveloperApiKey` or `thirdParty:*`
|
|
780
|
+
*
|
|
781
|
+
* Note: The new API key is only shown once in the response
|
|
782
|
+
*
|
|
783
|
+
* @param payload.id - Developer ID
|
|
784
|
+
* @returns Response containing the new API key
|
|
785
|
+
*
|
|
786
|
+
* @example
|
|
787
|
+
* ```typescript
|
|
788
|
+
* const result = await sdk.getThirdParty().rotateDeveloperApiKey({ id: 123 });
|
|
789
|
+
* console.log('New API key:', result.apiKey);
|
|
790
|
+
* // Store this key securely - it won't be shown again!
|
|
791
|
+
* ```
|
|
792
|
+
*/
|
|
793
|
+
async rotateDeveloperApiKey(payload) {
|
|
794
|
+
return this.sdk.request("thirdParty:rotateDeveloperApiKey", payload);
|
|
795
|
+
}
|
|
796
|
+
// ===========================================================================
|
|
797
|
+
// App Methods
|
|
798
|
+
// ===========================================================================
|
|
799
|
+
/**
|
|
800
|
+
* List registered apps (paginated)
|
|
801
|
+
* Requires permission: `thirdParty:listApps` or `thirdParty:*`
|
|
802
|
+
*
|
|
803
|
+
* @param payload.limit - Maximum number of results to return
|
|
804
|
+
* @param payload.offset - Offset into the result set
|
|
805
|
+
* @param payload.developerId - Filter by developer ID
|
|
806
|
+
* @returns Paginated response of apps
|
|
807
|
+
*
|
|
808
|
+
* @example
|
|
809
|
+
* ```typescript
|
|
810
|
+
* const apps = await sdk.getThirdParty().listApps({ limit: 20, offset: 0 });
|
|
811
|
+
* console.log('Total apps:', apps.count);
|
|
812
|
+
*
|
|
813
|
+
* // Filter by developer
|
|
814
|
+
* const devApps = await sdk.getThirdParty().listApps({ developerId: 123 });
|
|
815
|
+
* ```
|
|
816
|
+
*/
|
|
817
|
+
async listApps(payload) {
|
|
818
|
+
return this.sdk.request("thirdParty:listApps", payload);
|
|
819
|
+
}
|
|
820
|
+
/**
|
|
821
|
+
* Register a new app
|
|
822
|
+
* Requires permission: `thirdParty:createApp` or `thirdParty:*`
|
|
823
|
+
*
|
|
824
|
+
* Note: App name, description, and icon are automatically fetched from the URL's metadata
|
|
825
|
+
*
|
|
826
|
+
* @param payload - App creation payload with URL
|
|
827
|
+
* @returns Created app
|
|
828
|
+
*
|
|
829
|
+
* @example
|
|
830
|
+
* ```typescript
|
|
831
|
+
* const app = await sdk.getThirdParty().createApp({
|
|
832
|
+
* url: 'https://myapp.example.com'
|
|
833
|
+
* });
|
|
834
|
+
* console.log('Created app:', app.id, app.name);
|
|
835
|
+
* ```
|
|
836
|
+
*/
|
|
837
|
+
async createApp(payload) {
|
|
838
|
+
return this.sdk.request("thirdParty:createApp", payload);
|
|
839
|
+
}
|
|
840
|
+
/**
|
|
841
|
+
* Get app details by ID
|
|
842
|
+
* Requires permission: `thirdParty:getApp` or `thirdParty:*`
|
|
843
|
+
*
|
|
844
|
+
* @param payload.id - App ID
|
|
845
|
+
* @returns App details
|
|
846
|
+
*
|
|
847
|
+
* @example
|
|
848
|
+
* ```typescript
|
|
849
|
+
* const app = await sdk.getThirdParty().getApp({ id: 123 });
|
|
850
|
+
* console.log('App:', app.name, app.status);
|
|
851
|
+
* ```
|
|
852
|
+
*/
|
|
853
|
+
async getApp(payload) {
|
|
854
|
+
return this.sdk.request("thirdParty:getApp", payload);
|
|
855
|
+
}
|
|
856
|
+
/**
|
|
857
|
+
* Update an app
|
|
858
|
+
* Requires permission: `thirdParty:updateApp` or `thirdParty:*`
|
|
859
|
+
*
|
|
860
|
+
* @param payload.id - App ID
|
|
861
|
+
* @param payload.data - Update data
|
|
862
|
+
* @returns Updated app
|
|
863
|
+
*
|
|
864
|
+
* @example
|
|
865
|
+
* ```typescript
|
|
866
|
+
* const app = await sdk.getThirdParty().updateApp({
|
|
867
|
+
* id: 123,
|
|
868
|
+
* data: { name: 'Updated App Name', description: 'New description' }
|
|
869
|
+
* });
|
|
870
|
+
* ```
|
|
871
|
+
*/
|
|
872
|
+
async updateApp(payload) {
|
|
873
|
+
return this.sdk.request("thirdParty:updateApp", payload);
|
|
874
|
+
}
|
|
875
|
+
/**
|
|
876
|
+
* Request app deactivation
|
|
877
|
+
* Requires permission: `thirdParty:deleteApp` or `thirdParty:*`
|
|
878
|
+
*
|
|
879
|
+
* @param payload.id - App ID
|
|
880
|
+
*
|
|
881
|
+
* @example
|
|
882
|
+
* ```typescript
|
|
883
|
+
* await sdk.getThirdParty().deleteApp({ id: 123 });
|
|
884
|
+
* ```
|
|
885
|
+
*/
|
|
886
|
+
async deleteApp(payload) {
|
|
887
|
+
return this.sdk.request("thirdParty:deleteApp", payload);
|
|
888
|
+
}
|
|
889
|
+
// ===========================================================================
|
|
890
|
+
// Webhook Methods
|
|
891
|
+
// ===========================================================================
|
|
892
|
+
/**
|
|
893
|
+
* List webhooks (paginated)
|
|
894
|
+
* Requires permission: `thirdParty:listWebhooks` or `thirdParty:*`
|
|
895
|
+
*
|
|
896
|
+
* Note: Maximum 3 webhooks per developer account
|
|
897
|
+
*
|
|
898
|
+
* @param payload.limit - Maximum number of results to return
|
|
899
|
+
* @param payload.offset - Offset into the result set
|
|
900
|
+
* @param payload.developerId - Filter by developer ID
|
|
901
|
+
* @returns Paginated response of webhooks
|
|
902
|
+
*
|
|
903
|
+
* @example
|
|
904
|
+
* ```typescript
|
|
905
|
+
* const webhooks = await sdk.getThirdParty().listWebhooks({ limit: 10, offset: 0 });
|
|
906
|
+
* console.log('Total webhooks:', webhooks.count);
|
|
907
|
+
*
|
|
908
|
+
* // Filter by developer
|
|
909
|
+
* const devWebhooks = await sdk.getThirdParty().listWebhooks({ developerId: 123 });
|
|
910
|
+
* ```
|
|
911
|
+
*/
|
|
912
|
+
async listWebhooks(payload) {
|
|
913
|
+
return this.sdk.request("thirdParty:listWebhooks", payload);
|
|
914
|
+
}
|
|
915
|
+
/**
|
|
916
|
+
* Create a new webhook
|
|
917
|
+
* Requires permission: `thirdParty:createWebhook` or `thirdParty:*`
|
|
918
|
+
*
|
|
919
|
+
* Note: New webhooks require admin approval before going live
|
|
920
|
+
*
|
|
921
|
+
* @param payload - Webhook creation payload
|
|
922
|
+
* @returns Created webhook
|
|
923
|
+
*
|
|
924
|
+
* @example
|
|
925
|
+
* ```typescript
|
|
926
|
+
* const webhook = await sdk.getThirdParty().createWebhook({
|
|
927
|
+
* url: 'https://myapp.example.com/webhooks',
|
|
928
|
+
* events: ['app.approved', 'user.registered']
|
|
929
|
+
* });
|
|
930
|
+
* console.log('Created webhook:', webhook.id);
|
|
931
|
+
* ```
|
|
932
|
+
*/
|
|
933
|
+
async createWebhook(payload) {
|
|
934
|
+
return this.sdk.request("thirdParty:createWebhook", payload);
|
|
935
|
+
}
|
|
936
|
+
/**
|
|
937
|
+
* Get webhook details by ID
|
|
938
|
+
* Requires permission: `thirdParty:getWebhook` or `thirdParty:*`
|
|
939
|
+
*
|
|
940
|
+
* @param payload.id - Webhook ID
|
|
941
|
+
* @returns Webhook details
|
|
942
|
+
*
|
|
943
|
+
* @example
|
|
944
|
+
* ```typescript
|
|
945
|
+
* const webhook = await sdk.getThirdParty().getWebhook({ id: 123 });
|
|
946
|
+
* console.log('Webhook:', webhook.url, webhook.status);
|
|
947
|
+
* ```
|
|
948
|
+
*/
|
|
949
|
+
async getWebhook(payload) {
|
|
950
|
+
return this.sdk.request("thirdParty:getWebhook", payload);
|
|
951
|
+
}
|
|
952
|
+
/**
|
|
953
|
+
* Update a webhook
|
|
954
|
+
* Requires permission: `thirdParty:updateWebhook` or `thirdParty:*`
|
|
955
|
+
*
|
|
956
|
+
* Note: Config changes require admin approval before going live
|
|
957
|
+
*
|
|
958
|
+
* @param payload.id - Webhook ID
|
|
959
|
+
* @param payload.data - Update data
|
|
960
|
+
* @returns Updated webhook
|
|
961
|
+
*
|
|
962
|
+
* @example
|
|
963
|
+
* ```typescript
|
|
964
|
+
* const webhook = await sdk.getThirdParty().updateWebhook({
|
|
965
|
+
* id: 123,
|
|
966
|
+
* data: { url: 'https://newurl.example.com/webhooks' }
|
|
967
|
+
* });
|
|
968
|
+
* ```
|
|
969
|
+
*/
|
|
970
|
+
async updateWebhook(payload) {
|
|
971
|
+
return this.sdk.request("thirdParty:updateWebhook", payload);
|
|
972
|
+
}
|
|
973
|
+
/**
|
|
974
|
+
* Delete a webhook
|
|
975
|
+
* Requires permission: `thirdParty:deleteWebhook` or `thirdParty:*`
|
|
976
|
+
*
|
|
977
|
+
* @param payload.id - Webhook ID
|
|
978
|
+
*
|
|
979
|
+
* @example
|
|
980
|
+
* ```typescript
|
|
981
|
+
* await sdk.getThirdParty().deleteWebhook({ id: 123 });
|
|
982
|
+
* ```
|
|
983
|
+
*/
|
|
984
|
+
async deleteWebhook(payload) {
|
|
985
|
+
return this.sdk.request("thirdParty:deleteWebhook", payload);
|
|
986
|
+
}
|
|
987
|
+
/**
|
|
988
|
+
* Rotate webhook signing key
|
|
989
|
+
* Requires permission: `thirdParty:rotateWebhookSigningKey` or `thirdParty:*`
|
|
990
|
+
*
|
|
991
|
+
* Note: The new signing public key is returned in the response
|
|
992
|
+
*
|
|
993
|
+
* @param payload.id - Webhook ID
|
|
994
|
+
* @returns Response containing the new signing public key
|
|
995
|
+
*
|
|
996
|
+
* @example
|
|
997
|
+
* ```typescript
|
|
998
|
+
* const result = await sdk.getThirdParty().rotateWebhookSigningKey({ id: 123 });
|
|
999
|
+
* console.log('New signing key:', result.signingPublicKey);
|
|
1000
|
+
* ```
|
|
1001
|
+
*/
|
|
1002
|
+
async rotateWebhookSigningKey(payload) {
|
|
1003
|
+
return this.sdk.request("thirdParty:rotateWebhookSigningKey", payload);
|
|
1004
|
+
}
|
|
1005
|
+
};
|
|
1006
|
+
|
|
716
1007
|
// src/sdk.ts
|
|
717
1008
|
var FrontierSDK = class {
|
|
718
1009
|
constructor() {
|
|
@@ -736,6 +1027,7 @@ var FrontierSDK = class {
|
|
|
736
1027
|
this.chain = new ChainAccess(this);
|
|
737
1028
|
this.user = new UserAccess(this);
|
|
738
1029
|
this.partnerships = new PartnershipsAccess(this);
|
|
1030
|
+
this.thirdParty = new ThirdPartyAccess(this);
|
|
739
1031
|
window.addEventListener("message", this.handleMessage);
|
|
740
1032
|
this.notifyReady();
|
|
741
1033
|
}
|
|
@@ -790,6 +1082,12 @@ var FrontierSDK = class {
|
|
|
790
1082
|
getPartnerships() {
|
|
791
1083
|
return this.partnerships;
|
|
792
1084
|
}
|
|
1085
|
+
/**
|
|
1086
|
+
* Get third-party access instance
|
|
1087
|
+
*/
|
|
1088
|
+
getThirdParty() {
|
|
1089
|
+
return this.thirdParty;
|
|
1090
|
+
}
|
|
793
1091
|
/**
|
|
794
1092
|
* Cleanup: Remove event listeners
|
|
795
1093
|
* Call this when your app is being destroyed
|
|
@@ -881,7 +1179,7 @@ function renderStandaloneMessage(container, appName = "Frontier App") {
|
|
|
881
1179
|
color: #4a5568;
|
|
882
1180
|
line-height: 1.8;
|
|
883
1181
|
">
|
|
884
|
-
<li>Visit <a href="https://
|
|
1182
|
+
<li>Visit <a href="https://os.frontiertower.io" style="color: #667eea; text-decoration: underline; font-weight: 500;">os.frontiertower.io</a></li>
|
|
885
1183
|
<li>Go to the App Store</li>
|
|
886
1184
|
<li>Install this app</li>
|
|
887
1185
|
</ol>
|
|
@@ -893,7 +1191,7 @@ function renderStandaloneMessage(container, appName = "Frontier App") {
|
|
|
893
1191
|
border-top: 1px solid #e2e8f0;
|
|
894
1192
|
">
|
|
895
1193
|
<a
|
|
896
|
-
href="https://
|
|
1194
|
+
href="https://os.frontiertower.io"
|
|
897
1195
|
style="
|
|
898
1196
|
display: inline-block;
|
|
899
1197
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
@@ -975,7 +1273,7 @@ function createStandaloneHTML(appName = "Frontier App") {
|
|
|
975
1273
|
color: #4a5568;
|
|
976
1274
|
line-height: 1.8;
|
|
977
1275
|
">
|
|
978
|
-
<li>Visit <a href="https://
|
|
1276
|
+
<li>Visit <a href="https://os.frontiertower.io" style="color: #667eea; text-decoration: underline; font-weight: 500;">os.frontiertower.io</a></li>
|
|
979
1277
|
<li>Go to the App Store</li>
|
|
980
1278
|
<li>Install this app</li>
|
|
981
1279
|
</ol>
|
|
@@ -987,7 +1285,7 @@ function createStandaloneHTML(appName = "Frontier App") {
|
|
|
987
1285
|
border-top: 1px solid #e2e8f0;
|
|
988
1286
|
">
|
|
989
1287
|
<a
|
|
990
|
-
href="https://
|
|
1288
|
+
href="https://os.frontiertower.io"
|
|
991
1289
|
style="
|
|
992
1290
|
display: inline-block;
|
|
993
1291
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
@@ -1015,6 +1313,7 @@ function createStandaloneHTML(appName = "Frontier App") {
|
|
|
1015
1313
|
PartnershipsAccess,
|
|
1016
1314
|
StorageAccess,
|
|
1017
1315
|
SwapResultStatus,
|
|
1316
|
+
ThirdPartyAccess,
|
|
1018
1317
|
UserAccess,
|
|
1019
1318
|
WalletAccess,
|
|
1020
1319
|
createStandaloneHTML,
|
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
getParentOrigin,
|
|
4
4
|
isInFrontierApp,
|
|
5
5
|
renderStandaloneMessage
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-HCHF3YXU.mjs";
|
|
7
7
|
|
|
8
8
|
// src/access/wallet.ts
|
|
9
9
|
var SwapResultStatus = /* @__PURE__ */ ((SwapResultStatus2) => {
|
|
@@ -684,6 +684,296 @@ var PartnershipsAccess = class {
|
|
|
684
684
|
}
|
|
685
685
|
};
|
|
686
686
|
|
|
687
|
+
// src/access/third-party.ts
|
|
688
|
+
var ThirdPartyAccess = class {
|
|
689
|
+
constructor(sdk) {
|
|
690
|
+
this.sdk = sdk;
|
|
691
|
+
}
|
|
692
|
+
// ===========================================================================
|
|
693
|
+
// Developer Methods
|
|
694
|
+
// ===========================================================================
|
|
695
|
+
/**
|
|
696
|
+
* List developer accounts (paginated)
|
|
697
|
+
* Requires permission: `thirdParty:listDevelopers` or `thirdParty:*`
|
|
698
|
+
*
|
|
699
|
+
* @param payload.limit - Maximum number of results to return
|
|
700
|
+
* @param payload.offset - Offset into the result set
|
|
701
|
+
* @returns Paginated response of developers
|
|
702
|
+
*
|
|
703
|
+
* @example
|
|
704
|
+
* ```typescript
|
|
705
|
+
* const developers = await sdk.getThirdParty().listDevelopers({ limit: 20, offset: 0 });
|
|
706
|
+
* console.log('Total developers:', developers.count);
|
|
707
|
+
* ```
|
|
708
|
+
*/
|
|
709
|
+
async listDevelopers(payload) {
|
|
710
|
+
return this.sdk.request("thirdParty:listDevelopers", payload);
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* Get developer details by ID
|
|
714
|
+
* Requires permission: `thirdParty:getDeveloper` or `thirdParty:*`
|
|
715
|
+
*
|
|
716
|
+
* @param payload.id - Developer ID
|
|
717
|
+
* @returns Developer details
|
|
718
|
+
*
|
|
719
|
+
* @example
|
|
720
|
+
* ```typescript
|
|
721
|
+
* const developer = await sdk.getThirdParty().getDeveloper({ id: 123 });
|
|
722
|
+
* console.log('Developer:', developer.name);
|
|
723
|
+
* ```
|
|
724
|
+
*/
|
|
725
|
+
async getDeveloper(payload) {
|
|
726
|
+
return this.sdk.request("thirdParty:getDeveloper", payload);
|
|
727
|
+
}
|
|
728
|
+
/**
|
|
729
|
+
* Update developer information
|
|
730
|
+
* Requires permission: `thirdParty:updateDeveloper` or `thirdParty:*`
|
|
731
|
+
*
|
|
732
|
+
* @param payload.id - Developer ID
|
|
733
|
+
* @param payload.data - Update data
|
|
734
|
+
* @returns Updated developer
|
|
735
|
+
*
|
|
736
|
+
* @example
|
|
737
|
+
* ```typescript
|
|
738
|
+
* const developer = await sdk.getThirdParty().updateDeveloper({
|
|
739
|
+
* id: 123,
|
|
740
|
+
* data: { name: 'New Name', website: 'https://example.com' }
|
|
741
|
+
* });
|
|
742
|
+
* ```
|
|
743
|
+
*/
|
|
744
|
+
async updateDeveloper(payload) {
|
|
745
|
+
return this.sdk.request("thirdParty:updateDeveloper", payload);
|
|
746
|
+
}
|
|
747
|
+
/**
|
|
748
|
+
* Rotate developer API key
|
|
749
|
+
* Requires permission: `thirdParty:rotateDeveloperApiKey` or `thirdParty:*`
|
|
750
|
+
*
|
|
751
|
+
* Note: The new API key is only shown once in the response
|
|
752
|
+
*
|
|
753
|
+
* @param payload.id - Developer ID
|
|
754
|
+
* @returns Response containing the new API key
|
|
755
|
+
*
|
|
756
|
+
* @example
|
|
757
|
+
* ```typescript
|
|
758
|
+
* const result = await sdk.getThirdParty().rotateDeveloperApiKey({ id: 123 });
|
|
759
|
+
* console.log('New API key:', result.apiKey);
|
|
760
|
+
* // Store this key securely - it won't be shown again!
|
|
761
|
+
* ```
|
|
762
|
+
*/
|
|
763
|
+
async rotateDeveloperApiKey(payload) {
|
|
764
|
+
return this.sdk.request("thirdParty:rotateDeveloperApiKey", payload);
|
|
765
|
+
}
|
|
766
|
+
// ===========================================================================
|
|
767
|
+
// App Methods
|
|
768
|
+
// ===========================================================================
|
|
769
|
+
/**
|
|
770
|
+
* List registered apps (paginated)
|
|
771
|
+
* Requires permission: `thirdParty:listApps` or `thirdParty:*`
|
|
772
|
+
*
|
|
773
|
+
* @param payload.limit - Maximum number of results to return
|
|
774
|
+
* @param payload.offset - Offset into the result set
|
|
775
|
+
* @param payload.developerId - Filter by developer ID
|
|
776
|
+
* @returns Paginated response of apps
|
|
777
|
+
*
|
|
778
|
+
* @example
|
|
779
|
+
* ```typescript
|
|
780
|
+
* const apps = await sdk.getThirdParty().listApps({ limit: 20, offset: 0 });
|
|
781
|
+
* console.log('Total apps:', apps.count);
|
|
782
|
+
*
|
|
783
|
+
* // Filter by developer
|
|
784
|
+
* const devApps = await sdk.getThirdParty().listApps({ developerId: 123 });
|
|
785
|
+
* ```
|
|
786
|
+
*/
|
|
787
|
+
async listApps(payload) {
|
|
788
|
+
return this.sdk.request("thirdParty:listApps", payload);
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
791
|
+
* Register a new app
|
|
792
|
+
* Requires permission: `thirdParty:createApp` or `thirdParty:*`
|
|
793
|
+
*
|
|
794
|
+
* Note: App name, description, and icon are automatically fetched from the URL's metadata
|
|
795
|
+
*
|
|
796
|
+
* @param payload - App creation payload with URL
|
|
797
|
+
* @returns Created app
|
|
798
|
+
*
|
|
799
|
+
* @example
|
|
800
|
+
* ```typescript
|
|
801
|
+
* const app = await sdk.getThirdParty().createApp({
|
|
802
|
+
* url: 'https://myapp.example.com'
|
|
803
|
+
* });
|
|
804
|
+
* console.log('Created app:', app.id, app.name);
|
|
805
|
+
* ```
|
|
806
|
+
*/
|
|
807
|
+
async createApp(payload) {
|
|
808
|
+
return this.sdk.request("thirdParty:createApp", payload);
|
|
809
|
+
}
|
|
810
|
+
/**
|
|
811
|
+
* Get app details by ID
|
|
812
|
+
* Requires permission: `thirdParty:getApp` or `thirdParty:*`
|
|
813
|
+
*
|
|
814
|
+
* @param payload.id - App ID
|
|
815
|
+
* @returns App details
|
|
816
|
+
*
|
|
817
|
+
* @example
|
|
818
|
+
* ```typescript
|
|
819
|
+
* const app = await sdk.getThirdParty().getApp({ id: 123 });
|
|
820
|
+
* console.log('App:', app.name, app.status);
|
|
821
|
+
* ```
|
|
822
|
+
*/
|
|
823
|
+
async getApp(payload) {
|
|
824
|
+
return this.sdk.request("thirdParty:getApp", payload);
|
|
825
|
+
}
|
|
826
|
+
/**
|
|
827
|
+
* Update an app
|
|
828
|
+
* Requires permission: `thirdParty:updateApp` or `thirdParty:*`
|
|
829
|
+
*
|
|
830
|
+
* @param payload.id - App ID
|
|
831
|
+
* @param payload.data - Update data
|
|
832
|
+
* @returns Updated app
|
|
833
|
+
*
|
|
834
|
+
* @example
|
|
835
|
+
* ```typescript
|
|
836
|
+
* const app = await sdk.getThirdParty().updateApp({
|
|
837
|
+
* id: 123,
|
|
838
|
+
* data: { name: 'Updated App Name', description: 'New description' }
|
|
839
|
+
* });
|
|
840
|
+
* ```
|
|
841
|
+
*/
|
|
842
|
+
async updateApp(payload) {
|
|
843
|
+
return this.sdk.request("thirdParty:updateApp", payload);
|
|
844
|
+
}
|
|
845
|
+
/**
|
|
846
|
+
* Request app deactivation
|
|
847
|
+
* Requires permission: `thirdParty:deleteApp` or `thirdParty:*`
|
|
848
|
+
*
|
|
849
|
+
* @param payload.id - App ID
|
|
850
|
+
*
|
|
851
|
+
* @example
|
|
852
|
+
* ```typescript
|
|
853
|
+
* await sdk.getThirdParty().deleteApp({ id: 123 });
|
|
854
|
+
* ```
|
|
855
|
+
*/
|
|
856
|
+
async deleteApp(payload) {
|
|
857
|
+
return this.sdk.request("thirdParty:deleteApp", payload);
|
|
858
|
+
}
|
|
859
|
+
// ===========================================================================
|
|
860
|
+
// Webhook Methods
|
|
861
|
+
// ===========================================================================
|
|
862
|
+
/**
|
|
863
|
+
* List webhooks (paginated)
|
|
864
|
+
* Requires permission: `thirdParty:listWebhooks` or `thirdParty:*`
|
|
865
|
+
*
|
|
866
|
+
* Note: Maximum 3 webhooks per developer account
|
|
867
|
+
*
|
|
868
|
+
* @param payload.limit - Maximum number of results to return
|
|
869
|
+
* @param payload.offset - Offset into the result set
|
|
870
|
+
* @param payload.developerId - Filter by developer ID
|
|
871
|
+
* @returns Paginated response of webhooks
|
|
872
|
+
*
|
|
873
|
+
* @example
|
|
874
|
+
* ```typescript
|
|
875
|
+
* const webhooks = await sdk.getThirdParty().listWebhooks({ limit: 10, offset: 0 });
|
|
876
|
+
* console.log('Total webhooks:', webhooks.count);
|
|
877
|
+
*
|
|
878
|
+
* // Filter by developer
|
|
879
|
+
* const devWebhooks = await sdk.getThirdParty().listWebhooks({ developerId: 123 });
|
|
880
|
+
* ```
|
|
881
|
+
*/
|
|
882
|
+
async listWebhooks(payload) {
|
|
883
|
+
return this.sdk.request("thirdParty:listWebhooks", payload);
|
|
884
|
+
}
|
|
885
|
+
/**
|
|
886
|
+
* Create a new webhook
|
|
887
|
+
* Requires permission: `thirdParty:createWebhook` or `thirdParty:*`
|
|
888
|
+
*
|
|
889
|
+
* Note: New webhooks require admin approval before going live
|
|
890
|
+
*
|
|
891
|
+
* @param payload - Webhook creation payload
|
|
892
|
+
* @returns Created webhook
|
|
893
|
+
*
|
|
894
|
+
* @example
|
|
895
|
+
* ```typescript
|
|
896
|
+
* const webhook = await sdk.getThirdParty().createWebhook({
|
|
897
|
+
* url: 'https://myapp.example.com/webhooks',
|
|
898
|
+
* events: ['app.approved', 'user.registered']
|
|
899
|
+
* });
|
|
900
|
+
* console.log('Created webhook:', webhook.id);
|
|
901
|
+
* ```
|
|
902
|
+
*/
|
|
903
|
+
async createWebhook(payload) {
|
|
904
|
+
return this.sdk.request("thirdParty:createWebhook", payload);
|
|
905
|
+
}
|
|
906
|
+
/**
|
|
907
|
+
* Get webhook details by ID
|
|
908
|
+
* Requires permission: `thirdParty:getWebhook` or `thirdParty:*`
|
|
909
|
+
*
|
|
910
|
+
* @param payload.id - Webhook ID
|
|
911
|
+
* @returns Webhook details
|
|
912
|
+
*
|
|
913
|
+
* @example
|
|
914
|
+
* ```typescript
|
|
915
|
+
* const webhook = await sdk.getThirdParty().getWebhook({ id: 123 });
|
|
916
|
+
* console.log('Webhook:', webhook.url, webhook.status);
|
|
917
|
+
* ```
|
|
918
|
+
*/
|
|
919
|
+
async getWebhook(payload) {
|
|
920
|
+
return this.sdk.request("thirdParty:getWebhook", payload);
|
|
921
|
+
}
|
|
922
|
+
/**
|
|
923
|
+
* Update a webhook
|
|
924
|
+
* Requires permission: `thirdParty:updateWebhook` or `thirdParty:*`
|
|
925
|
+
*
|
|
926
|
+
* Note: Config changes require admin approval before going live
|
|
927
|
+
*
|
|
928
|
+
* @param payload.id - Webhook ID
|
|
929
|
+
* @param payload.data - Update data
|
|
930
|
+
* @returns Updated webhook
|
|
931
|
+
*
|
|
932
|
+
* @example
|
|
933
|
+
* ```typescript
|
|
934
|
+
* const webhook = await sdk.getThirdParty().updateWebhook({
|
|
935
|
+
* id: 123,
|
|
936
|
+
* data: { url: 'https://newurl.example.com/webhooks' }
|
|
937
|
+
* });
|
|
938
|
+
* ```
|
|
939
|
+
*/
|
|
940
|
+
async updateWebhook(payload) {
|
|
941
|
+
return this.sdk.request("thirdParty:updateWebhook", payload);
|
|
942
|
+
}
|
|
943
|
+
/**
|
|
944
|
+
* Delete a webhook
|
|
945
|
+
* Requires permission: `thirdParty:deleteWebhook` or `thirdParty:*`
|
|
946
|
+
*
|
|
947
|
+
* @param payload.id - Webhook ID
|
|
948
|
+
*
|
|
949
|
+
* @example
|
|
950
|
+
* ```typescript
|
|
951
|
+
* await sdk.getThirdParty().deleteWebhook({ id: 123 });
|
|
952
|
+
* ```
|
|
953
|
+
*/
|
|
954
|
+
async deleteWebhook(payload) {
|
|
955
|
+
return this.sdk.request("thirdParty:deleteWebhook", payload);
|
|
956
|
+
}
|
|
957
|
+
/**
|
|
958
|
+
* Rotate webhook signing key
|
|
959
|
+
* Requires permission: `thirdParty:rotateWebhookSigningKey` or `thirdParty:*`
|
|
960
|
+
*
|
|
961
|
+
* Note: The new signing public key is returned in the response
|
|
962
|
+
*
|
|
963
|
+
* @param payload.id - Webhook ID
|
|
964
|
+
* @returns Response containing the new signing public key
|
|
965
|
+
*
|
|
966
|
+
* @example
|
|
967
|
+
* ```typescript
|
|
968
|
+
* const result = await sdk.getThirdParty().rotateWebhookSigningKey({ id: 123 });
|
|
969
|
+
* console.log('New signing key:', result.signingPublicKey);
|
|
970
|
+
* ```
|
|
971
|
+
*/
|
|
972
|
+
async rotateWebhookSigningKey(payload) {
|
|
973
|
+
return this.sdk.request("thirdParty:rotateWebhookSigningKey", payload);
|
|
974
|
+
}
|
|
975
|
+
};
|
|
976
|
+
|
|
687
977
|
// src/sdk.ts
|
|
688
978
|
var FrontierSDK = class {
|
|
689
979
|
constructor() {
|
|
@@ -707,6 +997,7 @@ var FrontierSDK = class {
|
|
|
707
997
|
this.chain = new ChainAccess(this);
|
|
708
998
|
this.user = new UserAccess(this);
|
|
709
999
|
this.partnerships = new PartnershipsAccess(this);
|
|
1000
|
+
this.thirdParty = new ThirdPartyAccess(this);
|
|
710
1001
|
window.addEventListener("message", this.handleMessage);
|
|
711
1002
|
this.notifyReady();
|
|
712
1003
|
}
|
|
@@ -761,6 +1052,12 @@ var FrontierSDK = class {
|
|
|
761
1052
|
getPartnerships() {
|
|
762
1053
|
return this.partnerships;
|
|
763
1054
|
}
|
|
1055
|
+
/**
|
|
1056
|
+
* Get third-party access instance
|
|
1057
|
+
*/
|
|
1058
|
+
getThirdParty() {
|
|
1059
|
+
return this.thirdParty;
|
|
1060
|
+
}
|
|
764
1061
|
/**
|
|
765
1062
|
* Cleanup: Remove event listeners
|
|
766
1063
|
* Call this when your app is being destroyed
|
|
@@ -776,6 +1073,7 @@ export {
|
|
|
776
1073
|
PartnershipsAccess,
|
|
777
1074
|
StorageAccess,
|
|
778
1075
|
SwapResultStatus,
|
|
1076
|
+
ThirdPartyAccess,
|
|
779
1077
|
UserAccess,
|
|
780
1078
|
WalletAccess,
|
|
781
1079
|
createStandaloneHTML,
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* List of allowed Frontier Wallet origins
|
|
3
|
+
*/
|
|
4
|
+
declare const ALLOWED_ORIGINS: string[];
|
|
1
5
|
/**
|
|
2
6
|
* Check if the app is running inside a Frontier Wallet iframe
|
|
3
7
|
* Simply checks if the window is embedded in an iframe
|
|
@@ -20,4 +24,4 @@ declare function renderStandaloneMessage(container: HTMLElement, appName?: strin
|
|
|
20
24
|
*/
|
|
21
25
|
declare function createStandaloneHTML(appName?: string): string;
|
|
22
26
|
|
|
23
|
-
export { createStandaloneHTML, getParentOrigin, isInFrontierApp, renderStandaloneMessage };
|
|
27
|
+
export { ALLOWED_ORIGINS, createStandaloneHTML, getParentOrigin, isInFrontierApp, renderStandaloneMessage };
|