zano_web3 9.2.0 → 9.2.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/README.md +460 -410
- package/package.json +85 -85
- package/server/src/index.ts +3 -3
- package/server/src/server.ts +380 -380
- package/server/src/types.ts +111 -111
- package/server/src/utils.ts +12 -12
- package/shared/src/utils.ts +1 -1
- package/web/src/hooks.ts +17 -17
- package/web/src/index.ts +6 -6
- package/web/src/types.ts +35 -35
- package/web/src/zanoWallet.ts +219 -219
package/server/src/types.ts
CHANGED
|
@@ -1,111 +1,111 @@
|
|
|
1
|
-
export interface BaseAuthData {
|
|
2
|
-
address: string;
|
|
3
|
-
signature: string;
|
|
4
|
-
message: string;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export interface AliasAuth extends BaseAuthData {
|
|
8
|
-
alias: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface PkeyAuth extends BaseAuthData {
|
|
12
|
-
pkey: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export type AuthData = AliasAuth | PkeyAuth;
|
|
16
|
-
|
|
17
|
-
export interface ValidationParams {
|
|
18
|
-
buff: string;
|
|
19
|
-
sig: string;
|
|
20
|
-
alias?: string;
|
|
21
|
-
pkey?: string;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface APIAsset {
|
|
25
|
-
asset_id: string;
|
|
26
|
-
current_supply: number;
|
|
27
|
-
decimal_point: number;
|
|
28
|
-
full_name: string;
|
|
29
|
-
hidden_supply: boolean;
|
|
30
|
-
meta_info: string;
|
|
31
|
-
owner: string;
|
|
32
|
-
ticker: string;
|
|
33
|
-
total_max_supply: number;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface APIBalance {
|
|
37
|
-
asset_info: APIAsset;
|
|
38
|
-
awaiting_in: number;
|
|
39
|
-
awaiting_out: number;
|
|
40
|
-
total: number;
|
|
41
|
-
unlocked: number;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export interface BalanceInfo {
|
|
45
|
-
name: string;
|
|
46
|
-
ticker: string;
|
|
47
|
-
id: string;
|
|
48
|
-
amount: string;
|
|
49
|
-
awaiting_in: string;
|
|
50
|
-
awaiting_out: string;
|
|
51
|
-
total: string;
|
|
52
|
-
unlocked: string;
|
|
53
|
-
asset_info: APIAsset;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export interface SubTransfer {
|
|
57
|
-
amount: number;
|
|
58
|
-
asset_id: string;
|
|
59
|
-
is_income: boolean;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export interface EmployedEntry {
|
|
63
|
-
amount: number;
|
|
64
|
-
asset_id: string;
|
|
65
|
-
index: number;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export interface Transfer {
|
|
69
|
-
employed_entries: {
|
|
70
|
-
receive: EmployedEntry[];
|
|
71
|
-
spent: EmployedEntry[];
|
|
72
|
-
};
|
|
73
|
-
subtransfers: SubTransfer[];
|
|
74
|
-
comment: string;
|
|
75
|
-
fee: number;
|
|
76
|
-
height: number;
|
|
77
|
-
is_mining: boolean;
|
|
78
|
-
is_mixing: boolean;
|
|
79
|
-
is_service: boolean;
|
|
80
|
-
payment_id: string;
|
|
81
|
-
show_sender: boolean;
|
|
82
|
-
timestamp: number;
|
|
83
|
-
transfer_internal_index: number;
|
|
84
|
-
tx_blob_size: number;
|
|
85
|
-
tx_hash: string;
|
|
86
|
-
tx_type: number;
|
|
87
|
-
unlock_time: number;
|
|
88
|
-
remote_addresses: string[] | undefined;
|
|
89
|
-
remote_aliases: string[] | undefined;
|
|
90
|
-
}
|
|
91
|
-
export interface TxInfo {
|
|
92
|
-
last_item_index: number;
|
|
93
|
-
pi: {
|
|
94
|
-
balance: number;
|
|
95
|
-
curent_height: number;
|
|
96
|
-
transfer_entries_count: number;
|
|
97
|
-
transfers_count: number;
|
|
98
|
-
unlocked_balance: number;
|
|
99
|
-
};
|
|
100
|
-
total_transfers: number;
|
|
101
|
-
transfers: Transfer[];
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export interface AliasDetails {
|
|
105
|
-
alias_details: {
|
|
106
|
-
address: string;
|
|
107
|
-
comment: string;
|
|
108
|
-
tracking_key: string;
|
|
109
|
-
};
|
|
110
|
-
status: 'OK' | 'NOT_FOUND';
|
|
111
|
-
}
|
|
1
|
+
export interface BaseAuthData {
|
|
2
|
+
address: string;
|
|
3
|
+
signature: string;
|
|
4
|
+
message: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface AliasAuth extends BaseAuthData {
|
|
8
|
+
alias: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface PkeyAuth extends BaseAuthData {
|
|
12
|
+
pkey: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type AuthData = AliasAuth | PkeyAuth;
|
|
16
|
+
|
|
17
|
+
export interface ValidationParams {
|
|
18
|
+
buff: string;
|
|
19
|
+
sig: string;
|
|
20
|
+
alias?: string;
|
|
21
|
+
pkey?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface APIAsset {
|
|
25
|
+
asset_id: string;
|
|
26
|
+
current_supply: number;
|
|
27
|
+
decimal_point: number;
|
|
28
|
+
full_name: string;
|
|
29
|
+
hidden_supply: boolean;
|
|
30
|
+
meta_info: string;
|
|
31
|
+
owner: string;
|
|
32
|
+
ticker: string;
|
|
33
|
+
total_max_supply: number;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface APIBalance {
|
|
37
|
+
asset_info: APIAsset;
|
|
38
|
+
awaiting_in: number;
|
|
39
|
+
awaiting_out: number;
|
|
40
|
+
total: number;
|
|
41
|
+
unlocked: number;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface BalanceInfo {
|
|
45
|
+
name: string;
|
|
46
|
+
ticker: string;
|
|
47
|
+
id: string;
|
|
48
|
+
amount: string;
|
|
49
|
+
awaiting_in: string;
|
|
50
|
+
awaiting_out: string;
|
|
51
|
+
total: string;
|
|
52
|
+
unlocked: string;
|
|
53
|
+
asset_info: APIAsset;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface SubTransfer {
|
|
57
|
+
amount: number;
|
|
58
|
+
asset_id: string;
|
|
59
|
+
is_income: boolean;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface EmployedEntry {
|
|
63
|
+
amount: number;
|
|
64
|
+
asset_id: string;
|
|
65
|
+
index: number;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface Transfer {
|
|
69
|
+
employed_entries: {
|
|
70
|
+
receive: EmployedEntry[];
|
|
71
|
+
spent: EmployedEntry[];
|
|
72
|
+
};
|
|
73
|
+
subtransfers: SubTransfer[];
|
|
74
|
+
comment: string;
|
|
75
|
+
fee: number;
|
|
76
|
+
height: number;
|
|
77
|
+
is_mining: boolean;
|
|
78
|
+
is_mixing: boolean;
|
|
79
|
+
is_service: boolean;
|
|
80
|
+
payment_id: string;
|
|
81
|
+
show_sender: boolean;
|
|
82
|
+
timestamp: number;
|
|
83
|
+
transfer_internal_index: number;
|
|
84
|
+
tx_blob_size: number;
|
|
85
|
+
tx_hash: string;
|
|
86
|
+
tx_type: number;
|
|
87
|
+
unlock_time: number;
|
|
88
|
+
remote_addresses: string[] | undefined;
|
|
89
|
+
remote_aliases: string[] | undefined;
|
|
90
|
+
}
|
|
91
|
+
export interface TxInfo {
|
|
92
|
+
last_item_index: number;
|
|
93
|
+
pi: {
|
|
94
|
+
balance: number;
|
|
95
|
+
curent_height: number;
|
|
96
|
+
transfer_entries_count: number;
|
|
97
|
+
transfers_count: number;
|
|
98
|
+
unlocked_balance: number;
|
|
99
|
+
};
|
|
100
|
+
total_transfers: number;
|
|
101
|
+
transfers: Transfer[];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface AliasDetails {
|
|
105
|
+
alias_details: {
|
|
106
|
+
address: string;
|
|
107
|
+
comment: string;
|
|
108
|
+
tracking_key: string;
|
|
109
|
+
};
|
|
110
|
+
status: 'OK' | 'NOT_FOUND';
|
|
111
|
+
}
|
package/server/src/utils.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export const ZANO_ASSET_ID = "d6329b5b1f7c0805b5c345f4957554002a2f557845f64d7645dae0e051a6498a";
|
|
2
|
-
|
|
3
|
-
export class ZanoError extends Error {
|
|
4
|
-
|
|
5
|
-
public code: string;
|
|
6
|
-
public name: string;
|
|
7
|
-
|
|
8
|
-
constructor(message: string, code: string) {
|
|
9
|
-
super(message);
|
|
10
|
-
this.name = "ZanoError";
|
|
11
|
-
this.code = code;
|
|
12
|
-
}
|
|
1
|
+
export const ZANO_ASSET_ID = "d6329b5b1f7c0805b5c345f4957554002a2f557845f64d7645dae0e051a6498a";
|
|
2
|
+
|
|
3
|
+
export class ZanoError extends Error {
|
|
4
|
+
|
|
5
|
+
public code: string;
|
|
6
|
+
public name: string;
|
|
7
|
+
|
|
8
|
+
constructor(message: string, code: string) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.name = "ZanoError";
|
|
11
|
+
this.code = code;
|
|
12
|
+
}
|
|
13
13
|
}
|
package/shared/src/utils.ts
CHANGED
package/web/src/hooks.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import ZanoWallet, { ZanoWalletParams } from './zanoWallet';
|
|
2
|
-
import { useEffect, useState } from 'react';
|
|
3
|
-
|
|
4
|
-
function useZanoWallet(params: ZanoWalletParams) {
|
|
5
|
-
const [zanoWallet, setZanoWallet] = useState<ZanoWallet | null>(null);
|
|
6
|
-
|
|
7
|
-
useEffect(() => {
|
|
8
|
-
if (typeof window === 'undefined') {
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
setZanoWallet(new ZanoWallet(params));
|
|
13
|
-
}, []);
|
|
14
|
-
|
|
15
|
-
return zanoWallet;
|
|
16
|
-
}
|
|
17
|
-
|
|
1
|
+
import ZanoWallet, { ZanoWalletParams } from './zanoWallet';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
|
|
4
|
+
function useZanoWallet(params: ZanoWalletParams) {
|
|
5
|
+
const [zanoWallet, setZanoWallet] = useState<ZanoWallet | null>(null);
|
|
6
|
+
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
if (typeof window === 'undefined') {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
setZanoWallet(new ZanoWallet(params));
|
|
13
|
+
}, []);
|
|
14
|
+
|
|
15
|
+
return zanoWallet;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
18
|
export { useZanoWallet };
|
package/web/src/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import zanoWallet from "./zanoWallet";
|
|
2
|
-
|
|
3
|
-
import {useZanoWallet} from "./hooks";
|
|
4
|
-
export {useZanoWallet};
|
|
5
|
-
|
|
6
|
-
export * from "./types";
|
|
1
|
+
import zanoWallet from "./zanoWallet";
|
|
2
|
+
|
|
3
|
+
import {useZanoWallet} from "./hooks";
|
|
4
|
+
export {useZanoWallet};
|
|
5
|
+
|
|
6
|
+
export * from "./types";
|
|
7
7
|
export {zanoWallet};
|
package/web/src/types.ts
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
export interface Asset {
|
|
2
|
-
name: string;
|
|
3
|
-
ticker: string;
|
|
4
|
-
assetId: string;
|
|
5
|
-
decimalPoint: number;
|
|
6
|
-
balance: string;
|
|
7
|
-
unlockedBalance: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface Transfer {
|
|
11
|
-
amount: string;
|
|
12
|
-
assetId: string;
|
|
13
|
-
incoming: boolean;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface Transaction {
|
|
17
|
-
isConfirmed: boolean;
|
|
18
|
-
txHash: string;
|
|
19
|
-
blobSize: number;
|
|
20
|
-
timestamp: number;
|
|
21
|
-
height: number;
|
|
22
|
-
paymentId: string;
|
|
23
|
-
comment: string;
|
|
24
|
-
fee: string;
|
|
25
|
-
isInitiator: boolean;
|
|
26
|
-
transfers: Transfer[];
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface Wallet {
|
|
30
|
-
address: string;
|
|
31
|
-
alias: string;
|
|
32
|
-
balance: string;
|
|
33
|
-
assets: Asset[];
|
|
34
|
-
transactions: Transaction[];
|
|
35
|
-
}
|
|
1
|
+
export interface Asset {
|
|
2
|
+
name: string;
|
|
3
|
+
ticker: string;
|
|
4
|
+
assetId: string;
|
|
5
|
+
decimalPoint: number;
|
|
6
|
+
balance: string;
|
|
7
|
+
unlockedBalance: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface Transfer {
|
|
11
|
+
amount: string;
|
|
12
|
+
assetId: string;
|
|
13
|
+
incoming: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface Transaction {
|
|
17
|
+
isConfirmed: boolean;
|
|
18
|
+
txHash: string;
|
|
19
|
+
blobSize: number;
|
|
20
|
+
timestamp: number;
|
|
21
|
+
height: number;
|
|
22
|
+
paymentId: string;
|
|
23
|
+
comment: string;
|
|
24
|
+
fee: string;
|
|
25
|
+
isInitiator: boolean;
|
|
26
|
+
transfers: Transfer[];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface Wallet {
|
|
30
|
+
address: string;
|
|
31
|
+
alias: string;
|
|
32
|
+
balance: string;
|
|
33
|
+
assets: Asset[];
|
|
34
|
+
transactions: Transaction[];
|
|
35
|
+
}
|