@phantom/browser-injected-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/dist/solana/index.d.ts +9 -0
- package/dist/solana/index.js +13 -0
- package/dist/solana/index.mjs +13 -0
- package/package.json +2 -2
package/dist/solana/index.d.ts
CHANGED
|
@@ -78,6 +78,14 @@ declare function signAndSendTransaction(transaction: VersionedTransaction | Tran
|
|
|
78
78
|
address?: string;
|
|
79
79
|
}>;
|
|
80
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Signs a transaction using the Phantom provider without sending it.
|
|
83
|
+
* @param transaction The transaction to sign (Web3.js format).
|
|
84
|
+
* @returns A promise that resolves with the signed transaction.
|
|
85
|
+
* @throws Error if Phantom provider is not found or if the operation fails.
|
|
86
|
+
*/
|
|
87
|
+
declare function signTransaction(transaction: VersionedTransaction | Transaction): Promise<VersionedTransaction | Transaction>;
|
|
88
|
+
|
|
81
89
|
/**
|
|
82
90
|
* Signs in with Solana using the Phantom provider.
|
|
83
91
|
* @param signInData The sign-in data.
|
|
@@ -108,6 +116,7 @@ type Solana = {
|
|
|
108
116
|
getAccount: typeof getAccount;
|
|
109
117
|
signMessage: typeof signMessage;
|
|
110
118
|
signIn: typeof signIn;
|
|
119
|
+
signTransaction: typeof signTransaction;
|
|
111
120
|
signAndSendTransaction: typeof signAndSendTransaction;
|
|
112
121
|
addEventListener: (event: PhantomEventType, callback: PhantomEventCallback) => () => void;
|
|
113
122
|
removeEventListener: (event: PhantomEventType, callback: PhantomEventCallback) => void;
|
package/dist/solana/index.js
CHANGED
|
@@ -361,6 +361,18 @@ async function signAndSendTransaction(transaction) {
|
|
|
361
361
|
return provider.signAndSendTransaction(transaction);
|
|
362
362
|
}
|
|
363
363
|
|
|
364
|
+
// src/solana/signTransaction.ts
|
|
365
|
+
async function signTransaction(transaction) {
|
|
366
|
+
const provider = await getProvider();
|
|
367
|
+
if (!provider) {
|
|
368
|
+
throw new Error("Provider not found.");
|
|
369
|
+
}
|
|
370
|
+
if (!provider.isConnected) {
|
|
371
|
+
await provider.connect({ onlyIfTrusted: false });
|
|
372
|
+
}
|
|
373
|
+
return provider.signTransaction(transaction);
|
|
374
|
+
}
|
|
375
|
+
|
|
364
376
|
// src/solana/signIn.ts
|
|
365
377
|
async function signIn(signInData) {
|
|
366
378
|
const provider = await getProvider();
|
|
@@ -393,6 +405,7 @@ var solana = {
|
|
|
393
405
|
getAccount,
|
|
394
406
|
signMessage,
|
|
395
407
|
signIn,
|
|
408
|
+
signTransaction,
|
|
396
409
|
signAndSendTransaction,
|
|
397
410
|
addEventListener,
|
|
398
411
|
removeEventListener
|
package/dist/solana/index.mjs
CHANGED
|
@@ -328,6 +328,18 @@ async function signAndSendTransaction(transaction) {
|
|
|
328
328
|
return provider.signAndSendTransaction(transaction);
|
|
329
329
|
}
|
|
330
330
|
|
|
331
|
+
// src/solana/signTransaction.ts
|
|
332
|
+
async function signTransaction(transaction) {
|
|
333
|
+
const provider = await getProvider();
|
|
334
|
+
if (!provider) {
|
|
335
|
+
throw new Error("Provider not found.");
|
|
336
|
+
}
|
|
337
|
+
if (!provider.isConnected) {
|
|
338
|
+
await provider.connect({ onlyIfTrusted: false });
|
|
339
|
+
}
|
|
340
|
+
return provider.signTransaction(transaction);
|
|
341
|
+
}
|
|
342
|
+
|
|
331
343
|
// src/solana/signIn.ts
|
|
332
344
|
async function signIn(signInData) {
|
|
333
345
|
const provider = await getProvider();
|
|
@@ -360,6 +372,7 @@ var solana = {
|
|
|
360
372
|
getAccount,
|
|
361
373
|
signMessage,
|
|
362
374
|
signIn,
|
|
375
|
+
signTransaction,
|
|
363
376
|
signAndSendTransaction,
|
|
364
377
|
addEventListener,
|
|
365
378
|
removeEventListener
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phantom/browser-injected-sdk",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.2",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"prettier": "prettier --write \"src/**/*.{ts,tsx}\""
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@phantom/constants": "^1.0.0-beta.
|
|
45
|
+
"@phantom/constants": "^1.0.0-beta.2",
|
|
46
46
|
"@solana/web3.js": "^1.98.2"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|