starknet 6.4.1 → 6.5.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 +16 -0
- package/dist/index.d.ts +18 -6
- package/dist/index.global.js +50 -27
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +50 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +50 -27
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -125,7 +125,8 @@ __export(constants_exports, {
|
|
|
125
125
|
TRANSACTION_VERSION: () => ETransactionVersion4,
|
|
126
126
|
TransactionHashPrefix: () => TransactionHashPrefix,
|
|
127
127
|
UDC: () => UDC,
|
|
128
|
-
ZERO: () => ZERO
|
|
128
|
+
ZERO: () => ZERO,
|
|
129
|
+
feeMarginPercentage: () => feeMarginPercentage
|
|
129
130
|
});
|
|
130
131
|
|
|
131
132
|
// src/types/api/index.ts
|
|
@@ -452,6 +453,12 @@ var TransactionHashPrefix = /* @__PURE__ */ ((TransactionHashPrefix2) => {
|
|
|
452
453
|
TransactionHashPrefix2["L1_HANDLER"] = "0x6c315f68616e646c6572";
|
|
453
454
|
return TransactionHashPrefix2;
|
|
454
455
|
})(TransactionHashPrefix || {});
|
|
456
|
+
var feeMarginPercentage = /* @__PURE__ */ ((feeMarginPercentage2) => {
|
|
457
|
+
feeMarginPercentage2[feeMarginPercentage2["L1_BOUND_MAX_AMOUNT"] = 50] = "L1_BOUND_MAX_AMOUNT";
|
|
458
|
+
feeMarginPercentage2[feeMarginPercentage2["L1_BOUND_MAX_PRICE_PER_UNIT"] = 50] = "L1_BOUND_MAX_PRICE_PER_UNIT";
|
|
459
|
+
feeMarginPercentage2[feeMarginPercentage2["MAX_FEE"] = 50] = "MAX_FEE";
|
|
460
|
+
return feeMarginPercentage2;
|
|
461
|
+
})(feeMarginPercentage || {});
|
|
455
462
|
var UDC = {
|
|
456
463
|
ADDRESS: "0x041a78e741e5af2fec34b695679bc6891742439f7afb8484ecd7766661ad02bf",
|
|
457
464
|
ENTRYPOINT: "deployContract"
|
|
@@ -2941,10 +2948,10 @@ function signatureToDecimalArray(sig) {
|
|
|
2941
2948
|
function signatureToHexArray(sig) {
|
|
2942
2949
|
return bigNumberishArrayToHexadecimalStringArray(formatSignature(sig));
|
|
2943
2950
|
}
|
|
2944
|
-
function estimatedFeeToMaxFee(estimatedFee, overhead =
|
|
2945
|
-
return addPercent(estimatedFee, overhead
|
|
2951
|
+
function estimatedFeeToMaxFee(estimatedFee, overhead = 50 /* MAX_FEE */) {
|
|
2952
|
+
return addPercent(estimatedFee, overhead);
|
|
2946
2953
|
}
|
|
2947
|
-
function estimateFeeToBounds(estimate, amountOverhead =
|
|
2954
|
+
function estimateFeeToBounds(estimate, amountOverhead = 50 /* L1_BOUND_MAX_AMOUNT */, priceOverhead = 50 /* L1_BOUND_MAX_PRICE_PER_UNIT */) {
|
|
2948
2955
|
if (typeof estimate === "bigint") {
|
|
2949
2956
|
return {
|
|
2950
2957
|
l2_gas: { max_amount: "0x0", max_price_per_unit: "0x0" },
|
|
@@ -2954,7 +2961,7 @@ function estimateFeeToBounds(estimate, amountOverhead = 10, priceOverhead = 50)
|
|
|
2954
2961
|
if (typeof estimate.gas_consumed === "undefined" || typeof estimate.gas_price === "undefined") {
|
|
2955
2962
|
throw Error("estimateFeeToBounds: estimate is undefined");
|
|
2956
2963
|
}
|
|
2957
|
-
const maxUnits = toHex(addPercent(estimate.gas_consumed, amountOverhead));
|
|
2964
|
+
const maxUnits = estimate.data_gas_consumed !== void 0 && estimate.data_gas_price !== void 0 ? toHex(addPercent(BigInt(estimate.overall_fee) / BigInt(estimate.gas_price), amountOverhead)) : toHex(addPercent(estimate.gas_consumed, amountOverhead));
|
|
2958
2965
|
const maxUnitPrice = toHex(addPercent(estimate.gas_price, priceOverhead));
|
|
2959
2966
|
return {
|
|
2960
2967
|
l2_gas: { max_amount: "0x0", max_price_per_unit: "0x0" },
|
|
@@ -4308,6 +4315,20 @@ var RpcChannel2 = class {
|
|
|
4308
4315
|
|
|
4309
4316
|
// src/utils/responseParser/rpc.ts
|
|
4310
4317
|
var RPCResponseParser = class {
|
|
4318
|
+
margin;
|
|
4319
|
+
constructor(margin) {
|
|
4320
|
+
this.margin = margin;
|
|
4321
|
+
}
|
|
4322
|
+
estimatedFeeToMaxFee(estimatedFee) {
|
|
4323
|
+
return estimatedFeeToMaxFee(estimatedFee, this.margin?.maxFee);
|
|
4324
|
+
}
|
|
4325
|
+
estimateFeeToBounds(estimate) {
|
|
4326
|
+
return estimateFeeToBounds(
|
|
4327
|
+
estimate,
|
|
4328
|
+
this.margin?.l1BoundMaxAmount,
|
|
4329
|
+
this.margin?.l1BoundMaxPricePerUnit
|
|
4330
|
+
);
|
|
4331
|
+
}
|
|
4311
4332
|
parseGetBlockResponse(res) {
|
|
4312
4333
|
return { status: "PENDING", ...res };
|
|
4313
4334
|
}
|
|
@@ -4330,8 +4351,8 @@ var RPCResponseParser = class {
|
|
|
4330
4351
|
gas_consumed: toBigInt(val.gas_consumed),
|
|
4331
4352
|
gas_price: toBigInt(val.gas_price),
|
|
4332
4353
|
unit: val.unit,
|
|
4333
|
-
suggestedMaxFee: estimatedFeeToMaxFee(val.overall_fee),
|
|
4334
|
-
resourceBounds: estimateFeeToBounds(val)
|
|
4354
|
+
suggestedMaxFee: this.estimatedFeeToMaxFee(val.overall_fee),
|
|
4355
|
+
resourceBounds: this.estimateFeeToBounds(val)
|
|
4335
4356
|
};
|
|
4336
4357
|
}
|
|
4337
4358
|
parseFeeEstimateBulkResponse(res) {
|
|
@@ -4340,16 +4361,16 @@ var RPCResponseParser = class {
|
|
|
4340
4361
|
gas_consumed: toBigInt(val.gas_consumed),
|
|
4341
4362
|
gas_price: toBigInt(val.gas_price),
|
|
4342
4363
|
unit: val.unit,
|
|
4343
|
-
suggestedMaxFee: estimatedFeeToMaxFee(val.overall_fee),
|
|
4344
|
-
resourceBounds: estimateFeeToBounds(val)
|
|
4364
|
+
suggestedMaxFee: this.estimatedFeeToMaxFee(val.overall_fee),
|
|
4365
|
+
resourceBounds: this.estimateFeeToBounds(val)
|
|
4345
4366
|
}));
|
|
4346
4367
|
}
|
|
4347
4368
|
parseSimulateTransactionResponse(res) {
|
|
4348
4369
|
return res.map((it) => {
|
|
4349
4370
|
return {
|
|
4350
4371
|
...it,
|
|
4351
|
-
suggestedMaxFee: estimatedFeeToMaxFee(
|
|
4352
|
-
resourceBounds: estimateFeeToBounds(it.fee_estimation)
|
|
4372
|
+
suggestedMaxFee: this.estimatedFeeToMaxFee(it.fee_estimation.overall_fee),
|
|
4373
|
+
resourceBounds: this.estimateFeeToBounds(it.fee_estimation)
|
|
4353
4374
|
};
|
|
4354
4375
|
});
|
|
4355
4376
|
}
|
|
@@ -4363,13 +4384,15 @@ var RPCResponseParser = class {
|
|
|
4363
4384
|
|
|
4364
4385
|
// src/provider/rpc.ts
|
|
4365
4386
|
var RpcProvider = class {
|
|
4366
|
-
responseParser
|
|
4387
|
+
responseParser;
|
|
4367
4388
|
channel;
|
|
4368
4389
|
constructor(optionsOrProvider) {
|
|
4369
4390
|
if (optionsOrProvider && "channel" in optionsOrProvider) {
|
|
4370
4391
|
this.channel = optionsOrProvider.channel;
|
|
4392
|
+
this.responseParser = optionsOrProvider.responseParser;
|
|
4371
4393
|
} else {
|
|
4372
4394
|
this.channel = new RpcChannel2({ ...optionsOrProvider, waitMode: false });
|
|
4395
|
+
this.responseParser = new RPCResponseParser(optionsOrProvider?.feeMarginPercentage);
|
|
4373
4396
|
}
|
|
4374
4397
|
}
|
|
4375
4398
|
fetch(method, params, id = 0) {
|
|
@@ -4462,7 +4485,7 @@ var RpcProvider = class {
|
|
|
4462
4485
|
* - skipFeeCharge (default true)<br/>
|
|
4463
4486
|
*/
|
|
4464
4487
|
async getSimulateTransaction(invocations, options) {
|
|
4465
|
-
return this.channel.simulateTransaction(invocations, options).then(this.responseParser.parseSimulateTransactionResponse);
|
|
4488
|
+
return this.channel.simulateTransaction(invocations, options).then((r) => this.responseParser.parseSimulateTransactionResponse(r));
|
|
4466
4489
|
}
|
|
4467
4490
|
async waitForTransaction(txHash, options) {
|
|
4468
4491
|
return this.channel.waitForTransaction(txHash, options);
|
|
@@ -4519,7 +4542,7 @@ var RpcProvider = class {
|
|
|
4519
4542
|
}
|
|
4520
4543
|
],
|
|
4521
4544
|
{ blockIdentifier, skipValidate }
|
|
4522
|
-
).then(this.responseParser.parseFeeEstimateResponse);
|
|
4545
|
+
).then((r) => this.responseParser.parseFeeEstimateResponse(r));
|
|
4523
4546
|
}
|
|
4524
4547
|
async getDeclareEstimateFee(invocation, details, blockIdentifier, skipValidate) {
|
|
4525
4548
|
return this.channel.getEstimateFee(
|
|
@@ -4531,7 +4554,7 @@ var RpcProvider = class {
|
|
|
4531
4554
|
}
|
|
4532
4555
|
],
|
|
4533
4556
|
{ blockIdentifier, skipValidate }
|
|
4534
|
-
).then(this.responseParser.parseFeeEstimateResponse);
|
|
4557
|
+
).then((r) => this.responseParser.parseFeeEstimateResponse(r));
|
|
4535
4558
|
}
|
|
4536
4559
|
async getDeployAccountEstimateFee(invocation, details, blockIdentifier, skipValidate) {
|
|
4537
4560
|
return this.channel.getEstimateFee(
|
|
@@ -4543,10 +4566,10 @@ var RpcProvider = class {
|
|
|
4543
4566
|
}
|
|
4544
4567
|
],
|
|
4545
4568
|
{ blockIdentifier, skipValidate }
|
|
4546
|
-
).then(this.responseParser.parseFeeEstimateResponse);
|
|
4569
|
+
).then((r) => this.responseParser.parseFeeEstimateResponse(r));
|
|
4547
4570
|
}
|
|
4548
4571
|
async getEstimateFeeBulk(invocations, options) {
|
|
4549
|
-
return this.channel.getEstimateFee(invocations, options).then(this.responseParser.parseFeeEstimateBulkResponse);
|
|
4572
|
+
return this.channel.getEstimateFee(invocations, options).then((r) => this.responseParser.parseFeeEstimateBulkResponse(r));
|
|
4550
4573
|
}
|
|
4551
4574
|
async invokeFunction(functionInvocation, details) {
|
|
4552
4575
|
return this.channel.invoke(functionInvocation, details);
|
|
@@ -4694,7 +4717,7 @@ function useEncoded(decoded) {
|
|
|
4694
4717
|
var StarknetIdContract = /* @__PURE__ */ ((StarknetIdContract2) => {
|
|
4695
4718
|
StarknetIdContract2["MAINNET"] = "0x6ac597f8116f886fa1c97a23fa4e08299975ecaf6b598873ca6792b9bbfb678";
|
|
4696
4719
|
StarknetIdContract2["TESTNET"] = "0x3bab268e932d2cecd1946f100ae67ce3dff9fd234119ea2f6da57d16d29fce";
|
|
4697
|
-
StarknetIdContract2["TESTNET_SEPOLIA"] = "
|
|
4720
|
+
StarknetIdContract2["TESTNET_SEPOLIA"] = "0x0707f09bc576bd7cfee59694846291047e965f4184fe13dac62c56759b3b6fa7";
|
|
4698
4721
|
return StarknetIdContract2;
|
|
4699
4722
|
})(StarknetIdContract || {});
|
|
4700
4723
|
function getStarknetIdContract(chainId) {
|
|
@@ -4704,7 +4727,7 @@ function getStarknetIdContract(chainId) {
|
|
|
4704
4727
|
case "0x534e5f474f45524c49" /* SN_GOERLI */:
|
|
4705
4728
|
return "0x3bab268e932d2cecd1946f100ae67ce3dff9fd234119ea2f6da57d16d29fce" /* TESTNET */;
|
|
4706
4729
|
case "0x534e5f5345504f4c4941" /* SN_SEPOLIA */:
|
|
4707
|
-
return "
|
|
4730
|
+
return "0x0707f09bc576bd7cfee59694846291047e965f4184fe13dac62c56759b3b6fa7" /* TESTNET_SEPOLIA */;
|
|
4708
4731
|
default:
|
|
4709
4732
|
throw new Error("Starknet.id is not yet deployed on this network");
|
|
4710
4733
|
}
|
|
@@ -4712,7 +4735,7 @@ function getStarknetIdContract(chainId) {
|
|
|
4712
4735
|
var StarknetIdIdentityContract = /* @__PURE__ */ ((StarknetIdIdentityContract2) => {
|
|
4713
4736
|
StarknetIdIdentityContract2["MAINNET"] = "0x05dbdedc203e92749e2e746e2d40a768d966bd243df04a6b712e222bc040a9af";
|
|
4714
4737
|
StarknetIdIdentityContract2["TESTNET"] = "0x783a9097b26eae0586373b2ce0ed3529ddc44069d1e0fbc4f66d42b69d6850d";
|
|
4715
|
-
StarknetIdIdentityContract2["TESTNET_SEPOLIA"] = "
|
|
4738
|
+
StarknetIdIdentityContract2["TESTNET_SEPOLIA"] = "0x070DF8B4F5cb2879f8592849fA8f3134da39d25326B8558cc9C8FE8D47EA3A90";
|
|
4716
4739
|
return StarknetIdIdentityContract2;
|
|
4717
4740
|
})(StarknetIdIdentityContract || {});
|
|
4718
4741
|
function getStarknetIdIdentityContract(chainId) {
|
|
@@ -4722,7 +4745,7 @@ function getStarknetIdIdentityContract(chainId) {
|
|
|
4722
4745
|
case "0x534e5f474f45524c49" /* SN_GOERLI */:
|
|
4723
4746
|
return "0x783a9097b26eae0586373b2ce0ed3529ddc44069d1e0fbc4f66d42b69d6850d" /* TESTNET */;
|
|
4724
4747
|
case "0x534e5f5345504f4c4941" /* SN_SEPOLIA */:
|
|
4725
|
-
return "
|
|
4748
|
+
return "0x070DF8B4F5cb2879f8592849fA8f3134da39d25326B8558cc9C8FE8D47EA3A90" /* TESTNET_SEPOLIA */;
|
|
4726
4749
|
default:
|
|
4727
4750
|
throw new Error("Starknet.id verifier contract is not yet deployed on this network");
|
|
4728
4751
|
}
|
|
@@ -4743,7 +4766,7 @@ function getStarknetIdMulticallContract(chainId) {
|
|
|
4743
4766
|
var StarknetIdVerifierContract = /* @__PURE__ */ ((StarknetIdVerifierContract2) => {
|
|
4744
4767
|
StarknetIdVerifierContract2["MAINNET"] = "0x07d14dfd8ee95b41fce179170d88ba1f0d5a512e13aeb232f19cfeec0a88f8bf";
|
|
4745
4768
|
StarknetIdVerifierContract2["TESTNET"] = "0x057c942544063c3aea6ea6c37009cc9d1beacd750cb6801549a129c7265f0f11";
|
|
4746
|
-
StarknetIdVerifierContract2["TESTNET_SEPOLIA"] = "
|
|
4769
|
+
StarknetIdVerifierContract2["TESTNET_SEPOLIA"] = "0x0182EcE8173C216A395f4828e1523541b7e3600bf190CB252E1a1A0cE219d184";
|
|
4747
4770
|
return StarknetIdVerifierContract2;
|
|
4748
4771
|
})(StarknetIdVerifierContract || {});
|
|
4749
4772
|
function getStarknetIdVerifierContract(chainId) {
|
|
@@ -4753,7 +4776,7 @@ function getStarknetIdVerifierContract(chainId) {
|
|
|
4753
4776
|
case "0x534e5f474f45524c49" /* SN_GOERLI */:
|
|
4754
4777
|
return "0x057c942544063c3aea6ea6c37009cc9d1beacd750cb6801549a129c7265f0f11" /* TESTNET */;
|
|
4755
4778
|
case "0x534e5f5345504f4c4941" /* SN_SEPOLIA */:
|
|
4756
|
-
return "
|
|
4779
|
+
return "0x0182EcE8173C216A395f4828e1523541b7e3600bf190CB252E1a1A0cE219d184" /* TESTNET_SEPOLIA */;
|
|
4757
4780
|
default:
|
|
4758
4781
|
throw new Error("Starknet.id verifier contract is not yet deployed on this network");
|
|
4759
4782
|
}
|
|
@@ -4761,7 +4784,7 @@ function getStarknetIdVerifierContract(chainId) {
|
|
|
4761
4784
|
var StarknetIdPfpContract = /* @__PURE__ */ ((StarknetIdPfpContract2) => {
|
|
4762
4785
|
StarknetIdPfpContract2["MAINNET"] = "0x070aaa20ec4a46da57c932d9fd89ca5e6bb9ca3188d3df361a32306aff7d59c7";
|
|
4763
4786
|
StarknetIdPfpContract2["TESTNET"] = "0x03cac3228b434259734ee0e4ff445f642206ea11adace7e4f45edd2596748698";
|
|
4764
|
-
StarknetIdPfpContract2["TESTNET_SEPOLIA"] = "
|
|
4787
|
+
StarknetIdPfpContract2["TESTNET_SEPOLIA"] = "0x058061bb6bdc501eE215172c9f87d557C1E0f466dC498cA81b18f998Bf1362b2";
|
|
4765
4788
|
return StarknetIdPfpContract2;
|
|
4766
4789
|
})(StarknetIdPfpContract || {});
|
|
4767
4790
|
function getStarknetIdPfpContract(chainId) {
|
|
@@ -4771,7 +4794,7 @@ function getStarknetIdPfpContract(chainId) {
|
|
|
4771
4794
|
case "0x534e5f474f45524c49" /* SN_GOERLI */:
|
|
4772
4795
|
return "0x03cac3228b434259734ee0e4ff445f642206ea11adace7e4f45edd2596748698" /* TESTNET */;
|
|
4773
4796
|
case "0x534e5f5345504f4c4941" /* SN_SEPOLIA */:
|
|
4774
|
-
return "
|
|
4797
|
+
return "0x058061bb6bdc501eE215172c9f87d557C1E0f466dC498cA81b18f998Bf1362b2" /* TESTNET_SEPOLIA */;
|
|
4775
4798
|
default:
|
|
4776
4799
|
throw new Error(
|
|
4777
4800
|
"Starknet.id profile picture verifier contract is not yet deployed on this network"
|
|
@@ -4781,7 +4804,7 @@ function getStarknetIdPfpContract(chainId) {
|
|
|
4781
4804
|
var StarknetIdPopContract = /* @__PURE__ */ ((StarknetIdPopContract2) => {
|
|
4782
4805
|
StarknetIdPopContract2["MAINNET"] = "0x0293eb2ba9862f762bd3036586d5755a782bd22e6f5028320f1d0405fd47bff4";
|
|
4783
4806
|
StarknetIdPopContract2["TESTNET"] = "0x03528caf090179e337931ee669a5b0214041e1bae30d460ff07d2cea2c7a9106";
|
|
4784
|
-
StarknetIdPopContract2["TESTNET_SEPOLIA"] = "
|
|
4807
|
+
StarknetIdPopContract2["TESTNET_SEPOLIA"] = "0x0023FE3b845ed5665a9eb3792bbB17347B490EE4090f855C1298d03BB5F49B49";
|
|
4785
4808
|
return StarknetIdPopContract2;
|
|
4786
4809
|
})(StarknetIdPopContract || {});
|
|
4787
4810
|
function getStarknetIdPopContract(chainId) {
|
|
@@ -4791,7 +4814,7 @@ function getStarknetIdPopContract(chainId) {
|
|
|
4791
4814
|
case "0x534e5f474f45524c49" /* SN_GOERLI */:
|
|
4792
4815
|
return "0x03528caf090179e337931ee669a5b0214041e1bae30d460ff07d2cea2c7a9106" /* TESTNET */;
|
|
4793
4816
|
case "0x534e5f5345504f4c4941" /* SN_SEPOLIA */:
|
|
4794
|
-
return "
|
|
4817
|
+
return "0x0023FE3b845ed5665a9eb3792bbB17347B490EE4090f855C1298d03BB5F49B49" /* TESTNET_SEPOLIA */;
|
|
4795
4818
|
default:
|
|
4796
4819
|
throw new Error(
|
|
4797
4820
|
"Starknet.id proof of personhood verifier contract is not yet deployed on this network"
|