@atomiqlabs/chain-starknet 7.0.10 → 7.0.11
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/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/starknet/StarknetInitializer.js +2 -1
- package/dist/starknet/provider/WebSocketChannelWithRetries.d.ts +7 -0
- package/dist/starknet/provider/WebSocketChannelWithRetries.js +14 -0
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/starknet/StarknetInitializer.ts +2 -1
- package/src/starknet/provider/WebSocketChannelWithRetries.ts +13 -0
package/dist/index.d.ts
CHANGED
|
@@ -37,3 +37,4 @@ export * from "./starknet/spv_swap/StarknetSpvVaultContract";
|
|
|
37
37
|
export * from "./starknet/spv_swap/StarknetSpvVaultData";
|
|
38
38
|
export * from "./starknet/spv_swap/StarknetSpvWithdrawalData";
|
|
39
39
|
export * from "./starknet/provider/RpcProviderWithRetries";
|
|
40
|
+
export * from "./starknet/provider/WebSocketChannelWithRetries";
|
package/dist/index.js
CHANGED
|
@@ -56,3 +56,4 @@ __exportStar(require("./starknet/spv_swap/StarknetSpvVaultContract"), exports);
|
|
|
56
56
|
__exportStar(require("./starknet/spv_swap/StarknetSpvVaultData"), exports);
|
|
57
57
|
__exportStar(require("./starknet/spv_swap/StarknetSpvWithdrawalData"), exports);
|
|
58
58
|
__exportStar(require("./starknet/provider/RpcProviderWithRetries"), exports);
|
|
59
|
+
__exportStar(require("./starknet/provider/WebSocketChannelWithRetries"), exports);
|
|
@@ -13,6 +13,7 @@ const StarknetSpvVaultContract_1 = require("./spv_swap/StarknetSpvVaultContract"
|
|
|
13
13
|
const StarknetSpvVaultData_1 = require("./spv_swap/StarknetSpvVaultData");
|
|
14
14
|
const StarknetSpvWithdrawalData_1 = require("./spv_swap/StarknetSpvWithdrawalData");
|
|
15
15
|
const RpcProviderWithRetries_1 = require("./provider/RpcProviderWithRetries");
|
|
16
|
+
const WebSocketChannelWithRetries_1 = require("./provider/WebSocketChannelWithRetries");
|
|
16
17
|
exports.StarknetAssets = {
|
|
17
18
|
ETH: {
|
|
18
19
|
address: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
|
|
@@ -45,7 +46,7 @@ function initializeStarknet(options, bitcoinRpc, network) {
|
|
|
45
46
|
let wsChannel;
|
|
46
47
|
if (options.wsUrl != null)
|
|
47
48
|
wsChannel = typeof (options.wsUrl) === "string" ?
|
|
48
|
-
new
|
|
49
|
+
new WebSocketChannelWithRetries_1.WebSocketChannelWithRetries({ nodeUrl: options.wsUrl, reconnectOptions: { delay: 2000, retries: Infinity } }) :
|
|
49
50
|
options.wsUrl;
|
|
50
51
|
const Fees = options.fees ?? new StarknetFees_1.StarknetFees(provider);
|
|
51
52
|
const chainId = options.chainId ??
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WebSocketChannelWithRetries = void 0;
|
|
4
|
+
const starknet_1 = require("starknet");
|
|
5
|
+
/**
|
|
6
|
+
* An impl of WebSocketChannel which override the default exponential backoff and makes it linear
|
|
7
|
+
*/
|
|
8
|
+
class WebSocketChannelWithRetries extends starknet_1.WebSocketChannel {
|
|
9
|
+
reconnect() {
|
|
10
|
+
this.reconnectAttempts = 1;
|
|
11
|
+
super.reconnect();
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.WebSocketChannelWithRetries = WebSocketChannelWithRetries;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -11,6 +11,7 @@ import {StarknetSpvVaultContract} from "./spv_swap/StarknetSpvVaultContract";
|
|
|
11
11
|
import {StarknetSpvVaultData} from "./spv_swap/StarknetSpvVaultData";
|
|
12
12
|
import {StarknetSpvWithdrawalData} from "./spv_swap/StarknetSpvWithdrawalData";
|
|
13
13
|
import {RpcProviderWithRetries} from "./provider/RpcProviderWithRetries";
|
|
14
|
+
import {WebSocketChannelWithRetries} from "./provider/WebSocketChannelWithRetries";
|
|
14
15
|
|
|
15
16
|
export type StarknetAssetsType = BaseTokenType<"ETH" | "STRK" | "WBTC" | "TBTC" | "_TESTNET_WBTC_VESU">;
|
|
16
17
|
export const StarknetAssets: StarknetAssetsType = {
|
|
@@ -72,7 +73,7 @@ export function initializeStarknet(
|
|
|
72
73
|
options.rpcUrl;
|
|
73
74
|
let wsChannel: WebSocketChannel;
|
|
74
75
|
if(options.wsUrl!=null) wsChannel = typeof(options.wsUrl)==="string" ?
|
|
75
|
-
new
|
|
76
|
+
new WebSocketChannelWithRetries({nodeUrl: options.wsUrl, reconnectOptions: {delay: 2000, retries: Infinity}}) :
|
|
76
77
|
options.wsUrl;
|
|
77
78
|
|
|
78
79
|
const Fees = options.fees ?? new StarknetFees(provider);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {WebSocketChannel} from "starknet";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* An impl of WebSocketChannel which override the default exponential backoff and makes it linear
|
|
5
|
+
*/
|
|
6
|
+
export class WebSocketChannelWithRetries extends WebSocketChannel {
|
|
7
|
+
|
|
8
|
+
reconnect() {
|
|
9
|
+
(this as any).reconnectAttempts = 1;
|
|
10
|
+
super.reconnect();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
}
|