Skip to content

Commit

Permalink
Switch to Typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
Youngjoon Lee committed Sep 21, 2020
1 parent 5120f0c commit 5e3c018
Show file tree
Hide file tree
Showing 76 changed files with 6,491 additions and 7,613 deletions.
14 changes: 0 additions & 14 deletions .babelrc

This file was deleted.

11 changes: 0 additions & 11 deletions .eslintrc

This file was deleted.

23 changes: 23 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
],
rules: {
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/no-namespace': 'off',
'no-inner-declarations': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-ts-ignore': 'off',
'@typescript-eslint/no-var-requires': 'off',
},
env: {
node: true,
jest: true,
}
};
13 changes: 6 additions & 7 deletions example/did.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// eslint-disable-next-line import/extensions
import panaceajs from '../lib/index.js';
import panaceajs from '../dist/src/index.js';

const txBroadcastMode = 'block';
const chainId = 'testing';
Expand Down Expand Up @@ -40,7 +39,7 @@ async function createDID(account, keystore) {
const msg = new panaceajs.Message.DID.CreateDID({
did: didDoc.id,
document: didDoc,
sigKeyId: didDoc.publicKey[0].id,
verificationMethodId: didDoc.verificationMethod[0].id,
signature: sig,
fromAddress: account.address,
});
Expand Down Expand Up @@ -79,7 +78,7 @@ async function updateDID(account, keystore, did, keyId, newDoc) {
const msg = new panaceajs.Message.DID.UpdateDID({
did,
document: newDoc,
sigKeyId: keyId,
verificationMethodId: keyId,
signature: sig,
fromAddress: account.address,
});
Expand Down Expand Up @@ -111,7 +110,7 @@ async function deactivateDID(account, keystore, did, keyId) {

const msg = new panaceajs.Message.DID.DeactivateDID({
did,
sigKeyId: keyId,
verificationMethodId: keyId,
signature: sig,
fromAddress: account.address,
});
Expand All @@ -134,9 +133,9 @@ async function main() {
const doc = await getDID(did);
console.log(doc);

const keyId = doc.publicKey[0].id;
const keyId = doc.verificationMethod[0].id;
const newDoc = doc;
newDoc.authentication.push(keyId); // just for testing, push the same keyId again.
newDoc.authentication.push(newDoc.authentication[0]); // just for testing, push the same authentication again
await updateDID(account, keystore, did, keyId, newDoc);
console.log(await getDID(did));

Expand Down
Empty file removed index.js
Empty file.
6 changes: 6 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
rootDir: 'test',
testRegex: '.ts$'
};
Loading

0 comments on commit 5e3c018

Please sign in to comment.