Skip to content

Commit 2ee7fcf

Browse files
committed
build: fix typescript build step
it should output js and d.ts to root, not dist
1 parent e6f0f5d commit 2ee7fcf

File tree

6 files changed

+58
-144
lines changed

6 files changed

+58
-144
lines changed

dist/index.d.ts

Lines changed: 0 additions & 40 deletions
This file was deleted.

dist/index.js

Lines changed: 0 additions & 40 deletions
This file was deleted.

index.d.ts

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,39 @@
1-
import { Signer } from "@ethersproject/abstract-signer";
2-
import { Provider } from "@ethersproject/providers";
3-
import type { DATAv2 } from "./typechain/DATAv2";
1+
import { Provider, Signer } from "ethers";
2+
import type { DATAv2 } from "./typechain/contracts/DATAv2";
43
export declare const abi: ({
4+
inputs: never[];
5+
stateMutability: string;
56
type: string;
7+
anonymous?: undefined;
8+
name?: undefined;
9+
outputs?: undefined;
10+
} | {
11+
anonymous: boolean;
612
inputs: {
7-
indexed?: boolean; // events
13+
indexed: boolean;
814
internalType: string;
915
name: string;
1016
type: string;
1117
}[];
12-
name?: string; // constructor doesn't have name
13-
stateMutability?: string;
14-
anonymous?: boolean; // events
15-
outputs?: {
18+
name: string;
19+
type: string;
20+
stateMutability?: undefined;
21+
outputs?: undefined;
22+
} | {
23+
inputs: {
1624
internalType: string;
1725
name: string;
1826
type: string;
1927
}[];
28+
name: string;
29+
outputs: {
30+
internalType: string;
31+
name: string;
32+
type: string;
33+
}[];
34+
stateMutability: string;
35+
type: string;
36+
anonymous?: undefined;
2037
})[], bytecode: string;
2138
export type { DATAv2 };
2239
export declare function getTokenAt(address: string, signerOrProvider: Provider | Signer): DATAv2;

index.js

Lines changed: 30 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,40 @@
11
"use strict";
2-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4-
return new (P || (P = Promise))(function (resolve, reject) {
5-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8-
step((generator = generator.apply(thisArg, _arguments || [])).next());
9-
});
10-
};
11-
var __generator = (this && this.__generator) || function (thisArg, body) {
12-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14-
function verb(n) { return function (v) { return step([n, v]); }; }
15-
function step(op) {
16-
if (f) throw new TypeError("Generator is already executing.");
17-
while (_) try {
18-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19-
if (y = 0, t) op = [op[0] & 2, t.value];
20-
switch (op[0]) {
21-
case 0: case 1: t = op; break;
22-
case 4: _.label++; return { value: op[1], done: false };
23-
case 5: _.label++; y = op[1]; op = [0]; continue;
24-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
25-
default:
26-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30-
if (t[2]) _.ops.pop();
31-
_.trys.pop(); continue;
32-
}
33-
op = body.call(thisArg, _);
34-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
2+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3+
if (k2 === undefined) k2 = k;
4+
var desc = Object.getOwnPropertyDescriptor(m, k);
5+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6+
desc = { enumerable: true, get: function() { return m[k]; } };
367
}
8+
Object.defineProperty(o, k2, desc);
9+
}) : (function(o, m, k, k2) {
10+
if (k2 === undefined) k2 = k;
11+
o[k2] = m[k];
12+
}));
13+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14+
Object.defineProperty(o, "default", { enumerable: true, value: v });
15+
}) : function(o, v) {
16+
o["default"] = v;
17+
});
18+
var __importStar = (this && this.__importStar) || function (mod) {
19+
if (mod && mod.__esModule) return mod;
20+
var result = {};
21+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22+
__setModuleDefault(result, mod);
23+
return result;
3724
};
38-
exports.__esModule = true;
25+
Object.defineProperty(exports, "__esModule", { value: true });
3926
exports.deployToken = exports.getTokenAt = exports.bytecode = exports.abi = void 0;
40-
var contracts_1 = require("@ethersproject/contracts");
41-
var dataV2json = require("./artifacts/contracts/DATAv2.sol/DATAv2.json");
27+
const ethers_1 = require("ethers");
28+
const dataV2json = __importStar(require("./artifacts/contracts/DATAv2.sol/DATAv2.json"));
4229
exports.abi = dataV2json.abi, exports.bytecode = dataV2json.bytecode;
4330
function getTokenAt(address, signerOrProvider) {
44-
return new contracts_1.Contract(address, exports.abi, signerOrProvider);
31+
return new ethers_1.Contract(address, exports.abi, signerOrProvider);
4532
}
4633
exports.getTokenAt = getTokenAt;
47-
function deployToken(signer) {
48-
return __awaiter(this, void 0, void 0, function () {
49-
var factory, contract;
50-
return __generator(this, function (_a) {
51-
switch (_a.label) {
52-
case 0:
53-
factory = new contracts_1.ContractFactory(exports.abi, exports.bytecode, signer);
54-
return [4 /*yield*/, factory.deploy()];
55-
case 1:
56-
contract = _a.sent();
57-
return [2 /*return*/, contract.waitForDeployment()];
58-
}
59-
});
60-
});
34+
async function deployToken(signer) {
35+
const factory = new ethers_1.ContractFactory(exports.abi, exports.bytecode, signer);
36+
const contract = await factory.deploy();
37+
await contract.waitForDeployment();
38+
return contract;
6139
}
6240
exports.deployToken = deployToken;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
],
1111
"scripts": {
1212
"lint": "eslint",
13-
"clean": "rm -rf cache artifacts coverage typechain",
13+
"clean": "rm -rf cache artifacts coverage typechain index.js index.d.ts",
1414
"test": "hardhat test",
1515
"build": "hardhat compile && tsc -p tsconfig.build.json",
1616
"cov": "hardhat coverage"

tsconfig.build.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
"skipLibCheck": true,
1212
"forceConsistentCasingInFileNames": true,
1313
"resolveJsonModule": true,
14-
"declaration": true,
15-
"outDir": "dist"
14+
"declaration": true
1615
},
1716
"include": ["./index.ts"]
18-
}
17+
}

0 commit comments

Comments
 (0)