@@ -15,6 +15,7 @@ import {
15
15
import { ControllerTransferDto } from '~/assets/dto/controller-transfer.dto';
16
16
import { CreateAssetDto } from '~/assets/dto/create-asset.dto';
17
17
import { IssueDto } from '~/assets/dto/issue.dto';
18
+ import { LinkTickerDto } from '~/assets/dto/link-ticker.dto';
18
19
import { RedeemTokensDto } from '~/assets/dto/redeem-tokens.dto';
19
20
import { RequiredMediatorsDto } from '~/assets/dto/required-mediators.dto';
20
21
import { SetAssetDocumentsDto } from '~/assets/dto/set-asset-documents.dto';
@@ -75,27 +76,27 @@ export class AssetsService {
75
76
}
76
77
77
78
public async findHolders(
78
- ticker : string,
79
+ assetInput : string,
79
80
size: BigNumber,
80
81
start?: string
81
82
): Promise<ResultSet<IdentityBalance>> {
82
- const asset = await this.findFungible(ticker );
83
+ const asset = await this.findFungible(assetInput );
83
84
return asset.assetHolders.get({ size, start });
84
85
}
85
86
86
87
public async findDocuments(
87
- ticker : string,
88
+ assetInput : string,
88
89
size: BigNumber,
89
90
start?: string
90
91
): Promise<ResultSet<AssetDocument>> {
91
- const asset = await this.findOne(ticker );
92
+ const asset = await this.findOne(assetInput );
92
93
return asset.documents.get({ size, start });
93
94
}
94
95
95
- public async setDocuments(ticker : string, params: SetAssetDocumentsDto): ServiceReturn<void> {
96
+ public async setDocuments(assetInput : string, params: SetAssetDocumentsDto): ServiceReturn<void> {
96
97
const {
97
98
documents: { set },
98
- } = await this.findOne(ticker );
99
+ } = await this.findOne(assetInput );
99
100
const { options, args } = extractTxOptions(params);
100
101
101
102
return this.transactionsService.submit(set, args, options);
@@ -108,27 +109,27 @@ export class AssetsService {
108
109
return this.transactionsService.submit(createAsset, args, options);
109
110
}
110
111
111
- public async issue(ticker : string, params: IssueDto): ServiceReturn<FungibleAsset> {
112
+ public async issue(assetInput : string, params: IssueDto): ServiceReturn<FungibleAsset> {
112
113
const { options, args } = extractTxOptions(params);
113
- const asset = await this.findFungible(ticker );
114
+ const asset = await this.findFungible(assetInput );
114
115
115
116
return this.transactionsService.submit(asset.issuance.issue, args, options);
116
117
}
117
118
118
119
public async transferOwnership(
119
- ticker : string,
120
+ assetInput : string,
120
121
params: TransferOwnershipDto
121
122
): ServiceReturn<AuthorizationRequest> {
122
123
const { options, args } = extractTxOptions(params);
123
124
124
- const { transferOwnership } = await this.findOne(ticker );
125
+ const { transferOwnership } = await this.findOne(assetInput );
125
126
return this.transactionsService.submit(transferOwnership, args, options);
126
127
}
127
128
128
- public async redeem(ticker : string, params: RedeemTokensDto): ServiceReturn<void> {
129
+ public async redeem(assetInput : string, params: RedeemTokensDto): ServiceReturn<void> {
129
130
const { options, args } = extractTxOptions(params);
130
131
131
- const { redeem } = await this.findFungible(ticker );
132
+ const { redeem } = await this.findFungible(assetInput );
132
133
133
134
return this.transactionsService.submit(
134
135
redeem,
@@ -137,32 +138,35 @@ export class AssetsService {
137
138
);
138
139
}
139
140
140
- public async freeze(ticker: string, transactionBaseDto: TransactionBaseDto): ServiceReturn<void> {
141
+ public async freeze(
142
+ assetInput: string,
143
+ transactionBaseDto: TransactionBaseDto
144
+ ): ServiceReturn<void> {
141
145
const { options } = extractTxOptions(transactionBaseDto);
142
- const asset = await this.findOne(ticker );
146
+ const asset = await this.findOne(assetInput );
143
147
144
148
return this.transactionsService.submit(asset.freeze, {}, options);
145
149
}
146
150
147
151
public async unfreeze(
148
- ticker : string,
152
+ assetInput : string,
149
153
transactionBaseDto: TransactionBaseDto
150
154
): ServiceReturn<void> {
151
155
const { options } = extractTxOptions(transactionBaseDto);
152
- const asset = await this.findOne(ticker );
156
+ const asset = await this.findOne(assetInput );
153
157
154
158
return this.transactionsService.submit(asset.unfreeze, {}, options);
155
159
}
156
160
157
161
public async controllerTransfer(
158
- ticker : string,
162
+ assetInput : string,
159
163
params: ControllerTransferDto
160
164
): ServiceReturn<void> {
161
165
const {
162
166
options,
163
167
args: { origin, amount },
164
168
} = extractTxOptions(params);
165
- const { controllerTransfer } = await this.findFungible(ticker );
169
+ const { controllerTransfer } = await this.findFungible(assetInput );
166
170
167
171
return this.transactionsService.submit(
168
172
controllerTransfer,
@@ -171,61 +175,81 @@ export class AssetsService {
171
175
);
172
176
}
173
177
174
- public async getOperationHistory(ticker : string): Promise<HistoricAgentOperation[]> {
175
- const asset = await this.findFungible(ticker );
178
+ public async getOperationHistory(assetInput : string): Promise<HistoricAgentOperation[]> {
179
+ const asset = await this.findFungible(assetInput );
176
180
return asset.getOperationHistory();
177
181
}
178
182
179
- public async getRequiredMediators(ticker : string): Promise<Identity[]> {
180
- const asset = await this.findOne(ticker );
183
+ public async getRequiredMediators(assetInput : string): Promise<Identity[]> {
184
+ const asset = await this.findOne(assetInput );
181
185
return asset.getRequiredMediators().catch(error => {
182
186
throw handleSdkError(error);
183
187
});
184
188
}
185
189
186
190
public async addRequiredMediators(
187
- ticker : string,
191
+ assetInput : string,
188
192
params: RequiredMediatorsDto
189
193
): ServiceReturn<void> {
190
194
const {
191
195
options,
192
196
args: { mediators },
193
197
} = extractTxOptions(params);
194
- const { addRequiredMediators } = await this.findOne(ticker );
198
+ const { addRequiredMediators } = await this.findOne(assetInput );
195
199
196
200
return this.transactionsService.submit(addRequiredMediators, { mediators }, options);
197
201
}
198
202
199
203
public async removeRequiredMediators(
200
- ticker : string,
204
+ assetInput : string,
201
205
params: RequiredMediatorsDto
202
206
): ServiceReturn<void> {
203
207
const {
204
208
options,
205
209
args: { mediators },
206
210
} = extractTxOptions(params);
207
- const { removeRequiredMediators } = await this.findOne(ticker );
211
+ const { removeRequiredMediators } = await this.findOne(assetInput );
208
212
209
213
return this.transactionsService.submit(removeRequiredMediators, { mediators }, options);
210
214
}
211
215
212
- public async preApprove(ticker : string, params: TransactionBaseDto): ServiceReturn<void> {
216
+ public async preApprove(assetInput : string, params: TransactionBaseDto): ServiceReturn<void> {
213
217
const { options } = extractTxOptions(params);
214
218
215
219
const {
216
220
settlements: { preApprove },
217
- } = await this.findOne(ticker );
221
+ } = await this.findOne(assetInput );
218
222
219
223
return this.transactionsService.submit(preApprove, {}, options);
220
224
}
221
225
222
- public async removePreApproval(ticker: string, params: TransactionBaseDto): ServiceReturn<void> {
226
+ public async removePreApproval(
227
+ assetInput: string,
228
+ params: TransactionBaseDto
229
+ ): ServiceReturn<void> {
223
230
const { options } = extractTxOptions(params);
224
231
225
232
const {
226
233
settlements: { removePreApproval },
227
- } = await this.findOne(ticker );
234
+ } = await this.findOne(assetInput );
228
235
229
236
return this.transactionsService.submit(removePreApproval, {}, options);
230
237
}
238
+
239
+ public async linkTickerToAsset(assetInput: string, params: LinkTickerDto): ServiceReturn<void> {
240
+ const { options, args } = extractTxOptions(params);
241
+
242
+ const { linkTicker } = await this.findOne(assetInput);
243
+ return this.transactionsService.submit(linkTicker, args, options);
244
+ }
245
+
246
+ public async unlinkTickerFromAsset(
247
+ assetInput: string,
248
+ params: TransactionBaseDto
249
+ ): ServiceReturn<void> {
250
+ const { options } = extractTxOptions(params);
251
+
252
+ const { unlinkTicker } = await this.findOne(assetInput);
253
+ return this.transactionsService.submit(unlinkTicker, {}, options);
254
+ }
231
255
}
0 commit comments