@openfort/openfort-node 0.8.3 → 0.9.0
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/README.md +29 -37
- package/dist/index.d.mts +2370 -678
- package/dist/index.d.ts +2370 -678
- package/dist/index.js +450 -280
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +426 -267
- package/dist/index.mjs.map +1 -1
- package/examples/README.md +7 -16
- package/examples/evm/accounts/getAccount.ts +0 -6
- package/examples/evm/embedded/pregenerate.ts +1 -1
- package/examples/fee-sponsorship/createPolicy.ts +24 -8
- package/examples/fee-sponsorship/disableEnablePolicy.ts +22 -9
- package/examples/fee-sponsorship/getPolicy.ts +24 -11
- package/examples/fee-sponsorship/listPolicies.ts +7 -5
- package/examples/fee-sponsorship/updatePolicy.ts +20 -7
- package/examples/iam/getSession.ts +0 -2
- package/examples/transactions/createTransactionIntent.ts +17 -11
- package/examples/transactions/estimateGas.ts +16 -14
- package/examples/transactions/getTransactionIntent.ts +16 -15
- package/openapi.json +742 -59
- package/package.json +1 -1
- package/examples/fee-sponsorship/createPolicyRule.ts +0 -43
- package/examples/fee-sponsorship/listPolicyRules.ts +0 -37
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#74](https://github.com/openfort-xyz/openfort-node/pull/74) [`abcacadd74444ba58efc5f8b1436a45baad83f4b`](https://github.com/openfort-xyz/openfort-node/commit/abcacadd74444ba58efc5f8b1436a45baad83f4b) Thanks [@jamalavedra](https://github.com/jamalavedra)! - update fee sponsorship
|
|
8
|
+
|
|
9
|
+
## 0.8.4
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#72](https://github.com/openfort-xyz/openfort-node/pull/72) [`f6e6bbd249644bdb9fe287d3b363c06dabb2d77b`](https://github.com/openfort-xyz/openfort-node/commit/f6e6bbd249644bdb9fe287d3b363c06dabb2d77b) Thanks [@jamalavedra](https://github.com/jamalavedra)! - update backend wallet interactions
|
|
14
|
+
|
|
3
15
|
## 0.8.3
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@ The Openfort Node.js SDK provides convenient access to the [Openfort API](https:
|
|
|
43
43
|
|
|
44
44
|
## Installation
|
|
45
45
|
|
|
46
|
-
Requires Node.js
|
|
46
|
+
Requires Node.js 18 or higher.
|
|
47
47
|
|
|
48
48
|
```bash
|
|
49
49
|
npm install @openfort/openfort-node
|
|
@@ -69,9 +69,7 @@ const openfort = new Openfort("sk_test_...", {
|
|
|
69
69
|
});
|
|
70
70
|
|
|
71
71
|
// Create an EVM backend account
|
|
72
|
-
const account = await openfort.accounts.evm.backend.create(
|
|
73
|
-
name: "MyWallet",
|
|
74
|
-
});
|
|
72
|
+
const account = await openfort.accounts.evm.backend.create();
|
|
75
73
|
console.log("Account address:", account.address);
|
|
76
74
|
|
|
77
75
|
// Sign a message (methods are on the account object)
|
|
@@ -89,19 +87,14 @@ Create and manage wallets across EVM chains and Solana:
|
|
|
89
87
|
|
|
90
88
|
```typescript
|
|
91
89
|
// EVM backend accounts
|
|
92
|
-
const evmAccount = await openfort.accounts.evm.backend.create(
|
|
93
|
-
name: "MyEVMWallet",
|
|
94
|
-
});
|
|
90
|
+
const evmAccount = await openfort.accounts.evm.backend.create();
|
|
95
91
|
|
|
96
92
|
// Solana backend accounts
|
|
97
|
-
const solanaAccount = await openfort.accounts.solana.backend.create(
|
|
98
|
-
name: "MySolanaWallet",
|
|
99
|
-
});
|
|
93
|
+
const solanaAccount = await openfort.accounts.solana.backend.create();
|
|
100
94
|
|
|
101
95
|
// Import existing wallet
|
|
102
96
|
const imported = await openfort.accounts.evm.backend.import({
|
|
103
97
|
privateKey: "0x...",
|
|
104
|
-
name: "ImportedWallet",
|
|
105
98
|
});
|
|
106
99
|
```
|
|
107
100
|
|
|
@@ -131,29 +124,28 @@ const typedSig = await account.signTypedData({
|
|
|
131
124
|
|
|
132
125
|
### Gas Sponsorship
|
|
133
126
|
|
|
134
|
-
Sponsor gas fees for your users with
|
|
127
|
+
Sponsor gas fees for your users. Create a policy with criteria-based rules, then link it to a fee sponsorship:
|
|
135
128
|
|
|
136
129
|
```typescript
|
|
137
|
-
// Create a
|
|
130
|
+
// 1. Create a policy that accepts transactions on Polygon
|
|
138
131
|
const policy = await openfort.policies.create({
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
132
|
+
scope: "project",
|
|
133
|
+
rules: [
|
|
134
|
+
{
|
|
135
|
+
action: "accept",
|
|
136
|
+
operation: "sponsorEvmTransaction",
|
|
137
|
+
criteria: [
|
|
138
|
+
{ type: "evmNetwork", operator: "in", chainIds: [137] },
|
|
139
|
+
],
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
142
|
});
|
|
143
143
|
|
|
144
|
-
//
|
|
145
|
-
const
|
|
146
|
-
name: "
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
// Add rules to control sponsorship
|
|
152
|
-
await openfort.policyRules.create({
|
|
153
|
-
policy: policy.id,
|
|
154
|
-
type: "account_functions",
|
|
155
|
-
contract: contract.id,
|
|
156
|
-
functionName: "mint",
|
|
144
|
+
// 2. Create a fee sponsorship linked to that policy
|
|
145
|
+
const sponsorship = await openfort.feeSponsorship.create({
|
|
146
|
+
name: "Free gas for users",
|
|
147
|
+
strategy: { sponsorSchema: "pay_for_user" },
|
|
148
|
+
policyId: policy.id,
|
|
157
149
|
});
|
|
158
150
|
```
|
|
159
151
|
|
|
@@ -176,14 +168,14 @@ console.log("Session expires:", session.session.expiresAt);
|
|
|
176
168
|
|
|
177
169
|
The SDK includes comprehensive examples for all features. See the [examples directory](./examples) for runnable code.
|
|
178
170
|
|
|
179
|
-
| Category
|
|
180
|
-
|
|
|
181
|
-
| EVM Wallets
|
|
182
|
-
| Solana Wallets
|
|
183
|
-
| Policies
|
|
184
|
-
|
|
|
185
|
-
|
|
|
186
|
-
| IAM
|
|
171
|
+
| Category | Examples |
|
|
172
|
+
| ---------------- | -------------------------------------------------- |
|
|
173
|
+
| EVM Wallets | Create, import, export, sign messages/transactions |
|
|
174
|
+
| Solana Wallets | Create, import, export, sign messages/transactions |
|
|
175
|
+
| Policies | Criteria-based rules for EVM and Solana operations |
|
|
176
|
+
| Fee Sponsorship | Create, update, enable/disable gas sponsorship |
|
|
177
|
+
| Transactions | Create intents, estimate gas |
|
|
178
|
+
| IAM | User management, session verification |
|
|
187
179
|
|
|
188
180
|
Run examples:
|
|
189
181
|
|