@phantom/parsers 1.0.0-beta.6 → 1.0.0-beta.7
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/index.js +9 -4
- package/dist/index.mjs +9 -4
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -43,11 +43,11 @@ var import_transactions = require("@solana/transactions");
|
|
|
43
43
|
var import_buffer2 = require("buffer");
|
|
44
44
|
|
|
45
45
|
// src/response-parsers.ts
|
|
46
|
-
var import_constants = require("@phantom/constants");
|
|
47
46
|
var import_base64url = require("@phantom/base64url");
|
|
48
|
-
var
|
|
49
|
-
var import_bs58 = __toESM(require("bs58"));
|
|
47
|
+
var import_constants = require("@phantom/constants");
|
|
50
48
|
var import_web3 = require("@solana/web3.js");
|
|
49
|
+
var import_bs58 = __toESM(require("bs58"));
|
|
50
|
+
var import_buffer = require("buffer");
|
|
51
51
|
function parseSignMessageResponse(base64Response, networkId) {
|
|
52
52
|
const networkPrefix = networkId.split(":")[0].toLowerCase();
|
|
53
53
|
switch (networkPrefix) {
|
|
@@ -99,6 +99,12 @@ function parseSolanaSignatureResponse(base64Response) {
|
|
|
99
99
|
function parseEVMSignatureResponse(base64Response) {
|
|
100
100
|
try {
|
|
101
101
|
const signatureBytes = (0, import_base64url.base64urlDecode)(base64Response);
|
|
102
|
+
if (signatureBytes.length === 65) {
|
|
103
|
+
const recoveryId = signatureBytes[64];
|
|
104
|
+
if (recoveryId === 0 || recoveryId === 1) {
|
|
105
|
+
signatureBytes[64] = recoveryId + 27;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
102
108
|
const signature = "0x" + import_buffer.Buffer.from(signatureBytes).toString("hex");
|
|
103
109
|
return {
|
|
104
110
|
signature,
|
|
@@ -159,7 +165,6 @@ function parseSolanaSignedTransaction(base64RawTransaction) {
|
|
|
159
165
|
} catch (error) {
|
|
160
166
|
return null;
|
|
161
167
|
}
|
|
162
|
-
;
|
|
163
168
|
}
|
|
164
169
|
|
|
165
170
|
// src/index.ts
|
package/dist/index.mjs
CHANGED
|
@@ -4,11 +4,11 @@ import { getTransactionEncoder } from "@solana/transactions";
|
|
|
4
4
|
import { Buffer as Buffer2 } from "buffer";
|
|
5
5
|
|
|
6
6
|
// src/response-parsers.ts
|
|
7
|
-
import { getExplorerUrl } from "@phantom/constants";
|
|
8
7
|
import { base64urlDecode } from "@phantom/base64url";
|
|
9
|
-
import {
|
|
10
|
-
import bs58 from "bs58";
|
|
8
|
+
import { getExplorerUrl } from "@phantom/constants";
|
|
11
9
|
import { Transaction, VersionedTransaction } from "@solana/web3.js";
|
|
10
|
+
import bs58 from "bs58";
|
|
11
|
+
import { Buffer } from "buffer";
|
|
12
12
|
function parseSignMessageResponse(base64Response, networkId) {
|
|
13
13
|
const networkPrefix = networkId.split(":")[0].toLowerCase();
|
|
14
14
|
switch (networkPrefix) {
|
|
@@ -60,6 +60,12 @@ function parseSolanaSignatureResponse(base64Response) {
|
|
|
60
60
|
function parseEVMSignatureResponse(base64Response) {
|
|
61
61
|
try {
|
|
62
62
|
const signatureBytes = base64urlDecode(base64Response);
|
|
63
|
+
if (signatureBytes.length === 65) {
|
|
64
|
+
const recoveryId = signatureBytes[64];
|
|
65
|
+
if (recoveryId === 0 || recoveryId === 1) {
|
|
66
|
+
signatureBytes[64] = recoveryId + 27;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
63
69
|
const signature = "0x" + Buffer.from(signatureBytes).toString("hex");
|
|
64
70
|
return {
|
|
65
71
|
signature,
|
|
@@ -120,7 +126,6 @@ function parseSolanaSignedTransaction(base64RawTransaction) {
|
|
|
120
126
|
} catch (error) {
|
|
121
127
|
return null;
|
|
122
128
|
}
|
|
123
|
-
;
|
|
124
129
|
}
|
|
125
130
|
|
|
126
131
|
// src/index.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phantom/parsers",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.7",
|
|
4
4
|
"description": "Transaction and message parsers for Phantom Wallet SDK",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"prettier": "prettier --write \"src/**/*.{ts}\""
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@phantom/base64url": "^1.0.0-beta.
|
|
33
|
-
"@phantom/constants": "^1.0.0-beta.
|
|
34
|
-
"@phantom/sdk-types": "^1.0.0-beta.
|
|
32
|
+
"@phantom/base64url": "^1.0.0-beta.7",
|
|
33
|
+
"@phantom/constants": "^1.0.0-beta.7",
|
|
34
|
+
"@phantom/sdk-types": "^1.0.0-beta.7",
|
|
35
35
|
"@solana/transactions": "^2.0.0",
|
|
36
36
|
"@solana/web3.js": "^1.95.0",
|
|
37
37
|
"bs58": "^6.0.0",
|