Skip to content

Commit

Permalink
feat: add TypeScript declaration files for ABI, config, and types; up…
Browse files Browse the repository at this point in the history
…date package version to 1.1.1
  • Loading branch information
truethari committed Dec 16, 2024
1 parent 7ddcf4d commit aa9cfa8
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 44 deletions.
4 changes: 4 additions & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { methods, defaultContractAddress, defaultABI } from "./src/ABI";
import type { IEthersError, IExtendedConfig } from "./src/types";
declare const getTimestamp: (_config?: IExtendedConfig) => Promise<number>, encryptMessage: (message: string, timestamp: number, _config?: IExtendedConfig) => Promise<any>, decryptMessage: (encryptedMessage: string, _config?: IExtendedConfig) => Promise<any>, isActive: (encryptedMsg: string, _config?: IExtendedConfig) => Promise<any>, whenActive: (encryptedMsg: string, _config?: IExtendedConfig) => Promise<number>;
export { methods as default, getTimestamp, encryptMessage, decryptMessage, isActive, whenActive, defaultABI, defaultContractAddress, type IEthersError, type IExtendedConfig, };
2 changes: 2 additions & 0 deletions dist/jest.config.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export let preset: string;
export let testEnvironment: string;
21 changes: 21 additions & 0 deletions dist/src/ABI/abi.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export declare const v1_0: ({
inputs: never[];
stateMutability: string;
type: string;
name?: undefined;
outputs?: undefined;
} | {
inputs: {
internalType: string;
name: string;
type: string;
}[];
name: string;
outputs: {
internalType: string;
name: string;
type: string;
}[];
stateMutability: string;
type: string;
})[];
30 changes: 30 additions & 0 deletions dist/src/ABI/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import type { IExtendedConfig } from "../types";
export declare const defaultABI: ({
inputs: never[];
stateMutability: string;
type: string;
name?: undefined;
outputs?: undefined;
} | {
inputs: {
internalType: string;
name: string;
type: string;
}[];
name: string;
outputs: {
internalType: string;
name: string;
type: string;
}[];
stateMutability: string;
type: string;
})[];
export declare const defaultContractAddress: string;
export declare const methods: {
getTimestamp: (_config?: IExtendedConfig) => Promise<number>;
encryptMessage: (message: string, timestamp: number, _config?: IExtendedConfig) => Promise<any>;
decryptMessage: (encryptedMessage: string, _config?: IExtendedConfig) => Promise<any>;
isActive: (encryptedMsg: string, _config?: IExtendedConfig) => Promise<any>;
whenActive: (encryptedMsg: string, _config?: IExtendedConfig) => Promise<number>;
};
6 changes: 6 additions & 0 deletions dist/src/config/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
declare const config: {
RPC_URL: string;
CHAIN_ID: number;
CONTRACT_ADDRESS: string;
};
export default config;
13 changes: 13 additions & 0 deletions dist/src/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { InterfaceAbi, JsonRpcProvider } from "ethers";
export interface IExtendedConfig {
provider?: JsonRpcProvider;
contractAddress?: string;
rpcUrl?: string;
abi?: InterfaceAbi;
}
export interface IEthersError {
message: string;
revert: {
args: string[];
};
}
43 changes: 0 additions & 43 deletions dist/test/modules.test.js

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "timecipher",
"discription": "TimeCipher is a blockchain-based time-locked messaging system that securely encrypts messages with a timestamp, ensuring they can only be decrypted after the specified time. This innovative solution combines privacy and delayed access, perfect for secure future communication.",
"version": "1.1.0",
"version": "1.1.1",
"keywords": [
"timecipher",
"blockchain",
Expand Down
2 changes: 2 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"outDir": "./dist",
"moduleDetection": "force",
"allowJs": true,
"declaration": true,
"emitDeclarationOnly": true,

// Best practices
"skipLibCheck": true,
Expand Down

0 comments on commit aa9cfa8

Please sign in to comment.