@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 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 14 or higher.
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 policies:
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 sponsorship policy
130
+ // 1. Create a policy that accepts transactions on Polygon
138
131
  const policy = await openfort.policies.create({
139
- name: "Free gas for users",
140
- chainId: 80002,
141
- strategy: { sponsorSchema: "pay_for_user" },
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
- // Register a contract
145
- const contract = await openfort.contracts.create({
146
- name: "MyContract",
147
- chainId: 80002,
148
- address: "0x38090d1636069c0ff1af6bc1737fb996b7f63ac0",
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 | Examples |
180
- | -------------- | -------------------------------------------------- |
181
- | EVM Wallets | Create, import, export, sign messages/transactions |
182
- | Solana Wallets | Create, import, export, sign messages/transactions |
183
- | Policies | Gas sponsorship, policy rules, enable/disable |
184
- | Transactions | Create intents, estimate gas, read contracts |
185
- | Exchange | Token swap quotes and execution |
186
- | IAM | User management, session verification |
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