@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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.8.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#63](https://github.com/openfort-xyz/openfort-node/pull/63) [`6df1ada49c8131afbb303b805516c3f9ddba62f0`](https://github.com/openfort-xyz/openfort-node/commit/6df1ada49c8131afbb303b805516c3f9ddba62f0) Thanks [@jamalavedra](https://github.com/jamalavedra)! - name account
|
|
8
|
+
|
|
9
|
+
## 0.8.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#61](https://github.com/openfort-xyz/openfort-node/pull/61) [`8618e2248ef6f0cd92c0cb469c20562c27d2761c`](https://github.com/openfort-xyz/openfort-node/commit/8618e2248ef6f0cd92c0cb469c20562c27d2761c) Thanks [@jamalavedra](https://github.com/jamalavedra)! - fix signing
|
|
14
|
+
|
|
3
15
|
## 0.8.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -93,8 +93,6 @@ interface SignTransactionOptions$1 {
|
|
|
93
93
|
interface CreateEvmAccountOptions {
|
|
94
94
|
/** Wallet ID (starts with pla_). Optional - associates the wallet with a player. */
|
|
95
95
|
wallet?: string;
|
|
96
|
-
/** Optional name for the wallet */
|
|
97
|
-
name?: string;
|
|
98
96
|
/** Idempotency key */
|
|
99
97
|
idempotencyKey?: string;
|
|
100
98
|
}
|
|
@@ -104,8 +102,6 @@ interface CreateEvmAccountOptions {
|
|
|
104
102
|
interface GetEvmAccountOptions {
|
|
105
103
|
/** Account address */
|
|
106
104
|
address?: Address;
|
|
107
|
-
/** Account name */
|
|
108
|
-
name?: string;
|
|
109
105
|
/** Account ID */
|
|
110
106
|
id?: string;
|
|
111
107
|
}
|
|
@@ -124,8 +120,6 @@ interface ListEvmAccountsOptions {
|
|
|
124
120
|
interface ImportEvmAccountOptions {
|
|
125
121
|
/** Private key as hex string (with or without 0x prefix) */
|
|
126
122
|
privateKey: string;
|
|
127
|
-
/** Optional name for the account */
|
|
128
|
-
name?: string;
|
|
129
123
|
/** Idempotency key */
|
|
130
124
|
idempotencyKey?: string;
|
|
131
125
|
}
|
|
@@ -361,8 +355,6 @@ type SolanaAccount = SolanaAccountBase & SolanaSigningMethods;
|
|
|
361
355
|
interface CreateSolanaAccountOptions {
|
|
362
356
|
/** Wallet ID (starts with pla_). Optional - associates the wallet with a player. */
|
|
363
357
|
wallet?: string;
|
|
364
|
-
/** Optional name for the wallet */
|
|
365
|
-
name?: string;
|
|
366
358
|
/** Idempotency key */
|
|
367
359
|
idempotencyKey?: string;
|
|
368
360
|
}
|
|
@@ -372,8 +364,6 @@ interface CreateSolanaAccountOptions {
|
|
|
372
364
|
interface GetSolanaAccountOptions {
|
|
373
365
|
/** Account address (base58 encoded) */
|
|
374
366
|
address?: string;
|
|
375
|
-
/** Account name */
|
|
376
|
-
name?: string;
|
|
377
367
|
/** Account ID */
|
|
378
368
|
id?: string;
|
|
379
369
|
}
|
|
@@ -392,8 +382,6 @@ interface ListSolanaAccountsOptions {
|
|
|
392
382
|
interface ImportSolanaAccountOptions {
|
|
393
383
|
/** Private key as base58 string or 64-byte hex string */
|
|
394
384
|
privateKey: string;
|
|
395
|
-
/** Optional name for the account */
|
|
396
|
-
name?: string;
|
|
397
385
|
}
|
|
398
386
|
/**
|
|
399
387
|
* Options for exporting a Solana account
|
|
@@ -535,7 +523,7 @@ declare class SolanaClient {
|
|
|
535
523
|
* ```typescript
|
|
536
524
|
* const account = await openfort.solana.importAccount({
|
|
537
525
|
* privateKey: '5K...', // base58 or hex format
|
|
538
|
-
*
|
|
526
|
+
* // base58 or hex format
|
|
539
527
|
* });
|
|
540
528
|
* ```
|
|
541
529
|
*/
|
|
@@ -3189,7 +3177,7 @@ interface PolicyV2RuleResponse {
|
|
|
3189
3177
|
/** The action to take when this rule matches. */
|
|
3190
3178
|
action: PolicyV2Action;
|
|
3191
3179
|
/** The operation this rule applies to.
|
|
3192
|
-
EVM: signEvmTransaction, sendEvmTransaction, signEvmTypedData, signEvmMessage, signEvmHash
|
|
3180
|
+
EVM: signEvmTransaction, sendEvmTransaction, signEvmTypedData, signEvmMessage, signEvmHash
|
|
3193
3181
|
Solana: signSolTransaction, sendSolTransaction, signSolMessage */
|
|
3194
3182
|
operation: string;
|
|
3195
3183
|
/** Array of criteria to match for this rule. All criteria must match (AND logic). */
|
|
@@ -3756,7 +3744,7 @@ interface CreatePolicyV2RuleRequest {
|
|
|
3756
3744
|
/** The action to take when this rule matches. */
|
|
3757
3745
|
action: CreatePolicyV2RuleRequestAction;
|
|
3758
3746
|
/** The operation this rule applies to.
|
|
3759
|
-
EVM: signEvmTransaction, sendEvmTransaction, signEvmTypedData, signEvmMessage, signEvmHash
|
|
3747
|
+
EVM: signEvmTransaction, sendEvmTransaction, signEvmTypedData, signEvmMessage, signEvmHash
|
|
3760
3748
|
Solana: signSolTransaction, sendSolTransaction, signSolMessage */
|
|
3761
3749
|
operation: string;
|
|
3762
3750
|
/** Array of criteria to match for this rule. All criteria must match (AND logic). */
|
|
@@ -3847,7 +3835,7 @@ interface EvaluatePolicyV2Payload {
|
|
|
3847
3835
|
}
|
|
3848
3836
|
interface EvaluatePolicyV2Request {
|
|
3849
3837
|
/** The signing operation to evaluate.
|
|
3850
|
-
EVM: signEvmTransaction, sendEvmTransaction, signEvmTypedData, signEvmMessage, signEvmHash
|
|
3838
|
+
EVM: signEvmTransaction, sendEvmTransaction, signEvmTypedData, signEvmMessage, signEvmHash
|
|
3851
3839
|
Solana: signSolTransaction, sendSolTransaction, signSolMessage */
|
|
3852
3840
|
operation: string;
|
|
3853
3841
|
/** The account ID to evaluate policies for (starts with acc_). If not provided, only project-scoped policies are evaluated. */
|
|
@@ -3953,8 +3941,6 @@ interface BackendWalletResponse {
|
|
|
3953
3941
|
address: string;
|
|
3954
3942
|
/** The chain type the wallet is associated with. */
|
|
3955
3943
|
chainType: BackendWalletResponseChainType;
|
|
3956
|
-
/** Optional name for the wallet. */
|
|
3957
|
-
name?: string;
|
|
3958
3944
|
/** Key custody: always "Developer" for backend wallets (server-managed keys in TEE). */
|
|
3959
3945
|
custody: BackendWalletResponseCustody;
|
|
3960
3946
|
/** Creation timestamp (Unix epoch seconds). */
|
|
@@ -4006,8 +3992,6 @@ interface BackendWalletListQueries {
|
|
|
4006
3992
|
chainType?: BackendWalletListQueriesChainType;
|
|
4007
3993
|
/** Filter by wallet address. */
|
|
4008
3994
|
address?: string;
|
|
4009
|
-
/** Filter by wallet name. */
|
|
4010
|
-
name?: string;
|
|
4011
3995
|
/** Filter by associated wallet ID (starts with `pla_`). */
|
|
4012
3996
|
wallet?: string;
|
|
4013
3997
|
}
|
|
@@ -4057,8 +4041,6 @@ interface CreateBackendWalletRequest {
|
|
|
4057
4041
|
chainType: CreateBackendWalletRequestChainType;
|
|
4058
4042
|
/** The wallet ID to associate with this wallet (starts with `pla_`). */
|
|
4059
4043
|
wallet?: string;
|
|
4060
|
-
/** Optional name for the wallet. */
|
|
4061
|
-
name?: string;
|
|
4062
4044
|
}
|
|
4063
4045
|
/**
|
|
4064
4046
|
* The type of object.
|
|
@@ -4177,8 +4159,6 @@ interface ImportPrivateKeyRequest {
|
|
|
4177
4159
|
chainType?: ImportPrivateKeyRequestChainType;
|
|
4178
4160
|
/** The wallet ID to associate with this wallet (starts with `pla_`). */
|
|
4179
4161
|
wallet?: string;
|
|
4180
|
-
/** Optional name for the imported wallet. */
|
|
4181
|
-
name?: string;
|
|
4182
4162
|
}
|
|
4183
4163
|
/**
|
|
4184
4164
|
* The type of object.
|
|
@@ -6221,10 +6201,6 @@ type ListBackendWalletsParams = {
|
|
|
6221
6201
|
* Filter by wallet address.
|
|
6222
6202
|
*/
|
|
6223
6203
|
address?: string;
|
|
6224
|
-
/**
|
|
6225
|
-
* Filter by wallet name.
|
|
6226
|
-
*/
|
|
6227
|
-
name?: string;
|
|
6228
6204
|
/**
|
|
6229
6205
|
* Filter by associated wallet ID (starts with `pla_`).
|
|
6230
6206
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -93,8 +93,6 @@ interface SignTransactionOptions$1 {
|
|
|
93
93
|
interface CreateEvmAccountOptions {
|
|
94
94
|
/** Wallet ID (starts with pla_). Optional - associates the wallet with a player. */
|
|
95
95
|
wallet?: string;
|
|
96
|
-
/** Optional name for the wallet */
|
|
97
|
-
name?: string;
|
|
98
96
|
/** Idempotency key */
|
|
99
97
|
idempotencyKey?: string;
|
|
100
98
|
}
|
|
@@ -104,8 +102,6 @@ interface CreateEvmAccountOptions {
|
|
|
104
102
|
interface GetEvmAccountOptions {
|
|
105
103
|
/** Account address */
|
|
106
104
|
address?: Address;
|
|
107
|
-
/** Account name */
|
|
108
|
-
name?: string;
|
|
109
105
|
/** Account ID */
|
|
110
106
|
id?: string;
|
|
111
107
|
}
|
|
@@ -124,8 +120,6 @@ interface ListEvmAccountsOptions {
|
|
|
124
120
|
interface ImportEvmAccountOptions {
|
|
125
121
|
/** Private key as hex string (with or without 0x prefix) */
|
|
126
122
|
privateKey: string;
|
|
127
|
-
/** Optional name for the account */
|
|
128
|
-
name?: string;
|
|
129
123
|
/** Idempotency key */
|
|
130
124
|
idempotencyKey?: string;
|
|
131
125
|
}
|
|
@@ -361,8 +355,6 @@ type SolanaAccount = SolanaAccountBase & SolanaSigningMethods;
|
|
|
361
355
|
interface CreateSolanaAccountOptions {
|
|
362
356
|
/** Wallet ID (starts with pla_). Optional - associates the wallet with a player. */
|
|
363
357
|
wallet?: string;
|
|
364
|
-
/** Optional name for the wallet */
|
|
365
|
-
name?: string;
|
|
366
358
|
/** Idempotency key */
|
|
367
359
|
idempotencyKey?: string;
|
|
368
360
|
}
|
|
@@ -372,8 +364,6 @@ interface CreateSolanaAccountOptions {
|
|
|
372
364
|
interface GetSolanaAccountOptions {
|
|
373
365
|
/** Account address (base58 encoded) */
|
|
374
366
|
address?: string;
|
|
375
|
-
/** Account name */
|
|
376
|
-
name?: string;
|
|
377
367
|
/** Account ID */
|
|
378
368
|
id?: string;
|
|
379
369
|
}
|
|
@@ -392,8 +382,6 @@ interface ListSolanaAccountsOptions {
|
|
|
392
382
|
interface ImportSolanaAccountOptions {
|
|
393
383
|
/** Private key as base58 string or 64-byte hex string */
|
|
394
384
|
privateKey: string;
|
|
395
|
-
/** Optional name for the account */
|
|
396
|
-
name?: string;
|
|
397
385
|
}
|
|
398
386
|
/**
|
|
399
387
|
* Options for exporting a Solana account
|
|
@@ -535,7 +523,7 @@ declare class SolanaClient {
|
|
|
535
523
|
* ```typescript
|
|
536
524
|
* const account = await openfort.solana.importAccount({
|
|
537
525
|
* privateKey: '5K...', // base58 or hex format
|
|
538
|
-
*
|
|
526
|
+
* // base58 or hex format
|
|
539
527
|
* });
|
|
540
528
|
* ```
|
|
541
529
|
*/
|
|
@@ -3189,7 +3177,7 @@ interface PolicyV2RuleResponse {
|
|
|
3189
3177
|
/** The action to take when this rule matches. */
|
|
3190
3178
|
action: PolicyV2Action;
|
|
3191
3179
|
/** The operation this rule applies to.
|
|
3192
|
-
EVM: signEvmTransaction, sendEvmTransaction, signEvmTypedData, signEvmMessage, signEvmHash
|
|
3180
|
+
EVM: signEvmTransaction, sendEvmTransaction, signEvmTypedData, signEvmMessage, signEvmHash
|
|
3193
3181
|
Solana: signSolTransaction, sendSolTransaction, signSolMessage */
|
|
3194
3182
|
operation: string;
|
|
3195
3183
|
/** Array of criteria to match for this rule. All criteria must match (AND logic). */
|
|
@@ -3756,7 +3744,7 @@ interface CreatePolicyV2RuleRequest {
|
|
|
3756
3744
|
/** The action to take when this rule matches. */
|
|
3757
3745
|
action: CreatePolicyV2RuleRequestAction;
|
|
3758
3746
|
/** The operation this rule applies to.
|
|
3759
|
-
EVM: signEvmTransaction, sendEvmTransaction, signEvmTypedData, signEvmMessage, signEvmHash
|
|
3747
|
+
EVM: signEvmTransaction, sendEvmTransaction, signEvmTypedData, signEvmMessage, signEvmHash
|
|
3760
3748
|
Solana: signSolTransaction, sendSolTransaction, signSolMessage */
|
|
3761
3749
|
operation: string;
|
|
3762
3750
|
/** Array of criteria to match for this rule. All criteria must match (AND logic). */
|
|
@@ -3847,7 +3835,7 @@ interface EvaluatePolicyV2Payload {
|
|
|
3847
3835
|
}
|
|
3848
3836
|
interface EvaluatePolicyV2Request {
|
|
3849
3837
|
/** The signing operation to evaluate.
|
|
3850
|
-
EVM: signEvmTransaction, sendEvmTransaction, signEvmTypedData, signEvmMessage, signEvmHash
|
|
3838
|
+
EVM: signEvmTransaction, sendEvmTransaction, signEvmTypedData, signEvmMessage, signEvmHash
|
|
3851
3839
|
Solana: signSolTransaction, sendSolTransaction, signSolMessage */
|
|
3852
3840
|
operation: string;
|
|
3853
3841
|
/** The account ID to evaluate policies for (starts with acc_). If not provided, only project-scoped policies are evaluated. */
|
|
@@ -3953,8 +3941,6 @@ interface BackendWalletResponse {
|
|
|
3953
3941
|
address: string;
|
|
3954
3942
|
/** The chain type the wallet is associated with. */
|
|
3955
3943
|
chainType: BackendWalletResponseChainType;
|
|
3956
|
-
/** Optional name for the wallet. */
|
|
3957
|
-
name?: string;
|
|
3958
3944
|
/** Key custody: always "Developer" for backend wallets (server-managed keys in TEE). */
|
|
3959
3945
|
custody: BackendWalletResponseCustody;
|
|
3960
3946
|
/** Creation timestamp (Unix epoch seconds). */
|
|
@@ -4006,8 +3992,6 @@ interface BackendWalletListQueries {
|
|
|
4006
3992
|
chainType?: BackendWalletListQueriesChainType;
|
|
4007
3993
|
/** Filter by wallet address. */
|
|
4008
3994
|
address?: string;
|
|
4009
|
-
/** Filter by wallet name. */
|
|
4010
|
-
name?: string;
|
|
4011
3995
|
/** Filter by associated wallet ID (starts with `pla_`). */
|
|
4012
3996
|
wallet?: string;
|
|
4013
3997
|
}
|
|
@@ -4057,8 +4041,6 @@ interface CreateBackendWalletRequest {
|
|
|
4057
4041
|
chainType: CreateBackendWalletRequestChainType;
|
|
4058
4042
|
/** The wallet ID to associate with this wallet (starts with `pla_`). */
|
|
4059
4043
|
wallet?: string;
|
|
4060
|
-
/** Optional name for the wallet. */
|
|
4061
|
-
name?: string;
|
|
4062
4044
|
}
|
|
4063
4045
|
/**
|
|
4064
4046
|
* The type of object.
|
|
@@ -4177,8 +4159,6 @@ interface ImportPrivateKeyRequest {
|
|
|
4177
4159
|
chainType?: ImportPrivateKeyRequestChainType;
|
|
4178
4160
|
/** The wallet ID to associate with this wallet (starts with `pla_`). */
|
|
4179
4161
|
wallet?: string;
|
|
4180
|
-
/** Optional name for the imported wallet. */
|
|
4181
|
-
name?: string;
|
|
4182
4162
|
}
|
|
4183
4163
|
/**
|
|
4184
4164
|
* The type of object.
|
|
@@ -6221,10 +6201,6 @@ type ListBackendWalletsParams = {
|
|
|
6221
6201
|
* Filter by wallet address.
|
|
6222
6202
|
*/
|
|
6223
6203
|
address?: string;
|
|
6224
|
-
/**
|
|
6225
|
-
* Filter by wallet name.
|
|
6226
|
-
*/
|
|
6227
|
-
name?: string;
|
|
6228
6204
|
/**
|
|
6229
6205
|
* Filter by associated wallet ID (starts with `pla_`).
|
|
6230
6206
|
*/
|
package/dist/index.js
CHANGED
|
@@ -830,7 +830,7 @@ function requiresWalletAuth(requestMethod, requestPath) {
|
|
|
830
830
|
}
|
|
831
831
|
|
|
832
832
|
// src/version.ts
|
|
833
|
-
var VERSION = "0.8.
|
|
833
|
+
var VERSION = "0.8.2";
|
|
834
834
|
var PACKAGE = "@openfort/openfort-node";
|
|
835
835
|
|
|
836
836
|
// src/openapi-client/openfortApiClient.ts
|
|
@@ -899,6 +899,10 @@ var configure = (options) => {
|
|
|
899
899
|
retryDelay: import_axios_retry.exponentialDelay,
|
|
900
900
|
retries: 3,
|
|
901
901
|
retryCondition: (error) => {
|
|
902
|
+
const hasWalletAuth = error.config?.headers?.["X-Wallet-Auth"] !== void 0;
|
|
903
|
+
if (hasWalletAuth) {
|
|
904
|
+
return false;
|
|
905
|
+
}
|
|
902
906
|
return import_axios_retry.default.isNetworkOrIdempotentRequestError(error) || error.response?.status !== void 0 && error.response.status >= 500;
|
|
903
907
|
}
|
|
904
908
|
});
|
|
@@ -1034,7 +1038,8 @@ function handleResponseError(statusCode, responseData, cause) {
|
|
|
1034
1038
|
const correlationId = isOpenfortError(responseData) ? responseData.correlationId : void 0;
|
|
1035
1039
|
let errorMessage;
|
|
1036
1040
|
if (isOpenfortError(responseData)) {
|
|
1037
|
-
|
|
1041
|
+
const nestedMessage = responseData.error && typeof responseData.error === "object" ? responseData.error.message : void 0;
|
|
1042
|
+
errorMessage = responseData.message || nestedMessage || (typeof responseData.error === "string" ? responseData.error : void 0) || "Unknown error";
|
|
1038
1043
|
} else if (typeof responseData === "string") {
|
|
1039
1044
|
errorMessage = responseData;
|
|
1040
1045
|
} else if (responseData) {
|
|
@@ -1060,7 +1065,7 @@ function handleResponseError(statusCode, responseData, cause) {
|
|
|
1060
1065
|
throw new APIError(
|
|
1061
1066
|
statusCode,
|
|
1062
1067
|
"unauthorized",
|
|
1063
|
-
"Unauthorized. Check your API key.",
|
|
1068
|
+
errorMessage || "Unauthorized. Check your API key.",
|
|
1064
1069
|
correlationId,
|
|
1065
1070
|
`${ERROR_DOCS_URL}#unauthorized`,
|
|
1066
1071
|
cause
|
|
@@ -4238,7 +4243,8 @@ function toEvmAccount(data) {
|
|
|
4238
4243
|
},
|
|
4239
4244
|
async signTransaction(transaction) {
|
|
4240
4245
|
const serialized = (0, import_viem.serializeTransaction)(transaction);
|
|
4241
|
-
const
|
|
4246
|
+
const hash = (0, import_viem.keccak256)(serialized);
|
|
4247
|
+
const response = await sign(id, { data: hash });
|
|
4242
4248
|
const signature2 = (0, import_viem.parseSignature)(response.signature);
|
|
4243
4249
|
const signedTransaction = (0, import_viem.serializeTransaction)(
|
|
4244
4250
|
transaction,
|
|
@@ -4418,8 +4424,7 @@ var EvmClient = class {
|
|
|
4418
4424
|
);
|
|
4419
4425
|
const response = await importPrivateKey({
|
|
4420
4426
|
encryptedPrivateKey,
|
|
4421
|
-
chainType: "EVM"
|
|
4422
|
-
name: options.name
|
|
4427
|
+
chainType: "EVM"
|
|
4423
4428
|
});
|
|
4424
4429
|
return toEvmAccount({
|
|
4425
4430
|
id: response.id,
|
|
@@ -4659,7 +4664,7 @@ var SolanaClient = class {
|
|
|
4659
4664
|
* ```typescript
|
|
4660
4665
|
* const account = await openfort.solana.importAccount({
|
|
4661
4666
|
* privateKey: '5K...', // base58 or hex format
|
|
4662
|
-
*
|
|
4667
|
+
* // base58 or hex format
|
|
4663
4668
|
* });
|
|
4664
4669
|
* ```
|
|
4665
4670
|
*/
|
|
@@ -4702,8 +4707,7 @@ var SolanaClient = class {
|
|
|
4702
4707
|
);
|
|
4703
4708
|
const response = await importPrivateKey({
|
|
4704
4709
|
encryptedPrivateKey,
|
|
4705
|
-
chainType: "SVM"
|
|
4706
|
-
name: options.name
|
|
4710
|
+
chainType: "SVM"
|
|
4707
4711
|
});
|
|
4708
4712
|
return toSolanaAccount({
|
|
4709
4713
|
id: response.id,
|