@stellar/stellar-base 12.1.0 → 12.1.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/CHANGELOG.md +9 -0
- package/dist/stellar-base.js +17 -11
- package/dist/stellar-base.min.js +1 -1
- package/lib/asset.js +1 -1
- package/lib/auth.js +14 -9
- package/lib/invocation.js +2 -1
- package/package.json +11 -11
- package/types/index.d.ts +5 -1
package/lib/asset.js
CHANGED
package/lib/auth.js
CHANGED
|
@@ -65,6 +65,10 @@ function _asyncToGenerator(n) { return function () { var t = this, e = arguments
|
|
|
65
65
|
* authorization entry that you can pass along to
|
|
66
66
|
* {@link Operation.invokeHostFunction}
|
|
67
67
|
*
|
|
68
|
+
* @note If using the `SigningCallback` variation, the signer is assumed to be
|
|
69
|
+
* the entry's credential address. If you need a different key to sign the
|
|
70
|
+
* entry, you will need to use different method (e.g., fork this code).
|
|
71
|
+
*
|
|
68
72
|
* @see authorizeInvocation
|
|
69
73
|
* @example
|
|
70
74
|
* import {
|
|
@@ -147,7 +151,7 @@ function authorizeEntry(_x, _x2, _x3) {
|
|
|
147
151
|
* @see authorizeEntry
|
|
148
152
|
*/
|
|
149
153
|
function _authorizeEntry() {
|
|
150
|
-
_authorizeEntry = _asyncToGenerator(
|
|
154
|
+
_authorizeEntry = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(entry, signer, validUntilLedgerSeq) {
|
|
151
155
|
var networkPassphrase,
|
|
152
156
|
clone,
|
|
153
157
|
addrAuth,
|
|
@@ -181,7 +185,7 @@ function _authorizeEntry() {
|
|
|
181
185
|
}));
|
|
182
186
|
payload = (0, _hashing.hash)(preimage.toXDR());
|
|
183
187
|
if (!(typeof signer === 'function')) {
|
|
184
|
-
_context.next =
|
|
188
|
+
_context.next = 18;
|
|
185
189
|
break;
|
|
186
190
|
}
|
|
187
191
|
_context.t0 = Buffer;
|
|
@@ -190,18 +194,19 @@ function _authorizeEntry() {
|
|
|
190
194
|
case 13:
|
|
191
195
|
_context.t1 = _context.sent;
|
|
192
196
|
signature = _context.t0.from.call(_context.t0, _context.t1);
|
|
193
|
-
|
|
197
|
+
publicKey = _address.Address.fromScAddress(addrAuth.address()).toString();
|
|
198
|
+
_context.next = 20;
|
|
194
199
|
break;
|
|
195
|
-
case 17:
|
|
196
|
-
signature = Buffer.from(signer.sign(payload));
|
|
197
200
|
case 18:
|
|
198
|
-
|
|
201
|
+
signature = Buffer.from(signer.sign(payload));
|
|
202
|
+
publicKey = signer.publicKey();
|
|
203
|
+
case 20:
|
|
199
204
|
if (_keypair.Keypair.fromPublicKey(publicKey).verify(payload, signature)) {
|
|
200
|
-
_context.next =
|
|
205
|
+
_context.next = 22;
|
|
201
206
|
break;
|
|
202
207
|
}
|
|
203
208
|
throw new Error("signature doesn't match payload");
|
|
204
|
-
case
|
|
209
|
+
case 22:
|
|
205
210
|
// This structure is defined here:
|
|
206
211
|
// https://soroban.stellar.org/docs/fundamentals-and-concepts/invoking-contracts-with-transactions#stellar-account-signatures
|
|
207
212
|
//
|
|
@@ -218,7 +223,7 @@ function _authorizeEntry() {
|
|
|
218
223
|
});
|
|
219
224
|
addrAuth.signature(_xdr["default"].ScVal.scvVec([sigScVal]));
|
|
220
225
|
return _context.abrupt("return", clone);
|
|
221
|
-
case
|
|
226
|
+
case 25:
|
|
222
227
|
case "end":
|
|
223
228
|
return _context.stop();
|
|
224
229
|
}
|
package/lib/invocation.js
CHANGED
|
@@ -168,7 +168,8 @@ function buildInvocationTree(root) {
|
|
|
168
168
|
* @param {xdr.SorobanAuthorizedInvocation} [parent] this `node`s parent node,
|
|
169
169
|
* if any (i.e. this doesn't exist at the root)
|
|
170
170
|
*
|
|
171
|
-
* @returns {boolean
|
|
171
|
+
* @returns {boolean|null|void} returning exactly `false` is a hint to stop
|
|
172
|
+
* exploring, other values are ignored
|
|
172
173
|
*/
|
|
173
174
|
|
|
174
175
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stellar/stellar-base",
|
|
3
|
-
"version": "12.1.
|
|
3
|
+
"version": "12.1.1",
|
|
4
4
|
"description": "Low-level support library for the Stellar network.",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"browser": {
|
|
@@ -70,11 +70,11 @@
|
|
|
70
70
|
},
|
|
71
71
|
"homepage": "https://github.com/stellar/js-stellar-base",
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@babel/cli": "^7.
|
|
74
|
-
"@babel/core": "^7.
|
|
75
|
-
"@babel/eslint-parser": "^7.
|
|
76
|
-
"@babel/eslint-plugin": "^7.
|
|
77
|
-
"@babel/preset-env": "^7.
|
|
73
|
+
"@babel/cli": "^7.25.6",
|
|
74
|
+
"@babel/core": "^7.25.2",
|
|
75
|
+
"@babel/eslint-parser": "^7.25.1",
|
|
76
|
+
"@babel/eslint-plugin": "^7.25.1",
|
|
77
|
+
"@babel/preset-env": "^7.25.4",
|
|
78
78
|
"@babel/register": "^7.24.6",
|
|
79
79
|
"@definitelytyped/dtslint": "^0.0.182",
|
|
80
80
|
"@istanbuljs/nyc-config-babel": "3.0.0",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"eslint": "^8.57.0",
|
|
89
89
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
90
90
|
"eslint-config-prettier": "^9.1.0",
|
|
91
|
-
"eslint-plugin-import": "^2.
|
|
91
|
+
"eslint-plugin-import": "^2.30.0",
|
|
92
92
|
"eslint-plugin-node": "^11.1.0",
|
|
93
93
|
"eslint-plugin-prefer-import": "^0.0.1",
|
|
94
94
|
"eslint-plugin-prettier": "^5.2.1",
|
|
@@ -96,16 +96,16 @@
|
|
|
96
96
|
"ghooks": "^2.0.4",
|
|
97
97
|
"husky": "^8.0.3",
|
|
98
98
|
"jsdoc": "^4.0.3",
|
|
99
|
-
"karma": "^6.4.
|
|
99
|
+
"karma": "^6.4.4",
|
|
100
100
|
"karma-chrome-launcher": "^3.1.0",
|
|
101
101
|
"karma-coverage": "^2.2.1",
|
|
102
102
|
"karma-firefox-launcher": "^2.1.3",
|
|
103
103
|
"karma-mocha": "^2.0.0",
|
|
104
104
|
"karma-sinon-chai": "^2.0.2",
|
|
105
105
|
"karma-webpack": "^5.0.1",
|
|
106
|
-
"lint-staged": "^15.2.
|
|
106
|
+
"lint-staged": "^15.2.10",
|
|
107
107
|
"minami": "^1.1.1",
|
|
108
|
-
"mocha": "^10.
|
|
108
|
+
"mocha": "^10.7.3",
|
|
109
109
|
"node-polyfill-webpack-plugin": "^3.0.0",
|
|
110
110
|
"nyc": "^15.1.0",
|
|
111
111
|
"prettier": "^3.3.3",
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
"taffydb": "^2.7.3",
|
|
116
116
|
"terser-webpack-plugin": "^5.3.10",
|
|
117
117
|
"ts-node": "^10.9.2",
|
|
118
|
-
"typescript": "^5.
|
|
118
|
+
"typescript": "^5.6.2",
|
|
119
119
|
"webpack": "^5.93.0",
|
|
120
120
|
"webpack-cli": "^5.1.1"
|
|
121
121
|
},
|
package/types/index.d.ts
CHANGED
|
@@ -1019,6 +1019,7 @@ export class FeeBumpTransaction extends TransactionI {
|
|
|
1019
1019
|
);
|
|
1020
1020
|
feeSource: string;
|
|
1021
1021
|
innerTransaction: Transaction;
|
|
1022
|
+
get operations(): Operation[];
|
|
1022
1023
|
}
|
|
1023
1024
|
|
|
1024
1025
|
export class Transaction<
|
|
@@ -1058,7 +1059,9 @@ export class TransactionBuilder {
|
|
|
1058
1059
|
options?: TransactionBuilder.TransactionBuilderOptions
|
|
1059
1060
|
);
|
|
1060
1061
|
addOperation(operation: xdr.Operation): this;
|
|
1062
|
+
addOperationAt(op: xdr.Operation, i: number): this;
|
|
1061
1063
|
clearOperations(): this;
|
|
1064
|
+
clearOperationAt(i: number): this;
|
|
1062
1065
|
addMemo(memo: Memo): this;
|
|
1063
1066
|
setTimeout(timeoutInSeconds: number): this;
|
|
1064
1067
|
setTimebounds(min: Date | number, max: Date | number): this;
|
|
@@ -1085,6 +1088,7 @@ export class TransactionBuilder {
|
|
|
1085
1088
|
envelope: string | xdr.TransactionEnvelope,
|
|
1086
1089
|
networkPassphrase: string
|
|
1087
1090
|
): Transaction | FeeBumpTransaction;
|
|
1091
|
+
|
|
1088
1092
|
}
|
|
1089
1093
|
|
|
1090
1094
|
export namespace TransactionBuilder {
|
|
@@ -1258,7 +1262,7 @@ export type InvocationWalker = (
|
|
|
1258
1262
|
node: xdr.SorobanAuthorizedInvocation,
|
|
1259
1263
|
depth: number,
|
|
1260
1264
|
parent?: any
|
|
1261
|
-
) => boolean|null;
|
|
1265
|
+
) => boolean|null|void;
|
|
1262
1266
|
|
|
1263
1267
|
export function walkInvocationTree(
|
|
1264
1268
|
root: xdr.SorobanAuthorizedInvocation,
|