@stellar/stellar-base 12.1.1 → 13.0.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.
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.1",
3
+ "version": "13.0.0",
4
4
  "description": "Low-level support library for the Stellar network.",
5
5
  "main": "./lib/index.js",
6
6
  "browser": {
@@ -70,17 +70,17 @@
70
70
  },
71
71
  "homepage": "https://github.com/stellar/js-stellar-base",
72
72
  "devDependencies": {
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
- "@babel/register": "^7.24.6",
73
+ "@babel/cli": "^7.25.9",
74
+ "@babel/core": "^7.26.0",
75
+ "@babel/eslint-parser": "^7.25.9",
76
+ "@babel/eslint-plugin": "^7.25.9",
77
+ "@babel/preset-env": "^7.26.0",
78
+ "@babel/register": "^7.25.9",
79
79
  "@definitelytyped/dtslint": "^0.0.182",
80
80
  "@istanbuljs/nyc-config-babel": "3.0.0",
81
81
  "@types/node": "^20.14.11",
82
82
  "@typescript-eslint/parser": "^6.20.0",
83
- "babel-loader": "^9.1.3",
83
+ "babel-loader": "^9.2.1",
84
84
  "babel-plugin-istanbul": "^6.1.1",
85
85
  "chai": "^4.3.10",
86
86
  "chai-as-promised": "^7.1.2",
@@ -88,14 +88,14 @@
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.30.0",
91
+ "eslint-plugin-import": "^2.31.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",
95
95
  "eslint-webpack-plugin": "^4.2.0",
96
96
  "ghooks": "^2.0.4",
97
97
  "husky": "^8.0.3",
98
- "jsdoc": "^4.0.3",
98
+ "jsdoc": "^4.0.4",
99
99
  "karma": "^6.4.4",
100
100
  "karma-chrome-launcher": "^3.1.0",
101
101
  "karma-coverage": "^2.2.1",
@@ -105,7 +105,7 @@
105
105
  "karma-webpack": "^5.0.1",
106
106
  "lint-staged": "^15.2.10",
107
107
  "minami": "^1.1.1",
108
- "mocha": "^10.7.3",
108
+ "mocha": "^10.8.2",
109
109
  "node-polyfill-webpack-plugin": "^3.0.0",
110
110
  "nyc": "^15.1.0",
111
111
  "prettier": "^3.3.3",
@@ -115,8 +115,8 @@
115
115
  "taffydb": "^2.7.3",
116
116
  "terser-webpack-plugin": "^5.3.10",
117
117
  "ts-node": "^10.9.2",
118
- "typescript": "^5.6.2",
119
- "webpack": "^5.93.0",
118
+ "typescript": "^5.6.3",
119
+ "webpack": "^5.96.1",
120
120
  "webpack-cli": "^5.1.1"
121
121
  },
122
122
  "dependencies": {
@@ -128,6 +128,6 @@
128
128
  "tweetnacl": "^1.0.3"
129
129
  },
130
130
  "optionalDependencies": {
131
- "sodium-native": "^4.1.1"
131
+ "sodium-native": "^4.3.0"
132
132
  }
133
133
  }