@getpara/solana-web3.js-v1-integration 3.12.0 → 3.14.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.
|
@@ -2,8 +2,22 @@ var __create = Object.create;
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues = (a, b) => {
|
|
11
|
+
for (var prop in b || (b = {}))
|
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols)
|
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
}
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
7
21
|
var __export = (target, all) => {
|
|
8
22
|
for (var name in all)
|
|
9
23
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -63,7 +77,15 @@ class ParaSolanaWeb3Signer {
|
|
|
63
77
|
}
|
|
64
78
|
signBytes(bytes) {
|
|
65
79
|
return __async(this, null, function* () {
|
|
66
|
-
|
|
80
|
+
return this.signBytesWithCanonicalTransaction(bytes);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
signBytesWithCanonicalTransaction(bytes, canonicalTransaction) {
|
|
84
|
+
return __async(this, null, function* () {
|
|
85
|
+
const res = yield this.para.signMessage(__spreadValues({
|
|
86
|
+
walletId: this.currentWalletId,
|
|
87
|
+
messageBase64: bytes.toString("base64")
|
|
88
|
+
}, canonicalTransaction ? { canonicalTransaction } : {}));
|
|
67
89
|
if (res.transactionReviewUrl) {
|
|
68
90
|
throw new import_core_sdk.TransactionReviewError(res.transactionReviewUrl);
|
|
69
91
|
}
|
|
@@ -79,7 +101,10 @@ class ParaSolanaWeb3Signer {
|
|
|
79
101
|
transaction.recentBlockhash = (yield this.connection.getLatestBlockhash("finalized")).blockhash;
|
|
80
102
|
}
|
|
81
103
|
const bytesToSign = transaction.serializeMessage();
|
|
82
|
-
const sigBytes = yield this.
|
|
104
|
+
const sigBytes = yield this.signBytesWithCanonicalTransaction(bytesToSign, {
|
|
105
|
+
walletType: "SOLANA",
|
|
106
|
+
transactionBase64: transaction.serialize({ requireAllSignatures: false, verifySignatures: false }).toString("base64")
|
|
107
|
+
});
|
|
83
108
|
transaction.addSignature(this.sender, sigBytes);
|
|
84
109
|
return transaction;
|
|
85
110
|
});
|
|
@@ -90,7 +115,10 @@ class ParaSolanaWeb3Signer {
|
|
|
90
115
|
transaction.message.recentBlockhash = (yield this.connection.getLatestBlockhash("finalized")).blockhash;
|
|
91
116
|
}
|
|
92
117
|
const messageBytes = transaction.message.serialize();
|
|
93
|
-
const sigBytes = yield this.
|
|
118
|
+
const sigBytes = yield this.signBytesWithCanonicalTransaction(Buffer.from(messageBytes), {
|
|
119
|
+
walletType: "SOLANA",
|
|
120
|
+
transactionBase64: Buffer.from(transaction.serialize()).toString("base64")
|
|
121
|
+
});
|
|
94
122
|
transaction.addSignature(this.sender, sigBytes);
|
|
95
123
|
return transaction;
|
|
96
124
|
});
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
1
17
|
var __async = (__this, __arguments, generator) => {
|
|
2
18
|
return new Promise((resolve, reject) => {
|
|
3
19
|
var fulfilled = (value) => {
|
|
@@ -20,7 +36,9 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20
36
|
};
|
|
21
37
|
import * as solana from "@solana/web3.js";
|
|
22
38
|
import bs58 from "bs58";
|
|
23
|
-
import {
|
|
39
|
+
import {
|
|
40
|
+
TransactionReviewError
|
|
41
|
+
} from "@getpara/core-sdk";
|
|
24
42
|
class ParaSolanaWeb3Signer {
|
|
25
43
|
constructor(para, connection, walletId) {
|
|
26
44
|
this.currentWalletId = para.findWalletId(walletId, { type: ["SOLANA"] });
|
|
@@ -31,7 +49,15 @@ class ParaSolanaWeb3Signer {
|
|
|
31
49
|
}
|
|
32
50
|
signBytes(bytes) {
|
|
33
51
|
return __async(this, null, function* () {
|
|
34
|
-
|
|
52
|
+
return this.signBytesWithCanonicalTransaction(bytes);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
signBytesWithCanonicalTransaction(bytes, canonicalTransaction) {
|
|
56
|
+
return __async(this, null, function* () {
|
|
57
|
+
const res = yield this.para.signMessage(__spreadValues({
|
|
58
|
+
walletId: this.currentWalletId,
|
|
59
|
+
messageBase64: bytes.toString("base64")
|
|
60
|
+
}, canonicalTransaction ? { canonicalTransaction } : {}));
|
|
35
61
|
if (res.transactionReviewUrl) {
|
|
36
62
|
throw new TransactionReviewError(res.transactionReviewUrl);
|
|
37
63
|
}
|
|
@@ -47,7 +73,10 @@ class ParaSolanaWeb3Signer {
|
|
|
47
73
|
transaction.recentBlockhash = (yield this.connection.getLatestBlockhash("finalized")).blockhash;
|
|
48
74
|
}
|
|
49
75
|
const bytesToSign = transaction.serializeMessage();
|
|
50
|
-
const sigBytes = yield this.
|
|
76
|
+
const sigBytes = yield this.signBytesWithCanonicalTransaction(bytesToSign, {
|
|
77
|
+
walletType: "SOLANA",
|
|
78
|
+
transactionBase64: transaction.serialize({ requireAllSignatures: false, verifySignatures: false }).toString("base64")
|
|
79
|
+
});
|
|
51
80
|
transaction.addSignature(this.sender, sigBytes);
|
|
52
81
|
return transaction;
|
|
53
82
|
});
|
|
@@ -58,7 +87,10 @@ class ParaSolanaWeb3Signer {
|
|
|
58
87
|
transaction.message.recentBlockhash = (yield this.connection.getLatestBlockhash("finalized")).blockhash;
|
|
59
88
|
}
|
|
60
89
|
const messageBytes = transaction.message.serialize();
|
|
61
|
-
const sigBytes = yield this.
|
|
90
|
+
const sigBytes = yield this.signBytesWithCanonicalTransaction(Buffer.from(messageBytes), {
|
|
91
|
+
walletType: "SOLANA",
|
|
92
|
+
transactionBase64: Buffer.from(transaction.serialize()).toString("base64")
|
|
93
|
+
});
|
|
62
94
|
transaction.addSignature(this.sender, sigBytes);
|
|
63
95
|
return transaction;
|
|
64
96
|
});
|
|
@@ -8,6 +8,7 @@ export declare class ParaSolanaWeb3Signer {
|
|
|
8
8
|
sender?: solana.PublicKey;
|
|
9
9
|
constructor(para: ParaCore, connection: solana.Connection, walletId?: string);
|
|
10
10
|
signBytes(bytes: Buffer): Promise<Buffer>;
|
|
11
|
+
private signBytesWithCanonicalTransaction;
|
|
11
12
|
signTransaction<T extends solana.Transaction | solana.VersionedTransaction>(transaction: T): Promise<T>;
|
|
12
13
|
signVersionedTransaction(transaction: solana.VersionedTransaction): Promise<solana.VersionedTransaction>;
|
|
13
14
|
sendTransaction(transaction: solana.Transaction | solana.VersionedTransaction, options?: solana.SendOptions): Promise<string>;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/solana-web3.js-v1-integration",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.14.0",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@getpara/core-sdk": "3.
|
|
5
|
+
"@getpara/core-sdk": "3.14.0"
|
|
6
6
|
},
|
|
7
7
|
"devDependencies": {
|
|
8
8
|
"@solana/web3.js": "^1.98.0",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"dist",
|
|
20
20
|
"package.json"
|
|
21
21
|
],
|
|
22
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "2b83e73b639ad1733d1c03a5e628a92c87b399c1",
|
|
23
23
|
"main": "dist/cjs/index.js",
|
|
24
24
|
"module": "dist/esm/index.js",
|
|
25
25
|
"peerDependencies": {
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
29
|
"build": "rm -rf dist && node ./scripts/build.mjs && yarn build:types",
|
|
30
|
+
"test": "vitest run",
|
|
30
31
|
"build:cjs": "rm -rf dist/cjs && tsc --module commonjs --outDir dist/cjs && printf '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
|
|
31
32
|
"build:esm": "rm -rf dist/esm && tsc --module es6 --outDir dist/esm && printf '{\"type\":\"module\",\"sideEffects\":false}' > dist/esm/package.json",
|
|
32
33
|
"build:types": "rm -rf dist/types && tsc --module es6 --declarationDir dist/types --emitDeclarationOnly --declaration",
|