@gardenfi/orderbook 0.1.4 → 0.1.5

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/index4.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={ethereum_sepolia:"ethereum_sepolia",ethereum:"ethereum",bitcoin:"bitcoin",bitcoin_testnet:"bitcoin_testnet",bitcoin_regtest:"bitcoin_regtest",ethereum_arbitrum:"ethereum_arbitrum"},o={ethereum:{WBTC:{name:"Wrapped Bitcoin",symbol:"WBTC",decimals:8,chain:e.ethereum,isToken:!0,thumbnail:"https://cryptologos.cc/logos/wrapped-bitcoin-wbtc-logo.svg?v=029",address:"0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"}},ethereum_sepolia:{WBTC:{name:"Wrapped Bitcoin",symbol:"WBTC",decimals:8,chain:e.ethereum_sepolia,isToken:!0,thumbnail:"https://cryptologos.cc/logos/wrapped-bitcoin-wbtc-logo.svg",address:"0x3D1e56247033FE191DC789b5838E366dC04b1b73"}},bitcoin:{BTC:{name:"Bitcoin",symbol:"BTC",decimals:8,thumbnail:"https://cryptologos.cc/logos/bitcoin-btc-logo.svg",chain:e.bitcoin,isToken:!1}},bitcoin_testnet:{BTC:{name:"Bitcoin Testnet",symbol:"BTC",decimals:8,thumbnail:"https://cryptologos.cc/logos/bitcoin-btc-logo.svg",chain:e.bitcoin_testnet,isToken:!1}},ethereum_arbitrum:{WBTC:{name:"Wrapped Bitcoin",symbol:"WBTC",decimals:8,chain:e.ethereum_arbitrum,isToken:!0,thumbnail:"https://cryptologos.cc/logos/wrapped-bitcoin-wbtc-logo.svg?v=029",address:"0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f"}}},s={bitcoin:{nativeAsset:o.bitcoin.BTC},bitcoin_testnet:{nativeAsset:o.bitcoin_testnet.BTC},bitcoin_regtest:{nativeAsset:{name:"Bitcoin Regtest",symbol:"rBTC",decimals:8,chain:e.bitcoin_regtest,isToken:!1,thumbnail:"https://cryptologos.cc/logos/bitcoin-btc-logo.svg"}},ethereum:{nativeAsset:{name:"Ethereum",symbol:"ETH",decimals:18,chain:e.ethereum,isToken:!1,thumbnail:"https://cryptologos.cc/logos/ethereum-eth-logo.svg"}},ethereum_sepolia:{nativeAsset:{name:"Ethereum",symbol:"ETH",decimals:18,chain:e.ethereum_sepolia,isToken:!1,thumbnail:"https://cryptologos.cc/logos/ethereum-eth-logo.svg"}},ethereum_arbitrum:{nativeAsset:{name:"Ethereum",symbol:"ETH",decimals:18,chain:e.ethereum_arbitrum,isToken:!1,thumbnail:"https://cryptologos.cc/logos/arbitrum-arb-logo.svg"}}},i=t=>!(t===e.ethereum_sepolia||t===e.bitcoin_testnet||t===e.bitcoin_regtest);exports.Assets=o;exports.Chains=e;exports.ChainsData=s;exports.isMainnet=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={ethereum_sepolia:"ethereum_sepolia",ethereum:"ethereum",bitcoin:"bitcoin",bitcoin_testnet:"bitcoin_testnet",bitcoin_regtest:"bitcoin_regtest",ethereum_arbitrum:"ethereum_arbitrum"},o={ethereum:{WBTC:{name:"Wrapped Bitcoin",symbol:"WBTC",decimals:8,chain:e.ethereum,isToken:!0,thumbnail:"https://cryptologos.cc/logos/wrapped-bitcoin-wbtc-logo.svg?v=029",address:"0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"}},ethereum_sepolia:{WBTC:{name:"Wrapped Bitcoin",symbol:"WBTC",decimals:8,chain:e.ethereum_sepolia,isToken:!0,thumbnail:"https://cryptologos.cc/logos/wrapped-bitcoin-wbtc-logo.svg",address:"0x3D1e56247033FE191DC789b5838E366dC04b1b73"}},bitcoin:{BTC:{name:"Bitcoin",symbol:"BTC",decimals:8,thumbnail:"https://cryptologos.cc/logos/bitcoin-btc-logo.svg",chain:e.bitcoin,isToken:!1}},bitcoin_testnet:{BTC:{name:"Bitcoin Testnet",symbol:"BTC",decimals:8,thumbnail:"https://cryptologos.cc/logos/bitcoin-btc-logo.svg",chain:e.bitcoin_testnet,isToken:!1}},bitcoin_regtest:{BTC:{name:"Bitcoin Regtest",symbol:"BTC",decimals:8,thumbnail:"https://cryptologos.cc/logos/bitcoin-btc-logo.svg",chain:e.bitcoin_regtest,isToken:!1}},ethereum_arbitrum:{WBTC:{name:"Wrapped Bitcoin",symbol:"WBTC",decimals:8,chain:e.ethereum_arbitrum,isToken:!0,thumbnail:"https://cryptologos.cc/logos/bitcoin-btc-logo.svg",address:"0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f"}}},i={bitcoin:{nativeAsset:o.bitcoin.BTC},bitcoin_testnet:{nativeAsset:o.bitcoin_testnet.BTC},bitcoin_regtest:{nativeAsset:{name:"Bitcoin Regtest",symbol:"rBTC",decimals:8,chain:e.bitcoin_regtest,isToken:!1,thumbnail:"https://cryptologos.cc/logos/bitcoin-btc-logo.svg"}},ethereum:{nativeAsset:{name:"Ethereum",symbol:"ETH",decimals:18,chain:e.ethereum,isToken:!1,thumbnail:"https://cryptologos.cc/logos/ethereum-eth-logo.svg"}},ethereum_sepolia:{nativeAsset:{name:"Ethereum",symbol:"ETH",decimals:18,chain:e.ethereum_sepolia,isToken:!1,thumbnail:"https://cryptologos.cc/logos/ethereum-eth-logo.svg"}},ethereum_arbitrum:{nativeAsset:{name:"Ethereum",symbol:"ETH",decimals:18,chain:e.ethereum_arbitrum,isToken:!1,thumbnail:"https://cryptologos.cc/logos/arbitrum-arb-logo.svg"}}},s=t=>!(t===e.ethereum_sepolia||t===e.bitcoin_testnet||t===e.bitcoin_regtest);exports.Assets=o;exports.Chains=e;exports.ChainsData=i;exports.isMainnet=s;
package/dist/index4.js CHANGED
@@ -48,6 +48,16 @@ const e = {
48
48
  isToken: !1
49
49
  }
50
50
  },
51
+ bitcoin_regtest: {
52
+ BTC: {
53
+ name: "Bitcoin Regtest",
54
+ symbol: "BTC",
55
+ decimals: 8,
56
+ thumbnail: "https://cryptologos.cc/logos/bitcoin-btc-logo.svg",
57
+ chain: e.bitcoin_regtest,
58
+ isToken: !1
59
+ }
60
+ },
51
61
  ethereum_arbitrum: {
52
62
  WBTC: {
53
63
  name: "Wrapped Bitcoin",
@@ -55,7 +65,7 @@ const e = {
55
65
  decimals: 8,
56
66
  chain: e.ethereum_arbitrum,
57
67
  isToken: !0,
58
- thumbnail: "https://cryptologos.cc/logos/wrapped-bitcoin-wbtc-logo.svg?v=029",
68
+ thumbnail: "https://cryptologos.cc/logos/bitcoin-btc-logo.svg",
59
69
  address: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f"
60
70
  }
61
71
  }
package/dist/index8.js CHANGED
@@ -10,8 +10,7 @@ class v {
10
10
  }
11
11
  verifyToken(e, r) {
12
12
  const t = f(e);
13
- if (!t)
14
- return !1;
13
+ if (!t) return !1;
15
14
  try {
16
15
  const i = Math.floor(Date.now() / 1e3) + 120;
17
16
  return t.exp > i && t.userWallet.toLowerCase() === r.toLowerCase();
@@ -57,8 +56,7 @@ class v {
57
56
  }
58
57
  const f = (s) => {
59
58
  try {
60
- if (s.split(".").length < 3)
61
- return;
59
+ if (s.split(".").length < 3) return;
62
60
  const e = s.split(".")[1];
63
61
  return e ? JSON.parse(Buffer.from(e, "base64").toString("latin1")) : void 0;
64
62
  } catch {
@@ -7,7 +7,7 @@ export declare const Chains: {
7
7
  readonly ethereum_arbitrum: "ethereum_arbitrum";
8
8
  };
9
9
  export type Chain = keyof typeof Chains;
10
- export type EvmChain = keyof Omit<typeof Chains, 'bitcoin' | 'bitcoin_testnet' | 'bitcoin_regtest'>;
10
+ export type EvmChain = keyof Omit<typeof Chains, "bitcoin" | "bitcoin_testnet" | "bitcoin_regtest">;
11
11
  export type AssetCommon = {
12
12
  name: string;
13
13
  symbol: string;
@@ -65,6 +65,16 @@ export declare const Assets: {
65
65
  isToken: boolean;
66
66
  };
67
67
  };
68
+ bitcoin_regtest: {
69
+ BTC: {
70
+ name: string;
71
+ symbol: string;
72
+ decimals: number;
73
+ thumbnail: string;
74
+ chain: "bitcoin_regtest";
75
+ isToken: boolean;
76
+ };
77
+ };
68
78
  ethereum_arbitrum: {
69
79
  WBTC: {
70
80
  name: string;
@@ -81,4 +91,4 @@ export type ChainData = {
81
91
  nativeAsset: Asset;
82
92
  };
83
93
  export declare const ChainsData: Record<Chain, ChainData>;
84
- export declare const isMainnet: (chain: Chain) => boolean;
94
+ export declare const isMainnet: (chain: Chain) => chain is "ethereum" | "bitcoin" | "ethereum_arbitrum";
@@ -1,7 +1,8 @@
1
- import { JsonRpcSigner, Wallet } from "ethers";
2
- import { IAuth } from "./auth.interface";
3
- import { OrderbookOpts } from "../orderbook.types";
4
- import { Url } from "../url";
1
+ import { JsonRpcSigner, Wallet } from 'ethers';
2
+ import { IAuth } from './auth.interface';
3
+ import { OrderbookOpts } from '../orderbook.types';
4
+ import { Url } from '../url';
5
+
5
6
  export declare class Siwe implements IAuth {
6
7
  private readonly url;
7
8
  private store;
@@ -1,4 +1,5 @@
1
- import { CreateOrderConfig, IOrderbook, Order, OrderConfig, OrderNonVerbose, OrderbookConfig } from "./orderbook.types";
1
+ import { CreateOrderConfig, IOrderbook, Order, OrderConfig, OrderNonVerbose, OrderbookConfig } from './orderbook.types';
2
+
2
3
  /**
3
4
  * A class that allows you to create and manage orders with the backend url.
4
5
  *
@@ -1,7 +1,8 @@
1
- import { MarkNonNullable } from "@catalogfi/utils";
2
- import { Asset } from "./asset";
3
- import { JsonRpcSigner, Wallet } from "ethers";
4
- import { IStore } from "./store/store.interface";
1
+ import { MarkNonNullable } from '@catalogfi/utils';
2
+ import { Asset } from './asset';
3
+ import { JsonRpcSigner, Wallet } from 'ethers';
4
+ import { IStore } from './store/store.interface';
5
+
5
6
  /**
6
7
  * Configuration for the orders you want to receive
7
8
  *
@@ -1,4 +1,5 @@
1
1
  import { Asset, EvmChain } from './asset';
2
+
2
3
  export declare const orderPairGenerator: (from: Asset, to: Asset) => string;
3
4
  export declare const chainToId: Record<EvmChain, number>;
4
5
  export declare const idToChain: Record<number, EvmChain>;
@@ -1,4 +1,5 @@
1
- import { Orders } from "./orderbook.types";
1
+ import { Orders } from './orderbook.types';
2
+
2
3
  export declare class OrdersSocket {
3
4
  private url;
4
5
  private socket;
@@ -1,3 +1,3 @@
1
- export { PaymentChannelService } from "./service";
2
- export { IPaymentChannelService } from "./interface";
3
- export type { PaymentChannelState } from "./interface";
1
+ export { PaymentChannelService } from './service';
2
+ export { IPaymentChannelService } from './interface';
3
+ export type { PaymentChannelState } from './interface';
@@ -1,4 +1,5 @@
1
- import { AsyncResult } from "@catalogfi/utils";
1
+ import { AsyncResult } from '@catalogfi/utils';
2
+
2
3
  declare enum HTLCStatus {
3
4
  Pending = "pending",
4
5
  Ready = "ready",
@@ -1,7 +1,8 @@
1
- import { JsonRpcSigner, Wallet } from "ethers";
2
- import { ConditionalPaymentFinalRequest, ConditionalPaymentInitialRequest, IPaymentChannelService as IPaymentChannelService, PaymentChannelState } from "./interface";
3
- import { AsyncResult } from "@catalogfi/utils";
4
- import { IAuth } from "../auth/auth.interface";
1
+ import { JsonRpcSigner, Wallet } from 'ethers';
2
+ import { ConditionalPaymentFinalRequest, ConditionalPaymentInitialRequest, IPaymentChannelService as IPaymentChannelService, PaymentChannelState } from './interface';
3
+ import { AsyncResult } from '@catalogfi/utils';
4
+ import { IAuth } from '../auth/auth.interface';
5
+
5
6
  export declare class PaymentChannelService implements IPaymentChannelService {
6
7
  private api;
7
8
  private signer;
@@ -1,5 +1,6 @@
1
- import { JsonRpcApiProvider, JsonRpcSigner, Wallet } from "ethers";
2
- import { ConditionalPaymentInitialRequest, PaymentChannelState } from "./interface";
1
+ import { JsonRpcApiProvider, JsonRpcSigner, Wallet } from 'ethers';
2
+ import { ConditionalPaymentInitialRequest, PaymentChannelState } from './interface';
3
+
3
4
  export declare function getTimelock(provider: JsonRpcApiProvider): Promise<number>;
4
5
  export declare const parseError: (error: unknown) => string;
5
6
  export declare const getProviderOrThrow: (signer: JsonRpcSigner | Wallet) => JsonRpcApiProvider;
@@ -1,4 +1,5 @@
1
1
  import { IStore } from './store.interface';
2
+
2
3
  /**
3
4
  * In-memory storage implementation.
4
5
  *
@@ -1 +1 @@
1
- export * from "./Url";
1
+ export * from './Url';
@@ -1,4 +1,5 @@
1
- import { Order } from "./orderbook.types";
1
+ import { Order } from './orderbook.types';
2
+
2
3
  export declare const parseStatus: (order: Order) => Actions;
3
4
  export declare enum Actions {
4
5
  UserCanInitiate = "user can initiate",
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@gardenfi/orderbook",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "@catalogfi/utils": "^0.1.6",
7
- "@catalogfi/wallets": "0.2.35",
7
+ "@catalogfi/wallets": "0.2.43",
8
8
  "bufferutil": "^4.0.8",
9
9
  "ethers": "6.8.0",
10
10
  "siwe": "^2.1.4",