starknet 6.0.0-beta.4 → 6.0.0-beta.5
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 +16 -0
- package/dist/index.d.ts +6 -3
- package/dist/index.global.js +16 -11
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +16 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
# [6.0.0-beta.5](https://github.com/starknet-io/starknet.js/compare/v6.0.0-beta.4...v6.0.0-beta.5) (2023-12-10)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- apply bound for contract address from hash calculation ([6d8c291](https://github.com/starknet-io/starknet.js/commit/6d8c291bce130d7b00ae6d81aff071c4986f04af))
|
|
6
|
+
- **Calldata.compile:** do not split long `entrypoint` names before calling `getSelectorFromName` ([89715da](https://github.com/starknet-io/starknet.js/commit/89715da3fdb4b497cc5771eb83a88460007740b6))
|
|
7
|
+
- prioritize error states in waitForTransaction evaluation ([ac54404](https://github.com/starknet-io/starknet.js/commit/ac544045e2079b68042d850a09b203fc5536c0d0))
|
|
8
|
+
|
|
9
|
+
## [5.24.5](https://github.com/starknet-io/starknet.js/compare/v5.24.4...v5.24.5) (2023-12-10)
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
- apply bound for contract address from hash calculation ([6d8c291](https://github.com/starknet-io/starknet.js/commit/6d8c291bce130d7b00ae6d81aff071c4986f04af))
|
|
14
|
+
- **Calldata.compile:** do not split long `entrypoint` names before calling `getSelectorFromName` ([89715da](https://github.com/starknet-io/starknet.js/commit/89715da3fdb4b497cc5771eb83a88460007740b6))
|
|
15
|
+
- prioritize error states in waitForTransaction evaluation ([ac54404](https://github.com/starknet-io/starknet.js/commit/ac544045e2079b68042d850a09b203fc5536c0d0))
|
|
16
|
+
|
|
1
17
|
# [6.0.0-beta.4](https://github.com/starknet-io/starknet.js/compare/v6.0.0-beta.3...v6.0.0-beta.4) (2023-12-08)
|
|
2
18
|
|
|
3
19
|
### Bug Fixes
|
package/dist/index.d.ts
CHANGED
|
@@ -1650,8 +1650,9 @@ declare const TEXT_TO_FELT_MAX_LEN = 31;
|
|
|
1650
1650
|
|
|
1651
1651
|
declare const ZERO = 0n;
|
|
1652
1652
|
declare const MASK_250: bigint;
|
|
1653
|
-
declare const MASK_251: bigint;
|
|
1654
1653
|
declare const API_VERSION = 0n;
|
|
1654
|
+
declare const MAX_STORAGE_ITEM_SIZE = 256n;
|
|
1655
|
+
declare const ADDR_BOUND: bigint;
|
|
1655
1656
|
declare enum BaseUrl {
|
|
1656
1657
|
SN_MAIN = "https://alpha-mainnet.starknet.io",
|
|
1657
1658
|
SN_GOERLI = "https://alpha4.starknet.io"
|
|
@@ -1679,12 +1680,13 @@ declare const RPC_DEFAULT_VERSION = "v0_5";
|
|
|
1679
1680
|
declare const RPC_GOERLI_NODES: string[];
|
|
1680
1681
|
declare const RPC_MAINNET_NODES: string[];
|
|
1681
1682
|
|
|
1683
|
+
declare const constants_ADDR_BOUND: typeof ADDR_BOUND;
|
|
1682
1684
|
declare const constants_API_VERSION: typeof API_VERSION;
|
|
1683
1685
|
type constants_BaseUrl = BaseUrl;
|
|
1684
1686
|
declare const constants_BaseUrl: typeof BaseUrl;
|
|
1685
1687
|
declare const constants_IS_BROWSER: typeof IS_BROWSER;
|
|
1686
1688
|
declare const constants_MASK_250: typeof MASK_250;
|
|
1687
|
-
declare const
|
|
1689
|
+
declare const constants_MAX_STORAGE_ITEM_SIZE: typeof MAX_STORAGE_ITEM_SIZE;
|
|
1688
1690
|
type constants_NetworkName = NetworkName;
|
|
1689
1691
|
declare const constants_NetworkName: typeof NetworkName;
|
|
1690
1692
|
declare const constants_RPC_DEFAULT_VERSION: typeof RPC_DEFAULT_VERSION;
|
|
@@ -1699,11 +1701,12 @@ declare const constants_UDC: typeof UDC;
|
|
|
1699
1701
|
declare const constants_ZERO: typeof ZERO;
|
|
1700
1702
|
declare namespace constants {
|
|
1701
1703
|
export {
|
|
1704
|
+
constants_ADDR_BOUND as ADDR_BOUND,
|
|
1702
1705
|
constants_API_VERSION as API_VERSION,
|
|
1703
1706
|
constants_BaseUrl as BaseUrl,
|
|
1704
1707
|
constants_IS_BROWSER as IS_BROWSER,
|
|
1705
1708
|
constants_MASK_250 as MASK_250,
|
|
1706
|
-
|
|
1709
|
+
constants_MAX_STORAGE_ITEM_SIZE as MAX_STORAGE_ITEM_SIZE,
|
|
1707
1710
|
constants_NetworkName as NetworkName,
|
|
1708
1711
|
constants_RPC_DEFAULT_VERSION as RPC_DEFAULT_VERSION,
|
|
1709
1712
|
constants_RPC_GOERLI_NODES as RPC_GOERLI_NODES,
|
package/dist/index.global.js
CHANGED
|
@@ -721,11 +721,12 @@ var starknet = (() => {
|
|
|
721
721
|
// src/constants.ts
|
|
722
722
|
var constants_exports = {};
|
|
723
723
|
__export(constants_exports, {
|
|
724
|
+
ADDR_BOUND: () => ADDR_BOUND,
|
|
724
725
|
API_VERSION: () => API_VERSION,
|
|
725
726
|
BaseUrl: () => BaseUrl,
|
|
726
727
|
IS_BROWSER: () => IS_BROWSER,
|
|
727
728
|
MASK_250: () => MASK_250,
|
|
728
|
-
|
|
729
|
+
MAX_STORAGE_ITEM_SIZE: () => MAX_STORAGE_ITEM_SIZE,
|
|
729
730
|
NetworkName: () => NetworkName,
|
|
730
731
|
RPC_DEFAULT_VERSION: () => RPC_DEFAULT_VERSION,
|
|
731
732
|
RPC_GOERLI_NODES: () => RPC_GOERLI_NODES,
|
|
@@ -1087,8 +1088,9 @@ var starknet = (() => {
|
|
|
1087
1088
|
var TEXT_TO_FELT_MAX_LEN = 31;
|
|
1088
1089
|
var ZERO = 0n;
|
|
1089
1090
|
var MASK_250 = 2n ** 250n - 1n;
|
|
1090
|
-
var MASK_251 = 2n ** 251n;
|
|
1091
1091
|
var API_VERSION = ZERO;
|
|
1092
|
+
var MAX_STORAGE_ITEM_SIZE = 256n;
|
|
1093
|
+
var ADDR_BOUND = 2n ** 251n - MAX_STORAGE_ITEM_SIZE;
|
|
1092
1094
|
var BaseUrl = /* @__PURE__ */ ((BaseUrl2) => {
|
|
1093
1095
|
BaseUrl2["SN_MAIN"] = "https://alpha-mainnet.starknet.io";
|
|
1094
1096
|
BaseUrl2["SN_GOERLI"] = "https://alpha4.starknet.io";
|
|
@@ -5223,10 +5225,10 @@ var starknet = (() => {
|
|
|
5223
5225
|
const oe = Array.isArray(o) ? [o.length.toString(), ...o] : o;
|
|
5224
5226
|
return Object.entries(oe).flatMap(([k, v]) => {
|
|
5225
5227
|
let value = v;
|
|
5226
|
-
if (isLongText(value))
|
|
5227
|
-
value = splitLongString(value);
|
|
5228
5228
|
if (k === "entrypoint")
|
|
5229
5229
|
value = getSelectorFromName(value);
|
|
5230
|
+
else if (isLongText(value))
|
|
5231
|
+
value = splitLongString(value);
|
|
5230
5232
|
const kk = Array.isArray(oe) && k === "0" ? "$$len" : k;
|
|
5231
5233
|
if (isBigInt(value))
|
|
5232
5234
|
return [[`${prefix}${kk}`, felt(value)]];
|
|
@@ -6324,13 +6326,14 @@ var starknet = (() => {
|
|
|
6324
6326
|
const compiledCalldata = CallData.compile(constructorCalldata);
|
|
6325
6327
|
const constructorCalldataHash = computeHashOnElements3(compiledCalldata);
|
|
6326
6328
|
const CONTRACT_ADDRESS_PREFIX = felt("0x535441524b4e45545f434f4e54524143545f41444452455353");
|
|
6327
|
-
|
|
6329
|
+
const hash2 = computeHashOnElements3([
|
|
6328
6330
|
CONTRACT_ADDRESS_PREFIX,
|
|
6329
6331
|
deployerAddress,
|
|
6330
6332
|
salt,
|
|
6331
6333
|
classHash,
|
|
6332
6334
|
constructorCalldataHash
|
|
6333
6335
|
]);
|
|
6336
|
+
return toHex(BigInt(hash2) % ADDR_BOUND);
|
|
6334
6337
|
}
|
|
6335
6338
|
function nullSkipReplacer(key, value) {
|
|
6336
6339
|
if (key === "attributes" || key === "accessible_scopes") {
|
|
@@ -11136,8 +11139,10 @@ var starknet = (() => {
|
|
|
11136
11139
|
let isErrorState = false;
|
|
11137
11140
|
const retryInterval = options?.retryInterval ?? 5e3;
|
|
11138
11141
|
const errorStates = options?.errorStates ?? [
|
|
11139
|
-
api_exports.ETransactionStatus.REJECTED
|
|
11140
|
-
|
|
11142
|
+
api_exports.ETransactionStatus.REJECTED
|
|
11143
|
+
// TODO: commented out to preserve the long-standing behavior of "reverted" not being treated as an error by default
|
|
11144
|
+
// should decide which behavior to keep in the future
|
|
11145
|
+
// RPC.ETransactionExecutionStatus.REVERTED,
|
|
11141
11146
|
];
|
|
11142
11147
|
const successStates = options?.successStates ?? [
|
|
11143
11148
|
api_exports.ETransactionExecutionStatus.SUCCEEDED,
|
|
@@ -11155,14 +11160,14 @@ var starknet = (() => {
|
|
|
11155
11160
|
const error = new Error("waiting for transaction status");
|
|
11156
11161
|
throw error;
|
|
11157
11162
|
}
|
|
11158
|
-
if (
|
|
11159
|
-
onchain = true;
|
|
11160
|
-
} else if (errorStates.includes(executionStatus) || errorStates.includes(finalityStatus)) {
|
|
11163
|
+
if (errorStates.includes(executionStatus) || errorStates.includes(finalityStatus)) {
|
|
11161
11164
|
const message = `${executionStatus}: ${finalityStatus}`;
|
|
11162
11165
|
const error = new Error(message);
|
|
11163
11166
|
error.response = txStatus;
|
|
11164
11167
|
isErrorState = true;
|
|
11165
11168
|
throw error;
|
|
11169
|
+
} else if (successStates.includes(executionStatus) || successStates.includes(finalityStatus)) {
|
|
11170
|
+
onchain = true;
|
|
11166
11171
|
}
|
|
11167
11172
|
} catch (error) {
|
|
11168
11173
|
if (error instanceof Error && isErrorState) {
|
|
@@ -13526,7 +13531,7 @@ var starknet = (() => {
|
|
|
13526
13531
|
return addHexPrefix(removeHexPrefix(toHex(address)).padStart(64, "0"));
|
|
13527
13532
|
}
|
|
13528
13533
|
function validateAndParseAddress(address) {
|
|
13529
|
-
assertInRange(address, ZERO,
|
|
13534
|
+
assertInRange(address, ZERO, ADDR_BOUND - 1n, "Starknet Address");
|
|
13530
13535
|
const result = addAddressPadding(address);
|
|
13531
13536
|
if (!result.match(/^(0x)?[0-9a-fA-F]{64}$/)) {
|
|
13532
13537
|
throw new Error("Invalid Address Format");
|