@getpara/solana-web3.js-v1-integration 1.5.0 → 1.5.1

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/cjs/index.js CHANGED
@@ -25,6 +25,26 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
25
  mod
26
26
  ));
27
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var __async = (__this, __arguments, generator) => {
29
+ return new Promise((resolve, reject) => {
30
+ var fulfilled = (value) => {
31
+ try {
32
+ step(generator.next(value));
33
+ } catch (e) {
34
+ reject(e);
35
+ }
36
+ };
37
+ var rejected = (value) => {
38
+ try {
39
+ step(generator.throw(value));
40
+ } catch (e) {
41
+ reject(e);
42
+ }
43
+ };
44
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
45
+ step((generator = generator.apply(__this, __arguments)).next());
46
+ });
47
+ };
28
48
 
29
49
  // src/index.ts
30
50
  var src_exports = {};
@@ -45,37 +65,45 @@ var ParaSolanaWeb3Signer = class {
45
65
  this.address = para.wallets[this.currentWalletId].address;
46
66
  this.sender = this.address ? new solana.PublicKey(import_bs58.default.decode(this.address)) : void 0;
47
67
  }
48
- async signBytes(bytes) {
49
- const res = await this.para.signMessage({ walletId: this.currentWalletId, messageBase64: bytes.toString("base64") });
50
- if (res.transactionReviewUrl) {
51
- throw new import_core_sdk.TransactionReviewError(res.transactionReviewUrl);
52
- }
53
- return Buffer.from(res.signature, "base64");
68
+ signBytes(bytes) {
69
+ return __async(this, null, function* () {
70
+ const res = yield this.para.signMessage({ walletId: this.currentWalletId, messageBase64: bytes.toString("base64") });
71
+ if (res.transactionReviewUrl) {
72
+ throw new import_core_sdk.TransactionReviewError(res.transactionReviewUrl);
73
+ }
74
+ return Buffer.from(res.signature, "base64");
75
+ });
54
76
  }
55
- async signTransaction(transaction) {
56
- if (transaction instanceof solana.VersionedTransaction) {
57
- return await this.signVersionedTransaction(transaction);
58
- }
59
- if (!transaction.recentBlockhash) {
60
- transaction.recentBlockhash = (await this.connection.getLatestBlockhash("finalized")).blockhash;
61
- }
62
- const bytesToSign = transaction.serializeMessage();
63
- const sigBytes = await this.signBytes(bytesToSign);
64
- transaction.addSignature(this.sender, sigBytes);
65
- return transaction;
77
+ signTransaction(transaction) {
78
+ return __async(this, null, function* () {
79
+ if (transaction instanceof solana.VersionedTransaction) {
80
+ return yield this.signVersionedTransaction(transaction);
81
+ }
82
+ if (!transaction.recentBlockhash) {
83
+ transaction.recentBlockhash = (yield this.connection.getLatestBlockhash("finalized")).blockhash;
84
+ }
85
+ const bytesToSign = transaction.serializeMessage();
86
+ const sigBytes = yield this.signBytes(bytesToSign);
87
+ transaction.addSignature(this.sender, sigBytes);
88
+ return transaction;
89
+ });
66
90
  }
67
- async signVersionedTransaction(transaction) {
68
- if (!transaction.message.recentBlockhash) {
69
- transaction.message.recentBlockhash = (await this.connection.getLatestBlockhash("finalized")).blockhash;
70
- }
71
- const messageBytes = transaction.message.serialize();
72
- const sigBytes = await this.signBytes(Buffer.from(messageBytes));
73
- transaction.addSignature(this.sender, sigBytes);
74
- return transaction;
91
+ signVersionedTransaction(transaction) {
92
+ return __async(this, null, function* () {
93
+ if (!transaction.message.recentBlockhash) {
94
+ transaction.message.recentBlockhash = (yield this.connection.getLatestBlockhash("finalized")).blockhash;
95
+ }
96
+ const messageBytes = transaction.message.serialize();
97
+ const sigBytes = yield this.signBytes(Buffer.from(messageBytes));
98
+ transaction.addSignature(this.sender, sigBytes);
99
+ return transaction;
100
+ });
75
101
  }
76
- async sendTransaction(transaction, options) {
77
- const signedTransaction = await this.signTransaction(transaction);
78
- return this.connection.sendRawTransaction(signedTransaction.serialize(), options);
102
+ sendTransaction(transaction, options) {
103
+ return __async(this, null, function* () {
104
+ const signedTransaction = yield this.signTransaction(transaction);
105
+ return this.connection.sendRawTransaction(signedTransaction.serialize(), options);
106
+ });
79
107
  }
80
108
  };
81
109
  // Annotate the CommonJS export names for ESM import in node:
Binary file
Binary file
package/dist/esm/index.js CHANGED
@@ -1,3 +1,24 @@
1
+ var __async = (__this, __arguments, generator) => {
2
+ return new Promise((resolve, reject) => {
3
+ var fulfilled = (value) => {
4
+ try {
5
+ step(generator.next(value));
6
+ } catch (e) {
7
+ reject(e);
8
+ }
9
+ };
10
+ var rejected = (value) => {
11
+ try {
12
+ step(generator.throw(value));
13
+ } catch (e) {
14
+ reject(e);
15
+ }
16
+ };
17
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18
+ step((generator = generator.apply(__this, __arguments)).next());
19
+ });
20
+ };
21
+
1
22
  // src/solana-web3js.ts
2
23
  import * as solana from "@solana/web3.js";
3
24
  import bs58 from "bs58";
@@ -10,37 +31,45 @@ var ParaSolanaWeb3Signer = class {
10
31
  this.address = para.wallets[this.currentWalletId].address;
11
32
  this.sender = this.address ? new solana.PublicKey(bs58.decode(this.address)) : void 0;
12
33
  }
13
- async signBytes(bytes) {
14
- const res = await this.para.signMessage({ walletId: this.currentWalletId, messageBase64: bytes.toString("base64") });
15
- if (res.transactionReviewUrl) {
16
- throw new TransactionReviewError(res.transactionReviewUrl);
17
- }
18
- return Buffer.from(res.signature, "base64");
34
+ signBytes(bytes) {
35
+ return __async(this, null, function* () {
36
+ const res = yield this.para.signMessage({ walletId: this.currentWalletId, messageBase64: bytes.toString("base64") });
37
+ if (res.transactionReviewUrl) {
38
+ throw new TransactionReviewError(res.transactionReviewUrl);
39
+ }
40
+ return Buffer.from(res.signature, "base64");
41
+ });
19
42
  }
20
- async signTransaction(transaction) {
21
- if (transaction instanceof solana.VersionedTransaction) {
22
- return await this.signVersionedTransaction(transaction);
23
- }
24
- if (!transaction.recentBlockhash) {
25
- transaction.recentBlockhash = (await this.connection.getLatestBlockhash("finalized")).blockhash;
26
- }
27
- const bytesToSign = transaction.serializeMessage();
28
- const sigBytes = await this.signBytes(bytesToSign);
29
- transaction.addSignature(this.sender, sigBytes);
30
- return transaction;
43
+ signTransaction(transaction) {
44
+ return __async(this, null, function* () {
45
+ if (transaction instanceof solana.VersionedTransaction) {
46
+ return yield this.signVersionedTransaction(transaction);
47
+ }
48
+ if (!transaction.recentBlockhash) {
49
+ transaction.recentBlockhash = (yield this.connection.getLatestBlockhash("finalized")).blockhash;
50
+ }
51
+ const bytesToSign = transaction.serializeMessage();
52
+ const sigBytes = yield this.signBytes(bytesToSign);
53
+ transaction.addSignature(this.sender, sigBytes);
54
+ return transaction;
55
+ });
31
56
  }
32
- async signVersionedTransaction(transaction) {
33
- if (!transaction.message.recentBlockhash) {
34
- transaction.message.recentBlockhash = (await this.connection.getLatestBlockhash("finalized")).blockhash;
35
- }
36
- const messageBytes = transaction.message.serialize();
37
- const sigBytes = await this.signBytes(Buffer.from(messageBytes));
38
- transaction.addSignature(this.sender, sigBytes);
39
- return transaction;
57
+ signVersionedTransaction(transaction) {
58
+ return __async(this, null, function* () {
59
+ if (!transaction.message.recentBlockhash) {
60
+ transaction.message.recentBlockhash = (yield this.connection.getLatestBlockhash("finalized")).blockhash;
61
+ }
62
+ const messageBytes = transaction.message.serialize();
63
+ const sigBytes = yield this.signBytes(Buffer.from(messageBytes));
64
+ transaction.addSignature(this.sender, sigBytes);
65
+ return transaction;
66
+ });
40
67
  }
41
- async sendTransaction(transaction, options) {
42
- const signedTransaction = await this.signTransaction(transaction);
43
- return this.connection.sendRawTransaction(signedTransaction.serialize(), options);
68
+ sendTransaction(transaction, options) {
69
+ return __async(this, null, function* () {
70
+ const signedTransaction = yield this.signTransaction(transaction);
71
+ return this.connection.sendRawTransaction(signedTransaction.serialize(), options);
72
+ });
44
73
  }
45
74
  };
46
75
  export {
Binary file
Binary file
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
2
3
  import * as solana from '@solana/web3.js';
3
4
  import ParaCore from '@getpara/core-sdk';
4
5
  export declare class ParaSolanaWeb3Signer {
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@getpara/solana-web3.js-v1-integration",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
7
7
  "typings": "dist/types/index.d.ts",
8
8
  "sideEffects": false,
9
9
  "dependencies": {
10
- "@getpara/core-sdk": "1.5.0",
10
+ "@getpara/core-sdk": "1.5.1",
11
11
  "@solana/web3.js": "^1.95.8"
12
12
  },
13
13
  "scripts": {
@@ -31,5 +31,5 @@
31
31
  "types": "./dist/types/index.d.ts"
32
32
  }
33
33
  },
34
- "gitHead": "0e3c1401b4f1da60b288cdde7695077c9bcbc48f"
34
+ "gitHead": "f77e0f5e162a1672219b01dbf7c06a3baadd2f35"
35
35
  }