@talismn/solana 0.0.0-pr2198-20251125153235 → 0.0.0-pr2198-20251229104607

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.
@@ -15,6 +15,7 @@ export type SolInstructionJson = ReturnType<typeof solInstructionToJson>;
15
15
  export declare const solInstructionFromJson: (serialized: SolInstructionJson) => TransactionInstruction;
16
16
  export declare const serializeTransaction: (transaction: Transaction | VersionedTransaction) => string;
17
17
  export declare const deserializeTransaction: (transaction: string) => Transaction | VersionedTransaction;
18
+ export declare const deserializeTransactionFromHex: (transactionHex: string) => Transaction | VersionedTransaction | undefined;
18
19
  export declare const txToHumanJSON: (tx: string | Transaction | VersionedTransaction) => {
19
20
  type: string;
20
21
  version: 0 | "legacy";
@@ -78,6 +78,50 @@ const deserializeTransaction = transaction => {
78
78
  return web3_js.Transaction.from(bytes);
79
79
  }
80
80
  };
81
+
82
+ // export const deserializeTransactionFromBase64 = (
83
+ // transaction: string,
84
+ // ): Transaction | VersionedTransaction | undefined => {
85
+ // try {
86
+ // // Try base64 first (Yield API uses this)
87
+ // const rawTx = Buffer.from(transaction, "base64")
88
+
89
+ // try {
90
+ // return VersionedTransaction.deserialize(rawTx)
91
+ // } catch {
92
+ // return Transaction.from(rawTx)
93
+ // }
94
+ // } catch (base64Error) {
95
+ // // Fallback if it's hex-encoded
96
+ // try {
97
+ // const rawTx = Buffer.from(transaction, "hex")
98
+
99
+ // try {
100
+ // return VersionedTransaction.deserialize(rawTx)
101
+ // } catch {
102
+ // return Transaction.from(rawTx)
103
+ // }
104
+ // } catch (hexError) {
105
+ // return undefined
106
+ // }
107
+ // }
108
+ // }
109
+
110
+ const deserializeTransactionFromHex = transactionHex => {
111
+ try {
112
+ // Convert hex → bytes
113
+ const rawBytes = Buffer.from(transactionHex, "hex");
114
+
115
+ // Try versioned first
116
+ try {
117
+ return web3_js.VersionedTransaction.deserialize(rawBytes);
118
+ } catch {
119
+ return web3_js.Transaction.from(rawBytes);
120
+ }
121
+ } catch {
122
+ return undefined;
123
+ }
124
+ };
81
125
  const txToHumanJSON = tx => {
82
126
  if (typeof tx === "string") tx = deserializeTransaction(tx);
83
127
  return isVersionedTransaction(tx) ? versionedTxToJSON(tx) : legacyTxToJSON(tx);
@@ -152,6 +196,7 @@ const getSolNetworkId = chain => {
152
196
 
153
197
  exports.SOLANA_CHAINS = SOLANA_CHAINS;
154
198
  exports.deserializeTransaction = deserializeTransaction;
199
+ exports.deserializeTransactionFromHex = deserializeTransactionFromHex;
155
200
  exports.getKeypair = getKeypair;
156
201
  exports.getSolNetworkId = getSolNetworkId;
157
202
  exports.isVersionedTransaction = isVersionedTransaction;
@@ -78,6 +78,50 @@ const deserializeTransaction = transaction => {
78
78
  return web3_js.Transaction.from(bytes);
79
79
  }
80
80
  };
81
+
82
+ // export const deserializeTransactionFromBase64 = (
83
+ // transaction: string,
84
+ // ): Transaction | VersionedTransaction | undefined => {
85
+ // try {
86
+ // // Try base64 first (Yield API uses this)
87
+ // const rawTx = Buffer.from(transaction, "base64")
88
+
89
+ // try {
90
+ // return VersionedTransaction.deserialize(rawTx)
91
+ // } catch {
92
+ // return Transaction.from(rawTx)
93
+ // }
94
+ // } catch (base64Error) {
95
+ // // Fallback if it's hex-encoded
96
+ // try {
97
+ // const rawTx = Buffer.from(transaction, "hex")
98
+
99
+ // try {
100
+ // return VersionedTransaction.deserialize(rawTx)
101
+ // } catch {
102
+ // return Transaction.from(rawTx)
103
+ // }
104
+ // } catch (hexError) {
105
+ // return undefined
106
+ // }
107
+ // }
108
+ // }
109
+
110
+ const deserializeTransactionFromHex = transactionHex => {
111
+ try {
112
+ // Convert hex → bytes
113
+ const rawBytes = Buffer.from(transactionHex, "hex");
114
+
115
+ // Try versioned first
116
+ try {
117
+ return web3_js.VersionedTransaction.deserialize(rawBytes);
118
+ } catch {
119
+ return web3_js.Transaction.from(rawBytes);
120
+ }
121
+ } catch {
122
+ return undefined;
123
+ }
124
+ };
81
125
  const txToHumanJSON = tx => {
82
126
  if (typeof tx === "string") tx = deserializeTransaction(tx);
83
127
  return isVersionedTransaction(tx) ? versionedTxToJSON(tx) : legacyTxToJSON(tx);
@@ -152,6 +196,7 @@ const getSolNetworkId = chain => {
152
196
 
153
197
  exports.SOLANA_CHAINS = SOLANA_CHAINS;
154
198
  exports.deserializeTransaction = deserializeTransaction;
199
+ exports.deserializeTransactionFromHex = deserializeTransactionFromHex;
155
200
  exports.getKeypair = getKeypair;
156
201
  exports.getSolNetworkId = getSolNetworkId;
157
202
  exports.isVersionedTransaction = isVersionedTransaction;
@@ -76,6 +76,50 @@ const deserializeTransaction = transaction => {
76
76
  return Transaction.from(bytes);
77
77
  }
78
78
  };
79
+
80
+ // export const deserializeTransactionFromBase64 = (
81
+ // transaction: string,
82
+ // ): Transaction | VersionedTransaction | undefined => {
83
+ // try {
84
+ // // Try base64 first (Yield API uses this)
85
+ // const rawTx = Buffer.from(transaction, "base64")
86
+
87
+ // try {
88
+ // return VersionedTransaction.deserialize(rawTx)
89
+ // } catch {
90
+ // return Transaction.from(rawTx)
91
+ // }
92
+ // } catch (base64Error) {
93
+ // // Fallback if it's hex-encoded
94
+ // try {
95
+ // const rawTx = Buffer.from(transaction, "hex")
96
+
97
+ // try {
98
+ // return VersionedTransaction.deserialize(rawTx)
99
+ // } catch {
100
+ // return Transaction.from(rawTx)
101
+ // }
102
+ // } catch (hexError) {
103
+ // return undefined
104
+ // }
105
+ // }
106
+ // }
107
+
108
+ const deserializeTransactionFromHex = transactionHex => {
109
+ try {
110
+ // Convert hex → bytes
111
+ const rawBytes = Buffer.from(transactionHex, "hex");
112
+
113
+ // Try versioned first
114
+ try {
115
+ return VersionedTransaction.deserialize(rawBytes);
116
+ } catch {
117
+ return Transaction.from(rawBytes);
118
+ }
119
+ } catch {
120
+ return undefined;
121
+ }
122
+ };
79
123
  const txToHumanJSON = tx => {
80
124
  if (typeof tx === "string") tx = deserializeTransaction(tx);
81
125
  return isVersionedTransaction(tx) ? versionedTxToJSON(tx) : legacyTxToJSON(tx);
@@ -148,4 +192,4 @@ const getSolNetworkId = chain => {
148
192
  }
149
193
  };
150
194
 
151
- export { SOLANA_CHAINS, deserializeTransaction, getKeypair, getSolNetworkId, isVersionedTransaction, parseTransactionInfo, serializeTransaction, solInstructionFromJson, solInstructionToJson, txToHumanJSON };
195
+ export { SOLANA_CHAINS, deserializeTransaction, deserializeTransactionFromHex, getKeypair, getSolNetworkId, isVersionedTransaction, parseTransactionInfo, serializeTransaction, solInstructionFromJson, solInstructionToJson, txToHumanJSON };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@talismn/solana",
3
- "version": "0.0.0-pr2198-20251125153235",
3
+ "version": "0.0.0-pr2198-20251229104607",
4
4
  "author": "Talisman",
5
5
  "homepage": "https://talisman.xyz",
6
6
  "license": "GPL-3.0-or-later",
@@ -23,7 +23,7 @@
23
23
  "dependencies": {
24
24
  "@solana/web3.js": "^1.98.2",
25
25
  "anylogger": "^1.0.11",
26
- "@talismn/crypto": "0.2.3"
26
+ "@talismn/crypto": "0.3.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/jest": "^29.5.14",
@@ -31,8 +31,8 @@
31
31
  "jest": "^29.7",
32
32
  "ts-jest": "^29.2.5",
33
33
  "typescript": "^5.6.3",
34
- "@talismn/tsconfig": "0.0.3",
35
- "@talismn/eslint-config": "0.0.3"
34
+ "@talismn/eslint-config": "0.0.3",
35
+ "@talismn/tsconfig": "0.0.3"
36
36
  },
37
37
  "eslintConfig": {
38
38
  "root": true,