Skip to content

Commit f858162

Browse files
authored
Merge pull request #165 from KeystoneHQ/update-sol-keyring
feat(sol-keyring): change signing transaction interface
2 parents 5fea8b9 + ca17efb commit f858162

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

babel.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
presets: [['@babel/preset-env', { targets: { node: 'current' } }], '@babel/preset-typescript'],
3+
plugins: ['@babel/plugin-proposal-optional-chaining']
4+
};

packages/sol-keyring/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@keystonehq/sol-keyring",
3-
"version": "0.19.3",
3+
"version": "1.0.0",
44
"description": "sol-keyring interact with keystone",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

packages/sol-keyring/src/BaseKeyring.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import bs58 from "bs58";
22
import * as uuid from "uuid";
3-
import { Message, PublicKey, Transaction } from "@solana/web3.js";
3+
import { Message, Transaction } from "@solana/web3.js";
44
import { InteractionProvider } from "./InteractionProvider";
55
import { CryptoMultiAccounts } from "@keystonehq/bc-ur-registry";
66
import { SolSignRequest, SignType } from "@keystonehq/bc-ur-registry-sol";
@@ -114,14 +114,13 @@ export class BaseKeyring {
114114
return this.keys;
115115
}
116116

117-
async signTransaction(pubKey: string, tx: Transaction): Promise<Transaction> {
117+
async signTransaction(pubKey: string, txHex: Uint8Array): Promise<Uint8Array> {
118118
const signature = await this._getSignature(
119119
pubKey,
120-
Buffer.from(tx.serializeMessage() as unknown as ArrayBuffer),
120+
Buffer.from(txHex),
121121
SignType.Transaction
122122
);
123-
tx.addSignature(new PublicKey(pubKey), signature);
124-
return tx;
123+
return signature;
125124
}
126125

127126
async signMessage(

0 commit comments

Comments
 (0)