@cityofzion/blockchain-service 3.1.7 → 3.1.8
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 +24 -22
- 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
|
+
type TTransactionBase<N extends string> = {
|
|
135
135
|
txId: string;
|
|
136
136
|
txIdUrl?: string;
|
|
137
137
|
block?: number;
|
|
@@ -141,13 +141,15 @@ type TTransactionBase = {
|
|
|
141
141
|
networkFeeAmount?: string;
|
|
142
142
|
systemFeeAmount?: string;
|
|
143
143
|
data?: any;
|
|
144
|
+
isPending: boolean;
|
|
145
|
+
blockchain: N;
|
|
144
146
|
};
|
|
145
147
|
export type TTransactionDefaultEvent = TTransactionDefaultNftEvent | TTransactionDefaultTokenEvent | TTransactionDefaultGenericEvent;
|
|
146
|
-
export type TTransactionDefault = TTransactionBase & {
|
|
148
|
+
export type TTransactionDefault<N extends string> = TTransactionBase<N> & {
|
|
147
149
|
view: 'default';
|
|
148
150
|
events: TTransactionDefaultEvent[];
|
|
149
151
|
};
|
|
150
|
-
export type TTransactionUtxo = TTransactionBase & {
|
|
152
|
+
export type TTransactionUtxo<N extends string> = TTransactionBase<N> & {
|
|
151
153
|
view: 'utxo';
|
|
152
154
|
hex: string;
|
|
153
155
|
totalAmount: string;
|
|
@@ -155,8 +157,8 @@ export type TTransactionUtxo = TTransactionBase & {
|
|
|
155
157
|
inputs: TTransactionUtxoInputOutput[];
|
|
156
158
|
outputs: TTransactionUtxoInputOutput[];
|
|
157
159
|
};
|
|
158
|
-
export type TTransaction = TTransactionDefault | TTransactionUtxo
|
|
159
|
-
export type TGetTransactionsByAddressResponse<T extends TTransaction = TTransaction
|
|
160
|
+
export type TTransaction<N extends string> = TTransactionDefault<N> | TTransactionUtxo<N>;
|
|
161
|
+
export type TGetTransactionsByAddressResponse<N extends string, T extends TTransaction<N> = TTransaction<N>> = {
|
|
160
162
|
nextPageParams?: any;
|
|
161
163
|
transactions: T[];
|
|
162
164
|
};
|
|
@@ -173,10 +175,10 @@ export type TBalanceResponse = {
|
|
|
173
175
|
amount: string;
|
|
174
176
|
token: TBSToken;
|
|
175
177
|
};
|
|
176
|
-
export interface IBlockchainDataService {
|
|
178
|
+
export interface IBlockchainDataService<N extends string> {
|
|
177
179
|
readonly maxTimeToConfirmTransactionInMs: number;
|
|
178
|
-
getTransaction(transactionId: string): Promise<TTransaction
|
|
179
|
-
getTransactionsByAddress(params: TGetTransactionsByAddressParams): Promise<TGetTransactionsByAddressResponse
|
|
180
|
+
getTransaction(transactionId: string): Promise<TTransaction<N>>;
|
|
181
|
+
getTransactionsByAddress(params: TGetTransactionsByAddressParams): Promise<TGetTransactionsByAddressResponse<N>>;
|
|
180
182
|
getContract(contractHash: string): Promise<TContractResponse>;
|
|
181
183
|
getTokenInfo(tokenHash: string): Promise<TBSToken>;
|
|
182
184
|
getBalance(address: string): Promise<TBalanceResponse[]>;
|
|
@@ -194,8 +196,8 @@ export type TExportFullTransactionsByAddressParams = {
|
|
|
194
196
|
dateFrom: string;
|
|
195
197
|
dateTo: string;
|
|
196
198
|
};
|
|
197
|
-
export interface IFullTransactionsDataService {
|
|
198
|
-
getFullTransactionsByAddress(params: TGetFullTransactionsByAddressParams): Promise<TGetTransactionsByAddressResponse
|
|
199
|
+
export interface IFullTransactionsDataService<N extends string> {
|
|
200
|
+
getFullTransactionsByAddress(params: TGetFullTransactionsByAddressParams): Promise<TGetTransactionsByAddressResponse<N>>;
|
|
199
201
|
exportFullTransactionsByAddress(params: TExportFullTransactionsByAddressParams): Promise<string>;
|
|
200
202
|
}
|
|
201
203
|
export type TClaimServiceTransactionData = {
|
|
@@ -205,8 +207,8 @@ export interface IClaimService<N extends string> {
|
|
|
205
207
|
readonly claimToken: TBSToken;
|
|
206
208
|
getUnclaimed(address: string): Promise<string>;
|
|
207
209
|
calculateFee(account: TBSAccount<N>): Promise<string>;
|
|
208
|
-
claim(account: TBSAccount<N>): Promise<TTransactionDefault
|
|
209
|
-
getTransactionData(transaction: TTransaction): TClaimServiceTransactionData | undefined;
|
|
210
|
+
claim(account: TBSAccount<N>): Promise<TTransactionDefault<N>>;
|
|
211
|
+
getTransactionData(transaction: TTransaction<N>): TClaimServiceTransactionData | undefined;
|
|
210
212
|
}
|
|
211
213
|
export type TTokenPricesResponse = {
|
|
212
214
|
usdPrice: number;
|
|
@@ -331,9 +333,9 @@ export type TSwapOrchestratorEvents<N extends string> = {
|
|
|
331
333
|
availableTokensToReceive: (tokens: TSwapLoadableValue<TSwapToken<N>[]>) => void | Promise<void>;
|
|
332
334
|
error: (error: string) => void | Promise<void>;
|
|
333
335
|
};
|
|
334
|
-
export type TSwapResponse = {
|
|
336
|
+
export type TSwapResponse<N extends string> = {
|
|
335
337
|
id: string;
|
|
336
|
-
transaction?: TTransaction
|
|
338
|
+
transaction?: TTransaction<N>;
|
|
337
339
|
log?: string;
|
|
338
340
|
};
|
|
339
341
|
export type TSwapServiceStatusResponse = {
|
|
@@ -353,7 +355,7 @@ export interface ISwapOrchestrator<N extends string> {
|
|
|
353
355
|
setTokenToReceive(token: TSwapToken<N> | null): Promise<void>;
|
|
354
356
|
setAddressToReceive(address: string | null): Promise<void>;
|
|
355
357
|
setExtraIdToReceive(extraId: string | null): Promise<void>;
|
|
356
|
-
swap(): Promise<TSwapResponse
|
|
358
|
+
swap(): Promise<TSwapResponse<N>>;
|
|
357
359
|
calculateFee(): Promise<string>;
|
|
358
360
|
}
|
|
359
361
|
export type TBSBridgeName = 'neo3' | 'neox';
|
|
@@ -436,7 +438,7 @@ export interface INeo3NeoXBridgeService<N extends TBSBridgeName> {
|
|
|
436
438
|
getNonce(params: TNeo3NeoXBridgeServiceGetNonceParams<N>): Promise<string>;
|
|
437
439
|
getTransactionHashByNonce(params: TNeo3NeoXBridgeServiceGetTransactionHashByNonceParams<N>): Promise<string>;
|
|
438
440
|
getTokenByMultichainId(multichainId: string): TBridgeToken<N> | undefined;
|
|
439
|
-
getTransactionData(transaction: TTransaction): TNeo3NeoXBridgeTransactionData<N> | undefined;
|
|
441
|
+
getTransactionData(transaction: TTransaction<N>): TNeo3NeoXBridgeTransactionData<N> | undefined;
|
|
440
442
|
}
|
|
441
443
|
export type TTokenServicePredicateParams = {
|
|
442
444
|
hash: string;
|