@orderly.network/core 0.2.4-rc.4 → 0.2.4

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
@@ -87,11 +87,11 @@ type SignedMessagePayload = {
87
87
  * ```ts
88
88
  * const signer = new BaseSigner(keyStore);
89
89
  * const payload = await signer.sign({
90
- * url: "https://api.orderly.io/get_account?address=0x1234567890&brokerId=woofi_dex",
90
+ * url: "https://api.orderly.io/get_account?address=0x1234567890&brokerId=orderly",
91
91
  * method: "GET",
92
92
  * data: {
93
93
  * address: "0x1234567890",
94
- * brokerId: "woofi_pro",
94
+ * brokerId: "orderly",
95
95
  * },
96
96
  * });
97
97
  * ```
@@ -113,30 +113,6 @@ declare class BaseSigner implements Signer {
113
113
  }>;
114
114
  }
115
115
 
116
- type ConfigKey = "apiBaseUrl" | "klineDataUrl" | "privateWsUrl" | "publicWsUrl" | "operatorUrl" | "swapSupportApiUrl" | "domain" | "brokerId" | "networkId" | "env" | "PROD_URL" | "markets";
117
- interface ConfigStore {
118
- get<T>(key: ConfigKey): T;
119
- getOr<T>(key: ConfigKey, defaultValue: T): T;
120
- set<T>(key: ConfigKey, value: T): void;
121
- clear(): void;
122
- }
123
- declare class MemoryConfigStore implements ConfigStore {
124
- protected map: Map<ConfigKey, any>;
125
- constructor(init?: any);
126
- protected _restore(init?: Record<ConfigKey, any>): void;
127
- get<T>(key: ConfigKey): T;
128
- getOr<T>(key: ConfigKey, defaultValue: T): T;
129
- set<T>(key: ConfigKey, value: T): void;
130
- clear(): void;
131
- }
132
- /**
133
- *
134
- */
135
- declare class BaseConfigStore extends MemoryConfigStore {
136
- private readonly configMap;
137
- constructor(configMap: Record<string, any>);
138
- }
139
-
140
116
  type SignatureDomain = {
141
117
  name: string;
142
118
  version: string;
@@ -410,9 +386,16 @@ declare function generateSettleMessage(inputs: {
410
386
  };
411
387
  }];
412
388
 
389
+ type ConfigKey = "apiBaseUrl" | "klineDataUrl" | "privateWsUrl" | "publicWsUrl" | "operatorUrl" | "domain" | "brokerId" | "networkId" | "env" | "PROD_URL" | "markets";
390
+ interface ConfigStore {
391
+ get<T>(key: ConfigKey): T;
392
+ getOr<T>(key: ConfigKey, defaultValue: T): T;
393
+ set<T>(key: ConfigKey, value: T): void;
394
+ clear(): void;
395
+ }
396
+
413
397
  /**
414
398
  * Orderly contracts information
415
- * https://wootraders.atlassian.net/wiki/spaces/ORDER/pages/343441906/Orderly+V2+Contract+Information+Board
416
399
  */
417
400
  type OrderlyContracts = {
418
401
  usdcAddress: string;
@@ -586,6 +569,10 @@ declare class SimpleDI {
586
569
  interface IWalletAdapter {
587
570
  get chainId(): number;
588
571
  get addresses(): string;
572
+ /**
573
+ * Set the chain id
574
+ */
575
+ set chainId(chainId: number);
589
576
  parseUnits: (amount: string) => string;
590
577
  formatUnits: (amount: string) => string;
591
578
  send: (method: string, params: Array<any> | Record<string, any>) => Promise<any>;
@@ -597,7 +584,9 @@ interface IWalletAdapter {
597
584
  }, options: {
598
585
  abi: any;
599
586
  }): Promise<TransactionResponse>;
587
+ getTransactionRecipect: (txHash: string) => Promise<any>;
600
588
  signTypedData: (address: string, data: any) => Promise<string>;
589
+ pollTransactionReceiptWithBackoff: (txHash: string, baseInterval?: number, maxInterval?: number, maxRetries?: number) => Promise<any>;
601
590
  getBalance: (userAddress: string) => Promise<any>;
602
591
  call(address: string, method: string, params: any, options: {
603
592
  abi: any;
@@ -724,6 +713,8 @@ declare class Account {
724
713
  createOrderlyKey(expiration?: number): Promise<any>;
725
714
  settle(): Promise<any>;
726
715
  disconnect(): Promise<void>;
716
+ switchChainId(chainId: number | string): void;
717
+ private parseChainId;
727
718
  private _checkOrderlyKeyState;
728
719
  get signer(): Signer;
729
720
  get wallet(): IWalletAdapter | undefined;
@@ -761,6 +752,7 @@ declare class EtherAdapter implements IWalletAdapter {
761
752
  abi: any;
762
753
  }): Promise<any>;
763
754
  get chainId(): number;
755
+ set chainId(chainId: number);
764
756
  get addresses(): string;
765
757
  send(method: string, params: Array<any> | Record<string, any>): Promise<any>;
766
758
  sendTransaction(contractAddress: string, method: string, payload: {
@@ -771,6 +763,8 @@ declare class EtherAdapter implements IWalletAdapter {
771
763
  }, options: {
772
764
  abi: any;
773
765
  }): Promise<ethers.TransactionResponse>;
766
+ getTransactionRecipect(txHash: string): Promise<void>;
767
+ pollTransactionReceiptWithBackoff(txHash: string, baseInterval?: number, maxInterval?: number, maxRetries?: number): Promise<ethers.TransactionReceipt>;
774
768
  private estimateGas;
775
769
  signTypedData(address: string, data: any): Promise<any>;
776
770
  verify(data: {
@@ -783,4 +777,4 @@ declare class EtherAdapter implements IWalletAdapter {
783
777
  getContract(address: string, abi: any): ethers.Contract;
784
778
  }
785
779
 
786
- export { Account, AccountState, BaseConfigStore, BaseContract as BaseContractManager, BaseKeyStore, BaseOrderlyKeyPair, BaseSigner, ConfigKey, ConfigStore, DefaultConfigStore, EtherAdapter, IContract, LocalStorageStore, MemoryConfigStore, MessageFactor, MockKeyStore, OrderlyKeyPair, OrderlyKeyStore, SignedMessagePayload, Signer, SimpleDI, IWalletAdapter as WalletAdapter, WalletAdapterOptions, generateAddOrderlyKeyMessage, generateRegisterAccountMessage, generateSettleMessage, getDefaultSigner, getMockSigner, getWalletAdapterFunc, utils };
780
+ export { Account, AccountState, BaseContract as BaseContractManager, BaseKeyStore, BaseOrderlyKeyPair, BaseSigner, ConfigKey, ConfigStore, DefaultConfigStore, EtherAdapter, IContract, LocalStorageStore, MessageFactor, MockKeyStore, OrderlyKeyPair, OrderlyKeyStore, SignedMessagePayload, Signer, SimpleDI, IWalletAdapter as WalletAdapter, WalletAdapterOptions, generateAddOrderlyKeyMessage, generateRegisterAccountMessage, generateSettleMessage, getDefaultSigner, getMockSigner, getWalletAdapterFunc, utils };
package/dist/index.d.ts CHANGED
@@ -87,11 +87,11 @@ type SignedMessagePayload = {
87
87
  * ```ts
88
88
  * const signer = new BaseSigner(keyStore);
89
89
  * const payload = await signer.sign({
90
- * url: "https://api.orderly.io/get_account?address=0x1234567890&brokerId=woofi_dex",
90
+ * url: "https://api.orderly.io/get_account?address=0x1234567890&brokerId=orderly",
91
91
  * method: "GET",
92
92
  * data: {
93
93
  * address: "0x1234567890",
94
- * brokerId: "woofi_pro",
94
+ * brokerId: "orderly",
95
95
  * },
96
96
  * });
97
97
  * ```
@@ -113,30 +113,6 @@ declare class BaseSigner implements Signer {
113
113
  }>;
114
114
  }
115
115
 
116
- type ConfigKey = "apiBaseUrl" | "klineDataUrl" | "privateWsUrl" | "publicWsUrl" | "operatorUrl" | "swapSupportApiUrl" | "domain" | "brokerId" | "networkId" | "env" | "PROD_URL" | "markets";
117
- interface ConfigStore {
118
- get<T>(key: ConfigKey): T;
119
- getOr<T>(key: ConfigKey, defaultValue: T): T;
120
- set<T>(key: ConfigKey, value: T): void;
121
- clear(): void;
122
- }
123
- declare class MemoryConfigStore implements ConfigStore {
124
- protected map: Map<ConfigKey, any>;
125
- constructor(init?: any);
126
- protected _restore(init?: Record<ConfigKey, any>): void;
127
- get<T>(key: ConfigKey): T;
128
- getOr<T>(key: ConfigKey, defaultValue: T): T;
129
- set<T>(key: ConfigKey, value: T): void;
130
- clear(): void;
131
- }
132
- /**
133
- *
134
- */
135
- declare class BaseConfigStore extends MemoryConfigStore {
136
- private readonly configMap;
137
- constructor(configMap: Record<string, any>);
138
- }
139
-
140
116
  type SignatureDomain = {
141
117
  name: string;
142
118
  version: string;
@@ -410,9 +386,16 @@ declare function generateSettleMessage(inputs: {
410
386
  };
411
387
  }];
412
388
 
389
+ type ConfigKey = "apiBaseUrl" | "klineDataUrl" | "privateWsUrl" | "publicWsUrl" | "operatorUrl" | "domain" | "brokerId" | "networkId" | "env" | "PROD_URL" | "markets";
390
+ interface ConfigStore {
391
+ get<T>(key: ConfigKey): T;
392
+ getOr<T>(key: ConfigKey, defaultValue: T): T;
393
+ set<T>(key: ConfigKey, value: T): void;
394
+ clear(): void;
395
+ }
396
+
413
397
  /**
414
398
  * Orderly contracts information
415
- * https://wootraders.atlassian.net/wiki/spaces/ORDER/pages/343441906/Orderly+V2+Contract+Information+Board
416
399
  */
417
400
  type OrderlyContracts = {
418
401
  usdcAddress: string;
@@ -586,6 +569,10 @@ declare class SimpleDI {
586
569
  interface IWalletAdapter {
587
570
  get chainId(): number;
588
571
  get addresses(): string;
572
+ /**
573
+ * Set the chain id
574
+ */
575
+ set chainId(chainId: number);
589
576
  parseUnits: (amount: string) => string;
590
577
  formatUnits: (amount: string) => string;
591
578
  send: (method: string, params: Array<any> | Record<string, any>) => Promise<any>;
@@ -597,7 +584,9 @@ interface IWalletAdapter {
597
584
  }, options: {
598
585
  abi: any;
599
586
  }): Promise<TransactionResponse>;
587
+ getTransactionRecipect: (txHash: string) => Promise<any>;
600
588
  signTypedData: (address: string, data: any) => Promise<string>;
589
+ pollTransactionReceiptWithBackoff: (txHash: string, baseInterval?: number, maxInterval?: number, maxRetries?: number) => Promise<any>;
601
590
  getBalance: (userAddress: string) => Promise<any>;
602
591
  call(address: string, method: string, params: any, options: {
603
592
  abi: any;
@@ -724,6 +713,8 @@ declare class Account {
724
713
  createOrderlyKey(expiration?: number): Promise<any>;
725
714
  settle(): Promise<any>;
726
715
  disconnect(): Promise<void>;
716
+ switchChainId(chainId: number | string): void;
717
+ private parseChainId;
727
718
  private _checkOrderlyKeyState;
728
719
  get signer(): Signer;
729
720
  get wallet(): IWalletAdapter | undefined;
@@ -761,6 +752,7 @@ declare class EtherAdapter implements IWalletAdapter {
761
752
  abi: any;
762
753
  }): Promise<any>;
763
754
  get chainId(): number;
755
+ set chainId(chainId: number);
764
756
  get addresses(): string;
765
757
  send(method: string, params: Array<any> | Record<string, any>): Promise<any>;
766
758
  sendTransaction(contractAddress: string, method: string, payload: {
@@ -771,6 +763,8 @@ declare class EtherAdapter implements IWalletAdapter {
771
763
  }, options: {
772
764
  abi: any;
773
765
  }): Promise<ethers.TransactionResponse>;
766
+ getTransactionRecipect(txHash: string): Promise<void>;
767
+ pollTransactionReceiptWithBackoff(txHash: string, baseInterval?: number, maxInterval?: number, maxRetries?: number): Promise<ethers.TransactionReceipt>;
774
768
  private estimateGas;
775
769
  signTypedData(address: string, data: any): Promise<any>;
776
770
  verify(data: {
@@ -783,4 +777,4 @@ declare class EtherAdapter implements IWalletAdapter {
783
777
  getContract(address: string, abi: any): ethers.Contract;
784
778
  }
785
779
 
786
- export { Account, AccountState, BaseConfigStore, BaseContract as BaseContractManager, BaseKeyStore, BaseOrderlyKeyPair, BaseSigner, ConfigKey, ConfigStore, DefaultConfigStore, EtherAdapter, IContract, LocalStorageStore, MemoryConfigStore, MessageFactor, MockKeyStore, OrderlyKeyPair, OrderlyKeyStore, SignedMessagePayload, Signer, SimpleDI, IWalletAdapter as WalletAdapter, WalletAdapterOptions, generateAddOrderlyKeyMessage, generateRegisterAccountMessage, generateSettleMessage, getDefaultSigner, getMockSigner, getWalletAdapterFunc, utils };
780
+ export { Account, AccountState, BaseContract as BaseContractManager, BaseKeyStore, BaseOrderlyKeyPair, BaseSigner, ConfigKey, ConfigStore, DefaultConfigStore, EtherAdapter, IContract, LocalStorageStore, MessageFactor, MockKeyStore, OrderlyKeyPair, OrderlyKeyStore, SignedMessagePayload, Signer, SimpleDI, IWalletAdapter as WalletAdapter, WalletAdapterOptions, generateAddOrderlyKeyMessage, generateRegisterAccountMessage, generateSettleMessage, getDefaultSigner, getMockSigner, getWalletAdapterFunc, utils };