starknet 6.6.6 → 6.7.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/CHANGELOG.md +6 -0
- package/README.md +4 -1
- package/dist/index.d.ts +148 -482
- package/dist/index.global.js +3492 -1540
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +85 -83
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +83 -66
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -12
package/dist/index.js
CHANGED
|
@@ -67,7 +67,7 @@ __export(src_exports, {
|
|
|
67
67
|
TransactionFinalityStatus: () => TransactionFinalityStatus,
|
|
68
68
|
TransactionStatus: () => TransactionStatus,
|
|
69
69
|
TransactionType: () => TransactionType,
|
|
70
|
-
TypedDataRevision: () => TypedDataRevision,
|
|
70
|
+
TypedDataRevision: () => import_starknet_types.TypedDataRevision,
|
|
71
71
|
UINT_128_MAX: () => UINT_128_MAX,
|
|
72
72
|
UINT_128_MIN: () => UINT_128_MIN,
|
|
73
73
|
UINT_256_HIGH_MAX: () => UINT_256_HIGH_MAX,
|
|
@@ -82,17 +82,12 @@ __export(src_exports, {
|
|
|
82
82
|
ValidateType: () => ValidateType,
|
|
83
83
|
WalletAccount: () => WalletAccount,
|
|
84
84
|
addAddressPadding: () => addAddressPadding,
|
|
85
|
-
addDeclareTransaction: () => addDeclareTransaction,
|
|
86
|
-
addDeployAccountTransaction: () => addDeployAccountTransaction,
|
|
87
|
-
addInvokeTransaction: () => addInvokeTransaction,
|
|
88
|
-
addStarknetChain: () => addStarknetChain,
|
|
89
85
|
buildUrl: () => buildUrl,
|
|
90
86
|
byteArray: () => byteArray_exports,
|
|
91
87
|
cairo: () => cairo_exports,
|
|
92
88
|
constants: () => constants_exports,
|
|
93
89
|
contractClassResponseToLegacyCompiledContract: () => contractClassResponseToLegacyCompiledContract,
|
|
94
90
|
defaultProvider: () => defaultProvider,
|
|
95
|
-
deploymentData: () => deploymentData,
|
|
96
91
|
ec: () => ec_exports,
|
|
97
92
|
encode: () => encode_exports,
|
|
98
93
|
eth: () => eth_exports,
|
|
@@ -102,7 +97,6 @@ __export(src_exports, {
|
|
|
102
97
|
fixStack: () => fixStack,
|
|
103
98
|
getCalldata: () => getCalldata,
|
|
104
99
|
getChecksumAddress: () => getChecksumAddress,
|
|
105
|
-
getPermissions: () => getPermissions,
|
|
106
100
|
hash: () => hash_exports,
|
|
107
101
|
isSierra: () => isSierra,
|
|
108
102
|
isUrl: () => isUrl,
|
|
@@ -110,20 +104,13 @@ __export(src_exports, {
|
|
|
110
104
|
merkle: () => merkle_exports,
|
|
111
105
|
num: () => num_exports,
|
|
112
106
|
number: () => number,
|
|
113
|
-
onAccountChange: () => onAccountChange,
|
|
114
|
-
onNetworkChanged: () => onNetworkChanged,
|
|
115
107
|
parseUDCEvent: () => parseUDCEvent,
|
|
116
108
|
provider: () => provider_exports,
|
|
117
|
-
requestAccounts: () => requestAccounts,
|
|
118
|
-
requestChainId: () => requestChainId,
|
|
119
109
|
selector: () => selector_exports,
|
|
120
110
|
shortString: () => shortString_exports,
|
|
121
|
-
signMessage: () => signMessage,
|
|
122
111
|
splitArgsAndOptions: () => splitArgsAndOptions,
|
|
123
112
|
stark: () => stark_exports,
|
|
124
113
|
starknetId: () => starknetId_exports,
|
|
125
|
-
supportedSpecs: () => supportedSpecs,
|
|
126
|
-
switchStarknetChain: () => switchStarknetChain,
|
|
127
114
|
transaction: () => transaction_exports,
|
|
128
115
|
typedData: () => typedData_exports,
|
|
129
116
|
types: () => types_exports,
|
|
@@ -132,7 +119,7 @@ __export(src_exports, {
|
|
|
132
119
|
v3hash: () => v3_exports,
|
|
133
120
|
validateAndParseAddress: () => validateAndParseAddress,
|
|
134
121
|
validateChecksumAddress: () => validateChecksumAddress,
|
|
135
|
-
|
|
122
|
+
wallet: () => connect_exports
|
|
136
123
|
});
|
|
137
124
|
module.exports = __toCommonJS(src_exports);
|
|
138
125
|
|
|
@@ -572,7 +559,7 @@ __export(types_exports, {
|
|
|
572
559
|
TransactionFinalityStatus: () => TransactionFinalityStatus,
|
|
573
560
|
TransactionStatus: () => TransactionStatus,
|
|
574
561
|
TransactionType: () => TransactionType,
|
|
575
|
-
TypedDataRevision: () => TypedDataRevision,
|
|
562
|
+
TypedDataRevision: () => import_starknet_types.TypedDataRevision,
|
|
576
563
|
Uint: () => Uint,
|
|
577
564
|
ValidateType: () => ValidateType
|
|
578
565
|
});
|
|
@@ -660,11 +647,7 @@ var BlockTag = /* @__PURE__ */ ((BlockTag2) => {
|
|
|
660
647
|
})(BlockTag || {});
|
|
661
648
|
|
|
662
649
|
// src/types/typedData.ts
|
|
663
|
-
var
|
|
664
|
-
TypedDataRevision2["Active"] = "1";
|
|
665
|
-
TypedDataRevision2["Legacy"] = "0";
|
|
666
|
-
return TypedDataRevision2;
|
|
667
|
-
})(TypedDataRevision || {});
|
|
650
|
+
var import_starknet_types = require("starknet-types");
|
|
668
651
|
|
|
669
652
|
// src/utils/assert.ts
|
|
670
653
|
function assert(condition, message) {
|
|
@@ -3307,6 +3290,23 @@ function contractClassResponseToLegacyCompiledContract(ccr) {
|
|
|
3307
3290
|
return { ...contract, program: decompressProgram(contract.program) };
|
|
3308
3291
|
}
|
|
3309
3292
|
|
|
3293
|
+
// src/utils/eth.ts
|
|
3294
|
+
var eth_exports = {};
|
|
3295
|
+
__export(eth_exports, {
|
|
3296
|
+
ethRandomPrivateKey: () => ethRandomPrivateKey,
|
|
3297
|
+
validateAndParseEthAddress: () => validateAndParseEthAddress
|
|
3298
|
+
});
|
|
3299
|
+
var import_secp256k1 = require("@noble/curves/secp256k1");
|
|
3300
|
+
function ethRandomPrivateKey() {
|
|
3301
|
+
return sanitizeHex(buf2hex(import_secp256k1.secp256k1.utils.randomPrivateKey()));
|
|
3302
|
+
}
|
|
3303
|
+
function validateAndParseEthAddress(address) {
|
|
3304
|
+
assertInRange(address, ZERO, 2n ** 160n - 1n, "Ethereum Address ");
|
|
3305
|
+
const result = addHexPrefix(removeHexPrefix(toHex(address)).padStart(40, "0"));
|
|
3306
|
+
assert(result.match(/^(0x)?[0-9a-f]{40}$/), "Invalid Ethereum Address Format");
|
|
3307
|
+
return result;
|
|
3308
|
+
}
|
|
3309
|
+
|
|
3310
3310
|
// src/utils/fetchPonyfill.ts
|
|
3311
3311
|
var import_fetch_cookie = __toESM(require("fetch-cookie"));
|
|
3312
3312
|
var import_isomorphic_fetch = __toESM(require("isomorphic-fetch"));
|
|
@@ -3985,7 +3985,7 @@ var RpcChannel = class {
|
|
|
3985
3985
|
estimateMessageFee(message, blockIdentifier = this.blockIdentifier) {
|
|
3986
3986
|
const { from_address, to_address, entry_point_selector, payload } = message;
|
|
3987
3987
|
const formattedMessage = {
|
|
3988
|
-
from_address:
|
|
3988
|
+
from_address: validateAndParseEthAddress(from_address),
|
|
3989
3989
|
to_address: toHex(to_address),
|
|
3990
3990
|
entry_point_selector: getSelector(entry_point_selector),
|
|
3991
3991
|
payload: getHexStringArray(payload)
|
|
@@ -4097,11 +4097,11 @@ var RpcChannel2 = class {
|
|
|
4097
4097
|
requestId;
|
|
4098
4098
|
blockIdentifier;
|
|
4099
4099
|
chainId;
|
|
4100
|
-
|
|
4100
|
+
specVersion;
|
|
4101
4101
|
waitMode;
|
|
4102
4102
|
// behave like web2 rpc and return when tx is processed
|
|
4103
4103
|
constructor(optionsOrProvider) {
|
|
4104
|
-
const { nodeUrl, retries, headers, blockIdentifier, chainId, waitMode } = optionsOrProvider || {};
|
|
4104
|
+
const { nodeUrl, retries, headers, blockIdentifier, chainId, specVersion, waitMode } = optionsOrProvider || {};
|
|
4105
4105
|
if (Object.values(NetworkName).includes(nodeUrl)) {
|
|
4106
4106
|
this.nodeUrl = getDefaultNodeUrl(nodeUrl, optionsOrProvider?.default);
|
|
4107
4107
|
} else if (nodeUrl) {
|
|
@@ -4113,6 +4113,7 @@ var RpcChannel2 = class {
|
|
|
4113
4113
|
this.headers = { ...defaultOptions2.headers, ...headers };
|
|
4114
4114
|
this.blockIdentifier = blockIdentifier || defaultOptions2.blockIdentifier;
|
|
4115
4115
|
this.chainId = chainId;
|
|
4116
|
+
this.specVersion = specVersion;
|
|
4116
4117
|
this.waitMode = waitMode || false;
|
|
4117
4118
|
this.requestId = 0;
|
|
4118
4119
|
}
|
|
@@ -4164,8 +4165,8 @@ var RpcChannel2 = class {
|
|
|
4164
4165
|
return this.chainId;
|
|
4165
4166
|
}
|
|
4166
4167
|
async getSpecVersion() {
|
|
4167
|
-
this.
|
|
4168
|
-
return this.
|
|
4168
|
+
this.specVersion ??= await this.fetchEndpoint("starknet_specVersion");
|
|
4169
|
+
return this.specVersion;
|
|
4169
4170
|
}
|
|
4170
4171
|
getNonceForAddress(contractAddress, blockIdentifier = this.blockIdentifier) {
|
|
4171
4172
|
const contract_address = toHex(contractAddress);
|
|
@@ -4522,7 +4523,7 @@ var RpcChannel2 = class {
|
|
|
4522
4523
|
estimateMessageFee(message, blockIdentifier = this.blockIdentifier) {
|
|
4523
4524
|
const { from_address, to_address, entry_point_selector, payload } = message;
|
|
4524
4525
|
const formattedMessage = {
|
|
4525
|
-
from_address:
|
|
4526
|
+
from_address: validateAndParseEthAddress(from_address),
|
|
4526
4527
|
to_address: toHex(to_address),
|
|
4527
4528
|
entry_point_selector: getSelector(entry_point_selector),
|
|
4528
4529
|
payload: getHexStringArray(payload)
|
|
@@ -4656,7 +4657,9 @@ var RPCResponseParser = class {
|
|
|
4656
4657
|
gas_price: toBigInt(val.gas_price),
|
|
4657
4658
|
unit: val.unit,
|
|
4658
4659
|
suggestedMaxFee: this.estimatedFeeToMaxFee(val.overall_fee),
|
|
4659
|
-
resourceBounds: this.estimateFeeToBounds(val)
|
|
4660
|
+
resourceBounds: this.estimateFeeToBounds(val),
|
|
4661
|
+
data_gas_consumed: val.data_gas_consumed ? toBigInt(val.data_gas_consumed) : 0n,
|
|
4662
|
+
data_gas_price: val.data_gas_price ? toBigInt(val.data_gas_price) : 0n
|
|
4660
4663
|
};
|
|
4661
4664
|
}
|
|
4662
4665
|
parseFeeEstimateBulkResponse(res) {
|
|
@@ -4666,7 +4669,9 @@ var RPCResponseParser = class {
|
|
|
4666
4669
|
gas_price: toBigInt(val.gas_price),
|
|
4667
4670
|
unit: val.unit,
|
|
4668
4671
|
suggestedMaxFee: this.estimatedFeeToMaxFee(val.overall_fee),
|
|
4669
|
-
resourceBounds: this.estimateFeeToBounds(val)
|
|
4672
|
+
resourceBounds: this.estimateFeeToBounds(val),
|
|
4673
|
+
data_gas_consumed: val.data_gas_consumed ? toBigInt(val.data_gas_consumed) : 0n,
|
|
4674
|
+
data_gas_price: val.data_gas_price ? toBigInt(val.data_gas_price) : 0n
|
|
4670
4675
|
}));
|
|
4671
4676
|
}
|
|
4672
4677
|
parseSimulateTransactionResponse(res) {
|
|
@@ -5432,7 +5437,7 @@ var SignerInterface = class {
|
|
|
5432
5437
|
// src/utils/typedData.ts
|
|
5433
5438
|
var typedData_exports = {};
|
|
5434
5439
|
__export(typedData_exports, {
|
|
5435
|
-
TypedDataRevision: () => TypedDataRevision,
|
|
5440
|
+
TypedDataRevision: () => import_starknet_types.TypedDataRevision,
|
|
5436
5441
|
encodeData: () => encodeData,
|
|
5437
5442
|
encodeType: () => encodeType,
|
|
5438
5443
|
encodeValue: () => encodeValue,
|
|
@@ -5536,14 +5541,14 @@ var presetTypes = {
|
|
|
5536
5541
|
)
|
|
5537
5542
|
};
|
|
5538
5543
|
var revisionConfiguration = {
|
|
5539
|
-
[
|
|
5544
|
+
[import_starknet_types.TypedDataRevision.Active]: {
|
|
5540
5545
|
domain: "StarknetDomain",
|
|
5541
5546
|
hashMethod: computePoseidonHashOnElements,
|
|
5542
5547
|
hashMerkleMethod: computePoseidonHash,
|
|
5543
5548
|
escapeTypeString: (s) => `"${s}"`,
|
|
5544
5549
|
presetTypes
|
|
5545
5550
|
},
|
|
5546
|
-
[
|
|
5551
|
+
[import_starknet_types.TypedDataRevision.Legacy]: {
|
|
5547
5552
|
domain: "StarkNetDomain",
|
|
5548
5553
|
hashMethod: computePedersenHashOnElements,
|
|
5549
5554
|
hashMerkleMethod: computePedersenHash,
|
|
@@ -5556,10 +5561,10 @@ function assertRange(data, type, { min, max }) {
|
|
|
5556
5561
|
assert(value >= min && value <= max, `${value} (${type}) is out of bounds [${min}, ${max}]`);
|
|
5557
5562
|
}
|
|
5558
5563
|
function identifyRevision({ types, domain }) {
|
|
5559
|
-
if (revisionConfiguration[
|
|
5560
|
-
return
|
|
5561
|
-
if (revisionConfiguration[
|
|
5562
|
-
return
|
|
5564
|
+
if (revisionConfiguration[import_starknet_types.TypedDataRevision.Active].domain in types && domain.revision === import_starknet_types.TypedDataRevision.Active)
|
|
5565
|
+
return import_starknet_types.TypedDataRevision.Active;
|
|
5566
|
+
if (revisionConfiguration[import_starknet_types.TypedDataRevision.Legacy].domain in types && (domain.revision ?? import_starknet_types.TypedDataRevision.Legacy) === import_starknet_types.TypedDataRevision.Legacy)
|
|
5567
|
+
return import_starknet_types.TypedDataRevision.Legacy;
|
|
5563
5568
|
return void 0;
|
|
5564
5569
|
}
|
|
5565
5570
|
function getHex(value) {
|
|
@@ -5584,10 +5589,10 @@ function prepareSelector(selector) {
|
|
|
5584
5589
|
function isMerkleTreeType(type) {
|
|
5585
5590
|
return type.type === "merkletree";
|
|
5586
5591
|
}
|
|
5587
|
-
function getDependencies(types, type, dependencies = [], contains = "", revision =
|
|
5592
|
+
function getDependencies(types, type, dependencies = [], contains = "", revision = import_starknet_types.TypedDataRevision.Legacy) {
|
|
5588
5593
|
if (type[type.length - 1] === "*") {
|
|
5589
5594
|
type = type.slice(0, -1);
|
|
5590
|
-
} else if (revision ===
|
|
5595
|
+
} else if (revision === import_starknet_types.TypedDataRevision.Active) {
|
|
5591
5596
|
if (type === "enum") {
|
|
5592
5597
|
type = contains;
|
|
5593
5598
|
} else if (type.match(/^\(.*\)$/)) {
|
|
@@ -5625,8 +5630,8 @@ function getMerkleTreeType(types, ctx) {
|
|
|
5625
5630
|
}
|
|
5626
5631
|
return "raw";
|
|
5627
5632
|
}
|
|
5628
|
-
function encodeType(types, type, revision =
|
|
5629
|
-
const allTypes = revision ===
|
|
5633
|
+
function encodeType(types, type, revision = import_starknet_types.TypedDataRevision.Legacy) {
|
|
5634
|
+
const allTypes = revision === import_starknet_types.TypedDataRevision.Active ? { ...types, ...revisionConfiguration[revision].presetTypes } : types;
|
|
5630
5635
|
const [primary, ...dependencies] = getDependencies(
|
|
5631
5636
|
allTypes,
|
|
5632
5637
|
type,
|
|
@@ -5638,17 +5643,17 @@ function encodeType(types, type, revision = "0" /* Legacy */) {
|
|
|
5638
5643
|
const esc = revisionConfiguration[revision].escapeTypeString;
|
|
5639
5644
|
return newTypes.map((dependency) => {
|
|
5640
5645
|
const dependencyElements = allTypes[dependency].map((t) => {
|
|
5641
|
-
const targetType = t.type === "enum" && revision ===
|
|
5646
|
+
const targetType = t.type === "enum" && revision === import_starknet_types.TypedDataRevision.Active ? t.contains : t.type;
|
|
5642
5647
|
const typeString = targetType.match(/^\(.*\)$/) ? `(${targetType.slice(1, -1).split(",").map((e) => e ? esc(e) : e).join(",")})` : esc(targetType);
|
|
5643
5648
|
return `${esc(t.name)}:${typeString}`;
|
|
5644
5649
|
});
|
|
5645
5650
|
return `${esc(dependency)}(${dependencyElements})`;
|
|
5646
5651
|
}).join("");
|
|
5647
5652
|
}
|
|
5648
|
-
function getTypeHash(types, type, revision =
|
|
5653
|
+
function getTypeHash(types, type, revision = import_starknet_types.TypedDataRevision.Legacy) {
|
|
5649
5654
|
return getSelectorFromName(encodeType(types, type, revision));
|
|
5650
5655
|
}
|
|
5651
|
-
function encodeValue(types, type, data, ctx = {}, revision =
|
|
5656
|
+
function encodeValue(types, type, data, ctx = {}, revision = import_starknet_types.TypedDataRevision.Legacy) {
|
|
5652
5657
|
if (types[type]) {
|
|
5653
5658
|
return [type, getStructHash(types, type, data, revision)];
|
|
5654
5659
|
}
|
|
@@ -5671,7 +5676,7 @@ function encodeValue(types, type, data, ctx = {}, revision = "0" /* Legacy */) {
|
|
|
5671
5676
|
}
|
|
5672
5677
|
switch (type) {
|
|
5673
5678
|
case "enum": {
|
|
5674
|
-
if (revision ===
|
|
5679
|
+
if (revision === import_starknet_types.TypedDataRevision.Active) {
|
|
5675
5680
|
const [variantKey, variantData] = Object.entries(data)[0];
|
|
5676
5681
|
const parentType = types[ctx.parent][0];
|
|
5677
5682
|
const enumType = types[parentType.contains];
|
|
@@ -5705,7 +5710,7 @@ function encodeValue(types, type, data, ctx = {}, revision = "0" /* Legacy */) {
|
|
|
5705
5710
|
return ["felt", prepareSelector(data)];
|
|
5706
5711
|
}
|
|
5707
5712
|
case "string": {
|
|
5708
|
-
if (revision ===
|
|
5713
|
+
if (revision === import_starknet_types.TypedDataRevision.Active) {
|
|
5709
5714
|
const byteArray = byteArrayFromString(data);
|
|
5710
5715
|
const elements = [
|
|
5711
5716
|
byteArray.data.length,
|
|
@@ -5718,7 +5723,7 @@ function encodeValue(types, type, data, ctx = {}, revision = "0" /* Legacy */) {
|
|
|
5718
5723
|
return [type, getHex(data)];
|
|
5719
5724
|
}
|
|
5720
5725
|
case "i128": {
|
|
5721
|
-
if (revision ===
|
|
5726
|
+
if (revision === import_starknet_types.TypedDataRevision.Active) {
|
|
5722
5727
|
const value = BigInt(data);
|
|
5723
5728
|
assertRange(value, type, RANGE_I128);
|
|
5724
5729
|
return [type, getHex(value < 0n ? PRIME + value : value)];
|
|
@@ -5727,40 +5732,40 @@ function encodeValue(types, type, data, ctx = {}, revision = "0" /* Legacy */) {
|
|
|
5727
5732
|
}
|
|
5728
5733
|
case "timestamp":
|
|
5729
5734
|
case "u128": {
|
|
5730
|
-
if (revision ===
|
|
5735
|
+
if (revision === import_starknet_types.TypedDataRevision.Active) {
|
|
5731
5736
|
assertRange(data, type, RANGE_U128);
|
|
5732
5737
|
}
|
|
5733
5738
|
return [type, getHex(data)];
|
|
5734
5739
|
}
|
|
5735
5740
|
case "felt":
|
|
5736
5741
|
case "shortstring": {
|
|
5737
|
-
if (revision ===
|
|
5742
|
+
if (revision === import_starknet_types.TypedDataRevision.Active) {
|
|
5738
5743
|
assertRange(getHex(data), type, RANGE_FELT);
|
|
5739
5744
|
}
|
|
5740
5745
|
return [type, getHex(data)];
|
|
5741
5746
|
}
|
|
5742
5747
|
case "ClassHash":
|
|
5743
5748
|
case "ContractAddress": {
|
|
5744
|
-
if (revision ===
|
|
5749
|
+
if (revision === import_starknet_types.TypedDataRevision.Active) {
|
|
5745
5750
|
assertRange(data, type, RANGE_FELT);
|
|
5746
5751
|
}
|
|
5747
5752
|
return [type, getHex(data)];
|
|
5748
5753
|
}
|
|
5749
5754
|
case "bool": {
|
|
5750
|
-
if (revision ===
|
|
5755
|
+
if (revision === import_starknet_types.TypedDataRevision.Active) {
|
|
5751
5756
|
assert(typeof data === "boolean", `Type mismatch for ${type} ${data}`);
|
|
5752
5757
|
}
|
|
5753
5758
|
return [type, getHex(data)];
|
|
5754
5759
|
}
|
|
5755
5760
|
default: {
|
|
5756
|
-
if (revision ===
|
|
5761
|
+
if (revision === import_starknet_types.TypedDataRevision.Active) {
|
|
5757
5762
|
throw new Error(`Unsupported type: ${type}`);
|
|
5758
5763
|
}
|
|
5759
5764
|
return [type, getHex(data)];
|
|
5760
5765
|
}
|
|
5761
5766
|
}
|
|
5762
5767
|
}
|
|
5763
|
-
function encodeData(types, type, data, revision =
|
|
5768
|
+
function encodeData(types, type, data, revision = import_starknet_types.TypedDataRevision.Legacy) {
|
|
5764
5769
|
const targetType = types[type] ?? revisionConfiguration[revision].presetTypes[type];
|
|
5765
5770
|
const [returnTypes, values] = targetType.reduce(
|
|
5766
5771
|
([ts, vs], field) => {
|
|
@@ -5779,7 +5784,7 @@ function encodeData(types, type, data, revision = "0" /* Legacy */) {
|
|
|
5779
5784
|
);
|
|
5780
5785
|
return [returnTypes, values];
|
|
5781
5786
|
}
|
|
5782
|
-
function getStructHash(types, type, data, revision =
|
|
5787
|
+
function getStructHash(types, type, data, revision = import_starknet_types.TypedDataRevision.Legacy) {
|
|
5783
5788
|
return revisionConfiguration[revision].hashMethod(encodeData(types, type, data, revision)[1]);
|
|
5784
5789
|
}
|
|
5785
5790
|
function getMessageHash(typedData, account) {
|
|
@@ -5891,16 +5896,6 @@ var Signer = class {
|
|
|
5891
5896
|
// src/signer/ethSigner.ts
|
|
5892
5897
|
var import_secp256k12 = require("@noble/curves/secp256k1");
|
|
5893
5898
|
|
|
5894
|
-
// src/utils/eth.ts
|
|
5895
|
-
var eth_exports = {};
|
|
5896
|
-
__export(eth_exports, {
|
|
5897
|
-
ethRandomPrivateKey: () => ethRandomPrivateKey
|
|
5898
|
-
});
|
|
5899
|
-
var import_secp256k1 = require("@noble/curves/secp256k1");
|
|
5900
|
-
function ethRandomPrivateKey() {
|
|
5901
|
-
return sanitizeHex(buf2hex(import_secp256k1.secp256k1.utils.randomPrivateKey()));
|
|
5902
|
-
}
|
|
5903
|
-
|
|
5904
5899
|
// src/utils/uint256.ts
|
|
5905
5900
|
var uint256_exports = {};
|
|
5906
5901
|
__export(uint256_exports, {
|
|
@@ -6263,8 +6258,9 @@ var Account = class extends RpcProvider2 {
|
|
|
6263
6258
|
skipExecute
|
|
6264
6259
|
});
|
|
6265
6260
|
}
|
|
6266
|
-
async execute(
|
|
6267
|
-
const
|
|
6261
|
+
async execute(transactions, arg2, transactionsDetail = {}) {
|
|
6262
|
+
const details = arg2 === void 0 || Array.isArray(arg2) ? transactionsDetail : arg2;
|
|
6263
|
+
const calls = Array.isArray(transactions) ? transactions : [transactions];
|
|
6268
6264
|
const nonce = toBigInt(details.nonce ?? await this.getNonce());
|
|
6269
6265
|
const version = toTransactionVersion(
|
|
6270
6266
|
this.getPreferredVersion("0x1" /* V1 */, "0x3" /* V3 */),
|
|
@@ -6273,7 +6269,7 @@ var Account = class extends RpcProvider2 {
|
|
|
6273
6269
|
);
|
|
6274
6270
|
const estimate = await this.getUniversalSuggestedFee(
|
|
6275
6271
|
version,
|
|
6276
|
-
{ type: "INVOKE_FUNCTION" /* INVOKE */, payload:
|
|
6272
|
+
{ type: "INVOKE_FUNCTION" /* INVOKE */, payload: transactions },
|
|
6277
6273
|
{
|
|
6278
6274
|
...details,
|
|
6279
6275
|
version
|
|
@@ -6290,8 +6286,8 @@ var Account = class extends RpcProvider2 {
|
|
|
6290
6286
|
chainId,
|
|
6291
6287
|
cairoVersion: await this.getCairoVersion()
|
|
6292
6288
|
};
|
|
6293
|
-
const signature = await this.signer.signTransaction(
|
|
6294
|
-
const calldata = getExecuteCalldata(
|
|
6289
|
+
const signature = await this.signer.signTransaction(calls, signerDetails);
|
|
6290
|
+
const calldata = getExecuteCalldata(calls, await this.getCairoVersion());
|
|
6295
6291
|
return this.invokeFunction(
|
|
6296
6292
|
{ contractAddress: this.address, calldata, signature },
|
|
6297
6293
|
{
|
|
@@ -6503,7 +6499,9 @@ var Account = class extends RpcProvider2 {
|
|
|
6503
6499
|
overall_fee: ZERO,
|
|
6504
6500
|
unit: "FRI",
|
|
6505
6501
|
suggestedMaxFee: ZERO,
|
|
6506
|
-
resourceBounds: estimateFeeToBounds(ZERO)
|
|
6502
|
+
resourceBounds: estimateFeeToBounds(ZERO),
|
|
6503
|
+
data_gas_consumed: 0n,
|
|
6504
|
+
data_gas_price: 0n
|
|
6507
6505
|
};
|
|
6508
6506
|
break;
|
|
6509
6507
|
}
|
|
@@ -6672,6 +6670,23 @@ var AccountInterface = class extends ProviderInterface {
|
|
|
6672
6670
|
};
|
|
6673
6671
|
|
|
6674
6672
|
// src/wallet/connect.ts
|
|
6673
|
+
var connect_exports = {};
|
|
6674
|
+
__export(connect_exports, {
|
|
6675
|
+
addDeclareTransaction: () => addDeclareTransaction,
|
|
6676
|
+
addDeployAccountTransaction: () => addDeployAccountTransaction,
|
|
6677
|
+
addInvokeTransaction: () => addInvokeTransaction,
|
|
6678
|
+
addStarknetChain: () => addStarknetChain,
|
|
6679
|
+
deploymentData: () => deploymentData,
|
|
6680
|
+
getPermissions: () => getPermissions,
|
|
6681
|
+
onAccountChange: () => onAccountChange,
|
|
6682
|
+
onNetworkChanged: () => onNetworkChanged,
|
|
6683
|
+
requestAccounts: () => requestAccounts,
|
|
6684
|
+
requestChainId: () => requestChainId,
|
|
6685
|
+
signMessage: () => signMessage,
|
|
6686
|
+
supportedSpecs: () => supportedSpecs,
|
|
6687
|
+
switchStarknetChain: () => switchStarknetChain,
|
|
6688
|
+
watchAsset: () => watchAsset
|
|
6689
|
+
});
|
|
6675
6690
|
function requestAccounts(swo, silentMode = false) {
|
|
6676
6691
|
return swo.request({
|
|
6677
6692
|
type: "wallet_requestAccounts",
|
|
@@ -7358,17 +7373,12 @@ var number = num_exports;
|
|
|
7358
7373
|
ValidateType,
|
|
7359
7374
|
WalletAccount,
|
|
7360
7375
|
addAddressPadding,
|
|
7361
|
-
addDeclareTransaction,
|
|
7362
|
-
addDeployAccountTransaction,
|
|
7363
|
-
addInvokeTransaction,
|
|
7364
|
-
addStarknetChain,
|
|
7365
7376
|
buildUrl,
|
|
7366
7377
|
byteArray,
|
|
7367
7378
|
cairo,
|
|
7368
7379
|
constants,
|
|
7369
7380
|
contractClassResponseToLegacyCompiledContract,
|
|
7370
7381
|
defaultProvider,
|
|
7371
|
-
deploymentData,
|
|
7372
7382
|
ec,
|
|
7373
7383
|
encode,
|
|
7374
7384
|
eth,
|
|
@@ -7378,7 +7388,6 @@ var number = num_exports;
|
|
|
7378
7388
|
fixStack,
|
|
7379
7389
|
getCalldata,
|
|
7380
7390
|
getChecksumAddress,
|
|
7381
|
-
getPermissions,
|
|
7382
7391
|
hash,
|
|
7383
7392
|
isSierra,
|
|
7384
7393
|
isUrl,
|
|
@@ -7386,20 +7395,13 @@ var number = num_exports;
|
|
|
7386
7395
|
merkle,
|
|
7387
7396
|
num,
|
|
7388
7397
|
number,
|
|
7389
|
-
onAccountChange,
|
|
7390
|
-
onNetworkChanged,
|
|
7391
7398
|
parseUDCEvent,
|
|
7392
7399
|
provider,
|
|
7393
|
-
requestAccounts,
|
|
7394
|
-
requestChainId,
|
|
7395
7400
|
selector,
|
|
7396
7401
|
shortString,
|
|
7397
|
-
signMessage,
|
|
7398
7402
|
splitArgsAndOptions,
|
|
7399
7403
|
stark,
|
|
7400
7404
|
starknetId,
|
|
7401
|
-
supportedSpecs,
|
|
7402
|
-
switchStarknetChain,
|
|
7403
7405
|
transaction,
|
|
7404
7406
|
typedData,
|
|
7405
7407
|
types,
|
|
@@ -7408,6 +7410,6 @@ var number = num_exports;
|
|
|
7408
7410
|
v3hash,
|
|
7409
7411
|
validateAndParseAddress,
|
|
7410
7412
|
validateChecksumAddress,
|
|
7411
|
-
|
|
7413
|
+
wallet
|
|
7412
7414
|
});
|
|
7413
7415
|
//# sourceMappingURL=index.js.map
|