Skip to content

Commit

Permalink
Merge pull request #165 from KeystoneHQ/update-sol-keyring
Browse files Browse the repository at this point in the history
feat(sol-keyring): change signing transaction interface
  • Loading branch information
soralit authored Jul 12, 2024
2 parents 5fea8b9 + ca17efb commit f858162
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 4 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
presets: [['@babel/preset-env', { targets: { node: 'current' } }], '@babel/preset-typescript'],
plugins: ['@babel/plugin-proposal-optional-chaining']
};
2 changes: 1 addition & 1 deletion packages/sol-keyring/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@keystonehq/sol-keyring",
"version": "0.19.3",
"version": "1.0.0",
"description": "sol-keyring interact with keystone",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
9 changes: 4 additions & 5 deletions packages/sol-keyring/src/BaseKeyring.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import bs58 from "bs58";
import * as uuid from "uuid";
import { Message, PublicKey, Transaction } from "@solana/web3.js";
import { Message, Transaction } from "@solana/web3.js";
import { InteractionProvider } from "./InteractionProvider";
import { CryptoMultiAccounts } from "@keystonehq/bc-ur-registry";
import { SolSignRequest, SignType } from "@keystonehq/bc-ur-registry-sol";
Expand Down Expand Up @@ -114,14 +114,13 @@ export class BaseKeyring {
return this.keys;
}

async signTransaction(pubKey: string, tx: Transaction): Promise<Transaction> {
async signTransaction(pubKey: string, txHex: Uint8Array): Promise<Uint8Array> {
const signature = await this._getSignature(
pubKey,
Buffer.from(tx.serializeMessage() as unknown as ArrayBuffer),
Buffer.from(txHex),
SignType.Transaction
);
tx.addSignature(new PublicKey(pubKey), signature);
return tx;
return signature;
}

async signMessage(
Expand Down

0 comments on commit f858162

Please sign in to comment.