@stellar/stellar-sdk 16.0.0-rc.1 → 16.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/README.md +22 -28
- package/dist/stellar-sdk-axios.js +245 -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 +49 -36
- package/dist/stellar-sdk.js.map +1 -1
- package/dist/stellar-sdk.min.js +2 -2
- 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/base/transaction_builder.js +13 -1
- package/lib/axios/cjs/base/transaction_builder.js.map +1 -1
- package/lib/axios/cjs/bindings/config.js +1 -1
- package/lib/axios/cjs/bindings/config.js.map +1 -1
- package/lib/axios/cjs/bindings/wasm_fetcher.js +1 -1
- package/lib/axios/cjs/bindings/wasm_fetcher.js.map +1 -1
- package/lib/axios/cjs/contract/client.js.map +1 -1
- package/lib/axios/cjs/contract/spec.js.map +1 -1
- package/lib/axios/cjs/contract/types.js.map +1 -1
- package/lib/axios/cjs/contract/utils.js.map +1 -1
- package/lib/axios/cjs/contract/wasm_spec_parser.js +1 -1
- package/lib/axios/cjs/contract/wasm_spec_parser.js.map +1 -1
- package/lib/axios/cjs/horizon/call_builder.js.map +1 -1
- package/lib/axios/cjs/horizon/horizon_api.js.map +1 -1
- package/lib/axios/cjs/horizon/horizon_axios_client.js +1 -1
- package/lib/axios/cjs/horizon/horizon_axios_client.js.map +1 -1
- package/lib/axios/cjs/http-client/fetch-client.js +1 -1
- package/lib/axios/cjs/http-client/fetch-client.js.map +1 -1
- package/lib/axios/cjs/http-client/types.js.map +1 -1
- package/lib/axios/cjs/rpc/axios.js +1 -1
- package/lib/axios/cjs/rpc/axios.js.map +1 -1
- package/lib/axios/cjs/rpc/jsonrpc.js.map +1 -1
- package/lib/axios/cjs/rpc/server.js +2 -2
- package/lib/axios/cjs/rpc/server.js.map +1 -1
- package/lib/axios/cjs/webauth/challenge_transaction.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/base/transaction_builder.js +13 -1
- package/lib/axios/esm/base/transaction_builder.js.map +1 -1
- package/lib/axios/esm/bindings/config.js +1 -1
- package/lib/axios/esm/bindings/config.js.map +1 -1
- package/lib/axios/esm/bindings/wasm_fetcher.js +1 -1
- package/lib/axios/esm/bindings/wasm_fetcher.js.map +1 -1
- package/lib/axios/esm/contract/client.js.map +1 -1
- package/lib/axios/esm/contract/spec.js.map +1 -1
- package/lib/axios/esm/contract/types.js.map +1 -1
- package/lib/axios/esm/contract/utils.js.map +1 -1
- package/lib/axios/esm/contract/wasm_spec_parser.js +1 -1
- package/lib/axios/esm/contract/wasm_spec_parser.js.map +1 -1
- package/lib/axios/esm/horizon/call_builder.js.map +1 -1
- package/lib/axios/esm/horizon/horizon_api.js.map +1 -1
- package/lib/axios/esm/horizon/horizon_axios_client.js +1 -1
- package/lib/axios/esm/horizon/horizon_axios_client.js.map +1 -1
- package/lib/axios/esm/http-client/fetch-client.js +1 -1
- package/lib/axios/esm/http-client/fetch-client.js.map +1 -1
- package/lib/axios/esm/http-client/types.js.map +1 -1
- package/lib/axios/esm/rpc/axios.js +1 -1
- package/lib/axios/esm/rpc/axios.js.map +1 -1
- package/lib/axios/esm/rpc/jsonrpc.js.map +1 -1
- package/lib/axios/esm/rpc/server.js +2 -2
- package/lib/axios/esm/rpc/server.js.map +1 -1
- package/lib/axios/esm/webauth/challenge_transaction.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/base/transaction_builder.js +13 -1
- package/lib/cjs/base/transaction_builder.js.map +1 -1
- package/lib/cjs/bindings/config.js +1 -1
- package/lib/cjs/bindings/config.js.map +1 -1
- package/lib/cjs/bindings/wasm_fetcher.js +1 -1
- package/lib/cjs/bindings/wasm_fetcher.js.map +1 -1
- package/lib/cjs/contract/client.js.map +1 -1
- package/lib/cjs/contract/spec.js.map +1 -1
- package/lib/cjs/contract/types.js.map +1 -1
- package/lib/cjs/contract/utils.js.map +1 -1
- package/lib/cjs/contract/wasm_spec_parser.js +1 -1
- package/lib/cjs/contract/wasm_spec_parser.js.map +1 -1
- package/lib/cjs/horizon/call_builder.js.map +1 -1
- package/lib/cjs/horizon/horizon_api.js.map +1 -1
- package/lib/cjs/horizon/horizon_axios_client.js +1 -1
- package/lib/cjs/horizon/horizon_axios_client.js.map +1 -1
- package/lib/cjs/http-client/fetch-client.js +1 -1
- package/lib/cjs/http-client/fetch-client.js.map +1 -1
- package/lib/cjs/http-client/types.js.map +1 -1
- package/lib/cjs/rpc/axios.js +1 -1
- package/lib/cjs/rpc/axios.js.map +1 -1
- package/lib/cjs/rpc/jsonrpc.js.map +1 -1
- package/lib/cjs/rpc/server.js +2 -2
- package/lib/cjs/rpc/server.js.map +1 -1
- package/lib/cjs/webauth/challenge_transaction.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/base/transaction_builder.js +13 -1
- package/lib/esm/base/transaction_builder.js.map +1 -1
- package/lib/esm/bindings/config.js +1 -1
- package/lib/esm/bindings/config.js.map +1 -1
- package/lib/esm/bindings/wasm_fetcher.js +1 -1
- package/lib/esm/bindings/wasm_fetcher.js.map +1 -1
- package/lib/esm/contract/client.js.map +1 -1
- package/lib/esm/contract/spec.js.map +1 -1
- package/lib/esm/contract/types.js.map +1 -1
- package/lib/esm/contract/utils.js.map +1 -1
- package/lib/esm/contract/wasm_spec_parser.js +1 -1
- package/lib/esm/contract/wasm_spec_parser.js.map +1 -1
- package/lib/esm/horizon/call_builder.js.map +1 -1
- package/lib/esm/horizon/horizon_api.js.map +1 -1
- package/lib/esm/horizon/horizon_axios_client.js +1 -1
- package/lib/esm/horizon/horizon_axios_client.js.map +1 -1
- package/lib/esm/http-client/fetch-client.js +1 -1
- package/lib/esm/http-client/fetch-client.js.map +1 -1
- package/lib/esm/http-client/types.js.map +1 -1
- package/lib/esm/rpc/axios.js +1 -1
- package/lib/esm/rpc/axios.js.map +1 -1
- package/lib/esm/rpc/jsonrpc.js.map +1 -1
- package/lib/esm/rpc/server.js +2 -2
- package/lib/esm/rpc/server.js.map +1 -1
- package/lib/esm/webauth/challenge_transaction.js.map +1 -1
- package/package.json +2 -5
package/dist/stellar-sdk.js
CHANGED
|
@@ -687,7 +687,7 @@
|
|
|
687
687
|
reject(makeCanceledError(cancelToken.reason));
|
|
688
688
|
});
|
|
689
689
|
}
|
|
690
|
-
|
|
690
|
+
const modifiedConfig = config;
|
|
691
691
|
if (requestInterceptors.handlers.length > 0) {
|
|
692
692
|
const chain = requestInterceptors.handlers.filter(
|
|
693
693
|
(interceptor) => interceptor !== null
|
|
@@ -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. */
|
|
@@ -18360,7 +18361,19 @@
|
|
|
18360
18361
|
"cannot clone a transaction with no operations: per-operation base fee cannot be determined"
|
|
18361
18362
|
);
|
|
18362
18363
|
}
|
|
18363
|
-
|
|
18364
|
+
let sorobanData;
|
|
18365
|
+
const envelope = tx.toEnvelope();
|
|
18366
|
+
if (envelope.switch() === types.EnvelopeType.envelopeTypeTx()) {
|
|
18367
|
+
sorobanData = envelope.v1().tx().ext().value() ?? void 0;
|
|
18368
|
+
}
|
|
18369
|
+
let totalFee = parseInt(tx.fee, 10);
|
|
18370
|
+
if (sorobanData) {
|
|
18371
|
+
const resourceFee = Number(sorobanData.resourceFee().toBigInt());
|
|
18372
|
+
if (totalFee - resourceFee > 0) {
|
|
18373
|
+
totalFee -= resourceFee;
|
|
18374
|
+
}
|
|
18375
|
+
}
|
|
18376
|
+
const unscaledFee = Math.floor(totalFee / tx.operations.length);
|
|
18364
18377
|
const builderOpts = {
|
|
18365
18378
|
fee: (unscaledFee || BASE_FEE).toString(),
|
|
18366
18379
|
memo: tx.memo,
|
|
@@ -19282,7 +19295,8 @@
|
|
|
19282
19295
|
validUntilLedgerSeq,
|
|
19283
19296
|
invocation,
|
|
19284
19297
|
networkPassphrase,
|
|
19285
|
-
publicKey = ""
|
|
19298
|
+
publicKey = "",
|
|
19299
|
+
authV2 = false
|
|
19286
19300
|
} = params;
|
|
19287
19301
|
const kp = Keypair.random().rawPublicKey();
|
|
19288
19302
|
const nonce = new types.Int64(bytesToInt64(kp));
|
|
@@ -19290,18 +19304,17 @@
|
|
|
19290
19304
|
if (!pk) {
|
|
19291
19305
|
throw new Error(`authorizeInvocation requires publicKey parameter`);
|
|
19292
19306
|
}
|
|
19307
|
+
const addressCredentials = new types.SorobanAddressCredentials({
|
|
19308
|
+
address: new Address(pk).toScAddress(),
|
|
19309
|
+
nonce,
|
|
19310
|
+
signatureExpirationLedger: 0,
|
|
19311
|
+
// replaced
|
|
19312
|
+
signature: types.ScVal.scvVec([])
|
|
19313
|
+
// replaced
|
|
19314
|
+
});
|
|
19293
19315
|
const entry = new types.SorobanAuthorizationEntry({
|
|
19294
19316
|
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
|
-
)
|
|
19317
|
+
credentials: authV2 ? types.SorobanCredentials.sorobanCredentialsAddressV2(addressCredentials) : types.SorobanCredentials.sorobanCredentialsAddress(addressCredentials)
|
|
19305
19318
|
});
|
|
19306
19319
|
return authorizeEntry(entry, signer, validUntilLedgerSeq, networkPassphrase);
|
|
19307
19320
|
}
|
|
@@ -20876,7 +20889,7 @@ ${value}`, dataLines++;
|
|
|
20876
20889
|
return doc && typeof doc == "object" && "baseURI" in doc && typeof doc.baseURI == "string" ? doc.baseURI : void 0;
|
|
20877
20890
|
}
|
|
20878
20891
|
|
|
20879
|
-
const version$1 = "16.0.0
|
|
20892
|
+
const version$1 = "16.0.0";
|
|
20880
20893
|
const SERVER_TIME_MAP = {};
|
|
20881
20894
|
function toSeconds(ms) {
|
|
20882
20895
|
return Math.floor(ms / 1e3);
|
|
@@ -22803,7 +22816,7 @@ ${value}`, dataLines++;
|
|
|
22803
22816
|
Api2.isSimulationRaw = isSimulationRaw;
|
|
22804
22817
|
})(Api || (Api = {}));
|
|
22805
22818
|
|
|
22806
|
-
const version = "16.0.0
|
|
22819
|
+
const version = "16.0.0";
|
|
22807
22820
|
function createHttpClient(headers) {
|
|
22808
22821
|
return createFetchClient({
|
|
22809
22822
|
headers: {
|
|
@@ -23293,8 +23306,8 @@ ${value}`, dataLines++;
|
|
|
23293
23306
|
async getClaimableBalance(id) {
|
|
23294
23307
|
let balanceId;
|
|
23295
23308
|
if (StrKey.isValidClaimableBalance(id)) {
|
|
23296
|
-
|
|
23297
|
-
|
|
23309
|
+
const buffer = StrKey.decodeClaimableBalance(id);
|
|
23310
|
+
const v = bufferExports.Buffer.concat([
|
|
23298
23311
|
bufferExports.Buffer.from("\0\0\0"),
|
|
23299
23312
|
buffer.subarray(0, 1)
|
|
23300
23313
|
]);
|
|
@@ -25381,7 +25394,7 @@ ${JSON.stringify(sentTransaction)}`
|
|
|
25381
25394
|
|
|
25382
25395
|
function specFromWasm(wasm) {
|
|
25383
25396
|
const customData = parseWasmCustomSections(wasm);
|
|
25384
|
-
|
|
25397
|
+
const xdrSections = customData.get("contractspecv0");
|
|
25385
25398
|
if (!xdrSections || xdrSections.length === 0) {
|
|
25386
25399
|
throw new Error("Could not obtain contract spec from wasm");
|
|
25387
25400
|
}
|
|
@@ -26953,7 +26966,7 @@ ${indent} */
|
|
|
26953
26966
|
build: "tsc"
|
|
26954
26967
|
},
|
|
26955
26968
|
dependencies: {
|
|
26956
|
-
"@stellar/stellar-sdk": `^${"16.0.0
|
|
26969
|
+
"@stellar/stellar-sdk": `^${"16.0.0"}`,
|
|
26957
26970
|
buffer: "6.0.3"
|
|
26958
26971
|
},
|
|
26959
26972
|
devDependencies: {
|
|
@@ -27429,7 +27442,7 @@ export class Client extends ContractClient {
|
|
|
27429
27442
|
return { type: "stellar-asset-contract" };
|
|
27430
27443
|
}
|
|
27431
27444
|
const wasmHash = instance.executable().wasmHash();
|
|
27432
|
-
|
|
27445
|
+
const wasmBytes = await getRemoteWasmFromHash(server, wasmHash);
|
|
27433
27446
|
return { type: "wasm", wasmBytes };
|
|
27434
27447
|
} catch (error) {
|
|
27435
27448
|
if (error instanceof WasmFetchError) {
|