@onekeyfe/onekey-solana-provider 2.2.7-alpha.1 → 2.2.7-alpha.3
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/ProviderSolana.js +10 -3
- package/dist/cjs/ProviderSolana.js +10 -3
- package/dist/cjs/utils.js +4 -1
- package/dist/utils.d.ts +4 -1
- package/dist/utils.js +4 -1
- package/package.json +7 -7
package/dist/ProviderSolana.js
CHANGED
|
@@ -153,18 +153,25 @@ class ProviderSolana extends ProviderSolanaBase {
|
|
|
153
153
|
}
|
|
154
154
|
signTransaction(transaction) {
|
|
155
155
|
return __awaiter(this, void 0, void 0, function* () {
|
|
156
|
+
const hasVersionedTx = 'version' in transaction;
|
|
156
157
|
return this._handleSignTransaction({
|
|
157
158
|
message: encodeTransaction(transaction),
|
|
159
|
+
}, {
|
|
160
|
+
onlyVersionedTx: hasVersionedTx,
|
|
158
161
|
});
|
|
159
162
|
});
|
|
160
163
|
}
|
|
161
|
-
_handleSignTransaction(params) {
|
|
164
|
+
_handleSignTransaction(params, options) {
|
|
162
165
|
return __awaiter(this, void 0, void 0, function* () {
|
|
166
|
+
const { onlyVersionedTx } = options || {};
|
|
163
167
|
const result = yield this._callBridge({
|
|
164
168
|
method: 'signTransaction',
|
|
165
169
|
params,
|
|
166
170
|
});
|
|
167
|
-
return decodeSignedTransaction(
|
|
171
|
+
return decodeSignedTransaction({
|
|
172
|
+
message: result,
|
|
173
|
+
onlyVersionedTx,
|
|
174
|
+
});
|
|
168
175
|
});
|
|
169
176
|
}
|
|
170
177
|
signAllTransactions(transactions) {
|
|
@@ -180,7 +187,7 @@ class ProviderSolana extends ProviderSolanaBase {
|
|
|
180
187
|
method: 'signAllTransactions',
|
|
181
188
|
params,
|
|
182
189
|
});
|
|
183
|
-
return result.map(decodeSignedTransaction);
|
|
190
|
+
return result.map((message) => decodeSignedTransaction({ message }));
|
|
184
191
|
});
|
|
185
192
|
}
|
|
186
193
|
signMessage(message, display) {
|
|
@@ -159,18 +159,25 @@ class ProviderSolana extends ProviderSolanaBase_1.ProviderSolanaBase {
|
|
|
159
159
|
}
|
|
160
160
|
signTransaction(transaction) {
|
|
161
161
|
return __awaiter(this, void 0, void 0, function* () {
|
|
162
|
+
const hasVersionedTx = 'version' in transaction;
|
|
162
163
|
return this._handleSignTransaction({
|
|
163
164
|
message: (0, utils_1.encodeTransaction)(transaction),
|
|
165
|
+
}, {
|
|
166
|
+
onlyVersionedTx: hasVersionedTx,
|
|
164
167
|
});
|
|
165
168
|
});
|
|
166
169
|
}
|
|
167
|
-
_handleSignTransaction(params) {
|
|
170
|
+
_handleSignTransaction(params, options) {
|
|
168
171
|
return __awaiter(this, void 0, void 0, function* () {
|
|
172
|
+
const { onlyVersionedTx } = options || {};
|
|
169
173
|
const result = yield this._callBridge({
|
|
170
174
|
method: 'signTransaction',
|
|
171
175
|
params,
|
|
172
176
|
});
|
|
173
|
-
return (0, utils_1.decodeSignedTransaction)(
|
|
177
|
+
return (0, utils_1.decodeSignedTransaction)({
|
|
178
|
+
message: result,
|
|
179
|
+
onlyVersionedTx,
|
|
180
|
+
});
|
|
174
181
|
});
|
|
175
182
|
}
|
|
176
183
|
signAllTransactions(transactions) {
|
|
@@ -186,7 +193,7 @@ class ProviderSolana extends ProviderSolanaBase_1.ProviderSolanaBase {
|
|
|
186
193
|
method: 'signAllTransactions',
|
|
187
194
|
params,
|
|
188
195
|
});
|
|
189
|
-
return result.map(utils_1.decodeSignedTransaction);
|
|
196
|
+
return result.map((message) => (0, utils_1.decodeSignedTransaction)({ message }));
|
|
190
197
|
});
|
|
191
198
|
}
|
|
192
199
|
signMessage(message, display) {
|
package/dist/cjs/utils.js
CHANGED
|
@@ -14,8 +14,11 @@ const encodeTransaction = (transaction) => {
|
|
|
14
14
|
return bs58_1.default.encode(transaction.serialize({ requireAllSignatures: false }));
|
|
15
15
|
};
|
|
16
16
|
exports.encodeTransaction = encodeTransaction;
|
|
17
|
-
const decodeSignedTransaction = (message) => {
|
|
17
|
+
const decodeSignedTransaction = ({ message, onlyVersionedTx, }) => {
|
|
18
18
|
const txByte = bs58_1.default.decode(message);
|
|
19
|
+
if (onlyVersionedTx) {
|
|
20
|
+
return web3_js_1.VersionedTransaction.deserialize(txByte);
|
|
21
|
+
}
|
|
19
22
|
try {
|
|
20
23
|
return web3_js_1.Transaction.from(txByte);
|
|
21
24
|
}
|
package/dist/utils.d.ts
CHANGED
|
@@ -4,7 +4,10 @@ interface Indexed<T> {
|
|
|
4
4
|
[index: number]: T;
|
|
5
5
|
}
|
|
6
6
|
export declare const encodeTransaction: (transaction: Transaction | VersionedTransaction) => string;
|
|
7
|
-
export declare const decodeSignedTransaction: (message
|
|
7
|
+
export declare const decodeSignedTransaction: ({ message, onlyVersionedTx, }: {
|
|
8
|
+
message: string;
|
|
9
|
+
onlyVersionedTx?: boolean;
|
|
10
|
+
}) => Transaction | VersionedTransaction;
|
|
8
11
|
export declare function isWalletEventMethodMatch(method: string, name: string): boolean;
|
|
9
12
|
export declare function bytesEqual(a: Uint8Array, b: Uint8Array): boolean;
|
|
10
13
|
export declare function arraysEqual<T>(a: Indexed<T>, b: Indexed<T>): boolean;
|
package/dist/utils.js
CHANGED
|
@@ -3,8 +3,11 @@ import base58 from 'bs58';
|
|
|
3
3
|
export const encodeTransaction = (transaction) => {
|
|
4
4
|
return base58.encode(transaction.serialize({ requireAllSignatures: false }));
|
|
5
5
|
};
|
|
6
|
-
export const decodeSignedTransaction = (message) => {
|
|
6
|
+
export const decodeSignedTransaction = ({ message, onlyVersionedTx, }) => {
|
|
7
7
|
const txByte = base58.decode(message);
|
|
8
|
+
if (onlyVersionedTx) {
|
|
9
|
+
return VersionedTransaction.deserialize(txByte);
|
|
10
|
+
}
|
|
8
11
|
try {
|
|
9
12
|
return Transaction.from(txByte);
|
|
10
13
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/onekey-solana-provider",
|
|
3
|
-
"version": "2.2.7-alpha.
|
|
3
|
+
"version": "2.2.7-alpha.3",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"cross-inpage-provider",
|
|
6
6
|
"solona"
|
|
@@ -29,17 +29,17 @@
|
|
|
29
29
|
"start": "tsc --watch"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@onekeyfe/cross-inpage-provider-core": "2.2.7-alpha.
|
|
33
|
-
"@onekeyfe/cross-inpage-provider-errors": "2.2.7-alpha.
|
|
34
|
-
"@onekeyfe/cross-inpage-provider-types": "2.2.7-alpha.
|
|
35
|
-
"@onekeyfe/extension-bridge-injected": "2.2.7-alpha.
|
|
32
|
+
"@onekeyfe/cross-inpage-provider-core": "2.2.7-alpha.3",
|
|
33
|
+
"@onekeyfe/cross-inpage-provider-errors": "2.2.7-alpha.3",
|
|
34
|
+
"@onekeyfe/cross-inpage-provider-types": "2.2.7-alpha.3",
|
|
35
|
+
"@onekeyfe/extension-bridge-injected": "2.2.7-alpha.3",
|
|
36
36
|
"@solana/wallet-standard-features": "^1.1.0",
|
|
37
|
-
"@solana/web3.js": "^1.
|
|
37
|
+
"@solana/web3.js": "^1.98.0",
|
|
38
38
|
"@wallet-standard/base": "^1.0.1",
|
|
39
39
|
"bs58": "^5.0.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/bs58": "^4.0.1"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "4b4d54c686e1037fde71d9be5aca163160a5e816"
|
|
45
45
|
}
|