@atomiqlabs/chain-starknet 5.1.6 → 5.1.7
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/dist/starknet/btcrelay/StarknetBtcRelay.js +2 -2
- package/dist/starknet/spv_swap/StarknetSpvVaultContract.js +3 -2
- package/dist/starknet/swaps/handlers/claim/HashlockClaimHandler.js +1 -1
- package/dist/starknet/swaps/handlers/claim/btc/BitcoinNoncedOutputClaimHandler.js +1 -1
- package/dist/starknet/swaps/handlers/claim/btc/BitcoinOutputClaimHandler.js +1 -1
- package/dist/starknet/swaps/handlers/claim/btc/BitcoinTxIdClaimHandler.js +1 -1
- package/dist/starknet/swaps/handlers/claim/btc/IBitcoinClaimHandler.js +1 -1
- package/package.json +1 -1
- package/src/starknet/btcrelay/StarknetBtcRelay.ts +2 -2
- package/src/starknet/spv_swap/StarknetSpvVaultContract.ts +6 -2
- package/src/starknet/swaps/handlers/claim/HashlockClaimHandler.ts +1 -1
- package/src/starknet/swaps/handlers/claim/btc/BitcoinNoncedOutputClaimHandler.ts +1 -1
- package/src/starknet/swaps/handlers/claim/btc/BitcoinOutputClaimHandler.ts +1 -1
- package/src/starknet/swaps/handlers/claim/btc/BitcoinTxIdClaimHandler.ts +1 -1
- package/src/starknet/swaps/handlers/claim/btc/IBitcoinClaimHandler.ts +1 -1
|
@@ -22,8 +22,8 @@ function serializeBlockHeader(e) {
|
|
|
22
22
|
hash: buffer_1.Buffer.from(e.getHash(), "hex").reverse()
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
-
const GAS_PER_BLOCKHEADER = { l1DataGas: 600, l2Gas:
|
|
26
|
-
const GAS_PER_BLOCKHEADER_FORK = { l1DataGas: 1000, l2Gas:
|
|
25
|
+
const GAS_PER_BLOCKHEADER = { l1DataGas: 600, l2Gas: 24000000, l1Gas: 0 };
|
|
26
|
+
const GAS_PER_BLOCKHEADER_FORK = { l1DataGas: 1000, l2Gas: 40000000, l1Gas: 0 };
|
|
27
27
|
const btcRelayAddreses = {
|
|
28
28
|
[base_1.BitcoinNetwork.TESTNET4]: "0x0099b63f39f0cabb767361de3d8d3e97212351a51540e2687c2571f4da490dbe",
|
|
29
29
|
[base_1.BitcoinNetwork.TESTNET]: "0x068601c79da2231d21e015ccfd59c243861156fa523a12c9f987ec28eb8dbc8c",
|
|
@@ -360,7 +360,7 @@ class StarknetSpvVaultContract extends StarknetContractBase_1.StarknetContractBa
|
|
|
360
360
|
}
|
|
361
361
|
async getClaimFee(signer, withdrawalData, feeRate) {
|
|
362
362
|
feeRate ?? (feeRate = await this.Chain.Fees.getFeeRate());
|
|
363
|
-
return StarknetFees_1.StarknetFees.getGasFee(StarknetSpvVaultContract.GasCosts.CLAIM, feeRate);
|
|
363
|
+
return StarknetFees_1.StarknetFees.getGasFee(withdrawalData == null ? StarknetSpvVaultContract.GasCosts.CLAIM_OPTIMISTIC_ESTIMATE : StarknetSpvVaultContract.GasCosts.CLAIM, feeRate);
|
|
364
364
|
}
|
|
365
365
|
async getFrontFee(signer, withdrawalData, feeRate) {
|
|
366
366
|
feeRate ?? (feeRate = await this.Chain.Fees.getFeeRate());
|
|
@@ -372,5 +372,6 @@ StarknetSpvVaultContract.GasCosts = {
|
|
|
372
372
|
DEPOSIT: { l1DataGas: 400, l2Gas: 4000000, l1Gas: 0 },
|
|
373
373
|
OPEN: { l1DataGas: 1200, l2Gas: 3200000, l1Gas: 0 },
|
|
374
374
|
FRONT: { l1DataGas: 800, l2Gas: 12000000, l1Gas: 0 },
|
|
375
|
-
CLAIM: { l1DataGas: 1000, l2Gas: 400000000, l1Gas: 0 }
|
|
375
|
+
CLAIM: { l1DataGas: 1000, l2Gas: 400000000, l1Gas: 0 },
|
|
376
|
+
CLAIM_OPTIMISTIC_ESTIMATE: { l1DataGas: 1000, l2Gas: 80000000, l1Gas: 0 } //If claimer uses sierra 1.7.0 or later
|
|
376
377
|
};
|
|
@@ -41,4 +41,4 @@ class HashlockClaimHandler {
|
|
|
41
41
|
}
|
|
42
42
|
exports.HashlockClaimHandler = HashlockClaimHandler;
|
|
43
43
|
HashlockClaimHandler.type = base_1.ChainSwapType.HTLC;
|
|
44
|
-
HashlockClaimHandler.gas = { l1DataGas: 0, l2Gas:
|
|
44
|
+
HashlockClaimHandler.gas = { l1DataGas: 0, l2Gas: 16000000, l1Gas: 0 };
|
|
@@ -45,4 +45,4 @@ class BitcoinNoncedOutputClaimHandler extends IBitcoinClaimHandler_1.IBitcoinCla
|
|
|
45
45
|
}
|
|
46
46
|
exports.BitcoinNoncedOutputClaimHandler = BitcoinNoncedOutputClaimHandler;
|
|
47
47
|
BitcoinNoncedOutputClaimHandler.type = base_1.ChainSwapType.CHAIN_NONCED;
|
|
48
|
-
BitcoinNoncedOutputClaimHandler.gas = { l1DataGas: 0, l2Gas:
|
|
48
|
+
BitcoinNoncedOutputClaimHandler.gas = { l1DataGas: 0, l2Gas: 10000 * 40000, l1Gas: 0 };
|
|
@@ -37,4 +37,4 @@ class BitcoinOutputClaimHandler extends IBitcoinClaimHandler_1.IBitcoinClaimHand
|
|
|
37
37
|
}
|
|
38
38
|
exports.BitcoinOutputClaimHandler = BitcoinOutputClaimHandler;
|
|
39
39
|
BitcoinOutputClaimHandler.type = base_1.ChainSwapType.CHAIN;
|
|
40
|
-
BitcoinOutputClaimHandler.gas = { l1DataGas: 0, l2Gas:
|
|
40
|
+
BitcoinOutputClaimHandler.gas = { l1DataGas: 0, l2Gas: 10000 * 40000, l1Gas: 0 };
|
|
@@ -27,4 +27,4 @@ class BitcoinTxIdClaimHandler extends IBitcoinClaimHandler_1.IBitcoinClaimHandle
|
|
|
27
27
|
}
|
|
28
28
|
exports.BitcoinTxIdClaimHandler = BitcoinTxIdClaimHandler;
|
|
29
29
|
BitcoinTxIdClaimHandler.type = base_1.ChainSwapType.CHAIN_TXID;
|
|
30
|
-
BitcoinTxIdClaimHandler.gas = { l1DataGas: 0, l2Gas:
|
|
30
|
+
BitcoinTxIdClaimHandler.gas = { l1DataGas: 0, l2Gas: 10000 * 40000, l1Gas: 0 };
|
|
@@ -49,4 +49,4 @@ class IBitcoinClaimHandler {
|
|
|
49
49
|
exports.IBitcoinClaimHandler = IBitcoinClaimHandler;
|
|
50
50
|
IBitcoinClaimHandler.address = "";
|
|
51
51
|
IBitcoinClaimHandler.type = base_1.ChainSwapType.CHAIN_TXID;
|
|
52
|
-
IBitcoinClaimHandler.gas = { l1DataGas: 0, l2Gas:
|
|
52
|
+
IBitcoinClaimHandler.gas = { l1DataGas: 0, l2Gas: 10000 * 40000, l1Gas: 0 };
|
package/package.json
CHANGED
|
@@ -29,8 +29,8 @@ function serializeBlockHeader(e: BtcBlock): StarknetBtcHeader {
|
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
const GAS_PER_BLOCKHEADER = {l1DataGas: 600, l2Gas:
|
|
33
|
-
const GAS_PER_BLOCKHEADER_FORK = {l1DataGas: 1000, l2Gas:
|
|
32
|
+
const GAS_PER_BLOCKHEADER = {l1DataGas: 600, l2Gas: 24_000_000, l1Gas: 0};
|
|
33
|
+
const GAS_PER_BLOCKHEADER_FORK = {l1DataGas: 1000, l2Gas: 40_000_000, l1Gas: 0};
|
|
34
34
|
|
|
35
35
|
const btcRelayAddreses = {
|
|
36
36
|
[BitcoinNetwork.TESTNET4]: "0x0099b63f39f0cabb767361de3d8d3e97212351a51540e2687c2571f4da490dbe",
|
|
@@ -54,7 +54,8 @@ export class StarknetSpvVaultContract
|
|
|
54
54
|
DEPOSIT: {l1DataGas: 400, l2Gas: 4_000_000, l1Gas: 0},
|
|
55
55
|
OPEN: {l1DataGas: 1200, l2Gas: 3_200_000, l1Gas: 0},
|
|
56
56
|
FRONT: {l1DataGas: 800, l2Gas: 12_000_000, l1Gas: 0},
|
|
57
|
-
CLAIM: {l1DataGas: 1000, l2Gas: 400_000_000, l1Gas: 0}
|
|
57
|
+
CLAIM: {l1DataGas: 1000, l2Gas: 400_000_000, l1Gas: 0},
|
|
58
|
+
CLAIM_OPTIMISTIC_ESTIMATE: {l1DataGas: 1000, l2Gas: 80_000_000, l1Gas: 0} //If claimer uses sierra 1.7.0 or later
|
|
58
59
|
};
|
|
59
60
|
|
|
60
61
|
readonly chainId = "STARKNET";
|
|
@@ -466,7 +467,10 @@ export class StarknetSpvVaultContract
|
|
|
466
467
|
|
|
467
468
|
async getClaimFee(signer: string, withdrawalData: StarknetSpvWithdrawalData, feeRate?: string): Promise<bigint> {
|
|
468
469
|
feeRate ??= await this.Chain.Fees.getFeeRate();
|
|
469
|
-
return StarknetFees.getGasFee(
|
|
470
|
+
return StarknetFees.getGasFee(
|
|
471
|
+
withdrawalData==null ? StarknetSpvVaultContract.GasCosts.CLAIM_OPTIMISTIC_ESTIMATE : StarknetSpvVaultContract.GasCosts.CLAIM,
|
|
472
|
+
feeRate
|
|
473
|
+
);
|
|
470
474
|
}
|
|
471
475
|
|
|
472
476
|
async getFrontFee(signer: string, withdrawalData: StarknetSpvWithdrawalData, feeRate?: string): Promise<bigint> {
|
|
@@ -12,7 +12,7 @@ export class HashlockClaimHandler implements IClaimHandler<Buffer, string> {
|
|
|
12
12
|
|
|
13
13
|
public readonly address: string;
|
|
14
14
|
public static readonly type: ChainSwapType = ChainSwapType.HTLC;
|
|
15
|
-
public static readonly gas: StarknetGas = {l1DataGas: 0, l2Gas:
|
|
15
|
+
public static readonly gas: StarknetGas = {l1DataGas: 0, l2Gas: 16_000_000, l1Gas: 0};
|
|
16
16
|
|
|
17
17
|
constructor(address: string) {
|
|
18
18
|
this.address = address;
|
|
@@ -27,7 +27,7 @@ function getTransactionNonce(btcTx: Transaction): bigint {
|
|
|
27
27
|
export class BitcoinNoncedOutputClaimHandler extends IBitcoinClaimHandler<BitcoinNoncedOutputCommitmentData, BitcoinOutputWitnessData> {
|
|
28
28
|
|
|
29
29
|
public static readonly type: ChainSwapType = ChainSwapType.CHAIN_NONCED;
|
|
30
|
-
public static readonly gas: StarknetGas = {l1DataGas: 0, l2Gas:
|
|
30
|
+
public static readonly gas: StarknetGas = {l1DataGas: 0, l2Gas: 10_000*40_000, l1Gas: 0};
|
|
31
31
|
|
|
32
32
|
protected serializeCommitment(data: BitcoinNoncedOutputCommitmentData & BitcoinCommitmentData): BigNumberish[] {
|
|
33
33
|
return [
|
|
@@ -22,7 +22,7 @@ const logger = getLogger("BitcoinOutputClaimHandler: ");
|
|
|
22
22
|
export class BitcoinOutputClaimHandler extends IBitcoinClaimHandler<BitcoinOutputCommitmentData, BitcoinOutputWitnessData> {
|
|
23
23
|
|
|
24
24
|
public static readonly type: ChainSwapType = ChainSwapType.CHAIN;
|
|
25
|
-
public static readonly gas: StarknetGas = {l1DataGas: 0, l2Gas:
|
|
25
|
+
public static readonly gas: StarknetGas = {l1DataGas: 0, l2Gas: 10_000 * 40_000, l1Gas: 0};
|
|
26
26
|
|
|
27
27
|
protected serializeCommitment(data: BitcoinOutputCommitmentData & BitcoinCommitmentData): BigNumberish[] {
|
|
28
28
|
return [
|
|
@@ -16,7 +16,7 @@ const logger = getLogger("BitcoinTxIdClaimHandler: ");
|
|
|
16
16
|
export class BitcoinTxIdClaimHandler extends IBitcoinClaimHandler<BitcoinTxIdCommitmentData, BitcoinWitnessData> {
|
|
17
17
|
|
|
18
18
|
public static readonly type: ChainSwapType = ChainSwapType.CHAIN_TXID;
|
|
19
|
-
public static readonly gas: StarknetGas = {l1DataGas: 0, l2Gas:
|
|
19
|
+
public static readonly gas: StarknetGas = {l1DataGas: 0, l2Gas: 10_000 * 40_000, l1Gas: 0};
|
|
20
20
|
|
|
21
21
|
protected serializeCommitment(data: BitcoinTxIdCommitmentData & BitcoinCommitmentData): BigNumberish[] {
|
|
22
22
|
return [
|
|
@@ -33,7 +33,7 @@ export abstract class IBitcoinClaimHandler<C, W extends BitcoinWitnessData> impl
|
|
|
33
33
|
|
|
34
34
|
public static readonly address = "";
|
|
35
35
|
public static readonly type: ChainSwapType = ChainSwapType.CHAIN_TXID;
|
|
36
|
-
public static readonly gas: StarknetGas = {l1DataGas: 0, l2Gas:
|
|
36
|
+
public static readonly gas: StarknetGas = {l1DataGas: 0, l2Gas: 10_000 * 40_000, l1Gas: 0};
|
|
37
37
|
|
|
38
38
|
protected serializeCommitment(data: BitcoinCommitmentData): BigNumberish[] {
|
|
39
39
|
return [
|