@cityofzion/blockchain-service 3.1.7 → 3.1.9
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/functions.d.ts +2 -2
- package/dist/interfaces.d.ts +27 -23
- package/package.json +1 -1
package/dist/functions.d.ts
CHANGED
|
@@ -8,8 +8,8 @@ export declare function hasLedger<N extends string, A extends TBSNetworkId>(serv
|
|
|
8
8
|
export declare function hasNeo3NeoXBridge<N extends string, A extends TBSNetworkId>(service: IBlockchainService<N, A>): service is N extends TBSBridgeName ? IBlockchainService<N, A> & IBSWithNeo3NeoXBridge<N> : never;
|
|
9
9
|
export declare function hasEncryption<N extends string, A extends TBSNetworkId>(service: IBlockchainService<N, A>): service is IBlockchainService<N, A> & IBSWithEncryption<N>;
|
|
10
10
|
export declare function hasWalletConnect<N extends string, A extends TBSNetworkId>(service: IBlockchainService<N, A>): service is IBlockchainService<N, A> & IBSWithWalletConnect<N>;
|
|
11
|
-
export declare function hasFullTransactions<N extends string, A extends TBSNetworkId>(service: IBlockchainService<N, A>): service is IBlockchainService<N, A> & IBSWithFullTransactions
|
|
12
|
-
export declare function hasFaucet<N extends string, A extends TBSNetworkId>(service: IBlockchainService<N, A>): service is IBlockchainService<N, A> & IBSWithFaucet
|
|
11
|
+
export declare function hasFullTransactions<N extends string, A extends TBSNetworkId>(service: IBlockchainService<N, A>): service is IBlockchainService<N, A> & IBSWithFullTransactions<N>;
|
|
12
|
+
export declare function hasFaucet<N extends string, A extends TBSNetworkId>(service: IBlockchainService<N, A>): service is IBlockchainService<N, A> & IBSWithFaucet<N>;
|
|
13
13
|
/**
|
|
14
14
|
* @deprecated use `waitForAccountTransaction` instead
|
|
15
15
|
*/
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -52,7 +52,7 @@ export interface IBlockchainService<N extends string, A extends string = string>
|
|
|
52
52
|
readonly availableNetworks: TBSNetwork<A>[];
|
|
53
53
|
readonly isCustomNetworkSupported: boolean;
|
|
54
54
|
exchangeDataService: IExchangeDataService;
|
|
55
|
-
blockchainDataService: IBlockchainDataService
|
|
55
|
+
blockchainDataService: IBlockchainDataService<N>;
|
|
56
56
|
tokenService: ITokenService;
|
|
57
57
|
setNetwork(network: TBSNetwork<A>): void;
|
|
58
58
|
pingNetwork(url?: string): Promise<TPingNetworkResponse>;
|
|
@@ -60,7 +60,7 @@ export interface IBlockchainService<N extends string, A extends string = string>
|
|
|
60
60
|
generateAccountFromKey(key: string): Promise<TBSAccount<N>>;
|
|
61
61
|
validateAddress(address: string): boolean;
|
|
62
62
|
validateKey(key: string): boolean;
|
|
63
|
-
transfer(params: TTransferParams<N>): Promise<TTransaction[]>;
|
|
63
|
+
transfer(params: TTransferParams<N>): Promise<TTransaction<N>[]>;
|
|
64
64
|
}
|
|
65
65
|
export interface IBSWithEncryption<N extends string> {
|
|
66
66
|
decrypt(keyOrJson: string, password: string): Promise<TBSAccount<N>>;
|
|
@@ -90,11 +90,11 @@ export interface IBSWithLedger<N extends string> {
|
|
|
90
90
|
export interface IBSWithWalletConnect<N extends string> {
|
|
91
91
|
walletConnectService: IWalletConnectService<N>;
|
|
92
92
|
}
|
|
93
|
-
export interface IBSWithFullTransactions {
|
|
94
|
-
fullTransactionsDataService: IFullTransactionsDataService
|
|
93
|
+
export interface IBSWithFullTransactions<N extends string> {
|
|
94
|
+
fullTransactionsDataService: IFullTransactionsDataService<N>;
|
|
95
95
|
}
|
|
96
|
-
export interface IBSWithFaucet {
|
|
97
|
-
faucet(address: string): Promise<TTransaction
|
|
96
|
+
export interface IBSWithFaucet<N extends string> {
|
|
97
|
+
faucet(address: string): Promise<TTransaction<N>>;
|
|
98
98
|
}
|
|
99
99
|
export type TContractParameter = {
|
|
100
100
|
name: string;
|
|
@@ -131,7 +131,7 @@ export type TTransactionUtxoInputOutput = {
|
|
|
131
131
|
amount: string;
|
|
132
132
|
token: TBSToken;
|
|
133
133
|
};
|
|
134
|
-
type TTransactionBase = {
|
|
134
|
+
export type TTransactionBase = {
|
|
135
135
|
txId: string;
|
|
136
136
|
txIdUrl?: string;
|
|
137
137
|
block?: number;
|
|
@@ -142,12 +142,17 @@ type TTransactionBase = {
|
|
|
142
142
|
systemFeeAmount?: string;
|
|
143
143
|
data?: any;
|
|
144
144
|
};
|
|
145
|
+
export type TTransactionFullBase<N extends string> = TTransactionBase & {
|
|
146
|
+
isPending: boolean;
|
|
147
|
+
blockchain: N;
|
|
148
|
+
relatedAddress?: string;
|
|
149
|
+
};
|
|
145
150
|
export type TTransactionDefaultEvent = TTransactionDefaultNftEvent | TTransactionDefaultTokenEvent | TTransactionDefaultGenericEvent;
|
|
146
|
-
export type TTransactionDefault =
|
|
151
|
+
export type TTransactionDefault<N extends string> = TTransactionFullBase<N> & {
|
|
147
152
|
view: 'default';
|
|
148
153
|
events: TTransactionDefaultEvent[];
|
|
149
154
|
};
|
|
150
|
-
export type TTransactionUtxo =
|
|
155
|
+
export type TTransactionUtxo<N extends string> = TTransactionFullBase<N> & {
|
|
151
156
|
view: 'utxo';
|
|
152
157
|
hex: string;
|
|
153
158
|
totalAmount: string;
|
|
@@ -155,8 +160,8 @@ export type TTransactionUtxo = TTransactionBase & {
|
|
|
155
160
|
inputs: TTransactionUtxoInputOutput[];
|
|
156
161
|
outputs: TTransactionUtxoInputOutput[];
|
|
157
162
|
};
|
|
158
|
-
export type TTransaction = TTransactionDefault | TTransactionUtxo
|
|
159
|
-
export type TGetTransactionsByAddressResponse<T extends TTransaction = TTransaction
|
|
163
|
+
export type TTransaction<N extends string> = TTransactionDefault<N> | TTransactionUtxo<N>;
|
|
164
|
+
export type TGetTransactionsByAddressResponse<N extends string, T extends TTransaction<N> = TTransaction<N>> = {
|
|
160
165
|
nextPageParams?: any;
|
|
161
166
|
transactions: T[];
|
|
162
167
|
};
|
|
@@ -173,10 +178,10 @@ export type TBalanceResponse = {
|
|
|
173
178
|
amount: string;
|
|
174
179
|
token: TBSToken;
|
|
175
180
|
};
|
|
176
|
-
export interface IBlockchainDataService {
|
|
181
|
+
export interface IBlockchainDataService<N extends string> {
|
|
177
182
|
readonly maxTimeToConfirmTransactionInMs: number;
|
|
178
|
-
getTransaction(transactionId: string): Promise<TTransaction
|
|
179
|
-
getTransactionsByAddress(params: TGetTransactionsByAddressParams): Promise<TGetTransactionsByAddressResponse
|
|
183
|
+
getTransaction(transactionId: string): Promise<TTransaction<N>>;
|
|
184
|
+
getTransactionsByAddress(params: TGetTransactionsByAddressParams): Promise<TGetTransactionsByAddressResponse<N>>;
|
|
180
185
|
getContract(contractHash: string): Promise<TContractResponse>;
|
|
181
186
|
getTokenInfo(tokenHash: string): Promise<TBSToken>;
|
|
182
187
|
getBalance(address: string): Promise<TBalanceResponse[]>;
|
|
@@ -194,8 +199,8 @@ export type TExportFullTransactionsByAddressParams = {
|
|
|
194
199
|
dateFrom: string;
|
|
195
200
|
dateTo: string;
|
|
196
201
|
};
|
|
197
|
-
export interface IFullTransactionsDataService {
|
|
198
|
-
getFullTransactionsByAddress(params: TGetFullTransactionsByAddressParams): Promise<TGetTransactionsByAddressResponse
|
|
202
|
+
export interface IFullTransactionsDataService<N extends string> {
|
|
203
|
+
getFullTransactionsByAddress(params: TGetFullTransactionsByAddressParams): Promise<TGetTransactionsByAddressResponse<N>>;
|
|
199
204
|
exportFullTransactionsByAddress(params: TExportFullTransactionsByAddressParams): Promise<string>;
|
|
200
205
|
}
|
|
201
206
|
export type TClaimServiceTransactionData = {
|
|
@@ -205,8 +210,8 @@ export interface IClaimService<N extends string> {
|
|
|
205
210
|
readonly claimToken: TBSToken;
|
|
206
211
|
getUnclaimed(address: string): Promise<string>;
|
|
207
212
|
calculateFee(account: TBSAccount<N>): Promise<string>;
|
|
208
|
-
claim(account: TBSAccount<N>): Promise<TTransactionDefault
|
|
209
|
-
getTransactionData(transaction:
|
|
213
|
+
claim(account: TBSAccount<N>): Promise<TTransactionDefault<N>>;
|
|
214
|
+
getTransactionData(transaction: TTransactionBase): TClaimServiceTransactionData | undefined;
|
|
210
215
|
}
|
|
211
216
|
export type TTokenPricesResponse = {
|
|
212
217
|
usdPrice: number;
|
|
@@ -331,9 +336,9 @@ export type TSwapOrchestratorEvents<N extends string> = {
|
|
|
331
336
|
availableTokensToReceive: (tokens: TSwapLoadableValue<TSwapToken<N>[]>) => void | Promise<void>;
|
|
332
337
|
error: (error: string) => void | Promise<void>;
|
|
333
338
|
};
|
|
334
|
-
export type TSwapResponse = {
|
|
339
|
+
export type TSwapResponse<N extends string> = {
|
|
335
340
|
id: string;
|
|
336
|
-
transaction?: TTransaction
|
|
341
|
+
transaction?: TTransaction<N>;
|
|
337
342
|
log?: string;
|
|
338
343
|
};
|
|
339
344
|
export type TSwapServiceStatusResponse = {
|
|
@@ -353,7 +358,7 @@ export interface ISwapOrchestrator<N extends string> {
|
|
|
353
358
|
setTokenToReceive(token: TSwapToken<N> | null): Promise<void>;
|
|
354
359
|
setAddressToReceive(address: string | null): Promise<void>;
|
|
355
360
|
setExtraIdToReceive(extraId: string | null): Promise<void>;
|
|
356
|
-
swap(): Promise<TSwapResponse
|
|
361
|
+
swap(): Promise<TSwapResponse<N>>;
|
|
357
362
|
calculateFee(): Promise<string>;
|
|
358
363
|
}
|
|
359
364
|
export type TBSBridgeName = 'neo3' | 'neox';
|
|
@@ -436,7 +441,7 @@ export interface INeo3NeoXBridgeService<N extends TBSBridgeName> {
|
|
|
436
441
|
getNonce(params: TNeo3NeoXBridgeServiceGetNonceParams<N>): Promise<string>;
|
|
437
442
|
getTransactionHashByNonce(params: TNeo3NeoXBridgeServiceGetTransactionHashByNonceParams<N>): Promise<string>;
|
|
438
443
|
getTokenByMultichainId(multichainId: string): TBridgeToken<N> | undefined;
|
|
439
|
-
getTransactionData(transaction:
|
|
444
|
+
getTransactionData(transaction: TTransactionBase): TNeo3NeoXBridgeTransactionData<N> | undefined;
|
|
440
445
|
}
|
|
441
446
|
export type TTokenServicePredicateParams = {
|
|
442
447
|
hash: string;
|
|
@@ -472,4 +477,3 @@ export interface IWalletConnectService<N extends string> {
|
|
|
472
477
|
calculateRequestFee(args: TWalletConnectServiceRequestMethodParams<N>): Promise<string>;
|
|
473
478
|
[methodName: string]: any | TWalletConnectServiceRequestMethod<N>;
|
|
474
479
|
}
|
|
475
|
-
export {};
|