@atomiqlabs/chain-evm 1.0.0-dev.87 → 1.0.0-dev.89
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/chains/botanix/BotanixChainType.d.ts +1 -1
- package/dist/chains/botanix/BotanixInitializer.js +12 -12
- package/dist/chains/citrea/CitreaChainType.d.ts +1 -1
- package/dist/evm/btcrelay/EVMBtcRelay.d.ts +1 -1
- package/dist/evm/chain/EVMChainInterface.d.ts +3 -3
- package/dist/evm/chain/EVMModule.d.ts +3 -3
- package/dist/evm/swaps/EVMSwapContract.d.ts +1 -1
- package/dist/evm/swaps/modules/EVMSwapClaim.d.ts +1 -1
- package/package.json +2 -2
- package/src/chains/botanix/BotanixChainType.ts +1 -1
- package/src/chains/botanix/BotanixInitializer.ts +12 -12
- package/src/chains/citrea/CitreaChainType.ts +1 -1
- package/src/evm/btcrelay/EVMBtcRelay.ts +1 -1
- package/src/evm/chain/EVMChainInterface.ts +3 -3
- package/src/evm/chain/EVMModule.ts +3 -3
- package/src/evm/swaps/EVMSwapContract.ts +1 -1
- package/src/evm/swaps/modules/EVMSwapClaim.ts +1 -1
|
@@ -10,4 +10,4 @@ import { EVMSpvWithdrawalData } from "../../evm/spv_swap/EVMSpvWithdrawalData";
|
|
|
10
10
|
import { EVMSwapContract } from "../../evm/swaps/EVMSwapContract";
|
|
11
11
|
import { EVMBtcRelay } from "../../evm/btcrelay/EVMBtcRelay";
|
|
12
12
|
import { EVMSpvVaultContract } from "../../evm/spv_swap/EVMSpvVaultContract";
|
|
13
|
-
export type BotanixChainType = ChainType<"BOTANIX", never, EVMPreFetchVerification, EVMTx, EVMSigner, EVMSwapData, EVMSwapContract<"BOTANIX">, EVMChainInterface<"BOTANIX"
|
|
13
|
+
export type BotanixChainType = ChainType<"BOTANIX", never, EVMPreFetchVerification, EVMTx, EVMSigner, EVMSwapData, EVMSwapContract<"BOTANIX">, EVMChainInterface<"BOTANIX">, EVMChainEventsBrowser, EVMBtcRelay<any>, EVMSpvVaultData, EVMSpvWithdrawalData, EVMSpvVaultContract<"BOTANIX">>;
|
|
@@ -13,26 +13,26 @@ const EVMSwapData_1 = require("../../evm/swaps/EVMSwapData");
|
|
|
13
13
|
const EVMSpvVaultData_1 = require("../../evm/spv_swap/EVMSpvVaultData");
|
|
14
14
|
const EVMSpvWithdrawalData_1 = require("../../evm/spv_swap/EVMSpvWithdrawalData");
|
|
15
15
|
const BotanixChainIds = {
|
|
16
|
-
MAINNET:
|
|
16
|
+
MAINNET: 3637,
|
|
17
17
|
TESTNET: 3636
|
|
18
18
|
};
|
|
19
19
|
const BotanixContractAddresses = {
|
|
20
20
|
MAINNET: {
|
|
21
|
-
executionContract: "",
|
|
22
|
-
swapContract: "",
|
|
23
|
-
btcRelayContract: "",
|
|
24
|
-
btcRelayDeploymentHeight:
|
|
25
|
-
spvVaultContract: "",
|
|
26
|
-
spvVaultDeploymentHeight:
|
|
21
|
+
executionContract: "0x5bb0C725939cB825d1322A99a3FeB570097628c3",
|
|
22
|
+
swapContract: "0x8A44f1995a54fD976c904Cccf9EbaB49c3182eb3",
|
|
23
|
+
btcRelayContract: "0x6a373b6Adad83964727bA0fa15E22Be05173fc12",
|
|
24
|
+
btcRelayDeploymentHeight: 1791247,
|
|
25
|
+
spvVaultContract: "0xc98Ef084d3911C8447DBbE4dDa18bC2c9bB0584e",
|
|
26
|
+
spvVaultDeploymentHeight: 1791249,
|
|
27
27
|
handlerContracts: {
|
|
28
28
|
refund: {
|
|
29
|
-
timelock: ""
|
|
29
|
+
timelock: "0x3887B02217726bB36958Dd595e57293fB63D5082"
|
|
30
30
|
},
|
|
31
31
|
claim: {
|
|
32
|
-
[base_1.ChainSwapType.HTLC]: "",
|
|
33
|
-
[base_1.ChainSwapType.CHAIN_TXID]: "",
|
|
34
|
-
[base_1.ChainSwapType.CHAIN]: "",
|
|
35
|
-
[base_1.ChainSwapType.CHAIN_NONCED]: ""
|
|
32
|
+
[base_1.ChainSwapType.HTLC]: "0x59A54378B6bA9C21ba66487C6A701D702baDEabE",
|
|
33
|
+
[base_1.ChainSwapType.CHAIN_TXID]: "0x32EB4DbDdC31e19ba908fecc7cae03F0d04F01Fa",
|
|
34
|
+
[base_1.ChainSwapType.CHAIN]: "0xaB2D14745362B26a732dD8B7F95daAE3D2914bBF",
|
|
35
|
+
[base_1.ChainSwapType.CHAIN_NONCED]: "0x2920EE496693A5027249a027A6FD3F643E743745"
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
},
|
|
@@ -10,4 +10,4 @@ import { EVMSpvWithdrawalData } from "../../evm/spv_swap/EVMSpvWithdrawalData";
|
|
|
10
10
|
import { CitreaSwapContract } from "./CitreaSwapContract";
|
|
11
11
|
import { CitreaBtcRelay } from "./CitreaBtcRelay";
|
|
12
12
|
import { CitreaSpvVaultContract } from "./CitreaSpvVaultContract";
|
|
13
|
-
export type CitreaChainType = ChainType<"CITREA", never, EVMPreFetchVerification, EVMTx, EVMSigner, EVMSwapData, CitreaSwapContract, EVMChainInterface<"CITREA"
|
|
13
|
+
export type CitreaChainType = ChainType<"CITREA", never, EVMPreFetchVerification, EVMTx, EVMSigner, EVMSwapData, CitreaSwapContract, EVMChainInterface<"CITREA">, EVMChainEventsBrowser, CitreaBtcRelay<any>, EVMSpvVaultData, EVMSpvWithdrawalData, CitreaSpvVaultContract>;
|
|
@@ -72,7 +72,7 @@ export declare class EVMBtcRelay<B extends BtcBlock> extends EVMContractBase<Btc
|
|
|
72
72
|
}, requiredBlockheight?: number): Promise<{
|
|
73
73
|
header: EVMBtcStoredHeader;
|
|
74
74
|
height: number;
|
|
75
|
-
}
|
|
75
|
+
}>;
|
|
76
76
|
/**
|
|
77
77
|
* Retrieves blockheader data by blockheader's commit hash,
|
|
78
78
|
*
|
|
@@ -17,11 +17,11 @@ export type EVMConfiguration = {
|
|
|
17
17
|
safeBlockTag: EVMBlockTag;
|
|
18
18
|
maxLogsBlockRange: number;
|
|
19
19
|
};
|
|
20
|
-
export declare class EVMChainInterface<ChainId extends string = string
|
|
20
|
+
export declare class EVMChainInterface<ChainId extends string = string> implements ChainInterface {
|
|
21
21
|
readonly chainId: ChainId;
|
|
22
22
|
readonly provider: JsonRpcApiProvider;
|
|
23
23
|
readonly retryPolicy: EVMRetryPolicy;
|
|
24
|
-
readonly evmChainId:
|
|
24
|
+
readonly evmChainId: number;
|
|
25
25
|
readonly config: EVMConfiguration;
|
|
26
26
|
Fees: EVMFees;
|
|
27
27
|
Tokens: EVMTokens;
|
|
@@ -30,7 +30,7 @@ export declare class EVMChainInterface<ChainId extends string = string, EVMChain
|
|
|
30
30
|
Events: EVMEvents;
|
|
31
31
|
Blocks: EVMBlocks;
|
|
32
32
|
protected logger: LoggerType;
|
|
33
|
-
constructor(chainId: ChainId, evmChainId:
|
|
33
|
+
constructor(chainId: ChainId, evmChainId: number, provider: JsonRpcApiProvider, config: EVMConfiguration, retryPolicy?: EVMRetryPolicy, evmFeeEstimator?: EVMFees);
|
|
34
34
|
getBalance(signer: string, tokenAddress: string): Promise<bigint>;
|
|
35
35
|
getNativeCurrencyAddress(): string;
|
|
36
36
|
isValidToken(tokenIdentifier: string): boolean;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { JsonRpcApiProvider } from "ethers";
|
|
2
2
|
import { EVMChainInterface, EVMRetryPolicy } from "./EVMChainInterface";
|
|
3
|
-
export declare class EVMModule<ChainId extends string = string
|
|
3
|
+
export declare class EVMModule<ChainId extends string = string> {
|
|
4
4
|
protected readonly provider: JsonRpcApiProvider;
|
|
5
5
|
protected readonly retryPolicy: EVMRetryPolicy;
|
|
6
|
-
protected readonly root: EVMChainInterface<ChainId
|
|
6
|
+
protected readonly root: EVMChainInterface<ChainId>;
|
|
7
7
|
protected readonly logger: import("../../utils/Utils").LoggerType;
|
|
8
|
-
constructor(root: EVMChainInterface<ChainId
|
|
8
|
+
constructor(root: EVMChainInterface<ChainId>);
|
|
9
9
|
}
|
|
@@ -150,7 +150,7 @@ export declare class EVMSwapContract<ChainId extends string = string> extends EV
|
|
|
150
150
|
txid: string;
|
|
151
151
|
hex: string;
|
|
152
152
|
height: number;
|
|
153
|
-
}, requiredConfirmations: number, vout: number, commitedHeader?: EVMBtcStoredHeader, synchronizer?: RelaySynchronizer<EVMBtcStoredHeader, EVMTx, any>, initAta?: boolean, feeRate?: string): Promise<EVMTx[]
|
|
153
|
+
}, requiredConfirmations: number, vout: number, commitedHeader?: EVMBtcStoredHeader, synchronizer?: RelaySynchronizer<EVMBtcStoredHeader, EVMTx, any>, initAta?: boolean, feeRate?: string): Promise<EVMTx[]>;
|
|
154
154
|
txsRefund(signer: string, swapData: EVMSwapData, check?: boolean, initAta?: boolean, feeRate?: string): Promise<EVMTx[]>;
|
|
155
155
|
txsRefundWithAuthorization(signer: string, swapData: EVMSwapData, { timeout, prefix, signature }: {
|
|
156
156
|
timeout: any;
|
|
@@ -45,7 +45,7 @@ export declare class EVMSwapClaim extends EVMSwapModule {
|
|
|
45
45
|
txid: string;
|
|
46
46
|
hex: string;
|
|
47
47
|
height: number;
|
|
48
|
-
}, requiredConfirmations: number, vout: number, commitedHeader?: EVMBtcStoredHeader, synchronizer?: RelaySynchronizer<EVMBtcStoredHeader, EVMTx, any>, feeRate?: string): Promise<EVMTx[]
|
|
48
|
+
}, requiredConfirmations: number, vout: number, commitedHeader?: EVMBtcStoredHeader, synchronizer?: RelaySynchronizer<EVMBtcStoredHeader, EVMTx, any>, feeRate?: string): Promise<EVMTx[]>;
|
|
49
49
|
getClaimGas(swapData: EVMSwapData): number;
|
|
50
50
|
/**
|
|
51
51
|
* Get the estimated starknet transaction fee of the claim transaction
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atomiqlabs/chain-evm",
|
|
3
|
-
"version": "1.0.0-dev.
|
|
3
|
+
"version": "1.0.0-dev.89",
|
|
4
4
|
"description": "EVM specific base implementation",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types:": "./dist/index.d.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@atomiqlabs/base": "^10.0.0-dev.10",
|
|
27
27
|
"@noble/hashes": "^1.8.0",
|
|
28
|
-
"@scure/btc-signer": "1.6.0",
|
|
28
|
+
"@scure/btc-signer": "^1.6.0",
|
|
29
29
|
"buffer": "6.0.3",
|
|
30
30
|
"promise-cache-ts": "0.0.7",
|
|
31
31
|
"promise-queue-ts": "1.0.0"
|
|
@@ -12,27 +12,27 @@ import {EVMSpvWithdrawalData} from "../../evm/spv_swap/EVMSpvWithdrawalData";
|
|
|
12
12
|
import {BotanixChainType} from "./BotanixChainType";
|
|
13
13
|
|
|
14
14
|
const BotanixChainIds = {
|
|
15
|
-
MAINNET:
|
|
15
|
+
MAINNET: 3637,
|
|
16
16
|
TESTNET: 3636
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
const BotanixContractAddresses = {
|
|
20
20
|
MAINNET: {
|
|
21
|
-
executionContract: "",
|
|
22
|
-
swapContract: "",
|
|
23
|
-
btcRelayContract: "",
|
|
24
|
-
btcRelayDeploymentHeight:
|
|
25
|
-
spvVaultContract: "",
|
|
26
|
-
spvVaultDeploymentHeight:
|
|
21
|
+
executionContract: "0x5bb0C725939cB825d1322A99a3FeB570097628c3",
|
|
22
|
+
swapContract: "0x8A44f1995a54fD976c904Cccf9EbaB49c3182eb3",
|
|
23
|
+
btcRelayContract: "0x6a373b6Adad83964727bA0fa15E22Be05173fc12",
|
|
24
|
+
btcRelayDeploymentHeight: 1791247,
|
|
25
|
+
spvVaultContract: "0xc98Ef084d3911C8447DBbE4dDa18bC2c9bB0584e",
|
|
26
|
+
spvVaultDeploymentHeight: 1791249,
|
|
27
27
|
handlerContracts: {
|
|
28
28
|
refund: {
|
|
29
|
-
timelock: ""
|
|
29
|
+
timelock: "0x3887B02217726bB36958Dd595e57293fB63D5082"
|
|
30
30
|
},
|
|
31
31
|
claim: {
|
|
32
|
-
[ChainSwapType.HTLC]: "",
|
|
33
|
-
[ChainSwapType.CHAIN_TXID]: "",
|
|
34
|
-
[ChainSwapType.CHAIN]: "",
|
|
35
|
-
[ChainSwapType.CHAIN_NONCED]: ""
|
|
32
|
+
[ChainSwapType.HTLC]: "0x59A54378B6bA9C21ba66487C6A701D702baDEabE",
|
|
33
|
+
[ChainSwapType.CHAIN_TXID]: "0x32EB4DbDdC31e19ba908fecc7cae03F0d04F01Fa",
|
|
34
|
+
[ChainSwapType.CHAIN]: "0xaB2D14745362B26a732dD8B7F95daAE3D2914bBF",
|
|
35
|
+
[ChainSwapType.CHAIN_NONCED]: "0x2920EE496693A5027249a027A6FD3F643E743745"
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
},
|
|
@@ -255,7 +255,7 @@ export class EVMBtcRelay<B extends BtcBlock>
|
|
|
255
255
|
public async retrieveLogAndBlockheight(blockData: {blockhash: string}, requiredBlockheight?: number): Promise<{
|
|
256
256
|
header: EVMBtcStoredHeader,
|
|
257
257
|
height: number
|
|
258
|
-
}
|
|
258
|
+
}> {
|
|
259
259
|
//TODO: we can fetch the blockheight and events in parallel
|
|
260
260
|
const blockHeight = await this.getBlockHeight();
|
|
261
261
|
if(requiredBlockheight!=null && blockHeight < requiredBlockheight) {
|
|
@@ -21,14 +21,14 @@ export type EVMConfiguration = {
|
|
|
21
21
|
maxLogsBlockRange: number
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
export class EVMChainInterface<ChainId extends string = string
|
|
24
|
+
export class EVMChainInterface<ChainId extends string = string> implements ChainInterface {
|
|
25
25
|
|
|
26
26
|
readonly chainId: ChainId;
|
|
27
27
|
|
|
28
28
|
readonly provider: JsonRpcApiProvider;
|
|
29
29
|
readonly retryPolicy: EVMRetryPolicy;
|
|
30
30
|
|
|
31
|
-
public readonly evmChainId:
|
|
31
|
+
public readonly evmChainId: number;
|
|
32
32
|
|
|
33
33
|
public readonly config: EVMConfiguration;
|
|
34
34
|
|
|
@@ -43,7 +43,7 @@ export class EVMChainInterface<ChainId extends string = string, EVMChainId exten
|
|
|
43
43
|
|
|
44
44
|
constructor(
|
|
45
45
|
chainId: ChainId,
|
|
46
|
-
evmChainId:
|
|
46
|
+
evmChainId: number,
|
|
47
47
|
provider: JsonRpcApiProvider,
|
|
48
48
|
config: EVMConfiguration,
|
|
49
49
|
retryPolicy?: EVMRetryPolicy,
|
|
@@ -2,16 +2,16 @@ import {getLogger} from "../../utils/Utils";
|
|
|
2
2
|
import {JsonRpcApiProvider} from "ethers";
|
|
3
3
|
import {EVMChainInterface, EVMRetryPolicy} from "./EVMChainInterface";
|
|
4
4
|
|
|
5
|
-
export class EVMModule<ChainId extends string = string
|
|
5
|
+
export class EVMModule<ChainId extends string = string> {
|
|
6
6
|
|
|
7
7
|
protected readonly provider: JsonRpcApiProvider;
|
|
8
8
|
protected readonly retryPolicy: EVMRetryPolicy;
|
|
9
|
-
protected readonly root: EVMChainInterface<ChainId
|
|
9
|
+
protected readonly root: EVMChainInterface<ChainId>;
|
|
10
10
|
|
|
11
11
|
protected readonly logger = getLogger(this.constructor.name+": ");
|
|
12
12
|
|
|
13
13
|
constructor(
|
|
14
|
-
root: EVMChainInterface<ChainId
|
|
14
|
+
root: EVMChainInterface<ChainId>
|
|
15
15
|
) {
|
|
16
16
|
this.provider = root.provider;
|
|
17
17
|
this.retryPolicy = root.retryPolicy;
|
|
@@ -420,7 +420,7 @@ export class EVMSwapContract<ChainId extends string = string>
|
|
|
420
420
|
synchronizer?: RelaySynchronizer<EVMBtcStoredHeader, EVMTx, any>,
|
|
421
421
|
initAta?: boolean,
|
|
422
422
|
feeRate?: string
|
|
423
|
-
): Promise<EVMTx[]
|
|
423
|
+
): Promise<EVMTx[]> {
|
|
424
424
|
return this.Claim.txsClaimWithTxData(
|
|
425
425
|
typeof(signer)==="string" ? signer : signer.getAddress(),
|
|
426
426
|
swapData,
|
|
@@ -102,7 +102,7 @@ export class EVMSwapClaim extends EVMSwapModule {
|
|
|
102
102
|
commitedHeader?: EVMBtcStoredHeader,
|
|
103
103
|
synchronizer?: RelaySynchronizer<EVMBtcStoredHeader, EVMTx, any>,
|
|
104
104
|
feeRate?: string
|
|
105
|
-
): Promise<EVMTx[]
|
|
105
|
+
): Promise<EVMTx[]> {
|
|
106
106
|
const claimHandler: IClaimHandler<any, BitcoinOutputWitnessData | BitcoinWitnessData> = this.contract.claimHandlersByAddress[swapData.claimHandler.toLowerCase()];
|
|
107
107
|
if(claimHandler==null) throw new SwapDataVerificationError("Unknown claim handler!");
|
|
108
108
|
if(
|