@orderly.network/core 2.0.0 → 2.0.1-alpha.0

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.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import EventEmitter from 'eventemitter3';
2
2
  export { default as EventEmitter } from 'eventemitter3';
3
- import { definedTypes, API, ChainNamespace, AccountStatusEnum } from '@orderly.network/types';
3
+ import { definedTypes, API, ChainNamespace, AccountStatusEnum, NetworkId } from '@orderly.network/types';
4
4
  import { BigNumberish } from 'ethers/src.ts/utils';
5
5
  import { parseUnits, TransactionResponse, ethers } from 'ethers';
6
6
 
@@ -390,7 +390,7 @@ declare function generateSettleMessage(inputs: {
390
390
  };
391
391
  }];
392
392
 
393
- type ConfigKey = "apiBaseUrl" | "klineDataUrl" | "privateWsUrl" | "publicWsUrl" | "operatorUrl" | "domain" | "brokerId" | "brokerName" | "networkId" | "env" | "PROD_URL" | "markets";
393
+ type ConfigKey = "apiBaseUrl" | "klineDataUrl" | "privateWsUrl" | "publicWsUrl" | "operatorUrl" | "domain" | "brokerId" | "brokerName" | "networkId" | "env" | "chainNamespace" | "PROD_URL" | "orderly_markets" | "markets";
394
394
  interface ConfigStore {
395
395
  get<T = string>(key: ConfigKey): T;
396
396
  getOr<T = string>(key: ConfigKey, defaultValue: T): T;
@@ -561,6 +561,13 @@ declare class BaseContract implements IContract {
561
561
  };
562
562
  }
563
563
 
564
+ declare const EVENT_NAMES: {
565
+ statusChanged: string;
566
+ validateStart: string;
567
+ validateEnd: string;
568
+ switchAccount: string;
569
+ };
570
+
564
571
  declare class SimpleDI {
565
572
  private static KEY;
566
573
  private static container;
@@ -712,6 +719,9 @@ interface AccountState {
712
719
  * whether the account is validating
713
720
  */
714
721
  validating: boolean;
722
+ /**
723
+ * whether the account is revalidating
724
+ */
715
725
  accountId?: string;
716
726
  userId?: string;
717
727
  address?: string;
@@ -782,7 +792,7 @@ declare class Account {
782
792
  }): Promise<any>;
783
793
  private generateAPiKey;
784
794
  settle(): Promise<any>;
785
- destoryOrderlyKey(): Promise<void>;
795
+ destroyOrderlyKey(): Promise<void>;
786
796
  disconnect(): Promise<void>;
787
797
  switchChainId(chainId: number | string): void;
788
798
  private parseChainId;
@@ -799,6 +809,14 @@ declare class Account {
799
809
  get off(): <T extends string | symbol>(event: T, fn?: ((...args: any[]) => void) | undefined, context?: any, once?: boolean | undefined) => EventEmitter<string | symbol, any>;
800
810
  }
801
811
 
812
+ type ChainNamespaceType = typeof ChainNamespace[keyof typeof ChainNamespace];
813
+ type URLS = {
814
+ apiBaseUrl: string;
815
+ publicWsUrl: string;
816
+ privateWsUrl: string;
817
+ operatorUrl: Record<ChainNamespaceType, string>;
818
+ };
819
+ declare const API_URLS: Record<NetworkId, URLS>;
802
820
  declare class DefaultConfigStore implements ConfigStore {
803
821
  protected map: Map<ConfigKey, any>;
804
822
  constructor(init: Partial<Record<ConfigKey, any>>);
@@ -932,4 +950,4 @@ declare class EtherAdapter implements IWalletAdapter {
932
950
  getContract(address: string, abi: any): ethers.Contract;
933
951
  }
934
952
 
935
- export { Account, type AccountState, type AddOrderlyKeyInputs, BaseContract as BaseContractManager, BaseKeyStore, BaseOrderlyKeyPair, BaseSigner, BaseWalletAdapter, type ChainType, type ConfigKey, type ConfigStore, DefaultConfigStore, type Ed25519Keypair, EtherAdapter, type IContract, LocalStorageStore, type Message, type MessageFactor, MockKeyStore, type OrderlyKeyPair, type OrderlyKeyStore, type RegisterAccountInputs, type SettleInputs, type SignatureDomain, type SignedMessagePayload, type Signer, SimpleDI, type WalletAdapter, type WalletAdapterOptions, type WithdrawInputs, generateAddOrderlyKeyMessage, generateRegisterAccountMessage, generateSettleMessage, getDefaultSigner, getMockSigner, type getWalletAdapterFunc, utils };
953
+ export { API_URLS, Account, type AccountState, type AddOrderlyKeyInputs, BaseContract as BaseContractManager, BaseKeyStore, BaseOrderlyKeyPair, BaseSigner, BaseWalletAdapter, type ChainType, type ConfigKey, type ConfigStore, DefaultConfigStore, EVENT_NAMES, type Ed25519Keypair, EtherAdapter, type IContract, LocalStorageStore, type Message, type MessageFactor, MockKeyStore, type OrderlyKeyPair, type OrderlyKeyStore, type RegisterAccountInputs, type SettleInputs, type SignatureDomain, type SignedMessagePayload, type Signer, SimpleDI, type URLS, type WalletAdapter, type WalletAdapterOptions, type WithdrawInputs, generateAddOrderlyKeyMessage, generateRegisterAccountMessage, generateSettleMessage, getDefaultSigner, getMockSigner, type getWalletAdapterFunc, utils };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import EventEmitter from 'eventemitter3';
2
2
  export { default as EventEmitter } from 'eventemitter3';
3
- import { definedTypes, API, ChainNamespace, AccountStatusEnum } from '@orderly.network/types';
3
+ import { definedTypes, API, ChainNamespace, AccountStatusEnum, NetworkId } from '@orderly.network/types';
4
4
  import { BigNumberish } from 'ethers/src.ts/utils';
5
5
  import { parseUnits, TransactionResponse, ethers } from 'ethers';
6
6
 
@@ -390,7 +390,7 @@ declare function generateSettleMessage(inputs: {
390
390
  };
391
391
  }];
392
392
 
393
- type ConfigKey = "apiBaseUrl" | "klineDataUrl" | "privateWsUrl" | "publicWsUrl" | "operatorUrl" | "domain" | "brokerId" | "brokerName" | "networkId" | "env" | "PROD_URL" | "markets";
393
+ type ConfigKey = "apiBaseUrl" | "klineDataUrl" | "privateWsUrl" | "publicWsUrl" | "operatorUrl" | "domain" | "brokerId" | "brokerName" | "networkId" | "env" | "chainNamespace" | "PROD_URL" | "orderly_markets" | "markets";
394
394
  interface ConfigStore {
395
395
  get<T = string>(key: ConfigKey): T;
396
396
  getOr<T = string>(key: ConfigKey, defaultValue: T): T;
@@ -561,6 +561,13 @@ declare class BaseContract implements IContract {
561
561
  };
562
562
  }
563
563
 
564
+ declare const EVENT_NAMES: {
565
+ statusChanged: string;
566
+ validateStart: string;
567
+ validateEnd: string;
568
+ switchAccount: string;
569
+ };
570
+
564
571
  declare class SimpleDI {
565
572
  private static KEY;
566
573
  private static container;
@@ -712,6 +719,9 @@ interface AccountState {
712
719
  * whether the account is validating
713
720
  */
714
721
  validating: boolean;
722
+ /**
723
+ * whether the account is revalidating
724
+ */
715
725
  accountId?: string;
716
726
  userId?: string;
717
727
  address?: string;
@@ -782,7 +792,7 @@ declare class Account {
782
792
  }): Promise<any>;
783
793
  private generateAPiKey;
784
794
  settle(): Promise<any>;
785
- destoryOrderlyKey(): Promise<void>;
795
+ destroyOrderlyKey(): Promise<void>;
786
796
  disconnect(): Promise<void>;
787
797
  switchChainId(chainId: number | string): void;
788
798
  private parseChainId;
@@ -799,6 +809,14 @@ declare class Account {
799
809
  get off(): <T extends string | symbol>(event: T, fn?: ((...args: any[]) => void) | undefined, context?: any, once?: boolean | undefined) => EventEmitter<string | symbol, any>;
800
810
  }
801
811
 
812
+ type ChainNamespaceType = typeof ChainNamespace[keyof typeof ChainNamespace];
813
+ type URLS = {
814
+ apiBaseUrl: string;
815
+ publicWsUrl: string;
816
+ privateWsUrl: string;
817
+ operatorUrl: Record<ChainNamespaceType, string>;
818
+ };
819
+ declare const API_URLS: Record<NetworkId, URLS>;
802
820
  declare class DefaultConfigStore implements ConfigStore {
803
821
  protected map: Map<ConfigKey, any>;
804
822
  constructor(init: Partial<Record<ConfigKey, any>>);
@@ -932,4 +950,4 @@ declare class EtherAdapter implements IWalletAdapter {
932
950
  getContract(address: string, abi: any): ethers.Contract;
933
951
  }
934
952
 
935
- export { Account, type AccountState, type AddOrderlyKeyInputs, BaseContract as BaseContractManager, BaseKeyStore, BaseOrderlyKeyPair, BaseSigner, BaseWalletAdapter, type ChainType, type ConfigKey, type ConfigStore, DefaultConfigStore, type Ed25519Keypair, EtherAdapter, type IContract, LocalStorageStore, type Message, type MessageFactor, MockKeyStore, type OrderlyKeyPair, type OrderlyKeyStore, type RegisterAccountInputs, type SettleInputs, type SignatureDomain, type SignedMessagePayload, type Signer, SimpleDI, type WalletAdapter, type WalletAdapterOptions, type WithdrawInputs, generateAddOrderlyKeyMessage, generateRegisterAccountMessage, generateSettleMessage, getDefaultSigner, getMockSigner, type getWalletAdapterFunc, utils };
953
+ export { API_URLS, Account, type AccountState, type AddOrderlyKeyInputs, BaseContract as BaseContractManager, BaseKeyStore, BaseOrderlyKeyPair, BaseSigner, BaseWalletAdapter, type ChainType, type ConfigKey, type ConfigStore, DefaultConfigStore, EVENT_NAMES, type Ed25519Keypair, EtherAdapter, type IContract, LocalStorageStore, type Message, type MessageFactor, MockKeyStore, type OrderlyKeyPair, type OrderlyKeyStore, type RegisterAccountInputs, type SettleInputs, type SignatureDomain, type SignedMessagePayload, type Signer, SimpleDI, type URLS, type WalletAdapter, type WalletAdapterOptions, type WithdrawInputs, generateAddOrderlyKeyMessage, generateRegisterAccountMessage, generateSettleMessage, getDefaultSigner, getMockSigner, type getWalletAdapterFunc, utils };