@@ -5,36 +5,46 @@ An ironfish provider implementation and utilities in TypeScript.
5
5
6
6
** Features:**
7
7
8
- - Ironfish rpc over socket, both Tcp and Tls are supported
8
+ - Ironfish rpc over http
9
9
- Fully ** TypeScript** ready, with definition files and full TypeScript source
10
10
11
11
** Methods:**
12
12
13
13
- getBalance
14
- - getTransaction
14
+ - getBalances
15
+ - mintAsset
16
+ - burnAsset
17
+ - createTransaction
18
+ - sendTransaction
19
+ - getAccountTransaction
20
+ - getAccountTransactions
21
+ - getAsset
22
+ - broadcastTransaction
15
23
- getBlock
16
24
- getChainInfo
17
- - getStatus
18
- - sendTransaction
25
+ - getTransaction
19
26
20
- ** Basic Rpc Usage:**
27
+ ** Rpc Usage:**
21
28
22
29
``` typescript
23
- import { RpcService , RpcTcpClient , RpcTlsClient } from ' oreos' ;
30
+ import { RpcService } from ' oreos' ;
24
31
25
- // communication with rpc server over tcp
26
- const tcpProvider = new RpcService (ip , port , rpcAuthToken , ' TCP' );
27
- // communication with rpc server over tls
28
- const tlsProvider = new RpcService (ip , port , rpcAuthToken , ' TLS' );
32
+ const provider = new RpcService (ip , port );
29
33
30
34
type GetBalanceRequest = {
31
35
account? : string ;
32
36
assetId? : string ;
33
37
confirmations? : number ;
34
38
};
39
+
40
+ type AssetVerification = {
41
+ status: ' verified' | ' unverified' | ' unknown' ;
42
+ };
43
+
35
44
type GetBalanceResponse = {
36
45
account: string ;
37
46
assetId: string ;
47
+ assetVerification: AssetVerification ;
38
48
confirmed: string ;
39
49
unconfirmed: string ;
40
50
unconfirmedCount: number ;
@@ -51,44 +61,5 @@ const getBalanceRequest: GetBalanceRequest = {
51
61
confirmations: 2 ,
52
62
};
53
63
54
- // get balance with tcp/tls provider
55
- const response: GetBalanceResponse = await tcpProvider .getBalance (getBalanceRequest );
56
- ```
57
-
58
- ** Advanced:**
59
-
60
- As shown above, only part of rpc methods are supported by Oreos rpc service component. Therefore, Oreos provides another
61
- way to perform rpc request.
62
-
63
- ``` typescript
64
- import { RpcTcpClient , RpcTlsClient } from ' oreos' ;
65
-
66
- const tcpClient = new RpcTcpClient (ip , port , rpcAuthToken );
67
- const tlsClient = new RpcTlsClient (ip , port , rpcAuthToken );
68
-
69
- // to perform getBalance
70
- const getBalanceRequest: GetBalanceRequest = {
71
- account: ' default' ,
72
- confirmations: 2 ,
73
- };
74
- const response = await tlsClient .send (" wallet/getBalance" , getBalanceRequest );
75
- ```
76
-
77
- Please refer to [ HowToRpc.md] ( /docs/HowToRpc.md ) for more details about rpc.
78
-
79
- ** Account & Transaction:**
80
-
81
- ` CreateAccount ` , ` ImportAccount ` and ` Transaction ` based components are supported.
82
-
83
- ``` typescript
84
- import {
85
- Account ,
86
- createAccount ,
87
- importAccount ,
88
- } from ' oreos' ;
89
-
90
- const newAccount: Account = createAccount (accountName );
91
- const importedAccount: Account = importAccount (newAccount .name , newAccount .spendingKey );
64
+ const response: GetBalanceResponse = await provider .getBalance (getBalanceRequest );
92
65
```
93
-
94
- Please refer to [ HowToWallet.md] ( /docs/HowToWallet.md ) for more details about wallet.
0 commit comments