@openfort/openfort-node 0.9.1 → 0.9.3
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 +14 -0
- package/dist/index.d.mts +335 -548
- package/dist/index.d.ts +335 -548
- package/dist/index.js +139 -177
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +142 -164
- package/dist/index.mjs.map +1 -1
- package/examples/evm/delegation/sendTransaction.ts +34 -0
- package/openapi.json +28 -637
- package/package.json +16 -16
- package/tsconfig.json +1 -1
- package/pnpm-workspace.yaml +0 -11
package/dist/index.js
CHANGED
|
@@ -50,11 +50,6 @@ __export(index_exports, {
|
|
|
50
50
|
AuthProviderResponseV2: () => AuthProviderResponseV2,
|
|
51
51
|
AuthenticateOAuthRequestProvider: () => AuthenticateOAuthRequestProvider,
|
|
52
52
|
AuthenticationType: () => AuthenticationType,
|
|
53
|
-
BackendWalletListQueriesChainType: () => BackendWalletListQueriesChainType,
|
|
54
|
-
BackendWalletListResponseObject: () => BackendWalletListResponseObject,
|
|
55
|
-
BackendWalletResponseChainType: () => BackendWalletResponseChainType,
|
|
56
|
-
BackendWalletResponseCustody: () => BackendWalletResponseCustody,
|
|
57
|
-
BackendWalletResponseObject: () => BackendWalletResponseObject,
|
|
58
53
|
BasicAuthProvider: () => BasicAuthProvider,
|
|
59
54
|
BasicAuthProviderEMAIL: () => BasicAuthProviderEMAIL,
|
|
60
55
|
BasicAuthProviderGUEST: () => BasicAuthProviderGUEST,
|
|
@@ -82,6 +77,7 @@ __export(index_exports, {
|
|
|
82
77
|
CriteriaOperatorNOTIN: () => CriteriaOperatorNOTIN,
|
|
83
78
|
CriteriaType: () => CriteriaType,
|
|
84
79
|
Currency: () => Currency,
|
|
80
|
+
DelegationError: () => DelegationError,
|
|
85
81
|
DeleteBackendWalletResponseObject: () => DeleteBackendWalletResponseObject,
|
|
86
82
|
DeveloperAccountResponseExpandable: () => DeveloperAccountResponseExpandable,
|
|
87
83
|
EmailTypeRequest: () => EmailTypeRequest,
|
|
@@ -166,7 +162,6 @@ __export(index_exports, {
|
|
|
166
162
|
JsonRpcErrorResponseJsonrpc: () => JsonRpcErrorResponseJsonrpc,
|
|
167
163
|
JsonRpcRequestJsonrpc: () => JsonRpcRequestJsonrpc,
|
|
168
164
|
JsonRpcSuccessResponseAnyJsonrpc: () => JsonRpcSuccessResponseAnyJsonrpc,
|
|
169
|
-
ListBackendWalletsChainType: () => ListBackendWalletsChainType,
|
|
170
165
|
ListPoliciesScopeItem: () => ListPoliciesScopeItem,
|
|
171
166
|
MintAddressCriterionOperator: () => MintAddressCriterionOperator,
|
|
172
167
|
MintAddressCriterionRequestOperator: () => MintAddressCriterionRequestOperator,
|
|
@@ -296,12 +291,6 @@ __export(index_exports, {
|
|
|
296
291
|
TransactionIntentResponseExpandable: () => TransactionIntentResponseExpandable,
|
|
297
292
|
TransactionStatus: () => TransactionStatus,
|
|
298
293
|
UnknownError: () => UnknownError,
|
|
299
|
-
UpdateBackendWalletRequestAccountType: () => UpdateBackendWalletRequestAccountType,
|
|
300
|
-
UpdateBackendWalletRequestChainType: () => UpdateBackendWalletRequestChainType,
|
|
301
|
-
UpdateBackendWalletResponseChainType: () => UpdateBackendWalletResponseChainType,
|
|
302
|
-
UpdateBackendWalletResponseCustody: () => UpdateBackendWalletResponseCustody,
|
|
303
|
-
UpdateBackendWalletResponseDelegatedAccountChainChainType: () => UpdateBackendWalletResponseDelegatedAccountChainChainType,
|
|
304
|
-
UpdateBackendWalletResponseObject: () => UpdateBackendWalletResponseObject,
|
|
305
294
|
UpdatePolicyBodySchema: () => UpdatePolicyBodySchema,
|
|
306
295
|
UsageAlertType: () => UsageAlertType,
|
|
307
296
|
UserInputValidationError: () => UserInputValidationError,
|
|
@@ -314,7 +303,6 @@ __export(index_exports, {
|
|
|
314
303
|
authApi: () => auth_v2_exports,
|
|
315
304
|
authSchemas: () => openfortAuth_schemas_exports,
|
|
316
305
|
authenticateSIWE: () => authenticateSIWE,
|
|
317
|
-
authorize: () => authorize,
|
|
318
306
|
callbackOAuth: () => callbackOAuth,
|
|
319
307
|
cancelTransferAccountOwnership: () => cancelTransferAccountOwnership,
|
|
320
308
|
configure: () => configure,
|
|
@@ -377,7 +365,6 @@ __export(index_exports, {
|
|
|
377
365
|
getAuthPlayers: () => getAuthPlayers,
|
|
378
366
|
getAuthUser: () => getAuthUser,
|
|
379
367
|
getAuthUsers: () => getAuthUsers,
|
|
380
|
-
getBackendWallet: () => getBackendWallet,
|
|
381
368
|
getConfig: () => getConfig,
|
|
382
369
|
getContract: () => getContract,
|
|
383
370
|
getContracts: () => getContracts,
|
|
@@ -426,7 +413,6 @@ __export(index_exports, {
|
|
|
426
413
|
linkSIWE: () => linkSIWE,
|
|
427
414
|
linkThirdParty: () => linkThirdParty,
|
|
428
415
|
list: () => list,
|
|
429
|
-
listBackendWallets: () => listBackendWallets,
|
|
430
416
|
listFeeSponsorships: () => listFeeSponsorships,
|
|
431
417
|
listForwarderContracts: () => listForwarderContracts,
|
|
432
418
|
listOAuthConfig: () => listOAuthConfig,
|
|
@@ -434,7 +420,6 @@ __export(index_exports, {
|
|
|
434
420
|
listPolicies: () => listPolicies,
|
|
435
421
|
listSubscriptionLogs: () => listSubscriptionLogs,
|
|
436
422
|
loginEmailPassword: () => loginEmailPassword,
|
|
437
|
-
loginOIDC: () => loginOIDC,
|
|
438
423
|
loginWithIdToken: () => loginWithIdToken,
|
|
439
424
|
logout: () => logout,
|
|
440
425
|
me: () => me,
|
|
@@ -468,7 +453,6 @@ __export(index_exports, {
|
|
|
468
453
|
unlinkEmail: () => unlinkEmail,
|
|
469
454
|
unlinkOAuth: () => unlinkOAuth,
|
|
470
455
|
unlinkSIWE: () => unlinkSIWE,
|
|
471
|
-
updateBackendWallet: () => updateBackendWallet,
|
|
472
456
|
updateContract: () => updateContract,
|
|
473
457
|
updateDeveloperAccount: () => updateDeveloperAccount,
|
|
474
458
|
updateFeeSponsorship: () => updateFeeSponsorship,
|
|
@@ -666,6 +650,15 @@ var AccountNotFoundError = class _AccountNotFoundError extends Error {
|
|
|
666
650
|
}
|
|
667
651
|
}
|
|
668
652
|
};
|
|
653
|
+
var DelegationError = class _DelegationError extends Error {
|
|
654
|
+
constructor(message) {
|
|
655
|
+
super(message);
|
|
656
|
+
this.name = "DelegationError";
|
|
657
|
+
if (Error.captureStackTrace) {
|
|
658
|
+
Error.captureStackTrace(this, _DelegationError);
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
};
|
|
669
662
|
var EncryptionError = class _EncryptionError extends Error {
|
|
670
663
|
/**
|
|
671
664
|
* Initializes a new EncryptionError instance.
|
|
@@ -849,7 +842,7 @@ function requiresWalletAuth(requestMethod, requestPath) {
|
|
|
849
842
|
}
|
|
850
843
|
|
|
851
844
|
// src/version.ts
|
|
852
|
-
var VERSION = "0.9.
|
|
845
|
+
var VERSION = "0.9.3";
|
|
853
846
|
var PACKAGE = "@openfort/openfort-node";
|
|
854
847
|
|
|
855
848
|
// src/openapi-client/openfortApiClient.ts
|
|
@@ -1453,17 +1446,6 @@ var verifyAuthToken = (params, options) => {
|
|
|
1453
1446
|
options
|
|
1454
1447
|
);
|
|
1455
1448
|
};
|
|
1456
|
-
var authorize = (authorizePlayerRequest, options) => {
|
|
1457
|
-
return openfortApiClient(
|
|
1458
|
-
{
|
|
1459
|
-
url: `/iam/v1/authorize`,
|
|
1460
|
-
method: "POST",
|
|
1461
|
-
headers: { "Content-Type": "application/json" },
|
|
1462
|
-
data: authorizePlayerRequest
|
|
1463
|
-
},
|
|
1464
|
-
options
|
|
1465
|
-
);
|
|
1466
|
-
};
|
|
1467
1449
|
|
|
1468
1450
|
// src/openapi-client/generated/auth/auth-v2/auth-v2.ts
|
|
1469
1451
|
var auth_v2_exports = {};
|
|
@@ -2151,17 +2133,6 @@ var unlinkEmail = (unlinkEmailRequest, options) => {
|
|
|
2151
2133
|
options
|
|
2152
2134
|
);
|
|
2153
2135
|
};
|
|
2154
|
-
var loginOIDC = (loginOIDCRequest, options) => {
|
|
2155
|
-
return openfortApiClient(
|
|
2156
|
-
{
|
|
2157
|
-
url: `/iam/v1/oidc/login`,
|
|
2158
|
-
method: "POST",
|
|
2159
|
-
headers: { "Content-Type": "application/json" },
|
|
2160
|
-
data: loginOIDCRequest
|
|
2161
|
-
},
|
|
2162
|
-
options
|
|
2163
|
-
);
|
|
2164
|
-
};
|
|
2165
2136
|
var initOAuth = (oAuthInitRequest, options) => {
|
|
2166
2137
|
return openfortApiClient(
|
|
2167
2138
|
{
|
|
@@ -2267,16 +2238,6 @@ var me = (options) => {
|
|
|
2267
2238
|
};
|
|
2268
2239
|
|
|
2269
2240
|
// src/openapi-client/generated/backend-wallets/backend-wallets.ts
|
|
2270
|
-
var listBackendWallets = (params, options) => {
|
|
2271
|
-
return openfortApiClient(
|
|
2272
|
-
{
|
|
2273
|
-
url: `/v2/accounts/backend`,
|
|
2274
|
-
method: "GET",
|
|
2275
|
-
params
|
|
2276
|
-
},
|
|
2277
|
-
options
|
|
2278
|
-
);
|
|
2279
|
-
};
|
|
2280
2241
|
var createBackendWallet = (createBackendWalletRequest, options) => {
|
|
2281
2242
|
return openfortApiClient(
|
|
2282
2243
|
{
|
|
@@ -2288,26 +2249,6 @@ var createBackendWallet = (createBackendWalletRequest, options) => {
|
|
|
2288
2249
|
options
|
|
2289
2250
|
);
|
|
2290
2251
|
};
|
|
2291
|
-
var getBackendWallet = (id, options) => {
|
|
2292
|
-
return openfortApiClient(
|
|
2293
|
-
{
|
|
2294
|
-
url: `/v2/accounts/backend/${id}`,
|
|
2295
|
-
method: "GET"
|
|
2296
|
-
},
|
|
2297
|
-
options
|
|
2298
|
-
);
|
|
2299
|
-
};
|
|
2300
|
-
var updateBackendWallet = (id, updateBackendWalletRequest, options) => {
|
|
2301
|
-
return openfortApiClient(
|
|
2302
|
-
{
|
|
2303
|
-
url: `/v2/accounts/backend/${id}`,
|
|
2304
|
-
method: "PUT",
|
|
2305
|
-
headers: { "Content-Type": "application/json" },
|
|
2306
|
-
data: updateBackendWalletRequest
|
|
2307
|
-
},
|
|
2308
|
-
options
|
|
2309
|
-
);
|
|
2310
|
-
};
|
|
2311
2252
|
var deleteBackendWallet = (id, options) => {
|
|
2312
2253
|
return openfortApiClient(
|
|
2313
2254
|
{
|
|
@@ -3367,23 +3308,6 @@ var CreateEmbeddedRequestChainType = {
|
|
|
3367
3308
|
EVM: "EVM",
|
|
3368
3309
|
SVM: "SVM"
|
|
3369
3310
|
};
|
|
3370
|
-
var BackendWalletResponseObject = {
|
|
3371
|
-
backendWallet: "backendWallet"
|
|
3372
|
-
};
|
|
3373
|
-
var BackendWalletResponseChainType = {
|
|
3374
|
-
EVM: "EVM",
|
|
3375
|
-
SVM: "SVM"
|
|
3376
|
-
};
|
|
3377
|
-
var BackendWalletResponseCustody = {
|
|
3378
|
-
Developer: "Developer"
|
|
3379
|
-
};
|
|
3380
|
-
var BackendWalletListResponseObject = {
|
|
3381
|
-
list: "list"
|
|
3382
|
-
};
|
|
3383
|
-
var BackendWalletListQueriesChainType = {
|
|
3384
|
-
EVM: "EVM",
|
|
3385
|
-
SVM: "SVM"
|
|
3386
|
-
};
|
|
3387
3311
|
var CreateBackendWalletResponseObject = {
|
|
3388
3312
|
account: "account"
|
|
3389
3313
|
};
|
|
@@ -3395,27 +3319,6 @@ var CreateBackendWalletRequestChainType = {
|
|
|
3395
3319
|
EVM: "EVM",
|
|
3396
3320
|
SVM: "SVM"
|
|
3397
3321
|
};
|
|
3398
|
-
var UpdateBackendWalletResponseObject = {
|
|
3399
|
-
backendWallet: "backendWallet"
|
|
3400
|
-
};
|
|
3401
|
-
var UpdateBackendWalletResponseChainType = {
|
|
3402
|
-
EVM: "EVM",
|
|
3403
|
-
SVM: "SVM"
|
|
3404
|
-
};
|
|
3405
|
-
var UpdateBackendWalletResponseCustody = {
|
|
3406
|
-
Developer: "Developer"
|
|
3407
|
-
};
|
|
3408
|
-
var UpdateBackendWalletResponseDelegatedAccountChainChainType = {
|
|
3409
|
-
EVM: "EVM",
|
|
3410
|
-
SVM: "SVM"
|
|
3411
|
-
};
|
|
3412
|
-
var UpdateBackendWalletRequestAccountType = {
|
|
3413
|
-
Delegated_Account: "Delegated Account"
|
|
3414
|
-
};
|
|
3415
|
-
var UpdateBackendWalletRequestChainType = {
|
|
3416
|
-
EVM: "EVM",
|
|
3417
|
-
SVM: "SVM"
|
|
3418
|
-
};
|
|
3419
3322
|
var DeleteBackendWalletResponseObject = {
|
|
3420
3323
|
backendWallet: "backendWallet"
|
|
3421
3324
|
};
|
|
@@ -3670,10 +3573,6 @@ var ListPoliciesScopeItem = {
|
|
|
3670
3573
|
account: "account",
|
|
3671
3574
|
transaction: "transaction"
|
|
3672
3575
|
};
|
|
3673
|
-
var ListBackendWalletsChainType = {
|
|
3674
|
-
EVM: "EVM",
|
|
3675
|
-
SVM: "SVM"
|
|
3676
|
-
};
|
|
3677
3576
|
var GetAccountsV2ChainType = {
|
|
3678
3577
|
EVM: "EVM",
|
|
3679
3578
|
SVM: "SVM"
|
|
@@ -4363,11 +4262,12 @@ async function signHash(options) {
|
|
|
4363
4262
|
|
|
4364
4263
|
// src/wallets/evm/accounts/evmAccount.ts
|
|
4365
4264
|
function toEvmAccount(data) {
|
|
4366
|
-
const { id, address } = data;
|
|
4265
|
+
const { id, address, walletId } = data;
|
|
4367
4266
|
const account = {
|
|
4368
4267
|
id,
|
|
4369
4268
|
address,
|
|
4370
4269
|
custody: "Developer",
|
|
4270
|
+
walletId,
|
|
4371
4271
|
async sign(parameters) {
|
|
4372
4272
|
const result = await signHash({
|
|
4373
4273
|
accountId: id,
|
|
@@ -4419,7 +4319,8 @@ function toEvmAccount(data) {
|
|
|
4419
4319
|
function toEvmAccountData(response) {
|
|
4420
4320
|
return {
|
|
4421
4321
|
id: response.id,
|
|
4422
|
-
address: response.address
|
|
4322
|
+
address: response.address,
|
|
4323
|
+
walletId: response.wallet
|
|
4423
4324
|
};
|
|
4424
4325
|
}
|
|
4425
4326
|
var EvmClient = class {
|
|
@@ -4459,7 +4360,8 @@ var EvmClient = class {
|
|
|
4459
4360
|
});
|
|
4460
4361
|
return toEvmAccount({
|
|
4461
4362
|
id: response.id,
|
|
4462
|
-
address: response.address
|
|
4363
|
+
address: response.address,
|
|
4364
|
+
walletId: response.walletId
|
|
4463
4365
|
});
|
|
4464
4366
|
}
|
|
4465
4367
|
/**
|
|
@@ -4487,13 +4389,17 @@ var EvmClient = class {
|
|
|
4487
4389
|
);
|
|
4488
4390
|
}
|
|
4489
4391
|
if (options.id) {
|
|
4490
|
-
const response = await
|
|
4392
|
+
const response = await getAccountV2(options.id);
|
|
4393
|
+
if (response.custody !== "Developer") {
|
|
4394
|
+
throw new AccountNotFoundError();
|
|
4395
|
+
}
|
|
4491
4396
|
return toEvmAccount(toEvmAccountData(response));
|
|
4492
4397
|
}
|
|
4493
4398
|
if (options.address) {
|
|
4494
|
-
const wallets = await
|
|
4399
|
+
const wallets = await getAccountsV2({
|
|
4495
4400
|
address: options.address,
|
|
4496
4401
|
chainType: "EVM",
|
|
4402
|
+
custody: "Developer",
|
|
4497
4403
|
limit: 1
|
|
4498
4404
|
});
|
|
4499
4405
|
if (wallets.data.length === 0) {
|
|
@@ -4503,6 +4409,15 @@ var EvmClient = class {
|
|
|
4503
4409
|
}
|
|
4504
4410
|
throw new AccountNotFoundError();
|
|
4505
4411
|
}
|
|
4412
|
+
async getLinkedAccounts(options) {
|
|
4413
|
+
const response = await getAccountsV2({
|
|
4414
|
+
address: options.address,
|
|
4415
|
+
accountType: "Delegated Account",
|
|
4416
|
+
chainType: "EVM",
|
|
4417
|
+
chainId: options.chainId
|
|
4418
|
+
});
|
|
4419
|
+
return response;
|
|
4420
|
+
}
|
|
4506
4421
|
/**
|
|
4507
4422
|
* Lists all EVM backend wallets.
|
|
4508
4423
|
*
|
|
@@ -4517,10 +4432,11 @@ var EvmClient = class {
|
|
|
4517
4432
|
* ```
|
|
4518
4433
|
*/
|
|
4519
4434
|
async listAccounts(options = {}) {
|
|
4520
|
-
const response = await
|
|
4435
|
+
const response = await getAccountsV2({
|
|
4521
4436
|
limit: options.limit,
|
|
4522
4437
|
skip: options.skip,
|
|
4523
|
-
chainType: "EVM"
|
|
4438
|
+
chainType: "EVM",
|
|
4439
|
+
custody: "Developer"
|
|
4524
4440
|
});
|
|
4525
4441
|
const accounts = response.data.map(
|
|
4526
4442
|
(wallet) => toEvmAccount(toEvmAccountData(wallet))
|
|
@@ -4567,7 +4483,8 @@ var EvmClient = class {
|
|
|
4567
4483
|
});
|
|
4568
4484
|
return toEvmAccount({
|
|
4569
4485
|
id: response.id,
|
|
4570
|
-
address: response.address
|
|
4486
|
+
address: response.address,
|
|
4487
|
+
walletId: response.walletId
|
|
4571
4488
|
});
|
|
4572
4489
|
} catch (error) {
|
|
4573
4490
|
if (error instanceof UserInputValidationError) {
|
|
@@ -4624,28 +4541,6 @@ var EvmClient = class {
|
|
|
4624
4541
|
});
|
|
4625
4542
|
return response.signature;
|
|
4626
4543
|
}
|
|
4627
|
-
/**
|
|
4628
|
-
* Updates an EVM backend wallet.
|
|
4629
|
-
*
|
|
4630
|
-
* Currently supports upgrading an EVM EOA to a Delegated Account (EIP-7702).
|
|
4631
|
-
*
|
|
4632
|
-
* @param options - Update options including account ID and delegation parameters
|
|
4633
|
-
* @returns The updated backend wallet response
|
|
4634
|
-
*
|
|
4635
|
-
* @example
|
|
4636
|
-
* ```typescript
|
|
4637
|
-
* const updated = await openfort.accounts.evm.backend.update({
|
|
4638
|
-
* id: 'acc_...',
|
|
4639
|
-
* accountType: 'Delegated Account',
|
|
4640
|
-
* chain: { chainType: 'EVM', chainId: 8453 },
|
|
4641
|
-
* implementationType: 'Calibur',
|
|
4642
|
-
* });
|
|
4643
|
-
* ```
|
|
4644
|
-
*/
|
|
4645
|
-
async update(options) {
|
|
4646
|
-
const { id, ...req } = options;
|
|
4647
|
-
return updateBackendWallet(id, req);
|
|
4648
|
-
}
|
|
4649
4544
|
};
|
|
4650
4545
|
EvmClient.type = "evmWallet";
|
|
4651
4546
|
|
|
@@ -4771,13 +4666,14 @@ var SolanaClient = class {
|
|
|
4771
4666
|
);
|
|
4772
4667
|
}
|
|
4773
4668
|
if (options.id) {
|
|
4774
|
-
const response = await
|
|
4669
|
+
const response = await getAccountV2(options.id);
|
|
4775
4670
|
return toSolanaAccount(toSolanaAccountData(response));
|
|
4776
4671
|
}
|
|
4777
4672
|
if (options.address) {
|
|
4778
|
-
const wallets = await
|
|
4673
|
+
const wallets = await getAccountsV2({
|
|
4779
4674
|
address: options.address,
|
|
4780
4675
|
chainType: "SVM",
|
|
4676
|
+
custody: "Developer",
|
|
4781
4677
|
limit: 1
|
|
4782
4678
|
});
|
|
4783
4679
|
if (wallets.data.length === 0) {
|
|
@@ -4801,10 +4697,11 @@ var SolanaClient = class {
|
|
|
4801
4697
|
* ```
|
|
4802
4698
|
*/
|
|
4803
4699
|
async listAccounts(options = {}) {
|
|
4804
|
-
const response = await
|
|
4700
|
+
const response = await getAccountsV2({
|
|
4805
4701
|
limit: options.limit,
|
|
4806
4702
|
skip: options.skip,
|
|
4807
|
-
chainType: "SVM"
|
|
4703
|
+
chainType: "SVM",
|
|
4704
|
+
custody: "Developer"
|
|
4808
4705
|
});
|
|
4809
4706
|
const accounts = response.data.map(
|
|
4810
4707
|
(wallet) => toSolanaAccount(toSolanaAccountData(wallet))
|
|
@@ -4927,6 +4824,92 @@ SolanaClient.type = "solanaWallet";
|
|
|
4927
4824
|
// src/index.ts
|
|
4928
4825
|
var import_shield_js2 = require("@openfort/shield-js");
|
|
4929
4826
|
|
|
4827
|
+
// src/wallets/evm/actions/sendTransaction.ts
|
|
4828
|
+
var import_viem2 = require("viem");
|
|
4829
|
+
var chains = __toESM(require("viem/chains"));
|
|
4830
|
+
var import_utils = require("viem/utils");
|
|
4831
|
+
|
|
4832
|
+
// src/wallets/evm/actions/updateToDelegated.ts
|
|
4833
|
+
async function update(options) {
|
|
4834
|
+
const { chainId, walletId, implementationType, accountId } = options;
|
|
4835
|
+
return createAccountV2({
|
|
4836
|
+
accountType: "Delegated Account",
|
|
4837
|
+
chainType: "EVM",
|
|
4838
|
+
chainId,
|
|
4839
|
+
user: walletId,
|
|
4840
|
+
implementationType,
|
|
4841
|
+
account: accountId
|
|
4842
|
+
});
|
|
4843
|
+
}
|
|
4844
|
+
|
|
4845
|
+
// src/wallets/evm/actions/sendTransaction.ts
|
|
4846
|
+
async function sendTransaction(options) {
|
|
4847
|
+
const { account, chainId, interactions, policy, rpcUrl } = options;
|
|
4848
|
+
const transport = rpcUrl ? (0, import_viem2.http)(rpcUrl) : (0, import_viem2.http)();
|
|
4849
|
+
const allChains = Object.values(chains);
|
|
4850
|
+
const chain = allChains.find((c) => c.id === chainId);
|
|
4851
|
+
if (!chain) {
|
|
4852
|
+
throw new DelegationError(
|
|
4853
|
+
`Unknown chain ID ${chainId}. Provide a custom rpcUrl for unsupported chains.`
|
|
4854
|
+
);
|
|
4855
|
+
}
|
|
4856
|
+
let signedAuthorization;
|
|
4857
|
+
let txAccountId;
|
|
4858
|
+
const response = await getAccountsV2({
|
|
4859
|
+
address: (0, import_viem2.getAddress)(account.address),
|
|
4860
|
+
accountType: "Delegated Account",
|
|
4861
|
+
chainType: "EVM",
|
|
4862
|
+
chainId
|
|
4863
|
+
});
|
|
4864
|
+
if (response.data.length === 0) {
|
|
4865
|
+
const updated = await update({
|
|
4866
|
+
walletId: account.walletId,
|
|
4867
|
+
chainId,
|
|
4868
|
+
implementationType: "Calibur",
|
|
4869
|
+
accountId: account.id
|
|
4870
|
+
});
|
|
4871
|
+
txAccountId = updated.id;
|
|
4872
|
+
const implementationAddress = "0x000000009b1d0af20d8c6d0a44e162d11f9b8f00";
|
|
4873
|
+
const publicClient = (0, import_viem2.createPublicClient)({ chain, transport });
|
|
4874
|
+
const eoaNonce = await publicClient.getTransactionCount({
|
|
4875
|
+
address: account.address
|
|
4876
|
+
});
|
|
4877
|
+
const authHash = (0, import_utils.hashAuthorization)({
|
|
4878
|
+
contractAddress: implementationAddress,
|
|
4879
|
+
chainId,
|
|
4880
|
+
nonce: eoaNonce
|
|
4881
|
+
});
|
|
4882
|
+
signedAuthorization = await account.sign({ hash: authHash });
|
|
4883
|
+
} else {
|
|
4884
|
+
txAccountId = response.data[0].id;
|
|
4885
|
+
}
|
|
4886
|
+
const txIntent = await createTransactionIntent({
|
|
4887
|
+
chainId,
|
|
4888
|
+
account: txAccountId,
|
|
4889
|
+
policy,
|
|
4890
|
+
signedAuthorization,
|
|
4891
|
+
interactions
|
|
4892
|
+
});
|
|
4893
|
+
if (!txIntent.nextAction?.payload?.signableHash) {
|
|
4894
|
+
return txIntent;
|
|
4895
|
+
}
|
|
4896
|
+
const txSignature = await account.sign({
|
|
4897
|
+
hash: txIntent.nextAction.payload.signableHash
|
|
4898
|
+
});
|
|
4899
|
+
return signature(txIntent.id, {
|
|
4900
|
+
signature: txSignature
|
|
4901
|
+
});
|
|
4902
|
+
}
|
|
4903
|
+
|
|
4904
|
+
// src/wallets/evm/actions/signMessage.ts
|
|
4905
|
+
var import_viem3 = require("viem");
|
|
4906
|
+
|
|
4907
|
+
// src/wallets/evm/actions/signTransaction.ts
|
|
4908
|
+
var import_viem4 = require("viem");
|
|
4909
|
+
|
|
4910
|
+
// src/wallets/evm/actions/signTypedData.ts
|
|
4911
|
+
var import_viem5 = require("viem");
|
|
4912
|
+
|
|
4930
4913
|
// src/policies/evmSchema.ts
|
|
4931
4914
|
var import_zod = require("zod");
|
|
4932
4915
|
var EthValueOperatorEnum = import_zod.z.enum(["<=", ">=", "<", ">"]);
|
|
@@ -5232,15 +5215,6 @@ var UpdatePolicyBodySchema = import_zod3.z.object({
|
|
|
5232
5215
|
rules: import_zod3.z.array(RuleSchema).min(1).max(10).optional()
|
|
5233
5216
|
});
|
|
5234
5217
|
|
|
5235
|
-
// src/wallets/evm/actions/signMessage.ts
|
|
5236
|
-
var import_viem2 = require("viem");
|
|
5237
|
-
|
|
5238
|
-
// src/wallets/evm/actions/signTransaction.ts
|
|
5239
|
-
var import_viem3 = require("viem");
|
|
5240
|
-
|
|
5241
|
-
// src/wallets/evm/actions/signTypedData.ts
|
|
5242
|
-
var import_viem4 = require("viem");
|
|
5243
|
-
|
|
5244
5218
|
// src/index.ts
|
|
5245
5219
|
function isValidSecretKey(key) {
|
|
5246
5220
|
return key.startsWith("sk_test_") || key.startsWith("sk_live_");
|
|
@@ -5336,7 +5310,9 @@ var Openfort = class {
|
|
|
5336
5310
|
/** Export private key (with E2E encryption) */
|
|
5337
5311
|
export: evmClient.exportAccount.bind(evmClient),
|
|
5338
5312
|
/** Update EOA to delegated account */
|
|
5339
|
-
update
|
|
5313
|
+
update,
|
|
5314
|
+
/** Delegate + create + sign + submit a gasless transaction in one call */
|
|
5315
|
+
sendTransaction
|
|
5340
5316
|
},
|
|
5341
5317
|
/** Embedded wallet operations (User custody) */
|
|
5342
5318
|
embedded: {
|
|
@@ -5556,10 +5532,14 @@ var Openfort = class {
|
|
|
5556
5532
|
* gas costs are sponsored according to the policy's strategy.
|
|
5557
5533
|
*/
|
|
5558
5534
|
get transactionIntents() {
|
|
5535
|
+
if (!this._evmClient) {
|
|
5536
|
+
this._evmClient = new EvmClient();
|
|
5537
|
+
}
|
|
5538
|
+
const _evmClient = this._evmClient;
|
|
5559
5539
|
return {
|
|
5560
5540
|
/** List transaction intents */
|
|
5561
5541
|
list: getTransactionIntents,
|
|
5562
|
-
/** Create a transaction intent with contract interactions */
|
|
5542
|
+
/** Create a transaction intent with contract interactions. */
|
|
5563
5543
|
create: createTransactionIntent,
|
|
5564
5544
|
/** Get a transaction intent by ID */
|
|
5565
5545
|
get: getTransactionIntent,
|
|
@@ -5704,9 +5684,7 @@ var Openfort = class {
|
|
|
5704
5684
|
/** Verify auth token */
|
|
5705
5685
|
verifyToken: verifyAuthToken,
|
|
5706
5686
|
/** Verify OAuth token */
|
|
5707
|
-
verifyOAuthToken
|
|
5708
|
-
/** Authorize */
|
|
5709
|
-
authorize
|
|
5687
|
+
verifyOAuthToken
|
|
5710
5688
|
}
|
|
5711
5689
|
};
|
|
5712
5690
|
}
|
|
@@ -5915,11 +5893,6 @@ var index_default = Openfort;
|
|
|
5915
5893
|
AuthProviderResponseV2,
|
|
5916
5894
|
AuthenticateOAuthRequestProvider,
|
|
5917
5895
|
AuthenticationType,
|
|
5918
|
-
BackendWalletListQueriesChainType,
|
|
5919
|
-
BackendWalletListResponseObject,
|
|
5920
|
-
BackendWalletResponseChainType,
|
|
5921
|
-
BackendWalletResponseCustody,
|
|
5922
|
-
BackendWalletResponseObject,
|
|
5923
5896
|
BasicAuthProvider,
|
|
5924
5897
|
BasicAuthProviderEMAIL,
|
|
5925
5898
|
BasicAuthProviderGUEST,
|
|
@@ -5947,6 +5920,7 @@ var index_default = Openfort;
|
|
|
5947
5920
|
CriteriaOperatorNOTIN,
|
|
5948
5921
|
CriteriaType,
|
|
5949
5922
|
Currency,
|
|
5923
|
+
DelegationError,
|
|
5950
5924
|
DeleteBackendWalletResponseObject,
|
|
5951
5925
|
DeveloperAccountResponseExpandable,
|
|
5952
5926
|
EmailTypeRequest,
|
|
@@ -6031,7 +6005,6 @@ var index_default = Openfort;
|
|
|
6031
6005
|
JsonRpcErrorResponseJsonrpc,
|
|
6032
6006
|
JsonRpcRequestJsonrpc,
|
|
6033
6007
|
JsonRpcSuccessResponseAnyJsonrpc,
|
|
6034
|
-
ListBackendWalletsChainType,
|
|
6035
6008
|
ListPoliciesScopeItem,
|
|
6036
6009
|
MintAddressCriterionOperator,
|
|
6037
6010
|
MintAddressCriterionRequestOperator,
|
|
@@ -6161,12 +6134,6 @@ var index_default = Openfort;
|
|
|
6161
6134
|
TransactionIntentResponseExpandable,
|
|
6162
6135
|
TransactionStatus,
|
|
6163
6136
|
UnknownError,
|
|
6164
|
-
UpdateBackendWalletRequestAccountType,
|
|
6165
|
-
UpdateBackendWalletRequestChainType,
|
|
6166
|
-
UpdateBackendWalletResponseChainType,
|
|
6167
|
-
UpdateBackendWalletResponseCustody,
|
|
6168
|
-
UpdateBackendWalletResponseDelegatedAccountChainChainType,
|
|
6169
|
-
UpdateBackendWalletResponseObject,
|
|
6170
6137
|
UpdatePolicyBodySchema,
|
|
6171
6138
|
UsageAlertType,
|
|
6172
6139
|
UserInputValidationError,
|
|
@@ -6179,7 +6146,6 @@ var index_default = Openfort;
|
|
|
6179
6146
|
authApi,
|
|
6180
6147
|
authSchemas,
|
|
6181
6148
|
authenticateSIWE,
|
|
6182
|
-
authorize,
|
|
6183
6149
|
callbackOAuth,
|
|
6184
6150
|
cancelTransferAccountOwnership,
|
|
6185
6151
|
configure,
|
|
@@ -6241,7 +6207,6 @@ var index_default = Openfort;
|
|
|
6241
6207
|
getAuthPlayers,
|
|
6242
6208
|
getAuthUser,
|
|
6243
6209
|
getAuthUsers,
|
|
6244
|
-
getBackendWallet,
|
|
6245
6210
|
getConfig,
|
|
6246
6211
|
getContract,
|
|
6247
6212
|
getContracts,
|
|
@@ -6290,7 +6255,6 @@ var index_default = Openfort;
|
|
|
6290
6255
|
linkSIWE,
|
|
6291
6256
|
linkThirdParty,
|
|
6292
6257
|
list,
|
|
6293
|
-
listBackendWallets,
|
|
6294
6258
|
listFeeSponsorships,
|
|
6295
6259
|
listForwarderContracts,
|
|
6296
6260
|
listOAuthConfig,
|
|
@@ -6298,7 +6262,6 @@ var index_default = Openfort;
|
|
|
6298
6262
|
listPolicies,
|
|
6299
6263
|
listSubscriptionLogs,
|
|
6300
6264
|
loginEmailPassword,
|
|
6301
|
-
loginOIDC,
|
|
6302
6265
|
loginWithIdToken,
|
|
6303
6266
|
logout,
|
|
6304
6267
|
me,
|
|
@@ -6332,7 +6295,6 @@ var index_default = Openfort;
|
|
|
6332
6295
|
unlinkEmail,
|
|
6333
6296
|
unlinkOAuth,
|
|
6334
6297
|
unlinkSIWE,
|
|
6335
|
-
updateBackendWallet,
|
|
6336
6298
|
updateContract,
|
|
6337
6299
|
updateDeveloperAccount,
|
|
6338
6300
|
updateFeeSponsorship,
|