@dfns/lib-solana 0.1.0-beta.7 → 0.1.0

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.
Files changed (3) hide show
  1. package/index.d.ts +2 -1
  2. package/index.js +11 -1
  3. package/package.json +2 -11
package/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import { DfnsApiClient } from '@dfns/sdk';
3
- import { PublicKey, Transaction } from '@solana/web3.js';
3
+ import { PublicKey, Transaction, VersionedTransaction } from '@solana/web3.js';
4
4
  export type DfnsWalletOptions = {
5
5
  walletId: string;
6
6
  dfnsClient: DfnsApiClient;
@@ -15,4 +15,5 @@ export declare class DfnsWallet {
15
15
  get address(): string;
16
16
  waitForSignature(signatureId: string): Promise<Buffer>;
17
17
  signTransaction(transaction: Transaction): Promise<Transaction>;
18
+ signVersionedTransaction(transaction: VersionedTransaction): Promise<VersionedTransaction>;
18
19
  }
package/index.js CHANGED
@@ -48,7 +48,17 @@ class DfnsWallet {
48
48
  }
49
49
  async signTransaction(transaction) {
50
50
  const message = transaction.serializeMessage();
51
- console.log(message.length);
51
+ const { walletId, dfnsClient } = this.options;
52
+ const res = await dfnsClient.wallets.generateSignature({
53
+ walletId,
54
+ body: { kind: Wallets_1.SignatureKind.Message, message: `0x${message.toString('hex')}` },
55
+ });
56
+ const signature = await this.waitForSignature(res.id);
57
+ transaction.addSignature(this.publicKey, signature);
58
+ return transaction;
59
+ }
60
+ async signVersionedTransaction(transaction) {
61
+ const message = transaction.message.serialize();
52
62
  const { walletId, dfnsClient } = this.options;
53
63
  const res = await dfnsClient.wallets.generateSignature({
54
64
  walletId,
package/package.json CHANGED
@@ -1,15 +1,6 @@
1
1
  {
2
2
  "name": "@dfns/lib-solana",
3
- "version": "0.1.0-beta.7",
4
- "dependencies": {
5
- "@solana/web3.js": "1.78.0",
6
- "buffer": "6.0.3",
7
- "cross-fetch": "3.1.6",
8
- "uuid": "9.0.0"
9
- },
10
- "peerDependencies": {
11
- "@dfns/sdk": "0.1.0-beta.7"
12
- },
3
+ "version": "0.1.0",
13
4
  "main": "./index.js",
14
- "types": "./index.d.ts"
5
+ "type": "commonjs"
15
6
  }