@getpara/stellar-sdk-v14-integration 3.20.0 → 3.21.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.
|
@@ -68,7 +68,7 @@ class ParaStellarSigner {
|
|
|
68
68
|
}
|
|
69
69
|
const t = import_stellar_sdk.TransactionBuilder.fromXDR(xdr, passphrase);
|
|
70
70
|
const txHash = t.hash();
|
|
71
|
-
const signatureBuffer = yield this.
|
|
71
|
+
const signatureBuffer = yield this.signBytesWithCanonicalContext(txHash, {
|
|
72
72
|
walletType: "STELLAR",
|
|
73
73
|
transactionXdr: xdr,
|
|
74
74
|
networkPassphrase: passphrase
|
|
@@ -78,7 +78,11 @@ class ParaStellarSigner {
|
|
|
78
78
|
});
|
|
79
79
|
this.signAuthEntry = (authEntry, _opts) => __async(this, null, function* () {
|
|
80
80
|
const entryHash = (0, import_stellar_sdk.hash)(Buffer.from(authEntry, "base64"));
|
|
81
|
-
const signatureBuffer = yield this.
|
|
81
|
+
const signatureBuffer = yield this.signBytesWithCanonicalContext(entryHash, void 0, {
|
|
82
|
+
walletType: "STELLAR",
|
|
83
|
+
signingType: "AUTH_ENTRY",
|
|
84
|
+
authEntryBase64: authEntry
|
|
85
|
+
});
|
|
82
86
|
return { signedAuthEntry: signatureBuffer.toString("base64"), signerAddress: this.address };
|
|
83
87
|
});
|
|
84
88
|
var _a;
|
|
@@ -95,15 +99,15 @@ class ParaStellarSigner {
|
|
|
95
99
|
}
|
|
96
100
|
signBytes(bytes) {
|
|
97
101
|
return __async(this, null, function* () {
|
|
98
|
-
return this.
|
|
102
|
+
return this.signBytesWithCanonicalContext(bytes);
|
|
99
103
|
});
|
|
100
104
|
}
|
|
101
|
-
|
|
105
|
+
signBytesWithCanonicalContext(bytes, canonicalTransaction, canonicalMessage) {
|
|
102
106
|
return __async(this, null, function* () {
|
|
103
|
-
const res = yield this.para.signMessage(__spreadValues({
|
|
107
|
+
const res = yield this.para.signMessage(__spreadValues(__spreadValues({
|
|
104
108
|
walletId: this.currentWalletId,
|
|
105
109
|
messageBase64: bytes.toString("base64")
|
|
106
|
-
}, canonicalTransaction ? { canonicalTransaction } : {}));
|
|
110
|
+
}, canonicalTransaction ? { canonicalTransaction } : {}), canonicalMessage ? { canonicalMessage } : {}));
|
|
107
111
|
return Buffer.from((0, import_core_sdk.requireSuccessfulSignature)(res), "base64");
|
|
108
112
|
});
|
|
109
113
|
}
|
|
@@ -49,7 +49,7 @@ class ParaStellarSigner {
|
|
|
49
49
|
}
|
|
50
50
|
const t = TransactionBuilder.fromXDR(xdr, passphrase);
|
|
51
51
|
const txHash = t.hash();
|
|
52
|
-
const signatureBuffer = yield this.
|
|
52
|
+
const signatureBuffer = yield this.signBytesWithCanonicalContext(txHash, {
|
|
53
53
|
walletType: "STELLAR",
|
|
54
54
|
transactionXdr: xdr,
|
|
55
55
|
networkPassphrase: passphrase
|
|
@@ -59,7 +59,11 @@ class ParaStellarSigner {
|
|
|
59
59
|
});
|
|
60
60
|
this.signAuthEntry = (authEntry, _opts) => __async(this, null, function* () {
|
|
61
61
|
const entryHash = hash(Buffer.from(authEntry, "base64"));
|
|
62
|
-
const signatureBuffer = yield this.
|
|
62
|
+
const signatureBuffer = yield this.signBytesWithCanonicalContext(entryHash, void 0, {
|
|
63
|
+
walletType: "STELLAR",
|
|
64
|
+
signingType: "AUTH_ENTRY",
|
|
65
|
+
authEntryBase64: authEntry
|
|
66
|
+
});
|
|
63
67
|
return { signedAuthEntry: signatureBuffer.toString("base64"), signerAddress: this.address };
|
|
64
68
|
});
|
|
65
69
|
var _a;
|
|
@@ -76,15 +80,15 @@ class ParaStellarSigner {
|
|
|
76
80
|
}
|
|
77
81
|
signBytes(bytes) {
|
|
78
82
|
return __async(this, null, function* () {
|
|
79
|
-
return this.
|
|
83
|
+
return this.signBytesWithCanonicalContext(bytes);
|
|
80
84
|
});
|
|
81
85
|
}
|
|
82
|
-
|
|
86
|
+
signBytesWithCanonicalContext(bytes, canonicalTransaction, canonicalMessage) {
|
|
83
87
|
return __async(this, null, function* () {
|
|
84
|
-
const res = yield this.para.signMessage(__spreadValues({
|
|
88
|
+
const res = yield this.para.signMessage(__spreadValues(__spreadValues({
|
|
85
89
|
walletId: this.currentWalletId,
|
|
86
90
|
messageBase64: bytes.toString("base64")
|
|
87
|
-
}, canonicalTransaction ? { canonicalTransaction } : {}));
|
|
91
|
+
}, canonicalTransaction ? { canonicalTransaction } : {}), canonicalMessage ? { canonicalMessage } : {}));
|
|
88
92
|
return Buffer.from(requireSuccessfulSignature(res), "base64");
|
|
89
93
|
});
|
|
90
94
|
}
|
|
@@ -10,7 +10,7 @@ export declare class ParaStellarSigner {
|
|
|
10
10
|
address: string;
|
|
11
11
|
constructor(para: ParaCore, networkPassphrase?: string, walletId?: string);
|
|
12
12
|
signBytes(bytes: Buffer): Promise<Buffer>;
|
|
13
|
-
private
|
|
13
|
+
private signBytesWithCanonicalContext;
|
|
14
14
|
signTransaction: contract.SignTransaction;
|
|
15
15
|
signTransactionXDR(transactionXDR: string, networkPassphrase: string): Promise<string>;
|
|
16
16
|
signAuthEntry: contract.SignAuthEntry;
|
package/package.json
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/stellar-sdk-v14-integration",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.21.0",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@getpara/core-sdk": "3.
|
|
5
|
+
"@getpara/core-sdk": "3.21.0",
|
|
6
|
+
"@types/json-schema": "^7.0.15",
|
|
7
|
+
"@types/urijs": "^1.19.26",
|
|
6
8
|
"bs58": "^6.0.0"
|
|
7
9
|
},
|
|
8
10
|
"devDependencies": {
|
|
@@ -30,11 +32,12 @@
|
|
|
30
32
|
"test": "vitest run --coverage",
|
|
31
33
|
"build:cjs": "rm -rf dist/cjs && tsc --module commonjs --outDir dist/cjs && printf '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
|
|
32
34
|
"build:esm": "rm -rf dist/esm && tsc --module es6 --outDir dist/esm && printf '{\"type\":\"module\",\"sideEffects\":false}' > dist/esm/package.json",
|
|
33
|
-
"build:types": "
|
|
34
|
-
"old-build": "yarn build:cjs && yarn build:esm && yarn build:types"
|
|
35
|
+
"build:types": "tsc --emitDeclarationOnly",
|
|
36
|
+
"old-build": "yarn build:cjs && yarn build:esm && yarn build:types",
|
|
37
|
+
"typecheck": "tsc --noEmit"
|
|
35
38
|
},
|
|
36
39
|
"sideEffects": false,
|
|
37
40
|
"types": "dist/types/index.d.ts",
|
|
38
41
|
"typings": "dist/types/index.d.ts",
|
|
39
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "e1ca81fb06f6337aaa7cc1860584b7ba5d1d9ca8"
|
|
40
43
|
}
|