@orderly.network/core 0.1.26 → 0.1.27-alpha.1

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,7 +1,7 @@
1
1
  import EventEmitter from 'eventemitter3';
2
2
  export { default as EventEmitter } from 'eventemitter3';
3
+ import { API, AccountStatusEnum } from '@orderly.network/types';
3
4
  import { parseUnits, TransactionResponse, ethers } from 'ethers';
4
- import { AccountStatusEnum } from '@orderly.network/types';
5
5
 
6
6
  interface OrderlyKeyPair {
7
7
  getPublicKey(): Promise<string>;
@@ -149,11 +149,15 @@ declare function parseAccountId(userAddress: string, brokerId: string): string;
149
149
  declare function parseTokenHash(tokenSymbol: string): string;
150
150
  declare function calculateStringHash(input: string): string;
151
151
  declare function formatByUnits(amount: string, unit?: number | "ether" | "gwei"): string;
152
+ declare function isHex(value: string): boolean;
153
+ declare function isHexString(value: string): boolean;
152
154
 
153
155
  type utils_SignatureDomain = SignatureDomain;
154
156
  declare const utils_base64url: typeof base64url;
155
157
  declare const utils_calculateStringHash: typeof calculateStringHash;
156
158
  declare const utils_formatByUnits: typeof formatByUnits;
159
+ declare const utils_isHex: typeof isHex;
160
+ declare const utils_isHexString: typeof isHexString;
157
161
  declare const utils_parseAccountId: typeof parseAccountId;
158
162
  declare const utils_parseBrokerHash: typeof parseBrokerHash;
159
163
  declare const utils_parseTokenHash: typeof parseTokenHash;
@@ -164,6 +168,8 @@ declare namespace utils {
164
168
  utils_base64url as base64url,
165
169
  utils_calculateStringHash as calculateStringHash,
166
170
  utils_formatByUnits as formatByUnits,
171
+ utils_isHex as isHex,
172
+ utils_isHexString as isHexString,
167
173
  utils_parseAccountId as parseAccountId,
168
174
  utils_parseBrokerHash as parseBrokerHash,
169
175
  utils_parseTokenHash as parseTokenHash,
@@ -265,21 +271,6 @@ declare class BaseContract implements IContract {
265
271
  type: string;
266
272
  stateMutability?: undefined;
267
273
  outputs?: undefined;
268
- } | {
269
- inputs: {
270
- internalType: string;
271
- name: string;
272
- type: string;
273
- }[];
274
- name: string;
275
- outputs: {
276
- internalType: string;
277
- name: string;
278
- type: string;
279
- }[];
280
- stateMutability: string;
281
- type: string;
282
- anonymous?: undefined;
283
274
  } | {
284
275
  inputs: ({
285
276
  internalType: string;
@@ -297,7 +288,11 @@ declare class BaseContract implements IContract {
297
288
  type: string;
298
289
  })[];
299
290
  name: string;
300
- outputs: never[];
291
+ outputs: {
292
+ internalType: string;
293
+ name: string;
294
+ type: string;
295
+ }[];
301
296
  stateMutability: string;
302
297
  type: string;
303
298
  anonymous?: undefined;
@@ -377,6 +372,9 @@ interface IWalletAdapter {
377
372
  call(address: string, method: string, params: any, options: {
378
373
  abi: any;
379
374
  }): Promise<any>;
375
+ callOnChain(chain: API.NetworkInfos, address: string, method: string, params: any, options: {
376
+ abi: any;
377
+ }): Promise<any>;
380
378
  on(eventName: any, listener: any): void;
381
379
  off(eventName: any, listener: any): void;
382
380
  }
@@ -384,7 +382,7 @@ declare type WalletAdapterOptions = {
384
382
  provider: any;
385
383
  address: string;
386
384
  chain: {
387
- id: string;
385
+ id: number;
388
386
  };
389
387
  };
390
388
  declare type getWalletAdapterFunc = (options: WalletAdapterOptions) => IWalletAdapter;
@@ -416,7 +414,14 @@ declare class Assets {
416
414
  address: string;
417
415
  }): Promise<any>;
418
416
  private _approve;
419
- deposit(amount: string): Promise<ethers.TransactionResponse>;
417
+ getDepositData(amount: string): {
418
+ accountId: string | undefined;
419
+ brokerHash: string;
420
+ tokenHash: string;
421
+ tokenAmount: string;
422
+ };
423
+ getDepositFee(amount: string, chain: API.NetworkInfos): Promise<any>;
424
+ deposit(amount: string, fee?: bigint): Promise<ethers.TransactionResponse>;
420
425
  private _simpleFetch;
421
426
  get usdcAddress(): string;
422
427
  }
@@ -464,7 +469,7 @@ declare class Account {
464
469
  setAddress(address: string, wallet?: {
465
470
  provider: any;
466
471
  chain: {
467
- id: string;
472
+ id: string | number;
468
473
  };
469
474
  wallet?: {
470
475
  name: string;
@@ -522,6 +527,9 @@ declare class EtherAdapter implements IWalletAdapter {
522
527
  call(address: string, method: string, params: any[], options: {
523
528
  abi: any;
524
529
  }): Promise<any>;
530
+ callOnChain(chain: API.NetworkInfos, address: string, method: string, params: any[], options: {
531
+ abi: any;
532
+ }): Promise<any>;
525
533
  get chainId(): number;
526
534
  get addresses(): string;
527
535
  send(method: string, params: Array<any> | Record<string, any>): Promise<any>;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import EventEmitter from 'eventemitter3';
2
2
  export { default as EventEmitter } from 'eventemitter3';
3
+ import { API, AccountStatusEnum } from '@orderly.network/types';
3
4
  import { parseUnits, TransactionResponse, ethers } from 'ethers';
4
- import { AccountStatusEnum } from '@orderly.network/types';
5
5
 
6
6
  interface OrderlyKeyPair {
7
7
  getPublicKey(): Promise<string>;
@@ -149,11 +149,15 @@ declare function parseAccountId(userAddress: string, brokerId: string): string;
149
149
  declare function parseTokenHash(tokenSymbol: string): string;
150
150
  declare function calculateStringHash(input: string): string;
151
151
  declare function formatByUnits(amount: string, unit?: number | "ether" | "gwei"): string;
152
+ declare function isHex(value: string): boolean;
153
+ declare function isHexString(value: string): boolean;
152
154
 
153
155
  type utils_SignatureDomain = SignatureDomain;
154
156
  declare const utils_base64url: typeof base64url;
155
157
  declare const utils_calculateStringHash: typeof calculateStringHash;
156
158
  declare const utils_formatByUnits: typeof formatByUnits;
159
+ declare const utils_isHex: typeof isHex;
160
+ declare const utils_isHexString: typeof isHexString;
157
161
  declare const utils_parseAccountId: typeof parseAccountId;
158
162
  declare const utils_parseBrokerHash: typeof parseBrokerHash;
159
163
  declare const utils_parseTokenHash: typeof parseTokenHash;
@@ -164,6 +168,8 @@ declare namespace utils {
164
168
  utils_base64url as base64url,
165
169
  utils_calculateStringHash as calculateStringHash,
166
170
  utils_formatByUnits as formatByUnits,
171
+ utils_isHex as isHex,
172
+ utils_isHexString as isHexString,
167
173
  utils_parseAccountId as parseAccountId,
168
174
  utils_parseBrokerHash as parseBrokerHash,
169
175
  utils_parseTokenHash as parseTokenHash,
@@ -265,21 +271,6 @@ declare class BaseContract implements IContract {
265
271
  type: string;
266
272
  stateMutability?: undefined;
267
273
  outputs?: undefined;
268
- } | {
269
- inputs: {
270
- internalType: string;
271
- name: string;
272
- type: string;
273
- }[];
274
- name: string;
275
- outputs: {
276
- internalType: string;
277
- name: string;
278
- type: string;
279
- }[];
280
- stateMutability: string;
281
- type: string;
282
- anonymous?: undefined;
283
274
  } | {
284
275
  inputs: ({
285
276
  internalType: string;
@@ -297,7 +288,11 @@ declare class BaseContract implements IContract {
297
288
  type: string;
298
289
  })[];
299
290
  name: string;
300
- outputs: never[];
291
+ outputs: {
292
+ internalType: string;
293
+ name: string;
294
+ type: string;
295
+ }[];
301
296
  stateMutability: string;
302
297
  type: string;
303
298
  anonymous?: undefined;
@@ -377,6 +372,9 @@ interface IWalletAdapter {
377
372
  call(address: string, method: string, params: any, options: {
378
373
  abi: any;
379
374
  }): Promise<any>;
375
+ callOnChain(chain: API.NetworkInfos, address: string, method: string, params: any, options: {
376
+ abi: any;
377
+ }): Promise<any>;
380
378
  on(eventName: any, listener: any): void;
381
379
  off(eventName: any, listener: any): void;
382
380
  }
@@ -384,7 +382,7 @@ declare type WalletAdapterOptions = {
384
382
  provider: any;
385
383
  address: string;
386
384
  chain: {
387
- id: string;
385
+ id: number;
388
386
  };
389
387
  };
390
388
  declare type getWalletAdapterFunc = (options: WalletAdapterOptions) => IWalletAdapter;
@@ -416,7 +414,14 @@ declare class Assets {
416
414
  address: string;
417
415
  }): Promise<any>;
418
416
  private _approve;
419
- deposit(amount: string): Promise<ethers.TransactionResponse>;
417
+ getDepositData(amount: string): {
418
+ accountId: string | undefined;
419
+ brokerHash: string;
420
+ tokenHash: string;
421
+ tokenAmount: string;
422
+ };
423
+ getDepositFee(amount: string, chain: API.NetworkInfos): Promise<any>;
424
+ deposit(amount: string, fee?: bigint): Promise<ethers.TransactionResponse>;
420
425
  private _simpleFetch;
421
426
  get usdcAddress(): string;
422
427
  }
@@ -464,7 +469,7 @@ declare class Account {
464
469
  setAddress(address: string, wallet?: {
465
470
  provider: any;
466
471
  chain: {
467
- id: string;
472
+ id: string | number;
468
473
  };
469
474
  wallet?: {
470
475
  name: string;
@@ -522,6 +527,9 @@ declare class EtherAdapter implements IWalletAdapter {
522
527
  call(address: string, method: string, params: any[], options: {
523
528
  abi: any;
524
529
  }): Promise<any>;
530
+ callOnChain(chain: API.NetworkInfos, address: string, method: string, params: any[], options: {
531
+ abi: any;
532
+ }): Promise<any>;
525
533
  get chainId(): number;
526
534
  get addresses(): string;
527
535
  send(method: string, params: Array<any> | Record<string, any>): Promise<any>;