@paradex/sdk 0.1.1 → 0.2.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/account.d.ts CHANGED
@@ -1,5 +1,8 @@
1
- import type { ParadexConfig } from './config';
2
- import type { EthereumSigner } from './ethereum-signer';
1
+ import type { ParadexConfig } from './config.js';
2
+ import type { EthereumSigner } from './ethereum-signer.js';
3
+ interface Account {
4
+ readonly address: string;
5
+ }
3
6
  interface FromEthSignerParams {
4
7
  readonly config: ParadexConfig;
5
8
  readonly signer: EthereumSigner;
@@ -8,7 +11,5 @@ interface FromEthSignerParams {
8
11
  * Generates a Paradex account from an Ethereum wallet.
9
12
  * @returns The generated Paradex account.
10
13
  */
11
- export declare function fromEthSigner({ config, signer }: FromEthSignerParams): Promise<{
12
- address: string;
13
- }>;
14
+ export declare function fromEthSigner({ config, signer, }: FromEthSignerParams): Promise<Account>;
14
15
  export {};
package/dist/account.js CHANGED
@@ -4,7 +4,7 @@ import { CallData, hash } from 'starknet';
4
4
  * Generates a Paradex account from an Ethereum wallet.
5
5
  * @returns The generated Paradex account.
6
6
  */
7
- export async function fromEthSigner({ config, signer }) {
7
+ export async function fromEthSigner({ config, signer, }) {
8
8
  const starkKeyTypedData = buildStarkKeyTypedData(config.l1ChainId);
9
9
  const signature = await signer.signTypedData(starkKeyTypedData);
10
10
  const privateKey = keyDerivation.getPrivateKeyFromEthSignature(signature);
package/dist/config.d.ts CHANGED
@@ -15,7 +15,7 @@ export interface RawParadexConfig {
15
15
  readonly paraclear_decimals: number;
16
16
  readonly paraclear_account_proxy_hash: string;
17
17
  readonly paraclear_account_hash: string;
18
- readonly bridged_tokens: ReadonlyArray<RawBridgedTokenConfig>;
18
+ readonly bridged_tokens: readonly RawBridgedTokenConfig[];
19
19
  readonly l1_core_contract_address: `0x${string}`;
20
20
  readonly l1_operator_address: `0x${string}`;
21
21
  readonly l1_chain_id: string;
@@ -1,10 +1,11 @@
1
1
  import type { ethers } from 'ethers';
2
- interface TypedData {
2
+ export interface TypedData {
3
3
  readonly domain: {
4
4
  readonly name: string;
5
5
  readonly version: string;
6
6
  readonly chainId: string;
7
7
  };
8
+ readonly primaryType: string;
8
9
  readonly types: Record<string, Array<{
9
10
  readonly name: string;
10
11
  readonly type: string;
@@ -12,7 +13,6 @@ interface TypedData {
12
13
  readonly message: Record<string, unknown>;
13
14
  }
14
15
  export interface EthereumSigner {
15
- signTypedData(typedData: TypedData): Promise<string>;
16
+ readonly signTypedData: (typedData: TypedData) => Promise<string>;
16
17
  }
17
18
  export declare function ethersSignerAdapter(ethersSigner: ethers.Signer): EthereumSigner;
18
- export {};
@@ -1,7 +1,7 @@
1
1
  export function ethersSignerAdapter(ethersSigner) {
2
2
  return {
3
3
  async signTypedData(typedData) {
4
- return ethersSigner.signTypedData(typedData.domain, typedData.types, typedData.message);
4
+ return await ethersSigner.signTypedData(typedData.domain, typedData.types, typedData.message);
5
5
  },
6
6
  };
7
7
  }
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import * as _Config from './config';
2
- import * as _Account from './account';
3
- import * as _Signer from './ethereum-signer';
1
+ import * as _Account from './account.js';
2
+ import * as _Config from './config.js';
3
+ import * as _Signer from './ethereum-signer.js';
4
4
  export declare const Config: {
5
5
  fetchConfig: typeof _Config.fetchConfig;
6
6
  };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import * as _Config from './config';
2
- import * as _Account from './account';
3
- import * as _Signer from './ethereum-signer';
1
+ import * as _Account from './account.js';
2
+ import * as _Config from './config.js';
3
+ import * as _Signer from './ethereum-signer.js';
4
4
  export const Config = { fetchConfig: _Config.fetchConfig };
5
5
  export const Account = { fromEthSigner: _Account.fromEthSigner };
6
6
  export const Signer = { ethersSignerAdapter: _Signer.ethersSignerAdapter };
package/package.json CHANGED
@@ -1,20 +1,22 @@
1
1
  {
2
2
  "name": "@paradex/sdk",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "JavaScript SDK for Paradex",
5
5
  "main": "dist/index.js",
6
6
  "files": [
7
7
  "dist"
8
8
  ],
9
9
  "scripts": {
10
- "prepare": "husky && yarn build",
11
- "build": "yarn tsc",
12
- "lint": "prettier --check .",
13
- "format": "prettier --write ."
10
+ "prepare": "husky && tsc",
11
+ "build": "tsc",
12
+ "lint": "prettier --check . && eslint .",
13
+ "format": "prettier --write .",
14
+ "test": "jest"
14
15
  },
15
16
  "lint-staged": {
16
17
  "**/*": "prettier --write --ignore-unknown"
17
18
  },
19
+ "type": "module",
18
20
  "license": "MIT",
19
21
  "private": false,
20
22
  "keywords": [
@@ -29,11 +31,23 @@
29
31
  "starknet": "^6.6.6"
30
32
  },
31
33
  "devDependencies": {
34
+ "@ianvs/prettier-plugin-sort-imports": "^4.2.1",
32
35
  "@types/elliptic": "^6.4.18",
36
+ "@types/jest": "^29.5.12",
37
+ "@typescript-eslint/eslint-plugin": "6.21.0",
38
+ "@typescript-eslint/parser": "6.21.0",
39
+ "eslint": "^8.57.0",
40
+ "eslint-config-love": "^43.1.0",
41
+ "eslint-config-prettier": "^9.1.0",
42
+ "eslint-plugin-import": "^2.29.1",
43
+ "eslint-plugin-n": "^16.6.2 ",
44
+ "eslint-plugin-promise": "^6.0.0",
33
45
  "ethers": "^6.11.1",
34
46
  "husky": "^9.0.11",
47
+ "jest": "^29.7.0",
35
48
  "lint-staged": "^15.2.2",
36
49
  "prettier": "3.2.5",
37
- "typescript": "^5.4.3"
50
+ "ts-jest": "^29.1.2",
51
+ "typescript": "~5.3.3"
38
52
  }
39
53
  }