@atomiqlabs/chain-starknet 7.0.23 → 7.0.25

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.
@@ -3,7 +3,7 @@ import { StarknetFees } from "./chain/modules/StarknetFees";
3
3
  import { StarknetConfig, StarknetRetryPolicy } from "./chain/StarknetChainInterface";
4
4
  import { BaseTokenType, BitcoinNetwork, BitcoinRpc, ChainData, ChainInitializer, ChainSwapType } from "@atomiqlabs/base";
5
5
  import { StarknetChainType } from "./StarknetChainType";
6
- export type StarknetAssetsType = BaseTokenType<"ETH" | "STRK" | "WBTC" | "TBTC" | "_TESTNET_WBTC_VESU">;
6
+ export type StarknetAssetsType = BaseTokenType<"ETH" | "STRK" | "WBTC" | "TBTC" | "USDC" | "USDT" | "_TESTNET_WBTC_VESU">;
7
7
  export declare const StarknetAssets: StarknetAssetsType;
8
8
  export type StarknetOptions = {
9
9
  rpcUrl: string | Provider;
@@ -30,10 +30,18 @@ exports.StarknetAssets = {
30
30
  decimals: 8
31
31
  },
32
32
  TBTC: {
33
- address: "0x04daa17763b286d1e59b97c283C0b8C949994C361e426A28F743c67bDfE9a32f",
33
+ address: "0x04daa17763b286d1e59b97c283c0b8c949994c361e426a28f743c67bdfe9a32f",
34
34
  decimals: 18,
35
35
  displayDecimals: 8
36
36
  },
37
+ USDC: {
38
+ address: "0x033068f6539f8e6e6b131e6b2b814e6c34a5224bc66947c47dab9dfee93b35fb",
39
+ decimals: 6
40
+ },
41
+ USDT: {
42
+ address: "0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8",
43
+ decimals: 6
44
+ },
37
45
  _TESTNET_WBTC_VESU: {
38
46
  address: "0x04861ba938aed21f2cd7740acd3765ac4d2974783a3218367233de0153490cb6",
39
47
  decimals: 8
@@ -21,6 +21,8 @@ class StarknetChainEvents extends StarknetChainEventsBrowser_1.StarknetChainEven
21
21
  const arr = txt.split(",");
22
22
  if (arr.length < 2) {
23
23
  const blockNumber = parseInt(arr[0].split(";")[0]);
24
+ if (isNaN(blockNumber))
25
+ throw new Error("Cannot parse the integer, is NaN!");
24
26
  return [
25
27
  { lastBlockNumber: blockNumber, lastTxHash: null },
26
28
  { lastBlockNumber: blockNumber, lastTxHash: null }
@@ -28,7 +30,10 @@ class StarknetChainEvents extends StarknetChainEventsBrowser_1.StarknetChainEven
28
30
  }
29
31
  return arr.map(arrValue => {
30
32
  const subArray = arrValue.split(";");
31
- return { lastBlockNumber: parseInt(subArray[0]), lastTxHash: subArray[1] };
33
+ const lastBlockNumber = parseInt(subArray[0]);
34
+ if (isNaN(lastBlockNumber))
35
+ throw new Error("Cannot parse the integer, is NaN!");
36
+ return { lastBlockNumber, lastTxHash: subArray[1] };
32
37
  });
33
38
  }
34
39
  catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atomiqlabs/chain-starknet",
3
- "version": "7.0.23",
3
+ "version": "7.0.25",
4
4
  "description": "Starknet specific base implementation",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -13,7 +13,7 @@ import {StarknetSpvWithdrawalData} from "./spv_swap/StarknetSpvWithdrawalData";
13
13
  import {RpcProviderWithRetries} from "./provider/RpcProviderWithRetries";
14
14
  import {WebSocketChannelWithRetries} from "./provider/WebSocketChannelWithRetries";
15
15
 
16
- export type StarknetAssetsType = BaseTokenType<"ETH" | "STRK" | "WBTC" | "TBTC" | "_TESTNET_WBTC_VESU">;
16
+ export type StarknetAssetsType = BaseTokenType<"ETH" | "STRK" | "WBTC" | "TBTC" | "USDC" | "USDT" | "_TESTNET_WBTC_VESU">;
17
17
  export const StarknetAssets: StarknetAssetsType = {
18
18
  ETH: {
19
19
  address: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
@@ -30,10 +30,18 @@ export const StarknetAssets: StarknetAssetsType = {
30
30
  decimals: 8
31
31
  },
32
32
  TBTC: {
33
- address: "0x04daa17763b286d1e59b97c283C0b8C949994C361e426A28F743c67bDfE9a32f",
33
+ address: "0x04daa17763b286d1e59b97c283c0b8c949994c361e426a28f743c67bdfe9a32f",
34
34
  decimals: 18,
35
35
  displayDecimals: 8
36
36
  },
37
+ USDC: {
38
+ address: "0x033068f6539f8e6e6b131e6b2b814e6c34a5224bc66947c47dab9dfee93b35fb",
39
+ decimals: 6
40
+ },
41
+ USDT: {
42
+ address: "0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8",
43
+ decimals: 6
44
+ },
37
45
  _TESTNET_WBTC_VESU: {
38
46
  address: "0x04861ba938aed21f2cd7740acd3765ac4d2974783a3218367233de0153490cb6",
39
47
  decimals: 8
@@ -33,6 +33,7 @@ export class StarknetChainEvents extends StarknetChainEventsBrowser {
33
33
  const arr = txt.split(",");
34
34
  if(arr.length<2) {
35
35
  const blockNumber = parseInt(arr[0].split(";")[0]);
36
+ if(isNaN(blockNumber)) throw new Error("Cannot parse the integer, is NaN!");
36
37
  return [
37
38
  {lastBlockNumber: blockNumber, lastTxHash: null},
38
39
  {lastBlockNumber: blockNumber, lastTxHash: null}
@@ -41,7 +42,9 @@ export class StarknetChainEvents extends StarknetChainEventsBrowser {
41
42
 
42
43
  return arr.map(arrValue => {
43
44
  const subArray = arrValue.split(";");
44
- return {lastBlockNumber: parseInt(subArray[0]), lastTxHash: subArray[1]};
45
+ const lastBlockNumber = parseInt(subArray[0]);
46
+ if(isNaN(lastBlockNumber)) throw new Error("Cannot parse the integer, is NaN!");
47
+ return {lastBlockNumber, lastTxHash: subArray[1]};
45
48
  })
46
49
  } catch (e) {
47
50
  return [];