starknet 6.4.0 → 6.4.1
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 +5 -10
- package/dist/index.global.js +9 -37
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +9 -37
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -37
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## [6.4.1](https://github.com/starknet-io/starknet.js/compare/v6.4.0...v6.4.1) (2024-03-14)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- byteArray encoding for less than 31 chars ([#1011](https://github.com/starknet-io/starknet.js/issues/1011)) ([653acc4](https://github.com/starknet-io/starknet.js/commit/653acc44c841540214dd6f6b8956b354d7c27644))
|
|
6
|
+
|
|
1
7
|
# [6.4.0](https://github.com/starknet-io/starknet.js/compare/v6.3.0...v6.4.0) (2024-03-12)
|
|
2
8
|
|
|
3
9
|
### Bug Fixes
|
package/dist/index.d.ts
CHANGED
|
@@ -7107,11 +7107,6 @@ interface Context {
|
|
|
7107
7107
|
parent?: string;
|
|
7108
7108
|
key?: string;
|
|
7109
7109
|
}
|
|
7110
|
-
declare function byteArrayFromString$1(targetString: string): {
|
|
7111
|
-
data: BigNumberish[];
|
|
7112
|
-
pending_word: BigNumberish;
|
|
7113
|
-
pending_word_len: number;
|
|
7114
|
-
};
|
|
7115
7110
|
declare function prepareSelector(selector: string): string;
|
|
7116
7111
|
declare function isMerkleTreeType(type: StarkNetType): type is StarkNetMerkleType;
|
|
7117
7112
|
/**
|
|
@@ -7164,7 +7159,7 @@ declare const typedData_getTypeHash: typeof getTypeHash;
|
|
|
7164
7159
|
declare const typedData_isMerkleTreeType: typeof isMerkleTreeType;
|
|
7165
7160
|
declare const typedData_prepareSelector: typeof prepareSelector;
|
|
7166
7161
|
declare namespace typedData {
|
|
7167
|
-
export { type typedData_StarkNetDomain as StarkNetDomain, type typedData_StarkNetEnumType as StarkNetEnumType, type typedData_StarkNetMerkleType as StarkNetMerkleType, type typedData_StarkNetType as StarkNetType, type typedData_TypedData as TypedData, typedData_TypedDataRevision as TypedDataRevision,
|
|
7162
|
+
export { type typedData_StarkNetDomain as StarkNetDomain, type typedData_StarkNetEnumType as StarkNetEnumType, type typedData_StarkNetMerkleType as StarkNetMerkleType, type typedData_StarkNetType as StarkNetType, type typedData_TypedData as TypedData, typedData_TypedDataRevision as TypedDataRevision, typedData_encodeData as encodeData, typedData_encodeType as encodeType, typedData_encodeValue as encodeValue, typedData_getDependencies as getDependencies, typedData_getMessageHash as getMessageHash, typedData_getStructHash as getStructHash, typedData_getTypeHash as getTypeHash, typedData_isMerkleTreeType as isMerkleTreeType, typedData_prepareSelector as prepareSelector };
|
|
7168
7163
|
}
|
|
7169
7164
|
|
|
7170
7165
|
declare function useDecoded(encoded: bigint[]): string;
|
|
@@ -7454,7 +7449,7 @@ declare namespace cairo {
|
|
|
7454
7449
|
* @example
|
|
7455
7450
|
* ```typescript
|
|
7456
7451
|
* const myByteArray = {
|
|
7457
|
-
* data: [
|
|
7452
|
+
* data: [],
|
|
7458
7453
|
* pending_word: '0x414243444546474849',
|
|
7459
7454
|
* pending_word_len: 9
|
|
7460
7455
|
* }
|
|
@@ -7468,16 +7463,16 @@ declare function stringFromByteArray(myByteArray: ByteArray): string;
|
|
|
7468
7463
|
* @returns Cairo representation of a LongString
|
|
7469
7464
|
* @example
|
|
7470
7465
|
* ```typescript
|
|
7471
|
-
* const myByteArray: ByteArray =
|
|
7466
|
+
* const myByteArray: ByteArray = byteArrayFromString("ABCDEFGHI");
|
|
7472
7467
|
* ```
|
|
7473
7468
|
* Result is :
|
|
7474
7469
|
* {
|
|
7475
|
-
* data: [
|
|
7470
|
+
* data: [],
|
|
7476
7471
|
* pending_word: '0x414243444546474849',
|
|
7477
7472
|
* pending_word_len: 9
|
|
7478
7473
|
* }
|
|
7479
7474
|
*/
|
|
7480
|
-
declare function byteArrayFromString(
|
|
7475
|
+
declare function byteArrayFromString(targetString: string): ByteArray;
|
|
7481
7476
|
|
|
7482
7477
|
declare const byteArray_byteArrayFromString: typeof byteArrayFromString;
|
|
7483
7478
|
declare const byteArray_stringFromByteArray: typeof stringFromByteArray;
|
package/dist/index.global.js
CHANGED
|
@@ -16179,31 +16179,15 @@ var starknet = (() => {
|
|
|
16179
16179
|
return cumuledString + add;
|
|
16180
16180
|
}, "") + pending_word;
|
|
16181
16181
|
}
|
|
16182
|
-
function byteArrayFromString(
|
|
16183
|
-
|
|
16184
|
-
|
|
16185
|
-
|
|
16186
|
-
|
|
16187
|
-
pending_word_len: 0
|
|
16188
|
-
};
|
|
16189
|
-
}
|
|
16190
|
-
const myShortStrings = splitLongString(myString);
|
|
16191
|
-
const remains = myShortStrings[myShortStrings.length - 1];
|
|
16192
|
-
const myShortStringsEncoded = myShortStrings.map(
|
|
16193
|
-
(shortStr) => encodeShortString(shortStr)
|
|
16194
|
-
);
|
|
16195
|
-
if (remains.length === 31) {
|
|
16196
|
-
return {
|
|
16197
|
-
data: myShortStringsEncoded,
|
|
16198
|
-
pending_word: "0x00",
|
|
16199
|
-
pending_word_len: 0
|
|
16200
|
-
};
|
|
16201
|
-
}
|
|
16202
|
-
const pendingEncodedWord = myShortStringsEncoded.pop();
|
|
16182
|
+
function byteArrayFromString(targetString) {
|
|
16183
|
+
const shortStrings = splitLongString(targetString);
|
|
16184
|
+
const remainder = shortStrings[shortStrings.length - 1];
|
|
16185
|
+
const shortStringsEncoded = shortStrings.map(encodeShortString);
|
|
16186
|
+
const [pendingWord, pendingWordLength] = remainder === void 0 || remainder.length === 31 ? ["0x00", 0] : [shortStringsEncoded.pop(), remainder.length];
|
|
16203
16187
|
return {
|
|
16204
|
-
data:
|
|
16205
|
-
pending_word:
|
|
16206
|
-
pending_word_len:
|
|
16188
|
+
data: shortStringsEncoded.length === 0 ? [] : shortStringsEncoded,
|
|
16189
|
+
pending_word: pendingWord,
|
|
16190
|
+
pending_word_len: pendingWordLength
|
|
16207
16191
|
};
|
|
16208
16192
|
}
|
|
16209
16193
|
|
|
@@ -25504,7 +25488,6 @@ var starknet = (() => {
|
|
|
25504
25488
|
var typedData_exports = {};
|
|
25505
25489
|
__export(typedData_exports, {
|
|
25506
25490
|
TypedDataRevision: () => TypedDataRevision,
|
|
25507
|
-
byteArrayFromString: () => byteArrayFromString2,
|
|
25508
25491
|
encodeData: () => encodeData,
|
|
25509
25492
|
encodeType: () => encodeType,
|
|
25510
25493
|
encodeValue: () => encodeValue,
|
|
@@ -25623,17 +25606,6 @@ var starknet = (() => {
|
|
|
25623
25606
|
presetTypes: {}
|
|
25624
25607
|
}
|
|
25625
25608
|
};
|
|
25626
|
-
function byteArrayFromString2(targetString) {
|
|
25627
|
-
const shortStrings = splitLongString(targetString);
|
|
25628
|
-
const remainder = shortStrings[shortStrings.length - 1];
|
|
25629
|
-
const shortStringsEncoded = shortStrings.map(encodeShortString);
|
|
25630
|
-
const [pendingWord, pendingWordLength] = remainder === void 0 || remainder.length === 31 ? ["0x00", 0] : [shortStringsEncoded.pop(), remainder.length];
|
|
25631
|
-
return {
|
|
25632
|
-
data: shortStringsEncoded.length === 0 ? ["0x00"] : shortStringsEncoded,
|
|
25633
|
-
pending_word: pendingWord,
|
|
25634
|
-
pending_word_len: pendingWordLength
|
|
25635
|
-
};
|
|
25636
|
-
}
|
|
25637
25609
|
function identifyRevision({ types, domain }) {
|
|
25638
25610
|
if (revisionConfiguration["1" /* Active */].domain in types && domain.revision === "1" /* Active */)
|
|
25639
25611
|
return "1" /* Active */;
|
|
@@ -25785,7 +25757,7 @@ var starknet = (() => {
|
|
|
25785
25757
|
}
|
|
25786
25758
|
case "string": {
|
|
25787
25759
|
if (revision === "1" /* Active */) {
|
|
25788
|
-
const byteArray =
|
|
25760
|
+
const byteArray = byteArrayFromString(data);
|
|
25789
25761
|
const elements = [
|
|
25790
25762
|
byteArray.data.length,
|
|
25791
25763
|
...byteArray.data,
|