@phantom/browser-sdk 1.0.0-beta.1 → 1.0.0-beta.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/README.md CHANGED
@@ -463,6 +463,12 @@ const balance = await sdk.ethereum.request({
463
463
  method: "eth_getBalance",
464
464
  params: [address, "latest"],
465
465
  });
466
+
467
+ // Sign transaction via RPC (alternative to signTransaction method)
468
+ const signedTx = await sdk.ethereum.request({
469
+ method: "eth_signTransaction",
470
+ params: [{ to: "0x...", value: "0x...", gas: "0x..." }],
471
+ });
466
472
  ```
467
473
 
468
474
  #### signPersonalMessage(message, address)
@@ -511,6 +517,20 @@ const signature = await sdk.ethereum.signTypedData(typedData, address);
511
517
  // Returns: { signature: string, rawSignature: string }
512
518
  ```
513
519
 
520
+ #### signTransaction(transaction)
521
+
522
+ Sign an Ethereum transaction without sending it.
523
+
524
+ ```typescript
525
+ const signedTx = await sdk.ethereum.signTransaction({
526
+ to: "0x742d35Cc6634C0532925a3b8D4C8db86fB5C4A7E",
527
+ value: "1000000000000000000", // 1 ETH in wei
528
+ gas: "21000",
529
+ gasPrice: "20000000000", // 20 gwei
530
+ });
531
+ // Returns: string (hex-encoded signed transaction)
532
+ ```
533
+
514
534
  #### sendTransaction(transaction)
515
535
 
516
536
  Send an Ethereum transaction.
package/dist/index.js CHANGED
@@ -163,10 +163,16 @@ var InjectedSolanaChain = class {
163
163
  publicKey: this._publicKey || ""
164
164
  };
165
165
  }
166
- signTransaction(_transaction) {
167
- return Promise.reject(
168
- new Error("Sign-only transactions not supported by injected provider. Use signAndSendTransaction instead.")
169
- );
166
+ async signTransaction(transaction) {
167
+ if (!this.callbacks.isConnected()) {
168
+ return Promise.reject(new Error("Provider not connected. Call provider connect first."));
169
+ }
170
+ try {
171
+ const result = await this.phantom.solana.signTransaction(transaction);
172
+ return result;
173
+ } catch (error) {
174
+ return Promise.reject(error);
175
+ }
170
176
  }
171
177
  async signAndSendTransaction(transaction) {
172
178
  const result = await this.phantom.solana.signAndSendTransaction(transaction);
@@ -253,8 +259,13 @@ var InjectedEthereumChain = class {
253
259
  get accounts() {
254
260
  return this._accounts;
255
261
  }
256
- // EIP-1193 core method - unchanged, already compliant!
262
+ // EIP-1193 core method with eth_signTransaction support
257
263
  async request(args) {
264
+ if (args.method === "eth_signTransaction") {
265
+ const [transaction] = args.params;
266
+ const result = await this.signTransaction(transaction);
267
+ return result;
268
+ }
258
269
  const provider = await this.phantom.ethereum.getProvider();
259
270
  return await provider.request(args);
260
271
  }
@@ -278,6 +289,9 @@ var InjectedEthereumChain = class {
278
289
  async signTypedData(typedData, address) {
279
290
  return await this.phantom.ethereum.signTypedData(typedData, address);
280
291
  }
292
+ async signTransaction(transaction) {
293
+ return await this.phantom.ethereum.signTransaction(transaction);
294
+ }
281
295
  async sendTransaction(transaction) {
282
296
  return await this.phantom.ethereum.sendTransaction(transaction);
283
297
  }
package/dist/index.mjs CHANGED
@@ -127,10 +127,16 @@ var InjectedSolanaChain = class {
127
127
  publicKey: this._publicKey || ""
128
128
  };
129
129
  }
130
- signTransaction(_transaction) {
131
- return Promise.reject(
132
- new Error("Sign-only transactions not supported by injected provider. Use signAndSendTransaction instead.")
133
- );
130
+ async signTransaction(transaction) {
131
+ if (!this.callbacks.isConnected()) {
132
+ return Promise.reject(new Error("Provider not connected. Call provider connect first."));
133
+ }
134
+ try {
135
+ const result = await this.phantom.solana.signTransaction(transaction);
136
+ return result;
137
+ } catch (error) {
138
+ return Promise.reject(error);
139
+ }
134
140
  }
135
141
  async signAndSendTransaction(transaction) {
136
142
  const result = await this.phantom.solana.signAndSendTransaction(transaction);
@@ -217,8 +223,13 @@ var InjectedEthereumChain = class {
217
223
  get accounts() {
218
224
  return this._accounts;
219
225
  }
220
- // EIP-1193 core method - unchanged, already compliant!
226
+ // EIP-1193 core method with eth_signTransaction support
221
227
  async request(args) {
228
+ if (args.method === "eth_signTransaction") {
229
+ const [transaction] = args.params;
230
+ const result = await this.signTransaction(transaction);
231
+ return result;
232
+ }
222
233
  const provider = await this.phantom.ethereum.getProvider();
223
234
  return await provider.request(args);
224
235
  }
@@ -242,6 +253,9 @@ var InjectedEthereumChain = class {
242
253
  async signTypedData(typedData, address) {
243
254
  return await this.phantom.ethereum.signTypedData(typedData, address);
244
255
  }
256
+ async signTransaction(transaction) {
257
+ return await this.phantom.ethereum.signTransaction(transaction);
258
+ }
245
259
  async sendTransaction(transaction) {
246
260
  return await this.phantom.ethereum.sendTransaction(transaction);
247
261
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phantom/browser-sdk",
3
- "version": "1.0.0-beta.1",
3
+ "version": "1.0.0-beta.2",
4
4
  "description": "Browser SDK for Phantom Wallet",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -28,14 +28,14 @@
28
28
  "prettier": "prettier --write \"src/**/*.{ts,tsx}\""
29
29
  },
30
30
  "dependencies": {
31
- "@phantom/base64url": "^1.0.0-beta.1",
32
- "@phantom/browser-injected-sdk": "^1.0.0-beta.1",
33
- "@phantom/chains": "^1.0.0-beta.1",
34
- "@phantom/client": "^1.0.0-beta.1",
35
- "@phantom/constants": "^1.0.0-beta.1",
36
- "@phantom/embedded-provider-core": "^1.0.0-beta.1",
31
+ "@phantom/base64url": "^1.0.0-beta.2",
32
+ "@phantom/browser-injected-sdk": "^1.0.0-beta.2",
33
+ "@phantom/chains": "^1.0.0-beta.2",
34
+ "@phantom/client": "^1.0.0-beta.2",
35
+ "@phantom/constants": "^1.0.0-beta.2",
36
+ "@phantom/embedded-provider-core": "^1.0.0-beta.2",
37
37
  "@phantom/indexed-db-stamper": "^1.0.0-beta.1",
38
- "@phantom/parsers": "^1.0.0-beta.1",
38
+ "@phantom/parsers": "^1.0.0-beta.2",
39
39
  "axios": "^1.10.0",
40
40
  "bs58": "^6.0.0",
41
41
  "buffer": "^6.0.3",