@stellar/stellar-sdk 16.0.0-rc.1 → 16.0.0-rc.2
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/README.md +22 -28
- package/dist/stellar-sdk-axios.js +247 -232
- package/dist/stellar-sdk-axios.js.map +1 -1
- package/dist/stellar-sdk-axios.min.js +1 -1
- package/dist/stellar-sdk-axios.min.js.map +1 -1
- package/dist/stellar-sdk.js +50 -35
- package/dist/stellar-sdk.js.map +1 -1
- package/dist/stellar-sdk.min.js +1 -1
- package/dist/stellar-sdk.min.js.map +1 -1
- package/lib/axios/cjs/base/auth.js +11 -11
- package/lib/axios/cjs/base/auth.js.map +1 -1
- package/lib/axios/cjs/base/keypair.js +1 -1
- package/lib/axios/cjs/base/keypair.js.map +1 -1
- package/lib/axios/cjs/bindings/config.js +1 -1
- package/lib/axios/cjs/contract/assembled_transaction.js +6 -1
- package/lib/axios/cjs/contract/assembled_transaction.js.map +1 -1
- package/lib/axios/cjs/contract/types.js.map +1 -1
- package/lib/axios/cjs/horizon/horizon_axios_client.js +1 -1
- package/lib/axios/cjs/rpc/axios.js +1 -1
- package/lib/axios/cjs/rpc/server.js +13 -4
- package/lib/axios/cjs/rpc/server.js.map +1 -1
- package/lib/axios/esm/base/auth.d.ts +19 -7
- package/lib/axios/esm/base/auth.js +11 -11
- package/lib/axios/esm/base/auth.js.map +1 -1
- package/lib/axios/esm/base/keypair.js +1 -1
- package/lib/axios/esm/base/keypair.js.map +1 -1
- package/lib/axios/esm/bindings/config.js +1 -1
- package/lib/axios/esm/contract/assembled_transaction.js +6 -1
- package/lib/axios/esm/contract/assembled_transaction.js.map +1 -1
- package/lib/axios/esm/contract/types.d.ts +9 -0
- package/lib/axios/esm/contract/types.js.map +1 -1
- package/lib/axios/esm/horizon/horizon_axios_client.js +1 -1
- package/lib/axios/esm/rpc/axios.js +1 -1
- package/lib/axios/esm/rpc/server.d.ts +7 -2
- package/lib/axios/esm/rpc/server.js +13 -4
- package/lib/axios/esm/rpc/server.js.map +1 -1
- package/lib/cjs/base/auth.js +11 -11
- package/lib/cjs/base/auth.js.map +1 -1
- package/lib/cjs/base/keypair.js +1 -1
- package/lib/cjs/base/keypair.js.map +1 -1
- package/lib/cjs/bindings/config.js +1 -1
- package/lib/cjs/contract/assembled_transaction.js +6 -1
- package/lib/cjs/contract/assembled_transaction.js.map +1 -1
- package/lib/cjs/contract/types.js.map +1 -1
- package/lib/cjs/horizon/horizon_axios_client.js +1 -1
- package/lib/cjs/rpc/axios.js +1 -1
- package/lib/cjs/rpc/server.js +13 -4
- package/lib/cjs/rpc/server.js.map +1 -1
- package/lib/esm/base/auth.d.ts +19 -7
- package/lib/esm/base/auth.js +11 -11
- package/lib/esm/base/auth.js.map +1 -1
- package/lib/esm/base/keypair.js +1 -1
- package/lib/esm/base/keypair.js.map +1 -1
- package/lib/esm/bindings/config.js +1 -1
- package/lib/esm/contract/assembled_transaction.js +6 -1
- package/lib/esm/contract/assembled_transaction.js.map +1 -1
- package/lib/esm/contract/types.d.ts +9 -0
- package/lib/esm/contract/types.js.map +1 -1
- package/lib/esm/horizon/horizon_axios_client.js +1 -1
- package/lib/esm/rpc/axios.js +1 -1
- package/lib/esm/rpc/server.d.ts +7 -2
- package/lib/esm/rpc/server.js +13 -4
- package/lib/esm/rpc/server.js.map +1 -1
- package/package.json +1 -1
package/dist/stellar-sdk.js
CHANGED
|
@@ -9279,6 +9279,9 @@
|
|
|
9279
9279
|
// Reduce any little-endian byte string modulo the subgroup order; the `hash` name reflects the
|
|
9280
9280
|
// common caller shape, not an input restriction.
|
|
9281
9281
|
const modL_LE = (hash) => modN(bytesToNumberLE(hash)); // modulo L; but little-endian
|
|
9282
|
+
// Both sync and async SHA-512 slots are exported/configurable; use `callHash(...)` for both so
|
|
9283
|
+
// missing async overrides fail explicitly, then validate the returned digest type/length.
|
|
9284
|
+
const sha512a = (...m) => Promise.resolve(callHash('sha512Async')(concatBytes(...m))).then(checkDigest);
|
|
9282
9285
|
const sha512s = (...m) => checkDigest(callHash('sha512')(concatBytes(...m)));
|
|
9283
9286
|
// RFC8032 5.1.5. Split the 64-byte hashed seed into the clamped scalar half and nonce prefix.
|
|
9284
9287
|
const hash2extK = (hashed) => {
|
|
@@ -9296,6 +9299,8 @@
|
|
|
9296
9299
|
const pointBytes = point.toBytes(); // point serialized to Uint8Array
|
|
9297
9300
|
return { head, prefix, scalar, point, pointBytes };
|
|
9298
9301
|
};
|
|
9302
|
+
// RFC8032 5.1.5; getPublicKey async, sync. Hash priv key and extract point.
|
|
9303
|
+
const getExtendedPublicKeyAsync = (secretKey) => sha512a(abytes(secretKey, L)).then(hash2extK);
|
|
9299
9304
|
const getExtendedPublicKey = (secretKey) => hash2extK(sha512s(abytes(secretKey, L)));
|
|
9300
9305
|
/**
|
|
9301
9306
|
* Creates a 32-byte Ed25519 public key from the RFC 8032 32-byte secret-key seed.
|
|
@@ -9467,28 +9472,24 @@
|
|
|
9467
9472
|
return abytes(seed, L);
|
|
9468
9473
|
};
|
|
9469
9474
|
/**
|
|
9470
|
-
*
|
|
9471
|
-
*
|
|
9472
|
-
*
|
|
9473
|
-
* @throws If synchronous SHA-512 has not been configured in `hashes`. {@link Error}
|
|
9474
|
-
* @throws On wrong argument types. {@link TypeError}
|
|
9475
|
-
* @throws On wrong argument ranges or values. {@link RangeError}
|
|
9475
|
+
* Ed25519-specific key utilities.
|
|
9476
|
+
* `utils.getExtendedPublicKey*` expose secret-derived internals (`head`, `prefix`, `scalar`, and
|
|
9477
|
+
* point objects), not just public-key bytes.
|
|
9476
9478
|
* @example
|
|
9477
|
-
* Generate a new
|
|
9479
|
+
* Generate a new Ed25519 secret key and derive the matching public key.
|
|
9478
9480
|
*
|
|
9479
9481
|
* ```ts
|
|
9480
9482
|
* import * as ed from '@noble/ed25519';
|
|
9481
|
-
* import { sha512 } from '@noble/hashes/sha2.js';
|
|
9482
9483
|
*
|
|
9483
|
-
* ed.
|
|
9484
|
-
* const
|
|
9484
|
+
* const secretKey = ed.utils.randomSecretKey();
|
|
9485
|
+
* const publicKey = await ed.getPublicKeyAsync(secretKey);
|
|
9485
9486
|
* ```
|
|
9486
9487
|
*/
|
|
9487
|
-
const
|
|
9488
|
-
|
|
9489
|
-
|
|
9490
|
-
|
|
9491
|
-
};
|
|
9488
|
+
const utils = /* @__PURE__ */ Object.freeze({
|
|
9489
|
+
getExtendedPublicKeyAsync: getExtendedPublicKeyAsync,
|
|
9490
|
+
getExtendedPublicKey: getExtendedPublicKey,
|
|
9491
|
+
randomSecretKey: randomSecretKey,
|
|
9492
|
+
});
|
|
9492
9493
|
// ## Precomputes
|
|
9493
9494
|
// --------------
|
|
9494
9495
|
const W = 8; // W is window size
|
|
@@ -10666,7 +10667,7 @@
|
|
|
10666
10667
|
* Create a random `Keypair` object.
|
|
10667
10668
|
*/
|
|
10668
10669
|
static random() {
|
|
10669
|
-
const
|
|
10670
|
+
const secretKey = utils.randomSecretKey();
|
|
10670
10671
|
return this.fromRawEd25519Seed(bufferExports.Buffer.from(secretKey));
|
|
10671
10672
|
}
|
|
10672
10673
|
/** Returns this public key as an xdr.AccountId. */
|
|
@@ -19282,7 +19283,8 @@
|
|
|
19282
19283
|
validUntilLedgerSeq,
|
|
19283
19284
|
invocation,
|
|
19284
19285
|
networkPassphrase,
|
|
19285
|
-
publicKey = ""
|
|
19286
|
+
publicKey = "",
|
|
19287
|
+
authV2 = false
|
|
19286
19288
|
} = params;
|
|
19287
19289
|
const kp = Keypair.random().rawPublicKey();
|
|
19288
19290
|
const nonce = new types.Int64(bytesToInt64(kp));
|
|
@@ -19290,18 +19292,17 @@
|
|
|
19290
19292
|
if (!pk) {
|
|
19291
19293
|
throw new Error(`authorizeInvocation requires publicKey parameter`);
|
|
19292
19294
|
}
|
|
19295
|
+
const addressCredentials = new types.SorobanAddressCredentials({
|
|
19296
|
+
address: new Address(pk).toScAddress(),
|
|
19297
|
+
nonce,
|
|
19298
|
+
signatureExpirationLedger: 0,
|
|
19299
|
+
// replaced
|
|
19300
|
+
signature: types.ScVal.scvVec([])
|
|
19301
|
+
// replaced
|
|
19302
|
+
});
|
|
19293
19303
|
const entry = new types.SorobanAuthorizationEntry({
|
|
19294
19304
|
rootInvocation: invocation,
|
|
19295
|
-
credentials: types.SorobanCredentials.sorobanCredentialsAddressV2(
|
|
19296
|
-
new types.SorobanAddressCredentials({
|
|
19297
|
-
address: new Address(pk).toScAddress(),
|
|
19298
|
-
nonce,
|
|
19299
|
-
signatureExpirationLedger: 0,
|
|
19300
|
-
// replaced
|
|
19301
|
-
signature: types.ScVal.scvVec([])
|
|
19302
|
-
// replaced
|
|
19303
|
-
})
|
|
19304
|
-
)
|
|
19305
|
+
credentials: authV2 ? types.SorobanCredentials.sorobanCredentialsAddressV2(addressCredentials) : types.SorobanCredentials.sorobanCredentialsAddress(addressCredentials)
|
|
19305
19306
|
});
|
|
19306
19307
|
return authorizeEntry(entry, signer, validUntilLedgerSeq, networkPassphrase);
|
|
19307
19308
|
}
|
|
@@ -20876,7 +20877,7 @@ ${value}`, dataLines++;
|
|
|
20876
20877
|
return doc && typeof doc == "object" && "baseURI" in doc && typeof doc.baseURI == "string" ? doc.baseURI : void 0;
|
|
20877
20878
|
}
|
|
20878
20879
|
|
|
20879
|
-
const version$1 = "16.0.0-rc.
|
|
20880
|
+
const version$1 = "16.0.0-rc.2";
|
|
20880
20881
|
const SERVER_TIME_MAP = {};
|
|
20881
20882
|
function toSeconds(ms) {
|
|
20882
20883
|
return Math.floor(ms / 1e3);
|
|
@@ -22803,7 +22804,7 @@ ${value}`, dataLines++;
|
|
|
22803
22804
|
Api2.isSimulationRaw = isSimulationRaw;
|
|
22804
22805
|
})(Api || (Api = {}));
|
|
22805
22806
|
|
|
22806
|
-
const version = "16.0.0-rc.
|
|
22807
|
+
const version = "16.0.0-rc.2";
|
|
22807
22808
|
function createHttpClient(headers) {
|
|
22808
22809
|
return createFetchClient({
|
|
22809
22810
|
headers: {
|
|
@@ -23882,6 +23883,11 @@ ${value}`, dataLines++;
|
|
|
23882
23883
|
* auth mode to use for simulation: `enforce` for enforcement mode,
|
|
23883
23884
|
* `record` for recording mode, or `record_allow_nonroot` for recording
|
|
23884
23885
|
* mode that allows non-root authorization
|
|
23886
|
+
* @param authV2 - (optional) request `SOROBAN_CREDENTIALS_ADDRESS_V2`
|
|
23887
|
+
* (CAP-71) auth credentials from simulation instead of the legacy
|
|
23888
|
+
* `SOROBAN_CREDENTIALS_ADDRESS`. Defaults to `false`; only enable it for
|
|
23889
|
+
* networks that have activated CAP-71, as V2 credentials are otherwise
|
|
23890
|
+
* rejected.
|
|
23885
23891
|
*
|
|
23886
23892
|
* @returns An object with the
|
|
23887
23893
|
* cost, footprint, result/auth requirements (if applicable), and error of
|
|
@@ -23921,12 +23927,12 @@ ${value}`, dataLines++;
|
|
|
23921
23927
|
* });
|
|
23922
23928
|
* ```
|
|
23923
23929
|
*/
|
|
23924
|
-
async simulateTransaction(tx, addlResources, authMode) {
|
|
23925
|
-
return this._simulateTransaction(tx, addlResources, authMode).then(
|
|
23930
|
+
async simulateTransaction(tx, addlResources, authMode, authV2 = false) {
|
|
23931
|
+
return this._simulateTransaction(tx, addlResources, authMode, authV2).then(
|
|
23926
23932
|
parseRawSimulation
|
|
23927
23933
|
);
|
|
23928
23934
|
}
|
|
23929
|
-
async _simulateTransaction(transaction, addlResources, authMode) {
|
|
23935
|
+
async _simulateTransaction(transaction, addlResources, authMode, authV2 = false) {
|
|
23930
23936
|
return postObject(
|
|
23931
23937
|
this.httpClient,
|
|
23932
23938
|
this.serverURL.toString(),
|
|
@@ -23938,7 +23944,11 @@ ${value}`, dataLines++;
|
|
|
23938
23944
|
resourceConfig: {
|
|
23939
23945
|
instructionLeeway: addlResources.cpuInstructions
|
|
23940
23946
|
}
|
|
23941
|
-
}
|
|
23947
|
+
},
|
|
23948
|
+
// CAP-71: only request ADDRESS_V2 auth credentials when explicitly
|
|
23949
|
+
// opted in. They are rejected by networks that have not activated
|
|
23950
|
+
// CAP-71, so default to omitting the flag (legacy ADDRESS credentials).
|
|
23951
|
+
...authV2 && { authV2: true }
|
|
23942
23952
|
}
|
|
23943
23953
|
);
|
|
23944
23954
|
}
|
|
@@ -25002,7 +25012,12 @@ All attempts to get the result: ${JSON.stringify(
|
|
|
25002
25012
|
restore = restore ?? this.options.restore;
|
|
25003
25013
|
delete this.simulationResult;
|
|
25004
25014
|
delete this.simulationTransactionData;
|
|
25005
|
-
this.simulation = await this.server.simulateTransaction(
|
|
25015
|
+
this.simulation = await this.server.simulateTransaction(
|
|
25016
|
+
this.built,
|
|
25017
|
+
void 0,
|
|
25018
|
+
void 0,
|
|
25019
|
+
this.options.authV2
|
|
25020
|
+
);
|
|
25006
25021
|
if (restore && Api.isSimulationRestore(this.simulation)) {
|
|
25007
25022
|
const account = await getAccount(this.options, this.server);
|
|
25008
25023
|
const result = await this.restoreFootprint(
|
|
@@ -26953,7 +26968,7 @@ ${indent} */
|
|
|
26953
26968
|
build: "tsc"
|
|
26954
26969
|
},
|
|
26955
26970
|
dependencies: {
|
|
26956
|
-
"@stellar/stellar-sdk": `^${"16.0.0-rc.
|
|
26971
|
+
"@stellar/stellar-sdk": `^${"16.0.0-rc.2"}`,
|
|
26957
26972
|
buffer: "6.0.3"
|
|
26958
26973
|
},
|
|
26959
26974
|
devDependencies: {
|