@orderly.network/core 0.2.4-experimental.0 → 0.2.4-rc.8
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 +35 -11
- package/dist/index.d.ts +35 -11
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
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=
|
|
90
|
+
* url: "https://api.orderly.io/get_account?address=0x1234567890&brokerId=woofi_dex",
|
|
91
91
|
* method: "GET",
|
|
92
92
|
* data: {
|
|
93
93
|
* address: "0x1234567890",
|
|
94
|
-
* brokerId: "
|
|
94
|
+
* brokerId: "woofi_pro",
|
|
95
95
|
* },
|
|
96
96
|
* });
|
|
97
97
|
* ```
|
|
@@ -113,6 +113,30 @@ 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
|
+
|
|
116
140
|
type SignatureDomain = {
|
|
117
141
|
name: string;
|
|
118
142
|
version: string;
|
|
@@ -386,16 +410,9 @@ declare function generateSettleMessage(inputs: {
|
|
|
386
410
|
};
|
|
387
411
|
}];
|
|
388
412
|
|
|
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
|
-
|
|
397
413
|
/**
|
|
398
414
|
* Orderly contracts information
|
|
415
|
+
* https://wootraders.atlassian.net/wiki/spaces/ORDER/pages/343441906/Orderly+V2+Contract+Information+Board
|
|
399
416
|
*/
|
|
400
417
|
type OrderlyContracts = {
|
|
401
418
|
usdcAddress: string;
|
|
@@ -569,6 +586,10 @@ declare class SimpleDI {
|
|
|
569
586
|
interface IWalletAdapter {
|
|
570
587
|
get chainId(): number;
|
|
571
588
|
get addresses(): string;
|
|
589
|
+
/**
|
|
590
|
+
* Set the chain id
|
|
591
|
+
*/
|
|
592
|
+
set chainId(chainId: number);
|
|
572
593
|
parseUnits: (amount: string) => string;
|
|
573
594
|
formatUnits: (amount: string) => string;
|
|
574
595
|
send: (method: string, params: Array<any> | Record<string, any>) => Promise<any>;
|
|
@@ -707,6 +728,8 @@ declare class Account {
|
|
|
707
728
|
createOrderlyKey(expiration?: number): Promise<any>;
|
|
708
729
|
settle(): Promise<any>;
|
|
709
730
|
disconnect(): Promise<void>;
|
|
731
|
+
switchChainId(chainId: number | string): void;
|
|
732
|
+
private parseChainId;
|
|
710
733
|
private _checkOrderlyKeyState;
|
|
711
734
|
get signer(): Signer;
|
|
712
735
|
get wallet(): IWalletAdapter | undefined;
|
|
@@ -744,6 +767,7 @@ declare class EtherAdapter implements IWalletAdapter {
|
|
|
744
767
|
abi: any;
|
|
745
768
|
}): Promise<any>;
|
|
746
769
|
get chainId(): number;
|
|
770
|
+
set chainId(chainId: number);
|
|
747
771
|
get addresses(): string;
|
|
748
772
|
send(method: string, params: Array<any> | Record<string, any>): Promise<any>;
|
|
749
773
|
sendTransaction(contractAddress: string, method: string, payload: {
|
|
@@ -766,4 +790,4 @@ declare class EtherAdapter implements IWalletAdapter {
|
|
|
766
790
|
getContract(address: string, abi: any): ethers.Contract;
|
|
767
791
|
}
|
|
768
792
|
|
|
769
|
-
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 };
|
|
793
|
+
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 };
|
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=
|
|
90
|
+
* url: "https://api.orderly.io/get_account?address=0x1234567890&brokerId=woofi_dex",
|
|
91
91
|
* method: "GET",
|
|
92
92
|
* data: {
|
|
93
93
|
* address: "0x1234567890",
|
|
94
|
-
* brokerId: "
|
|
94
|
+
* brokerId: "woofi_pro",
|
|
95
95
|
* },
|
|
96
96
|
* });
|
|
97
97
|
* ```
|
|
@@ -113,6 +113,30 @@ 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
|
+
|
|
116
140
|
type SignatureDomain = {
|
|
117
141
|
name: string;
|
|
118
142
|
version: string;
|
|
@@ -386,16 +410,9 @@ declare function generateSettleMessage(inputs: {
|
|
|
386
410
|
};
|
|
387
411
|
}];
|
|
388
412
|
|
|
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
|
-
|
|
397
413
|
/**
|
|
398
414
|
* Orderly contracts information
|
|
415
|
+
* https://wootraders.atlassian.net/wiki/spaces/ORDER/pages/343441906/Orderly+V2+Contract+Information+Board
|
|
399
416
|
*/
|
|
400
417
|
type OrderlyContracts = {
|
|
401
418
|
usdcAddress: string;
|
|
@@ -569,6 +586,10 @@ declare class SimpleDI {
|
|
|
569
586
|
interface IWalletAdapter {
|
|
570
587
|
get chainId(): number;
|
|
571
588
|
get addresses(): string;
|
|
589
|
+
/**
|
|
590
|
+
* Set the chain id
|
|
591
|
+
*/
|
|
592
|
+
set chainId(chainId: number);
|
|
572
593
|
parseUnits: (amount: string) => string;
|
|
573
594
|
formatUnits: (amount: string) => string;
|
|
574
595
|
send: (method: string, params: Array<any> | Record<string, any>) => Promise<any>;
|
|
@@ -707,6 +728,8 @@ declare class Account {
|
|
|
707
728
|
createOrderlyKey(expiration?: number): Promise<any>;
|
|
708
729
|
settle(): Promise<any>;
|
|
709
730
|
disconnect(): Promise<void>;
|
|
731
|
+
switchChainId(chainId: number | string): void;
|
|
732
|
+
private parseChainId;
|
|
710
733
|
private _checkOrderlyKeyState;
|
|
711
734
|
get signer(): Signer;
|
|
712
735
|
get wallet(): IWalletAdapter | undefined;
|
|
@@ -744,6 +767,7 @@ declare class EtherAdapter implements IWalletAdapter {
|
|
|
744
767
|
abi: any;
|
|
745
768
|
}): Promise<any>;
|
|
746
769
|
get chainId(): number;
|
|
770
|
+
set chainId(chainId: number);
|
|
747
771
|
get addresses(): string;
|
|
748
772
|
send(method: string, params: Array<any> | Record<string, any>): Promise<any>;
|
|
749
773
|
sendTransaction(contractAddress: string, method: string, payload: {
|
|
@@ -766,4 +790,4 @@ declare class EtherAdapter implements IWalletAdapter {
|
|
|
766
790
|
getContract(address: string, abi: any): ethers.Contract;
|
|
767
791
|
}
|
|
768
792
|
|
|
769
|
-
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 };
|
|
793
|
+
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 };
|