Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sol-keyring): change signing transaction interface #165

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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