@rabby-wallet/rabby-api 0.6.13 → 0.6.14

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/types.js CHANGED
@@ -1 +1 @@
1
- export {};
1
+ export {};
package/dist/utils.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { CHAINS } from '@debank/common';
2
- import { AxiosRequestConfig } from 'axios';
3
- export declare const getChain: (chainId?: string) => import("@debank/common").Chain | null;
4
- export declare const INITIAL_OPENAPI_URL = "https://api.rabby.io";
5
- export { CHAINS };
6
- export declare const SIGN_HDS: readonly ["x-api-ts", "x-api-nonce", "x-api-ver", "x-api-sign"];
7
- export declare function genSignParams(config: AxiosRequestConfig): {
8
- method: any;
9
- url: string;
10
- params: Partial<any>;
11
- };
1
+ import { CHAINS } from '@debank/common';
2
+ import { AxiosRequestConfig } from 'axios';
3
+ export declare const getChain: (chainId?: string) => import("@debank/common").Chain | null;
4
+ export declare const INITIAL_OPENAPI_URL = "https://api.rabby.io";
5
+ export { CHAINS };
6
+ export declare const SIGN_HDS: readonly ["x-api-ts", "x-api-nonce", "x-api-ver", "x-api-sign"];
7
+ export declare function genSignParams(config: AxiosRequestConfig): {
8
+ method: any;
9
+ url: string;
10
+ params: Partial<any>;
11
+ };
package/dist/utils.js CHANGED
@@ -1,35 +1,35 @@
1
- import { isNil, keyBy, omitBy } from 'lodash';
2
- import { CHAINS } from '@debank/common';
3
- import { decode } from 'qss';
4
- const chainsDict = keyBy(CHAINS, 'serverId');
5
- export const getChain = (chainId) => {
6
- if (!chainId) {
7
- return null;
8
- }
9
- return chainsDict[chainId];
10
- };
11
- export const INITIAL_OPENAPI_URL = 'https://api.rabby.io';
12
- export { CHAINS };
13
- export const SIGN_HDS = [
14
- 'x-api-ts',
15
- 'x-api-nonce',
16
- 'x-api-ver',
17
- 'x-api-sign',
18
- ];
19
- export function genSignParams(config) {
20
- var _a, _b, _c;
21
- let params = omitBy((_a = config.params) !== null && _a !== void 0 ? _a : {}, isNil);
22
- const method = ((_b = config.method) !== null && _b !== void 0 ? _b : 'GET').toUpperCase();
23
- let url = decodeURIComponent((_c = config.url) !== null && _c !== void 0 ? _c : '');
24
- if (url.search(/\?/) > 0) {
25
- const [_url, qs] = url.split('?');
26
- const query = decode(qs);
27
- params = Object.assign(Object.assign({}, params), query);
28
- url = _url;
29
- }
30
- return {
31
- method,
32
- url,
33
- params,
34
- };
35
- }
1
+ import { isNil, keyBy, omitBy } from 'lodash';
2
+ import { CHAINS } from '@debank/common';
3
+ import { decode } from 'qss';
4
+ const chainsDict = keyBy(CHAINS, 'serverId');
5
+ export const getChain = (chainId) => {
6
+ if (!chainId) {
7
+ return null;
8
+ }
9
+ return chainsDict[chainId];
10
+ };
11
+ export const INITIAL_OPENAPI_URL = 'https://api.rabby.io';
12
+ export { CHAINS };
13
+ export const SIGN_HDS = [
14
+ 'x-api-ts',
15
+ 'x-api-nonce',
16
+ 'x-api-ver',
17
+ 'x-api-sign',
18
+ ];
19
+ export function genSignParams(config) {
20
+ var _a, _b, _c;
21
+ let params = omitBy((_a = config.params) !== null && _a !== void 0 ? _a : {}, isNil);
22
+ const method = ((_b = config.method) !== null && _b !== void 0 ? _b : 'GET').toUpperCase();
23
+ let url = decodeURIComponent((_c = config.url) !== null && _c !== void 0 ? _c : '');
24
+ if (url.search(/\?/) > 0) {
25
+ const [_url, qs] = url.split('?');
26
+ const query = decode(qs);
27
+ params = Object.assign(Object.assign({}, params), query);
28
+ url = _url;
29
+ }
30
+ return {
31
+ method,
32
+ url,
33
+ params,
34
+ };
35
+ }
package/package.json CHANGED
@@ -1,53 +1,53 @@
1
- {
2
- "name": "@rabby-wallet/rabby-api",
3
- "version": "0.6.13",
4
- "main": "dist/index.js",
5
- "files": [
6
- "dist"
7
- ],
8
- "publishConfig": {
9
- "access": "public"
10
- },
11
- "dependencies": {
12
- "@rabby-wallet/rabby-sign": "^0.3.3",
13
- "axios": "^0.27.2",
14
- "axios-rate-limit": "^1.3.0",
15
- "eth-rpc-errors": "^4.0.3",
16
- "lodash": "^4.17.21",
17
- "qss": "^2.0.3"
18
- },
19
- "devDependencies": {
20
- "@babel/preset-env": "^7.19.1",
21
- "@types/jest": "^29.0.3",
22
- "@types/lodash": "^4.14.185",
23
- "@types/node": "^18.7.18",
24
- "axios-mock-adapter": "^1.21.2",
25
- "babel-jest": "^29.0.3",
26
- "husky": ">=6",
27
- "jest": "^29.0.3",
28
- "jest-environment-jsdom": "^29.5.0",
29
- "jest-mock-axios": "^4.7.0-beta",
30
- "lint-staged": ">=10",
31
- "prettier": "^2.7.1",
32
- "rimraf": "^3.0.2",
33
- "ts-jest": "^29.0.1",
34
- "ts-node": "^10.9.1",
35
- "typescript": "^4.8.3"
36
- },
37
- "scripts": {
38
- "test": "jest test/*.spec.ts --env=./test/jsdom-env-hack.js",
39
- "build": "rimraf dist && tsc",
40
- "preversion": "npm run build",
41
- "prepublishOnly": "npm run build && npm run test",
42
- "prepare": "husky install"
43
- },
44
- "peerDependencies": {
45
- "@debank/common": "^0.3.5"
46
- },
47
- "author": "",
48
- "description": "",
49
- "license": "UNLICENSED",
50
- "lint-staged": {
51
- "*.{ts,css,md}": "prettier --write"
52
- }
53
- }
1
+ {
2
+ "name": "@rabby-wallet/rabby-api",
3
+ "version": "0.6.14",
4
+ "main": "dist/index.js",
5
+ "files": [
6
+ "dist"
7
+ ],
8
+ "publishConfig": {
9
+ "access": "public"
10
+ },
11
+ "dependencies": {
12
+ "@rabby-wallet/rabby-sign": "^0.3.3",
13
+ "axios": "^0.27.2",
14
+ "axios-rate-limit": "^1.3.0",
15
+ "eth-rpc-errors": "^4.0.3",
16
+ "lodash": "^4.17.21",
17
+ "qss": "^2.0.3"
18
+ },
19
+ "devDependencies": {
20
+ "@babel/preset-env": "^7.19.1",
21
+ "@types/jest": "^29.0.3",
22
+ "@types/lodash": "^4.14.185",
23
+ "@types/node": "^18.7.18",
24
+ "axios-mock-adapter": "^1.21.2",
25
+ "babel-jest": "^29.0.3",
26
+ "husky": ">=6",
27
+ "jest": "^29.0.3",
28
+ "jest-environment-jsdom": "^29.5.0",
29
+ "jest-mock-axios": "^4.7.0-beta",
30
+ "lint-staged": ">=10",
31
+ "prettier": "^2.7.1",
32
+ "rimraf": "^3.0.2",
33
+ "ts-jest": "^29.0.1",
34
+ "ts-node": "^10.9.1",
35
+ "typescript": "^4.8.3"
36
+ },
37
+ "scripts": {
38
+ "test": "jest test/*.spec.ts --env=./test/jsdom-env-hack.js",
39
+ "build": "rimraf dist && tsc",
40
+ "preversion": "npm run build",
41
+ "prepublishOnly": "npm run build && npm run test",
42
+ "prepare": "husky install"
43
+ },
44
+ "peerDependencies": {
45
+ "@debank/common": "^0.3.5"
46
+ },
47
+ "author": "",
48
+ "description": "",
49
+ "license": "UNLICENSED",
50
+ "lint-staged": {
51
+ "*.{ts,css,md}": "prettier --write"
52
+ }
53
+ }