@rosen-bridge/tx-pot 1.0.3 → 2.0.0
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/CHANGELOG.md +27 -0
- package/README.md +8 -8
- package/dist/db/entities/transactionEntity.d.ts +15 -0
- package/dist/db/entities/{TransactionEntity.d.ts.map → transactionEntity.d.ts.map} +1 -1
- package/dist/db/entities/transactionEntity.js +81 -0
- package/dist/db/migrations/index.d.ts +3 -3
- package/dist/db/migrations/index.js +3 -3
- package/dist/db/migrations/postgres/1706350644686-migration.d.ts +4 -4
- package/dist/db/migrations/postgres/1706350644686-migration.d.ts.map +1 -1
- package/dist/db/migrations/postgres/1706350644686-migration.js +8 -8
- package/dist/db/migrations/sqlite/1706007154531-migration.d.ts +4 -4
- package/dist/db/migrations/sqlite/1706007154531-migration.d.ts.map +1 -1
- package/dist/db/migrations/sqlite/1706007154531-migration.js +8 -8
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -4
- package/dist/network/abstractPotChainManager.d.ts +36 -0
- package/dist/network/{AbstractPotChainManager.d.ts.map → abstractPotChainManager.d.ts.map} +1 -1
- package/dist/network/{AbstractPotChainManager.js → abstractPotChainManager.js} +3 -2
- package/dist/transaction/txPot.d.ts +212 -0
- package/dist/transaction/txPot.d.ts.map +1 -0
- package/dist/transaction/{TxPot.js → txPot.js} +2 -2
- package/dist/transaction/types.d.ts +21 -24
- package/dist/transaction/types.d.ts.map +1 -1
- package/dist/transaction/types.js +13 -13
- package/dist/transaction/utils.d.ts +2 -4
- package/dist/transaction/utils.d.ts.map +1 -1
- package/dist/transaction/utils.js +48 -43
- package/package.json +25 -21
- package/.eslintignore +0 -1
- package/dist/db/entities/TransactionEntity.d.ts +0 -15
- package/dist/db/entities/TransactionEntity.js +0 -125
- package/dist/network/AbstractPotChainManager.d.ts +0 -39
- package/dist/transaction/TxPot.d.ts +0 -284
- package/dist/transaction/TxPot.d.ts.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/lib/db/entities/TransactionEntity.ts +0 -44
- package/lib/db/migrations/index.ts +0 -7
- package/lib/db/migrations/postgres/1706350644686-migration.ts +0 -31
- package/lib/db/migrations/sqlite/1706007154531-migration.ts +0 -31
- package/lib/index.ts +0 -5
- package/lib/network/AbstractPotChainManager.ts +0 -44
- package/lib/transaction/TxPot.ts +0 -728
- package/lib/transaction/types.ts +0 -46
- package/lib/transaction/utils.ts +0 -59
- package/tests/.gitkeep +0 -0
- package/tests/db/dataSource.mock.ts +0 -18
- package/tests/network/TestPotChainManager.ts +0 -23
- package/tests/transaction/TestTxPot.ts +0 -32
- package/tests/transaction/TxPot.spec.ts +0 -1881
- package/tests/transaction/testData.ts +0 -84
- package/tsconfig.build.json +0 -8
- package/tsconfig.build.tsbuildinfo +0 -1
- package/tsconfig.json +0 -9
- package/vitest.config.ts +0 -13
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
var __decorate =
|
|
2
|
-
(this && this.__decorate) ||
|
|
3
|
-
function (decorators, target, key, desc) {
|
|
4
|
-
var c = arguments.length,
|
|
5
|
-
r =
|
|
6
|
-
c < 3
|
|
7
|
-
? target
|
|
8
|
-
: desc === null
|
|
9
|
-
? (desc = Object.getOwnPropertyDescriptor(target, key))
|
|
10
|
-
: desc,
|
|
11
|
-
d;
|
|
12
|
-
if (typeof Reflect === 'object' && typeof Reflect.decorate === 'function')
|
|
13
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
|
14
|
-
else
|
|
15
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
|
16
|
-
if ((d = decorators[i]))
|
|
17
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
18
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
|
-
};
|
|
20
|
-
var __metadata =
|
|
21
|
-
(this && this.__metadata) ||
|
|
22
|
-
function (k, v) {
|
|
23
|
-
if (typeof Reflect === 'object' && typeof Reflect.metadata === 'function')
|
|
24
|
-
return Reflect.metadata(k, v);
|
|
25
|
-
};
|
|
26
|
-
import { Column, Entity, PrimaryColumn } from 'typeorm';
|
|
27
|
-
let TransactionEntity = class TransactionEntity {
|
|
28
|
-
txId;
|
|
29
|
-
chain;
|
|
30
|
-
txType;
|
|
31
|
-
status;
|
|
32
|
-
requiredSign;
|
|
33
|
-
lastCheck;
|
|
34
|
-
lastStatusUpdate;
|
|
35
|
-
failedInSign;
|
|
36
|
-
signFailedCount;
|
|
37
|
-
serializedTx;
|
|
38
|
-
extra;
|
|
39
|
-
extra2;
|
|
40
|
-
};
|
|
41
|
-
__decorate(
|
|
42
|
-
[PrimaryColumn('varchar'), __metadata('design:type', String)],
|
|
43
|
-
TransactionEntity.prototype,
|
|
44
|
-
'txId',
|
|
45
|
-
void 0
|
|
46
|
-
);
|
|
47
|
-
__decorate(
|
|
48
|
-
[PrimaryColumn('varchar'), __metadata('design:type', String)],
|
|
49
|
-
TransactionEntity.prototype,
|
|
50
|
-
'chain',
|
|
51
|
-
void 0
|
|
52
|
-
);
|
|
53
|
-
__decorate(
|
|
54
|
-
[Column('varchar'), __metadata('design:type', String)],
|
|
55
|
-
TransactionEntity.prototype,
|
|
56
|
-
'txType',
|
|
57
|
-
void 0
|
|
58
|
-
);
|
|
59
|
-
__decorate(
|
|
60
|
-
[Column('varchar'), __metadata('design:type', String)],
|
|
61
|
-
TransactionEntity.prototype,
|
|
62
|
-
'status',
|
|
63
|
-
void 0
|
|
64
|
-
);
|
|
65
|
-
__decorate(
|
|
66
|
-
[Column('integer'), __metadata('design:type', Number)],
|
|
67
|
-
TransactionEntity.prototype,
|
|
68
|
-
'requiredSign',
|
|
69
|
-
void 0
|
|
70
|
-
);
|
|
71
|
-
__decorate(
|
|
72
|
-
[Column('integer'), __metadata('design:type', Number)],
|
|
73
|
-
TransactionEntity.prototype,
|
|
74
|
-
'lastCheck',
|
|
75
|
-
void 0
|
|
76
|
-
);
|
|
77
|
-
__decorate(
|
|
78
|
-
[Column('varchar'), __metadata('design:type', String)],
|
|
79
|
-
TransactionEntity.prototype,
|
|
80
|
-
'lastStatusUpdate',
|
|
81
|
-
void 0
|
|
82
|
-
);
|
|
83
|
-
__decorate(
|
|
84
|
-
[Column('boolean'), __metadata('design:type', Boolean)],
|
|
85
|
-
TransactionEntity.prototype,
|
|
86
|
-
'failedInSign',
|
|
87
|
-
void 0
|
|
88
|
-
);
|
|
89
|
-
__decorate(
|
|
90
|
-
[Column('integer'), __metadata('design:type', Number)],
|
|
91
|
-
TransactionEntity.prototype,
|
|
92
|
-
'signFailedCount',
|
|
93
|
-
void 0
|
|
94
|
-
);
|
|
95
|
-
__decorate(
|
|
96
|
-
[Column('varchar'), __metadata('design:type', String)],
|
|
97
|
-
TransactionEntity.prototype,
|
|
98
|
-
'serializedTx',
|
|
99
|
-
void 0
|
|
100
|
-
);
|
|
101
|
-
__decorate(
|
|
102
|
-
[
|
|
103
|
-
Column('varchar', {
|
|
104
|
-
nullable: true,
|
|
105
|
-
}),
|
|
106
|
-
__metadata('design:type', Object),
|
|
107
|
-
],
|
|
108
|
-
TransactionEntity.prototype,
|
|
109
|
-
'extra',
|
|
110
|
-
void 0
|
|
111
|
-
);
|
|
112
|
-
__decorate(
|
|
113
|
-
[
|
|
114
|
-
Column('varchar', {
|
|
115
|
-
nullable: true,
|
|
116
|
-
}),
|
|
117
|
-
__metadata('design:type', Object),
|
|
118
|
-
],
|
|
119
|
-
TransactionEntity.prototype,
|
|
120
|
-
'extra2',
|
|
121
|
-
void 0
|
|
122
|
-
);
|
|
123
|
-
TransactionEntity = __decorate([Entity()], TransactionEntity);
|
|
124
|
-
export { TransactionEntity };
|
|
125
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiVHJhbnNhY3Rpb25FbnRpdHkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9saWIvZGIvZW50aXRpZXMvVHJhbnNhY3Rpb25FbnRpdHk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oYXInLCB7XG4gICAgbnVsbGFibGU6IHRydWUsXG4gIH0pXG4gIGV4dHJhMj86IHN0cmluZyB8IG51bGw7XG59XG4iXX0=
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { SigningStatus } from '../transaction/types';
|
|
2
|
-
export declare abstract class AbstractPotChainManager {
|
|
3
|
-
/**
|
|
4
|
-
* gets the blockchain current height
|
|
5
|
-
*/
|
|
6
|
-
abstract getHeight: () => Promise<number>;
|
|
7
|
-
/**
|
|
8
|
-
* returns required number of confirmation
|
|
9
|
-
* @param txType
|
|
10
|
-
*/
|
|
11
|
-
abstract getTxRequiredConfirmation: (txType: string) => number;
|
|
12
|
-
/**
|
|
13
|
-
* gets number of confirmation for a tx
|
|
14
|
-
* returns -1 if tx is not in the blockchain
|
|
15
|
-
* @param txId
|
|
16
|
-
*/
|
|
17
|
-
abstract getTxConfirmation: (txId: string) => Promise<number>;
|
|
18
|
-
/**
|
|
19
|
-
* checks if a tx is still valid and can be sent to the network
|
|
20
|
-
* @param serializedTx
|
|
21
|
-
* @param signingStatus
|
|
22
|
-
*/
|
|
23
|
-
abstract isTxValid: (
|
|
24
|
-
serializedTx: string,
|
|
25
|
-
signingStatus: SigningStatus
|
|
26
|
-
) => Promise<boolean>;
|
|
27
|
-
/**
|
|
28
|
-
* submits a tx to the blockchain
|
|
29
|
-
* @param serializedTx
|
|
30
|
-
*/
|
|
31
|
-
abstract submitTransaction: (serializedTx: string) => Promise<void>;
|
|
32
|
-
/**
|
|
33
|
-
* checks if a tx is in mempool
|
|
34
|
-
* returns false if the chain has no mempool
|
|
35
|
-
* @param txId
|
|
36
|
-
*/
|
|
37
|
-
abstract isTxInMempool: (txId: string) => Promise<boolean>;
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=AbstractPotChainManager.d.ts.map
|
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
import { DataSource, Repository } from 'typeorm';
|
|
2
|
-
import { TransactionEntity } from '../db/entities/TransactionEntity';
|
|
3
|
-
import { AbstractLogger } from '@rosen-bridge/abstract-logger';
|
|
4
|
-
import {
|
|
5
|
-
CallbackFunction,
|
|
6
|
-
TransactionStatus,
|
|
7
|
-
TxOptions,
|
|
8
|
-
ValidatorFunction,
|
|
9
|
-
} from './types';
|
|
10
|
-
import { AbstractPotChainManager } from '../network/AbstractPotChainManager';
|
|
11
|
-
export declare class TxPot {
|
|
12
|
-
protected static instance: TxPot;
|
|
13
|
-
protected readonly txRepository: Repository<TransactionEntity>;
|
|
14
|
-
protected chains: Map<string, AbstractPotChainManager>;
|
|
15
|
-
protected validators: Map<
|
|
16
|
-
string,
|
|
17
|
-
Map<string, Map<string, ValidatorFunction>>
|
|
18
|
-
>;
|
|
19
|
-
protected txTypeCallbacks: Map<
|
|
20
|
-
string,
|
|
21
|
-
Map<TransactionStatus, Map<string, CallbackFunction>>
|
|
22
|
-
>;
|
|
23
|
-
protected submissionAllowance: Map<string, Map<string, ValidatorFunction>>;
|
|
24
|
-
protected logger: AbstractLogger;
|
|
25
|
-
protected constructor(dataSource: DataSource, logger?: AbstractLogger);
|
|
26
|
-
/**
|
|
27
|
-
* initiates TxPot
|
|
28
|
-
* @param dataSource typeorm data source
|
|
29
|
-
* @param logger
|
|
30
|
-
* @returns
|
|
31
|
-
*/
|
|
32
|
-
static setup: (dataSource: DataSource, logger?: AbstractLogger) => TxPot;
|
|
33
|
-
/**
|
|
34
|
-
* returns TxPot instance (throws error if none exists)
|
|
35
|
-
* @returns TxPot instance
|
|
36
|
-
*/
|
|
37
|
-
static getInstance: () => TxPot;
|
|
38
|
-
/**
|
|
39
|
-
* registers a chain to TxPot
|
|
40
|
-
* @param chain
|
|
41
|
-
* @param chainManager
|
|
42
|
-
*/
|
|
43
|
-
registerChain: (chain: string, chainManager: AbstractPotChainManager) => void;
|
|
44
|
-
/**
|
|
45
|
-
* registers a validator function
|
|
46
|
-
* @param chain
|
|
47
|
-
* @param txType
|
|
48
|
-
* @param id
|
|
49
|
-
* @param validator
|
|
50
|
-
*/
|
|
51
|
-
registerValidator: (
|
|
52
|
-
chain: string,
|
|
53
|
-
txType: string,
|
|
54
|
-
id: string,
|
|
55
|
-
validator: ValidatorFunction
|
|
56
|
-
) => void;
|
|
57
|
-
/**
|
|
58
|
-
* removes a validator function
|
|
59
|
-
* @param chain
|
|
60
|
-
* @param txType
|
|
61
|
-
* @param id
|
|
62
|
-
*/
|
|
63
|
-
unregisterValidator: (chain: string, txType: string, id: string) => void;
|
|
64
|
-
/**
|
|
65
|
-
* registers a submit validator function
|
|
66
|
-
* @param chain
|
|
67
|
-
* @param id
|
|
68
|
-
* @param validator
|
|
69
|
-
*/
|
|
70
|
-
registerSubmitValidator: (
|
|
71
|
-
chain: string,
|
|
72
|
-
id: string,
|
|
73
|
-
validator: ValidatorFunction
|
|
74
|
-
) => void;
|
|
75
|
-
/**
|
|
76
|
-
* removes a submit validator function
|
|
77
|
-
* @param chain
|
|
78
|
-
* @param id
|
|
79
|
-
*/
|
|
80
|
-
unregisterSubmitValidator: (chain: string, id: string) => void;
|
|
81
|
-
/**
|
|
82
|
-
* registers a callback function
|
|
83
|
-
* the callback will be called when status of any transactions
|
|
84
|
-
* of given type changes to given status
|
|
85
|
-
* @param txType
|
|
86
|
-
* @param status
|
|
87
|
-
* @param id
|
|
88
|
-
* @param callback
|
|
89
|
-
*/
|
|
90
|
-
registerCallback: (
|
|
91
|
-
txType: string,
|
|
92
|
-
status: TransactionStatus,
|
|
93
|
-
id: string,
|
|
94
|
-
callback: CallbackFunction
|
|
95
|
-
) => void;
|
|
96
|
-
/**
|
|
97
|
-
* removes a callback function
|
|
98
|
-
* @param txType
|
|
99
|
-
* @param status
|
|
100
|
-
* @param id
|
|
101
|
-
*/
|
|
102
|
-
unregisterCallback: (
|
|
103
|
-
txType: string,
|
|
104
|
-
status: TransactionStatus,
|
|
105
|
-
id: string
|
|
106
|
-
) => void;
|
|
107
|
-
/**
|
|
108
|
-
* returns chain manager for given chain
|
|
109
|
-
* throws error if no manager is registered for it
|
|
110
|
-
* @param chain
|
|
111
|
-
*/
|
|
112
|
-
protected getChainManager: (chain: string) => AbstractPotChainManager;
|
|
113
|
-
/**
|
|
114
|
-
* sets the tx as invalid if enough blocks is passed from last check
|
|
115
|
-
* @param tx
|
|
116
|
-
*/
|
|
117
|
-
protected setTransactionAsInvalid: (tx: TransactionEntity) => Promise<void>;
|
|
118
|
-
/**
|
|
119
|
-
* validates a transaction
|
|
120
|
-
* returns true if no validator functions is set or tx is valid
|
|
121
|
-
* otherwise handle the tx as invalid and returns false
|
|
122
|
-
* @param tx
|
|
123
|
-
*/
|
|
124
|
-
protected validateTx: (tx: TransactionEntity) => Promise<boolean>;
|
|
125
|
-
/**
|
|
126
|
-
* checks a transaction for submission
|
|
127
|
-
* returns true if no validator functions is set or all validators allow tx to submit
|
|
128
|
-
* otherwise returns false
|
|
129
|
-
* @param tx
|
|
130
|
-
*/
|
|
131
|
-
protected isSubmitAllowed: (tx: TransactionEntity) => Promise<boolean>;
|
|
132
|
-
/**
|
|
133
|
-
* updates the status of a tx
|
|
134
|
-
* @param txKey tx id and chain
|
|
135
|
-
* @param status new status
|
|
136
|
-
*/
|
|
137
|
-
protected setTxStatus: (
|
|
138
|
-
tx: TransactionEntity,
|
|
139
|
-
status: TransactionStatus
|
|
140
|
-
) => Promise<void>;
|
|
141
|
-
/**
|
|
142
|
-
* @returns current timestamp in seconds and string format
|
|
143
|
-
*/
|
|
144
|
-
protected currentTime: () => string;
|
|
145
|
-
/**
|
|
146
|
-
* submits the signed transaction to the blockchain
|
|
147
|
-
* @param tx
|
|
148
|
-
*/
|
|
149
|
-
protected processSignedTx: (tx: TransactionEntity) => Promise<void>;
|
|
150
|
-
/**
|
|
151
|
-
* processes the sent transaction
|
|
152
|
-
* @param tx
|
|
153
|
-
*/
|
|
154
|
-
protected processesSentTx: (tx: TransactionEntity) => Promise<void>;
|
|
155
|
-
/**
|
|
156
|
-
* runs all jobs of TxPot
|
|
157
|
-
* - process signed txs
|
|
158
|
-
* - process sent txs
|
|
159
|
-
*/
|
|
160
|
-
update: () => Promise<void>;
|
|
161
|
-
/**
|
|
162
|
-
* gets transactions by status
|
|
163
|
-
* @param status
|
|
164
|
-
* @param validate
|
|
165
|
-
* @returns
|
|
166
|
-
*/
|
|
167
|
-
getTxsByStatus: (
|
|
168
|
-
status: TransactionStatus,
|
|
169
|
-
validate?: boolean
|
|
170
|
-
) => Promise<Array<TransactionEntity>>;
|
|
171
|
-
/**
|
|
172
|
-
* inserts a new transaction into db
|
|
173
|
-
* Note: make sure to set `lastCheck` field if initialStatus is `signed` or `sent`
|
|
174
|
-
* @param txId
|
|
175
|
-
* @param chain
|
|
176
|
-
* @param txType
|
|
177
|
-
* @param requiredSign
|
|
178
|
-
* @param serializedTx
|
|
179
|
-
* @param initialStatus
|
|
180
|
-
* @param lastCheck last blockchain height that tx was valid
|
|
181
|
-
* @param extra
|
|
182
|
-
* @param extra2
|
|
183
|
-
*/
|
|
184
|
-
addTx: (
|
|
185
|
-
txId: string,
|
|
186
|
-
chain: string,
|
|
187
|
-
txType: string,
|
|
188
|
-
requiredSign: number,
|
|
189
|
-
serializedTx: string,
|
|
190
|
-
initialStatus?: TransactionStatus,
|
|
191
|
-
lastCheck?: number,
|
|
192
|
-
extra?: string | null,
|
|
193
|
-
extra2?: string | null
|
|
194
|
-
) => Promise<void>;
|
|
195
|
-
/**
|
|
196
|
-
* updates the status of a tx
|
|
197
|
-
* @param txId
|
|
198
|
-
* @param chain
|
|
199
|
-
* @param status new status
|
|
200
|
-
*/
|
|
201
|
-
setTxStatusById: (
|
|
202
|
-
txId: string,
|
|
203
|
-
chain: string,
|
|
204
|
-
status: TransactionStatus
|
|
205
|
-
) => Promise<void>;
|
|
206
|
-
/**
|
|
207
|
-
* updates tx info when failed in sign process
|
|
208
|
-
* @param txId
|
|
209
|
-
* @param chain
|
|
210
|
-
*/
|
|
211
|
-
setTxAsSignFailed: (txId: string, chain: string) => Promise<void>;
|
|
212
|
-
/**
|
|
213
|
-
* updates the tx and set status as signed
|
|
214
|
-
* @param txId
|
|
215
|
-
* @param chain
|
|
216
|
-
* @param serializedTx
|
|
217
|
-
* @param currentHeight current height of the blockchain
|
|
218
|
-
* @param extra
|
|
219
|
-
* @param extra2
|
|
220
|
-
*/
|
|
221
|
-
setTxAsSigned: (
|
|
222
|
-
txId: string,
|
|
223
|
-
chain: string,
|
|
224
|
-
serializedTx: string,
|
|
225
|
-
currentHeight: number,
|
|
226
|
-
extra?: string,
|
|
227
|
-
extra2?: string
|
|
228
|
-
) => Promise<void>;
|
|
229
|
-
/**
|
|
230
|
-
* updates last check value of a tx
|
|
231
|
-
* @param txId
|
|
232
|
-
* @param chain
|
|
233
|
-
* @param currentHeight current height of the blockchain
|
|
234
|
-
*/
|
|
235
|
-
updateTxLastCheck: (
|
|
236
|
-
txId: string,
|
|
237
|
-
chain: string,
|
|
238
|
-
currentHeight: number
|
|
239
|
-
) => Promise<void>;
|
|
240
|
-
/**
|
|
241
|
-
* updates failedInSign field of a transaction to false
|
|
242
|
-
* @param txId
|
|
243
|
-
* @param chain
|
|
244
|
-
*/
|
|
245
|
-
resetFailedInSign: (txId: string, chain: string) => Promise<void>;
|
|
246
|
-
/**
|
|
247
|
-
* updates requiredSign field of a transaction
|
|
248
|
-
* @param txId
|
|
249
|
-
* @param chain
|
|
250
|
-
* @param requiredSign
|
|
251
|
-
*/
|
|
252
|
-
updateRequiredSign: (
|
|
253
|
-
txId: string,
|
|
254
|
-
chain: string,
|
|
255
|
-
requiredSign: number
|
|
256
|
-
) => Promise<void>;
|
|
257
|
-
/**
|
|
258
|
-
* gets the transaction by its id and chain
|
|
259
|
-
* @param txId
|
|
260
|
-
* @param chain
|
|
261
|
-
*/
|
|
262
|
-
getTxByKey: (
|
|
263
|
-
txId: string,
|
|
264
|
-
chain: string
|
|
265
|
-
) => Promise<TransactionEntity | null>;
|
|
266
|
-
/**
|
|
267
|
-
* @returns the transactions with valid status
|
|
268
|
-
*/
|
|
269
|
-
getTxsQuery: (options?: Array<TxOptions>) => Promise<TransactionEntity[]>;
|
|
270
|
-
/**
|
|
271
|
-
* updates extra fields of a transaction
|
|
272
|
-
* @param txId
|
|
273
|
-
* @param chain
|
|
274
|
-
* @param extra
|
|
275
|
-
* @param extra2
|
|
276
|
-
*/
|
|
277
|
-
updateExtra: (
|
|
278
|
-
txId: string,
|
|
279
|
-
chain: string,
|
|
280
|
-
extra?: string | null,
|
|
281
|
-
extra2?: string | null
|
|
282
|
-
) => Promise<void>;
|
|
283
|
-
}
|
|
284
|
-
//# sourceMappingURL=TxPot.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TxPot.d.ts","sourceRoot":"","sources":["../../lib/transaction/TxPot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAe,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EACL,gBAAgB,EAEhB,iBAAiB,EACjB,SAAS,EAET,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAE7E,qBAAa,KAAK;IAChB,SAAS,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC;IACjC,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,UAAU,CAAC,iBAAiB,CAAC,CAAC;IAC/D,SAAS,CAAC,MAAM,uCAA8C;IAC9D,SAAS,CAAC,UAAU,2DAGhB;IACJ,SAAS,CAAC,eAAe,qEAGrB;IACJ,SAAS,CAAC,mBAAmB,8CAGzB;IACJ,SAAS,CAAC,MAAM,EAAE,cAAc,CAAC;IAEjC,SAAS,aAAa,UAAU,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,cAAc;IAMrE;;;;;OAKG;IACH,OAAc,KAAK,eACL,UAAU,WACb,cAA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