@xelis/sdk 0.8.4 → 0.9.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.
@@ -1,6 +1,6 @@
1
- import { WS as BaseWS } from '../lib/websocket.js';
2
- import { GetAssetParams, TransactionData } from '../daemon/types.js';
3
- import { BuildTransactionParams, BuildTransactionResult, GetAddressParams, ListTransactionParams, SplitAddressParams, SplitAddressResult, Signature, TransactionEntry } from './types.js';
1
+ import { WS as BaseWS } from '../lib/websocket';
2
+ import { GetAssetParams } from '../daemon/types';
3
+ import { BuildTransactionParams, BuildTransactionResult, GetAddressParams, ListTransactionParams, SplitAddressParams, SplitAddressResult, Signature, TransactionEntry, RescanParams, SetOnlineModeParams, EstimateFeesParams } from './types';
4
4
  export declare class WalletMethods {
5
5
  ws: BaseWS;
6
6
  prefix: string;
@@ -12,7 +12,7 @@ export declare class WalletMethods {
12
12
  getTopoheight(): Promise<number>;
13
13
  getAddress(params?: GetAddressParams): Promise<string>;
14
14
  splitAddress(params: SplitAddressParams): Promise<SplitAddressResult>;
15
- rescan(): Promise<void>;
15
+ rescan(params: RescanParams): Promise<boolean>;
16
16
  getBalance(asset?: string): Promise<number>;
17
17
  getTrackedAssets(): Promise<string[]>;
18
18
  getAssetPrecision(params: GetAssetParams): Promise<number>;
@@ -21,7 +21,9 @@ export declare class WalletMethods {
21
21
  listTransactions(params?: ListTransactionParams): Promise<TransactionEntry[]>;
22
22
  isOnline(): Promise<boolean>;
23
23
  signData(data: any): Promise<Signature>;
24
- estimateFees(txData: TransactionData): Promise<number>;
24
+ estimateFees(params: EstimateFeesParams): Promise<number>;
25
+ setOnlineMode(params: SetOnlineModeParams): Promise<boolean>;
26
+ setOfflineMode(): Promise<boolean>;
25
27
  }
26
28
  export declare class WS extends BaseWS {
27
29
  methods: WalletMethods;
@@ -1,11 +1,11 @@
1
- import { WS as BaseWS } from '../lib/websocket.js';
2
- import { ApplicationData } from '../wallet/types.js';
3
- import { DaemonMethods } from '../daemon/websocket.js';
4
- import { WalletMethods } from '../wallet/websocket.js';
1
+ import { WS as BaseWS } from '../lib/websocket';
2
+ import { ApplicationData } from '../wallet/types';
3
+ import { DaemonMethods } from '../daemon/websocket';
4
+ import { WalletMethods } from '../wallet/websocket';
5
5
  export declare class WS extends BaseWS {
6
6
  daemon: DaemonMethods;
7
7
  wallet: WalletMethods;
8
8
  constructor();
9
- authorize(app: ApplicationData): Promise<import("../lib/types.js").RPCResponse<unknown>>;
9
+ authorize(app: ApplicationData): Promise<import("../lib/types").RPCResponse<unknown>>;
10
10
  }
11
11
  export default WS;
package/package.json CHANGED
@@ -1,39 +1,42 @@
1
- {
2
- "version": "0.8.4",
3
- "name": "@xelis/sdk",
4
- "description": "Xelis software development kit for JS",
5
- "exports": {
6
- "./*": {
7
- "types": "./dist/types/*.d.ts",
8
- "require": "./dist/cjs/*.js",
9
- "import": "./dist/esm/*.js",
10
- "default": "./dist/esm/*.js"
11
- }
12
- },
13
- "repository": {
14
- "type": "git",
15
- "url": "git+https://github.com/xelis-project/xelis-js-sdk"
16
- },
17
- "homepage": "https://github.com/xelis-project/xelis-js-sdk#readme",
18
- "scripts": {
19
- "test": "jest",
20
- "compile": "tsc -b ./tsconfig.cjs.json ./tsconfig.esm.json ./tsconfig.types.json",
21
- "clean": "rm -rf ./dist",
22
- "build": "npm run clean && npm run compile && node create_esm_pkg.js",
23
- "prepublishOnly": "npm run build"
24
- },
25
- "devDependencies": {
26
- "@types/jest": "^29.4.0",
27
- "@types/react": "^18.2.23",
28
- "@types/ws": "^8.5.4",
29
- "ts-jest": "^29.0.5",
30
- "typescript": "^4.9.5"
31
- },
32
- "dependencies": {
33
- "await-to-js": "^3.0.0",
34
- "isomorphic-ws": "^5.0.0",
35
- "js-base64": "^3.7.6",
36
- "react": "^18.2.0",
37
- "ws": "^8.12.1"
38
- }
39
- }
1
+ {
2
+ "version": "0.9.0",
3
+ "name": "@xelis/sdk",
4
+ "description": "Xelis software development kit for JS",
5
+ "exports": {
6
+ "./*": {
7
+ "types": "./dist/types/*.d.ts",
8
+ "require": "./dist/cjs/*.js",
9
+ "import": "./dist/esm/*.js",
10
+ "default": "./dist/esm/*.js"
11
+ }
12
+ },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/xelis-project/xelis-js-sdk"
16
+ },
17
+ "homepage": "https://github.com/xelis-project/xelis-js-sdk#readme",
18
+ "scripts": {
19
+ "test-func": "jest -t",
20
+ "test": "jest",
21
+ "compile": "tsc -b ./tsconfig.cjs.json ./tsconfig.esm.json ./tsconfig.types.json",
22
+ "fix-esm": "fix-esm-import-path ./dist/esm",
23
+ "clean": "rm -rf ./dist",
24
+ "build": "npm run clean && npm run compile && node create_esm_pkg.js && npm run fix-esm",
25
+ "prepublishOnly": "npm run build"
26
+ },
27
+ "devDependencies": {
28
+ "@types/jest": "^29.4.0",
29
+ "@types/react": "^18.2.23",
30
+ "@types/ws": "^8.5.4",
31
+ "fix-esm-import-path": "^1.5.0",
32
+ "ts-jest": "^29.0.5",
33
+ "typescript": "^4.9.5"
34
+ },
35
+ "dependencies": {
36
+ "await-to-js": "^3.0.0",
37
+ "isomorphic-ws": "^5.0.0",
38
+ "js-base64": "^3.7.6",
39
+ "react": "^18.2.0",
40
+ "ws": "^8.12.1"
41
+ }
42
+ }
@@ -0,0 +1,22 @@
1
+ const { RPC: DaemonRPC } = require('../dist/cjs/daemon/rpc')
2
+ const { WS: DaemonWS } = require('../dist/cjs/daemon/websocket')
3
+ const { WS: WalletWS } = require('../dist/cjs/wallet/websocket')
4
+ const { TESTNET_NODE_RPC, TESTNET_NODE_WS, LOCAL_NODE_WS } = require('../dist/cjs/config')
5
+
6
+ const main = async () => {
7
+ const daemonRPC = new DaemonRPC(TESTNET_NODE_RPC)
8
+ const res1 = await daemonRPC.getInfo()
9
+ console.log(res1)
10
+
11
+ const daemonWS = new DaemonWS()
12
+ await daemonWS.connect(TESTNET_NODE_WS)
13
+ const res2 = await daemonWS.methods.getInfo()
14
+ console.log(res2)
15
+
16
+ const walletWS = new WalletWS(`test`, `test`)
17
+ await walletWS.connect(LOCAL_NODE_WS)
18
+ const res3 = await walletWS.methods.getVersion()
19
+ console.log(res3)
20
+ }
21
+
22
+ main()
@@ -0,0 +1,12 @@
1
+ import { RPC as DaemonRPC } from '../dist/esm/daemon/rpc.js'
2
+ import { TESTNET_NODE_RPC } from '../dist/esm/config.js'
3
+
4
+ // need to add "type": "module" in package.json to test
5
+
6
+ const main = async () => {
7
+ const daemon = new DaemonRPC(TESTNET_NODE_RPC)
8
+ const res = await daemon.getInfo()
9
+ console.log(res)
10
+ }
11
+
12
+ main()