@openfort/openfort-node 0.8.0 → 0.8.2
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/dist/index.d.mts +4 -28
- package/dist/index.d.ts +4 -28
- package/dist/index.js +13 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -10
- package/dist/index.mjs.map +1 -1
- package/openapi.json +3 -33
- package/package.json +1 -1
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.8.
|
|
377
|
+
var VERSION = "0.8.2";
|
|
378
378
|
var PACKAGE = "@openfort/openfort-node";
|
|
379
379
|
|
|
380
380
|
// src/openapi-client/openfortApiClient.ts
|
|
@@ -443,6 +443,10 @@ var configure = (options) => {
|
|
|
443
443
|
retryDelay: exponentialDelay,
|
|
444
444
|
retries: 3,
|
|
445
445
|
retryCondition: (error) => {
|
|
446
|
+
const hasWalletAuth = error.config?.headers?.["X-Wallet-Auth"] !== void 0;
|
|
447
|
+
if (hasWalletAuth) {
|
|
448
|
+
return false;
|
|
449
|
+
}
|
|
446
450
|
return axiosRetry.isNetworkOrIdempotentRequestError(error) || error.response?.status !== void 0 && error.response.status >= 500;
|
|
447
451
|
}
|
|
448
452
|
});
|
|
@@ -578,7 +582,8 @@ function handleResponseError(statusCode, responseData, cause) {
|
|
|
578
582
|
const correlationId = isOpenfortError(responseData) ? responseData.correlationId : void 0;
|
|
579
583
|
let errorMessage;
|
|
580
584
|
if (isOpenfortError(responseData)) {
|
|
581
|
-
|
|
585
|
+
const nestedMessage = responseData.error && typeof responseData.error === "object" ? responseData.error.message : void 0;
|
|
586
|
+
errorMessage = responseData.message || nestedMessage || (typeof responseData.error === "string" ? responseData.error : void 0) || "Unknown error";
|
|
582
587
|
} else if (typeof responseData === "string") {
|
|
583
588
|
errorMessage = responseData;
|
|
584
589
|
} else if (responseData) {
|
|
@@ -604,7 +609,7 @@ function handleResponseError(statusCode, responseData, cause) {
|
|
|
604
609
|
throw new APIError(
|
|
605
610
|
statusCode,
|
|
606
611
|
"unauthorized",
|
|
607
|
-
"Unauthorized. Check your API key.",
|
|
612
|
+
errorMessage || "Unauthorized. Check your API key.",
|
|
608
613
|
correlationId,
|
|
609
614
|
`${ERROR_DOCS_URL}#unauthorized`,
|
|
610
615
|
cause
|
|
@@ -3753,6 +3758,7 @@ import {
|
|
|
3753
3758
|
getTypesForEIP712Domain,
|
|
3754
3759
|
hashMessage,
|
|
3755
3760
|
hashTypedData,
|
|
3761
|
+
keccak256,
|
|
3756
3762
|
parseSignature,
|
|
3757
3763
|
serializeTransaction
|
|
3758
3764
|
} from "viem";
|
|
@@ -3793,7 +3799,8 @@ function toEvmAccount(data) {
|
|
|
3793
3799
|
},
|
|
3794
3800
|
async signTransaction(transaction) {
|
|
3795
3801
|
const serialized = serializeTransaction(transaction);
|
|
3796
|
-
const
|
|
3802
|
+
const hash = keccak256(serialized);
|
|
3803
|
+
const response = await sign(id, { data: hash });
|
|
3797
3804
|
const signature2 = parseSignature(response.signature);
|
|
3798
3805
|
const signedTransaction = serializeTransaction(
|
|
3799
3806
|
transaction,
|
|
@@ -3973,8 +3980,7 @@ var EvmClient = class {
|
|
|
3973
3980
|
);
|
|
3974
3981
|
const response = await importPrivateKey({
|
|
3975
3982
|
encryptedPrivateKey,
|
|
3976
|
-
chainType: "EVM"
|
|
3977
|
-
name: options.name
|
|
3983
|
+
chainType: "EVM"
|
|
3978
3984
|
});
|
|
3979
3985
|
return toEvmAccount({
|
|
3980
3986
|
id: response.id,
|
|
@@ -4214,7 +4220,7 @@ var SolanaClient = class {
|
|
|
4214
4220
|
* ```typescript
|
|
4215
4221
|
* const account = await openfort.solana.importAccount({
|
|
4216
4222
|
* privateKey: '5K...', // base58 or hex format
|
|
4217
|
-
*
|
|
4223
|
+
* // base58 or hex format
|
|
4218
4224
|
* });
|
|
4219
4225
|
* ```
|
|
4220
4226
|
*/
|
|
@@ -4257,8 +4263,7 @@ var SolanaClient = class {
|
|
|
4257
4263
|
);
|
|
4258
4264
|
const response = await importPrivateKey({
|
|
4259
4265
|
encryptedPrivateKey,
|
|
4260
|
-
chainType: "SVM"
|
|
4261
|
-
name: options.name
|
|
4266
|
+
chainType: "SVM"
|
|
4262
4267
|
});
|
|
4263
4268
|
return toSolanaAccount({
|
|
4264
4269
|
id: response.id,
|
|
@@ -4595,7 +4600,7 @@ import { hashMessage as hashMessage2, toHex } from "viem";
|
|
|
4595
4600
|
|
|
4596
4601
|
// src/wallets/evm/actions/signTransaction.ts
|
|
4597
4602
|
import {
|
|
4598
|
-
keccak256,
|
|
4603
|
+
keccak256 as keccak2562,
|
|
4599
4604
|
parseSignature as parseSignature2,
|
|
4600
4605
|
serializeTransaction as serializeTransaction2
|
|
4601
4606
|
} from "viem";
|