starknet 5.13.1 → 5.13.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/CHANGELOG.md +6 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.global.js +7 -2
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## [5.13.2](https://github.com/0xs34n/starknet.js/compare/v5.13.1...v5.13.2) (2023-06-16)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- rpc storage key & added simple storage test ([6c66202](https://github.com/0xs34n/starknet.js/commit/6c66202a966003509460dedf91e98177f7f4af27))
|
|
6
|
+
|
|
1
7
|
## [5.13.1](https://github.com/0xs34n/starknet.js/compare/v5.13.0...v5.13.1) (2023-06-14)
|
|
2
8
|
|
|
3
9
|
### Bug Fixes
|
package/dist/index.d.ts
CHANGED
|
@@ -3234,6 +3234,14 @@ declare function isHex(hex: string): boolean;
|
|
|
3234
3234
|
declare function toBigInt(value: BigNumberish): bigint;
|
|
3235
3235
|
declare function isBigInt(value: any): value is bigint;
|
|
3236
3236
|
declare function toHex(number: BigNumberish): string;
|
|
3237
|
+
/**
|
|
3238
|
+
* Convert BigNumberish to STORAGE_KEY
|
|
3239
|
+
* Same as toHex but conforming pattern STORAGE_KEY pattern ^0x0[0-7]{1}[a-fA-F0-9]{0,62}$
|
|
3240
|
+
* A storage key. Represented as up to 62 hex digits, 3 bits, and 5 leading zeroes.
|
|
3241
|
+
* 0x0 + [0-7] + 62 hex = 0x + 64 hex
|
|
3242
|
+
* @param number BigNumberish
|
|
3243
|
+
*/
|
|
3244
|
+
declare function toStorageKey(number: BigNumberish): string;
|
|
3237
3245
|
declare function hexToDecimalString(hex: string): string;
|
|
3238
3246
|
/**
|
|
3239
3247
|
* Remove hex string leading zero and lower case '0x01A'.. -> '0x1a..'
|
|
@@ -3273,6 +3281,7 @@ declare const num_toBigInt: typeof toBigInt;
|
|
|
3273
3281
|
declare const num_toCairoBool: typeof toCairoBool;
|
|
3274
3282
|
declare const num_toHex: typeof toHex;
|
|
3275
3283
|
declare const num_toHexString: typeof toHexString;
|
|
3284
|
+
declare const num_toStorageKey: typeof toStorageKey;
|
|
3276
3285
|
declare namespace num {
|
|
3277
3286
|
export {
|
|
3278
3287
|
num_BigNumberish as BigNumberish,
|
|
@@ -3292,6 +3301,7 @@ declare namespace num {
|
|
|
3292
3301
|
num_toCairoBool as toCairoBool,
|
|
3293
3302
|
num_toHex as toHex,
|
|
3294
3303
|
num_toHexString as toHexString,
|
|
3304
|
+
num_toStorageKey as toStorageKey,
|
|
3295
3305
|
};
|
|
3296
3306
|
}
|
|
3297
3307
|
|
package/dist/index.global.js
CHANGED
|
@@ -2906,7 +2906,8 @@ var starknet = (() => {
|
|
|
2906
2906
|
toBigInt: () => toBigInt,
|
|
2907
2907
|
toCairoBool: () => toCairoBool,
|
|
2908
2908
|
toHex: () => toHex,
|
|
2909
|
-
toHexString: () => toHexString
|
|
2909
|
+
toHexString: () => toHexString,
|
|
2910
|
+
toStorageKey: () => toStorageKey
|
|
2910
2911
|
});
|
|
2911
2912
|
|
|
2912
2913
|
// node_modules/@noble/curves/esm/abstract/utils.js
|
|
@@ -3126,6 +3127,10 @@ var starknet = (() => {
|
|
|
3126
3127
|
function toHex(number3) {
|
|
3127
3128
|
return addHexPrefix(toBigInt(number3).toString(16));
|
|
3128
3129
|
}
|
|
3130
|
+
function toStorageKey(number3) {
|
|
3131
|
+
const res = addHexPrefix(toBigInt(number3).toString(16).padStart(64, "0"));
|
|
3132
|
+
return res;
|
|
3133
|
+
}
|
|
3129
3134
|
function hexToDecimalString(hex) {
|
|
3130
3135
|
return BigInt(addHexPrefix(hex)).toString(10);
|
|
3131
3136
|
}
|
|
@@ -12038,7 +12043,7 @@ var starknet = (() => {
|
|
|
12038
12043
|
return this.fetchEndpoint("starknet_getStateUpdate", { block_id });
|
|
12039
12044
|
}
|
|
12040
12045
|
async getStorageAt(contractAddress, key, blockIdentifier = this.blockIdentifier) {
|
|
12041
|
-
const parsedKey =
|
|
12046
|
+
const parsedKey = toStorageKey(key);
|
|
12042
12047
|
const block_id = new Block(blockIdentifier).identifier;
|
|
12043
12048
|
return this.fetchEndpoint("starknet_getStorageAt", {
|
|
12044
12049
|
contract_address: contractAddress,
|