@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.js CHANGED
@@ -96,6 +96,7 @@ __export(index_exports, {
96
96
  EntityTypeTRANSACTIONINTENT: () => EntityTypeTRANSACTIONINTENT,
97
97
  EntityTypeTRIGGER: () => EntityTypeTRIGGER,
98
98
  EntityTypeUSER: () => EntityTypeUSER,
99
+ EntityTypeWALLET: () => EntityTypeWALLET,
99
100
  ErrorTypeINVALIDREQUESTERROR: () => ErrorTypeINVALIDREQUESTERROR,
100
101
  EvmClient: () => EvmClient,
101
102
  ExportPrivateKeyResponseObject: () => ExportPrivateKeyResponseObject,
@@ -177,7 +178,6 @@ __export(index_exports, {
177
178
  TimeIntervalType: () => TimeIntervalType,
178
179
  TimeoutError: () => TimeoutError,
179
180
  TokenType: () => TokenType,
180
- TradeType: () => TradeType,
181
181
  TransactionAbstractionType: () => TransactionAbstractionType,
182
182
  TransactionIntentResponseExpandable: () => TransactionIntentResponseExpandable,
183
183
  TransactionStatus: () => TransactionStatus,
@@ -216,7 +216,6 @@ __export(index_exports, {
216
216
  createPolicyWithdrawal: () => createPolicyWithdrawal,
217
217
  createSession: () => createSession,
218
218
  createSubscription: () => createSubscription,
219
- createSwap: () => createSwap,
220
219
  createTransactionIntent: () => createTransactionIntent,
221
220
  createTrigger: () => createTrigger,
222
221
  decryptExportedPrivateKey: () => decryptExportedPrivateKey,
@@ -283,6 +282,7 @@ __export(index_exports, {
283
282
  getTransactionIntents: () => getTransactionIntents,
284
283
  getTrigger: () => getTrigger,
285
284
  getTriggers: () => getTriggers,
285
+ getUserWallet: () => getUserWallet,
286
286
  getVerificationPayload: () => getVerificationPayload,
287
287
  getWebhookLogsByProjectId: () => getWebhookLogsByProjectId,
288
288
  grantOAuth: () => grantOAuth,
@@ -312,7 +312,6 @@ __export(index_exports, {
312
312
  poolOAuth: () => poolOAuth,
313
313
  pregenerateUserV2: () => pregenerateUserV2,
314
314
  query: () => query,
315
- quoteSwap: () => quoteSwap,
316
315
  readContract: () => readContract,
317
316
  refresh: () => refresh,
318
317
  registerGuest: () => registerGuest,
@@ -720,7 +719,7 @@ function requiresWalletAuth(requestMethod, requestPath) {
720
719
  }
721
720
 
722
721
  // src/version.ts
723
- var VERSION = "0.7.5";
722
+ var VERSION = "0.7.7";
724
723
  var PACKAGE = "@openfort/openfort-node";
725
724
 
726
725
  // src/openapi-client/openfortApiClient.ts
@@ -2417,30 +2416,6 @@ var deleteEvent = (id, options) => {
2417
2416
  );
2418
2417
  };
2419
2418
 
2420
- // src/openapi-client/generated/exchange/exchange.ts
2421
- var createSwap = (createExchangeRequest, options) => {
2422
- return openfortApiClient(
2423
- {
2424
- url: `/v1/exchange`,
2425
- method: "POST",
2426
- headers: { "Content-Type": "application/json" },
2427
- data: createExchangeRequest
2428
- },
2429
- options
2430
- );
2431
- };
2432
- var quoteSwap = (createExchangeRequest, options) => {
2433
- return openfortApiClient(
2434
- {
2435
- url: `/v1/exchange/quote`,
2436
- method: "POST",
2437
- headers: { "Content-Type": "application/json" },
2438
- data: createExchangeRequest
2439
- },
2440
- options
2441
- );
2442
- };
2443
-
2444
2419
  // src/openapi-client/generated/forwarder-contract/forwarder-contract.ts
2445
2420
  var createForwarderContract = (createForwarderContractRequest, options) => {
2446
2421
  return openfortApiClient(
@@ -2731,10 +2706,6 @@ var OnrampProvider = {
2731
2706
  var EntityTypeFORWARDERCONTRACT = {
2732
2707
  forwarderContract: "forwarderContract"
2733
2708
  };
2734
- var TradeType = {
2735
- EXACT_INPUT: "EXACT_INPUT",
2736
- EXACT_OUTPUT: "EXACT_OUTPUT"
2737
- };
2738
2709
  var APITopicBALANCECONTRACT = {
2739
2710
  balancecontract: "balance.contract"
2740
2711
  };
@@ -2777,6 +2748,9 @@ var AuthProviderResponseV2 = {
2777
2748
  oidc: "oidc",
2778
2749
  siwe: "siwe"
2779
2750
  };
2751
+ var EntityTypeWALLET = {
2752
+ wallet: "wallet"
2753
+ };
2780
2754
  var PregenerateAccountResponseCustody = {
2781
2755
  Developer: "Developer",
2782
2756
  User: "User"
@@ -3727,6 +3701,15 @@ var deleteUser = (id, options) => {
3727
3701
  options
3728
3702
  );
3729
3703
  };
3704
+ var getUserWallet = (id, options) => {
3705
+ return openfortApiClient(
3706
+ {
3707
+ url: `/v2/users/${id}/wallet`,
3708
+ method: "GET"
3709
+ },
3710
+ options
3711
+ );
3712
+ };
3730
3713
  var pregenerateUserV2 = (pregenerateUserRequestV2, options) => {
3731
3714
  return openfortApiClient(
3732
3715
  {
@@ -3832,6 +3815,9 @@ var decryptExportedPrivateKey = (encryptedPrivateKeyBase64, privateKeyPem) => {
3832
3815
  return decrypted.toString("hex");
3833
3816
  };
3834
3817
 
3818
+ // src/wallets/evm/accounts/evmAccount.ts
3819
+ var import_viem = require("viem");
3820
+
3835
3821
  // src/wallets/evm/actions/signHash.ts
3836
3822
  async function signHash(options) {
3837
3823
  const { accountId, hash } = options;
@@ -3841,53 +3827,6 @@ async function signHash(options) {
3841
3827
  };
3842
3828
  }
3843
3829
 
3844
- // src/wallets/evm/actions/signMessage.ts
3845
- var import_viem = require("viem");
3846
- async function signMessage(options) {
3847
- const { accountId, message } = options;
3848
- let messageStr;
3849
- if (typeof message === "string") {
3850
- messageStr = message;
3851
- } else if (message instanceof Uint8Array) {
3852
- messageStr = (0, import_viem.toHex)(message);
3853
- } else if ("raw" in message) {
3854
- messageStr = typeof message.raw === "string" ? message.raw : (0, import_viem.toHex)(message.raw);
3855
- } else {
3856
- throw new UserInputValidationError("Invalid message format");
3857
- }
3858
- const messageHash = (0, import_viem.hashMessage)(messageStr);
3859
- const response = await sign(accountId, { data: messageHash });
3860
- return {
3861
- signature: response.signature
3862
- };
3863
- }
3864
-
3865
- // src/wallets/evm/actions/signTransaction.ts
3866
- var import_viem2 = require("viem");
3867
- async function signTransaction(options) {
3868
- const { accountId, transaction } = options;
3869
- const serialized = (0, import_viem2.serializeTransaction)(transaction);
3870
- const response = await sign(accountId, { data: serialized });
3871
- const signature2 = (0, import_viem2.parseSignature)(response.signature);
3872
- const signedTransaction = (0, import_viem2.serializeTransaction)(transaction, signature2);
3873
- const transactionHash = (0, import_viem2.keccak256)(signedTransaction);
3874
- return {
3875
- signedTransaction,
3876
- transactionHash
3877
- };
3878
- }
3879
-
3880
- // src/wallets/evm/actions/signTypedData.ts
3881
- var import_viem3 = require("viem");
3882
- async function signTypedData(options) {
3883
- const { accountId, typedData } = options;
3884
- const hash = (0, import_viem3.hashTypedData)(typedData);
3885
- const response = await sign(accountId, { data: hash });
3886
- return {
3887
- signature: response.signature
3888
- };
3889
- }
3890
-
3891
3830
  // src/wallets/evm/accounts/evmAccount.ts
3892
3831
  function toEvmAccount(data) {
3893
3832
  const { id, address } = data;
@@ -3903,27 +3842,44 @@ function toEvmAccount(data) {
3903
3842
  return result.signature;
3904
3843
  },
3905
3844
  async signMessage(parameters) {
3906
- const result = await signMessage({
3907
- address,
3908
- accountId: id,
3909
- message: parameters.message
3910
- });
3845
+ const { message } = parameters;
3846
+ if (typeof message === "string") {
3847
+ const hash2 = (0, import_viem.hashMessage)(message);
3848
+ const result2 = await sign(id, { data: hash2 });
3849
+ return result2.signature;
3850
+ }
3851
+ const hash = (0, import_viem.hashMessage)(message);
3852
+ const result = await sign(id, { data: hash });
3911
3853
  return result.signature;
3912
3854
  },
3913
3855
  async signTransaction(transaction) {
3914
- const result = await signTransaction({
3915
- address,
3916
- accountId: id,
3917
- transaction
3918
- });
3919
- return result.signedTransaction;
3856
+ const serialized = (0, import_viem.serializeTransaction)(transaction);
3857
+ const response = await sign(id, { data: serialized });
3858
+ const signature2 = (0, import_viem.parseSignature)(response.signature);
3859
+ const signedTransaction = (0, import_viem.serializeTransaction)(
3860
+ transaction,
3861
+ signature2
3862
+ );
3863
+ return signedTransaction;
3920
3864
  },
3921
3865
  async signTypedData(parameters) {
3922
- const result = await signTypedData({
3923
- address,
3924
- accountId: id,
3925
- typedData: parameters
3926
- });
3866
+ const {
3867
+ domain = {},
3868
+ message,
3869
+ primaryType
3870
+ } = parameters;
3871
+ const types = {
3872
+ EIP712Domain: (0, import_viem.getTypesForEIP712Domain)({ domain }),
3873
+ ...parameters.types
3874
+ };
3875
+ const openApiMessage = {
3876
+ domain,
3877
+ types,
3878
+ primaryType,
3879
+ message
3880
+ };
3881
+ const hash = (0, import_viem.hashTypedData)(openApiMessage);
3882
+ const result = await sign(id, { data: hash });
3927
3883
  return result.signature;
3928
3884
  }
3929
3885
  };
@@ -4147,7 +4103,7 @@ EvmClient.type = "evmWallet";
4147
4103
  var import_bs58 = __toESM(require("bs58"));
4148
4104
 
4149
4105
  // src/wallets/solana/actions/signMessage.ts
4150
- async function signMessage2(options) {
4106
+ async function signMessage(options) {
4151
4107
  const { accountId, message } = options;
4152
4108
  const messageBytes = Buffer.from(message, "utf-8");
4153
4109
  const messageHex = `0x${messageBytes.toString("hex")}`;
@@ -4158,7 +4114,7 @@ async function signMessage2(options) {
4158
4114
  }
4159
4115
 
4160
4116
  // src/wallets/solana/actions/signTransaction.ts
4161
- async function signTransaction2(options) {
4117
+ async function signTransaction(options) {
4162
4118
  const { accountId, transaction } = options;
4163
4119
  const txBytes = Buffer.from(transaction, "base64");
4164
4120
  const txHex = `0x${txBytes.toString("hex")}`;
@@ -4176,14 +4132,14 @@ function toSolanaAccount(data) {
4176
4132
  address,
4177
4133
  custody: "Developer",
4178
4134
  async signMessage(parameters) {
4179
- const result = await signMessage2({
4135
+ const result = await signMessage({
4180
4136
  accountId: id,
4181
4137
  message: parameters.message
4182
4138
  });
4183
4139
  return result.signature;
4184
4140
  },
4185
4141
  async signTransaction(parameters) {
4186
- const result = await signTransaction2({
4142
+ const result = await signTransaction({
4187
4143
  accountId: id,
4188
4144
  transaction: parameters.transaction
4189
4145
  });
@@ -4421,6 +4377,17 @@ SolanaClient.type = "solanaWallet";
4421
4377
 
4422
4378
  // src/index.ts
4423
4379
  var import_shield_js2 = require("@openfort/shield-js");
4380
+
4381
+ // src/wallets/evm/actions/signMessage.ts
4382
+ var import_viem2 = require("viem");
4383
+
4384
+ // src/wallets/evm/actions/signTransaction.ts
4385
+ var import_viem3 = require("viem");
4386
+
4387
+ // src/wallets/evm/actions/signTypedData.ts
4388
+ var import_viem4 = require("viem");
4389
+
4390
+ // src/index.ts
4424
4391
  function isValidSecretKey(key) {
4425
4392
  return key.startsWith("sk_test_") || key.startsWith("sk_live_");
4426
4393
  }
@@ -4745,20 +4712,6 @@ var Openfort = class {
4745
4712
  };
4746
4713
  }
4747
4714
  // ============================================
4748
- // Exchange API
4749
- // ============================================
4750
- /**
4751
- * Exchange endpoints
4752
- */
4753
- get exchange() {
4754
- return {
4755
- /** Create swap */
4756
- createSwap,
4757
- /** Get swap quote */
4758
- quoteSwap
4759
- };
4760
- }
4761
- // ============================================
4762
4715
  // Auth API
4763
4716
  // ============================================
4764
4717
  /**
@@ -5077,6 +5030,7 @@ var index_default = Openfort;
5077
5030
  EntityTypeTRANSACTIONINTENT,
5078
5031
  EntityTypeTRIGGER,
5079
5032
  EntityTypeUSER,
5033
+ EntityTypeWALLET,
5080
5034
  ErrorTypeINVALIDREQUESTERROR,
5081
5035
  EvmClient,
5082
5036
  ExportPrivateKeyResponseObject,
@@ -5158,7 +5112,6 @@ var index_default = Openfort;
5158
5112
  TimeIntervalType,
5159
5113
  TimeoutError,
5160
5114
  TokenType,
5161
- TradeType,
5162
5115
  TransactionAbstractionType,
5163
5116
  TransactionIntentResponseExpandable,
5164
5117
  TransactionStatus,
@@ -5197,7 +5150,6 @@ var index_default = Openfort;
5197
5150
  createPolicyWithdrawal,
5198
5151
  createSession,
5199
5152
  createSubscription,
5200
- createSwap,
5201
5153
  createTransactionIntent,
5202
5154
  createTrigger,
5203
5155
  decryptExportedPrivateKey,
@@ -5263,6 +5215,7 @@ var index_default = Openfort;
5263
5215
  getTransactionIntents,
5264
5216
  getTrigger,
5265
5217
  getTriggers,
5218
+ getUserWallet,
5266
5219
  getVerificationPayload,
5267
5220
  getWebhookLogsByProjectId,
5268
5221
  grantOAuth,
@@ -5292,7 +5245,6 @@ var index_default = Openfort;
5292
5245
  poolOAuth,
5293
5246
  pregenerateUserV2,
5294
5247
  query,
5295
- quoteSwap,
5296
5248
  readContract,
5297
5249
  refresh,
5298
5250
  registerGuest,