@onekeyfe/onekey-solana-provider 1.1.23 → 1.1.24
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.d.ts +7 -7
- package/dist/cjs/utils.js +7 -1
- package/dist/utils.d.ts +3 -3
- package/dist/utils.js +8 -2
- package/package.json +6 -6
package/dist/ProviderSolana.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PublicKey } from '@solana/web3.js';
|
|
1
|
+
import { PublicKey, VersionedTransaction } from '@solana/web3.js';
|
|
2
2
|
import type { SendOptions, Transaction } from '@solana/web3.js';
|
|
3
3
|
import { IInpageProviderConfig } from '@onekeyfe/cross-inpage-provider-core';
|
|
4
4
|
import { IJsonRpcRequest } from '@onekeyfe/cross-inpage-provider-types';
|
|
@@ -76,18 +76,18 @@ interface IProviderSolana extends ProviderSolanaBase {
|
|
|
76
76
|
* Sign multiple transactions
|
|
77
77
|
* @returns Transaction[]
|
|
78
78
|
*/
|
|
79
|
-
signAllTransactions(transactions: Transaction[]): Promise<Transaction[]>;
|
|
79
|
+
signAllTransactions(transactions: (Transaction | VersionedTransaction)[]): Promise<(Transaction | VersionedTransaction)[]>;
|
|
80
80
|
/**
|
|
81
81
|
* @deprecated
|
|
82
82
|
* Sign one transaction
|
|
83
83
|
* @returns Transaction
|
|
84
84
|
*/
|
|
85
|
-
signTransaction(transaction: Transaction): Promise<Transaction>;
|
|
85
|
+
signTransaction(transaction: Transaction | VersionedTransaction): Promise<Transaction | VersionedTransaction>;
|
|
86
86
|
/**
|
|
87
87
|
* Sign and send a transaction
|
|
88
88
|
* @returns {Object} Signature and public key
|
|
89
89
|
*/
|
|
90
|
-
signAndSendTransaction(transaction: Transaction, options?: SendOptions): Promise<{
|
|
90
|
+
signAndSendTransaction(transaction: Transaction | VersionedTransaction, options?: SendOptions): Promise<{
|
|
91
91
|
publicKey: string;
|
|
92
92
|
signature: string;
|
|
93
93
|
}>;
|
|
@@ -122,14 +122,14 @@ declare class ProviderSolana extends ProviderSolanaBase implements IProviderSola
|
|
|
122
122
|
private _handleDisconnected;
|
|
123
123
|
isAccountsChanged(account: SolanaAccountInfo | undefined): boolean;
|
|
124
124
|
private _handleAccountChange;
|
|
125
|
-
signAndSendTransaction(transaction: Transaction, options?: Partial<SendOptions>): Promise<{
|
|
125
|
+
signAndSendTransaction(transaction: Transaction | VersionedTransaction, options?: Partial<SendOptions>): Promise<{
|
|
126
126
|
publicKey: string;
|
|
127
127
|
signature: string;
|
|
128
128
|
}>;
|
|
129
129
|
private _handleSignAndSendTransaction;
|
|
130
|
-
signTransaction(transaction: Transaction): Promise<Transaction>;
|
|
130
|
+
signTransaction(transaction: Transaction | VersionedTransaction): Promise<Transaction | VersionedTransaction>;
|
|
131
131
|
private _handleSignTransaction;
|
|
132
|
-
signAllTransactions(transactions: Transaction[]): Promise<Transaction[]>;
|
|
132
|
+
signAllTransactions(transactions: (Transaction | VersionedTransaction)[]): Promise<(Transaction | VersionedTransaction)[]>;
|
|
133
133
|
private _handleSignAllTransactions;
|
|
134
134
|
signMessage(message: Uint8Array, display?: DisplayEncoding): Promise<{
|
|
135
135
|
signature: Uint8Array;
|
package/dist/cjs/utils.js
CHANGED
|
@@ -11,7 +11,13 @@ const encodeTransaction = (transaction) => {
|
|
|
11
11
|
};
|
|
12
12
|
exports.encodeTransaction = encodeTransaction;
|
|
13
13
|
const decodeSignedTransaction = (message) => {
|
|
14
|
-
|
|
14
|
+
const txByte = bs58_1.default.decode(message);
|
|
15
|
+
try {
|
|
16
|
+
return web3_js_1.Transaction.from(txByte);
|
|
17
|
+
}
|
|
18
|
+
catch (_a) {
|
|
19
|
+
return web3_js_1.VersionedTransaction.deserialize(txByte);
|
|
20
|
+
}
|
|
15
21
|
};
|
|
16
22
|
exports.decodeSignedTransaction = decodeSignedTransaction;
|
|
17
23
|
function isWalletEventMethodMatch(method, name) {
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Transaction } from '@solana/web3.js';
|
|
2
|
-
export declare const encodeTransaction: (transaction: Transaction) => string;
|
|
3
|
-
export declare const decodeSignedTransaction: (message: string) => Transaction;
|
|
1
|
+
import { Transaction, VersionedTransaction } from '@solana/web3.js';
|
|
2
|
+
export declare const encodeTransaction: (transaction: Transaction | VersionedTransaction) => string;
|
|
3
|
+
export declare const decodeSignedTransaction: (message: string) => Transaction | VersionedTransaction;
|
|
4
4
|
export declare function isWalletEventMethodMatch(method: string, name: string): boolean;
|
package/dist/utils.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import { Transaction } from '@solana/web3.js';
|
|
1
|
+
import { Transaction, VersionedTransaction } from '@solana/web3.js';
|
|
2
2
|
import base58 from 'bs58';
|
|
3
3
|
export const encodeTransaction = (transaction) => {
|
|
4
4
|
return base58.encode(transaction.serialize({ requireAllSignatures: false }));
|
|
5
5
|
};
|
|
6
6
|
export const decodeSignedTransaction = (message) => {
|
|
7
|
-
|
|
7
|
+
const txByte = base58.decode(message);
|
|
8
|
+
try {
|
|
9
|
+
return Transaction.from(txByte);
|
|
10
|
+
}
|
|
11
|
+
catch (_a) {
|
|
12
|
+
return VersionedTransaction.deserialize(txByte);
|
|
13
|
+
}
|
|
8
14
|
};
|
|
9
15
|
export function isWalletEventMethodMatch(method, name) {
|
|
10
16
|
return method === `metamask_${name}` || method === `wallet_events_${name}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/onekey-solana-provider",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.24",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"cross-inpage-provider",
|
|
6
6
|
"solona"
|
|
@@ -29,15 +29,15 @@
|
|
|
29
29
|
"start": "tsc --watch"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@onekeyfe/cross-inpage-provider-core": "1.1.
|
|
33
|
-
"@onekeyfe/cross-inpage-provider-errors": "1.1.
|
|
34
|
-
"@onekeyfe/cross-inpage-provider-types": "1.1.
|
|
35
|
-
"@onekeyfe/extension-bridge-injected": "1.1.
|
|
32
|
+
"@onekeyfe/cross-inpage-provider-core": "1.1.24",
|
|
33
|
+
"@onekeyfe/cross-inpage-provider-errors": "1.1.24",
|
|
34
|
+
"@onekeyfe/cross-inpage-provider-types": "1.1.24",
|
|
35
|
+
"@onekeyfe/extension-bridge-injected": "1.1.24",
|
|
36
36
|
"@solana/web3.js": "^1.41.3",
|
|
37
37
|
"bs58": "^5.0.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/bs58": "^4.0.1"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "77715c206f3369f7a0c294d2706d471d7339212e"
|
|
43
43
|
}
|