@openfort/openfort-node 0.7.5 → 0.7.7

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/dist/index.mjs CHANGED
@@ -374,7 +374,7 @@ function requiresWalletAuth(requestMethod, requestPath) {
374
374
  }
375
375
 
376
376
  // src/version.ts
377
- var VERSION = "0.7.5";
377
+ var VERSION = "0.7.7";
378
378
  var PACKAGE = "@openfort/openfort-node";
379
379
 
380
380
  // src/openapi-client/openfortApiClient.ts
@@ -2071,30 +2071,6 @@ var deleteEvent = (id, options) => {
2071
2071
  );
2072
2072
  };
2073
2073
 
2074
- // src/openapi-client/generated/exchange/exchange.ts
2075
- var createSwap = (createExchangeRequest, options) => {
2076
- return openfortApiClient(
2077
- {
2078
- url: `/v1/exchange`,
2079
- method: "POST",
2080
- headers: { "Content-Type": "application/json" },
2081
- data: createExchangeRequest
2082
- },
2083
- options
2084
- );
2085
- };
2086
- var quoteSwap = (createExchangeRequest, options) => {
2087
- return openfortApiClient(
2088
- {
2089
- url: `/v1/exchange/quote`,
2090
- method: "POST",
2091
- headers: { "Content-Type": "application/json" },
2092
- data: createExchangeRequest
2093
- },
2094
- options
2095
- );
2096
- };
2097
-
2098
2074
  // src/openapi-client/generated/forwarder-contract/forwarder-contract.ts
2099
2075
  var createForwarderContract = (createForwarderContractRequest, options) => {
2100
2076
  return openfortApiClient(
@@ -2385,10 +2361,6 @@ var OnrampProvider = {
2385
2361
  var EntityTypeFORWARDERCONTRACT = {
2386
2362
  forwarderContract: "forwarderContract"
2387
2363
  };
2388
- var TradeType = {
2389
- EXACT_INPUT: "EXACT_INPUT",
2390
- EXACT_OUTPUT: "EXACT_OUTPUT"
2391
- };
2392
2364
  var APITopicBALANCECONTRACT = {
2393
2365
  balancecontract: "balance.contract"
2394
2366
  };
@@ -2431,6 +2403,9 @@ var AuthProviderResponseV2 = {
2431
2403
  oidc: "oidc",
2432
2404
  siwe: "siwe"
2433
2405
  };
2406
+ var EntityTypeWALLET = {
2407
+ wallet: "wallet"
2408
+ };
2434
2409
  var PregenerateAccountResponseCustody = {
2435
2410
  Developer: "Developer",
2436
2411
  User: "User"
@@ -3381,6 +3356,15 @@ var deleteUser = (id, options) => {
3381
3356
  options
3382
3357
  );
3383
3358
  };
3359
+ var getUserWallet = (id, options) => {
3360
+ return openfortApiClient(
3361
+ {
3362
+ url: `/v2/users/${id}/wallet`,
3363
+ method: "GET"
3364
+ },
3365
+ options
3366
+ );
3367
+ };
3384
3368
  var pregenerateUserV2 = (pregenerateUserRequestV2, options) => {
3385
3369
  return openfortApiClient(
3386
3370
  {
@@ -3491,60 +3475,18 @@ var decryptExportedPrivateKey = (encryptedPrivateKeyBase64, privateKeyPem) => {
3491
3475
  return decrypted.toString("hex");
3492
3476
  };
3493
3477
 
3494
- // src/wallets/evm/actions/signHash.ts
3495
- async function signHash(options) {
3496
- const { accountId, hash } = options;
3497
- const response = await sign(accountId, { data: hash });
3498
- return {
3499
- signature: response.signature
3500
- };
3501
- }
3502
-
3503
- // src/wallets/evm/actions/signMessage.ts
3504
- import { hashMessage, toHex } from "viem";
3505
- async function signMessage(options) {
3506
- const { accountId, message } = options;
3507
- let messageStr;
3508
- if (typeof message === "string") {
3509
- messageStr = message;
3510
- } else if (message instanceof Uint8Array) {
3511
- messageStr = toHex(message);
3512
- } else if ("raw" in message) {
3513
- messageStr = typeof message.raw === "string" ? message.raw : toHex(message.raw);
3514
- } else {
3515
- throw new UserInputValidationError("Invalid message format");
3516
- }
3517
- const messageHash = hashMessage(messageStr);
3518
- const response = await sign(accountId, { data: messageHash });
3519
- return {
3520
- signature: response.signature
3521
- };
3522
- }
3523
-
3524
- // src/wallets/evm/actions/signTransaction.ts
3478
+ // src/wallets/evm/accounts/evmAccount.ts
3525
3479
  import {
3526
- keccak256,
3480
+ getTypesForEIP712Domain,
3481
+ hashMessage,
3482
+ hashTypedData,
3527
3483
  parseSignature,
3528
3484
  serializeTransaction
3529
3485
  } from "viem";
3530
- async function signTransaction(options) {
3531
- const { accountId, transaction } = options;
3532
- const serialized = serializeTransaction(transaction);
3533
- const response = await sign(accountId, { data: serialized });
3534
- const signature2 = parseSignature(response.signature);
3535
- const signedTransaction = serializeTransaction(transaction, signature2);
3536
- const transactionHash = keccak256(signedTransaction);
3537
- return {
3538
- signedTransaction,
3539
- transactionHash
3540
- };
3541
- }
3542
3486
 
3543
- // src/wallets/evm/actions/signTypedData.ts
3544
- import { hashTypedData } from "viem";
3545
- async function signTypedData(options) {
3546
- const { accountId, typedData } = options;
3547
- const hash = hashTypedData(typedData);
3487
+ // src/wallets/evm/actions/signHash.ts
3488
+ async function signHash(options) {
3489
+ const { accountId, hash } = options;
3548
3490
  const response = await sign(accountId, { data: hash });
3549
3491
  return {
3550
3492
  signature: response.signature
@@ -3566,27 +3508,44 @@ function toEvmAccount(data) {
3566
3508
  return result.signature;
3567
3509
  },
3568
3510
  async signMessage(parameters) {
3569
- const result = await signMessage({
3570
- address,
3571
- accountId: id,
3572
- message: parameters.message
3573
- });
3511
+ const { message } = parameters;
3512
+ if (typeof message === "string") {
3513
+ const hash2 = hashMessage(message);
3514
+ const result2 = await sign(id, { data: hash2 });
3515
+ return result2.signature;
3516
+ }
3517
+ const hash = hashMessage(message);
3518
+ const result = await sign(id, { data: hash });
3574
3519
  return result.signature;
3575
3520
  },
3576
3521
  async signTransaction(transaction) {
3577
- const result = await signTransaction({
3578
- address,
3579
- accountId: id,
3580
- transaction
3581
- });
3582
- return result.signedTransaction;
3522
+ const serialized = serializeTransaction(transaction);
3523
+ const response = await sign(id, { data: serialized });
3524
+ const signature2 = parseSignature(response.signature);
3525
+ const signedTransaction = serializeTransaction(
3526
+ transaction,
3527
+ signature2
3528
+ );
3529
+ return signedTransaction;
3583
3530
  },
3584
3531
  async signTypedData(parameters) {
3585
- const result = await signTypedData({
3586
- address,
3587
- accountId: id,
3588
- typedData: parameters
3589
- });
3532
+ const {
3533
+ domain = {},
3534
+ message,
3535
+ primaryType
3536
+ } = parameters;
3537
+ const types = {
3538
+ EIP712Domain: getTypesForEIP712Domain({ domain }),
3539
+ ...parameters.types
3540
+ };
3541
+ const openApiMessage = {
3542
+ domain,
3543
+ types,
3544
+ primaryType,
3545
+ message
3546
+ };
3547
+ const hash = hashTypedData(openApiMessage);
3548
+ const result = await sign(id, { data: hash });
3590
3549
  return result.signature;
3591
3550
  }
3592
3551
  };
@@ -3810,7 +3769,7 @@ EvmClient.type = "evmWallet";
3810
3769
  import bs58 from "bs58";
3811
3770
 
3812
3771
  // src/wallets/solana/actions/signMessage.ts
3813
- async function signMessage2(options) {
3772
+ async function signMessage(options) {
3814
3773
  const { accountId, message } = options;
3815
3774
  const messageBytes = Buffer.from(message, "utf-8");
3816
3775
  const messageHex = `0x${messageBytes.toString("hex")}`;
@@ -3821,7 +3780,7 @@ async function signMessage2(options) {
3821
3780
  }
3822
3781
 
3823
3782
  // src/wallets/solana/actions/signTransaction.ts
3824
- async function signTransaction2(options) {
3783
+ async function signTransaction(options) {
3825
3784
  const { accountId, transaction } = options;
3826
3785
  const txBytes = Buffer.from(transaction, "base64");
3827
3786
  const txHex = `0x${txBytes.toString("hex")}`;
@@ -3839,14 +3798,14 @@ function toSolanaAccount(data) {
3839
3798
  address,
3840
3799
  custody: "Developer",
3841
3800
  async signMessage(parameters) {
3842
- const result = await signMessage2({
3801
+ const result = await signMessage({
3843
3802
  accountId: id,
3844
3803
  message: parameters.message
3845
3804
  });
3846
3805
  return result.signature;
3847
3806
  },
3848
3807
  async signTransaction(parameters) {
3849
- const result = await signTransaction2({
3808
+ const result = await signTransaction({
3850
3809
  accountId: id,
3851
3810
  transaction: parameters.transaction
3852
3811
  });
@@ -4084,6 +4043,21 @@ SolanaClient.type = "solanaWallet";
4084
4043
 
4085
4044
  // src/index.ts
4086
4045
  import { ShieldAuthProvider as ShieldAuthProvider2 } from "@openfort/shield-js";
4046
+
4047
+ // src/wallets/evm/actions/signMessage.ts
4048
+ import { hashMessage as hashMessage2, toHex } from "viem";
4049
+
4050
+ // src/wallets/evm/actions/signTransaction.ts
4051
+ import {
4052
+ keccak256,
4053
+ parseSignature as parseSignature2,
4054
+ serializeTransaction as serializeTransaction2
4055
+ } from "viem";
4056
+
4057
+ // src/wallets/evm/actions/signTypedData.ts
4058
+ import { hashTypedData as hashTypedData2 } from "viem";
4059
+
4060
+ // src/index.ts
4087
4061
  function isValidSecretKey(key) {
4088
4062
  return key.startsWith("sk_test_") || key.startsWith("sk_live_");
4089
4063
  }
@@ -4408,20 +4382,6 @@ var Openfort = class {
4408
4382
  };
4409
4383
  }
4410
4384
  // ============================================
4411
- // Exchange API
4412
- // ============================================
4413
- /**
4414
- * Exchange endpoints
4415
- */
4416
- get exchange() {
4417
- return {
4418
- /** Create swap */
4419
- createSwap,
4420
- /** Get swap quote */
4421
- quoteSwap
4422
- };
4423
- }
4424
- // ============================================
4425
4385
  // Auth API
4426
4386
  // ============================================
4427
4387
  /**
@@ -4739,6 +4699,7 @@ export {
4739
4699
  EntityTypeTRANSACTIONINTENT,
4740
4700
  EntityTypeTRIGGER,
4741
4701
  EntityTypeUSER,
4702
+ EntityTypeWALLET,
4742
4703
  ErrorTypeINVALIDREQUESTERROR,
4743
4704
  EvmClient,
4744
4705
  ExportPrivateKeyResponseObject,
@@ -4820,7 +4781,6 @@ export {
4820
4781
  TimeIntervalType,
4821
4782
  TimeoutError,
4822
4783
  TokenType,
4823
- TradeType,
4824
4784
  TransactionAbstractionType,
4825
4785
  TransactionIntentResponseExpandable,
4826
4786
  TransactionStatus,
@@ -4859,7 +4819,6 @@ export {
4859
4819
  createPolicyWithdrawal,
4860
4820
  createSession,
4861
4821
  createSubscription,
4862
- createSwap,
4863
4822
  createTransactionIntent,
4864
4823
  createTrigger,
4865
4824
  decryptExportedPrivateKey,
@@ -4926,6 +4885,7 @@ export {
4926
4885
  getTransactionIntents,
4927
4886
  getTrigger,
4928
4887
  getTriggers,
4888
+ getUserWallet,
4929
4889
  getVerificationPayload,
4930
4890
  getWebhookLogsByProjectId,
4931
4891
  grantOAuth,
@@ -4955,7 +4915,6 @@ export {
4955
4915
  poolOAuth,
4956
4916
  pregenerateUserV2,
4957
4917
  query,
4958
- quoteSwap,
4959
4918
  readContract,
4960
4919
  refresh,
4961
4920
  registerGuest,