@cityofzion/blockchain-service 3.1.8 → 3.1.10
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/interfaces.d.ts +51 -49
- package/package.json +2 -2
package/dist/interfaces.d.ts
CHANGED
|
@@ -24,15 +24,6 @@ export type TBSNetwork<T extends string = string> = {
|
|
|
24
24
|
url: string;
|
|
25
25
|
type: TBSNetworkType;
|
|
26
26
|
};
|
|
27
|
-
export type TTransferIntent = {
|
|
28
|
-
receiverAddress: string;
|
|
29
|
-
amount: string;
|
|
30
|
-
token: TBSToken;
|
|
31
|
-
};
|
|
32
|
-
export type TTransferParams<N extends string> = {
|
|
33
|
-
senderAccount: TBSAccount<N>;
|
|
34
|
-
intents: TTransferIntent[];
|
|
35
|
-
};
|
|
36
27
|
export type TPingNetworkResponse = {
|
|
37
28
|
latency: number;
|
|
38
29
|
url: string;
|
|
@@ -62,48 +53,30 @@ export interface IBlockchainService<N extends string, A extends string = string>
|
|
|
62
53
|
validateKey(key: string): boolean;
|
|
63
54
|
transfer(params: TTransferParams<N>): Promise<TTransaction<N>[]>;
|
|
64
55
|
}
|
|
56
|
+
export type TTransferIntent = {
|
|
57
|
+
receiverAddress: string;
|
|
58
|
+
amount: string;
|
|
59
|
+
token: TBSToken;
|
|
60
|
+
};
|
|
61
|
+
export type TTransferParams<N extends string> = {
|
|
62
|
+
senderAccount: TBSAccount<N>;
|
|
63
|
+
intents: TTransferIntent[];
|
|
64
|
+
};
|
|
65
|
+
export interface IBSWithFee<N extends string> {
|
|
66
|
+
calculateTransferFee(params: TTransferParams<N>): Promise<string>;
|
|
67
|
+
}
|
|
65
68
|
export interface IBSWithEncryption<N extends string> {
|
|
66
69
|
decrypt(keyOrJson: string, password: string): Promise<TBSAccount<N>>;
|
|
67
70
|
encrypt(key: string, password: string): Promise<string>;
|
|
68
71
|
validateEncrypted(keyOrJson: string): boolean;
|
|
69
72
|
}
|
|
70
|
-
export interface IBSWithFee<N extends string> {
|
|
71
|
-
calculateTransferFee(params: TTransferParams<N>): Promise<string>;
|
|
72
|
-
}
|
|
73
|
-
export interface IBSWithClaim<N extends string> {
|
|
74
|
-
claimService: IClaimService<N>;
|
|
75
|
-
}
|
|
76
73
|
export interface IBSWithNameService {
|
|
77
74
|
resolveNameServiceDomain(domainName: string): Promise<string>;
|
|
78
75
|
validateNameServiceDomainFormat(domainName: string): boolean;
|
|
79
76
|
}
|
|
80
|
-
export interface IBSWithExplorer {
|
|
81
|
-
explorerService: IExplorerService;
|
|
82
|
-
}
|
|
83
|
-
export interface IBSWithNft {
|
|
84
|
-
nftDataService: INftDataService;
|
|
85
|
-
}
|
|
86
|
-
export interface IBSWithLedger<N extends string> {
|
|
87
|
-
ledgerService: ILedgerService<N>;
|
|
88
|
-
generateAccountFromPublicKey(publicKey: string): Promise<TBSAccount<N>>;
|
|
89
|
-
}
|
|
90
|
-
export interface IBSWithWalletConnect<N extends string> {
|
|
91
|
-
walletConnectService: IWalletConnectService<N>;
|
|
92
|
-
}
|
|
93
|
-
export interface IBSWithFullTransactions<N extends string> {
|
|
94
|
-
fullTransactionsDataService: IFullTransactionsDataService<N>;
|
|
95
|
-
}
|
|
96
77
|
export interface IBSWithFaucet<N extends string> {
|
|
97
78
|
faucet(address: string): Promise<TTransaction<N>>;
|
|
98
79
|
}
|
|
99
|
-
export type TContractParameter = {
|
|
100
|
-
name: string;
|
|
101
|
-
type: string;
|
|
102
|
-
};
|
|
103
|
-
export type TGetTransactionsByAddressParams = {
|
|
104
|
-
address: string;
|
|
105
|
-
nextPageParams?: any;
|
|
106
|
-
};
|
|
107
80
|
export type TTransactionBaseEvent = {
|
|
108
81
|
methodName?: string;
|
|
109
82
|
from?: string;
|
|
@@ -125,13 +98,14 @@ export type TTransactionDefaultGenericEvent = TTransactionBaseEvent & {
|
|
|
125
98
|
eventType: 'generic';
|
|
126
99
|
data?: Record<string, string | number | boolean | undefined | null>;
|
|
127
100
|
};
|
|
101
|
+
export type TTransactionDefaultEvent = TTransactionDefaultNftEvent | TTransactionDefaultTokenEvent | TTransactionDefaultGenericEvent;
|
|
128
102
|
export type TTransactionUtxoInputOutput = {
|
|
129
103
|
address?: string;
|
|
130
104
|
addressUrl?: string;
|
|
131
105
|
amount: string;
|
|
132
106
|
token: TBSToken;
|
|
133
107
|
};
|
|
134
|
-
type TTransactionBase
|
|
108
|
+
export type TTransactionBase = {
|
|
135
109
|
txId: string;
|
|
136
110
|
txIdUrl?: string;
|
|
137
111
|
block?: number;
|
|
@@ -141,15 +115,17 @@ type TTransactionBase<N extends string> = {
|
|
|
141
115
|
networkFeeAmount?: string;
|
|
142
116
|
systemFeeAmount?: string;
|
|
143
117
|
data?: any;
|
|
118
|
+
};
|
|
119
|
+
export type TTransactionFullBase<N extends string> = TTransactionBase & {
|
|
144
120
|
isPending: boolean;
|
|
145
121
|
blockchain: N;
|
|
122
|
+
relatedAddress?: string;
|
|
146
123
|
};
|
|
147
|
-
export type
|
|
148
|
-
export type TTransactionDefault<N extends string> = TTransactionBase<N> & {
|
|
124
|
+
export type TTransactionDefault<N extends string> = TTransactionFullBase<N> & {
|
|
149
125
|
view: 'default';
|
|
150
126
|
events: TTransactionDefaultEvent[];
|
|
151
127
|
};
|
|
152
|
-
export type TTransactionUtxo<N extends string> =
|
|
128
|
+
export type TTransactionUtxo<N extends string> = TTransactionFullBase<N> & {
|
|
153
129
|
view: 'utxo';
|
|
154
130
|
hex: string;
|
|
155
131
|
totalAmount: string;
|
|
@@ -158,10 +134,18 @@ export type TTransactionUtxo<N extends string> = TTransactionBase<N> & {
|
|
|
158
134
|
outputs: TTransactionUtxoInputOutput[];
|
|
159
135
|
};
|
|
160
136
|
export type TTransaction<N extends string> = TTransactionDefault<N> | TTransactionUtxo<N>;
|
|
137
|
+
export type TGetTransactionsByAddressParams = {
|
|
138
|
+
address: string;
|
|
139
|
+
nextPageParams?: any;
|
|
140
|
+
};
|
|
161
141
|
export type TGetTransactionsByAddressResponse<N extends string, T extends TTransaction<N> = TTransaction<N>> = {
|
|
162
142
|
nextPageParams?: any;
|
|
163
143
|
transactions: T[];
|
|
164
144
|
};
|
|
145
|
+
export type TContractParameter = {
|
|
146
|
+
name: string;
|
|
147
|
+
type: string;
|
|
148
|
+
};
|
|
165
149
|
export type TContractMethod = {
|
|
166
150
|
name: string;
|
|
167
151
|
parameters: TContractParameter[];
|
|
@@ -200,6 +184,9 @@ export interface IFullTransactionsDataService<N extends string> {
|
|
|
200
184
|
getFullTransactionsByAddress(params: TGetFullTransactionsByAddressParams): Promise<TGetTransactionsByAddressResponse<N>>;
|
|
201
185
|
exportFullTransactionsByAddress(params: TExportFullTransactionsByAddressParams): Promise<string>;
|
|
202
186
|
}
|
|
187
|
+
export interface IBSWithFullTransactions<N extends string> {
|
|
188
|
+
fullTransactionsDataService: IFullTransactionsDataService<N>;
|
|
189
|
+
}
|
|
203
190
|
export type TClaimServiceTransactionData = {
|
|
204
191
|
isClaim: boolean;
|
|
205
192
|
};
|
|
@@ -208,7 +195,10 @@ export interface IClaimService<N extends string> {
|
|
|
208
195
|
getUnclaimed(address: string): Promise<string>;
|
|
209
196
|
calculateFee(account: TBSAccount<N>): Promise<string>;
|
|
210
197
|
claim(account: TBSAccount<N>): Promise<TTransactionDefault<N>>;
|
|
211
|
-
getTransactionData(transaction:
|
|
198
|
+
getTransactionData(transaction: TTransactionBase): TClaimServiceTransactionData | undefined;
|
|
199
|
+
}
|
|
200
|
+
export interface IBSWithClaim<N extends string> {
|
|
201
|
+
claimService: IClaimService<N>;
|
|
212
202
|
}
|
|
213
203
|
export type TTokenPricesResponse = {
|
|
214
204
|
usdPrice: number;
|
|
@@ -271,6 +261,9 @@ export interface INftDataService {
|
|
|
271
261
|
getNft(params: TGetNftParams): Promise<TNftResponse>;
|
|
272
262
|
hasToken(params: THasTokenParams): Promise<boolean>;
|
|
273
263
|
}
|
|
264
|
+
export interface IBSWithNft {
|
|
265
|
+
nftDataService: INftDataService;
|
|
266
|
+
}
|
|
274
267
|
export type TBuildNftUrlParams = {
|
|
275
268
|
collectionHash?: string;
|
|
276
269
|
tokenHash: string;
|
|
@@ -285,6 +278,9 @@ export interface IExplorerService {
|
|
|
285
278
|
getNftTemplateUrl(): string | undefined;
|
|
286
279
|
getContractTemplateUrl(): string | undefined;
|
|
287
280
|
}
|
|
281
|
+
export interface IBSWithExplorer {
|
|
282
|
+
explorerService: IExplorerService;
|
|
283
|
+
}
|
|
288
284
|
export type TLedgerServiceEmitter = TypedEmitter<{
|
|
289
285
|
getSignatureStart(): void | Promise<void>;
|
|
290
286
|
getSignatureEnd(): void | Promise<void>;
|
|
@@ -296,6 +292,10 @@ export interface ILedgerService<N extends string> {
|
|
|
296
292
|
getAccount(transport: Transport, index: number): Promise<TBSAccount<N>>;
|
|
297
293
|
getAccounts(transport: Transport, getUntilIndex?: TUntilIndexRecord<N>): Promise<TBSAccount<N>[]>;
|
|
298
294
|
}
|
|
295
|
+
export interface IBSWithLedger<N extends string> {
|
|
296
|
+
ledgerService: ILedgerService<N>;
|
|
297
|
+
generateAccountFromPublicKey(publicKey: string): Promise<TBSAccount<N>>;
|
|
298
|
+
}
|
|
299
299
|
export type TSwapToken<N extends string> = {
|
|
300
300
|
id: string;
|
|
301
301
|
blockchain?: N;
|
|
@@ -394,9 +394,6 @@ export interface IBridgeOrchestrator<N extends TBSBridgeName> {
|
|
|
394
394
|
switchTokens(): Promise<void>;
|
|
395
395
|
bridge(): Promise<string>;
|
|
396
396
|
}
|
|
397
|
-
export interface IBSWithNeo3NeoXBridge<N extends TBSBridgeName> {
|
|
398
|
-
neo3NeoXBridgeService: INeo3NeoXBridgeService<N>;
|
|
399
|
-
}
|
|
400
397
|
export type TNeo3NeoXBridgeServiceConstants = {
|
|
401
398
|
bridgeFee: string;
|
|
402
399
|
bridgeMaxAmount: string;
|
|
@@ -438,7 +435,10 @@ export interface INeo3NeoXBridgeService<N extends TBSBridgeName> {
|
|
|
438
435
|
getNonce(params: TNeo3NeoXBridgeServiceGetNonceParams<N>): Promise<string>;
|
|
439
436
|
getTransactionHashByNonce(params: TNeo3NeoXBridgeServiceGetTransactionHashByNonceParams<N>): Promise<string>;
|
|
440
437
|
getTokenByMultichainId(multichainId: string): TBridgeToken<N> | undefined;
|
|
441
|
-
getTransactionData(transaction:
|
|
438
|
+
getTransactionData(transaction: TTransactionBase): TNeo3NeoXBridgeTransactionData<N> | undefined;
|
|
439
|
+
}
|
|
440
|
+
export interface IBSWithNeo3NeoXBridge<N extends TBSBridgeName> {
|
|
441
|
+
neo3NeoXBridgeService: INeo3NeoXBridgeService<N>;
|
|
442
442
|
}
|
|
443
443
|
export type TTokenServicePredicateParams = {
|
|
444
444
|
hash: string;
|
|
@@ -474,4 +474,6 @@ export interface IWalletConnectService<N extends string> {
|
|
|
474
474
|
calculateRequestFee(args: TWalletConnectServiceRequestMethodParams<N>): Promise<string>;
|
|
475
475
|
[methodName: string]: any | TWalletConnectServiceRequestMethod<N>;
|
|
476
476
|
}
|
|
477
|
-
export {
|
|
477
|
+
export interface IBSWithWalletConnect<N extends string> {
|
|
478
|
+
walletConnectService: IWalletConnectService<N>;
|
|
479
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cityofzion/blockchain-service",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.10",
|
|
4
4
|
"repository": "https://github.com/CityOfZion/blockchain-services",
|
|
5
5
|
"license": "GPL-3.0-only",
|
|
6
6
|
"author": "Coz",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"/dist"
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"axios": "~1.
|
|
13
|
+
"axios": "~1.15.0",
|
|
14
14
|
"bignumber.js": "~9.3.1",
|
|
15
15
|
"bip39": "~3.1.0",
|
|
16
16
|
"date-fns": "~4.1.0",
|