Skip to content
This repository has been archived by the owner on Feb 18, 2021. It is now read-only.

Commit

Permalink
async
Browse files Browse the repository at this point in the history
  • Loading branch information
Charly committed Sep 30, 2019
1 parent 3664fe0 commit e9c0144
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 20 deletions.
2 changes: 1 addition & 1 deletion dist/Tinlake.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export declare class Tinlake {
/**
* @param owner Owner of the new NFT
*/
mintNFT: (owner: string, tokenId: string) => Promise<any>;
mintNFT: (owner: string, tokenId: string) => Promise<unknown>;
/**
* @param owner Owner of the created loan
*/
Expand Down
16 changes: 9 additions & 7 deletions dist/Tinlake.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -34724,14 +34724,16 @@ var Tinlake = /** @class */ (function () {
* @param owner Owner of the new NFT
*/
this.mintNFT = function (owner, tokenId) { return __awaiter(_this, void 0, void 0, function () {
var tkn;
var _this = this;
var tkn, txHash;
return __generator(this, function (_a) {
tkn = abiCoder$1.encodeParameter('uint', tokenId);
return [2 /*return*/, this.contracts.nft.mint(owner, tkn, this.ethConfig).then(function (txHash) {
console.log("[NFT.mint] txHash: " + txHash);
return waitAndReturnEvents(_this.eth, txHash, _this.contracts['nft'].abi, _this.transactionTimeout);
})];
switch (_a.label) {
case 0:
tkn = abiCoder$1.encodeParameter('uint', tokenId);
return [4 /*yield*/, this.contracts.nft.mint(owner, tkn, this.ethConfig)];
case 1:
txHash = _a.sent();
return [2 /*return*/, waitAndReturnEvents(this.eth, txHash, this.contracts['nft'].abi, this.transactionTimeout)];
}
});
}); };
/**
Expand Down
16 changes: 9 additions & 7 deletions dist/Tinlake.js
Original file line number Diff line number Diff line change
Expand Up @@ -34730,14 +34730,16 @@ var Tinlake = /** @class */ (function () {
* @param owner Owner of the new NFT
*/
this.mintNFT = function (owner, tokenId) { return __awaiter(_this, void 0, void 0, function () {
var tkn;
var _this = this;
var tkn, txHash;
return __generator(this, function (_a) {
tkn = abiCoder$1.encodeParameter('uint', tokenId);
return [2 /*return*/, this.contracts.nft.mint(owner, tkn, this.ethConfig).then(function (txHash) {
console.log("[NFT.mint] txHash: " + txHash);
return waitAndReturnEvents(_this.eth, txHash, _this.contracts['nft'].abi, _this.transactionTimeout);
})];
switch (_a.label) {
case 0:
tkn = abiCoder$1.encodeParameter('uint', tokenId);
return [4 /*yield*/, this.contracts.nft.mint(owner, tkn, this.ethConfig)];
case 1:
txHash = _a.sent();
return [2 /*return*/, waitAndReturnEvents(this.eth, txHash, this.contracts['nft'].abi, this.transactionTimeout)];
}
});
}); };
/**
Expand Down
7 changes: 2 additions & 5 deletions src/Tinlake.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,9 @@ export class Tinlake {
*/
mintNFT = async (owner: string, tokenId: string) => {
const tkn = abiCoder.encodeParameter('uint', tokenId)
return this.contracts.nft.mint(owner, tkn, this.ethConfig).then((txHash: string) => {
console.log(`[NFT.mint] txHash: ${txHash}`);
return waitAndReturnEvents(this.eth, txHash, this.contracts['nft'].abi, this.transactionTimeout);
});
const txHash = await this.contracts.nft.mint(owner, tkn, this.ethConfig);
return waitAndReturnEvents(this.eth, txHash, this.contracts['nft'].abi, this.transactionTimeout);
}

/**
* @param owner Owner of the created loan
*/
Expand Down

0 comments on commit e9c0144

Please sign in to comment.