@stellar/stellar-base 12.1.0 → 13.0.0-beta.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/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?} returning `false` is a hint to stop exploring
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/lib/operation.js CHANGED
@@ -100,7 +100,12 @@ var AuthClawbackEnabledFlag = exports.AuthClawbackEnabledFlag = 1 << 3;
100
100
  * * `{@link Operation.setTrustLineFlags}`
101
101
  * * `{@link Operation.liquidityPoolDeposit}`
102
102
  * * `{@link Operation.liquidityPoolWithdraw}`
103
- * * `{@link Operation.invokeHostFunction}`
103
+ * * `{@link Operation.invokeHostFunction}`, which has the following additional
104
+ * "pseudo-operations" that make building host functions easier:
105
+ * - `{@link Operation.createStellarAssetContract}`
106
+ * - `{@link Operation.invokeContractFunction}`
107
+ * - `{@link Operation.createCustomContract}`
108
+ * - `{@link Operation.uploadContractWasm}`
104
109
  * * `{@link Operation.extendFootprintTtlOp}`
105
110
  * * `{@link Operation.restoreFootprint}`
106
111
  *
@@ -97,7 +97,8 @@ function invokeContractFunction(opts) {
97
97
  }
98
98
 
99
99
  /**
100
- * Returns an operation that creates a custom WASM contract.
100
+ * Returns an operation that creates a custom WASM contract and atomically
101
+ * invokes its constructor.
101
102
  *
102
103
  * @function
103
104
  * @alias Operation.createCustomContract
@@ -107,6 +108,9 @@ function invokeContractFunction(opts) {
107
108
  * @param {Uint8Array|Buffer} opts.wasmHash - the SHA-256 hash of the contract
108
109
  * WASM you're uploading (see {@link hash} and
109
110
  * {@link Operation.uploadContractWasm})
111
+ * @param {xdr.ScVal[]} [opts.constructorArgs] - the optional parameters to pass
112
+ * to the constructor of this contract (see {@link nativeToScVal} for ways to
113
+ * easily create these parameters from native JS values)
110
114
  * @param {Uint8Array|Buffer} [opts.salt] - an optional, 32-byte salt to
111
115
  * distinguish deployment instances of the same wasm from the same user (if
112
116
  * omitted, one will be generated for you)
@@ -121,6 +125,7 @@ function invokeContractFunction(opts) {
121
125
  * https://soroban.stellar.org/docs/fundamentals-and-concepts/invoking-contracts-with-transactions#function
122
126
  */
123
127
  function createCustomContract(opts) {
128
+ var _opts$constructorArgs;
124
129
  var salt = Buffer.from(opts.salt || getSalty());
125
130
  if (!opts.wasmHash || opts.wasmHash.length !== 32) {
126
131
  throw new TypeError("expected hash(contract WASM) in 'opts.wasmHash', got ".concat(opts.wasmHash));
@@ -131,12 +136,13 @@ function createCustomContract(opts) {
131
136
  return this.invokeHostFunction({
132
137
  source: opts.source,
133
138
  auth: opts.auth,
134
- func: _xdr["default"].HostFunction.hostFunctionTypeCreateContract(new _xdr["default"].CreateContractArgs({
139
+ func: _xdr["default"].HostFunction.hostFunctionTypeCreateContractV2(new _xdr["default"].CreateContractArgsV2({
135
140
  executable: _xdr["default"].ContractExecutable.contractExecutableWasm(Buffer.from(opts.wasmHash)),
136
141
  contractIdPreimage: _xdr["default"].ContractIdPreimage.contractIdPreimageFromAddress(new _xdr["default"].ContractIdPreimageFromAddress({
137
142
  address: opts.address.toScAddress(),
138
143
  salt: salt
139
- }))
144
+ })),
145
+ constructorArgs: (_opts$constructorArgs = opts.constructorArgs) !== null && _opts$constructorArgs !== void 0 ? _opts$constructorArgs : []
140
146
  }))
141
147
  });
142
148
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stellar/stellar-base",
3
- "version": "12.1.0",
3
+ "version": "13.0.0-beta.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.24.8",
74
- "@babel/core": "^7.24.9",
75
- "@babel/eslint-parser": "^7.24.8",
76
- "@babel/eslint-plugin": "^7.24.7",
77
- "@babel/preset-env": "^7.24.8",
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.29.1",
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.3",
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.7",
106
+ "lint-staged": "^15.2.10",
107
107
  "minami": "^1.1.1",
108
- "mocha": "^10.6.0",
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.5.3",
118
+ "typescript": "^5.6.2",
119
119
  "webpack": "^5.93.0",
120
120
  "webpack-cli": "^5.1.1"
121
121
  },