Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public async createDeployment(deployData: AssetLedgerDeploymentData, priority: Priority) {
if (!this.context.authentication) {
throw new Error('Client not connected. Please initialize your client first.');
}
const deployGateway = new Gateway(this.context.provider);
const date = Date.now();
const multiplier = new BigNumber(1000000000000000000);
const paymentAmount = this.context.payment.assetDeployCost;
const value = new BigNumber(paymentAmount).multipliedBy(multiplier);
const assetLedgerDeployOrder = {
kind: OrderKind.ASSET_LEDGER_DEPLOY_ORDER,
makerId: this.context.provider.accountId,
seed: date,
expiration: Date.now() + 172800000, // 2 days
tokenTransferData: {
ledgerId: this.context.payment.tokenAddress,
receiverId: this.context.payment.receiverAddress,
value: value.toFixed(0),
},
assetLedgerData: deployData,
};
const claim = await deployGateway.sign(assetLedgerDeployOrder as AssetLedgerDeployOrder);
delete assetLedgerDeployOrder.kind; // kind will be automatically assigned in the API
return clientFetch(`${this.context.apiUrl}/deployments`, {
method: 'POST',
body: JSON.stringify({
priority,