@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.js
CHANGED
|
@@ -22,7 +22,10 @@ var index_exports = {};
|
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
ChainAccess: () => ChainAccess,
|
|
24
24
|
FrontierSDK: () => FrontierSDK,
|
|
25
|
+
PartnershipsAccess: () => PartnershipsAccess,
|
|
25
26
|
StorageAccess: () => StorageAccess,
|
|
27
|
+
SwapResultStatus: () => SwapResultStatus,
|
|
28
|
+
ThirdPartyAccess: () => ThirdPartyAccess,
|
|
26
29
|
UserAccess: () => UserAccess,
|
|
27
30
|
WalletAccess: () => WalletAccess,
|
|
28
31
|
createStandaloneHTML: () => createStandaloneHTML,
|
|
@@ -33,6 +36,11 @@ __export(index_exports, {
|
|
|
33
36
|
module.exports = __toCommonJS(index_exports);
|
|
34
37
|
|
|
35
38
|
// src/access/wallet.ts
|
|
39
|
+
var SwapResultStatus = /* @__PURE__ */ ((SwapResultStatus2) => {
|
|
40
|
+
SwapResultStatus2["COMPLETED"] = "COMPLETED";
|
|
41
|
+
SwapResultStatus2["SUBMITTED"] = "SUBMITTED";
|
|
42
|
+
return SwapResultStatus2;
|
|
43
|
+
})(SwapResultStatus || {});
|
|
36
44
|
var WalletAccess = class {
|
|
37
45
|
constructor(sdk) {
|
|
38
46
|
this.sdk = sdk;
|
|
@@ -263,6 +271,126 @@ var WalletAccess = class {
|
|
|
263
271
|
overrides
|
|
264
272
|
});
|
|
265
273
|
}
|
|
274
|
+
/**
|
|
275
|
+
* Execute multiple calls atomically with a single signature
|
|
276
|
+
*
|
|
277
|
+
* Executes multiple contract interactions in a single transaction.
|
|
278
|
+
* All calls are executed atomically - if one fails, all fail.
|
|
279
|
+
*
|
|
280
|
+
* @param calls - Array of execute call parameters
|
|
281
|
+
* @param overrides - Optional gas overrides
|
|
282
|
+
* @returns User operation receipt with transaction details
|
|
283
|
+
* @throws {Error} If any transaction fails
|
|
284
|
+
*
|
|
285
|
+
* @example
|
|
286
|
+
* ```typescript
|
|
287
|
+
* import { encodeFunctionData } from 'viem';
|
|
288
|
+
*
|
|
289
|
+
* const receipt = await sdk.getWallet().executeBatchCall([
|
|
290
|
+
* {
|
|
291
|
+
* to: '0xToken1',
|
|
292
|
+
* value: 0n,
|
|
293
|
+
* data: encodeFunctionData({ abi: erc20Abi, functionName: 'approve', args: [...] })
|
|
294
|
+
* },
|
|
295
|
+
* {
|
|
296
|
+
* to: '0xProtocol',
|
|
297
|
+
* value: 0n,
|
|
298
|
+
* data: encodeFunctionData({ abi: protocolAbi, functionName: 'deposit', args: [...] })
|
|
299
|
+
* }
|
|
300
|
+
* ]);
|
|
301
|
+
* ```
|
|
302
|
+
*/
|
|
303
|
+
async executeBatchCall(calls, overrides) {
|
|
304
|
+
return this.sdk.request("wallet:executeBatchCall", {
|
|
305
|
+
calls,
|
|
306
|
+
overrides
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Get list of supported token symbols for the current chain
|
|
311
|
+
*
|
|
312
|
+
* Returns an array of token symbols that are supported for swaps
|
|
313
|
+
* and other operations on the current network.
|
|
314
|
+
*
|
|
315
|
+
* @returns Array of token symbols (e.g., ['FTD', 'USDC', 'WETH'])
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* ```typescript
|
|
319
|
+
* const tokens = await sdk.getWallet().getSupportedTokens();
|
|
320
|
+
* console.log('Supported tokens:', tokens); // ['FTD', 'USDC', 'WETH']
|
|
321
|
+
* ```
|
|
322
|
+
*/
|
|
323
|
+
async getSupportedTokens() {
|
|
324
|
+
return this.sdk.request("wallet:getSupportedTokens");
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Execute a token swap
|
|
328
|
+
*
|
|
329
|
+
* @param sourceToken - Symbol of the token to swap from (e.g., 'USDC')
|
|
330
|
+
* @param targetToken - Symbol of the token to swap to (e.g., 'WETH')
|
|
331
|
+
* @param sourceNetwork - Network identifier for source chain (e.g., 'base')
|
|
332
|
+
* @param targetNetwork - Network identifier for target chain (e.g., 'ethereum')
|
|
333
|
+
* @param amount - Amount to swap in human-readable format (e.g., '100.5')
|
|
334
|
+
* @returns Swap result with status and transaction details
|
|
335
|
+
* @throws {Error} If swap fails or tokens/networks are not supported
|
|
336
|
+
*
|
|
337
|
+
* @example
|
|
338
|
+
* ```typescript
|
|
339
|
+
* const result = await sdk.getWallet().swap(
|
|
340
|
+
* 'USDC',
|
|
341
|
+
* 'WETH',
|
|
342
|
+
* 'base',
|
|
343
|
+
* 'ethereum',
|
|
344
|
+
* '100.5'
|
|
345
|
+
* );
|
|
346
|
+
* console.log('Swap status:', result.status);
|
|
347
|
+
* ```
|
|
348
|
+
*/
|
|
349
|
+
async swap(sourceToken, targetToken, sourceNetwork, targetNetwork, amount) {
|
|
350
|
+
return this.sdk.request("wallet:swap", {
|
|
351
|
+
sourceToken,
|
|
352
|
+
targetToken,
|
|
353
|
+
sourceNetwork,
|
|
354
|
+
targetNetwork,
|
|
355
|
+
amount
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Get a quote for a token swap without executing it
|
|
360
|
+
*
|
|
361
|
+
* Returns the expected output amount for a given swap.
|
|
362
|
+
* Useful for displaying swap previews to users before confirmation.
|
|
363
|
+
*
|
|
364
|
+
* @param sourceToken - Symbol of the token to swap from (e.g., 'USDC')
|
|
365
|
+
* @param targetToken - Symbol of the token to swap to (e.g., 'WETH')
|
|
366
|
+
* @param sourceNetwork - Network identifier for source chain (e.g., 'base')
|
|
367
|
+
* @param targetNetwork - Network identifier for target chain (e.g., 'ethereum')
|
|
368
|
+
* @param amount - Amount to swap in human-readable format (e.g., '100.5')
|
|
369
|
+
* @returns Quote with expected and minimum output amounts
|
|
370
|
+
* @throws {Error} If tokens/networks are not supported
|
|
371
|
+
*
|
|
372
|
+
* @example
|
|
373
|
+
* ```typescript
|
|
374
|
+
* const quote = await sdk.getWallet().quoteSwap(
|
|
375
|
+
* 'USDC',
|
|
376
|
+
* 'WETH',
|
|
377
|
+
* 'base',
|
|
378
|
+
* 'ethereum',
|
|
379
|
+
* '100.5'
|
|
380
|
+
* );
|
|
381
|
+
* console.log('Expected output:', quote.expectedAmountOut);
|
|
382
|
+
* console.log('Minimum output:', quote.minAmountOut);
|
|
383
|
+
* ```
|
|
384
|
+
*/
|
|
385
|
+
async quoteSwap(sourceToken, targetToken, sourceNetwork, targetNetwork, amount) {
|
|
386
|
+
return this.sdk.request("wallet:quoteSwap", {
|
|
387
|
+
sourceToken,
|
|
388
|
+
targetToken,
|
|
389
|
+
sourceNetwork,
|
|
390
|
+
targetNetwork,
|
|
391
|
+
amount
|
|
392
|
+
});
|
|
393
|
+
}
|
|
266
394
|
};
|
|
267
395
|
|
|
268
396
|
// src/access/storage.ts
|
|
@@ -487,6 +615,395 @@ var UserAccess = class {
|
|
|
487
615
|
}
|
|
488
616
|
};
|
|
489
617
|
|
|
618
|
+
// src/access/partnerships.ts
|
|
619
|
+
var PartnershipsAccess = class {
|
|
620
|
+
constructor(sdk) {
|
|
621
|
+
this.sdk = sdk;
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* Create a SponsorPass
|
|
625
|
+
* Requires permission: `partnerships:createSponsorPass` or `partnerships:*`
|
|
626
|
+
*
|
|
627
|
+
* @param payload - SponsorPass creation payload
|
|
628
|
+
* @returns Created SponsorPass
|
|
629
|
+
*
|
|
630
|
+
* @example
|
|
631
|
+
* ```typescript
|
|
632
|
+
* const pass = await sdk.getPartnerships().createSponsorPass({
|
|
633
|
+
* sponsor: 123,
|
|
634
|
+
* firstName: 'Ada',
|
|
635
|
+
* lastName: 'Lovelace',
|
|
636
|
+
* email: 'ada@example.com',
|
|
637
|
+
* });
|
|
638
|
+
* console.log('Created SponsorPass:', pass.id);
|
|
639
|
+
* ```
|
|
640
|
+
*/
|
|
641
|
+
async createSponsorPass(payload) {
|
|
642
|
+
return this.sdk.request("partnerships:createSponsorPass", payload);
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* List active SponsorPasses (paginated)
|
|
646
|
+
* Requires permission: `partnerships:listActiveSponsorPasses` or `partnerships:*`
|
|
647
|
+
*
|
|
648
|
+
* @param payload.limit - Maximum number of results to return
|
|
649
|
+
* @param payload.offset - Offset into the result set
|
|
650
|
+
* @returns Paginated response of active SponsorPasses
|
|
651
|
+
*
|
|
652
|
+
* @example
|
|
653
|
+
* ```typescript
|
|
654
|
+
* const active = await sdk.getPartnerships().listActiveSponsorPasses({ limit: 20, offset: 0 });
|
|
655
|
+
* console.log('Active count:', active.count);
|
|
656
|
+
* ```
|
|
657
|
+
*/
|
|
658
|
+
async listActiveSponsorPasses(payload) {
|
|
659
|
+
return this.sdk.request("partnerships:listActiveSponsorPasses", payload);
|
|
660
|
+
}
|
|
661
|
+
/**
|
|
662
|
+
* List all SponsorPasses (paginated)
|
|
663
|
+
* Requires permission: `partnerships:listAllSponsorPasses` or `partnerships:*`
|
|
664
|
+
*
|
|
665
|
+
* @param payload.includeRevoked - When true, include revoked passes
|
|
666
|
+
* @returns Paginated response of SponsorPasses
|
|
667
|
+
*
|
|
668
|
+
* @example
|
|
669
|
+
* ```typescript
|
|
670
|
+
* const all = await sdk.getPartnerships().listAllSponsorPasses({ includeRevoked: true, limit: 50, offset: 0 });
|
|
671
|
+
* console.log('Total passes:', all.count);
|
|
672
|
+
* ```
|
|
673
|
+
*/
|
|
674
|
+
async listAllSponsorPasses(payload) {
|
|
675
|
+
return this.sdk.request("partnerships:listAllSponsorPasses", payload);
|
|
676
|
+
}
|
|
677
|
+
async listSponsors(payload) {
|
|
678
|
+
return this.sdk.request("partnerships:listSponsors", payload);
|
|
679
|
+
}
|
|
680
|
+
async getSponsor(payload) {
|
|
681
|
+
return this.sdk.request("partnerships:getSponsor", payload);
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* Retrieve a specific SponsorPass by ID
|
|
685
|
+
* Requires permission: `partnerships:getSponsorPass` or `partnerships:*`
|
|
686
|
+
*
|
|
687
|
+
* @param payload.id - SponsorPass ID
|
|
688
|
+
* @returns SponsorPass
|
|
689
|
+
*
|
|
690
|
+
* @example
|
|
691
|
+
* ```typescript
|
|
692
|
+
* const pass = await sdk.getPartnerships().getSponsorPass({ id: 123 });
|
|
693
|
+
* console.log('SponsorPass:', pass);
|
|
694
|
+
* ```
|
|
695
|
+
*/
|
|
696
|
+
async getSponsorPass(payload) {
|
|
697
|
+
return this.sdk.request("partnerships:getSponsorPass", payload);
|
|
698
|
+
}
|
|
699
|
+
/**
|
|
700
|
+
* Revoke a SponsorPass by ID
|
|
701
|
+
* Requires permission: `partnerships:revokeSponsorPass` or `partnerships:*`
|
|
702
|
+
*
|
|
703
|
+
* Note: backend revokes (does not delete).
|
|
704
|
+
*
|
|
705
|
+
* @param payload.id - SponsorPass ID
|
|
706
|
+
*
|
|
707
|
+
* @example
|
|
708
|
+
* ```typescript
|
|
709
|
+
* await sdk.getPartnerships().revokeSponsorPass({ id: 123 });
|
|
710
|
+
* ```
|
|
711
|
+
*/
|
|
712
|
+
async revokeSponsorPass(payload) {
|
|
713
|
+
return this.sdk.request("partnerships:revokeSponsorPass", payload);
|
|
714
|
+
}
|
|
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
|
+
|
|
490
1007
|
// src/sdk.ts
|
|
491
1008
|
var FrontierSDK = class {
|
|
492
1009
|
constructor() {
|
|
@@ -509,6 +1026,8 @@ var FrontierSDK = class {
|
|
|
509
1026
|
this.storage = new StorageAccess(this);
|
|
510
1027
|
this.chain = new ChainAccess(this);
|
|
511
1028
|
this.user = new UserAccess(this);
|
|
1029
|
+
this.partnerships = new PartnershipsAccess(this);
|
|
1030
|
+
this.thirdParty = new ThirdPartyAccess(this);
|
|
512
1031
|
window.addEventListener("message", this.handleMessage);
|
|
513
1032
|
this.notifyReady();
|
|
514
1033
|
}
|
|
@@ -557,6 +1076,18 @@ var FrontierSDK = class {
|
|
|
557
1076
|
getUser() {
|
|
558
1077
|
return this.user;
|
|
559
1078
|
}
|
|
1079
|
+
/**
|
|
1080
|
+
* Get partnerships access instance
|
|
1081
|
+
*/
|
|
1082
|
+
getPartnerships() {
|
|
1083
|
+
return this.partnerships;
|
|
1084
|
+
}
|
|
1085
|
+
/**
|
|
1086
|
+
* Get third-party access instance
|
|
1087
|
+
*/
|
|
1088
|
+
getThirdParty() {
|
|
1089
|
+
return this.thirdParty;
|
|
1090
|
+
}
|
|
560
1091
|
/**
|
|
561
1092
|
* Cleanup: Remove event listeners
|
|
562
1093
|
* Call this when your app is being destroyed
|
|
@@ -779,7 +1310,10 @@ function createStandaloneHTML(appName = "Frontier App") {
|
|
|
779
1310
|
0 && (module.exports = {
|
|
780
1311
|
ChainAccess,
|
|
781
1312
|
FrontierSDK,
|
|
1313
|
+
PartnershipsAccess,
|
|
782
1314
|
StorageAccess,
|
|
1315
|
+
SwapResultStatus,
|
|
1316
|
+
ThirdPartyAccess,
|
|
783
1317
|
UserAccess,
|
|
784
1318
|
WalletAccess,
|
|
785
1319
|
createStandaloneHTML,
|