@openfort/openfort-node 0.8.3 → 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/CHANGELOG.md +12 -0
- package/README.md +29 -37
- package/dist/index.d.mts +2370 -678
- package/dist/index.d.ts +2370 -678
- package/dist/index.js +450 -280
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +426 -267
- package/dist/index.mjs.map +1 -1
- package/examples/README.md +7 -16
- package/examples/evm/accounts/getAccount.ts +0 -6
- package/examples/evm/embedded/pregenerate.ts +1 -1
- package/examples/fee-sponsorship/createPolicy.ts +24 -8
- package/examples/fee-sponsorship/disableEnablePolicy.ts +22 -9
- package/examples/fee-sponsorship/getPolicy.ts +24 -11
- package/examples/fee-sponsorship/listPolicies.ts +7 -5
- package/examples/fee-sponsorship/updatePolicy.ts +20 -7
- package/examples/iam/getSession.ts +0 -2
- package/examples/transactions/createTransactionIntent.ts +17 -11
- package/examples/transactions/estimateGas.ts +16 -14
- package/examples/transactions/getTransactionIntent.ts +16 -15
- package/openapi.json +742 -59
- package/package.json +1 -1
- package/examples/fee-sponsorship/createPolicyRule.ts +0 -43
- package/examples/fee-sponsorship/listPolicyRules.ts +0 -37
package/dist/index.js
CHANGED
|
@@ -94,6 +94,7 @@ __export(index_exports, {
|
|
|
94
94
|
EntityTypeDEVICE: () => EntityTypeDEVICE,
|
|
95
95
|
EntityTypeEMAILSAMPLE: () => EntityTypeEMAILSAMPLE,
|
|
96
96
|
EntityTypeEVENT: () => EntityTypeEVENT,
|
|
97
|
+
EntityTypeFEESPONSORSHIP: () => EntityTypeFEESPONSORSHIP,
|
|
97
98
|
EntityTypeFORWARDERCONTRACT: () => EntityTypeFORWARDERCONTRACT,
|
|
98
99
|
EntityTypeLOG: () => EntityTypeLOG,
|
|
99
100
|
EntityTypePAYMASTER: () => EntityTypePAYMASTER,
|
|
@@ -154,7 +155,7 @@ __export(index_exports, {
|
|
|
154
155
|
GetAccountsV2AccountType: () => GetAccountsV2AccountType,
|
|
155
156
|
GetAccountsV2ChainType: () => GetAccountsV2ChainType,
|
|
156
157
|
GetAccountsV2Custody: () => GetAccountsV2Custody,
|
|
157
|
-
|
|
158
|
+
GetGasPolicyRulesLegacyExpandItem: () => GetGasPolicyRulesLegacyExpandItem,
|
|
158
159
|
IMPORT_ENCRYPTION_PUBLIC_KEY: () => IMPORT_ENCRYPTION_PUBLIC_KEY,
|
|
159
160
|
ImportPrivateKeyRequestChainType: () => ImportPrivateKeyRequestChainType,
|
|
160
161
|
ImportPrivateKeyResponseChainType: () => ImportPrivateKeyResponseChainType,
|
|
@@ -166,7 +167,7 @@ __export(index_exports, {
|
|
|
166
167
|
JsonRpcRequestJsonrpc: () => JsonRpcRequestJsonrpc,
|
|
167
168
|
JsonRpcSuccessResponseAnyJsonrpc: () => JsonRpcSuccessResponseAnyJsonrpc,
|
|
168
169
|
ListBackendWalletsChainType: () => ListBackendWalletsChainType,
|
|
169
|
-
|
|
170
|
+
ListPoliciesScopeItem: () => ListPoliciesScopeItem,
|
|
170
171
|
MintAddressCriterionOperator: () => MintAddressCriterionOperator,
|
|
171
172
|
MintAddressCriterionRequestOperator: () => MintAddressCriterionRequestOperator,
|
|
172
173
|
MintAddressCriterionRequestType: () => MintAddressCriterionRequestType,
|
|
@@ -202,7 +203,7 @@ __export(index_exports, {
|
|
|
202
203
|
PolicyRuleTypeCONTRACT: () => PolicyRuleTypeCONTRACT,
|
|
203
204
|
PolicyRuleTypeRATELIMIT: () => PolicyRuleTypeRATELIMIT,
|
|
204
205
|
PolicyV2Action: () => PolicyV2Action,
|
|
205
|
-
|
|
206
|
+
PolicyV2ListQueriesScopeItem: () => PolicyV2ListQueriesScopeItem,
|
|
206
207
|
PolicyV2Scope: () => PolicyV2Scope,
|
|
207
208
|
PregenerateAccountResponseCustody: () => PregenerateAccountResponseCustody,
|
|
208
209
|
PregenerateUserRequestV2AccountType: () => PregenerateUserRequestV2AccountType,
|
|
@@ -272,10 +273,12 @@ __export(index_exports, {
|
|
|
272
273
|
SplValueCriterionRequestOperator: () => SplValueCriterionRequestOperator,
|
|
273
274
|
SplValueCriterionRequestType: () => SplValueCriterionRequestType,
|
|
274
275
|
SplValueCriterionSchema: () => SplValueCriterionSchema,
|
|
276
|
+
SponsorEvmTransactionRuleSchema: () => SponsorEvmTransactionRuleSchema,
|
|
275
277
|
SponsorSchema: () => SponsorSchema,
|
|
276
278
|
SponsorSchemaCHARGECUSTOMTOKENS: () => SponsorSchemaCHARGECUSTOMTOKENS,
|
|
277
279
|
SponsorSchemaFIXEDRATE: () => SponsorSchemaFIXEDRATE,
|
|
278
280
|
SponsorSchemaPAYFORUSER: () => SponsorSchemaPAYFORUSER,
|
|
281
|
+
SponsorSolTransactionRuleSchema: () => SponsorSolTransactionRuleSchema,
|
|
279
282
|
Status: () => Status,
|
|
280
283
|
ThirdPartyOAuthProvider: () => ThirdPartyOAuthProvider,
|
|
281
284
|
ThirdPartyOAuthProviderACCELBYTE: () => ThirdPartyOAuthProviderACCELBYTE,
|
|
@@ -316,15 +319,16 @@ __export(index_exports, {
|
|
|
316
319
|
createContract: () => createContract,
|
|
317
320
|
createDeveloperAccount: () => createDeveloperAccount,
|
|
318
321
|
createEvent: () => createEvent,
|
|
322
|
+
createFeeSponsorship: () => createFeeSponsorship,
|
|
319
323
|
createForwarderContract: () => createForwarderContract,
|
|
324
|
+
createGasPolicyLegacy: () => createGasPolicyLegacy,
|
|
325
|
+
createGasPolicyRuleLegacy: () => createGasPolicyRuleLegacy,
|
|
326
|
+
createGasPolicyWithdrawalLegacy: () => createGasPolicyWithdrawalLegacy,
|
|
320
327
|
createOAuthConfig: () => createOAuthConfig,
|
|
321
328
|
createOnrampSession: () => createOnrampSession,
|
|
322
329
|
createPaymaster: () => createPaymaster,
|
|
323
330
|
createPlayer: () => createPlayer,
|
|
324
|
-
createPolicy: () => createPolicy,
|
|
325
|
-
createPolicyRule: () => createPolicyRule,
|
|
326
331
|
createPolicyV2: () => createPolicyV2,
|
|
327
|
-
createPolicyWithdrawal: () => createPolicyWithdrawal,
|
|
328
332
|
createSession: () => createSession,
|
|
329
333
|
createSubscription: () => createSubscription,
|
|
330
334
|
createTransactionIntent: () => createTransactionIntent,
|
|
@@ -336,20 +340,23 @@ __export(index_exports, {
|
|
|
336
340
|
deleteContract: () => deleteContract,
|
|
337
341
|
deleteDeveloperAccount: () => deleteDeveloperAccount,
|
|
338
342
|
deleteEvent: () => deleteEvent,
|
|
343
|
+
deleteFeeSponsorship: () => deleteFeeSponsorship,
|
|
339
344
|
deleteForwarderContract: () => deleteForwarderContract,
|
|
345
|
+
deleteGasPolicyLegacy: () => deleteGasPolicyLegacy,
|
|
346
|
+
deleteGasPolicyRuleLegacy: () => deleteGasPolicyRuleLegacy,
|
|
340
347
|
deleteOAuthConfig: () => deleteOAuthConfig,
|
|
341
348
|
deletePaymaster: () => deletePaymaster,
|
|
342
349
|
deletePlayer: () => deletePlayer,
|
|
343
|
-
deletePolicy: () => deletePolicy,
|
|
344
|
-
deletePolicyRule: () => deletePolicyRule,
|
|
345
350
|
deletePolicyV2: () => deletePolicyV2,
|
|
346
351
|
deleteSubscription: () => deleteSubscription,
|
|
347
352
|
deleteTrigger: () => deleteTrigger,
|
|
348
353
|
deleteUser: () => deleteUser,
|
|
349
354
|
deprecatedCallbackOAuth: () => deprecatedCallbackOAuth,
|
|
350
355
|
disableAccount: () => disableAccount,
|
|
351
|
-
|
|
352
|
-
|
|
356
|
+
disableFeeSponsorship: () => disableFeeSponsorship,
|
|
357
|
+
disableGasPolicyLegacy: () => disableGasPolicyLegacy,
|
|
358
|
+
enableFeeSponsorship: () => enableFeeSponsorship,
|
|
359
|
+
enableGasPolicyLegacy: () => enableGasPolicyLegacy,
|
|
353
360
|
encryptForImport: () => encryptForImport,
|
|
354
361
|
estimateTransactionIntentCost: () => estimateTransactionIntentCost,
|
|
355
362
|
evaluatePolicyV2: () => evaluatePolicyV2,
|
|
@@ -371,7 +378,14 @@ __export(index_exports, {
|
|
|
371
378
|
getDeveloperAccounts: () => getDeveloperAccounts,
|
|
372
379
|
getEvent: () => getEvent,
|
|
373
380
|
getEvents: () => getEvents,
|
|
381
|
+
getFeeSponsorship: () => getFeeSponsorship,
|
|
374
382
|
getForwarderContract: () => getForwarderContract,
|
|
383
|
+
getGasPoliciesLegacy: () => getGasPoliciesLegacy,
|
|
384
|
+
getGasPolicyBalanceLegacy: () => getGasPolicyBalanceLegacy,
|
|
385
|
+
getGasPolicyLegacy: () => getGasPolicyLegacy,
|
|
386
|
+
getGasPolicyReportTransactionIntentsLegacy: () => getGasPolicyReportTransactionIntentsLegacy,
|
|
387
|
+
getGasPolicyRulesLegacy: () => getGasPolicyRulesLegacy,
|
|
388
|
+
getGasPolicyTotalGasUsageLegacy: () => getGasPolicyTotalGasUsageLegacy,
|
|
375
389
|
getJwks: () => getJwks,
|
|
376
390
|
getOAuthConfig: () => getOAuthConfig,
|
|
377
391
|
getOnrampQuote: () => getOnrampQuote,
|
|
@@ -379,12 +393,6 @@ __export(index_exports, {
|
|
|
379
393
|
getPlayer: () => getPlayer,
|
|
380
394
|
getPlayerSessions: () => getPlayerSessions,
|
|
381
395
|
getPlayers: () => getPlayers,
|
|
382
|
-
getPolicies: () => getPolicies,
|
|
383
|
-
getPolicy: () => getPolicy,
|
|
384
|
-
getPolicyBalance: () => getPolicyBalance,
|
|
385
|
-
getPolicyReportTransactionIntents: () => getPolicyReportTransactionIntents,
|
|
386
|
-
getPolicyRules: () => getPolicyRules,
|
|
387
|
-
getPolicyTotalGasUsage: () => getPolicyTotalGasUsage,
|
|
388
396
|
getPolicyV2: () => getPolicyV2,
|
|
389
397
|
getProjectLogs: () => getProjectLogs,
|
|
390
398
|
getSession: () => getSession,
|
|
@@ -412,6 +420,7 @@ __export(index_exports, {
|
|
|
412
420
|
linkThirdParty: () => linkThirdParty,
|
|
413
421
|
list: () => list,
|
|
414
422
|
listBackendWallets: () => listBackendWallets,
|
|
423
|
+
listFeeSponsorships: () => listFeeSponsorships,
|
|
415
424
|
listForwarderContracts: () => listForwarderContracts,
|
|
416
425
|
listOAuthConfig: () => listOAuthConfig,
|
|
417
426
|
listPaymasters: () => listPaymasters,
|
|
@@ -454,17 +463,19 @@ __export(index_exports, {
|
|
|
454
463
|
unlinkSIWE: () => unlinkSIWE,
|
|
455
464
|
updateContract: () => updateContract,
|
|
456
465
|
updateDeveloperAccount: () => updateDeveloperAccount,
|
|
466
|
+
updateFeeSponsorship: () => updateFeeSponsorship,
|
|
457
467
|
updateForwarderContract: () => updateForwarderContract,
|
|
468
|
+
updateGasPolicyLegacy: () => updateGasPolicyLegacy,
|
|
469
|
+
updateGasPolicyRuleLegacy: () => updateGasPolicyRuleLegacy,
|
|
458
470
|
updatePaymaster: () => updatePaymaster,
|
|
459
471
|
updatePlayer: () => updatePlayer,
|
|
460
|
-
updatePolicy: () => updatePolicy,
|
|
461
|
-
updatePolicyRule: () => updatePolicyRule,
|
|
462
472
|
updatePolicyV2: () => updatePolicyV2,
|
|
463
473
|
verifyAuthToken: () => verifyAuthToken,
|
|
464
474
|
verifyEmail: () => verifyEmail,
|
|
465
475
|
verifyOAuthToken: () => verifyOAuthToken
|
|
466
476
|
});
|
|
467
477
|
module.exports = __toCommonJS(index_exports);
|
|
478
|
+
var import_node_crypto4 = require("crypto");
|
|
468
479
|
var import_shield_js = require("@openfort/shield-js");
|
|
469
480
|
var import_node_fetch = __toESM(require("node-fetch"));
|
|
470
481
|
|
|
@@ -830,7 +841,7 @@ function requiresWalletAuth(requestMethod, requestPath) {
|
|
|
830
841
|
}
|
|
831
842
|
|
|
832
843
|
// src/version.ts
|
|
833
|
-
var VERSION = "0.
|
|
844
|
+
var VERSION = "0.9.0";
|
|
834
845
|
var PACKAGE = "@openfort/openfort-node";
|
|
835
846
|
|
|
836
847
|
// src/openapi-client/openfortApiClient.ts
|
|
@@ -2457,6 +2468,76 @@ var deleteEvent = (id, options) => {
|
|
|
2457
2468
|
);
|
|
2458
2469
|
};
|
|
2459
2470
|
|
|
2471
|
+
// src/openapi-client/generated/fee-sponsorship/fee-sponsorship.ts
|
|
2472
|
+
var listFeeSponsorships = (params, options) => {
|
|
2473
|
+
return openfortApiClient(
|
|
2474
|
+
{
|
|
2475
|
+
url: `/v2/fee-sponsorship`,
|
|
2476
|
+
method: "GET",
|
|
2477
|
+
params
|
|
2478
|
+
},
|
|
2479
|
+
options
|
|
2480
|
+
);
|
|
2481
|
+
};
|
|
2482
|
+
var createFeeSponsorship = (createFeeSponsorshipRequest, options) => {
|
|
2483
|
+
return openfortApiClient(
|
|
2484
|
+
{
|
|
2485
|
+
url: `/v2/fee-sponsorship`,
|
|
2486
|
+
method: "POST",
|
|
2487
|
+
headers: { "Content-Type": "application/json" },
|
|
2488
|
+
data: createFeeSponsorshipRequest
|
|
2489
|
+
},
|
|
2490
|
+
options
|
|
2491
|
+
);
|
|
2492
|
+
};
|
|
2493
|
+
var getFeeSponsorship = (feeSponsorshipId, options) => {
|
|
2494
|
+
return openfortApiClient(
|
|
2495
|
+
{
|
|
2496
|
+
url: `/v2/fee-sponsorship/${feeSponsorshipId}`,
|
|
2497
|
+
method: "GET"
|
|
2498
|
+
},
|
|
2499
|
+
options
|
|
2500
|
+
);
|
|
2501
|
+
};
|
|
2502
|
+
var updateFeeSponsorship = (feeSponsorshipId, updateFeeSponsorshipRequest, options) => {
|
|
2503
|
+
return openfortApiClient(
|
|
2504
|
+
{
|
|
2505
|
+
url: `/v2/fee-sponsorship/${feeSponsorshipId}`,
|
|
2506
|
+
method: "PUT",
|
|
2507
|
+
headers: { "Content-Type": "application/json" },
|
|
2508
|
+
data: updateFeeSponsorshipRequest
|
|
2509
|
+
},
|
|
2510
|
+
options
|
|
2511
|
+
);
|
|
2512
|
+
};
|
|
2513
|
+
var deleteFeeSponsorship = (feeSponsorshipId, options) => {
|
|
2514
|
+
return openfortApiClient(
|
|
2515
|
+
{
|
|
2516
|
+
url: `/v2/fee-sponsorship/${feeSponsorshipId}`,
|
|
2517
|
+
method: "DELETE"
|
|
2518
|
+
},
|
|
2519
|
+
options
|
|
2520
|
+
);
|
|
2521
|
+
};
|
|
2522
|
+
var enableFeeSponsorship = (feeSponsorshipId, options) => {
|
|
2523
|
+
return openfortApiClient(
|
|
2524
|
+
{
|
|
2525
|
+
url: `/v2/fee-sponsorship/${feeSponsorshipId}/enable`,
|
|
2526
|
+
method: "PUT"
|
|
2527
|
+
},
|
|
2528
|
+
options
|
|
2529
|
+
);
|
|
2530
|
+
};
|
|
2531
|
+
var disableFeeSponsorship = (feeSponsorshipId, options) => {
|
|
2532
|
+
return openfortApiClient(
|
|
2533
|
+
{
|
|
2534
|
+
url: `/v2/fee-sponsorship/${feeSponsorshipId}/disable`,
|
|
2535
|
+
method: "PUT"
|
|
2536
|
+
},
|
|
2537
|
+
options
|
|
2538
|
+
);
|
|
2539
|
+
};
|
|
2540
|
+
|
|
2460
2541
|
// src/openapi-client/generated/forwarder-contract/forwarder-contract.ts
|
|
2461
2542
|
var createForwarderContract = (createForwarderContractRequest, options) => {
|
|
2462
2543
|
return openfortApiClient(
|
|
@@ -2509,6 +2590,160 @@ var deleteForwarderContract = (id, options) => {
|
|
|
2509
2590
|
);
|
|
2510
2591
|
};
|
|
2511
2592
|
|
|
2593
|
+
// src/openapi-client/generated/gas-policies-legacy/gas-policies-legacy.ts
|
|
2594
|
+
var getGasPoliciesLegacy = (params, options) => {
|
|
2595
|
+
return openfortApiClient(
|
|
2596
|
+
{
|
|
2597
|
+
url: `/v1/policies`,
|
|
2598
|
+
method: "GET",
|
|
2599
|
+
params
|
|
2600
|
+
},
|
|
2601
|
+
options
|
|
2602
|
+
);
|
|
2603
|
+
};
|
|
2604
|
+
var createGasPolicyLegacy = (createPolicyRequest, options) => {
|
|
2605
|
+
return openfortApiClient(
|
|
2606
|
+
{
|
|
2607
|
+
url: `/v1/policies`,
|
|
2608
|
+
method: "POST",
|
|
2609
|
+
headers: { "Content-Type": "application/json" },
|
|
2610
|
+
data: createPolicyRequest
|
|
2611
|
+
},
|
|
2612
|
+
options
|
|
2613
|
+
);
|
|
2614
|
+
};
|
|
2615
|
+
var getGasPolicyLegacy = (id, params, options) => {
|
|
2616
|
+
return openfortApiClient(
|
|
2617
|
+
{
|
|
2618
|
+
url: `/v1/policies/${id}`,
|
|
2619
|
+
method: "GET",
|
|
2620
|
+
params
|
|
2621
|
+
},
|
|
2622
|
+
options
|
|
2623
|
+
);
|
|
2624
|
+
};
|
|
2625
|
+
var updateGasPolicyLegacy = (id, updatePolicyRequest, options) => {
|
|
2626
|
+
return openfortApiClient(
|
|
2627
|
+
{
|
|
2628
|
+
url: `/v1/policies/${id}`,
|
|
2629
|
+
method: "POST",
|
|
2630
|
+
headers: { "Content-Type": "application/json" },
|
|
2631
|
+
data: updatePolicyRequest
|
|
2632
|
+
},
|
|
2633
|
+
options
|
|
2634
|
+
);
|
|
2635
|
+
};
|
|
2636
|
+
var deleteGasPolicyLegacy = (id, options) => {
|
|
2637
|
+
return openfortApiClient(
|
|
2638
|
+
{
|
|
2639
|
+
url: `/v1/policies/${id}`,
|
|
2640
|
+
method: "DELETE"
|
|
2641
|
+
},
|
|
2642
|
+
options
|
|
2643
|
+
);
|
|
2644
|
+
};
|
|
2645
|
+
var disableGasPolicyLegacy = (id, options) => {
|
|
2646
|
+
return openfortApiClient(
|
|
2647
|
+
{
|
|
2648
|
+
url: `/v1/policies/${id}/disable`,
|
|
2649
|
+
method: "PUT"
|
|
2650
|
+
},
|
|
2651
|
+
options
|
|
2652
|
+
);
|
|
2653
|
+
};
|
|
2654
|
+
var enableGasPolicyLegacy = (id, options) => {
|
|
2655
|
+
return openfortApiClient(
|
|
2656
|
+
{
|
|
2657
|
+
url: `/v1/policies/${id}/enable`,
|
|
2658
|
+
method: "PUT"
|
|
2659
|
+
},
|
|
2660
|
+
options
|
|
2661
|
+
);
|
|
2662
|
+
};
|
|
2663
|
+
var getGasPolicyTotalGasUsageLegacy = (id, params, options) => {
|
|
2664
|
+
return openfortApiClient(
|
|
2665
|
+
{
|
|
2666
|
+
url: `/v1/policies/${id}/reports`,
|
|
2667
|
+
method: "GET",
|
|
2668
|
+
params
|
|
2669
|
+
},
|
|
2670
|
+
options
|
|
2671
|
+
);
|
|
2672
|
+
};
|
|
2673
|
+
var getGasPolicyReportTransactionIntentsLegacy = (id, params, options) => {
|
|
2674
|
+
return openfortApiClient(
|
|
2675
|
+
{
|
|
2676
|
+
url: `/v1/policies/${id}/reports/transaction_intents`,
|
|
2677
|
+
method: "GET",
|
|
2678
|
+
params
|
|
2679
|
+
},
|
|
2680
|
+
options
|
|
2681
|
+
);
|
|
2682
|
+
};
|
|
2683
|
+
var getGasPolicyBalanceLegacy = (id, options) => {
|
|
2684
|
+
return openfortApiClient(
|
|
2685
|
+
{
|
|
2686
|
+
url: `/v1/policies/${id}/withdraw`,
|
|
2687
|
+
method: "GET"
|
|
2688
|
+
},
|
|
2689
|
+
options
|
|
2690
|
+
);
|
|
2691
|
+
};
|
|
2692
|
+
var createGasPolicyWithdrawalLegacy = (id, withdrawalPolicyRequest, options) => {
|
|
2693
|
+
return openfortApiClient(
|
|
2694
|
+
{
|
|
2695
|
+
url: `/v1/policies/${id}/withdraw`,
|
|
2696
|
+
method: "POST",
|
|
2697
|
+
headers: { "Content-Type": "application/json" },
|
|
2698
|
+
data: withdrawalPolicyRequest
|
|
2699
|
+
},
|
|
2700
|
+
options
|
|
2701
|
+
);
|
|
2702
|
+
};
|
|
2703
|
+
|
|
2704
|
+
// src/openapi-client/generated/gas-policy-rules-legacy/gas-policy-rules-legacy.ts
|
|
2705
|
+
var getGasPolicyRulesLegacy = (params, options) => {
|
|
2706
|
+
return openfortApiClient(
|
|
2707
|
+
{
|
|
2708
|
+
url: `/v1/policy_rules`,
|
|
2709
|
+
method: "GET",
|
|
2710
|
+
params
|
|
2711
|
+
},
|
|
2712
|
+
options
|
|
2713
|
+
);
|
|
2714
|
+
};
|
|
2715
|
+
var createGasPolicyRuleLegacy = (createPolicyRuleRequest, options) => {
|
|
2716
|
+
return openfortApiClient(
|
|
2717
|
+
{
|
|
2718
|
+
url: `/v1/policy_rules`,
|
|
2719
|
+
method: "POST",
|
|
2720
|
+
headers: { "Content-Type": "application/json" },
|
|
2721
|
+
data: createPolicyRuleRequest
|
|
2722
|
+
},
|
|
2723
|
+
options
|
|
2724
|
+
);
|
|
2725
|
+
};
|
|
2726
|
+
var updateGasPolicyRuleLegacy = (id, updatePolicyRuleRequest, options) => {
|
|
2727
|
+
return openfortApiClient(
|
|
2728
|
+
{
|
|
2729
|
+
url: `/v1/policy_rules/${id}`,
|
|
2730
|
+
method: "POST",
|
|
2731
|
+
headers: { "Content-Type": "application/json" },
|
|
2732
|
+
data: updatePolicyRuleRequest
|
|
2733
|
+
},
|
|
2734
|
+
options
|
|
2735
|
+
);
|
|
2736
|
+
};
|
|
2737
|
+
var deleteGasPolicyRuleLegacy = (id, options) => {
|
|
2738
|
+
return openfortApiClient(
|
|
2739
|
+
{
|
|
2740
|
+
url: `/v1/policy_rules/${id}`,
|
|
2741
|
+
method: "DELETE"
|
|
2742
|
+
},
|
|
2743
|
+
options
|
|
2744
|
+
);
|
|
2745
|
+
};
|
|
2746
|
+
|
|
2512
2747
|
// src/openapi-client/generated/graph-q-l/graph-q-l.ts
|
|
2513
2748
|
var query = (queryBody, options) => {
|
|
2514
2749
|
return openfortApiClient(
|
|
@@ -2821,7 +3056,8 @@ var PregenerateUserRequestV2ChainType = {
|
|
|
2821
3056
|
};
|
|
2822
3057
|
var PolicyV2Scope = {
|
|
2823
3058
|
project: "project",
|
|
2824
|
-
account: "account"
|
|
3059
|
+
account: "account",
|
|
3060
|
+
transaction: "transaction"
|
|
2825
3061
|
};
|
|
2826
3062
|
var PolicyV2Action = {
|
|
2827
3063
|
accept: "accept",
|
|
@@ -2953,9 +3189,10 @@ var EntityTypePOLICYV2RULE = {
|
|
|
2953
3189
|
var EntityTypePOLICYV2 = {
|
|
2954
3190
|
policyV2: "policyV2"
|
|
2955
3191
|
};
|
|
2956
|
-
var
|
|
3192
|
+
var PolicyV2ListQueriesScopeItem = {
|
|
2957
3193
|
project: "project",
|
|
2958
|
-
account: "account"
|
|
3194
|
+
account: "account",
|
|
3195
|
+
transaction: "transaction"
|
|
2959
3196
|
};
|
|
2960
3197
|
var EvmAddressCriterionRequestType = {
|
|
2961
3198
|
evmAddress: "evmAddress"
|
|
@@ -3093,11 +3330,15 @@ var CreatePolicyV2RuleRequestAction = {
|
|
|
3093
3330
|
};
|
|
3094
3331
|
var CreatePolicyV2RequestScope = {
|
|
3095
3332
|
project: "project",
|
|
3096
|
-
account: "account"
|
|
3333
|
+
account: "account",
|
|
3334
|
+
transaction: "transaction"
|
|
3097
3335
|
};
|
|
3098
3336
|
var EvaluatePolicyV2ResponseObject = {
|
|
3099
3337
|
policy_evaluation: "policy_evaluation"
|
|
3100
3338
|
};
|
|
3339
|
+
var EntityTypeFEESPONSORSHIP = {
|
|
3340
|
+
feeSponsorship: "feeSponsorship"
|
|
3341
|
+
};
|
|
3101
3342
|
var CreateEmbeddedRequestAccountType = {
|
|
3102
3343
|
Externally_Owned_Account: "Externally Owned Account",
|
|
3103
3344
|
Smart_Account: "Smart Account",
|
|
@@ -3376,12 +3617,13 @@ var AuthenticationType = {
|
|
|
3376
3617
|
basic: "basic",
|
|
3377
3618
|
third_party: "third_party"
|
|
3378
3619
|
};
|
|
3379
|
-
var
|
|
3620
|
+
var GetGasPolicyRulesLegacyExpandItem = {
|
|
3380
3621
|
contract: "contract"
|
|
3381
3622
|
};
|
|
3382
|
-
var
|
|
3623
|
+
var ListPoliciesScopeItem = {
|
|
3383
3624
|
project: "project",
|
|
3384
|
-
account: "account"
|
|
3625
|
+
account: "account",
|
|
3626
|
+
transaction: "transaction"
|
|
3385
3627
|
};
|
|
3386
3628
|
var ListBackendWalletsChainType = {
|
|
3387
3629
|
EVM: "EVM",
|
|
@@ -3529,115 +3771,6 @@ var cancelTransferAccountOwnership = (id, playerCancelTransferOwnershipRequest,
|
|
|
3529
3771
|
};
|
|
3530
3772
|
|
|
3531
3773
|
// src/openapi-client/generated/policies/policies.ts
|
|
3532
|
-
var getPolicies = (params, options) => {
|
|
3533
|
-
return openfortApiClient(
|
|
3534
|
-
{
|
|
3535
|
-
url: `/v1/policies`,
|
|
3536
|
-
method: "GET",
|
|
3537
|
-
params
|
|
3538
|
-
},
|
|
3539
|
-
options
|
|
3540
|
-
);
|
|
3541
|
-
};
|
|
3542
|
-
var createPolicy = (createPolicyRequest, options) => {
|
|
3543
|
-
return openfortApiClient(
|
|
3544
|
-
{
|
|
3545
|
-
url: `/v1/policies`,
|
|
3546
|
-
method: "POST",
|
|
3547
|
-
headers: { "Content-Type": "application/json" },
|
|
3548
|
-
data: createPolicyRequest
|
|
3549
|
-
},
|
|
3550
|
-
options
|
|
3551
|
-
);
|
|
3552
|
-
};
|
|
3553
|
-
var getPolicy = (id, params, options) => {
|
|
3554
|
-
return openfortApiClient(
|
|
3555
|
-
{
|
|
3556
|
-
url: `/v1/policies/${id}`,
|
|
3557
|
-
method: "GET",
|
|
3558
|
-
params
|
|
3559
|
-
},
|
|
3560
|
-
options
|
|
3561
|
-
);
|
|
3562
|
-
};
|
|
3563
|
-
var updatePolicy = (id, updatePolicyRequest, options) => {
|
|
3564
|
-
return openfortApiClient(
|
|
3565
|
-
{
|
|
3566
|
-
url: `/v1/policies/${id}`,
|
|
3567
|
-
method: "POST",
|
|
3568
|
-
headers: { "Content-Type": "application/json" },
|
|
3569
|
-
data: updatePolicyRequest
|
|
3570
|
-
},
|
|
3571
|
-
options
|
|
3572
|
-
);
|
|
3573
|
-
};
|
|
3574
|
-
var deletePolicy = (id, options) => {
|
|
3575
|
-
return openfortApiClient(
|
|
3576
|
-
{
|
|
3577
|
-
url: `/v1/policies/${id}`,
|
|
3578
|
-
method: "DELETE"
|
|
3579
|
-
},
|
|
3580
|
-
options
|
|
3581
|
-
);
|
|
3582
|
-
};
|
|
3583
|
-
var disablePolicy = (id, options) => {
|
|
3584
|
-
return openfortApiClient(
|
|
3585
|
-
{
|
|
3586
|
-
url: `/v1/policies/${id}/disable`,
|
|
3587
|
-
method: "PUT"
|
|
3588
|
-
},
|
|
3589
|
-
options
|
|
3590
|
-
);
|
|
3591
|
-
};
|
|
3592
|
-
var enablePolicy = (id, options) => {
|
|
3593
|
-
return openfortApiClient(
|
|
3594
|
-
{
|
|
3595
|
-
url: `/v1/policies/${id}/enable`,
|
|
3596
|
-
method: "PUT"
|
|
3597
|
-
},
|
|
3598
|
-
options
|
|
3599
|
-
);
|
|
3600
|
-
};
|
|
3601
|
-
var getPolicyTotalGasUsage = (id, params, options) => {
|
|
3602
|
-
return openfortApiClient(
|
|
3603
|
-
{
|
|
3604
|
-
url: `/v1/policies/${id}/reports`,
|
|
3605
|
-
method: "GET",
|
|
3606
|
-
params
|
|
3607
|
-
},
|
|
3608
|
-
options
|
|
3609
|
-
);
|
|
3610
|
-
};
|
|
3611
|
-
var getPolicyReportTransactionIntents = (id, params, options) => {
|
|
3612
|
-
return openfortApiClient(
|
|
3613
|
-
{
|
|
3614
|
-
url: `/v1/policies/${id}/reports/transaction_intents`,
|
|
3615
|
-
method: "GET",
|
|
3616
|
-
params
|
|
3617
|
-
},
|
|
3618
|
-
options
|
|
3619
|
-
);
|
|
3620
|
-
};
|
|
3621
|
-
var getPolicyBalance = (id, options) => {
|
|
3622
|
-
return openfortApiClient(
|
|
3623
|
-
{
|
|
3624
|
-
url: `/v1/policies/${id}/withdraw`,
|
|
3625
|
-
method: "GET"
|
|
3626
|
-
},
|
|
3627
|
-
options
|
|
3628
|
-
);
|
|
3629
|
-
};
|
|
3630
|
-
var createPolicyWithdrawal = (id, withdrawalPolicyRequest, options) => {
|
|
3631
|
-
return openfortApiClient(
|
|
3632
|
-
{
|
|
3633
|
-
url: `/v1/policies/${id}/withdraw`,
|
|
3634
|
-
method: "POST",
|
|
3635
|
-
headers: { "Content-Type": "application/json" },
|
|
3636
|
-
data: withdrawalPolicyRequest
|
|
3637
|
-
},
|
|
3638
|
-
options
|
|
3639
|
-
);
|
|
3640
|
-
};
|
|
3641
3774
|
var listPolicies = (params, options) => {
|
|
3642
3775
|
return openfortApiClient(
|
|
3643
3776
|
{
|
|
@@ -3700,49 +3833,6 @@ var evaluatePolicyV2 = (evaluatePolicyV2Request, options) => {
|
|
|
3700
3833
|
);
|
|
3701
3834
|
};
|
|
3702
3835
|
|
|
3703
|
-
// src/openapi-client/generated/policy-rules/policy-rules.ts
|
|
3704
|
-
var getPolicyRules = (params, options) => {
|
|
3705
|
-
return openfortApiClient(
|
|
3706
|
-
{
|
|
3707
|
-
url: `/v1/policy_rules`,
|
|
3708
|
-
method: "GET",
|
|
3709
|
-
params
|
|
3710
|
-
},
|
|
3711
|
-
options
|
|
3712
|
-
);
|
|
3713
|
-
};
|
|
3714
|
-
var createPolicyRule = (createPolicyRuleRequest, options) => {
|
|
3715
|
-
return openfortApiClient(
|
|
3716
|
-
{
|
|
3717
|
-
url: `/v1/policy_rules`,
|
|
3718
|
-
method: "POST",
|
|
3719
|
-
headers: { "Content-Type": "application/json" },
|
|
3720
|
-
data: createPolicyRuleRequest
|
|
3721
|
-
},
|
|
3722
|
-
options
|
|
3723
|
-
);
|
|
3724
|
-
};
|
|
3725
|
-
var updatePolicyRule = (id, updatePolicyRuleRequest, options) => {
|
|
3726
|
-
return openfortApiClient(
|
|
3727
|
-
{
|
|
3728
|
-
url: `/v1/policy_rules/${id}`,
|
|
3729
|
-
method: "POST",
|
|
3730
|
-
headers: { "Content-Type": "application/json" },
|
|
3731
|
-
data: updatePolicyRuleRequest
|
|
3732
|
-
},
|
|
3733
|
-
options
|
|
3734
|
-
);
|
|
3735
|
-
};
|
|
3736
|
-
var deletePolicyRule = (id, options) => {
|
|
3737
|
-
return openfortApiClient(
|
|
3738
|
-
{
|
|
3739
|
-
url: `/v1/policy_rules/${id}`,
|
|
3740
|
-
method: "DELETE"
|
|
3741
|
-
},
|
|
3742
|
-
options
|
|
3743
|
-
);
|
|
3744
|
-
};
|
|
3745
|
-
|
|
3746
3836
|
// src/openapi-client/generated/rpc/rpc.ts
|
|
3747
3837
|
var handleRpcRequest = (jsonRpcRequest, options) => {
|
|
3748
3838
|
return openfortApiClient(
|
|
@@ -4232,19 +4322,13 @@ function toEvmAccount(data) {
|
|
|
4232
4322
|
},
|
|
4233
4323
|
async signMessage(parameters) {
|
|
4234
4324
|
const { message } = parameters;
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
const result2 = await sign(id, { data: hash2 });
|
|
4238
|
-
return result2.signature;
|
|
4239
|
-
}
|
|
4240
|
-
const hash = (0, import_viem.hashMessage)(message);
|
|
4241
|
-
const result = await sign(id, { data: hash });
|
|
4325
|
+
const preimage = (0, import_viem.toPrefixedMessage)(message);
|
|
4326
|
+
const result = await sign(id, { data: preimage });
|
|
4242
4327
|
return result.signature;
|
|
4243
4328
|
},
|
|
4244
4329
|
async signTransaction(transaction) {
|
|
4245
4330
|
const serialized = (0, import_viem.serializeTransaction)(transaction);
|
|
4246
|
-
const
|
|
4247
|
-
const response = await sign(id, { data: hash });
|
|
4331
|
+
const response = await sign(id, { data: serialized });
|
|
4248
4332
|
const signature2 = (0, import_viem.parseSignature)(response.signature);
|
|
4249
4333
|
const signedTransaction = (0, import_viem.serializeTransaction)(
|
|
4250
4334
|
transaction,
|
|
@@ -4883,6 +4967,19 @@ var SignEvmHashRuleSchema = import_zod.z.object({
|
|
|
4883
4967
|
action: ActionEnum,
|
|
4884
4968
|
operation: import_zod.z.literal("signEvmHash")
|
|
4885
4969
|
});
|
|
4970
|
+
var SponsorEvmTransactionCriteriaSchema = import_zod.z.array(
|
|
4971
|
+
import_zod.z.discriminatedUnion("type", [
|
|
4972
|
+
EthValueCriterionSchema,
|
|
4973
|
+
EvmAddressCriterionSchema,
|
|
4974
|
+
EvmNetworkCriterionSchema,
|
|
4975
|
+
EvmDataCriterionSchema
|
|
4976
|
+
])
|
|
4977
|
+
).max(10);
|
|
4978
|
+
var SponsorEvmTransactionRuleSchema = import_zod.z.object({
|
|
4979
|
+
action: ActionEnum,
|
|
4980
|
+
operation: import_zod.z.literal("sponsorEvmTransaction"),
|
|
4981
|
+
criteria: SponsorEvmTransactionCriteriaSchema
|
|
4982
|
+
});
|
|
4886
4983
|
|
|
4887
4984
|
// src/policies/solanaSchema.ts
|
|
4888
4985
|
var import_zod2 = require("zod");
|
|
@@ -5000,6 +5097,23 @@ var SignSolMessageRuleSchema = import_zod2.z.object({
|
|
|
5000
5097
|
operation: import_zod2.z.literal("signSolMessage"),
|
|
5001
5098
|
criteria: SignSolMessageCriteriaSchema
|
|
5002
5099
|
});
|
|
5100
|
+
var SponsorSolTransactionCriteriaSchema = import_zod2.z.array(
|
|
5101
|
+
import_zod2.z.discriminatedUnion("type", [
|
|
5102
|
+
SolAddressCriterionSchema,
|
|
5103
|
+
SolValueCriterionSchema,
|
|
5104
|
+
SplAddressCriterionSchema,
|
|
5105
|
+
SplValueCriterionSchema,
|
|
5106
|
+
MintAddressCriterionSchema,
|
|
5107
|
+
SolDataCriterionSchema,
|
|
5108
|
+
ProgramIdCriterionSchema,
|
|
5109
|
+
SolNetworkCriterionSchema
|
|
5110
|
+
])
|
|
5111
|
+
).max(10);
|
|
5112
|
+
var SponsorSolTransactionRuleSchema = import_zod2.z.object({
|
|
5113
|
+
action: ActionEnum,
|
|
5114
|
+
operation: import_zod2.z.literal("sponsorSolTransaction"),
|
|
5115
|
+
criteria: SponsorSolTransactionCriteriaSchema
|
|
5116
|
+
});
|
|
5003
5117
|
|
|
5004
5118
|
// src/policies/types.ts
|
|
5005
5119
|
var import_zod3 = require("zod");
|
|
@@ -5010,9 +5124,11 @@ var RuleSchema = import_zod3.z.discriminatedUnion("operation", [
|
|
|
5010
5124
|
SignEvmMessageRuleSchema,
|
|
5011
5125
|
SignEvmTypedDataRuleSchema,
|
|
5012
5126
|
SignEvmHashRuleSchema,
|
|
5127
|
+
SponsorEvmTransactionRuleSchema,
|
|
5013
5128
|
SignSolTransactionRuleSchema,
|
|
5014
5129
|
SendSolTransactionRuleSchema,
|
|
5015
|
-
SignSolMessageRuleSchema
|
|
5130
|
+
SignSolMessageRuleSchema,
|
|
5131
|
+
SponsorSolTransactionRuleSchema
|
|
5016
5132
|
]);
|
|
5017
5133
|
var CreatePolicyBodySchema = import_zod3.z.object({
|
|
5018
5134
|
/** The scope of the policy. 'project' applies to all accounts, 'account' applies to a specific account. */
|
|
@@ -5192,8 +5308,8 @@ var Openfort = class {
|
|
|
5192
5308
|
// Players API
|
|
5193
5309
|
// ============================================
|
|
5194
5310
|
/**
|
|
5195
|
-
* Player management endpoints
|
|
5196
|
-
* @deprecated
|
|
5311
|
+
* Player management endpoints.
|
|
5312
|
+
* @deprecated Use `openfort.iam.users` for V2 user management.
|
|
5197
5313
|
*/
|
|
5198
5314
|
get players() {
|
|
5199
5315
|
return {
|
|
@@ -5233,39 +5349,60 @@ var Openfort = class {
|
|
|
5233
5349
|
// Policies API
|
|
5234
5350
|
// ============================================
|
|
5235
5351
|
/**
|
|
5236
|
-
* Policy management endpoints for
|
|
5352
|
+
* Policy management endpoints for criteria-based access control.
|
|
5237
5353
|
*
|
|
5238
5354
|
* Policies define rules that govern what operations accounts can perform,
|
|
5239
|
-
* including transaction signing, message signing, and
|
|
5355
|
+
* including transaction signing, message signing, and gas sponsorship.
|
|
5356
|
+
* Each policy has a scope (project, account, or transaction), a priority,
|
|
5357
|
+
* and an ordered list of rules. Each rule specifies an action (accept/reject),
|
|
5358
|
+
* an operation, and criteria that must all match (AND logic).
|
|
5359
|
+
*
|
|
5360
|
+
* **Supported operations:**
|
|
5361
|
+
* - EVM: `signEvmTransaction`, `sendEvmTransaction`, `signEvmTypedData`, `signEvmMessage`, `signEvmHash`, `sponsorEvmTransaction`
|
|
5362
|
+
* - Solana: `signSolTransaction`, `sendSolTransaction`, `signSolMessage`, `sponsorSolTransaction`
|
|
5363
|
+
*
|
|
5364
|
+
* **Supported criteria types:**
|
|
5365
|
+
* - EVM: `evmAddress`, `ethValue`, `evmNetwork`, `evmData`, `evmMessage`, `evmTypedDataVerifyingContract`, `evmTypedDataField`
|
|
5366
|
+
* - Solana: `solAddress`, `solValue`, `splAddress`, `splValue`, `mintAddress`, `programId`, `solNetwork`, `solMessage`, `solData`
|
|
5367
|
+
*
|
|
5368
|
+
* Policies are evaluated in priority order (highest first). The first matching rule determines the outcome.
|
|
5369
|
+
* If policies exist but no rule matches, the operation is rejected (fail-closed).
|
|
5240
5370
|
*
|
|
5241
5371
|
* @example
|
|
5242
5372
|
* ```typescript
|
|
5243
|
-
* //
|
|
5244
|
-
* const all = await openfort.policies.list();
|
|
5245
|
-
*
|
|
5246
|
-
* // Create a policy
|
|
5373
|
+
* // Create a policy that only allows transactions to specific addresses on certain chains
|
|
5247
5374
|
* const policy = await openfort.policies.create({
|
|
5248
5375
|
* scope: 'project',
|
|
5249
|
-
* rules: [{
|
|
5376
|
+
* rules: [{
|
|
5377
|
+
* action: 'accept',
|
|
5378
|
+
* operation: 'sponsorEvmTransaction',
|
|
5379
|
+
* criteria: [
|
|
5380
|
+
* { type: 'evmNetwork', operator: 'in', chainIds: [1, 137] },
|
|
5381
|
+
* { type: 'evmAddress', operator: 'in', addresses: ['0x...'] },
|
|
5382
|
+
* ],
|
|
5383
|
+
* }],
|
|
5250
5384
|
* });
|
|
5251
5385
|
*
|
|
5252
5386
|
* // Evaluate whether an operation would be allowed
|
|
5253
|
-
* const result = await openfort.policies.evaluate({
|
|
5387
|
+
* const result = await openfort.policies.evaluate({
|
|
5388
|
+
* operation: 'signEvmTransaction',
|
|
5389
|
+
* accountId: 'acc_...',
|
|
5390
|
+
* });
|
|
5254
5391
|
* ```
|
|
5255
5392
|
*/
|
|
5256
5393
|
get policies() {
|
|
5257
5394
|
return {
|
|
5258
|
-
/** List policies */
|
|
5395
|
+
/** List policies, optionally filtered by scope, enabled status, or account */
|
|
5259
5396
|
list: listPolicies,
|
|
5260
|
-
/** Create a policy */
|
|
5397
|
+
/** Create a policy with scope, priority, and criteria-based rules */
|
|
5261
5398
|
create: createPolicyV2,
|
|
5262
|
-
/** Get a policy by ID */
|
|
5399
|
+
/** Get a policy by ID (ply_...) */
|
|
5263
5400
|
get: getPolicyV2,
|
|
5264
|
-
/** Update a policy */
|
|
5401
|
+
/** Update a policy's description, priority, enabled status, or rules */
|
|
5265
5402
|
update: updatePolicyV2,
|
|
5266
|
-
/**
|
|
5403
|
+
/** Soft-delete a policy */
|
|
5267
5404
|
delete: deletePolicyV2,
|
|
5268
|
-
/**
|
|
5405
|
+
/** Pre-flight check: evaluate whether an operation would be allowed without executing it */
|
|
5269
5406
|
evaluate: evaluatePolicyV2
|
|
5270
5407
|
};
|
|
5271
5408
|
}
|
|
@@ -5273,56 +5410,83 @@ var Openfort = class {
|
|
|
5273
5410
|
// Fee Sponsorship API
|
|
5274
5411
|
// ============================================
|
|
5275
5412
|
/**
|
|
5276
|
-
* Fee sponsorship
|
|
5413
|
+
* Fee sponsorship endpoints for sponsoring gas costs on behalf of users.
|
|
5414
|
+
*
|
|
5415
|
+
* A fee sponsorship links a strategy (how gas is paid) to a policy (which
|
|
5416
|
+
* transactions qualify). Create a policy first via `openfort.policies.create()`,
|
|
5417
|
+
* then create a fee sponsorship referencing it.
|
|
5418
|
+
*
|
|
5419
|
+
* **Strategies (`sponsorSchema`):**
|
|
5420
|
+
* - `pay_for_user` — Developer fully sponsors gas costs
|
|
5421
|
+
* - `charge_custom_tokens` — User pays in ERC-20 tokens (fixed or dynamic exchange rate)
|
|
5422
|
+
* - `fixed_rate` — User pays a fixed token amount per transaction
|
|
5423
|
+
*
|
|
5424
|
+
* **Workflow:**
|
|
5425
|
+
* 1. Create a policy via `openfort.policies.create()` with criteria rules
|
|
5426
|
+
* 2. Create a fee sponsorship via `openfort.feeSponsorship.create()` linking to that policy
|
|
5427
|
+
*
|
|
5428
|
+
* When a transaction is submitted without an explicit policy, project-scoped fee
|
|
5429
|
+
* sponsorships are auto-discovered and the first matching one is applied.
|
|
5430
|
+
*
|
|
5431
|
+
* @example
|
|
5432
|
+
* ```typescript
|
|
5433
|
+
* // 1. Create a policy to sponsor transactions on Polygon
|
|
5434
|
+
* const policy = await openfort.policies.create({
|
|
5435
|
+
* scope: 'project',
|
|
5436
|
+
* rules: [{
|
|
5437
|
+
* action: 'accept',
|
|
5438
|
+
* operation: 'sponsorEvmTransaction',
|
|
5439
|
+
* criteria: [{ type: 'evmNetwork', operator: 'in', chainIds: [137] }],
|
|
5440
|
+
* }],
|
|
5441
|
+
* });
|
|
5442
|
+
*
|
|
5443
|
+
* // 2. Create a fee sponsorship with pay_for_user strategy
|
|
5444
|
+
* const sponsorship = await openfort.feeSponsorship.create({
|
|
5445
|
+
* name: 'Polygon Gas Sponsorship',
|
|
5446
|
+
* strategy: { sponsorSchema: 'pay_for_user' },
|
|
5447
|
+
* policyId: policy.id,
|
|
5448
|
+
* });
|
|
5449
|
+
* ```
|
|
5277
5450
|
*/
|
|
5278
5451
|
get feeSponsorship() {
|
|
5279
5452
|
return {
|
|
5280
|
-
/** List fee
|
|
5281
|
-
list:
|
|
5282
|
-
/** Create a fee sponsorship policy */
|
|
5283
|
-
create:
|
|
5284
|
-
/** Get a fee sponsorship
|
|
5285
|
-
get:
|
|
5286
|
-
/** Update a fee sponsorship policy */
|
|
5287
|
-
update:
|
|
5288
|
-
/**
|
|
5289
|
-
delete:
|
|
5290
|
-
/** Disable a fee sponsorship
|
|
5291
|
-
disable:
|
|
5292
|
-
/** Enable a fee sponsorship
|
|
5293
|
-
enable:
|
|
5294
|
-
/** Get fee sponsorship policy total gas usage */
|
|
5295
|
-
getTotalGasUsage: getPolicyTotalGasUsage,
|
|
5296
|
-
/** Fee sponsorship policy rules */
|
|
5297
|
-
rules: {
|
|
5298
|
-
/** List policy rules */
|
|
5299
|
-
list: getPolicyRules,
|
|
5300
|
-
/** Create a policy rule */
|
|
5301
|
-
create: createPolicyRule,
|
|
5302
|
-
/** Update a policy rule */
|
|
5303
|
-
update: updatePolicyRule,
|
|
5304
|
-
/** Delete a policy rule */
|
|
5305
|
-
delete: deletePolicyRule
|
|
5306
|
-
}
|
|
5453
|
+
/** List fee sponsorships, optionally filtered by name, chainId, or enabled status */
|
|
5454
|
+
list: listFeeSponsorships,
|
|
5455
|
+
/** Create a fee sponsorship linked to a policy (policyId required) */
|
|
5456
|
+
create: createFeeSponsorship,
|
|
5457
|
+
/** Get a fee sponsorship by ID (pol_...) */
|
|
5458
|
+
get: getFeeSponsorship,
|
|
5459
|
+
/** Update a fee sponsorship's name, strategy, or linked policy */
|
|
5460
|
+
update: updateFeeSponsorship,
|
|
5461
|
+
/** Soft-delete a fee sponsorship */
|
|
5462
|
+
delete: deleteFeeSponsorship,
|
|
5463
|
+
/** Disable a fee sponsorship (stops it from being applied to transactions) */
|
|
5464
|
+
disable: disableFeeSponsorship,
|
|
5465
|
+
/** Enable a previously disabled fee sponsorship */
|
|
5466
|
+
enable: enableFeeSponsorship
|
|
5307
5467
|
};
|
|
5308
5468
|
}
|
|
5309
5469
|
// ============================================
|
|
5310
5470
|
// Transaction Intents API
|
|
5311
5471
|
// ============================================
|
|
5312
5472
|
/**
|
|
5313
|
-
* Transaction intent
|
|
5473
|
+
* Transaction intent endpoints for creating and managing on-chain transactions.
|
|
5474
|
+
*
|
|
5475
|
+
* Transaction intents represent a desired on-chain action (contract calls, transfers).
|
|
5476
|
+
* When a fee sponsorship policy is provided (or auto-discovered from project-scoped policies),
|
|
5477
|
+
* gas costs are sponsored according to the policy's strategy.
|
|
5314
5478
|
*/
|
|
5315
5479
|
get transactionIntents() {
|
|
5316
5480
|
return {
|
|
5317
5481
|
/** List transaction intents */
|
|
5318
5482
|
list: getTransactionIntents,
|
|
5319
|
-
/** Create a transaction intent */
|
|
5483
|
+
/** Create a transaction intent with contract interactions */
|
|
5320
5484
|
create: createTransactionIntent,
|
|
5321
5485
|
/** Get a transaction intent by ID */
|
|
5322
5486
|
get: getTransactionIntent,
|
|
5323
5487
|
/** Sign a transaction intent */
|
|
5324
5488
|
signature,
|
|
5325
|
-
/** Estimate cost */
|
|
5489
|
+
/** Estimate gas cost for a transaction before creating it */
|
|
5326
5490
|
estimateCost: estimateTransactionIntentCost
|
|
5327
5491
|
};
|
|
5328
5492
|
}
|
|
@@ -5347,27 +5511,6 @@ var Openfort = class {
|
|
|
5347
5511
|
};
|
|
5348
5512
|
}
|
|
5349
5513
|
// ============================================
|
|
5350
|
-
// Settings API
|
|
5351
|
-
// ============================================
|
|
5352
|
-
/**
|
|
5353
|
-
* Settings / Developer account management endpoints
|
|
5354
|
-
* @deprecated
|
|
5355
|
-
*/
|
|
5356
|
-
get settings() {
|
|
5357
|
-
return {
|
|
5358
|
-
/** List developer accounts */
|
|
5359
|
-
getDeveloperAccounts,
|
|
5360
|
-
/** Create a developer account */
|
|
5361
|
-
createDeveloperAccount,
|
|
5362
|
-
/** Get a developer account by ID */
|
|
5363
|
-
getDeveloperAccount,
|
|
5364
|
-
/** Delete a developer account */
|
|
5365
|
-
deleteDeveloperAccount,
|
|
5366
|
-
/** Get verification payload */
|
|
5367
|
-
getVerificationPayload
|
|
5368
|
-
};
|
|
5369
|
-
}
|
|
5370
|
-
// ============================================
|
|
5371
5514
|
// Subscriptions API
|
|
5372
5515
|
// ============================================
|
|
5373
5516
|
/**
|
|
@@ -5516,7 +5659,10 @@ var Openfort = class {
|
|
|
5516
5659
|
const { recoveryShare: _, ...accountResponse } = response;
|
|
5517
5660
|
return accountResponse;
|
|
5518
5661
|
} catch (error) {
|
|
5519
|
-
|
|
5662
|
+
try {
|
|
5663
|
+
await deleteUser(response.user);
|
|
5664
|
+
} catch {
|
|
5665
|
+
}
|
|
5520
5666
|
throw error;
|
|
5521
5667
|
}
|
|
5522
5668
|
}
|
|
@@ -5547,6 +5693,11 @@ var Openfort = class {
|
|
|
5547
5693
|
* @internal
|
|
5548
5694
|
*/
|
|
5549
5695
|
async preRegisterWithShield(recoveryShare, openfortUserId, thirdPartyUserId, config) {
|
|
5696
|
+
if (!config.shieldApiKey || !config.shieldApiSecret || !config.encryptionShare) {
|
|
5697
|
+
throw new Error(
|
|
5698
|
+
"Shield configuration requires shieldApiKey, shieldApiSecret, and encryptionShare"
|
|
5699
|
+
);
|
|
5700
|
+
}
|
|
5550
5701
|
let externalUserId;
|
|
5551
5702
|
if (config.shieldAuthProvider === import_shield_js.ShieldAuthProvider.OPENFORT) {
|
|
5552
5703
|
externalUserId = openfortUserId;
|
|
@@ -5581,13 +5732,16 @@ var Openfort = class {
|
|
|
5581
5732
|
// Paymasters API
|
|
5582
5733
|
// ============================================
|
|
5583
5734
|
/**
|
|
5584
|
-
* Paymaster endpoints
|
|
5735
|
+
* Paymaster endpoints for managing ERC-4337 paymasters.
|
|
5736
|
+
*
|
|
5737
|
+
* Paymasters handle gas payment on-chain for account abstraction (ERC-4337).
|
|
5738
|
+
* Fee sponsorships reference a paymaster to determine how user operations are sponsored.
|
|
5585
5739
|
*/
|
|
5586
5740
|
get paymasters() {
|
|
5587
5741
|
return {
|
|
5588
5742
|
/** Create a paymaster */
|
|
5589
5743
|
create: createPaymaster,
|
|
5590
|
-
/** Get a paymaster by ID */
|
|
5744
|
+
/** Get a paymaster by ID (pay_...) */
|
|
5591
5745
|
get: getPaymaster,
|
|
5592
5746
|
/** Update a paymaster */
|
|
5593
5747
|
update: updatePaymaster,
|
|
@@ -5606,10 +5760,16 @@ var Openfort = class {
|
|
|
5606
5760
|
*/
|
|
5607
5761
|
async constructWebhookEvent(body, signature2) {
|
|
5608
5762
|
const signedPayload = await sign2(this._apiKey, body);
|
|
5609
|
-
|
|
5610
|
-
|
|
5763
|
+
const expectedBuffer = Buffer.from(signedPayload, "hex");
|
|
5764
|
+
const receivedBuffer = Buffer.from(signature2, "hex");
|
|
5765
|
+
if (expectedBuffer.length !== receivedBuffer.length || !(0, import_node_crypto4.timingSafeEqual)(expectedBuffer, receivedBuffer)) {
|
|
5766
|
+
throw new Error("Invalid signature");
|
|
5767
|
+
}
|
|
5768
|
+
try {
|
|
5769
|
+
return JSON.parse(body);
|
|
5770
|
+
} catch {
|
|
5771
|
+
throw new Error("Failed to parse webhook payload");
|
|
5611
5772
|
}
|
|
5612
|
-
return JSON.parse(body);
|
|
5613
5773
|
}
|
|
5614
5774
|
/**
|
|
5615
5775
|
* Creates an encryption session with Shield.
|
|
@@ -5720,6 +5880,7 @@ var index_default = Openfort;
|
|
|
5720
5880
|
EntityTypeDEVICE,
|
|
5721
5881
|
EntityTypeEMAILSAMPLE,
|
|
5722
5882
|
EntityTypeEVENT,
|
|
5883
|
+
EntityTypeFEESPONSORSHIP,
|
|
5723
5884
|
EntityTypeFORWARDERCONTRACT,
|
|
5724
5885
|
EntityTypeLOG,
|
|
5725
5886
|
EntityTypePAYMASTER,
|
|
@@ -5780,7 +5941,7 @@ var index_default = Openfort;
|
|
|
5780
5941
|
GetAccountsV2AccountType,
|
|
5781
5942
|
GetAccountsV2ChainType,
|
|
5782
5943
|
GetAccountsV2Custody,
|
|
5783
|
-
|
|
5944
|
+
GetGasPolicyRulesLegacyExpandItem,
|
|
5784
5945
|
IMPORT_ENCRYPTION_PUBLIC_KEY,
|
|
5785
5946
|
ImportPrivateKeyRequestChainType,
|
|
5786
5947
|
ImportPrivateKeyResponseChainType,
|
|
@@ -5792,7 +5953,7 @@ var index_default = Openfort;
|
|
|
5792
5953
|
JsonRpcRequestJsonrpc,
|
|
5793
5954
|
JsonRpcSuccessResponseAnyJsonrpc,
|
|
5794
5955
|
ListBackendWalletsChainType,
|
|
5795
|
-
|
|
5956
|
+
ListPoliciesScopeItem,
|
|
5796
5957
|
MintAddressCriterionOperator,
|
|
5797
5958
|
MintAddressCriterionRequestOperator,
|
|
5798
5959
|
MintAddressCriterionRequestType,
|
|
@@ -5828,7 +5989,7 @@ var index_default = Openfort;
|
|
|
5828
5989
|
PolicyRuleTypeCONTRACT,
|
|
5829
5990
|
PolicyRuleTypeRATELIMIT,
|
|
5830
5991
|
PolicyV2Action,
|
|
5831
|
-
|
|
5992
|
+
PolicyV2ListQueriesScopeItem,
|
|
5832
5993
|
PolicyV2Scope,
|
|
5833
5994
|
PregenerateAccountResponseCustody,
|
|
5834
5995
|
PregenerateUserRequestV2AccountType,
|
|
@@ -5898,10 +6059,12 @@ var index_default = Openfort;
|
|
|
5898
6059
|
SplValueCriterionRequestOperator,
|
|
5899
6060
|
SplValueCriterionRequestType,
|
|
5900
6061
|
SplValueCriterionSchema,
|
|
6062
|
+
SponsorEvmTransactionRuleSchema,
|
|
5901
6063
|
SponsorSchema,
|
|
5902
6064
|
SponsorSchemaCHARGECUSTOMTOKENS,
|
|
5903
6065
|
SponsorSchemaFIXEDRATE,
|
|
5904
6066
|
SponsorSchemaPAYFORUSER,
|
|
6067
|
+
SponsorSolTransactionRuleSchema,
|
|
5905
6068
|
Status,
|
|
5906
6069
|
ThirdPartyOAuthProvider,
|
|
5907
6070
|
ThirdPartyOAuthProviderACCELBYTE,
|
|
@@ -5942,15 +6105,16 @@ var index_default = Openfort;
|
|
|
5942
6105
|
createContract,
|
|
5943
6106
|
createDeveloperAccount,
|
|
5944
6107
|
createEvent,
|
|
6108
|
+
createFeeSponsorship,
|
|
5945
6109
|
createForwarderContract,
|
|
6110
|
+
createGasPolicyLegacy,
|
|
6111
|
+
createGasPolicyRuleLegacy,
|
|
6112
|
+
createGasPolicyWithdrawalLegacy,
|
|
5946
6113
|
createOAuthConfig,
|
|
5947
6114
|
createOnrampSession,
|
|
5948
6115
|
createPaymaster,
|
|
5949
6116
|
createPlayer,
|
|
5950
|
-
createPolicy,
|
|
5951
|
-
createPolicyRule,
|
|
5952
6117
|
createPolicyV2,
|
|
5953
|
-
createPolicyWithdrawal,
|
|
5954
6118
|
createSession,
|
|
5955
6119
|
createSubscription,
|
|
5956
6120
|
createTransactionIntent,
|
|
@@ -5961,20 +6125,23 @@ var index_default = Openfort;
|
|
|
5961
6125
|
deleteContract,
|
|
5962
6126
|
deleteDeveloperAccount,
|
|
5963
6127
|
deleteEvent,
|
|
6128
|
+
deleteFeeSponsorship,
|
|
5964
6129
|
deleteForwarderContract,
|
|
6130
|
+
deleteGasPolicyLegacy,
|
|
6131
|
+
deleteGasPolicyRuleLegacy,
|
|
5965
6132
|
deleteOAuthConfig,
|
|
5966
6133
|
deletePaymaster,
|
|
5967
6134
|
deletePlayer,
|
|
5968
|
-
deletePolicy,
|
|
5969
|
-
deletePolicyRule,
|
|
5970
6135
|
deletePolicyV2,
|
|
5971
6136
|
deleteSubscription,
|
|
5972
6137
|
deleteTrigger,
|
|
5973
6138
|
deleteUser,
|
|
5974
6139
|
deprecatedCallbackOAuth,
|
|
5975
6140
|
disableAccount,
|
|
5976
|
-
|
|
5977
|
-
|
|
6141
|
+
disableFeeSponsorship,
|
|
6142
|
+
disableGasPolicyLegacy,
|
|
6143
|
+
enableFeeSponsorship,
|
|
6144
|
+
enableGasPolicyLegacy,
|
|
5978
6145
|
encryptForImport,
|
|
5979
6146
|
estimateTransactionIntentCost,
|
|
5980
6147
|
evaluatePolicyV2,
|
|
@@ -5996,7 +6163,14 @@ var index_default = Openfort;
|
|
|
5996
6163
|
getDeveloperAccounts,
|
|
5997
6164
|
getEvent,
|
|
5998
6165
|
getEvents,
|
|
6166
|
+
getFeeSponsorship,
|
|
5999
6167
|
getForwarderContract,
|
|
6168
|
+
getGasPoliciesLegacy,
|
|
6169
|
+
getGasPolicyBalanceLegacy,
|
|
6170
|
+
getGasPolicyLegacy,
|
|
6171
|
+
getGasPolicyReportTransactionIntentsLegacy,
|
|
6172
|
+
getGasPolicyRulesLegacy,
|
|
6173
|
+
getGasPolicyTotalGasUsageLegacy,
|
|
6000
6174
|
getJwks,
|
|
6001
6175
|
getOAuthConfig,
|
|
6002
6176
|
getOnrampQuote,
|
|
@@ -6004,12 +6178,6 @@ var index_default = Openfort;
|
|
|
6004
6178
|
getPlayer,
|
|
6005
6179
|
getPlayerSessions,
|
|
6006
6180
|
getPlayers,
|
|
6007
|
-
getPolicies,
|
|
6008
|
-
getPolicy,
|
|
6009
|
-
getPolicyBalance,
|
|
6010
|
-
getPolicyReportTransactionIntents,
|
|
6011
|
-
getPolicyRules,
|
|
6012
|
-
getPolicyTotalGasUsage,
|
|
6013
6181
|
getPolicyV2,
|
|
6014
6182
|
getProjectLogs,
|
|
6015
6183
|
getSession,
|
|
@@ -6037,6 +6205,7 @@ var index_default = Openfort;
|
|
|
6037
6205
|
linkThirdParty,
|
|
6038
6206
|
list,
|
|
6039
6207
|
listBackendWallets,
|
|
6208
|
+
listFeeSponsorships,
|
|
6040
6209
|
listForwarderContracts,
|
|
6041
6210
|
listOAuthConfig,
|
|
6042
6211
|
listPaymasters,
|
|
@@ -6079,11 +6248,12 @@ var index_default = Openfort;
|
|
|
6079
6248
|
unlinkSIWE,
|
|
6080
6249
|
updateContract,
|
|
6081
6250
|
updateDeveloperAccount,
|
|
6251
|
+
updateFeeSponsorship,
|
|
6082
6252
|
updateForwarderContract,
|
|
6253
|
+
updateGasPolicyLegacy,
|
|
6254
|
+
updateGasPolicyRuleLegacy,
|
|
6083
6255
|
updatePaymaster,
|
|
6084
6256
|
updatePlayer,
|
|
6085
|
-
updatePolicy,
|
|
6086
|
-
updatePolicyRule,
|
|
6087
6257
|
updatePolicyV2,
|
|
6088
6258
|
verifyAuthToken,
|
|
6089
6259
|
verifyEmail,
|